Skip to content

Commit

Permalink
add progress bar plugin support
Browse files Browse the repository at this point in the history
  • Loading branch information
yassinefikri committed Aug 7, 2023
1 parent 670a37a commit cf3371a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Swup/assets/dist/controller.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default class extends Controller {
readonly hasLinkSelectorValue: boolean;
readonly themeValue: string;
readonly debugValue: boolean;
readonly useProgressBarValue: boolean;
static values: {
animateHistoryBrowsing: BooleanConstructor;
animationSelector: StringConstructor;
Expand All @@ -22,6 +23,7 @@ export default class extends Controller {
theme: StringConstructor;
debug: BooleanConstructor;
mainElement: StringConstructor;
useProgressBar: BooleanConstructor;
};
connect(): void;
private dispatchEvent;
Expand Down
5 changes: 5 additions & 0 deletions src/Swup/assets/dist/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import SwupDebugPlugin from '@swup/debug-plugin';
import SwupFormsPlugin from '@swup/forms-plugin';
import SwupFadeTheme from '@swup/fade-theme';
import SwupSlideTheme from '@swup/slide-theme';
import SwupProgressPlugin from '@swup/progress-plugin';

class default_1 extends Controller {
connect() {
Expand Down Expand Up @@ -40,6 +41,9 @@ class default_1 extends Controller {
if (this.debugValue) {
options.plugins.push(new SwupDebugPlugin());
}
if (this.useProgressBarValue) {
options.plugins.push(new SwupProgressPlugin());
}
this.dispatchEvent('pre-connect', { options });
const swup = new Swup(options);
this.dispatchEvent('connect', { swup, options });
Expand All @@ -57,6 +61,7 @@ default_1.values = {
theme: String,
debug: Boolean,
mainElement: String,
useProgressBar: Boolean,
};

export { default_1 as default };
3 changes: 3 additions & 0 deletions src/Swup/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@swup/fade-theme": "^1.0",
"@swup/slide-theme": "^1.0",
"@swup/forms-plugin": "^1.0||^2.0",
"@swup/progress-plugin": "^1.0||^2.0",
"@swup/debug-plugin": "^1.0||^2.0||^3.0",
"swup": "^2.0||^3.0",
"@hotwired/stimulus": "^3.0.0"
Expand All @@ -27,6 +28,7 @@
"@swup/fade-theme": "^1.0",
"@swup/slide-theme": "^1.0",
"@swup/forms-plugin": "^1.0||^2.0",
"@swup/progress-plugin": "^1.0||^2.0",
"@swup/debug-plugin": "^1.0||^2.0||^3.0",
"swup": "^2.0||^3.0",
"@hotwired/stimulus": "^3.0.0"
Expand All @@ -35,6 +37,7 @@
"@swup/fade-theme": "^1.0",
"@swup/slide-theme": "^1.0",
"@swup/forms-plugin": "^1.0",
"@swup/progress-plugin": "^1.0||^2.0",
"@swup/debug-plugin": "^1.0",
"swup": "^2.0",
"@hotwired/stimulus": "^3.0.0"
Expand Down
6 changes: 6 additions & 0 deletions src/Swup/assets/src/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import SwupDebugPlugin from '@swup/debug-plugin';
import SwupFormsPlugin from '@swup/forms-plugin';
import SwupFadeTheme from '@swup/fade-theme';
import SwupSlideTheme from '@swup/slide-theme';
import SwupProgressPlugin from '@swup/progress-plugin';

export default class extends Controller {
declare readonly animateHistoryBrowsingValue: boolean;
Expand All @@ -30,6 +31,7 @@ export default class extends Controller {
declare readonly hasLinkSelectorValue: boolean;
declare readonly themeValue: string;
declare readonly debugValue: boolean;
declare readonly useProgressBarValue: boolean;

static values = {
animateHistoryBrowsing: Boolean,
Expand All @@ -42,6 +44,7 @@ export default class extends Controller {
theme: String,
debug: Boolean,
mainElement: String,
useProgressBar: Boolean,
};

connect() {
Expand Down Expand Up @@ -81,6 +84,9 @@ export default class extends Controller {
if (this.debugValue) {
options.plugins.push(new SwupDebugPlugin());
}
if (this.useProgressBarValue) {
options.plugins.push(new SwupProgressPlugin());
}

this.dispatchEvent('pre-connect', { options });

Expand Down
1 change: 1 addition & 0 deletions src/Swup/assets/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ declare module '@swup/debug-plugin';
declare module '@swup/forms-plugin';
declare module '@swup/fade-theme';
declare module '@swup/slide-theme';
declare module '@swup/progress-plugin';

0 comments on commit cf3371a

Please sign in to comment.