@sladg/apex-state 3.7.1 → 3.9.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/deep-clone-DMRvv0Pr.d.ts +2119 -0
- package/dist/index.d.ts +91 -1765
- package/dist/index.js +165 -37
- package/dist/index.js.map +1 -1
- package/dist/testing/index.d.ts +3 -3
- package/dist/testing/index.js +21 -15
- package/dist/testing/index.js.map +1 -1
- package/package.json +2 -1
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DeepKey, DeepValue, GenericMeta, ConcernType, defaultConcerns, StoreConfig, GenericStoreApi } from '../
|
|
2
|
-
export { _, applyChangesToObject, deepClone, dot, evaluateBoolLogic, extractPlaceholders, findConcern, hashKey, interpolateTemplate, is, prebuilts, registerFlipPair, registerListenerLegacy, registerSideEffects, registerSyncPairsBatch, useBufferedField, useKeyboardSelect, useThrottledField, useTransformedField } from '../
|
|
3
|
-
import 'react';
|
|
1
|
+
import { w as DeepKey, z as DeepValue, G as GenericMeta, s as ConcernType, a7 as defaultConcerns, T as StoreConfig, J as GenericStoreApi } from '../deep-clone-DMRvv0Pr.js';
|
|
2
|
+
export { a3 as _, a4 as applyChangesToObject, a6 as deepClone, a8 as dot, a9 as evaluateBoolLogic, aa as extractPlaceholders, ab as findConcern, ac as hashKey, ad as interpolateTemplate, ae as is, af as prebuilts, ag as registerFlipPair, ah as registerListenerLegacy, ai as registerSideEffects, aj as registerSyncPairsBatch, ak as useBufferedField, al as useKeyboardSelect, am as useThrottledField, an as useTransformedField } from '../deep-clone-DMRvv0Pr.js';
|
|
4
3
|
import 'react/jsx-runtime';
|
|
4
|
+
import 'react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @sladg/apex-state/testing
|
package/dist/testing/index.js
CHANGED
|
@@ -1482,7 +1482,7 @@ var filterAndRelativize = (changes, listenerPath) => {
|
|
|
1482
1482
|
return result;
|
|
1483
1483
|
};
|
|
1484
1484
|
var processListeners = (changes, store, currentState) => {
|
|
1485
|
-
const { listeners, sortedListenerPaths } = store._internal.graphs;
|
|
1485
|
+
const { listeners: listeners2, sortedListenerPaths } = store._internal.graphs;
|
|
1486
1486
|
const { queue } = store._internal.processing;
|
|
1487
1487
|
const effectiveChanges = [];
|
|
1488
1488
|
for (const change of changes) {
|
|
@@ -1497,7 +1497,7 @@ var processListeners = (changes, store, currentState) => {
|
|
|
1497
1497
|
(a, b) => getPathDepth(b[0]) - getPathDepth(a[0])
|
|
1498
1498
|
);
|
|
1499
1499
|
for (const listenerPath of sortedListenerPaths) {
|
|
1500
|
-
const pathListeners =
|
|
1500
|
+
const pathListeners = listeners2.get(listenerPath);
|
|
1501
1501
|
const relevantChanges = filterAndRelativize(sortedChanges, listenerPath);
|
|
1502
1502
|
for (const registration of pathListeners) {
|
|
1503
1503
|
processListener({
|
|
@@ -1586,12 +1586,12 @@ var CONCERNS_PREFIX_LEN = CONCERNS_PREFIX.length;
|
|
|
1586
1586
|
|
|
1587
1587
|
// src/sideEffects/prebuilts/aggregation.ts
|
|
1588
1588
|
import { effect as effect3 } from "valtio-reactive";
|
|
1589
|
-
var registerAggregations = (store, id,
|
|
1589
|
+
var registerAggregations = (store, id, aggregationPairs2) => {
|
|
1590
1590
|
const { aggregations } = store._internal.registrations;
|
|
1591
1591
|
const disposeCallbacks = [];
|
|
1592
1592
|
const targets = /* @__PURE__ */ new Set();
|
|
1593
1593
|
const sources = /* @__PURE__ */ new Set();
|
|
1594
|
-
for (const [target, source] of
|
|
1594
|
+
for (const [target, source] of aggregationPairs2) {
|
|
1595
1595
|
targets.add(target);
|
|
1596
1596
|
sources.add(source);
|
|
1597
1597
|
}
|
|
@@ -1603,7 +1603,7 @@ var registerAggregations = (store, id, aggregationPairs) => {
|
|
|
1603
1603
|
}
|
|
1604
1604
|
}
|
|
1605
1605
|
const byTarget = /* @__PURE__ */ new Map();
|
|
1606
|
-
for (const [target, source] of
|
|
1606
|
+
for (const [target, source] of aggregationPairs2) {
|
|
1607
1607
|
const existing = byTarget.get(target) ?? [];
|
|
1608
1608
|
existing.push(source);
|
|
1609
1609
|
byTarget.set(target, existing);
|
|
@@ -1680,30 +1680,33 @@ var validateScopeAndPath = (path, scope) => {
|
|
|
1680
1680
|
};
|
|
1681
1681
|
var registerListenerLegacy = (store, registration) => {
|
|
1682
1682
|
const { graphs } = store._internal;
|
|
1683
|
-
const { listeners, listenerHandlers } = graphs;
|
|
1684
|
-
|
|
1683
|
+
const { listeners: listeners2, listenerHandlers } = graphs;
|
|
1684
|
+
if (registration.scope === void 0) {
|
|
1685
|
+
registration.scope = registration.path;
|
|
1686
|
+
}
|
|
1687
|
+
validateScopeAndPath(registration.path, registration.scope ?? null);
|
|
1685
1688
|
const subscriberId = nextSubscriberId++;
|
|
1686
1689
|
const mapKey = registration.path ?? "";
|
|
1687
|
-
const existing =
|
|
1690
|
+
const existing = listeners2.get(mapKey) ?? [];
|
|
1688
1691
|
const originalFn = registration.fn;
|
|
1689
1692
|
registration.fn = (changes, state) => store._internal.timing.run("listeners", () => originalFn(changes, state), {
|
|
1690
1693
|
path: mapKey,
|
|
1691
1694
|
name: "listener"
|
|
1692
1695
|
});
|
|
1693
|
-
|
|
1696
|
+
listeners2.set(mapKey, [...existing, registration]);
|
|
1694
1697
|
listenerHandlers.set(subscriberId, {
|
|
1695
1698
|
scope: registration.scope,
|
|
1696
1699
|
fn: registration.fn
|
|
1697
1700
|
});
|
|
1698
1701
|
updateSortedListenerPaths(graphs);
|
|
1699
1702
|
return () => {
|
|
1700
|
-
const list =
|
|
1703
|
+
const list = listeners2.get(mapKey);
|
|
1701
1704
|
if (list) {
|
|
1702
1705
|
const filtered = list.filter((l) => l !== registration);
|
|
1703
1706
|
if (filtered.length > 0) {
|
|
1704
|
-
|
|
1707
|
+
listeners2.set(mapKey, filtered);
|
|
1705
1708
|
} else {
|
|
1706
|
-
|
|
1709
|
+
listeners2.delete(mapKey);
|
|
1707
1710
|
}
|
|
1708
1711
|
updateSortedListenerPaths(graphs);
|
|
1709
1712
|
}
|
|
@@ -1782,17 +1785,20 @@ var registerSyncPairsBatch = (store, pairs) => {
|
|
|
1782
1785
|
var registerSideEffectsImpl = (store, id, effects) => {
|
|
1783
1786
|
const cleanups = [];
|
|
1784
1787
|
if (effects.syncPaths) {
|
|
1785
|
-
const
|
|
1788
|
+
const pairs = effects.syncPaths;
|
|
1789
|
+
const cleanup = registerSyncPairsBatch(store, pairs);
|
|
1786
1790
|
cleanups.push(cleanup);
|
|
1787
1791
|
}
|
|
1788
1792
|
if (effects.flipPaths) {
|
|
1789
|
-
|
|
1793
|
+
const pairs = effects.flipPaths;
|
|
1794
|
+
for (const [path1, path2] of pairs) {
|
|
1790
1795
|
const cleanup = registerFlipPair(store, path1, path2);
|
|
1791
1796
|
cleanups.push(cleanup);
|
|
1792
1797
|
}
|
|
1793
1798
|
}
|
|
1794
1799
|
if (effects.aggregations) {
|
|
1795
|
-
const
|
|
1800
|
+
const pairs = effects.aggregations;
|
|
1801
|
+
const cleanup = registerAggregations(store, id, pairs);
|
|
1796
1802
|
cleanups.push(cleanup);
|
|
1797
1803
|
}
|
|
1798
1804
|
if (effects.listeners) {
|