@octane-xplat/patches 0.11.1 → 0.13.0

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,8 +1,8 @@
1
1
  diff --git a/dist/cjs/runtime.cjs b/dist/cjs/runtime.cjs
2
- index 6f4f11cafea50ca0de062aace3426df371a44867..dc96ffaa91081ca81f904de35ed5db9a024daa96 100644
2
+ index a035f05..9912e51 100644
3
3
  --- a/dist/cjs/runtime.cjs
4
4
  +++ b/dist/cjs/runtime.cjs
5
- @@ -354,6 +354,7 @@ var import_stream_protocol = require("./stream-protocol.cjs");
5
+ @@ -365,6 +365,7 @@ var import_stream_protocol = require("./stream-protocol.cjs");
6
6
  var import_renderer_bridge = require("./renderer-bridge.cjs");
7
7
  var import_context_identity = require("./context-identity.cjs");
8
8
  var import_native_read_client = require("./signals/native-read-client.cjs");
@@ -10,7 +10,7 @@ index 6f4f11cafea50ca0de062aace3426df371a44867..dc96ffaa91081ca81f904de35ed5db9a
10
10
  var import_native_read_collector = require("./signals/native-read-collector.cjs");
11
11
  var import_native_read_retry = require("./signals/native-read-retry.cjs");
12
12
  var import_transition_state = require("./signals/transition-state.cjs");
13
- @@ -7604,6 +7605,7 @@ function nativeLocalHook(name, initialize, dispose, slot) {
13
+ @@ -8525,6 +8526,7 @@ function nativeLocalHook(name, initialize, dispose, slot) {
14
14
  }
15
15
  return cell.nativeValue;
16
16
  }
@@ -19,7 +19,7 @@ index 6f4f11cafea50ca0de062aace3426df371a44867..dc96ffaa91081ca81f904de35ed5db9a
19
19
  const s = readStateHook(initial, slot, arguments.length === 1);
20
20
  return [s.value, s.setter];
21
21
  diff --git a/dist/cjs/signals/client.cjs b/dist/cjs/signals/client.cjs
22
- index 28e28444192dee7af64351cfe02d5dde96658832..af40518defca21eb88707eb76bb6fe10c1d266e7 100644
22
+ index 28e2844..af40518 100644
23
23
  --- a/dist/cjs/signals/client.cjs
24
24
  +++ b/dist/cjs/signals/client.cjs
