@alignable/bifrost 0.0.11 → 0.0.12
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/dist/index.d.ts +1 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/PageShell.d.ts.map +1 -1
- package/dist/lib/getElementAttributes.d.ts +2 -0
- package/dist/lib/getElementAttributes.d.ts.map +1 -0
- package/dist/lib/getElementAttributes.js +7 -0
- package/dist/lib/turbolinks/adapter.d.ts +17 -0
- package/dist/lib/turbolinks/adapter.d.ts.map +1 -0
- package/dist/lib/turbolinks/adapter.js +1 -0
- package/dist/lib/turbolinks/browser_adapter.d.ts +28 -0
- package/dist/lib/turbolinks/browser_adapter.d.ts.map +1 -0
- package/dist/lib/turbolinks/browser_adapter.js +68 -0
- package/dist/lib/turbolinks/controller.d.ts +75 -0
- package/dist/lib/turbolinks/controller.d.ts.map +1 -0
- package/dist/lib/turbolinks/controller.js +219 -0
- package/dist/lib/turbolinks/head_details.d.ts +24 -0
- package/dist/lib/turbolinks/head_details.d.ts.map +1 -0
- package/dist/lib/turbolinks/head_details.js +97 -0
- package/dist/lib/turbolinks/index.d.ts +14 -0
- package/dist/lib/turbolinks/index.d.ts.map +1 -0
- package/dist/lib/turbolinks/index.js +55 -0
- package/dist/lib/turbolinks/location.d.ts +23 -0
- package/dist/lib/turbolinks/location.d.ts.map +1 -0
- package/dist/lib/turbolinks/location.js +75 -0
- package/dist/lib/turbolinks/lruCache.d.ts.map +1 -0
- package/dist/lib/turbolinks/mergeHead.d.ts +2 -0
- package/dist/lib/turbolinks/mergeHead.d.ts.map +1 -0
- package/dist/lib/{mergeHead.js → turbolinks/mergeHead.js} +27 -33
- package/dist/lib/turbolinks/progress_bar.d.ts +24 -0
- package/dist/lib/turbolinks/progress_bar.d.ts.map +1 -0
- package/dist/lib/turbolinks/progress_bar.js +99 -0
- package/dist/lib/turbolinks/types.d.ts +7 -0
- package/dist/lib/turbolinks/types.d.ts.map +1 -0
- package/dist/lib/turbolinks/types.js +3 -0
- package/dist/lib/turbolinks/util.d.ts +18 -0
- package/dist/lib/turbolinks/util.d.ts.map +1 -0
- package/dist/lib/turbolinks/util.js +125 -0
- package/dist/lib/turbolinks/visit.d.ts +55 -0
- package/dist/lib/turbolinks/visit.d.ts.map +1 -0
- package/dist/lib/turbolinks/visit.js +163 -0
- package/dist/proxy/pages/onRenderClient.d.ts.map +1 -1
- package/dist/proxy/pages/onRenderClient.js +40 -29
- package/dist/proxy/pages/onRenderHtml.d.ts.map +1 -1
- package/dist/proxy/pages/onRenderHtml.js +19 -5
- package/dist/proxy/pages/restorationVisit/+config.d.ts +2 -0
- package/dist/proxy/pages/restorationVisit/+config.d.ts.map +1 -1
- package/dist/proxy/pages/restorationVisit/+config.js +3 -0
- package/dist/proxy/pages/restorationVisit/onRenderClient.d.ts +3 -0
- package/dist/proxy/pages/restorationVisit/onRenderClient.d.ts.map +1 -0
- package/dist/proxy/pages/restorationVisit/onRenderClient.js +41 -0
- package/dist/renderer/onBeforeRoute.d.ts +1 -6
- package/dist/renderer/onBeforeRoute.d.ts.map +1 -1
- package/dist/renderer/onBeforeRoute.js +19 -11
- package/dist/renderer/onRenderClient.d.ts.map +1 -1
- package/dist/renderer/onRenderClient.js +29 -23
- package/dist/renderer/onRenderHtml.d.ts.map +1 -1
- package/dist/renderer/onRenderHtml.js +12 -16
- package/dist/renderer/utils/buildHead.d.ts +4 -0
- package/dist/renderer/utils/buildHead.d.ts.map +1 -0
- package/dist/renderer/utils/buildHead.js +10 -0
- package/dist/types/internal.d.ts +25 -23
- package/dist/types/internal.d.ts.map +1 -1
- package/package.json +13 -5
- package/dist/lib/dispatchTurbolinks.d.ts +0 -28
- package/dist/lib/dispatchTurbolinks.d.ts.map +0 -1
- package/dist/lib/dispatchTurbolinks.js +0 -5
- package/dist/lib/domUtils.d.ts +0 -3
- package/dist/lib/domUtils.d.ts.map +0 -1
- package/dist/lib/domUtils.js +0 -34
- package/dist/lib/linkInterceptor.d.ts +0 -2
- package/dist/lib/linkInterceptor.d.ts.map +0 -1
- package/dist/lib/linkInterceptor.js +0 -74
- package/dist/lib/lruCache.d.ts.map +0 -1
- package/dist/lib/mergeHead.d.ts +0 -2
- package/dist/lib/mergeHead.d.ts.map +0 -1
- package/dist/lib/navigateAnywhere.d.ts +0 -3
- package/dist/lib/navigateAnywhere.d.ts.map +0 -1
- package/dist/lib/navigateAnywhere.js +0 -15
- package/dist/lib/snapshots.d.ts +0 -9
- package/dist/lib/snapshots.d.ts.map +0 -1
- package/dist/lib/snapshots.js +0 -50
- package/dist/lib/turbolinks.d.ts +0 -5
- package/dist/lib/turbolinks.d.ts.map +0 -1
- package/dist/lib/turbolinks.js +0 -14
- package/dist/renderer/utils/formatMetaObject.d.ts +0 -4
- package/dist/renderer/utils/formatMetaObject.d.ts.map +0 -1
- package/dist/renderer/utils/formatMetaObject.js +0 -3
- /package/dist/lib/{lruCache.d.ts → turbolinks/lruCache.d.ts} +0 -0
- /package/dist/lib/{lruCache.js → turbolinks/lruCache.js} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import { DocumentProps, Layout, LayoutMap } from "./types/internal";
|
|
3
|
-
import ProxyLibConfig from "./proxy/pages/+config.js";
|
|
4
|
-
import bifrostLibConfig from "./renderer/+config.js";
|
|
5
|
-
import { Turbolinks } from "./lib/turbolinks.js";
|
|
1
|
+
export type { DocumentProps, LayoutMap, NoProxyConfig as BifrostConfig } from "./types/internal";
|
|
6
2
|
export { usePageContext } from "./renderer/usePageContext.js";
|
|
7
|
-
export { LayoutMap, DocumentProps };
|
|
8
|
-
type ConfigConstructor<LibConfig extends ConfigNonHeaderFile, T extends {
|
|
9
|
-
[K in keyof LibConfig["meta"]]?: any;
|
|
10
|
-
}> = Config & Partial<T>;
|
|
11
|
-
export type ProxyConfig<LayoutProps> = ConfigConstructor<typeof ProxyLibConfig, {
|
|
12
|
-
layoutMap: LayoutMap<LayoutProps>;
|
|
13
|
-
}>;
|
|
14
|
-
export type BifrostConfig<LayoutProps> = ConfigConstructor<typeof bifrostLibConfig, {
|
|
15
|
-
Layout: Layout<LayoutProps>;
|
|
16
|
-
layoutProps: LayoutProps;
|
|
17
|
-
documentProps: DocumentProps;
|
|
18
|
-
}>;
|
|
19
|
-
declare global {
|
|
20
|
-
interface Window {
|
|
21
|
-
Turbolinks: typeof Turbolinks;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageShell.d.ts","sourceRoot":"","sources":["../../lib/PageShell.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"PageShell.d.ts","sourceRoot":"","sources":["../../lib/PageShell.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,wBAAgB,SAAS,CAAC,EACxB,WAAW,EACX,QAAQ,GACT,EAAE;IACD,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,SAAS,CAAC;CACrB,eAQA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getElementAttributes.d.ts","sourceRoot":"","sources":["../../lib/getElementAttributes.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,0BAMpD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Locatable } from "./location";
|
|
2
|
+
import { Action } from "./types";
|
|
3
|
+
import { Visit } from "./visit";
|
|
4
|
+
export interface Adapter {
|
|
5
|
+
visitProposedToLocationWithAction(location: Locatable, action: Action): void;
|
|
6
|
+
visitStarted(visit: Visit): void;
|
|
7
|
+
visitCompleted(visit: Visit): void;
|
|
8
|
+
visitFailed(visit: Visit): void;
|
|
9
|
+
visitRequestStarted(visit: Visit): void;
|
|
10
|
+
visitRequestProgressed?(visit: Visit): void;
|
|
11
|
+
visitRequestCompleted(visit: Visit): void;
|
|
12
|
+
visitRequestFailedWithStatusCode(visit: Visit, statusCode: number): void;
|
|
13
|
+
visitRequestFinished(visit: Visit): void;
|
|
14
|
+
visitRendered(visit: Visit): void;
|
|
15
|
+
pageInvalidated(): void;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../lib/turbolinks/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,WAAW,OAAO;IACtB,iCAAiC,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7E,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACjC,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACnC,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAChC,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACxC,sBAAsB,CAAC,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC5C,qBAAqB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC1C,gCAAgC,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACzE,oBAAoB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACzC,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAClC,eAAe,IAAI,IAAI,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Adapter } from "./adapter";
|
|
2
|
+
import { Controller } from "./controller";
|
|
3
|
+
import { Locatable } from "./location";
|
|
4
|
+
import { ProgressBar } from "./progress_bar";
|
|
5
|
+
import { Action } from "./types";
|
|
6
|
+
import { Visit } from "./visit";
|
|
7
|
+
export declare class BrowserAdapter implements Adapter {
|
|
8
|
+
readonly controller: Controller;
|
|
9
|
+
readonly progressBar: ProgressBar;
|
|
10
|
+
progressBarTimeout?: number;
|
|
11
|
+
constructor(controller: Controller);
|
|
12
|
+
visitProposedToLocationWithAction(location: Locatable, action: Action): void;
|
|
13
|
+
visitStarted(visit: Visit): void;
|
|
14
|
+
visitRequestStarted(visit: Visit): void;
|
|
15
|
+
visitRequestProgressed(visit: Visit): void;
|
|
16
|
+
visitRequestCompleted(visit: Visit): void;
|
|
17
|
+
visitRequestFailedWithStatusCode(visit: Visit, statusCode: number): void;
|
|
18
|
+
visitRequestFinished(visit: Visit): void;
|
|
19
|
+
visitCompleted(visit: Visit): void;
|
|
20
|
+
pageInvalidated(): void;
|
|
21
|
+
visitFailed(visit: Visit): void;
|
|
22
|
+
visitRendered(visit: Visit): void;
|
|
23
|
+
showProgressBarAfterDelay(): void;
|
|
24
|
+
showProgressBar: () => void;
|
|
25
|
+
hideProgressBar(): void;
|
|
26
|
+
reload(): void;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=browser_adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser_adapter.d.ts","sourceRoot":"","sources":["../../../lib/turbolinks/browser_adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,qBAAa,cAAe,YAAW,OAAO;IAC5C,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,WAAW,cAAqB;IAEzC,kBAAkB,CAAC,EAAE,MAAM,CAAC;gBAEhB,UAAU,EAAE,UAAU;IAIlC,iCAAiC,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM;IAOrE,YAAY,CAAC,KAAK,EAAE,KAAK;IAMzB,mBAAmB,CAAC,KAAK,EAAE,KAAK;IAShC,sBAAsB,CAAC,KAAK,EAAE,KAAK;IAInC,qBAAqB,CAAC,KAAK,EAAE,KAAK;IAIlC,gCAAgC,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM;IAYjE,oBAAoB,CAAC,KAAK,EAAE,KAAK;IAIjC,cAAc,CAAC,KAAK,EAAE,KAAK;IAG3B,eAAe;IAIf,WAAW,CAAC,KAAK,EAAE,KAAK;IAExB,aAAa,CAAC,KAAK,EAAE,KAAK;IAI1B,yBAAyB;IAOzB,eAAe,aAEb;IAEF,eAAe;IAQf,MAAM;CAGP"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ProgressBar } from "./progress_bar";
|
|
2
|
+
export class BrowserAdapter {
|
|
3
|
+
constructor(controller) {
|
|
4
|
+
this.progressBar = new ProgressBar();
|
|
5
|
+
this.showProgressBar = () => {
|
|
6
|
+
this.progressBar.show();
|
|
7
|
+
};
|
|
8
|
+
this.controller = controller;
|
|
9
|
+
}
|
|
10
|
+
visitProposedToLocationWithAction(location, action) {
|
|
11
|
+
this.controller.startVisitToLocationWithAction(location, action);
|
|
12
|
+
}
|
|
13
|
+
visitStarted(visit) {
|
|
14
|
+
visit.issueRequest();
|
|
15
|
+
visit.changeHistory();
|
|
16
|
+
visit.loadCachedSnapshot();
|
|
17
|
+
}
|
|
18
|
+
visitRequestStarted(visit) {
|
|
19
|
+
this.progressBar.setValue(0);
|
|
20
|
+
if (visit.hasCachedSnapshot() || visit.action != "restore") {
|
|
21
|
+
this.showProgressBarAfterDelay();
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
this.showProgressBar();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
visitRequestProgressed(visit) {
|
|
28
|
+
this.progressBar.setValue(visit.progress);
|
|
29
|
+
}
|
|
30
|
+
visitRequestCompleted(visit) {
|
|
31
|
+
visit.loadResponse();
|
|
32
|
+
}
|
|
33
|
+
visitRequestFailedWithStatusCode(visit, statusCode) {
|
|
34
|
+
switch (statusCode) {
|
|
35
|
+
// TODO
|
|
36
|
+
// case SystemStatusCode.networkFailure:
|
|
37
|
+
// case SystemStatusCode.timeoutFailure:
|
|
38
|
+
// case SystemStatusCode.contentTypeMismatch:
|
|
39
|
+
// return this.reload()
|
|
40
|
+
default:
|
|
41
|
+
return visit.loadResponse();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
visitRequestFinished(visit) {
|
|
45
|
+
this.hideProgressBar();
|
|
46
|
+
}
|
|
47
|
+
visitCompleted(visit) {
|
|
48
|
+
}
|
|
49
|
+
pageInvalidated() {
|
|
50
|
+
this.reload();
|
|
51
|
+
}
|
|
52
|
+
visitFailed(visit) { }
|
|
53
|
+
visitRendered(visit) { }
|
|
54
|
+
// Private
|
|
55
|
+
showProgressBarAfterDelay() {
|
|
56
|
+
this.progressBarTimeout = window.setTimeout(this.showProgressBar, this.controller.progressBarDelay);
|
|
57
|
+
}
|
|
58
|
+
hideProgressBar() {
|
|
59
|
+
this.progressBar.hide();
|
|
60
|
+
if (this.progressBarTimeout != null) {
|
|
61
|
+
window.clearTimeout(this.progressBarTimeout);
|
|
62
|
+
delete this.progressBarTimeout;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
reload() {
|
|
66
|
+
window.location.reload();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { LruCache } from "./lruCache";
|
|
2
|
+
import { Adapter } from "./adapter";
|
|
3
|
+
import { Location, Locatable } from "./location";
|
|
4
|
+
import { Action } from "./types";
|
|
5
|
+
import { Visit } from "./visit";
|
|
6
|
+
export type TimingData = {};
|
|
7
|
+
export type VisitOptions = {
|
|
8
|
+
action: Action;
|
|
9
|
+
};
|
|
10
|
+
export interface Snapshot {
|
|
11
|
+
bodyEl: Element;
|
|
12
|
+
headEl: Element;
|
|
13
|
+
pageContext: any;
|
|
14
|
+
}
|
|
15
|
+
export declare class Controller {
|
|
16
|
+
adapter: Adapter;
|
|
17
|
+
cache: LruCache<Snapshot>;
|
|
18
|
+
currentVisit?: Visit;
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
lastRenderedLocation?: Location;
|
|
21
|
+
location: Location;
|
|
22
|
+
progressBarDelay: number;
|
|
23
|
+
restorationIdentifier: string;
|
|
24
|
+
started: boolean;
|
|
25
|
+
pageContext: any;
|
|
26
|
+
start(): void;
|
|
27
|
+
disable(): void;
|
|
28
|
+
stop(): void;
|
|
29
|
+
clearCache(): void;
|
|
30
|
+
visit(location: Locatable, options?: Partial<VisitOptions>): void;
|
|
31
|
+
startVisitToLocationWithAction(location: Locatable, action: Action, restorationIdentifier?: string): void;
|
|
32
|
+
setProgressBarDelay(delay: number): void;
|
|
33
|
+
historyPoppedToLocationWithRestorationIdentifier(location: Locatable, restorationIdentifier: string): void;
|
|
34
|
+
getCachedSnapshotForLocation(location: Locatable): Snapshot | undefined;
|
|
35
|
+
shouldCacheSnapshot(): boolean | null;
|
|
36
|
+
cacheSnapshot(): void;
|
|
37
|
+
viewInvalidated(): void;
|
|
38
|
+
viewWillRender(): void;
|
|
39
|
+
viewRendered(): void;
|
|
40
|
+
clickCaptured: () => void;
|
|
41
|
+
clickBubbled: (event: MouseEvent) => void;
|
|
42
|
+
applicationAllowsFollowingLinkToLocation(link: Element, location: Location): boolean;
|
|
43
|
+
applicationAllowsVisitingLocation(location: Location): boolean;
|
|
44
|
+
notifyApplicationAfterClickingLinkToLocation(link: Element, location: Location): Event & {
|
|
45
|
+
data: any;
|
|
46
|
+
};
|
|
47
|
+
notifyApplicationBeforeVisitingLocation(location: Location): Event & {
|
|
48
|
+
data: any;
|
|
49
|
+
};
|
|
50
|
+
notifyApplicationAfterVisitingLocation(location: Location): Event & {
|
|
51
|
+
data: any;
|
|
52
|
+
};
|
|
53
|
+
notifyApplicationBeforeCachingSnapshot(): Event & {
|
|
54
|
+
data: any;
|
|
55
|
+
};
|
|
56
|
+
notifyApplicationBeforeRender(): Event & {
|
|
57
|
+
data: any;
|
|
58
|
+
};
|
|
59
|
+
notifyApplicationAfterRender(): Event & {
|
|
60
|
+
data: any;
|
|
61
|
+
};
|
|
62
|
+
notifyApplicationAfterPageLoad(timing?: TimingData): Event & {
|
|
63
|
+
data: any;
|
|
64
|
+
};
|
|
65
|
+
startVisit(location: Location, action: Action): void;
|
|
66
|
+
createVisit(location: Location, action: Action): Visit;
|
|
67
|
+
visitCompleted(visit: Visit): void;
|
|
68
|
+
clickEventIsSignificant(event: MouseEvent): boolean;
|
|
69
|
+
getVisitableLinkForTarget(target: EventTarget | null): Element | null | undefined;
|
|
70
|
+
getVisitableLocationForLink(link: Element): Location | undefined;
|
|
71
|
+
getActionForLink(link: Element): Action;
|
|
72
|
+
elementIsVisitable(element: Element): boolean;
|
|
73
|
+
locationIsVisitable(location: Location): false | RegExpMatchArray | null;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../lib/turbolinks/controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,MAAM,EAAY,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,MAAM,UAAU,GAAG,EAAE,CAAC;AAC5B,MAAM,MAAM,YAAY,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9C,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,GAAG,CAAC;CAClB;AAED,qBAAa,UAAU;IACrB,OAAO,EAAE,OAAO,CAA4B;IAE5C,KAAK,qBAA8B;IACnC,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,OAAO,UAAQ;IACf,oBAAoB,CAAC,EAAE,QAAQ,CAAC;IAChC,QAAQ,EAAG,QAAQ,CAAC;IACpB,gBAAgB,SAAO;IACvB,qBAAqB,EAAG,MAAM,CAAC;IAC/B,OAAO,UAAS;IAChB,WAAW,EAAE,GAAG,CAAC;IAEjB,KAAK;IAaL,OAAO;IAIP,IAAI;IAOJ,UAAU;IAIV,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,GAAE,OAAO,CAAC,YAAY,CAAM;IAY9D,8BAA8B,CAC5B,QAAQ,EAAE,SAAS,EACnB,MAAM,EAAE,MAAM,EACd,qBAAqB,CAAC,EAAE,MAAM;IAKhC,mBAAmB,CAAC,KAAK,EAAE,MAAM;IAMjC,gDAAgD,CAC9C,QAAQ,EAAE,SAAS,EACnB,qBAAqB,EAAE,MAAM;IAa/B,4BAA4B,CAAC,QAAQ,EAAE,SAAS;IAIhD,mBAAmB;IASnB,aAAa;IAcb,eAAe;IAIf,cAAc;IAId,YAAY;IAOZ,aAAa,aAGX;IAEF,YAAY,UAAW,UAAU,UAgB/B;IAIF,wCAAwC,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ;IAQ1E,iCAAiC,CAAC,QAAQ,EAAE,QAAQ;IAKpD,4CAA4C,CAC1C,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,QAAQ;;;IASpB,uCAAuC,CAAC,QAAQ,EAAE,QAAQ;;;IAO1D,sCAAsC,CAAC,QAAQ,EAAE,QAAQ;;;IAMzD,sCAAsC;;;IAItC,6BAA6B;;;IAI7B,4BAA4B;;;IAI5B,8BAA8B,CAAC,MAAM,GAAE,UAAe;;;IAQtD,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM;IAS7C,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK;IAUtD,cAAc,CAAC,KAAK,EAAE,KAAK;IAI3B,uBAAuB,CAAC,KAAK,EAAE,UAAU;IAYzC,yBAAyB,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAMpD,2BAA2B,CAAC,IAAI,EAAE,OAAO;IAOzC,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM;IAKvC,kBAAkB,CAAC,OAAO,EAAE,OAAO;IASnC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ;CAGvC"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { LruCache } from "./lruCache";
|
|
2
|
+
import { BrowserAdapter } from "./browser_adapter";
|
|
3
|
+
import { Location } from "./location";
|
|
4
|
+
import { isAction } from "./types";
|
|
5
|
+
import { closest, defer, dispatch, uuid } from "./util";
|
|
6
|
+
import { Visit } from "./visit";
|
|
7
|
+
export class Controller {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.adapter = new BrowserAdapter(this);
|
|
10
|
+
this.cache = new LruCache(10);
|
|
11
|
+
this.enabled = true;
|
|
12
|
+
this.progressBarDelay = 500;
|
|
13
|
+
this.started = false;
|
|
14
|
+
// Event handlers
|
|
15
|
+
this.clickCaptured = () => {
|
|
16
|
+
document.body.removeEventListener("click", this.clickBubbled, false);
|
|
17
|
+
document.body.addEventListener("click", this.clickBubbled, false);
|
|
18
|
+
};
|
|
19
|
+
this.clickBubbled = (event) => {
|
|
20
|
+
if (this.enabled && this.clickEventIsSignificant(event)) {
|
|
21
|
+
const link = this.getVisitableLinkForTarget(event.target);
|
|
22
|
+
if (link) {
|
|
23
|
+
const location = this.getVisitableLocationForLink(link);
|
|
24
|
+
if (location &&
|
|
25
|
+
this.applicationAllowsFollowingLinkToLocation(link, location)) {
|
|
26
|
+
event.preventDefault();
|
|
27
|
+
event.stopPropagation();
|
|
28
|
+
const action = this.getActionForLink(link);
|
|
29
|
+
this.visit(location, { action });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
start() {
|
|
36
|
+
if (!this.started) {
|
|
37
|
+
// TODO: delete document.body in this file. We are doing this to pre-empt VPS interceptor.
|
|
38
|
+
// https://github.com/brillout/vite-plugin-ssr/issues/918 fixes this.
|
|
39
|
+
document.body.addEventListener("click", this.clickCaptured, true);
|
|
40
|
+
this.location = Location.currentLocation;
|
|
41
|
+
this.restorationIdentifier = uuid();
|
|
42
|
+
this.lastRenderedLocation = this.location;
|
|
43
|
+
this.started = true;
|
|
44
|
+
this.enabled = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
disable() {
|
|
48
|
+
this.enabled = false;
|
|
49
|
+
}
|
|
50
|
+
stop() {
|
|
51
|
+
if (this.started) {
|
|
52
|
+
document.body.removeEventListener("click", this.clickCaptured, true);
|
|
53
|
+
this.started = false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
clearCache() {
|
|
57
|
+
this.cache = new LruCache(10);
|
|
58
|
+
}
|
|
59
|
+
visit(location, options = {}) {
|
|
60
|
+
location = Location.wrap(location);
|
|
61
|
+
if (this.applicationAllowsVisitingLocation(location)) {
|
|
62
|
+
if (this.locationIsVisitable(location)) {
|
|
63
|
+
const action = options.action || "advance";
|
|
64
|
+
this.adapter.visitProposedToLocationWithAction(location, action);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
window.location.href = location.toString();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
startVisitToLocationWithAction(location, action, restorationIdentifier) {
|
|
72
|
+
this.startVisit(Location.wrap(location), action);
|
|
73
|
+
}
|
|
74
|
+
setProgressBarDelay(delay) {
|
|
75
|
+
this.progressBarDelay = delay;
|
|
76
|
+
}
|
|
77
|
+
// History delegate
|
|
78
|
+
historyPoppedToLocationWithRestorationIdentifier(location, restorationIdentifier) {
|
|
79
|
+
if (this.enabled) {
|
|
80
|
+
this.location = Location.wrap(location);
|
|
81
|
+
this.restorationIdentifier = restorationIdentifier;
|
|
82
|
+
this.startVisit(this.location, "restore");
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
this.adapter.pageInvalidated();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Snapshot cache
|
|
89
|
+
getCachedSnapshotForLocation(location) {
|
|
90
|
+
return this.cache.get(Location.wrap(location).toCacheKey());
|
|
91
|
+
}
|
|
92
|
+
shouldCacheSnapshot() {
|
|
93
|
+
return (document.body.querySelector("#proxied-body") &&
|
|
94
|
+
document.head
|
|
95
|
+
.querySelector("meta[name='turbolinks-no-cache']")
|
|
96
|
+
?.getAttribute("content") != "no-cache");
|
|
97
|
+
}
|
|
98
|
+
cacheSnapshot() {
|
|
99
|
+
if (this.shouldCacheSnapshot()) {
|
|
100
|
+
this.notifyApplicationBeforeCachingSnapshot();
|
|
101
|
+
const snapshot = {
|
|
102
|
+
bodyEl: document.body.cloneNode(true),
|
|
103
|
+
headEl: document.head.cloneNode(true),
|
|
104
|
+
pageContext: this.pageContext,
|
|
105
|
+
};
|
|
106
|
+
const location = this.lastRenderedLocation || Location.currentLocation;
|
|
107
|
+
defer(() => this.cache.put(location.toCacheKey(), snapshot));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// View
|
|
111
|
+
viewInvalidated() {
|
|
112
|
+
this.adapter.pageInvalidated();
|
|
113
|
+
}
|
|
114
|
+
viewWillRender() {
|
|
115
|
+
this.notifyApplicationBeforeRender();
|
|
116
|
+
}
|
|
117
|
+
viewRendered() {
|
|
118
|
+
this.lastRenderedLocation = this.currentVisit.location;
|
|
119
|
+
this.notifyApplicationAfterRender();
|
|
120
|
+
}
|
|
121
|
+
// Application events
|
|
122
|
+
applicationAllowsFollowingLinkToLocation(link, location) {
|
|
123
|
+
const event = this.notifyApplicationAfterClickingLinkToLocation(link, location);
|
|
124
|
+
return !event.defaultPrevented;
|
|
125
|
+
}
|
|
126
|
+
applicationAllowsVisitingLocation(location) {
|
|
127
|
+
const event = this.notifyApplicationBeforeVisitingLocation(location);
|
|
128
|
+
return !event.defaultPrevented;
|
|
129
|
+
}
|
|
130
|
+
notifyApplicationAfterClickingLinkToLocation(link, location) {
|
|
131
|
+
return dispatch("turbolinks:click", {
|
|
132
|
+
target: link,
|
|
133
|
+
data: { url: location.absoluteURL },
|
|
134
|
+
cancelable: true,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
notifyApplicationBeforeVisitingLocation(location) {
|
|
138
|
+
return dispatch("turbolinks:before-visit", {
|
|
139
|
+
data: { url: location.absoluteURL },
|
|
140
|
+
cancelable: true,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
notifyApplicationAfterVisitingLocation(location) {
|
|
144
|
+
return dispatch("turbolinks:visit", {
|
|
145
|
+
data: { url: location.absoluteURL },
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
notifyApplicationBeforeCachingSnapshot() {
|
|
149
|
+
return dispatch("turbolinks:before-cache");
|
|
150
|
+
}
|
|
151
|
+
notifyApplicationBeforeRender() {
|
|
152
|
+
return dispatch("turbolinks:before-render");
|
|
153
|
+
}
|
|
154
|
+
notifyApplicationAfterRender() {
|
|
155
|
+
return dispatch("turbolinks:render");
|
|
156
|
+
}
|
|
157
|
+
notifyApplicationAfterPageLoad(timing = {}) {
|
|
158
|
+
return dispatch("turbolinks:load", {
|
|
159
|
+
data: { url: this.location.absoluteURL, timing },
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
// Private
|
|
163
|
+
startVisit(location, action) {
|
|
164
|
+
if (this.currentVisit) {
|
|
165
|
+
this.currentVisit.cancel();
|
|
166
|
+
}
|
|
167
|
+
this.currentVisit = this.createVisit(location, action);
|
|
168
|
+
this.currentVisit.start();
|
|
169
|
+
this.notifyApplicationAfterVisitingLocation(location);
|
|
170
|
+
}
|
|
171
|
+
createVisit(location, action) {
|
|
172
|
+
const visit = new Visit(this, location, action);
|
|
173
|
+
visit.referrer = this.location;
|
|
174
|
+
if (action === "restore") {
|
|
175
|
+
// dont issue navigate() because VPS already did.
|
|
176
|
+
visit.requestInFlight = true;
|
|
177
|
+
}
|
|
178
|
+
return visit;
|
|
179
|
+
}
|
|
180
|
+
visitCompleted(visit) {
|
|
181
|
+
this.notifyApplicationAfterPageLoad(visit.getTimingMetrics());
|
|
182
|
+
}
|
|
183
|
+
clickEventIsSignificant(event) {
|
|
184
|
+
return !((event.target && event.target.isContentEditable) ||
|
|
185
|
+
event.defaultPrevented ||
|
|
186
|
+
event.which > 1 ||
|
|
187
|
+
event.altKey ||
|
|
188
|
+
event.ctrlKey ||
|
|
189
|
+
event.metaKey ||
|
|
190
|
+
event.shiftKey);
|
|
191
|
+
}
|
|
192
|
+
getVisitableLinkForTarget(target) {
|
|
193
|
+
if (target instanceof Element && this.elementIsVisitable(target)) {
|
|
194
|
+
return closest(target, "a[href]:not([target]):not([download])");
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
getVisitableLocationForLink(link) {
|
|
198
|
+
const location = new Location(link.getAttribute("href") || "");
|
|
199
|
+
if (this.locationIsVisitable(location)) {
|
|
200
|
+
return location;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
getActionForLink(link) {
|
|
204
|
+
const action = link.getAttribute("data-turbolinks-action");
|
|
205
|
+
return isAction(action) ? action : "advance";
|
|
206
|
+
}
|
|
207
|
+
elementIsVisitable(element) {
|
|
208
|
+
const container = closest(element, "[data-turbolinks]");
|
|
209
|
+
if (container) {
|
|
210
|
+
return container.getAttribute("data-turbolinks") != "false";
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
locationIsVisitable(location) {
|
|
217
|
+
return location.isPrefixedBy(new Location("/")) && location.isHTML();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type ElementDetailMap = {
|
|
2
|
+
[outerHTML: string]: ElementDetails;
|
|
3
|
+
};
|
|
4
|
+
type ElementDetails = {
|
|
5
|
+
type?: ElementType;
|
|
6
|
+
tracked: boolean;
|
|
7
|
+
elements: Element[];
|
|
8
|
+
};
|
|
9
|
+
type ElementType = "script" | "stylesheet";
|
|
10
|
+
export declare class HeadDetails {
|
|
11
|
+
readonly detailsByOuterHTML: ElementDetailMap;
|
|
12
|
+
static fromHeadElement(headElement: HTMLHeadElement | null): HeadDetails;
|
|
13
|
+
static fromHeadString(head: string): HeadDetails;
|
|
14
|
+
constructor(children: Element[]);
|
|
15
|
+
getTrackedElementSignature(): string;
|
|
16
|
+
getScriptElementsNotInDetails(headDetails: HeadDetails): Element[];
|
|
17
|
+
getStylesheetElementsNotInDetails(headDetails: HeadDetails): Element[];
|
|
18
|
+
getElementsMatchingTypeNotInDetails(matchedType: ElementType, headDetails: HeadDetails): Element[];
|
|
19
|
+
getProvisionalElements(): Element[];
|
|
20
|
+
getMetaValue(name: string): string | null;
|
|
21
|
+
findMetaElementByName(name: string): Element | undefined;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=head_details.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"head_details.d.ts","sourceRoot":"","sources":["../../../lib/turbolinks/head_details.ts"],"names":[],"mappings":"AAEA,KAAK,gBAAgB,GAAG;IAAE,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,CAAA;CAAE,CAAC;AAEhE,KAAK,cAAc,GAAG;IACpB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB,CAAC;AAEF,KAAK,WAAW,GAAG,QAAQ,GAAG,YAAY,CAAC;AAE3C,qBAAa,WAAW;IACtB,QAAQ,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;IAE9C,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,eAAe,GAAG,IAAI,GAAG,WAAW;IAKxE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW;gBAMpC,QAAQ,EAAE,OAAO,EAAE;IAqB/B,0BAA0B,IAAI,MAAM;IAMpC,6BAA6B,CAAC,WAAW,EAAE,WAAW;IAItD,iCAAiC,CAAC,WAAW,EAAE,WAAW;IAI1D,mCAAmC,CACjC,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW;IAS1B,sBAAsB,IAAI,OAAO,EAAE;IAanC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAKzC,qBAAqB,CAAC,IAAI,EAAE,MAAM;CAQnC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { array } from "./util";
|
|
2
|
+
export class HeadDetails {
|
|
3
|
+
static fromHeadElement(headElement) {
|
|
4
|
+
const children = headElement ? array(headElement.children) : [];
|
|
5
|
+
return new this(children);
|
|
6
|
+
}
|
|
7
|
+
static fromHeadString(head) {
|
|
8
|
+
const element = document.createElement("head");
|
|
9
|
+
element.innerHTML = head;
|
|
10
|
+
return this.fromHeadElement(element);
|
|
11
|
+
}
|
|
12
|
+
constructor(children) {
|
|
13
|
+
this.detailsByOuterHTML = children.reduce((result, element) => {
|
|
14
|
+
const { outerHTML } = element;
|
|
15
|
+
const details = outerHTML in result
|
|
16
|
+
? result[outerHTML]
|
|
17
|
+
: {
|
|
18
|
+
type: elementType(element),
|
|
19
|
+
tracked: elementIsTracked(element),
|
|
20
|
+
elements: [],
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
...result,
|
|
24
|
+
[outerHTML]: {
|
|
25
|
+
...details,
|
|
26
|
+
elements: [...details.elements, element],
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}, {});
|
|
30
|
+
}
|
|
31
|
+
getTrackedElementSignature() {
|
|
32
|
+
return Object.keys(this.detailsByOuterHTML)
|
|
33
|
+
.filter((outerHTML) => this.detailsByOuterHTML[outerHTML].tracked)
|
|
34
|
+
.join("");
|
|
35
|
+
}
|
|
36
|
+
getScriptElementsNotInDetails(headDetails) {
|
|
37
|
+
return this.getElementsMatchingTypeNotInDetails("script", headDetails);
|
|
38
|
+
}
|
|
39
|
+
getStylesheetElementsNotInDetails(headDetails) {
|
|
40
|
+
return this.getElementsMatchingTypeNotInDetails("stylesheet", headDetails);
|
|
41
|
+
}
|
|
42
|
+
getElementsMatchingTypeNotInDetails(matchedType, headDetails) {
|
|
43
|
+
return Object.keys(this.detailsByOuterHTML)
|
|
44
|
+
.filter((outerHTML) => !(outerHTML in headDetails.detailsByOuterHTML))
|
|
45
|
+
.map((outerHTML) => this.detailsByOuterHTML[outerHTML])
|
|
46
|
+
.filter(({ type }) => type == matchedType)
|
|
47
|
+
.map(({ elements: [element] }) => element);
|
|
48
|
+
}
|
|
49
|
+
getProvisionalElements() {
|
|
50
|
+
return Object.keys(this.detailsByOuterHTML).reduce((result, outerHTML) => {
|
|
51
|
+
const { type, tracked, elements } = this.detailsByOuterHTML[outerHTML];
|
|
52
|
+
if (type == null && !tracked) {
|
|
53
|
+
return [...result, ...elements];
|
|
54
|
+
}
|
|
55
|
+
else if (elements.length > 1) {
|
|
56
|
+
return [...result, ...elements.slice(1)];
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
}, []);
|
|
62
|
+
}
|
|
63
|
+
getMetaValue(name) {
|
|
64
|
+
const element = this.findMetaElementByName(name);
|
|
65
|
+
return element ? element.getAttribute("content") : null;
|
|
66
|
+
}
|
|
67
|
+
findMetaElementByName(name) {
|
|
68
|
+
return Object.keys(this.detailsByOuterHTML).reduce((result, outerHTML) => {
|
|
69
|
+
const { elements: [element], } = this.detailsByOuterHTML[outerHTML];
|
|
70
|
+
return elementIsMetaElementWithName(element, name) ? element : result;
|
|
71
|
+
}, undefined);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function elementType(element) {
|
|
75
|
+
if (elementIsScript(element)) {
|
|
76
|
+
return "script";
|
|
77
|
+
}
|
|
78
|
+
else if (elementIsStylesheet(element)) {
|
|
79
|
+
return "stylesheet";
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function elementIsTracked(element) {
|
|
83
|
+
return element.getAttribute("data-turbolinks-track") == "reload";
|
|
84
|
+
}
|
|
85
|
+
function elementIsScript(element) {
|
|
86
|
+
const tagName = element.tagName.toLowerCase();
|
|
87
|
+
return tagName == "script";
|
|
88
|
+
}
|
|
89
|
+
function elementIsStylesheet(element) {
|
|
90
|
+
const tagName = element.tagName.toLowerCase();
|
|
91
|
+
return (tagName == "style" ||
|
|
92
|
+
(tagName == "link" && element.getAttribute("rel") == "stylesheet"));
|
|
93
|
+
}
|
|
94
|
+
function elementIsMetaElementWithName(element, name) {
|
|
95
|
+
const tagName = element.tagName.toLowerCase();
|
|
96
|
+
return tagName == "meta" && element.getAttribute("name") == name;
|
|
97
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Controller, VisitOptions } from "./controller";
|
|
2
|
+
import { Locatable } from "./location";
|
|
3
|
+
export declare const Turbolinks: {
|
|
4
|
+
readonly supported: boolean;
|
|
5
|
+
controller: Controller;
|
|
6
|
+
visit(location: Locatable, options?: Partial<VisitOptions>): void;
|
|
7
|
+
clearCache(): void;
|
|
8
|
+
setProgressBarDelay(delay: number): void;
|
|
9
|
+
start(): void;
|
|
10
|
+
_vpsCachePageContext(pageContext: any): void;
|
|
11
|
+
_vpsOnRenderClient(newHead: HTMLHeadElement, trackScripts: boolean, renderBody: () => void): void;
|
|
12
|
+
};
|
|
13
|
+
export type Turbolinks = typeof Turbolinks;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/turbolinks/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAKvC,eAAO,MAAM,UAAU;;;oBAOL,SAAS,YAAY,QAAQ,YAAY,CAAC;;+BAQ/B,MAAM;;sCAmBC,GAAG;gCAK1B,eAAe,gBACV,OAAO,cACT,MAAM,IAAI;CA+BzB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC"}
|