@base-framework/base 3.9.16 → 3.9.18
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 +791 -763
- package/dist/base.js +1 -1
- package/dist/chunks/chunk-6YJAZHX6.js +2 -0
- package/dist/chunks/chunk-7ZHUXJZT.js +2 -0
- package/dist/chunks/chunk-HBL2JSVL.js +2 -0
- package/dist/chunks/chunk-IKBATT4B.js +2 -0
- package/dist/chunks/chunk-LY736NR2.js +2 -0
- package/dist/chunks/chunk-PIAMX2DB.js +2 -0
- package/dist/chunks/chunk-VSCHM2ZB.js +2 -0
- package/dist/modules/ajax.js +1 -1
- package/dist/modules/component.js +1 -1
- package/dist/modules/data.js +1 -1
- package/dist/modules/html.js +1 -1
- package/dist/modules/router.js +1 -1
- package/dist/modules/state.js +1 -1
- package/dist/types/base.d.ts +2 -1
- package/dist/types/entries/ajax.d.ts +1 -0
- package/dist/types/modules/ajax/resource-cache.d.ts +214 -0
- package/dist/types/modules/component/mount-queue.d.ts +6 -0
- package/dist/types/modules/component/unit.d.ts +37 -1
- package/dist/types/modules/data/types/model/model-service.d.ts +106 -8
- package/dist/types/modules/import/layout-manager.d.ts +11 -0
- package/dist/types/modules/router/history/browser-history.d.ts +23 -0
- package/dist/types/modules/router/router.d.ts +109 -3
- package/dist/types/modules/router/routes/component-helper.d.ts +163 -2
- package/dist/types/modules/router/routes/element-scroll.d.ts +18 -0
- package/dist/types/modules/router/routes/page-cache.d.ts +113 -0
- package/dist/types/modules/router/routes/route.d.ts +16 -3
- package/package.json +1 -1
|
@@ -20,7 +20,9 @@ export class Router {
|
|
|
20
20
|
lastPath: any;
|
|
21
21
|
path: any;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* The last route that matched a path. This is kept for
|
|
24
|
+
* backwards compatibility only: every route is checked on
|
|
25
|
+
* each navigation so stale routes are deactivated.
|
|
24
26
|
* @type {object|null} lastMatchedRoute
|
|
25
27
|
*/
|
|
26
28
|
lastMatchedRoute: object | null;
|
|
@@ -47,6 +49,30 @@ export class Router {
|
|
|
47
49
|
* @type {number}
|
|
48
50
|
*/
|
|
49
51
|
scrollWaitToken: number;
|
|
52
|
+
/**
|
|
53
|
+
* Removes the user interaction listeners of a pending
|
|
54
|
+
* history scroll restore.
|
|
55
|
+
* @type {function|null}
|
|
56
|
+
*/
|
|
57
|
+
cancelScrollWait: Function | null;
|
|
58
|
+
/**
|
|
59
|
+
* The default keep-alive setting for routes that do not set
|
|
60
|
+
* `keepAlive` themselves. Keep-alive route pages are detached
|
|
61
|
+
* and cached instead of destroyed when the route deactivates.
|
|
62
|
+
* @type {boolean} keepAlive
|
|
63
|
+
*/
|
|
64
|
+
keepAlive: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* The max detached keep-alive pages kept across the router.
|
|
67
|
+
* The least recently used page is destroyed past it.
|
|
68
|
+
* @type {number} keepAliveMax
|
|
69
|
+
*/
|
|
70
|
+
keepAliveMax: number;
|
|
71
|
+
/**
|
|
72
|
+
* This will track the detached keep-alive pages.
|
|
73
|
+
* @type {PageCache} pageCache
|
|
74
|
+
*/
|
|
75
|
+
pageCache: PageCache;
|
|
50
76
|
/**
|
|
51
77
|
* This will be used to access our history object.
|
|
52
78
|
*/
|
|
@@ -82,6 +108,22 @@ export class Router {
|
|
|
82
108
|
* @returns {object}
|
|
83
109
|
*/
|
|
84
110
|
protected createRoute(settings: object): object;
|
|
111
|
+
/**
|
|
112
|
+
* This will set the default keep-alive setting for routes that
|
|
113
|
+
* do not set `keepAlive` themselves.
|
|
114
|
+
*
|
|
115
|
+
* @param {boolean} enabled
|
|
116
|
+
* @param {object} [options]
|
|
117
|
+
* @param {number} [options.max] The max detached pages kept across
|
|
118
|
+
* the router (default 5). The least recently used is destroyed.
|
|
119
|
+
* @returns {this} a reference to the router object.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* router.setKeepAlive(true, { max: 5 });
|
|
123
|
+
*/
|
|
124
|
+
setKeepAlive(enabled: boolean, options?: {
|
|
125
|
+
max?: number;
|
|
126
|
+
}): this;
|
|
85
127
|
/**
|
|
86
128
|
* This will add a new route to the router.
|
|
87
129
|
*
|
|
@@ -216,10 +258,26 @@ export class Router {
|
|
|
216
258
|
/**
|
|
217
259
|
* This will check if a link was routed.
|
|
218
260
|
*
|
|
261
|
+
* Only plain primary clicks on same-origin links that open in the
|
|
262
|
+
* current browsing context are routed. Everything else is left to
|
|
263
|
+
* the browser (new tabs / windows, downloads, mailto:, tel:, other
|
|
264
|
+
* origins, or clicks another handler already cancelled).
|
|
265
|
+
*
|
|
219
266
|
* @protected
|
|
220
267
|
* @param {PointerEvent} evt
|
|
221
268
|
*/
|
|
222
269
|
protected checkLink(evt: PointerEvent): boolean;
|
|
270
|
+
/**
|
|
271
|
+
* This will convert a link href to a router path. Absolute and
|
|
272
|
+
* scheme relative urls are only routed when they are on the
|
|
273
|
+
* current origin. The base uri is only removed as a prefix.
|
|
274
|
+
*
|
|
275
|
+
* @protected
|
|
276
|
+
* @param {string} href
|
|
277
|
+
* @returns {string|null} the path or null if the router should
|
|
278
|
+
* not handle the link.
|
|
279
|
+
*/
|
|
280
|
+
protected getLinkPath(href: string): string | null;
|
|
223
281
|
/**
|
|
224
282
|
* This will reset the router.
|
|
225
283
|
*
|
|
@@ -259,17 +317,22 @@ export class Router {
|
|
|
259
317
|
*
|
|
260
318
|
* @protected
|
|
261
319
|
* @param {string} [path]
|
|
320
|
+
* @param {boolean} [restoreScroll] - when true (history back /
|
|
321
|
+
* forward) the caller restores the saved scroll position, so no
|
|
322
|
+
* route scroll intent is applied.
|
|
262
323
|
*/
|
|
263
|
-
protected checkActiveRoutes(path?: string): void;
|
|
324
|
+
protected checkActiveRoutes(path?: string, restoreScroll?: boolean): void;
|
|
264
325
|
/**
|
|
265
326
|
* Checks all switch groups against the given path.
|
|
266
327
|
* Activates the first matching route or falls back to the first route in the group if none match.
|
|
267
328
|
*
|
|
268
329
|
* @protected
|
|
269
330
|
* @param {string} path
|
|
331
|
+
* @param {boolean} [skipDormant] - true to skip groups whose
|
|
332
|
+
* container is inside a detached keep-alive page.
|
|
270
333
|
* @returns {void}
|
|
271
334
|
*/
|
|
272
|
-
protected checkSwitches(path: string): void;
|
|
335
|
+
protected checkSwitches(path: string, skipDormant?: boolean): void;
|
|
273
336
|
/**
|
|
274
337
|
* Checks a single group of routes against the path.
|
|
275
338
|
* Selects the first matching route if any; otherwise selects the first route.
|
|
@@ -325,6 +388,48 @@ export class Router {
|
|
|
325
388
|
* @returns {void}
|
|
326
389
|
*/
|
|
327
390
|
reassertScrollTop(): void;
|
|
391
|
+
/**
|
|
392
|
+
* This will restore a saved scroll position after the routes for
|
|
393
|
+
* a history navigation have been activated.
|
|
394
|
+
*
|
|
395
|
+
* When the page can already reach the position (e.g. a keep-alive
|
|
396
|
+
* page that was re-inserted at full height) it is restored
|
|
397
|
+
* synchronously so it lands before the next paint. Otherwise the
|
|
398
|
+
* page is still loading, so the document height is checked each
|
|
399
|
+
* frame and the position is restored once it can be reached (or
|
|
400
|
+
* after a short timeout). The wait is cancelled when the user
|
|
401
|
+
* starts interacting with the page or a newer navigation starts.
|
|
402
|
+
*
|
|
403
|
+
* @param {object} position
|
|
404
|
+
* @returns {void}
|
|
405
|
+
*/
|
|
406
|
+
restoreScrollPosition(position: object): void;
|
|
407
|
+
/**
|
|
408
|
+
* This will remove the listeners of a pending scroll restore.
|
|
409
|
+
*
|
|
410
|
+
* @protected
|
|
411
|
+
* @returns {void}
|
|
412
|
+
*/
|
|
413
|
+
protected clearScrollWait(): void;
|
|
414
|
+
/**
|
|
415
|
+
* This will check if the document is large enough to scroll the
|
|
416
|
+
* window to a position.
|
|
417
|
+
*
|
|
418
|
+
* @protected
|
|
419
|
+
* @param {number} x
|
|
420
|
+
* @param {number} y
|
|
421
|
+
* @returns {boolean}
|
|
422
|
+
*/
|
|
423
|
+
protected canReachScroll(x: number, y: number): boolean;
|
|
424
|
+
/**
|
|
425
|
+
* This will scroll the element matching a url hash into view.
|
|
426
|
+
* Lazy routes can mount their DOM after activation, so a missing
|
|
427
|
+
* element is polled for on animation frames for a short window.
|
|
428
|
+
*
|
|
429
|
+
* @param {string} hash
|
|
430
|
+
* @returns {void}
|
|
431
|
+
*/
|
|
432
|
+
scrollToHash(hash: string): void;
|
|
328
433
|
/**
|
|
329
434
|
* This will scroll to a target element by CSS selector.
|
|
330
435
|
* For sticky elements, it scrolls to the position where the
|
|
@@ -379,3 +484,4 @@ export class Router {
|
|
|
379
484
|
* @type {Router}
|
|
380
485
|
*/
|
|
381
486
|
export const router: Router;
|
|
487
|
+
import { PageCache } from './routes/page-cache.js';
|
|
@@ -4,6 +4,17 @@
|
|
|
4
4
|
* This will create a helper to create and destroy components
|
|
5
5
|
* that are added to a route.
|
|
6
6
|
*
|
|
7
|
+
* Keep-alive: when the route (or its component, or the router default)
|
|
8
|
+
* has `keepAlive` enabled, deactivating the route detaches the page
|
|
9
|
+
* root nodes from the document instead of destroying the component.
|
|
10
|
+
* Watchers, data and events stay alive, and the page is re-inserted
|
|
11
|
+
* as is when the route activates again. Keep-alive page components may
|
|
12
|
+
* define:
|
|
13
|
+
*
|
|
14
|
+
* - `onActivate(params, { restored })` called after the page is
|
|
15
|
+
* rendered (`restored: false`) or re-inserted (`restored: true`).
|
|
16
|
+
* - `onDeactivate()` called after the page is detached.
|
|
17
|
+
*
|
|
7
18
|
* @class
|
|
8
19
|
*/
|
|
9
20
|
export class ComponentHelper {
|
|
@@ -23,6 +34,60 @@ export class ComponentHelper {
|
|
|
23
34
|
container: any;
|
|
24
35
|
persist: any;
|
|
25
36
|
parent: any;
|
|
37
|
+
/**
|
|
38
|
+
* The route keep-alive setting. Null uses the component
|
|
39
|
+
* `keepAlive` or the router default.
|
|
40
|
+
*
|
|
41
|
+
* @type {boolean|null} keepAlive
|
|
42
|
+
*/
|
|
43
|
+
keepAlive: boolean | null;
|
|
44
|
+
/**
|
|
45
|
+
* The router page cache that tracks detached keep-alive
|
|
46
|
+
* pages and element scroll memory.
|
|
47
|
+
*
|
|
48
|
+
* @type {object|null} pageCache
|
|
49
|
+
*/
|
|
50
|
+
pageCache: object | null;
|
|
51
|
+
/**
|
|
52
|
+
* The root nodes of a detached keep-alive page, or null when
|
|
53
|
+
* the page is not cached.
|
|
54
|
+
*
|
|
55
|
+
* @type {Array<object>|null} detachedNodes
|
|
56
|
+
*/
|
|
57
|
+
detachedNodes: Array<object> | null;
|
|
58
|
+
/**
|
|
59
|
+
* The element scroll offsets of the detached page.
|
|
60
|
+
*
|
|
61
|
+
* @type {object|null} savedScroll
|
|
62
|
+
*/
|
|
63
|
+
savedScroll: object | null;
|
|
64
|
+
/**
|
|
65
|
+
* The last params the page was focused with.
|
|
66
|
+
*
|
|
67
|
+
* @type {object|null} params
|
|
68
|
+
*/
|
|
69
|
+
params: object | null;
|
|
70
|
+
/**
|
|
71
|
+
* Token that cancels a pending element scroll restore.
|
|
72
|
+
*
|
|
73
|
+
* @type {number} scrollToken
|
|
74
|
+
*/
|
|
75
|
+
scrollToken: number;
|
|
76
|
+
/**
|
|
77
|
+
* This will check if the route page is kept alive when the
|
|
78
|
+
* route deactivates. The route setting wins, then the component
|
|
79
|
+
* `keepAlive` property, then the router default.
|
|
80
|
+
*
|
|
81
|
+
* @param {object|null} [component]
|
|
82
|
+
* @returns {boolean}
|
|
83
|
+
*/
|
|
84
|
+
isKeepAlive(component?: object | null): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* This will check if the page is detached and cached.
|
|
87
|
+
*
|
|
88
|
+
* @returns {boolean}
|
|
89
|
+
*/
|
|
90
|
+
isDetached(): boolean;
|
|
26
91
|
/**
|
|
27
92
|
* This will create the component.
|
|
28
93
|
*
|
|
@@ -67,11 +132,107 @@ export class ComponentHelper {
|
|
|
67
132
|
*/
|
|
68
133
|
protected create(): void;
|
|
69
134
|
/**
|
|
70
|
-
* This will
|
|
135
|
+
* This will run the keep-alive and scroll memory work after the
|
|
136
|
+
* page has been rendered.
|
|
137
|
+
*
|
|
138
|
+
* @protected
|
|
139
|
+
* @param {object} params
|
|
140
|
+
* @returns {void}
|
|
141
|
+
*/
|
|
142
|
+
protected afterCreate(params: object): void;
|
|
143
|
+
/**
|
|
144
|
+
* This will be called when an imported page module rendered.
|
|
145
|
+
*
|
|
146
|
+
* @protected
|
|
147
|
+
* @param {object} component
|
|
148
|
+
* @returns {void}
|
|
149
|
+
*/
|
|
150
|
+
protected onModuleRender(component: object): void;
|
|
151
|
+
/**
|
|
152
|
+
* This will get the scroll memory key of the route page.
|
|
153
|
+
*
|
|
154
|
+
* @protected
|
|
155
|
+
* @returns {string}
|
|
156
|
+
*/
|
|
157
|
+
protected getScrollKey(): string;
|
|
158
|
+
/**
|
|
159
|
+
* This will get the root nodes of the rendered page. Imported
|
|
160
|
+
* pages render their layout next to the import placeholder, so
|
|
161
|
+
* those roots are included.
|
|
162
|
+
*
|
|
163
|
+
* @protected
|
|
164
|
+
* @param {object} component
|
|
165
|
+
* @returns {Array<object>}
|
|
166
|
+
*/
|
|
167
|
+
protected getRootNodes(component: object): Array<object>;
|
|
168
|
+
/**
|
|
169
|
+
* This will call a page lifecycle hook on the component and on
|
|
170
|
+
* an imported page component.
|
|
171
|
+
*
|
|
172
|
+
* @protected
|
|
173
|
+
* @param {string} name
|
|
174
|
+
* @param {Array<any>} args
|
|
175
|
+
* @returns {void}
|
|
176
|
+
*/
|
|
177
|
+
protected callPageHook(name: string, args: Array<any>): void;
|
|
178
|
+
/**
|
|
179
|
+
* This will restore the saved element scroll of a re-rendered
|
|
180
|
+
* page on history navigation. The content may still be loading,
|
|
181
|
+
* so it is retried each frame for a short window.
|
|
182
|
+
*
|
|
183
|
+
* @protected
|
|
184
|
+
* @returns {void}
|
|
185
|
+
*/
|
|
186
|
+
protected restoreHistoryScroll(): void;
|
|
187
|
+
/**
|
|
188
|
+
* This will restore the element scroll of a re-inserted page.
|
|
189
|
+
* The page keeps its content, so this is done synchronously
|
|
190
|
+
* before the next paint.
|
|
191
|
+
*
|
|
192
|
+
* @protected
|
|
193
|
+
* @returns {void}
|
|
194
|
+
*/
|
|
195
|
+
protected restoreDetachedScroll(): void;
|
|
196
|
+
/**
|
|
197
|
+
* This will detach a keep-alive page from the document without
|
|
198
|
+
* destroying it. Watchers, data and events stay alive.
|
|
199
|
+
*
|
|
200
|
+
* @protected
|
|
201
|
+
* @param {object} component
|
|
202
|
+
* @returns {boolean} false when the page can not be detached.
|
|
203
|
+
*/
|
|
204
|
+
protected detach(component: object): boolean;
|
|
205
|
+
/**
|
|
206
|
+
* This will re-insert a detached keep-alive page.
|
|
207
|
+
*
|
|
208
|
+
* @protected
|
|
209
|
+
* @returns {boolean} false when the page was destroyed while
|
|
210
|
+
* it was detached.
|
|
211
|
+
*/
|
|
212
|
+
protected reattach(): boolean;
|
|
213
|
+
/**
|
|
214
|
+
* This will destroy a detached keep-alive page. This is called
|
|
215
|
+
* by the page cache when the page is evicted.
|
|
216
|
+
*
|
|
217
|
+
* @returns {void}
|
|
218
|
+
*/
|
|
219
|
+
evict(): void;
|
|
220
|
+
/**
|
|
221
|
+
* This will destroy the component.
|
|
222
|
+
*
|
|
223
|
+
* @protected
|
|
224
|
+
* @returns {void}
|
|
225
|
+
*/
|
|
226
|
+
protected releaseComponent(): void;
|
|
227
|
+
/**
|
|
228
|
+
* This will remove the component. A keep-alive page is detached
|
|
229
|
+
* and cached instead of destroyed unless `destroy` is true.
|
|
71
230
|
*
|
|
231
|
+
* @param {boolean} [destroy] - true to always destroy the page,
|
|
232
|
+
* including a detached keep-alive page (route removal/teardown).
|
|
72
233
|
* @returns {void}
|
|
73
234
|
*/
|
|
74
|
-
remove(): void;
|
|
235
|
+
remove(destroy?: boolean): void;
|
|
75
236
|
/**
|
|
76
237
|
* This will call the component update method and pass the params.
|
|
77
238
|
*
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Element scroll memory
|
|
3
|
+
*
|
|
4
|
+
* Elements inside a route page that carry a `data-scroll-key`
|
|
5
|
+
* attribute have their scrollTop / scrollLeft saved when the route
|
|
6
|
+
* deactivates and restored when it activates again. Detaching an
|
|
7
|
+
* element from the document resets its scroll offsets, so this is
|
|
8
|
+
* required for keep-alive pages and also lets re-rendered pages restore
|
|
9
|
+
* their inner scroll panes on history navigation.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* @type {string} SCROLL_KEY_ATTR
|
|
15
|
+
*/
|
|
16
|
+
export const SCROLL_KEY_ATTR: string;
|
|
17
|
+
export function saveElementScroll(nodes: Array<object>): object | null;
|
|
18
|
+
export function restoreElementScroll(nodes: Array<object>, saved: object | null): boolean;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The default number of detached keep-alive pages.
|
|
3
|
+
*
|
|
4
|
+
* @type {number} DEFAULT_MAX
|
|
5
|
+
*/
|
|
6
|
+
export const DEFAULT_KEEP_ALIVE_MAX: number;
|
|
7
|
+
/**
|
|
8
|
+
* PageCache
|
|
9
|
+
*
|
|
10
|
+
* This will track the keep-alive route pages that are detached from
|
|
11
|
+
* the document for a router. The cache is ordered by recency so the
|
|
12
|
+
* least recently used page is evicted (really destroyed) once more than
|
|
13
|
+
* `max` pages are detached.
|
|
14
|
+
*
|
|
15
|
+
* It also keeps a bounded memory of element scroll offsets
|
|
16
|
+
* (`data-scroll-key`) per route and path.
|
|
17
|
+
*
|
|
18
|
+
* @class
|
|
19
|
+
*/
|
|
20
|
+
export class PageCache {
|
|
21
|
+
/**
|
|
22
|
+
* This will create a page cache.
|
|
23
|
+
*
|
|
24
|
+
* @constructor
|
|
25
|
+
* @param {object} [owner] The router that owns the cache. The
|
|
26
|
+
* `keepAlive` and `keepAliveMax` settings are read from it so they
|
|
27
|
+
* can be changed at any time.
|
|
28
|
+
*/
|
|
29
|
+
constructor(owner?: object);
|
|
30
|
+
/**
|
|
31
|
+
* @type {object|null} owner
|
|
32
|
+
*/
|
|
33
|
+
owner: object | null;
|
|
34
|
+
/**
|
|
35
|
+
* Detached page helpers in least recently used order.
|
|
36
|
+
*
|
|
37
|
+
* @type {Set<object>} pages
|
|
38
|
+
*/
|
|
39
|
+
pages: Set<object>;
|
|
40
|
+
/**
|
|
41
|
+
* @type {LRUCache} scrollMemory
|
|
42
|
+
*/
|
|
43
|
+
scrollMemory: LRUCache;
|
|
44
|
+
/**
|
|
45
|
+
* This is set by the router while routes are checked for a
|
|
46
|
+
* history (back / forward) navigation.
|
|
47
|
+
*
|
|
48
|
+
* @type {boolean} historyNavigation
|
|
49
|
+
*/
|
|
50
|
+
historyNavigation: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* This will check if keep-alive is the router default.
|
|
53
|
+
*
|
|
54
|
+
* @returns {boolean}
|
|
55
|
+
*/
|
|
56
|
+
isEnabled(): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* This will get the max detached pages.
|
|
59
|
+
*
|
|
60
|
+
* @returns {number}
|
|
61
|
+
*/
|
|
62
|
+
getMax(): number;
|
|
63
|
+
/**
|
|
64
|
+
* This will get the detached page count.
|
|
65
|
+
*
|
|
66
|
+
* @returns {number}
|
|
67
|
+
*/
|
|
68
|
+
get size(): number;
|
|
69
|
+
/**
|
|
70
|
+
* This will add a detached page as the most recently used and
|
|
71
|
+
* evict the least recently used pages over the max.
|
|
72
|
+
*
|
|
73
|
+
* @param {object} helper
|
|
74
|
+
* @returns {void}
|
|
75
|
+
*/
|
|
76
|
+
add(helper: object): void;
|
|
77
|
+
/**
|
|
78
|
+
* This will remove a page without destroying it (it has been
|
|
79
|
+
* re-activated or destroyed by its owner).
|
|
80
|
+
*
|
|
81
|
+
* @param {object} helper
|
|
82
|
+
* @returns {void}
|
|
83
|
+
*/
|
|
84
|
+
delete(helper: object): void;
|
|
85
|
+
/**
|
|
86
|
+
* This will evict the least recently used pages over the max.
|
|
87
|
+
*
|
|
88
|
+
* @returns {void}
|
|
89
|
+
*/
|
|
90
|
+
trim(): void;
|
|
91
|
+
/**
|
|
92
|
+
* This will destroy every detached page.
|
|
93
|
+
*
|
|
94
|
+
* @returns {void}
|
|
95
|
+
*/
|
|
96
|
+
clear(): void;
|
|
97
|
+
/**
|
|
98
|
+
* This will save element scroll offsets.
|
|
99
|
+
*
|
|
100
|
+
* @param {string} key
|
|
101
|
+
* @param {object|null} offsets
|
|
102
|
+
* @returns {void}
|
|
103
|
+
*/
|
|
104
|
+
saveScroll(key: string, offsets: object | null): void;
|
|
105
|
+
/**
|
|
106
|
+
* This will get saved element scroll offsets.
|
|
107
|
+
*
|
|
108
|
+
* @param {string} key
|
|
109
|
+
* @returns {object|null}
|
|
110
|
+
*/
|
|
111
|
+
getScroll(key: string): object | null;
|
|
112
|
+
}
|
|
113
|
+
import { LRUCache } from '../../../shared/lru-cache.js';
|
|
@@ -13,12 +13,14 @@ export class Route extends BasicData {
|
|
|
13
13
|
* @constructor
|
|
14
14
|
* @param {object} settings
|
|
15
15
|
* @param {function} titleCallBack
|
|
16
|
+
* @param {object|null} [pageCache] The router keep-alive page cache.
|
|
16
17
|
*/
|
|
17
|
-
constructor(settings: object, titleCallBack: Function);
|
|
18
|
+
constructor(settings: object, titleCallBack: Function, pageCache?: object | null);
|
|
18
19
|
uri: any;
|
|
19
20
|
matchUri: string;
|
|
20
21
|
paramKeys: string[];
|
|
21
22
|
titleCallBack: Function;
|
|
23
|
+
pageCache: any;
|
|
22
24
|
routeId: any;
|
|
23
25
|
rawUri: any;
|
|
24
26
|
uriQuery: RegExp;
|
|
@@ -52,11 +54,22 @@ export class Route extends BasicData {
|
|
|
52
54
|
*/
|
|
53
55
|
setTitle(title: string | Function): void;
|
|
54
56
|
/**
|
|
55
|
-
* This will deactivate the route.
|
|
57
|
+
* This will deactivate the route. A keep-alive route page is
|
|
58
|
+
* detached and cached unless `destroy` is true.
|
|
56
59
|
*
|
|
60
|
+
* @param {boolean} [destroy] - true to destroy the page even
|
|
61
|
+
* when it is kept alive (route removal and router teardown).
|
|
57
62
|
* @returns {void}
|
|
58
63
|
*/
|
|
59
|
-
deactivate(): void;
|
|
64
|
+
deactivate(destroy?: boolean): void;
|
|
65
|
+
/**
|
|
66
|
+
* This will check if the route page is detached from the
|
|
67
|
+
* document because it is kept alive, or because the route
|
|
68
|
+
* container is inside a detached keep-alive page.
|
|
69
|
+
*
|
|
70
|
+
* @returns {boolean}
|
|
71
|
+
*/
|
|
72
|
+
isDormant(): boolean;
|
|
60
73
|
/**
|
|
61
74
|
* This will get the route layout.
|
|
62
75
|
*
|