@base-framework/base 3.9.17 → 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-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
|
@@ -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
|
*
|