palistor 0.0.25 → 0.0.27
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 +609 -542
- package/README.ru.md +1015 -0
- package/dist/index.d.ts +16 -27
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -28
- package/dist/index.js.map +1 -1
- package/dist/react/createTrackingProxy.d.ts +27 -27
- package/dist/react/createTrackingProxy.d.ts.map +1 -1
- package/dist/react/createTrackingProxy.js +54 -53
- package/dist/react/createTrackingProxy.js.map +1 -1
- package/dist/react/useForm.d.ts +42 -43
- package/dist/react/useForm.d.ts.map +1 -1
- package/dist/react/useForm.js +38 -38
- package/dist/react/useForm.js.map +1 -1
- package/dist/react/usePersist.d.ts +14 -14
- package/dist/react/usePersist.js +18 -18
- package/dist/react/usePersist.js.map +1 -1
- package/dist/react/useStoreContext.d.ts +11 -11
- package/dist/react/useStoreContext.js +11 -11
- package/dist/react/useTranslator.d.ts +12 -12
- package/dist/react/useTranslator.js +12 -12
- package/dist/store/applyPatch/applyPatch.d.ts +8 -8
- package/dist/store/applyPatch/applyPatch.js +12 -12
- package/dist/store/applyPatch/applyPatch.js.map +1 -1
- package/dist/store/buildProxy/buildEntityProjectionProxy.js +6 -6
- package/dist/store/buildProxy/buildEntityProjectionProxy.js.map +1 -1
- package/dist/store/buildProxy/buildListProxy.d.ts +8 -8
- package/dist/store/buildProxy/buildListProxy.js +30 -30
- package/dist/store/buildProxy/buildListProxy.js.map +1 -1
- package/dist/store/buildProxy/buildProxy.d.ts +8 -8
- package/dist/store/buildProxy/buildProxy.js +39 -39
- package/dist/store/buildProxy/buildProxy.js.map +1 -1
- package/dist/store/buildProxy/computeProxyKeys.d.ts +8 -8
- package/dist/store/buildProxy/computeProxyKeys.js +9 -9
- package/dist/store/buildProxy/computeProxyKeys.js.map +1 -1
- package/dist/store/buildProxy/handleLazyResolve.d.ts +3 -3
- package/dist/store/buildProxy/handleLazyResolve.js +3 -3
- package/dist/store/buildProxy/initProxyCaches.d.ts +5 -5
- package/dist/store/buildProxy/initProxyCaches.js +5 -5
- package/dist/store/compute/computeFieldState.d.ts +3 -3
- package/dist/store/compute/computeFieldState.js +8 -8
- package/dist/store/compute/computeFieldState.js.map +1 -1
- package/dist/store/compute/fieldStateChanged.d.ts +1 -1
- package/dist/store/compute/fieldStateChanged.js +1 -1
- package/dist/store/compute/recompute/collectGroupComputeNodes.d.ts +4 -4
- package/dist/store/compute/recompute/collectGroupComputeNodes.js +7 -7
- package/dist/store/compute/recompute/collectGroupComputeNodes.js.map +1 -1
- package/dist/store/compute/recompute/recomputeAndNotify.d.ts +3 -3
- package/dist/store/compute/recompute/recomputeAndNotify.js +3 -3
- package/dist/store/compute/recompute/recomputeLeaves.d.ts +11 -10
- package/dist/store/compute/recompute/recomputeLeaves.d.ts.map +1 -1
- package/dist/store/compute/recompute/recomputeLeaves.js +26 -27
- package/dist/store/compute/recompute/recomputeLeaves.js.map +1 -1
- package/dist/store/compute/recompute/recomputeTargeted.d.ts +7 -7
- package/dist/store/compute/recompute/recomputeTargeted.js +12 -12
- package/dist/store/compute/recompute/recomputeTargeted.js.map +1 -1
- package/dist/store/compute/recompute/topologicalSortComputed.d.ts +4 -4
- package/dist/store/compute/recompute/topologicalSortComputed.d.ts.map +1 -1
- package/dist/store/compute/recompute/topologicalSortComputed.js +11 -13
- package/dist/store/compute/recompute/topologicalSortComputed.js.map +1 -1
- package/dist/store/compute/recompute/types.d.ts +4 -4
- package/dist/store/compute/resolveFlag.d.ts +2 -2
- package/dist/store/compute/resolveFlag.js +2 -2
- package/dist/store/compute/resolveString.d.ts +5 -5
- package/dist/store/compute/resolveString.js +6 -6
- package/dist/store/compute/resolveString.js.map +1 -1
- package/dist/store/compute/types.d.ts +3 -3
- package/dist/store/constants.d.ts +48 -48
- package/dist/store/constants.d.ts.map +1 -1
- package/dist/store/constants.js +45 -45
- package/dist/store/defineFieldMapping.d.ts +21 -19
- package/dist/store/defineFieldMapping.d.ts.map +1 -1
- package/dist/store/defineFieldMapping.js +21 -19
- package/dist/store/defineFieldMapping.js.map +1 -1
- package/dist/store/dirtyTracking/collectInitialSnapshot.js +1 -1
- package/dist/store/dirtyTracking/collectInitialSnapshot.js.map +1 -1
- package/dist/store/dirtyTracking/recomputeDirtyTargeted.d.ts +3 -3
- package/dist/store/dirtyTracking/recomputeDirtyTargeted.js +11 -11
- package/dist/store/dirtyTracking/recomputeDirtyTargeted.js.map +1 -1
- package/dist/store/dirtyTracking/setGroupRevalidate.d.ts +6 -6
- package/dist/store/dirtyTracking/setGroupRevalidate.js +7 -7
- package/dist/store/dirtyTracking/setGroupRevalidate.js.map +1 -1
- package/dist/store/entityRegistry/entityRegistry.d.ts +72 -72
- package/dist/store/entityRegistry/entityRegistry.d.ts.map +1 -1
- package/dist/store/entityRegistry/entityRegistry.js +91 -91
- package/dist/store/entityRegistry/entityRegistry.js.map +1 -1
- package/dist/store/entityRegistry/generateId.d.ts +3 -3
- package/dist/store/entityRegistry/generateId.js +3 -3
- package/dist/store/entityRegistry/types.d.ts +17 -17
- package/dist/store/entityRegistry/types.d.ts.map +1 -1
- package/dist/store/flow/buildFlowStepsProxy.d.ts +9 -9
- package/dist/store/flow/buildFlowStepsProxy.js +13 -13
- package/dist/store/flow/buildFlowStepsProxy.js.map +1 -1
- package/dist/store/flow/defineFlow.d.ts +27 -25
- package/dist/store/flow/defineFlow.d.ts.map +1 -1
- package/dist/store/flow/defineFlow.js +15 -13
- package/dist/store/flow/defineFlow.js.map +1 -1
- package/dist/store/flow/flowApi.d.ts +3 -2
- package/dist/store/flow/flowApi.d.ts.map +1 -1
- package/dist/store/flow/flowApi.js +1 -1
- package/dist/store/flow/flowApi.js.map +1 -1
- package/dist/store/flow/flowNavigation.d.ts +65 -63
- package/dist/store/flow/flowNavigation.d.ts.map +1 -1
- package/dist/store/flow/flowNavigation.js +74 -72
- package/dist/store/flow/flowNavigation.js.map +1 -1
- package/dist/store/flow/flowState.d.ts +16 -16
- package/dist/store/flow/flowState.d.ts.map +1 -1
- package/dist/store/flow/flowState.js +5 -5
- package/dist/store/flow/flowState.js.map +1 -1
- package/dist/store/groupDeps/createGroupDeps.d.ts +3 -3
- package/dist/store/groupDeps/createGroupDeps.js +6 -6
- package/dist/store/groupDeps/createGroupDeps.js.map +1 -1
- package/dist/store/groupDeps/createTrackingValues.d.ts +9 -9
- package/dist/store/groupDeps/createTrackingValues.js +11 -11
- package/dist/store/groupDeps/createTrackingValues.js.map +1 -1
- package/dist/store/groupDeps/getNodeGroupPath.d.ts +3 -3
- package/dist/store/groupDeps/getNodeGroupPath.js +5 -5
- package/dist/store/groupDeps/getNodeGroupPath.js.map +1 -1
- package/dist/store/groupDeps/getRecipientGroups.d.ts +1 -1
- package/dist/store/groupDeps/getRecipientGroups.js +1 -1
- package/dist/store/groupDeps/groupDeps.d.ts +7 -7
- package/dist/store/groupDeps/groupDeps.js +7 -7
- package/dist/store/groupDeps/pairKey.d.ts +3 -3
- package/dist/store/groupDeps/pairKey.d.ts.map +1 -1
- package/dist/store/groupDeps/pairKey.js +4 -4
- package/dist/store/groupDeps/pairKey.js.map +1 -1
- package/dist/store/groupDeps/resolveGroupByPath.d.ts +3 -3
- package/dist/store/groupDeps/resolveGroupByPath.js +3 -3
- package/dist/store/init/createNotificationHub.d.ts +31 -31
- package/dist/store/init/createNotificationHub.d.ts.map +1 -1
- package/dist/store/init/createNotificationHub.js +36 -37
- package/dist/store/init/createNotificationHub.js.map +1 -1
- package/dist/store/init/createResolveManager.d.ts +72 -69
- package/dist/store/init/createResolveManager.d.ts.map +1 -1
- package/dist/store/init/createResolveManager.js +101 -98
- package/dist/store/init/createResolveManager.js.map +1 -1
- package/dist/store/init/initGroupSubmitting.d.ts +2 -2
- package/dist/store/init/initGroupSubmitting.js +4 -4
- package/dist/store/init/initGroupSubmitting.js.map +1 -1
- package/dist/store/normalizeConfig.d.ts +20 -18
- package/dist/store/normalizeConfig.d.ts.map +1 -1
- package/dist/store/normalizeConfig.js +31 -29
- package/dist/store/normalizeConfig.js.map +1 -1
- package/dist/store/onChangePipeline/computeFieldKey.d.ts +2 -2
- package/dist/store/onChangePipeline/computeFieldKey.js +2 -2
- package/dist/store/onChangePipeline/findOnChangeAncestors.d.ts +2 -2
- package/dist/store/onChangePipeline/findOnChangeAncestors.js +4 -4
- package/dist/store/onChangePipeline/findOnChangeAncestors.js.map +1 -1
- package/dist/store/onChangePipeline/onChangePipeline.d.ts +13 -12
- package/dist/store/onChangePipeline/onChangePipeline.d.ts.map +1 -1
- package/dist/store/onChangePipeline/onChangePipeline.js +14 -13
- package/dist/store/onChangePipeline/onChangePipeline.js.map +1 -1
- package/dist/store/persist/drivers.d.ts +7 -7
- package/dist/store/persist/drivers.js +8 -8
- package/dist/store/persist/drivers.js.map +1 -1
- package/dist/store/persist/index.d.ts +1 -1
- package/dist/store/persist/persistManager.d.ts +23 -23
- package/dist/store/persist/persistManager.d.ts.map +1 -1
- package/dist/store/persist/persistManager.js +51 -51
- package/dist/store/persist/persistManager.js.map +1 -1
- package/dist/store/persist/types.d.ts +23 -23
- package/dist/store/persist/types.d.ts.map +1 -1
- package/dist/store/persist/types.js +4 -4
- package/dist/store/resetPipeline/buildResetPatch.d.ts +5 -5
- package/dist/store/resetPipeline/buildResetPatch.js +5 -5
- package/dist/store/resetPipeline/collectDefaults.d.ts +5 -5
- package/dist/store/resetPipeline/collectDefaults.js +6 -6
- package/dist/store/resetPipeline/collectDefaults.js.map +1 -1
- package/dist/store/resetPipeline/resetPipeline.d.ts +7 -7
- package/dist/store/resetPipeline/resetPipeline.js +15 -15
- package/dist/store/resetPipeline/resetPipeline.js.map +1 -1
- package/dist/store/resolvePipeline/applyPendingWrites.d.ts +10 -10
- package/dist/store/resolvePipeline/applyPendingWrites.d.ts.map +1 -1
- package/dist/store/resolvePipeline/applyPendingWrites.js +35 -38
- package/dist/store/resolvePipeline/applyPendingWrites.js.map +1 -1
- package/dist/store/resolvePipeline/createContextTrackingProxy.d.ts +8 -7
- package/dist/store/resolvePipeline/createContextTrackingProxy.d.ts.map +1 -1
- package/dist/store/resolvePipeline/createContextTrackingProxy.js +6 -5
- package/dist/store/resolvePipeline/createContextTrackingProxy.js.map +1 -1
- package/dist/store/resolvePipeline/createValuesTrackingProxy.d.ts +43 -43
- package/dist/store/resolvePipeline/createValuesTrackingProxy.d.ts.map +1 -1
- package/dist/store/resolvePipeline/createValuesTrackingProxy.js +70 -70
- package/dist/store/resolvePipeline/createValuesTrackingProxy.js.map +1 -1
- package/dist/store/resolvePipeline/executeListResolve.d.ts +14 -14
- package/dist/store/resolvePipeline/executeListResolve.js +27 -27
- package/dist/store/resolvePipeline/executeListResolve.js.map +1 -1
- package/dist/store/resolvePipeline/executeResolve.d.ts +15 -15
- package/dist/store/resolvePipeline/executeResolve.js +46 -46
- package/dist/store/resolvePipeline/executeResolve.js.map +1 -1
- package/dist/store/store/NodeRegistry/nodeRegistry.d.ts +61 -61
- package/dist/store/store/NodeRegistry/nodeRegistry.d.ts.map +1 -1
- package/dist/store/store/NodeRegistry/nodeRegistry.js +85 -86
- package/dist/store/store/NodeRegistry/nodeRegistry.js.map +1 -1
- package/dist/store/store/NodeRegistry/nodeUtils.d.ts +5 -5
- package/dist/store/store/NodeRegistry/nodeUtils.d.ts.map +1 -1
- package/dist/store/store/NodeRegistry/nodeUtils.js +5 -5
- package/dist/store/store/NodeRegistry/nodeUtils.js.map +1 -1
- package/dist/store/store/groupDepsMap.d.ts +23 -23
- package/dist/store/store/groupDepsMap.d.ts.map +1 -1
- package/dist/store/store/groupDepsMap.js +35 -34
- package/dist/store/store/groupDepsMap.js.map +1 -1
- package/dist/store/store/hasComputedProps.d.ts +2 -2
- package/dist/store/store/hasComputedProps.js +2 -2
- package/dist/store/store/nodeMap.d.ts +5 -5
- package/dist/store/store/nodeMap.js +7 -7
- package/dist/store/store/nodeMap.js.map +1 -1
- package/dist/store/store/palistor.d.ts +80 -80
- package/dist/store/store/palistor.d.ts.map +1 -1
- package/dist/store/store/palistor.js +149 -169
- package/dist/store/store/palistor.js.map +1 -1
- package/dist/store/store/registerNodes.d.ts +10 -10
- package/dist/store/store/registerNodes.js +15 -15
- package/dist/store/store/registerNodes.js.map +1 -1
- package/dist/store/store/serviceRegistry.d.ts +8 -8
- package/dist/store/store/serviceRegistry.d.ts.map +1 -1
- package/dist/store/store/serviceRegistry.js +8 -8
- package/dist/store/store/serviceRegistry.js.map +1 -1
- package/dist/store/store/types.d.ts +236 -234
- package/dist/store/store/types.d.ts.map +1 -1
- package/dist/store/submitPipeline/applyLeafBeforeSubmit.d.ts +2 -2
- package/dist/store/submitPipeline/applyLeafBeforeSubmit.js +2 -2
- package/dist/store/submitPipeline/collectLeafStates.d.ts +2 -2
- package/dist/store/submitPipeline/collectLeafStates.js +2 -2
- package/dist/store/submitPipeline/submitPipeline.d.ts +8 -8
- package/dist/store/submitPipeline/submitPipeline.js +12 -12
- package/dist/store/submitPipeline/submitPipeline.js.map +1 -1
- package/dist/store/submitPipeline/types.d.ts +1 -1
- package/dist/store/submitPipeline/types.d.ts.map +1 -1
- package/dist/store/traversal/nodeClassifier.d.ts +9 -9
- package/dist/store/traversal/nodeClassifier.d.ts.map +1 -1
- package/dist/store/traversal/nodeClassifier.js +11 -11
- package/dist/store/traversal/nodeClassifier.js.map +1 -1
- package/dist/store/traversal/walkFull.d.ts +14 -14
- package/dist/store/traversal/walkFull.js +2 -2
- package/dist/store/valuesCache/valuesCache.d.ts +9 -9
- package/dist/store/valuesCache/valuesCache.d.ts.map +1 -1
- package/dist/store/valuesCache/valuesCache.js +6 -6
- package/dist/store/writePipeline/formatPatch.d.ts +5 -5
- package/dist/store/writePipeline/formatPatch.js +7 -7
- package/dist/store/writePipeline/formatPatch.js.map +1 -1
- package/dist/store/writePipeline/formatValue.d.ts +5 -5
- package/dist/store/writePipeline/formatValue.js +5 -5
- package/dist/store/writePipeline/mergeChanged.d.ts +4 -4
- package/dist/store/writePipeline/mergeChanged.js +4 -4
- package/dist/store/writePipeline/runSetter.d.ts +6 -6
- package/dist/store/writePipeline/runSetter.js +8 -8
- package/dist/store/writePipeline/storeValue.d.ts +3 -3
- package/dist/store/writePipeline/storeValue.js +3 -3
- package/dist/store/writePipeline/types.d.ts +4 -4
- package/dist/store/writePipeline/types.d.ts.map +1 -1
- package/dist/store/writePipeline/writePipeline.d.ts +7 -7
- package/dist/store/writePipeline/writePipeline.d.ts.map +1 -1
- package/dist/store/writePipeline/writePipeline.js +15 -15
- package/dist/store/writePipeline/writePipeline.js.map +1 -1
- package/package.json +11 -4
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { pairKey } from "./pairKey";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Wrapper for valuesCache.values that intercepts READ accesses
|
|
4
|
+
* and records cross-group dependencies into a Set.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* When a leaf value is read, the donor group is determined by the current
|
|
7
|
+
* nesting level. If donor ≠ recipient → the donor→recipient pair is recorded.
|
|
8
8
|
*
|
|
9
|
-
* @param values —
|
|
10
|
-
* @param recipientGroupPath —
|
|
11
|
-
* @param deps — Set
|
|
12
|
-
* @param currentGroupPath —
|
|
13
|
-
* @param subProxyCache — WeakMap
|
|
9
|
+
* @param values — flat values object from valuesCache.values
|
|
10
|
+
* @param recipientGroupPath — path of the group currently being computed
|
|
11
|
+
* @param deps — Set that collects discovered dependencies
|
|
12
|
+
* @param currentGroupPath — current nesting level in the values tree (starts as "")
|
|
13
|
+
* @param subProxyCache — WeakMap memoizing sub-proxies within one call
|
|
14
14
|
*/
|
|
15
15
|
export function createTrackingValues(values, recipientGroupPath, deps, currentGroupPath = "", subProxyCache = new WeakMap()) {
|
|
16
16
|
return new Proxy(values, {
|
|
@@ -18,7 +18,7 @@ export function createTrackingValues(values, recipientGroupPath, deps, currentGr
|
|
|
18
18
|
if (typeof key === "symbol")
|
|
19
19
|
return target[key];
|
|
20
20
|
const val = target[key];
|
|
21
|
-
//
|
|
21
|
+
// Nested object (group) — recursive proxy with memoization
|
|
22
22
|
if (val && typeof val === "object" && !Array.isArray(val)) {
|
|
23
23
|
const cached = subProxyCache.get(val);
|
|
24
24
|
if (cached)
|
|
@@ -28,7 +28,7 @@ export function createTrackingValues(values, recipientGroupPath, deps, currentGr
|
|
|
28
28
|
subProxyCache.set(val, childProxy);
|
|
29
29
|
return childProxy;
|
|
30
30
|
}
|
|
31
|
-
//
|
|
31
|
+
// Leaf value read: donor = currentGroupPath
|
|
32
32
|
if (currentGroupPath !== recipientGroupPath) {
|
|
33
33
|
deps.add(pairKey(currentGroupPath, recipientGroupPath));
|
|
34
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTrackingValues.js","sourceRoot":"","sources":["../../../store/groupDeps/createTrackingValues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAA+B,EAC/B,kBAA0B,EAC1B,IAAiB,EACjB,gBAAgB,GAAG,EAAE,EACrB,gBAA0D,IAAI,OAAO,EAAE;IAEvE,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE;QACvB,GAAG,CAAC,MAAM,EAAE,GAAoB;YAC9B,IAAI,OAAO,GAAG,KAAK,QAAQ;gBAAE,OAAQ,MAAc,CAAC,GAAG,CAAC,CAAC;YAEzD,MAAM,GAAG,GAAI,MAAkC,CAAC,GAAG,CAAC,CAAC;YAErD,
|
|
1
|
+
{"version":3,"file":"createTrackingValues.js","sourceRoot":"","sources":["../../../store/groupDeps/createTrackingValues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAA+B,EAC/B,kBAA0B,EAC1B,IAAiB,EACjB,gBAAgB,GAAG,EAAE,EACrB,gBAA0D,IAAI,OAAO,EAAE;IAEvE,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE;QACvB,GAAG,CAAC,MAAM,EAAE,GAAoB;YAC9B,IAAI,OAAO,GAAG,KAAK,QAAQ;gBAAE,OAAQ,MAAc,CAAC,GAAG,CAAC,CAAC;YAEzD,MAAM,GAAG,GAAI,MAAkC,CAAC,GAAG,CAAC,CAAC;YAErD,2DAA2D;YAC3D,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC1D,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,GAAa,CAAC,CAAC;gBAChD,IAAI,MAAM;oBAAE,OAAO,MAAM,CAAC;gBAC1B,MAAM,SAAS,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,gBAAgB,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;gBACxE,MAAM,UAAU,GAAG,oBAAoB,CACrC,GAA8B,EAC9B,kBAAkB,EAClB,IAAI,EACJ,SAAS,EACT,aAAa,CACd,CAAC;gBACF,aAAa,CAAC,GAAG,CAAC,GAAa,EAAE,UAAU,CAAC,CAAC;gBAC7C,OAAO,UAAU,CAAC;YACpB,CAAC;YAED,4CAA4C;YAC5C,IAAI,gBAAgB,KAAK,kBAAkB,EAAE,CAAC;gBAC5C,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC,CAAC;YAC1D,CAAC;YAED,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Determine the path of the group a node belongs to.
|
|
3
3
|
*
|
|
4
|
-
* -
|
|
5
|
-
* -
|
|
4
|
+
* - Leaf node (has "value") → the parent group's path
|
|
5
|
+
* - Group node → its own path
|
|
6
6
|
* - Root → ""
|
|
7
7
|
*/
|
|
8
8
|
export declare function getNodeGroupPath(node: object, nodeParents: WeakMap<object, object>, nodePaths: WeakMap<object, string>): string;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { isGroupNode } from "../traversal";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Determine the path of the group a node belongs to.
|
|
4
4
|
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
5
|
+
* - Leaf node (has "value") → the parent group's path
|
|
6
|
+
* - Group node → its own path
|
|
7
7
|
* - Root → ""
|
|
8
8
|
*/
|
|
9
9
|
export function getNodeGroupPath(node, nodeParents, nodePaths) {
|
|
10
|
-
//
|
|
10
|
+
// Group node → its own path
|
|
11
11
|
if (isGroupNode(node)) {
|
|
12
12
|
return nodePaths.get(node) ?? "";
|
|
13
13
|
}
|
|
14
|
-
//
|
|
14
|
+
// Leaf → the parent group's path
|
|
15
15
|
const parent = nodeParents.get(node);
|
|
16
16
|
if (!parent)
|
|
17
17
|
return "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNodeGroupPath.js","sourceRoot":"","sources":["../../../store/groupDeps/getNodeGroupPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAY,EACZ,WAAoC,EACpC,SAAkC;IAElC,
|
|
1
|
+
{"version":3,"file":"getNodeGroupPath.js","sourceRoot":"","sources":["../../../store/groupDeps/getNodeGroupPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAY,EACZ,WAAoC,EACpC,SAAkC;IAElC,4BAA4B;IAC5B,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACnC,CAAC;IACD,iCAAiC;IACjC,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,OAAO,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Get all recipient groups for a given donor (excluding the self-dependency).
|
|
3
3
|
*/
|
|
4
4
|
export declare function getRecipientGroups(deps: Set<string>, donorPath: string): string[];
|
|
5
5
|
//# sourceMappingURL=getRecipientGroups.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parsePairKey } from "./pairKey";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Get all recipient groups for a given donor (excluding the self-dependency).
|
|
4
4
|
*/
|
|
5
5
|
export function getRecipientGroups(deps, donorPath) {
|
|
6
6
|
const recipients = [];
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Map of dependencies between groups.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Stores "donor→recipient" pairs in a Set<string>.
|
|
5
|
+
* When a value in a donor group changes, all recipient groups
|
|
6
|
+
* need to be recomputed.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Example: if a field in the passport group reads a value from the root,
|
|
9
|
+
* the dependency "→passport" is recorded (root is the donor, passport the recipient).
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* Every group depends on itself by default ("AA", "BB").
|
|
12
12
|
*/
|
|
13
13
|
export { pairKey } from "./pairKey";
|
|
14
14
|
export { createGroupDeps } from "./createGroupDeps";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Map of dependencies between groups.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Stores "donor→recipient" pairs in a Set<string>.
|
|
5
|
+
* When a value in a donor group changes, all recipient groups
|
|
6
|
+
* need to be recomputed.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Example: if a field in the passport group reads a value from the root,
|
|
9
|
+
* the dependency "→passport" is recorded (root is the donor, passport the recipient).
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* Every group depends on itself by default ("AA", "BB").
|
|
12
12
|
*/
|
|
13
13
|
export { pairKey } from "./pairKey";
|
|
14
14
|
export { createGroupDeps } from "./createGroupDeps";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Separator of the "donor→recipient" pair. */
|
|
2
2
|
export declare const SEP = "\u2192";
|
|
3
|
-
/**
|
|
3
|
+
/** Create a "donor→recipient" pair key. */
|
|
4
4
|
export declare function pairKey(donor: string, recipient: string): string;
|
|
5
|
-
/**
|
|
5
|
+
/** Parse a key back into [donor, recipient]. */
|
|
6
6
|
export declare function parsePairKey(key: string): [string, string];
|
|
7
7
|
//# sourceMappingURL=pairKey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pairKey.d.ts","sourceRoot":"","sources":["../../../store/groupDeps/pairKey.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pairKey.d.ts","sourceRoot":"","sources":["../../../store/groupDeps/pairKey.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,eAAO,MAAM,GAAG,WAAM,CAAC;AAEvB,2CAA2C;AAC3C,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,gDAAgD;AAChD,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAG1D"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
export const SEP = "
|
|
3
|
-
/**
|
|
1
|
+
/** Separator of the "donor→recipient" pair. */
|
|
2
|
+
export const SEP = "→"; // →
|
|
3
|
+
/** Create a "donor→recipient" pair key. */
|
|
4
4
|
export function pairKey(donor, recipient) {
|
|
5
5
|
return `${donor}${SEP}${recipient}`;
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
7
|
+
/** Parse a key back into [donor, recipient]. */
|
|
8
8
|
export function parsePairKey(key) {
|
|
9
9
|
const idx = key.indexOf(SEP);
|
|
10
10
|
return [key.slice(0, idx), key.slice(idx + SEP.length)];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pairKey.js","sourceRoot":"","sources":["../../../store/groupDeps/pairKey.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pairKey.js","sourceRoot":"","sources":["../../../store/groupDeps/pairKey.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,MAAM,CAAC,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,IAAI;AAE5B,2CAA2C;AAC3C,MAAM,UAAU,OAAO,CAAC,KAAa,EAAE,SAAiB;IACtD,OAAO,GAAG,KAAK,GAAG,GAAG,GAAG,SAAS,EAAE,CAAC;AACtC,CAAC;AAED,gDAAgD;AAChD,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC7B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type AnyConfigNode } from "../store/types";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* "" → rootConfig, "passport" → rootConfig.passport,
|
|
5
|
-
*
|
|
3
|
+
* Find a group config node by dot-path.
|
|
4
|
+
* "" → rootConfig, "passport" → rootConfig.passport, etc.
|
|
5
|
+
* Returns undefined when the path doesn't exist in the tree (e.g. "_entity_.*" paths).
|
|
6
6
|
*/
|
|
7
7
|
export declare function resolveGroupByPath(rootConfig: AnyConfigNode, path: string): AnyConfigNode | undefined;
|
|
8
8
|
//# sourceMappingURL=resolveGroupByPath.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* "" → rootConfig, "passport" → rootConfig.passport,
|
|
4
|
-
*
|
|
2
|
+
* Find a group config node by dot-path.
|
|
3
|
+
* "" → rootConfig, "passport" → rootConfig.passport, etc.
|
|
4
|
+
* Returns undefined when the path doesn't exist in the tree (e.g. "_entity_.*" paths).
|
|
5
5
|
*/
|
|
6
6
|
export function resolveGroupByPath(rootConfig, path) {
|
|
7
7
|
if (!path)
|
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
import type { AnyConfigNode, ListState } from "../store/types";
|
|
2
2
|
import type { FieldState } from "../compute/index";
|
|
3
3
|
import type { ComputeEntry } from "../store/registerNodes";
|
|
4
|
-
/**
|
|
4
|
+
/** Dependencies needed to recompute dirty flags during notification. */
|
|
5
5
|
export interface DirtyDeps {
|
|
6
6
|
rootConfig: AnyConfigNode;
|
|
7
7
|
nodeState: WeakMap<AnyConfigNode, FieldState>;
|
|
8
8
|
initialValueMap: WeakMap<AnyConfigNode, unknown>;
|
|
9
|
-
/** ListStates
|
|
9
|
+
/** ListStates for list-membership dirty tracking. */
|
|
10
10
|
listStates?: WeakMap<AnyConfigNode, ListState>;
|
|
11
11
|
nodeParents: WeakMap<AnyConfigNode, AnyConfigNode>;
|
|
12
12
|
nodePaths: WeakMap<AnyConfigNode, string>;
|
|
13
13
|
}
|
|
14
14
|
export interface NotificationHubDeps {
|
|
15
15
|
computeNodes: ComputeEntry[];
|
|
16
|
-
/**
|
|
16
|
+
/** Node → dot-path mapping (filled by buildNodeMaps). */
|
|
17
17
|
nodePaths: WeakMap<object, string>;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* The store's notification system.
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
* - per-node
|
|
24
|
-
* -
|
|
25
|
-
* - post-notify hook
|
|
22
|
+
* Consolidates:
|
|
23
|
+
* - per-node and global subscriptions
|
|
24
|
+
* - versioning (global + per-node)
|
|
25
|
+
* - the post-notify hook for external subsystems (resolve re-trigger)
|
|
26
26
|
*/
|
|
27
27
|
export declare class NotificationHub {
|
|
28
28
|
private readonly computeNodes;
|
|
29
29
|
private readonly nodePaths;
|
|
30
|
-
/**
|
|
30
|
+
/** Per-field change subscribers. */
|
|
31
31
|
private readonly nodeListeners;
|
|
32
|
-
/**
|
|
32
|
+
/** Global subscribers — notified on ANY change. */
|
|
33
33
|
private readonly globalListeners;
|
|
34
|
-
/**
|
|
34
|
+
/** Global version — incremented on every change. */
|
|
35
35
|
private version;
|
|
36
|
-
/**
|
|
36
|
+
/** Per-node versions — for targeted subscriptions. */
|
|
37
37
|
private readonly nodeVersions;
|
|
38
|
-
/**
|
|
38
|
+
/** Hook invoked after every notifyChanged (resolve re-trigger etc.). */
|
|
39
39
|
private postNotifyHook;
|
|
40
40
|
/**
|
|
41
|
-
* Re-entrancy guard:
|
|
42
|
-
*
|
|
43
|
-
*
|
|
41
|
+
* Re-entrancy guard: prevents recursive postNotifyHook invocation.
|
|
42
|
+
* Paths accumulated while a hook is active are deferred and processed
|
|
43
|
+
* sequentially after the current call completes.
|
|
44
44
|
*/
|
|
45
45
|
private isDispatchingHook;
|
|
46
46
|
private pendingHookPaths;
|
|
@@ -48,31 +48,31 @@ export declare class NotificationHub {
|
|
|
48
48
|
private notifyNode;
|
|
49
49
|
private notifyGlobals;
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
52
|
-
* 1.
|
|
53
|
-
* 2.
|
|
54
|
-
* 3.
|
|
55
|
-
* 4.
|
|
56
|
-
* 5.
|
|
51
|
+
* Process a set of changed nodes:
|
|
52
|
+
* 1. Recompute dirty flags (leaf + group + root)
|
|
53
|
+
* 2. Increment the global version
|
|
54
|
+
* 3. Update per-node versions + notify per-node subscribers
|
|
55
|
+
* 4. Notify global subscribers
|
|
56
|
+
* 5. Invoke the postNotifyHook (resolve re-triggers etc.)
|
|
57
57
|
*/
|
|
58
58
|
notifyChanged(changed: Set<AnyConfigNode>, dirtyDeps: DirtyDeps): void;
|
|
59
|
-
/**
|
|
59
|
+
/** Subscribe to changes of a specific node. */
|
|
60
60
|
subscribe: (node: AnyConfigNode, listener: () => void) => (() => void);
|
|
61
|
-
/**
|
|
61
|
+
/** Subscribe to any store change. */
|
|
62
62
|
subscribeGlobal: (listener: () => void) => (() => void);
|
|
63
|
-
/**
|
|
63
|
+
/** Global store version. */
|
|
64
64
|
getVersion: () => number;
|
|
65
|
-
/**
|
|
65
|
+
/** Version of a specific node. */
|
|
66
66
|
getNodeVersion: (node: AnyConfigNode) => number;
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
68
|
+
* Bump the version of all leaf nodes + notify global subscribers.
|
|
69
|
+
* Used on translator change — all components re-render.
|
|
70
70
|
*/
|
|
71
71
|
bumpLeafVersions(): void;
|
|
72
72
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
73
|
+
* Register a hook invoked after every notifyChanged.
|
|
74
|
+
* Receives the set of dot-paths of the changed nodes.
|
|
75
|
+
* Used by the resolve system for dependency-driven re-triggers.
|
|
76
76
|
*/
|
|
77
77
|
setPostNotifyHook(hook: ((changedPaths: Set<string>) => void) | null): void;
|
|
78
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNotificationHub.d.ts","sourceRoot":"","sources":["../../../store/init/createNotificationHub.ts"],"names":[],"mappings":"AAAA,OA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AAC,eAAe,CAAyB;IAEzD,oDAAoD;IACpD,OAAO,CAAC,OAAO,CAAK;IAEpB,sDAAsD;IACtD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAwC;IAErE,wEAAwE;IACxE,OAAO,CAAC,cAAc,CAAsD;IAE5E;;;;OAIG;IACH,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,gBAAgB,CAA4B;gBAExC,IAAI,EAAE,mBAAmB;IAOrC,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,aAAa;IAMrB;;;;;;;OAOG;IACH,aAAa,CAAC,OAAO,EAAE,GAAG,CAAC,aAAa,CAAC,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;IAqDtE,+CAA+C;IAC/C,SAAS,GAAI,MAAM,aAAa,EAAE,UAAU,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC,CAInE;IAEF,qCAAqC;IACrC,eAAe,GAAI,UAAU,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC,CAGpD;IAEF,4BAA4B;IAC5B,UAAU,QAAO,MAAM,CAErB;IAEF,kCAAkC;IAClC,cAAc,GAAI,MAAM,aAAa,KAAG,MAAM,CAE5C;IAEF;;;OAGG;IACH,gBAAgB,IAAI,IAAI;IAQxB;;;;OAIG;IACH,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI;CAG5E;AAID,2DAA2D;AAC3D,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,mBAAmB,GAAG,eAAe,CAEhF"}
|
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
import { recomputeDirtyTargeted } from "../dirtyTracking/recomputeDirtyTargeted";
|
|
2
2
|
// ─── Class ───────────────────────────────────────────────────────────────────
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* The store's notification system.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* - per-node
|
|
8
|
-
* -
|
|
9
|
-
* - post-notify hook
|
|
6
|
+
* Consolidates:
|
|
7
|
+
* - per-node and global subscriptions
|
|
8
|
+
* - versioning (global + per-node)
|
|
9
|
+
* - the post-notify hook for external subsystems (resolve re-trigger)
|
|
10
10
|
*/
|
|
11
11
|
export class NotificationHub {
|
|
12
12
|
constructor(deps) {
|
|
13
|
-
/**
|
|
13
|
+
/** Per-field change subscribers. */
|
|
14
14
|
this.nodeListeners = new WeakMap();
|
|
15
|
-
/**
|
|
15
|
+
/** Global subscribers — notified on ANY change. */
|
|
16
16
|
this.globalListeners = new Set();
|
|
17
|
-
/**
|
|
17
|
+
/** Global version — incremented on every change. */
|
|
18
18
|
this.version = 0;
|
|
19
|
-
/**
|
|
19
|
+
/** Per-node versions — for targeted subscriptions. */
|
|
20
20
|
this.nodeVersions = new WeakMap();
|
|
21
|
-
/**
|
|
21
|
+
/** Hook invoked after every notifyChanged (resolve re-trigger etc.). */
|
|
22
22
|
this.postNotifyHook = null;
|
|
23
23
|
/**
|
|
24
|
-
* Re-entrancy guard:
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* Re-entrancy guard: prevents recursive postNotifyHook invocation.
|
|
25
|
+
* Paths accumulated while a hook is active are deferred and processed
|
|
26
|
+
* sequentially after the current call completes.
|
|
27
27
|
*/
|
|
28
28
|
this.isDispatchingHook = false;
|
|
29
29
|
this.pendingHookPaths = null;
|
|
30
|
-
/**
|
|
30
|
+
/** Subscribe to changes of a specific node. */
|
|
31
31
|
this.subscribe = (node, listener) => {
|
|
32
32
|
if (!this.nodeListeners.has(node))
|
|
33
33
|
this.nodeListeners.set(node, new Set());
|
|
34
34
|
this.nodeListeners.get(node).add(listener);
|
|
35
35
|
return () => this.nodeListeners.get(node).delete(listener);
|
|
36
36
|
};
|
|
37
|
-
/**
|
|
37
|
+
/** Subscribe to any store change. */
|
|
38
38
|
this.subscribeGlobal = (listener) => {
|
|
39
39
|
this.globalListeners.add(listener);
|
|
40
40
|
return () => this.globalListeners.delete(listener);
|
|
41
41
|
};
|
|
42
|
-
/**
|
|
42
|
+
/** Global store version. */
|
|
43
43
|
this.getVersion = () => {
|
|
44
44
|
return this.version;
|
|
45
45
|
};
|
|
46
|
-
/**
|
|
46
|
+
/** Version of a specific node. */
|
|
47
47
|
this.getNodeVersion = (node) => {
|
|
48
48
|
return this.nodeVersions.get(node) ?? 0;
|
|
49
49
|
};
|
|
@@ -59,12 +59,12 @@ export class NotificationHub {
|
|
|
59
59
|
}
|
|
60
60
|
// ─── Public API ──────────────────────────────────────────────────────────
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
63
|
-
* 1.
|
|
64
|
-
* 2.
|
|
65
|
-
* 3.
|
|
66
|
-
* 4.
|
|
67
|
-
* 5.
|
|
62
|
+
* Process a set of changed nodes:
|
|
63
|
+
* 1. Recompute dirty flags (leaf + group + root)
|
|
64
|
+
* 2. Increment the global version
|
|
65
|
+
* 3. Update per-node versions + notify per-node subscribers
|
|
66
|
+
* 4. Notify global subscribers
|
|
67
|
+
* 5. Invoke the postNotifyHook (resolve re-triggers etc.)
|
|
68
68
|
*/
|
|
69
69
|
notifyChanged(changed, dirtyDeps) {
|
|
70
70
|
if (changed.size === 0)
|
|
@@ -74,19 +74,18 @@ export class NotificationHub {
|
|
|
74
74
|
const dirtyResult = recomputeDirtyTargeted(changed, rootConfig, nodeState, initialValueMap, nodeParents, nodePaths, listStates);
|
|
75
75
|
for (const n of dirtyResult.changed)
|
|
76
76
|
changed.add(n);
|
|
77
|
-
//
|
|
77
|
+
// Increment the global version
|
|
78
78
|
this.version++;
|
|
79
|
-
//
|
|
79
|
+
// Update the changed nodes' versions + notify per-node subscribers
|
|
80
80
|
for (const node of changed) {
|
|
81
81
|
this.nodeVersions.set(node, this.version);
|
|
82
82
|
this.notifyNode(node);
|
|
83
83
|
}
|
|
84
|
-
// Уведомляем глобальных подписчиков
|
|
85
84
|
this.notifyGlobals();
|
|
86
|
-
// Post-notify hook (resolve
|
|
87
|
-
// Re-entrancy guard:
|
|
88
|
-
//
|
|
89
|
-
//
|
|
85
|
+
// Post-notify hook (resolve re-triggers etc.)
|
|
86
|
+
// Re-entrancy guard: when notifyChanged is called recursively (e.g. from
|
|
87
|
+
// executeListResolve during the postNotifyHook), the paths accumulate and
|
|
88
|
+
// are processed sequentially after the outer call completes.
|
|
90
89
|
if (this.postNotifyHook) {
|
|
91
90
|
const changedPaths = new Set();
|
|
92
91
|
for (const n of changed) {
|
|
@@ -96,7 +95,7 @@ export class NotificationHub {
|
|
|
96
95
|
}
|
|
97
96
|
if (changedPaths.size > 0) {
|
|
98
97
|
if (this.isDispatchingHook) {
|
|
99
|
-
//
|
|
98
|
+
// Recursive call: defer the paths
|
|
100
99
|
if (!this.pendingHookPaths)
|
|
101
100
|
this.pendingHookPaths = new Set();
|
|
102
101
|
for (const p of changedPaths)
|
|
@@ -106,7 +105,7 @@ export class NotificationHub {
|
|
|
106
105
|
this.isDispatchingHook = true;
|
|
107
106
|
try {
|
|
108
107
|
this.postNotifyHook(changedPaths);
|
|
109
|
-
//
|
|
108
|
+
// Drain the paths accumulated during the hook invocation
|
|
110
109
|
while (this.pendingHookPaths !== null && this.pendingHookPaths.size > 0) {
|
|
111
110
|
const pending = this.pendingHookPaths;
|
|
112
111
|
this.pendingHookPaths = null;
|
|
@@ -122,8 +121,8 @@ export class NotificationHub {
|
|
|
122
121
|
}
|
|
123
122
|
}
|
|
124
123
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
124
|
+
* Bump the version of all leaf nodes + notify global subscribers.
|
|
125
|
+
* Used on translator change — all components re-render.
|
|
127
126
|
*/
|
|
128
127
|
bumpLeafVersions() {
|
|
129
128
|
this.version++;
|
|
@@ -133,9 +132,9 @@ export class NotificationHub {
|
|
|
133
132
|
this.notifyGlobals();
|
|
134
133
|
}
|
|
135
134
|
/**
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
135
|
+
* Register a hook invoked after every notifyChanged.
|
|
136
|
+
* Receives the set of dot-paths of the changed nodes.
|
|
137
|
+
* Used by the resolve system for dependency-driven re-triggers.
|
|
139
138
|
*/
|
|
140
139
|
setPostNotifyHook(hook) {
|
|
141
140
|
this.postNotifyHook = hook;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNotificationHub.js","sourceRoot":"","sources":["../../../store/init/createNotificationHub.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAqBjF,gFAAgF;AAEhF;;;;;;;GAOG;AACH,MAAM,OAAO,eAAe;IA2B1B,YAAY,IAAyB;QAvBrC,
|
|
1
|
+
{"version":3,"file":"createNotificationHub.js","sourceRoot":"","sources":["../../../store/init/createNotificationHub.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAqBjF,gFAAgF;AAEhF;;;;;;;GAOG;AACH,MAAM,OAAO,eAAe;IA2B1B,YAAY,IAAyB;QAvBrC,oCAAoC;QACnB,kBAAa,GAAG,IAAI,OAAO,EAAkC,CAAC;QAE/E,mDAAmD;QAClC,oBAAe,GAAG,IAAI,GAAG,EAAc,CAAC;QAEzD,oDAAoD;QAC5C,YAAO,GAAG,CAAC,CAAC;QAEpB,sDAAsD;QACrC,iBAAY,GAAG,IAAI,OAAO,EAAyB,CAAC;QAErE,wEAAwE;QAChE,mBAAc,GAAiD,IAAI,CAAC;QAE5E;;;;WAIG;QACK,sBAAiB,GAAG,KAAK,CAAC;QAC1B,qBAAgB,GAAuB,IAAI,CAAC;QAgFpD,+CAA+C;QAC/C,cAAS,GAAG,CAAC,IAAmB,EAAE,QAAoB,EAAgB,EAAE;YACtE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC;gBAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;YAC3E,IA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