@flexsurfer/reflex 0.1.17 → 0.1.19

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
@@ -50,6 +50,7 @@ __export(src_exports, {
50
50
  getAppDb: () => getAppDb,
51
51
  getGlobalInterceptors: () => getGlobalInterceptors,
52
52
  getHandler: () => getHandler,
53
+ getHandlers: () => getHandlers,
53
54
  getReactions: () => getReactions,
54
55
  getSubscriptionValue: () => getSubscriptionValue,
55
56
  initAppDb: () => initAppDb,
@@ -62,6 +63,7 @@ __export(src_exports, {
62
63
  regSub: () => regSub,
63
64
  registerHotReloadCallback: () => registerHotReloadCallback,
64
65
  registerTraceCb: () => registerTraceCb,
66
+ removeTraceCb: () => removeTraceCb,
65
67
  setupSubsHotReload: () => setupSubsHotReload,
66
68
  throttleAndDispatch: () => throttleAndDispatch,
67
69
  triggerHotReload: () => triggerHotReload,
@@ -107,6 +109,9 @@ function getHandler(kind, id) {
107
109
  }
108
110
  return handler;
109
111
  }
112
+ function getHandlers() {
113
+ return kindToIdToHandler;
114
+ }
110
115
  function registerHandler(kind, id, handlerFn) {
111
116
  if (kindToIdToHandler[kind][id]) {
112
117
  consoleLog("warn", `[reflex] overwriting ${kind} handler for:`, id);
@@ -642,6 +647,9 @@ function registerTraceCb(key, cb) {
642
647
  }
643
648
  traceCbs.set(key, cb);
644
649
  }
650
+ function removeTraceCb(key) {
651
+ traceCbs.delete(key);
652
+ }
645
653
  function scheduleFlush() {
646
654
  if (debounceTimer)
647
655
  return;
@@ -917,7 +925,7 @@ var Reaction = class _Reaction {
917
925
  try {
918
926
  let changed = false;
919
927
  withTrace(
920
- { operation: this.subVector?.[0] ?? "", opType: "sub/run", tags: { queryV: this.subVector, reaction: this.id } },
928
+ { operation: this.subVector?.[0] ?? "", opType: "sub/run", tags: { queryV: this.subVector, reaction: this.id, deps: this.deps?.map((d) => d.getId()) ?? [] } },
921
929
  () => {
922
930
  if (this.isRoot) {
923
931
  changed = true;
@@ -949,7 +957,8 @@ var Reaction = class _Reaction {
949
957
  withTrace(
950
958
  {
951
959
  opType: "render",
952
- operation: w.componentName
960
+ operation: w.componentName,
961
+ tags: { reaction: this.id }
953
962
  },
954
963
  () => {
955
964
  w.callback(this.value);
@@ -1239,6 +1248,7 @@ function HotReloadWrapper({ children }) {
1239
1248
  getAppDb,
1240
1249
  getGlobalInterceptors,
1241
1250
  getHandler,
1251
+ getHandlers,
1242
1252
  getReactions,
1243
1253
  getSubscriptionValue,
1244
1254
  initAppDb,
@@ -1251,6 +1261,7 @@ function HotReloadWrapper({ children }) {
1251
1261
  regSub,
1252
1262
  registerHotReloadCallback,
1253
1263
  registerTraceCb,
1264
+ removeTraceCb,
1254
1265
  setupSubsHotReload,
1255
1266
  throttleAndDispatch,
1256
1267
  triggerHotReload,
package/dist/index.d.cts CHANGED
@@ -163,6 +163,7 @@ declare function clearGlobalInterceptors(id: string): void;
163
163
  type Kind = 'event' | 'fx' | 'cofx' | 'sub' | 'subDeps' | 'error';
164
164
  type RegistryHandler = EventHandler | EffectHandler | CoEffectHandler | ErrorHandler | SubHandler | SubDepsHandler;
165
165
  declare function getHandler<T extends RegistryHandler = RegistryHandler>(kind: Kind, id: Id): T | undefined;
166
+ declare function getHandlers(): Record<Kind, Record<string, RegistryHandler>>;
166
167
  declare function clearHandlers(): void;
167
168
  declare function clearHandlers(kind: Kind): void;
168
169
  declare function clearHandlers(kind: Kind, id: string): void;
@@ -251,6 +252,7 @@ type TraceCallback = (traces: Trace[]) => void;
251
252
  declare function enableTracing(): void;
252
253
  declare function disableTracing(): void;
253
254
  declare function registerTraceCb(key: string, cb: TraceCallback): void;
255
+ declare function removeTraceCb(key: string): void;
254
256
  declare function enableTracePrint(): void;
255
257
 
256
- 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, getReactions, getSubscriptionValue, initAppDb, original, regCoeffect, regEffect, regEvent, regEventErrorHandler, regGlobalInterceptor, regSub, registerHotReloadCallback, registerTraceCb, setupSubsHotReload, throttleAndDispatch, triggerHotReload, useHotReload, useHotReloadKey, useSubscription };
258
+ 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 };
package/dist/index.d.ts CHANGED
@@ -163,6 +163,7 @@ declare function clearGlobalInterceptors(id: string): void;
163
163
  type Kind = 'event' | 'fx' | 'cofx' | 'sub' | 'subDeps' | 'error';
164
164
  type RegistryHandler = EventHandler | EffectHandler | CoEffectHandler | ErrorHandler | SubHandler | SubDepsHandler;
165
165
  declare function getHandler<T extends RegistryHandler = RegistryHandler>(kind: Kind, id: Id): T | undefined;
166
+ declare function getHandlers(): Record<Kind, Record<string, RegistryHandler>>;
166
167
  declare function clearHandlers(): void;
167
168
  declare function clearHandlers(kind: Kind): void;
168
169
  declare function clearHandlers(kind: Kind, id: string): void;
@@ -251,6 +252,7 @@ type TraceCallback = (traces: Trace[]) => void;
251
252
  declare function enableTracing(): void;
252
253
  declare function disableTracing(): void;
253
254
  declare function registerTraceCb(key: string, cb: TraceCallback): void;
255
+ declare function removeTraceCb(key: string): void;
254
256
  declare function enableTracePrint(): void;
255
257
 
256
- 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, getReactions, getSubscriptionValue, initAppDb, original, regCoeffect, regEffect, regEvent, regEventErrorHandler, regGlobalInterceptor, regSub, registerHotReloadCallback, registerTraceCb, setupSubsHotReload, throttleAndDispatch, triggerHotReload, useHotReload, useHotReloadKey, useSubscription };
258
+ 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 };
package/dist/index.mjs CHANGED
@@ -34,6 +34,9 @@ function getHandler(kind, id) {
34
34
  }
35
35
  return handler;
36
36
  }
37
+ function getHandlers() {
38
+ return kindToIdToHandler;
39
+ }
37
40
  function registerHandler(kind, id, handlerFn) {
38
41
  if (kindToIdToHandler[kind][id]) {
39
42
  consoleLog("warn", `[reflex] overwriting ${kind} handler for:`, id);
@@ -569,6 +572,9 @@ function registerTraceCb(key, cb) {
569
572
  }
570
573
  traceCbs.set(key, cb);
571
574
  }
575
+ function removeTraceCb(key) {
576
+ traceCbs.delete(key);
577
+ }
572
578
  function scheduleFlush() {
573
579
  if (debounceTimer)
574
580
  return;
@@ -844,7 +850,7 @@ var Reaction = class _Reaction {
844
850
  try {
845
851
  let changed = false;
846
852
  withTrace(
847
- { operation: this.subVector?.[0] ?? "", opType: "sub/run", tags: { queryV: this.subVector, reaction: this.id } },
853
+ { operation: this.subVector?.[0] ?? "", opType: "sub/run", tags: { queryV: this.subVector, reaction: this.id, deps: this.deps?.map((d) => d.getId()) ?? [] } },
848
854
  () => {
849
855
  if (this.isRoot) {
850
856
  changed = true;
@@ -876,7 +882,8 @@ var Reaction = class _Reaction {
876
882
  withTrace(
877
883
  {
878
884
  opType: "render",
879
- operation: w.componentName
885
+ operation: w.componentName,
886
+ tags: { reaction: this.id }
880
887
  },
881
888
  () => {
882
889
  w.callback(this.value);
@@ -1165,6 +1172,7 @@ export {
1165
1172
  getAppDb,
1166
1173
  getGlobalInterceptors,
1167
1174
  getHandler,
1175
+ getHandlers,
1168
1176
  getReactions,
1169
1177
  getSubscriptionValue,
1170
1178
  initAppDb,
@@ -1177,6 +1185,7 @@ export {
1177
1185
  regSub,
1178
1186
  registerHotReloadCallback,
1179
1187
  registerTraceCb,
1188
+ removeTraceCb,
1180
1189
  setupSubsHotReload,
1181
1190
  throttleAndDispatch,
1182
1191
  triggerHotReload,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flexsurfer/reflex",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",