25
25
  @@ -23,13 +23,13 @@ __export(client_exports, {
@@ -27,26 +27,33 @@ index 28e28444192dee7af64351cfe02d5dde96658832..af40518defca21eb88707eb76bb6fe10
27
27
  module.exports = __toCommonJS(client_exports);
28
28
  __reExport(client_exports, require("./index.cjs"), module.exports);
29
29
  -var import_runtime = require("../runtime.cjs");
30
- var import_engine = require("./engine.cjs");
31
- +var import_local_hook = require("./local-hook.cjs");
32
- function disposeLocalSignal(cell) {
33
- cell.scope.dispose();
34
- }
35
- function useSignal$(initial, slot) {
30
+ -var import_engine = require("./engine.cjs");
31
+ -function disposeLocalSignal(cell) {
32
+ - cell.scope.dispose();
33
+ -}
34
+ -function useSignal$(initial, slot) {
36
35
  - const cell = (0, import_runtime.nativeLocalHook)(
36
+ +var import_engine = require("./engine.cjs");
37
+ +var import_local_hook = require("./local-hook.cjs");
38
+ +function disposeLocalSignal(cell) {
39
+ + cell.scope.dispose();
40
+ +}
41
+ +function useSignal$(initial, slot) {
37
42
  + const cell = (0, import_local_hook.localSignalHook)(
38
43
  "useSignal$",
39
44
  () => {
40
45
  const value = typeof initial === "function" ? initial() : initial;
41
46
  diff --git a/dist/cjs/signals/document-owner.cjs b/dist/cjs/signals/document-owner.cjs
42
- index ea6b3040bcc3d1fe0c600894af33fece59711d4b..56a74394b0e40f0ca1dc9b1afb1b44e5a695994f 100644
47
+ index dbfcce2..ec264d5 100644
43
48
  --- a/dist/cjs/signals/document-owner.cjs
44
49
  +++ b/dist/cjs/signals/document-owner.cjs
45
- @@ -54,7 +54,9 @@ function enableSignalDocument(abi = 1) {
46
- if (defaultInstalled)
47
- return;
50
+ @@ -52,9 +52,9 @@ function enableSignalDocument(abi = 1) {
51
+ if (defaultInstalled) return;
48
52
  defaultInstalled = true;
49
- - (0, import_owner_context.installDefaultSignalOwner)(() => typeof document === "undefined" ? null : documentSignalOwner(document));
53
+ signalOwnerFrame = { enter: import_owner_context.enterSynchronousSignalOwner, restore: import_owner_context.restoreSynchronousSignalOwner };
54
+ - (0, import_owner_context.installDefaultSignalOwner)(
55
+ - () => typeof document === "undefined" ? null : documentSignalOwner(document)
56
+ - );
50
57
  + if (typeof document === "undefined")
51
58
  + return;
52
59
  + (0, import_owner_context.installDefaultSignalOwner)(() => documentSignalOwner(document));
@@ -54,58 +61,31 @@ index ea6b3040bcc3d1fe0c600894af33fece59711d4b..56a74394b0e40f0ca1dc9b1afb1b44e5
54
61
  function installStreamedSignalOwnerActivator(activate) {
55
62
  if (streamedSignalOwnerActivator !== void 0) {
56
63
  diff --git a/dist/cjs/signals/facade.cjs b/dist/cjs/signals/facade.cjs
57
- index 9da71c1a774d4764d6e34df12211a08ae2817d5c..02db86c39e23717e0fedb83eb7faf62e4cca7780 100644
64
+ index 6b6d10a..917422a 100644
58
65
  --- a/dist/cjs/signals/facade.cjs
59
66
  +++ b/dist/cjs/signals/facade.cjs
60
- @@ -283,6 +283,8 @@ class Descriptor {
61
- this.kind = kind;
62
- this.create = create;
63
- this.site = site;
64
- + // Instance declarations stay with their component across child templates and events.
65
- + this.instanceOwner = site?.startsWith("i:") ? (0, import_owner_context.currentSignalOwner)() : null;
67
+ @@ -338,7 +338,7 @@ class Descriptor {
66
68
  }
67
- key;
68
- kind;
69
- @@ -292,7 +294,7 @@ class Descriptor {
70
- cells = /* @__PURE__ */ new WeakMap();
71
- [import_types.SIGNAL_OWNER_RESOLVE](owner) {
72
- requireSite(this.site);
73
- - return this.resolvedCell(resolveDescriptorOwner(this.site, owner));
74
- + return this.resolvedCell(resolveDescriptorOwner(this.site, this.instanceOwner ?? owner));
75
- }
76
- resolvedCell(target) {
77
- let cell = this.cells.get(target);
78
- @@ -303,7 +305,7 @@ class Descriptor {
79
- return cell;
69
+ /** The owner a use resolves for: its reader, or for a lexical handle its declaring owner. */
70
+ reader() {
71
+ - return this.lexical === this ? this.owner : requireOwner();
72
+ + return this.owner ?? requireOwner();
80
73
  }
81
- resolve() {
82
- - const token = requireOwner();
83
- + const token = this.instanceOwner ?? requireOwner();
84
- const owner = resolveDescriptorOwner(this.site, token);
74
+ [import_types.SIGNAL_OWNER_RESOLVE](owner) {
85
75
  requireSite(this.site);
86
- return this.resolvedCell(owner);
87
- @@ -334,7 +336,7 @@ class Descriptor {
88
- return this.resolve().snapshot();
89
- }
90
- subscribe(notify) {
91
- - const token = requireOwner();
92
- + const token = this.instanceOwner ?? requireOwner();
93
- const scope = resolveDescriptorOwner(this.site, token);
94
- const run = (0, import_owner_context.captureSignalOwner)(token);
95
- return this[import_types.SIGNAL_OWNER_RESOLVE](scope).subscribe((0, import_read_protocol.forwardNativeTransitionConsumer)(notify, () => run(notify)));
96
76
  diff --git a/dist/cjs/signals/index.cjs b/dist/cjs/signals/index.cjs
97
- index 865afcf87d84f0cc319d65145b246c9c033927aa..08dd675a49a50c1621e5d3c5a26ca22f8cdbb31d 100644
77
+ index 4b2efde..a487b50 100644
98
78
  --- a/dist/cjs/signals/index.cjs
99
79
  +++ b/dist/cjs/signals/index.cjs
100
- @@ -34,6 +34,7 @@ __export(signals_exports, {
80
+ @@ -35,6 +35,7 @@ __export(signals_exports, {
101
81
  __derivedAt: () => import_derived_facade.__derivedAt,
102
82
  __derivedScalarAt: () => import_facade.__derivedScalarAt,
103
83
  __enableSignalDocument: () => import_document_owner.enableSignalDocument,
104
84
  + __enableUniversalSignalDocument: () => import_universal_owner.enableUniversalSignalDocument,
85
+ __methodDep: () => import_method_dep.__methodDep,
105
86
  __queryAt: () => import_query_facade.__queryAt,
106
87
  __signalAt: () => import_facade.__signalAt,
107
- __startSignalReads: () => import_facade.__startSignalReads,
108
- @@ -65,6 +66,7 @@ module.exports = __toCommonJS(signals_exports);
88
+ @@ -67,6 +68,7 @@ module.exports = __toCommonJS(signals_exports);
109
89
  var import_engine = require("./engine.cjs");
110
90
  var import_control_binding = require("./control-binding.cjs");
111
91
  var import_document_owner = require("./document-owner.cjs");
@@ -113,17 +93,17 @@ index 865afcf87d84f0cc319d65145b246c9c033927aa..08dd675a49a50c1621e5d3c5a26ca22f
113
93
  var import_requests = require("./requests.cjs");
114
94
  var import_actions = require("./actions.cjs");
115
95
  var import_derived_facade = require("./derived-facade.cjs");
116
- @@ -92,6 +94,7 @@ var import_types = require("./types.cjs");
96
+ @@ -97,6 +99,7 @@ var import_types = require("./types.cjs");
117
97
  __derivedAt,
118
98
  __derivedScalarAt,
119
99
  __enableSignalDocument,
120
100
  + __enableUniversalSignalDocument,
101
+ __methodDep,
121
102
  __queryAt,
122
103
  __signalAt,
123
- __startSignalReads,
124
104
  diff --git a/dist/cjs/signals/local-hook.cjs b/dist/cjs/signals/local-hook.cjs
125
105
  new file mode 100644
126
- index 0000000000000000000000000000000000000000..4858595ce50e97284f18daa94c3b5ce6ab041dd4
106
+ index 0000000..4858595
127
107
  --- /dev/null
128
108
  +++ b/dist/cjs/signals/local-hook.cjs
129
109
  @@ -0,0 +1,44 @@
@@ -173,7 +153,7 @@ index 0000000000000000000000000000000000000000..4858595ce50e97284f18daa94c3b5ce6
173
153
  +});
174
154
  diff --git a/dist/cjs/signals/universal-owner.cjs b/dist/cjs/signals/universal-owner.cjs
175
155
  new file mode 100644
176
- index 0000000000000000000000000000000000000000..00c323a8bd4453d566dbd002ab1222f03def2760
156
+ index 0000000..00c323a
177
157
  --- /dev/null
178
158
  +++ b/dist/cjs/signals/universal-owner.cjs
179
159
  @@ -0,0 +1,46 @@
@@ -223,223 +203,268 @@ index 0000000000000000000000000000000000000000..00c323a8bd4453d566dbd002ab1222f0
223
203
  + installUniversalSignalDocumentProvider,
224
204
  + universalSignalDocument
225
205
  +});
226
- diff --git a/dist/compiler/compile-universal.js b/dist/compiler/compile-universal.js
227
- index fb05864726848fec0e680cc06de3cfe88f9930de..e1ae8e2314f2cc61a7a6cbd38ae0fadea8aa08bf 100644
228
- --- a/dist/compiler/compile-universal.js
229
- +++ b/dist/compiler/compile-universal.js
230
- @@ -2658,6 +2658,15 @@ function hasOwnTemplateReturn(fn) {
231
- }
232
-
233
- function componentRender(fn, state, force = false) {
234
- + // Functions that are never invoked as components stay ordinary functions,
235
- + // so an async/generator helper only fails once it is actually compiled as
236
- + // one (the `@{ … }` form, a JSX-shaped return, or component usage).
237
- + const component =
238
- + fn.body?.type === 'JSXCodeBlock' ||
239
- + (fn.body?.type !== 'BlockStatement'
240
- + ? force || isTemplateNode(fn.body)
241
- + : force || hasOwnTemplateReturn(fn) || state.componentNames.has(functionName(fn)));
242
- + if (!component) return null;
243
- if (fn.async || fn.generator) {
244
- throw universalError(
245
- state.filename,
246
- @@ -2672,11 +2681,8 @@ function componentRender(fn, state, force = false) {
247
- };
248
- }
249
- if (fn.body?.type !== 'BlockStatement') {
250
- - if (!force && !isTemplateNode(fn.body)) return null;
251
- return { setup: [], render: isTemplateNode(fn.body) ? fn.body : null, expression: fn.body };
252
- }
253
- - if (!force && !hasOwnTemplateReturn(fn) && !state.componentNames.has(functionName(fn)))
254
- - return null;
255
- return { setup: fn.body.body ?? [], render: null };
256
- }
257
-
258
206
  diff --git a/dist/compiler/compile.js b/dist/compiler/compile.js
259
- index cdf5a08e96946bf06dd417dcfb87373e4be5f305..64a357159586e45774ff864f4478b204bb0dd7ab 100644
207
+ index b891c6a..c736d3c 100644
260
208
  --- a/dist/compiler/compile.js
261
209
  +++ b/dist/compiler/compile.js
262
- @@ -2275,7 +2275,7 @@ function classifyViewTransitionOwnership(astBody, production, ownComponents) {
263
-
210
+ @@ -2493,7 +2493,7 @@ function classifyViewTransitionOwnership(astBody, production, ownComponents) {
211
+
264
212
  function hookRuntimeModulesForCompile(options, universalUnits = []) {
265
- const modules = new Set(options?.__hookRuntimeModules || []);
213
+ - const modules = new Set(options?.__hookRuntimeModules || []);
266
214
  - if (options?.nativeReads === true) {
215
+ - modules.add('octane/signals/client');
216
+ - modules.add('octane/signals/server');
217
+ - }
218
+ + const modules = new Set(options?.__hookRuntimeModules || []);
267
219
  + if (options?.nativeReads === true || options?.__universalSignalReads === true) {
268
- modules.add('octane/signals/client');
269
- modules.add('octane/signals/server');
270
- }
271
- @@ -10112,6 +10112,11 @@ function compileInternal(
272
- universalRuntime: undefined,
273
- rendererBoundaries: undefined,
274
- rendererRegistry: undefined,
220
+ + modules.add('octane/signals/client');
221
+ + modules.add('octane/signals/server');
222
+ + }
223
+ @@ -11087,6 +11087,11 @@ function compileInternal(
224
+ - universalRuntime: undefined,
225
+ - rendererBoundaries: undefined,
226
+ - rendererRegistry: undefined,
227
+ - __hookRuntimeModules: [...(options?.__hookRuntimeModules || []), renderer.module],
228
+ - __runtimeImportRoutes: [
229
+ - ...(options?.__runtimeImportRoutes ?? []),
230
+ + universalRuntime: undefined,
231
+ + rendererBoundaries: undefined,
232
+ + rendererRegistry: undefined,
275
233
  + // Universal owners observe reads at render time; the inner
276
234
  + // compile must not emit the DOM native-read runtime helpers,
277
235
  + // but signal hook classification still applies.
278
236
  + nativeReads: false,
279
237
  + __universalSignalReads: options.nativeReads === true,
280
- __hookRuntimeModules: [...(options?.__hookRuntimeModules || []), renderer.module],
281
- __runtimeImportRoutes: [
282
- ...(options?.__runtimeImportRoutes ?? []),
283
- @@ -10360,6 +10365,10 @@ function compileInternal(
284
- autoMemo: autoMemoEnabled,
285
- strongMemo: strongMemoEnabled,
286
- nativeReads: options?.nativeReads === true,
287
- + // Universal renders observe signal reads at runtime through the owner
288
- + // environment; hook classification still needs to know the module imports
289
- + // the signals runtime even though no DOM native-read helpers are emitted.
238
+ + __hookRuntimeModules: [...(options?.__hookRuntimeModules || []), renderer.module],
239
+ + __runtimeImportRoutes: [
240
+ + ...(options?.__runtimeImportRoutes ?? []),
241
+ @@ -11346,6 +11351,7 @@ function compileInternal(
242
+ - nativeReads: options?.nativeReads === true,
243
+ - opaqueSignalHandles:
244
+ - options?.opaqueSignalHandles === true || options?.__signalModuleImport === true,
245
+ - nativeModuleStyles: options?.nativeReads === true && hasModuleStyleMaps(ast.body),
246
+ - signalHookSites: domSignalTarget(options),
247
+ - // A split Hydrate query module is invoked as the existing server-rendered
248
+ + nativeReads: options?.nativeReads === true,
249
+ + opaqueSignalHandles:
250
+ + options?.opaqueSignalHandles === true || options?.__signalModuleImport === true,
290
251
  + signalReads: options?.nativeReads === true || options?.__universalSignalReads === true,
291
- nativeModuleStyles: options?.nativeReads === true && hasModuleStyleMaps(ast.body),
292
- // A split Hydrate query module is invoked as the existing server-rendered
293
- // boundary body. Its sole component child must therefore keep the server's
294
- @@ -11805,6 +11814,10 @@ function compileServer(
295
- compilerNameSuffixes: null,
296
- mode: 'server',
297
- nativeReads: options?.nativeReads === true,
298
- + // Universal renders observe signal reads at runtime through the owner
299
- + // environment; hook classification still needs to know the module imports
300
- + // the signals runtime even though no DOM native-read helpers are emitted.
252
+ + nativeModuleStyles: options?.nativeReads === true && hasModuleStyleMaps(ast.body),
253
+ + signalHookSites: domSignalTarget(options),
254
+ + // A split Hydrate query module is invoked as the existing server-rendered
255
+ @@ -12814,6 +12820,7 @@ function compileServer(
256
+ - nativeReads: options?.nativeReads === true,
257
+ - opaqueSignalHandles:
258
+ - options?.opaqueSignalHandles === true || options?.__signalModuleImport === true,
259
+ - nativeModuleStyles: options?.nativeReads === true && hasModuleStyleMaps(ast.body),
260
+ - signalHookSites: domSignalTarget(options),
261
+ - hmr: false, // SSR never hot-swaps in place; client/server production slot shapes stay aligned
262
+ + nativeReads: options?.nativeReads === true,
263
+ + opaqueSignalHandles:
264
+ + options?.opaqueSignalHandles === true || options?.__signalModuleImport === true,
301
265
  + signalReads: options?.nativeReads === true || options?.__universalSignalReads === true,
302
- nativeModuleStyles: options?.nativeReads === true && hasModuleStyleMaps(ast.body),
303
- hmr: false, // SSR never hot-swaps in place; client/server production slot shapes stay aligned
304
- dev: !!(options && options.dev),
305
- @@ -18960,7 +18973,7 @@ function slotKeyedHookName(n, ctx) {
306
- ctx.foreignImportLocals?.has(local) === true;
307
- if (
308
- imported !== undefined &&
266
+ + nativeModuleStyles: options?.nativeReads === true && hasModuleStyleMaps(ast.body),
267
+ + signalHookSites: domSignalTarget(options),
268
+ + hmr: false, // SSR never hot-swaps in place; client/server production slot shapes stay aligned
269
+ @@ -20130,7 +20137,7 @@ function slotKeyedHookName(n, ctx) {
270
+ - ctx.foreignImportLocals?.has(local) === true;
271
+ - if (
272
+ - imported !== undefined &&
309
273
  - (HOOK_NAMES.has(imported) || (ctx.nativeReads && NATIVE_SIGNAL_HOOK_NAMES.has(imported)))
274
+ - )
275
+ - return imported;
276
+ - if (!shadowsImport && HOOK_NAMES.has(local)) return local;
277
+ + ctx.foreignImportLocals?.has(local) === true;
278
+ + if (
279
+ + imported !== undefined &&
310
280
  + (HOOK_NAMES.has(imported) || (ctx.signalReads && NATIVE_SIGNAL_HOOK_NAMES.has(imported)))
311
- )
312
- return imported;
313
- if (!shadowsImport && HOOK_NAMES.has(local)) return local;
314
- @@ -18970,7 +18983,7 @@ function slotKeyedHookName(n, ctx) {
315
- const imported = n._octaneImportedHook ?? n._octaneHookRuntimeImportedHook;
316
- if (
317
- imported !== undefined &&
281
+ + )
282
+ + return imported;
283
+ + if (!shadowsImport && HOOK_NAMES.has(local)) return local;
284
+ @@ -20140,7 +20147,7 @@ function slotKeyedHookName(n, ctx) {
285
+ - const imported = n._octaneImportedHook ?? n._octaneHookRuntimeImportedHook;
286
+ - if (
287
+ - imported !== undefined &&
318
288
  - (HOOK_NAMES.has(imported) || (ctx.nativeReads && NATIVE_SIGNAL_HOOK_NAMES.has(imported)))
289
+ - ) {
290
+ - return imported;
291
+ - }
292
+ + const imported = n._octaneImportedHook ?? n._octaneHookRuntimeImportedHook;
293
+ + if (
294
+ + imported !== undefined &&
319
295
  + (HOOK_NAMES.has(imported) || (ctx.signalReads && NATIVE_SIGNAL_HOOK_NAMES.has(imported)))
320
- ) {
321
- return imported;
322
- }
323
- @@ -19817,7 +19830,7 @@ function rewriteHookCalls(node, ctx, componentName, localRoot = false) {
324
- // enforced by rejectHookInJsLoop.
325
- const isBuiltin =
326
- (HOOK_NAMES.has(name) ||
296
+ + ) {
297
+ + return imported;
298
+ + }
299
+ @@ -20996,7 +21003,7 @@ function rewriteHookCalls(node, ctx, componentName, localRoot = false) {
300
+ - // enforced by rejectHookInJsLoop.
301
+ - const isBuiltin =
302
+ - (HOOK_NAMES.has(name) ||
327
303
  - (ctx.nativeReads &&
304
+ - hookRuntimeImportedName !== undefined &&
305
+ - NATIVE_SIGNAL_HOOK_NAMES.has(name))) &&
306
+ - (generated ||
307
+ + // enforced by rejectHookInJsLoop.
308
+ + const isBuiltin =
309
+ + (HOOK_NAMES.has(name) ||
328
310
  + (ctx.signalReads &&
329
- hookRuntimeImportedName !== undefined &&
330
- NATIVE_SIGNAL_HOOK_NAMES.has(name))) &&
331
- (generated ||
332
- @@ -19946,7 +19959,7 @@ function rewriteHookCalls(node, ctx, componentName, localRoot = false) {
333
- ) {
334
- const name = n._octaneImportedHook ?? n._octaneHookRuntimeImportedHook;
335
- const isBuiltin =
311
+ + hookRuntimeImportedName !== undefined &&
312
+ + NATIVE_SIGNAL_HOOK_NAMES.has(name))) &&
313
+ + (generated ||
314
+ @@ -21127,7 +21134,7 @@ function rewriteHookCalls(node, ctx, componentName, localRoot = false) {
315
+ - ) {
316
+ - const name = n._octaneImportedHook ?? n._octaneHookRuntimeImportedHook;
317
+ - const isBuiltin =
336
318
  - HOOK_NAMES.has(name) || (ctx.nativeReads && NATIVE_SIGNAL_HOOK_NAMES.has(name));
319
+ - const isServerUse = name === 'use' && ctx.mode === 'server';
320
+ - if (isBuiltin || isServerUse) {
321
+ - if (isBuiltin) {
322
+ + ) {
323
+ + const name = n._octaneImportedHook ?? n._octaneHookRuntimeImportedHook;
324
+ + const isBuiltin =
337
325
  + HOOK_NAMES.has(name) || (ctx.signalReads && NATIVE_SIGNAL_HOOK_NAMES.has(name));
338
- const isServerUse = name === 'use' && ctx.mode === 'server';
339
- if (isBuiltin || isServerUse) {
340
- if (isBuiltin) {
326
+ + const isServerUse = name === 'use' && ctx.mode === 'server';
327
+ + if (isBuiltin || isServerUse) {
328
+ + if (isBuiltin) {
341
329
  diff --git a/dist/compiler/native-read-diagnostics.js b/dist/compiler/native-read-diagnostics.js
342
- index 3ec74f384e5b34a8032c96646e9ba3faeee50e75..0816e98d66d5082d8d3bb337073c2123e6032c4c 100644
330
+ index 89c9b5a..3baf9e9 100644
343
331
  --- a/dist/compiler/native-read-diagnostics.js
344
332
  +++ b/dist/compiler/native-read-diagnostics.js
345
- @@ -87,9 +87,12 @@ export function assertNativeReadOptions(options) {
346
- if (
347
- options?.nativeReads === true &&
348
- options.renderer?.target != null &&
333
+ @@ -100,9 +100,12 @@ export function assertNativeReadOptions(options) {
334
+ - if (
335
+ - options?.nativeReads === true &&
336
+ - options.renderer?.target != null &&
349
337
  - options.renderer.target !== 'dom'
338
+ - ) {
339
+ - throw new Error('Octane native signal reads support only the DOM client and server.');
340
+ - }
341
+ + if (
342
+ + options?.nativeReads === true &&
343
+ + options.renderer?.target != null &&
350
344
  + options.renderer.target !== 'dom' &&
351
345
  + options.renderer.target !== 'universal'
352
- ) {
353
- - throw new Error('Octane native signal reads support only the DOM client and server.');
346
+ + ) {
354
347
  + throw new Error(
355
348
  + 'Octane native signal reads support only the DOM client, DOM server, and universal renderers.',
356
349
  + );
357
- }
350
+ + }
358
351
  }
359
-
360
- @@ -108,11 +111,11 @@ export function analyzeNativeReadDiagnostics(ast, source, filename, options = {}
361
- filename,
362
- rendererBoundaries: options.rendererBoundaries,
363
- });
352
+
353
+ @@ -121,11 +124,11 @@ export function analyzeNativeReadDiagnostics(ast, source, filename, options = {}
354
+ - filename,
355
+ - rendererBoundaries: options.rendererBoundaries,
356
+ - });
364
357
  - const unsupported = boundaries.find(
365
358
  - (boundary) =>
366
359
  - boundary.childRenderer !== 'dom' &&
367
360
  - options.rendererRegistry?.[boundary.childRenderer]?.target !== 'dom',
368
361
  - );
362
+ - if (unsupported)
363
+ - return [
364
+ - nativeReadDiagnostic(
365
+ + filename,
366
+ + rendererBoundaries: options.rendererBoundaries,
367
+ + });
369
368
  + const unsupported = boundaries.find((boundary) => {
370
369
  + if (boundary.childRenderer === 'dom') return false;
371
370
  + const target = options.rendererRegistry?.[boundary.childRenderer]?.target;
372
371
  + return target !== 'dom' && target !== 'universal';
373
372
  + });
374
- if (unsupported)
375
- return [
376
- nativeReadDiagnostic(
373
+ + if (unsupported)
374
+ + return [
375
+ + nativeReadDiagnostic(
377
376
  diff --git a/dist/compiler/slot-hooks.js b/dist/compiler/slot-hooks.js
378
- index 7b2f867538a166ebaf3d1a8aa6e7d910e3b0da12..2c1d36c9edb32c483a5e7ed736e51b0ca12cde30 100644
377
+ index 90848a6..474c2bb 100644
379
378
  --- a/dist/compiler/slot-hooks.js
380
379
  +++ b/dist/compiler/slot-hooks.js
381
- @@ -1182,12 +1182,12 @@ function walk(node, owner, st) {
382
- }
383
- const imported =
384
- node._octaneImportedHook ??
380
+ @@ -1034,12 +1034,12 @@ function walk(node, owner, st) {
381
+ - }
382
+ - const imported =
383
+ - node._octaneImportedHook ??
385
384
  - (st.nativeReads ? node._octaneHookRuntimeImportedHook : undefined);
386
- + (st.signalReads ? node._octaneHookRuntimeImportedHook : undefined);
387
- collectStateGetterEdit(node, imported, st);
388
- if (
389
- !st.manualSlots &&
390
- imported &&
385
+ - collectStateGetterEdit(node, imported, st);
386
+ - if (
387
+ - !st.manualSlots &&
388
+ - imported &&
391
389
  - (HOOK_NAMES.has(imported) || (st.nativeReads && NATIVE_SIGNAL_HOOK_NAMES.has(imported)))
390
+ - ) {
391
+ - const local =
392
+ - node.callee?.type === 'Identifier'
393
+ + }
394
+ + const imported =
395
+ + node._octaneImportedHook ??
396
+ + (st.signalReads ? node._octaneHookRuntimeImportedHook : undefined);
397
+ + collectStateGetterEdit(node, imported, st);
398
+ + if (
399
+ + !st.manualSlots &&
400
+ + imported &&
392
401
  + (HOOK_NAMES.has(imported) || (st.signalReads && NATIVE_SIGNAL_HOOK_NAMES.has(imported)))
393
- ) {
394
- const local =
395
- node.callee?.type === 'Identifier'
396
- @@ -1398,7 +1398,11 @@ export function slotHooks(source, id, options) {
397
- HOOK_NAMES.has(name),
398
- );
399
- const manualProviders = options?.manualSlots ? findManualHookProviders(ast) : new Map();
402
+ + ) {
403
+ + const local =
404
+ + node.callee?.type === 'Identifier'
405
+ @@ -1255,7 +1255,9 @@ export function slotHooks(source, id, options) {
406
+ - HOOK_NAMES.has(name),
407
+ - );
408
+ - const manualProviders = options?.manualSlots ? findManualHookProviders(ast) : new Map();
400
409
  - const nativeReadActivation = options?.nativeReads === true && importsNativeRenderer(ast);
401
- + // Universal renderers observe reads at render time; the DOM collection
402
- + // driver and its activation helper only apply to dom targets.
410
+ - // Native signal reads exist only for the DOM client and server renderers.
411
+ - const signalHookSites =
412
+ - (options?.renderer?.target ?? 'dom') === 'dom' && options?.universalRuntime == null;
413
+ + HOOK_NAMES.has(name),
414
+ + );
415
+ + const manualProviders = options?.manualSlots ? findManualHookProviders(ast) : new Map();
403
416
  + const universalTarget = options?.renderer?.target === 'universal';
404
417
  + const nativeReadActivation =
405
418
  + options?.nativeReads === true && !universalTarget && importsNativeRenderer(ast);
406
- const signalLowering = signalDeclarationSourceEdits(ast, id, source);
407
- const pureCalls = collectPureFactoryCalls(
408
- ast,
409
- @@ -1487,7 +1491,8 @@ export function slotHooks(source, id, options) {
410
- ]),
411
- ),
412
- manualSlots: options?.manualSlots === true,
419
+ + // Native signal reads exist only for the DOM client and server renderers.
420
+ + const signalHookSites =
421
+ + (options?.renderer?.target ?? 'dom') === 'dom' && options?.universalRuntime == null;
422
+ @@ -1350,7 +1352,8 @@ export function slotHooks(source, id, options) {
423
+ - ]),
424
+ - ),
425
+ - manualSlots: options?.manualSlots === true,
413
426
  - nativeReads: options?.nativeReads === true,
427
+ - signalHookSites,
428
+ - locals: importInfo.locals,
429
+ - source,
430
+ + ]),
431
+ + ),
432
+ + manualSlots: options?.manualSlots === true,
414
433
  + nativeReads: options?.nativeReads === true && !universalTarget,
415
434
  + signalReads: options?.nativeReads === true,
416
- locals: importInfo.locals,
417
- source,
418
- inferred,
419
- @@ -1590,7 +1595,9 @@ export function slotHooks(source, id, options) {
420
- ? 'enableServerSignalBindings'
421
- : nativeReadActivation
422
- ? 'enableSignalBindings'
435
+ + signalHookSites,
436
+ + locals: importInfo.locals,
437
+ + source,
438
+ @@ -1459,7 +1462,9 @@ export function slotHooks(source, id, options) {
439
+ - ? 'enableServerSignalBindings'
440
+ - : nativeReadActivation
441
+ - ? 'enableSignalBindings'
423
442
  - : '__enableSignalDocument';
443
+ - const local = allocSlotName(st, `_$${imported}`);
444
+ - let specifiers = signalHelperImports.get(request);
445
+ - if (specifiers === undefined) signalHelperImports.set(request, (specifiers = []));
446
+ + ? 'enableServerSignalBindings'
447
+ + : nativeReadActivation
448
+ + ? 'enableSignalBindings'
424
449
  + : universalTarget
425
450
  + ? '__enableUniversalSignalDocument'
426
451
  + : '__enableSignalDocument';
427
- const local = allocSlotName(st, `_$${imported}`);
428
- let specifiers = signalHelperImports.get(request);
429
- if (specifiers === undefined) signalHelperImports.set(request, (specifiers = []));
452
+ + const local = allocSlotName(st, `_$${imported}`);
453
+ + let specifiers = signalHelperImports.get(request);
454
+ + if (specifiers === undefined) signalHelperImports.set(request, (specifiers = []));
430
455
  diff --git a/dist/node/runtime.js b/dist/node/runtime.js
431
- index 21d10d95b6094ee07693a8b0757ca381d706b86e..2a0b4204dbcc6a0a749fcdbecfe93241d73dd768 100644
456
+ index 927d060..cef6b5b 100644
432
457
  --- a/dist/node/runtime.js
433
458
  +++ b/dist/node/runtime.js
434
- @@ -162,6 +162,7 @@ import {
435
- import { isRendererContext, registerClientRendererBridge } from "./renderer-bridge.js";
436
- import { defineRemovedContextMembers, registerContext } from "./context-identity.js";
437
- import { createNativeReadDriver } from "./signals/native-read-client.js";
459
+ @@ -185,6 +185,7 @@ import {
460
+ createNativeReadDriver,
461
+ rebaseNativeRead
462
+ } from "./signals/native-read-client.js";
438
463
  +import { registerLocalSignalHook } from "./signals/local-hook.js";
439
464
  import {
440
465
  validateNativeReadWitness
441
466
  } from "./signals/native-read-collector.js";
442
- @@ -7456,6 +7457,7 @@ function nativeLocalHook(name, initialize, dispose, slot) {
467
+ @@ -8398,6 +8399,7 @@ function nativeLocalHook(name, initialize, dispose, slot) {
443
468
  }
444
469
  return cell.nativeValue;
445
470
  }
@@ -448,80 +473,59 @@ index 21d10d95b6094ee07693a8b0757ca381d706b86e..2a0b4204dbcc6a0a749fcdbecfe93241
448
473
  const s = readStateHook(initial, slot, arguments.length === 1);
449
474
  return [s.value, s.setter];
450
475
  diff --git a/dist/node/signals/client.js b/dist/node/signals/client.js
451
- index 21a39c3ce9a28d2095e276fd647fd795e939a0bf..3f85700b57cbc3084c2df776ab3e6b5365f091a8 100644
476
+ index 21a39c3..3f85700 100644
452
477
  --- a/dist/node/signals/client.js
453
478
  +++ b/dist/node/signals/client.js
454
479
  @@ -1,11 +1,11 @@
455
480
  export * from "./index.js";
456
481
  -import { nativeLocalHook } from "../runtime.js";
457
- import { createLocalScope } from "./engine.js";
458
- +import { localSignalHook } from "./local-hook.js";
459
- function disposeLocalSignal(cell) {
460
- cell.scope.dispose();
461
- }
462
- function useSignal$(initial, slot) {
482
+ -import { createLocalScope } from "./engine.js";
483
+ -function disposeLocalSignal(cell) {
484
+ - cell.scope.dispose();
485
+ -}
486
+ -function useSignal$(initial, slot) {
463
487
  - const cell = nativeLocalHook(
488
+ +import { createLocalScope } from "./engine.js";
489
+ +import { localSignalHook } from "./local-hook.js";
490
+ +function disposeLocalSignal(cell) {
491
+ + cell.scope.dispose();
492
+ +}
493
+ +function useSignal$(initial, slot) {
464
494
  + const cell = localSignalHook(
465
495
  "useSignal$",
466
496
  () => {
467
497
  const value = typeof initial === "function" ? initial() : initial;
468
498
  diff --git a/dist/node/signals/document-owner.js b/dist/node/signals/document-owner.js
469
- index 0decc9286f8d06e78dd15eaa16d0cc53cac44220..59a94863274839675c48880bf37018fddd00ec11 100644
499
+ index 35db8d5..aeeaabc 100644
470
500
  --- a/dist/node/signals/document-owner.js
471
501
  +++ b/dist/node/signals/document-owner.js
472
- @@ -27,7 +27,9 @@ function enableSignalDocument(abi = 1) {
473
- if (defaultInstalled)
474
- return;
502
+ @@ -28,9 +28,8 @@ function enableSignalDocument(abi = 1) {
503
+ if (defaultInstalled) return;
475
504
  defaultInstalled = true;
476
- - installDefaultSignalOwner(() => typeof document === "undefined" ? null : documentSignalOwner(document));
477
- + if (typeof document === "undefined")
478
- + return;
505
+ signalOwnerFrame = { enter: enterSynchronousSignalOwner, restore: restoreSynchronousSignalOwner };
506
+ - installDefaultSignalOwner(
507
+ - () => typeof document === "undefined" ? null : documentSignalOwner(document)
508
+ - );
509
+ + if (typeof document === "undefined") return;
479
510
  + installDefaultSignalOwner(() => documentSignalOwner(document));
480
511
  }
481
512
  function installStreamedSignalOwnerActivator(activate) {
482
513
  if (streamedSignalOwnerActivator !== void 0) {
483
514
  diff --git a/dist/node/signals/facade.js b/dist/node/signals/facade.js
484
- index 86c0233dad7013c6516912656e0e1b304351c1cb..594e697b59f19e95821ed09313835842a7afe33e 100644
515
+ index 11ec297..575233b 100644
485
516
  --- a/dist/node/signals/facade.js
486
517
  +++ b/dist/node/signals/facade.js
487
- @@ -241,6 +241,8 @@ class Descriptor {
488
- this.kind = kind;
489
- this.create = create;
490
- this.site = site;
491
- + // Instance declarations stay with their component across child templates and events.
492
- + this.instanceOwner = site?.startsWith("i:") ? currentSignalOwner() : null;
493
- }
494
- key;
495
- kind;
496
- @@ -250,7 +252,7 @@ class Descriptor {
497
- cells = /* @__PURE__ */ new WeakMap();
498
- [SIGNAL_OWNER_RESOLVE](owner) {
499
- requireSite(this.site);
500
- - return this.resolvedCell(resolveDescriptorOwner(this.site, owner));
501
- + return this.resolvedCell(resolveDescriptorOwner(this.site, this.instanceOwner ?? owner));
518
+ @@ -326,7 +326,7 @@ class Descriptor {
502
519
  }
503
- resolvedCell(target) {
504
- let cell = this.cells.get(target);
505
- @@ -261,7 +263,7 @@ class Descriptor {
506
- return cell;
520
+ /** The owner a use resolves for: its reader, or for a lexical handle its declaring owner. */
521
+ reader() {
522
+ - return this.lexical === this ? this.owner : requireOwner();
523
+ + return this.owner ?? requireOwner();
507
524
  }
508
- resolve() {
509
- - const token = requireOwner();
510
- + const token = this.instanceOwner ?? requireOwner();
511
- const owner = resolveDescriptorOwner(this.site, token);
525
+ [SIGNAL_OWNER_RESOLVE](owner) {
512
526
  requireSite(this.site);
513
- return this.resolvedCell(owner);
514
- @@ -292,7 +294,7 @@ class Descriptor {
515
- return this.resolve().snapshot();
516
- }
517
- subscribe(notify) {
518
- - const token = requireOwner();
519
- + const token = this.instanceOwner ?? requireOwner();
520
- const scope = resolveDescriptorOwner(this.site, token);
521
- const run = captureSignalOwner(token);
522
- return this[SIGNAL_OWNER_RESOLVE](scope).subscribe(forwardNativeTransitionConsumer(notify, () => run(notify)));
523
527
  diff --git a/dist/node/signals/index.js b/dist/node/signals/index.js
524
- index 8ae19e510a09e8144ae2ab66c0daf293a4a3f8f6..0bf09f5276e9e1a38ef67923b9cc2a441be2ce7f 100644
528
+ index d657064..01a81cf 100644
525
529
  --- a/dist/node/signals/index.js
526
530
  +++ b/dist/node/signals/index.js
527
531
  @@ -1,6 +1,7 @@
@@ -532,17 +536,17 @@ index 8ae19e510a09e8144ae2ab66c0daf293a4a3f8f6..0bf09f5276e9e1a38ef67923b9cc2a44
532
536
  import { createResource, query } from "./requests.js";
533
537
  import { ActionUncertainError, action$, isActionUncertain, optimistic$ } from "./actions.js";
534
538
  import { __derivedAt, derived$ } from "./derived-facade.js";
535
- @@ -58,6 +59,7 @@ export {
539
+ @@ -60,6 +61,7 @@ export {
536
540
  __derivedAt,
537
541
  __derivedScalarAt,
538
542
  enableSignalDocument as __enableSignalDocument,
539
543
  + enableUniversalSignalDocument as __enableUniversalSignalDocument,
544
+ __methodDep,
540
545
  __queryAt,
541
546
  __signalAt,
542
- __startSignalReads,
543
547
  diff --git a/dist/node/signals/local-hook.js b/dist/node/signals/local-hook.js
544
548
  new file mode 100644
545
- index 0000000000000000000000000000000000000000..77c63f5e2d931eb8dbd384ae027ee0f09935f9ce
549
+ index 0000000..77c63f5
546
550
  --- /dev/null
547
551
  +++ b/dist/node/signals/local-hook.js
548
552
  @@ -0,0 +1,19 @@
@@ -567,7 +571,7 @@ index 0000000000000000000000000000000000000000..77c63f5e2d931eb8dbd384ae027ee0f0
567
571
  +};
568
572
  diff --git a/dist/node/signals/universal-owner.js b/dist/node/signals/universal-owner.js
569
573
  new file mode 100644
570
- index 0000000000000000000000000000000000000000..ff5eb43e8f0ddcadbcf8e861f42788b389b4d99b
574
+ index 0000000..ff5eb43
571
575
  --- /dev/null
572
576
  +++ b/dist/node/signals/universal-owner.js
573
577
  @@ -0,0 +1,20 @@
@@ -592,25 +596,21 @@ index 0000000000000000000000000000000000000000..ff5eb43e8f0ddcadbcf8e861f42788b3
592
596
  + universalSignalDocument
593
597
  +};
594
598
  diff --git a/dist/node/universal-core.js b/dist/node/universal-core.js
595
- index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0bde99062 100644
599
+ index aa045ee..38d6b2b 100644
596
600
  --- a/dist/node/universal-core.js
597
601
  +++ b/dist/node/universal-core.js
598
- @@ -17,6 +17,14 @@ import {
602
+ @@ -17,6 +17,10 @@ import {
603
+ __profileTrackComponent
599
604
  } from "./profiling.js";
600
605
  import { getRendererHostFlusher } from "./renderer-bridge.js";
601
- import { resolveLazyDefaultProps } from "./shared-value-helpers.js";
602
606
  +import { universalSignalDocument } from "./signals/universal-owner.js";
603
607
  +import { registerLocalSignalHook } from "./signals/local-hook.js";
604
608
  +import { retireSignalOwnerIdentity, runWithSignalOwner } from "./signals/owner-context.js";
605
- +import {
606
- + beginNativeWriteGuard,
607
- + endNativeWriteGuard,
608
- + setNativeReadObserver
609
- +} from "./signals/read-protocol.js";
610
- import { __methodDep } from "./method-dep.js";
611
- const UNIVERSAL_PLAN = /* @__PURE__ */ Symbol.for("octane.universal.plan");
612
- const UNIVERSAL_VALUE = /* @__PURE__ */ Symbol.for("octane.universal.value");
613
- @@ -474,6 +482,133 @@ function universalComponent(renderer, component, props = null, key = NO_KEY) {
609
+ +import { beginNativeWriteGuard, endNativeWriteGuard, setNativeReadObserver } from "./signals/read-protocol.js";
610
+ import { resolveLazyDefaultProps } from "./shared-value-helpers.js";
611
+ import {
612
+ deactivateEffectEventCells,
613
+ @@ -495,6 +499,133 @@ function universalComponent(renderer, component, props = null, key = NO_KEY) {
614
614
  hasKey: key !== NO_KEY || normalized.hasKey
615
615
  };
616
616
  }
@@ -744,7 +744,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
744
744
  function universalChildren(renderer, render) {
745
745
  assertRendererId(renderer, "universalChildren renderer");
746
746
  if (typeof render !== "function") throw new TypeError("universalChildren expected a function.");
747
- @@ -842,6 +977,7 @@ function draftOwner(record, parent, replayPath) {
747
+ @@ -863,6 +994,7 @@ function draftOwner(record, parent, replayPath) {
748
748
  boundaryThenable: record.boundaryThenable,
749
749
  isBoundary: record.isBoundary,
750
750
  canHandleSuspense: record.canHandleSuspense,
@@ -752,7 +752,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
752
752
  visibility: parent?.visibility ?? record.visibility,
753
753
  contextStable: null
754
754
  };
755
- @@ -1012,6 +1148,7 @@ function executeOwner(owner, build, initialRenderCount = 0) {
755
+ @@ -1033,6 +1165,7 @@ function executeOwner(owner, build, initialRenderCount = 0) {
756
756
  owner.contextStable = null;
757
757
  owner.needsRender = false;
758
758
  owner.implicitSlot = 0;
@@ -760,29 +760,33 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
760
760
  const previousOwner = CURRENT_OWNER;
761
761
  const previousAttemptOwner = attempt.owner;
762
762
  CURRENT_OWNER = owner;
763
- @@ -1023,13 +1160,18 @@ function executeOwner(owner, build, initialRenderCount = 0) {
763
+ @@ -1044,13 +1177,18 @@ function executeOwner(owner, build, initialRenderCount = 0) {
764
764
  const profileFrame = typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && component !== null ? __profileBeginRender(owner.record, component, owner.record.mounted) : null;
765
765
  let didThrow = false;
766
766
  let thrown;
767
+ - try {
768
+ - output = build();
769
+ - } catch (error) {
770
+ - didThrow = true;
771
+ - thrown = error;
772
+ - throw error;
773
+ - } finally {
767
774
  + const signalOwner = universalSignalOwner(owner.record);
768
775
  + const previousReadObserver = setNativeReadObserver(observeUniversalSignalRead);
769
776
  + const writeGuard = beginNativeWriteGuard();
770
- try {
771
- - output = build();
777
+ + try {
772
778
  + output = runWithSignalOwner(signalOwner, build);
773
- } catch (error) {
774
- didThrow = true;
775
- - thrown = error;
776
- - throw error;
779
+ + } catch (error) {
780
+ + didThrow = true;
777
781
  + thrown = isThenable(error) ? new UniversalSuspense(error) : error;
778
782
  + throw thrown;
779
- } finally {
783
+ + } finally {
780
784
  + endNativeWriteGuard(writeGuard);
781
785
  + setNativeReadObserver(previousReadObserver);
782
786
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__) {
783
787
  __profileEndRender(profileFrame, didThrow, thrown);
784
788
  }
785
- @@ -1196,6 +1338,8 @@ function disposeUncommittedDraft(owner) {
789
+ @@ -1214,6 +1352,8 @@ function disposeUncommittedDraft(owner) {
786
790
  owner.record.componentProps = null;
787
791
  owner.record.range = null;
788
792
  owner.record.updates.clear();
@@ -791,7 +795,15 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
791
795
  for (const hook of owner.hooks.values()) {
792
796
  if (hook.kind === "effect-event") hook.cell.active = false;
793
797
  }
794
- @@ -3142,6 +3286,85 @@ function scheduleOwner(owner, slot) {
798
+ @@ -3048,6 +3188,7 @@ function tryCreateCompactTemplateUpdateTransaction(root, blueprint, attempt, com
799
+ owner.componentProps = draftOwner2.componentProps;
800
+ owner.componentRevision = draftOwner2.componentRevision;
801
+ owner.hooks = draftOwner2.hooks;
802
+ + commitUniversalSignalReads(owner, draftOwner2.signalReads);
803
+ for (const [slot, applied] of draftOwner2.appliedUpdates) {
804
+ const queue = owner.updates.get(slot);
805
+ if (queue !== applied.queue || applied.lane) continue;
806
+ @@ -3514,6 +3655,86 @@ function scheduleOwner(owner, slot) {
795
807
  }
796
808
  owner.root.scheduleOwned(owner);
797
809
  }
@@ -806,7 +818,8 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
806
818
  + // The identity object itself is the opaque per-instance token — the
807
819
  + // same shape DOM scopes use, so identity maps never retain the record.
808
820
  + instanceOwner: null,
809
- + instanceKey: `u:${record.id}`
821
+ + instanceKey: `u:${record.id}`,
822
+ + enclosingOwner: record.parent === null ? void 0 : universalSignalOwner(record.parent)
810
823
  + };
811
824
  + identity.instanceOwner = identity;
812
825
  + owner = Object.freeze(identity);
@@ -877,7 +890,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
877
890
  function currentDraftOwner() {
878
891
  currentAttempt();
879
892
  const owner = activateLazyLeafOwner();
880
- @@ -4142,15 +4365,35 @@ function use(usable) {
893
+ @@ -4628,15 +4849,35 @@ function use(usable) {
881
894
  function useImperativeHandle(ref, create, deps, slot) {
882
895
  useLayoutEffect(
883
896
  () => {
@@ -887,6 +900,9 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
887
900
  - return () => {
888
901
  - if (typeof ref === "function") ref(null);
889
902
  - else if (ref !== null) ref.current = null;
903
+ - };
904
+ - },
905
+ - deps,
890
906
  + const cleanups = [];
891
907
  + let value;
892
908
  + let initialized = false;
@@ -907,32 +923,32 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
907
923
  + target.current = value;
908
924
  + cleanups.push(() => { target.current = null; });
909
925
  + }
910
- };
926
+ + };
911
927
  + try {
912
928
  + attach(ref);
913
929
  + } catch (error) {
914
930
  + try { runCommitTasks(cleanups); } finally { throw error; }
915
931
  + }
916
932
  + return () => runCommitTasks(cleanups);
917
- },
918
- - deps,
933
+ + },
919
934
  + deps == null ? deps : [...deps, ref],
920
935
  slot
921
936
  );
922
937
  }
923
- @@ -5520,9 +5763,9 @@ class UniversalRootImpl {
938
+ @@ -5631,9 +5872,9 @@ class UniversalRootImpl {
924
939
  }
925
940
  let result;
926
941
  try {
927
942
  - result = event.handler(payload);
928
- + result = runWithSignalOwner(universalSignalOwner(event.owner), () => event.handler(payload));
929
- } catch (error) {
943
+ - } catch (error) {
930
944
  - if (!routeUniversalOwnerError(event.owner, error)) throw error;
945
+ + result = runWithSignalOwner(universalSignalOwner(event.owner), () => event.handler(payload));
946
+ + } catch (error) {
931
947
  + if (!routeUniversalOwnerError(event.owner, error) && !reportUniversalUncaughtError(this, error)) throw error;
932
948
  }
933
949
  return result;
934
950
  }
935
- @@ -6096,6 +6339,8 @@ class UniversalRootImpl {
951
+ @@ -6204,6 +6445,8 @@ class UniversalRootImpl {
936
952
  draft.record.componentProps = null;
937
953
  draft.record.range = null;
938
954
  draft.record.updates.clear();
@@ -941,15 +957,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
941
957
  for (const hook of draft.hooks.values()) {
942
958
  if (hook.kind === "effect-event") hook.cell.active = false;
943
959
  }
944
- @@ -6776,6 +7021,7 @@ class UniversalRootImpl {
945
- owner.componentProps = draftOwner2.componentProps;
946
- owner.componentRevision = draftOwner2.componentRevision;
947
- owner.hooks = draftOwner2.hooks;
948
- + commitUniversalSignalReads(owner, draftOwner2.signalReads);
949
- for (const [slot, applied] of draftOwner2.appliedUpdates) {
950
- const queue = owner.updates.get(slot);
951
- if (queue !== applied.queue || applied.lane) continue;
952
- @@ -6809,6 +7055,7 @@ class UniversalRootImpl {
960
+ @@ -6721,6 +6964,7 @@ class UniversalRootImpl {
953
961
  record.componentRevision = draft.componentRevision;
954
962
  record.parent = draft.parent?.record ?? null;
955
963
  record.hooks = draft.hooks;
@@ -957,7 +965,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
957
965
  record.effectOrder = [...draft.seenEffects];
958
966
  for (let index = 0; index < draft.seenEffects.length; index++) {
959
967
  draft.seenEffects[index].previous = null;
960
- @@ -8455,6 +8702,8 @@ class UniversalRootImpl {
968
+ @@ -8369,6 +8613,8 @@ class UniversalRootImpl {
961
969
  owner.componentProps = null;
962
970
  owner.range = null;
963
971
  owner.updates.clear();
@@ -966,7 +974,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
966
974
  }
967
975
  for (const draft of draftOwnersParentFirst) {
968
976
  const record = draft.record;
969
- @@ -8464,6 +8713,7 @@ class UniversalRootImpl {
977
+ @@ -8378,6 +8624,7 @@ class UniversalRootImpl {
970
978
  record.parent = draft.parent?.record ?? null;
971
979
  }
972
980
  record.hooks = draft.hooks;
@@ -974,7 +982,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
974
982
  record.effectOrder = [...draft.seenEffects];
975
983
  for (let index = 0; index < draft.seenEffects.length; index++) {
976
984
  draft.seenEffects[index].previous = null;
977
- @@ -8985,6 +9235,8 @@ class UniversalRootImpl {
985
+ @@ -8889,6 +9136,8 @@ class UniversalRootImpl {
978
986
  owner.componentProps = null;
979
987
  owner.range = null;
980
988
  owner.updates.clear();
@@ -983,7 +991,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
983
991
  }
984
992
  const deactivatedRegionCells = /* @__PURE__ */ new Set();
985
993
  for (const bridge of regionBridges) {
986
- @@ -9937,6 +10189,7 @@ function createObjectDriver(renderer = "object") {
994
+ @@ -10105,6 +10354,7 @@ function createObjectDriver(renderer = "object") {
987
995
  };
988
996
  }
989
997
  export {
@@ -992,23 +1000,27 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
992
1000
  UNIVERSAL_HMR,
993
1001
  UNIVERSAL_TRANSPORT_PROTOCOL_VERSION,
994
1002
  diff --git a/dist/node/universal-native.js b/dist/node/universal-native.js
995
- index 55ac9b640dc8bbfd977bb2cbe0b7993c8ddb425a..3ff9a5750fb59cd91b63299aec3a3e0c030b4579 100644
1003
+ index 55ac9b6..399633e 100644
996
1004
  --- a/dist/node/universal-native.js
997
1005
  +++ b/dist/node/universal-native.js
998
- @@ -6,9 +6,11 @@ import {
1006
+ @@ -6,9 +6,12 @@ import {
999
1007
  import {
1000
1008
  universalContext
1001
1009
  } from "./universal-core.js";
1010
+ -import { registerRendererContext, renderRendererContextProvider } from "./renderer-bridge.js";
1011
+ -import { CONTEXT_TAG } from "./runtime-tags.js";
1012
+ -import { registerContext } from "./context-identity.js";
1013
+ +export { Children } from "./universal-core.js";
1002
1014
  +import { enableUniversalSignalDocument } from "./signals/universal-owner.js";
1003
- import { registerRendererContext, renderRendererContextProvider } from "./renderer-bridge.js";
1004
- import { CONTEXT_TAG } from "./runtime-tags.js";
1005
- import { registerContext } from "./context-identity.js";
1015
+ +import { registerRendererContext, renderRendererContextProvider } from "./renderer-bridge.js";
1016
+ +import { CONTEXT_TAG } from "./runtime-tags.js";
1017
+ +import { registerContext } from "./context-identity.js";
1006
1018
  +enableUniversalSignalDocument();
1007
1019
  // @__NO_SIDE_EFFECTS__
1008
1020
  function createContext(defaultValue) {
1009
1021
  const context = ((props, scope) => scope === void 0 ? universalContext(context, props.value, props.children) : renderRendererContextProvider(context, props, scope));
1010
1022
  diff --git a/dist/node/universal.js b/dist/node/universal.js
1011
- index 6427a0190c072e7e4629c379e42bedc03669dc6e..8049b7880824de607157091004a46c9d33a23484 100644
1023
+ index 6427a01..8049b78 100644
1012
1024
  --- a/dist/node/universal.js
1013
1025
  +++ b/dist/node/universal.js
1014
1026
  @@ -8,6 +8,9 @@ import {
@@ -1022,18 +1034,18 @@ index 6427a0190c072e7e4629c379e42bedc03669dc6e..8049b7880824de607157091004a46c9d
1022
1034
  createContext,
1023
1035
  createSubSlot,
1024
1036
  diff --git a/dist/runtime.js b/dist/runtime.js
1025
- index ee2a2bdd0e0909921fc43ed073be0fbc7f6ec585..4f9f1b5b7782bc0e42799ddb847d22f617a4885f 100644
1037
+ index 67ace09..ef61a91 100644
1026
1038
  --- a/dist/runtime.js
1027
1039
  +++ b/dist/runtime.js
1028
- @@ -161,6 +161,7 @@ import {
1029
- import { isRendererContext, registerClientRendererBridge } from "./renderer-bridge.js";
1030
- import { defineRemovedContextMembers, registerContext } from "./context-identity.js";
1031
- import { createNativeReadDriver } from "./signals/native-read-client.js";
1040
+ @@ -184,6 +184,7 @@ import {
1041
+ createNativeReadDriver,
1042
+ rebaseNativeRead
1043
+ } from "./signals/native-read-client.js";
1032
1044
  +import { registerLocalSignalHook } from "./signals/local-hook.js";
1033
1045
  import {
1034
1046
  validateNativeReadWitness
1035
1047
  } from "./signals/native-read-collector.js";
1036
- @@ -7455,6 +7456,7 @@ function nativeLocalHook(name, initialize, dispose, slot) {
1048
+ @@ -8397,6 +8398,7 @@ function nativeLocalHook(name, initialize, dispose, slot) {
1037
1049
  }
1038
1050
  return cell.nativeValue;
1039
1051
  }
@@ -1042,7 +1054,7 @@ index ee2a2bdd0e0909921fc43ed073be0fbc7f6ec585..4f9f1b5b7782bc0e42799ddb847d22f6
1042
1054
  const s = readStateHook(initial, slot, arguments.length === 1);
1043
1055
  return [s.value, s.setter];
1044
1056
  diff --git a/dist/signals/client.d.ts b/dist/signals/client.d.ts
1045
- index 6388c2f98517884a13af720687fb81c1f18357be..f9e98624f159cccf02a379d79201751fc07694d8 100644
1057
+ index 6388c2f..f9e9862 100644
1046
1058
  --- a/dist/signals/client.d.ts
1047
1059
  +++ b/dist/signals/client.d.ts
1048
1060
  @@ -1,4 +1,4 @@
@@ -1052,80 +1064,59 @@ index 6388c2f98517884a13af720687fb81c1f18357be..f9e98624f159cccf02a379d79201751f
1052
1064
  import type { WritableSignal } from './types.js';
1053
1065
  /** A writable signal owned by this compiler-assigned component hook slot. */
1054
1066
  diff --git a/dist/signals/client.js b/dist/signals/client.js
1055
- index 21a39c3ce9a28d2095e276fd647fd795e939a0bf..3f85700b57cbc3084c2df776ab3e6b5365f091a8 100644
1067
+ index 21a39c3..3f85700 100644
1056
1068
  --- a/dist/signals/client.js
1057
1069
  +++ b/dist/signals/client.js
1058
1070
  @@ -1,11 +1,11 @@
1059
1071
  export * from "./index.js";
1060
1072
  -import { nativeLocalHook } from "../runtime.js";
1061
- import { createLocalScope } from "./engine.js";
1062
- +import { localSignalHook } from "./local-hook.js";
1063
- function disposeLocalSignal(cell) {
1064
- cell.scope.dispose();
1065
- }
1066
- function useSignal$(initial, slot) {
1073
+ -import { createLocalScope } from "./engine.js";
1074
+ -function disposeLocalSignal(cell) {
1075
+ - cell.scope.dispose();
1076
+ -}
1077
+ -function useSignal$(initial, slot) {
1067
1078
  - const cell = nativeLocalHook(
1079
+ +import { createLocalScope } from "./engine.js";
1080
+ +import { localSignalHook } from "./local-hook.js";
1081
+ +function disposeLocalSignal(cell) {
1082
+ + cell.scope.dispose();
1083
+ +}
1084
+ +function useSignal$(initial, slot) {
1068
1085
  + const cell = localSignalHook(
1069
1086
  "useSignal$",
1070
1087
  () => {
1071
1088
  const value = typeof initial === "function" ? initial() : initial;
1072
1089
  diff --git a/dist/signals/document-owner.js b/dist/signals/document-owner.js
1073
- index cd4e628f79d9fed839c089a89e711d446d2e18a4..078dcd31218022b69086238180e6b236e7d8224f 100644
1090
+ index 4ad3aca..b2a5d0e 100644
1074
1091
  --- a/dist/signals/document-owner.js
1075
1092
  +++ b/dist/signals/document-owner.js
1076
- @@ -26,7 +26,9 @@ function enableSignalDocument(abi = 1) {
1077
- if (defaultInstalled)
1078
- return;
1093
+ @@ -27,9 +27,8 @@ function enableSignalDocument(abi = 1) {
1094
+ if (defaultInstalled) return;
1079
1095
  defaultInstalled = true;
1080
- - installDefaultSignalOwner(() => typeof document === "undefined" ? null : documentSignalOwner(document));
1081
- + if (typeof document === "undefined")
1082
- + return;
1096
+ signalOwnerFrame = { enter: enterSynchronousSignalOwner, restore: restoreSynchronousSignalOwner };
1097
+ - installDefaultSignalOwner(
1098
+ - () => typeof document === "undefined" ? null : documentSignalOwner(document)
1099
+ - );
1100
+ + if (typeof document === "undefined") return;
1083
1101
  + installDefaultSignalOwner(() => documentSignalOwner(document));
1084
1102
  }
1085
1103
  function installStreamedSignalOwnerActivator(activate) {
1086
1104
  if (streamedSignalOwnerActivator !== void 0) {
1087
1105
  diff --git a/dist/signals/facade.js b/dist/signals/facade.js
1088
- index 5ab4b73f2e8276b3ade5f04e8fa647efd76cb830..7b23010b7440b698ac4775b44cf16dc55625654d 100644
1106
+ index 478c29d..b6b18b4 100644
1089
1107
  --- a/dist/signals/facade.js
1090
1108
  +++ b/dist/signals/facade.js
1091
- @@ -240,6 +240,8 @@ class Descriptor {
1092
- this.kind = kind;
1093
- this.create = create;
1094
- this.site = site;
1095
- + // Instance declarations stay with their component across child templates and events.
1096
- + this.instanceOwner = site?.startsWith("i:") ? currentSignalOwner() : null;
1097
- }
1098
- key;
1099
- kind;
1100
- @@ -249,7 +251,7 @@ class Descriptor {
1101
- cells = /* @__PURE__ */ new WeakMap();
1102
- [SIGNAL_OWNER_RESOLVE](owner) {
1103
- requireSite(this.site);
1104
- - return this.resolvedCell(resolveDescriptorOwner(this.site, owner));
1105
- + return this.resolvedCell(resolveDescriptorOwner(this.site, this.instanceOwner ?? owner));
1109
+ @@ -325,7 +325,7 @@ class Descriptor {
1106
1110
  }
1107
- resolvedCell(target) {
1108
- let cell = this.cells.get(target);
1109
- @@ -260,7 +262,7 @@ class Descriptor {
1110
- return cell;
1111
+ /** The owner a use resolves for: its reader, or for a lexical handle its declaring owner. */
1112
+ reader() {
1113
+ - return this.lexical === this ? this.owner : requireOwner();
1114
+ + return this.owner ?? requireOwner();
1111
1115
  }
1112
- resolve() {
1113
- - const token = requireOwner();
1114
- + const token = this.instanceOwner ?? requireOwner();
1115
- const owner = resolveDescriptorOwner(this.site, token);
1116
+ [SIGNAL_OWNER_RESOLVE](owner) {
1116
1117
  requireSite(this.site);
1117
- return this.resolvedCell(owner);
1118
- @@ -291,7 +293,7 @@ class Descriptor {
1119
- return this.resolve().snapshot();
1120
- }
1121
- subscribe(notify) {
1122
- - const token = requireOwner();
1123
- + const token = this.instanceOwner ?? requireOwner();
1124
- const scope = resolveDescriptorOwner(this.site, token);
1125
- const run = captureSignalOwner(token);
1126
- return this[SIGNAL_OWNER_RESOLVE](scope).subscribe(forwardNativeTransitionConsumer(notify, () => run(notify)));
1127
1118
  diff --git a/dist/signals/index.d.ts b/dist/signals/index.d.ts
1128
- index 95f32a27af860c358714eeadfbdcbc18bc323d9d..98559855b07e84b61915dba198f357505d584175 100644
1119
+ index ed08619..acccb75 100644
1129
1120
  --- a/dist/signals/index.d.ts
1130
1121
  +++ b/dist/signals/index.d.ts
1131
1122
  @@ -3,6 +3,7 @@ export { createScope } from './engine.js';
@@ -1137,7 +1128,7 @@ index 95f32a27af860c358714eeadfbdcbc18bc323d9d..98559855b07e84b61915dba198f35750
1137
1128
  export { ActionUncertainError, action$, isActionUncertain, optimistic$ } from './actions.js';
1138
1129
  export { __derivedAt, derived$ } from './derived-facade.js';
1139
1130
  diff --git a/dist/signals/index.js b/dist/signals/index.js
1140
- index 8ae19e510a09e8144ae2ab66c0daf293a4a3f8f6..0bf09f5276e9e1a38ef67923b9cc2a441be2ce7f 100644
1131
+ index d657064..01a81cf 100644
1141
1132
  --- a/dist/signals/index.js
1142
1133
  +++ b/dist/signals/index.js
1143
1134
  @@ -1,6 +1,7 @@
@@ -1148,17 +1139,17 @@ index 8ae19e510a09e8144ae2ab66c0daf293a4a3f8f6..0bf09f5276e9e1a38ef67923b9cc2a44
1148
1139
  import { createResource, query } from "./requests.js";
1149
1140
  import { ActionUncertainError, action$, isActionUncertain, optimistic$ } from "./actions.js";
1150
1141
  import { __derivedAt, derived$ } from "./derived-facade.js";
1151
- @@ -58,6 +59,7 @@ export {
1142
+ @@ -60,6 +61,7 @@ export {
1152
1143
  __derivedAt,
1153
1144
  __derivedScalarAt,
1154
1145
  enableSignalDocument as __enableSignalDocument,
1155
1146
  + enableUniversalSignalDocument as __enableUniversalSignalDocument,
1147
+ __methodDep,
1156
1148
  __queryAt,
1157
1149
  __signalAt,
1158
- __startSignalReads,
1159
1150
  diff --git a/dist/signals/local-hook.d.ts b/dist/signals/local-hook.d.ts
1160
1151
  new file mode 100644
1161
- index 0000000000000000000000000000000000000000..d6c1770fc22b738e0e107b6616f60eaf676d853e
1152
+ index 0000000..d6c1770
1162
1153
  --- /dev/null
1163
1154
  +++ b/dist/signals/local-hook.d.ts
1164
1155
  @@ -0,0 +1,16 @@
@@ -1180,7 +1171,7 @@ index 0000000000000000000000000000000000000000..d6c1770fc22b738e0e107b6616f60eaf
1180
1171
  +export declare function localSignalHook<T>(name: string, initialize: () => T, dispose: (value: T) => void, slot?: symbol | number): T;
1181
1172
  diff --git a/dist/signals/local-hook.js b/dist/signals/local-hook.js
1182
1173
  new file mode 100644
1183
- index 0000000000000000000000000000000000000000..77c63f5e2d931eb8dbd384ae027ee0f09935f9ce
1174
+ index 0000000..77c63f5
1184
1175
  --- /dev/null
1185
1176
  +++ b/dist/signals/local-hook.js
1186
1177
  @@ -0,0 +1,19 @@
@@ -1205,7 +1196,7 @@ index 0000000000000000000000000000000000000000..77c63f5e2d931eb8dbd384ae027ee0f0
1205
1196
  +};
1206
1197
  diff --git a/dist/signals/universal-owner.d.ts b/dist/signals/universal-owner.d.ts
1207
1198
  new file mode 100644
1208
- index 0000000000000000000000000000000000000000..0e57f3a79115c858355f863434c6e3423570067b
1199
+ index 0000000..0e57f3a
1209
1200
  --- /dev/null
1210
1201
  +++ b/dist/signals/universal-owner.d.ts
1211
1202
  @@ -0,0 +1,10 @@
@@ -1221,7 +1212,7 @@ index 0000000000000000000000000000000000000000..0e57f3a79115c858355f863434c6e342
1221
1212
  +export declare function enableUniversalSignalDocument(abi?: number): void;
1222
1213
  diff --git a/dist/signals/universal-owner.js b/dist/signals/universal-owner.js
1223
1214
  new file mode 100644
1224
- index 0000000000000000000000000000000000000000..ff5eb43e8f0ddcadbcf8e861f42788b389b4d99b
1215
+ index 0000000..ff5eb43
1225
1216
  --- /dev/null
1226
1217
  +++ b/dist/signals/universal-owner.js
1227
1218
  @@ -0,0 +1,20 @@
@@ -1246,10 +1237,10 @@ index 0000000000000000000000000000000000000000..ff5eb43e8f0ddcadbcf8e861f42788b3
1246
1237
  + universalSignalDocument
1247
1238
  +};
1248
1239
  diff --git a/dist/universal-core.d.ts b/dist/universal-core.d.ts
1249
- index 7e60feece0d3ded5f088bf4e4044516bef588663..3e4cfc19341496009be773b80562476ffd04f2d2 100644
1240
+ index ddf95b3..3a6b744 100644
1250
1241
  --- a/dist/universal-core.d.ts
1251
1242
  +++ b/dist/universal-core.d.ts
1252
- @@ -764,9 +764,8 @@ export declare function lazy<C extends UniversalComponent<any>>(load: () => Prom
1243
+ @@ -791,9 +791,8 @@ export declare function lazy<C extends UniversalComponent<any>>(load: () => Prom
1253
1244
  default: C;
1254
1245
  } | C>): C;
1255
1246
  export declare function use<T>(usable: UniversalContext<T> | PromiseLike<T>): T;
@@ -1261,32 +1252,28 @@ index 7e60feece0d3ded5f088bf4e4044516bef588663..3e4cfc19341496009be773b80562476f
1261
1252
  export declare function useEffectEvent<T extends (...args: any[]) => any>(fn: T, slot?: unknown): T;
1262
1253
  export declare function useDebugValue(): void;
1263
1254
  export declare function startTransition(fn: () => void | Promise<unknown>): void;
1264
- @@ -817,3 +816,5 @@ export interface ObjectHostContainer {
1255
+ @@ -844,3 +843,5 @@ export interface ObjectHostContainer {
1265
1256
  }
1266
1257
  export declare function createObjectContainer(renderer?: string): ObjectHostContainer;
1267
1258
  export declare function createObjectDriver(renderer?: string): UniversalHostDriver<ObjectHostContainer, ObjectHostInstance>;
1268
1259
  +
1269
1260
  +export declare const Children: { toArray(children: UniversalRenderable): UniversalRenderable[]; map(children: UniversalRenderable, fn: (child: UniversalRenderable, index: number) => UniversalRenderable): UniversalRenderable[]; };
1270
1261
  diff --git a/dist/universal-core.js b/dist/universal-core.js
1271
- index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0bde99062 100644
1262
+ index aa045ee..38d6b2b 100644
1272
1263
  --- a/dist/universal-core.js
1273
1264
  +++ b/dist/universal-core.js
1274
- @@ -17,6 +17,14 @@ import {
1265
+ @@ -17,6 +17,10 @@ import {
1266
+ __profileTrackComponent
1275
1267
  } from "./profiling.js";
1276
1268
  import { getRendererHostFlusher } from "./renderer-bridge.js";
1277
- import { resolveLazyDefaultProps } from "./shared-value-helpers.js";
1278
1269
  +import { universalSignalDocument } from "./signals/universal-owner.js";
1279
1270
  +import { registerLocalSignalHook } from "./signals/local-hook.js";
1280
1271
  +import { retireSignalOwnerIdentity, runWithSignalOwner } from "./signals/owner-context.js";
1281
- +import {
1282
- + beginNativeWriteGuard,
1283
- + endNativeWriteGuard,
1284
- + setNativeReadObserver
1285
- +} from "./signals/read-protocol.js";
1286
- import { __methodDep } from "./method-dep.js";
1287
- const UNIVERSAL_PLAN = /* @__PURE__ */ Symbol.for("octane.universal.plan");
1288
- const UNIVERSAL_VALUE = /* @__PURE__ */ Symbol.for("octane.universal.value");
1289
- @@ -474,6 +482,133 @@ function universalComponent(renderer, component, props = null, key = NO_KEY) {
1272
+ +import { beginNativeWriteGuard, endNativeWriteGuard, setNativeReadObserver } from "./signals/read-protocol.js";
1273
+ import { resolveLazyDefaultProps } from "./shared-value-helpers.js";
1274
+ import {
1275
+ deactivateEffectEventCells,
1276
+ @@ -495,6 +499,133 @@ function universalComponent(renderer, component, props = null, key = NO_KEY) {
1290
1277
  hasKey: key !== NO_KEY || normalized.hasKey
1291
1278
  };
1292
1279
  }
@@ -1420,7 +1407,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1420
1407
  function universalChildren(renderer, render) {
1421
1408
  assertRendererId(renderer, "universalChildren renderer");
1422
1409
  if (typeof render !== "function") throw new TypeError("universalChildren expected a function.");
1423
- @@ -842,6 +977,7 @@ function draftOwner(record, parent, replayPath) {
1410
+ @@ -863,6 +994,7 @@ function draftOwner(record, parent, replayPath) {
1424
1411
  boundaryThenable: record.boundaryThenable,
1425
1412
  isBoundary: record.isBoundary,
1426
1413
  canHandleSuspense: record.canHandleSuspense,
@@ -1428,7 +1415,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1428
1415
  visibility: parent?.visibility ?? record.visibility,
1429
1416
  contextStable: null
1430
1417
  };
1431
- @@ -1012,6 +1148,7 @@ function executeOwner(owner, build, initialRenderCount = 0) {
1418
+ @@ -1033,6 +1165,7 @@ function executeOwner(owner, build, initialRenderCount = 0) {
1432
1419
  owner.contextStable = null;
1433
1420
  owner.needsRender = false;
1434
1421
  owner.implicitSlot = 0;
@@ -1436,29 +1423,33 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1436
1423
  const previousOwner = CURRENT_OWNER;
1437
1424
  const previousAttemptOwner = attempt.owner;
1438
1425
  CURRENT_OWNER = owner;
1439
- @@ -1023,13 +1160,18 @@ function executeOwner(owner, build, initialRenderCount = 0) {
1426
+ @@ -1044,13 +1177,18 @@ function executeOwner(owner, build, initialRenderCount = 0) {
1440
1427
  const profileFrame = typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && component !== null ? __profileBeginRender(owner.record, component, owner.record.mounted) : null;
1441
1428
  let didThrow = false;
1442
1429
  let thrown;
1430
+ - try {
1431
+ - output = build();
1432
+ - } catch (error) {
1433
+ - didThrow = true;
1434
+ - thrown = error;
1435
+ - throw error;
1436
+ - } finally {
1443
1437
  + const signalOwner = universalSignalOwner(owner.record);
1444
1438
  + const previousReadObserver = setNativeReadObserver(observeUniversalSignalRead);
1445
1439
  + const writeGuard = beginNativeWriteGuard();
1446
- try {
1447
- - output = build();
1440
+ + try {
1448
1441
  + output = runWithSignalOwner(signalOwner, build);
1449
- } catch (error) {
1450
- didThrow = true;
1451
- - thrown = error;
1452
- - throw error;
1442
+ + } catch (error) {
1443
+ + didThrow = true;
1453
1444
  + thrown = isThenable(error) ? new UniversalSuspense(error) : error;
1454
1445
  + throw thrown;
1455
- } finally {
1446
+ + } finally {
1456
1447
  + endNativeWriteGuard(writeGuard);
1457
1448
  + setNativeReadObserver(previousReadObserver);
1458
1449
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__) {
1459
1450
  __profileEndRender(profileFrame, didThrow, thrown);
1460
1451
  }
1461
- @@ -1196,6 +1338,8 @@ function disposeUncommittedDraft(owner) {
1452
+ @@ -1214,6 +1352,8 @@ function disposeUncommittedDraft(owner) {
1462
1453
  owner.record.componentProps = null;
1463
1454
  owner.record.range = null;
1464
1455
  owner.record.updates.clear();
@@ -1467,7 +1458,15 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1467
1458
  for (const hook of owner.hooks.values()) {
1468
1459
  if (hook.kind === "effect-event") hook.cell.active = false;
1469
1460
  }
1470
- @@ -3142,6 +3286,85 @@ function scheduleOwner(owner, slot) {
1461
+ @@ -3048,6 +3188,7 @@ function tryCreateCompactTemplateUpdateTransaction(root, blueprint, attempt, com
1462
+ owner.componentProps = draftOwner2.componentProps;
1463
+ owner.componentRevision = draftOwner2.componentRevision;
1464
+ owner.hooks = draftOwner2.hooks;
1465
+ + commitUniversalSignalReads(owner, draftOwner2.signalReads);
1466
+ for (const [slot, applied] of draftOwner2.appliedUpdates) {
1467
+ const queue = owner.updates.get(slot);
1468
+ if (queue !== applied.queue || applied.lane) continue;
1469
+ @@ -3514,6 +3655,86 @@ function scheduleOwner(owner, slot) {
1471
1470
  }
1472
1471
  owner.root.scheduleOwned(owner);
1473
1472
  }
@@ -1482,7 +1481,8 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1482
1481
  + // The identity object itself is the opaque per-instance token — the
1483
1482
  + // same shape DOM scopes use, so identity maps never retain the record.
1484
1483
  + instanceOwner: null,
1485
- + instanceKey: `u:${record.id}`
1484
+ + instanceKey: `u:${record.id}`,
1485
+ + enclosingOwner: record.parent === null ? void 0 : universalSignalOwner(record.parent)
1486
1486
  + };
1487
1487
  + identity.instanceOwner = identity;
1488
1488
  + owner = Object.freeze(identity);
@@ -1553,7 +1553,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1553
1553
  function currentDraftOwner() {
1554
1554
  currentAttempt();
1555
1555
  const owner = activateLazyLeafOwner();
1556
- @@ -4142,15 +4365,35 @@ function use(usable) {
1556
+ @@ -4628,15 +4849,35 @@ function use(usable) {
1557
1557
  function useImperativeHandle(ref, create, deps, slot) {
1558
1558
  useLayoutEffect(
1559
1559
  () => {
@@ -1563,6 +1563,9 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1563
1563
  - return () => {
1564
1564
  - if (typeof ref === "function") ref(null);
1565
1565
  - else if (ref !== null) ref.current = null;
1566
+ - };
1567
+ - },
1568
+ - deps,
1566
1569
  + const cleanups = [];
1567
1570
  + let value;
1568
1571
  + let initialized = false;
@@ -1583,32 +1586,32 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1583
1586
  + target.current = value;
1584
1587
  + cleanups.push(() => { target.current = null; });
1585
1588
  + }
1586
- };
1589
+ + };
1587
1590
  + try {
1588
1591
  + attach(ref);
1589
1592
  + } catch (error) {
1590
1593
  + try { runCommitTasks(cleanups); } finally { throw error; }
1591
1594
  + }
1592
1595
  + return () => runCommitTasks(cleanups);
1593
- },
1594
- - deps,
1596
+ + },
1595
1597
  + deps == null ? deps : [...deps, ref],
1596
1598
  slot
1597
1599
  );
1598
1600
  }
1599
- @@ -5520,9 +5763,9 @@ class UniversalRootImpl {
1601
+ @@ -5631,9 +5872,9 @@ class UniversalRootImpl {
1600
1602
  }
1601
1603
  let result;
1602
1604
  try {
1603
1605
  - result = event.handler(payload);
1604
- + result = runWithSignalOwner(universalSignalOwner(event.owner), () => event.handler(payload));
1605
- } catch (error) {
1606
+ - } catch (error) {
1606
1607
  - if (!routeUniversalOwnerError(event.owner, error)) throw error;
1608
+ + result = runWithSignalOwner(universalSignalOwner(event.owner), () => event.handler(payload));
1609
+ + } catch (error) {
1607
1610
  + if (!routeUniversalOwnerError(event.owner, error) && !reportUniversalUncaughtError(this, error)) throw error;
1608
1611
  }
1609
1612
  return result;
1610
1613
  }
1611
- @@ -6096,6 +6339,8 @@ class UniversalRootImpl {
1614
+ @@ -6204,6 +6445,8 @@ class UniversalRootImpl {
1612
1615
  draft.record.componentProps = null;
1613
1616
  draft.record.range = null;
1614
1617
  draft.record.updates.clear();
@@ -1617,15 +1620,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1617
1620
  for (const hook of draft.hooks.values()) {
1618
1621
  if (hook.kind === "effect-event") hook.cell.active = false;
1619
1622
  }
1620
- @@ -6776,6 +7021,7 @@ class UniversalRootImpl {
1621
- owner.componentProps = draftOwner2.componentProps;
1622
- owner.componentRevision = draftOwner2.componentRevision;
1623
- owner.hooks = draftOwner2.hooks;
1624
- + commitUniversalSignalReads(owner, draftOwner2.signalReads);
1625
- for (const [slot, applied] of draftOwner2.appliedUpdates) {
1626
- const queue = owner.updates.get(slot);
1627
- if (queue !== applied.queue || applied.lane) continue;
1628
- @@ -6809,6 +7055,7 @@ class UniversalRootImpl {
1623
+ @@ -6721,6 +6964,7 @@ class UniversalRootImpl {
1629
1624
  record.componentRevision = draft.componentRevision;
1630
1625
  record.parent = draft.parent?.record ?? null;
1631
1626
  record.hooks = draft.hooks;
@@ -1633,7 +1628,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1633
1628
  record.effectOrder = [...draft.seenEffects];
1634
1629
  for (let index = 0; index < draft.seenEffects.length; index++) {
1635
1630
  draft.seenEffects[index].previous = null;
1636
- @@ -8455,6 +8702,8 @@ class UniversalRootImpl {
1631
+ @@ -8369,6 +8613,8 @@ class UniversalRootImpl {
1637
1632
  owner.componentProps = null;
1638
1633
  owner.range = null;
1639
1634
  owner.updates.clear();
@@ -1642,7 +1637,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1642
1637
  }
1643
1638
  for (const draft of draftOwnersParentFirst) {
1644
1639
  const record = draft.record;
1645
- @@ -8464,6 +8713,7 @@ class UniversalRootImpl {
1640
+ @@ -8378,6 +8624,7 @@ class UniversalRootImpl {
1646
1641
  record.parent = draft.parent?.record ?? null;
1647
1642
  }
1648
1643
  record.hooks = draft.hooks;
@@ -1650,7 +1645,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1650
1645
  record.effectOrder = [...draft.seenEffects];
1651
1646
  for (let index = 0; index < draft.seenEffects.length; index++) {
1652
1647
  draft.seenEffects[index].previous = null;
1653
- @@ -8985,6 +9235,8 @@ class UniversalRootImpl {
1648
+ @@ -8889,6 +9136,8 @@ class UniversalRootImpl {
1654
1649
  owner.componentProps = null;
1655
1650
  owner.range = null;
1656
1651
  owner.updates.clear();
@@ -1659,7 +1654,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1659
1654
  }
1660
1655
  const deactivatedRegionCells = /* @__PURE__ */ new Set();
1661
1656
  for (const bridge of regionBridges) {
1662
- @@ -9937,6 +10189,7 @@ function createObjectDriver(renderer = "object") {
1657
+ @@ -10105,6 +10354,7 @@ function createObjectDriver(renderer = "object") {
1663
1658
  };
1664
1659
  }
1665
1660
  export {
@@ -1668,23 +1663,27 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1668
1663
  UNIVERSAL_HMR,
1669
1664
  UNIVERSAL_TRANSPORT_PROTOCOL_VERSION,
1670
1665
  diff --git a/dist/universal-native.js b/dist/universal-native.js
1671
- index 55ac9b640dc8bbfd977bb2cbe0b7993c8ddb425a..3ff9a5750fb59cd91b63299aec3a3e0c030b4579 100644
1666
+ index 55ac9b6..399633e 100644
1672
1667
  --- a/dist/universal-native.js
1673
1668
  +++ b/dist/universal-native.js
1674
- @@ -6,9 +6,11 @@ import {
1669
+ @@ -6,9 +6,12 @@ import {
1675
1670
  import {
1676
1671
  universalContext
1677
1672
  } from "./universal-core.js";
1673
+ -import { registerRendererContext, renderRendererContextProvider } from "./renderer-bridge.js";
1674
+ -import { CONTEXT_TAG } from "./runtime-tags.js";
1675
+ -import { registerContext } from "./context-identity.js";
1676
+ +export { Children } from "./universal-core.js";
1678
1677
  +import { enableUniversalSignalDocument } from "./signals/universal-owner.js";
1679
- import { registerRendererContext, renderRendererContextProvider } from "./renderer-bridge.js";
1680
- import { CONTEXT_TAG } from "./runtime-tags.js";
1681
- import { registerContext } from "./context-identity.js";
1678
+ +import { registerRendererContext, renderRendererContextProvider } from "./renderer-bridge.js";
1679
+ +import { CONTEXT_TAG } from "./runtime-tags.js";
1680
+ +import { registerContext } from "./context-identity.js";
1682
1681
  +enableUniversalSignalDocument();
1683
1682
  // @__NO_SIDE_EFFECTS__
1684
1683
  function createContext(defaultValue) {
1685
1684
  const context = ((props, scope) => scope === void 0 ? universalContext(context, props.value, props.children) : renderRendererContextProvider(context, props, scope));
1686
1685
  diff --git a/dist/universal.js b/dist/universal.js
1687
- index 6427a0190c072e7e4629c379e42bedc03669dc6e..8049b7880824de607157091004a46c9d33a23484 100644
1686
+ index 6427a01..8049b78 100644
1688
1687
  --- a/dist/universal.js
1689
1688
  +++ b/dist/universal.js
1690
1689
  @@ -8,6 +8,9 @@ import {