octane 0.6.1 → 0.6.2
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-binding-handoff.cjs +27 -13
- package/dist/cjs/dom-binding-protocol.cjs +42 -22
- package/dist/cjs/dom-binding-styles.cjs +70 -56
- package/dist/cjs/dom-bindings.cjs +311 -222
- package/dist/cjs/hydration/event-capture.cjs +81 -45
- package/dist/cjs/independent-hydration-protocol.cjs +19 -10
- package/dist/cjs/signals/control-binding.cjs +122 -96
- package/dist/cjs/signals/derived-facade.cjs +9 -11
- package/dist/cjs/signals/document-owner.cjs +13 -9
- package/dist/cjs/signals/facade.cjs +92 -82
- package/dist/cjs/signals/graph.cjs +139 -79
- package/dist/cjs/signals/native-read-client.cjs +78 -38
- package/dist/cjs/signals/owner-context.cjs +20 -10
- package/dist/cjs/signals/query-attempt-observer.cjs +9 -10
- package/dist/cjs/signals/query-facade.cjs +8 -16
- package/dist/cjs/signals/scalar-computations.cjs +6 -3
- package/dist/cjs/signals/transition-action.cjs +188 -117
- package/dist/cjs/signals/transition-candidate.cjs +29 -17
- package/dist/cjs/version.cjs +1 -1
- package/dist/dom-binding-classes.js +47 -24
- package/dist/dom-binding-handoff.js +27 -13
- package/dist/dom-binding-program.js +363 -380
- package/dist/dom-binding-projections.js +61 -43
- package/dist/dom-binding-protocol.js +43 -29
- package/dist/dom-binding-signals.js +39 -38
- package/dist/dom-binding-styles.js +71 -63
- package/dist/dom-bindings.js +312 -226
- package/dist/hydration/document-lifecycle.js +14 -7
- package/dist/hydration/event-capture.js +85 -68
- package/dist/hydration/independent-island.js +156 -151
- package/dist/hydration/stream-delivery.js +83 -65
- package/dist/hydration/stream-result-receiver.js +60 -42
- package/dist/hydration/streamed-signals.js +52 -55
- package/dist/independent-hydration-protocol.js +19 -10
- package/dist/signals/control-binding.js +127 -120
- package/dist/signals/derived-facade.js +9 -11
- package/dist/signals/document-owner.js +13 -9
- package/dist/signals/facade.js +95 -103
- package/dist/signals/graph.js +144 -117
- package/dist/signals/native-read-client.js +79 -42
- package/dist/signals/owner-context.js +20 -10
- package/dist/signals/query-attempt-observer.js +9 -10
- package/dist/signals/query-facade.js +9 -19
- package/dist/signals/scalar-computations.js +7 -12
- package/dist/signals/transition-action.js +190 -133
- package/dist/signals/transition-candidate.js +30 -20
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -28,23 +28,30 @@ __export(dom_binding_handoff_exports, {
|
|
|
28
28
|
releaseBindingHandoff: () => releaseBindingHandoff
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(dom_binding_handoff_exports);
|
|
31
|
-
var import_error_codes_client_generated = require("./error-codes.client.generated.cjs");
|
|
32
31
|
var import_control_handoff = require("./signals/control-handoff.cjs");
|
|
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
|
+
}
|
|
33
35
|
const events = /* @__PURE__ */ new WeakMap();
|
|
34
36
|
const delivered = /* @__PURE__ */ new WeakMap();
|
|
35
37
|
function registerBindingEvent(node, type) {
|
|
36
38
|
let counts = events.get(node);
|
|
37
|
-
if (counts === void 0)
|
|
39
|
+
if (counts === void 0)
|
|
40
|
+
events.set(node, counts = /* @__PURE__ */ new Map());
|
|
38
41
|
counts.set(type, (counts.get(type) ?? 0) + 1);
|
|
39
42
|
return () => {
|
|
40
43
|
const count = counts.get(type) - 1;
|
|
41
|
-
if (count === 0)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
if (count === 0)
|
|
45
|
+
counts.delete(type);
|
|
46
|
+
else
|
|
47
|
+
counts.set(type, count);
|
|
48
|
+
if (counts.size === 0)
|
|
49
|
+
events.delete(node);
|
|
44
50
|
};
|
|
45
51
|
}
|
|
46
52
|
function claimBindingHandoff(lease, owner) {
|
|
47
|
-
if (!lease.active() || lease.owner !== void 0)
|
|
53
|
+
if (!lease.active() || lease.owner !== void 0)
|
|
54
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "A DOM binding hydration lease must be active and have only one root owner." : __octaneNoArgError(277));
|
|
48
55
|
lease.owner = owner;
|
|
49
56
|
}
|
|
50
57
|
function releaseBindingHandoff(lease) {
|
|
@@ -52,7 +59,8 @@ function releaseBindingHandoff(lease) {
|
|
|
52
59
|
}
|
|
53
60
|
function hasBindingHandoffEvent(event) {
|
|
54
61
|
for (const node of event.composedPath()) {
|
|
55
|
-
if (events.get(node)?.has(event.type))
|
|
62
|
+
if (events.get(node)?.has(event.type))
|
|
63
|
+
return true;
|
|
56
64
|
}
|
|
57
65
|
return false;
|
|
58
66
|
}
|
|
@@ -61,10 +69,13 @@ function markBindingEvent(event, node, capture) {
|
|
|
61
69
|
if (nodes === void 0) {
|
|
62
70
|
delivered.set(event, nodes = /* @__PURE__ */ new Map());
|
|
63
71
|
const cleanup = () => {
|
|
64
|
-
if (delivered.get(event) === nodes)
|
|
72
|
+
if (delivered.get(event) === nodes)
|
|
73
|
+
delivered.delete(event);
|
|
65
74
|
};
|
|
66
|
-
if (event.isTrusted)
|
|
67
|
-
|
|
75
|
+
if (event.isTrusted)
|
|
76
|
+
setTimeout(cleanup, 0);
|
|
77
|
+
else
|
|
78
|
+
queueMicrotask(cleanup);
|
|
68
79
|
}
|
|
69
80
|
nodes.set(node, (nodes.get(node) ?? 0) | (capture ? 2 : 1));
|
|
70
81
|
}
|
|
@@ -72,9 +83,12 @@ function consumeBindingEvent(event, node, capture) {
|
|
|
72
83
|
const nodes = delivered.get(event);
|
|
73
84
|
const flags = nodes?.get(node) ?? 0;
|
|
74
85
|
const bit = capture ? 2 : 1;
|
|
75
|
-
if ((flags & bit) === 0)
|
|
76
|
-
|
|
77
|
-
|
|
86
|
+
if ((flags & bit) === 0)
|
|
87
|
+
return false;
|
|
88
|
+
if ((flags & ~bit) === 0)
|
|
89
|
+
nodes.delete(node);
|
|
90
|
+
else
|
|
91
|
+
nodes.set(node, flags & ~bit);
|
|
78
92
|
return true;
|
|
79
93
|
}
|
|
80
94
|
function beginBindingEvent(event) {
|
|
@@ -27,8 +27,10 @@ __export(dom_binding_protocol_exports, {
|
|
|
27
27
|
parseBindingMarker: () => parseBindingMarker
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(dom_binding_protocol_exports);
|
|
30
|
-
var import_error_codes_client_generated = require("./error-codes.client.generated.cjs");
|
|
31
30
|
var import_hydration_markers = require("./hydration-markers.cjs");
|
|
31
|
+
function __octaneNoArgError(code) {
|
|
32
|
+
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.";
|
|
33
|
+
}
|
|
32
34
|
const BINDING_OPEN_PREFIX = import_hydration_markers.HYDRATION_START + "b;";
|
|
33
35
|
const BINDING_RECEIPT = ";b;";
|
|
34
36
|
const BINDING_FOR_EMPTY_PREFIX = import_hydration_markers.HYDRATION_FOR_EMPTY + BINDING_RECEIPT;
|
|
@@ -43,25 +45,28 @@ function bindingRootMarker(id) {
|
|
|
43
45
|
function encodeBindingKey(key) {
|
|
44
46
|
if (typeof key === "string")
|
|
45
47
|
return "s:" + JSON.stringify(key).replace(/-/g, "\\u002d").replace(/</g, "\\u003c");
|
|
46
|
-
if (typeof key === "number" && Number.isFinite(key))
|
|
47
|
-
|
|
48
|
+
if (typeof key === "number" && Number.isFinite(key))
|
|
49
|
+
return "n:" + String(key);
|
|
50
|
+
throw new TypeError(process.env.NODE_ENV !== "production" ? "A DOM presentation key must be a string or finite number." : __octaneNoArgError(306));
|
|
48
51
|
}
|
|
49
52
|
function decodeBindingKey(encoded) {
|
|
50
53
|
let key;
|
|
51
54
|
try {
|
|
52
55
|
key = JSON.parse(encoded.slice(2));
|
|
53
56
|
} catch {
|
|
54
|
-
throw new TypeError(
|
|
57
|
+
throw new TypeError(process.env.NODE_ENV !== "production" ? "A DOM presentation key has invalid serialized identity." : __octaneNoArgError(307));
|
|
55
58
|
}
|
|
56
59
|
if (encoded.startsWith("s:") && typeof key === "string" || encoded.startsWith("n:") && typeof key === "number" && Number.isFinite(key)) {
|
|
57
|
-
if (encodeBindingKey(key) === encoded)
|
|
60
|
+
if (encodeBindingKey(key) === encoded)
|
|
61
|
+
return key;
|
|
58
62
|
}
|
|
59
|
-
throw new TypeError(
|
|
63
|
+
throw new TypeError(process.env.NODE_ENV !== "production" ? "A DOM presentation key has invalid serialized identity." : __octaneNoArgError(307));
|
|
60
64
|
}
|
|
61
65
|
function parseBindingMarker(data) {
|
|
62
66
|
if (data.startsWith(BINDING_FOR_EMPTY_PREFIX) || data.startsWith(BINDING_FOR_ITEMS_PREFIX)) {
|
|
63
67
|
const separator = data.indexOf(";", BINDING_FOR_ID_START);
|
|
64
|
-
if (separator <= BINDING_FOR_ID_START || separator === data.length - 1)
|
|
68
|
+
if (separator <= BINDING_FOR_ID_START || separator === data.length - 1)
|
|
69
|
+
return null;
|
|
65
70
|
return {
|
|
66
71
|
id: data.slice(BINDING_FOR_ID_START, separator),
|
|
67
72
|
site: data.slice(separator + 1),
|
|
@@ -69,20 +74,27 @@ function parseBindingMarker(data) {
|
|
|
69
74
|
arm: data.charCodeAt(import_hydration_markers.HYDRATION_FOR_ARM_INDEX) - 48
|
|
70
75
|
};
|
|
71
76
|
}
|
|
72
|
-
if (!data.startsWith(BINDING_OPEN_PREFIX))
|
|
77
|
+
if (!data.startsWith(BINDING_OPEN_PREFIX))
|
|
78
|
+
return null;
|
|
73
79
|
const idEnd = data.indexOf(";", BINDING_ID_START);
|
|
74
|
-
if (idEnd <= BINDING_ID_START || idEnd === data.length - 1)
|
|
80
|
+
if (idEnd <= BINDING_ID_START || idEnd === data.length - 1)
|
|
81
|
+
return null;
|
|
75
82
|
const id = data.slice(BINDING_ID_START, idEnd);
|
|
76
83
|
if (data.slice(idEnd + 1) === BINDING_ROOT_SITE)
|
|
77
84
|
return { id, site: BINDING_ROOT_SITE, kind: "root" };
|
|
78
85
|
const siteEnd = data.indexOf(";", idEnd + 1);
|
|
79
|
-
if (siteEnd <= idEnd + 1 || siteEnd === data.length - 1)
|
|
86
|
+
if (siteEnd <= idEnd + 1 || siteEnd === data.length - 1)
|
|
87
|
+
return null;
|
|
80
88
|
const site = data.slice(idEnd + 1, siteEnd);
|
|
81
89
|
const kind = data.slice(siteEnd + 1);
|
|
82
|
-
if (kind === "t")
|
|
83
|
-
|
|
84
|
-
if (kind === "
|
|
85
|
-
|
|
90
|
+
if (kind === "t")
|
|
91
|
+
return { id, site, kind: "text" };
|
|
92
|
+
if (kind === "v")
|
|
93
|
+
return { id, site, kind: "view" };
|
|
94
|
+
if (kind === "s")
|
|
95
|
+
return { id, site, kind: "slot" };
|
|
96
|
+
if (kind === "o")
|
|
97
|
+
return { id, site, kind: "opaque" };
|
|
86
98
|
if (kind.startsWith("k;")) {
|
|
87
99
|
const key = kind.slice(2);
|
|
88
100
|
try {
|
|
@@ -94,21 +106,26 @@ function parseBindingMarker(data) {
|
|
|
94
106
|
}
|
|
95
107
|
if (/^(?:-1|0|[1-9]\d*)$/.test(kind)) {
|
|
96
108
|
const arm = Number(kind);
|
|
97
|
-
if (Number.isSafeInteger(arm))
|
|
109
|
+
if (Number.isSafeInteger(arm))
|
|
110
|
+
return { id, site, kind: "if", arm };
|
|
98
111
|
}
|
|
99
112
|
return null;
|
|
100
113
|
}
|
|
101
114
|
function isBindingOpenComment(data) {
|
|
102
115
|
const list = data.startsWith(BINDING_FOR_EMPTY_PREFIX) || data.startsWith(BINDING_FOR_ITEMS_PREFIX);
|
|
103
|
-
if (!list && !data.startsWith(BINDING_OPEN_PREFIX))
|
|
116
|
+
if (!list && !data.startsWith(BINDING_OPEN_PREFIX))
|
|
117
|
+
return false;
|
|
104
118
|
const idStart = list ? BINDING_FOR_ID_START : BINDING_ID_START;
|
|
105
119
|
const idEnd = data.indexOf(";", idStart);
|
|
106
|
-
if (idEnd <= idStart || idEnd === data.length - 1)
|
|
107
|
-
|
|
120
|
+
if (idEnd <= idStart || idEnd === data.length - 1)
|
|
121
|
+
return false;
|
|
122
|
+
if (list)
|
|
123
|
+
return data.indexOf(";", idEnd + 1) === -1;
|
|
108
124
|
if (data.length - idEnd === BINDING_ROOT_SUFFIX.length && data.endsWith(BINDING_ROOT_SUFFIX))
|
|
109
125
|
return true;
|
|
110
126
|
const siteEnd = data.indexOf(";", idEnd + 1);
|
|
111
|
-
if (siteEnd <= idEnd + 1 || siteEnd === data.length - 1)
|
|
127
|
+
if (siteEnd <= idEnd + 1 || siteEnd === data.length - 1)
|
|
128
|
+
return false;
|
|
112
129
|
const tail = siteEnd + 1;
|
|
113
130
|
if (data.length === tail + 1) {
|
|
114
131
|
const code = data.charCodeAt(tail);
|
|
@@ -116,11 +133,14 @@ function isBindingOpenComment(data) {
|
|
|
116
133
|
}
|
|
117
134
|
if (data.charCodeAt(tail) === 107 && data.charCodeAt(tail + 1) === 59)
|
|
118
135
|
return (data.charCodeAt(tail + 2) === 115 || data.charCodeAt(tail + 2) === 110) && data.charCodeAt(tail + 3) === 58 && data.length > tail + 4;
|
|
119
|
-
if (data.length === tail + 2 && data.endsWith("-1"))
|
|
120
|
-
|
|
136
|
+
if (data.length === tail + 2 && data.endsWith("-1"))
|
|
137
|
+
return true;
|
|
138
|
+
if (data.charCodeAt(tail) < 49 || data.charCodeAt(tail) > 57)
|
|
139
|
+
return false;
|
|
121
140
|
for (let index = tail + 1; index < data.length; index++) {
|
|
122
141
|
const code = data.charCodeAt(index);
|
|
123
|
-
if (code < 48 || code > 57)
|
|
142
|
+
if (code < 48 || code > 57)
|
|
143
|
+
return false;
|
|
124
144
|
}
|
|
125
145
|
return true;
|
|
126
146
|
}
|
|
@@ -23,11 +23,13 @@ __export(dom_binding_styles_exports, {
|
|
|
23
23
|
__prepareBindingSources: () => __prepareBindingSources
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(dom_binding_styles_exports);
|
|
26
|
-
var import_error_codes_client_generated = require("./error-codes.client.generated.cjs");
|
|
27
26
|
var import_style_values = require("./style-values.cjs");
|
|
28
27
|
var import_dom_bindings = require("./dom-bindings.cjs");
|
|
29
28
|
var import_owner_context = require("./signals/owner-context.cjs");
|
|
30
29
|
var import_read_protocol = require("./signals/read-protocol.cjs");
|
|
30
|
+
function __octaneNoArgError(code) {
|
|
31
|
+
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.";
|
|
32
|
+
}
|
|
31
33
|
function __prepareBindingSources(reads, subscriptions, notify, active, run) {
|
|
32
34
|
const previous = new Map(subscriptions);
|
|
33
35
|
const acquired = /* @__PURE__ */ new Map();
|
|
@@ -36,49 +38,58 @@ function __prepareBindingSources(reads, subscriptions, notify, active, run) {
|
|
|
36
38
|
let invalid = false;
|
|
37
39
|
try {
|
|
38
40
|
for (const source of reads.keys()) {
|
|
39
|
-
if (previous.has(source))
|
|
41
|
+
if (previous.has(source))
|
|
42
|
+
continue;
|
|
40
43
|
let live = true;
|
|
41
|
-
const stop = run(
|
|
42
|
-
(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
);
|
|
44
|
+
const stop = run(() => source.subscribe((0, import_read_protocol.forwardNativeTransitionConsumer)(notify, () => {
|
|
45
|
+
if (!live || retired || !active())
|
|
46
|
+
return;
|
|
47
|
+
if (!accepted)
|
|
48
|
+
invalid = true;
|
|
49
|
+
else
|
|
50
|
+
notify();
|
|
51
|
+
})));
|
|
50
52
|
acquired.set(source, () => {
|
|
51
53
|
live = false;
|
|
52
54
|
stop();
|
|
53
55
|
});
|
|
54
56
|
}
|
|
55
57
|
} catch (error) {
|
|
56
|
-
for (const stop of acquired.values())
|
|
58
|
+
for (const stop of acquired.values())
|
|
59
|
+
stop();
|
|
57
60
|
throw error;
|
|
58
61
|
}
|
|
59
62
|
return {
|
|
60
63
|
validate: () => !retired && !invalid && active() && subscriptions.size === previous.size && [...previous].every(([source, stop]) => subscriptions.get(source) === stop) && [...reads].every(([source, version]) => source.getVersion() === version),
|
|
61
64
|
commit() {
|
|
62
|
-
if (accepted || retired || !active())
|
|
65
|
+
if (accepted || retired || !active())
|
|
66
|
+
return;
|
|
63
67
|
accepted = true;
|
|
64
|
-
for (const [source, stop] of acquired)
|
|
68
|
+
for (const [source, stop] of acquired)
|
|
69
|
+
subscriptions.set(source, stop);
|
|
65
70
|
for (const [source, stop] of previous) {
|
|
66
|
-
if (reads.has(source))
|
|
71
|
+
if (reads.has(source))
|
|
72
|
+
continue;
|
|
67
73
|
subscriptions.delete(source);
|
|
68
74
|
stop();
|
|
69
75
|
}
|
|
70
76
|
},
|
|
71
77
|
discard() {
|
|
72
|
-
if (accepted || retired)
|
|
78
|
+
if (accepted || retired)
|
|
79
|
+
return;
|
|
73
80
|
retired = true;
|
|
74
|
-
for (const stop of acquired.values())
|
|
81
|
+
for (const stop of acquired.values())
|
|
82
|
+
stop();
|
|
75
83
|
}
|
|
76
84
|
};
|
|
77
85
|
}
|
|
78
86
|
function __normalizeBindingStyle(value) {
|
|
79
|
-
if (value == null || value === false || value === "")
|
|
80
|
-
|
|
81
|
-
if (typeof value
|
|
87
|
+
if (value == null || value === false || value === "")
|
|
88
|
+
return null;
|
|
89
|
+
if (typeof value === "string")
|
|
90
|
+
return value;
|
|
91
|
+
if (typeof value !== "object")
|
|
92
|
+
throw new TypeError(process.env.NODE_ENV !== "production" ? "A whole-style DOM binding requires a style object, CSS text or null." : __octaneNoArgError(311));
|
|
82
93
|
const result = /* @__PURE__ */ Object.create(null);
|
|
83
94
|
for (const name in value) {
|
|
84
95
|
const property = value[name];
|
|
@@ -111,11 +122,10 @@ function __createBindingStyles() {
|
|
|
111
122
|
};
|
|
112
123
|
previous = snapshotDOM();
|
|
113
124
|
const get = () => {
|
|
114
|
-
if (disposed)
|
|
125
|
+
if (disposed)
|
|
126
|
+
return null;
|
|
115
127
|
const reads = /* @__PURE__ */ new Map();
|
|
116
|
-
const previousObserver = (0, import_read_protocol.setNativeReadObserver)(
|
|
117
|
-
(source, version) => reads.set(source, version)
|
|
118
|
-
);
|
|
128
|
+
const previousObserver = (0, import_read_protocol.setNativeReadObserver)((source, version) => reads.set(source, version));
|
|
119
129
|
const guard = (0, import_read_protocol.beginNativeWriteGuard)();
|
|
120
130
|
let value;
|
|
121
131
|
try {
|
|
@@ -125,35 +135,39 @@ function __createBindingStyles() {
|
|
|
125
135
|
(0, import_read_protocol.setNativeReadObserver)(previousObserver);
|
|
126
136
|
}
|
|
127
137
|
for (const [source, stop] of subscriptions) {
|
|
128
|
-
if (reads.has(source))
|
|
138
|
+
if (reads.has(source))
|
|
139
|
+
continue;
|
|
129
140
|
subscriptions.delete(source);
|
|
130
141
|
stop();
|
|
131
142
|
}
|
|
132
143
|
for (const [source, version] of reads) {
|
|
133
|
-
if (disposed)
|
|
144
|
+
if (disposed)
|
|
145
|
+
break;
|
|
134
146
|
if (!subscriptions.has(source)) {
|
|
135
147
|
let active = true;
|
|
136
|
-
const stop = run(
|
|
137
|
-
(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
)
|
|
142
|
-
);
|
|
143
|
-
if (typeof stop !== "function") throw new TypeError((0, import_error_codes_client_generated.formatClientError)(312));
|
|
148
|
+
const stop = run(() => source.subscribe((0, import_read_protocol.forwardNativeTransitionConsumer)(notify, () => {
|
|
149
|
+
if (active && !disposed)
|
|
150
|
+
notify();
|
|
151
|
+
})));
|
|
152
|
+
if (typeof stop !== "function")
|
|
153
|
+
throw new TypeError(process.env.NODE_ENV !== "production" ? "A DOM style subscription must return cleanup." : __octaneNoArgError(312));
|
|
144
154
|
const disposeSource = () => {
|
|
145
155
|
active = false;
|
|
146
156
|
stop();
|
|
147
157
|
};
|
|
148
|
-
if (disposed)
|
|
149
|
-
|
|
158
|
+
if (disposed)
|
|
159
|
+
disposeSource();
|
|
160
|
+
else
|
|
161
|
+
subscriptions.set(source, disposeSource);
|
|
150
162
|
}
|
|
151
|
-
if (!disposed && source.getVersion() !== version)
|
|
163
|
+
if (!disposed && source.getVersion() !== version)
|
|
164
|
+
notify();
|
|
152
165
|
}
|
|
153
166
|
return value;
|
|
154
167
|
};
|
|
155
168
|
const writeProperty = (name, value) => {
|
|
156
|
-
if (disposed)
|
|
169
|
+
if (disposed)
|
|
170
|
+
return;
|
|
157
171
|
name = (0, import_style_values.hyphenateStyleName)(name);
|
|
158
172
|
const operation = [0, "styleProperty", name];
|
|
159
173
|
if (restoreStyles) {
|
|
@@ -169,17 +183,18 @@ function __createBindingStyles() {
|
|
|
169
183
|
(0, import_dom_bindings.__writeBinding)(node, operation, value);
|
|
170
184
|
};
|
|
171
185
|
const restore = () => {
|
|
172
|
-
if (!restorations)
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
);
|
|
186
|
+
if (!restorations)
|
|
187
|
+
return;
|
|
188
|
+
const owned = [...restorations].filter((name) => style.getPropertyValue(name) === expected.style.getPropertyValue(name) && style.getPropertyPriority(name) === expected.style.getPropertyPriority(name));
|
|
176
189
|
let failed = false;
|
|
177
190
|
let failure;
|
|
178
191
|
for (const name of owned) {
|
|
179
192
|
try {
|
|
180
193
|
const value = baseline.style.getPropertyValue(name);
|
|
181
|
-
if (value === "")
|
|
182
|
-
|
|
194
|
+
if (value === "")
|
|
195
|
+
style.removeProperty(name);
|
|
196
|
+
else
|
|
197
|
+
style.setProperty(name, value, baseline.style.getPropertyPriority(name));
|
|
183
198
|
} catch (error) {
|
|
184
199
|
if (!failed) {
|
|
185
200
|
failed = true;
|
|
@@ -187,14 +202,16 @@ function __createBindingStyles() {
|
|
|
187
202
|
}
|
|
188
203
|
}
|
|
189
204
|
}
|
|
190
|
-
if (failed)
|
|
205
|
+
if (failed)
|
|
206
|
+
throw failure;
|
|
191
207
|
};
|
|
192
208
|
return {
|
|
193
209
|
get,
|
|
194
210
|
preview(value) {
|
|
195
211
|
const reads = /* @__PURE__ */ new Map();
|
|
196
212
|
const previousObserver = (0, import_read_protocol.setNativeReadObserver)((source, version) => {
|
|
197
|
-
if (!reads.has(source))
|
|
213
|
+
if (!reads.has(source))
|
|
214
|
+
reads.set(source, version);
|
|
198
215
|
});
|
|
199
216
|
const guard = (0, import_read_protocol.beginNativeWriteGuard)();
|
|
200
217
|
let projected;
|
|
@@ -204,13 +221,7 @@ function __createBindingStyles() {
|
|
|
204
221
|
(0, import_read_protocol.endNativeWriteGuard)(guard);
|
|
205
222
|
(0, import_read_protocol.setNativeReadObserver)(previousObserver);
|
|
206
223
|
}
|
|
207
|
-
const prepared = __prepareBindingSources(
|
|
208
|
-
reads,
|
|
209
|
-
subscriptions,
|
|
210
|
-
notify,
|
|
211
|
-
() => !disposed,
|
|
212
|
-
run
|
|
213
|
-
);
|
|
224
|
+
const prepared = __prepareBindingSources(reads, subscriptions, notify, () => !disposed, run);
|
|
214
225
|
return {
|
|
215
226
|
value: projected,
|
|
216
227
|
validate: prepared.validate,
|
|
@@ -226,7 +237,8 @@ function __createBindingStyles() {
|
|
|
226
237
|
return get();
|
|
227
238
|
},
|
|
228
239
|
write(value) {
|
|
229
|
-
if (disposed)
|
|
240
|
+
if (disposed)
|
|
241
|
+
return;
|
|
230
242
|
let next = value;
|
|
231
243
|
let old = typeof previous === "string" ? snapshotDOM() : previous;
|
|
232
244
|
const writeAll = firstWrite || typeof previous === "string" || typeof value === "string";
|
|
@@ -256,7 +268,8 @@ function __createBindingStyles() {
|
|
|
256
268
|
}
|
|
257
269
|
},
|
|
258
270
|
dispose(preservePresentation) {
|
|
259
|
-
if (disposed)
|
|
271
|
+
if (disposed)
|
|
272
|
+
return;
|
|
260
273
|
disposed = true;
|
|
261
274
|
raw = previous = null;
|
|
262
275
|
let failed = false;
|
|
@@ -277,7 +290,8 @@ function __createBindingStyles() {
|
|
|
277
290
|
subscriptions.clear();
|
|
278
291
|
restorations?.clear();
|
|
279
292
|
probe = baseline = expected = void 0;
|
|
280
|
-
if (failed)
|
|
293
|
+
if (failed)
|
|
294
|
+
throw failure;
|
|
281
295
|
}
|
|
282
296
|
};
|
|
283
297
|
}
|