@octane-xplat/patches 0.11.1 → 0.12.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 ea7eb4c079294af879830a9490a29d6e9544426c..585ec412ec6c0cca419e031411df605721e4b155 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
+ @@ -364,6 +364,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
+ @@ -8099,6 +8100,7 @@ function nativeLocalHook(name, initialize, dispose, slot) {
14
14
  }
15
15
  return cell.nativeValue;
16
16
  }
@@ -39,7 +39,7 @@ index 28e28444192dee7af64351cfe02d5dde96658832..af40518defca21eb88707eb76bb6fe10
39
39
  () => {
40
40
  const value = typeof initial === "function" ? initial() : initial;
41
41
  diff --git a/dist/cjs/signals/document-owner.cjs b/dist/cjs/signals/document-owner.cjs
42
- index ea6b3040bcc3d1fe0c600894af33fece59711d4b..56a74394b0e40f0ca1dc9b1afb1b44e5a695994f 100644
42
+ index b133523be49ca945a3f6e0f776fc0e08c4a3442f..035e04dd8e0125589143f46adcf41f0646103739 100644
43
43
  --- a/dist/cjs/signals/document-owner.cjs
44
44
  +++ b/dist/cjs/signals/document-owner.cjs
45
45
  @@ -54,7 +54,9 @@ function enableSignalDocument(abi = 1) {
@@ -54,58 +54,31 @@ index ea6b3040bcc3d1fe0c600894af33fece59711d4b..56a74394b0e40f0ca1dc9b1afb1b44e5
54
54
  function installStreamedSignalOwnerActivator(activate) {
55
55
  if (streamedSignalOwnerActivator !== void 0) {
56
56
  diff --git a/dist/cjs/signals/facade.cjs b/dist/cjs/signals/facade.cjs
57
- index 9da71c1a774d4764d6e34df12211a08ae2817d5c..02db86c39e23717e0fedb83eb7faf62e4cca7780 100644
57
+ index 1c2d920240cb347656680620727c163c0140f3fd..aa9d0a319b3e5947a26fc6c0559ca41821eb7ebf 100644
58
58
  --- a/dist/cjs/signals/facade.cjs
59
59
  +++ 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;
60
+ @@ -370,7 +370,7 @@ class Descriptor {
66
61
  }
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));
62
+ /** The owner a use resolves for: its reader, or for a lexical handle its declaring owner. */
63
+ reader() {
64
+ - return this.lexical === this ? this.owner : requireOwner();
65
+ + return this.owner ?? requireOwner();
75
66
  }
76
- resolvedCell(target) {
77
- let cell = this.cells.get(target);
78
- @@ -303,7 +305,7 @@ class Descriptor {
79
- return cell;
80
- }
81
- resolve() {
82
- - const token = requireOwner();
83
- + const token = this.instanceOwner ?? requireOwner();
84
- const owner = resolveDescriptorOwner(this.site, token);
67
+ [import_types.SIGNAL_OWNER_RESOLVE](owner) {
85
68
  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
69
  diff --git a/dist/cjs/signals/index.cjs b/dist/cjs/signals/index.cjs
97
- index 865afcf87d84f0cc319d65145b246c9c033927aa..08dd675a49a50c1621e5d3c5a26ca22f8cdbb31d 100644
70
+ index d8ae26b6cba9b90c2e9d28894776264b248c2646..25c4cbba1cc5138d98bf35de72847e53d7c30087 100644
98
71
  --- a/dist/cjs/signals/index.cjs
99
72
  +++ b/dist/cjs/signals/index.cjs
100
- @@ -34,6 +34,7 @@ __export(signals_exports, {
73
+ @@ -35,6 +35,7 @@ __export(signals_exports, {
101
74
  __derivedAt: () => import_derived_facade.__derivedAt,
102
75
  __derivedScalarAt: () => import_facade.__derivedScalarAt,
103
76
  __enableSignalDocument: () => import_document_owner.enableSignalDocument,
104
77
  + __enableUniversalSignalDocument: () => import_universal_owner.enableUniversalSignalDocument,
78
+ __methodDep: () => import_method_dep.__methodDep,
105
79
  __queryAt: () => import_query_facade.__queryAt,
106
80
  __signalAt: () => import_facade.__signalAt,
107
- __startSignalReads: () => import_facade.__startSignalReads,
108
- @@ -65,6 +66,7 @@ module.exports = __toCommonJS(signals_exports);
81
+ @@ -67,6 +68,7 @@ module.exports = __toCommonJS(signals_exports);
109
82
  var import_engine = require("./engine.cjs");
110
83
  var import_control_binding = require("./control-binding.cjs");
111
84
  var import_document_owner = require("./document-owner.cjs");
@@ -113,14 +86,14 @@ index 865afcf87d84f0cc319d65145b246c9c033927aa..08dd675a49a50c1621e5d3c5a26ca22f
113
86
  var import_requests = require("./requests.cjs");
114
87
  var import_actions = require("./actions.cjs");
115
88
  var import_derived_facade = require("./derived-facade.cjs");
116
- @@ -92,6 +94,7 @@ var import_types = require("./types.cjs");
89
+ @@ -96,6 +98,7 @@ var import_types = require("./types.cjs");
117
90
  __derivedAt,
118
91
  __derivedScalarAt,
119
92
  __enableSignalDocument,
120
93
  + __enableUniversalSignalDocument,
94
+ __methodDep,
121
95
  __queryAt,
122
96
  __signalAt,
123
- __startSignalReads,
124
97
  diff --git a/dist/cjs/signals/local-hook.cjs b/dist/cjs/signals/local-hook.cjs
125
98
  new file mode 100644
126
99
  index 0000000000000000000000000000000000000000..4858595ce50e97284f18daa94c3b5ce6ab041dd4
@@ -223,215 +196,260 @@ index 0000000000000000000000000000000000000000..00c323a8bd4453d566dbd002ab1222f0
223
196
  + installUniversalSignalDocumentProvider,
224
197
  + universalSignalDocument
225
198
  +});
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
199
  diff --git a/dist/compiler/compile.js b/dist/compiler/compile.js
259
- index cdf5a08e96946bf06dd417dcfb87373e4be5f305..64a357159586e45774ff864f4478b204bb0dd7ab 100644
200
+ index 536ce597..0d60ff8e 100644
260
201
  --- a/dist/compiler/compile.js
261
202
  +++ b/dist/compiler/compile.js
262
- @@ -2275,7 +2275,7 @@ function classifyViewTransitionOwnership(astBody, production, ownComponents) {
263
-
203
+ @@ -2494,7 +2494,7 @@ function classifyViewTransitionOwnership(astBody, production, ownComponents) {
204
+
264
205
  function hookRuntimeModulesForCompile(options, universalUnits = []) {
265
- const modules = new Set(options?.__hookRuntimeModules || []);
206
+ - const modules = new Set(options?.__hookRuntimeModules || []);
266
207
  - if (options?.nativeReads === true) {
208
+ - modules.add('octane/signals/client');
209
+ - modules.add('octane/signals/server');
210
+ - }
211
+ + const modules = new Set(options?.__hookRuntimeModules || []);
267
212
  + 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,
213
+ + modules.add('octane/signals/client');
214
+ + modules.add('octane/signals/server');
215
+ + }
216
+ @@ -11051,6 +11051,11 @@ function compileInternal(
217
+ - universalRuntime: undefined,
218
+ - rendererBoundaries: undefined,
219
+ - rendererRegistry: undefined,
220
+ - __hookRuntimeModules: [...(options?.__hookRuntimeModules || []), renderer.module],
221
+ - __runtimeImportRoutes: [
222
+ - ...(options?.__runtimeImportRoutes ?? []),
223
+ + universalRuntime: undefined,
224
+ + rendererBoundaries: undefined,
225
+ + rendererRegistry: undefined,
275
226
  + // Universal owners observe reads at render time; the inner
276
227
  + // compile must not emit the DOM native-read runtime helpers,
277
228
  + // but signal hook classification still applies.
278
229
  + nativeReads: false,
279
230
  + __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.
231
+ + __hookRuntimeModules: [...(options?.__hookRuntimeModules || []), renderer.module],
232
+ + __runtimeImportRoutes: [
233
+ + ...(options?.__runtimeImportRoutes ?? []),
234
+ @@ -11310,6 +11315,7 @@ function compileInternal(
235
+ - nativeReads: options?.nativeReads === true,
236
+ - opaqueSignalHandles:
237
+ - options?.opaqueSignalHandles === true || options?.__signalModuleImport === true,
238
+ - nativeModuleStyles: options?.nativeReads === true && hasModuleStyleMaps(ast.body),
239
+ - signalHookSites: domSignalTarget(options),
240
+ - // A split Hydrate query module is invoked as the existing server-rendered
241
+ + nativeReads: options?.nativeReads === true,
242
+ + opaqueSignalHandles:
243
+ + options?.opaqueSignalHandles === true || options?.__signalModuleImport === true,
290
244
  + 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.
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
+ @@ -12778,6 +12784,7 @@ function compileServer(
249
+ - nativeReads: options?.nativeReads === true,
250
+ - opaqueSignalHandles:
251
+ - options?.opaqueSignalHandles === true || options?.__signalModuleImport === true,
252
+ - nativeModuleStyles: options?.nativeReads === true && hasModuleStyleMaps(ast.body),
253
+ - signalHookSites: domSignalTarget(options),
254
+ - hmr: false, // SSR never hot-swaps in place; client/server production slot shapes stay aligned
255
+ + nativeReads: options?.nativeReads === true,
256
+ + opaqueSignalHandles:
257
+ + options?.opaqueSignalHandles === true || options?.__signalModuleImport === true,
301
258
  + 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 &&
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
+ @@ -20073,7 +20080,7 @@ function slotKeyedHookName(n, ctx) {
263
+ - ctx.foreignImportLocals?.has(local) === true;
264
+ - if (
265
+ - imported !== undefined &&
309
266
  - (HOOK_NAMES.has(imported) || (ctx.nativeReads && NATIVE_SIGNAL_HOOK_NAMES.has(imported)))
267
+ - )
268
+ - return imported;
269
+ - if (!shadowsImport && HOOK_NAMES.has(local)) return local;
270
+ + ctx.foreignImportLocals?.has(local) === true;
271
+ + if (
272
+ + imported !== undefined &&
310
273
  + (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 &&
274
+ + )
275
+ + return imported;
276
+ + if (!shadowsImport && HOOK_NAMES.has(local)) return local;
277
+ @@ -20083,7 +20090,7 @@ function slotKeyedHookName(n, ctx) {
278
+ - const imported = n._octaneImportedHook ?? n._octaneHookRuntimeImportedHook;
279
+ - if (
280
+ - imported !== undefined &&
318
281
  - (HOOK_NAMES.has(imported) || (ctx.nativeReads && NATIVE_SIGNAL_HOOK_NAMES.has(imported)))
282
+ - ) {
283
+ - return imported;
284
+ - }
285
+ + const imported = n._octaneImportedHook ?? n._octaneHookRuntimeImportedHook;
286
+ + if (
287
+ + imported !== undefined &&
319
288
  + (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) ||
289
+ + ) {
290
+ + return imported;
291
+ + }
292
+ @@ -20939,7 +20946,7 @@ function rewriteHookCalls(node, ctx, componentName, localRoot = false) {
293
+ - // enforced by rejectHookInJsLoop.
294
+ - const isBuiltin =
295
+ - (HOOK_NAMES.has(name) ||
327
296
  - (ctx.nativeReads &&
297
+ - hookRuntimeImportedName !== undefined &&
298
+ - NATIVE_SIGNAL_HOOK_NAMES.has(name))) &&
299
+ - (generated ||
300
+ + // enforced by rejectHookInJsLoop.
301
+ + const isBuiltin =
302
+ + (HOOK_NAMES.has(name) ||
328
303
  + (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 =
304
+ + hookRuntimeImportedName !== undefined &&
305
+ + NATIVE_SIGNAL_HOOK_NAMES.has(name))) &&
306
+ + (generated ||
307
+ @@ -21070,7 +21077,7 @@ function rewriteHookCalls(node, ctx, componentName, localRoot = false) {
308
+ - ) {
309
+ - const name = n._octaneImportedHook ?? n._octaneHookRuntimeImportedHook;
310
+ - const isBuiltin =
336
311
  - HOOK_NAMES.has(name) || (ctx.nativeReads && NATIVE_SIGNAL_HOOK_NAMES.has(name));
312
+ - const isServerUse = name === 'use' && ctx.mode === 'server';
313
+ - if (isBuiltin || isServerUse) {
314
+ - if (isBuiltin) {
315
+ + ) {
316
+ + const name = n._octaneImportedHook ?? n._octaneHookRuntimeImportedHook;
317
+ + const isBuiltin =
337
318
  + 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) {
319
+ + const isServerUse = name === 'use' && ctx.mode === 'server';
320
+ + if (isBuiltin || isServerUse) {
321
+ + if (isBuiltin) {
341
322
  diff --git a/dist/compiler/native-read-diagnostics.js b/dist/compiler/native-read-diagnostics.js
342
- index 3ec74f384e5b34a8032c96646e9ba3faeee50e75..0816e98d66d5082d8d3bb337073c2123e6032c4c 100644
323
+ index f783b405..60c88e48 100644
343
324
  --- a/dist/compiler/native-read-diagnostics.js
344
325
  +++ 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 &&
326
+ @@ -100,9 +100,12 @@ export function assertNativeReadOptions(options) {
327
+ - if (
328
+ - options?.nativeReads === true &&
329
+ - options.renderer?.target != null &&
349
330
  - options.renderer.target !== 'dom'
331
+ - ) {
332
+ - throw new Error('Octane native signal reads support only the DOM client and server.');
333
+ - }
334
+ + if (
335
+ + options?.nativeReads === true &&
336
+ + options.renderer?.target != null &&
350
337
  + options.renderer.target !== 'dom' &&
351
338
  + options.renderer.target !== 'universal'
352
- ) {
353
- - throw new Error('Octane native signal reads support only the DOM client and server.');
339
+ + ) {
354
340
  + throw new Error(
355
341
  + 'Octane native signal reads support only the DOM client, DOM server, and universal renderers.',
356
342
  + );
357
- }
343
+ + }
358
344
  }
359
-
360
- @@ -108,11 +111,11 @@ export function analyzeNativeReadDiagnostics(ast, source, filename, options = {}
361
- filename,
362
- rendererBoundaries: options.rendererBoundaries,
363
- });
345
+
346
+ @@ -121,11 +124,11 @@ export function analyzeNativeReadDiagnostics(ast, source, filename, options = {}
347
+ - filename,
348
+ - rendererBoundaries: options.rendererBoundaries,
349
+ - });
364
350
  - const unsupported = boundaries.find(
365
351
  - (boundary) =>
366
352
  - boundary.childRenderer !== 'dom' &&
367
353
  - options.rendererRegistry?.[boundary.childRenderer]?.target !== 'dom',
368
354
  - );
355
+ - if (unsupported)
356
+ - return [
357
+ - nativeReadDiagnostic(
358
+ + filename,
359
+ + rendererBoundaries: options.rendererBoundaries,
360
+ + });
369
361
  + const unsupported = boundaries.find((boundary) => {
370
362
  + if (boundary.childRenderer === 'dom') return false;
371
363
  + const target = options.rendererRegistry?.[boundary.childRenderer]?.target;
372
364
  + return target !== 'dom' && target !== 'universal';
373
365
  + });
374
- if (unsupported)
375
- return [
376
- nativeReadDiagnostic(
366
+ + if (unsupported)
367
+ + return [
368
+ + nativeReadDiagnostic(
377
369
  diff --git a/dist/compiler/slot-hooks.js b/dist/compiler/slot-hooks.js
378
- index 7b2f867538a166ebaf3d1a8aa6e7d910e3b0da12..2c1d36c9edb32c483a5e7ed736e51b0ca12cde30 100644
370
+ index 90848a65..474c2bb5 100644
379
371
  --- a/dist/compiler/slot-hooks.js
380
372
  +++ b/dist/compiler/slot-hooks.js
381
- @@ -1182,12 +1182,12 @@ function walk(node, owner, st) {
382
- }
383
- const imported =
384
- node._octaneImportedHook ??
373
+ @@ -1034,12 +1034,12 @@ function walk(node, owner, st) {
374
+ - }
375
+ - const imported =
376
+ - node._octaneImportedHook ??
385
377
  - (st.nativeReads ? node._octaneHookRuntimeImportedHook : undefined);
386
- + (st.signalReads ? node._octaneHookRuntimeImportedHook : undefined);
387
- collectStateGetterEdit(node, imported, st);
388
- if (
389
- !st.manualSlots &&
390
- imported &&
378
+ - collectStateGetterEdit(node, imported, st);
379
+ - if (
380
+ - !st.manualSlots &&
381
+ - imported &&
391
382
  - (HOOK_NAMES.has(imported) || (st.nativeReads && NATIVE_SIGNAL_HOOK_NAMES.has(imported)))
383
+ - ) {
384
+ - const local =
385
+ - node.callee?.type === 'Identifier'
386
+ + }
387
+ + const imported =
388
+ + node._octaneImportedHook ??
389
+ + (st.signalReads ? node._octaneHookRuntimeImportedHook : undefined);
390
+ + collectStateGetterEdit(node, imported, st);
391
+ + if (
392
+ + !st.manualSlots &&
393
+ + imported &&
392
394
  + (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();
395
+ + ) {
396
+ + const local =
397
+ + node.callee?.type === 'Identifier'
398
+ @@ -1255,7 +1255,9 @@ export function slotHooks(source, id, options) {
399
+ - HOOK_NAMES.has(name),
400
+ - );
401
+ - const manualProviders = options?.manualSlots ? findManualHookProviders(ast) : new Map();
400
402
  - 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.
403
+ - // Native signal reads exist only for the DOM client and server renderers.
404
+ - const signalHookSites =
405
+ - (options?.renderer?.target ?? 'dom') === 'dom' && options?.universalRuntime == null;
406
+ + HOOK_NAMES.has(name),
407
+ + );
408
+ + const manualProviders = options?.manualSlots ? findManualHookProviders(ast) : new Map();
403
409
  + const universalTarget = options?.renderer?.target === 'universal';
404
410
  + const nativeReadActivation =
405
411
  + 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,
412
+ + // Native signal reads exist only for the DOM client and server renderers.
413
+ + const signalHookSites =
414
+ + (options?.renderer?.target ?? 'dom') === 'dom' && options?.universalRuntime == null;
415
+ @@ -1350,7 +1352,8 @@ export function slotHooks(source, id, options) {
416
+ - ]),
417
+ - ),
418
+ - manualSlots: options?.manualSlots === true,
413
419
  - nativeReads: options?.nativeReads === true,
420
+ - signalHookSites,
421
+ - locals: importInfo.locals,
422
+ - source,
423
+ + ]),
424
+ + ),
425
+ + manualSlots: options?.manualSlots === true,
414
426
  + nativeReads: options?.nativeReads === true && !universalTarget,
415
427
  + 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'
428
+ + signalHookSites,
429
+ + locals: importInfo.locals,
430
+ + source,
431
+ @@ -1459,7 +1462,9 @@ export function slotHooks(source, id, options) {
432
+ - ? 'enableServerSignalBindings'
433
+ - : nativeReadActivation
434
+ - ? 'enableSignalBindings'
423
435
  - : '__enableSignalDocument';
436
+ - const local = allocSlotName(st, `_$${imported}`);
437
+ - let specifiers = signalHelperImports.get(request);
438
+ - if (specifiers === undefined) signalHelperImports.set(request, (specifiers = []));
439
+ + ? 'enableServerSignalBindings'
440
+ + : nativeReadActivation
441
+ + ? 'enableSignalBindings'
424
442
  + : universalTarget
425
443
  + ? '__enableUniversalSignalDocument'
426
444
  + : '__enableSignalDocument';
427
- const local = allocSlotName(st, `_$${imported}`);
428
- let specifiers = signalHelperImports.get(request);
429
- if (specifiers === undefined) signalHelperImports.set(request, (specifiers = []));
445
+ + const local = allocSlotName(st, `_$${imported}`);
446
+ + let specifiers = signalHelperImports.get(request);
447
+ + if (specifiers === undefined) signalHelperImports.set(request, (specifiers = []));
430
448
  diff --git a/dist/node/runtime.js b/dist/node/runtime.js
431
- index 21d10d95b6094ee07693a8b0757ca381d706b86e..2a0b4204dbcc6a0a749fcdbecfe93241d73dd768 100644
449
+ index 65a87a5f6f63e8fde886c3ed12d3057668b3a2f3..2fd59e94545f2b566234f3957e3bb89bbe7abf78 100644
432
450
  --- a/dist/node/runtime.js
433
451
  +++ b/dist/node/runtime.js
434
- @@ -162,6 +162,7 @@ import {
452
+ @@ -171,6 +171,7 @@ import {
435
453
  import { isRendererContext, registerClientRendererBridge } from "./renderer-bridge.js";
436
454
  import { defineRemovedContextMembers, registerContext } from "./context-identity.js";
437
455
  import { createNativeReadDriver } from "./signals/native-read-client.js";
@@ -439,7 +457,7 @@ index 21d10d95b6094ee07693a8b0757ca381d706b86e..2a0b4204dbcc6a0a749fcdbecfe93241
439
457
  import {
440
458
  validateNativeReadWitness
441
459
  } from "./signals/native-read-collector.js";
442
- @@ -7456,6 +7457,7 @@ function nativeLocalHook(name, initialize, dispose, slot) {
460
+ @@ -7956,6 +7957,7 @@ function nativeLocalHook(name, initialize, dispose, slot) {
443
461
  }
444
462
  return cell.nativeValue;
445
463
  }
@@ -466,7 +484,7 @@ index 21a39c3ce9a28d2095e276fd647fd795e939a0bf..3f85700b57cbc3084c2df776ab3e6b53
466
484
  () => {
467
485
  const value = typeof initial === "function" ? initial() : initial;
468
486
  diff --git a/dist/node/signals/document-owner.js b/dist/node/signals/document-owner.js
469
- index 0decc9286f8d06e78dd15eaa16d0cc53cac44220..59a94863274839675c48880bf37018fddd00ec11 100644
487
+ index 6fae4a2b7042161c0d21452004cea4b0ee87d138..9df7c9c5e8539b797b95d562cf7bca5104b857d3 100644
470
488
  --- a/dist/node/signals/document-owner.js
471
489
  +++ b/dist/node/signals/document-owner.js
472
490
  @@ -27,7 +27,9 @@ function enableSignalDocument(abi = 1) {
@@ -481,47 +499,20 @@ index 0decc9286f8d06e78dd15eaa16d0cc53cac44220..59a94863274839675c48880bf37018fd
481
499
  function installStreamedSignalOwnerActivator(activate) {
482
500
  if (streamedSignalOwnerActivator !== void 0) {
483
501
  diff --git a/dist/node/signals/facade.js b/dist/node/signals/facade.js
484
- index 86c0233dad7013c6516912656e0e1b304351c1cb..594e697b59f19e95821ed09313835842a7afe33e 100644
502
+ index d9786d6899e819ea40589116d9ef946a4c4df4a0..efb80b9186d590dc4ca29bd9f8a77eeb2508e2e6 100644
485
503
  --- a/dist/node/signals/facade.js
486
504
  +++ 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;
505
+ @@ -325,7 +325,7 @@ class Descriptor {
493
506
  }
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));
507
+ /** The owner a use resolves for: its reader, or for a lexical handle its declaring owner. */
508
+ reader() {
509
+ - return this.lexical === this ? this.owner : requireOwner();
510
+ + return this.owner ?? requireOwner();
502
511
  }
503
- resolvedCell(target) {
504
- let cell = this.cells.get(target);
505
- @@ -261,7 +263,7 @@ class Descriptor {
506
- return cell;
507
- }
508
- resolve() {
509
- - const token = requireOwner();
510
- + const token = this.instanceOwner ?? requireOwner();
511
- const owner = resolveDescriptorOwner(this.site, token);
512
+ [SIGNAL_OWNER_RESOLVE](owner) {
512
513
  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
514
  diff --git a/dist/node/signals/index.js b/dist/node/signals/index.js
524
- index 8ae19e510a09e8144ae2ab66c0daf293a4a3f8f6..0bf09f5276e9e1a38ef67923b9cc2a441be2ce7f 100644
515
+ index 33efa85de5a5784b920e648e222e0831e3cfae90..fab07861bbacadbc429883ff8d48baa13aec082c 100644
525
516
  --- a/dist/node/signals/index.js
526
517
  +++ b/dist/node/signals/index.js
527
518
  @@ -1,6 +1,7 @@
@@ -532,14 +523,14 @@ index 8ae19e510a09e8144ae2ab66c0daf293a4a3f8f6..0bf09f5276e9e1a38ef67923b9cc2a44
532
523
  import { createResource, query } from "./requests.js";
533
524
  import { ActionUncertainError, action$, isActionUncertain, optimistic$ } from "./actions.js";
534
525
  import { __derivedAt, derived$ } from "./derived-facade.js";
535
- @@ -58,6 +59,7 @@ export {
526
+ @@ -61,6 +62,7 @@ export {
536
527
  __derivedAt,
537
528
  __derivedScalarAt,
538
529
  enableSignalDocument as __enableSignalDocument,
539
530
  + enableUniversalSignalDocument as __enableUniversalSignalDocument,
531
+ __methodDep,
540
532
  __queryAt,
541
533
  __signalAt,
542
- __startSignalReads,
543
534
  diff --git a/dist/node/signals/local-hook.js b/dist/node/signals/local-hook.js
544
535
  new file mode 100644
545
536
  index 0000000000000000000000000000000000000000..77c63f5e2d931eb8dbd384ae027ee0f09935f9ce
@@ -592,25 +583,21 @@ index 0000000000000000000000000000000000000000..ff5eb43e8f0ddcadbcf8e861f42788b3
592
583
  + universalSignalDocument
593
584
  +};
594
585
  diff --git a/dist/node/universal-core.js b/dist/node/universal-core.js
595
- index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0bde99062 100644
586
+ index 4bc0ddf5022daa883d35536af2db8d9b3d59b166..f7cc3726cf895383ded13e4bb41857682f90fb66 100644
596
587
  --- a/dist/node/universal-core.js
597
588
  +++ b/dist/node/universal-core.js
598
- @@ -17,6 +17,14 @@ import {
589
+ @@ -16,6 +16,10 @@ import {
590
+ __profileTrackComponent
599
591
  } from "./profiling.js";
600
592
  import { getRendererHostFlusher } from "./renderer-bridge.js";
601
- import { resolveLazyDefaultProps } from "./shared-value-helpers.js";
602
593
  +import { universalSignalDocument } from "./signals/universal-owner.js";
603
594
  +import { registerLocalSignalHook } from "./signals/local-hook.js";
604
595
  +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) {
596
+ +import { beginNativeWriteGuard, endNativeWriteGuard, setNativeReadObserver } from "./signals/read-protocol.js";
597
+ import { resolveLazyDefaultProps } from "./shared-value-helpers.js";
598
+ import {
599
+ deactivateEffectEventCells,
600
+ @@ -488,6 +492,133 @@ function universalComponent(renderer, component, props = null, key = NO_KEY) {
614
601
  hasKey: key !== NO_KEY || normalized.hasKey
615
602
  };
616
603
  }
@@ -744,7 +731,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
744
731
  function universalChildren(renderer, render) {
745
732
  assertRendererId(renderer, "universalChildren renderer");
746
733
  if (typeof render !== "function") throw new TypeError("universalChildren expected a function.");
747
- @@ -842,6 +977,7 @@ function draftOwner(record, parent, replayPath) {
734
+ @@ -856,6 +987,7 @@ function draftOwner(record, parent, replayPath) {
748
735
  boundaryThenable: record.boundaryThenable,
749
736
  isBoundary: record.isBoundary,
750
737
  canHandleSuspense: record.canHandleSuspense,
@@ -752,7 +739,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
752
739
  visibility: parent?.visibility ?? record.visibility,
753
740
  contextStable: null
754
741
  };
755
- @@ -1012,6 +1148,7 @@ function executeOwner(owner, build, initialRenderCount = 0) {
742
+ @@ -1026,6 +1158,7 @@ function executeOwner(owner, build, initialRenderCount = 0) {
756
743
  owner.contextStable = null;
757
744
  owner.needsRender = false;
758
745
  owner.implicitSlot = 0;
@@ -760,7 +747,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
760
747
  const previousOwner = CURRENT_OWNER;
761
748
  const previousAttemptOwner = attempt.owner;
762
749
  CURRENT_OWNER = owner;
763
- @@ -1023,13 +1160,18 @@ function executeOwner(owner, build, initialRenderCount = 0) {
750
+ @@ -1037,13 +1170,18 @@ function executeOwner(owner, build, initialRenderCount = 0) {
764
751
  const profileFrame = typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && component !== null ? __profileBeginRender(owner.record, component, owner.record.mounted) : null;
765
752
  let didThrow = false;
766
753
  let thrown;
@@ -782,7 +769,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
782
769
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__) {
783
770
  __profileEndRender(profileFrame, didThrow, thrown);
784
771
  }
785
- @@ -1196,6 +1338,8 @@ function disposeUncommittedDraft(owner) {
772
+ @@ -1210,6 +1348,8 @@ function disposeUncommittedDraft(owner) {
786
773
  owner.record.componentProps = null;
787
774
  owner.record.range = null;
788
775
  owner.record.updates.clear();
@@ -791,7 +778,15 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
791
778
  for (const hook of owner.hooks.values()) {
792
779
  if (hook.kind === "effect-event") hook.cell.active = false;
793
780
  }
794
- @@ -3142,6 +3286,85 @@ function scheduleOwner(owner, slot) {
781
+ @@ -3044,6 +3184,7 @@ function tryCreateCompactTemplateUpdateTransaction(root, blueprint, attempt, com
782
+ owner.componentProps = draftOwner2.componentProps;
783
+ owner.componentRevision = draftOwner2.componentRevision;
784
+ owner.hooks = draftOwner2.hooks;
785
+ + commitUniversalSignalReads(owner, draftOwner2.signalReads);
786
+ for (const [slot, applied] of draftOwner2.appliedUpdates) {
787
+ const queue = owner.updates.get(slot);
788
+ if (queue !== applied.queue || applied.lane) continue;
789
+ @@ -3510,6 +3651,86 @@ function scheduleOwner(owner, slot) {
795
790
  }
796
791
  owner.root.scheduleOwned(owner);
797
792
  }
@@ -806,7 +801,8 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
806
801
  + // The identity object itself is the opaque per-instance token — the
807
802
  + // same shape DOM scopes use, so identity maps never retain the record.
808
803
  + instanceOwner: null,
809
- + instanceKey: `u:${record.id}`
804
+ + instanceKey: `u:${record.id}`,
805
+ + enclosingOwner: record.parent === null ? void 0 : universalSignalOwner(record.parent)
810
806
  + };
811
807
  + identity.instanceOwner = identity;
812
808
  + owner = Object.freeze(identity);
@@ -877,7 +873,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
877
873
  function currentDraftOwner() {
878
874
  currentAttempt();
879
875
  const owner = activateLazyLeafOwner();
880
- @@ -4142,15 +4365,35 @@ function use(usable) {
876
+ @@ -4624,15 +4845,35 @@ function use(usable) {
881
877
  function useImperativeHandle(ref, create, deps, slot) {
882
878
  useLayoutEffect(
883
879
  () => {
@@ -920,7 +916,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
920
916
  slot
921
917
  );
922
918
  }
923
- @@ -5520,9 +5763,9 @@ class UniversalRootImpl {
919
+ @@ -5627,9 +5868,9 @@ class UniversalRootImpl {
924
920
  }
925
921
  let result;
926
922
  try {
@@ -932,7 +928,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
932
928
  }
933
929
  return result;
934
930
  }
935
- @@ -6096,6 +6339,8 @@ class UniversalRootImpl {
931
+ @@ -6200,6 +6441,8 @@ class UniversalRootImpl {
936
932
  draft.record.componentProps = null;
937
933
  draft.record.range = null;
938
934
  draft.record.updates.clear();
@@ -941,15 +937,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
941
937
  for (const hook of draft.hooks.values()) {
942
938
  if (hook.kind === "effect-event") hook.cell.active = false;
943
939
  }
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 {
940
+ @@ -6717,6 +6960,7 @@ class UniversalRootImpl {
953
941
  record.componentRevision = draft.componentRevision;
954
942
  record.parent = draft.parent?.record ?? null;
955
943
  record.hooks = draft.hooks;
@@ -957,7 +945,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
957
945
  record.effectOrder = [...draft.seenEffects];
958
946
  for (let index = 0; index < draft.seenEffects.length; index++) {
959
947
  draft.seenEffects[index].previous = null;
960
- @@ -8455,6 +8702,8 @@ class UniversalRootImpl {
948
+ @@ -8365,6 +8609,8 @@ class UniversalRootImpl {
961
949
  owner.componentProps = null;
962
950
  owner.range = null;
963
951
  owner.updates.clear();
@@ -966,7 +954,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
966
954
  }
967
955
  for (const draft of draftOwnersParentFirst) {
968
956
  const record = draft.record;
969
- @@ -8464,6 +8713,7 @@ class UniversalRootImpl {
957
+ @@ -8374,6 +8620,7 @@ class UniversalRootImpl {
970
958
  record.parent = draft.parent?.record ?? null;
971
959
  }
972
960
  record.hooks = draft.hooks;
@@ -974,7 +962,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
974
962
  record.effectOrder = [...draft.seenEffects];
975
963
  for (let index = 0; index < draft.seenEffects.length; index++) {
976
964
  draft.seenEffects[index].previous = null;
977
- @@ -8985,6 +9235,8 @@ class UniversalRootImpl {
965
+ @@ -8885,6 +9132,8 @@ class UniversalRootImpl {
978
966
  owner.componentProps = null;
979
967
  owner.range = null;
980
968
  owner.updates.clear();
@@ -983,7 +971,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
983
971
  }
984
972
  const deactivatedRegionCells = /* @__PURE__ */ new Set();
985
973
  for (const bridge of regionBridges) {
986
- @@ -9937,6 +10189,7 @@ function createObjectDriver(renderer = "object") {
974
+ @@ -10101,6 +10350,7 @@ function createObjectDriver(renderer = "object") {
987
975
  };
988
976
  }
989
977
  export {
@@ -995,10 +983,11 @@ diff --git a/dist/node/universal-native.js b/dist/node/universal-native.js
995
983
  index 55ac9b640dc8bbfd977bb2cbe0b7993c8ddb425a..3ff9a5750fb59cd91b63299aec3a3e0c030b4579 100644
996
984
  --- a/dist/node/universal-native.js
997
985
  +++ b/dist/node/universal-native.js
998
- @@ -6,9 +6,11 @@ import {
986
+ @@ -6,9 +6,12 @@ import {
999
987
  import {
1000
988
  universalContext
1001
989
  } from "./universal-core.js";
990
+ +export { Children } from "./universal-core.js";
1002
991
  +import { enableUniversalSignalDocument } from "./signals/universal-owner.js";
1003
992
  import { registerRendererContext, renderRendererContextProvider } from "./renderer-bridge.js";
1004
993
  import { CONTEXT_TAG } from "./runtime-tags.js";
@@ -1022,10 +1011,10 @@ index 6427a0190c072e7e4629c379e42bedc03669dc6e..8049b7880824de607157091004a46c9d
1022
1011
  createContext,
1023
1012
  createSubSlot,
1024
1013
  diff --git a/dist/runtime.js b/dist/runtime.js
1025
- index ee2a2bdd0e0909921fc43ed073be0fbc7f6ec585..4f9f1b5b7782bc0e42799ddb847d22f617a4885f 100644
1014
+ index 614f28d71730aa84dc8dd2ae1d712f1b45e8a6f9..f9988db75999f905a389a3a8eea73573bcc15c84 100644
1026
1015
  --- a/dist/runtime.js
1027
1016
  +++ b/dist/runtime.js
1028
- @@ -161,6 +161,7 @@ import {
1017
+ @@ -170,6 +170,7 @@ import {
1029
1018
  import { isRendererContext, registerClientRendererBridge } from "./renderer-bridge.js";
1030
1019
  import { defineRemovedContextMembers, registerContext } from "./context-identity.js";
1031
1020
  import { createNativeReadDriver } from "./signals/native-read-client.js";
@@ -1033,7 +1022,7 @@ index ee2a2bdd0e0909921fc43ed073be0fbc7f6ec585..4f9f1b5b7782bc0e42799ddb847d22f6
1033
1022
  import {
1034
1023
  validateNativeReadWitness
1035
1024
  } from "./signals/native-read-collector.js";
1036
- @@ -7455,6 +7456,7 @@ function nativeLocalHook(name, initialize, dispose, slot) {
1025
+ @@ -7955,6 +7956,7 @@ function nativeLocalHook(name, initialize, dispose, slot) {
1037
1026
  }
1038
1027
  return cell.nativeValue;
1039
1028
  }
@@ -1070,7 +1059,7 @@ index 21a39c3ce9a28d2095e276fd647fd795e939a0bf..3f85700b57cbc3084c2df776ab3e6b53
1070
1059
  () => {
1071
1060
  const value = typeof initial === "function" ? initial() : initial;
1072
1061
  diff --git a/dist/signals/document-owner.js b/dist/signals/document-owner.js
1073
- index cd4e628f79d9fed839c089a89e711d446d2e18a4..078dcd31218022b69086238180e6b236e7d8224f 100644
1062
+ index 56a7ac2713e73cc136b846ce26849d27dca65485..0422e096c511a49f7fb3ffc73ed5a02218f45465 100644
1074
1063
  --- a/dist/signals/document-owner.js
1075
1064
  +++ b/dist/signals/document-owner.js
1076
1065
  @@ -26,7 +26,9 @@ function enableSignalDocument(abi = 1) {
@@ -1085,47 +1074,20 @@ index cd4e628f79d9fed839c089a89e711d446d2e18a4..078dcd31218022b69086238180e6b236
1085
1074
  function installStreamedSignalOwnerActivator(activate) {
1086
1075
  if (streamedSignalOwnerActivator !== void 0) {
1087
1076
  diff --git a/dist/signals/facade.js b/dist/signals/facade.js
1088
- index 5ab4b73f2e8276b3ade5f04e8fa647efd76cb830..7b23010b7440b698ac4775b44cf16dc55625654d 100644
1077
+ index 56b8f6f00dc8c313ced91a6cc5abc6a01bbd0b66..6aace062ae8ad61fa4090fdedced994c44e814eb 100644
1089
1078
  --- a/dist/signals/facade.js
1090
1079
  +++ 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;
1080
+ @@ -324,7 +324,7 @@ class Descriptor {
1097
1081
  }
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));
1082
+ /** The owner a use resolves for: its reader, or for a lexical handle its declaring owner. */
1083
+ reader() {
1084
+ - return this.lexical === this ? this.owner : requireOwner();
1085
+ + return this.owner ?? requireOwner();
1106
1086
  }
1107
- resolvedCell(target) {
1108
- let cell = this.cells.get(target);
1109
- @@ -260,7 +262,7 @@ class Descriptor {
1110
- return cell;
1111
- }
1112
- resolve() {
1113
- - const token = requireOwner();
1114
- + const token = this.instanceOwner ?? requireOwner();
1115
- const owner = resolveDescriptorOwner(this.site, token);
1087
+ [SIGNAL_OWNER_RESOLVE](owner) {
1116
1088
  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
1089
  diff --git a/dist/signals/index.d.ts b/dist/signals/index.d.ts
1128
- index 95f32a27af860c358714eeadfbdcbc18bc323d9d..98559855b07e84b61915dba198f357505d584175 100644
1090
+ index 69733ffb205a61929a2a004296192ab411722385..ce5647edd39f281161aa0f338ce82b86e139a126 100644
1129
1091
  --- a/dist/signals/index.d.ts
1130
1092
  +++ b/dist/signals/index.d.ts
1131
1093
  @@ -3,6 +3,7 @@ export { createScope } from './engine.js';
@@ -1137,7 +1099,7 @@ index 95f32a27af860c358714eeadfbdcbc18bc323d9d..98559855b07e84b61915dba198f35750
1137
1099
  export { ActionUncertainError, action$, isActionUncertain, optimistic$ } from './actions.js';
1138
1100
  export { __derivedAt, derived$ } from './derived-facade.js';
1139
1101
  diff --git a/dist/signals/index.js b/dist/signals/index.js
1140
- index 8ae19e510a09e8144ae2ab66c0daf293a4a3f8f6..0bf09f5276e9e1a38ef67923b9cc2a441be2ce7f 100644
1102
+ index 33efa85de5a5784b920e648e222e0831e3cfae90..fab07861bbacadbc429883ff8d48baa13aec082c 100644
1141
1103
  --- a/dist/signals/index.js
1142
1104
  +++ b/dist/signals/index.js
1143
1105
  @@ -1,6 +1,7 @@
@@ -1148,14 +1110,14 @@ index 8ae19e510a09e8144ae2ab66c0daf293a4a3f8f6..0bf09f5276e9e1a38ef67923b9cc2a44
1148
1110
  import { createResource, query } from "./requests.js";
1149
1111
  import { ActionUncertainError, action$, isActionUncertain, optimistic$ } from "./actions.js";
1150
1112
  import { __derivedAt, derived$ } from "./derived-facade.js";
1151
- @@ -58,6 +59,7 @@ export {
1113
+ @@ -61,6 +62,7 @@ export {
1152
1114
  __derivedAt,
1153
1115
  __derivedScalarAt,
1154
1116
  enableSignalDocument as __enableSignalDocument,
1155
1117
  + enableUniversalSignalDocument as __enableUniversalSignalDocument,
1118
+ __methodDep,
1156
1119
  __queryAt,
1157
1120
  __signalAt,
1158
- __startSignalReads,
1159
1121
  diff --git a/dist/signals/local-hook.d.ts b/dist/signals/local-hook.d.ts
1160
1122
  new file mode 100644
1161
1123
  index 0000000000000000000000000000000000000000..d6c1770fc22b738e0e107b6616f60eaf676d853e
@@ -1246,10 +1208,10 @@ index 0000000000000000000000000000000000000000..ff5eb43e8f0ddcadbcf8e861f42788b3
1246
1208
  + universalSignalDocument
1247
1209
  +};
1248
1210
  diff --git a/dist/universal-core.d.ts b/dist/universal-core.d.ts
1249
- index 7e60feece0d3ded5f088bf4e4044516bef588663..3e4cfc19341496009be773b80562476ffd04f2d2 100644
1211
+ index ddf95b3ee39836940dab20bc2ac2ae2761e4dd82..3a6b744f17a726062562db075b165b1089d23678 100644
1250
1212
  --- a/dist/universal-core.d.ts
1251
1213
  +++ b/dist/universal-core.d.ts
1252
- @@ -764,9 +764,8 @@ export declare function lazy<C extends UniversalComponent<any>>(load: () => Prom
1214
+ @@ -791,9 +791,8 @@ export declare function lazy<C extends UniversalComponent<any>>(load: () => Prom
1253
1215
  default: C;
1254
1216
  } | C>): C;
1255
1217
  export declare function use<T>(usable: UniversalContext<T> | PromiseLike<T>): T;
@@ -1261,32 +1223,28 @@ index 7e60feece0d3ded5f088bf4e4044516bef588663..3e4cfc19341496009be773b80562476f
1261
1223
  export declare function useEffectEvent<T extends (...args: any[]) => any>(fn: T, slot?: unknown): T;
1262
1224
  export declare function useDebugValue(): void;
1263
1225
  export declare function startTransition(fn: () => void | Promise<unknown>): void;
1264
- @@ -817,3 +816,5 @@ export interface ObjectHostContainer {
1226
+ @@ -844,3 +843,5 @@ export interface ObjectHostContainer {
1265
1227
  }
1266
1228
  export declare function createObjectContainer(renderer?: string): ObjectHostContainer;
1267
1229
  export declare function createObjectDriver(renderer?: string): UniversalHostDriver<ObjectHostContainer, ObjectHostInstance>;
1268
1230
  +
1269
1231
  +export declare const Children: { toArray(children: UniversalRenderable): UniversalRenderable[]; map(children: UniversalRenderable, fn: (child: UniversalRenderable, index: number) => UniversalRenderable): UniversalRenderable[]; };
1270
1232
  diff --git a/dist/universal-core.js b/dist/universal-core.js
1271
- index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0bde99062 100644
1233
+ index 4bc0ddf5022daa883d35536af2db8d9b3d59b166..f7cc3726cf895383ded13e4bb41857682f90fb66 100644
1272
1234
  --- a/dist/universal-core.js
1273
1235
  +++ b/dist/universal-core.js
1274
- @@ -17,6 +17,14 @@ import {
1236
+ @@ -16,6 +16,10 @@ import {
1237
+ __profileTrackComponent
1275
1238
  } from "./profiling.js";
1276
1239
  import { getRendererHostFlusher } from "./renderer-bridge.js";
1277
- import { resolveLazyDefaultProps } from "./shared-value-helpers.js";
1278
1240
  +import { universalSignalDocument } from "./signals/universal-owner.js";
1279
1241
  +import { registerLocalSignalHook } from "./signals/local-hook.js";
1280
1242
  +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) {
1243
+ +import { beginNativeWriteGuard, endNativeWriteGuard, setNativeReadObserver } from "./signals/read-protocol.js";
1244
+ import { resolveLazyDefaultProps } from "./shared-value-helpers.js";
1245
+ import {
1246
+ deactivateEffectEventCells,
1247
+ @@ -488,6 +492,133 @@ function universalComponent(renderer, component, props = null, key = NO_KEY) {
1290
1248
  hasKey: key !== NO_KEY || normalized.hasKey
1291
1249
  };
1292
1250
  }
@@ -1420,7 +1378,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1420
1378
  function universalChildren(renderer, render) {
1421
1379
  assertRendererId(renderer, "universalChildren renderer");
1422
1380
  if (typeof render !== "function") throw new TypeError("universalChildren expected a function.");
1423
- @@ -842,6 +977,7 @@ function draftOwner(record, parent, replayPath) {
1381
+ @@ -856,6 +987,7 @@ function draftOwner(record, parent, replayPath) {
1424
1382
  boundaryThenable: record.boundaryThenable,
1425
1383
  isBoundary: record.isBoundary,
1426
1384
  canHandleSuspense: record.canHandleSuspense,
@@ -1428,7 +1386,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1428
1386
  visibility: parent?.visibility ?? record.visibility,
1429
1387
  contextStable: null
1430
1388
  };
1431
- @@ -1012,6 +1148,7 @@ function executeOwner(owner, build, initialRenderCount = 0) {
1389
+ @@ -1026,6 +1158,7 @@ function executeOwner(owner, build, initialRenderCount = 0) {
1432
1390
  owner.contextStable = null;
1433
1391
  owner.needsRender = false;
1434
1392
  owner.implicitSlot = 0;
@@ -1436,7 +1394,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1436
1394
  const previousOwner = CURRENT_OWNER;
1437
1395
  const previousAttemptOwner = attempt.owner;
1438
1396
  CURRENT_OWNER = owner;
1439
- @@ -1023,13 +1160,18 @@ function executeOwner(owner, build, initialRenderCount = 0) {
1397
+ @@ -1037,13 +1170,18 @@ function executeOwner(owner, build, initialRenderCount = 0) {
1440
1398
  const profileFrame = typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && component !== null ? __profileBeginRender(owner.record, component, owner.record.mounted) : null;
1441
1399
  let didThrow = false;
1442
1400
  let thrown;
@@ -1458,7 +1416,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1458
1416
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__) {
1459
1417
  __profileEndRender(profileFrame, didThrow, thrown);
1460
1418
  }
1461
- @@ -1196,6 +1338,8 @@ function disposeUncommittedDraft(owner) {
1419
+ @@ -1210,6 +1348,8 @@ function disposeUncommittedDraft(owner) {
1462
1420
  owner.record.componentProps = null;
1463
1421
  owner.record.range = null;
1464
1422
  owner.record.updates.clear();
@@ -1467,7 +1425,15 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1467
1425
  for (const hook of owner.hooks.values()) {
1468
1426
  if (hook.kind === "effect-event") hook.cell.active = false;
1469
1427
  }
1470
- @@ -3142,6 +3286,85 @@ function scheduleOwner(owner, slot) {
1428
+ @@ -3044,6 +3184,7 @@ function tryCreateCompactTemplateUpdateTransaction(root, blueprint, attempt, com
1429
+ owner.componentProps = draftOwner2.componentProps;
1430
+ owner.componentRevision = draftOwner2.componentRevision;
1431
+ owner.hooks = draftOwner2.hooks;
1432
+ + commitUniversalSignalReads(owner, draftOwner2.signalReads);
1433
+ for (const [slot, applied] of draftOwner2.appliedUpdates) {
1434
+ const queue = owner.updates.get(slot);
1435
+ if (queue !== applied.queue || applied.lane) continue;
1436
+ @@ -3510,6 +3651,86 @@ function scheduleOwner(owner, slot) {
1471
1437
  }
1472
1438
  owner.root.scheduleOwned(owner);
1473
1439
  }
@@ -1482,7 +1448,8 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1482
1448
  + // The identity object itself is the opaque per-instance token — the
1483
1449
  + // same shape DOM scopes use, so identity maps never retain the record.
1484
1450
  + instanceOwner: null,
1485
- + instanceKey: `u:${record.id}`
1451
+ + instanceKey: `u:${record.id}`,
1452
+ + enclosingOwner: record.parent === null ? void 0 : universalSignalOwner(record.parent)
1486
1453
  + };
1487
1454
  + identity.instanceOwner = identity;
1488
1455
  + owner = Object.freeze(identity);
@@ -1553,7 +1520,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1553
1520
  function currentDraftOwner() {
1554
1521
  currentAttempt();
1555
1522
  const owner = activateLazyLeafOwner();
1556
- @@ -4142,15 +4365,35 @@ function use(usable) {
1523
+ @@ -4624,15 +4845,35 @@ function use(usable) {
1557
1524
  function useImperativeHandle(ref, create, deps, slot) {
1558
1525
  useLayoutEffect(
1559
1526
  () => {
@@ -1596,7 +1563,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1596
1563
  slot
1597
1564
  );
1598
1565
  }
1599
- @@ -5520,9 +5763,9 @@ class UniversalRootImpl {
1566
+ @@ -5627,9 +5868,9 @@ class UniversalRootImpl {
1600
1567
  }
1601
1568
  let result;
1602
1569
  try {
@@ -1608,7 +1575,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1608
1575
  }
1609
1576
  return result;
1610
1577
  }
1611
- @@ -6096,6 +6339,8 @@ class UniversalRootImpl {
1578
+ @@ -6200,6 +6441,8 @@ class UniversalRootImpl {
1612
1579
  draft.record.componentProps = null;
1613
1580
  draft.record.range = null;
1614
1581
  draft.record.updates.clear();
@@ -1617,15 +1584,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1617
1584
  for (const hook of draft.hooks.values()) {
1618
1585
  if (hook.kind === "effect-event") hook.cell.active = false;
1619
1586
  }
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 {
1587
+ @@ -6717,6 +6960,7 @@ class UniversalRootImpl {
1629
1588
  record.componentRevision = draft.componentRevision;
1630
1589
  record.parent = draft.parent?.record ?? null;
1631
1590
  record.hooks = draft.hooks;
@@ -1633,7 +1592,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1633
1592
  record.effectOrder = [...draft.seenEffects];
1634
1593
  for (let index = 0; index < draft.seenEffects.length; index++) {
1635
1594
  draft.seenEffects[index].previous = null;
1636
- @@ -8455,6 +8702,8 @@ class UniversalRootImpl {
1595
+ @@ -8365,6 +8609,8 @@ class UniversalRootImpl {
1637
1596
  owner.componentProps = null;
1638
1597
  owner.range = null;
1639
1598
  owner.updates.clear();
@@ -1642,7 +1601,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1642
1601
  }
1643
1602
  for (const draft of draftOwnersParentFirst) {
1644
1603
  const record = draft.record;
1645
- @@ -8464,6 +8713,7 @@ class UniversalRootImpl {
1604
+ @@ -8374,6 +8620,7 @@ class UniversalRootImpl {
1646
1605
  record.parent = draft.parent?.record ?? null;
1647
1606
  }
1648
1607
  record.hooks = draft.hooks;
@@ -1650,7 +1609,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1650
1609
  record.effectOrder = [...draft.seenEffects];
1651
1610
  for (let index = 0; index < draft.seenEffects.length; index++) {
1652
1611
  draft.seenEffects[index].previous = null;
1653
- @@ -8985,6 +9235,8 @@ class UniversalRootImpl {
1612
+ @@ -8885,6 +9132,8 @@ class UniversalRootImpl {
1654
1613
  owner.componentProps = null;
1655
1614
  owner.range = null;
1656
1615
  owner.updates.clear();
@@ -1659,7 +1618,7 @@ index 4dbe2f938d039d415b44821bcb3be520172bcada..735a017364cd23bdb8972a04401385f0
1659
1618
  }
1660
1619
  const deactivatedRegionCells = /* @__PURE__ */ new Set();
1661
1620
  for (const bridge of regionBridges) {
1662
- @@ -9937,6 +10189,7 @@ function createObjectDriver(renderer = "object") {
1621
+ @@ -10101,6 +10350,7 @@ function createObjectDriver(renderer = "object") {
1663
1622
  };
1664
1623
  }
1665
1624
  export {
@@ -1671,10 +1630,11 @@ diff --git a/dist/universal-native.js b/dist/universal-native.js
1671
1630
  index 55ac9b640dc8bbfd977bb2cbe0b7993c8ddb425a..3ff9a5750fb59cd91b63299aec3a3e0c030b4579 100644
1672
1631
  --- a/dist/universal-native.js
1673
1632
  +++ b/dist/universal-native.js
1674
- @@ -6,9 +6,11 @@ import {
1633
+ @@ -6,9 +6,12 @@ import {
1675
1634
  import {
1676
1635
  universalContext
1677
1636
  } from "./universal-core.js";
1637
+ +export { Children } from "./universal-core.js";
1678
1638
  +import { enableUniversalSignalDocument } from "./signals/universal-owner.js";
1679
1639
  import { registerRendererContext, renderRendererContextProvider } from "./renderer-bridge.js";
1680
1640
  import { CONTEXT_TAG } from "./runtime-tags.js";