octane 0.15.0 → 0.16.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.
- package/dist/cjs/dom-focused-move.cjs +62 -33
- package/dist/cjs/hydration/dev-values.cjs +1 -1
- package/dist/cjs/index.cjs +2 -0
- package/dist/cjs/runtime/actions.cjs +73 -34
- package/dist/cjs/runtime/child-slots.cjs +11 -0
- package/dist/cjs/runtime/commit.cjs +17 -5
- package/dist/cjs/runtime/deopt.cjs +3 -2
- package/dist/cjs/runtime/engine.cjs +44 -32
- package/dist/cjs/runtime/events.cjs +19 -12
- package/dist/cjs/runtime/host-props.cjs +20 -16
- package/dist/cjs/runtime/hydration.cjs +4 -5
- package/dist/cjs/runtime/lists.cjs +20 -20
- package/dist/cjs/runtime/render.cjs +2 -0
- package/dist/cjs/runtime/roots.cjs +3 -2
- package/dist/cjs/runtime/signal-bindings.cjs +59 -9
- package/dist/cjs/runtime/suspense.cjs +18 -18
- package/dist/cjs/runtime/templates.cjs +4 -2
- package/dist/cjs/runtime/transitions.cjs +61 -3
- package/dist/cjs/runtime.server.cjs +1 -1
- package/dist/cjs/server/streamed-region.cjs +2 -2
- package/dist/cjs/server-rpc-batch-client.cjs +34 -59
- package/dist/cjs/server-rpc-client.cjs +114 -104
- package/dist/cjs/server-rpc-protocol.cjs +0 -59
- package/dist/cjs/server-rpc-stream-client.cjs +57 -1
- package/dist/cjs/signals/computations.cjs +74 -67
- package/dist/cjs/signals/engine.cjs +0 -24
- package/dist/cjs/signals/facade.cjs +15 -81
- package/dist/cjs/signals/index.cjs +14 -4
- package/dist/cjs/signals/native-adoption.cjs +112 -0
- package/dist/cjs/signals/native-read-seeds.cjs +4 -85
- package/dist/cjs/signals/requests.cjs +77 -72
- package/dist/cjs/signals/scalar-computations.cjs +59 -52
- package/dist/cjs/signals/server-reads.cjs +11 -2
- package/dist/cjs/signals/streamed-results.cjs +122 -0
- package/dist/cjs/trusted-types.cjs +41 -0
- package/dist/cjs/version.cjs +1 -1
- package/dist/compiler/compile-universal.js +287 -52
- package/dist/compiler/compile.js +130 -81
- package/dist/compiler/index.d.ts +11 -1
- package/dist/compiler/signal-declarations.js +33 -1
- package/dist/compiler/style-scopes.js +4 -1
- package/dist/compiler/typescript-output.js +6 -2
- package/dist/compiler/vite.js +20 -0
- package/dist/dom-binding-program.js +3 -1
- package/dist/dom-focused-move.d.ts +8 -3
- package/dist/dom-focused-move.js +61 -33
- package/dist/hydration/dev-values.d.ts +2 -1
- package/dist/hydration/dev-values.js +1 -1
- package/dist/hydration/stream-receiver.js +2 -1
- package/dist/hydration/streamed-signals.js +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/internal/server-rpc.d.ts +8 -0
- package/dist/internal/server-rpc.js +7 -0
- package/dist/node/dom-binding-program.js +3 -1
- package/dist/node/dom-focused-move.js +61 -33
- package/dist/node/hydration/dev-values.js +1 -1
- package/dist/node/hydration/stream-receiver.js +2 -1
- package/dist/node/hydration/streamed-signals.js +2 -1
- package/dist/node/index.js +2 -1
- package/dist/node/internal/server-rpc.js +7 -0
- package/dist/node/runtime/actions.js +78 -39
- package/dist/node/runtime/child-slots.js +10 -0
- package/dist/node/runtime/commit.js +16 -5
- package/dist/node/runtime/deopt.js +4 -3
- package/dist/node/runtime/engine.js +40 -29
- package/dist/node/runtime/events.js +19 -12
- package/dist/node/runtime/host-props.js +20 -16
- package/dist/node/runtime/hydration.js +4 -5
- package/dist/node/runtime/lists.js +21 -21
- package/dist/node/runtime/render.js +2 -0
- package/dist/node/runtime/roots.js +4 -2
- package/dist/node/runtime/signal-bindings.js +60 -10
- package/dist/node/runtime/suspense.js +25 -19
- package/dist/node/runtime/templates.js +4 -2
- package/dist/node/runtime/transitions.js +59 -2
- package/dist/node/runtime.server.js +1 -1
- package/dist/node/server/streamed-region.js +1 -1
- package/dist/node/server-rpc-batch-client.js +38 -58
- package/dist/node/server-rpc-client.js +106 -93
- package/dist/node/server-rpc-protocol.js +0 -57
- package/dist/node/server-rpc-response.js +131 -0
- package/dist/node/server-rpc-stream-client.js +56 -1
- package/dist/node/signals/computations.js +72 -66
- package/dist/node/signals/engine.js +0 -21
- package/dist/node/signals/facade.js +7 -82
- package/dist/node/signals/index.js +12 -4
- package/dist/node/signals/native-adoption.js +91 -0
- package/dist/node/signals/native-read-seeds.js +2 -82
- package/dist/node/signals/requests.js +73 -69
- package/dist/node/signals/scalar-computations.js +57 -51
- package/dist/node/signals/server-reads-elsewhere.js +17 -1
- package/dist/node/signals/server-reads.js +11 -1
- package/dist/node/signals/streamed-results.js +106 -0
- package/dist/node/trusted-types.js +16 -0
- package/dist/node/universal-core.js +61 -26
- package/dist/node/universal-native.js +3 -0
- package/dist/node/universal-styles.js +21 -0
- package/dist/node/universal.js +3 -0
- package/dist/node/version.js +1 -1
- package/dist/runtime/actions.js +78 -39
- package/dist/runtime/child-slots.d.ts +8 -0
- package/dist/runtime/child-slots.js +10 -0
- package/dist/runtime/commit.d.ts +8 -1
- package/dist/runtime/commit.js +16 -5
- package/dist/runtime/deopt.js +4 -3
- package/dist/runtime/effects.d.ts +1 -1
- package/dist/runtime/engine.d.ts +6 -3
- package/dist/runtime/engine.js +40 -29
- package/dist/runtime/events.js +19 -12
- package/dist/runtime/host-props.d.ts +2 -2
- package/dist/runtime/host-props.js +20 -16
- package/dist/runtime/hydration.d.ts +5 -6
- package/dist/runtime/hydration.js +4 -5
- package/dist/runtime/lists.js +21 -21
- package/dist/runtime/render.js +2 -0
- package/dist/runtime/roots.js +4 -2
- package/dist/runtime/signal-bindings.d.ts +2 -1
- package/dist/runtime/signal-bindings.js +60 -10
- package/dist/runtime/suspense.d.ts +1 -1
- package/dist/runtime/suspense.js +25 -19
- package/dist/runtime/templates.js +4 -2
- package/dist/runtime/transitions.d.ts +12 -1
- package/dist/runtime/transitions.js +59 -2
- package/dist/runtime/types.d.ts +5 -2
- package/dist/runtime.server.js +1 -1
- package/dist/server/streamed-region.js +1 -1
- package/dist/server-rpc-batch-client.d.ts +12 -4
- package/dist/server-rpc-batch-client.js +38 -58
- package/dist/server-rpc-client.d.ts +24 -1
- package/dist/server-rpc-client.js +106 -93
- package/dist/server-rpc-protocol.d.ts +0 -6
- package/dist/server-rpc-protocol.js +0 -57
- package/dist/server-rpc-response.d.ts +6 -0
- package/dist/server-rpc-response.js +131 -0
- package/dist/server-rpc-stream-client.js +56 -1
- package/dist/signals/computations.d.ts +22 -9
- package/dist/signals/computations.js +72 -66
- package/dist/signals/engine.d.ts +1 -11
- package/dist/signals/engine.js +0 -21
- package/dist/signals/facade.d.ts +10 -16
- package/dist/signals/facade.js +7 -82
- package/dist/signals/index.d.ts +5 -1
- package/dist/signals/index.js +12 -4
- package/dist/signals/native-adoption.d.ts +18 -0
- package/dist/signals/native-adoption.js +91 -0
- package/dist/signals/native-read-seeds.d.ts +12 -17
- package/dist/signals/native-read-seeds.js +2 -82
- package/dist/signals/redeclaration.d.ts +9 -4
- package/dist/signals/requests.d.ts +19 -10
- package/dist/signals/requests.js +73 -69
- package/dist/signals/scalar-computations.d.ts +2 -0
- package/dist/signals/scalar-computations.js +57 -51
- package/dist/signals/server-reads-elsewhere.d.ts +4 -0
- package/dist/signals/server-reads-elsewhere.js +17 -1
- package/dist/signals/server-reads.d.ts +3 -1
- package/dist/signals/server-reads.js +11 -1
- package/dist/signals/streamed-results.d.ts +18 -0
- package/dist/signals/streamed-results.js +106 -0
- package/dist/trusted-types.d.ts +18 -0
- package/dist/trusted-types.js +16 -0
- package/dist/universal-core.js +61 -26
- package/dist/universal-native.d.ts +2 -0
- package/dist/universal-native.js +3 -0
- package/dist/universal-styles.d.ts +15 -0
- package/dist/universal-styles.js +21 -0
- package/dist/universal.d.ts +2 -0
- package/dist/universal.js +3 -0
- package/dist/version.js +1 -1
- package/package.json +6 -1
|
@@ -18,54 +18,83 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var dom_focused_move_exports = {};
|
|
20
20
|
__export(dom_focused_move_exports, {
|
|
21
|
+
isChildOf: () => isChildOf,
|
|
21
22
|
moveNativeNodeBefore: () => moveNativeNodeBefore
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(dom_focused_move_exports);
|
|
24
25
|
function moveNativeNodeBefore(parent, node, anchor, focused, contentEditable) {
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
do {
|
|
29
|
-
if (node.contains(candidate)) {
|
|
30
|
-
containsFocused = true;
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
const root = candidate.getRootNode();
|
|
34
|
-
candidate = root.nodeType === 11 ? root.host : void 0;
|
|
35
|
-
} while (candidate !== void 0);
|
|
36
|
-
}
|
|
37
|
-
if (!containsFocused) {
|
|
38
|
-
parent.insertBefore(node, anchor);
|
|
26
|
+
const move = nativeMove(parent);
|
|
27
|
+
if (move !== null && node.isConnected === true && parent.ownerDocument === node.ownerDocument && !(contentEditable && containsFocus(node, focused))) {
|
|
28
|
+
move.call(parent, node, anchor);
|
|
39
29
|
return;
|
|
40
30
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
moveBefore.call(parent, node, anchor);
|
|
31
|
+
if (!containsFocus(node, focused)) {
|
|
32
|
+
parent.insertBefore(node, anchor);
|
|
44
33
|
return;
|
|
45
34
|
}
|
|
46
|
-
if (node
|
|
35
|
+
if (!isChildOf(node, parent) || anchor !== null && !isChildOf(anchor, parent)) {
|
|
47
36
|
parent.insertBefore(node, anchor);
|
|
48
37
|
return;
|
|
49
38
|
}
|
|
50
|
-
if (node === anchor || node
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
39
|
+
if (node === anchor || nextOf(node) === anchor) return;
|
|
40
|
+
const forward = anchor === null || // 4 is Node.DOCUMENT_POSITION_FOLLOWING.
|
|
41
|
+
(nodeProto(node).compareDocumentPosition.call(node, anchor) & 4) !== 0;
|
|
42
|
+
const siblings = [];
|
|
43
|
+
for (let cursor = forward ? nextOf(node) : anchor; cursor !== null && cursor !== (forward ? anchor : node); cursor = nextOf(cursor))
|
|
44
|
+
siblings.push(cursor);
|
|
45
|
+
const rotate = move ?? parent.insertBefore;
|
|
46
|
+
let after = node;
|
|
47
|
+
for (let i = 0; i < siblings.length; i++) {
|
|
48
|
+
const sibling = siblings[i];
|
|
49
|
+
if (!isChildOf(sibling, parent)) continue;
|
|
50
|
+
if (forward) rotate.call(parent, sibling, node);
|
|
51
|
+
else {
|
|
52
|
+
rotate.call(parent, sibling, nextOf(after));
|
|
53
|
+
if (isChildOf(sibling, parent)) after = sibling;
|
|
65
54
|
}
|
|
66
55
|
}
|
|
67
56
|
}
|
|
57
|
+
let NODE_PROTO;
|
|
58
|
+
let parentNodeGetter;
|
|
59
|
+
let nextSiblingGetter;
|
|
60
|
+
function nodeProto(node) {
|
|
61
|
+
if (NODE_PROTO === void 0) {
|
|
62
|
+
let proto = Object.getPrototypeOf(node);
|
|
63
|
+
while (!Object.prototype.hasOwnProperty.call(proto, "nextSibling"))
|
|
64
|
+
proto = Object.getPrototypeOf(proto);
|
|
65
|
+
NODE_PROTO = proto;
|
|
66
|
+
}
|
|
67
|
+
return NODE_PROTO;
|
|
68
|
+
}
|
|
69
|
+
function nodeGetter(node, name) {
|
|
70
|
+
return Object.getOwnPropertyDescriptor(nodeProto(node), name).get;
|
|
71
|
+
}
|
|
72
|
+
function isChildOf(node, parent) {
|
|
73
|
+
parentNodeGetter ??= nodeGetter(node, "parentNode");
|
|
74
|
+
return parentNodeGetter.call(node) === parent;
|
|
75
|
+
}
|
|
76
|
+
function nextOf(node) {
|
|
77
|
+
nextSiblingGetter ??= nodeGetter(node, "nextSibling");
|
|
78
|
+
return nextSiblingGetter.call(node);
|
|
79
|
+
}
|
|
80
|
+
function nativeMove(parent) {
|
|
81
|
+
if (parent.isConnected !== true) return null;
|
|
82
|
+
const move = parent.moveBefore;
|
|
83
|
+
return typeof move === "function" ? move : null;
|
|
84
|
+
}
|
|
85
|
+
function containsFocus(node, focused) {
|
|
86
|
+
if (node === focused) return true;
|
|
87
|
+
if (focused === null || node.nodeType !== 1) return false;
|
|
88
|
+
let candidate = focused;
|
|
89
|
+
do {
|
|
90
|
+
if (nodeProto(node).contains.call(node, candidate)) return true;
|
|
91
|
+
const root = candidate.getRootNode();
|
|
92
|
+
candidate = root.nodeType === 11 ? root.host : void 0;
|
|
93
|
+
} while (candidate !== void 0);
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
68
96
|
// Annotate the CommonJS export names for ESM import in node:
|
|
69
97
|
0 && (module.exports = {
|
|
98
|
+
isChildOf,
|
|
70
99
|
moveNativeNodeBefore
|
|
71
100
|
});
|
|
@@ -77,7 +77,7 @@ function unpatchedHTML(pass, el, next) {
|
|
|
77
77
|
let client;
|
|
78
78
|
if (el.localName === "script") {
|
|
79
79
|
server = el.textContent ?? "";
|
|
80
|
-
client = next.replace(
|
|
80
|
+
client = String(next).replace(
|
|
81
81
|
INLINE_SCRIPT_TOKEN,
|
|
82
82
|
(_match, prefix, s, suffix) => `${prefix}${s === "s" ? "\\u0073" : "\\u0053"}${suffix}`
|
|
83
83
|
).replace(SCRIPT_DATA_NORMALIZATION, (match) => match === "\0" ? "\uFFFD" : "\n");
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -44,6 +44,7 @@ __export(index_exports, {
|
|
|
44
44
|
__runOnCatch: () => import_runtime.__runOnCatch,
|
|
45
45
|
__s: () => import_runtime.markSingleRoot,
|
|
46
46
|
__serverRpc: () => import_server_rpc_client.__serverRpc,
|
|
47
|
+
__serverRpcStream: () => import_server_rpc_client.__serverRpcStream,
|
|
47
48
|
__useCommittedState: () => import_runtime.__useCommittedState,
|
|
48
49
|
__useLinkedStateWithGetter: () => import_runtime.__useLinkedStateWithGetter,
|
|
49
50
|
__useReducerWithGetter: () => import_runtime.__useReducerWithGetter,
|
|
@@ -302,6 +303,7 @@ var import_method_dep = require("./method-dep.cjs");
|
|
|
302
303
|
__runOnCatch,
|
|
303
304
|
__s,
|
|
304
305
|
__serverRpc,
|
|
306
|
+
__serverRpcStream,
|
|
305
307
|
__useCommittedState,
|
|
306
308
|
__useLinkedStateWithGetter,
|
|
307
309
|
__useReducerWithGetter,
|
|
@@ -44,6 +44,7 @@ var import_hydration = require("./hydration.cjs");
|
|
|
44
44
|
var import_portals = require("./portals.cjs");
|
|
45
45
|
var import_suspense = require("./suspense.cjs");
|
|
46
46
|
var import_render = require("./render.cjs");
|
|
47
|
+
var import_commit = require("./commit.cjs");
|
|
47
48
|
var import_host_props = require("./host-props.cjs");
|
|
48
49
|
var import_events = require("./events.cjs");
|
|
49
50
|
var import_forms = require("./forms.cjs");
|
|
@@ -405,33 +406,38 @@ function useOptimistic(passthrough, updateFnOrSlot, slot) {
|
|
|
405
406
|
const block = import_render.CURRENT_BLOCK;
|
|
406
407
|
let s = scope.hooks?.get(slot);
|
|
407
408
|
if (s === void 0) {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
slotRef.queue.length = 0;
|
|
416
|
-
} else {
|
|
417
|
-
let write = indices[0];
|
|
418
|
-
let skip = 0;
|
|
419
|
-
for (let read = write; read < slotRef.queue.length; read++) {
|
|
420
|
-
if (read === indices[skip]) skip++;
|
|
421
|
-
else slotRef.queue[write++] = slotRef.queue[read];
|
|
422
|
-
}
|
|
423
|
-
slotRef.queue.length = write;
|
|
409
|
+
const compact = (owner) => {
|
|
410
|
+
const queue2 = slotRef.queue;
|
|
411
|
+
const owners2 = slotRef.owners;
|
|
412
|
+
if (owners2 === null) {
|
|
413
|
+
if (owner !== null || queue2.length === 0) return false;
|
|
414
|
+
queue2.length = 0;
|
|
415
|
+
return true;
|
|
424
416
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
417
|
+
let write = 0;
|
|
418
|
+
for (let read = 0; read < queue2.length; read++) {
|
|
419
|
+
if (owners2[read] === owner) continue;
|
|
420
|
+
queue2[write] = queue2[read];
|
|
421
|
+
owners2[write++] = owners2[read];
|
|
430
422
|
}
|
|
423
|
+
const removed = write !== queue2.length;
|
|
424
|
+
queue2.length = write;
|
|
425
|
+
owners2.length = write;
|
|
426
|
+
if (slotRef.batches === null || slotRef.batches.size === 0) slotRef.owners = null;
|
|
427
|
+
return removed;
|
|
428
|
+
};
|
|
429
|
+
const revert = () => {
|
|
430
|
+
if (block.disposed) return;
|
|
431
|
+
if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__)
|
|
432
|
+
(0, import_profiling.__profileSchedule)(block, "optimistic-revert", slot);
|
|
433
|
+
(0, import_engine.scheduleHookPublication)(block);
|
|
431
434
|
};
|
|
432
435
|
const slotRef = {
|
|
433
436
|
queue: [],
|
|
434
|
-
|
|
437
|
+
owners: null,
|
|
438
|
+
batches: null,
|
|
439
|
+
unownedPending: false,
|
|
440
|
+
compact,
|
|
435
441
|
add: (value) => {
|
|
436
442
|
const inAction = (0, import_engine.isTransitionUpdateContext)();
|
|
437
443
|
if (__octaneDev && !inAction) {
|
|
@@ -440,13 +446,33 @@ function useOptimistic(passthrough, updateFnOrSlot, slot) {
|
|
|
440
446
|
);
|
|
441
447
|
}
|
|
442
448
|
slotRef.queue.push(value);
|
|
443
|
-
|
|
444
|
-
|
|
449
|
+
const batch = inAction ? (0, import_transitions.transitionActionBatchForUpdate)() : null;
|
|
450
|
+
if (batch !== null) {
|
|
451
|
+
const owners2 = slotRef.owners ?? (slotRef.owners = new Array(slotRef.queue.length - 1).fill(null));
|
|
452
|
+
owners2.push(batch);
|
|
453
|
+
if (batch.finished) compact(batch);
|
|
454
|
+
else {
|
|
455
|
+
let batches = slotRef.batches;
|
|
456
|
+
if (batches === null) slotRef.batches = batches = /* @__PURE__ */ new Map();
|
|
457
|
+
if (!batches.has(batch))
|
|
458
|
+
batches.set(
|
|
459
|
+
batch,
|
|
460
|
+
(0, import_transitions.onTransitionBatchFinished)(batch, () => {
|
|
461
|
+
batches.delete(batch);
|
|
462
|
+
if (batches.size === 0) slotRef.batches = null;
|
|
463
|
+
if (compact(batch)) revert();
|
|
464
|
+
})
|
|
465
|
+
);
|
|
466
|
+
}
|
|
445
467
|
} else {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
468
|
+
slotRef.owners?.push(null);
|
|
469
|
+
if (!slotRef.unownedPending) {
|
|
470
|
+
slotRef.unownedPending = true;
|
|
471
|
+
queueMicrotask(() => {
|
|
472
|
+
slotRef.unownedPending = false;
|
|
473
|
+
if (compact(null)) revert();
|
|
474
|
+
});
|
|
475
|
+
}
|
|
450
476
|
}
|
|
451
477
|
if (!block.disposed) {
|
|
452
478
|
if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__)
|
|
@@ -458,15 +484,28 @@ function useOptimistic(passthrough, updateFnOrSlot, slot) {
|
|
|
458
484
|
};
|
|
459
485
|
s = slotRef;
|
|
460
486
|
(0, import_hooks.ensureHooks)(scope).set(slot, slotRef);
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
487
|
+
(0, import_hooks.registerHookCleanup)(scope, () => {
|
|
488
|
+
const batches = slotRef.batches;
|
|
489
|
+
if (batches === null) return;
|
|
490
|
+
for (const unsubscribe of batches.values()) unsubscribe();
|
|
491
|
+
batches.clear();
|
|
492
|
+
slotRef.batches = null;
|
|
493
|
+
});
|
|
466
494
|
}
|
|
467
495
|
let optimistic = passthrough;
|
|
468
496
|
const reduce = updateFn ?? basicOptimisticReducer;
|
|
469
|
-
|
|
497
|
+
const queue = s.queue;
|
|
498
|
+
const owners = s.owners;
|
|
499
|
+
const transition = block.currentRenderMode === "transition";
|
|
500
|
+
let reverted = null;
|
|
501
|
+
for (let i = 0; i < queue.length; i++) {
|
|
502
|
+
const owner = owners === null ? null : owners[i];
|
|
503
|
+
if (owner !== null && import_drivers.TRANSITION_ROOT_DRIVER && (transition || ((0, import_transitions.rootTransitionBatch)(owner).pendingHolds ?? 0) !== 0) && import_drivers.TRANSITION_ROOT_DRIVER.fold(owner, transition, import_render.ROOT_RENDER_TRANSACTION)) {
|
|
504
|
+
if (reverted === null) reverted = [owner];
|
|
505
|
+
else if (reverted.indexOf(owner) === -1) reverted.push(owner);
|
|
506
|
+
} else optimistic = reduce(optimistic, queue[i]);
|
|
507
|
+
}
|
|
508
|
+
if (reverted !== null) for (const owner of reverted) (0, import_commit.atCommit)(s.compact, owner);
|
|
470
509
|
return [optimistic, s.add];
|
|
471
510
|
}
|
|
472
511
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -30,6 +30,7 @@ __export(child_slots_exports, {
|
|
|
30
30
|
compilerCacheImmutableArrayFilter: () => compilerCacheImmutableArrayFilter,
|
|
31
31
|
compilerCacheMappedArray: () => compilerCacheMappedArray,
|
|
32
32
|
mapSlot: () => mapSlot,
|
|
33
|
+
renderSignalChildSlot: () => renderSignalChildSlot,
|
|
33
34
|
textHole: () => textHole,
|
|
34
35
|
textHoleUpdate: () => textHoleUpdate,
|
|
35
36
|
textSlot: () => textSlot
|
|
@@ -267,6 +268,13 @@ function mapSlot(scopeOrItems, slotOrMethod, domParent, items, method, native, c
|
|
|
267
268
|
}
|
|
268
269
|
}
|
|
269
270
|
}
|
|
271
|
+
function renderSignalChildSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsHost, compactable, onlyChild, bindingMarker, cachedText) {
|
|
272
|
+
if (onlyChild) return childTextHole(parentScope, slotKey, domParent, value, cachedText);
|
|
273
|
+
if (bindingMarker === void 0)
|
|
274
|
+
childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsHost, compactable);
|
|
275
|
+
else bindingChildSlot(parentScope, slotKey, domParent, value, bindingMarker, anchor, ownEnd);
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
270
278
|
function bindingChildSlot(parentScope, slotKey, domParent, value, marker, anchor, ownEnd) {
|
|
271
279
|
const frame = import_hydration_flag.hydrationStarted ? import_hydration_presentation.PRESENTATION_HYDRATION : null;
|
|
272
280
|
if (frame?.revision !== void 0) {
|
|
@@ -337,6 +345,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
|
|
|
337
345
|
}
|
|
338
346
|
if (import_drivers.SIGNAL_CHILD) {
|
|
339
347
|
if ((0, import_drivers.SIGNAL_CHILD)(
|
|
348
|
+
renderSignalChildSlot,
|
|
340
349
|
parentScope,
|
|
341
350
|
slotKey,
|
|
342
351
|
domParent,
|
|
@@ -349,6 +358,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
|
|
|
349
358
|
))
|
|
350
359
|
return;
|
|
351
360
|
} else if (import_read_protocol.nativeSignalHydration && (0, import_signal_bindings.bindImplicitSignalChild)(
|
|
361
|
+
renderSignalChildSlot,
|
|
352
362
|
parentScope,
|
|
353
363
|
slotKey,
|
|
354
364
|
domParent,
|
|
@@ -1108,6 +1118,7 @@ function childTextHole(parentScope, slotKey, domParent, value, cachedNode) {
|
|
|
1108
1118
|
compilerCacheImmutableArrayFilter,
|
|
1109
1119
|
compilerCacheMappedArray,
|
|
1110
1120
|
mapSlot,
|
|
1121
|
+
renderSignalChildSlot,
|
|
1111
1122
|
textHole,
|
|
1112
1123
|
textHoleUpdate,
|
|
1113
1124
|
textSlot
|
|
@@ -42,6 +42,7 @@ __export(commit_exports, {
|
|
|
42
42
|
bagRecord: () => bagRecord,
|
|
43
43
|
captureFocusSelection: () => captureFocusSelection,
|
|
44
44
|
captureQueuedFocusSelection: () => captureQueuedFocusSelection,
|
|
45
|
+
commitQueuedBag: () => commitQueuedBag,
|
|
45
46
|
defersRootUnmount: () => defersRootUnmount,
|
|
46
47
|
discardMarker: () => discardMarker,
|
|
47
48
|
dropRootOps: () => dropRootOps,
|
|
@@ -130,7 +131,7 @@ function bagRecord(s, next, cell, value, committed, bundle, a0, a1) {
|
|
|
130
131
|
next[size] = s;
|
|
131
132
|
next[size + 1] = transaction.ops.length;
|
|
132
133
|
bag.$ = state | BAG_QUEUED;
|
|
133
|
-
transaction.ops.push(
|
|
134
|
+
transaction.ops.push(commitQueuedBag, bag);
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
next[cell] = changed ? value : bag;
|
|
@@ -147,9 +148,19 @@ function bagResume(bag) {
|
|
|
147
148
|
journalObjectOnce(next);
|
|
148
149
|
return next;
|
|
149
150
|
}
|
|
150
|
-
function bagDone(s, bag
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
function bagDone(s, bag) {
|
|
152
|
+
const next = bag.next;
|
|
153
|
+
const size = bag.$ &= BAG_SIZE;
|
|
154
|
+
next[size] = s;
|
|
155
|
+
next[size + 2](
|
|
156
|
+
bag,
|
|
157
|
+
next,
|
|
158
|
+
import_render.TRANSITION_JOURNAL !== null || import_events._dispatchDepth !== 0 && import_events.CAPTURE_SLOTS.length !== 0
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
function commitQueuedBag(bag, careful) {
|
|
162
|
+
const next = bag.next;
|
|
163
|
+
next[(bag.$ &= BAG_SIZE) + 2](bag, next, careful);
|
|
153
164
|
}
|
|
154
165
|
function slotNext(slot) {
|
|
155
166
|
const tx = import_render.ROOT_RENDER_TRANSACTION;
|
|
@@ -404,7 +415,7 @@ function dropRootOps(transaction, from, retired) {
|
|
|
404
415
|
for (let i = from; i < ops.length; i += 2) {
|
|
405
416
|
const target = ops[i + 1];
|
|
406
417
|
if (ops[i] === applySlotNext) target.next = null;
|
|
407
|
-
else if (
|
|
418
|
+
else if (ops[i] === commitQueuedBag) target.$ &= BAG_SIZE;
|
|
408
419
|
}
|
|
409
420
|
ops.length = from;
|
|
410
421
|
const set = transaction.retired;
|
|
@@ -1061,6 +1072,7 @@ function withRegisteredRefDetachSuppression(entries, fn) {
|
|
|
1061
1072
|
bagRecord,
|
|
1062
1073
|
captureFocusSelection,
|
|
1063
1074
|
captureQueuedFocusSelection,
|
|
1075
|
+
commitQueuedBag,
|
|
1064
1076
|
defersRootUnmount,
|
|
1065
1077
|
discardMarker,
|
|
1066
1078
|
dropRootOps,
|
|
@@ -52,6 +52,7 @@ module.exports = __toCommonJS(deopt_exports);
|
|
|
52
52
|
var import_branches = require("./branches.cjs");
|
|
53
53
|
var import_hydration_flag = require("../hydration-flag.cjs");
|
|
54
54
|
var import_has_own = require("../has-own.cjs");
|
|
55
|
+
var import_dom_focused_move = require("../dom-focused-move.cjs");
|
|
55
56
|
var import_shared_value_helpers = require("../shared-value-helpers.cjs");
|
|
56
57
|
var import_profiling = require("../profiling.cjs");
|
|
57
58
|
var import_error_codes_client_generated = require("../error-codes.client.generated.cjs");
|
|
@@ -795,7 +796,7 @@ function applyDeoptOrder(order) {
|
|
|
795
796
|
}
|
|
796
797
|
if (order.desc !== null) {
|
|
797
798
|
if (order.owner === null) stampDeoptDesc(node, order.desc);
|
|
798
|
-
else (0, import_render.commitInScope)(order.owner, commitDeoptHost, node, order.desc);
|
|
799
|
+
else (0, import_render.commitInScope)((0, import_branches.owningBlock)(order.owner), commitDeoptHost, node, order.desc);
|
|
799
800
|
}
|
|
800
801
|
if (order.nodes !== null) placeDeoptChildren(node, order.nodes, true, false);
|
|
801
802
|
}
|
|
@@ -810,7 +811,7 @@ function placeDeoptChildren(el, result, skip, adopt) {
|
|
|
810
811
|
const want = result[i];
|
|
811
812
|
const at = skip ? nextDeoptOwnedChild(cursor, adopt) : cursor;
|
|
812
813
|
if (at !== want) {
|
|
813
|
-
if (import_engine.renderingFocus === null)
|
|
814
|
+
if (import_engine.renderingFocus === null) (0, import_dom_focused_move.moveNativeNodeBefore)(el, want, at, null, false);
|
|
814
815
|
else {
|
|
815
816
|
(0, import_engine.captureFocusedMovement)(el, import_engine.renderingFocus);
|
|
816
817
|
(0, import_lists.moveFocusedNodeBefore)(el, want, at, import_engine.renderingFocus);
|
|
@@ -136,6 +136,7 @@ __export(engine_exports, {
|
|
|
136
136
|
runEffectCleanupCallback: () => runEffectCleanupCallback,
|
|
137
137
|
runEffectLifecycleCallback: () => runEffectLifecycleCallback,
|
|
138
138
|
runTransition: () => runTransition,
|
|
139
|
+
scheduleHookPublication: () => scheduleHookPublication,
|
|
139
140
|
scheduleNativeRead: () => scheduleNativeRead,
|
|
140
141
|
scheduleRender: () => scheduleRender,
|
|
141
142
|
scheduleRenderCleanup: () => scheduleRenderCleanup,
|
|
@@ -171,7 +172,7 @@ var import_error_codes_client_generated = require("../error-codes.client.generat
|
|
|
171
172
|
var import_native_read_client = require("../signals/native-read-client.cjs");
|
|
172
173
|
var import_transition_state = require("../signals/transition-state.cjs");
|
|
173
174
|
var import_read_protocol = require("../signals/read-protocol.cjs");
|
|
174
|
-
var
|
|
175
|
+
var import_native_adoption = require("../signals/native-adoption.cjs");
|
|
175
176
|
var import_owner_context = require("../signals/owner-context.cjs");
|
|
176
177
|
var import_document_owner = require("../signals/document-owner.cjs");
|
|
177
178
|
var import_profile_probes = require("./profile-probes.cjs");
|
|
@@ -235,16 +236,16 @@ function ownNativeAdoption(scope, manifest, consume) {
|
|
|
235
236
|
const initial = renderOwner?.initialDocumentSignals;
|
|
236
237
|
const signalOwner = renderOwner?.signalOwner;
|
|
237
238
|
const initialScopeKey = (signalOwner?.documentOwner ?? signalOwner)?.scopeKey ?? "octane:document";
|
|
238
|
-
let state = import_read_protocol.nativeSignalHydration ? (0,
|
|
239
|
-
typeof manifest === "string" ? (0,
|
|
239
|
+
let state = import_read_protocol.nativeSignalHydration ? (0, import_native_adoption.createNativeAdoptionState)(
|
|
240
|
+
typeof manifest === "string" ? (0, import_native_adoption.parseNativeSignalManifest)(manifest) : manifest,
|
|
240
241
|
initial,
|
|
241
242
|
initialScopeKey
|
|
242
243
|
) : void 0;
|
|
243
244
|
const adoption = state ?? {
|
|
244
245
|
resolve(owner) {
|
|
245
246
|
if (state === null || !import_read_protocol.nativeSignalHydration) return void 0;
|
|
246
|
-
state ??= (0,
|
|
247
|
-
typeof manifest === "string" ? (0,
|
|
247
|
+
state ??= (0, import_native_adoption.createNativeAdoptionState)(
|
|
248
|
+
typeof manifest === "string" ? (0, import_native_adoption.parseNativeSignalManifest)(manifest) : manifest,
|
|
248
249
|
initial,
|
|
249
250
|
initialScopeKey
|
|
250
251
|
);
|
|
@@ -423,7 +424,15 @@ function unsuspendTransitionHolder(holder) {
|
|
|
423
424
|
scheduleTransitionTask();
|
|
424
425
|
}
|
|
425
426
|
}
|
|
426
|
-
let
|
|
427
|
+
let TRANSITION_HOOK_PUBLISH_DEPTH = 0;
|
|
428
|
+
function scheduleHookPublication(block) {
|
|
429
|
+
TRANSITION_HOOK_PUBLISH_DEPTH++;
|
|
430
|
+
try {
|
|
431
|
+
scheduleUrgentRender(block);
|
|
432
|
+
} finally {
|
|
433
|
+
TRANSITION_HOOK_PUBLISH_DEPTH--;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
427
436
|
let TRANSITION_ORIGIN = null;
|
|
428
437
|
let TRANSITION_HARVEST = null;
|
|
429
438
|
let TRANSITION_CELL_HARVEST = null;
|
|
@@ -821,19 +830,22 @@ function commitRootRenders() {
|
|
|
821
830
|
try {
|
|
822
831
|
for (let i = 0; i < ops.length; i += 2) {
|
|
823
832
|
if (owner.disposed || owner.generation !== COMMITTING_GENERATION) break;
|
|
833
|
+
const op = ops[i];
|
|
824
834
|
const target = ops[i + 1];
|
|
835
|
+
const bag = op === import_commit.commitQueuedBag;
|
|
825
836
|
COMMIT_OP = i;
|
|
826
837
|
try {
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
838
|
+
const careful = import_render.TRANSITION_JOURNAL !== null || import_events._dispatchDepth !== 0 && import_events.CAPTURE_SLOTS.length !== 0;
|
|
839
|
+
if (bag) {
|
|
840
|
+
const next = target.next;
|
|
841
|
+
next[(target.$ &= import_commit.BAG_SIZE) + 2](target, next, careful);
|
|
842
|
+
} else op(target, careful);
|
|
831
843
|
} catch (error) {
|
|
832
|
-
if (
|
|
844
|
+
if (!bag) throw error;
|
|
833
845
|
if (import_drivers.SIGNAL_COMMIT_RETRY ? !(0, import_drivers.SIGNAL_COMMIT_RETRY)(target, error) : true)
|
|
834
846
|
reportEffectError(target.next[target.$ & import_commit.BAG_SIZE].block, error);
|
|
835
847
|
}
|
|
836
|
-
if (import_commit.BAG_POOL.length < 8 && target
|
|
848
|
+
if (bag && import_commit.BAG_POOL.length < 8 && target.$ <= import_commit.BAG_SIZE) {
|
|
837
849
|
const next = target.next;
|
|
838
850
|
import_commit.BAG_POOL.push(next);
|
|
839
851
|
target.next = next[target.$ + 2];
|
|
@@ -1008,18 +1020,6 @@ function tickTransitionCount(delta) {
|
|
|
1008
1020
|
if (TRANSITION_PENDING_COUNT < 0) TRANSITION_PENDING_COUNT = 0;
|
|
1009
1021
|
if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__)
|
|
1010
1022
|
(0, import_devtools_hook.__devtoolsSetTransitionCount)(TRANSITION_PENDING_COUNT);
|
|
1011
|
-
TRANSITION_LISTENER_PUBLISH_DEPTH++;
|
|
1012
|
-
try {
|
|
1013
|
-
for (const fn of import_transitions.TRANSITION_LISTENERS) {
|
|
1014
|
-
try {
|
|
1015
|
-
fn();
|
|
1016
|
-
} catch (err) {
|
|
1017
|
-
console.error(err);
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
} finally {
|
|
1021
|
-
TRANSITION_LISTENER_PUBLISH_DEPTH--;
|
|
1022
|
-
}
|
|
1023
1023
|
}
|
|
1024
1024
|
const refAttachQueue = [];
|
|
1025
1025
|
function attachLiveFragmentRef(instance) {
|
|
@@ -1167,7 +1167,7 @@ This ensures you're testing the behavior the user would see in the browser.`
|
|
|
1167
1167
|
);
|
|
1168
1168
|
}
|
|
1169
1169
|
const renderPhaseSelf = import_render.CURRENT_BLOCK === block;
|
|
1170
|
-
const renderPhaseOther = import_render.CURRENT_BLOCK !== null && (!renderPhaseSelf || import_render.CURRENT_SCOPE !== block) &&
|
|
1170
|
+
const renderPhaseOther = import_render.CURRENT_BLOCK !== null && (!renderPhaseSelf || import_render.CURRENT_SCOPE !== block) && TRANSITION_HOOK_PUBLISH_DEPTH === 0 && EFFECT_EVENT_LIFECYCLE_DEPTH === 0;
|
|
1171
1171
|
if (renderPhaseOther) {
|
|
1172
1172
|
block.crossRenderUpdate = true;
|
|
1173
1173
|
warnCrossComponentRenderUpdate(block, import_render.CURRENT_BLOCK);
|
|
@@ -3271,14 +3271,14 @@ function useTransition(slot) {
|
|
|
3271
3271
|
hook.tentative = false;
|
|
3272
3272
|
if (hook.isPending === pending || block.disposed) return;
|
|
3273
3273
|
hook.isPending = pending;
|
|
3274
|
-
|
|
3274
|
+
TRANSITION_HOOK_PUBLISH_DEPTH++;
|
|
3275
3275
|
try {
|
|
3276
3276
|
if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__)
|
|
3277
3277
|
(0, import_profiling.__profileSchedule)(block, "transition-pending", slot);
|
|
3278
3278
|
if (pending) (0, import_transitions.markTransitionCue)(block);
|
|
3279
3279
|
scheduleRender(block, false, pending);
|
|
3280
3280
|
} finally {
|
|
3281
|
-
|
|
3281
|
+
TRANSITION_HOOK_PUBLISH_DEPTH--;
|
|
3282
3282
|
}
|
|
3283
3283
|
}
|
|
3284
3284
|
};
|
|
@@ -3309,16 +3309,25 @@ function runDeferredSwaps() {
|
|
|
3309
3309
|
DEFERRED_SWAPS = null;
|
|
3310
3310
|
if (slots === null) return;
|
|
3311
3311
|
TRANSITION_TASK_ACTIVE = true;
|
|
3312
|
+
let roots = null;
|
|
3312
3313
|
try {
|
|
3313
|
-
for (let i = 0; i < slots.length; i++)
|
|
3314
|
+
for (let i = 0; i < slots.length; i++) {
|
|
3315
|
+
const root = swapDeferredValue(slots[i]);
|
|
3316
|
+
if (root !== null && !(roots ??= []).includes(root)) roots.push(root);
|
|
3317
|
+
}
|
|
3318
|
+
if (roots !== null) for (const root of roots) root.retry(true);
|
|
3314
3319
|
} finally {
|
|
3315
3320
|
TRANSITION_TASK_ACTIVE = false;
|
|
3316
3321
|
}
|
|
3317
3322
|
}
|
|
3318
3323
|
function swapDeferredValue(s) {
|
|
3319
|
-
if (!s.scheduled
|
|
3324
|
+
if (!s.scheduled) return null;
|
|
3320
3325
|
s.scheduled = false;
|
|
3321
|
-
if (
|
|
3326
|
+
if (s.block.disposed) {
|
|
3327
|
+
const owner = s.block.idState.renderOwner;
|
|
3328
|
+
return owner !== void 0 && owner.wakeable !== null && (owner.current === null || owner.current.disposed) ? owner : null;
|
|
3329
|
+
}
|
|
3330
|
+
if (Object.is(s.value, s.next)) return null;
|
|
3322
3331
|
(0, import_transitions.startTransition)(() => {
|
|
3323
3332
|
DEFERRED_SPAWN = true;
|
|
3324
3333
|
try {
|
|
@@ -3334,6 +3343,7 @@ function swapDeferredValue(s) {
|
|
|
3334
3343
|
DEFERRED_SPAWN = false;
|
|
3335
3344
|
}
|
|
3336
3345
|
});
|
|
3346
|
+
return null;
|
|
3337
3347
|
}
|
|
3338
3348
|
function hideActivityRefs(activity) {
|
|
3339
3349
|
if (!activity.hasRefs) return;
|
|
@@ -3399,7 +3409,7 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
|
|
|
3399
3409
|
spareOps: []
|
|
3400
3410
|
};
|
|
3401
3411
|
idState.renderOwner = renderOwner;
|
|
3402
|
-
const renderResolved = (body, props, nextKey, mode) => {
|
|
3412
|
+
const renderResolved = (body, props, nextKey, mode, deferred = false) => {
|
|
3403
3413
|
if (unmounted) return;
|
|
3404
3414
|
(0, import_context_epoch.bumpContextEpoch)();
|
|
3405
3415
|
if (rootBlock && !rootBlock.disposed && currentBody === body && Object.is(currentKey, nextKey)) {
|
|
@@ -3509,6 +3519,7 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
|
|
|
3509
3519
|
}
|
|
3510
3520
|
const mountedRoot = rootBlock;
|
|
3511
3521
|
mountedRoot.pendingMode = mode ?? null;
|
|
3522
|
+
mountedRoot.pendingDeferred = deferred;
|
|
3512
3523
|
try {
|
|
3513
3524
|
(0, import_signal_owners.renderBlock)(mountedRoot);
|
|
3514
3525
|
if (QUEUE.length > 0) drainHydrationRenderPhaseUpdates(mountedRoot);
|
|
@@ -3621,7 +3632,7 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
|
|
|
3621
3632
|
renderOwner.retryKey = null;
|
|
3622
3633
|
renderOwner.request = null;
|
|
3623
3634
|
if (renderOwner.transaction?.aborted === true) renderOwner.transaction = null;
|
|
3624
|
-
renderOwner.retry = () => renderResolved(body, props, nextKey);
|
|
3635
|
+
renderOwner.retry = (deferred) => renderResolved(body, props, nextKey, deferred ? "transition" : void 0, deferred);
|
|
3625
3636
|
renderResolved(body, props, nextKey);
|
|
3626
3637
|
},
|
|
3627
3638
|
unmount() {
|
|
@@ -3812,6 +3823,7 @@ function makeRoot(container, rootBlock, currentBody, currentKey, idState, output
|
|
|
3812
3823
|
runEffectCleanupCallback,
|
|
3813
3824
|
runEffectLifecycleCallback,
|
|
3814
3825
|
runTransition,
|
|
3826
|
+
scheduleHookPublication,
|
|
3815
3827
|
scheduleNativeRead,
|
|
3816
3828
|
scheduleRender,
|
|
3817
3829
|
scheduleRenderCleanup,
|