@genesislcap/foundation-redux 14.419.2 → 14.421.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.
@@ -1,5 +1,17 @@
1
1
  import { StoreReturn, RootStateFromSlices, SliceArray } from './types';
2
2
  export { createSlice } from '@reduxjs/toolkit';
3
+ /**
4
+ * Options for {@link createStore}.
5
+ *
6
+ * @public
7
+ */
8
+ export interface CreateStoreOptions {
9
+ /**
10
+ * Whether to enable Redux DevTools integration.
11
+ * Defaults to the result of `isDev()` when omitted.
12
+ */
13
+ devTools?: boolean;
14
+ }
3
15
  /**
4
16
  * Creates a Redux store with FAST component integration.
5
17
  *
@@ -10,6 +22,7 @@ export { createSlice } from '@reduxjs/toolkit';
10
22
  *
11
23
  * @param slices - Array of slices to combine into the store
12
24
  * @param preloadedState - Initial state that matches the slice structure
25
+ * @param options - Optional configuration (e.g. `{ devTools: false }`)
13
26
  * @returns Object containing store, actions, selectors, and utility functions
14
27
  *
15
28
  * @example
@@ -25,5 +38,5 @@ export { createSlice } from '@reduxjs/toolkit';
25
38
  *
26
39
  * @public
27
40
  */
