@sladg/apex-state 3.11.2 → 3.11.4

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.d.ts CHANGED
@@ -509,7 +509,7 @@ type ConcernRegistrationMap<DATA extends object, CONCERNS extends readonly any[]
509
509
  * 1. `{ path: string, fn }` — scope defaults to path → scoped state
510
510
  * 2. `{ path: string, scope: null, fn }` — explicit null scope → full DATA
511
511
  * 3. `{ path: string, scope: string, fn }` — scope must be prefix of path
512
- * 4. `{ path: null, fn }` — watch everything, scope defaults to null → full DATA
512
+ * 4. `{ path: null, fn }` — always fires on any change, scope defaults to null → full DATA
513
513
  * 5. `{ path: null, scope: null, fn }` — same as above, explicit
514
514
  *
515
515
  * **Inline fn restriction**: Fns with untyped (any) parameters are rejected.
@@ -928,6 +928,17 @@ interface PipelineObserver {
928
928
  concernEval: (path: string, name: string, value: unknown, result: unknown) => void;
929
929
  destroy: () => void;
930
930
  }
931
+ interface DevToolsInstance {
932
+ init: (state: unknown) => void;
933
+ send: (action: {
934
+ type: string;
935
+ }, state: unknown) => void;
936
+ unsubscribe: () => void;
937
+ }
938
+ interface DevToolsRef {
939
+ prefix: string;
940
+ pipeline: DevToolsInstance | null;
941
+ }
931
942
 
932
943
  /**
933
944
  * Debug Timing Utilities
@@ -1221,6 +1232,8 @@ interface DebugTrack {
1221
1232
  clear: () => void;
1222
1233
  }
1223
1234
  interface StoreConfig {
1235
+ /** Human-readable store name for DevTools (default: "store"). Auto-incremented ID is appended. */
1236
+ name?: string;
1224
1237
  /** Error storage path (default: "_errors") */
1225
1238
  errorStorePath?: string;
1226
1239
  /** Max iterations for change processing (default: 100) */
@@ -1281,12 +1294,22 @@ type OnStateListener<DATA extends object = object, SUB_STATE = DATA, META extend
1281
1294
  * // state: p.123.g.abc object
1282
1295
  * }
1283
1296
  * }
1297
+ *
1298
+ * // Watch ALL changes (always fires), get full state
1299
+ * {
1300
+ * path: null,
1301
+ * scope: null,
1302
+ * fn: (changes, state) => {
1303
+ * // changes: [['user.profile.name', 'Alice', {}], ['count', 5, {}]] - FULL paths, all depths
1304
+ * // state: full DATA object
1305
+ * }
1306
+ * }
1284
1307
  * ```
1285
1308
  */
1286
1309
  interface ListenerRegistration<DATA extends object = object, META extends GenericMeta = GenericMeta, Depth extends number = DefaultDepth> {
1287
1310
  /**
1288
1311
  * Path to watch - only changes under this path will trigger the listener
1289
- * null = watch all top-level paths
1312
+ * null = watch all paths (receives every change)
1290
1313
  */
1291
1314
  path: DeepKey<DATA, Depth> | null;
1292
1315
  /**
@@ -1329,6 +1352,8 @@ interface InternalState<DATA extends object = object, META extends GenericMeta =
1329
1352
  timing: Timing;
1330
1353
  observer: PipelineObserver;
1331
1354
  config: DeepRequired<StoreConfig>;
1355
+ /** Redux DevTools state — prefix for naming + shared connection instance. */
1356
+ _devtools: DevToolsRef;
1332
1357
  /** Per-store WASM pipeline instance (null when using legacy implementation). */
1333
1358
  pipeline: WasmPipeline | null;
1334
1359
  /** Pending deferred destroy timer — cancelled on StrictMode re-mount. */
@@ -1622,6 +1647,15 @@ type ClearPathRule<DATA extends object, Depth extends number = DefaultDepth> = [
1622
1647
  * // state: p.123.g.abc object
1623
1648
  * return [['data.computed', computed, {}]] // SCOPED path (relative to scope)
1624
1649
  * }
1650
+ * },
1651
+ * {
1652
+ * path: null, // Always fires — receives ALL changes at any depth
1653
+ * scope: null, // Get full state
1654
+ * fn: (changes, state) => {
1655
+ * // changes: [['user.profile.name', 'Alice', {}]] // FULL paths, all depths
1656
+ * // state: full DATA object
1657
+ * return undefined
1658
+ * }
1625
1659
  * }
1626
1660
  * ]
1627
1661
  * })