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,28 +1,30 @@
|
|
|
1
1
|
import type { FieldMapping } from "./store/types";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Converts a config authored in EXTERNAL (mapped) names to internal names —
|
|
4
|
+
* once, at the `Palistor` constructor boundary, BEFORE the tree reaches
|
|
5
5
|
* init/compute/traversal.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* (computeFieldState, registerNodes,
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
7
|
+
* Why: `fieldMapping` defines the single public vocabulary of field names.
|
|
8
|
+
* The author writes the config in that vocabulary (`required`, `helpText`, …)
|
|
9
|
+
* while the whole internal core (computeFieldState, registerNodes, walks over
|
|
10
|
+
* `CONFIG_PROPS` / `"value" in node`) operates on internal names
|
|
11
|
+
* (`isRequired`, `description`, …). Normalizing the tree at a single point
|
|
12
|
+
* leaves the ~dozen call sites below the stack untouched — they keep working
|
|
13
|
+
* with internal names unchanged.
|
|
13
14
|
*
|
|
14
|
-
*
|
|
15
|
-
* mappable
|
|
16
|
-
* (`email`, `passport`, …)
|
|
15
|
+
* Only keys from {@link MAPPABLE_CONFIG_KEYS} are translated (the
|
|
16
|
+
* intersection of mappable keys and config input keys). Child field identity
|
|
17
|
+
* (`email`, `passport`, …) is never remapped.
|
|
17
18
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
19
|
+
* Map invariant: an external name must not collide with a sibling child-field
|
|
20
|
+
* name.
|
|
20
21
|
*
|
|
21
|
-
* @param config
|
|
22
|
-
* @param externalToInternal
|
|
23
|
-
* @param fieldMapping
|
|
24
|
-
* @returns
|
|
25
|
-
*
|
|
22
|
+
* @param config root config (as authored)
|
|
23
|
+
* @param externalToInternal reverse map, external→internal (sparse)
|
|
24
|
+
* @param fieldMapping forward map, internal→external (for strict checks)
|
|
25
|
+
* @returns a new normalized tree (the original is not mutated). When the map
|
|
26
|
+
* is empty the original `config` is returned without copies (zero
|
|
27
|
+
* overhead).
|
|
26
28
|
*/
|
|
27
29
|
export declare function normalizeConfig<T>(config: T, externalToInternal: Record<string, string>, fieldMapping: FieldMapping): T;
|
|
28
30
|
//# sourceMappingURL=normalizeConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeConfig.d.ts","sourceRoot":"","sources":["../../store/normalizeConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAIlD
|
|
1
|
+
{"version":3,"file":"normalizeConfig.d.ts","sourceRoot":"","sources":["../../store/normalizeConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAIlD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAC/B,MAAM,EAAE,CAAC,EACT,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1C,YAAY,EAAE,YAAY,GACzB,CAAC,CAGH"}
|
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
import { CONFIG_PROPS, MAPPABLE_CONFIG_KEYS, MAPPABLE_KEYS } from "./constants";
|
|
2
2
|
const MAPPABLE_KEYS_SET = new Set(MAPPABLE_KEYS);
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Converts a config authored in EXTERNAL (mapped) names to internal names —
|
|
5
|
+
* once, at the `Palistor` constructor boundary, BEFORE the tree reaches
|
|
6
6
|
* init/compute/traversal.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* (computeFieldState, registerNodes,
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
8
|
+
* Why: `fieldMapping` defines the single public vocabulary of field names.
|
|
9
|
+
* The author writes the config in that vocabulary (`required`, `helpText`, …)
|
|
10
|
+
* while the whole internal core (computeFieldState, registerNodes, walks over
|
|
11
|
+
* `CONFIG_PROPS` / `"value" in node`) operates on internal names
|
|
12
|
+
* (`isRequired`, `description`, …). Normalizing the tree at a single point
|
|
13
|
+
* leaves the ~dozen call sites below the stack untouched — they keep working
|
|
14
|
+
* with internal names unchanged.
|
|
14
15
|
*
|
|
15
|
-
*
|
|
16
|
-
* mappable
|
|
17
|
-
* (`email`, `passport`, …)
|
|
16
|
+
* Only keys from {@link MAPPABLE_CONFIG_KEYS} are translated (the
|
|
17
|
+
* intersection of mappable keys and config input keys). Child field identity
|
|
18
|
+
* (`email`, `passport`, …) is never remapped.
|
|
18
19
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
20
|
+
* Map invariant: an external name must not collide with a sibling child-field
|
|
21
|
+
* name.
|
|
21
22
|
*
|
|
22
|
-
* @param config
|
|
23
|
-
* @param externalToInternal
|
|
24
|
-
* @param fieldMapping
|
|
25
|
-
* @returns
|
|
26
|
-
*
|
|
23
|
+
* @param config root config (as authored)
|
|
24
|
+
* @param externalToInternal reverse map, external→internal (sparse)
|
|
25
|
+
* @param fieldMapping forward map, internal→external (for strict checks)
|
|
26
|
+
* @returns a new normalized tree (the original is not mutated). When the map
|
|
27
|
+
* is empty the original `config` is returned without copies (zero
|
|
28
|
+
* overhead).
|
|
27
29
|
*/
|
|
28
30
|
export function normalizeConfig(config, externalToInternal, fieldMapping) {
|
|
29
31
|
if (Object.keys(externalToInternal).length === 0)
|
|
@@ -31,7 +33,7 @@ export function normalizeConfig(config, externalToInternal, fieldMapping) {
|
|
|
31
33
|
return normalizeNode(config, externalToInternal, fieldMapping);
|
|
32
34
|
}
|
|
33
35
|
function normalizeNode(node, e2i, fwd) {
|
|
34
|
-
// ListNode —
|
|
36
|
+
// ListNode — array [template, listConfig?]: normalize each element.
|
|
35
37
|
if (Array.isArray(node)) {
|
|
36
38
|
return node.map((el) => normalizeNode(el, e2i, fwd));
|
|
37
39
|
}
|
|
@@ -41,33 +43,33 @@ function normalizeNode(node, e2i, fwd) {
|
|
|
41
43
|
const out = {};
|
|
42
44
|
for (const key of Object.keys(src)) {
|
|
43
45
|
const value = src[key];
|
|
44
|
-
// (1) strict:
|
|
45
|
-
//
|
|
46
|
+
// (1) strict: the author wrote the INTERNAL name of a config key that is
|
|
47
|
+
// actively remapped (e.g. `isRequired` when isRequired→required).
|
|
46
48
|
if (MAPPABLE_CONFIG_KEYS.has(key) && key in fwd) {
|
|
47
49
|
throw new Error(`[palistor] fieldMapping is active: write "${String(fwd[key])}" instead of internal "${key}" in config.`);
|
|
48
50
|
}
|
|
49
51
|
const internal = e2i[key];
|
|
50
|
-
// (2) key
|
|
52
|
+
// (2) key is an external name from the map.
|
|
51
53
|
if (internal !== undefined) {
|
|
52
54
|
if (MAPPABLE_CONFIG_KEYS.has(internal)) {
|
|
53
|
-
//
|
|
55
|
+
// remap to an INPUT config key → rename, do not recurse inside.
|
|
54
56
|
out[internal] = value;
|
|
55
57
|
continue;
|
|
56
58
|
}
|
|
57
59
|
if (MAPPABLE_KEYS_SET.has(internal)) {
|
|
58
|
-
//
|
|
59
|
-
// loading/onValueChange) —
|
|
60
|
+
// remap to a COMPUTED/output key (isInvalid/errorMessage/dirty/
|
|
61
|
+
// loading/onValueChange) — it must not be written in a config.
|
|
60
62
|
throw new Error(`[palistor] "${internal}" (mapped as "${key}") is computed and cannot be set in config — remove it.`);
|
|
61
63
|
}
|
|
62
|
-
// internal
|
|
64
|
+
// internal is not mappable — odd map; treat key normally (below).
|
|
63
65
|
}
|
|
64
|
-
// (3) key
|
|
66
|
+
// (3) key is not an external map name: a service config key or a child field.
|
|
65
67
|
if (CONFIG_PROPS.has(key)) {
|
|
66
|
-
//
|
|
68
|
+
// service key (validate, componentProps, resolve, value, label, …) — as-is.
|
|
67
69
|
out[key] = value;
|
|
68
70
|
}
|
|
69
71
|
else {
|
|
70
|
-
//
|
|
72
|
+
// child field (identity is never remapped) → recurse.
|
|
71
73
|
out[key] = normalizeNode(value, e2i, fwd);
|
|
72
74
|
}
|
|
73
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeConfig.js","sourceRoot":"","sources":["../../store/normalizeConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGhF,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAS,aAAa,CAAC,CAAC;AAEzD
|
|
1
|
+
{"version":3,"file":"normalizeConfig.js","sourceRoot":"","sources":["../../store/normalizeConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGhF,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAS,aAAa,CAAC,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,eAAe,CAC7B,MAAS,EACT,kBAA0C,EAC1C,YAA0B;IAE1B,IAAI,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC;IAChE,OAAO,aAAa,CAAC,MAAM,EAAE,kBAAkB,EAAE,YAAY,CAAM,CAAC;AACtE,CAAC;AAED,SAAS,aAAa,CACpB,IAAa,EACb,GAA2B,EAC3B,GAAiB;IAEjB,oEAAoE;IACpE,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,E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AE,CAAC;YAC1B,4EAA4E;YAC5E,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACnB,CAAC;aAAM,CAAC;YACN,sDAAsD;YACtD,GAAG,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Computes the changed field's path relative to the handler node.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Examples:
|
|
5
5
|
* nodePath="form.address.city", handlerPath="form" → "address.city"
|
|
6
6
|
* nodePath="name", handlerPath="" → "name"
|
|
7
7
|
* nodePath="form.country", handlerPath="form.country" → "country" (self)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Computes the changed field's path relative to the handler node.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Examples:
|
|
5
5
|
* nodePath="form.address.city", handlerPath="form" → "address.city"
|
|
6
6
|
* nodePath="name", handlerPath="" → "name"
|
|
7
7
|
* nodePath="form.country", handlerPath="form.country" → "country" (self)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type AnyConfigNode } from "../store/types";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Collects all nodes with `onChange` from the node itself up to the root.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* Order: the node itself first (if it has onChange), then the nearest ancestor, etc.
|
|
6
6
|
*/
|
|
7
7
|
export declare function findOnChangeNodes(node: object, nodeParents: WeakMap<object, object>): AnyConfigNode[];
|
|
8
8
|
//# sourceMappingURL=findOnChangeAncestors.d.ts.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Collects all nodes with `onChange` from the node itself up to the root.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Order: the node itself first (if it has onChange), then the nearest ancestor, etc.
|
|
5
5
|
*/
|
|
6
6
|
export function findOnChangeNodes(node, nodeParents) {
|
|
7
7
|
const result = [];
|
|
8
|
-
//
|
|
8
|
+
// The node itself
|
|
9
9
|
if (typeof node.onChange === "function") {
|
|
10
10
|
result.push(node);
|
|
11
11
|
}
|
|
12
|
-
//
|
|
12
|
+
// Ancestors
|
|
13
13
|
let current = nodeParents.get(node);
|
|
14
14
|
while (current) {
|
|
15
15
|
if (typeof current.onChange === "function") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findOnChangeAncestors.js","sourceRoot":"","sources":["../../../store/onChangePipeline/findOnChangeAncestors.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,IAAY,EACZ,WAAoC;IAEpC,MAAM,MAAM,GAAoB,EAAE,CAAC;IAEnC,
|
|
1
|
+
{"version":3,"file":"findOnChangeAncestors.js","sourceRoot":"","sources":["../../../store/onChangePipeline/findOnChangeAncestors.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,IAAY,EACZ,WAAoC;IAEpC,MAAM,MAAM,GAAoB,EAAE,CAAC;IAEnC,kBAAkB;IAClB,IAAI,OAAQ,IAAsB,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;QAC3D,MAAM,CAAC,IAAI,CAAC,IAAqB,CAAC,CAAC;IACrC,CAAC;IAED,YAAY;IACZ,IAAI,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpC,OAAO,OAAO,EAAE,CAAC;QACf,IAAI,OAAQ,OAAyB,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;YAC9D,MAAM,CAAC,IAAI,CAAC,OAAwB,CAAC,CAAC;QACxC,CAAC;QACD,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
import { type AnyConfigNode } from "../store/types";
|
|
2
2
|
import type { Palistor } from "../store/palistor";
|
|
3
3
|
export interface OnChangeOptions {
|
|
4
|
-
/** templateField —
|
|
4
|
+
/** templateField — in entity mode: onChange is looked up in the template tree, the patch is applied to entity siblings. */
|
|
5
5
|
via?: AnyConfigNode;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
* OnChangePipeline — fire-and-forget
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* OnChangePipeline — fire-and-forget invocation of onChange handlers when a
|
|
9
|
+
* field changes: first on the node itself (if it has onChange), then on all
|
|
10
|
+
* ancestor groups with onChange.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
* -
|
|
14
|
-
* - onChange
|
|
15
|
-
* -
|
|
12
|
+
* For every node with `onChange`:
|
|
13
|
+
* - `fieldKey` is computed — the field name (for the node itself) or the path relative to the ancestor
|
|
14
|
+
* - onChange runs asynchronously, without blocking the write pipeline
|
|
15
|
+
* - a returned patch object is applied to the store
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
* allValues
|
|
17
|
+
* With opts.via — entity mode: the onChange walk goes through the template
|
|
18
|
+
* hierarchy (not the entity); allValues are the entity values from
|
|
19
|
+
* view.parent.getValues().
|
|
19
20
|
*/
|
|
20
21
|
export declare class OnChangePipeline {
|
|
21
22
|
private readonly kernel;
|
|
22
23
|
constructor(kernel: Palistor<any, any>);
|
|
23
24
|
fire(node: AnyConfigNode, newValue: unknown, previousValue: unknown, opts?: OnChangeOptions): void;
|
|
24
|
-
/**
|
|
25
|
+
/** Apply an onChange patch to entity siblings (entity mode). */
|
|
25
26
|
private _applyEntityOnChangeResult;
|
|
26
|
-
/**
|
|
27
|
+
/** Apply an onChange patch to config nodes (config mode). */
|
|
27
28
|
private _applyOnChangeResult;
|
|
28
29
|
}
|
|
29
30
|
//# sourceMappingURL=onChangePipeline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onChangePipeline.d.ts","sourceRoot":"","sources":["../../../store/onChangePipeline/onChangePipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AASlD,MAAM,WAAW,eAAe;IAC9B
|
|
1
|
+
{"version":3,"file":"onChangePipeline.d.ts","sourceRoot":"","sources":["../../../store/onChangePipeline/onChangePipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AASlD,MAAM,WAAW,eAAe;IAC9B,2HAA2H;IAC3H,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAEvD,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,IAAI;IA0ClG,gEAAgE;IAChE,OAAO,CAAC,0BAA0B;IAsClC,6DAA6D;IAC7D,OAAO,CAAC,oBAAoB;CAsB7B"}
|
|
@@ -5,17 +5,18 @@ import { computeFieldKey } from "./computeFieldKey";
|
|
|
5
5
|
import { isLeafNode } from "../traversal";
|
|
6
6
|
import { storeValue } from "../writePipeline/storeValue";
|
|
7
7
|
/**
|
|
8
|
-
* OnChangePipeline — fire-and-forget
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* OnChangePipeline — fire-and-forget invocation of onChange handlers when a
|
|
9
|
+
* field changes: first on the node itself (if it has onChange), then on all
|
|
10
|
+
* ancestor groups with onChange.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
* -
|
|
14
|
-
* - onChange
|
|
15
|
-
* -
|
|
12
|
+
* For every node with `onChange`:
|
|
13
|
+
* - `fieldKey` is computed — the field name (for the node itself) or the path relative to the ancestor
|
|
14
|
+
* - onChange runs asynchronously, without blocking the write pipeline
|
|
15
|
+
* - a returned patch object is applied to the store
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
* allValues
|
|
17
|
+
* With opts.via — entity mode: the onChange walk goes through the template
|
|
18
|
+
* hierarchy (not the entity); allValues are the entity values from
|
|
19
|
+
* view.parent.getValues().
|
|
19
20
|
*/
|
|
20
21
|
export class OnChangePipeline {
|
|
21
22
|
constructor(kernel) {
|
|
@@ -24,7 +25,7 @@ export class OnChangePipeline {
|
|
|
24
25
|
fire(node, newValue, previousValue, opts) {
|
|
25
26
|
const { nodePaths, nodeParents } = this.kernel.nodes;
|
|
26
27
|
if (opts?.via !== undefined) {
|
|
27
|
-
// ── Entity mode: onChange
|
|
28
|
+
// ── Entity mode: onChange walk over the template tree ──
|
|
28
29
|
const view = this.kernel.nodes.getView(node, opts.via);
|
|
29
30
|
const onChangeNodes = findOnChangeNodes(view.rules, nodeParents);
|
|
30
31
|
if (onChangeNodes.length === 0)
|
|
@@ -41,7 +42,7 @@ export class OnChangePipeline {
|
|
|
41
42
|
}
|
|
42
43
|
return;
|
|
43
44
|
}
|
|
44
|
-
// ── Config mode
|
|
45
|
+
// ── Config mode ──
|
|
45
46
|
const valuesCache = this.kernel.values;
|
|
46
47
|
const onChangeNodes = findOnChangeNodes(node, nodeParents);
|
|
47
48
|
if (onChangeNodes.length === 0)
|
|
@@ -57,7 +58,7 @@ export class OnChangePipeline {
|
|
|
57
58
|
.catch(() => { });
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
|
-
/**
|
|
61
|
+
/** Apply an onChange patch to entity siblings (entity mode). */
|
|
61
62
|
_applyEntityOnChangeResult(patch, view) {
|
|
62
63
|
if (!patch || typeof patch !== "object" || Object.keys(patch).length === 0)
|
|
63
64
|
return;
|
|
@@ -83,7 +84,7 @@ export class OnChangePipeline {
|
|
|
83
84
|
recomputeAndNotify(patchedNodes, () => this.kernel.recompute(patchedNodes), (c) => this.kernel.notifyChanged(c));
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
|
-
/**
|
|
87
|
+
/** Apply an onChange patch to config nodes (config mode). */
|
|
87
88
|
_applyOnChangeResult(patch, sourceNode) {
|
|
88
89
|
if (!patch || typeof patch !== "object" || Object.keys(patch).length === 0)
|
|
89
90
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onChangePipeline.js","sourceRoot":"","sources":["../../../store/onChangePipeline/onChangePipeline.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAOzD
|
|
1
|
+
{"version":3,"file":"onChangePipeline.js","sourceRoot":"","sources":["../../../store/onChangePipeline/onChangePipeline.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,U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CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAE7F,MAAM,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;YACvC,CAAC,CAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAmB;YAC9F,CAAC,CAAC,UAAU,CAAC;QAEf,MAAM,YAAY,GAAG,UAAU,CAC7B,UAAU,EACV,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,EAC3B,KAAgC,EAChC,IAAI,GAAG,EAAE,EACT,IAAI,CAAC,MAAM,CAAC,MAAM,CACnB,CAAC;QACF,IAAI,YAAY,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YAC1B,kBAAkB,CAChB,YAAY,EACZ,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,EAC7B,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CACpC,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Built-in storage drivers for persist.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Each driver implements the PersistDriver interface.
|
|
5
|
+
* All drivers check API availability (SSR-safe).
|
|
6
6
|
*/
|
|
7
7
|
import type { PersistDriver } from "./types";
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Driver backed by `window.localStorage`.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* SSR-safe: no-op when `localStorage` is unavailable.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```ts
|
|
@@ -19,9 +19,9 @@ import type { PersistDriver } from "./types";
|
|
|
19
19
|
*/
|
|
20
20
|
export declare const localStorageDriver: PersistDriver;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Driver backed by `window.sessionStorage`.
|
|
23
23
|
*
|
|
24
|
-
*
|
|
24
|
+
* Data survives until the tab/window is closed.
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
27
27
|
* ```ts
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Built-in storage drivers for persist.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Each driver implements the PersistDriver interface.
|
|
5
|
+
* All drivers check API availability (SSR-safe).
|
|
6
6
|
*/
|
|
7
7
|
// ─── localStorage ────────────────────────────────────────────────────────────
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Driver backed by `window.localStorage`.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* SSR-safe: no-op when `localStorage` is unavailable.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```ts
|
|
@@ -32,7 +32,7 @@ export const localStorageDriver = {
|
|
|
32
32
|
localStorage.setItem(key, value);
|
|
33
33
|
}
|
|
34
34
|
catch {
|
|
35
|
-
// Quota exceeded
|
|
35
|
+
// Quota exceeded or private mode — stay silent
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
removeItem(key) {
|
|
@@ -47,9 +47,9 @@ export const localStorageDriver = {
|
|
|
47
47
|
};
|
|
48
48
|
// ─── sessionStorage ──────────────────────────────────────────────────────────
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* Driver backed by `window.sessionStorage`.
|
|
51
51
|
*
|
|
52
|
-
*
|
|
52
|
+
* Data survives until the tab/window is closed.
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
55
|
* ```ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drivers.js","sourceRoot":"","sources":["../../../store/persist/drivers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,gFAAgF;AAEhF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;QACxE,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;QACT,CAAC;IACH,CAAC;CACF,CAAC;AAEF,gFAAgF;AAEhF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAkB;IACjD,OAAO,CAAC,GAAW;QACjB,IAAI,CAAC;YACH,OAAO,OAAO,cAAc,KAAK,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACpF,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAW,EAAE,KAAa;QAChC,IAAI,CAAC;YACH,IAAI,OAAO,cAAc,KAAK,WAAW;gBAAE,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAChF,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;QACT,CAAC;IACH,CAAC;IAED,UAAU,CAAC,GAAW;QACpB,IAAI,CAAC;YACH,IAAI,OAAO,cAAc,KAAK,WAAW;gBAAE,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAC5E,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;QACT,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* PersistManager —
|
|
2
|
+
* PersistManager — manages hydration and auto-saving of form state.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Instantiated inside Palistor.
|
|
5
|
+
* React-independent — can be wired up from any environment.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* 1.
|
|
9
|
-
* 2.
|
|
10
|
-
* 3.
|
|
7
|
+
* Lifecycle:
|
|
8
|
+
* 1. Created by new Palistor(...) (inactive).
|
|
9
|
+
* 2. Activated via enable(options) — hydration + auto-save.
|
|
10
|
+
* 3. Deactivated via disable() — unsubscribes from the store, cancels timers.
|
|
11
11
|
*/
|
|
12
12
|
import type { PersistOptions } from "./types";
|
|
13
13
|
import type { Palistor } from "../store/palistor";
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* The form's persistence manager.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
17
|
+
* Accesses all form data through the `kernel` (Palistor instance).
|
|
18
18
|
*/
|
|
19
19
|
export declare class PersistManager {
|
|
20
20
|
private readonly kernel;
|
|
@@ -26,42 +26,42 @@ export declare class PersistManager {
|
|
|
26
26
|
private debounceMs;
|
|
27
27
|
private pickFields;
|
|
28
28
|
private omitFields;
|
|
29
|
-
/**
|
|
29
|
+
/** Unsubscribe from subscribeGlobal. */
|
|
30
30
|
private unsubscribe;
|
|
31
|
-
/**
|
|
31
|
+
/** Debounce timer ID. */
|
|
32
32
|
private debounceTimer;
|
|
33
|
-
/**
|
|
33
|
+
/** Flag preventing saves during hydration. */
|
|
34
34
|
private isHydrating;
|
|
35
35
|
constructor(kernel: Palistor<any, any>);
|
|
36
36
|
private cancelDebounce;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* Save the current values to storage (no debounce).
|
|
39
39
|
*/
|
|
40
40
|
private saveToStorage;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Schedule a debounced save.
|
|
43
43
|
*/
|
|
44
44
|
private scheduleSave;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
46
|
+
* Read from storage and apply the values to nodeState.
|
|
47
47
|
*/
|
|
48
48
|
private hydrateFromStorage;
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* Activate persistence: hydrate from storage + auto-save on changes.
|
|
51
51
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
52
|
+
* When persist is already active, the previous one is disabled first.
|
|
53
|
+
* Returns a Promise that resolves after successful hydration.
|
|
54
54
|
*/
|
|
55
55
|
enable(options: PersistOptions): Promise<void>;
|
|
56
|
-
/**
|
|
56
|
+
/** Deactivate: unsubscribe from the store, cancel timers, clear state. */
|
|
57
57
|
disable(): void;
|
|
58
|
-
/**
|
|
58
|
+
/** Force-save the current values to storage (no debounce). */
|
|
59
59
|
flush(): Promise<void>;
|
|
60
|
-
/**
|
|
60
|
+
/** Force-hydrate from storage. */
|
|
61
61
|
hydrate(): Promise<void>;
|
|
62
|
-
/**
|
|
62
|
+
/** Remove the data from storage under the current key. */
|
|
63
63
|
clear(): Promise<void>;
|
|
64
|
-
/**
|
|
64
|
+
/** Whether persistence is currently active. */
|
|
65
65
|
isEnabled(): boolean;
|
|
66
66
|
}
|
|
67
67
|
//# sourceMappingURL=persistManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistManager.d.ts","sourceRoot":"","sources":["../../../store/persist/persistManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,SAAS,CAAC;AAG7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAiDlD;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;IAI5C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,SAAS,CAA0D;IAC3E,OAAO,CAAC,WAAW,CAAwD;IAC3E,OAAO,CAAC,UAAU,CAAO;IACzB,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,UAAU,CAAuB;IAEzC,
|
|
1
|
+
{"version":3,"file":"persistManager.d.ts","sourceRoot":"","sources":["../../../store/persist/persistManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,SAAS,CAAC;AAG7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAiDlD;;;;GAIG;AACH,qB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