create-octane-xplat 0.18.0 → 0.20.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.
Files changed (77) hide show
  1. package/README.md +2 -144
  2. package/compatibility.json +97 -19
  3. package/compatibility.ts +141 -72
  4. package/dist/compatibility.js +66 -26
  5. package/dist/index.js +127 -64
  6. package/dist/package-manager.js +62 -0
  7. package/dist/scaffold.js +377 -127
  8. package/index.ts +256 -154
  9. package/library-template/AGENTS.md +6 -4
  10. package/library-template/README.md +22 -18
  11. package/library-template/bunfig +4 -0
  12. package/library-template/package.json +115 -18
  13. package/library-template/patches/@nativescript-community__octane@0.2.5.patch +1018 -0
  14. package/library-template/patches/@nativescript-community__sqlite-bridge@4.1.1.patch +30 -0
  15. package/library-template/patches/@nativescript-community__vite-octane@0.2.1.patch +72 -0
  16. package/library-template/patches/@nativescript__core@9.1.3.patch +1280 -0
  17. package/library-template/patches/@nativescript__doctor@2.0.18.patch +13 -0
  18. package/library-template/patches/@nativescript__vite@8.0.20.patch +2019 -0
  19. package/library-template/patches/@octane-xplat__nativescript-mason-core@1.0.0-beta.7.patch +65 -0
  20. package/library-template/patches/@octanejs__tiptap@0.0.62.patch +12 -0
  21. package/library-template/patches/@sveltejs__acorn-typescript@1.0.13.patch +16 -0
  22. package/library-template/patches/css@3.0.0.patch +52 -0
  23. package/library-template/patches/octane@0.16.3.patch +1479 -0
  24. package/library-template/src/Badge.tsx +7 -6
  25. package/library-template/src/Badge.web.tsx +7 -6
  26. package/library-template/src/Welcome.stories.tsx +12 -0
  27. package/library-template/src/normalizeBadgeLabel.ts +1 -1
  28. package/library-template/src/props.ts +11 -11
  29. package/library-template/tests/normalizeBadgeLabel.test.ts +1 -1
  30. package/library-template/tests/packed-consumer.mjs +140 -123
  31. package/library-template/tsconfig.envs.json +1 -0
  32. package/library-template/tsconfig.json +1 -0
  33. package/library-template/tsconfig.types.json +15 -1
  34. package/library-template/tsrx-typegen.json +1 -1
  35. package/library-template/workshop.config.ts +3 -0
  36. package/package-manager.ts +93 -0
  37. package/package.json +70 -58
  38. package/scaffold.ts +1056 -526
  39. package/template/.agents/skills/xplat/SKILL.md +6 -6
  40. package/template/.agents/skills/xplat/references/components.md +1 -1
  41. package/template/.agents/skills/xplat/references/navigation.md +1 -1
  42. package/template/.agents/skills/xplat/references/styling.md +14 -14
  43. package/template/AGENTS.md +10 -10
  44. package/template/bunfig +4 -0
  45. package/template/gitignore +1 -0
  46. package/template/nativescript.config.ts +13 -16
  47. package/template/package.json +119 -10
  48. package/template/patches/@nativescript-community__octane@0.2.5.patch +1018 -0
  49. package/template/patches/@nativescript-community__sqlite-bridge@4.1.1.patch +30 -0
  50. package/template/patches/@nativescript-community__vite-octane@0.2.1.patch +72 -0
  51. package/template/patches/@nativescript__core@9.1.3.patch +1280 -0
  52. package/template/patches/@nativescript__doctor@2.0.18.patch +13 -0
  53. package/template/patches/@nativescript__vite@8.0.20.patch +2019 -0
  54. package/template/patches/@octane-xplat__nativescript-mason-core@1.0.0-beta.7.patch +65 -0
  55. package/template/patches/@octanejs__tiptap@0.0.62.patch +12 -0
  56. package/template/patches/@sveltejs__acorn-typescript@1.0.13.patch +16 -0
  57. package/template/patches/css@3.0.0.patch +52 -0
  58. package/template/patches/octane@0.16.3.patch +1479 -0
  59. package/template/src/App.tsrx +77 -42
  60. package/template/src/Welcome.stories.tsx +22 -0
  61. package/template/src/app.spec.tsrx +169 -163
  62. package/template/src/app.web.test.tsx +18 -13
  63. package/template/src/failure-reporting.spec.ts +3 -3
  64. package/template/src/main.ts +14 -13
  65. package/template/src/main.tsrx +2 -0
  66. package/template/src/main.web.tsrx +5 -5
  67. package/template/src/native-runtime.spec.ts +13 -11
  68. package/template/src/test-setup.web.ts +9 -8
  69. package/template/src/test.ts +6 -6
  70. package/template/tsconfig.json +17 -1
  71. package/template/vite.config.native.mts +1 -2
  72. package/template/vite.config.ts +29 -23
  73. package/template/vitest.config.mts +18 -18
  74. package/template/vitest.web.config.mts +7 -7
  75. package/template/workshop.config.ts +3 -0
  76. package/library-template/pnpm-workspace.yaml +0 -171
  77. package/template/pnpm-workspace.yaml +0 -192
