octane 0.3.6 → 0.4.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/index.cjs +3 -0
- package/dist/cjs/resize-observer.cjs +129 -0
- package/dist/cjs/runtime.cjs +125 -45
- package/dist/cjs/server/index.cjs +3 -0
- package/dist/cjs/signals/graph.cjs +11 -0
- package/dist/cjs/version.cjs +1 -1
- package/dist/compiler/bundler.js +44 -4
- package/dist/compiler/compile.js +58 -1
- package/dist/compiler/dom-binding-fixed-props.js +247 -0
- package/dist/compiler/dom-binding-program.js +36 -3
- package/dist/compiler/dom-binding-request.js +32 -5
- package/dist/compiler/dom-bindings.js +35 -8
- package/dist/compiler/index.d.ts +2 -0
- package/dist/compiler/vite.d.ts +2 -0
- package/dist/compiler/vite.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/resize-observer.d.ts +14 -0
- package/dist/resize-observer.js +105 -0
- package/dist/runtime.d.ts +15 -1
- package/dist/runtime.js +125 -45
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +2 -0
- package/dist/signals/graph.js +12 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -85,6 +85,7 @@ __export(index_exports, {
|
|
|
85
85
|
createElement: () => import_runtime.createElement,
|
|
86
86
|
createHostContextRequest: () => import_runtime.createHostContextRequest,
|
|
87
87
|
createPortal: () => import_runtime.createPortal,
|
|
88
|
+
createResizeObserver: () => import_resize_observer.createResizeObserver,
|
|
88
89
|
createRoot: () => import_runtime.createRoot,
|
|
89
90
|
createScopedElement: () => import_runtime.createScopedElement,
|
|
90
91
|
createScopedValue: () => import_runtime.createScopedValue,
|
|
@@ -246,6 +247,7 @@ __export(index_exports, {
|
|
|
246
247
|
});
|
|
247
248
|
module.exports = __toCommonJS(index_exports);
|
|
248
249
|
var import_trusted_html = require("./trusted-html.cjs");
|
|
250
|
+
var import_resize_observer = require("./resize-observer.cjs");
|
|
249
251
|
var import_version = require("./version.cjs");
|
|
250
252
|
var import_compatibility = require("./compatibility.cjs");
|
|
251
253
|
var import_event_capture = require("./hydration/event-capture.cjs");
|
|
@@ -325,6 +327,7 @@ var import_method_dep = require("./method-dep.cjs");
|
|
|
325
327
|
createElement,
|
|
326
328
|
createHostContextRequest,
|
|
327
329
|
createPortal,
|
|
330
|
+
createResizeObserver,
|
|
328
331
|
createRoot,
|
|
329
332
|
createScopedElement,
|
|
330
333
|
createScopedValue,
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var resize_observer_exports = {};
|
|
20
|
+
__export(resize_observer_exports, {
|
|
21
|
+
createResizeObserver: () => createResizeObserver
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(resize_observer_exports);
|
|
24
|
+
let queuedCallbacks = null;
|
|
25
|
+
let postTask;
|
|
26
|
+
function drainCallbacks() {
|
|
27
|
+
const callbacks = queuedCallbacks;
|
|
28
|
+
queuedCallbacks = null;
|
|
29
|
+
if (callbacks === null) return;
|
|
30
|
+
for (const callback of callbacks) {
|
|
31
|
+
try {
|
|
32
|
+
callback();
|
|
33
|
+
} catch (error) {
|
|
34
|
+
if (typeof reportError === "function") reportError(error);
|
|
35
|
+
else
|
|
36
|
+
setTimeout(() => {
|
|
37
|
+
throw error;
|
|
38
|
+
}, 0);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function enqueue(callback) {
|
|
43
|
+
if (queuedCallbacks !== null) {
|
|
44
|
+
queuedCallbacks.add(callback);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
queuedCallbacks = /* @__PURE__ */ new Set([callback]);
|
|
48
|
+
if (postTask === void 0) {
|
|
49
|
+
if (typeof MessageChannel === "undefined") {
|
|
50
|
+
postTask = () => {
|
|
51
|
+
setTimeout(drainCallbacks, 0);
|
|
52
|
+
};
|
|
53
|
+
} else {
|
|
54
|
+
const channel = new MessageChannel();
|
|
55
|
+
channel.port1.onmessage = drainCallbacks;
|
|
56
|
+
postTask = () => channel.port2.postMessage(null);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
postTask();
|
|
60
|
+
}
|
|
61
|
+
function createResizeObserver(callback, ResizeObserverCtor = ResizeObserver) {
|
|
62
|
+
if (typeof callback !== "function")
|
|
63
|
+
throw new TypeError("ResizeObserver callback must be a function");
|
|
64
|
+
const entries = /* @__PURE__ */ new Map();
|
|
65
|
+
const boxes = /* @__PURE__ */ new Map();
|
|
66
|
+
let pending = false;
|
|
67
|
+
const deliver = () => {
|
|
68
|
+
if (!pending) return;
|
|
69
|
+
pending = false;
|
|
70
|
+
const batch = Array.from(entries.values());
|
|
71
|
+
entries.clear();
|
|
72
|
+
Reflect.apply(callback, observer, [batch, observer]);
|
|
73
|
+
};
|
|
74
|
+
const observer = new ResizeObserverCtor((batch) => {
|
|
75
|
+
pending = true;
|
|
76
|
+
for (const entry of batch) entries.set(entry.target, entry);
|
|
77
|
+
enqueue(deliver);
|
|
78
|
+
});
|
|
79
|
+
const observe = observer.observe;
|
|
80
|
+
const unobserve = observer.unobserve;
|
|
81
|
+
const disconnect = observer.disconnect;
|
|
82
|
+
const discard = (target) => {
|
|
83
|
+
if (entries.delete(target) && entries.size === 0) {
|
|
84
|
+
pending = false;
|
|
85
|
+
queuedCallbacks?.delete(deliver);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
observer.observe = function(target, options) {
|
|
89
|
+
let box = "content-box";
|
|
90
|
+
let nativeOptions = options;
|
|
91
|
+
if (options !== null && (typeof options === "object" || typeof options === "function")) {
|
|
92
|
+
nativeOptions = {
|
|
93
|
+
get box() {
|
|
94
|
+
const value = options.box;
|
|
95
|
+
if (value === void 0) return void 0;
|
|
96
|
+
box = `${value}`;
|
|
97
|
+
return box;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
observe.call(this, target, nativeOptions);
|
|
102
|
+
if (this !== observer) return;
|
|
103
|
+
if (boxes.get(target) !== box) discard(target);
|
|
104
|
+
boxes.set(target, box);
|
|
105
|
+
};
|
|
106
|
+
observer.unobserve = function(target) {
|
|
107
|
+
unobserve.call(this, target);
|
|
108
|
+
if (this !== observer) return;
|
|
109
|
+
boxes.delete(target);
|
|
110
|
+
discard(target);
|
|
111
|
+
if (boxes.size === 0 && entries.size === 0) {
|
|
112
|
+
pending = false;
|
|
113
|
+
queuedCallbacks?.delete(deliver);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
observer.disconnect = function() {
|
|
117
|
+
disconnect.call(this);
|
|
118
|
+
if (this !== observer) return;
|
|
119
|
+
boxes.clear();
|
|
120
|
+
entries.clear();
|
|
121
|
+
pending = false;
|
|
122
|
+
queuedCallbacks?.delete(deliver);
|
|
123
|
+
};
|
|
124
|
+
return observer;
|
|
125
|
+
}
|
|
126
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
127
|
+
0 && (module.exports = {
|
|
128
|
+
createResizeObserver
|
|
129
|
+
});
|
package/dist/cjs/runtime.cjs
CHANGED
|
@@ -403,7 +403,6 @@ let NATIVE_BLOCK_RETRIES = null;
|
|
|
403
403
|
let NATIVE_ADOPTION_RELEASES = null;
|
|
404
404
|
let SIGNAL_BINDINGS_ENABLED = false;
|
|
405
405
|
const SCOPE_SIGNAL_OWNERS = /* @__PURE__ */ new WeakMap();
|
|
406
|
-
const SCOPE_SIGNAL_INSTANCE_KEYS = /* @__PURE__ */ new WeakMap();
|
|
407
406
|
let RETAINED_SIGNAL_OWNERS;
|
|
408
407
|
const SIGNAL_RETRY_LOCATIONS = /* @__PURE__ */ new WeakMap();
|
|
409
408
|
function signalRetryBoundary(block) {
|
|
@@ -604,17 +603,30 @@ function rootSignalInstanceKey(ids) {
|
|
|
604
603
|
return JSON.stringify([ids.signalState?.prefix ?? ids.prefix, "root"]);
|
|
605
604
|
}
|
|
606
605
|
function resolveSignalInstanceKey(scope) {
|
|
607
|
-
const
|
|
608
|
-
if (
|
|
606
|
+
const resolved = scope.signalInstanceResolved;
|
|
607
|
+
if (resolved !== void 0) return resolved;
|
|
608
|
+
const parent = scope.signalInstanceParent;
|
|
609
|
+
if (parent === null) return void 0;
|
|
609
610
|
const key = structuralSignalInstanceKey(
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
611
|
+
parent,
|
|
612
|
+
scope.signalInstanceSite,
|
|
613
|
+
scope.signalInstanceValue,
|
|
614
|
+
scope.signalInstanceHasKey
|
|
614
615
|
);
|
|
615
|
-
|
|
616
|
+
scope.signalInstanceResolved = key;
|
|
616
617
|
return key;
|
|
617
618
|
}
|
|
619
|
+
function stampSignalInstanceKey(scope, key) {
|
|
620
|
+
if (typeof key === "string") {
|
|
621
|
+
scope.signalInstanceResolved = key;
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
scope.signalInstanceParent = key.parentScope;
|
|
625
|
+
scope.signalInstanceSite = key.invocationSite;
|
|
626
|
+
scope.signalInstanceValue = key.key;
|
|
627
|
+
scope.signalInstanceHasKey = key.hasKey;
|
|
628
|
+
scope.signalInstanceResolved = void 0;
|
|
629
|
+
}
|
|
618
630
|
function structuralSignalInstanceKey(parentScope, invocationSite, key, hasKey) {
|
|
619
631
|
let base = resolveSignalInstanceKey(parentScope);
|
|
620
632
|
const itemKeys = [];
|
|
@@ -645,7 +657,11 @@ function structuralSignalInstanceKey(parentScope, invocationSite, key, hasKey) {
|
|
|
645
657
|
}
|
|
646
658
|
function stampSignalInstance(scope, parentScope, invocationSite, key, hasKey) {
|
|
647
659
|
if (SIGNAL_BINDINGS_ENABLED || import_document_owner.signalDocumentEnabled) {
|
|
648
|
-
|
|
660
|
+
scope.signalInstanceParent = parentScope;
|
|
661
|
+
scope.signalInstanceSite = invocationSite;
|
|
662
|
+
scope.signalInstanceValue = key;
|
|
663
|
+
scope.signalInstanceHasKey = hasKey;
|
|
664
|
+
scope.signalInstanceResolved = void 0;
|
|
649
665
|
}
|
|
650
666
|
}
|
|
651
667
|
function scopeSignalOwner(scope) {
|
|
@@ -6078,14 +6094,20 @@ function drainEffectEventUpdates() {
|
|
|
6078
6094
|
for (let i = 0; i < q.length; i++) {
|
|
6079
6095
|
const entry = q[i];
|
|
6080
6096
|
const block = entry.block;
|
|
6081
|
-
if (!entry.cell.active || NATIVE_READ_DRIVER?.publicationCurrent(entry) === false || blockSubtreeDisposed(block)
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6097
|
+
if (!entry.cell.active || NATIVE_READ_DRIVER?.publicationCurrent(entry) === false || blockSubtreeDisposed(block))
|
|
6098
|
+
continue;
|
|
6099
|
+
const hiddenOwner = findScheduledVisibilityOwner(block, true);
|
|
6100
|
+
if (block.renderStatus !== RENDER_VALID && hiddenOwner === null) continue;
|
|
6101
|
+
if (hiddenOwner !== null && hiddenOwner.__kind === "trySlotSlot") {
|
|
6102
|
+
const hiddenTry = hiddenOwner;
|
|
6103
|
+
deferHiddenRevealAction(hiddenTry, () => {
|
|
6104
|
+
if (entry.cell.active && !blockSubtreeDisposed(block) && block.effectEventRenderVersion === entry.renderVersion && block.effectEventCompletedVersion === entry.renderVersion)
|
|
6105
|
+
entry.cell.impl = entry.nextImpl;
|
|
6106
|
+
});
|
|
6087
6107
|
continue;
|
|
6088
6108
|
}
|
|
6109
|
+
if (block.effectEventRenderVersion !== entry.renderVersion || block.effectEventCompletedVersion !== entry.renderVersion)
|
|
6110
|
+
continue;
|
|
6089
6111
|
entry.cell.impl = entry.nextImpl;
|
|
6090
6112
|
}
|
|
6091
6113
|
}
|
|
@@ -6532,6 +6554,11 @@ class BlockImpl {
|
|
|
6532
6554
|
this.__activitySlot = void 0;
|
|
6533
6555
|
this.__warmCache = void 0;
|
|
6534
6556
|
this.__warmCacheEpisode = void 0;
|
|
6557
|
+
this.signalInstanceParent = null;
|
|
6558
|
+
this.signalInstanceSite = void 0;
|
|
6559
|
+
this.signalInstanceValue = void 0;
|
|
6560
|
+
this.signalInstanceHasKey = false;
|
|
6561
|
+
this.signalInstanceResolved = void 0;
|
|
6535
6562
|
}
|
|
6536
6563
|
}
|
|
6537
6564
|
class ScopeImpl {
|
|
@@ -6551,6 +6578,11 @@ class ScopeImpl {
|
|
|
6551
6578
|
this.mounted = false;
|
|
6552
6579
|
this.slots = [];
|
|
6553
6580
|
this.compilerMemo = null;
|
|
6581
|
+
this.signalInstanceParent = null;
|
|
6582
|
+
this.signalInstanceSite = void 0;
|
|
6583
|
+
this.signalInstanceValue = void 0;
|
|
6584
|
+
this.signalInstanceHasKey = false;
|
|
6585
|
+
this.signalInstanceResolved = void 0;
|
|
6554
6586
|
}
|
|
6555
6587
|
}
|
|
6556
6588
|
function createBlock(kind, parentBlock, parentNode, startMarker, endMarker, body, props, extra, outputHandler = null) {
|
|
@@ -6695,7 +6727,8 @@ function endUrgentTransitionRender(block, render) {
|
|
|
6695
6727
|
}
|
|
6696
6728
|
function renderBlockInner(block) {
|
|
6697
6729
|
if (block.renderStatus === RENDER_INVALID) block.renderStatus = RENDER_RETRYING;
|
|
6698
|
-
if (WIP_CAPTURE !== null
|
|
6730
|
+
if (WIP_CAPTURE !== null && WIP_CAPTURE.rootTransaction !== true)
|
|
6731
|
+
recordCapturedRender(WIP_CAPTURE, block);
|
|
6699
6732
|
if (TRANSITION_JOURNAL !== null) {
|
|
6700
6733
|
TRANSITION_JOURNAL.push(JOURNAL_RENDER, block, null, null);
|
|
6701
6734
|
}
|
|
@@ -6773,7 +6806,7 @@ function renderBlockInner(block) {
|
|
|
6773
6806
|
if (block.outputHandler !== null && (out !== void 0 || block.slots[0]?.returnedOutput === true)) {
|
|
6774
6807
|
block.outputHandler(block, out ?? null);
|
|
6775
6808
|
}
|
|
6776
|
-
finishEffectRender(block);
|
|
6809
|
+
if (block.effectSlots !== null) finishEffectRender(block);
|
|
6777
6810
|
if (!block.mounted) block.mounted = true;
|
|
6778
6811
|
if (block.renderStatus === RENDER_RETRYING) block.renderStatus = RENDER_VALID;
|
|
6779
6812
|
if (block.effectEventRenderVersion !== 0) {
|
|
@@ -7062,6 +7095,11 @@ class LiteBlockImpl {
|
|
|
7062
7095
|
this.parentBlock = parentBlock;
|
|
7063
7096
|
this.$$ctxValues = null;
|
|
7064
7097
|
this.idState = parentBlock.idState;
|
|
7098
|
+
this.signalInstanceParent = null;
|
|
7099
|
+
this.signalInstanceSite = void 0;
|
|
7100
|
+
this.signalInstanceValue = void 0;
|
|
7101
|
+
this.signalInstanceHasKey = false;
|
|
7102
|
+
this.signalInstanceResolved = void 0;
|
|
7065
7103
|
}
|
|
7066
7104
|
}
|
|
7067
7105
|
function componentSlotLite(parentScope, slotKey, host, comp, props, anchor, invocationSite) {
|
|
@@ -7130,9 +7168,14 @@ function componentSlotLite(parentScope, slotKey, host, comp, props, anchor, invo
|
|
|
7130
7168
|
let profileThrown;
|
|
7131
7169
|
const nativeToken = NATIVE_READ_DRIVER === null ? -1 : beginActiveNativeReadScope(scope);
|
|
7132
7170
|
try {
|
|
7133
|
-
if (import_document_owner.signalDocumentEnabled || scope.block.idState.renderOwner?.signalOwner !== void 0)
|
|
7134
|
-
|
|
7135
|
-
|
|
7171
|
+
if (import_document_owner.signalDocumentEnabled || scope.block.idState.renderOwner?.signalOwner !== void 0) {
|
|
7172
|
+
const owner = scopeSignalOwner(scope);
|
|
7173
|
+
if (owner !== void 0 && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null))
|
|
7174
|
+
(0, import_document_owner.streamedSignalOwnerActivator)?.(owner);
|
|
7175
|
+
if (owner === void 0 || (0, import_owner_context.currentSignalOwner)() === owner) {
|
|
7176
|
+
comp(props, scope, void 0);
|
|
7177
|
+
} else (0, import_owner_context.runWithSignalOwner)(owner, () => comp(props, scope, void 0));
|
|
7178
|
+
} else comp(props, scope, void 0);
|
|
7136
7179
|
if (!scope.mounted) scope.mounted = true;
|
|
7137
7180
|
} catch (error) {
|
|
7138
7181
|
profileDidThrow = true;
|
|
@@ -18788,7 +18831,7 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
|
|
|
18788
18831
|
void 0,
|
|
18789
18832
|
outputHandler
|
|
18790
18833
|
);
|
|
18791
|
-
if (signalInstanceKey !== void 0)
|
|
18834
|
+
if (signalInstanceKey !== void 0) stampSignalInstanceKey(b, signalInstanceKey);
|
|
18792
18835
|
if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && typeof identity === "function")
|
|
18793
18836
|
profileTrackComponent(b, identity);
|
|
18794
18837
|
state.block = b;
|
|
@@ -18818,7 +18861,7 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
|
|
|
18818
18861
|
void 0,
|
|
18819
18862
|
outputHandler
|
|
18820
18863
|
);
|
|
18821
|
-
if (signalInstanceKey !== void 0)
|
|
18864
|
+
if (signalInstanceKey !== void 0) stampSignalInstanceKey(b, signalInstanceKey);
|
|
18822
18865
|
if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && typeof identity === "function")
|
|
18823
18866
|
profileTrackComponent(b, identity);
|
|
18824
18867
|
if (state.inherited) b.exclusiveMarkers = true;
|
|
@@ -18859,7 +18902,7 @@ function renderOffscreen(parentBlock, domParent, afterNode, body, props, outputH
|
|
|
18859
18902
|
env,
|
|
18860
18903
|
outputHandler
|
|
18861
18904
|
);
|
|
18862
|
-
if (signalInstanceKey !== void 0)
|
|
18905
|
+
if (signalInstanceKey !== void 0) stampSignalInstanceKey(block, signalInstanceKey);
|
|
18863
18906
|
if (retryLocation !== void 0) SIGNAL_RETRY_LOCATIONS.set(block, retryLocation);
|
|
18864
18907
|
if (implicitBail) {
|
|
18865
18908
|
block.$$implicitBail = true;
|
|
@@ -21216,7 +21259,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
|
|
|
21216
21259
|
void 0,
|
|
21217
21260
|
renderReturnedValue
|
|
21218
21261
|
);
|
|
21219
|
-
if (signalInstanceKey !== void 0)
|
|
21262
|
+
if (signalInstanceKey !== void 0) stampSignalInstanceKey(b2, signalInstanceKey);
|
|
21220
21263
|
preserveRootCreatedDom(b2);
|
|
21221
21264
|
if (state.borrowed) b2.exclusiveMarkers = true;
|
|
21222
21265
|
b2.$$implicitBail = true;
|
|
@@ -21312,7 +21355,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
|
|
|
21312
21355
|
void 0,
|
|
21313
21356
|
renderReturnedValue
|
|
21314
21357
|
);
|
|
21315
|
-
if (signalInstanceKey !== void 0)
|
|
21358
|
+
if (signalInstanceKey !== void 0) stampSignalInstanceKey(b, signalInstanceKey);
|
|
21316
21359
|
if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && comp !== hostElementBody)
|
|
21317
21360
|
(0, import_profiling.__profileTrackComponent)(b, !isBodyFn || (0, import_profiling.__profileHasComponentMetadata)(comp) ? comp : null);
|
|
21318
21361
|
if (state.borrowed) b.exclusiveMarkers = true;
|
|
@@ -22461,6 +22504,7 @@ function tryBlock(parentScope, slotKey, domParent, tryBody, catchBody, pendingBo
|
|
|
22461
22504
|
const parentBlock = parentScope.block;
|
|
22462
22505
|
const hydration = activeHydration();
|
|
22463
22506
|
let state = parentScope.slots[slotKey];
|
|
22507
|
+
let supersedesInputs = false;
|
|
22464
22508
|
if (state === void 0) {
|
|
22465
22509
|
let start;
|
|
22466
22510
|
let end;
|
|
@@ -22512,8 +22556,8 @@ function tryBlock(parentScope, slotKey, domParent, tryBody, catchBody, pendingBo
|
|
|
22512
22556
|
registerSlot(parentScope, newState);
|
|
22513
22557
|
state = newState;
|
|
22514
22558
|
} else {
|
|
22515
|
-
|
|
22516
|
-
|
|
22559
|
+
supersedesInputs = (state.branch === 2 || state.retrySignalOwners !== void 0) && (state.tryBody !== tryBody || state.env !== env && depsChanged(state.env, env));
|
|
22560
|
+
if (state.retrySignalOwners !== void 0 && supersedesInputs) clearSignalRetryOwners(state);
|
|
22517
22561
|
state.tryBody = tryBody;
|
|
22518
22562
|
state.catchBody = catchBody;
|
|
22519
22563
|
state.pendingBody = pendingBody;
|
|
@@ -22542,7 +22586,7 @@ function tryBlock(parentScope, slotKey, domParent, tryBody, catchBody, pendingBo
|
|
|
22542
22586
|
s.block.extra = s.env;
|
|
22543
22587
|
renderBlock(s.block);
|
|
22544
22588
|
} else if (s.branch === 2 && s.tryBlock && !s.tryBlock.disposed && s.hiddenDom) {
|
|
22545
|
-
attemptHiddenReveal(s, void 0, "parent");
|
|
22589
|
+
attemptHiddenReveal(s, void 0, supersedesInputs ? "parent" : "update");
|
|
22546
22590
|
if (s.branch === 2) refreshPendingBody(s);
|
|
22547
22591
|
} else if (s.branch === 2) {
|
|
22548
22592
|
mountTry(s);
|
|
@@ -22678,7 +22722,8 @@ function takeInitialSuspenseHydration(state, hydration) {
|
|
|
22678
22722
|
state.idState = {
|
|
22679
22723
|
prefix: state.parentBlock.idState.prefix + "b" + boundaryId + "-",
|
|
22680
22724
|
next: 0,
|
|
22681
|
-
renderOwner: state.parentBlock.idState.renderOwner
|
|
22725
|
+
renderOwner: state.parentBlock.idState.renderOwner,
|
|
22726
|
+
signalState: state.parentBlock.idState.signalState
|
|
22682
22727
|
};
|
|
22683
22728
|
return {
|
|
22684
22729
|
metadata: [marker],
|
|
@@ -22800,7 +22845,7 @@ function renderInitialSuspenseHydration(state, initial) {
|
|
|
22800
22845
|
(0, import_read_protocol.setNativeAdoptionResolver)(previousNative);
|
|
22801
22846
|
WIP_CAPTURE = previousCapture;
|
|
22802
22847
|
currentHydration = previousHydration;
|
|
22803
|
-
if (previousHydration !== null) previousHydration.node = state.end;
|
|
22848
|
+
if (previousHydration !== null) previousHydration.node = getNextSibling(state.end);
|
|
22804
22849
|
}
|
|
22805
22850
|
if (!failed) {
|
|
22806
22851
|
if (state.retrySignalOwners !== void 0) clearSignalRetryOwners(state);
|
|
@@ -22844,7 +22889,7 @@ function renderInitialSuspenseHydration(state, initial) {
|
|
|
22844
22889
|
});
|
|
22845
22890
|
} finally {
|
|
22846
22891
|
currentHydration = outerHydration;
|
|
22847
|
-
if (outerHydration !== null) outerHydration.node = state.end;
|
|
22892
|
+
if (outerHydration !== null) outerHydration.node = getNextSibling(state.end);
|
|
22848
22893
|
}
|
|
22849
22894
|
}
|
|
22850
22895
|
function mountTry(state) {
|
|
@@ -22916,7 +22961,8 @@ function mountTry(state) {
|
|
|
22916
22961
|
state.idState = {
|
|
22917
22962
|
prefix: state.parentBlock.idState.prefix + "b" + streamedBoundaryId + "-",
|
|
22918
22963
|
next: 0,
|
|
22919
|
-
renderOwner: state.parentBlock.idState.renderOwner
|
|
22964
|
+
renderOwner: state.parentBlock.idState.renderOwner,
|
|
22965
|
+
signalState: state.parentBlock.idState.signalState
|
|
22920
22966
|
};
|
|
22921
22967
|
}
|
|
22922
22968
|
const freshIds = takeNativeFreshArm(hydration, adoptCursor, state.end, state.idState);
|
|
@@ -28084,8 +28130,43 @@ function hydrateRootWithOutputHandler(container, bodyOrElement, propsOrOptions,
|
|
|
28084
28130
|
}
|
|
28085
28131
|
function createIndependentHydrateActivator(body) {
|
|
28086
28132
|
return (context) => {
|
|
28133
|
+
const { captures, element, manifest, signalOwner } = context;
|
|
28134
|
+
let intents = context.intents.length === 0 ? null : context.intents;
|
|
28135
|
+
const notify = intents === null ? null : (scope) => {
|
|
28136
|
+
if (intents === null || scope.block.disposed) return;
|
|
28137
|
+
const retryBatch = suspenseRetryBatchForSubtree(scope.block);
|
|
28138
|
+
if (retryBatch !== null) {
|
|
28139
|
+
const effect = scope.effectSlots.find((entry) => entry.connectedFn === notify);
|
|
28140
|
+
(retryBatch.afterCommit ??= []).push(() => {
|
|
28141
|
+
if (intents === null || scope.block.disposed || !effect.active) return;
|
|
28142
|
+
effectQueues[PASSIVE].push({
|
|
28143
|
+
scope,
|
|
28144
|
+
slot: effect.slot,
|
|
28145
|
+
fn: effect.connectedFn,
|
|
28146
|
+
order: effect.order,
|
|
28147
|
+
revision: effect.revision,
|
|
28148
|
+
args: effect.connectedArgs,
|
|
28149
|
+
phase: PASSIVE,
|
|
28150
|
+
seq: commitSeq++
|
|
28151
|
+
});
|
|
28152
|
+
if (!passiveScheduled) schedulePassiveFlush();
|
|
28153
|
+
});
|
|
28154
|
+
return;
|
|
28155
|
+
}
|
|
28156
|
+
const replays = intents;
|
|
28157
|
+
intents = null;
|
|
28158
|
+
for (const replay of replays) {
|
|
28159
|
+
if (!(0, import_event_capture.isHydrationSelectionIntentCurrent)(replay)) continue;
|
|
28160
|
+
const originalTarget = replay.event.target;
|
|
28161
|
+
if (originalTarget === null || originalTarget.nodeType !== 1 || !element.contains(originalTarget))
|
|
28162
|
+
continue;
|
|
28163
|
+
const target = originalTarget;
|
|
28164
|
+
target.dispatchEvent(cloneHydrationReplayEvent(replay.event, target));
|
|
28165
|
+
}
|
|
28166
|
+
};
|
|
28087
28167
|
const content = (_props, scope, extra) => {
|
|
28088
|
-
body(
|
|
28168
|
+
body(captures, scope, extra);
|
|
28169
|
+
if (notify !== null) useEffect(notify, [scope], HYDRATE_NOTIFY_SLOT);
|
|
28089
28170
|
};
|
|
28090
28171
|
const framed = (_props, scope) => {
|
|
28091
28172
|
tryBlock(scope, 0, scope.block.parentNode, content, null, null, scope.block.endMarker);
|
|
@@ -28093,19 +28174,18 @@ function createIndependentHydrateActivator(body) {
|
|
|
28093
28174
|
const adapter = (_props, scope) => {
|
|
28094
28175
|
componentSlotVoid(scope, 0, scope.block.parentNode, framed, void 0, scope.block.endMarker);
|
|
28095
28176
|
};
|
|
28096
|
-
const root = hydrateRoot(
|
|
28097
|
-
identifierPrefix:
|
|
28098
|
-
identifierSeed:
|
|
28099
|
-
signalInstancePrefix:
|
|
28100
|
-
...
|
|
28177
|
+
const root = hydrateRoot(element, adapter, captures, {
|
|
28178
|
+
identifierPrefix: manifest.boundaryId + "-",
|
|
28179
|
+
identifierSeed: manifest.idSeed,
|
|
28180
|
+
signalInstancePrefix: manifest.boundaryId,
|
|
28181
|
+
...signalOwner === void 0 ? {} : { signalOwner }
|
|
28101
28182
|
});
|
|
28102
|
-
|
|
28103
|
-
|
|
28104
|
-
|
|
28105
|
-
|
|
28106
|
-
|
|
28107
|
-
|
|
28108
|
-
target.dispatchEvent(cloneHydrationReplayEvent(replay.event, target));
|
|
28183
|
+
if (notify !== null) {
|
|
28184
|
+
const unmount = root.unmount;
|
|
28185
|
+
root.unmount = () => {
|
|
28186
|
+
intents = null;
|
|
28187
|
+
unmount();
|
|
28188
|
+
};
|
|
28109
28189
|
}
|
|
28110
28190
|
return root;
|
|
28111
28191
|
};
|
|
@@ -42,6 +42,7 @@ __export(server_exports, {
|
|
|
42
42
|
createContext: () => import_runtime_server.createContext,
|
|
43
43
|
createElement: () => import_runtime_server.createElement,
|
|
44
44
|
createPortal: () => import_runtime_server.createPortal,
|
|
45
|
+
createResizeObserver: () => import_resize_observer.createResizeObserver,
|
|
45
46
|
createScopedElement: () => import_runtime_server.createScopedElement,
|
|
46
47
|
createScopedValue: () => import_runtime_server.createScopedValue,
|
|
47
48
|
createStreamedRegionPlacementFrame: () => import_streamed_region.createStreamedRegionPlacementFrame,
|
|
@@ -180,6 +181,7 @@ __export(server_exports, {
|
|
|
180
181
|
});
|
|
181
182
|
module.exports = __toCommonJS(server_exports);
|
|
182
183
|
var import_trusted_html = require("../trusted-html.cjs");
|
|
184
|
+
var import_resize_observer = require("../resize-observer.cjs");
|
|
183
185
|
var import_rpc = require("./rpc.cjs");
|
|
184
186
|
var import_early_signals = require("./early-signals.cjs");
|
|
185
187
|
var import_rpc_batch = require("./rpc-batch.cjs");
|
|
@@ -218,6 +220,7 @@ var import_runtime_server = require("../runtime.server.cjs");
|
|
|
218
220
|
createContext,
|
|
219
221
|
createElement,
|
|
220
222
|
createPortal,
|
|
223
|
+
createResizeObserver,
|
|
221
224
|
createScopedElement,
|
|
222
225
|
createScopedValue,
|
|
223
226
|
createStreamedRegionPlacementFrame,
|
|
@@ -537,6 +537,7 @@ function evaluate(node) {
|
|
|
537
537
|
node.flags = ReactiveFlags.Mutable | ReactiveFlags.Watching;
|
|
538
538
|
return true;
|
|
539
539
|
}
|
|
540
|
+
if (historicalReader || (0, import_read_protocol.getNativeAdoptionResolver)()) return evaluateLiveNode(node);
|
|
540
541
|
const previousNode = activeNode;
|
|
541
542
|
const previousOwners = activeOwners;
|
|
542
543
|
const previousObserver = (0, import_read_protocol.setNativeReadObserver)(null);
|
|
@@ -579,6 +580,16 @@ function evaluate(node) {
|
|
|
579
580
|
commitState(node, next);
|
|
580
581
|
return true;
|
|
581
582
|
}
|
|
583
|
+
function evaluateLiveNode(node) {
|
|
584
|
+
const previousReader = setHistoricalReader(void 0);
|
|
585
|
+
const previousAdoption = (0, import_read_protocol.setNativeAdoptionResolver)(null);
|
|
586
|
+
try {
|
|
587
|
+
return evaluate(node);
|
|
588
|
+
} finally {
|
|
589
|
+
(0, import_read_protocol.setNativeAdoptionResolver)(previousAdoption);
|
|
590
|
+
setHistoricalReader(previousReader);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
582
593
|
function commitState(node, next) {
|
|
583
594
|
const previous = node.state;
|
|
584
595
|
node.state = next;
|
package/dist/cjs/version.cjs
CHANGED
|
@@ -21,7 +21,7 @@ __export(version_exports, {
|
|
|
21
21
|
version: () => version
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(version_exports);
|
|
24
|
-
const version = "0.
|
|
24
|
+
const version = "0.4.0";
|
|
25
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
26
|
0 && (module.exports = {
|
|
27
27
|
version
|
package/dist/compiler/bundler.js
CHANGED
|
@@ -146,7 +146,7 @@ export function resolveOctaneRuntimeRequest(request, environment) {
|
|
|
146
146
|
: OCTANE_RUNTIME_REQUESTS[environment];
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
function
|
|
149
|
+
function packageDeclaresOctane(pkg) {
|
|
150
150
|
return (
|
|
151
151
|
pkg.name === 'octane' ||
|
|
152
152
|
['dependencies', 'optionalDependencies', 'peerDependencies'].some(
|
|
@@ -155,6 +155,27 @@ function packageUsesOctane(pkg) {
|
|
|
155
155
|
);
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Does this package compile as Octane source?
|
|
160
|
+
*
|
|
161
|
+
* A declared `octane` dependency is the fast path and the only signal accepted
|
|
162
|
+
* for an installed package, whose real path lies under `node_modules`, where a
|
|
163
|
+
* hoisted copy of Octane says nothing about the package's own intent.
|
|
164
|
+
*
|
|
165
|
+
* A workspace or linked package outside `node_modules` may instead set
|
|
166
|
+
* `octane.source` in its manifest. Such a repository pins Octane once in a
|
|
167
|
+
* shared toolkit manifest and receives it transitively, so a version range in
|
|
168
|
+
* every consumer was a compiler marker for a dependency the consumer does not
|
|
169
|
+
* own the version of. The marker carries no version and stays an explicit
|
|
170
|
+
* per-package decision, which is what exempts these packages from the
|
|
171
|
+
* requireDirective ownership gate.
|
|
172
|
+
*/
|
|
173
|
+
function packageUsesOctane(pkg, dir) {
|
|
174
|
+
if (packageDeclaresOctane(pkg)) return true;
|
|
175
|
+
if (pkg.octane?.source !== true) return false;
|
|
176
|
+
return !/(?:^|[\\/])node_modules(?:[\\/]|$)/.test(realPathOrSelf(dir));
|
|
177
|
+
}
|
|
178
|
+
|
|
158
179
|
function packageViteOptimizeDepsExclusions(pkg) {
|
|
159
180
|
const configured = pkg.octane?.vite?.optimizeDeps?.exclude;
|
|
160
181
|
if (!Array.isArray(configured)) return [];
|
|
@@ -209,6 +230,14 @@ function resolveInstalledPackageManifest(name, issuerRoot, collected) {
|
|
|
209
230
|
}
|
|
210
231
|
}
|
|
211
232
|
|
|
233
|
+
function realPathOrSelf(dir) {
|
|
234
|
+
try {
|
|
235
|
+
return nodeFs.realpathSync(dir);
|
|
236
|
+
} catch {
|
|
237
|
+
return nodePath.resolve(dir);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
212
241
|
function metadata(dependencies = [], missingDependencies = []) {
|
|
213
242
|
return { dependencies, missingDependencies };
|
|
214
243
|
}
|
|
@@ -530,6 +559,7 @@ class OctaneBundlerCompiler {
|
|
|
530
559
|
inlineHookMemo: options.inlineHookMemo !== false,
|
|
531
560
|
strong: options.strong === true,
|
|
532
561
|
knownAttributeSpreads: options.knownAttributeSpreads,
|
|
562
|
+
domBindingFixedProps: options.domBindingFixedProps,
|
|
533
563
|
universalRuntime: normalizeUniversalRuntime(options.universalRuntime),
|
|
534
564
|
};
|
|
535
565
|
this.renderers = normalizeRendererConfig(options.renderers);
|
|
@@ -607,6 +637,7 @@ class OctaneBundlerCompiler {
|
|
|
607
637
|
let result;
|
|
608
638
|
if (pkg !== null) {
|
|
609
639
|
const manual = pkg.octane?.hookSlots?.manual;
|
|
640
|
+
const usesOctane = packageUsesOctane(pkg, dir);
|
|
610
641
|
result = {
|
|
611
642
|
rule: {
|
|
612
643
|
name: typeof pkg.name === 'string' ? pkg.name : null,
|
|
@@ -617,7 +648,7 @@ class OctaneBundlerCompiler {
|
|
|
617
648
|
...Object.keys(pkg.optionalDependencies ?? {}),
|
|
618
649
|
],
|
|
619
650
|
viteOptimizeDepsExclusions: packageViteOptimizeDepsExclusions(pkg),
|
|
620
|
-
usesOctane
|
|
651
|
+
usesOctane,
|
|
621
652
|
},
|
|
622
653
|
...metadata([manifest]),
|
|
623
654
|
};
|
|
@@ -725,8 +756,10 @@ class OctaneBundlerCompiler {
|
|
|
725
756
|
* the plain `.ts`/`.js` hook-slotting branch of `transform` applies the same
|
|
726
757
|
* pragma rule inline.
|
|
727
758
|
* Two carve-outs: installed and linked packages are exempt (their
|
|
728
|
-
* manifest `usesOctane` rule
|
|
729
|
-
*
|
|
759
|
+
* manifest `usesOctane` rule — a declared `octane` dependency, or
|
|
760
|
+
* `octane.source` for a package outside `node_modules` — is already the
|
|
761
|
+
* explicit per-package decision), and `exclude` path fragments are never
|
|
762
|
+
* Octane's — tsrx
|
|
730
763
|
* syntax can target other renderers (e.g. `@tsrx/react`), so a project
|
|
731
764
|
* routing part of its `.tsrx` through a different tsrx compiler lists
|
|
732
765
|
* those paths in `exclude`, and the exclusion wins even over an
|
|
@@ -1218,6 +1251,13 @@ class OctaneBundlerCompiler {
|
|
|
1218
1251
|
...(renderer.target === 'dom' && options.textTypeFacts !== undefined
|
|
1219
1252
|
? { textTypeFacts: options.textTypeFacts }
|
|
1220
1253
|
: null),
|
|
1254
|
+
...(renderer.target === 'dom' &&
|
|
1255
|
+
(options.domBindingFixedProps ?? this.defaults.domBindingFixedProps) !== undefined
|
|
1256
|
+
? {
|
|
1257
|
+
domBindingFixedProps:
|
|
1258
|
+
options.domBindingFixedProps ?? this.defaults.domBindingFixedProps,
|
|
1259
|
+
}
|
|
1260
|
+
: null),
|
|
1221
1261
|
profile,
|
|
1222
1262
|
profileFilename,
|
|
1223
1263
|
...(inlineHookMemo ? null : { inlineHookMemo: false }),
|