@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.
@@ -1,9 +1,9 @@
1
1
  import { RuntimeProviderProps } from './RuntimeProvider.cjs';
2
2
  import { ManagedRuntime } from 'effect';
3
- import { u as useModule, a as useLocalModule, b as useSelector, c as useDispatch } from './useDispatch-CnO5-66H.cjs';
3
+ import { u as useModule, a as useLocalModule, b as useSelector, c as useDispatch } from './useDispatch-DiwQQAfC.cjs';
4
4
  import React from 'react';
5
5
  import '@logixjs/core';
6
- import './ModuleRef-wZSQ3Wwo.cjs';
6
+ import './ModuleRef-gZmL6Zvb.cjs';
7
7
 
8
8
  declare const ReactPlatform: {
9
9
  /**
@@ -1,9 +1,9 @@
1
1
  import { RuntimeProviderProps } from './RuntimeProvider.js';
2
2
  import { ManagedRuntime } from 'effect';
3
- import { u as useModule, a as useLocalModule, b as useSelector, c as useDispatch } from './useDispatch-BnzYVkRE.js';
3
+ import { u as useModule, a as useLocalModule, b as useSelector, c as useDispatch } from './useDispatch-CiDimIYZ.js';
4
4
  import React from 'react';
5
5
  import '@logixjs/core';
6
- import './ModuleRef-wZSQ3Wwo.js';
6
+ import './ModuleRef-gZmL6Zvb.js';
7
7
 
8
8
  declare const ReactPlatform: {
9
9
  /**
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  ReactPlatform
3
- } from "./chunk-4G7H66OY.js";
4
- import "./chunk-PYWHL7TA.js";
5
- import "./chunk-UFFCJGSZ.js";
3
+ } from "./chunk-JC3R6GII.js";
4
+ import "./chunk-WOTNVLCD.js";
5
+ import "./chunk-G2LX7WWQ.js";
6
6
  import "./chunk-VFWWMK67.js";
7
- import "./chunk-JXAJTWSZ.js";
7
+ import "./chunk-2M6MDNVT.js";
8
8
  import "./chunk-2WFULYPJ.js";
9
9
  export {
10
10
  ReactPlatform
@@ -1248,6 +1248,20 @@ var RuntimeProvider = ({
1248
1248
  );
1249
1249
  const onErrorRef = import_react4.default.useRef(onError);
1250
1250
  onErrorRef.current = onError;
1251
+ const hasTickServices = (0, import_react4.useMemo)(() => {
1252
+ try {
1253
+ Logix5.InternalContracts.getRuntimeStore(baseRuntime);
1254
+ return true;
1255
+ } catch {
1256
+ return false;
1257
+ }
1258
+ }, [baseRuntime]);
1259
+ const { binding: tickBinding } = useLayerBinding(
1260
+ baseRuntime,
1261
+ Logix5.InternalContracts.tickServicesLayer,
1262
+ !hasTickServices,
1263
+ onErrorRef.current
1264
+ );
1251
1265
  const { binding: layerBinding } = useLayerBinding(baseRuntime, layer, Boolean(layer), onErrorRef.current);
1252
1266
  const onErrorSink = (0, import_react4.useMemo)(() => {
1253
1267
  if (!onError) return null;
@@ -1306,17 +1320,17 @@ var RuntimeProvider = ({
1306
1320
  }
1307
1321
  }, [baseRuntime, layerBinding, onErrorSink]);
1308
1322
  const runtimeWithBindings = (0, import_react4.useMemo)(
1309
- () => layerBinding || onErrorSink ? createRuntimeAdapter(
1323
+ () => tickBinding || layerBinding || onErrorSink ? createRuntimeAdapter(
1310
1324
  baseRuntime,
1311
- layerBinding ? [layerBinding.context] : [],
1312
- layerBinding ? [layerBinding.scope] : [],
1313
- layerBinding ? [layerBinding.loggers] : [],
1314
- layerBinding ? [layerBinding.logLevel] : [],
1325
+ [...tickBinding ? [tickBinding.context] : [], ...layerBinding ? [layerBinding.context] : []],
1326
+ [...tickBinding ? [tickBinding.scope] : [], ...layerBinding ? [layerBinding.scope] : []],
1327
+ layerBinding ? [layerBinding.loggers] : tickBinding ? [tickBinding.loggers] : [],
1328
+ layerBinding ? [layerBinding.logLevel] : tickBinding ? [tickBinding.logLevel] : [],
1315
1329
  [
1316
1330
  onErrorSink ? [onErrorSink, ...inheritedDebugSinks] : layerBinding ? layerBinding.debugSinks : []
1317
1331
  ]
1318
1332
  ) : baseRuntime,
1319
- [baseRuntime, inheritedDebugSinks, layerBinding, onErrorSink]
1333
+ [baseRuntime, inheritedDebugSinks, layerBinding, onErrorSink, tickBinding]
1320
1334
  );
1321
1335
  const didReportSyncConfigSnapshotRef = import_react4.default.useRef(false);
1322
1336
  const [configState, setConfigState] = (0, import_react4.useState)(() => {
@@ -1421,6 +1435,7 @@ var RuntimeProvider = ({
1421
1435
  }),
1422
1436
  [runtimeWithBindings, configState, resolvedPolicy]
1423
1437
  );
1438
+ const isTickServicesReady = hasTickServices || tickBinding !== null;
1424
1439
  const isLayerReady = !layer || layerBinding !== null;
1425
1440
  const isConfigReady = configState.loaded;
1426
1441
  const resolveFallback = (phase) => {
@@ -1575,9 +1590,10 @@ var RuntimeProvider = ({
1575
1590
  release();
1576
1591
  };
1577
1592
  }, [resolvedPolicy.mode, deferReady]);
1578
- const isReady = isLayerReady && isConfigReady && (resolvedPolicy.mode !== "defer" || deferReady);
1593
+ const isReady = isTickServicesReady && isLayerReady && isConfigReady && (resolvedPolicy.mode !== "defer" || deferReady);
1579
1594
  if (!isReady) {
1580
1595
  const blockersList = [
1596
+ isTickServicesReady ? null : "tick",
1581
1597
  isLayerReady ? null : "layer",
1582
1598
  isConfigReady ? null : "config",
1583
1599
  resolvedPolicy.mode !== "defer" || deferReady ? null : "preload"
@@ -1,7 +1,7 @@
1
1
  import "./chunk-VFWWMK67.js";
2
2
  import {
3
3
  RuntimeProvider
4
- } from "./chunk-JXAJTWSZ.js";
4
+ } from "./chunk-2M6MDNVT.js";
5
5
  import "./chunk-2WFULYPJ.js";
6
6
  export {
7
7
  RuntimeProvider
@@ -403,6 +403,20 @@ var RuntimeProvider = ({
403
403
  );
404
404
  const onErrorRef = React2.useRef(onError);
405
405
  onErrorRef.current = onError;
406
+ const hasTickServices = useMemo(() => {
407
+ try {
408
+ Logix2.InternalContracts.getRuntimeStore(baseRuntime);
409
+ return true;
410
+ } catch {
411
+ return false;
412
+ }
413
+ }, [baseRuntime]);
414
+ const { binding: tickBinding } = useLayerBinding(
415
+ baseRuntime,
416
+ Logix2.InternalContracts.tickServicesLayer,
417
+ !hasTickServices,
418
+ onErrorRef.current
419
+ );
406
420
  const { binding: layerBinding } = useLayerBinding(baseRuntime, layer, Boolean(layer), onErrorRef.current);
407
421
  const onErrorSink = useMemo(() => {
408
422
  if (!onError) return null;
@@ -461,17 +475,17 @@ var RuntimeProvider = ({
461
475
  }
462
476
  }, [baseRuntime, layerBinding, onErrorSink]);
463
477
  const runtimeWithBindings = useMemo(
464
- () => layerBinding || onErrorSink ? createRuntimeAdapter(
478
+ () => tickBinding || layerBinding || onErrorSink ? createRuntimeAdapter(
465
479
  baseRuntime,
466
- layerBinding ? [layerBinding.context] : [],
467
- layerBinding ? [layerBinding.scope] : [],
468
- layerBinding ? [layerBinding.loggers] : [],
469
- layerBinding ? [layerBinding.logLevel] : [],
480
+ [...tickBinding ? [tickBinding.context] : [], ...layerBinding ? [layerBinding.context] : []],
481
+ [...tickBinding ? [tickBinding.scope] : [], ...layerBinding ? [layerBinding.scope] : []],
482
+ layerBinding ? [layerBinding.loggers] : tickBinding ? [tickBinding.loggers] : [],
483
+ layerBinding ? [layerBinding.logLevel] : tickBinding ? [tickBinding.logLevel] : [],
470
484
  [
471
485
  onErrorSink ? [onErrorSink, ...inheritedDebugSinks] : layerBinding ? layerBinding.debugSinks : []
472
486
  ]
473
487
  ) : baseRuntime,
474
- [baseRuntime, inheritedDebugSinks, layerBinding, onErrorSink]
488
+ [baseRuntime, inheritedDebugSinks, layerBinding, onErrorSink, tickBinding]
475
489
  );
476
490
  const didReportSyncConfigSnapshotRef = React2.useRef(false);
477
491
  const [configState, setConfigState] = useState2(() => {
@@ -576,6 +590,7 @@ var RuntimeProvider = ({
576
590
  }),
577
591
  [runtimeWithBindings, configState, resolvedPolicy]
578
592
  );
593
+ const isTickServicesReady = hasTickServices || tickBinding !== null;
579
594
  const isLayerReady = !layer || layerBinding !== null;
580
595
  const isConfigReady = configState.loaded;
581
596
  const resolveFallback = (phase) => {
@@ -730,9 +745,10 @@ var RuntimeProvider = ({
730
745
  release();
731
746
  };
732
747
  }, [resolvedPolicy.mode, deferReady]);
733
- const isReady = isLayerReady && isConfigReady && (resolvedPolicy.mode !== "defer" || deferReady);
748
+ const isReady = isTickServicesReady && isLayerReady && isConfigReady && (resolvedPolicy.mode !== "defer" || deferReady);
734
749
  if (!isReady) {
735
750
  const blockersList = [
751
+ isTickServicesReady ? null : "tick",
736
752
  isLayerReady ? null : "layer",
737
753
  isConfigReady ? null : "config",
738
754
  resolvedPolicy.mode !== "defer" || deferReady ? null : "preload"