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