28
- export declare const createStore: <S extends SliceArray>(slices: S, preloadedState: RootStateFromSlices<S>) => StoreReturn<S>;
41
+ export declare const createStore: <S extends SliceArray>(slices: S, preloadedState: RootStateFromSlices<S>, options?: CreateStoreOptions) => StoreReturn<S>;
29
42
  //# sourceMappingURL=store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,WAAW,EACX,mBAAmB,EAEnB,UAAU,EAEX,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAyL/C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,UAAU,EAC9C,QAAQ,CAAC,EACT,gBAAgB,mBAAmB,CAAC,CAAC,CAAC,KACrC,WAAW,CAAC,CAAC,CAqBf,CAAC"}
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,WAAW,EACX,mBAAmB,EAEnB,UAAU,EAEX,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA4LD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,UAAU,EAC9C,QAAQ,CAAC,EACT,gBAAgB,mBAAmB,CAAC,CAAC,CAAC,EACtC,UAAU,kBAAkB,KAC3B,WAAW,CAAC,CAAC,CAqBf,CAAC"}
@@ -170,14 +170,14 @@ export type StoreReturn<S extends SliceArray> = {
170
170
  selectors: SelectorsFromSlices<S>;
171
171
  /** The root reducer combining all slices */
172
172
  rootReducer: ReducersMapObject<RootStateFromSlices<S>>;
173
- /** Performance-optimized subscription function for specific values */
174
- subscribeKey: (checkerFn: (s: RootStateFromSlices<S>) => string, callbackFn: (s: RootStateFromSlices<S>) => void) => void;
173
+ /** Performance-optimized subscription for a specific value — returns an unsubscribe function */
174
+ subscribeKey: (checkerFn: (s: RootStateFromSlices<S>) => string, callbackFn: (s: RootStateFromSlices<S>) => void) => () => void;
175
175
  /** Function to dispatch actions or thunks */
176
176
  dispatch: (action: Action | ThunkDispatch<S>) => void;
177
177
  /** Function to notify FAST components of slice changes */
178
178
  notify: (sliceName: keyof RootStateFromSlices<S>) => void;
179
- /** General subscription function for all state changes */
180
- subscribe: (cb: (state: RootStateFromSlices<S>) => void) => void;
179
+ /** Subscribes to all state changes — returns an unsubscribe function */
180
+ subscribe: (cb: (state: RootStateFromSlices<S>) => void) => () => void;
181
181
  /** Function to get the current state */
182
182
  getState: ()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AAC,CAAC,KAAK,IAAI,CAAC;IACtD,0DAA0D;IAC1D,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAC1D,wEAAwE;IACxE,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;IACvE,wCAAwC;IACxC,QAAQ,EAAE,MAAM,mBAAmB,CAAC,CAAC,CAAC,CAAC;CACxC,CAAC"}
package/dist/esm/store.js CHANGED
@@ -17,8 +17,10 @@ class ObservableStore {
17
17
  *
18
18
  * @param slices - Array of slices to combine into the store
19
19
  * @param preloadedState - Initial state for the store
20
+ * @param options - Optional configuration
20
21
  */
21
- constructor(slices, preloadedState) {
22
+ constructor(slices, preloadedState, options) {
23
+ var _a;
22
24
  /**
23
25
  * Gets the underlying Redux store instance.
24
26
  *
@@ -55,6 +57,7 @@ class ObservableStore {
55
57
  * Subscribes to all state changes in the store.
56
58
  *
57
59
  * @param cb - Callback function called whenever state changes
60
+ * @returns Unsubscribe function — call it to stop receiving updates
58
61
  */
59
62
  this.subscribe = (cb) => this._store.subscribe(() => {
60
63
  cb(this._store.getState());
@@ -68,10 +71,11 @@ class ObservableStore {
68
71
  *
69
72
  * @param checkerFn - Function that extracts the value to watch (must return string)
70
73
  * @param callbackFn - Callback function called when the watched value changes
74
+ * @returns Unsubscribe function — call it to stop receiving updates
71
75
  */
72
76
  this.subscribeKey = (checkerFn, callbackFn) => {
73
77
  let cache = checkerFn(this._store.getState());
74
- this.subscribe(() => {
78
+ return this.subscribe(() => {
75
79
  const newState = checkerFn(this._store.getState());
76
80
  if (cache === newState)
77
81
  return;
@@ -145,7 +149,7 @@ class ObservableStore {
145
149
  }, {});
146
150
  this._store = configureStore({
147
151
  reducer: this._rootReducer,
148
- devTools: isDev(),
152
+ devTools: (_a = options === null || options === void 0 ? void 0 : options.devTools) !== null && _a !== void 0 ? _a : isDev(),
149
153
  preloadedState,
150
154
  });
151
155
  }
@@ -160,6 +164,7 @@ class ObservableStore {
160
164
  *
161
165
  * @param slices - Array of slices to combine into the store
162
166
  * @param preloadedState - Initial state that matches the slice structure
167
+ * @param options - Optional configuration (e.g. `{ devTools: false }`)
163
168
  * @returns Object containing store, actions, selectors, and utility functions
164
169
  *
165
170
  * @example
@@ -175,8 +180,8 @@ class ObservableStore {
175
180
  *
176
181
  * @public
177
182
  */
178
- export const createStore = (slices, preloadedState) => {
179
- const observableStore = new ObservableStore(slices, preloadedState);
183
+ export const createStore = (slices, preloadedState, options) => {
184
+ const observableStore = new ObservableStore(slices, preloadedState, options);
180
185
  const actions = observableStore.getActions();
181
186
  const storeProxy = new Proxy({}, {
182
187
  get(target, propertyName) {
@@ -250,7 +250,7 @@
250
250
  {
251
251
  "kind": "Function",
252
252
  "canonicalReference": "@genesislcap/foundation-redux!createStore:function(1)",
253
- "docComment": "/**\n * Creates a Redux store with FAST component integration.\n *\n * @remarks\n *\n * This function creates a Redux store that integrates seamlessly with FAST components. It automatically binds actions and selectors, provides subscription methods, and handles FAST Observable notifications.\n *\n * @param slices - Array of slices to combine into the store\n *\n * @param preloadedState - Initial state that matches the slice structure\n *\n * @returns Object containing store, actions, selectors, and utility functions\n *\n * @example\n * ```typescript\n * const { store, actions, selectors, subscribeKey } = createStore(\n * [userSlice, cartSlice],\n * {\n * user: { name: '', email: '' },\n * cart: { items: [], total: 0 }\n * }\n * );\n * ```\n *\n * @public\n */\n",
253
+ "docComment": "/**\n * Creates a Redux store with FAST component integration.\n *\n * @remarks\n *\n * This function creates a Redux store that integrates seamlessly with FAST components. It automatically binds actions and selectors, provides subscription methods, and handles FAST Observable notifications.\n *\n * @param slices - Array of slices to combine into the store\n *\n * @param preloadedState - Initial state that matches the slice structure\n *\n * @param options - Optional configuration (e.g. `{ devTools: false }`)\n *\n * @returns Object containing store, actions, selectors, and utility functions\n *\n * @example\n * ```typescript\n * const { store, actions, selectors, subscribeKey } = createStore(\n * [userSlice, cartSlice],\n * {\n * user: { name: '', email: '' },\n * cart: { items: [], total: 0 }\n * }\n * );\n * ```\n *\n * @public\n */\n",
254
254
  "excerptTokens": [
255
255
  {
256
256
  "kind": "Content",
@@ -282,6 +282,15 @@
282
282
  "kind": "Content",
283
283
  "text": "<S>"
284
284
  },
285
+ {
286
+ "kind": "Content",
287
+ "text": ", options?: "
288
+ },
289
+ {
290
+ "kind": "Reference",
291
+ "text": "CreateStoreOptions",
292
+ "canonicalReference": "@genesislcap/foundation-redux!CreateStoreOptions:interface"
293
+ },
285
294
  {
286
295
  "kind": "Content",
287
296
  "text": ") => "
@@ -298,8 +307,8 @@
298
307
  ],
299
308
  "fileUrlPath": "src/store.ts",
300
309
  "returnTypeTokenRange": {
301
- "startIndex": 8,
302
- "endIndex": 10
310
+ "startIndex": 10,
311
+ "endIndex": 12
303
312
  },
304
313
  "releaseTag": "Public",
305
314
  "overloadIndex": 1,
@@ -319,6 +328,14 @@
319
328
  "endIndex": 7
320
329
  },
321
330
  "isOptional": false
331
+ },
332
+ {
333
+ "parameterName": "options",
334
+ "parameterTypeTokenRange": {
335
+ "startIndex": 8,
336
+ "endIndex": 9
337
+ },
338
+ "isOptional": true
322
339
  }
323
340
  ],
324
341
  "typeParameters": [
@@ -336,6 +353,51 @@
336
353
  ],
337
354
  "name": "createStore"
338
355
  },
356
+ {
357
+ "kind": "Interface",
358
+ "canonicalReference": "@genesislcap/foundation-redux!CreateStoreOptions:interface",
359
+ "docComment": "/**\n * Options for {@link createStore}.\n *\n * @public\n */\n",
360
+ "excerptTokens": [
361
+ {
362
+ "kind": "Content",
363
+ "text": "export interface CreateStoreOptions "
364
+ }
365
+ ],
366
+ "fileUrlPath": "src/store.ts",
367
+ "releaseTag": "Public",
368
+ "name": "CreateStoreOptions",
369
+ "preserveMemberOrder": false,
370
+ "members": [
371
+ {
372
+ "kind": "PropertySignature",
373
+ "canonicalReference": "@genesislcap/foundation-redux!CreateStoreOptions#devTools:member",
374
+ "docComment": "/**\n * Whether to enable Redux DevTools integration. Defaults to the result of `isDev()` when omitted.\n */\n",
375
+ "excerptTokens": [
376
+ {
377
+ "kind": "Content",
378
+ "text": "devTools?: "
379
+ },
380
+ {
381
+ "kind": "Content",
382
+ "text": "boolean"
383
+ },
384
+ {
385
+ "kind": "Content",
386
+ "text": ";"
387
+ }
388
+ ],
389
+ "isReadonly": false,
390
+ "isOptional": true,
391
+ "releaseTag": "Public",
392
+ "name": "devTools",
393
+ "propertyTypeTokenRange": {
394
+ "startIndex": 1,
395
+ "endIndex": 2
396
+ }
397
+ }
398
+ ],
399
+ "extendsTokenRanges": []
400
+ },
339
401
  {
340
402
  "kind": "TypeAlias",
341
403
  "canonicalReference": "@genesislcap/foundation-redux!RootStateFromSlices:type",
@@ -825,7 +887,7 @@
825
887
  },
826
888
  {
827
889
  "kind": "Content",
828
- "text": "<S>) => void) => void;\n dispatch: (action: "
890
+ "text": "<S>) => void) => () => void;\n dispatch: (action: "
829
891
  },
830
892
  {
831
893
  "kind": "Reference",
@@ -861,7 +923,7 @@
861
923
  },
862
924
  {
863
925
  "kind": "Content",
864
- "text": "<S>) => void) => void;\n getState: () => "
926
+ "text": "<S>) => void) => () => void;\n getState: () => "
865
927
  },
866
928
  {
867
929
  "kind": "Reference",
@@ -44,6 +44,7 @@ export { createSlice }
44
44
  *
45
45
  * @param slices - Array of slices to combine into the store
46
46
  * @param preloadedState - Initial state that matches the slice structure
47
+ * @param options - Optional configuration (e.g. `{ devTools: false }`)
47
48
  * @returns Object containing store, actions, selectors, and utility functions
48
49
  *
49
50
  * @example
@@ -59,7 +60,20 @@ export { createSlice }
59
60
  *
60
61
  * @public
61
62
  */
62
- export declare const createStore: <S extends SliceArray>(slices: S, preloadedState: RootStateFromSlices<S>) => StoreReturn<S>;
63
+ export declare const createStore: <S extends SliceArray>(slices: S, preloadedState: RootStateFromSlices<S>, options?: CreateStoreOptions) => StoreReturn<S>;
64
+
65
+ /**
66
+ * Options for {@link createStore}.
67
+ *
68
+ * @public
69
+ */
70
+ export declare interface CreateStoreOptions {
71
+ /**
72
+ * Whether to enable Redux DevTools integration.
73
+ * Defaults to the result of `isDev()` when omitted.
74
+ */
75
+ devTools?: boolean;
76
+ }
63
77
 
64
78
  declare type FirstIndex = 0;
65
79
 
@@ -198,14 +212,14 @@ export declare type StoreReturn<S extends SliceArray> = {
198
212
  selectors: SelectorsFromSlices<S>;
199
213
  /** The root reducer combining all slices */
200
214
  rootReducer: ReducersMapObject<RootStateFromSlices<S>>;
201
- /** Performance-optimized subscription function for specific values */
202
- subscribeKey: (checkerFn: (s: RootStateFromSlices<S>) => string, callbackFn: (s: RootStateFromSlices<S>) => void) => void;
215
+ /** Performance-optimized subscription for a specific value — returns an unsubscribe function */
216
+ subscribeKey: (checkerFn: (s: RootStateFromSlices<S>) => string, callbackFn: (s: RootStateFromSlices<S>) => void) => () => void;
203
217
  /** Function to dispatch actions or thunks */
204
218
  dispatch: (action: Action | ThunkDispatch<S>) => void;
205
219
  /** Function to notify FAST components of slice changes */
206
220
  notify: (sliceName: keyof RootStateFromSlices<S>) => void;
207
- /** General subscription function for all state changes */
208
- subscribe: (cb: (state: RootStateFromSlices<S>) => void) => void;
221
+ /** Subscribes to all state changes — returns an unsubscribe function */
222
+ subscribe: (cb: (state: RootStateFromSlices<S>) => void) => () => void;
209
223
  /** Function to get the current state */
210
224
  getState: () => RootStateFromSlices<S>;
211
225
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-redux",
3
3
  "description": "Genesis Foundation Redux - Redux Toolkit integration for FAST components",
4
- "version": "14.419.2",
4
+ "version": "14.421.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -38,17 +38,17 @@
38
38
  }
39
39
  },
40
40
  "devDependencies": {
41
- "@genesislcap/foundation-testing": "14.419.2",
42
- "@genesislcap/genx": "14.419.2",
43
- "@genesislcap/rollup-builder": "14.419.2",
44
- "@genesislcap/ts-builder": "14.419.2",
45
- "@genesislcap/uvu-playwright-builder": "14.419.2",
46
- "@genesislcap/vite-builder": "14.419.2",
47
- "@genesislcap/webpack-builder": "14.419.2"
41
+ "@genesislcap/foundation-testing": "14.421.0",
42
+ "@genesislcap/genx": "14.421.0",
43
+ "@genesislcap/rollup-builder": "14.421.0",
44
+ "@genesislcap/ts-builder": "14.421.0",
45
+ "@genesislcap/uvu-playwright-builder": "14.421.0",
46
+ "@genesislcap/vite-builder": "14.421.0",
47
+ "@genesislcap/webpack-builder": "14.421.0"
48
48
  },
49
49
  "dependencies": {
50
- "@genesislcap/foundation-utils": "14.419.2",
51
- "@genesislcap/web-core": "14.419.2",
50
+ "@genesislcap/foundation-utils": "14.421.0",
51
+ "@genesislcap/web-core": "14.421.0",
52
52
  "@reduxjs/toolkit": "^2.2.5"
53
53
  },
54
54
  "repository": {
@@ -59,5 +59,5 @@
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  },
62
- "gitHead": "a9bf0fc6bd28727bf0f95f63b227aee7c418470f"
62
+ "gitHead": "d109b70edbd07af351ed8bf393ace74b42bb5356"
63
63
  }