Skip to content
Snippets Groups Projects
Commit 86d3367a authored by Felix Chadwick-Smith's avatar Felix Chadwick-Smith
Browse files

Initial commit

parents
No related branches found
No related tags found
1 merge request!1Master
Showing
with 687 additions and 0 deletions
For running ws
cd //c/Users//c2051326//Documents//Images
source venv/Scripts/activate
python -m flask run
File added
File added
app.py 0 → 100644
from flask import Flask, render_template, request, redirect, url_for, send_from_directory
from flask_sqlalchemy import SQLAlchemy#
from flask import abort, jsonify
app = Flask(__name__, static_folder='static')
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///site.db'
app.config['SECRET_KEY'] = 'your_secret_key' # Add a secret key
db = SQLAlchemy(app)
# Define the Project model
class Project(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(100), nullable=False)
description = db.Column(db.Text, nullable=False)
# Existing route for the home page
@app.route('/')
def home():
try:
projects = Project.query.all()
return render_template('index.html', projects=projects)
except Exception as e:
# Handle the error, log it, or render an error template
print(f"Error fetching projects: {str(e)}")
return render_template('error.html')
@app.route('/about')
def about():
return render_template('about.html')
# New route for the Experience page
@app.route('/experience')
def experience():
# Add logic to fetch data related to the Experience section if needed
return render_template('experience.html')
# New route for the Portfolio page
@app.route('/portfolio')
def portfolio():
# Add logic to fetch data related to the Portfolio section if needed
return render_template('portfolio.html')
# New route for the contact page
@app.route('/contact')
def contact():
return render_template('contact.html')
# New route for adding a project
@app.route('/add_project', methods=['GET', 'POST'])
def add_project():
if request.method == 'POST':
title = request.form['title']
description = request.form['description']
new_project = Project(title=title, description=description)
db.session.add(new_project)
db.session.commit()
return redirect(url_for('home'))
return render_template('add_project.html')
# New route for serving the my-cv.docx file
@app.route('/download_cv')
def download_cv():
file_path = 'static/my-cv.docx'
print(f"Attempting to serve file: {file_path}")
return send_from_directory('static', 'my-cv.docx', as_attachment=True, mimetype='application/docx')
@app.route('/download_assessment/<filename>')
def download_assessment(filename):
try:
file_path = f'static/{filename}'
print(f"Attempting to serve file: {file_path}")
return send_from_directory('static', filename, as_attachment=True)
except FileNotFoundError:
print(f"File not found: {file_path}")
abort(404) # Return a 404 Not Found error
except Exception as e:
print(f"Error serving assessment file: {str(e)}")
app.logger.exception(f"Error serving assessment file: {str(e)}")
abort(500)
if __name__ == '__main__':
# Create database tables
with app.app_context():
db.create_all()
app.run(debug=True)
import 0 → 100644
File added
{
"name": "Images",
"lockfileVersion": 3,
"requires": true,
"packages": {
"node_modules/@barba/core": {
"version": "2.9.7",
"resolved": "https://registry.npmjs.org/@barba/core/-/core-2.9.7.tgz",
"integrity": "sha512-GLtpty1fzWnd500AoUHd+hJoSCVElqth20P4W8Bf0IAA9nd1K5e8NbPnCegXC4KzOwV+JHk5DVofAZcoc+I54Q==",
"dependencies": {
"is-promise": "^2.1.0",
"path-to-regexp": "^3.0.0"
}
},
"node_modules/is-promise": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz",
"integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ=="
},
"node_modules/jquery": {
"version": "3.7.1",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz",
"integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg=="
},
"node_modules/path-to-regexp": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-3.2.0.tgz",
"integrity": "sha512-jczvQbCUS7XmS7o+y1aEO9OBVFeZBQ1MDSEqmO7xSoPgOPoowY/SxLpZ6Vh97/8qHZOteiCKb7gkG9gA2ZUxJA=="
}
}
}
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.9.7](https://github.com/barbajs/barba/compare/@barba/core@2.9.6...@barba/core@2.9.7) (2020-01-16)
### Bug Fixes
- **core:** :bug: fix once only transition resolved for page ([0e52e61](https://github.com/barbajs/barba/commit/0e52e616e9964ad98f28239b1341a71cf1d29f4a)), closes [#483](https://github.com/barbajs/barba/issues/483)
## [2.9.6](https://github.com/barbajs/barba/compare/@barba/core@2.9.5...@barba/core@2.9.6) (2019-12-12)
### Bug Fixes
- **core:** :bug: fix route (object) resolution ([1fb344f](https://github.com/barbajs/barba/commit/1fb344f9f07fbe58c5893b09f59d471704c0c521))
## [2.9.5](https://github.com/barbajs/barba/compare/@barba/core@2.9.4...@barba/core@2.9.5) (2019-12-09)
### Bug Fixes
- **core:** :bug: filter transition errors from request errors ([281c85f](https://github.com/barbajs/barba/commit/281c85fc7bbaf3d51ee58653468c48b2404152ea)), closes [#475](https://github.com/barbajs/barba/issues/475)
## [2.9.4](https://github.com/barbajs/barba/compare/@barba/core@2.9.3...@barba/core@2.9.4) (2019-12-09)
### Bug Fixes
- **core:** :bug: fix cache management with ignore option ([d801813](https://github.com/barbajs/barba/commit/d801813976a130d41b3261e7de8f0bcdf5dcd581)), closes [#470](https://github.com/barbajs/barba/issues/470)
## [2.9.3](https://github.com/barbajs/barba/compare/@barba/core@2.9.2...@barba/core@2.9.3) (2019-12-09)
### Bug Fixes
- **core:** :recycle: refactor history states ([08c83b8](https://github.com/barbajs/barba/commit/08c83b857d8ab3f7826631968afaabf76e1a2e87)), closes [#473](https://github.com/barbajs/barba/issues/473) [#472](https://github.com/barbajs/barba/issues/472)
## [2.9.2](https://github.com/barbajs/barba/compare/@barba/core@2.9.1...@barba/core@2.9.2) (2019-11-25)
### Bug Fixes
- **root:** :art: improve typings for TS ([48f0637](https://github.com/barbajs/barba/commit/48f0637))
## [2.9.1](https://github.com/barbajs/barba/compare/@barba/core@2.9.0...@barba/core@2.9.1) (2019-11-25)
### Bug Fixes
- **core:** :rotating_light: fix TS errors, improve TS defs ([a48acd2](https://github.com/barbajs/barba/commit/a48acd2)), closes [#468](https://github.com/barbajs/barba/issues/468)
# [2.9.0](https://github.com/barbajs/barba/compare/@barba/core@2.8.0...@barba/core@2.9.0) (2019-11-25)
### Bug Fixes
- **core:** :bug: hooks: context can not be undefined ([f6bb536](https://github.com/barbajs/barba/commit/f6bb536)), closes [#468](https://github.com/barbajs/barba/issues/468)
### Features
- **core:** :sparkles: add replace history via data-attribute ([272a43f](https://github.com/barbajs/barba/commit/272a43f)), closes [#460](https://github.com/barbajs/barba/issues/460)
# [2.8.0](https://github.com/barbajs/barba/compare/@barba/core@2.7.2...@barba/core@2.8.0) (2019-11-06)
### Bug Fixes
- **core:** :bug: compare ports for sameUrl prevent check ([e2a84e4](https://github.com/barbajs/barba/commit/e2a84e4)), closes [#463](https://github.com/barbajs/barba/issues/463)
- **core:** :bug: popstate with unknown state (null) ([3369633](https://github.com/barbajs/barba/commit/3369633)), closes [#456](https://github.com/barbajs/barba/issues/456) [#466](https://github.com/barbajs/barba/issues/466)
- **core:** :ok_hand: resolve once transitions ([20cafe1](https://github.com/barbajs/barba/commit/20cafe1)), closes [#439](https://github.com/barbajs/barba/issues/439)
### Features
- **core:** :loud_sound: add/improve error logs ([e67a17b](https://github.com/barbajs/barba/commit/e67a17b)), closes [#447](https://github.com/barbajs/barba/issues/447)
## [2.7.2](https://github.com/barbajs/barba/compare/@barba/core@2.7.1...@barba/core@2.7.2) (2019-11-05)
### Bug Fixes
- **core:** :heavy_minus_sign: remove 'path' for URL resolution ([3875d0c](https://github.com/barbajs/barba/commit/3875d0c)), closes [#465](https://github.com/barbajs/barba/issues/465)
- **root:** :bug: fix context for views and add to transitions ([9054673](https://github.com/barbajs/barba/commit/9054673)), closes [#467](https://github.com/barbajs/barba/issues/467)
## [2.7.1](https://github.com/barbajs/barba/compare/@barba/core@2.7.0...@barba/core@2.7.1) (2019-10-27)
**Note:** Version bump only for package @barba/core
# [2.7.0](https://github.com/barbajs/barba/compare/@barba/core@2.6.1...@barba/core@2.7.0) (2019-10-27)
### Bug Fixes
- **core:** :bug: fix container + dom sibling insertion ([7f349a7](https://github.com/barbajs/barba/commit/7f349a7)), closes [#449](https://github.com/barbajs/barba/issues/449)
- **core:** :ok_hand: move after hooks ([42742ea](https://github.com/barbajs/barba/commit/42742ea)), closes [#455](https://github.com/barbajs/barba/issues/455)
### Features
- **core:** :sparkles: add preventRunning option ([93f0b50](https://github.com/barbajs/barba/commit/93f0b50)), closes [#414](https://github.com/barbajs/barba/issues/414)
## [2.6.1](https://github.com/barbajs/barba/compare/@barba/core@2.6.0...@barba/core@2.6.1) (2019-10-22)
### Bug Fixes
- **core:** :ambulance: fix URL with query/hash ([f5e639c](https://github.com/barbajs/barba/commit/f5e639c)), closes [#445](https://github.com/barbajs/barba/issues/445)
- **core:** :recycle: improve url/href/path management ([159afdc](https://github.com/barbajs/barba/commit/159afdc))
# [2.6.0](https://github.com/barbajs/barba/compare/@barba/core@2.5.1...@barba/core@2.6.0) (2019-08-22)
### Features
- **core:** :alembic: store scroll position in history ([0fb28e2](https://github.com/barbajs/barba/commit/0fb28e2))
## [2.5.1](https://github.com/barbajs/barba/compare/@barba/core@2.5.0...@barba/core@2.5.1) (2019-08-22)
### Bug Fixes
- **core:** :bug: keep container position ([5482154](https://github.com/barbajs/barba/commit/5482154))
# [2.5.0](https://github.com/barbajs/barba/compare/@barba/core@2.4.0...@barba/core@2.5.0) (2019-08-22)
### Features
- **core:** :ok_hand: replace popstate with back/forward ([c665052](https://github.com/barbajs/barba/commit/c665052))
# [2.4.0](https://github.com/barbajs/barba/compare/@barba/core@2.3.16...@barba/core@2.4.0) (2019-08-02)
### Features
- **core:** :sparkles: add history size ([3b8d7fd](https://github.com/barbajs/barba/commit/3b8d7fd))
## [2.3.16](https://github.com/barbajs/barba/compare/@barba/core@2.3.15...@barba/core@2.3.16) (2019-08-01)
### Bug Fixes
- **core:** :bug: Fix global hooks (before|afterEnter) on first load ([e948166](https://github.com/barbajs/barba/commit/e948166)), closes [#393](https://github.com/barbajs/barba/issues/393)
## [2.3.15](https://github.com/barbajs/barba/compare/@barba/core@2.3.14...@barba/core@2.3.15) (2019-07-17)
### Bug Fixes
- **core:** :ok_hand: view hook on page load ([c631b54](https://github.com/barbajs/barba/commit/c631b54)), closes [#393](https://github.com/barbajs/barba/issues/393)
## [2.3.14](https://github.com/barbajs/barba/compare/@barba/core@2.3.13...@barba/core@2.3.14) (2019-07-16)
### Bug Fixes
- **root:** :mute: remove print version ([be5aa73](https://github.com/barbajs/barba/commit/be5aa73)), closes [#415](https://github.com/barbajs/barba/issues/415)
## [2.3.13](https://github.com/barbajs/barba/compare/@barba/core@2.3.12...@barba/core@2.3.13) (2019-07-16)
### Bug Fixes
- **core:** :bug: Clean url extend ([7667a8d](https://github.com/barbajs/barba/commit/7667a8d))
- **core:** :bug: fix link with no href attribute ([e434ecb](https://github.com/barbajs/barba/commit/e434ecb))
## [2.3.12](https://github.com/barbajs/barba/compare/@barba/core@2.3.11...@barba/core@2.3.12) (2019-06-26)
### Bug Fixes
- **core:** :ok_hand: improve support of SVG links ([19e7e5d](https://github.com/barbajs/barba/commit/19e7e5d))
## [2.3.11](https://github.com/barbajs/barba/compare/@barba/core@2.3.10...@barba/core@2.3.11) (2019-06-25)
### Bug Fixes
- **core:** :bug: make page hook async ([10e66d9](https://github.com/barbajs/barba/commit/10e66d9))
## [2.3.10](https://github.com/barbajs/barba/compare/@barba/core@2.3.9...@barba/core@2.3.10) (2019-06-11)
### Bug Fixes
- **core:** :bug: remove "force repaint" when new container is added ([5a34322](https://github.com/barbajs/barba/commit/5a34322))
- **core:** :construction: fix "glitch" when new container added ([1286bf9](https://github.com/barbajs/barba/commit/1286bf9))
## [2.3.9](https://github.com/barbajs/barba/compare/@barba/core@2.3.8...@barba/core@2.3.9) (2019-04-29)
**Note:** Version bump only for package @barba/core
## [2.3.8](https://github.com/barbajs/barba/compare/@barba/core@2.3.7...@barba/core@2.3.8) (2019-04-29)
### Bug Fixes
- **core:** :bug: fix sameUrl with query params ([fa79a6a](https://github.com/barbajs/barba/commit/fa79a6a)), closes [#389](https://github.com/barbajs/barba/issues/389)
## [2.3.7](https://github.com/barbajs/barba/compare/@barba/core@2.3.6...@barba/core@2.3.7) (2019-04-29)
### Bug Fixes
- **core:** :bug: fix glitch on containers add/remove ([374660c](https://github.com/barbajs/barba/commit/374660c))
## [2.3.6](https://github.com/barbajs/barba/compare/@barba/core@2.3.5...@barba/core@2.3.6) (2019-04-29)
**Note:** Version bump only for package @barba/core
## [2.3.5](https://github.com/barbajs/barba/compare/@barba/core@2.3.4...@barba/core@2.3.5) (2019-04-29)
### Bug Fixes
- **core:** :construction: fix history ([36d3393](https://github.com/barbajs/barba/commit/36d3393))
## [2.3.4](https://github.com/barbajs/barba/compare/@barba/core@2.3.3...@barba/core@2.3.4) (2019-04-29)
### Bug Fixes
- **core:** :bug: fix object rule with no value ([4014fd8](https://github.com/barbajs/barba/commit/4014fd8))
## [2.3.3](https://github.com/barbajs/barba/compare/@barba/core@2.3.2...@barba/core@2.3.3) (2019-04-23)
### Bug Fixes
- **core:** :bug: update title with "next" ([f8c1940](https://github.com/barbajs/barba/commit/f8c1940)), closes [#384](https://github.com/barbajs/barba/issues/384)
## [2.3.2](https://github.com/barbajs/barba/compare/@barba/core@2.3.1...@barba/core@2.3.2) (2019-04-20)
### Bug Fixes
- **core:** :bug: remove current container at the end ([f6fab91](https://github.com/barbajs/barba/commit/f6fab91))
## [2.3.1](https://github.com/barbajs/barba/compare/@barba/core@2.3.0...@barba/core@2.3.1) (2019-04-16)
### Bug Fixes
- **core:** :bug: do not cache rendered HTML ([0cc4b86](https://github.com/barbajs/barba/commit/0cc4b86)), closes [#383](https://github.com/barbajs/barba/issues/383)
# [2.3.0](https://github.com/barbajs/barba/compare/@barba/core@2.2.0...@barba/core@2.3.0) (2019-04-14)
### Features
- **core:** :sparkles: add programmatically prefetch ([7b95ffd](https://github.com/barbajs/barba/commit/7b95ffd))
# [2.2.0](https://github.com/barbajs/barba/compare/@barba/core@2.1.3...@barba/core@2.2.0) (2019-04-14)
### Features
- **core:** :art: allow global hooks to be asynchronous ([be5dccf](https://github.com/barbajs/barba/commit/be5dccf))
## [2.1.3](https://github.com/barbajs/barba/compare/@barba/core@2.1.2...@barba/core@2.1.3) (2019-04-13)
### Bug Fixes
- **core:** :loud_sound: print version ([24dd2ea](https://github.com/barbajs/barba/commit/24dd2ea))
### Reverts
- **root:** :bug: revert failed release ([2b8a1ef](https://github.com/barbajs/barba/commit/2b8a1ef))
## [2.1.3](https://github.com/barbajs/barba/compare/@barba/core@2.1.2...@barba/core@2.1.3) (2019-04-13)
### Bug Fixes
- **core:** :loud_sound: print version ([24dd2ea](https://github.com/barbajs/barba/commit/24dd2ea))
## [2.1.2](https://github.com/barbajs/barba/compare/@barba/core@2.1.1...@barba/core@2.1.2) (2019-04-13)
### Bug Fixes
- **core:** :mute: remove debug logs ([f4ce952](https://github.com/barbajs/barba/commit/f4ce952))
## [2.1.1](https://github.com/barbajs/barba/compare/@barba/core@2.1.0...@barba/core@2.1.1) (2019-04-13)
### Bug Fixes
- **core:** :bug: fix cache not working ([a01e122](https://github.com/barbajs/barba/commit/a01e122))
- **core:** :bug: fix hook order ([716b062](https://github.com/barbajs/barba/commit/716b062))
- **core:** :bug: fix hooks order in sync mode true ([b3c92d1](https://github.com/barbajs/barba/commit/b3c92d1))
- **core:** :bug: fix popstate navigation ([f78ee11](https://github.com/barbajs/barba/commit/f78ee11)), closes [#359](https://github.com/barbajs/barba/issues/359)
- **core:** :bug: fix sameUrl + anchors ([039f5d9](https://github.com/barbajs/barba/commit/039f5d9)), closes [#359](https://github.com/barbajs/barba/issues/359)
- **core:** :bug: fix timeout error ([70b7805](https://github.com/barbajs/barba/commit/70b7805)), closes [#373](https://github.com/barbajs/barba/issues/373)
- **core:** :bug: fix view.beforeEnter on barba ready ([5a09470](https://github.com/barbajs/barba/commit/5a09470)), closes [#360](https://github.com/barbajs/barba/issues/360)
- **core:** :bug: fix wrong combo namespace / view hooks ([3c775a3](https://github.com/barbajs/barba/commit/3c775a3)), closes [#351](https://github.com/barbajs/barba/issues/351)
- **core:** :checkered_flag: fix InvalidStateError on IE ([b9eece9](https://github.com/barbajs/barba/commit/b9eece9)), closes [#371](https://github.com/barbajs/barba/issues/371)
- **core:** :green_apple: fix img[srcset] parsing ([8afe945](https://github.com/barbajs/barba/commit/8afe945)), closes [#362](https://github.com/barbajs/barba/issues/362)
- **core:** :ok_hand: add Accept header ([94962ef](https://github.com/barbajs/barba/commit/94962ef))
- **core:** :ok_hand: fix `beforeEnter` view hook ([0d11e44](https://github.com/barbajs/barba/commit/0d11e44))
- **core:** :ok_hand: make main transition hooks public ([2c0cc28](https://github.com/barbajs/barba/commit/2c0cc28))
- **core:** :ok_hand: make onRequestError public ([61193ad](https://github.com/barbajs/barba/commit/61193ad))
# 2.1.0 (2019-03-17)
### Bug Fixes
- **core:** :bug: append next container correctly on sync mode ([dc62bd3](https://github.com/barbajs/barba/commit/dc62bd3)), closes [#4](https://github.com/barbajs/barba/issues/4)
- **core:** :bug: fix `xlink:href` with SVG ([19ecd81](https://github.com/barbajs/barba/commit/19ecd81)), closes [#1](https://github.com/barbajs/barba/issues/1)
- **css:** :bug: fix css with next tick ([63642bf](https://github.com/barbajs/barba/commit/63642bf))
- **prefetch:** :bug: fix requestError ([33c213b](https://github.com/barbajs/barba/commit/33c213b))
- **root:** :bug: force publish ([ddb8798](https://github.com/barbajs/barba/commit/ddb8798))
- **root:** :ok_hand: replace error with warning when no transition ([661801e](https://github.com/barbajs/barba/commit/661801e))
- :bug: fix case issues ([c6adcb3](https://github.com/barbajs/barba/commit/c6adcb3))
### Features
- **core:** :sparkles: add prevent custom + update README ([2fb4ec6](https://github.com/barbajs/barba/commit/2fb4ec6))
- **css:** :recycle: add transitionend logic + big refactoring ([b775358](https://github.com/barbajs/barba/commit/b775358))
- **css:** :tada: initial commit ([aed8206](https://github.com/barbajs/barba/commit/aed8206))
- **root:** :sparkles: add logger + fixes ([6db3875](https://github.com/barbajs/barba/commit/6db3875))
- **router:** :sparkles: add multiple properties to `route` ([4e92c83](https://github.com/barbajs/barba/commit/4e92c83))
MIT License
Copyright (c) 2018 Luigi De Rosa, Thierry Michel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# @barba/core
[![NPM version](https://img.shields.io/npm/v/@barba/core?style=flat-square)](https://www.npmjs.com/package/@barba/core)
[![Dependencies](https://img.shields.io/librariesio/release/npm/@barba/core?style=flat-square)](https://github.com/barbajs/barba/network/dependencies)
> TBD ([GitHub repo](https://github.com/barbajs/barba.js))
## Install
Using npm:
```sh
npm install --save-dev @barba/core
```
or using yarn:
```sh
yarn add @barba/core --dev
```
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/**
* @barba/core
* <br><br>
* ## Barba core object
*
* Main methods:
*
* - `.init()` for initialization with options
* - `.use()` for plugins
*
* @module core
*/
import { IBarbaOptions, IBarbaPlugin, IgnoreOption, ISchemaPage, ITransitionData, LinkEvent, Trigger } from './defs';
import { Cache } from './modules/Cache';
import { Logger } from './modules/Logger';
import { Prevent } from './modules/Prevent';
import { Transitions } from './modules/Transitions';
import { Views } from './modules/Views';
import './polyfills';
import { helpers, request, url } from './utils';
export declare class Core {
/**
* Version.
*/
version: string;
/**
* Schemas.
*/
schemaPage: ISchemaPage;
/**
* Logger class, allows plugins to create Logger.
*/
Logger: typeof Logger;
/**
* Barba logger.
*/
logger: Logger;
/**
* Plugins.
*/
plugins: Array<IBarbaPlugin<any>>;
/**
* Options
*/
timeout: number;
cacheIgnore: IgnoreOption;
prefetchIgnore: IgnoreOption;
preventRunning: boolean;
/**
* Hooks
*/
hooks: import("./hooks.js").Hooks;
/**
* Modules.
*/
cache: Cache;
prevent: Prevent;
transitions: Transitions;
views: Views;
/**
* Utils.
*/
dom: import("./utils/dom.js").Dom;
helpers: typeof helpers;
history: import("./utils/history.js").History;
request: typeof request;
url: typeof url;
private _data;
private _requestCustomError;
private _wrapper;
/**
* ### Init plugin with options.
*
* See [[IBarbaPlugin]] for more details.
*/
use<T>(plugin: IBarbaPlugin<T>, options?: T): void;
/**
* ### Init barba with options.
*
* See [[IBarbaOptions]] for more details.
*
* Default values are:
*
* - transitions: `[]`
* - views: `[]`
* - schema: [[SchemaAttribute]]
* - timeout: `2e3`
* - cacheIgnore: `false`
* - prefetchIgnore: `false`
* - preventRunning: `false`
* - prevent: `null`,
* - debug: `false`
* - logLevel: `'debug'`
*/
init(
/** @ignore */ { transitions, views, schema, requestError, timeout, cacheIgnore, prefetchIgnore, preventRunning, prevent: preventCustom, debug, logLevel, }?: IBarbaOptions): void;
destroy(): void;
get data(): ITransitionData;
get wrapper(): HTMLElement;
/**
* ### Force a page change without Barba transition.
*/
force(href: string): void;
/**
* ### Go for a Barba transition.
*
* Manage "self page" href:
*
* - if same url and no self transition, keep default behavior
* - link: reload the page
* - anchor: scroll to
* - if same url with self transition, use it
* - then start a page transition.
*/
go(href: string, trigger?: Trigger, e?: LinkEvent | PopStateEvent): Promise<void>;
/**
* ### Start an "once" transition.
*
* If some registered "once" transition,
* get the "resolved" transition from the store and start it.
*/
once(readyData: ITransitionData): Promise<void>;
/**
* ### Start a "page" transition.
*
* 1. If no running transition, updates data with full URL properties and trigger.
* 2. Get page from cache or init request.
* 3. Wait if some transitions need "next" data (`sync: true`, `to: …`).
* 4. Manage the history, depending on trigger.
* 5. Get "data" and trigger "go" hook.
* 6. Get the "resolved" transition from the store and start it.
* 7. Update title and reset data (current, next = undefined).
*
* > If "self", use the "self" transition
*/
page(href: string, trigger: Trigger, self: boolean): Promise<void>;
/**
* When a request error occurs.
*
* Allow the user to manage request error. (E.g: 404)
*/
onRequestError(trigger: Trigger, ...args: any): boolean;
/**
* Programmatically prefetch
*/
prefetch(href: string): void;
/**
* Bind event listeners.
*/
private _bind;
/**
* Bind event listeners.
*/
private _unbind;
/**
* When a element is entered.
*
* Get valid link element.
* Cache URL if needed.
*/
private _onLinkEnter;
/**
* When an element is clicked.
*
* Get valid link element.
* Prevent same URL.
* Go for a Barba transition.
*/
private _onLinkClick;
/**
* When History state changes.
*
* Get "href" from URL
* Go for a Barba transition.
*/
private _onStateChange;
/**
* Get a valid link ancestor.
*
* Check for a "href" attribute.
* Then check if eligible for Barba.
*/
private _getLinkElement;
/**
* Reset pages data.
*
* Set "current" and unset "next".
*/
private _resetData;
}
declare const core: Core;
export default core;
/**
* @module typings/core
*/
import { Core } from '../core';
import { LogLevels } from '../modules/Logger';
import { IgnoreOption, ISchemaAttribute, ITransitionPage, IView, PreventCheck, RequestCustomError } from './index';
export interface IBarbaOptions {
/** Array of transitions. */
transitions?: ITransitionPage[];
/** Array of views. */
views?: IView[];
/** Request timeout. */
timeout?: number;
/** Custom request error. */
requestError?: RequestCustomError | undefined;
/** Disable cache or ignore some routes. */
cacheIgnore?: IgnoreOption;
/** Disable prefetch or ignore routes. */
prefetchIgnore?: IgnoreOption;
/** Custom prevent check. */
prevent?: PreventCheck | null;
/** Prevent click when transition is running. */
preventRunning?: boolean;
/** Custom [data-attribute]. */
schema?: ISchemaAttribute;
/** Enable debug mode. */
debug?: boolean;
/** Log level. */
logLevel?: keyof typeof LogLevels;
}
export interface IBarbaPlugin<T> {
/** Plugin version */
version: string;
/** Plugin name */
name: string;
/** Install method */
install(barba: Core, options?: T): void;
/** Init method */
init(): void;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment