@next-core/brick-kit 2.179.7 → 2.181.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/index.bundle.js +74 -4
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +74 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/Runtime.d.ts.map +1 -1
- package/dist/types/core/StoryboardContext.d.ts +1 -0
- package/dist/types/core/StoryboardContext.d.ts.map +1 -1
- package/dist/types/core/realTimeDataInspect.d.ts +26 -0
- package/dist/types/core/realTimeDataInspect.d.ts.map +1 -0
- package/dist/types/developHelper.d.ts +3 -0
- package/dist/types/developHelper.d.ts.map +1 -1
- package/dist/types/getRealValue.d.ts +3 -1
- package/dist/types/getRealValue.d.ts.map +1 -1
- package/dist/types/internal/evaluate.d.ts +1 -0
- package/dist/types/internal/evaluate.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1799,6 +1799,43 @@ function _checkIf(rawIf, ctx, fn) {
|
|
|
1799
1799
|
return true;
|
|
1800
1800
|
}
|
|
1801
1801
|
|
|
1802
|
+
var realTimeDataInspectRoot;
|
|
1803
|
+
var RealTimeDataInspectHooks = [];
|
|
1804
|
+
function setRealTimeDataInspectRoot(root) {
|
|
1805
|
+
realTimeDataInspectRoot = root;
|
|
1806
|
+
var data = Object.fromEntries([..._dev_only_getAllContextValues({
|
|
1807
|
+
tplContextId: root.tplStateStoreId
|
|
1808
|
+
})].filter(_ref => {
|
|
1809
|
+
var [, item] = _ref;
|
|
1810
|
+
return item.type === "free-variable";
|
|
1811
|
+
}).map(_ref2 => {
|
|
1812
|
+
var [k, item] = _ref2;
|
|
1813
|
+
return [k, item.value];
|
|
1814
|
+
}));
|
|
1815
|
+
callRealTimeDataInspectHooks({
|
|
1816
|
+
changeType: "initialize",
|
|
1817
|
+
tplStateStoreId: root.tplStateStoreId,
|
|
1818
|
+
detail: {
|
|
1819
|
+
data
|
|
1820
|
+
}
|
|
1821
|
+
});
|
|
1822
|
+
}
|
|
1823
|
+
function addRealTimeDataInspectHook(hook) {
|
|
1824
|
+
RealTimeDataInspectHooks.push(hook);
|
|
1825
|
+
}
|
|
1826
|
+
function callRealTimeDataInspectHooks(detail) {
|
|
1827
|
+
setTimeout(() => {
|
|
1828
|
+
for (var hook of RealTimeDataInspectHooks) {
|
|
1829
|
+
try {
|
|
1830
|
+
hook(detail);
|
|
1831
|
+
} catch (error) {
|
|
1832
|
+
// eslint-disable-next-line no-console
|
|
1833
|
+
console.error("RealTimeDataInspectHook failed (".concat(detail.changeType, "):"), error);
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
});
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1802
1839
|
class StoryboardContextWrapper {
|
|
1803
1840
|
constructor(tplContextId, formContextId, renderId) {
|
|
1804
1841
|
_defineProperty$1(this, "data", new Map());
|
|
@@ -1831,6 +1868,23 @@ class StoryboardContextWrapper {
|
|
|
1831
1868
|
var _this$data$get;
|
|
1832
1869
|
return (_this$data$get = this.data.get(name)) === null || _this$data$get === void 0 ? void 0 : _this$data$get.value;
|
|
1833
1870
|
}
|
|
1871
|
+
notifyRealTimeDataChange(name, value) {
|
|
1872
|
+
if (realTimeDataInspectRoot) {
|
|
1873
|
+
var {
|
|
1874
|
+
tplStateStoreId
|
|
1875
|
+
} = realTimeDataInspectRoot;
|
|
1876
|
+
if (tplStateStoreId ? this.tplContextId === tplStateStoreId : !this.tplContextId && !this.formContextId) {
|
|
1877
|
+
callRealTimeDataInspectHooks({
|
|
1878
|
+
changeType: "update",
|
|
1879
|
+
tplStateStoreId,
|
|
1880
|
+
detail: {
|
|
1881
|
+
name,
|
|
1882
|
+
value
|
|
1883
|
+
}
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1834
1888
|
getAffectListByContext(name) {
|
|
1835
1889
|
var affectNames = [name];
|
|
1836
1890
|
this.data.forEach((value, key) => {
|
|
@@ -2201,6 +2255,9 @@ function resolveFreeVariableValue(value, contextConf, mergedContext, storyboardC
|
|
|
2201
2255
|
newContext.eventTarget.addEventListener(eventName, listenerFactory(handler, mergedContext, brick));
|
|
2202
2256
|
}
|
|
2203
2257
|
}
|
|
2258
|
+
newContext.eventTarget.addEventListener(eventName, e => {
|
|
2259
|
+
storyboardContextWrapper.notifyRealTimeDataChange(contextConf.name, e.detail);
|
|
2260
|
+
});
|
|
2204
2261
|
if (contextConf.track) {
|
|
2205
2262
|
var isTemplateState = !!storyboardContextWrapper.tplContextId;
|
|
2206
2263
|
var isFormState = !!storyboardContextWrapper.formContextId;
|
|
@@ -2538,9 +2595,15 @@ function evaluate(raw) {
|
|
|
2538
2595
|
}
|
|
2539
2596
|
});
|
|
2540
2597
|
case "QUERY":
|
|
2541
|
-
|
|
2598
|
+
{
|
|
2599
|
+
var params = options.useRealTimeQuery ? new URLSearchParams(getHistory().location.search) : query;
|
|
2600
|
+
return Object.fromEntries(Array.from(params.keys()).map(key => [key, params.get(key)]));
|
|
2601
|
+
}
|
|
2542
2602
|
case "QUERY_ARRAY":
|
|
2543
|
-
|
|
2603
|
+
{
|
|
2604
|
+
var _params = options.useRealTimeQuery ? new URLSearchParams(getHistory().location.search) : query;
|
|
2605
|
+
return Object.fromEntries(Array.from(_params.keys()).map(key => [key, _params.getAll(key)]));
|
|
2606
|
+
}
|
|
2544
2607
|
case "SEGUE":
|
|
2545
2608
|
return {
|
|
2546
2609
|
getUrl: getUrlBySegueFactory(app, segues)
|
|
@@ -14133,7 +14196,9 @@ var developHelper = {
|
|
|
14133
14196
|
getAddedContracts: _dev_only_getAddedContracts,
|
|
14134
14197
|
getContextValue: _dev_only_getContextValue,
|
|
14135
14198
|
getAllContextValues: _dev_only_getAllContextValues,
|
|
14136
|
-
render: _dev_only_render
|
|
14199
|
+
render: _dev_only_render,
|
|
14200
|
+
setRealTimeDataInspectRoot,
|
|
14201
|
+
addRealTimeDataInspectHook
|
|
14137
14202
|
};
|
|
14138
14203
|
|
|
14139
14204
|
var _excluded$2 = ["type"];
|
|
@@ -14735,10 +14800,15 @@ function useProvider() {
|
|
|
14735
14800
|
* @returns Computed real value.
|
|
14736
14801
|
*/
|
|
14737
14802
|
function getRealValue(value) {
|
|
14803
|
+
var {
|
|
14804
|
+
useRealTimeQuery
|
|
14805
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
14738
14806
|
var compute = (data, ctx) => {
|
|
14739
14807
|
if (typeof data === "string") {
|
|
14740
14808
|
if (isEvaluable(data)) {
|
|
14741
|
-
var result = evaluate(data
|
|
14809
|
+
var result = evaluate(data, undefined, {
|
|
14810
|
+
useRealTimeQuery
|
|
14811
|
+
});
|
|
14742
14812
|
recursiveMarkAsInjected(result);
|
|
14743
14813
|
return result;
|
|
14744
14814
|
}
|