chayns-api 3.0.0-beta.4 → 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/README.md +4 -11
- 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,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports._extractNode = extractNode;
|
|
7
|
+
exports.applyStateToTree = applyStateToTree;
|
|
8
|
+
exports.diffIncomingState = diffIncomingState;
|
|
9
|
+
exports.hasChaynsHistoryState = hasChaynsHistoryState;
|
|
10
|
+
exports.projectToState = projectToState;
|
|
11
|
+
var _equality = require("../equality");
|
|
12
|
+
const ROOT_KEY = '__chaynsHistory';
|
|
13
|
+
const SCHEMA_VERSION = 1;
|
|
14
|
+
function buildNode(layer) {
|
|
15
|
+
const node = {
|
|
16
|
+
...layer._getOwnState()
|
|
17
|
+
};
|
|
18
|
+
const params = layer._getOwnParams();
|
|
19
|
+
if (Object.keys(params).length > 0) node.__params = {
|
|
20
|
+
...params
|
|
21
|
+
};
|
|
22
|
+
const hash = layer._getOwnHash();
|
|
23
|
+
if (hash !== undefined) node.__hash = hash;
|
|
24
|
+
const activeChildId = layer.getActiveChildId();
|
|
25
|
+
if (activeChildId) {
|
|
26
|
+
node.activeChild = activeChildId;
|
|
27
|
+
const child = layer.getChildLayer(activeChildId);
|
|
28
|
+
if (child) {
|
|
29
|
+
node.childState = buildNode(child);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return node;
|
|
33
|
+
}
|
|
34
|
+
function projectToState(root, existing = {}) {
|
|
35
|
+
const tree = buildNode(root);
|
|
36
|
+
return {
|
|
37
|
+
...existing,
|
|
38
|
+
[ROOT_KEY]: {
|
|
39
|
+
v: SCHEMA_VERSION,
|
|
40
|
+
tree
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function applyNode(layer, node) {
|
|
45
|
+
const {
|
|
46
|
+
activeChild,
|
|
47
|
+
childState,
|
|
48
|
+
__params,
|
|
49
|
+
__hash,
|
|
50
|
+
...ownProps
|
|
51
|
+
} = node;
|
|
52
|
+
layer._setOwnStateSilent(ownProps);
|
|
53
|
+
layer._setOwnParamsSilent(__params !== null && __params !== void 0 ? __params : {});
|
|
54
|
+
layer._setOwnHashSilent('__hash' in node ? __hash : undefined);
|
|
55
|
+
if (activeChild !== undefined) {
|
|
56
|
+
layer._setActiveChildSilent(activeChild);
|
|
57
|
+
if (childState) {
|
|
58
|
+
const child = layer.getChildLayer(activeChild);
|
|
59
|
+
if (child) applyNode(child, childState);
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
layer._setActiveChildSilent(null);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function applyStateToTree(root, raw) {
|
|
66
|
+
const node = extractNode(raw);
|
|
67
|
+
if (!node) return {
|
|
68
|
+
changedLayerIds: new Set()
|
|
69
|
+
};
|
|
70
|
+
const changedLayerIds = new Set();
|
|
71
|
+
applyNodeTracked(root, node, changedLayerIds);
|
|
72
|
+
return {
|
|
73
|
+
changedLayerIds
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function diffIncomingState(root, raw) {
|
|
77
|
+
const node = extractNode(raw);
|
|
78
|
+
if (!node) return {
|
|
79
|
+
changedLayerIds: new Set()
|
|
80
|
+
};
|
|
81
|
+
const changedLayerIds = new Set();
|
|
82
|
+
diffNodeTracked(root, node, changedLayerIds);
|
|
83
|
+
return {
|
|
84
|
+
changedLayerIds
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function extractNode(raw) {
|
|
88
|
+
if (!raw || typeof raw !== 'object') return null;
|
|
89
|
+
const entry = raw[ROOT_KEY];
|
|
90
|
+
if (!entry || typeof entry !== 'object') return null;
|
|
91
|
+
const {
|
|
92
|
+
tree
|
|
93
|
+
} = entry;
|
|
94
|
+
return tree !== null && tree !== void 0 ? tree : null;
|
|
95
|
+
}
|
|
96
|
+
function applyNodeTracked(layer, node, changed) {
|
|
97
|
+
const {
|
|
98
|
+
activeChild,
|
|
99
|
+
childState,
|
|
100
|
+
__params,
|
|
101
|
+
__hash,
|
|
102
|
+
...ownProps
|
|
103
|
+
} = node;
|
|
104
|
+
const prevState = layer._getOwnState();
|
|
105
|
+
const prevActiveChild = layer.getActiveChildId();
|
|
106
|
+
const prevParams = layer._getOwnParams();
|
|
107
|
+
const prevHash = layer._getOwnHash();
|
|
108
|
+
const incomingParams = __params !== null && __params !== void 0 ? __params : {};
|
|
109
|
+
const incomingHash = '__hash' in node ? __hash : undefined;
|
|
110
|
+
const ownPropsClean = ownProps;
|
|
111
|
+
const stateChanged = !(0, _equality.shallowEqualObj)(prevState, ownPropsClean);
|
|
112
|
+
const activeChildChanged = prevActiveChild !== (activeChild !== null && activeChild !== void 0 ? activeChild : null);
|
|
113
|
+
const paramsChanged = !(0, _equality.shallowEqualObj)(prevParams, incomingParams);
|
|
114
|
+
const hashChanged = prevHash !== incomingHash;
|
|
115
|
+
const child = activeChild ? layer.getChildLayer(activeChild) : undefined;
|
|
116
|
+
layer._setOwnStateSilent(ownPropsClean);
|
|
117
|
+
layer._setActiveChildSilent(activeChild !== null && activeChild !== void 0 ? activeChild : null);
|
|
118
|
+
layer._setOwnParamsSilent(incomingParams);
|
|
119
|
+
layer._setOwnHashSilent(incomingHash);
|
|
120
|
+
if (stateChanged || activeChildChanged || paramsChanged || hashChanged) {
|
|
121
|
+
changed.add(layer.id);
|
|
122
|
+
}
|
|
123
|
+
if (activeChild && childState) {
|
|
124
|
+
if (child) applyNodeTracked(child, childState, changed);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function diffNodeTracked(layer, node, changed) {
|
|
128
|
+
const {
|
|
129
|
+
activeChild,
|
|
130
|
+
childState,
|
|
131
|
+
__params,
|
|
132
|
+
__hash,
|
|
133
|
+
...ownProps
|
|
134
|
+
} = node;
|
|
135
|
+
const prevState = layer._getOwnState();
|
|
136
|
+
const prevActiveChild = layer.getActiveChildId();
|
|
137
|
+
const prevParams = layer._getOwnParams();
|
|
138
|
+
const prevHash = layer._getOwnHash();
|
|
139
|
+
const incomingParams = __params !== null && __params !== void 0 ? __params : {};
|
|
140
|
+
const incomingHash = '__hash' in node ? __hash : undefined;
|
|
141
|
+
const ownPropsClean = ownProps;
|
|
142
|
+
const stateChanged = !(0, _equality.shallowEqualObj)(prevState, ownPropsClean);
|
|
143
|
+
const activeChildChanged = prevActiveChild !== (activeChild !== null && activeChild !== void 0 ? activeChild : null);
|
|
144
|
+
const paramsChanged = !(0, _equality.shallowEqualObj)(prevParams, incomingParams);
|
|
145
|
+
const hashChanged = prevHash !== incomingHash;
|
|
146
|
+
const child = activeChild ? layer.getChildLayer(activeChild) : undefined;
|
|
147
|
+
if (stateChanged || activeChildChanged || paramsChanged || hashChanged) {
|
|
148
|
+
changed.add(layer.id);
|
|
149
|
+
}
|
|
150
|
+
if (activeChild && childState) {
|
|
151
|
+
if (child) diffNodeTracked(child, childState, changed);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function hasChaynsHistoryState(raw) {
|
|
155
|
+
return extractNode(raw) !== null;
|
|
156
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.parseFromUrl = parseFromUrl;
|
|
7
|
+
exports.projectToUrl = projectToUrl;
|
|
8
|
+
var _layerTree = require("./layerTree");
|
|
9
|
+
var _segments = require("./segments");
|
|
10
|
+
function projectToUrl(root) {
|
|
11
|
+
const chain = (0, _layerTree.getChaynsHistoryActiveChain)(root);
|
|
12
|
+
const parts = [];
|
|
13
|
+
const mergedParams = {};
|
|
14
|
+
let hash;
|
|
15
|
+
for (const layer of chain) {
|
|
16
|
+
for (const seg of (0, _segments.normalizeHistorySegments)(layer._getOwnSegments())) {
|
|
17
|
+
parts.push(seg);
|
|
18
|
+
}
|
|
19
|
+
Object.assign(mergedParams, layer._getOwnParams());
|
|
20
|
+
const layerHash = layer._getOwnHash();
|
|
21
|
+
if (layerHash !== undefined) hash = layerHash;
|
|
22
|
+
}
|
|
23
|
+
let url = '/' + parts.join('/');
|
|
24
|
+
const search = new URLSearchParams(mergedParams).toString();
|
|
25
|
+
if (search) url += '?' + search;
|
|
26
|
+
if (hash) url += '#' + hash;
|
|
27
|
+
return url;
|
|
28
|
+
}
|
|
29
|
+
function parseFromUrl(url, root) {
|
|
30
|
+
const perLayerSegments = new Map();
|
|
31
|
+
const pathname = url.startsWith('/') ? url.slice(1) : url;
|
|
32
|
+
const all = pathname ? pathname.split('/') : [];
|
|
33
|
+
let offset = 0;
|
|
34
|
+
const chain = (0, _layerTree.getChaynsHistoryActiveChain)(root);
|
|
35
|
+
for (const layer of chain) {
|
|
36
|
+
const count = layer.getSegmentCount();
|
|
37
|
+
const slice = all.slice(offset, offset + count);
|
|
38
|
+
while (slice.length < count) slice.push('');
|
|
39
|
+
perLayerSegments.set(layer.id, slice);
|
|
40
|
+
offset += count;
|
|
41
|
+
}
|
|
42
|
+
const pendingSegments = offset < all.length ? all.slice(offset) : [];
|
|
43
|
+
return {
|
|
44
|
+
perLayerSegments,
|
|
45
|
+
pendingSegments
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -10,12 +10,12 @@ var _sendMessage = require("../calls/sendMessage");
|
|
|
10
10
|
var _constants = require("../constants");
|
|
11
11
|
var _languages = require("../constants/languages");
|
|
12
12
|
var _DialogHandler = _interopRequireDefault(require("../handler/DialogHandler"));
|
|
13
|
-
var
|
|
13
|
+
var _apiListener = require("../utils/apiListener");
|
|
14
14
|
var _IChaynsReact = require("../types/IChaynsReact");
|
|
15
|
-
var _appCall = _interopRequireDefault(require("../
|
|
16
|
-
var _appStorage = require("../
|
|
17
|
-
var _deviceHelper = _interopRequireWildcard(require("../
|
|
18
|
-
var _is = require("../
|
|
15
|
+
var _appCall = _interopRequireDefault(require("../utils/appCall"));
|
|
16
|
+
var _appStorage = require("../utils/appStorage");
|
|
17
|
+
var _deviceHelper = _interopRequireWildcard(require("../utils/deviceHelper"));
|
|
18
|
+
var _is = require("../utils/is");
|
|
19
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
20
20
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
21
|
class AppWrapper {
|
|
@@ -197,14 +197,14 @@ class AppWrapper {
|
|
|
197
197
|
const {
|
|
198
198
|
id,
|
|
199
199
|
shouldInitialize
|
|
200
|
-
} = (0,
|
|
200
|
+
} = (0, _apiListener.addApiListener)('geoLocationListener', callback);
|
|
201
201
|
if (shouldInitialize) {
|
|
202
202
|
this.appCall(14, {
|
|
203
203
|
permanent: true
|
|
204
204
|
}, {
|
|
205
205
|
callback: v => {
|
|
206
206
|
var _v$accuracy, _v$isAccurate, _v$code;
|
|
207
|
-
(0,
|
|
207
|
+
(0, _apiListener.dispatchApiEvent)('geoLocationListener', {
|
|
208
208
|
latitude: v.latitude,
|
|
209
209
|
longitude: v.longitude,
|
|
210
210
|
accuracy: (_v$accuracy = v.accuracy) !== null && _v$accuracy !== void 0 ? _v$accuracy : null,
|
|
@@ -225,11 +225,11 @@ class AppWrapper {
|
|
|
225
225
|
const {
|
|
226
226
|
id,
|
|
227
227
|
shouldInitialize
|
|
228
|
-
} = (0,
|
|
228
|
+
} = (0, _apiListener.addApiListener)('scrollListener', throttledCallback);
|
|
229
229
|
if (shouldInitialize) {
|
|
230
230
|
window.addEventListener('scroll', this.scrollListener = () => {
|
|
231
231
|
void (async () => {
|
|
232
|
-
(0,
|
|
232
|
+
(0, _apiListener.dispatchApiEvent)('scrollListener', {
|
|
233
233
|
scrollX: window.scrollX,
|
|
234
234
|
scrollY: window.scrollY
|
|
235
235
|
});
|
|
@@ -242,11 +242,11 @@ class AppWrapper {
|
|
|
242
242
|
const {
|
|
243
243
|
id,
|
|
244
244
|
shouldInitialize
|
|
245
|
-
} = (0,
|
|
245
|
+
} = (0, _apiListener.addApiListener)('visibilityChangeListener', callback);
|
|
246
246
|
if (shouldInitialize) {
|
|
247
247
|
this.appCall(60, {}, {
|
|
248
248
|
callback: v => {
|
|
249
|
-
(0,
|
|
249
|
+
(0, _apiListener.dispatchApiEvent)('visibilityChangeListener', {
|
|
250
250
|
isVisible: v.tappEvent !== _IChaynsReact.TappEvent.OnHide,
|
|
251
251
|
tappEvent: v.tappEvent
|
|
252
252
|
});
|
|
@@ -259,11 +259,11 @@ class AppWrapper {
|
|
|
259
259
|
const {
|
|
260
260
|
id,
|
|
261
261
|
shouldInitialize
|
|
262
|
-
} = (0,
|
|
262
|
+
} = (0, _apiListener.addApiListener)('toolbarChangeListener', callback);
|
|
263
263
|
if (shouldInitialize) {
|
|
264
264
|
this.appCall(293, {}, {
|
|
265
265
|
callback: v => {
|
|
266
|
-
(0,
|
|
266
|
+
(0, _apiListener.dispatchApiEvent)('toolbarChangeListener', {
|
|
267
267
|
isVisible: v.isVisible,
|
|
268
268
|
toolbarHeight: v.toolbarHeight
|
|
269
269
|
});
|
|
@@ -276,11 +276,11 @@ class AppWrapper {
|
|
|
276
276
|
const {
|
|
277
277
|
id,
|
|
278
278
|
shouldInitialize
|
|
279
|
-
} = (0,
|
|
279
|
+
} = (0, _apiListener.addApiListener)('windowMetricsListener', callback);
|
|
280
280
|
if (shouldInitialize) {
|
|
281
281
|
window.addEventListener('resize', this.resizeListener = () => {
|
|
282
282
|
void (async () => {
|
|
283
|
-
(0,
|
|
283
|
+
(0, _apiListener.dispatchApiEvent)('windowMetricsListener', await this.functions.getWindowMetrics());
|
|
284
284
|
})();
|
|
285
285
|
});
|
|
286
286
|
}
|
|
@@ -429,13 +429,13 @@ class AppWrapper {
|
|
|
429
429
|
removeGeoLocationListener: async id => {
|
|
430
430
|
const {
|
|
431
431
|
shouldRemove
|
|
432
|
-
} = (0,
|
|
432
|
+
} = (0, _apiListener.removeApiListener)('geoLocationListener', id);
|
|
433
433
|
if (shouldRemove) {}
|
|
434
434
|
},
|
|
435
435
|
removeScrollListener: async id => {
|
|
436
436
|
const {
|
|
437
437
|
shouldRemove
|
|
438
|
-
} = (0,
|
|
438
|
+
} = (0, _apiListener.removeApiListener)('scrollListener', id);
|
|
439
439
|
if (shouldRemove && this.scrollListener) {
|
|
440
440
|
window.removeEventListener('scroll', this.scrollListener);
|
|
441
441
|
this.scrollListener = null;
|
|
@@ -444,17 +444,17 @@ class AppWrapper {
|
|
|
444
444
|
removeVisibilityChangeListener: async id => {
|
|
445
445
|
const {
|
|
446
446
|
shouldRemove
|
|
447
|
-
} = (0,
|
|
447
|
+
} = (0, _apiListener.removeApiListener)('visibilityChangeListener', id);
|
|
448
448
|
if (shouldRemove) {}
|
|
449
449
|
},
|
|
450
450
|
removeToolbarChangeListener: async id => {
|
|
451
451
|
const {
|
|
452
452
|
shouldRemove
|
|
453
|
-
} = (0,
|
|
453
|
+
} = (0, _apiListener.removeApiListener)('toolbarChangeListener', id);
|
|
454
454
|
if (shouldRemove) {}
|
|
455
455
|
},
|
|
456
456
|
removeWindowMetricsListener: async id => {
|
|
457
|
-
const shouldRemove = (0,
|
|
457
|
+
const shouldRemove = (0, _apiListener.removeApiListener)('windowMetricsListener', id);
|
|
458
458
|
if (shouldRemove) {
|
|
459
459
|
void this.exposedFunctions.removeWindowMetricsListener(id);
|
|
460
460
|
if (this.resizeListener) window.removeEventListener('resize', this.resizeListener);
|
|
@@ -699,13 +699,13 @@ class AppWrapper {
|
|
|
699
699
|
addAccessTokenChangeListener: async (options, callback) => {
|
|
700
700
|
const {
|
|
701
701
|
id
|
|
702
|
-
} = (0,
|
|
702
|
+
} = (0, _apiListener.addApiListener)('accessTokenChangeListener', callback);
|
|
703
703
|
return id;
|
|
704
704
|
},
|
|
705
705
|
removeAccessTokenChangeListener: async id => {
|
|
706
706
|
const {
|
|
707
707
|
shouldRemove
|
|
708
|
-
} = (0,
|
|
708
|
+
} = (0, _apiListener.removeApiListener)('accessTokenChangeListener', id);
|
|
709
709
|
if (shouldRemove) {}
|
|
710
710
|
},
|
|
711
711
|
redirect: async options => {
|
|
@@ -722,7 +722,7 @@ class AppWrapper {
|
|
|
722
722
|
}, {
|
|
723
723
|
callback: async () => {
|
|
724
724
|
this.values = this.mapOldApiToNew(await this.appCall(18));
|
|
725
|
-
(0,
|
|
725
|
+
(0, _apiListener.dispatchApiEvent)('accessTokenChangeListener', {
|
|
726
726
|
accessToken: this.accessToken,
|
|
727
727
|
isExternal: false
|
|
728
728
|
});
|
|
@@ -9,8 +9,9 @@ var _getUserInfo = _interopRequireDefault(require("../calls/getUserInfo"));
|
|
|
9
9
|
var _sendMessage = require("../calls/sendMessage");
|
|
10
10
|
var _visibilityChangeListener = require("../calls/visibilityChangeListener");
|
|
11
11
|
var _DialogHandler = _interopRequireDefault(require("../handler/DialogHandler"));
|
|
12
|
-
var
|
|
13
|
-
var
|
|
12
|
+
var _FrameHistoryLayer = require("../handler/history/FrameHistoryLayer");
|
|
13
|
+
var _heightHelper = require("../utils/heightHelper");
|
|
14
|
+
var _transferNestedFunctions = require("../utils/transferNestedFunctions");
|
|
14
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
16
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
17
|
class FrameWrapper {
|
|
@@ -19,6 +20,7 @@ class FrameWrapper {
|
|
|
19
20
|
exposedCustomFunctions = {};
|
|
20
21
|
exposedCustomFunctionNames = [];
|
|
21
22
|
resizeListener = null;
|
|
23
|
+
_historyLayer = null;
|
|
22
24
|
ready = new Promise(res => {
|
|
23
25
|
this.resolve = res;
|
|
24
26
|
});
|
|
@@ -301,6 +303,12 @@ class FrameWrapper {
|
|
|
301
303
|
redirect: async options => {
|
|
302
304
|
if (!this.initialized) await this.ready;
|
|
303
305
|
return this.exposedFunctions.redirect(options);
|
|
306
|
+
},
|
|
307
|
+
getHistoryLayer: () => {
|
|
308
|
+
if (!this._historyLayer) {
|
|
309
|
+
throw new Error('[chaynsHistory] No history layer available. Ensure historyLayer prop is set on the parent HostIframe.');
|
|
310
|
+
}
|
|
311
|
+
return this._historyLayer;
|
|
304
312
|
}
|
|
305
313
|
};
|
|
306
314
|
customFunctions = new Proxy({}, {
|
|
@@ -361,6 +369,31 @@ class FrameWrapper {
|
|
|
361
369
|
p[e] = (...args) => this.exposedCustomFunctions[e](...args.map(a => typeof a === 'function' ? comlink.proxy(a) : a));
|
|
362
370
|
return p;
|
|
363
371
|
}, {});
|
|
372
|
+
const exposedHistory = exposed.history;
|
|
373
|
+
if (exposedHistory) {
|
|
374
|
+
const initialState = await exposedHistory.getInitialState();
|
|
375
|
+
if (initialState) {
|
|
376
|
+
this._historyLayer = new _FrameHistoryLayer.FrameHistoryLayer({
|
|
377
|
+
setRoute: (route, opts) => exposedHistory.setRoute(route, opts),
|
|
378
|
+
setParams: (params, opts) => exposedHistory.setParams(params, opts),
|
|
379
|
+
setHash: (hash, opts) => exposedHistory.setHash(hash, opts),
|
|
380
|
+
setState: (state, opts) => exposedHistory.setState(state, opts),
|
|
381
|
+
navigate: opts => exposedHistory.navigate(opts),
|
|
382
|
+
setActiveChild: (id, init) => exposedHistory.setActiveChild(id, init),
|
|
383
|
+
setSegmentCount: n => exposedHistory.setSegmentCount(n),
|
|
384
|
+
addBlock: async (callback, opts) => {
|
|
385
|
+
const remoteUnsub = await exposedHistory.addBlock(comlink.proxy(callback), opts);
|
|
386
|
+
return () => void remoteUnsub();
|
|
387
|
+
}
|
|
388
|
+
}, initialState);
|
|
389
|
+
await exposedHistory.addChangeListener(comlink.proxy(e => {
|
|
390
|
+
this._historyLayer._applyAndEmit(e);
|
|
391
|
+
}));
|
|
392
|
+
await exposedHistory.addPopstateListener(comlink.proxy(e => {
|
|
393
|
+
this._historyLayer._applyAndEmit(e);
|
|
394
|
+
}));
|
|
395
|
+
}
|
|
396
|
+
}
|
|
364
397
|
this.initialized = true;
|
|
365
398
|
this.resolve(null);
|
|
366
399
|
(0, _heightHelper.setTappHeight)(this.functions.setHeight);
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ModuleFederationWrapper = void 0;
|
|
7
7
|
var _DialogHandler = _interopRequireDefault(require("../handler/DialogHandler"));
|
|
8
|
+
var _rootLayer = require("../utils/history/rootLayer");
|
|
8
9
|
var _visibilityChangeListener = require("../calls/visibilityChangeListener");
|
|
9
10
|
var _getUserInfo = _interopRequireDefault(require("../calls/getUserInfo"));
|
|
10
11
|
var _sendMessage = require("../calls/sendMessage");
|
|
@@ -31,6 +32,7 @@ class ModuleFederationWrapper {
|
|
|
31
32
|
this.functions.createDialog = config => {
|
|
32
33
|
return new _DialogHandler.default(config, functions.openDialog, functions.closeDialog, functions.dispatchEventToDialogClient, functions.addDialogClientEventListener);
|
|
33
34
|
};
|
|
35
|
+
this.functions.getHistoryLayer = () => (0, _rootLayer.getOrInitRootChaynsHistoryLayer)().rootLayer;
|
|
34
36
|
}
|
|
35
37
|
async init() {
|
|
36
38
|
return undefined;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _moduleWrapper = require("../components/moduleWrapper");
|
|
8
8
|
var _IChaynsReact = require("../types/IChaynsReact");
|
|
9
|
-
var _deviceHelper = _interopRequireDefault(require("../
|
|
9
|
+
var _deviceHelper = _interopRequireDefault(require("../utils/deviceHelper"));
|
|
10
10
|
var _AppWrapper = require("./AppWrapper");
|
|
11
11
|
var _FrameWrapper = require("./FrameWrapper");
|
|
12
12
|
var _ModuleFederationWrapper = require("./ModuleFederationWrapper");
|
package/dist/esm/calls/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { moduleWrapper } from '../components/moduleWrapper';
|
|
2
|
+
import { getCurrentChaynsHistoryLayer } from '../contexts/HistoryLayerContext';
|
|
2
3
|
export const addGeoLocationListener = (...args) => moduleWrapper.current.functions.addGeoLocationListener(...args);
|
|
3
4
|
export const addScrollListener = (...args) => moduleWrapper.current.functions.addScrollListener(...args);
|
|
4
5
|
export const addVisibilityChangeListener = (...args) => moduleWrapper.current.functions.addVisibilityChangeListener(...args);
|
|
@@ -54,6 +55,7 @@ export const createDialog = config => moduleWrapper.current.functions.createDial
|
|
|
54
55
|
export const setOverlay = (...args) => moduleWrapper.current.functions.setOverlay(...args);
|
|
55
56
|
export const addAnonymousAccount = () => moduleWrapper.current.functions.addAnonymousAccount();
|
|
56
57
|
export const getUser = () => moduleWrapper.current.values.user;
|
|
58
|
+
export const getChaynsHistoryLayer = () => getCurrentChaynsHistoryLayer();
|
|
57
59
|
export const getSite = () => moduleWrapper.current.values.site;
|
|
58
60
|
export const getCurrentPage = () => moduleWrapper.current.values.currentPage;
|
|
59
61
|
export const getDevice = () => moduleWrapper.current.values.device;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addApiListener, dispatchApiEvent, removeApiListener } from '../
|
|
1
|
+
import { addApiListener, dispatchApiEvent, removeApiListener } from '../utils/apiListener';
|
|
2
2
|
const key = 'visibilityChangeListener';
|
|
3
3
|
const handleVisibilityChange = () => {
|
|
4
4
|
dispatchApiEvent(key, {
|
|
@@ -3,13 +3,15 @@ import htmlEscape from 'htmlescape';
|
|
|
3
3
|
import React, { useEffect, useRef, useState } from 'react';
|
|
4
4
|
import { useIsomorphicLayoutEffect } from '../hooks/useIsomorphicLayoutEffect';
|
|
5
5
|
import { AppName } from '../types/IChaynsReact';
|
|
6
|
-
import getDeviceInfo from '../
|
|
6
|
+
import getDeviceInfo from '../utils/deviceHelper';
|
|
7
7
|
import { AppWrapper } from '../wrapper/AppWrapper';
|
|
8
8
|
import { FrameWrapper } from '../wrapper/FrameWrapper';
|
|
9
9
|
import { ModuleFederationWrapper } from '../wrapper/ModuleFederationWrapper';
|
|
10
10
|
import { SsrWrapper } from '../wrapper/SsrWrapper';
|
|
11
11
|
import { ChaynsContext } from './ChaynsContext';
|
|
12
12
|
import { addModuleWrapper, moduleWrapper, removeModuleWrapper } from './moduleWrapper';
|
|
13
|
+
import { ChaynsHistoryLayerProvider, useChaynsHistoryLayerContext } from '../contexts/HistoryLayerContext';
|
|
14
|
+
import { getOrInitRootChaynsHistoryLayer } from '../utils/history/rootLayer';
|
|
13
15
|
const isServer = typeof window === 'undefined';
|
|
14
16
|
const InitialDataProvider = React.memo(t0 => {
|
|
15
17
|
const $ = _c(6);
|
|
@@ -59,11 +61,18 @@ const ChaynsProvider = ({
|
|
|
59
61
|
customFunctions,
|
|
60
62
|
renderedByServer,
|
|
61
63
|
isModule,
|
|
62
|
-
chaynsApiId
|
|
64
|
+
chaynsApiId,
|
|
65
|
+
historyLayer,
|
|
66
|
+
history,
|
|
67
|
+
isHistoryDisabled,
|
|
68
|
+
segmentCount
|
|
63
69
|
}) => {
|
|
64
|
-
var _ref, _crypto, _customWrapper$curren, _customWrapper$
|
|
70
|
+
var _ref, _crypto, _customWrapper$curren, _customWrapper$curren3, _customWrapper$curren4;
|
|
65
71
|
const customWrapper = useRef(null);
|
|
66
72
|
const idRef = useRef((_ref = chaynsApiId !== null && chaynsApiId !== void 0 ? chaynsApiId : (_crypto = crypto) === null || _crypto === void 0 ? void 0 : _crypto.randomUUID()) !== null && _ref !== void 0 ? _ref : Math.random().toString());
|
|
73
|
+
const contextLayer = useChaynsHistoryLayerContext();
|
|
74
|
+
const parentLayerRef = useRef(contextLayer);
|
|
75
|
+
const rootLayerRef = useRef(null);
|
|
67
76
|
if (!customWrapper.current) {
|
|
68
77
|
if (isModule) {
|
|
69
78
|
if (data && functions) {
|
|
@@ -91,9 +100,10 @@ const ChaynsProvider = ({
|
|
|
91
100
|
customWrapper.current.chaynsApiId = idRef.current;
|
|
92
101
|
}
|
|
93
102
|
}
|
|
103
|
+
const [effectiveLayer, setEffectiveLayer] = useState(historyLayer !== null && historyLayer !== void 0 ? historyLayer : null);
|
|
94
104
|
const [isInitialized, setIsInitialized] = useState(!!((_customWrapper$curren = customWrapper.current) !== null && _customWrapper$curren !== void 0 && _customWrapper$curren.values));
|
|
95
105
|
useEffect(() => {
|
|
96
|
-
void (async () => {
|
|
106
|
+
void (async (_customWrapper$curren2, _ref2) => {
|
|
97
107
|
await customWrapper.current.init();
|
|
98
108
|
customWrapper.current.addDataListener(({
|
|
99
109
|
type,
|
|
@@ -101,6 +111,15 @@ const ChaynsProvider = ({
|
|
|
101
111
|
}) => {
|
|
102
112
|
customWrapper.current.emitChange();
|
|
103
113
|
});
|
|
114
|
+
parentLayerRef.current = (_customWrapper$curren2 = customWrapper.current.functions.getHistoryLayer()) !== null && _customWrapper$curren2 !== void 0 ? _customWrapper$curren2 : contextLayer;
|
|
115
|
+
if (!rootLayerRef.current && !historyLayer && !parentLayerRef.current) {
|
|
116
|
+
rootLayerRef.current = getOrInitRootChaynsHistoryLayer(history === null || history === void 0 ? void 0 : history.url, history === null || history === void 0 ? void 0 : history.segmentCount).rootLayer;
|
|
117
|
+
}
|
|
118
|
+
const layer = (_ref2 = historyLayer !== null && historyLayer !== void 0 ? historyLayer : parentLayerRef.current) !== null && _ref2 !== void 0 ? _ref2 : rootLayerRef.current;
|
|
119
|
+
if (typeof segmentCount === 'number' && layer.getSegmentCount() !== segmentCount) {
|
|
120
|
+
layer.setSegmentCount(segmentCount);
|
|
121
|
+
}
|
|
122
|
+
setEffectiveLayer(layer);
|
|
104
123
|
if (!isInitialized) {
|
|
105
124
|
setIsInitialized(true);
|
|
106
125
|
}
|
|
@@ -125,10 +144,19 @@ const ChaynsProvider = ({
|
|
|
125
144
|
removeModuleWrapper(id, customWrapper.current);
|
|
126
145
|
};
|
|
127
146
|
}, []);
|
|
147
|
+
let isDisabled = Boolean((_customWrapper$curren3 = customWrapper.current.values) === null || _customWrapper$curren3 === void 0 ? void 0 : _customWrapper$curren3.isHistoryDisabled);
|
|
148
|
+
if (typeof isHistoryDisabled === 'boolean' && !isDisabled) {
|
|
149
|
+
isDisabled = isHistoryDisabled;
|
|
150
|
+
}
|
|
151
|
+
if ((historyLayer === null || historyLayer === void 0 ? void 0 : historyLayer.id) === 'root') {
|
|
152
|
+
isDisabled = false;
|
|
153
|
+
}
|
|
128
154
|
return React.createElement(React.Fragment, null, isInitialized && React.createElement(ChaynsContext.Provider, {
|
|
129
155
|
value: customWrapper.current
|
|
130
|
-
},
|
|
131
|
-
|
|
156
|
+
}, effectiveLayer && !isDisabled ? React.createElement(ChaynsHistoryLayerProvider, {
|
|
157
|
+
layer: effectiveLayer
|
|
158
|
+
}, children) : children), React.createElement(InitialDataProvider, {
|
|
159
|
+
data: (_customWrapper$curren4 = customWrapper.current) === null || _customWrapper$curren4 === void 0 ? void 0 : _customWrapper$curren4.values,
|
|
132
160
|
renderedByServer: renderedByServer
|
|
133
161
|
}));
|
|
134
162
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
2
|
import React, { useContext, useEffect, useState } from 'react';
|
|
3
|
-
import { HydrationContext } from '../
|
|
3
|
+
import { HydrationContext } from '../contexts';
|
|
4
4
|
function withHydrationBoundary(Component, initializer, useHydrationId, useProps) {
|
|
5
5
|
const stores = {};
|
|
6
6
|
return ({
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { c as _c } from "react-compiler-runtime";
|
|
2
|
+
import React, { createContext, useContext } from 'react';
|
|
3
|
+
import { useIsomorphicLayoutEffect } from '../hooks/useIsomorphicLayoutEffect';
|
|
4
|
+
const _layerStack = [];
|
|
5
|
+
export function pushChaynsHistoryLayer(layer) {
|
|
6
|
+
_layerStack.push(layer);
|
|
7
|
+
}
|
|
8
|
+
export function popChaynsHistoryLayer(layer) {
|
|
9
|
+
const index = _layerStack.lastIndexOf(layer);
|
|
10
|
+
if (index > -1) {
|
|
11
|
+
_layerStack.splice(index, 1);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function getCurrentChaynsHistoryLayer() {
|
|
15
|
+
return _layerStack.length > 0 ? _layerStack[_layerStack.length - 1] : null;
|
|
16
|
+
}
|
|
17
|
+
const ChaynsHistoryLayerContext = createContext(null);
|
|
18
|
+
ChaynsHistoryLayerContext.displayName = 'ChaynsHistoryLayerContext';
|
|
19
|
+
export const ChaynsHistoryLayerProvider = t0 => {
|
|
20
|
+
const $ = _c(6);
|
|
21
|
+
const {
|
|
22
|
+
layer,
|
|
23
|
+
children
|
|
24
|
+
} = t0;
|
|
25
|
+
let t1;
|
|
26
|
+
let t2;
|
|
27
|
+
if ($[0] !== layer) {
|
|
28
|
+
t1 = () => {
|
|
29
|
+
pushChaynsHistoryLayer(layer);
|
|
30
|
+
return () => popChaynsHistoryLayer(layer);
|
|
31
|
+
};
|
|
32
|
+
t2 = [layer];
|
|
33
|
+
$[0] = layer;
|
|
34
|
+
$[1] = t1;
|
|
35
|
+
$[2] = t2;
|
|
36
|
+
} else {
|
|
37
|
+
t1 = $[1];
|
|
38
|
+
t2 = $[2];
|
|
39
|
+
}
|
|
40
|
+
useIsomorphicLayoutEffect(t1, t2);
|
|
41
|
+
let t3;
|
|
42
|
+
if ($[3] !== children || $[4] !== layer) {
|
|
43
|
+
t3 = React.createElement(ChaynsHistoryLayerContext.Provider, {
|
|
44
|
+
value: layer
|
|
45
|
+
}, children);
|
|
46
|
+
$[3] = children;
|
|
47
|
+
$[4] = layer;
|
|
48
|
+
$[5] = t3;
|
|
49
|
+
} else {
|
|
50
|
+
t3 = $[5];
|
|
51
|
+
}
|
|
52
|
+
return t3;
|
|
53
|
+
};
|
|
54
|
+
export const ChaynsHistoryLayerOverrideProvider = t0 => {
|
|
55
|
+
const $ = _c(3);
|
|
56
|
+
const {
|
|
57
|
+
layer,
|
|
58
|
+
children
|
|
59
|
+
} = t0;
|
|
60
|
+
let t1;
|
|
61
|
+
if ($[0] !== children || $[1] !== layer) {
|
|
62
|
+
t1 = React.createElement(ChaynsHistoryLayerContext.Provider, {
|
|
63
|
+
value: layer
|
|
64
|
+
}, children);
|
|
65
|
+
$[0] = children;
|
|
66
|
+
$[1] = layer;
|
|
67
|
+
$[2] = t1;
|
|
68
|
+
} else {
|
|
69
|
+
t1 = $[2];
|
|
70
|
+
}
|
|
71
|
+
return t1;
|
|
72
|
+
};
|
|
73
|
+
export function useChaynsHistoryLayerContext() {
|
|
74
|
+
return useContext(ChaynsHistoryLayerContext);
|
|
75
|
+
}
|
|
76
|
+
export default ChaynsHistoryLayerContext;
|