@@ -0,0 +1,1479 @@
1
+ diff --git a/dist/cjs/runtime/hooks.cjs b/dist/cjs/runtime/hooks.cjs
2
+ index 1f235d62a..4848e4fe2 100644
3
+ --- a/dist/cjs/runtime/hooks.cjs
4
+ +++ b/dist/cjs/runtime/hooks.cjs
5
+ @@ -1,4 +1,5 @@
6
+ "use strict";
7
+ +var import_local_hook = require("../signals/local-hook.cjs");
8
+ var __defProp = Object.defineProperty;
9
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
10
+ var __getOwnPropNames = Object.getOwnPropertyNames;
11
+ @@ -157,6 +158,7 @@ function nativeLocalHook(name, initialize, dispose, slot) {
12
+ }
13
+ return cell.nativeValue;
14
+ }
15
+ +(0, import_local_hook.registerLocalSignalHook)(() => import_render.CURRENT_SCOPE === null ? null : nativeLocalHook);
16
+ function applyHookUpdate(state, action, reducer) {
17
+ return reducer !== null ? reducer(state, action) : typeof action === "function" ? action(state) : action;
18
+ }
19
+ diff --git a/dist/cjs/signals/client.cjs b/dist/cjs/signals/client.cjs
20
+ index 28e284441..af40518de 100644
21
+ --- a/dist/cjs/signals/client.cjs
22
+ +++ b/dist/cjs/signals/client.cjs
23
+ @@ -23,13 +23,13 @@ __export(client_exports, {
24
+ });
25
+ module.exports = __toCommonJS(client_exports);
26
+ __reExport(client_exports, require("./index.cjs"), module.exports);
27
+ -var import_runtime = require("../runtime.cjs");
28
+ var import_engine = require("./engine.cjs");
29
+ +var import_local_hook = require("./local-hook.cjs");
30
+ function disposeLocalSignal(cell) {
31
+ cell.scope.dispose();
32
+ }
33
+ function useSignal$(initial, slot) {
34
+ - const cell = (0, import_runtime.nativeLocalHook)(
35
+ + const cell = (0, import_local_hook.localSignalHook)(
36
+ "useSignal$",
37
+ () => {
38
+ const value = typeof initial === "function" ? initial() : initial;
39
+ diff --git a/dist/cjs/signals/document-owner.cjs b/dist/cjs/signals/document-owner.cjs
40
+ index bfa55295a..a106df17a 100644
41
+ --- a/dist/cjs/signals/document-owner.cjs
42
+ +++ b/dist/cjs/signals/document-owner.cjs
43
+ @@ -53,9 +53,9 @@ function enableSignalDocument(abi = 1) {
44
+ if (defaultInstalled) return;
45
+ defaultInstalled = true;
46
+ signalOwnerFrame = { enter: import_owner_context.enterSynchronousSignalOwner, restore: import_owner_context.restoreSynchronousSignalOwner };
47
+ - (0, import_owner_context.installDefaultSignalOwner)(
48
+ - () => typeof document === "undefined" ? null : documentSignalOwner(document)
49
+ - );
50
+ + if (typeof document === "undefined")
51
+ + return;
52
+ + (0, import_owner_context.installDefaultSignalOwner)(() => documentSignalOwner(document));
53
+ }
54
+ function installStreamedSignalOwnerActivator(activate) {
55
+ if (streamedSignalOwnerActivator !== void 0) {
56
+ diff --git a/dist/cjs/signals/facade.cjs b/dist/cjs/signals/facade.cjs
57
+ index e60d5fc7f..c96a0fdaf 100644
58
+ --- a/dist/cjs/signals/facade.cjs
59
+ +++ b/dist/cjs/signals/facade.cjs
60
+ @@ -315,7 +315,7 @@ class Descriptor {
61
+ lexical;
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();
66
+ }
67
+ [import_types.SIGNAL_OWNER_RESOLVE](owner) {
68
+ requireSite(this.site);
69
+ diff --git a/dist/cjs/signals/index.cjs b/dist/cjs/signals/index.cjs
70
+ index ae3693030..2f07b043a 100644
71
+ --- a/dist/cjs/signals/index.cjs
72
+ +++ b/dist/cjs/signals/index.cjs
73
+ @@ -37,6 +37,7 @@ __export(signals_exports, {
74
+ __derivedScalarViews: () => import_scalar_computations.installScalarViews,
75
+ __derivedViews: () => import_computations.installDerivedViews,
76
+ __enableSignalDocument: () => import_document_owner.enableSignalDocument,
77
+ + __enableUniversalSignalDocument: () => import_universal_owner.enableUniversalSignalDocument,
78
+ __methodDep: () => import_method_dep.__methodDep,
79
+ __queryAt: () => import_query_facade.__queryAt,
80
+ __queryViews: () => import_requests2.installResourceViews,
81
+ @@ -70,6 +71,7 @@ module.exports = __toCommonJS(signals_exports);
82
+ var import_engine = require("./engine.cjs");
83
+ var import_control_binding = require("./control-binding.cjs");
84
+ var import_document_owner = require("./document-owner.cjs");
85
+ +var import_universal_owner = require("./universal-owner.cjs");
86
+ var import_requests = require("./requests.cjs");
87
+ var import_actions = require("./actions.cjs");
88
+ var import_derived_facade = require("./derived-facade.cjs");
89
+ @@ -106,6 +108,7 @@ var import_types = require("./types.cjs");
90
+ __derivedScalarViews,
91
+ __derivedViews,
92
+ __enableSignalDocument,
93
+ + __enableUniversalSignalDocument,
94
+ __methodDep,
95
+ __queryAt,
96
+ __queryViews,
97
+ diff --git a/dist/cjs/signals/local-hook.cjs b/dist/cjs/signals/local-hook.cjs
98
+ new file mode 100644
99
+ index 000000000..4858595ce
100
+ --- /dev/null
101
+ +++ b/dist/cjs/signals/local-hook.cjs
102
+ @@ -0,0 +1,44 @@
103
+ +"use strict";
104
+ +var __defProp = Object.defineProperty;
105
+ +var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
106
+ +var __getOwnPropNames = Object.getOwnPropertyNames;
107
+ +var __hasOwnProp = Object.prototype.hasOwnProperty;
108
+ +var __export = (target, all) => {
109
+ + for (var name in all)
110
+ + __defProp(target, name, { get: all[name], enumerable: true });
111
+ +};
112
+ +var __copyProps = (to, from, except, desc) => {
113
+ + if (from && typeof from === "object" || typeof from === "function") {
114
+ + for (let key of __getOwnPropNames(from))
115
+ + if (!__hasOwnProp.call(to, key) && key !== except)
116
+ + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
117
+ + }
118
+ + return to;
119
+ +};
120
+ +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
121
+ +var local_hook_exports = {};
122
+ +__export(local_hook_exports, {
123
+ + localSignalHook: () => localSignalHook,
124
+ + registerLocalSignalHook: () => registerLocalSignalHook
125
+ +});
126
+ +module.exports = __toCommonJS(local_hook_exports);
127
+ +const probes = [];
128
+ +function registerLocalSignalHook(probe) {
129
+ + probes.push(probe);
130
+ + return () => {
131
+ + const index = probes.indexOf(probe);
132
+ + if (index !== -1) probes.splice(index, 1);
133
+ + };
134
+ +}
135
+ +function localSignalHook(name, initialize, dispose, slot) {
136
+ + for (let index = probes.length - 1; index >= 0; index--) {
137
+ + const hook = probes[index]();
138
+ + if (hook !== null) return hook(name, initialize, dispose, slot);
139
+ + }
140
+ + throw new Error(`${name} requires an active Octane component render.`);
141
+ +}
142
+ +// Annotate the CommonJS export names for ESM import in node:
143
+ +0 && (module.exports = {
144
+ + localSignalHook,
145
+ + registerLocalSignalHook
146
+ +});
147
+ diff --git a/dist/cjs/signals/universal-owner.cjs b/dist/cjs/signals/universal-owner.cjs
148
+ new file mode 100644
149
+ index 000000000..00c323a8b
150
+ --- /dev/null
151
+ +++ b/dist/cjs/signals/universal-owner.cjs
152
+ @@ -0,0 +1,46 @@
153
+ +"use strict";
154
+ +var __defProp = Object.defineProperty;
155
+ +var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
156
+ +var __getOwnPropNames = Object.getOwnPropertyNames;
157
+ +var __hasOwnProp = Object.prototype.hasOwnProperty;
158
+ +var __export = (target, all) => {
159
+ + for (var name in all)
160
+ + __defProp(target, name, { get: all[name], enumerable: true });
161
+ +};
162
+ +var __copyProps = (to, from, except, desc) => {
163
+ + if (from && typeof from === "object" || typeof from === "function") {
164
+ + for (let key of __getOwnPropNames(from))
165
+ + if (!__hasOwnProp.call(to, key) && key !== except)
166
+ + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
167
+ + }
168
+ + return to;
169
+ +};
170
+ +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
171
+ +var universal_owner_exports = {};
172
+ +__export(universal_owner_exports, {
173
+ + enableUniversalSignalDocument: () => enableUniversalSignalDocument,
174
+ + installUniversalSignalDocumentProvider: () => installUniversalSignalDocumentProvider,
175
+ + universalSignalDocument: () => universalSignalDocument
176
+ +});
177
+ +module.exports = __toCommonJS(universal_owner_exports);
178
+ +var import_owner_context = require("./owner-context.cjs");
179
+ +let universalOwner;
180
+ +let provider;
181
+ +function installUniversalSignalDocumentProvider(next) {
182
+ + provider = next;
183
+ +}
184
+ +function universalSignalDocument() {
185
+ + return provider?.() ?? (universalOwner ??= Object.freeze({ scopeKey: "octane:universal" }));
186
+ +}
187
+ +function enableUniversalSignalDocument(abi = 1) {
188
+ + if (abi !== 1) {
189
+ + throw new TypeError("Unsupported universal signal owner ABI.");
190
+ + }
191
+ + (0, import_owner_context.installDefaultSignalOwner)(universalSignalDocument);
192
+ +}
193
+ +// Annotate the CommonJS export names for ESM import in node:
194
+ +0 && (module.exports = {
195
+ + enableUniversalSignalDocument,
196
+ + installUniversalSignalDocumentProvider,
197
+ + universalSignalDocument
198
+ +});
199
+ diff --git a/dist/compiler/compile.js b/dist/compiler/compile.js
200
+ index c468940c8..693a4eb90 100644
201
+ --- a/dist/compiler/compile.js
202
+ +++ b/dist/compiler/compile.js
203
+ @@ -2631,7 +2631,7 @@ function classifyViewTransitionOwnership(astBody, production, ownComponents) {
204
+
205
+ function hookRuntimeModulesForCompile(options, universalUnits = []) {
206
+ const modules = new Set(options?.__hookRuntimeModules || []);
207
+ - if (options?.nativeReads === true) {
208
+ + if (options?.nativeReads === true || options?.__universalSignalReads === true) {
209
+ modules.add('octane/signals/client');
210
+ modules.add('octane/signals/server');
211
+ }
212
+ @@ -12347,6 +12347,11 @@ function compileInternal(
213
+ universalRuntime: undefined,
214
+ rendererBoundaries: undefined,
215
+ rendererRegistry: undefined,
216
+ + // Universal owners observe reads at render time; the inner
217
+ + // compile must not emit the DOM native-read runtime helpers,
218
+ + // but signal hook classification still applies.
219
+ + nativeReads: false,
220
+ + __universalSignalReads: options.nativeReads === true,
221
+ __hookRuntimeModules: [...(options?.__hookRuntimeModules || []), renderer.module],
222
+ __runtimeImportRoutes: [
223
+ ...(options?.__runtimeImportRoutes ?? []),
224
+ @@ -12634,6 +12639,7 @@ function compileInternal(
225
+ nativeReads: options?.nativeReads === true,
226
+ opaqueSignalHandles:
227
+ options?.opaqueSignalHandles === true || options?.__signalModuleImport === true,
228
+ + signalReads: options?.nativeReads === true || options?.__universalSignalReads === true,
229
+ nativeModuleStyles: options?.nativeReads === true && hasModuleStyleMaps(ast.body),
230
+ signalHookSites: domSignalTarget(options),
231
+ // A split Hydrate query module is invoked as the existing server-rendered
232
+ @@ -14293,6 +14299,7 @@ function compileServer(
233
+ nativeReads: options?.nativeReads === true,
234
+ opaqueSignalHandles:
235
+ options?.opaqueSignalHandles === true || options?.__signalModuleImport === true,
236
+ + signalReads: options?.nativeReads === true || options?.__universalSignalReads === true,
237
+ nativeModuleStyles: options?.nativeReads === true && hasModuleStyleMaps(ast.body),
238
+ signalHookSites: domSignalTarget(options),
239
+ hmr: false, // SSR never hot-swaps in place; client/server production slot shapes stay aligned
240
+ @@ -21980,7 +21987,7 @@ function slotKeyedHookName(n, ctx) {
241
+ ctx.foreignImportLocals?.has(local) === true;
242
+ if (
243
+ imported !== undefined &&
244
+ - (HOOK_NAMES.has(imported) || (ctx.nativeReads && NATIVE_SIGNAL_HOOK_NAMES.has(imported)))
245
+ + (HOOK_NAMES.has(imported) || (ctx.signalReads && NATIVE_SIGNAL_HOOK_NAMES.has(imported)))
246
+ )
247
+ return imported;
248
+ if (!shadowsImport && HOOK_NAMES.has(local)) return local;
249
+ @@ -21990,7 +21997,7 @@ function slotKeyedHookName(n, ctx) {
250
+ const imported = n._octaneImportedHook ?? n._octaneHookRuntimeImportedHook;
251
+ if (
252
+ imported !== undefined &&
253
+ - (HOOK_NAMES.has(imported) || (ctx.nativeReads && NATIVE_SIGNAL_HOOK_NAMES.has(imported)))
254
+ + (HOOK_NAMES.has(imported) || (ctx.signalReads && NATIVE_SIGNAL_HOOK_NAMES.has(imported)))
255
+ ) {
256
+ return imported;
257
+ }
258
+ @@ -22853,7 +22860,7 @@ function rewriteHookCalls(node, ctx, componentName, localRoot = false) {
259
+ // enforced by rejectHookInJsLoop.
260
+ const isBuiltin =
261
+ (HOOK_NAMES.has(name) ||
262
+ - (ctx.nativeReads &&
263
+ + (ctx.signalReads &&
264
+ hookRuntimeImportedName !== undefined &&
265
+ NATIVE_SIGNAL_HOOK_NAMES.has(name))) &&
266
+ (generated ||
267
+ @@ -22984,7 +22991,7 @@ function rewriteHookCalls(node, ctx, componentName, localRoot = false) {
268
+ ) {
269
+ const name = n._octaneImportedHook ?? n._octaneHookRuntimeImportedHook;
270
+ const isBuiltin =
271
+ - HOOK_NAMES.has(name) || (ctx.nativeReads && NATIVE_SIGNAL_HOOK_NAMES.has(name));
272
+ + HOOK_NAMES.has(name) || (ctx.signalReads && NATIVE_SIGNAL_HOOK_NAMES.has(name));
273
+ const isServerUse = name === 'use' && ctx.mode === 'server';
274
+ if (isBuiltin || isServerUse) {
275
+ if (isBuiltin) {
276
+ diff --git a/dist/compiler/native-read-diagnostics.js b/dist/compiler/native-read-diagnostics.js
277
+ index 7b2acff60..d3356b4d4 100644
278
+ --- a/dist/compiler/native-read-diagnostics.js
279
+ +++ b/dist/compiler/native-read-diagnostics.js
280
+ @@ -149,9 +149,12 @@ export function assertNativeReadOptions(options) {
281
+ if (
282
+ options?.nativeReads === true &&
283
+ options.renderer?.target != null &&
284
+ - options.renderer.target !== 'dom'
285
+ + options.renderer.target !== 'dom' &&
286
+ + options.renderer.target !== 'universal'
287
+ ) {
288
+ - throw new Error('Octane native signal reads support only the DOM client and server.');
289
+ + throw new Error(
290
+ + 'Octane native signal reads support only the DOM client, DOM server, and universal renderers.',
291
+ + );
292
+ }
293
+ }
294
+
295
+ @@ -200,11 +203,11 @@ export function analyzeNativeReadDiagnostics(ast, source, filename, options = {}
296
+ filename,
297
+ rendererBoundaries: options.rendererBoundaries,
298
+ });
299
+ - const unsupported = boundaries.find(
300
+ - (boundary) =>
301
+ - boundary.childRenderer !== 'dom' &&
302
+ - options.rendererRegistry?.[boundary.childRenderer]?.target !== 'dom',
303
+ - );
304
+ + const unsupported = boundaries.find((boundary) => {
305
+ + if (boundary.childRenderer === 'dom') return false;
306
+ + const target = options.rendererRegistry?.[boundary.childRenderer]?.target;
307
+ + return target !== 'dom' && target !== 'universal';
308
+ + });
309
+ if (unsupported)
310
+ return [
311
+ nativeReadDiagnostic(
312
+ diff --git a/dist/compiler/slot-hooks.js b/dist/compiler/slot-hooks.js
313
+ index e4c9bfbc6..7ca611233 100644
314
+ --- a/dist/compiler/slot-hooks.js
315
+ +++ b/dist/compiler/slot-hooks.js
316
+ @@ -1044,12 +1044,12 @@ function walk(node, owner, st) {
317
+ }
318
+ const imported =
319
+ node._octaneImportedHook ??
320
+ - (st.nativeReads ? node._octaneHookRuntimeImportedHook : undefined);
321
+ + (st.signalReads ? node._octaneHookRuntimeImportedHook : undefined);
322
+ collectStateGetterEdit(node, imported, st);
323
+ if (
324
+ !st.manualSlots &&
325
+ imported &&
326
+ - (HOOK_NAMES.has(imported) || (st.nativeReads && NATIVE_SIGNAL_HOOK_NAMES.has(imported)))
327
+ + (HOOK_NAMES.has(imported) || (st.signalReads && NATIVE_SIGNAL_HOOK_NAMES.has(imported)))
328
+ ) {
329
+ const local =
330
+ node.callee?.type === 'Identifier'
331
+ @@ -1265,7 +1265,9 @@ export function slotHooks(source, id, options) {
332
+ HOOK_NAMES.has(name),
333
+ );
334
+ const manualProviders = options?.manualSlots ? findManualHookProviders(ast) : new Map();
335
+ - const nativeReadActivation = options?.nativeReads === true && importsNativeRenderer(ast);
336
+ + const universalTarget = options?.renderer?.target === 'universal';
337
+ + const nativeReadActivation =
338
+ + options?.nativeReads === true && !universalTarget && importsNativeRenderer(ast);
339
+ // Native signal reads exist only for the DOM client and server renderers.
340
+ const signalHookSites =
341
+ (options?.renderer?.target ?? 'dom') === 'dom' && options?.universalRuntime == null;
342
+ @@ -1376,7 +1378,8 @@ export function slotHooks(source, id, options) {
343
+ ]),
344
+ ),
345
+ manualSlots: options?.manualSlots === true,
346
+ - nativeReads: options?.nativeReads === true,
347
+ + nativeReads: options?.nativeReads === true && !universalTarget,
348
+ + signalReads: options?.nativeReads === true,
349
+ signalHookSites,
350
+ locals: importInfo.locals,
351
+ source,
352
+ @@ -1489,6 +1492,8 @@ export function slotHooks(source, id, options) {
353
+ ? 'enableServerSignalBindings'
354
+ : nativeReadActivation
355
+ ? 'enableSignalBindings'
356
+ + : universalTarget
357
+ + ? '__enableUniversalSignalDocument'
358
+ : '__enableSignalDocument';
359
+ const local = allocSlotName(st, `_$${imported}`);
360
+ let specifiers = signalHelperImports.get(request);
361
+ diff --git a/dist/node/runtime/hooks.js b/dist/node/runtime/hooks.js
362
+ index d02587d1a..eeb410f8e 100644
363
+ --- a/dist/node/runtime/hooks.js
364
+ +++ b/dist/node/runtime/hooks.js
365
+ @@ -1,3 +1,4 @@
366
+ +import { registerLocalSignalHook } from "../signals/local-hook.js";
367
+ const __octaneDev = process.env.NODE_ENV !== "production";
368
+ import {} from "./view-transition.js";
369
+ import { resolveHookPath } from "../hook-slot-cache.js";
370
+ @@ -104,6 +105,7 @@ function nativeLocalHook(name, initialize, dispose, slot) {
371
+ }
372
+ return cell.nativeValue;
373
+ }
374
+ +registerLocalSignalHook(() => CURRENT_SCOPE === null ? null : nativeLocalHook);
375
+ function applyHookUpdate(state, action, reducer) {
376
+ return reducer !== null ? reducer(state, action) : typeof action === "function" ? action(state) : action;
377
+ }
378
+ diff --git a/dist/node/signals/client.js b/dist/node/signals/client.js
379
+ index 21a39c3ce..3f85700b5 100644
380
+ --- a/dist/node/signals/client.js
381
+ +++ b/dist/node/signals/client.js
382
+ @@ -1,11 +1,11 @@
383
+ export * from "./index.js";
384
+ -import { nativeLocalHook } from "../runtime.js";
385
+ import { createLocalScope } from "./engine.js";
386
+ +import { localSignalHook } from "./local-hook.js";
387
+ function disposeLocalSignal(cell) {
388
+ cell.scope.dispose();
389
+ }
390
+ function useSignal$(initial, slot) {
391
+ - const cell = nativeLocalHook(
392
+ + const cell = localSignalHook(
393
+ "useSignal$",
394
+ () => {
395
+ const value = typeof initial === "function" ? initial() : initial;
396
+ diff --git a/dist/node/signals/document-owner.js b/dist/node/signals/document-owner.js
397
+ index 3b50394eb..e80903037 100644
398
+ --- a/dist/node/signals/document-owner.js
399
+ +++ b/dist/node/signals/document-owner.js
400
+ @@ -30,9 +30,8 @@ function enableSignalDocument(abi = 1) {
401
+ if (defaultInstalled) return;
402
+ defaultInstalled = true;
403
+ signalOwnerFrame = { enter: enterSynchronousSignalOwner, restore: restoreSynchronousSignalOwner };
404
+ - installDefaultSignalOwner(
405
+ - () => typeof document === "undefined" ? null : documentSignalOwner(document)
406
+ - );
407
+ + if (typeof document === "undefined") return;
408
+ + installDefaultSignalOwner(() => documentSignalOwner(document));
409
+ }
410
+ function installStreamedSignalOwnerActivator(activate) {
411
+ if (streamedSignalOwnerActivator !== void 0) {
412
+ diff --git a/dist/node/signals/facade.js b/dist/node/signals/facade.js
413
+ index 138348393..fc91d11ee 100644
414
+ --- a/dist/node/signals/facade.js
415
+ +++ b/dist/node/signals/facade.js
416
+ @@ -301,7 +301,7 @@ class Descriptor {
417
+ lexical;
418
+ /** The owner a use resolves for: its reader, or for a lexical handle its declaring owner. */
419
+ reader() {
420
+ - return this.lexical === this ? this.owner : requireOwner();
421
+ + return this.owner ?? requireOwner();
422
+ }
423
+ [SIGNAL_OWNER_RESOLVE](owner) {
424
+ requireSite(this.site);
425
+ diff --git a/dist/node/signals/index.js b/dist/node/signals/index.js
426
+ index 83ab8a6b1..f8a707103 100644
427
+ --- a/dist/node/signals/index.js
428
+ +++ b/dist/node/signals/index.js
429
+ @@ -1,6 +1,7 @@
430
+ import { createScope } from "./engine.js";
431
+ import { bindSignalControl } from "./control-binding.js";
432
+ import { enableSignalDocument } from "./document-owner.js";
433
+ +import { enableUniversalSignalDocument } from "./universal-owner.js";
434
+ import { createResource, query } from "./requests.js";
435
+ import { ActionUncertainError, action$, isActionUncertain, optimistic$ } from "./actions.js";
436
+ import { __derivedAt, derived$ } from "./derived-facade.js";
437
+ @@ -67,6 +68,7 @@ export {
438
+ installScalarViews as __derivedScalarViews,
439
+ installDerivedViews as __derivedViews,
440
+ enableSignalDocument as __enableSignalDocument,
441
+ + enableUniversalSignalDocument as __enableUniversalSignalDocument,
442
+ __methodDep,
443
+ __queryAt,
444
+ installResourceViews as __queryViews,
445
+ diff --git a/dist/node/signals/local-hook.js b/dist/node/signals/local-hook.js
446
+ new file mode 100644
447
+ index 000000000..77c63f5e2
448
+ --- /dev/null
449
+ +++ b/dist/node/signals/local-hook.js
450
+ @@ -0,0 +1,19 @@
451
+ +const probes = [];
452
+ +function registerLocalSignalHook(probe) {
453
+ + probes.push(probe);
454
+ + return () => {
455
+ + const index = probes.indexOf(probe);
456
+ + if (index !== -1) probes.splice(index, 1);
457
+ + };
458
+ +}
459
+ +function localSignalHook(name, initialize, dispose, slot) {
460
+ + for (let index = probes.length - 1; index >= 0; index--) {
461
+ + const hook = probes[index]();
462
+ + if (hook !== null) return hook(name, initialize, dispose, slot);
463
+ + }
464
+ + throw new Error(`${name} requires an active Octane component render.`);
465
+ +}
466
+ +export {
467
+ + localSignalHook,
468
+ + registerLocalSignalHook
469
+ +};
470
+ diff --git a/dist/node/signals/universal-owner.js b/dist/node/signals/universal-owner.js
471
+ new file mode 100644
472
+ index 000000000..ff5eb43e8
473
+ --- /dev/null
474
+ +++ b/dist/node/signals/universal-owner.js
475
+ @@ -0,0 +1,20 @@
476
+ +import { installDefaultSignalOwner } from "./owner-context.js";
477
+ +let universalOwner;
478
+ +let provider;
479
+ +function installUniversalSignalDocumentProvider(next) {
480
+ + provider = next;
481
+ +}
482
+ +function universalSignalDocument() {
483
+ + return provider?.() ?? (universalOwner ??= Object.freeze({ scopeKey: "octane:universal" }));
484
+ +}
485
+ +function enableUniversalSignalDocument(abi = 1) {
486
+ + if (abi !== 1) {
487
+ + throw new TypeError("Unsupported universal signal owner ABI.");
488
+ + }
489
+ + installDefaultSignalOwner(universalSignalDocument);
490
+ +}
491
+ +export {
492
+ + enableUniversalSignalDocument,
493
+ + installUniversalSignalDocumentProvider,
494
+ + universalSignalDocument
495
+ +};
496
+ diff --git a/dist/node/universal-core.js b/dist/node/universal-core.js
497
+ index 617ed9a63..1c6e01f17 100644
498
+ --- a/dist/node/universal-core.js
499
+ +++ b/dist/node/universal-core.js
500
+ @@ -17,6 +17,10 @@ import {
501
+ __profileTrackComponent
502
+ } from "./profiling.js";
503
+ import { getRendererHostFlusher } from "./renderer-bridge.js";
504
+ +import { universalSignalDocument } from "./signals/universal-owner.js";
505
+ +import { registerLocalSignalHook } from "./signals/local-hook.js";
506
+ +import { retireSignalOwnerIdentity, runWithSignalOwner } from "./signals/owner-context.js";
507
+ +import { beginNativeWriteGuard, endNativeWriteGuard, setNativeReadObserver } from "./signals/read-protocol.js";
508
+ import { createUniversalChildren } from "./universal-children.js";
509
+ import { resolveLazyDefaultProps } from "./shared-value-helpers.js";
510
+ import {
511
+ @@ -368,7 +372,11 @@ function universalList(items, render, empty) {
512
+ }
513
+ function renderableKey(value) {
514
+ if (value?.$$kind === UNIVERSAL_VALUE) {
515
+ - return value.key;
516
+ + if (value.key !== null) return value.key;
517
+ + // A compiler-generated root slot is transparent to keyed ownership.
518
+ + // Do not look through ranges: authored fragment boundaries remain distinct.
519
+ + const node = value.plan.root;
520
+ + return node.kind === "slot" ? renderableKey(value.values[node.slot]) : null;
521
+ }
522
+ if (value?.$$kind === UNIVERSAL_KEYED) {
523
+ return value.key;
524
+ @@ -911,6 +919,7 @@ function draftOwner(record, parent, replayPath) {
525
+ boundaryThenable: record.boundaryThenable,
526
+ isBoundary: record.isBoundary,
527
+ canHandleSuspense: record.canHandleSuspense,
528
+ + signalReads: null,
529
+ visibility: parent?.visibility ?? record.visibility,
530
+ contextStable: null
531
+ };
532
+ @@ -1121,6 +1130,8 @@ function executeOwner(owner, build, initialRenderCount = 0) {
533
+ owner.contextStable = null;
534
+ owner.needsRender = false;
535
+ owner.implicitSlot = 0;
536
+ + owner.hookChain = void 0;
537
+ + owner.signalReads = NO_SIGNAL_READS;
538
+ const previousOwner = CURRENT_OWNER;
539
+ const previousAttemptOwner = attempt.owner;
540
+ CURRENT_OWNER = owner;
541
+ @@ -1132,13 +1142,18 @@ function executeOwner(owner, build, initialRenderCount = 0) {
542
+ const profileFrame = typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && component !== null ? __profileBeginRender(owner.record, component, owner.record.mounted) : null;
543
+ let didThrow = false;
544
+ let thrown;
545
+ + const signalOwner = universalSignalOwner(owner.record);
546
+ + const previousReadObserver = setNativeReadObserver(observeUniversalSignalRead);
547
+ + const writeGuard = beginNativeWriteGuard();
548
+ try {
549
+ - output = build();
550
+ + output = runWithSignalOwner(signalOwner, build);
551
+ } catch (error) {
552
+ didThrow = true;
553
+ - thrown = error;
554
+ - throw error;
555
+ + thrown = isThenable(error) ? new UniversalSuspense(error) : error;
556
+ + throw thrown;
557
+ } finally {
558
+ + endNativeWriteGuard(writeGuard);
559
+ + setNativeReadObserver(previousReadObserver);
560
+ if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__) {
561
+ __profileEndRender(profileFrame, didThrow, thrown);
562
+ }
563
+ @@ -1302,6 +1317,8 @@ function disposeUncommittedDraft(owner) {
564
+ owner.record.componentProps = null;
565
+ owner.record.range = null;
566
+ owner.record.updates.clear();
567
+ + disposeUniversalSignalReads(owner.record);
568
+ + disposeUniversalLocalHooks(owner.hooks);
569
+ for (const hook of owner.hooks.values()) {
570
+ if (hook.kind === "effect-event") hook.cell.active = false;
571
+ }
572
+ @@ -3136,6 +3153,7 @@ function tryCreateCompactTemplateUpdateTransaction(root, blueprint, attempt, com
573
+ owner.componentProps = draftOwner2.componentProps;
574
+ owner.componentRevision = draftOwner2.componentRevision;
575
+ owner.hooks = draftOwner2.hooks;
576
+ + commitUniversalSignalReads(owner, draftOwner2.signalReads);
577
+ for (const [slot, applied] of draftOwner2.appliedUpdates) {
578
+ const queue = owner.updates.get(slot);
579
+ if (queue !== applied.queue || applied.lane) continue;
580
+ @@ -3457,5 +3457,6 @@ function resolveHookSlot(slot) {
581
+ const own = slot ?? `implicit:${owner.implicitSlot++}`;
582
+ - const depth = UNIVERSAL_SLOT_STACK.length;
583
+ - if (depth === 0) return own;
584
+ - return resolveHookPath(UNIVERSAL_SLOT_STACK, own, true);
585
+ + const chain = owner.hookChain;
586
+ + const resolved = chain === void 0 && UNIVERSAL_SLOT_STACK.length === 0 ? own : resolveHookPath(chain === void 0 ? UNIVERSAL_SLOT_STACK : [...UNIVERSAL_SLOT_STACK, chain], own, true);
587
+ + owner.hookChain = resolved;
588
+ + return resolved;
589
+ }
590
+ @@ -3507,7 +3507,9 @@ function withSlot(sym, fn, ...args) {
591
+ Object.defineProperty(provider, "length", { value: fn.length, configurable: true });
592
+ return provider;
593
+ }
594
+ function withSlot(sym, fn, ...args) {
595
+ + const hmr = fn?.[UNIVERSAL_HMR];
596
+ + if (hmr !== void 0) fn = hmr.component;
597
+ const driver = MANUAL_HOOK_DRIVER;
598
+ const pending = driver?.pending;
599
+ const active = driver?.active ?? false;
600
+ @@ -3683,6 +3701,86 @@ function scheduleOwner(owner, slot) {
601
+ }
602
+ owner.root.scheduleOwned(owner);
603
+ }
604
+ +const UNIVERSAL_SIGNAL_OWNERS = /* @__PURE__ */ new WeakMap();
605
+ +function universalSignalOwner(record) {
606
+ + let owner = UNIVERSAL_SIGNAL_OWNERS.get(record);
607
+ + if (owner === void 0) {
608
+ + const documentOwner = universalSignalDocument();
609
+ + const identity = {
610
+ + scopeKey: documentOwner.scopeKey,
611
+ + documentOwner,
612
+ + // The identity object itself is the opaque per-instance token — the
613
+ + // same shape DOM scopes use, so identity maps never retain the record.
614
+ + instanceOwner: null,
615
+ + instanceKey: `u:${record.id}`,
616
+ + enclosingOwner: record.parent === null ? void 0 : universalSignalOwner(record.parent)
617
+ + };
618
+ + identity.instanceOwner = identity;
619
+ + owner = Object.freeze(identity);
620
+ + UNIVERSAL_SIGNAL_OWNERS.set(record, owner);
621
+ + }
622
+ + return owner;
623
+ +}
624
+ +const NO_SIGNAL_READS = /* @__PURE__ */ new Set();
625
+ +function observeUniversalSignalRead(source) {
626
+ + const owner = CURRENT_OWNER;
627
+ + if (owner === null) return;
628
+ + if (owner.signalReads === NO_SIGNAL_READS) owner.signalReads = /* @__PURE__ */ new Set();
629
+ + owner.signalReads.add(source);
630
+ +}
631
+ +function commitUniversalSignalReads(record, reads) {
632
+ + if (reads === null) return;
633
+ + let subscriptions = record.signalSubscriptions;
634
+ + if (subscriptions !== void 0) {
635
+ + for (const [source, unsubscribe] of subscriptions) {
636
+ + if (!reads.has(source)) {
637
+ + subscriptions.delete(source);
638
+ + unsubscribe();
639
+ + }
640
+ + }
641
+ + }
642
+ + for (const source of reads) {
643
+ + if (subscriptions?.has(source)) continue;
644
+ + if (subscriptions === void 0) {
645
+ + subscriptions = /* @__PURE__ */ new Map();
646
+ + record.signalSubscriptions = subscriptions;
647
+ + }
648
+ + subscriptions.set(
649
+ + source,
650
+ + source.subscribe(() => {
651
+ + if (!record.disposed) scheduleOwner(record);
652
+ + })
653
+ + );
654
+ + }
655
+ + if (subscriptions !== void 0 && subscriptions.size === 0) {
656
+ + record.signalSubscriptions = void 0;
657
+ + }
658
+ +}
659
+ +function disposeUniversalSignalReads(record) {
660
+ + const subscriptions = record.signalSubscriptions;
661
+ + if (subscriptions !== void 0) {
662
+ + record.signalSubscriptions = void 0;
663
+ + for (const unsubscribe of subscriptions.values()) unsubscribe();
664
+ + }
665
+ + const owner = UNIVERSAL_SIGNAL_OWNERS.get(record);
666
+ + if (owner !== void 0) retireSignalOwnerIdentity(owner);
667
+ +}
668
+ +function disposeUniversalLocalHooks(hooks) {
669
+ + for (const hook of hooks.values()) {
670
+ + if (hook.kind === "local") hook.dispose(hook.value);
671
+ + }
672
+ +}
673
+ +function universalLocalHook(_name, initialize, dispose, slot) {
674
+ + const owner = currentDraftOwner();
675
+ + const resolved = resolveHookSlot(slot);
676
+ + let cell = owner.hooks.get(resolved);
677
+ + if (cell === void 0) {
678
+ + cell = { kind: "local", value: initialize(), dispose };
679
+ + owner.hooks.set(resolved, cell);
680
+ + }
681
+ + return cell.value;
682
+ +}
683
+ +registerLocalSignalHook(() => CURRENT_OWNER === null ? null : universalLocalHook);
684
+ function currentDraftOwner() {
685
+ currentAttempt();
686
+ const owner = activateLazyLeafOwner();
687
+ @@ -4797,15 +4895,35 @@ function use(usable) {
688
+ function useImperativeHandle(ref, create, deps, slot) {
689
+ useLayoutEffect(
690
+ () => {
691
+ - const value = create();
692
+ - if (typeof ref === "function") ref(value);
693
+ - else if (ref !== null) ref.current = value;
694
+ - return () => {
695
+ - if (typeof ref === "function") ref(null);
696
+ - else if (ref !== null) ref.current = null;
697
+ + const cleanups = [];
698
+ + let value;
699
+ + let initialized = false;
700
+ + const attach = (target) => {
701
+ + if (target == null) return;
702
+ + if (Array.isArray(target)) {
703
+ + for (const entry of target) attach(entry);
704
+ + return;
705
+ + }
706
+ + if (!initialized) {
707
+ + value = create();
708
+ + initialized = true;
709
+ + }
710
+ + if (typeof target === "function") {
711
+ + const cleanup = target(value);
712
+ + cleanups.push(typeof cleanup === "function" ? cleanup : () => target(null));
713
+ + } else {
714
+ + target.current = value;
715
+ + cleanups.push(() => { target.current = null; });
716
+ + }
717
+ };
718
+ + try {
719
+ + attach(ref);
720
+ + } catch (error) {
721
+ + try { runCommitTasks(cleanups); } finally { throw error; }
722
+ + }
723
+ + return () => runCommitTasks(cleanups);
724
+ },
725
+ - deps,
726
+ + deps == null ? deps : [...deps, ref],
727
+ slot
728
+ );
729
+ }
730
+ @@ -5800,9 +5918,9 @@ class UniversalRootImpl {
731
+ }
732
+ let result;
733
+ try {
734
+ - result = event.handler(payload);
735
+ + result = runWithSignalOwner(universalSignalOwner(event.owner), () => event.handler(payload));
736
+ } catch (error) {
737
+ - if (!routeUniversalOwnerError(event.owner, error)) throw error;
738
+ + if (!routeUniversalOwnerError(event.owner, error) && !reportUniversalUncaughtError(this, error)) throw error;
739
+ }
740
+ return result;
741
+ }
742
+ @@ -6382,6 +6500,8 @@ class UniversalRootImpl {
743
+ draft.record.componentProps = null;
744
+ draft.record.range = null;
745
+ draft.record.updates.clear();
746
+ + disposeUniversalSignalReads(draft.record);
747
+ + disposeUniversalLocalHooks(draft.hooks);
748
+ for (const hook of draft.hooks.values()) {
749
+ if (hook.kind === "effect-event") hook.cell.active = false;
750
+ }
751
+ @@ -6910,6 +7030,7 @@ class UniversalRootImpl {
752
+ record.componentRevision = draft.componentRevision;
753
+ record.parent = draft.parent?.record ?? null;
754
+ record.hooks = draft.hooks;
755
+ + commitUniversalSignalReads(record, draft.signalReads);
756
+ record.effectOrder = [...draft.seenEffects];
757
+ for (let index = 0; index < draft.seenEffects.length; index++) {
758
+ draft.seenEffects[index].previous = null;
759
+ @@ -8558,6 +8679,8 @@ class UniversalRootImpl {
760
+ owner.componentProps = null;
761
+ owner.range = null;
762
+ owner.updates.clear();
763
+ + disposeUniversalSignalReads(owner);
764
+ + disposeUniversalLocalHooks(owner.hooks);
765
+ }
766
+ for (const draft of draftOwnersParentFirst) {
767
+ const record = draft.record;
768
+ @@ -8567,6 +8690,7 @@ class UniversalRootImpl {
769
+ record.parent = draft.parent?.record ?? null;
770
+ }
771
+ record.hooks = draft.hooks;
772
+ + commitUniversalSignalReads(record, draft.signalReads);
773
+ record.effectOrder = [...draft.seenEffects];
774
+ for (let index = 0; index < draft.seenEffects.length; index++) {
775
+ draft.seenEffects[index].previous = null;
776
+ @@ -9078,6 +9202,8 @@ class UniversalRootImpl {
777
+ owner.componentProps = null;
778
+ owner.range = null;
779
+ owner.updates.clear();
780
+ + disposeUniversalSignalReads(owner);
781
+ + disposeUniversalLocalHooks(owner.hooks);
782
+ }
783
+ const deactivatedRegionCells = /* @__PURE__ */ new Set();
784
+ for (const bridge of regionBridges) {
785
+ @@ -10307,8 +10433,9 @@ function createObjectDriver(renderer = "object") {
786
+ };
787
+ }
788
+ export {
789
+ - Activity,
790
+ Children,
791
+ + descriptorChildren,
792
+ + Activity,
793
+ UNIVERSAL_HMR,
794
+ UNIVERSAL_TRANSPORT_PROTOCOL_VERSION,
795
+ __methodDep,
796
+ @@ -10320,7 +10447,6 @@ export {
797
+ createPortal,
798
+ createUniversalRoot,
799
+ defineUniversalComponent,
800
+ - descriptorChildren,
801
+ flushUniversalAct,
802
+ flushUniversalSync,
803
+ getUniversalHostFlusher,
804
+ diff --git a/dist/node/universal-native.js b/dist/node/universal-native.js
805
+ index a23c08065..de30978f6 100644
806
+ --- a/dist/node/universal-native.js
807
+ +++ b/dist/node/universal-native.js
808
+ @@ -8,9 +8,12 @@ import {
809
+ import {
810
+ universalContext
811
+ } from "./universal-core.js";
812
+ +export { Children, descriptorChildren } from "./universal-core.js";
813
+ +import { enableUniversalSignalDocument } from "./signals/universal-owner.js";
814
+ import { registerRendererContext, renderRendererContextProvider } from "./renderer-bridge.js";
815
+ import { CONTEXT_TAG } from "./runtime-tags.js";
816
+ import { registerContext } from "./context-identity.js";
817
+ +enableUniversalSignalDocument();
818
+ // @__NO_SIDE_EFFECTS__
819
+ function createContext(defaultValue) {
820
+ const context = ((props, scope) => scope === void 0 ? universalContext(context, props.value, props.children) : renderRendererContextProvider(context, props, scope));
821
+ diff --git a/dist/node/universal.js b/dist/node/universal.js
822
+ index 361cb665b..0c4585fd7 100644
823
+ --- a/dist/node/universal.js
824
+ +++ b/dist/node/universal.js
825
+ @@ -10,6 +10,9 @@ import {
826
+ createUniversalHostBoundary,
827
+ registerUniversalHostBridge
828
+ } from "./universal-dom-boundary.js";
829
+ +import { documentSignalOwner } from "./signals/document-owner.js";
830
+ +import { installUniversalSignalDocumentProvider } from "./signals/universal-owner.js";
831
+ +installUniversalSignalDocumentProvider(() => documentSignalOwner(document));
832
+ export {
833
+ createContext,
834
+ createSubSlot,
835
+ diff --git a/dist/runtime/hooks.js b/dist/runtime/hooks.js
836
+ index b03b45950..4278ac2a0 100644
837
+ --- a/dist/runtime/hooks.js
838
+ +++ b/dist/runtime/hooks.js
839
+ @@ -1,3 +1,4 @@
840
+ +import { registerLocalSignalHook } from "../signals/local-hook.js";
841
+ import {} from "./view-transition.js";
842
+ import { resolveHookPath } from "../hook-slot-cache.js";
843
+ import { __profileResolveHook, __profileSchedule, __profileCacheHit } from "../profiling.js";
844
+ @@ -103,6 +104,7 @@ function nativeLocalHook(name, initialize, dispose, slot) {
845
+ }
846
+ return cell.nativeValue;
847
+ }
848
+ +registerLocalSignalHook(() => CURRENT_SCOPE === null ? null : nativeLocalHook);
849
+ function applyHookUpdate(state, action, reducer) {
850
+ return reducer !== null ? reducer(state, action) : typeof action === "function" ? action(state) : action;
851
+ }
852
+ diff --git a/dist/signals/client.d.ts b/dist/signals/client.d.ts
853
+ index 6388c2f98..f9e98624f 100644
854
+ --- a/dist/signals/client.d.ts
855
+ +++ b/dist/signals/client.d.ts
856
+ @@ -1,4 +1,4 @@
857
+ -/** Optional component hooks for the native-read DOM compiler mode. */
858
+ +/** Optional component hooks for the native-read compiler mode (DOM and universal). */
859
+ export * from './index.js';
860
+ import type { WritableSignal } from './types.js';
861
+ /** A writable signal owned by this compiler-assigned component hook slot. */
862
+ diff --git a/dist/signals/client.js b/dist/signals/client.js
863
+ index 21a39c3ce..3f85700b5 100644
864
+ --- a/dist/signals/client.js
865
+ +++ b/dist/signals/client.js
866
+ @@ -1,11 +1,11 @@
867
+ export * from "./index.js";
868
+ -import { nativeLocalHook } from "../runtime.js";
869
+ import { createLocalScope } from "./engine.js";
870
+ +import { localSignalHook } from "./local-hook.js";
871
+ function disposeLocalSignal(cell) {
872
+ cell.scope.dispose();
873
+ }
874
+ function useSignal$(initial, slot) {
875
+ - const cell = nativeLocalHook(
876
+ + const cell = localSignalHook(
877
+ "useSignal$",
878
+ () => {
879
+ const value = typeof initial === "function" ? initial() : initial;
880
+ diff --git a/dist/signals/document-owner.js b/dist/signals/document-owner.js
881
+ index 6f2891ffb..557d6cc14 100644
882
+ --- a/dist/signals/document-owner.js
883
+ +++ b/dist/signals/document-owner.js
884
+ @@ -29,9 +29,8 @@ function enableSignalDocument(abi = 1) {
885
+ if (defaultInstalled) return;
886
+ defaultInstalled = true;
887
+ signalOwnerFrame = { enter: enterSynchronousSignalOwner, restore: restoreSynchronousSignalOwner };
888
+ - installDefaultSignalOwner(
889
+ - () => typeof document === "undefined" ? null : documentSignalOwner(document)
890
+ - );
891
+ + if (typeof document === "undefined") return;
892
+ + installDefaultSignalOwner(() => documentSignalOwner(document));
893
+ }
894
+ function installStreamedSignalOwnerActivator(activate) {
895
+ if (streamedSignalOwnerActivator !== void 0) {
896
+ diff --git a/dist/signals/facade.js b/dist/signals/facade.js
897
+ index 27e34593e..0e4e9a251 100644
898
+ --- a/dist/signals/facade.js
899
+ +++ b/dist/signals/facade.js
900
+ @@ -300,7 +300,7 @@ class Descriptor {
901
+ lexical;
902
+ /** The owner a use resolves for: its reader, or for a lexical handle its declaring owner. */
903
+ reader() {
904
+ - return this.lexical === this ? this.owner : requireOwner();
905
+ + return this.owner ?? requireOwner();
906
+ }
907
+ [SIGNAL_OWNER_RESOLVE](owner) {
908
+ requireSite(this.site);
909
+ diff --git a/dist/signals/index.d.ts b/dist/signals/index.d.ts
910
+ index 3fcbfe74c..68c7d724d 100644
911
+ --- a/dist/signals/index.d.ts
912
+ +++ b/dist/signals/index.d.ts
913
+ @@ -3,6 +3,7 @@ export { createScope } from './engine.js';
914
+ export { bindSignalControl } from './control-binding.js';
915
+ export type { SignalControlBinding } from './control-handoff.js';
916
+ export { enableSignalDocument as __enableSignalDocument } from './document-owner.js';
917
+ +export { enableUniversalSignalDocument as __enableUniversalSignalDocument } from './universal-owner.js';
918
+ export { createResource, query } from './requests.js';
919
+ export { ActionUncertainError, action$, isActionUncertain, optimistic$ } from './actions.js';
920
+ export { __derivedAt, derived$ } from './derived-facade.js';
921
+ diff --git a/dist/signals/index.js b/dist/signals/index.js
922
+ index 83ab8a6b1..f8a707103 100644
923
+ --- a/dist/signals/index.js
924
+ +++ b/dist/signals/index.js
925
+ @@ -1,6 +1,7 @@
926
+ import { createScope } from "./engine.js";
927
+ import { bindSignalControl } from "./control-binding.js";
928
+ import { enableSignalDocument } from "./document-owner.js";
929
+ +import { enableUniversalSignalDocument } from "./universal-owner.js";
930
+ import { createResource, query } from "./requests.js";
931
+ import { ActionUncertainError, action$, isActionUncertain, optimistic$ } from "./actions.js";
932
+ import { __derivedAt, derived$ } from "./derived-facade.js";
933
+ @@ -67,6 +68,7 @@ export {
934
+ installScalarViews as __derivedScalarViews,
935
+ installDerivedViews as __derivedViews,
936
+ enableSignalDocument as __enableSignalDocument,
937
+ + enableUniversalSignalDocument as __enableUniversalSignalDocument,
938
+ __methodDep,
939
+ __queryAt,
940
+ installResourceViews as __queryViews,
941
+ diff --git a/dist/signals/local-hook.d.ts b/dist/signals/local-hook.d.ts
942
+ new file mode 100644
943
+ index 000000000..d6c1770fc
944
+ --- /dev/null
945
+ +++ b/dist/signals/local-hook.d.ts
946
+ @@ -0,0 +1,16 @@
947
+ +/**
948
+ + * Renderer-provided slots for optional signal hooks.
949
+ + *
950
+ + * `useSignal$` allocates a component-local signal cell, but the cell itself
951
+ + * lives in whichever renderer is currently rendering — DOM hook slots on the
952
+ + * client/server, universal owner slots under `target: 'universal'` renderers.
953
+ + * `octane/signals` cannot import either runtime (both import the signal
954
+ + * engine), so each renderer registers a probe at module evaluation; the probe
955
+ + * answers only while one of its own owners is executing, which also settles
956
+ + * nesting (a universal boundary inside a DOM render probes last and wins).
957
+ + */
958
+ +export type LocalSignalHook = <T>(name: string, initialize: () => T, dispose: (value: T) => void, slot?: symbol | number) => T;
959
+ +/** @internal Renderer runtimes register once, at module evaluation. */
960
+ +export declare function registerLocalSignalHook(probe: () => LocalSignalHook | null): () => void;
961
+ +/** @internal Dispatch to the innermost renderer that currently owns a render. */
962
+ +export declare function localSignalHook<T>(name: string, initialize: () => T, dispose: (value: T) => void, slot?: symbol | number): T;
963
+ diff --git a/dist/signals/local-hook.js b/dist/signals/local-hook.js
964
+ new file mode 100644
965
+ index 000000000..77c63f5e2
966
+ --- /dev/null
967
+ +++ b/dist/signals/local-hook.js
968
+ @@ -0,0 +1,19 @@
969
+ +const probes = [];
970
+ +function registerLocalSignalHook(probe) {
971
+ + probes.push(probe);
972
+ + return () => {
973
+ + const index = probes.indexOf(probe);
974
+ + if (index !== -1) probes.splice(index, 1);
975
+ + };
976
+ +}
977
+ +function localSignalHook(name, initialize, dispose, slot) {
978
+ + for (let index = probes.length - 1; index >= 0; index--) {
979
+ + const hook = probes[index]();
980
+ + if (hook !== null) return hook(name, initialize, dispose, slot);
981
+ + }
982
+ + throw new Error(`${name} requires an active Octane component render.`);
983
+ +}
984
+ +export {
985
+ + localSignalHook,
986
+ + registerLocalSignalHook
987
+ +};
988
+ diff --git a/dist/signals/universal-owner.d.ts b/dist/signals/universal-owner.d.ts
989
+ new file mode 100644
990
+ index 000000000..0e57f3a79
991
+ --- /dev/null
992
+ +++ b/dist/signals/universal-owner.d.ts
993
+ @@ -0,0 +1,10 @@
994
+ +import type { SignalOwner } from './types.js';
995
+ +/**
996
+ + * @internal A DOM runtime aliases the ambient owner so universal-boundary and
997
+ + * DOM renders resolve the same document scope.
998
+ + */
999
+ +export declare function installUniversalSignalDocumentProvider(next: () => SignalOwner): void;
1000
+ +/** @internal Process-wide signal document for host-neutral renderers. */
1001
+ +export declare function universalSignalDocument(): SignalOwner;
1002
+ +/** @internal Compiler capability for ambient signal reads under universal renderers. */
1003
+ +export declare function enableUniversalSignalDocument(abi?: number): void;
1004
+ diff --git a/dist/signals/universal-owner.js b/dist/signals/universal-owner.js
1005
+ new file mode 100644
1006
+ index 000000000..ff5eb43e8
1007
+ --- /dev/null
1008
+ +++ b/dist/signals/universal-owner.js
1009
+ @@ -0,0 +1,20 @@
1010
+ +import { installDefaultSignalOwner } from "./owner-context.js";
1011
+ +let universalOwner;
1012
+ +let provider;
1013
+ +function installUniversalSignalDocumentProvider(next) {
1014
+ + provider = next;
1015
+ +}
1016
+ +function universalSignalDocument() {
1017
+ + return provider?.() ?? (universalOwner ??= Object.freeze({ scopeKey: "octane:universal" }));
1018
+ +}
1019
+ +function enableUniversalSignalDocument(abi = 1) {
1020
+ + if (abi !== 1) {
1021
+ + throw new TypeError("Unsupported universal signal owner ABI.");
1022
+ + }
1023
+ + installDefaultSignalOwner(universalSignalDocument);
1024
+ +}
1025
+ +export {
1026
+ + enableUniversalSignalDocument,
1027
+ + installUniversalSignalDocumentProvider,
1028
+ + universalSignalDocument
1029
+ +};
1030
+ diff --git a/dist/universal-core.d.ts b/dist/universal-core.d.ts
1031
+ index 1de434ab7..8a45b7529 100644
1032
+ --- a/dist/universal-core.d.ts
1033
+ +++ b/dist/universal-core.d.ts
1034
+ @@ -796,9 +796,8 @@ export declare function lazy<C extends UniversalComponent<any>>(load: () => Prom
1035
+ default: C;
1036
+ } | C>): C;
1037
+ export declare function use<T>(usable: UniversalContext<T> | PromiseLike<T>): T;
1038
+ -export declare function useImperativeHandle<T>(ref: {
1039
+ - current: T | null;
1040
+ -} | ((value: T | null) => void) | null, create: () => T, deps?: readonly unknown[] | null, slot?: unknown): void;
1041
+ +type UniversalImperativeRef<T> = { current: T | null } | ((value: T | null) => void | (() => void)) | readonly UniversalImperativeRef<T>[] | null | undefined;
1042
+ +export declare function useImperativeHandle<T>(ref: UniversalImperativeRef<T>, create: () => T, deps?: readonly unknown[] | null, slot?: unknown): void;
1043
+ export declare function useEffectEvent<T extends (...args: any[]) => any>(fn: T, slot?: unknown): T;
1044
+ export declare function useDebugValue(): void;
1045
+ export declare function startTransition(fn: () => void | Promise<unknown>): void;
1046
+ @@ -849,3 +848,4 @@ export interface ObjectHostContainer {
1047
+ }
1048
+ export declare function createObjectContainer(renderer?: string): ObjectHostContainer;
1049
+ export declare function createObjectDriver(renderer?: string): UniversalHostDriver<ObjectHostContainer, ObjectHostInstance>;
1050
+ +
1051
+ diff --git a/dist/universal-core.js b/dist/universal-core.js
1052
+ index 617ed9a63..1c6e01f17 100644
1053
+ --- a/dist/universal-core.js
1054
+ +++ b/dist/universal-core.js
1055
+ @@ -17,6 +17,10 @@ import {
1056
+ __profileTrackComponent
1057
+ } from "./profiling.js";
1058
+ import { getRendererHostFlusher } from "./renderer-bridge.js";
1059
+ +import { universalSignalDocument } from "./signals/universal-owner.js";
1060
+ +import { registerLocalSignalHook } from "./signals/local-hook.js";
1061
+ +import { retireSignalOwnerIdentity, runWithSignalOwner } from "./signals/owner-context.js";
1062
+ +import { beginNativeWriteGuard, endNativeWriteGuard, setNativeReadObserver } from "./signals/read-protocol.js";
1063
+ import { createUniversalChildren } from "./universal-children.js";
1064
+ import { resolveLazyDefaultProps } from "./shared-value-helpers.js";
1065
+ import {
1066
+ @@ -368,7 +372,11 @@ function universalList(items, render, empty) {
1067
+ }
1068
+ function renderableKey(value) {
1069
+ if (value?.$$kind === UNIVERSAL_VALUE) {
1070
+ - return value.key;
1071
+ + if (value.key !== null) return value.key;
1072
+ + // A compiler-generated root slot is transparent to keyed ownership.
1073
+ + // Do not look through ranges: authored fragment boundaries remain distinct.
1074
+ + const node = value.plan.root;
1075
+ + return node.kind === "slot" ? renderableKey(value.values[node.slot]) : null;
1076
+ }
1077
+ if (value?.$$kind === UNIVERSAL_KEYED) {
1078
+ return value.key;
1079
+ @@ -911,6 +919,7 @@ function draftOwner(record, parent, replayPath) {
1080
+ boundaryThenable: record.boundaryThenable,
1081
+ isBoundary: record.isBoundary,
1082
+ canHandleSuspense: record.canHandleSuspense,
1083
+ + signalReads: null,
1084
+ visibility: parent?.visibility ?? record.visibility,
1085
+ contextStable: null
1086
+ };
1087
+ @@ -1121,6 +1130,8 @@ function executeOwner(owner, build, initialRenderCount = 0) {
1088
+ owner.contextStable = null;
1089
+ owner.needsRender = false;
1090
+ owner.implicitSlot = 0;
1091
+ + owner.hookChain = void 0;
1092
+ + owner.signalReads = NO_SIGNAL_READS;
1093
+ const previousOwner = CURRENT_OWNER;
1094
+ const previousAttemptOwner = attempt.owner;
1095
+ CURRENT_OWNER = owner;
1096
+ @@ -1132,13 +1142,18 @@ function executeOwner(owner, build, initialRenderCount = 0) {
1097
+ const profileFrame = typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && component !== null ? __profileBeginRender(owner.record, component, owner.record.mounted) : null;
1098
+ let didThrow = false;
1099
+ let thrown;
1100
+ + const signalOwner = universalSignalOwner(owner.record);
1101
+ + const previousReadObserver = setNativeReadObserver(observeUniversalSignalRead);
1102
+ + const writeGuard = beginNativeWriteGuard();
1103
+ try {
1104
+ - output = build();
1105
+ + output = runWithSignalOwner(signalOwner, build);
1106
+ } catch (error) {
1107
+ didThrow = true;
1108
+ - thrown = error;
1109
+ - throw error;
1110
+ + thrown = isThenable(error) ? new UniversalSuspense(error) : error;
1111
+ + throw thrown;
1112
+ } finally {
1113
+ + endNativeWriteGuard(writeGuard);
1114
+ + setNativeReadObserver(previousReadObserver);
1115
+ if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__) {
1116
+ __profileEndRender(profileFrame, didThrow, thrown);
1117
+ }
1118
+ @@ -1302,6 +1317,8 @@ function disposeUncommittedDraft(owner) {
1119
+ owner.record.componentProps = null;
1120
+ owner.record.range = null;
1121
+ owner.record.updates.clear();
1122
+ + disposeUniversalSignalReads(owner.record);
1123
+ + disposeUniversalLocalHooks(owner.hooks);
1124
+ for (const hook of owner.hooks.values()) {
1125
+ if (hook.kind === "effect-event") hook.cell.active = false;
1126
+ }
1127
+ @@ -3136,6 +3153,7 @@ function tryCreateCompactTemplateUpdateTransaction(root, blueprint, attempt, com
1128
+ owner.componentProps = draftOwner2.componentProps;
1129
+ owner.componentRevision = draftOwner2.componentRevision;
1130
+ owner.hooks = draftOwner2.hooks;
1131
+ + commitUniversalSignalReads(owner, draftOwner2.signalReads);
1132
+ for (const [slot, applied] of draftOwner2.appliedUpdates) {
1133
+ const queue = owner.updates.get(slot);
1134
+ if (queue !== applied.queue || applied.lane) continue;
1135
+ @@ -3457,5 +3457,6 @@ function resolveHookSlot(slot) {
1136
+ const own = slot ?? `implicit:${owner.implicitSlot++}`;
1137
+ - const depth = UNIVERSAL_SLOT_STACK.length;
1138
+ - if (depth === 0) return own;
1139
+ - return resolveHookPath(UNIVERSAL_SLOT_STACK, own, true);
1140
+ + const chain = owner.hookChain;
1141
+ + const resolved = chain === void 0 && UNIVERSAL_SLOT_STACK.length === 0 ? own : resolveHookPath(chain === void 0 ? UNIVERSAL_SLOT_STACK : [...UNIVERSAL_SLOT_STACK, chain], own, true);
1142
+ + owner.hookChain = resolved;
1143
+ + return resolved;
1144
+ }
1145
+ @@ -3507,7 +3507,9 @@ function withSlot(sym, fn, ...args) {
1146
+ Object.defineProperty(provider, "length", { value: fn.length, configurable: true });
1147
+ return provider;
1148
+ }
1149
+ function withSlot(sym, fn, ...args) {
1150
+ + const hmr = fn?.[UNIVERSAL_HMR];
1151
+ + if (hmr !== void 0) fn = hmr.component;
1152
+ const driver = MANUAL_HOOK_DRIVER;
1153
+ const pending = driver?.pending;
1154
+ const active = driver?.active ?? false;
1155
+ @@ -3683,6 +3701,86 @@ function scheduleOwner(owner, slot) {
1156
+ }
1157
+ owner.root.scheduleOwned(owner);
1158
+ }
1159
+ +const UNIVERSAL_SIGNAL_OWNERS = /* @__PURE__ */ new WeakMap();
1160
+ +function universalSignalOwner(record) {
1161
+ + let owner = UNIVERSAL_SIGNAL_OWNERS.get(record);
1162
+ + if (owner === void 0) {
1163
+ + const documentOwner = universalSignalDocument();
1164
+ + const identity = {
1165
+ + scopeKey: documentOwner.scopeKey,
1166
+ + documentOwner,
1167
+ + // The identity object itself is the opaque per-instance token — the
1168
+ + // same shape DOM scopes use, so identity maps never retain the record.
1169
+ + instanceOwner: null,
1170
+ + instanceKey: `u:${record.id}`,
1171
+ + enclosingOwner: record.parent === null ? void 0 : universalSignalOwner(record.parent)
1172
+ + };
1173
+ + identity.instanceOwner = identity;
1174
+ + owner = Object.freeze(identity);
1175
+ + UNIVERSAL_SIGNAL_OWNERS.set(record, owner);
1176
+ + }
1177
+ + return owner;
1178
+ +}
1179
+ +const NO_SIGNAL_READS = /* @__PURE__ */ new Set();
1180
+ +function observeUniversalSignalRead(source) {
1181
+ + const owner = CURRENT_OWNER;
1182
+ + if (owner === null) return;
1183
+ + if (owner.signalReads === NO_SIGNAL_READS) owner.signalReads = /* @__PURE__ */ new Set();
1184
+ + owner.signalReads.add(source);
1185
+ +}
1186
+ +function commitUniversalSignalReads(record, reads) {
1187
+ + if (reads === null) return;
1188
+ + let subscriptions = record.signalSubscriptions;
1189
+ + if (subscriptions !== void 0) {
1190
+ + for (const [source, unsubscribe] of subscriptions) {
1191
+ + if (!reads.has(source)) {
1192
+ + subscriptions.delete(source);
1193
+ + unsubscribe();
1194
+ + }
1195
+ + }
1196
+ + }
1197
+ + for (const source of reads) {
1198
+ + if (subscriptions?.has(source)) continue;
1199
+ + if (subscriptions === void 0) {
1200
+ + subscriptions = /* @__PURE__ */ new Map();
1201
+ + record.signalSubscriptions = subscriptions;
1202
+ + }
1203
+ + subscriptions.set(
1204
+ + source,
1205
+ + source.subscribe(() => {
1206
+ + if (!record.disposed) scheduleOwner(record);
1207
+ + })
1208
+ + );
1209
+ + }
1210
+ + if (subscriptions !== void 0 && subscriptions.size === 0) {
1211
+ + record.signalSubscriptions = void 0;
1212
+ + }
1213
+ +}
1214
+ +function disposeUniversalSignalReads(record) {
1215
+ + const subscriptions = record.signalSubscriptions;
1216
+ + if (subscriptions !== void 0) {
1217
+ + record.signalSubscriptions = void 0;
1218
+ + for (const unsubscribe of subscriptions.values()) unsubscribe();
1219
+ + }
1220
+ + const owner = UNIVERSAL_SIGNAL_OWNERS.get(record);
1221
+ + if (owner !== void 0) retireSignalOwnerIdentity(owner);
1222
+ +}
1223
+ +function disposeUniversalLocalHooks(hooks) {
1224
+ + for (const hook of hooks.values()) {
1225
+ + if (hook.kind === "local") hook.dispose(hook.value);
1226
+ + }
1227
+ +}
1228
+ +function universalLocalHook(_name, initialize, dispose, slot) {
1229
+ + const owner = currentDraftOwner();
1230
+ + const resolved = resolveHookSlot(slot);
1231
+ + let cell = owner.hooks.get(resolved);
1232
+ + if (cell === void 0) {
1233
+ + cell = { kind: "local", value: initialize(), dispose };
1234
+ + owner.hooks.set(resolved, cell);
1235
+ + }
1236
+ + return cell.value;
1237
+ +}
1238
+ +registerLocalSignalHook(() => CURRENT_OWNER === null ? null : universalLocalHook);
1239
+ function currentDraftOwner() {
1240
+ currentAttempt();
1241
+ const owner = activateLazyLeafOwner();
1242
+ @@ -4797,15 +4895,35 @@ function use(usable) {
1243
+ function useImperativeHandle(ref, create, deps, slot) {
1244
+ useLayoutEffect(
1245
+ () => {
1246
+ - const value = create();
1247
+ - if (typeof ref === "function") ref(value);
1248
+ - else if (ref !== null) ref.current = value;
1249
+ - return () => {
1250
+ - if (typeof ref === "function") ref(null);
1251
+ - else if (ref !== null) ref.current = null;
1252
+ + const cleanups = [];
1253
+ + let value;
1254
+ + let initialized = false;
1255
+ + const attach = (target) => {
1256
+ + if (target == null) return;
1257
+ + if (Array.isArray(target)) {
1258
+ + for (const entry of target) attach(entry);
1259
+ + return;
1260
+ + }
1261
+ + if (!initialized) {
1262
+ + value = create();
1263
+ + initialized = true;
1264
+ + }
1265
+ + if (typeof target === "function") {
1266
+ + const cleanup = target(value);
1267
+ + cleanups.push(typeof cleanup === "function" ? cleanup : () => target(null));
1268
+ + } else {
1269
+ + target.current = value;
1270
+ + cleanups.push(() => { target.current = null; });
1271
+ + }
1272
+ };
1273
+ + try {
1274
+ + attach(ref);
1275
+ + } catch (error) {
1276
+ + try { runCommitTasks(cleanups); } finally { throw error; }
1277
+ + }
1278
+ + return () => runCommitTasks(cleanups);
1279
+ },
1280
+ - deps,
1281
+ + deps == null ? deps : [...deps, ref],
1282
+ slot
1283
+ );
1284
+ }
1285
+ @@ -5800,9 +5918,9 @@ class UniversalRootImpl {
1286
+ }
1287
+ let result;
1288
+ try {
1289
+ - result = event.handler(payload);
1290
+ + result = runWithSignalOwner(universalSignalOwner(event.owner), () => event.handler(payload));
1291
+ } catch (error) {
1292
+ - if (!routeUniversalOwnerError(event.owner, error)) throw error;
1293
+ + if (!routeUniversalOwnerError(event.owner, error) && !reportUniversalUncaughtError(this, error)) throw error;
1294
+ }
1295
+ return result;
1296
+ }
1297
+ @@ -6382,6 +6500,8 @@ class UniversalRootImpl {
1298
+ draft.record.componentProps = null;
1299
+ draft.record.range = null;
1300
+ draft.record.updates.clear();
1301
+ + disposeUniversalSignalReads(draft.record);
1302
+ + disposeUniversalLocalHooks(draft.hooks);
1303
+ for (const hook of draft.hooks.values()) {
1304
+ if (hook.kind === "effect-event") hook.cell.active = false;
1305
+ }
1306
+ @@ -6910,6 +7030,7 @@ class UniversalRootImpl {
1307
+ record.componentRevision = draft.componentRevision;
1308
+ record.parent = draft.parent?.record ?? null;
1309
+ record.hooks = draft.hooks;
1310
+ + commitUniversalSignalReads(record, draft.signalReads);
1311
+ record.effectOrder = [...draft.seenEffects];
1312
+ for (let index = 0; index < draft.seenEffects.length; index++) {
1313
+ draft.seenEffects[index].previous = null;
1314
+ @@ -8558,6 +8679,8 @@ class UniversalRootImpl {
1315
+ owner.componentProps = null;
1316
+ owner.range = null;
1317
+ owner.updates.clear();
1318
+ + disposeUniversalSignalReads(owner);
1319
+ + disposeUniversalLocalHooks(owner.hooks);
1320
+ }
1321
+ for (const draft of draftOwnersParentFirst) {
1322
+ const record = draft.record;
1323
+ @@ -8567,6 +8690,7 @@ class UniversalRootImpl {
1324
+ record.parent = draft.parent?.record ?? null;
1325
+ }
1326
+ record.hooks = draft.hooks;
1327
+ + commitUniversalSignalReads(record, draft.signalReads);
1328
+ record.effectOrder = [...draft.seenEffects];
1329
+ for (let index = 0; index < draft.seenEffects.length; index++) {
1330
+ draft.seenEffects[index].previous = null;
1331
+ @@ -9078,6 +9202,8 @@ class UniversalRootImpl {
1332
+ owner.componentProps = null;
1333
+ owner.range = null;
1334
+ owner.updates.clear();
1335
+ + disposeUniversalSignalReads(owner);
1336
+ + disposeUniversalLocalHooks(owner.hooks);
1337
+ }
1338
+ const deactivatedRegionCells = /* @__PURE__ */ new Set();
1339
+ for (const bridge of regionBridges) {
1340
+ @@ -10307,8 +10433,9 @@ function createObjectDriver(renderer = "object") {
1341
+ };
1342
+ }
1343
+ export {
1344
+ - Activity,
1345
+ Children,
1346
+ + descriptorChildren,
1347
+ + Activity,
1348
+ UNIVERSAL_HMR,
1349
+ UNIVERSAL_TRANSPORT_PROTOCOL_VERSION,
1350
+ __methodDep,
1351
+ @@ -10320,7 +10447,6 @@ export {
1352
+ createPortal,
1353
+ createUniversalRoot,
1354
+ defineUniversalComponent,
1355
+ - descriptorChildren,
1356
+ flushUniversalAct,
1357
+ flushUniversalSync,
1358
+ getUniversalHostFlusher,
1359
+ diff --git a/dist/universal-native.js b/dist/universal-native.js
1360
+ index a23c08065..de30978f6 100644
1361
+ --- a/dist/universal-native.js
1362
+ +++ b/dist/universal-native.js
1363
+ @@ -8,9 +8,12 @@ import {
1364
+ import {
1365
+ universalContext
1366
+ } from "./universal-core.js";
1367
+ +export { Children, descriptorChildren } from "./universal-core.js";
1368
+ +import { enableUniversalSignalDocument } from "./signals/universal-owner.js";
1369
+ import { registerRendererContext, renderRendererContextProvider } from "./renderer-bridge.js";
1370
+ import { CONTEXT_TAG } from "./runtime-tags.js";
1371
+ import { registerContext } from "./context-identity.js";
1372
+ +enableUniversalSignalDocument();
1373
+ // @__NO_SIDE_EFFECTS__
1374
+ function createContext(defaultValue) {
1375
+ const context = ((props, scope) => scope === void 0 ? universalContext(context, props.value, props.children) : renderRendererContextProvider(context, props, scope));
1376
+ diff --git a/dist/universal.js b/dist/universal.js
1377
+ index 361cb665b..0c4585fd7 100644
1378
+ --- a/dist/universal.js
1379
+ +++ b/dist/universal.js
1380
+ @@ -10,6 +10,9 @@ import {
1381
+ createUniversalHostBoundary,
1382
+ registerUniversalHostBridge
1383
+ } from "./universal-dom-boundary.js";
1384
+ +import { documentSignalOwner } from "./signals/document-owner.js";
1385
+ +import { installUniversalSignalDocumentProvider } from "./signals/universal-owner.js";
1386
+ +installUniversalSignalDocumentProvider(() => documentSignalOwner(document));
1387
+ export {
1388
+ createContext,
1389
+ createSubSlot,
1390
+ diff --git a/dist/cjs/runtime/drivers.cjs b/dist/cjs/runtime/drivers.cjs
1391
+ index 8f3c21a0..1b2e9d4c 100644
1392
+ --- a/dist/cjs/runtime/drivers.cjs
1393
+ +++ b/dist/cjs/runtime/drivers.cjs
1394
+ @@ -350,17 +350,18 @@
1395
+ detachSubtreeRefs = import_activity.detachRegisteredSubtreeRefs;
1396
+ withRefDetachSuppression = import_commit.withRegisteredRefDetachSuppression;
1397
+ }
1398
+ - activityRefCreated?.(scope.block, el);
1399
+ + const block = scope.block ?? scope;
1400
+ + activityRefCreated?.(block, el);
1401
+ const transaction = import_render.ROOT_RENDER_TRANSACTION;
1402
+ const entry = {
1403
+ ref,
1404
+ el,
1405
+ - block: scope.block,
1406
+ + block,
1407
+ op: transaction !== null ? transaction.ops.length : import_engine.COMMIT_OP
1408
+ };
1409
+ (import_render.WIP_CAPTURE !== null ? import_render.WIP_CAPTURE.refs : import_engine.refAttachQueue).push(entry);
1410
+ if (import_render.WIP_CAPTURE === null && NATIVE_READ_DRIVER) {
1411
+ - const owner = scope.block.idState.renderOwner;
1412
+ + const owner = block.idState.renderOwner;
1413
+ if (owner !== void 0) NATIVE_READ_DRIVER.stampQueuedPublication(owner, entry);
1414
+ }
1415
+ }
1416
+ diff --git a/dist/node/runtime/drivers.js b/dist/node/runtime/drivers.js
1417
+ index 9d4f2b17..3a8e1c52 100644
1418
+ --- a/dist/node/runtime/drivers.js
1419
+ +++ b/dist/node/runtime/drivers.js
1420
+ @@ -349,17 +349,18 @@
1421
+ detachSubtreeRefs = detachRegisteredSubtreeRefs;
1422
+ withRefDetachSuppression = withRegisteredRefDetachSuppression;
1423
+ }
1424
+ - activityRefCreated?.(scope.block, el);
1425
+ + const block = scope.block ?? scope;
1426
+ + activityRefCreated?.(block, el);
1427
+ const transaction = ROOT_RENDER_TRANSACTION;
1428
+ const entry = {
1429
+ ref,
1430
+ el,
1431
+ - block: scope.block,
1432
+ + block,
1433
+ op: transaction !== null ? transaction.ops.length : COMMIT_OP
1434
+ };
1435
+ (WIP_CAPTURE !== null ? WIP_CAPTURE.refs : refAttachQueue).push(entry);
1436
+ if (WIP_CAPTURE === null && NATIVE_READ_DRIVER) {
1437
+ - const owner = scope.block.idState.renderOwner;
1438
+ + const owner = block.idState.renderOwner;
1439
+ if (owner !== void 0) NATIVE_READ_DRIVER.stampQueuedPublication(owner, entry);
1440
+ }
1441
+ }
1442
+ diff --git a/dist/runtime/drivers.js b/dist/runtime/drivers.js
1443
+ index 1e7a3b90..5c9d02f1 100644
1444
+ --- a/dist/runtime/drivers.js
1445
+ +++ b/dist/runtime/drivers.js
1446
+ @@ -348,17 +348,18 @@
1447
+ detachSubtreeRefs = detachRegisteredSubtreeRefs;
1448
+ withRefDetachSuppression = withRegisteredRefDetachSuppression;
1449
+ }
1450
+ - activityRefCreated?.(scope.block, el);
1451
+ + const block = scope.block ?? scope;
1452
+ + activityRefCreated?.(block, el);
1453
+ const transaction = ROOT_RENDER_TRANSACTION;
1454
+ const entry = {
1455
+ ref,
1456
+ el,
1457
+ - block: scope.block,
1458
+ + block,
1459
+ op: transaction !== null ? transaction.ops.length : COMMIT_OP
1460
+ };
1461
+ (WIP_CAPTURE !== null ? WIP_CAPTURE.refs : refAttachQueue).push(entry);
1462
+ if (WIP_CAPTURE === null && NATIVE_READ_DRIVER) {
1463
+ - const owner = scope.block.idState.renderOwner;
1464
+ + const owner = block.idState.renderOwner;
1465
+ if (owner !== void 0) NATIVE_READ_DRIVER.stampQueuedPublication(owner, entry);
1466
+ }
1467
+ }
1468
+ diff --git a/dist/compiler/compile-universal.js b/dist/compiler/compile-universal.js
1469
+ index 229c024159..f453bb4e4d 100644
1470
+ --- a/dist/compiler/compile-universal.js
1471
+ +++ b/dist/compiler/compile-universal.js
1472
+ @@ -415,6 +415,7 @@
1473
+ 'useId',
1474
+ 'useImperativeHandle',
1475
+ 'useInsertionEffect',
1476
+ + '__methodDep',
1477
+ 'useLayoutEffect',
1478
+ 'useLinkedState',
1479
+ 'useMemo',