chayns-api 3.0.0 → 3.1.0-beta.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/dist/cjs/calls/index.js +4 -1
- package/dist/cjs/calls/visibilityChangeListener.js +4 -4
- package/dist/cjs/components/ChaynsProvider.js +34 -6
- package/dist/cjs/components/withHydrationBoundary.js +2 -2
- package/dist/cjs/constants/index.js +0 -22
- package/dist/cjs/contexts/HistoryLayerContext.js +89 -0
- package/dist/cjs/contexts/index.js +38 -0
- package/dist/cjs/handler/history/FrameHistoryLayer.js +100 -0
- package/dist/cjs/handler/history/HistoryLayer.js +321 -0
- package/dist/cjs/handler/history/index.js +19 -0
- package/dist/cjs/hooks/history.js +454 -0
- package/dist/cjs/hooks/index.js +62 -1
- package/dist/cjs/host/ChaynsHost.js +113 -54
- package/dist/cjs/host/iframe/HostIframe.js +70 -5
- package/dist/cjs/host/module/ModuleHost.js +50 -44
- package/dist/cjs/index.js +139 -6
- package/dist/cjs/types/history.js +1 -0
- package/dist/cjs/umd.index.js +2 -2
- package/dist/cjs/utils/EventBus.js +33 -0
- package/dist/cjs/{util → utils}/appStorage.js +2 -2
- package/dist/cjs/utils/equality.js +19 -0
- package/dist/cjs/utils/history/BlockRegistry.js +110 -0
- package/dist/cjs/utils/history/NavigationQueue.js +388 -0
- package/dist/cjs/utils/history/layerTree.js +32 -0
- package/dist/cjs/utils/history/navigationIndex.js +42 -0
- package/dist/cjs/utils/history/rootLayer.js +175 -0
- package/dist/cjs/utils/history/segments.js +15 -0
- package/dist/cjs/utils/history/stateProjector.js +156 -0
- package/dist/cjs/utils/history/url.js +47 -0
- package/dist/cjs/utils/history/window.js +9 -0
- package/dist/cjs/wrapper/AppWrapper.js +23 -23
- package/dist/cjs/wrapper/FrameWrapper.js +35 -2
- package/dist/cjs/wrapper/ModuleFederationWrapper.js +2 -0
- package/dist/cjs/wrapper/StaticChaynsApi.js +1 -1
- package/dist/esm/calls/index.js +2 -0
- package/dist/esm/calls/visibilityChangeListener.js +1 -1
- package/dist/esm/components/ChaynsProvider.js +34 -6
- package/dist/esm/components/withHydrationBoundary.js +1 -1
- package/dist/esm/constants/index.js +1 -3
- package/dist/esm/contexts/HistoryLayerContext.js +76 -0
- package/dist/esm/contexts/index.js +3 -0
- package/dist/esm/handler/history/FrameHistoryLayer.js +105 -0
- package/dist/esm/handler/history/HistoryLayer.js +321 -0
- package/dist/esm/handler/history/index.js +2 -0
- package/dist/esm/hooks/history.js +428 -0
- package/dist/esm/hooks/index.js +2 -1
- package/dist/esm/host/ChaynsHost.js +113 -54
- package/dist/esm/host/iframe/HostIframe.js +70 -5
- package/dist/esm/host/module/ModuleHost.js +50 -44
- package/dist/esm/index.js +15 -6
- package/dist/esm/types/history.js +1 -0
- package/dist/esm/umd.index.js +2 -2
- package/dist/esm/utils/EventBus.js +31 -0
- package/dist/esm/{util → utils}/appStorage.js +1 -1
- package/dist/esm/utils/equality.js +12 -0
- package/dist/esm/utils/history/BlockRegistry.js +108 -0
- package/dist/esm/utils/history/NavigationQueue.js +385 -0
- package/dist/esm/utils/history/layerTree.js +24 -0
- package/dist/esm/utils/history/navigationIndex.js +33 -0
- package/dist/esm/utils/history/rootLayer.js +167 -0
- package/dist/esm/utils/history/segments.js +7 -0
- package/dist/esm/utils/history/stateProjector.js +147 -0
- package/dist/esm/utils/history/url.js +40 -0
- package/dist/esm/utils/history/window.js +3 -0
- package/dist/esm/wrapper/AppWrapper.js +5 -5
- package/dist/esm/wrapper/FrameWrapper.js +35 -2
- package/dist/esm/wrapper/ModuleFederationWrapper.js +2 -0
- package/dist/esm/wrapper/StaticChaynsApi.js +2 -1
- package/dist/types/calls/index.d.ts +5 -0
- package/dist/types/components/ChaynsProvider.d.ts +21 -0
- package/dist/types/constants/index.d.ts +0 -2
- package/dist/types/contexts/HistoryLayerContext.d.ts +33 -0
- package/dist/types/contexts/index.d.ts +3 -0
- package/dist/types/handler/history/FrameHistoryLayer.d.ts +99 -0
- package/dist/types/handler/history/HistoryLayer.d.ts +117 -0
- package/dist/types/handler/history/index.d.ts +2 -0
- package/dist/types/hooks/history.d.ts +89 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/host/ChaynsHost.d.ts +12 -0
- package/dist/types/host/iframe/HostIframe.d.ts +4 -0
- package/dist/types/host/module/ModuleHost.d.ts +4 -0
- package/dist/types/index.d.ts +15 -6
- package/dist/types/types/IChaynsReact.d.ts +3 -0
- package/dist/types/types/history.d.ts +74 -0
- package/dist/types/umd.index.d.ts +2 -2
- package/dist/types/utils/EventBus.d.ts +10 -0
- package/dist/types/{util → utils}/collectCssChunks.d.ts +1 -1
- package/dist/types/utils/equality.d.ts +2 -0
- package/dist/types/utils/history/BlockRegistry.d.ts +38 -0
- package/dist/types/utils/history/NavigationQueue.d.ts +109 -0
- package/dist/types/utils/history/layerTree.d.ts +10 -0
- package/dist/types/utils/history/navigationIndex.d.ts +14 -0
- package/dist/types/utils/history/rootLayer.d.ts +42 -0
- package/dist/types/utils/history/segments.d.ts +2 -0
- package/dist/types/utils/history/stateProjector.d.ts +24 -0
- package/dist/types/utils/history/url.d.ts +17 -0
- package/dist/types/utils/history/window.d.ts +1 -0
- package/dist/types/wrapper/FrameWrapper.d.ts +1 -0
- package/dist/types/wrapper/StaticChaynsApi.d.ts +1 -0
- package/package.json +2 -1
- /package/dist/cjs/{constants → contexts}/hydrationContext.js +0 -0
- /package/dist/cjs/{constants → contexts}/moduleContext.js +0 -0
- /package/dist/cjs/{helper/apiListenerHelper.js → utils/apiListener.js} +0 -0
- /package/dist/cjs/{util → utils}/appCall.js +0 -0
- /package/dist/cjs/{util → utils}/bindChaynsApi.js +0 -0
- /package/dist/cjs/{util → utils}/collectCssChunks.js +0 -0
- /package/dist/cjs/{util → utils}/deviceHelper.js +0 -0
- /package/dist/cjs/{util → utils}/heightHelper.js +0 -0
- /package/dist/cjs/{util → utils}/initModuleFederationSharing.js +0 -0
- /package/dist/cjs/{util → utils}/is.js +0 -0
- /package/dist/cjs/{util → utils}/postIframeForm.js +0 -0
- /package/dist/cjs/{util → utils}/transferNestedFunctions.js +0 -0
- /package/dist/cjs/{util → utils}/url.js +0 -0
- /package/dist/esm/{constants → contexts}/hydrationContext.js +0 -0
- /package/dist/esm/{constants → contexts}/moduleContext.js +0 -0
- /package/dist/esm/{helper/apiListenerHelper.js → utils/apiListener.js} +0 -0
- /package/dist/esm/{util → utils}/appCall.js +0 -0
- /package/dist/esm/{util → utils}/bindChaynsApi.js +0 -0
- /package/dist/esm/{util → utils}/collectCssChunks.js +0 -0
- /package/dist/esm/{util → utils}/deviceHelper.js +0 -0
- /package/dist/esm/{util → utils}/heightHelper.js +0 -0
- /package/dist/esm/{util → utils}/initModuleFederationSharing.js +0 -0
- /package/dist/esm/{util → utils}/is.js +0 -0
- /package/dist/esm/{util → utils}/postIframeForm.js +0 -0
- /package/dist/esm/{util → utils}/transferNestedFunctions.js +0 -0
- /package/dist/esm/{util → utils}/url.js +0 -0
- /package/dist/types/{constants → contexts}/hydrationContext.d.ts +0 -0
- /package/dist/types/{constants → contexts}/moduleContext.d.ts +0 -0
- /package/dist/types/{helper/apiListenerHelper.d.ts → utils/apiListener.d.ts} +0 -0
- /package/dist/types/{util → utils}/appCall.d.ts +0 -0
- /package/dist/types/{util → utils}/appStorage.d.ts +0 -0
- /package/dist/types/{util → utils}/bindChaynsApi.d.ts +0 -0
- /package/dist/types/{util → utils}/deviceHelper.d.ts +0 -0
- /package/dist/types/{util → utils}/heightHelper.d.ts +0 -0
- /package/dist/types/{util → utils}/initModuleFederationSharing.d.ts +0 -0
- /package/dist/types/{util → utils}/is.d.ts +0 -0
- /package/dist/types/{util → utils}/postIframeForm.d.ts +0 -0
- /package/dist/types/{util → utils}/transferNestedFunctions.d.ts +0 -0
- /package/dist/types/{util → utils}/url.d.ts +0 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ChaynsHistoryLayer = void 0;
|
|
7
|
+
var _EventBus = require("../../utils/EventBus");
|
|
8
|
+
var _rootLayer = require("../../utils/history/rootLayer");
|
|
9
|
+
var _segments = require("../../utils/history/segments");
|
|
10
|
+
const RESERVED_STATE_KEYS = ['activeChild', 'childState', '__params', '__hash'];
|
|
11
|
+
class ChaynsHistoryLayer {
|
|
12
|
+
children = new Map();
|
|
13
|
+
activeChildId = null;
|
|
14
|
+
segmentCount = 0;
|
|
15
|
+
segments = [];
|
|
16
|
+
ownState = {};
|
|
17
|
+
_params = {};
|
|
18
|
+
_hash = undefined;
|
|
19
|
+
bus = new _EventBus.EventBus();
|
|
20
|
+
_bootstrapPool = null;
|
|
21
|
+
_bootstrapUrlResolver = null;
|
|
22
|
+
isDestroyed = false;
|
|
23
|
+
constructor(init) {
|
|
24
|
+
var _init$segmentCount, _init$segments;
|
|
25
|
+
this.id = init.id;
|
|
26
|
+
this.parent = init.parent;
|
|
27
|
+
this.depth = init.parent ? init.parent.depth + 1 : 0;
|
|
28
|
+
this.deps = init.deps;
|
|
29
|
+
this.segmentCount = (_init$segmentCount = init.segmentCount) !== null && _init$segmentCount !== void 0 ? _init$segmentCount : 0;
|
|
30
|
+
this.segments = (0, _segments.normalizeHistorySegments)((_init$segments = init.segments) !== null && _init$segments !== void 0 ? _init$segments : []);
|
|
31
|
+
}
|
|
32
|
+
getSegmentCount() {
|
|
33
|
+
return this.segmentCount;
|
|
34
|
+
}
|
|
35
|
+
setSegmentCount(n) {
|
|
36
|
+
if (n < 0 || !Number.isInteger(n)) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const prev = this.segmentCount;
|
|
40
|
+
if (n === prev) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
this.segmentCount = n;
|
|
44
|
+
if (this._isInActiveChain()) {
|
|
45
|
+
if (n < prev) {
|
|
46
|
+
const excess = this.segments.splice(n);
|
|
47
|
+
if (excess.length > 0 && this.activeChildId) {
|
|
48
|
+
const child = this.children.get(this.activeChildId);
|
|
49
|
+
if (child) {
|
|
50
|
+
child._setOwnSegmentsSilent([...excess, ...child._getOwnSegments()]);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
} else if (n > prev && this.segments.length === 0) {
|
|
54
|
+
const root = this.deps.getRoot();
|
|
55
|
+
const bootstrapSegs = root._consumeBootstrapSegments(n);
|
|
56
|
+
if (bootstrapSegs) {
|
|
57
|
+
this.segments = (0, _segments.normalizeHistorySegments)(bootstrapSegs);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
void this.deps.getQueue().enqueue({
|
|
61
|
+
kind: 'setRoute',
|
|
62
|
+
layerId: this.id,
|
|
63
|
+
segments: [...this.segments],
|
|
64
|
+
opts: {},
|
|
65
|
+
_notifyEvenIfUnchanged: true,
|
|
66
|
+
_skipCommit: true
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
createChildLayer(id) {
|
|
71
|
+
if (this.children.has(id)) {
|
|
72
|
+
throw new Error(`[chaynsHistory] Child layer with id "${id}" already exists on layer "${this.id}".`);
|
|
73
|
+
}
|
|
74
|
+
const segments = (0, _rootLayer.resolveSegmentsFrom)(undefined, this.getCumulativeSegmentCount());
|
|
75
|
+
const child = new ChaynsHistoryLayer({
|
|
76
|
+
id,
|
|
77
|
+
parent: this,
|
|
78
|
+
deps: this.deps,
|
|
79
|
+
segments,
|
|
80
|
+
segmentCount: segments.length
|
|
81
|
+
});
|
|
82
|
+
this.children.set(id, child);
|
|
83
|
+
return child;
|
|
84
|
+
}
|
|
85
|
+
destroyChildLayer(id) {
|
|
86
|
+
const child = this.children.get(id);
|
|
87
|
+
if (!child) return;
|
|
88
|
+
child.markDestroyed();
|
|
89
|
+
this.children.delete(id);
|
|
90
|
+
if (this.activeChildId === id) {
|
|
91
|
+
void this.deps.getQueue().enqueue({
|
|
92
|
+
kind: 'setActiveChild',
|
|
93
|
+
layerId: this.id,
|
|
94
|
+
childId: null
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
getChildLayer(id) {
|
|
99
|
+
return this.children.get(id);
|
|
100
|
+
}
|
|
101
|
+
getActiveChildId() {
|
|
102
|
+
return this.activeChildId;
|
|
103
|
+
}
|
|
104
|
+
setActiveChild(id, init) {
|
|
105
|
+
if (this.isDestroyed) return Promise.resolve({
|
|
106
|
+
isOk: false,
|
|
107
|
+
reason: 'destroyed'
|
|
108
|
+
});
|
|
109
|
+
return this.deps.getQueue().enqueue({
|
|
110
|
+
kind: 'setActiveChild',
|
|
111
|
+
layerId: this.id,
|
|
112
|
+
childId: id,
|
|
113
|
+
init: init ? {
|
|
114
|
+
...init,
|
|
115
|
+
route: init.route !== undefined ? ChaynsHistoryLayer.normalizeRoute(init.route) : undefined
|
|
116
|
+
} : undefined
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
getRoute() {
|
|
120
|
+
return [...this.segments];
|
|
121
|
+
}
|
|
122
|
+
setRoute(route, opts) {
|
|
123
|
+
if (this.isDestroyed) return;
|
|
124
|
+
void this.deps.getQueue().enqueue({
|
|
125
|
+
kind: 'setRoute',
|
|
126
|
+
layerId: this.id,
|
|
127
|
+
segments: ChaynsHistoryLayer.normalizeRoute(route),
|
|
128
|
+
opts: opts !== null && opts !== void 0 ? opts : {}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
getParams() {
|
|
132
|
+
return {
|
|
133
|
+
...this._params
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
setParams(params, opts) {
|
|
137
|
+
if (this.isDestroyed) return;
|
|
138
|
+
void this.deps.getQueue().enqueue({
|
|
139
|
+
kind: 'setParams',
|
|
140
|
+
layerId: this.id,
|
|
141
|
+
params: {
|
|
142
|
+
...params
|
|
143
|
+
},
|
|
144
|
+
opts: opts !== null && opts !== void 0 ? opts : {}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
getHash() {
|
|
148
|
+
var _this$_hash;
|
|
149
|
+
return (_this$_hash = this._hash) !== null && _this$_hash !== void 0 ? _this$_hash : '';
|
|
150
|
+
}
|
|
151
|
+
setHash(hash, opts) {
|
|
152
|
+
if (this.isDestroyed) return;
|
|
153
|
+
const normalized = hash.startsWith('#') ? hash.slice(1) : hash;
|
|
154
|
+
void this.deps.getQueue().enqueue({
|
|
155
|
+
kind: 'setHash',
|
|
156
|
+
layerId: this.id,
|
|
157
|
+
hash: normalized,
|
|
158
|
+
opts: opts !== null && opts !== void 0 ? opts : {}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
getState() {
|
|
162
|
+
return {
|
|
163
|
+
...this.ownState
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
setState(state, opts) {
|
|
167
|
+
if (this.isDestroyed) return;
|
|
168
|
+
const filtered = ChaynsHistoryLayer.filterReservedKeys(state);
|
|
169
|
+
void this.deps.getQueue().enqueue({
|
|
170
|
+
kind: 'setState',
|
|
171
|
+
layerId: this.id,
|
|
172
|
+
state: filtered,
|
|
173
|
+
opts: opts !== null && opts !== void 0 ? opts : {}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
navigate(opts) {
|
|
177
|
+
if (this.isDestroyed) return Promise.resolve({
|
|
178
|
+
isOk: false,
|
|
179
|
+
reason: 'destroyed'
|
|
180
|
+
});
|
|
181
|
+
const {
|
|
182
|
+
route,
|
|
183
|
+
state,
|
|
184
|
+
params,
|
|
185
|
+
hash,
|
|
186
|
+
activeChild,
|
|
187
|
+
activeChildInit,
|
|
188
|
+
...rest
|
|
189
|
+
} = opts;
|
|
190
|
+
return this.deps.getQueue().enqueue({
|
|
191
|
+
kind: 'navigate',
|
|
192
|
+
layerId: this.id,
|
|
193
|
+
route: route !== undefined ? ChaynsHistoryLayer.normalizeRoute(route) : undefined,
|
|
194
|
+
state: state ? ChaynsHistoryLayer.filterReservedKeys(state) : undefined,
|
|
195
|
+
params,
|
|
196
|
+
hash: hash !== undefined ? hash.startsWith('#') ? hash.slice(1) : hash : undefined,
|
|
197
|
+
activeChild,
|
|
198
|
+
activeChildInit: activeChildInit ? {
|
|
199
|
+
...activeChildInit,
|
|
200
|
+
route: activeChildInit.route !== undefined ? ChaynsHistoryLayer.normalizeRoute(activeChildInit.route) : undefined
|
|
201
|
+
} : undefined,
|
|
202
|
+
opts: rest
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
addBlock(callback, opts = {}) {
|
|
206
|
+
return this.deps.getBlockRegistry().add(this, callback, opts);
|
|
207
|
+
}
|
|
208
|
+
addEventListener(type, handler) {
|
|
209
|
+
return this.bus.on(type, handler);
|
|
210
|
+
}
|
|
211
|
+
_getOwnState() {
|
|
212
|
+
return this.ownState;
|
|
213
|
+
}
|
|
214
|
+
_getOwnSegments() {
|
|
215
|
+
return this.segments;
|
|
216
|
+
}
|
|
217
|
+
_getChildren() {
|
|
218
|
+
return this.children;
|
|
219
|
+
}
|
|
220
|
+
_setOwnStateSilent(next) {
|
|
221
|
+
this.ownState = ChaynsHistoryLayer.filterReservedKeys(next);
|
|
222
|
+
}
|
|
223
|
+
_setOwnSegmentsSilent(next) {
|
|
224
|
+
this.segments = (0, _segments.normalizeHistorySegments)(next);
|
|
225
|
+
}
|
|
226
|
+
_getOwnParams() {
|
|
227
|
+
return this._params;
|
|
228
|
+
}
|
|
229
|
+
_setOwnParamsSilent(params) {
|
|
230
|
+
this._params = {
|
|
231
|
+
...params
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
_getOwnHash() {
|
|
235
|
+
return this._hash;
|
|
236
|
+
}
|
|
237
|
+
_setOwnHashSilent(hash) {
|
|
238
|
+
this._hash = hash;
|
|
239
|
+
}
|
|
240
|
+
_setActiveChildSilent(id) {
|
|
241
|
+
this.activeChildId = id;
|
|
242
|
+
}
|
|
243
|
+
_emit(type) {
|
|
244
|
+
var _this$_hash2;
|
|
245
|
+
const event = {
|
|
246
|
+
type,
|
|
247
|
+
layerId: this.id,
|
|
248
|
+
segments: [...this.segments],
|
|
249
|
+
state: {
|
|
250
|
+
...this.ownState
|
|
251
|
+
},
|
|
252
|
+
params: {
|
|
253
|
+
...this._params
|
|
254
|
+
},
|
|
255
|
+
hash: (_this$_hash2 = this._hash) !== null && _this$_hash2 !== void 0 ? _this$_hash2 : ''
|
|
256
|
+
};
|
|
257
|
+
this.bus.emit(type, event);
|
|
258
|
+
}
|
|
259
|
+
_isInActiveChain() {
|
|
260
|
+
let node = this;
|
|
261
|
+
while (node && node.parent) {
|
|
262
|
+
if (node.parent.activeChildId !== node.id) return false;
|
|
263
|
+
node = node.parent;
|
|
264
|
+
}
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
267
|
+
_setBootstrapUrlResolver(resolver) {
|
|
268
|
+
this._bootstrapUrlResolver = resolver;
|
|
269
|
+
}
|
|
270
|
+
_setBootstrapPool(segs) {
|
|
271
|
+
this._bootstrapPool = [...segs];
|
|
272
|
+
}
|
|
273
|
+
_consumeBootstrapSegments(n) {
|
|
274
|
+
if (this._bootstrapPool === null && this._bootstrapUrlResolver) {
|
|
275
|
+
const pathname = this._bootstrapUrlResolver();
|
|
276
|
+
this._bootstrapPool = pathname.replace(/^\//, '').split('/').filter(Boolean);
|
|
277
|
+
this._bootstrapUrlResolver = null;
|
|
278
|
+
}
|
|
279
|
+
if (!this._bootstrapPool || this._bootstrapPool.length === 0 || n === 0) return null;
|
|
280
|
+
const taken = this._bootstrapPool.splice(0, n);
|
|
281
|
+
while (taken.length < n) taken.push('');
|
|
282
|
+
return taken;
|
|
283
|
+
}
|
|
284
|
+
_isDestroyed() {
|
|
285
|
+
return this.isDestroyed;
|
|
286
|
+
}
|
|
287
|
+
markDestroyed() {
|
|
288
|
+
this.isDestroyed = true;
|
|
289
|
+
try {
|
|
290
|
+
this.deps.getBlockRegistry().removeAllForLayer(this.id);
|
|
291
|
+
} catch {}
|
|
292
|
+
for (const child of this.children.values()) {
|
|
293
|
+
child.markDestroyed();
|
|
294
|
+
}
|
|
295
|
+
this.children.clear();
|
|
296
|
+
this.bus.clear();
|
|
297
|
+
}
|
|
298
|
+
getCumulativeSegmentCount() {
|
|
299
|
+
let count = this.segmentCount;
|
|
300
|
+
let node = this.parent;
|
|
301
|
+
while (node) {
|
|
302
|
+
count += node.segmentCount;
|
|
303
|
+
node = node.parent;
|
|
304
|
+
}
|
|
305
|
+
return count;
|
|
306
|
+
}
|
|
307
|
+
static normalizeRoute(route) {
|
|
308
|
+
return (0, _segments.normalizeHistoryRouteInput)(route);
|
|
309
|
+
}
|
|
310
|
+
static filterReservedKeys(input) {
|
|
311
|
+
const out = {};
|
|
312
|
+
for (const key of Object.keys(input)) {
|
|
313
|
+
if (RESERVED_STATE_KEYS.includes(key)) {
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
out[key] = input[key];
|
|
317
|
+
}
|
|
318
|
+
return out;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
exports.ChaynsHistoryLayer = ChaynsHistoryLayer;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ChaynsHistoryLayerClass", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _HistoryLayer.ChaynsHistoryLayer;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "FrameHistoryLayer", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _FrameHistoryLayer.FrameHistoryLayer;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _HistoryLayer = require("./HistoryLayer");
|
|
19
|
+
var _FrameHistoryLayer = require("./FrameHistoryLayer");
|