@base-framework/base 3.9.7 → 3.9.8
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/base.js +1 -1
- package/dist/chunks/chunk-3X6POBEJ.js +2 -0
- package/dist/chunks/chunk-E3C6NOMV.js +2 -0
- package/dist/chunks/chunk-FRCLWWKS.js +2 -0
- package/dist/chunks/chunk-G5VVBURO.js +2 -0
- package/dist/chunks/chunk-IHAOOHJB.js +2 -0
- package/dist/chunks/chunk-IHTCTRTS.js +2 -0
- package/dist/chunks/chunk-J4K3HIHH.js +2 -0
- package/dist/chunks/chunk-MXSQXT7V.js +2 -0
- package/dist/chunks/chunk-SHTKCUQM.js +2 -0
- package/dist/chunks/chunk-UOSGJOHK.js +2 -0
- package/dist/chunks/chunk-XHKEEED5.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/modules/animations/animation.d.ts +7 -0
- package/dist/types/modules/component/state-helper.d.ts +22 -6
- package/dist/types/modules/data/types/basic-data.d.ts +31 -15
- package/dist/types/modules/data/types/deep-data/data-utils.d.ts +1 -15
- package/dist/types/modules/data-binder/data-pub-sub.d.ts +38 -0
- package/dist/types/modules/router/utils.d.ts +11 -0
- package/dist/types/modules/state/state-tracker.d.ts +48 -6
- package/dist/types/shared/lru-cache.d.ts +77 -0
- package/package.json +1 -1
|
@@ -29,6 +29,13 @@ export class Animation {
|
|
|
29
29
|
* @returns {void}
|
|
30
30
|
*/
|
|
31
31
|
addMovement(property: any): void;
|
|
32
|
+
/**
|
|
33
|
+
* Step every movement of the animation.
|
|
34
|
+
*
|
|
35
|
+
* @param {number} delta - The eased progress of the animation (0-1).
|
|
36
|
+
* @returns {void}
|
|
37
|
+
*/
|
|
38
|
+
step(delta: number): void;
|
|
32
39
|
/**
|
|
33
40
|
* Setup the movements for the animation.
|
|
34
41
|
*
|
|
@@ -18,6 +18,14 @@ export class StateHelper {
|
|
|
18
18
|
* @type {Array<any>} remoteStates
|
|
19
19
|
*/
|
|
20
20
|
remoteStates: Array<any>;
|
|
21
|
+
/**
|
|
22
|
+
* Actions that registered a callBack on the local target.
|
|
23
|
+
* The subscription token has to be kept or the callBack can
|
|
24
|
+
* never be released.
|
|
25
|
+
*
|
|
26
|
+
* @type {Array<any>} callBackStates
|
|
27
|
+
*/
|
|
28
|
+
callBackStates: Array<any>;
|
|
21
29
|
/**
|
|
22
30
|
* This will add states to a state.
|
|
23
31
|
*
|
|
@@ -60,6 +68,14 @@ export class StateHelper {
|
|
|
60
68
|
* @returns {void}
|
|
61
69
|
*/
|
|
62
70
|
removeRemoteStates(state: object): void;
|
|
71
|
+
/**
|
|
72
|
+
* This will release the action callBacks registered on the
|
|
73
|
+
* local target.
|
|
74
|
+
*
|
|
75
|
+
* @param {object} state
|
|
76
|
+
* @returns {void}
|
|
77
|
+
*/
|
|
78
|
+
removeLocalStates(state: object): void;
|
|
63
79
|
/**
|
|
64
80
|
* This will remove the actions.
|
|
65
81
|
*
|
|
@@ -81,17 +97,17 @@ export class StateHelper {
|
|
|
81
97
|
* @param {object} target
|
|
82
98
|
* @param {string} actionEvent
|
|
83
99
|
* @param {string} remoteTargetId
|
|
84
|
-
* @returns {
|
|
100
|
+
* @returns {number} The link token.
|
|
85
101
|
*/
|
|
86
|
-
bindRemoteState(target: object, actionEvent: string, remoteTargetId: string):
|
|
102
|
+
bindRemoteState(target: object, actionEvent: string, remoteTargetId: string): number;
|
|
87
103
|
/**
|
|
88
104
|
* This will unbind a remote state.
|
|
89
105
|
*
|
|
90
106
|
* @param {object} target
|
|
91
|
-
* @param {
|
|
107
|
+
* @param {number} token
|
|
92
108
|
* @return {void}
|
|
93
109
|
*/
|
|
94
|
-
unbindRemoteState(target: object, token:
|
|
110
|
+
unbindRemoteState(target: object, token: number): void;
|
|
95
111
|
/**
|
|
96
112
|
* This will add the states to the target.
|
|
97
113
|
*
|
|
@@ -106,7 +122,7 @@ export class StateHelper {
|
|
|
106
122
|
*
|
|
107
123
|
* @param {object} target
|
|
108
124
|
* @param {object} action
|
|
109
|
-
* @returns {
|
|
125
|
+
* @returns {number|null}
|
|
110
126
|
*/
|
|
111
|
-
addAction(target: object, action: object):
|
|
127
|
+
addAction(target: object, action: object): number | null;
|
|
112
128
|
}
|
|
@@ -58,11 +58,20 @@ export class BasicData {
|
|
|
58
58
|
*/
|
|
59
59
|
_refreshState: boolean;
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
61
|
+
* Link records keyed by subscription token.
|
|
62
|
+
*
|
|
63
|
+
* Tokens are the numbers handed out by the event sub, so both
|
|
64
|
+
* sides of a link pair must key and read this map with a
|
|
65
|
+
* number. A stringified token would delete nothing.
|
|
66
|
+
*
|
|
67
|
+
* @type {Map<number, {data: object, attr: string, pair: number}>} links
|
|
63
68
|
* @protected
|
|
64
69
|
*/
|
|
65
|
-
protected links:
|
|
70
|
+
protected links: Map<number, {
|
|
71
|
+
data: object;
|
|
72
|
+
attr: string;
|
|
73
|
+
pair: number;
|
|
74
|
+
}>;
|
|
66
75
|
/**
|
|
67
76
|
* @type {string} dataTypeId
|
|
68
77
|
*/
|
|
@@ -137,7 +146,8 @@ export class BasicData {
|
|
|
137
146
|
*/
|
|
138
147
|
getDataId(): string;
|
|
139
148
|
/**
|
|
140
|
-
* This
|
|
149
|
+
* This will release every subscription and link the data
|
|
150
|
+
* source holds.
|
|
141
151
|
*
|
|
142
152
|
* @returns {void}
|
|
143
153
|
*/
|
|
@@ -347,41 +357,47 @@ export class BasicData {
|
|
|
347
357
|
* @param {object} data
|
|
348
358
|
* @param {string|object} attr
|
|
349
359
|
* @param {string} alias
|
|
350
|
-
* @returns {
|
|
360
|
+
* @returns {number|Array<number>}
|
|
351
361
|
*/
|
|
352
|
-
link(data: object, attr: string | object, alias: string, ...args: any[]):
|
|
362
|
+
link(data: object, attr: string | object, alias: string, ...args: any[]): number | Array<number>;
|
|
353
363
|
/**
|
|
354
364
|
* This will link a remote data source by property.
|
|
355
365
|
*
|
|
356
366
|
* @param {object} data
|
|
357
367
|
* @param {string} attr
|
|
358
368
|
* @param {string} [alias]
|
|
359
|
-
* @returns {
|
|
369
|
+
* @returns {number} The subscription token.
|
|
360
370
|
*/
|
|
361
|
-
remoteLink(data: object, attr: string, alias?: string):
|
|
371
|
+
remoteLink(data: object, attr: string, alias?: string): number;
|
|
362
372
|
/**
|
|
363
|
-
* This will add a link token to the links
|
|
373
|
+
* This will add a link token to the links map.
|
|
364
374
|
*
|
|
365
|
-
*
|
|
375
|
+
* The attr name is what makes the link removable: subscriptions
|
|
376
|
+
* are registered per attr message, so a record without one can
|
|
377
|
+
* only be forgotten, not unsubscribed.
|
|
378
|
+
*
|
|
379
|
+
* @param {number} token
|
|
366
380
|
* @param {object} data
|
|
381
|
+
* @param {string} [attr]
|
|
382
|
+
* @param {number} [pair] The token of the opposite direction.
|
|
367
383
|
* @returns {void}
|
|
368
384
|
*/
|
|
369
|
-
addLink(token:
|
|
385
|
+
addLink(token: number, data: object, attr?: string, pair?: number): void;
|
|
370
386
|
/**
|
|
371
387
|
* This will remove a link or all links if no token is provided.
|
|
372
388
|
*
|
|
373
|
-
* @param {
|
|
389
|
+
* @param {number|null} [token=null]
|
|
374
390
|
* @returns {void}
|
|
375
391
|
*/
|
|
376
|
-
unlink(token?:
|
|
392
|
+
unlink(token?: number | null): void;
|
|
377
393
|
/**
|
|
378
394
|
* This will remove the linked subscription.
|
|
379
395
|
*
|
|
380
|
-
* @param {
|
|
396
|
+
* @param {number} token
|
|
381
397
|
* @param {boolean} [removeFromLinks=true]
|
|
382
398
|
* @returns {void}
|
|
383
399
|
*/
|
|
384
|
-
removeLink(token:
|
|
400
|
+
removeLink(token: number, removeFromLinks?: boolean): void;
|
|
385
401
|
isData: boolean;
|
|
386
402
|
}
|
|
387
403
|
import { DataPubSub } from '../../data-binder/data-pub-sub.js';
|
|
@@ -25,18 +25,4 @@ export namespace DataUtils {
|
|
|
25
25
|
*/
|
|
26
26
|
function getSegments(str: string): Array<any> | null;
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
* Simple LRU Cache implementation for caching parsed path segments.
|
|
30
|
-
* Caches up to 1000 most recently used paths (~50KB memory overhead).
|
|
31
|
-
*
|
|
32
|
-
* @class
|
|
33
|
-
*/
|
|
34
|
-
declare class LRUCache {
|
|
35
|
-
constructor(maxSize?: number);
|
|
36
|
-
cache: Map<any, any>;
|
|
37
|
-
maxSize: number;
|
|
38
|
-
get(key: any): any;
|
|
39
|
-
set(key: any, value: any): void;
|
|
40
|
-
clear(): void;
|
|
41
|
-
}
|
|
42
|
-
export {};
|
|
28
|
+
import { LRUCache } from '../../../../shared/lru-cache.js';
|
|
@@ -83,6 +83,31 @@ export class DataPubSub {
|
|
|
83
83
|
* @protected
|
|
84
84
|
*/
|
|
85
85
|
protected flushCallbacks: Array<Function>;
|
|
86
|
+
/**
|
|
87
|
+
* The message currently being delivered, used to spot a
|
|
88
|
+
* subscriber that re-publishes its own message.
|
|
89
|
+
*
|
|
90
|
+
* @type {string|null}
|
|
91
|
+
* @protected
|
|
92
|
+
*/
|
|
93
|
+
protected deliveringMessage: string | null;
|
|
94
|
+
/**
|
|
95
|
+
* Messages whose own subscribers re-published them during the
|
|
96
|
+
* current flush cycle. Allocated only when it happens.
|
|
97
|
+
*
|
|
98
|
+
* @type {Set<string>|null}
|
|
99
|
+
* @protected
|
|
100
|
+
*/
|
|
101
|
+
protected reentrantMessages: Set<string> | null;
|
|
102
|
+
/**
|
|
103
|
+
* When true, publishes are dropped instead of queued. Set
|
|
104
|
+
* while the flush breaker drains the surviving updates so the
|
|
105
|
+
* runaway cascade cannot restart.
|
|
106
|
+
*
|
|
107
|
+
* @type {boolean}
|
|
108
|
+
* @protected
|
|
109
|
+
*/
|
|
110
|
+
protected suppressQueue: boolean;
|
|
86
111
|
/**
|
|
87
112
|
* This will get a subscriber array.
|
|
88
113
|
*
|
|
@@ -183,6 +208,19 @@ export class DataPubSub {
|
|
|
183
208
|
* @returns {void}
|
|
184
209
|
*/
|
|
185
210
|
flush(): void;
|
|
211
|
+
/**
|
|
212
|
+
* Stop a runaway cascade without discarding the updates that
|
|
213
|
+
* were only queued alongside it.
|
|
214
|
+
*
|
|
215
|
+
* Dropping the whole queue loses the last value of every
|
|
216
|
+
* unrelated message. Only the self-republishing messages are
|
|
217
|
+
* dropped; the rest are delivered once with queueing suppressed,
|
|
218
|
+
* which guarantees the loop cannot restart.
|
|
219
|
+
*
|
|
220
|
+
* @protected
|
|
221
|
+
* @returns {void}
|
|
222
|
+
*/
|
|
223
|
+
protected _breakCascade(): void;
|
|
186
224
|
/**
|
|
187
225
|
* Resolve all pending flush completion promises and execute callbacks.
|
|
188
226
|
*
|
|
@@ -6,4 +6,15 @@ export namespace Utils {
|
|
|
6
6
|
* @returns {string}
|
|
7
7
|
*/
|
|
8
8
|
function removeSlashes(uri: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* This will get the pathname style uri from a hash url.
|
|
11
|
+
*
|
|
12
|
+
* The hashchange event reports absolute urls, but route patterns
|
|
13
|
+
* are anchored against the uri that `Router.getPath()` produces
|
|
14
|
+
* for hash routing, which is the hash without its '#'.
|
|
15
|
+
*
|
|
16
|
+
* @param {string} url
|
|
17
|
+
* @returns {string}
|
|
18
|
+
*/
|
|
19
|
+
function getHashUri(url: string): string;
|
|
9
20
|
}
|
|
@@ -13,6 +13,19 @@ export class StateTracker {
|
|
|
13
13
|
* @private
|
|
14
14
|
*/
|
|
15
15
|
private static targets;
|
|
16
|
+
/**
|
|
17
|
+
* The number of owners that have attached to each target.
|
|
18
|
+
*
|
|
19
|
+
* Targets are keyed by the owning component's unique instance id,
|
|
20
|
+
* so without a release path the map grows by one entry per mount
|
|
21
|
+
* and never shrinks. Counting owners keeps ids that are shared on
|
|
22
|
+
* purpose (a `stateTargetId` override) alive until the last one
|
|
23
|
+
* detaches.
|
|
24
|
+
*
|
|
25
|
+
* @type {Map<string, number>} ownerCounts
|
|
26
|
+
* @private
|
|
27
|
+
*/
|
|
28
|
+
private static ownerCounts;
|
|
16
29
|
/**
|
|
17
30
|
* This will restore a state target.
|
|
18
31
|
*
|
|
@@ -28,6 +41,35 @@ export class StateTracker {
|
|
|
28
41
|
* @returns {StateTarget}
|
|
29
42
|
*/
|
|
30
43
|
static getTarget(id: string): StateTarget;
|
|
44
|
+
/**
|
|
45
|
+
* This will get the state target and claim ownership of it.
|
|
46
|
+
*
|
|
47
|
+
* Every attach must be paired with a detach or the target is
|
|
48
|
+
* retained for the life of the page.
|
|
49
|
+
*
|
|
50
|
+
* @param {string} id
|
|
51
|
+
* @returns {StateTarget}
|
|
52
|
+
*/
|
|
53
|
+
static attach(id: string): StateTarget;
|
|
54
|
+
/**
|
|
55
|
+
* This will record an owner of a target.
|
|
56
|
+
*
|
|
57
|
+
* @protected
|
|
58
|
+
* @param {string} id
|
|
59
|
+
* @returns {void}
|
|
60
|
+
*/
|
|
61
|
+
protected static addOwner(id: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* This will release an owner of a state target. The target is
|
|
64
|
+
* reset and dropped once the last owner detaches.
|
|
65
|
+
*
|
|
66
|
+
* Ids that were never attached (targets created on demand by
|
|
67
|
+
* getTarget, e.g. app level states) are left alone.
|
|
68
|
+
*
|
|
69
|
+
* @param {string} id
|
|
70
|
+
* @returns {void}
|
|
71
|
+
*/
|
|
72
|
+
static detach(id: string): void;
|
|
31
73
|
/**
|
|
32
74
|
* This will get the state of an action.
|
|
33
75
|
*
|
|
@@ -60,10 +102,10 @@ export class StateTracker {
|
|
|
60
102
|
*
|
|
61
103
|
* @param {string} targetId
|
|
62
104
|
* @param {string} action
|
|
63
|
-
* @param {
|
|
105
|
+
* @param {number} [token]
|
|
64
106
|
* @returns {void}
|
|
65
107
|
*/
|
|
66
|
-
static removeAction(targetId: string, action: string, token?:
|
|
108
|
+
static removeAction(targetId: string, action: string, token?: number): void;
|
|
67
109
|
/**
|
|
68
110
|
* This will add a new subscriber to the action.
|
|
69
111
|
*
|
|
@@ -78,19 +120,19 @@ export class StateTracker {
|
|
|
78
120
|
*
|
|
79
121
|
* @param {string} targetId
|
|
80
122
|
* @param {string} action
|
|
81
|
-
* @param {
|
|
123
|
+
* @param {number} token
|
|
82
124
|
* @returns {void}
|
|
83
125
|
*/
|
|
84
|
-
static off(targetId: string, action: string, token:
|
|
126
|
+
static off(targetId: string, action: string, token: number): void;
|
|
85
127
|
/**
|
|
86
128
|
* This will remove a target or action or callBack.
|
|
87
129
|
*
|
|
88
130
|
* @param {string} targetId
|
|
89
131
|
* @param {string} [action]
|
|
90
|
-
* @param {
|
|
132
|
+
* @param {number} [token]
|
|
91
133
|
* @returns {void}
|
|
92
134
|
*/
|
|
93
|
-
static remove(targetId: string, action?: string, token?:
|
|
135
|
+
static remove(targetId: string, action?: string, token?: number): void;
|
|
94
136
|
/**
|
|
95
137
|
* This will set the action state.
|
|
96
138
|
*
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LRUCache
|
|
3
|
+
*
|
|
4
|
+
* A bounded cache with least-recently-used eviction, used to keep
|
|
5
|
+
* the module level parse/lookup caches from growing for the life of
|
|
6
|
+
* the page.
|
|
7
|
+
*
|
|
8
|
+
* Recency is the Map's own insertion order: re-inserting a key moves
|
|
9
|
+
* it to the end, so the first key returned by the iterator is always
|
|
10
|
+
* the least recently used one.
|
|
11
|
+
*
|
|
12
|
+
* @class
|
|
13
|
+
*/
|
|
14
|
+
export class LRUCache {
|
|
15
|
+
/**
|
|
16
|
+
* This will create an LRU cache.
|
|
17
|
+
*
|
|
18
|
+
* @constructor
|
|
19
|
+
* @param {number} [maxSize=1000]
|
|
20
|
+
*/
|
|
21
|
+
constructor(maxSize?: number);
|
|
22
|
+
/**
|
|
23
|
+
* @type {Map<*, *>} cache
|
|
24
|
+
* @protected
|
|
25
|
+
*/
|
|
26
|
+
protected cache: Map<any, any>;
|
|
27
|
+
/**
|
|
28
|
+
* @type {number} maxSize
|
|
29
|
+
*/
|
|
30
|
+
maxSize: number;
|
|
31
|
+
/**
|
|
32
|
+
* The most recently used key. Reads of the hottest key are by
|
|
33
|
+
* far the common case, and comparing against this avoids the
|
|
34
|
+
* delete/set pair that promotion would otherwise cost.
|
|
35
|
+
*
|
|
36
|
+
* @type {*} lastKey
|
|
37
|
+
* @protected
|
|
38
|
+
*/
|
|
39
|
+
protected lastKey: any;
|
|
40
|
+
/**
|
|
41
|
+
* This will get a value and promote the key to most recently
|
|
42
|
+
* used.
|
|
43
|
+
*
|
|
44
|
+
* @param {*} key
|
|
45
|
+
* @returns {*} The value or undefined when not cached.
|
|
46
|
+
*/
|
|
47
|
+
get(key: any): any;
|
|
48
|
+
/**
|
|
49
|
+
* This will check if a key is cached without promoting it.
|
|
50
|
+
*
|
|
51
|
+
* @param {*} key
|
|
52
|
+
* @returns {boolean}
|
|
53
|
+
*/
|
|
54
|
+
has(key: any): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* This will add a value and promote the key to most recently
|
|
57
|
+
* used, evicting the least recently used key when over capacity.
|
|
58
|
+
*
|
|
59
|
+
* @param {*} key
|
|
60
|
+
* @param {*} value
|
|
61
|
+
* @returns {void}
|
|
62
|
+
*/
|
|
63
|
+
set(key: any, value: any): void;
|
|
64
|
+
/**
|
|
65
|
+
* This will remove a key.
|
|
66
|
+
*
|
|
67
|
+
* @param {*} key
|
|
68
|
+
* @returns {void}
|
|
69
|
+
*/
|
|
70
|
+
delete(key: any): void;
|
|
71
|
+
/**
|
|
72
|
+
* This will empty the cache.
|
|
73
|
+
*
|
|
74
|
+
* @returns {void}
|
|
75
|
+
*/
|
|
76
|
+
clear(): void;
|
|
77
|
+
}
|