@flexsurfer/reflex 0.1.20 → 0.1.22

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.cjs CHANGED
@@ -45,9 +45,11 @@ __export(src_exports, {
45
45
  defaultErrorHandler: () => defaultErrorHandler,
46
46
  disableTracing: () => disableTracing,
47
47
  dispatch: () => dispatch,
48
+ enableMapSet: () => enableMapSet,
48
49
  enableTracePrint: () => enableTracePrint,
49
50
  enableTracing: () => enableTracing,
50
51
  getAppDb: () => getAppDb,
52
+ getGlobalEqualityCheck: () => getGlobalEqualityCheck,
51
53
  getGlobalInterceptors: () => getGlobalInterceptors,
52
54
  getHandler: () => getHandler,
53
55
  getHandlers: () => getHandlers,
@@ -64,6 +66,7 @@ __export(src_exports, {
64
66
  registerHotReloadCallback: () => registerHotReloadCallback,
65
67
  registerTraceCb: () => registerTraceCb,
66
68
  removeTraceCb: () => removeTraceCb,
69
+ setGlobalEqualityCheck: () => setGlobalEqualityCheck,
67
70
  setupSubsHotReload: () => setupSubsHotReload,
68
71
  throttleAndDispatch: () => throttleAndDispatch,
69
72
  triggerHotReload: () => triggerHotReload,
@@ -262,6 +265,9 @@ function original(value) {
262
265
  function current(value) {
263
266
  return (0, import_immer.isDraft)(value) ? (0, import_immer.current)(value) : value;
264
267
  }
268
+ function enableMapSet() {
269
+ (0, import_immer.enableMapSet)();
270
+ }
265
271
 
266
272
  // src/interceptor.ts
267
273
  function isInterceptor(m) {
@@ -632,6 +638,9 @@ function clearGlobalInterceptors(id) {
632
638
  store.globalInterceptors = store.globalInterceptors.filter((interceptor) => interceptor.id !== id);
633
639
  }
634
640
  }
641
+ function setGlobalEqualityCheck(equalityCheck) {
642
+ store.globalEqualityCheck = equalityCheck;
643
+ }
635
644
  function getGlobalEqualityCheck() {
636
645
  return store.globalEqualityCheck;
637
646
  }
@@ -1274,9 +1283,11 @@ function HotReloadWrapper({ children }) {
1274
1283
  defaultErrorHandler,
1275
1284
  disableTracing,
1276
1285
  dispatch,
1286
+ enableMapSet,
1277
1287
  enableTracePrint,
1278
1288
  enableTracing,
1279
1289
  getAppDb,
1290
+ getGlobalEqualityCheck,
1280
1291
  getGlobalInterceptors,
1281
1292
  getHandler,
1282
1293
  getHandlers,
@@ -1293,6 +1304,7 @@ function HotReloadWrapper({ children }) {
1293
1304
  registerHotReloadCallback,
1294
1305
  registerTraceCb,
1295
1306
  removeTraceCb,
1307
+ setGlobalEqualityCheck,
1296
1308
  setupSubsHotReload,
1297
1309
  throttleAndDispatch,
1298
1310
  triggerHotReload,
package/dist/index.d.cts CHANGED
@@ -62,6 +62,11 @@ declare function original<T>(value: T): T;
62
62
  * otherwise returns the value as-is
63
63
  */
64
64
  declare function current<T>(value: T): T;
65
+ /**
66
+ * Enable Map and Set support in Immer
67
+ * This allows Immer to handle Map and Set objects properly in drafts
68
+ */
69
+ declare function enableMapSet(): void;
65
70
 
66
71
  /** Register an event handler with only a handler function (db event) */
67
72
  declare function regEvent<T = Record<string, any>>(id: Id, handler: EventHandler<T>): void;
@@ -164,6 +169,14 @@ declare function getGlobalInterceptors(): Interceptor[];
164
169
  */
165
170
  declare function clearGlobalInterceptors(): void;
166
171
  declare function clearGlobalInterceptors(id: string): void;
172
+ /**
173
+ * Set the global equality check function used for reaction value comparisons
174
+ */
175
+ declare function setGlobalEqualityCheck(equalityCheck: EqualityCheckFn): void;
176
+ /**
177
+ * Get the current global equality check function
178
+ */
179
+ declare function getGlobalEqualityCheck(): EqualityCheckFn;
167
180
 
168
181
  type Kind = 'event' | 'fx' | 'cofx' | 'sub' | 'subDeps' | 'error';
169
182
  type RegistryHandler = EventHandler | EffectHandler | CoEffectHandler | ErrorHandler | SubHandler | SubDepsHandler;
@@ -260,4 +273,4 @@ declare function registerTraceCb(key: string, cb: TraceCallback): void;
260
273
  declare function removeTraceCb(key: string): void;
261
274
  declare function enableTracePrint(): void;
262
275
 
263
- export { CoEffectHandler, CoEffects, Context, DISPATCH, DISPATCH_LATER, Db, DispatchLaterEffect, EffectHandler, Effects, ErrorHandler, EventHandler, EventVector, HotReloadWrapper, Id, Interceptor, NOW, RANDOM, SubVector, clearGlobalInterceptors, clearHandlers, clearHotReloadCallbacks, clearReactions, clearSubs, current, debounceAndDispatch, defaultErrorHandler, disableTracing, dispatch, enableTracePrint, enableTracing, getAppDb, getGlobalInterceptors, getHandler, getHandlers, getReactions, getSubscriptionValue, initAppDb, original, regCoeffect, regEffect, regEvent, regEventErrorHandler, regGlobalInterceptor, regSub, registerHotReloadCallback, registerTraceCb, removeTraceCb, setupSubsHotReload, throttleAndDispatch, triggerHotReload, useHotReload, useHotReloadKey, useSubscription };
276
+ export { CoEffectHandler, CoEffects, Context, DISPATCH, DISPATCH_LATER, Db, DispatchLaterEffect, EffectHandler, Effects, EqualityCheckFn, ErrorHandler, EventHandler, EventVector, HotReloadWrapper, Id, Interceptor, NOW, RANDOM, SubConfig, SubVector, clearGlobalInterceptors, clearHandlers, clearHotReloadCallbacks, clearReactions, clearSubs, current, debounceAndDispatch, defaultErrorHandler, disableTracing, dispatch, enableMapSet, enableTracePrint, enableTracing, getAppDb, getGlobalEqualityCheck, getGlobalInterceptors, getHandler, getHandlers, getReactions, getSubscriptionValue, initAppDb, original, regCoeffect, regEffect, regEvent, regEventErrorHandler, regGlobalInterceptor, regSub, registerHotReloadCallback, registerTraceCb, removeTraceCb, setGlobalEqualityCheck, setupSubsHotReload, throttleAndDispatch, triggerHotReload, useHotReload, useHotReloadKey, useSubscription };
package/dist/index.d.ts CHANGED
@@ -62,6 +62,11 @@ declare function original<T>(value: T): T;
62
62
  * otherwise returns the value as-is
63
63
  */
64
64
  declare function current<T>(value: T): T;
65
+ /**
66
+ * Enable Map and Set support in Immer
67
+ * This allows Immer to handle Map and Set objects properly in drafts
68
+ */
69
+ declare function enableMapSet(): void;
65
70
 
66
71
  /** Register an event handler with only a handler function (db event) */
67
72
  declare function regEvent<T = Record<string, any>>(id: Id, handler: EventHandler<T>): void;
@@ -164,6 +169,14 @@ declare function getGlobalInterceptors(): Interceptor[];
164
169
  */
165
170
  declare function clearGlobalInterceptors(): void;
166
171
  declare function clearGlobalInterceptors(id: string): void;
172
+ /**
173
+ * Set the global equality check function used for reaction value comparisons
174
+ */
175
+ declare function setGlobalEqualityCheck(equalityCheck: EqualityCheckFn): void;
176
+ /**
177
+ * Get the current global equality check function
178
+ */
179
+ declare function getGlobalEqualityCheck(): EqualityCheckFn;
167
180
 
168
181
  type Kind = 'event' | 'fx' | 'cofx' | 'sub' | 'subDeps' | 'error';
169
182
  type RegistryHandler = EventHandler | EffectHandler | CoEffectHandler | ErrorHandler | SubHandler | SubDepsHandler;
@@ -260,4 +273,4 @@ declare function registerTraceCb(key: string, cb: TraceCallback): void;
260
273
  declare function removeTraceCb(key: string): void;
261
274
  declare function enableTracePrint(): void;
262
275
 
263
- export { CoEffectHandler, CoEffects, Context, DISPATCH, DISPATCH_LATER, Db, DispatchLaterEffect, EffectHandler, Effects, ErrorHandler, EventHandler, EventVector, HotReloadWrapper, Id, Interceptor, NOW, RANDOM, SubVector, clearGlobalInterceptors, clearHandlers, clearHotReloadCallbacks, clearReactions, clearSubs, current, debounceAndDispatch, defaultErrorHandler, disableTracing, dispatch, enableTracePrint, enableTracing, getAppDb, getGlobalInterceptors, getHandler, getHandlers, getReactions, getSubscriptionValue, initAppDb, original, regCoeffect, regEffect, regEvent, regEventErrorHandler, regGlobalInterceptor, regSub, registerHotReloadCallback, registerTraceCb, removeTraceCb, setupSubsHotReload, throttleAndDispatch, triggerHotReload, useHotReload, useHotReloadKey, useSubscription };
276
+ export { CoEffectHandler, CoEffects, Context, DISPATCH, DISPATCH_LATER, Db, DispatchLaterEffect, EffectHandler, Effects, EqualityCheckFn, ErrorHandler, EventHandler, EventVector, HotReloadWrapper, Id, Interceptor, NOW, RANDOM, SubConfig, SubVector, clearGlobalInterceptors, clearHandlers, clearHotReloadCallbacks, clearReactions, clearSubs, current, debounceAndDispatch, defaultErrorHandler, disableTracing, dispatch, enableMapSet, enableTracePrint, enableTracing, getAppDb, getGlobalEqualityCheck, getGlobalInterceptors, getHandler, getHandlers, getReactions, getSubscriptionValue, initAppDb, original, regCoeffect, regEffect, regEvent, regEventErrorHandler, regGlobalInterceptor, regSub, registerHotReloadCallback, registerTraceCb, removeTraceCb, setGlobalEqualityCheck, setupSubsHotReload, throttleAndDispatch, triggerHotReload, useHotReload, useHotReloadKey, useSubscription };
package/dist/index.mjs CHANGED
@@ -180,13 +180,16 @@ function updateAppDbWithPatches(newDb, patches) {
180
180
  }
181
181
 
182
182
  // src/immer-utils.ts
183
- import { isDraft, original as immerOriginal, current as immerCurrent } from "immer";
183
+ import { isDraft, original as immerOriginal, current as immerCurrent, enableMapSet as immerEnableMapSet } from "immer";
184
184
  function original(value) {
185
185
  return isDraft(value) ? immerOriginal(value) : value;
186
186
  }
187
187
  function current(value) {
188
188
  return isDraft(value) ? immerCurrent(value) : value;
189
189
  }
190
+ function enableMapSet() {
191
+ immerEnableMapSet();
192
+ }
190
193
 
191
194
  // src/interceptor.ts
192
195
  function isInterceptor(m) {
@@ -557,6 +560,9 @@ function clearGlobalInterceptors(id) {
557
560
  store.globalInterceptors = store.globalInterceptors.filter((interceptor) => interceptor.id !== id);
558
561
  }
559
562
  }
563
+ function setGlobalEqualityCheck(equalityCheck) {
564
+ store.globalEqualityCheck = equalityCheck;
565
+ }
560
566
  function getGlobalEqualityCheck() {
561
567
  return store.globalEqualityCheck;
562
568
  }
@@ -1198,9 +1204,11 @@ export {
1198
1204
  defaultErrorHandler,
1199
1205
  disableTracing,
1200
1206
  dispatch,
1207
+ enableMapSet,
1201
1208
  enableTracePrint,
1202
1209
  enableTracing,
1203
1210
  getAppDb,
1211
+ getGlobalEqualityCheck,
1204
1212
  getGlobalInterceptors,
1205
1213
  getHandler,
1206
1214
  getHandlers,
@@ -1217,6 +1225,7 @@ export {
1217
1225
  registerHotReloadCallback,
1218
1226
  registerTraceCb,
1219
1227
  removeTraceCb,
1228
+ setGlobalEqualityCheck,
1220
1229
  setupSubsHotReload,
1221
1230
  throttleAndDispatch,
1222
1231
  triggerHotReload,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flexsurfer/reflex",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",