@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.
@@ -34,12 +34,12 @@ __export(ModuleScope_exports, {
34
34
  });
35
35
  module.exports = __toCommonJS(ModuleScope_exports);
36
36
  var import_react10 = __toESM(require("react"), 1);
37
- var Logix10 = __toESM(require("@logixjs/core"), 1);
37
+ var Logix11 = __toESM(require("@logixjs/core"), 1);
38
38
 
39
39
  // src/internal/hooks/useModule.ts
40
40
  var import_react7 = __toESM(require("react"), 1);
41
- var Logix7 = __toESM(require("@logixjs/core"), 1);
42
- var import_effect8 = require("effect");
41
+ var Logix8 = __toESM(require("@logixjs/core"), 1);
42
+ var import_effect7 = require("effect");
43
43
 
44
44
  // src/internal/hooks/useModuleRuntime.ts
45
45
  var import_react4 = require("react");
@@ -1123,55 +1123,71 @@ function useModuleRuntime(handle) {
1123
1123
  // src/internal/hooks/useSelector.ts
1124
1124
  var import_react5 = require("react");
1125
1125
  var import_with_selector = require("use-sync-external-store/shim/with-selector");
1126
- var Logix5 = __toESM(require("@logixjs/core"), 1);
1126
+ var Logix6 = __toESM(require("@logixjs/core"), 1);
1127
1127
 
1128
- // src/internal/store/ModuleRuntimeExternalStore.ts
1128
+ // src/internal/store/RuntimeExternalStore.ts
1129
+ var Logix5 = __toESM(require("@logixjs/core"), 1);
1129
1130
  var import_effect6 = require("effect");
1130
1131
  var storesByRuntime = /* @__PURE__ */ new WeakMap();
1131
1132
  var getStoreMapForRuntime = (runtime) => {
1132
1133
  const cached = storesByRuntime.get(runtime);
1133
1134
  if (cached) return cached;
1134
- const next = /* @__PURE__ */ new WeakMap();
1135
+ const next = /* @__PURE__ */ new Map();
1135
1136
  storesByRuntime.set(runtime, next);
1136
1137
  return next;
1137
1138
  };
1138
- var getModuleRuntimeExternalStore = (runtime, moduleRuntime, options) => {
1139
- const byModule = getStoreMapForRuntime(runtime);
1140
- const cached = byModule.get(moduleRuntime);
1139
+ var makeModuleInstanceKey = (moduleId, instanceId) => `${moduleId}::${instanceId}`;
1140
+ var makeReadQueryTopicKey = (moduleInstanceKey, selectorId) => `${moduleInstanceKey}::rq:${selectorId}`;
1141
+ var getRuntimeStore = (runtime) => Logix5.InternalContracts.getRuntimeStore(runtime);
1142
+ var getHostScheduler = (runtime) => Logix5.InternalContracts.getHostScheduler(runtime);
1143
+ var getOrCreateStore = (runtime, topicKey, make) => {
1144
+ const map = getStoreMapForRuntime(runtime);
1145
+ const cached = map.get(topicKey);
1141
1146
  if (cached) {
1142
1147
  return cached;
1143
1148
  }
1144
- let currentState;
1149
+ const created = make();
1150
+ map.set(topicKey, created);
1151
+ return created;
1152
+ };
1153
+ var removeStore = (runtime, topicKey) => {
1154
+ const map = storesByRuntime.get(runtime);
1155
+ if (!map) return;
1156
+ map.delete(topicKey);
1157
+ };
1158
+ var makeTopicExternalStore = (args) => {
1159
+ const { runtime, runtimeStore, topicKey } = args;
1160
+ const hostScheduler = getHostScheduler(runtime);
1161
+ let currentVersion;
1162
+ let hasSnapshot = false;
1163
+ let currentSnapshot;
1145
1164
  const listeners = /* @__PURE__ */ new Set();
1146
- const lowPriorityDelayMs = options?.lowPriorityDelayMs ?? 16;
1147
- const lowPriorityMaxDelayMs = options?.lowPriorityMaxDelayMs ?? 50;
1165
+ let unsubscribeFromRuntimeStore;
1166
+ const lowPriorityDelayMs = args.options?.lowPriorityDelayMs ?? 16;
1167
+ const lowPriorityMaxDelayMs = args.options?.lowPriorityMaxDelayMs ?? 50;
1148
1168
  let notifyScheduled = false;
1149
1169
  let notifyScheduledLow = false;
1150
- let lowTimeoutId;
1151
- let lowMaxTimeoutId;
1152
- let lowRafId;
1170
+ let lowCancelDelay;
1171
+ let lowCancelMaxDelay;
1172
+ let lowCancelRaf;
1153
1173
  const cancelLow = () => {
1154
1174
  if (!notifyScheduledLow) return;
1155
1175
  notifyScheduledLow = false;
1156
- if (lowTimeoutId != null) {
1157
- clearTimeout(lowTimeoutId);
1158
- lowTimeoutId = void 0;
1159
- }
1160
- if (lowMaxTimeoutId != null) {
1161
- clearTimeout(lowMaxTimeoutId);
1162
- lowMaxTimeoutId = void 0;
1163
- }
1164
- const cancel = globalThis.cancelAnimationFrame;
1165
- if (cancel && typeof lowRafId === "number") {
1166
- cancel(lowRafId);
1167
- lowRafId = void 0;
1168
- }
1176
+ lowCancelDelay?.();
1177
+ lowCancelDelay = void 0;
1178
+ lowCancelMaxDelay?.();
1179
+ lowCancelMaxDelay = void 0;
1180
+ lowCancelRaf?.();
1181
+ lowCancelRaf = void 0;
1169
1182
  };
1170
1183
  const flushNotify = () => {
1171
1184
  notifyScheduled = false;
1172
1185
  cancelLow();
1173
1186
  for (const listener of listeners) {
1174
- listener();
1187
+ try {
1188
+ listener();
1189
+ } catch {
1190
+ }
1175
1191
  }
1176
1192
  };
1177
1193
  const scheduleNotify = (priority) => {
@@ -1183,72 +1199,135 @@ var getModuleRuntimeExternalStore = (runtime, moduleRuntime, options) => {
1183
1199
  if (!notifyScheduledLow) return;
1184
1200
  flushNotify();
1185
1201
  };
1186
- const raf = globalThis.requestAnimationFrame;
1187
- if (raf) {
1188
- lowRafId = raf(flush);
1202
+ const scheduleRaf = () => {
1203
+ if (!notifyScheduledLow) return;
1204
+ lowCancelRaf = hostScheduler.scheduleAnimationFrame(flush);
1205
+ };
1206
+ if (lowPriorityDelayMs <= 0) {
1207
+ scheduleRaf();
1189
1208
  } else {
1190
- lowTimeoutId = setTimeout(flush, lowPriorityDelayMs);
1209
+ lowCancelDelay = hostScheduler.scheduleTimeout(lowPriorityDelayMs, scheduleRaf);
1191
1210
  }
1192
- lowMaxTimeoutId = setTimeout(flush, lowPriorityMaxDelayMs);
1211
+ lowCancelMaxDelay = hostScheduler.scheduleTimeout(lowPriorityMaxDelayMs, flush);
1193
1212
  return;
1194
1213
  }
1195
1214
  cancelLow();
1196
1215
  if (notifyScheduled) return;
1197
1216
  notifyScheduled = true;
1198
- queueMicrotask(flushNotify);
1217
+ hostScheduler.scheduleMicrotask(flushNotify);
1218
+ };
1219
+ const onRuntimeStoreChange = () => {
1220
+ try {
1221
+ scheduleNotify(runtimeStore.getTopicPriority(topicKey));
1222
+ } catch {
1223
+ }
1199
1224
  };
1200
- let fiber;
1201
1225
  const ensureSubscription = () => {
1202
- if (fiber) return;
1203
- fiber = runtime.runFork(
1204
- import_effect6.Stream.runForEach(
1205
- moduleRuntime.changesWithMeta((state) => state),
1206
- ({ value: state, meta }) => import_effect6.Effect.sync(() => {
1207
- currentState = state;
1208
- scheduleNotify(meta.priority);
1209
- })
1210
- )
1211
- );
1226
+ if (unsubscribeFromRuntimeStore) return;
1227
+ unsubscribeFromRuntimeStore = runtimeStore.subscribeTopic(topicKey, onRuntimeStoreChange);
1212
1228
  };
1213
1229
  const refreshSnapshotIfStale = () => {
1214
- if (currentState === void 0) {
1215
- return;
1216
- }
1230
+ if (!hasSnapshot) return;
1217
1231
  try {
1218
- const latest = runtime.runSync(moduleRuntime.getState);
1219
- if (currentState === void 0 || !Object.is(currentState, latest)) {
1220
- currentState = latest;
1221
- scheduleNotify("normal");
1232
+ const version = runtimeStore.getTopicVersion(topicKey);
1233
+ if (currentVersion !== version) {
1234
+ scheduleNotify(runtimeStore.getTopicPriority(topicKey));
1222
1235
  }
1223
1236
  } catch {
1224
1237
  }
1225
1238
  };
1226
1239
  const getSnapshot = () => {
1227
- if (currentState !== void 0) return currentState;
1228
- currentState = runtime.runSync(moduleRuntime.getState);
1229
- return currentState;
1240
+ const version = runtimeStore.getTopicVersion(topicKey);
1241
+ if (hasSnapshot && currentVersion === version) {
1242
+ return currentSnapshot;
1243
+ }
1244
+ const next = args.readSnapshot();
1245
+ currentVersion = version;
1246
+ hasSnapshot = true;
1247
+ currentSnapshot = next;
1248
+ return next;
1230
1249
  };
1231
1250
  const subscribe = (listener) => {
1251
+ const isFirst = listeners.size === 0;
1232
1252
  listeners.add(listener);
1233
1253
  ensureSubscription();
1234
1254
  refreshSnapshotIfStale();
1255
+ if (isFirst) {
1256
+ try {
1257
+ args.onFirstListener?.();
1258
+ } catch {
1259
+ }
1260
+ }
1235
1261
  return () => {
1236
1262
  listeners.delete(listener);
1237
1263
  if (listeners.size > 0) return;
1238
- const running = fiber;
1239
- if (!running) return;
1240
- fiber = void 0;
1264
+ try {
1265
+ args.onLastListener?.();
1266
+ } catch {
1267
+ }
1268
+ const unsub = unsubscribeFromRuntimeStore;
1269
+ unsubscribeFromRuntimeStore = void 0;
1241
1270
  cancelLow();
1242
- runtime.runFork(import_effect6.Fiber.interrupt(running));
1271
+ try {
1272
+ unsub?.();
1273
+ } catch {
1274
+ }
1275
+ removeStore(runtime, topicKey);
1243
1276
  };
1244
1277
  };
1245
- const store = { getSnapshot, subscribe };
1246
- byModule.set(moduleRuntime, store);
1247
- return store;
1278
+ return { getSnapshot, getServerSnapshot: getSnapshot, subscribe };
1279
+ };
1280
+ var getRuntimeModuleExternalStore = (runtime, moduleRuntime, options) => {
1281
+ const moduleInstanceKey = makeModuleInstanceKey(moduleRuntime.moduleId, moduleRuntime.instanceId);
1282
+ const runtimeStore = getRuntimeStore(runtime);
1283
+ return getOrCreateStore(
1284
+ runtime,
1285
+ moduleInstanceKey,
1286
+ () => makeTopicExternalStore({
1287
+ runtime,
1288
+ runtimeStore,
1289
+ topicKey: moduleInstanceKey,
1290
+ readSnapshot: () => {
1291
+ const state = runtimeStore.getModuleState(moduleInstanceKey);
1292
+ if (state !== void 0) return state;
1293
+ return runtime.runSync(moduleRuntime.getState);
1294
+ },
1295
+ options
1296
+ })
1297
+ );
1298
+ };
1299
+ var getRuntimeReadQueryExternalStore = (runtime, moduleRuntime, selectorReadQuery, options) => {
1300
+ const moduleInstanceKey = makeModuleInstanceKey(moduleRuntime.moduleId, moduleRuntime.instanceId);
1301
+ const topicKey = makeReadQueryTopicKey(moduleInstanceKey, selectorReadQuery.selectorId);
1302
+ const runtimeStore = getRuntimeStore(runtime);
1303
+ let readQueryDrainFiber;
1304
+ return getOrCreateStore(
1305
+ runtime,
1306
+ topicKey,
1307
+ () => makeTopicExternalStore({
1308
+ runtime,
1309
+ runtimeStore,
1310
+ topicKey,
1311
+ readSnapshot: () => {
1312
+ const state = runtimeStore.getModuleState(moduleInstanceKey);
1313
+ const current = state ?? runtime.runSync(moduleRuntime.getState);
1314
+ return selectorReadQuery.select(current);
1315
+ },
1316
+ options,
1317
+ onFirstListener: () => {
1318
+ if (readQueryDrainFiber) return;
1319
+ const effect = import_effect6.Stream.runDrain(moduleRuntime.changesReadQueryWithMeta(selectorReadQuery));
1320
+ readQueryDrainFiber = runtime.runFork(effect);
1321
+ },
1322
+ onLastListener: () => {
1323
+ const fiber = readQueryDrainFiber;
1324
+ if (!fiber) return;
1325
+ readQueryDrainFiber = void 0;
1326
+ runtime.runFork(import_effect6.Fiber.interrupt(fiber));
1327
+ }
1328
+ })
1329
+ );
1248
1330
  };
1249
-
1250
- // src/internal/store/ModuleRuntimeSelectorExternalStore.ts
1251
- var import_effect7 = require("effect");
1252
1331
 
1253
1332
  // src/internal/hooks/shallow.ts
1254
1333
  var hasObjectShape = (value) => typeof value === "object" && value !== null;
@@ -1300,146 +1379,6 @@ var shallow = (previous, next) => {
1300
1379
  return true;
1301
1380
  };
1302
1381
 
1303
- // src/internal/store/ModuleRuntimeSelectorExternalStore.ts
1304
- var storesByRuntime2 = /* @__PURE__ */ new WeakMap();
1305
- var getStoreMapForRuntime2 = (runtime) => {
1306
- const cached = storesByRuntime2.get(runtime);
1307
- if (cached) return cached;
1308
- const next = /* @__PURE__ */ new WeakMap();
1309
- storesByRuntime2.set(runtime, next);
1310
- return next;
1311
- };
1312
- var getOrCreateSelectorMapForModule = (byModule, moduleRuntime) => {
1313
- const cached = byModule.get(moduleRuntime);
1314
- if (cached) return cached;
1315
- const next = /* @__PURE__ */ new Map();
1316
- byModule.set(moduleRuntime, next);
1317
- return next;
1318
- };
1319
- var equalsValue = (readQuery, a, b) => {
1320
- if (readQuery.equalsKind === "custom" && typeof readQuery.equals === "function") {
1321
- return readQuery.equals(a, b);
1322
- }
1323
- if (readQuery.equalsKind === "shallowStruct") {
1324
- return shallow(a, b);
1325
- }
1326
- return Object.is(a, b);
1327
- };
1328
- var getModuleRuntimeSelectorExternalStore = (runtime, moduleRuntime, selectorReadQuery, options) => {
1329
- const byModule = getStoreMapForRuntime2(runtime);
1330
- const bySelector = getOrCreateSelectorMapForModule(byModule, moduleRuntime);
1331
- const cached = bySelector.get(selectorReadQuery.selectorId);
1332
- if (cached) {
1333
- return cached;
1334
- }
1335
- let currentValue;
1336
- const listeners = /* @__PURE__ */ new Set();
1337
- const lowPriorityDelayMs = options?.lowPriorityDelayMs ?? 16;
1338
- const lowPriorityMaxDelayMs = options?.lowPriorityMaxDelayMs ?? 50;
1339
- let notifyScheduled = false;
1340
- let notifyScheduledLow = false;
1341
- let lowTimeoutId;
1342
- let lowMaxTimeoutId;
1343
- let lowRafId;
1344
- const cancelLow = () => {
1345
- if (!notifyScheduledLow) return;
1346
- notifyScheduledLow = false;
1347
- if (lowTimeoutId != null) {
1348
- clearTimeout(lowTimeoutId);
1349
- lowTimeoutId = void 0;
1350
- }
1351
- if (lowMaxTimeoutId != null) {
1352
- clearTimeout(lowMaxTimeoutId);
1353
- lowMaxTimeoutId = void 0;
1354
- }
1355
- const cancel = globalThis.cancelAnimationFrame;
1356
- if (cancel && typeof lowRafId === "number") {
1357
- cancel(lowRafId);
1358
- lowRafId = void 0;
1359
- }
1360
- };
1361
- const flushNotify = () => {
1362
- notifyScheduled = false;
1363
- cancelLow();
1364
- for (const listener of listeners) {
1365
- listener();
1366
- }
1367
- };
1368
- const scheduleNotify = (priority) => {
1369
- if (priority === "low") {
1370
- if (notifyScheduled) return;
1371
- if (notifyScheduledLow) return;
1372
- notifyScheduledLow = true;
1373
- const flush = () => {
1374
- if (!notifyScheduledLow) return;
1375
- flushNotify();
1376
- };
1377
- const raf = globalThis.requestAnimationFrame;
1378
- if (raf) {
1379
- lowRafId = raf(flush);
1380
- } else {
1381
- lowTimeoutId = setTimeout(flush, lowPriorityDelayMs);
1382
- }
1383
- lowMaxTimeoutId = setTimeout(flush, lowPriorityMaxDelayMs);
1384
- return;
1385
- }
1386
- cancelLow();
1387
- if (notifyScheduled) return;
1388
- notifyScheduled = true;
1389
- queueMicrotask(flushNotify);
1390
- };
1391
- let fiber;
1392
- const ensureSubscription = () => {
1393
- if (fiber) return;
1394
- fiber = runtime.runFork(
1395
- import_effect7.Stream.runForEach(
1396
- moduleRuntime.changesReadQueryWithMeta(selectorReadQuery),
1397
- ({ value, meta }) => import_effect7.Effect.sync(() => {
1398
- currentValue = value;
1399
- scheduleNotify(meta.priority);
1400
- })
1401
- )
1402
- );
1403
- };
1404
- const refreshSnapshotIfStale = () => {
1405
- if (currentValue === void 0) {
1406
- return;
1407
- }
1408
- try {
1409
- const state = runtime.runSync(moduleRuntime.getState);
1410
- const next = selectorReadQuery.select(state);
1411
- if (currentValue === void 0 || !equalsValue(selectorReadQuery, currentValue, next)) {
1412
- currentValue = next;
1413
- scheduleNotify("normal");
1414
- }
1415
- } catch {
1416
- }
1417
- };
1418
- const getSnapshot = () => {
1419
- if (currentValue !== void 0) return currentValue;
1420
- const state = runtime.runSync(moduleRuntime.getState);
1421
- currentValue = selectorReadQuery.select(state);
1422
- return currentValue;
1423
- };
1424
- const subscribe = (listener) => {
1425
- listeners.add(listener);
1426
- ensureSubscription();
1427
- refreshSnapshotIfStale();
1428
- return () => {
1429
- listeners.delete(listener);
1430
- if (listeners.size > 0) return;
1431
- const running = fiber;
1432
- if (!running) return;
1433
- fiber = void 0;
1434
- cancelLow();
1435
- runtime.runFork(import_effect7.Fiber.interrupt(running));
1436
- };
1437
- };
1438
- const store = { getSnapshot, subscribe };
1439
- bySelector.set(selectorReadQuery.selectorId, store);
1440
- return store;
1441
- };
1442
-
1443
1382
  // src/internal/hooks/useSelector.ts
1444
1383
  function useSelector(handle, selector, equalityFn) {
1445
1384
  const runtimeContext = (0, import_react5.useContext)(RuntimeContext);
@@ -1450,7 +1389,7 @@ function useSelector(handle, selector, equalityFn) {
1450
1389
  const moduleRuntime = useModuleRuntime(handle);
1451
1390
  const actualSelector = selector ?? ((state) => state);
1452
1391
  const selectorReadQuery = (0, import_react5.useMemo)(
1453
- () => typeof selector === "function" ? Logix5.ReadQuery.compile(selector) : void 0,
1392
+ () => typeof selector === "function" ? Logix6.ReadQuery.compile(selector) : void 0,
1454
1393
  [selector]
1455
1394
  );
1456
1395
  const actualEqualityFn = (0, import_react5.useMemo)(() => {
@@ -1458,17 +1397,12 @@ function useSelector(handle, selector, equalityFn) {
1458
1397
  if (typeof selector !== "function") return Object.is;
1459
1398
  return selectorReadQuery?.equalsKind === "shallowStruct" ? shallow : Object.is;
1460
1399
  }, [equalityFn, selector, selectorReadQuery?.equalsKind]);
1461
- const useStaticLane = typeof selector === "function" && selectorReadQuery?.lane === "static";
1400
+ const selectorTopicEligible = typeof selector === "function" && selectorReadQuery?.lane === "static" && selectorReadQuery.readsDigest != null && selectorReadQuery.fallbackReason == null;
1462
1401
  const store = (0, import_react5.useMemo)(
1463
- () => useStaticLane && selectorReadQuery ? getModuleRuntimeSelectorExternalStore(
1464
- runtime,
1465
- moduleRuntime,
1466
- selectorReadQuery,
1467
- {
1468
- lowPriorityDelayMs: runtimeContext.reactConfigSnapshot.lowPriorityDelayMs,
1469
- lowPriorityMaxDelayMs: runtimeContext.reactConfigSnapshot.lowPriorityMaxDelayMs
1470
- }
1471
- ) : getModuleRuntimeExternalStore(
1402
+ () => selectorTopicEligible && selectorReadQuery ? getRuntimeReadQueryExternalStore(runtime, moduleRuntime, selectorReadQuery, {
1403
+ lowPriorityDelayMs: runtimeContext.reactConfigSnapshot.lowPriorityDelayMs,
1404
+ lowPriorityMaxDelayMs: runtimeContext.reactConfigSnapshot.lowPriorityMaxDelayMs
1405
+ }) : getRuntimeModuleExternalStore(
1472
1406
  runtime,
1473
1407
  moduleRuntime,
1474
1408
  {
@@ -1482,18 +1416,18 @@ function useSelector(handle, selector, equalityFn) {
1482
1416
  runtimeContext.reactConfigSnapshot.lowPriorityDelayMs,
1483
1417
  runtimeContext.reactConfigSnapshot.lowPriorityMaxDelayMs,
1484
1418
  selectorReadQuery,
1485
- useStaticLane
1419
+ selectorTopicEligible
1486
1420
  ]
1487
1421
  );
1488
1422
  const selected = (0, import_with_selector.useSyncExternalStoreWithSelector)(
1489
1423
  store.subscribe,
1490
1424
  store.getSnapshot,
1491
- store.getSnapshot,
1492
- useStaticLane ? (snapshot) => snapshot : (snapshot) => actualSelector(snapshot),
1425
+ store.getServerSnapshot ?? store.getSnapshot,
1426
+ selectorTopicEligible ? (snapshot) => snapshot : (snapshot) => actualSelector(snapshot),
1493
1427
  actualEqualityFn
1494
1428
  );
1495
1429
  (0, import_react5.useEffect)(() => {
1496
- if (!(0, import_Env.isDevEnv)() && !Logix5.Debug.isDevtoolsEnabled()) {
1430
+ if (!(0, import_Env.isDevEnv)() && !Logix6.Debug.isDevtoolsEnabled()) {
1497
1431
  return;
1498
1432
  }
1499
1433
  const instanceId = moduleRuntime.instanceId;
@@ -1509,7 +1443,7 @@ function useSelector(handle, selector, equalityFn) {
1509
1443
  const rawDebugKey = meta.debugKey;
1510
1444
  selectorKey = typeof rawDebugKey === "string" && rawDebugKey.length > 0 ? rawDebugKey : typeof selector.name === "string" && selector.name.length > 0 ? selector.name : void 0;
1511
1445
  }
1512
- const effect = Logix5.Debug.record({
1446
+ const effect = Logix6.Debug.record({
1513
1447
  type: "trace:react-selector",
1514
1448
  moduleId: moduleRuntime.moduleId,
1515
1449
  instanceId,
@@ -1532,7 +1466,7 @@ function useSelector(handle, selector, equalityFn) {
1532
1466
  }
1533
1467
 
1534
1468
  // src/internal/store/resolveImportedModuleRef.ts
1535
- var Logix6 = __toESM(require("@logixjs/core"), 1);
1469
+ var Logix7 = __toESM(require("@logixjs/core"), 1);
1536
1470
  var getOrCreateWeakMap = (map, key, make) => {
1537
1471
  const cached = map.get(key);
1538
1472
  if (cached) return cached;
@@ -1556,7 +1490,7 @@ var resolveImportedModuleRef = (runtime, parentRuntime, module2) => {
1556
1490
  if (cached) {
1557
1491
  return cached;
1558
1492
  }
1559
- const importsScope = Logix6.InternalContracts.getImportsScope(parentRuntime);
1493
+ const importsScope = Logix7.InternalContracts.getImportsScope(parentRuntime);
1560
1494
  const childRuntime = importsScope.get(module2);
1561
1495
  if (childRuntime) {
1562
1496
  const dispatch = Object.assign(
@@ -1642,8 +1576,8 @@ var useStableId = () => {
1642
1576
 
1643
1577
  // src/internal/hooks/useModule.ts
1644
1578
  var isModuleImpl = (handle) => Boolean(handle) && typeof handle === "object" && handle._tag === "ModuleImpl";
1645
- var isModule = (handle) => Logix7.Module.hasImpl(handle);
1646
- var isModuleDef = (handle) => Logix7.Module.is(handle) && handle._kind === "ModuleDef";
1579
+ var isModule = (handle) => Logix8.Module.hasImpl(handle);
1580
+ var isModuleDef = (handle) => Logix8.Module.is(handle) && handle._kind === "ModuleDef";
1647
1581
  function useModule(handle, selectorOrOptions, equalityFn) {
1648
1582
  const runtimeBase = useRuntime();
1649
1583
  const runtimeContext = import_react7.default.useContext(RuntimeContext);
@@ -1695,9 +1629,9 @@ function useModule(handle, selectorOrOptions, equalityFn) {
1695
1629
  const key = depsHash ? `${baseKey}:${depsHash}` : baseKey;
1696
1630
  const ownerId = moduleId;
1697
1631
  const baseFactory = import_react7.default.useMemo(
1698
- () => (scope) => import_effect8.Layer.buildWithScope(normalizedHandle.layer, scope).pipe(
1699
- import_effect8.Effect.map(
1700
- (context) => import_effect8.Context.get(context, normalizedHandle.module)
1632
+ () => (scope) => import_effect7.Layer.buildWithScope(normalizedHandle.layer, scope).pipe(
1633
+ import_effect7.Effect.map(
1634
+ (context) => import_effect7.Context.get(context, normalizedHandle.module)
1701
1635
  )
1702
1636
  ),
1703
1637
  [normalizedHandle]
@@ -1707,7 +1641,7 @@ function useModule(handle, selectorOrOptions, equalityFn) {
1707
1641
  return baseFactory;
1708
1642
  }
1709
1643
  return (scope) => baseFactory(scope).pipe(
1710
- import_effect8.Effect.timeoutFail({
1644
+ import_effect7.Effect.timeoutFail({
1711
1645
  duration: initTimeoutMs,
1712
1646
  onTimeout: () => new Error(`[useModule] Module "${ownerId}" initialization timed out after ${initTimeoutMs}ms`)
1713
1647
  })
@@ -1736,7 +1670,7 @@ function useModule(handle, selectorOrOptions, equalityFn) {
1736
1670
  if (!label) {
1737
1671
  return;
1738
1672
  }
1739
- const effect = Logix7.Debug.record({
1673
+ const effect = Logix8.Debug.record({
1740
1674
  type: "trace:instanceLabel",
1741
1675
  moduleId: normalizedHandle.module.id,
1742
1676
  instanceId: runtime.instanceId,
@@ -1745,13 +1679,13 @@ function useModule(handle, selectorOrOptions, equalityFn) {
1745
1679
  runtimeBase.runFork(effect);
1746
1680
  }, [runtimeBase, runtime, normalizedHandle, options]);
1747
1681
  import_react7.default.useEffect(() => {
1748
- if (!(0, import_Env.isDevEnv)() && !Logix7.Debug.isDevtoolsEnabled()) {
1682
+ if (!(0, import_Env.isDevEnv)() && !Logix8.Debug.isDevtoolsEnabled()) {
1749
1683
  return;
1750
1684
  }
1751
1685
  if (!runtime.instanceId) {
1752
1686
  return;
1753
1687
  }
1754
- const effect = Logix7.Debug.record({
1688
+ const effect = Logix8.Debug.record({
1755
1689
  type: "trace:react-render",
1756
1690
  moduleId: runtime.moduleId,
1757
1691
  instanceId: runtime.instanceId,
@@ -1848,12 +1782,12 @@ function useModule(handle, selectorOrOptions, equalityFn) {
1848
1782
 
1849
1783
  // src/internal/provider/RuntimeProvider.tsx
1850
1784
  var import_react9 = __toESM(require("react"), 1);
1851
- var import_effect10 = require("effect");
1852
- var Logix9 = __toESM(require("@logixjs/core"), 1);
1785
+ var import_effect9 = require("effect");
1786
+ var Logix10 = __toESM(require("@logixjs/core"), 1);
1853
1787
 
1854
1788
  // src/internal/provider/config.ts
1855
- var import_effect9 = require("effect");
1856
- var ReactRuntimeConfigTag = class extends import_effect9.Context.Tag("@logixjs/react/RuntimeConfig")() {
1789
+ var import_effect8 = require("effect");
1790
+ var ReactRuntimeConfigTag = class extends import_effect8.Context.Tag("@logixjs/react/RuntimeConfig")() {
1857
1791
  };
1858
1792
  var DEFAULT_CONFIG = {
1859
1793
  gcTime: 500,
@@ -1874,58 +1808,58 @@ var ReactModuleConfigFromEnv = {
1874
1808
  * - Applies when not explicitly specified in useModule(options.gcTime).
1875
1809
  * - Default: 500ms (StrictMode jitter protection).
1876
1810
  */
1877
- gcTime: import_effect9.Config.number("logix.react.gc_time").pipe(import_effect9.Config.withDefault(DEFAULT_CONFIG.gcTime)),
1811
+ gcTime: import_effect8.Config.number("logix.react.gc_time").pipe(import_effect8.Config.withDefault(DEFAULT_CONFIG.gcTime)),
1878
1812
  /**
1879
1813
  * Default init timeout (ms), only effective when suspend:true.
1880
1814
  * - Uses Option<number> to represent "optional config": missing means init timeout is disabled.
1881
1815
  * - Callers can map Option.none to undefined.
1882
1816
  */
1883
- initTimeoutMs: import_effect9.Config.option(import_effect9.Config.number("logix.react.init_timeout_ms")),
1817
+ initTimeoutMs: import_effect8.Config.option(import_effect8.Config.number("logix.react.init_timeout_ms")),
1884
1818
  /**
1885
1819
  * Delay (ms) for low-priority notification scheduling.
1886
1820
  * - Roughly "defer to the next frame" cadence (default 16ms).
1887
1821
  */
1888
- lowPriorityDelayMs: import_effect9.Config.number("logix.react.low_priority_delay_ms").pipe(
1889
- import_effect9.Config.withDefault(DEFAULT_CONFIG.lowPriorityDelayMs ?? 16)
1822
+ lowPriorityDelayMs: import_effect8.Config.number("logix.react.low_priority_delay_ms").pipe(
1823
+ import_effect8.Config.withDefault(DEFAULT_CONFIG.lowPriorityDelayMs ?? 16)
1890
1824
  ),
1891
1825
  /**
1892
1826
  * Maximum delay upper bound (ms) for low-priority notification scheduling.
1893
1827
  * - Ensures eventual delivery, avoiding indefinite coalescing under extreme high-frequency scenarios.
1894
1828
  * - Default 50ms.
1895
1829
  */
1896
- lowPriorityMaxDelayMs: import_effect9.Config.number("logix.react.low_priority_max_delay_ms").pipe(
1897
- import_effect9.Config.withDefault(DEFAULT_CONFIG.lowPriorityMaxDelayMs ?? 50)
1830
+ lowPriorityMaxDelayMs: import_effect8.Config.number("logix.react.low_priority_max_delay_ms").pipe(
1831
+ import_effect8.Config.withDefault(DEFAULT_CONFIG.lowPriorityMaxDelayMs ?? 50)
1898
1832
  )
1899
1833
  };
1900
1834
  var ReactModuleConfig = {
1901
- gcTime: import_effect9.Effect.gen(function* () {
1902
- const override = yield* import_effect9.Effect.serviceOption(ReactRuntimeConfigTag);
1903
- if (import_effect9.Option.isSome(override)) {
1835
+ gcTime: import_effect8.Effect.gen(function* () {
1836
+ const override = yield* import_effect8.Effect.serviceOption(ReactRuntimeConfigTag);
1837
+ if (import_effect8.Option.isSome(override)) {
1904
1838
  return override.value.gcTime;
1905
1839
  }
1906
1840
  const value = yield* ReactModuleConfigFromEnv.gcTime;
1907
1841
  return value;
1908
1842
  }),
1909
- initTimeoutMs: import_effect9.Effect.gen(function* () {
1910
- const override = yield* import_effect9.Effect.serviceOption(ReactRuntimeConfigTag);
1911
- if (import_effect9.Option.isSome(override)) {
1843
+ initTimeoutMs: import_effect8.Effect.gen(function* () {
1844
+ const override = yield* import_effect8.Effect.serviceOption(ReactRuntimeConfigTag);
1845
+ if (import_effect8.Option.isSome(override)) {
1912
1846
  const v = override.value.initTimeoutMs;
1913
- return v === void 0 ? import_effect9.Option.none() : import_effect9.Option.some(v);
1847
+ return v === void 0 ? import_effect8.Option.none() : import_effect8.Option.some(v);
1914
1848
  }
1915
1849
  const opt = yield* ReactModuleConfigFromEnv.initTimeoutMs;
1916
1850
  return opt;
1917
1851
  }),
1918
- lowPriorityDelayMs: import_effect9.Effect.gen(function* () {
1919
- const override = yield* import_effect9.Effect.serviceOption(ReactRuntimeConfigTag);
1920
- if (import_effect9.Option.isSome(override)) {
1852
+ lowPriorityDelayMs: import_effect8.Effect.gen(function* () {
1853
+ const override = yield* import_effect8.Effect.serviceOption(ReactRuntimeConfigTag);
1854
+ if (import_effect8.Option.isSome(override)) {
1921
1855
  return override.value.lowPriorityDelayMs ?? DEFAULT_CONFIG.lowPriorityDelayMs ?? 16;
1922
1856
  }
1923
1857
  const value = yield* ReactModuleConfigFromEnv.lowPriorityDelayMs;
1924
1858
  return value;
1925
1859
  }),
1926
- lowPriorityMaxDelayMs: import_effect9.Effect.gen(function* () {
1927
- const override = yield* import_effect9.Effect.serviceOption(ReactRuntimeConfigTag);
1928
- if (import_effect9.Option.isSome(override)) {
1860
+ lowPriorityMaxDelayMs: import_effect8.Effect.gen(function* () {
1861
+ const override = yield* import_effect8.Effect.serviceOption(ReactRuntimeConfigTag);
1862
+ if (import_effect8.Option.isSome(override)) {
1929
1863
  return override.value.lowPriorityMaxDelayMs ?? DEFAULT_CONFIG.lowPriorityMaxDelayMs ?? 50;
1930
1864
  }
1931
1865
  const value = yield* ReactModuleConfigFromEnv.lowPriorityMaxDelayMs;
@@ -1933,9 +1867,9 @@ var ReactModuleConfig = {
1933
1867
  })
1934
1868
  };
1935
1869
  var ReactRuntimeConfigSnapshot = {
1936
- load: import_effect9.Effect.gen(function* () {
1937
- const runtimeOverride = yield* import_effect9.Effect.serviceOption(ReactRuntimeConfigTag);
1938
- if (import_effect9.Option.isSome(runtimeOverride)) {
1870
+ load: import_effect8.Effect.gen(function* () {
1871
+ const runtimeOverride = yield* import_effect8.Effect.serviceOption(ReactRuntimeConfigTag);
1872
+ if (import_effect8.Option.isSome(runtimeOverride)) {
1939
1873
  return {
1940
1874
  gcTime: runtimeOverride.value.gcTime,
1941
1875
  initTimeoutMs: runtimeOverride.value.initTimeoutMs,
@@ -1946,10 +1880,10 @@ var ReactRuntimeConfigSnapshot = {
1946
1880
  }
1947
1881
  const envGcTime = yield* ReactModuleConfigFromEnv.gcTime;
1948
1882
  const envInitTimeoutOpt = yield* ReactModuleConfigFromEnv.initTimeoutMs;
1949
- const envInitTimeout = import_effect9.Option.getOrUndefined(envInitTimeoutOpt);
1883
+ const envInitTimeout = import_effect8.Option.getOrUndefined(envInitTimeoutOpt);
1950
1884
  const envLowPriorityDelayMs = yield* ReactModuleConfigFromEnv.lowPriorityDelayMs;
1951
1885
  const envLowPriorityMaxDelayMs = yield* ReactModuleConfigFromEnv.lowPriorityMaxDelayMs;
1952
- const fromConfig = envGcTime !== DEFAULT_CONFIG.gcTime || import_effect9.Option.isSome(envInitTimeoutOpt) || envLowPriorityDelayMs !== (DEFAULT_CONFIG.lowPriorityDelayMs ?? 16) || envLowPriorityMaxDelayMs !== (DEFAULT_CONFIG.lowPriorityMaxDelayMs ?? 50);
1886
+ const fromConfig = envGcTime !== DEFAULT_CONFIG.gcTime || import_effect8.Option.isSome(envInitTimeoutOpt) || envLowPriorityDelayMs !== (DEFAULT_CONFIG.lowPriorityDelayMs ?? 16) || envLowPriorityMaxDelayMs !== (DEFAULT_CONFIG.lowPriorityMaxDelayMs ?? 50);
1953
1887
  if (fromConfig) {
1954
1888
  return {
1955
1889
  gcTime: envGcTime,
@@ -1965,7 +1899,7 @@ var ReactRuntimeConfigSnapshot = {
1965
1899
 
1966
1900
  // src/internal/provider/fallback.tsx
1967
1901
  var import_react8 = require("react");
1968
- var Logix8 = __toESM(require("@logixjs/core"), 1);
1902
+ var Logix9 = __toESM(require("@logixjs/core"), 1);
1969
1903
 
1970
1904
  // src/internal/provider/docs.ts
1971
1905
  var LOGIX_DOCS_PREFIX_ENV = "LOGIX_DOCS_PREFIX";
@@ -2068,11 +2002,11 @@ var resolveRuntimeProviderFallback = (args) => {
2068
2002
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultRuntimeFallback, { phase: args.phase, policyMode: args.policyMode });
2069
2003
  };
2070
2004
  var recordFallbackDuration = (args) => {
2071
- if (!(0, import_Env.isDevEnv)() && !Logix8.Debug.isDevtoolsEnabled()) {
2005
+ if (!(0, import_Env.isDevEnv)() && !Logix9.Debug.isDevtoolsEnabled()) {
2072
2006
  return;
2073
2007
  }
2074
2008
  void args.runtime.runPromise(
2075
- Logix8.Debug.record({
2009
+ Logix9.Debug.record({
2076
2010
  type: "trace:react.fallback.duration",
2077
2011
  data: {
2078
2012
  phase: args.phase,
@@ -2151,7 +2085,7 @@ var FallbackProbeEnabled = ({ runtime, phase, policyMode, blockers, children })
2151
2085
  };
2152
2086
  var FallbackProbeNoop = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
2153
2087
  var FallbackProbe = (props) => {
2154
- const enabled = (0, import_Env.isDevEnv)() || Logix8.Debug.isDevtoolsEnabled();
2088
+ const enabled = (0, import_Env.isDevEnv)() || Logix9.Debug.isDevtoolsEnabled();
2155
2089
  const Impl = enabled ? FallbackProbeEnabled : FallbackProbeNoop;
2156
2090
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Impl, { ...props });
2157
2091
  };
@@ -2243,6 +2177,20 @@ var RuntimeProvider = ({
2243
2177
  );
2244
2178
  const onErrorRef = import_react9.default.useRef(onError);
2245
2179
  onErrorRef.current = onError;
2180
+ const hasTickServices = (0, import_react9.useMemo)(() => {
2181
+ try {
2182
+ Logix10.InternalContracts.getRuntimeStore(baseRuntime);
2183
+ return true;
2184
+ } catch {
2185
+ return false;
2186
+ }
2187
+ }, [baseRuntime]);
2188
+ const { binding: tickBinding } = useLayerBinding(
2189
+ baseRuntime,
2190
+ Logix10.InternalContracts.tickServicesLayer,
2191
+ !hasTickServices,
2192
+ onErrorRef.current
2193
+ );
2246
2194
  const { binding: layerBinding } = useLayerBinding(baseRuntime, layer, Boolean(layer), onErrorRef.current);
2247
2195
  const onErrorSink = (0, import_react9.useMemo)(() => {
2248
2196
  if (!onError) return null;
@@ -2250,7 +2198,7 @@ var RuntimeProvider = ({
2250
2198
  record: (event) => {
2251
2199
  const handler = onErrorRef.current;
2252
2200
  if (!handler) {
2253
- return import_effect10.Effect.void;
2201
+ return import_effect9.Effect.void;
2254
2202
  }
2255
2203
  if (event.type === "lifecycle:error") {
2256
2204
  return handler(event.cause, {
@@ -2259,11 +2207,11 @@ var RuntimeProvider = ({
2259
2207
  moduleId: event.moduleId,
2260
2208
  instanceId: event.instanceId,
2261
2209
  runtimeLabel: event.runtimeLabel
2262
- }).pipe(import_effect10.Effect.catchAllCause(() => import_effect10.Effect.void));
2210
+ }).pipe(import_effect9.Effect.catchAllCause(() => import_effect9.Effect.void));
2263
2211
  }
2264
2212
  if (event.type === "diagnostic" && event.severity === "error") {
2265
2213
  return handler(
2266
- import_effect10.Cause.fail({
2214
+ import_effect9.Cause.fail({
2267
2215
  code: event.code,
2268
2216
  message: event.message,
2269
2217
  hint: event.hint
@@ -2278,9 +2226,9 @@ var RuntimeProvider = ({
2278
2226
  instanceId: event.instanceId,
2279
2227
  runtimeLabel: event.runtimeLabel
2280
2228
  }
2281
- ).pipe(import_effect10.Effect.catchAllCause(() => import_effect10.Effect.void));
2229
+ ).pipe(import_effect9.Effect.catchAllCause(() => import_effect9.Effect.void));
2282
2230
  }
2283
- return import_effect10.Effect.void;
2231
+ return import_effect9.Effect.void;
2284
2232
  }
2285
2233
  };
2286
2234
  return sink;
@@ -2294,24 +2242,24 @@ var RuntimeProvider = ({
2294
2242
  }
2295
2243
  try {
2296
2244
  return baseRuntime.runSync(
2297
- import_effect10.FiberRef.get(Logix9.Debug.internal.currentDebugSinks)
2245
+ import_effect9.FiberRef.get(Logix10.Debug.internal.currentDebugSinks)
2298
2246
  );
2299
2247
  } catch {
2300
2248
  return [];
2301
2249
  }
2302
2250
  }, [baseRuntime, layerBinding, onErrorSink]);
2303
2251
  const runtimeWithBindings = (0, import_react9.useMemo)(
2304
- () => layerBinding || onErrorSink ? createRuntimeAdapter(
2252
+ () => tickBinding || layerBinding || onErrorSink ? createRuntimeAdapter(
2305
2253
  baseRuntime,
2306
- layerBinding ? [layerBinding.context] : [],
2307
- layerBinding ? [layerBinding.scope] : [],
2308
- layerBinding ? [layerBinding.loggers] : [],
2309
- layerBinding ? [layerBinding.logLevel] : [],
2254
+ [...tickBinding ? [tickBinding.context] : [], ...layerBinding ? [layerBinding.context] : []],
2255
+ [...tickBinding ? [tickBinding.scope] : [], ...layerBinding ? [layerBinding.scope] : []],
2256
+ layerBinding ? [layerBinding.loggers] : tickBinding ? [tickBinding.loggers] : [],
2257
+ layerBinding ? [layerBinding.logLevel] : tickBinding ? [tickBinding.logLevel] : [],
2310
2258
  [
2311
2259
  onErrorSink ? [onErrorSink, ...inheritedDebugSinks] : layerBinding ? layerBinding.debugSinks : []
2312
2260
  ]
2313
2261
  ) : baseRuntime,
2314
- [baseRuntime, inheritedDebugSinks, layerBinding, onErrorSink]
2262
+ [baseRuntime, inheritedDebugSinks, layerBinding, onErrorSink, tickBinding]
2315
2263
  );
2316
2264
  const didReportSyncConfigSnapshotRef = import_react9.default.useRef(false);
2317
2265
  const [configState, setConfigState] = (0, import_react9.useState)(() => {
@@ -2353,7 +2301,7 @@ var RuntimeProvider = ({
2353
2301
  }
2354
2302
  didReportSyncConfigSnapshotRef.current = true;
2355
2303
  void runtimeWithBindings.runPromise(
2356
- Logix9.Debug.record({
2304
+ Logix10.Debug.record({
2357
2305
  type: "trace:react.runtime.config.snapshot",
2358
2306
  data: {
2359
2307
  source: configState.snapshot.source,
@@ -2384,7 +2332,7 @@ var RuntimeProvider = ({
2384
2332
  };
2385
2333
  });
2386
2334
  void runtimeWithBindings.runPromise(
2387
- Logix9.Debug.record({
2335
+ Logix10.Debug.record({
2388
2336
  type: "trace:react.runtime.config.snapshot",
2389
2337
  data: {
2390
2338
  source: snapshot.source,
@@ -2416,6 +2364,7 @@ var RuntimeProvider = ({
2416
2364
  }),
2417
2365
  [runtimeWithBindings, configState, resolvedPolicy]
2418
2366
  );
2367
+ const isTickServicesReady = hasTickServices || tickBinding !== null;
2419
2368
  const isLayerReady = !layer || layerBinding !== null;
2420
2369
  const isConfigReady = configState.loaded;
2421
2370
  const resolveFallback = (phase) => {
@@ -2460,8 +2409,8 @@ var RuntimeProvider = ({
2460
2409
  if (handle?._tag === "ModuleImpl") {
2461
2410
  const moduleId = handle.module?.id ?? "ModuleImpl";
2462
2411
  const key2 = resolvedPolicy.preload.keysByModuleId.get(moduleId) ?? getPreloadKeyForModuleId(moduleId);
2463
- const factory2 = (scope) => import_effect10.Layer.buildWithScope(handle.layer, scope).pipe(
2464
- import_effect10.Effect.map((context) => import_effect10.Context.get(context, handle.module))
2412
+ const factory2 = (scope) => import_effect9.Layer.buildWithScope(handle.layer, scope).pipe(
2413
+ import_effect9.Effect.map((context) => import_effect9.Context.get(context, handle.module))
2465
2414
  );
2466
2415
  const op2 = cache.preload(key2, factory2, {
2467
2416
  ownerId: moduleId,
@@ -2473,7 +2422,7 @@ var RuntimeProvider = ({
2473
2422
  await op2.promise;
2474
2423
  const durationMs2 = performance.now() - startedAt;
2475
2424
  void runtimeWithBindings.runPromise(
2476
- Logix9.Debug.record({
2425
+ Logix10.Debug.record({
2477
2426
  type: "trace:react.module.preload",
2478
2427
  moduleId,
2479
2428
  data: {
@@ -2493,7 +2442,7 @@ var RuntimeProvider = ({
2493
2442
  const tagId = handle.id ?? "ModuleTag";
2494
2443
  const key = resolvedPolicy.preload.keysByTagId.get(tagId) ?? getPreloadKeyForTagId(tagId);
2495
2444
  const factory = (scope) => handle.pipe(
2496
- import_effect10.Scope.extend(scope)
2445
+ import_effect9.Scope.extend(scope)
2497
2446
  );
2498
2447
  const op = cache.preload(key, factory, {
2499
2448
  ownerId: tagId,
@@ -2505,7 +2454,7 @@ var RuntimeProvider = ({
2505
2454
  await op.promise;
2506
2455
  const durationMs = performance.now() - startedAt;
2507
2456
  void runtimeWithBindings.runPromise(
2508
- Logix9.Debug.record({
2457
+ Logix10.Debug.record({
2509
2458
  type: "trace:react.module.preload",
2510
2459
  data: {
2511
2460
  mode: "defer",
@@ -2537,7 +2486,7 @@ var RuntimeProvider = ({
2537
2486
  if (cancelled) return;
2538
2487
  if (onErrorRef.current) {
2539
2488
  runtimeWithBindings.runFork(
2540
- onErrorRef.current(import_effect10.Cause.die(error), { source: "provider", phase: "provider.layer.build" }).pipe(import_effect10.Effect.catchAllCause(() => import_effect10.Effect.void))
2489
+ onErrorRef.current(import_effect9.Cause.die(error), { source: "provider", phase: "provider.layer.build" }).pipe(import_effect9.Effect.catchAllCause(() => import_effect9.Effect.void))
2541
2490
  );
2542
2491
  }
2543
2492
  setDeferReady(true);
@@ -2570,9 +2519,10 @@ var RuntimeProvider = ({
2570
2519
  release();
2571
2520
  };
2572
2521
  }, [resolvedPolicy.mode, deferReady]);
2573
- const isReady = isLayerReady && isConfigReady && (resolvedPolicy.mode !== "defer" || deferReady);
2522
+ const isReady = isTickServicesReady && isLayerReady && isConfigReady && (resolvedPolicy.mode !== "defer" || deferReady);
2574
2523
  if (!isReady) {
2575
2524
  const blockersList = [
2525
+ isTickServicesReady ? null : "tick",
2576
2526
  isLayerReady ? null : "layer",
2577
2527
  isConfigReady ? null : "config",
2578
2528
  resolvedPolicy.mode !== "defer" || deferReady ? null : "preload"
@@ -2617,7 +2567,7 @@ var makeModuleScope = (handle, defaults) => {
2617
2567
  };
2618
2568
  const getRegistryOrThrow = (runtime, where) => {
2619
2569
  try {
2620
- const registry = runtime.runSync(Logix10.ScopeRegistry.ScopeRegistryTag);
2570
+ const registry = runtime.runSync(Logix11.ScopeRegistry.ScopeRegistryTag);
2621
2571
  if (!registry) {
2622
2572
  throw new Error("ScopeRegistry service is undefined");
2623
2573
  }
@@ -2628,7 +2578,7 @@ var makeModuleScope = (handle, defaults) => {
2628
2578
  );
2629
2579
  }
2630
2580
  };
2631
- const moduleToken = Logix10.Module.hasImpl(handle) ? handle.tag : handle.module;
2581
+ const moduleToken = Logix11.Module.hasImpl(handle) ? handle.tag : handle.module;
2632
2582
  const Provider = ({ children, options }) => {
2633
2583
  const runtime = useRuntime();
2634
2584
  const merged = defaults || options ? { ...defaults ?? {}, ...options ?? {} } : void 0;
@@ -2637,7 +2587,7 @@ var makeModuleScope = (handle, defaults) => {
2637
2587
  import_react10.default.useEffect(() => {
2638
2588
  if (!scopeId) return;
2639
2589
  const registry = getRegistryOrThrow(runtime, "[ModuleScope]");
2640
- const leaseRuntime = registry.register(scopeId, Logix10.ScopeRegistry.ScopedRuntimeTag, runtime);
2590
+ const leaseRuntime = registry.register(scopeId, Logix11.ScopeRegistry.ScopedRuntimeTag, runtime);
2641
2591
  const leaseModule = registry.register(scopeId, moduleToken, ref.runtime);
2642
2592
  return () => {
2643
2593
  leaseModule.release();
@@ -2660,11 +2610,8 @@ var makeModuleScope = (handle, defaults) => {
2660
2610
  const Bridge = ({ scopeId, children }) => {
2661
2611
  const runtime = useRuntime();
2662
2612
  const registry = getRegistryOrThrow(runtime, "[ModuleScope.Bridge]");
2663
- const scopedRuntime = registry.get(scopeId, Logix10.ScopeRegistry.ScopedRuntimeTag);
2664
- const moduleRuntime = registry.get(
2665
- scopeId,
2666
- moduleToken
2667
- );
2613
+ const scopedRuntime = registry.get(scopeId, Logix11.ScopeRegistry.ScopedRuntimeTag);
2614
+ const moduleRuntime = registry.get(scopeId, moduleToken);
2668
2615
  if (!scopedRuntime || !moduleRuntime) {
2669
2616
  throw new Error(
2670
2617
  `[ModuleScope.Bridge] Scope "${scopeId}" is not registered (or has been disposed). Ensure you have a corresponding <ModuleScope.Provider options={{ scopeId }}> mounted.`