swup 4.8.2 → 4.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/Swup.cjs +1 -1
- package/dist/Swup.cjs.map +1 -1
- package/dist/Swup.modern.js +1 -1
- package/dist/Swup.modern.js.map +1 -1
- package/dist/Swup.module.js +1 -1
- package/dist/Swup.module.js.map +1 -1
- package/dist/Swup.umd.js +1 -1
- package/dist/Swup.umd.js.map +1 -1
- package/dist/types/helpers/classify.d.ts.map +1 -1
- package/dist/types/helpers/delegateEvent.d.ts +1 -1
- package/dist/types/helpers/delegateEvent.d.ts.map +1 -1
- package/dist/types/helpers/getCurrentUrl.d.ts.map +1 -1
- package/dist/types/helpers/history.d.ts.map +1 -1
- package/dist/types/helpers/matchPath.d.ts.map +1 -1
- package/dist/types/modules/Cache.d.ts +1 -2
- package/dist/types/modules/Cache.d.ts.map +1 -1
- package/dist/types/modules/Visit.d.ts +4 -1
- package/dist/types/modules/Visit.d.ts.map +1 -1
- package/dist/types/modules/animatePageIn.d.ts.map +1 -1
- package/dist/types/modules/animatePageOut.d.ts.map +1 -1
- package/dist/types/modules/awaitAnimations.d.ts.map +1 -1
- package/dist/types/modules/getAnchorElement.d.ts.map +1 -1
- package/dist/types/modules/navigate.d.ts.map +1 -1
- package/dist/types/modules/plugins.d.ts +1 -1
- package/dist/types/modules/plugins.d.ts.map +1 -1
- package/dist/types/modules/renderPage.d.ts.map +1 -1
- package/dist/types/modules/replaceContent.d.ts.map +1 -1
- package/dist/types/modules/scrollToContent.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/helpers/classify.ts +1 -1
- package/src/helpers/matchPath.ts +3 -1
- package/src/modules/Cache.ts +1 -1
- package/src/modules/Visit.ts +12 -2
- package/src/modules/awaitAnimations.ts +5 -3
- package/src/modules/navigate.ts +8 -3
- package/src/modules/plugins.ts +6 -7
- package/src/utils/index.ts +2 -2
- package/src/utils.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../../../src/helpers/classify.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../../../src/helpers/classify.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,EAAE,WAAW,MAAM,KAAG,MAU1D,CAAC"}
|
|
@@ -4,5 +4,5 @@ export type DelegateEventUnsubscribe = {
|
|
|
4
4
|
destroy: () => void;
|
|
5
5
|
};
|
|
6
6
|
/** Register a delegated event listener. */
|
|
7
|
-
export declare const delegateEvent: <Selector extends string, TElement extends Element = ParseSelector<Selector, HTMLElement>, TEvent extends EventType =
|
|
7
|
+
export declare const delegateEvent: <Selector extends string, TElement extends Element = ParseSelector<Selector, HTMLElement>, TEvent extends EventType = EventType>(selector: Selector, type: TEvent, callback: DelegateEventHandler<GlobalEventHandlersEventMap[TEvent], TElement>, options?: DelegateOptions) => DelegateEventUnsubscribe;
|
|
8
8
|
//# sourceMappingURL=delegateEvent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegateEvent.d.ts","sourceRoot":"","sources":["../../../src/helpers/delegateEvent.ts"],"names":[],"mappings":"AAAA,OAAiB,EAChB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAEpE,MAAM,MAAM,wBAAwB,GAAG;IACtC,OAAO,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,2CAA2C;AAC3C,eAAO,MAAM,aAAa,GACzB,QAAQ,SAAS,MAAM,EACvB,QAAQ,SAAS,OAAO,
|
|
1
|
+
{"version":3,"file":"delegateEvent.d.ts","sourceRoot":"","sources":["../../../src/helpers/delegateEvent.ts"],"names":[],"mappings":"AAAA,OAAiB,EAChB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAEpE,MAAM,MAAM,wBAAwB,GAAG;IACtC,OAAO,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,2CAA2C;AAC3C,eAAO,MAAM,aAAa,GACzB,QAAQ,SAAS,MAAM,EACvB,QAAQ,SAAS,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE,WAAW,CAAC,EAC/D,MAAM,SAAS,SAAS,GAAG,SAAS,EAEpC,UAAU,QAAQ,EAClB,MAAM,MAAM,EACZ,UAAU,oBAAoB,CAAC,2BAA2B,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,EAC7E,UAAU,eAAe,KACvB,wBAKF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCurrentUrl.d.ts","sourceRoot":"","sources":["../../../src/helpers/getCurrentUrl.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"getCurrentUrl.d.ts","sourceRoot":"","sources":["../../../src/helpers/getCurrentUrl.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,eAAO,MAAM,aAAa,GAAI,WAAU;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,KAAG,MAEjE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/helpers/history.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE3C,iEAAiE;AACjE,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/helpers/history.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE3C,iEAAiE;AACjE,eAAO,MAAM,mBAAmB,GAAI,KAAK,MAAM,EAAE,OAAM,WAAgB,KAAG,IASzE,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,GAAI,MAAK,MAAM,GAAG,IAAW,EAAE,OAAM,WAAgB,KAAG,IAWvF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matchPath.d.ts","sourceRoot":"","sources":["../../../src/helpers/matchPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC;AAErB,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AAEvC,oFAAoF;AACpF,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"matchPath.d.ts","sourceRoot":"","sources":["../../../src/helpers/matchPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC;AAErB,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AAEvC,oFAAoF;AACpF,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,GAAG,MAAM,EAClD,MAAM,MAAM,CAAC,CAAC,CAAC,EACf,UAAU,MAAM,CAAC,CAAC,CAAC,KACjB,aAAa,CAAC,CAAC,CAYjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cache.d.ts","sourceRoot":"","sources":["../../../src/modules/Cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,
|
|
1
|
+
{"version":3,"file":"Cache.d.ts","sourceRoot":"","sources":["../../../src/modules/Cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC;AAEjC;;GAEG;AACH,qBAAa,KAAK;IACjB,0CAA0C;IAC1C,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC;IAErB,mCAAmC;IACnC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAa;gBAExC,IAAI,EAAE,IAAI;IAItB,wCAAwC;IACxC,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,wBAAwB;IACxB,IAAI,GAAG,kBAMN;IAED,8CAA8C;IAC9C,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,oEAAoE;IACpE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAMvC,mDAAmD;IACnD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS;IAOhC,gEAAgE;IAChE,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAMnC,6BAA6B;IAC7B,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIzB,uBAAuB;IACvB,KAAK,IAAI,IAAI;IAKb,iFAAiF;IACjF,KAAK,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,KAAK,OAAO,GAAG,IAAI;IAQjE,uEAAuE;IACvE,SAAS,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;CAI/C"}
|
|
@@ -88,8 +88,11 @@ export declare class Visit {
|
|
|
88
88
|
/** User-defined metadata */
|
|
89
89
|
meta: Record<string, unknown>;
|
|
90
90
|
constructor(swup: Swup, options: VisitInitOptions);
|
|
91
|
-
|
|
91
|
+
ignore(): void;
|
|
92
|
+
/** Is this visit done, i.e. completed, aborted, failed, or ignored? */
|
|
92
93
|
get done(): boolean;
|
|
94
|
+
/** Was this visit ignored by swup, i.e. left to the browser? */
|
|
95
|
+
get ignored(): boolean;
|
|
93
96
|
}
|
|
94
97
|
/** Create a new visit object. */
|
|
95
98
|
export declare function createVisit(this: Swup, options: VisitInitOptions): Visit;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Visit.d.ts","sourceRoot":"","sources":["../../../src/modules/Visit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAErE,kDAAkD;AAGlD,MAAM,WAAW,SAAS;IACzB,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAA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AI,EAAE,OAAO,EAAE,gBAAgB;IA6CjD,MAAM;IAIN,uEAAuE;IACvE,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,gEAAgE;IAChE,IAAI,OAAO,IAAI,OAAO,CAErB;CACD;AAED,iCAAiC;AACjC,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,GAAG,KAAK,CAExE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animatePageIn.d.ts","sourceRoot":"","sources":["../../../src/modules/animatePageIn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"animatePageIn.d.ts","sourceRoot":"","sources":["../../../src/modules/animatePageIn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAmB,MAAM,IAAI,EAAE,OAAO,KAAK,kBAuBpE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animatePageOut.d.ts","sourceRoot":"","sources":["../../../src/modules/animatePageOut.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"animatePageOut.d.ts","sourceRoot":"","sources":["../../../src/modules/animatePageOut.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAmB,MAAM,IAAI,EAAE,OAAO,KAAK,kBAWrE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"awaitAnimations.d.ts","sourceRoot":"","sources":["../../../src/modules/awaitAnimations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,QAAA,MAAM,UAAU,eAAe,CAAC;AAChC,QAAA,MAAM,SAAS,cAAc,CAAC;AAE9B,KAAK,aAAa,GAAG,OAAO,UAAU,GAAG,OAAO,SAAS,CAAC;AAE1D,KAAK,iBAAiB,GAAG,OAAO,GAAG,UAAU,CAAC;AAC9C,KAAK,iBAAiB,GAAG,GAAG,aAAa,GAAG,iBAAiB,EAAE,GAAG,oBAAoB,CAAC;AAEvF,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,KAAK,CAAC;AAE9C;;;GAGG;AACH,wBAAsB,eAAe,CACpC,IAAI,EAAE,IAAI,EACV,EACC,QAAQ,EACR,QAAQ,EACR,EAAE;IACF,QAAQ,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,WAAW,EAAE,CAAC;CACnD,GACC,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"awaitAnimations.d.ts","sourceRoot":"","sources":["../../../src/modules/awaitAnimations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,QAAA,MAAM,UAAU,eAAe,CAAC;AAChC,QAAA,MAAM,SAAS,cAAc,CAAC;AAE9B,KAAK,aAAa,GAAG,OAAO,UAAU,GAAG,OAAO,SAAS,CAAC;AAE1D,KAAK,iBAAiB,GAAG,OAAO,GAAG,UAAU,CAAC;AAC9C,KAAK,iBAAiB,GAAG,GAAG,aAAa,GAAG,iBAAiB,EAAE,GAAG,oBAAoB,CAAC;AAEvF,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,KAAK,CAAC;AAE9C;;;GAGG;AACH,wBAAsB,eAAe,CACpC,IAAI,EAAE,IAAI,EACV,EACC,QAAQ,EACR,QAAQ,EACR,EAAE;IACF,QAAQ,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,WAAW,EAAE,CAAC;CACnD,GACC,OAAO,CAAC,IAAI,CAAC,CAiCf;AA2ED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,mBAAmB,EAAE,GAAG,EAAE,iBAAiB,GAAG,MAAM,EAAE,CAEhG;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAM9E;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAnchorElement.d.ts","sourceRoot":"","sources":["../../../src/modules/getAnchorElement.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"getAnchorElement.d.ts","sourceRoot":"","sources":["../../../src/modules/getAnchorElement.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,KAAG,OAAO,GAAG,IAqB1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigate.d.ts","sourceRoot":"","sources":["../../../src/modules/navigate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAc,KAAK,YAAY,EAAiB,MAAM,gBAAgB,CA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AAgB,CAAC;AAC9E,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,KAAK,EAAc,MAAM,YAAY,CAAC;AAI3E,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC;AAC/C,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,WAAW,CAAC;AACxD,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAC3D,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAEtE,wCAAwC;AACxC,KAAK,iBAAiB,GAAG;IACxB,sDAAsD;IACtD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qIAAqI;IACrI,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,iEAAiE;IACjE,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,QAAQ,CACvB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,iBAAiB,GAAG,YAAiB,EAC9C,IAAI,GAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAM,QAgBvC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACtC,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,OAAO,GAAE,iBAAiB,GAAG,YAAiB,GAC5C,OAAO,CAAC,IAAI,CAAC,CA+Kf"}
|
|
@@ -4,7 +4,7 @@ export type Plugin = {
|
|
|
4
4
|
isSwupPlugin: true;
|
|
5
5
|
/** Name of this plugin */
|
|
6
6
|
name: string;
|
|
7
|
-
/** Version of this plugin. Currently not in use, defined here for backward
|
|
7
|
+
/** Version of this plugin. Currently not in use, defined here for backward compatibility. */
|
|
8
8
|
version?: string;
|
|
9
9
|
/** The swup instance that mounted this plugin */
|
|
10
10
|
swup?: Swup;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/modules/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,MAAM,MAAM,MAAM,GAAG;IACpB,gCAAgC;IAChC,YAAY,EAAE,IAAI,CAAC;IACnB,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/modules/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,MAAM,MAAM,MAAM,GAAG;IACpB,gCAAgC;IAChC,YAAY,EAAE,IAAI,CAAC;IACnB,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,6FAA6F;IAC7F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC7C,mBAAmB;IACnB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,qBAAqB;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC;CACnC,CAAC;AAOF,wBAAwB;AACxB,eAAO,MAAM,GAAG,GAAa,MAAM,IAAI,EAAE,QAAQ,OAAO,yBAoBvD,CAAC;AAEF,0BAA0B;AAC1B,wBAAgB,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,wBAe9D;AAED,0CAA0C;AAC1C,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,sBAMnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderPage.d.ts","sourceRoot":"","sources":["../../../src/modules/renderPage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAc,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"renderPage.d.ts","sourceRoot":"","sources":["../../../src/modules/renderPage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAc,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,UAAU,GAAmB,MAAM,IAAI,EAAE,OAAO,KAAK,EAAE,MAAM,QAAQ,KAAG,OAAO,CAAC,IAAI,CA0ChG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replaceContent.d.ts","sourceRoot":"","sources":["../../../src/modules/replaceContent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"replaceContent.d.ts","sourceRoot":"","sources":["../../../src/modules/replaceContent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAa,MAAM,IAAI,EAAE,OAAO,KAAK,KAAG,OAyClE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrollToContent.d.ts","sourceRoot":"","sources":["../../../src/modules/scrollToContent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"scrollToContent.d.ts","sourceRoot":"","sources":["../../../src/modules/scrollToContent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAa,MAAM,IAAI,EAAE,OAAO,KAAK,KAAG,OA8BnE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,eAAO,MAAM,KAAK,GAAI,UAAU,MAAM,EAAE,UAAS,QAAQ,GAAG,OAAkB,uBAE7E,CAAC;AAEF,0CAA0C;AAC1C,eAAO,MAAM,QAAQ,GACpB,UAAU,MAAM,EAChB,UAAS,QAAQ,GAAG,OAAkB,KACpC,WAAW,EAEb,CAAC;AAEF,gEAAgE;AAChE,eAAO,MAAM,QAAQ,QAAO,OAAO,CAAC,IAAI,CAQvC,CAAC;AAEF,oDAAoD;AACpD,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAMhE;AAED,wFAAwF;AAExF,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CASnF;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI,CAGvD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAChC,EAAE,EAAE,OAAO,GAAG,SAAS,EACvB,IAAI,EAAE,MAAM,GACV,MAAM,GAAG,OAAO,GAAG,SAAS,CAG9B"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "swup",
|
|
3
3
|
"amdName": "Swup",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.9.0",
|
|
5
5
|
"description": "Versatile and extensible page transition library for server-rendered websites",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"source": "./src/Swup.ts",
|
|
@@ -30,10 +30,9 @@
|
|
|
30
30
|
"lint": "npm run lint:ts && npm run lint:es",
|
|
31
31
|
"lint:ts": "tsc --noEmit --skipLibCheck",
|
|
32
32
|
"lint:es": "npx eslint .",
|
|
33
|
-
"lint:compat": "npx eslint --config .eslintrc.compat.cjs
|
|
33
|
+
"lint:compat": "npx eslint --config .eslintrc.compat.cjs .",
|
|
34
34
|
"lint:prettier": "prettier 'src/**/*.ts'",
|
|
35
35
|
"prepublishOnly": "npm run build",
|
|
36
|
-
"postinstall": "opencollective-postinstall || true",
|
|
37
36
|
"test": "npm run test:unit && npm run test:e2e",
|
|
38
37
|
"test:ci": "npm run test:unit && npm run test:e2e:ci",
|
|
39
38
|
"test:unit": "vitest run --config ./tests/config/vitest.config.ts",
|
|
@@ -44,7 +43,8 @@
|
|
|
44
43
|
"test:e2e:instrument": "nyc instrument --compact=false dist tests/fixtures/dist",
|
|
45
44
|
"test:e2e:serve": "npx serve -n -S -L -p 8274 --config ./tests/config/serve.json",
|
|
46
45
|
"test:e2e:start": "npm run test:e2e:instrument && npm run test:e2e:serve",
|
|
47
|
-
"prepare": "husky"
|
|
46
|
+
"prepare": "husky",
|
|
47
|
+
"actions-up": "actions-up --yes"
|
|
48
48
|
},
|
|
49
49
|
"author": {
|
|
50
50
|
"name": "Georgy Marchuk",
|
|
@@ -77,33 +77,33 @@
|
|
|
77
77
|
],
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"delegate-it": "^6.0.0",
|
|
80
|
-
"opencollective-postinstall": "^2.0.2",
|
|
81
80
|
"path-to-regexp": "^6.2.1"
|
|
82
81
|
},
|
|
83
82
|
"devDependencies": {
|
|
84
83
|
"@babel/preset-typescript": "^7.18.6",
|
|
85
|
-
"@
|
|
84
|
+
"@eslint/js": "^10.0.1",
|
|
85
|
+
"@playwright/test": "^1.58.2",
|
|
86
86
|
"@swup/browserslist-config": "^1.0.0",
|
|
87
87
|
"@swup/prettier-config": "^1.0.0",
|
|
88
88
|
"@types/dom-view-transitions": "^1.0.2",
|
|
89
|
-
"@types/jsdom": "^
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"eslint": "^
|
|
93
|
-
"eslint-
|
|
94
|
-
"eslint-plugin-compat": "^5.0.0",
|
|
89
|
+
"@types/jsdom": "^28.0.0",
|
|
90
|
+
"actions-up": "^1.12.0",
|
|
91
|
+
"eslint": "^10.0.2",
|
|
92
|
+
"eslint-config-prettier": "^10.1.8",
|
|
93
|
+
"eslint-plugin-compat": "^7.0.0",
|
|
95
94
|
"eslint-plugin-ecmascript-compat": "^3.2.0",
|
|
96
95
|
"eslint-plugin-prettier": "^5.0.1",
|
|
97
96
|
"husky": "^9.0.11",
|
|
98
97
|
"istanbul-lib-coverage": "^3.2.0",
|
|
99
|
-
"jsdom": "^
|
|
98
|
+
"jsdom": "^28.1.0",
|
|
100
99
|
"microbundle": "^0.15.0",
|
|
101
|
-
"nyc": "^
|
|
100
|
+
"nyc": "^18.0.0",
|
|
102
101
|
"prettier": "^3.1.0",
|
|
103
|
-
"serve": "^14.2.
|
|
102
|
+
"serve": "^14.2.5",
|
|
104
103
|
"typed-query-selector": "^2.11.0",
|
|
105
|
-
"typescript": "^5.
|
|
106
|
-
"
|
|
104
|
+
"typescript": "^5.9.3",
|
|
105
|
+
"typescript-eslint": "^8.56.1",
|
|
106
|
+
"vitest": "^4.0.18"
|
|
107
107
|
},
|
|
108
108
|
"collective": {
|
|
109
109
|
"type": "opencollective",
|
package/src/helpers/classify.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export const classify = (text: string, fallback?: string): string => {
|
|
3
3
|
const output = String(text)
|
|
4
4
|
.toLowerCase()
|
|
5
|
-
// .normalize('NFD') // split an accented letter in the base letter and the
|
|
5
|
+
// .normalize('NFD') // split an accented letter in the base letter and the accent
|
|
6
6
|
// .replace(/[\u0300-\u036f]/g, '') // remove all previously split accents
|
|
7
7
|
.replace(/[\s/_.]+/g, '-') // replace spaces and _./ with '-'
|
|
8
8
|
.replace(/[^\w-]+/g, '') // remove all non-word chars
|
package/src/helpers/matchPath.ts
CHANGED
|
@@ -18,6 +18,8 @@ export const matchPath = <P extends object = object>(
|
|
|
18
18
|
try {
|
|
19
19
|
return match<P>(path, options);
|
|
20
20
|
} catch (error) {
|
|
21
|
-
throw new Error(`[swup] Error parsing path "${String(path)}":\n${String(error)}
|
|
21
|
+
throw new Error(`[swup] Error parsing path "${String(path)}":\n${String(error)}`, {
|
|
22
|
+
cause: error
|
|
23
|
+
});
|
|
22
24
|
}
|
|
23
25
|
};
|
package/src/modules/Cache.ts
CHANGED
package/src/modules/Visit.ts
CHANGED
|
@@ -86,7 +86,8 @@ export const VisitState = {
|
|
|
86
86
|
ENTERING: 6,
|
|
87
87
|
COMPLETED: 7,
|
|
88
88
|
ABORTED: 8,
|
|
89
|
-
FAILED: 9
|
|
89
|
+
FAILED: 9,
|
|
90
|
+
IGNORED: 10
|
|
90
91
|
} as const;
|
|
91
92
|
|
|
92
93
|
/** @internal */
|
|
@@ -162,10 +163,19 @@ export class Visit {
|
|
|
162
163
|
this.state = VisitState.ABORTED;
|
|
163
164
|
}
|
|
164
165
|
|
|
165
|
-
|
|
166
|
+
ignore() {
|
|
167
|
+
this.state = VisitState.IGNORED;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** Is this visit done, i.e. completed, aborted, failed, or ignored? */
|
|
166
171
|
get done(): boolean {
|
|
167
172
|
return this.state >= VisitState.COMPLETED;
|
|
168
173
|
}
|
|
174
|
+
|
|
175
|
+
/** Was this visit ignored by swup, i.e. left to the browser? */
|
|
176
|
+
get ignored(): boolean {
|
|
177
|
+
return this.state === VisitState.IGNORED;
|
|
178
|
+
}
|
|
169
179
|
}
|
|
170
180
|
|
|
171
181
|
/** Create a new visit object. */
|
|
@@ -44,9 +44,11 @@ export async function awaitAnimations(
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
const awaitedAnimations = animatedElements
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
const awaitedAnimations = animatedElements
|
|
48
|
+
.map((el) => awaitAnimationsOnElement(el))
|
|
49
|
+
.filter((p): p is Promise<void> => p !== false);
|
|
50
|
+
|
|
51
|
+
if (!awaitedAnimations.length) {
|
|
50
52
|
if (selector) {
|
|
51
53
|
console.warn(
|
|
52
54
|
`[swup] No CSS animation duration defined on elements matching \`${selector}\``
|
package/src/modules/navigate.ts
CHANGED
|
@@ -118,7 +118,7 @@ export async function performNavigation(
|
|
|
118
118
|
} else if (options.cache !== undefined) {
|
|
119
119
|
visit.cache = { read: !!options.cache, write: !!options.cache };
|
|
120
120
|
}
|
|
121
|
-
// Delete this so that window.fetch doesn't
|
|
121
|
+
// Delete this so that window.fetch doesn't misinterpret it
|
|
122
122
|
delete options.cache;
|
|
123
123
|
|
|
124
124
|
try {
|
|
@@ -175,6 +175,11 @@ export async function performNavigation(
|
|
|
175
175
|
await page;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
+
// Ignored in the meantime? Throw to trigger catch block and exit visit
|
|
179
|
+
if (visit.ignored) {
|
|
180
|
+
throw new Error(`Visit to ${visit.to.url} manually ignored`);
|
|
181
|
+
}
|
|
182
|
+
|
|
178
183
|
// Check if failed/aborted in the meantime
|
|
179
184
|
if (visit.done) return;
|
|
180
185
|
|
|
@@ -216,11 +221,11 @@ export async function performNavigation(
|
|
|
216
221
|
} catch (error) {
|
|
217
222
|
// Return early if error is undefined or signals an aborted request
|
|
218
223
|
if (!error || (error as FetchError)?.aborted) {
|
|
219
|
-
visit.
|
|
224
|
+
visit.advance(VisitState.ABORTED);
|
|
220
225
|
return;
|
|
221
226
|
}
|
|
222
227
|
|
|
223
|
-
visit.
|
|
228
|
+
visit.advance(VisitState.FAILED);
|
|
224
229
|
|
|
225
230
|
// Log to console
|
|
226
231
|
console.error(error);
|
package/src/modules/plugins.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type Plugin = {
|
|
|
5
5
|
isSwupPlugin: true;
|
|
6
6
|
/** Name of this plugin */
|
|
7
7
|
name: string;
|
|
8
|
-
/** Version of this plugin. Currently not in use, defined here for backward
|
|
8
|
+
/** Version of this plugin. Currently not in use, defined here for backward compatibility. */
|
|
9
9
|
version?: string;
|
|
10
10
|
/** The swup instance that mounted this plugin */
|
|
11
11
|
swup?: Swup;
|
|
@@ -68,10 +68,9 @@ export function unuse(this: Swup, pluginOrName: Plugin | string) {
|
|
|
68
68
|
|
|
69
69
|
/** Find a plugin by name or reference. */
|
|
70
70
|
export function findPlugin(this: Swup, pluginOrName: Plugin | string) {
|
|
71
|
-
return this.plugins.find(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
plugin
|
|
75
|
-
|
|
76
|
-
);
|
|
71
|
+
return this.plugins.find((plugin) => {
|
|
72
|
+
return typeof pluginOrName === 'string'
|
|
73
|
+
? [`Swup${pluginOrName}`, pluginOrName].includes(plugin.name)
|
|
74
|
+
: plugin === pluginOrName;
|
|
75
|
+
});
|
|
77
76
|
}
|
package/src/utils/index.ts
CHANGED
|
@@ -32,10 +32,10 @@ export function isPromise<T>(obj: unknown): obj is PromiseLike<T> {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/** Call a function as a Promise. Resolves with the returned Promsise or immediately. */
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
36
36
|
export function runAsPromise(func: Function, args: unknown[] = []): Promise<unknown> {
|
|
37
37
|
return new Promise((resolve, reject) => {
|
|
38
|
-
const result: unknown = func(...args);
|
|
38
|
+
const result: unknown = (func as (...args: unknown[]) => unknown)(...args);
|
|
39
39
|
if (isPromise(result)) {
|
|
40
40
|
result.then(resolve, reject);
|
|
41
41
|
} else {
|
package/src/utils.ts
CHANGED