@logixjs/react 0.1.0 → 0.1.1

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.
@@ -138,7 +138,7 @@ var shallow = (previous, next) => {
138
138
  // src/internal/hooks/useSelector.ts
139
139
  import { useContext as useContext3, useEffect as useEffect3, useMemo as useMemo3 } from "react";
140
140
  import { useSyncExternalStoreWithSelector } from "use-sync-external-store/shim/with-selector";
141
- import * as Logix2 from "@logixjs/core";
141
+ import * as Logix3 from "@logixjs/core";
142
142
 
143
143
  // src/internal/hooks/useModuleRuntime.ts
144
144
  import { useEffect as useEffect2, useMemo as useMemo2, useContext as useContext2 } from "react";
@@ -293,53 +293,69 @@ function useModuleRuntime(handle) {
293
293
  return resolved;
294
294
  }
295
295
 
296
- // src/internal/store/ModuleRuntimeExternalStore.ts
297
- import { Effect as Effect2, Fiber, Stream } from "effect";
296
+ // src/internal/store/RuntimeExternalStore.ts
297
+ import * as Logix2 from "@logixjs/core";
298
+ import { Fiber, Stream } from "effect";
298
299
  var storesByRuntime = /* @__PURE__ */ new WeakMap();
299
300
  var getStoreMapForRuntime = (runtime) => {
300
301
  const cached = storesByRuntime.get(runtime);
301
302
  if (cached) return cached;
302
- const next = /* @__PURE__ */ new WeakMap();
303
+ const next = /* @__PURE__ */ new Map();
303
304
  storesByRuntime.set(runtime, next);
304
305
  return next;
305
306
  };
306
- var getModuleRuntimeExternalStore = (runtime, moduleRuntime, options) => {
307
- const byModule = getStoreMapForRuntime(runtime);
308
- const cached = byModule.get(moduleRuntime);
307
+ var makeModuleInstanceKey = (moduleId, instanceId) => `${moduleId}::${instanceId}`;
308
+ var makeReadQueryTopicKey = (moduleInstanceKey, selectorId) => `${moduleInstanceKey}::rq:${selectorId}`;
309
+ var getRuntimeStore = (runtime) => Logix2.InternalContracts.getRuntimeStore(runtime);
310
+ var getHostScheduler = (runtime) => Logix2.InternalContracts.getHostScheduler(runtime);
311
+ var getOrCreateStore = (runtime, topicKey, make) => {
312
+ const map = getStoreMapForRuntime(runtime);
313
+ const cached = map.get(topicKey);
309
314
  if (cached) {
310
315
  return cached;
311
316
  }
312
- let currentState;
317
+ const created = make();
318
+ map.set(topicKey, created);
319
+ return created;
320
+ };
321
+ var removeStore = (runtime, topicKey) => {
322
+ const map = storesByRuntime.get(runtime);
323
+ if (!map) return;
324
+ map.delete(topicKey);
325
+ };
326
+ var makeTopicExternalStore = (args) => {
327
+ const { runtime, runtimeStore, topicKey } = args;
328
+ const hostScheduler = getHostScheduler(runtime);
329
+ let currentVersion;
330
+ let hasSnapshot = false;
331
+ let currentSnapshot;
313
332
  const listeners = /* @__PURE__ */ new Set();
314
- const lowPriorityDelayMs = options?.lowPriorityDelayMs ?? 16;
315
- const lowPriorityMaxDelayMs = options?.lowPriorityMaxDelayMs ?? 50;
333
+ let unsubscribeFromRuntimeStore;
334
+ const lowPriorityDelayMs = args.options?.lowPriorityDelayMs ?? 16;
335
+ const lowPriorityMaxDelayMs = args.options?.lowPriorityMaxDelayMs ?? 50;
316
336
  let notifyScheduled = false;
317
337
  let notifyScheduledLow = false;
318
- let lowTimeoutId;
319
- let lowMaxTimeoutId;
320
- let lowRafId;
338
+ let lowCancelDelay;
339
+ let lowCancelMaxDelay;
340
+ let lowCancelRaf;
321
341
  const cancelLow = () => {
322
342
  if (!notifyScheduledLow) return;
323
343
  notifyScheduledLow = false;
324
- if (lowTimeoutId != null) {
325
- clearTimeout(lowTimeoutId);
326
- lowTimeoutId = void 0;
327
- }
328
- if (lowMaxTimeoutId != null) {
329
- clearTimeout(lowMaxTimeoutId);
330
- lowMaxTimeoutId = void 0;
331
- }
332
- const cancel = globalThis.cancelAnimationFrame;
333
- if (cancel && typeof lowRafId === "number") {
334
- cancel(lowRafId);
335
- lowRafId = void 0;
336
- }
344
+ lowCancelDelay?.();
345
+ lowCancelDelay = void 0;
346
+ lowCancelMaxDelay?.();
347
+ lowCancelMaxDelay = void 0;
348
+ lowCancelRaf?.();
349
+ lowCancelRaf = void 0;
337
350
  };
338
351
  const flushNotify = () => {
339
352
  notifyScheduled = false;
340
353
  cancelLow();
341
354
  for (const listener of listeners) {
342
- listener();
355
+ try {
356
+ listener();
357
+ } catch {
358
+ }
343
359
  }
344
360
  };
345
361
  const scheduleNotify = (priority) => {
@@ -351,209 +367,134 @@ var getModuleRuntimeExternalStore = (runtime, moduleRuntime, options) => {
351
367
  if (!notifyScheduledLow) return;
352
368
  flushNotify();
353
369
  };
354
- const raf = globalThis.requestAnimationFrame;
355
- if (raf) {
356
- lowRafId = raf(flush);
370
+ const scheduleRaf = () => {
371
+ if (!notifyScheduledLow) return;
372
+ lowCancelRaf = hostScheduler.scheduleAnimationFrame(flush);
373
+ };
374
+ if (lowPriorityDelayMs <= 0) {
375
+ scheduleRaf();
357
376
  } else {
358
- lowTimeoutId = setTimeout(flush, lowPriorityDelayMs);
377
+ lowCancelDelay = hostScheduler.scheduleTimeout(lowPriorityDelayMs, scheduleRaf);
359
378
  }
360
- lowMaxTimeoutId = setTimeout(flush, lowPriorityMaxDelayMs);
379
+ lowCancelMaxDelay = hostScheduler.scheduleTimeout(lowPriorityMaxDelayMs, flush);
361
380
  return;
362
381
  }
363
382
  cancelLow();
364
383
  if (notifyScheduled) return;
365
384
  notifyScheduled = true;
366
- queueMicrotask(flushNotify);
367
- };
368
- let fiber;
369
- const ensureSubscription = () => {
370
- if (fiber) return;
371
- fiber = runtime.runFork(
372
- Stream.runForEach(
373
- moduleRuntime.changesWithMeta((state) => state),
374
- ({ value: state, meta }) => Effect2.sync(() => {
375
- currentState = state;
376
- scheduleNotify(meta.priority);
377
- })
378
- )
379
- );
385
+ hostScheduler.scheduleMicrotask(flushNotify);
380
386
  };
381
- const refreshSnapshotIfStale = () => {
382
- if (currentState === void 0) {
383
- return;
384
- }
387
+ const onRuntimeStoreChange = () => {
385
388
  try {
386
- const latest = runtime.runSync(moduleRuntime.getState);
387
- if (currentState === void 0 || !Object.is(currentState, latest)) {
388
- currentState = latest;
389
- scheduleNotify("normal");
390
- }
389
+ scheduleNotify(runtimeStore.getTopicPriority(topicKey));
391
390
  } catch {
392
391
  }
393
392
  };
394
- const getSnapshot = () => {
395
- if (currentState !== void 0) return currentState;
396
- currentState = runtime.runSync(moduleRuntime.getState);
397
- return currentState;
398
- };
399
- const subscribe = (listener) => {
400
- listeners.add(listener);
401
- ensureSubscription();
402
- refreshSnapshotIfStale();
403
- return () => {
404
- listeners.delete(listener);
405
- if (listeners.size > 0) return;
406
- const running = fiber;
407
- if (!running) return;
408
- fiber = void 0;
409
- cancelLow();
410
- runtime.runFork(Fiber.interrupt(running));
411
- };
412
- };
413
- const store = { getSnapshot, subscribe };
414
- byModule.set(moduleRuntime, store);
415
- return store;
416
- };
417
-
418
- // src/internal/store/ModuleRuntimeSelectorExternalStore.ts
419
- import { Effect as Effect3, Fiber as Fiber2, Stream as Stream2 } from "effect";
420
- var storesByRuntime2 = /* @__PURE__ */ new WeakMap();
421
- var getStoreMapForRuntime2 = (runtime) => {
422
- const cached = storesByRuntime2.get(runtime);
423
- if (cached) return cached;
424
- const next = /* @__PURE__ */ new WeakMap();
425
- storesByRuntime2.set(runtime, next);
426
- return next;
427
- };
428
- var getOrCreateSelectorMapForModule = (byModule, moduleRuntime) => {
429
- const cached = byModule.get(moduleRuntime);
430
- if (cached) return cached;
431
- const next = /* @__PURE__ */ new Map();
432
- byModule.set(moduleRuntime, next);
433
- return next;
434
- };
435
- var equalsValue = (readQuery, a, b) => {
436
- if (readQuery.equalsKind === "custom" && typeof readQuery.equals === "function") {
437
- return readQuery.equals(a, b);
438
- }
439
- if (readQuery.equalsKind === "shallowStruct") {
440
- return shallow(a, b);
441
- }
442
- return Object.is(a, b);
443
- };
444
- var getModuleRuntimeSelectorExternalStore = (runtime, moduleRuntime, selectorReadQuery, options) => {
445
- const byModule = getStoreMapForRuntime2(runtime);
446
- const bySelector = getOrCreateSelectorMapForModule(byModule, moduleRuntime);
447
- const cached = bySelector.get(selectorReadQuery.selectorId);
448
- if (cached) {
449
- return cached;
450
- }
451
- let currentValue;
452
- const listeners = /* @__PURE__ */ new Set();
453
- const lowPriorityDelayMs = options?.lowPriorityDelayMs ?? 16;
454
- const lowPriorityMaxDelayMs = options?.lowPriorityMaxDelayMs ?? 50;
455
- let notifyScheduled = false;
456
- let notifyScheduledLow = false;
457
- let lowTimeoutId;
458
- let lowMaxTimeoutId;
459
- let lowRafId;
460
- const cancelLow = () => {
461
- if (!notifyScheduledLow) return;
462
- notifyScheduledLow = false;
463
- if (lowTimeoutId != null) {
464
- clearTimeout(lowTimeoutId);
465
- lowTimeoutId = void 0;
466
- }
467
- if (lowMaxTimeoutId != null) {
468
- clearTimeout(lowMaxTimeoutId);
469
- lowMaxTimeoutId = void 0;
470
- }
471
- const cancel = globalThis.cancelAnimationFrame;
472
- if (cancel && typeof lowRafId === "number") {
473
- cancel(lowRafId);
474
- lowRafId = void 0;
475
- }
476
- };
477
- const flushNotify = () => {
478
- notifyScheduled = false;
479
- cancelLow();
480
- for (const listener of listeners) {
481
- listener();
482
- }
483
- };
484
- const scheduleNotify = (priority) => {
485
- if (priority === "low") {
486
- if (notifyScheduled) return;
487
- if (notifyScheduledLow) return;
488
- notifyScheduledLow = true;
489
- const flush = () => {
490
- if (!notifyScheduledLow) return;
491
- flushNotify();
492
- };
493
- const raf = globalThis.requestAnimationFrame;
494
- if (raf) {
495
- lowRafId = raf(flush);
496
- } else {
497
- lowTimeoutId = setTimeout(flush, lowPriorityDelayMs);
498
- }
499
- lowMaxTimeoutId = setTimeout(flush, lowPriorityMaxDelayMs);
500
- return;
501
- }
502
- cancelLow();
503
- if (notifyScheduled) return;
504
- notifyScheduled = true;
505
- queueMicrotask(flushNotify);
506
- };
507
- let fiber;
508
393
  const ensureSubscription = () => {
509
- if (fiber) return;
510
- fiber = runtime.runFork(
511
- Stream2.runForEach(
512
- moduleRuntime.changesReadQueryWithMeta(selectorReadQuery),
513
- ({ value, meta }) => Effect3.sync(() => {
514
- currentValue = value;
515
- scheduleNotify(meta.priority);
516
- })
517
- )
518
- );
394
+ if (unsubscribeFromRuntimeStore) return;
395
+ unsubscribeFromRuntimeStore = runtimeStore.subscribeTopic(topicKey, onRuntimeStoreChange);
519
396
  };
520
397
  const refreshSnapshotIfStale = () => {
521
- if (currentValue === void 0) {
522
- return;
523
- }
398
+ if (!hasSnapshot) return;
524
399
  try {
525
- const state = runtime.runSync(moduleRuntime.getState);
526
- const next = selectorReadQuery.select(state);
527
- if (currentValue === void 0 || !equalsValue(selectorReadQuery, currentValue, next)) {
528
- currentValue = next;
529
- scheduleNotify("normal");
400
+ const version = runtimeStore.getTopicVersion(topicKey);
401
+ if (currentVersion !== version) {
402
+ scheduleNotify(runtimeStore.getTopicPriority(topicKey));
530
403
  }
531
404
  } catch {
532
405
  }
533
406
  };
534
407
  const getSnapshot = () => {
535
- if (currentValue !== void 0) return currentValue;
536
- const state = runtime.runSync(moduleRuntime.getState);
537
- currentValue = selectorReadQuery.select(state);
538
- return currentValue;
408
+ const version = runtimeStore.getTopicVersion(topicKey);
409
+ if (hasSnapshot && currentVersion === version) {
410
+ return currentSnapshot;
411
+ }
412
+ const next = args.readSnapshot();
413
+ currentVersion = version;
414
+ hasSnapshot = true;
415
+ currentSnapshot = next;
416
+ return next;
539
417
  };
540
418
  const subscribe = (listener) => {
419
+ const isFirst = listeners.size === 0;
541
420
  listeners.add(listener);
542
421
  ensureSubscription();
543
422
  refreshSnapshotIfStale();
423
+ if (isFirst) {
424
+ try {
425
+ args.onFirstListener?.();
426
+ } catch {
427
+ }
428
+ }
544
429
  return () => {
545
430
  listeners.delete(listener);
546
431
  if (listeners.size > 0) return;
547
- const running = fiber;
548
- if (!running) return;
549
- fiber = void 0;
432
+ try {
433
+ args.onLastListener?.();
434
+ } catch {
435
+ }
436
+ const unsub = unsubscribeFromRuntimeStore;
437
+ unsubscribeFromRuntimeStore = void 0;
550
438
  cancelLow();
551
- runtime.runFork(Fiber2.interrupt(running));
439
+ try {
440
+ unsub?.();
441
+ } catch {
442
+ }
443
+ removeStore(runtime, topicKey);
552
444
  };
553
445
  };
554
- const store = { getSnapshot, subscribe };
555
- bySelector.set(selectorReadQuery.selectorId, store);
556
- return store;
446
+ return { getSnapshot, getServerSnapshot: getSnapshot, subscribe };
447
+ };
448
+ var getRuntimeModuleExternalStore = (runtime, moduleRuntime, options) => {
449
+ const moduleInstanceKey = makeModuleInstanceKey(moduleRuntime.moduleId, moduleRuntime.instanceId);
450
+ const runtimeStore = getRuntimeStore(runtime);
451
+ return getOrCreateStore(
452
+ runtime,
453
+ moduleInstanceKey,
454
+ () => makeTopicExternalStore({
455
+ runtime,
456
+ runtimeStore,
457
+ topicKey: moduleInstanceKey,
458
+ readSnapshot: () => {
459
+ const state = runtimeStore.getModuleState(moduleInstanceKey);
460
+ if (state !== void 0) return state;
461
+ return runtime.runSync(moduleRuntime.getState);
462
+ },
463
+ options
464
+ })
465
+ );
466
+ };
467
+ var getRuntimeReadQueryExternalStore = (runtime, moduleRuntime, selectorReadQuery, options) => {
468
+ const moduleInstanceKey = makeModuleInstanceKey(moduleRuntime.moduleId, moduleRuntime.instanceId);
469
+ const topicKey = makeReadQueryTopicKey(moduleInstanceKey, selectorReadQuery.selectorId);
470
+ const runtimeStore = getRuntimeStore(runtime);
471
+ let readQueryDrainFiber;
472
+ return getOrCreateStore(
473
+ runtime,
474
+ topicKey,
475
+ () => makeTopicExternalStore({
476
+ runtime,
477
+ runtimeStore,
478
+ topicKey,
479
+ readSnapshot: () => {
480
+ const state = runtimeStore.getModuleState(moduleInstanceKey);
481
+ const current = state ?? runtime.runSync(moduleRuntime.getState);
482
+ return selectorReadQuery.select(current);
483
+ },
484
+ options,
485
+ onFirstListener: () => {
486
+ if (readQueryDrainFiber) return;
487
+ const effect = Stream.runDrain(moduleRuntime.changesReadQueryWithMeta(selectorReadQuery));
488
+ readQueryDrainFiber = runtime.runFork(effect);
489
+ },
490
+ onLastListener: () => {
491
+ const fiber = readQueryDrainFiber;
492
+ if (!fiber) return;
493
+ readQueryDrainFiber = void 0;
494
+ runtime.runFork(Fiber.interrupt(fiber));
495
+ }
496
+ })
497
+ );
557
498
  };
558
499
 
559
500
  // src/internal/hooks/useSelector.ts
@@ -566,7 +507,7 @@ function useSelector(handle, selector, equalityFn) {
566
507
  const moduleRuntime = useModuleRuntime(handle);
567
508
  const actualSelector = selector ?? ((state) => state);
568
509
  const selectorReadQuery = useMemo3(
569
- () => typeof selector === "function" ? Logix2.ReadQuery.compile(selector) : void 0,
510
+ () => typeof selector === "function" ? Logix3.ReadQuery.compile(selector) : void 0,
570
511
  [selector]
571
512
  );
572
513
  const actualEqualityFn = useMemo3(() => {
@@ -574,17 +515,12 @@ function useSelector(handle, selector, equalityFn) {
574
515
  if (typeof selector !== "function") return Object.is;
575
516
  return selectorReadQuery?.equalsKind === "shallowStruct" ? shallow : Object.is;
576
517
  }, [equalityFn, selector, selectorReadQuery?.equalsKind]);
577
- const useStaticLane = typeof selector === "function" && selectorReadQuery?.lane === "static";
518
+ const selectorTopicEligible = typeof selector === "function" && selectorReadQuery?.lane === "static" && selectorReadQuery.readsDigest != null && selectorReadQuery.fallbackReason == null;
578
519
  const store = useMemo3(
579
- () => useStaticLane && selectorReadQuery ? getModuleRuntimeSelectorExternalStore(
580
- runtime,
581
- moduleRuntime,
582
- selectorReadQuery,
583
- {
584
- lowPriorityDelayMs: runtimeContext.reactConfigSnapshot.lowPriorityDelayMs,
585
- lowPriorityMaxDelayMs: runtimeContext.reactConfigSnapshot.lowPriorityMaxDelayMs
586
- }
587
- ) : getModuleRuntimeExternalStore(
520
+ () => selectorTopicEligible && selectorReadQuery ? getRuntimeReadQueryExternalStore(runtime, moduleRuntime, selectorReadQuery, {
521
+ lowPriorityDelayMs: runtimeContext.reactConfigSnapshot.lowPriorityDelayMs,
522
+ lowPriorityMaxDelayMs: runtimeContext.reactConfigSnapshot.lowPriorityMaxDelayMs
523
+ }) : getRuntimeModuleExternalStore(
588
524
  runtime,
589
525
  moduleRuntime,
590
526
  {
@@ -598,18 +534,18 @@ function useSelector(handle, selector, equalityFn) {
598
534
  runtimeContext.reactConfigSnapshot.lowPriorityDelayMs,
599
535
  runtimeContext.reactConfigSnapshot.lowPriorityMaxDelayMs,
600
536
  selectorReadQuery,
601
- useStaticLane
537
+ selectorTopicEligible
602
538
  ]
603
539
  );
604
540
  const selected = useSyncExternalStoreWithSelector(
605
541
  store.subscribe,
606
542
  store.getSnapshot,
607
- store.getSnapshot,
608
- useStaticLane ? (snapshot) => snapshot : (snapshot) => actualSelector(snapshot),
543
+ store.getServerSnapshot ?? store.getSnapshot,
544
+ selectorTopicEligible ? (snapshot) => snapshot : (snapshot) => actualSelector(snapshot),
609
545
  actualEqualityFn
610
546
  );
611
547
  useEffect3(() => {
612
- if (!isDevEnv() && !Logix2.Debug.isDevtoolsEnabled()) {
548
+ if (!isDevEnv() && !Logix3.Debug.isDevtoolsEnabled()) {
613
549
  return;
614
550
  }
615
551
  const instanceId = moduleRuntime.instanceId;
@@ -625,7 +561,7 @@ function useSelector(handle, selector, equalityFn) {
625
561
  const rawDebugKey = meta.debugKey;
626
562
  selectorKey = typeof rawDebugKey === "string" && rawDebugKey.length > 0 ? rawDebugKey : typeof selector.name === "string" && selector.name.length > 0 ? selector.name : void 0;
627
563
  }
628
- const effect = Logix2.Debug.record({
564
+ const effect = Logix3.Debug.record({
629
565
  type: "trace:react-selector",
630
566
  moduleId: moduleRuntime.moduleId,
631
567
  instanceId,
@@ -649,11 +585,11 @@ function useSelector(handle, selector, equalityFn) {
649
585
 
650
586
  // src/internal/hooks/useModule.ts
651
587
  import React2 from "react";
652
- import * as Logix4 from "@logixjs/core";
653
- import { Context, Effect as Effect4, Layer as Layer2 } from "effect";
588
+ import * as Logix5 from "@logixjs/core";
589
+ import { Context, Effect as Effect3, Layer as Layer2 } from "effect";
654
590
 
655
591
  // src/internal/store/resolveImportedModuleRef.ts
656
- import * as Logix3 from "@logixjs/core";
592
+ import * as Logix4 from "@logixjs/core";
657
593
  var getOrCreateWeakMap = (map, key, make) => {
658
594
  const cached = map.get(key);
659
595
  if (cached) return cached;
@@ -677,7 +613,7 @@ var resolveImportedModuleRef = (runtime, parentRuntime, module) => {
677
613
  if (cached) {
678
614
  return cached;
679
615
  }
680
- const importsScope = Logix3.InternalContracts.getImportsScope(parentRuntime);
616
+ const importsScope = Logix4.InternalContracts.getImportsScope(parentRuntime);
681
617
  const childRuntime = importsScope.get(module);
682
618
  if (childRuntime) {
683
619
  const dispatch = Object.assign(
@@ -763,8 +699,8 @@ var useStableId = () => {
763
699
 
764
700
  // src/internal/hooks/useModule.ts
765
701
  var isModuleImpl = (handle) => Boolean(handle) && typeof handle === "object" && handle._tag === "ModuleImpl";
766
- var isModule = (handle) => Logix4.Module.hasImpl(handle);
767
- var isModuleDef = (handle) => Logix4.Module.is(handle) && handle._kind === "ModuleDef";
702
+ var isModule = (handle) => Logix5.Module.hasImpl(handle);
703
+ var isModuleDef = (handle) => Logix5.Module.is(handle) && handle._kind === "ModuleDef";
768
704
  function useModule(handle, selectorOrOptions, equalityFn) {
769
705
  const runtimeBase = useRuntime();
770
706
  const runtimeContext = React2.useContext(RuntimeContext);
@@ -817,7 +753,7 @@ function useModule(handle, selectorOrOptions, equalityFn) {
817
753
  const ownerId = moduleId;
818
754
  const baseFactory = React2.useMemo(
819
755
  () => (scope) => Layer2.buildWithScope(normalizedHandle.layer, scope).pipe(
820
- Effect4.map(
756
+ Effect3.map(
821
757
  (context) => Context.get(context, normalizedHandle.module)
822
758
  )
823
759
  ),
@@ -828,7 +764,7 @@ function useModule(handle, selectorOrOptions, equalityFn) {
828
764
  return baseFactory;
829
765
  }
830
766
  return (scope) => baseFactory(scope).pipe(
831
- Effect4.timeoutFail({
767
+ Effect3.timeoutFail({
832
768
  duration: initTimeoutMs,
833
769
  onTimeout: () => new Error(`[useModule] Module "${ownerId}" initialization timed out after ${initTimeoutMs}ms`)
834
770
  })
@@ -857,7 +793,7 @@ function useModule(handle, selectorOrOptions, equalityFn) {
857
793
  if (!label) {
858
794
  return;
859
795
  }
860
- const effect = Logix4.Debug.record({
796
+ const effect = Logix5.Debug.record({
861
797
  type: "trace:instanceLabel",
862
798
  moduleId: normalizedHandle.module.id,
863
799
  instanceId: runtime.instanceId,
@@ -866,13 +802,13 @@ function useModule(handle, selectorOrOptions, equalityFn) {
866
802
  runtimeBase.runFork(effect);
867
803
  }, [runtimeBase, runtime, normalizedHandle, options]);
868
804
  React2.useEffect(() => {
869
- if (!isDevEnv() && !Logix4.Debug.isDevtoolsEnabled()) {
805
+ if (!isDevEnv() && !Logix5.Debug.isDevtoolsEnabled()) {
870
806
  return;
871
807
  }
872
808
  if (!runtime.instanceId) {
873
809
  return;
874
810
  }
875
- const effect = Logix4.Debug.record({
811
+ const effect = Logix5.Debug.record({
876
812
  type: "trace:react-render",
877
813
  moduleId: runtime.moduleId,
878
814
  instanceId: runtime.instanceId,
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  useDispatch,
3
3
  useLocalModule
4
- } from "./chunk-PYWHL7TA.js";
4
+ } from "./chunk-WOTNVLCD.js";
5
5
  import {
6
6
  useModule,
7
7
  useSelector
8
- } from "./chunk-UFFCJGSZ.js";
8
+ } from "./chunk-G2LX7WWQ.js";
9
9
  import {
10
10
  RuntimeProvider
11
- } from "./chunk-JXAJTWSZ.js";
11
+ } from "./chunk-2M6MDNVT.js";
12
12
 
13
13
  // src/ReactPlatform.ts
14
14
  import React from "react";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  useModule,
3
3
  useRuntime
4
- } from "./chunk-UFFCJGSZ.js";
4
+ } from "./chunk-G2LX7WWQ.js";
5
5
  import {
6
6
  RuntimeProvider
7
- } from "./chunk-JXAJTWSZ.js";
7
+ } from "./chunk-2M6MDNVT.js";
8
8
 
9
9
  // src/ModuleScope.ts
10
10
  import React from "react";
@@ -61,10 +61,7 @@ var makeModuleScope = (handle, defaults) => {
61
61
  const runtime = useRuntime();
62
62
  const registry = getRegistryOrThrow(runtime, "[ModuleScope.Bridge]");
63
63
  const scopedRuntime = registry.get(scopeId, Logix.ScopeRegistry.ScopedRuntimeTag);
64
- const moduleRuntime = registry.get(
65
- scopeId,
66
- moduleToken
67
- );
64
+ const moduleRuntime = registry.get(scopeId, moduleToken);
68
65
  if (!scopedRuntime || !moduleRuntime) {
69
66
  throw new Error(
70
67
  `[ModuleScope.Bridge] Scope "${scopeId}" is not registered (or has been disposed). Ensure you have a corresponding <ModuleScope.Provider options={{ scopeId }}> mounted.`
@@ -6,7 +6,7 @@ import {
6
6
  useModuleRuntime,
7
7
  useRuntime,
8
8
  useStableId
9
- } from "./chunk-UFFCJGSZ.js";
9
+ } from "./chunk-G2LX7WWQ.js";
10
10
  import {
11
11
  RuntimeContext,
12
12
  getModuleCache,