octane 0.10.0 → 0.11.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/README.md +9 -0
- package/dist/cjs/dom-binding-handoff.cjs +13 -27
- package/dist/cjs/dom-binding-protocol.cjs +24 -46
- package/dist/cjs/dom-binding-styles.cjs +57 -73
- package/dist/cjs/dom-bindings.cjs +261 -322
- package/dist/cjs/error-codes.client.generated.cjs +5 -0
- package/dist/cjs/error-message-no-arguments.cjs +30 -0
- package/dist/cjs/host-budget.cjs +44 -0
- package/dist/cjs/host-task.cjs +44 -0
- package/dist/cjs/hydration/event-capture.cjs +53 -88
- package/dist/cjs/independent-hydration-protocol.cjs +10 -19
- package/dist/cjs/profiling.cjs +169 -0
- package/dist/cjs/runtime.cjs +1129 -414
- package/dist/cjs/server/streamed-signals.cjs +5 -3
- package/dist/cjs/server-rpc-protocol.cjs +9 -1
- package/dist/cjs/server-rpc-stream-client.cjs +3 -1
- package/dist/cjs/signals/candidate-producers.cjs +20 -21
- package/dist/cjs/signals/computations.cjs +42 -30
- package/dist/cjs/signals/control-binding.cjs +102 -126
- package/dist/cjs/signals/derived-facade.cjs +11 -9
- package/dist/cjs/signals/document-owner.cjs +13 -13
- package/dist/cjs/signals/engine.cjs +255 -192
- package/dist/cjs/signals/facade.cjs +107 -120
- package/dist/cjs/signals/graph.cjs +129 -192
- package/dist/cjs/signals/index.cjs +3 -2
- package/dist/cjs/signals/native-read-client.cjs +73 -79
- package/dist/cjs/signals/owner-context.cjs +10 -20
- package/dist/cjs/signals/public-owner.cjs +40 -0
- package/dist/cjs/signals/query-attempt-observer.cjs +17 -12
- package/dist/cjs/signals/query-facade.cjs +24 -9
- package/dist/cjs/signals/read-protocol.cjs +22 -0
- package/dist/cjs/signals/requests.cjs +16 -4
- package/dist/cjs/signals/scalar-computations.cjs +21 -16
- package/dist/cjs/signals/transition-action.cjs +127 -206
- package/dist/cjs/signals/transition-candidate.cjs +17 -29
- package/dist/cjs/signals/transition-coordinator.cjs +1 -1
- package/dist/cjs/version.cjs +1 -1
- package/dist/compiler/bundler.js +298 -20
- package/dist/compiler/client-only-server.js +14 -1
- package/dist/compiler/compile-renderer-boundaries.js +4 -3
- package/dist/compiler/compile-universal.js +52 -7
- package/dist/compiler/compile-valdi.js +1 -1
- package/dist/compiler/compile.js +489 -62
- package/dist/compiler/dom-binding-program.js +77 -37
- package/dist/compiler/dom-bindings.js +256 -98
- package/dist/compiler/hydrate-boundaries.js +4 -2
- package/dist/compiler/native-read-diagnostics.js +1 -1
- package/dist/compiler/native-read-types.js +173 -79
- package/dist/compiler/parser-template-shape.js +109 -0
- package/dist/compiler/parser.browser.js +10 -0
- package/dist/compiler/parser.node.js +5 -2
- package/dist/compiler/plain-hook-memo.js +1 -0
- package/dist/compiler/profile-guards.js +604 -0
- package/dist/compiler/renderer-boundaries.js +4 -2
- package/dist/compiler/runtime-requests.js +26 -6
- package/dist/compiler/slot-hooks.js +3 -2
- package/dist/compiler/strong-diagnostics.js +2 -2
- package/dist/compiler/strong-effects.js +13 -90
- package/dist/compiler/strong-mode.js +15 -46
- package/dist/compiler/text-types-classic.js +429 -0
- package/dist/compiler/text-types-shared.js +292 -0
- package/dist/compiler/text-types-ts7.js +532 -0
- package/dist/compiler/typescript-module.js +88 -0
- package/dist/compiler/typescript.d.ts +49 -8
- package/dist/compiler/typescript.js +63 -631
- package/dist/compiler/vite.js +115 -18
- package/dist/compiler/void-roots.js +12 -5
- package/dist/compiler/volar.LICENSES.txt +1 -1
- package/dist/compiler/volar.js +10013 -3979
- package/dist/dom-binding-classes.js +21 -44
- package/dist/dom-binding-handoff.js +13 -27
- package/dist/dom-binding-island.js +18 -25
- package/dist/dom-binding-program.d.ts +2 -1
- package/dist/dom-binding-program.js +439 -419
- package/dist/dom-binding-projections.js +48 -62
- package/dist/dom-binding-protocol.js +28 -44
- package/dist/dom-binding-signals.js +60 -73
- package/dist/dom-binding-styles.js +64 -74
- package/dist/dom-bindings.d.ts +2 -2
- package/dist/dom-bindings.js +247 -305
- package/dist/error-codes.client.generated.d.ts +1 -0
- package/dist/error-codes.client.generated.js +5 -0
- package/dist/error-message-no-arguments.d.ts +8 -0
- package/dist/error-message-no-arguments.js +6 -0
- package/dist/host-budget.d.ts +7 -0
- package/dist/host-budget.js +20 -0
- package/dist/host-task.d.ts +19 -0
- package/dist/host-task.js +20 -0
- package/dist/hydration/document-lifecycle.js +6 -13
- package/dist/hydration/event-capture.js +77 -91
- package/dist/hydration/independent-island.d.ts +1 -0
- package/dist/hydration/independent-island.js +208 -175
- package/dist/hydration/stream-delivery.js +78 -75
- package/dist/hydration/stream-result-receiver.js +26 -44
- package/dist/hydration/streamed-signals.js +51 -48
- package/dist/independent-hydration-protocol.js +8 -17
- package/dist/node/dom-binding-classes.js +21 -44
- package/dist/node/dom-binding-handoff.js +13 -27
- package/dist/node/dom-binding-island.js +18 -25
- package/dist/node/dom-binding-program.js +439 -419
- package/dist/node/dom-binding-projections.js +48 -62
- package/dist/node/dom-binding-protocol.js +28 -44
- package/dist/node/dom-binding-signals.js +60 -73
- package/dist/node/dom-binding-styles.js +64 -74
- package/dist/node/dom-bindings.js +247 -305
- package/dist/node/error-codes.client.generated.js +5 -0
- package/dist/node/error-message-no-arguments.js +6 -0
- package/dist/node/host-budget.js +20 -0
- package/dist/node/host-task.js +20 -0
- package/dist/node/hydration/document-lifecycle.js +6 -13
- package/dist/node/hydration/event-capture.js +77 -91
- package/dist/node/hydration/independent-island.js +208 -175
- package/dist/node/hydration/stream-delivery.js +78 -75
- package/dist/node/hydration/stream-result-receiver.js +26 -44
- package/dist/node/hydration/streamed-signals.js +51 -48
- package/dist/node/independent-hydration-protocol.js +8 -17
- package/dist/node/profiling.js +158 -0
- package/dist/node/runtime.js +1146 -415
- package/dist/node/server/streamed-signals.js +5 -3
- package/dist/node/server-rpc-protocol.js +9 -1
- package/dist/node/server-rpc-stream-client.js +3 -1
- package/dist/node/signals/candidate-producers.js +23 -20
- package/dist/node/signals/computations.js +46 -32
- package/dist/node/signals/control-binding.js +123 -128
- package/dist/node/signals/derived-facade.js +11 -9
- package/dist/node/signals/document-owner.js +16 -13
- package/dist/node/signals/engine.js +255 -192
- package/dist/node/signals/facade.js +139 -119
- package/dist/node/signals/graph.js +161 -196
- package/dist/node/signals/index.js +1 -2
- package/dist/node/signals/native-read-client.js +79 -80
- package/dist/node/signals/owner-context.js +9 -19
- package/dist/node/signals/public-owner.js +18 -0
- package/dist/node/signals/query-attempt-observer.js +16 -11
- package/dist/node/signals/query-facade.js +26 -9
- package/dist/node/signals/read-protocol.js +18 -0
- package/dist/node/signals/requests.js +16 -4
- package/dist/node/signals/scalar-computations.js +38 -16
- package/dist/node/signals/transition-action.js +136 -204
- package/dist/node/signals/transition-candidate.js +20 -30
- package/dist/node/signals/transition-coordinator.js +1 -1
- package/dist/node/tsrx-boundary.js +8 -0
- package/dist/node/universal-core.js +10 -6
- package/dist/node/version.js +1 -1
- package/dist/profiling.d.ts +108 -0
- package/dist/profiling.js +157 -0
- package/dist/runtime.d.ts +116 -40
- package/dist/runtime.js +1146 -415
- package/dist/runtime.server.d.ts +8 -2
- package/dist/server/streamed-signals.js +5 -3
- package/dist/server-rpc-protocol.d.ts +1 -1
- package/dist/server-rpc-protocol.js +9 -1
- package/dist/server-rpc-stream-client.js +3 -1
- package/dist/signals/candidate-producers.js +23 -20
- package/dist/signals/computations.d.ts +3 -2
- package/dist/signals/computations.js +46 -32
- package/dist/signals/control-binding.js +123 -128
- package/dist/signals/derived-facade.js +11 -9
- package/dist/signals/document-owner.d.ts +10 -0
- package/dist/signals/document-owner.js +16 -13
- package/dist/signals/engine.d.ts +39 -29
- package/dist/signals/engine.js +255 -192
- package/dist/signals/facade.d.ts +4 -4
- package/dist/signals/facade.js +139 -119
- package/dist/signals/graph.d.ts +12 -0
- package/dist/signals/graph.js +161 -196
- package/dist/signals/index.d.ts +2 -1
- package/dist/signals/index.js +1 -2
- package/dist/signals/native-read-client.d.ts +8 -0
- package/dist/signals/native-read-client.js +79 -80
- package/dist/signals/owner-context.js +9 -19
- package/dist/signals/public-owner.d.ts +5 -0
- package/dist/signals/public-owner.js +18 -0
- package/dist/signals/query-attempt-observer.js +16 -11
- package/dist/signals/query-facade.js +26 -9
- package/dist/signals/read-protocol.d.ts +28 -0
- package/dist/signals/read-protocol.js +18 -0
- package/dist/signals/requests.js +16 -4
- package/dist/signals/scalar-computations.d.ts +2 -2
- package/dist/signals/scalar-computations.js +38 -16
- package/dist/signals/transition-action.js +136 -204
- package/dist/signals/transition-candidate.js +20 -30
- package/dist/signals/transition-coordinator.d.ts +7 -0
- package/dist/signals/transition-coordinator.js +1 -1
- package/dist/signals/types.d.ts +19 -5
- package/dist/tsrx-boundary.d.ts +30 -0
- package/dist/tsrx-boundary.js +8 -0
- package/dist/tsrx-spread.d.ts +4 -1
- package/dist/universal-core.d.ts +8 -2
- package/dist/universal-core.js +10 -6
- package/dist/version.js +1 -1
- package/package.json +17 -8
package/README.md
CHANGED
|
@@ -17,6 +17,15 @@ wrapper is narrower: the wrapper must be locally declared in a fully compiled
|
|
|
17
17
|
parameter to a supported hook. This package ships both the runtime and compiler,
|
|
18
18
|
with the compiler exposed at `octane/compiler`.
|
|
19
19
|
|
|
20
|
+
To use the compiler in Node, including through the Vite, Rspack, or Rsbuild
|
|
21
|
+
integrations, install its optional parser peer in your project:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm add @tsrx/oxc@0.20.0
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Applications that use only the Octane runtime do not need this peer.
|
|
28
|
+
|
|
20
29
|
[Signals](https://octanejs.dev/docs/signals) are stable. Import `createScope` and
|
|
21
30
|
`query` from `octane/signals`, or `useSignal$` from `octane/signals/client`, for
|
|
22
31
|
scoped state, derived values, async resources, and native component reads.
|
|
@@ -28,31 +28,24 @@ __export(dom_binding_handoff_exports, {
|
|
|
28
28
|
releaseBindingHandoff: () => releaseBindingHandoff
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(dom_binding_handoff_exports);
|
|
31
|
+
var import_error_message_no_arguments = require("./error-message-no-arguments.cjs");
|
|
31
32
|
var import_control_handoff = require("./signals/control-handoff.cjs");
|
|
32
33
|
const __octaneDev = process.env.NODE_ENV !== "production";
|
|
33
|
-
function __octaneNoArgError(code) {
|
|
34
|
-
return "Minified Octane error #" + code + "; visit https://octanejs.dev/errors/" + code + " for the full message or use a development build for full errors and additional helpful warnings.";
|
|
35
|
-
}
|
|
36
34
|
const events = /* @__PURE__ */ new WeakMap();
|
|
37
35
|
const delivered = /* @__PURE__ */ new WeakMap();
|
|
38
36
|
function registerBindingEvent(node, type) {
|
|
39
37
|
let counts = events.get(node);
|
|
40
|
-
if (counts === void 0)
|
|
41
|
-
events.set(node, counts = /* @__PURE__ */ new Map());
|
|
38
|
+
if (counts === void 0) events.set(node, counts = /* @__PURE__ */ new Map());
|
|
42
39
|
counts.set(type, (counts.get(type) ?? 0) + 1);
|
|
43
40
|
return () => {
|
|
44
41
|
const count = counts.get(type) - 1;
|
|
45
|
-
if (count === 0)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
counts.set(type, count);
|
|
49
|
-
if (counts.size === 0)
|
|
50
|
-
events.delete(node);
|
|
42
|
+
if (count === 0) counts.delete(type);
|
|
43
|
+
else counts.set(type, count);
|
|
44
|
+
if (counts.size === 0) events.delete(node);
|
|
51
45
|
};
|
|
52
46
|
}
|
|
53
47
|
function claimBindingHandoff(lease, owner) {
|
|
54
|
-
if (!lease.active() || lease.owner !== void 0)
|
|
55
|
-
throw new Error(__octaneDev ? "A DOM binding hydration lease must be active and have only one root owner." : __octaneNoArgError(277));
|
|
48
|
+
if (!lease.active() || lease.owner !== void 0) throw new Error(__octaneDev ? "A DOM binding hydration lease must be active and have only one root owner." : (0, import_error_message_no_arguments.formatNoArgumentErrorMessage)(277));
|
|
56
49
|
lease.owner = owner;
|
|
57
50
|
}
|
|
58
51
|
function releaseBindingHandoff(lease) {
|
|
@@ -60,8 +53,7 @@ function releaseBindingHandoff(lease) {
|
|
|
60
53
|
}
|
|
61
54
|
function hasBindingHandoffEvent(event) {
|
|
62
55
|
for (const node of event.composedPath()) {
|
|
63
|
-
if (events.get(node)?.has(event.type))
|
|
64
|
-
return true;
|
|
56
|
+
if (events.get(node)?.has(event.type)) return true;
|
|
65
57
|
}
|
|
66
58
|
return false;
|
|
67
59
|
}
|
|
@@ -70,13 +62,10 @@ function markBindingEvent(event, node, capture) {
|
|
|
70
62
|
if (nodes === void 0) {
|
|
71
63
|
delivered.set(event, nodes = /* @__PURE__ */ new Map());
|
|
72
64
|
const cleanup = () => {
|
|
73
|
-
if (delivered.get(event) === nodes)
|
|
74
|
-
delivered.delete(event);
|
|
65
|
+
if (delivered.get(event) === nodes) delivered.delete(event);
|
|
75
66
|
};
|
|
76
|
-
if (event.isTrusted)
|
|
77
|
-
|
|
78
|
-
else
|
|
79
|
-
queueMicrotask(cleanup);
|
|
67
|
+
if (event.isTrusted) setTimeout(cleanup, 0);
|
|
68
|
+
else queueMicrotask(cleanup);
|
|
80
69
|
}
|
|
81
70
|
nodes.set(node, (nodes.get(node) ?? 0) | (capture ? 2 : 1));
|
|
82
71
|
}
|
|
@@ -84,12 +73,9 @@ function consumeBindingEvent(event, node, capture) {
|
|
|
84
73
|
const nodes = delivered.get(event);
|
|
85
74
|
const flags = nodes?.get(node) ?? 0;
|
|
86
75
|
const bit = capture ? 2 : 1;
|
|
87
|
-
if ((flags & bit) === 0)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
nodes.delete(node);
|
|
91
|
-
else
|
|
92
|
-
nodes.set(node, flags & ~bit);
|
|
76
|
+
if ((flags & bit) === 0) return false;
|
|
77
|
+
if ((flags & ~bit) === 0) nodes.delete(node);
|
|
78
|
+
else nodes.set(node, flags & ~bit);
|
|
93
79
|
return true;
|
|
94
80
|
}
|
|
95
81
|
function beginBindingEvent(event) {
|
|
@@ -28,11 +28,9 @@ __export(dom_binding_protocol_exports, {
|
|
|
28
28
|
parseBindingMarker: () => parseBindingMarker
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(dom_binding_protocol_exports);
|
|
31
|
+
var import_error_message_no_arguments = require("./error-message-no-arguments.cjs");
|
|
31
32
|
var import_hydration_markers = require("./hydration-markers.cjs");
|
|
32
33
|
const __octaneDev = process.env.NODE_ENV !== "production";
|
|
33
|
-
function __octaneNoArgError(code) {
|
|
34
|
-
return "Minified Octane error #" + code + "; visit https://octanejs.dev/errors/" + code + " for the full message or use a development build for full errors and additional helpful warnings.";
|
|
35
|
-
}
|
|
36
34
|
const BINDING_OPEN_PREFIX = import_hydration_markers.HYDRATION_START + "b;";
|
|
37
35
|
const BINDING_RECEIPT = ";b;";
|
|
38
36
|
const BINDING_FOR_EMPTY_PREFIX = import_hydration_markers.HYDRATION_FOR_EMPTY + BINDING_RECEIPT;
|
|
@@ -47,28 +45,25 @@ function bindingRootMarker(id) {
|
|
|
47
45
|
function encodeBindingKey(key) {
|
|
48
46
|
if (typeof key === "string")
|
|
49
47
|
return "s:" + JSON.stringify(key).replace(/-/g, "\\u002d").replace(/</g, "\\u003c");
|
|
50
|
-
if (typeof key === "number" && Number.isFinite(key))
|
|
51
|
-
|
|
52
|
-
throw new TypeError(__octaneDev ? "A DOM presentation key must be a string or finite number." : __octaneNoArgError(306));
|
|
48
|
+
if (typeof key === "number" && Number.isFinite(key)) return "n:" + String(key);
|
|
49
|
+
throw new TypeError(__octaneDev ? "A DOM presentation key must be a string or finite number." : (0, import_error_message_no_arguments.formatNoArgumentErrorMessage)(306));
|
|
53
50
|
}
|
|
54
51
|
function decodeBindingKey(encoded) {
|
|
55
52
|
let key;
|
|
56
53
|
try {
|
|
57
54
|
key = JSON.parse(encoded.slice(2));
|
|
58
55
|
} catch {
|
|
59
|
-
throw new TypeError(__octaneDev ? "A DOM presentation key has invalid serialized identity." :
|
|
56
|
+
throw new TypeError(__octaneDev ? "A DOM presentation key has invalid serialized identity." : (0, import_error_message_no_arguments.formatNoArgumentErrorMessage)(307));
|
|
60
57
|
}
|
|
61
58
|
if (encoded.startsWith("s:") && typeof key === "string" || encoded.startsWith("n:") && typeof key === "number" && Number.isFinite(key)) {
|
|
62
|
-
if (encodeBindingKey(key) === encoded)
|
|
63
|
-
return key;
|
|
59
|
+
if (encodeBindingKey(key) === encoded) return key;
|
|
64
60
|
}
|
|
65
|
-
throw new TypeError(__octaneDev ? "A DOM presentation key has invalid serialized identity." :
|
|
61
|
+
throw new TypeError(__octaneDev ? "A DOM presentation key has invalid serialized identity." : (0, import_error_message_no_arguments.formatNoArgumentErrorMessage)(307));
|
|
66
62
|
}
|
|
67
63
|
function parseBindingMarker(data) {
|
|
68
64
|
if (data.startsWith(BINDING_FOR_EMPTY_PREFIX) || data.startsWith(BINDING_FOR_ITEMS_PREFIX)) {
|
|
69
65
|
const separator = data.indexOf(";", BINDING_FOR_ID_START);
|
|
70
|
-
if (separator <= BINDING_FOR_ID_START || separator === data.length - 1)
|
|
71
|
-
return null;
|
|
66
|
+
if (separator <= BINDING_FOR_ID_START || separator === data.length - 1) return null;
|
|
72
67
|
return {
|
|
73
68
|
id: data.slice(BINDING_FOR_ID_START, separator),
|
|
74
69
|
site: data.slice(separator + 1),
|
|
@@ -76,29 +71,21 @@ function parseBindingMarker(data) {
|
|
|
76
71
|
arm: data.charCodeAt(import_hydration_markers.HYDRATION_FOR_ARM_INDEX) - 48
|
|
77
72
|
};
|
|
78
73
|
}
|
|
79
|
-
if (!data.startsWith(BINDING_OPEN_PREFIX))
|
|
80
|
-
return null;
|
|
74
|
+
if (!data.startsWith(BINDING_OPEN_PREFIX)) return null;
|
|
81
75
|
const idEnd = data.indexOf(";", BINDING_ID_START);
|
|
82
|
-
if (idEnd <= BINDING_ID_START || idEnd === data.length - 1)
|
|
83
|
-
return null;
|
|
76
|
+
if (idEnd <= BINDING_ID_START || idEnd === data.length - 1) return null;
|
|
84
77
|
const id = data.slice(BINDING_ID_START, idEnd);
|
|
85
78
|
if (data.slice(idEnd + 1) === BINDING_ROOT_SITE)
|
|
86
79
|
return { id, site: BINDING_ROOT_SITE, kind: "root" };
|
|
87
80
|
const siteEnd = data.indexOf(";", idEnd + 1);
|
|
88
|
-
if (siteEnd <= idEnd + 1 || siteEnd === data.length - 1)
|
|
89
|
-
return null;
|
|
81
|
+
if (siteEnd <= idEnd + 1 || siteEnd === data.length - 1) return null;
|
|
90
82
|
const site = data.slice(idEnd + 1, siteEnd);
|
|
91
83
|
const kind = data.slice(siteEnd + 1);
|
|
92
|
-
if (kind === "t")
|
|
93
|
-
|
|
94
|
-
if (kind === "
|
|
95
|
-
|
|
96
|
-
if (kind === "
|
|
97
|
-
return { id, site, kind: "slot" };
|
|
98
|
-
if (kind === "o")
|
|
99
|
-
return { id, site, kind: "opaque" };
|
|
100
|
-
if (kind === "y")
|
|
101
|
-
return { id, site, kind: "try", arm: -1 };
|
|
84
|
+
if (kind === "t") return { id, site, kind: "text" };
|
|
85
|
+
if (kind === "v") return { id, site, kind: "view" };
|
|
86
|
+
if (kind === "s") return { id, site, kind: "slot" };
|
|
87
|
+
if (kind === "o") return { id, site, kind: "opaque" };
|
|
88
|
+
if (kind === "y") return { id, site, kind: "try", arm: -1 };
|
|
102
89
|
if (kind.length === 2 && kind[0] === "y" && kind[1] >= "0" && kind[1] <= "2")
|
|
103
90
|
return { id, site, kind: "try", arm: kind.charCodeAt(1) - 48 };
|
|
104
91
|
if (kind.startsWith("k;")) {
|
|
@@ -112,44 +99,35 @@ function parseBindingMarker(data) {
|
|
|
112
99
|
}
|
|
113
100
|
if (/^(?:-1|0|[1-9]\d*)$/.test(kind)) {
|
|
114
101
|
const arm = Number(kind);
|
|
115
|
-
if (Number.isSafeInteger(arm))
|
|
116
|
-
return { id, site, kind: "if", arm };
|
|
102
|
+
if (Number.isSafeInteger(arm)) return { id, site, kind: "if", arm };
|
|
117
103
|
}
|
|
118
104
|
return null;
|
|
119
105
|
}
|
|
120
106
|
const BINDING_OPEN_TAIL_SOURCE = "f[01];b;[^;]+;[^;]+|b;[^;]+;(root|[^;]+;([tvso\\d]|-1|[1-9]\\d+|y[012]?|k;[sn]:[^]+))";
|
|
121
107
|
function isBindingOpenComment(data) {
|
|
122
108
|
const list = data.startsWith(BINDING_FOR_EMPTY_PREFIX) || data.startsWith(BINDING_FOR_ITEMS_PREFIX);
|
|
123
|
-
if (!list && !data.startsWith(BINDING_OPEN_PREFIX))
|
|
124
|
-
return false;
|
|
109
|
+
if (!list && !data.startsWith(BINDING_OPEN_PREFIX)) return false;
|
|
125
110
|
const idStart = list ? BINDING_FOR_ID_START : BINDING_ID_START;
|
|
126
111
|
const idEnd = data.indexOf(";", idStart);
|
|
127
|
-
if (idEnd <= idStart || idEnd === data.length - 1)
|
|
128
|
-
|
|
129
|
-
if (list)
|
|
130
|
-
return data.indexOf(";", idEnd + 1) === -1;
|
|
112
|
+
if (idEnd <= idStart || idEnd === data.length - 1) return false;
|
|
113
|
+
if (list) return data.indexOf(";", idEnd + 1) === -1;
|
|
131
114
|
if (data.length - idEnd === BINDING_ROOT_SUFFIX.length && data.endsWith(BINDING_ROOT_SUFFIX))
|
|
132
115
|
return true;
|
|
133
116
|
const siteEnd = data.indexOf(";", idEnd + 1);
|
|
134
|
-
if (siteEnd <= idEnd + 1 || siteEnd === data.length - 1)
|
|
135
|
-
return false;
|
|
117
|
+
if (siteEnd <= idEnd + 1 || siteEnd === data.length - 1) return false;
|
|
136
118
|
const tail = siteEnd + 1;
|
|
137
|
-
if (data[tail] === "y")
|
|
138
|
-
return /^y[012]?$/.test(data.slice(tail));
|
|
119
|
+
if (data[tail] === "y") return /^y[012]?$/.test(data.slice(tail));
|
|
139
120
|
if (data.length === tail + 1) {
|
|
140
121
|
const code = data.charCodeAt(tail);
|
|
141
122
|
return code === 116 || code === 118 || code === 115 || code === 111 || code >= 48 && code <= 57;
|
|
142
123
|
}
|
|
143
124
|
if (data.charCodeAt(tail) === 107 && data.charCodeAt(tail + 1) === 59)
|
|
144
125
|
return (data.charCodeAt(tail + 2) === 115 || data.charCodeAt(tail + 2) === 110) && data.charCodeAt(tail + 3) === 58 && data.length > tail + 4;
|
|
145
|
-
if (data.length === tail + 2 && data.endsWith("-1"))
|
|
146
|
-
|
|
147
|
-
if (data.charCodeAt(tail) < 49 || data.charCodeAt(tail) > 57)
|
|
148
|
-
return false;
|
|
126
|
+
if (data.length === tail + 2 && data.endsWith("-1")) return true;
|
|
127
|
+
if (data.charCodeAt(tail) < 49 || data.charCodeAt(tail) > 57) return false;
|
|
149
128
|
for (let index = tail + 1; index < data.length; index++) {
|
|
150
129
|
const code = data.charCodeAt(index);
|
|
151
|
-
if (code < 48 || code > 57)
|
|
152
|
-
return false;
|
|
130
|
+
if (code < 48 || code > 57) return false;
|
|
153
131
|
}
|
|
154
132
|
return true;
|
|
155
133
|
}
|
|
@@ -24,14 +24,12 @@ __export(dom_binding_styles_exports, {
|
|
|
24
24
|
__retiredBindingSource: () => __retiredBindingSource
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(dom_binding_styles_exports);
|
|
27
|
+
var import_error_message_no_arguments = require("./error-message-no-arguments.cjs");
|
|
27
28
|
var import_style_values = require("./style-values.cjs");
|
|
28
29
|
var import_dom_bindings = require("./dom-bindings.cjs");
|
|
29
30
|
var import_owner_context = require("./signals/owner-context.cjs");
|
|
30
31
|
var import_read_protocol = require("./signals/read-protocol.cjs");
|
|
31
32
|
const __octaneDev = process.env.NODE_ENV !== "production";
|
|
32
|
-
function __octaneNoArgError(code) {
|
|
33
|
-
return "Minified Octane error #" + code + "; visit https://octanejs.dev/errors/" + code + " for the full message or use a development build for full errors and additional helpful warnings.";
|
|
34
|
-
}
|
|
35
33
|
function __prepareBindingSources(reads, subscriptions, notify, active, run) {
|
|
36
34
|
const previous = new Map(subscriptions);
|
|
37
35
|
const acquired = /* @__PURE__ */ new Map();
|
|
@@ -40,64 +38,53 @@ function __prepareBindingSources(reads, subscriptions, notify, active, run) {
|
|
|
40
38
|
let invalid = false;
|
|
41
39
|
try {
|
|
42
40
|
for (const source of reads.keys()) {
|
|
43
|
-
if (previous.has(source))
|
|
44
|
-
continue;
|
|
41
|
+
if (previous.has(source)) continue;
|
|
45
42
|
let live = true;
|
|
46
|
-
const stop = run(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
const stop = run(
|
|
44
|
+
() => source.subscribe(
|
|
45
|
+
(0, import_read_protocol.forwardNativeTransitionConsumer)(notify, () => {
|
|
46
|
+
if (!live || retired || !active()) return;
|
|
47
|
+
if (!accepted) invalid = true;
|
|
48
|
+
else notify();
|
|
49
|
+
})
|
|
50
|
+
)
|
|
51
|
+
);
|
|
54
52
|
acquired.set(source, () => {
|
|
55
53
|
live = false;
|
|
56
54
|
stop();
|
|
57
55
|
});
|
|
58
56
|
}
|
|
59
57
|
} catch (error) {
|
|
60
|
-
for (const stop of acquired.values())
|
|
61
|
-
stop();
|
|
58
|
+
for (const stop of acquired.values()) stop();
|
|
62
59
|
throw error;
|
|
63
60
|
}
|
|
64
61
|
return {
|
|
65
62
|
validate: () => !retired && !invalid && active() && subscriptions.size === previous.size && [...previous].every(([source, stop]) => subscriptions.get(source) === stop) && [...reads].every(([source, version]) => source.getVersion() === version),
|
|
66
63
|
commit() {
|
|
67
|
-
if (accepted || retired || !active())
|
|
68
|
-
return;
|
|
64
|
+
if (accepted || retired || !active()) return;
|
|
69
65
|
accepted = true;
|
|
70
|
-
for (const [source, stop] of acquired)
|
|
71
|
-
subscriptions.set(source, stop);
|
|
66
|
+
for (const [source, stop] of acquired) subscriptions.set(source, stop);
|
|
72
67
|
for (const [source, stop] of previous) {
|
|
73
|
-
if (reads.has(source))
|
|
74
|
-
continue;
|
|
68
|
+
if (reads.has(source)) continue;
|
|
75
69
|
subscriptions.delete(source);
|
|
76
70
|
stop();
|
|
77
71
|
}
|
|
78
72
|
},
|
|
79
73
|
discard() {
|
|
80
|
-
if (accepted || retired)
|
|
81
|
-
return;
|
|
74
|
+
if (accepted || retired) return;
|
|
82
75
|
retired = true;
|
|
83
|
-
for (const stop of acquired.values())
|
|
84
|
-
stop();
|
|
76
|
+
for (const stop of acquired.values()) stop();
|
|
85
77
|
}
|
|
86
78
|
};
|
|
87
79
|
}
|
|
88
80
|
function __retiredBindingSource(subscriptions) {
|
|
89
|
-
for (const source of subscriptions.keys())
|
|
90
|
-
if (source.inspect?.().retired)
|
|
91
|
-
return true;
|
|
81
|
+
for (const source of subscriptions.keys()) if (source.inspect?.().retired) return true;
|
|
92
82
|
return false;
|
|
93
83
|
}
|
|
94
84
|
function __normalizeBindingStyle(value) {
|
|
95
|
-
if (value == null || value === false || value === "")
|
|
96
|
-
|
|
97
|
-
if (typeof value
|
|
98
|
-
return value;
|
|
99
|
-
if (typeof value !== "object")
|
|
100
|
-
throw new TypeError(__octaneDev ? "A whole-style DOM binding requires a style object, CSS text or null." : __octaneNoArgError(311));
|
|
85
|
+
if (value == null || value === false || value === "") return null;
|
|
86
|
+
if (typeof value === "string") return value;
|
|
87
|
+
if (typeof value !== "object") throw new TypeError(__octaneDev ? "A whole-style DOM binding requires a style object, CSS text or null." : (0, import_error_message_no_arguments.formatNoArgumentErrorMessage)(311));
|
|
101
88
|
const result = /* @__PURE__ */ Object.create(null);
|
|
102
89
|
for (const name in value) {
|
|
103
90
|
const property = value[name];
|
|
@@ -130,10 +117,11 @@ function __createBindingStyles() {
|
|
|
130
117
|
};
|
|
131
118
|
previous = snapshotDOM();
|
|
132
119
|
const get = () => {
|
|
133
|
-
if (disposed)
|
|
134
|
-
return null;
|
|
120
|
+
if (disposed) return null;
|
|
135
121
|
const reads = /* @__PURE__ */ new Map();
|
|
136
|
-
const previousObserver = (0, import_read_protocol.setNativeReadObserver)(
|
|
122
|
+
const previousObserver = (0, import_read_protocol.setNativeReadObserver)(
|
|
123
|
+
(source, version) => reads.set(source, version)
|
|
124
|
+
);
|
|
137
125
|
const guard = (0, import_read_protocol.beginNativeWriteGuard)();
|
|
138
126
|
let value;
|
|
139
127
|
try {
|
|
@@ -143,39 +131,35 @@ function __createBindingStyles() {
|
|
|
143
131
|
(0, import_read_protocol.setNativeReadObserver)(previousObserver);
|
|
144
132
|
}
|
|
145
133
|
for (const [source, stop] of subscriptions) {
|
|
146
|
-
if (reads.has(source))
|
|
147
|
-
continue;
|
|
134
|
+
if (reads.has(source)) continue;
|
|
148
135
|
subscriptions.delete(source);
|
|
149
136
|
stop();
|
|
150
137
|
}
|
|
151
138
|
for (const [source, version] of reads) {
|
|
152
|
-
if (disposed)
|
|
153
|
-
break;
|
|
139
|
+
if (disposed) break;
|
|
154
140
|
if (!subscriptions.has(source)) {
|
|
155
141
|
let active = true;
|
|
156
|
-
const stop = run(
|
|
157
|
-
|
|
158
|
-
notify()
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
142
|
+
const stop = run(
|
|
143
|
+
() => source.subscribe(
|
|
144
|
+
(0, import_read_protocol.forwardNativeTransitionConsumer)(notify, () => {
|
|
145
|
+
if (active && !disposed) notify();
|
|
146
|
+
})
|
|
147
|
+
)
|
|
148
|
+
);
|
|
149
|
+
if (typeof stop !== "function") throw new TypeError(__octaneDev ? "A DOM style subscription must return cleanup." : (0, import_error_message_no_arguments.formatNoArgumentErrorMessage)(312));
|
|
162
150
|
const disposeSource = () => {
|
|
163
151
|
active = false;
|
|
164
152
|
stop();
|
|
165
153
|
};
|
|
166
|
-
if (disposed)
|
|
167
|
-
|
|
168
|
-
else
|
|
169
|
-
subscriptions.set(source, disposeSource);
|
|
154
|
+
if (disposed) disposeSource();
|
|
155
|
+
else subscriptions.set(source, disposeSource);
|
|
170
156
|
}
|
|
171
|
-
if (!disposed && source.getVersion() !== version)
|
|
172
|
-
notify();
|
|
157
|
+
if (!disposed && source.getVersion() !== version) notify();
|
|
173
158
|
}
|
|
174
159
|
return value;
|
|
175
160
|
};
|
|
176
161
|
const writeProperty = (name, value) => {
|
|
177
|
-
if (disposed)
|
|
178
|
-
return;
|
|
162
|
+
if (disposed) return;
|
|
179
163
|
name = (0, import_style_values.hyphenateStyleName)(name);
|
|
180
164
|
const operation = [0, "styleProperty", name];
|
|
181
165
|
if (restoreStyles) {
|
|
@@ -191,18 +175,17 @@ function __createBindingStyles() {
|
|
|
191
175
|
(0, import_dom_bindings.__writeBinding)(node, operation, value);
|
|
192
176
|
};
|
|
193
177
|
const restore = () => {
|
|
194
|
-
if (!restorations)
|
|
195
|
-
|
|
196
|
-
|
|
178
|
+
if (!restorations) return;
|
|
179
|
+
const owned = [...restorations].filter(
|
|
180
|
+
(name) => style.getPropertyValue(name) === expected.style.getPropertyValue(name) && style.getPropertyPriority(name) === expected.style.getPropertyPriority(name)
|
|
181
|
+
);
|
|
197
182
|
let failed = false;
|
|
198
183
|
let failure;
|
|
199
184
|
for (const name of owned) {
|
|
200
185
|
try {
|
|
201
186
|
const value = baseline.style.getPropertyValue(name);
|
|
202
|
-
if (value === "")
|
|
203
|
-
|
|
204
|
-
else
|
|
205
|
-
style.setProperty(name, value, baseline.style.getPropertyPriority(name));
|
|
187
|
+
if (value === "") style.removeProperty(name);
|
|
188
|
+
else style.setProperty(name, value, baseline.style.getPropertyPriority(name));
|
|
206
189
|
} catch (error) {
|
|
207
190
|
if (!failed) {
|
|
208
191
|
failed = true;
|
|
@@ -210,8 +193,7 @@ function __createBindingStyles() {
|
|
|
210
193
|
}
|
|
211
194
|
}
|
|
212
195
|
}
|
|
213
|
-
if (failed)
|
|
214
|
-
throw failure;
|
|
196
|
+
if (failed) throw failure;
|
|
215
197
|
};
|
|
216
198
|
return {
|
|
217
199
|
get,
|
|
@@ -219,8 +201,7 @@ function __createBindingStyles() {
|
|
|
219
201
|
preview(value) {
|
|
220
202
|
const reads = /* @__PURE__ */ new Map();
|
|
221
203
|
const previousObserver = (0, import_read_protocol.setNativeReadObserver)((source, version) => {
|
|
222
|
-
if (!reads.has(source))
|
|
223
|
-
reads.set(source, version);
|
|
204
|
+
if (!reads.has(source)) reads.set(source, version);
|
|
224
205
|
});
|
|
225
206
|
const guard = (0, import_read_protocol.beginNativeWriteGuard)();
|
|
226
207
|
let projected;
|
|
@@ -230,7 +211,13 @@ function __createBindingStyles() {
|
|
|
230
211
|
(0, import_read_protocol.endNativeWriteGuard)(guard);
|
|
231
212
|
(0, import_read_protocol.setNativeReadObserver)(previousObserver);
|
|
232
213
|
}
|
|
233
|
-
const prepared = __prepareBindingSources(
|
|
214
|
+
const prepared = __prepareBindingSources(
|
|
215
|
+
reads,
|
|
216
|
+
subscriptions,
|
|
217
|
+
notify,
|
|
218
|
+
() => !disposed,
|
|
219
|
+
run
|
|
220
|
+
);
|
|
234
221
|
return {
|
|
235
222
|
value: projected,
|
|
236
223
|
validate: prepared.validate,
|
|
@@ -246,8 +233,7 @@ function __createBindingStyles() {
|
|
|
246
233
|
return get();
|
|
247
234
|
},
|
|
248
235
|
write(value) {
|
|
249
|
-
if (disposed)
|
|
250
|
-
return;
|
|
236
|
+
if (disposed) return;
|
|
251
237
|
let next = value;
|
|
252
238
|
let old = typeof previous === "string" ? snapshotDOM() : previous;
|
|
253
239
|
const writeAll = firstWrite || typeof previous === "string" || typeof value === "string";
|
|
@@ -277,8 +263,7 @@ function __createBindingStyles() {
|
|
|
277
263
|
}
|
|
278
264
|
},
|
|
279
265
|
dispose(preservePresentation) {
|
|
280
|
-
if (disposed)
|
|
281
|
-
return;
|
|
266
|
+
if (disposed) return;
|
|
282
267
|
disposed = true;
|
|
283
268
|
raw = previous = null;
|
|
284
269
|
let failed = false;
|
|
@@ -299,8 +284,7 @@ function __createBindingStyles() {
|
|
|
299
284
|
subscriptions.clear();
|
|
300
285
|
restorations?.clear();
|
|
301
286
|
probe = baseline = expected = void 0;
|
|
302
|
-
if (failed)
|
|
303
|
-
throw failure;
|
|
287
|
+
if (failed) throw failure;
|
|
304
288
|
}
|
|
305
289
|
};
|
|
306
290
|
}
|