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.
Files changed (48) hide show
  1. package/dist/cjs/dom-binding-handoff.cjs +27 -13
  2. package/dist/cjs/dom-binding-protocol.cjs +42 -22
  3. package/dist/cjs/dom-binding-styles.cjs +70 -56
  4. package/dist/cjs/dom-bindings.cjs +311 -222
  5. package/dist/cjs/hydration/event-capture.cjs +81 -45
  6. package/dist/cjs/independent-hydration-protocol.cjs +19 -10
  7. package/dist/cjs/signals/control-binding.cjs +122 -96
  8. package/dist/cjs/signals/derived-facade.cjs +9 -11
  9. package/dist/cjs/signals/document-owner.cjs +13 -9
  10. package/dist/cjs/signals/facade.cjs +92 -82
  11. package/dist/cjs/signals/graph.cjs +139 -79
  12. package/dist/cjs/signals/native-read-client.cjs +78 -38
  13. package/dist/cjs/signals/owner-context.cjs +20 -10
  14. package/dist/cjs/signals/query-attempt-observer.cjs +9 -10
  15. package/dist/cjs/signals/query-facade.cjs +8 -16
  16. package/dist/cjs/signals/scalar-computations.cjs +6 -3
  17. package/dist/cjs/signals/transition-action.cjs +188 -117
  18. package/dist/cjs/signals/transition-candidate.cjs +29 -17
  19. package/dist/cjs/version.cjs +1 -1
  20. package/dist/dom-binding-classes.js +47 -24
  21. package/dist/dom-binding-handoff.js +27 -13
  22. package/dist/dom-binding-program.js +363 -380
  23. package/dist/dom-binding-projections.js +61 -43
  24. package/dist/dom-binding-protocol.js +43 -29
  25. package/dist/dom-binding-signals.js +39 -38
  26. package/dist/dom-binding-styles.js +71 -63
  27. package/dist/dom-bindings.js +312 -226
  28. package/dist/hydration/document-lifecycle.js +14 -7
  29. package/dist/hydration/event-capture.js +85 -68
  30. package/dist/hydration/independent-island.js +156 -151
  31. package/dist/hydration/stream-delivery.js +83 -65
  32. package/dist/hydration/stream-result-receiver.js +60 -42
  33. package/dist/hydration/streamed-signals.js +52 -55
  34. package/dist/independent-hydration-protocol.js +19 -10
  35. package/dist/signals/control-binding.js +127 -120
  36. package/dist/signals/derived-facade.js +9 -11
  37. package/dist/signals/document-owner.js +13 -9
  38. package/dist/signals/facade.js +95 -103
  39. package/dist/signals/graph.js +144 -117
  40. package/dist/signals/native-read-client.js +79 -42
  41. package/dist/signals/owner-context.js +20 -10
  42. package/dist/signals/query-attempt-observer.js +9 -10
  43. package/dist/signals/query-facade.js +9 -19
  44. package/dist/signals/scalar-computations.js +7 -12
  45. package/dist/signals/transition-action.js +190 -133
  46. package/dist/signals/transition-candidate.js +30 -20
  47. package/dist/version.js +1 -1
  48. package/package.json +1 -1
@@ -31,7 +31,6 @@ __export(dom_bindings_exports, {
31
31
  unbound: () => unbound
32
32
  });
33
33
  module.exports = __toCommonJS(dom_bindings_exports);
34
- var import_error_codes_client_generated = require("./error-codes.client.generated.cjs");
35
34
  var import_class_names = require("./class-names.cjs");
36
35
  var import_dom_binding_claims = require("./dom-binding-claims.cjs");
37
36
  var import_sanitize_url = require("./sanitize-url.cjs");
@@ -40,14 +39,17 @@ var import_native_read_seeds = require("./signals/native-read-seeds.cjs");
40
39
  var import_control_handoff = require("./signals/control-handoff.cjs");
41
40
  var import_owner_context = require("./signals/owner-context.cjs");
42
41
  var import_read_protocol = require("./signals/read-protocol.cjs");
42
+ function __octaneNoArgError(code) {
43
+ 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.";
44
+ }
43
45
  function unbound(value) {
44
46
  return value;
45
47
  }
46
48
  function adoptBindings(_root, _view, _source, _options) {
47
- throw new Error((0, import_error_codes_client_generated.formatClientError)(313));
49
+ throw new Error(process.env.NODE_ENV !== "production" ? "adoptBindings() requires an Octane-compiled .tsrx or .tsx call and a supported static view." : __octaneNoArgError(313));
48
50
  }
49
51
  function mountBindings(_target, _view, _source, _options) {
50
- throw new Error((0, import_error_codes_client_generated.formatClientError)(314));
52
+ throw new Error(process.env.NODE_ENV !== "production" ? "mountBindings() requires an Octane-compiled .tsrx or .tsx call." : __octaneNoArgError(314));
51
53
  }
52
54
  function __mountBindings(target, descriptor, source, options) {
53
55
  return descriptor.mount(target, descriptor, source, options);
@@ -58,49 +60,63 @@ function channel(binding) {
58
60
  return binding[1] === "styleProperty" ? `style:${binding[2]}` : binding[1] === "classToken" ? `class:${binding[2]}` : binding[1] === "classGroup" ? `classGroup:${binding[2]}:${binding[3]}` : binding[2];
59
61
  }
60
62
  function conflicts(channels, binding, name) {
61
- if (channels.has(name)) return true;
62
- if (binding[1] === "styleProperty" && channels.has("style")) return true;
63
+ if (channels.has(name))
64
+ return true;
65
+ if (binding[1] === "styleProperty" && channels.has("style"))
66
+ return true;
63
67
  if (name === "style") {
64
- for (const claimed of channels) if (claimed.startsWith("style:")) return true;
68
+ for (const claimed of channels)
69
+ if (claimed.startsWith("style:"))
70
+ return true;
65
71
  }
66
72
  if (binding[1] === "classToken") {
67
- if (channels.has("class")) return true;
68
- for (const claimed of channels) if (claimed.startsWith("classGroup:")) return true;
73
+ if (channels.has("class"))
74
+ return true;
75
+ for (const claimed of channels)
76
+ if (claimed.startsWith("classGroup:"))
77
+ return true;
69
78
  }
70
79
  if (binding[1] === "classGroup") {
71
- if (channels.has("class")) return true;
72
- for (const claimed of channels) if (claimed.startsWith("class:")) return true;
80
+ if (channels.has("class"))
81
+ return true;
82
+ for (const claimed of channels)
83
+ if (claimed.startsWith("class:"))
84
+ return true;
73
85
  }
74
86
  if (name === "class") {
75
87
  for (const claimed of channels)
76
- if (claimed.startsWith("class:") || claimed.startsWith("classGroup:")) return true;
88
+ if (claimed.startsWith("class:") || claimed.startsWith("classGroup:"))
89
+ return true;
77
90
  }
78
91
  return false;
79
92
  }
80
93
  function __claimBinding(node, binding) {
81
94
  if (binding[1] === "classToken" && !/^\S+$/.test(binding[2]))
82
- throw new TypeError((0, import_error_codes_client_generated.formatClientError)(315));
95
+ throw new TypeError(process.env.NODE_ENV !== "production" ? "A DOM class token binding requires one nonempty class token." : __octaneNoArgError(315));
83
96
  const name = channel(binding);
84
97
  let channels = claims.get(node);
85
98
  if (channels !== void 0 && conflicts(channels, binding, name))
86
- throw new Error((0, import_error_codes_client_generated.formatClientError)(316));
87
- if (channels === void 0) claims.set(node, channels = /* @__PURE__ */ new Set());
99
+ throw new Error(process.env.NODE_ENV !== "production" ? "This DOM property already has a binding. Dispose it before rebinding." : __octaneNoArgError(316));
100
+ if (channels === void 0)
101
+ claims.set(node, channels = /* @__PURE__ */ new Set());
88
102
  channels.add(name);
89
103
  return name;
90
104
  }
91
105
  function __releaseBinding(node, name) {
92
106
  const channels = claims.get(node);
93
107
  channels.delete(name);
94
- if (channels.size === 0) claims.delete(node);
108
+ if (channels.size === 0)
109
+ claims.delete(node);
95
110
  const published = import_dom_binding_claims.domBindingClaims.get(node);
96
111
  if (published) {
97
112
  published.delete(name);
98
- if (published.size === 0) import_dom_binding_claims.domBindingClaims.delete(node);
113
+ if (published.size === 0)
114
+ import_dom_binding_claims.domBindingClaims.delete(node);
99
115
  }
100
116
  }
101
117
  function assertBindingRoot(root, descriptor) {
102
118
  if (root?.nodeType !== 1 || root.getAttribute("data-octane-bindings") !== descriptor.id || descriptor.nodes.length === 0) {
103
- throw new Error((0, import_error_codes_client_generated.formatClientError)(317));
119
+ throw new Error(process.env.NODE_ENV !== "production" ? "DOM bindings require the matching compiler-stamped root." : __octaneNoArgError(317));
104
120
  }
105
121
  return root;
106
122
  }
@@ -112,14 +128,14 @@ function resolveFixedNodes(root, descriptor) {
112
128
  const [parent, tag, namespace, children, , text] = descriptor.nodes[i];
113
129
  const node = i === 0 ? parent === -1 ? root : void 0 : parent >= 0 && parent < i && descriptor.nodes[parent][3] !== null ? nodes[parent]?.children[childIndices[parent]++] : void 0;
114
130
  if (node === void 0 || descriptor.nodes[i][4] === true || node.localName !== tag || node.namespaceURI !== namespaces[namespace] || (text ? node.childNodes.length > 1 || node.firstChild !== null && node.firstChild.nodeType !== 3 : children !== null && (node.childNodes.length !== children || node.children.length !== children))) {
115
- throw new Error((0, import_error_codes_client_generated.formatClientError)(318));
131
+ throw new Error(process.env.NODE_ENV !== "production" ? "DOM bindings cannot adopt a mismatched static element topology." : __octaneNoArgError(318));
116
132
  }
117
133
  nodes.push(node);
118
134
  childIndices.push(0);
119
135
  }
120
136
  for (let i = 0; i < nodes.length; i++) {
121
137
  if (childIndices[i] !== (descriptor.nodes[i][3] ?? 0)) {
122
- throw new Error((0, import_error_codes_client_generated.formatClientError)(319));
138
+ throw new Error(process.env.NODE_ENV !== "production" ? "DOM bindings cannot adopt an incomplete static element topology." : __octaneNoArgError(319));
123
139
  }
124
140
  }
125
141
  return nodes;
@@ -135,10 +151,11 @@ function resolveAddressedNodes(root, descriptor) {
135
151
  if (marker?.startsWith(prefix)) {
136
152
  const index = Number(marker.slice(prefix.length));
137
153
  if (!Number.isSafeInteger(index) || index < 0 || index >= descriptor.nodes.length || marker !== `${prefix}${index}` || nodes[index] !== void 0) {
138
- throw new Error((0, import_error_codes_client_generated.formatClientError)(320));
154
+ throw new Error(process.env.NODE_ENV !== "production" ? "DOM bindings require unique compiler-issued target addresses." : __octaneNoArgError(320));
139
155
  }
140
156
  nodes[index] = current;
141
- if (descriptor.nodes[index][3] === null) descend = false;
157
+ if (descriptor.nodes[index][3] === null)
158
+ descend = false;
142
159
  }
143
160
  }
144
161
  if (descend && current.firstElementChild !== null) {
@@ -147,7 +164,8 @@ function resolveAddressedNodes(root, descriptor) {
147
164
  }
148
165
  while (current !== root && current.nextElementSibling === null)
149
166
  current = current.parentElement;
150
- if (current === root) break;
167
+ if (current === root)
168
+ break;
151
169
  current = current.nextElementSibling;
152
170
  }
153
171
  const childCounts = new Array(descriptor.nodes.length).fill(0);
@@ -155,13 +173,14 @@ function resolveAddressedNodes(root, descriptor) {
155
173
  const [parent, tag, namespace, children, openChildren, text] = descriptor.nodes[i];
156
174
  const node = nodes[i];
157
175
  if (node === void 0 || node.localName !== tag || node.namespaceURI !== namespaces[namespace] || (i === 0 ? parent !== -1 || node !== root : parent < 0 || parent >= i || descriptor.nodes[parent][3] === null || node.parentElement !== nodes[parent] || descriptor.nodes[parent][4] !== true && nodes[parent].children[childCounts[parent]] !== node) || openChildren && children === null || (text ? node.childNodes.length > 1 || node.firstChild !== null && node.firstChild.nodeType !== 3 : children !== null && !openChildren && (node.childNodes.length !== children || node.children.length !== children))) {
158
- throw new Error((0, import_error_codes_client_generated.formatClientError)(321));
176
+ throw new Error(process.env.NODE_ENV !== "production" ? "DOM bindings cannot adopt a mismatched addressed element topology." : __octaneNoArgError(321));
159
177
  }
160
- if (parent !== -1) childCounts[parent]++;
178
+ if (parent !== -1)
179
+ childCounts[parent]++;
161
180
  }
162
181
  for (let i = 0; i < descriptor.nodes.length; i++) {
163
182
  if (childCounts[i] !== (descriptor.nodes[i][3] ?? 0)) {
164
- throw new Error((0, import_error_codes_client_generated.formatClientError)(322));
183
+ throw new Error(process.env.NODE_ENV !== "production" ? "DOM bindings cannot adopt an incomplete addressed element topology." : __octaneNoArgError(322));
165
184
  }
166
185
  }
167
186
  return nodes;
@@ -174,9 +193,10 @@ function normalizeFixedScalar(binding, value) {
174
193
  const type = typeof value;
175
194
  switch (binding[1]) {
176
195
  case "text":
177
- if (value == null || value === false) return "";
196
+ if (value == null || value === false)
197
+ return "";
178
198
  if (type !== "string" && type !== "number" && type !== "bigint" && type !== "boolean")
179
- throw new TypeError((0, import_error_codes_client_generated.formatClientError)(323));
199
+ throw new TypeError(process.env.NODE_ENV !== "production" ? "DOM binding text must be a synchronous scalar." : __octaneNoArgError(323));
180
200
  return String(value);
181
201
  case "class":
182
202
  return value == null || value === false ? null : (0, import_class_names.normalizeClass)(value);
@@ -190,10 +210,13 @@ function writeFixedScalar(node, binding, value) {
190
210
  const name = binding[2];
191
211
  if (binding[1] === "text") {
192
212
  const text = node.firstChild;
193
- if (text === null) node.appendChild(node.ownerDocument.createTextNode(value));
194
- else if (text.nodeValue !== value) text.nodeValue = value;
213
+ if (text === null)
214
+ node.appendChild(node.ownerDocument.createTextNode(value));
215
+ else if (text.nodeValue !== value)
216
+ text.nodeValue = value;
195
217
  } else if (value === null) {
196
- if (node.hasAttribute(name)) node.removeAttribute(name);
218
+ if (node.hasAttribute(name))
219
+ node.removeAttribute(name);
197
220
  } else if (node.getAttribute(name) !== value) {
198
221
  node.setAttribute(name, value);
199
222
  }
@@ -206,15 +229,18 @@ function normalize(binding, value) {
206
229
  case "classGroup":
207
230
  return value == null || value === false ? "" : (0, import_class_names.normalizeClass)(value);
208
231
  case "styleAttribute":
209
- if (value == null || value === false || value === "") return null;
210
- if (type !== "string") throw new TypeError((0, import_error_codes_client_generated.formatClientError)(324));
232
+ if (value == null || value === false || value === "")
233
+ return null;
234
+ if (type !== "string")
235
+ throw new TypeError(process.env.NODE_ENV !== "production" ? "A whole-style DOM binding requires serialized CSS text or null." : __octaneNoArgError(324));
211
236
  return value;
212
237
  case "classToken":
213
238
  return value ? "" : null;
214
239
  case "url":
215
240
  return value == null || type === "boolean" || type === "function" || type === "symbol" ? null : (0, import_sanitize_url.sanitizeURL)(String(value));
216
241
  case "styleProperty": {
217
- if (value == null || type === "boolean") return null;
242
+ if (value == null || type === "boolean")
243
+ return null;
218
244
  return type === "number" && value !== 0 && !binding[3] ? value + "px" : type === "string" ? value.trim() : "" + value;
219
245
  }
220
246
  default:
@@ -226,14 +252,18 @@ function write(node, binding, value) {
226
252
  if (binding[1] === "classToken") {
227
253
  node.classList.toggle(name, value !== null);
228
254
  } else if (binding[1] === "url") {
229
- if (value === "" && !(name === "href" && node.localName === "a")) value = null;
255
+ if (value === "" && !(name === "href" && node.localName === "a"))
256
+ value = null;
230
257
  if (name === "xlink:href") {
231
- if (value === null) node.removeAttributeNS("http://www.w3.org/1999/xlink", "href");
258
+ if (value === null)
259
+ node.removeAttributeNS("http://www.w3.org/1999/xlink", "href");
232
260
  else if (node.getAttributeNS("http://www.w3.org/1999/xlink", "href") !== value)
233
261
  node.setAttributeNS("http://www.w3.org/1999/xlink", name, value);
234
262
  } else if (value === null) {
235
- if (node.hasAttribute(name)) node.removeAttribute(name);
236
- } else if (node.getAttribute(name) !== value) node.setAttribute(name, value);
263
+ if (node.hasAttribute(name))
264
+ node.removeAttribute(name);
265
+ } else if (node.getAttribute(name) !== value)
266
+ node.setAttribute(name, value);
237
267
  } else if (binding[1] === "styleProperty") {
238
268
  const style = node.style;
239
269
  if (value === null) {
@@ -246,7 +276,8 @@ function write(node, binding, value) {
246
276
  if (style.getPropertyValue(name) !== text || style.getPropertyPriority(name) !== priority)
247
277
  style.setProperty(name, text, priority);
248
278
  }
249
- } else writeFixedScalar(node, binding, value);
279
+ } else
280
+ writeFixedScalar(node, binding, value);
250
281
  }
251
282
  function __createBindingStyleRestoration(node, binding) {
252
283
  if (binding[1] === "styleAttribute") {
@@ -255,13 +286,16 @@ function __createBindingStyleRestoration(node, binding) {
255
286
  let disposed2 = false;
256
287
  return {
257
288
  write(value) {
258
- if (disposed2) return;
259
- if (baseline2 === void 0) baseline2 = node.getAttribute("style");
289
+ if (disposed2)
290
+ return;
291
+ if (baseline2 === void 0)
292
+ baseline2 = node.getAttribute("style");
260
293
  expected2 = value;
261
294
  write(node, binding, value);
262
295
  },
263
296
  dispose(preservePresentation) {
264
- if (disposed2) return;
297
+ if (disposed2)
298
+ return;
265
299
  disposed2 = true;
266
300
  if (!preservePresentation && baseline2 !== void 0 && node.getAttribute("style") === expected2)
267
301
  write(node, binding, baseline2);
@@ -276,7 +310,8 @@ function __createBindingStyleRestoration(node, binding) {
276
310
  let disposed = false;
277
311
  return {
278
312
  write(value) {
279
- if (disposed) return;
313
+ if (disposed)
314
+ return;
280
315
  baseline ??= [style.getPropertyValue(name), style.getPropertyPriority(name)];
281
316
  probe ??= node.ownerDocument.createElement("i");
282
317
  probe.style.cssText = "";
@@ -286,19 +321,23 @@ function __createBindingStyleRestoration(node, binding) {
286
321
  write(node, binding, value);
287
322
  },
288
323
  dispose(preservePresentation) {
289
- if (disposed) return;
324
+ if (disposed)
325
+ return;
290
326
  disposed = true;
291
327
  if (!preservePresentation && baseline && expected && style.getPropertyValue(name) === expected[0] && style.getPropertyPriority(name) === expected[1]) {
292
- if (baseline[0] === "") style.removeProperty(name);
293
- else style.setProperty(name, baseline[0], baseline[1]);
328
+ if (baseline[0] === "")
329
+ style.removeProperty(name);
330
+ else
331
+ style.setProperty(name, baseline[0], baseline[1]);
294
332
  }
295
333
  }
296
334
  };
297
335
  }
298
336
  function __adoptBindings(root, descriptor, source, options) {
299
- if ("root" in descriptor) return descriptor.adopt(root, descriptor, source, options);
337
+ if ("root" in descriptor)
338
+ return descriptor.adopt(root, descriptor, source, options);
300
339
  if (!source || typeof source.getSnapshot !== "function" || typeof source.subscribe !== "function")
301
- throw new TypeError((0, import_error_codes_client_generated.formatClientError)(325));
340
+ throw new TypeError(process.env.NODE_ENV !== "production" ? "DOM bindings require synchronous getSnapshot() and subscribe() methods." : __octaneNoArgError(325));
302
341
  const nodes = descriptor.addressed ? resolveAddressedNodes(assertBindingRoot(root, descriptor), descriptor) : resolveFixedNodes(root, descriptor);
303
342
  const bindings = descriptor.bindings;
304
343
  const owned = [];
@@ -394,18 +433,22 @@ function __adoptBindings(root, descriptor, source, options) {
394
433
  try {
395
434
  stop?.();
396
435
  } catch (error) {
397
- if (!failed) throw error;
436
+ if (!failed)
437
+ throw error;
398
438
  }
399
- if (failed) throw failure;
439
+ if (failed)
440
+ throw failure;
400
441
  };
401
442
  const prepareProjection = projections ? (index, next, indices) => {
402
443
  const projection = projections.get(index);
403
- if (!projection) return;
444
+ if (!projection)
445
+ return;
404
446
  if (index === projection.group[0][0]) {
405
447
  const values = projection.get();
406
448
  for (const [fieldIndex] of projection.group) {
407
449
  next[fieldIndex] = values[fieldIndex];
408
- if (indices && !indices.includes(fieldIndex)) indices.push(fieldIndex);
450
+ if (indices && !indices.includes(fieldIndex))
451
+ indices.push(fieldIndex);
409
452
  }
410
453
  }
411
454
  return projection.group;
@@ -417,21 +460,27 @@ function __adoptBindings(root, descriptor, source, options) {
417
460
  preparedControls.get(i).commit();
418
461
  continue;
419
462
  }
420
- if (next[i] === previous[i]) continue;
463
+ if (next[i] === previous[i])
464
+ continue;
421
465
  const binding = bindings[i];
422
- if (binding[1] === "classToken") previous[i] = next[i];
466
+ if (binding[1] === "classToken")
467
+ previous[i] = next[i];
423
468
  if (binding[1] === "styleObject") {
424
469
  const projection = projections?.get(i);
425
- if (projection) projection.writeStyle(i, next[i]);
426
- else signalConnections.get(i).write(next[i]);
427
- } else if (binding[1] === "classGroup") preparedGroups.get(i).commit();
470
+ if (projection)
471
+ projection.writeStyle(i, next[i]);
472
+ else
473
+ signalConnections.get(i).write(next[i]);
474
+ } else if (binding[1] === "classGroup")
475
+ preparedGroups.get(i).commit();
428
476
  else if ((binding[1] === "styleProperty" || binding[1] === "styleAttribute") && options?.restoreStyles) {
429
477
  styles ??= /* @__PURE__ */ new Map();
430
478
  let style = styles.get(i);
431
479
  if (!style)
432
480
  styles.set(i, style = __createBindingStyleRestoration(nodes[binding[0]], binding));
433
481
  style.write(next[i]);
434
- } else write(nodes[binding[0]], binding, next[i]);
482
+ } else
483
+ write(nodes[binding[0]], binding, next[i]);
435
484
  if (!disposed) {
436
485
  previous[i] = next[i];
437
486
  if (binding[1] === "attr" || binding[1] === "boolean" || binding[1] === "aria" || binding[1] === "class" || binding[1] === "styleProperty" || binding[1] === "text") {
@@ -443,17 +492,20 @@ function __adoptBindings(root, descriptor, source, options) {
443
492
  published2 = value === "" ? null : value + (style.getPropertyPriority(binding[2]) ? " !important" : "");
444
493
  }
445
494
  let claims2 = import_dom_binding_claims.domBindingClaims.get(node);
446
- if (claims2 === void 0) import_dom_binding_claims.domBindingClaims.set(node, claims2 = /* @__PURE__ */ new Map());
495
+ if (claims2 === void 0)
496
+ import_dom_binding_claims.domBindingClaims.set(node, claims2 = /* @__PURE__ */ new Map());
447
497
  claims2.set(name, published2);
448
498
  }
449
499
  }
450
500
  }
451
501
  };
452
502
  const drain = (preview = false) => {
453
- if (disposed) return;
454
- if (busy) return preview ? { validate: () => false, commit() {
455
- }, discard() {
456
- } } : void 0;
503
+ if (disposed)
504
+ return;
505
+ if (busy)
506
+ return preview ? { validate: () => false, commit() {
507
+ }, discard() {
508
+ } } : void 0;
457
509
  const version = revision;
458
510
  const previousDirty = dirty;
459
511
  const previousUpdates = preview && signalUpdates ? [...signalUpdates] : void 0;
@@ -464,16 +516,22 @@ function __adoptBindings(root, descriptor, source, options) {
464
516
  let accepted = false;
465
517
  let retired = false;
466
518
  const discard = preview ? () => {
467
- if (accepted || retired) return;
519
+ if (accepted || retired)
520
+ return;
468
521
  retired = true;
469
- for (const receipt of receipts) receipt.discard();
470
- for (const control of controlReceipts) control.discard();
522
+ for (const receipt of receipts)
523
+ receipt.discard();
524
+ for (const control of controlReceipts)
525
+ control.discard();
471
526
  for (const [index, connection] of preparedSignals ?? [])
472
- if (connection !== signalConnections?.get(index)) connection.dispose(true);
527
+ if (connection !== signalConnections?.get(index))
528
+ connection.dispose(true);
473
529
  for (const [index, connection] of preparedProjections ?? [])
474
- if (connection !== projections?.get(index)) connection.dispose(true);
530
+ if (connection !== projections?.get(index))
531
+ connection.dispose(true);
475
532
  } : void 0;
476
- if (preview) dirty = true;
533
+ if (preview)
534
+ dirty = true;
477
535
  busy = true;
478
536
  try {
479
537
  while ((dirty || signalUpdates?.size) && !disposed) {
@@ -484,87 +542,89 @@ function __adoptBindings(root, descriptor, source, options) {
484
542
  dirty = false;
485
543
  signalUpdates?.clear();
486
544
  const snapshot = source.getSnapshot();
487
- if (dirty || disposed) continue;
545
+ if (dirty || disposed)
546
+ continue;
488
547
  if (snapshot !== null && (typeof snapshot === "object" || typeof snapshot === "function") && typeof snapshot.then === "function" && !dirty && !disposed)
489
- throw new TypeError((0, import_error_codes_client_generated.formatClientError)(326));
490
- if (dirty || disposed) continue;
548
+ throw new TypeError(process.env.NODE_ENV !== "production" ? "DOM bindings require a synchronous snapshot, not a thenable." : __octaneNoArgError(326));
549
+ if (dirty || disposed)
550
+ continue;
491
551
  const values = descriptor.project(snapshot);
492
- if (dirty || disposed) continue;
552
+ if (dirty || disposed)
553
+ continue;
493
554
  if (!Array.isArray(values) || values.length !== bindings.length)
494
- throw new TypeError((0, import_error_codes_client_generated.formatClientError)(327));
555
+ throw new TypeError(process.env.NODE_ENV !== "production" ? "A DOM binding projection must return its synchronous scalar values." : __octaneNoArgError(327));
495
556
  let resolved = values;
496
557
  if (projectionFactory && descriptor.projectionGroups) {
497
558
  for (const group of descriptor.projectionGroups) {
498
- if (disposed || dirty) break;
559
+ if (disposed || dirty)
560
+ break;
499
561
  const first = group[0][0];
500
562
  let connection = preparedProjections.get(first);
501
563
  if (!connection) {
502
- connection = projectionFactory.connect(
503
- group,
504
- bindings,
505
- nodes,
506
- (0, import_read_protocol.forwardNativeTransitionConsumer)(refresh, () => {
507
- if (!disposed) {
508
- revision++;
509
- signalUpdates.add(first);
510
- drain();
511
- }
512
- }),
513
- options?.restoreStyles
514
- );
515
- for (const [index] of group) preparedProjections.set(index, connection);
564
+ connection = projectionFactory.connect(group, bindings, nodes, (0, import_read_protocol.forwardNativeTransitionConsumer)(refresh, () => {
565
+ if (!disposed) {
566
+ revision++;
567
+ signalUpdates.add(first);
568
+ drain();
569
+ }
570
+ }), options?.restoreStyles);
571
+ for (const [index] of group)
572
+ preparedProjections.set(index, connection);
516
573
  }
517
574
  const receipt = preview ? connection.preview(values[first]) : void 0;
518
- if (receipt) receipts.push(receipt);
575
+ if (receipt)
576
+ receipts.push(receipt);
519
577
  const projected = receipt ? receipt.value : connection.read(values[first]);
520
- if (resolved === values) resolved = [...values];
521
- for (const [index] of group) resolved[index] = projected[index];
578
+ if (resolved === values)
579
+ resolved = [...values];
580
+ for (const [index] of group)
581
+ resolved[index] = projected[index];
522
582
  }
523
583
  }
524
584
  if (styleFactory && descriptor.styleIndices) {
525
585
  for (const index of descriptor.styleIndices) {
526
- if (disposed || dirty) break;
586
+ if (disposed || dirty)
587
+ break;
527
588
  let connection = preparedSignals.get(index);
528
589
  if (!connection) {
529
- connection = styleFactory.connect(
530
- nodes[bindings[index][0]],
531
- (0, import_read_protocol.forwardNativeTransitionConsumer)(refresh, () => {
532
- if (!disposed) {
533
- revision++;
534
- signalUpdates.add(index);
535
- drain();
536
- }
537
- }),
538
- options?.restoreStyles
539
- );
590
+ connection = styleFactory.connect(nodes[bindings[index][0]], (0, import_read_protocol.forwardNativeTransitionConsumer)(refresh, () => {
591
+ if (!disposed) {
592
+ revision++;
593
+ signalUpdates.add(index);
594
+ drain();
595
+ }
596
+ }), options?.restoreStyles);
540
597
  preparedSignals.set(index, connection);
541
598
  }
542
- if (resolved === values) resolved = [...values];
599
+ if (resolved === values)
600
+ resolved = [...values];
543
601
  const receipt = preview ? connection.preview(values[index]) : void 0;
544
- if (receipt) receipts.push(receipt);
602
+ if (receipt)
603
+ receipts.push(receipt);
545
604
  resolved[index] = receipt ? receipt.value : connection.read(values[index]);
546
605
  }
547
606
  }
548
607
  if (signalFactory && descriptor.signalIndices) {
549
608
  for (const index of descriptor.signalIndices) {
550
- if (disposed || dirty) break;
609
+ if (disposed || dirty)
610
+ break;
551
611
  let connection = preparedSignals.get(index);
552
612
  if (!connection && signalFactory.isSignal(values[index])) {
553
- connection = signalFactory.connect(
554
- (0, import_read_protocol.forwardNativeTransitionConsumer)(refresh, () => {
555
- if (!disposed) {
556
- revision++;
557
- signalUpdates.add(index);
558
- drain();
559
- }
560
- })
561
- );
613
+ connection = signalFactory.connect((0, import_read_protocol.forwardNativeTransitionConsumer)(refresh, () => {
614
+ if (!disposed) {
615
+ revision++;
616
+ signalUpdates.add(index);
617
+ drain();
618
+ }
619
+ }));
562
620
  preparedSignals.set(index, connection);
563
621
  }
564
622
  if (connection) {
565
- if (resolved === values) resolved = [...values];
623
+ if (resolved === values)
624
+ resolved = [...values];
566
625
  const receipt = preview ? connection.preview(values[index]) : void 0;
567
- if (receipt) receipts.push(receipt);
626
+ if (receipt)
627
+ receipts.push(receipt);
568
628
  resolved[index] = receipt ? receipt.value : connection.read(values[index]);
569
629
  }
570
630
  }
@@ -584,36 +644,43 @@ function __adoptBindings(root, descriptor, source, options) {
584
644
  signalUpdates.clear();
585
645
  next = [];
586
646
  for (const index of indices) {
587
- if (prepareProjection?.(index, next, indices)) continue;
647
+ if (prepareProjection?.(index, next, indices))
648
+ continue;
588
649
  const control = controls?.get(index);
589
- if (control) preparedControls.set(index, control.prepareCurrent());
590
- else next[index] = normalize(bindings[index], signalConnections.get(index).get());
650
+ if (control)
651
+ preparedControls.set(index, control.prepareCurrent());
652
+ else
653
+ next[index] = normalize(bindings[index], signalConnections.get(index).get());
591
654
  }
592
655
  }
593
656
  while (!preview && signalUpdates?.size && !dirty && !disposed) {
594
657
  const pending = [...signalUpdates];
595
658
  signalUpdates.clear();
596
659
  for (const index of pending) {
597
- if (prepareProjection?.(index, next, indices)) continue;
660
+ if (prepareProjection?.(index, next, indices))
661
+ continue;
598
662
  const control = controls?.get(index);
599
- if (control) preparedControls.set(index, control.prepareCurrent());
600
- else next[index] = normalize(bindings[index], signalConnections.get(index).get());
601
- if (indices && !indices.includes(index)) indices.push(index);
663
+ if (control)
664
+ preparedControls.set(index, control.prepareCurrent());
665
+ else
666
+ next[index] = normalize(bindings[index], signalConnections.get(index).get());
667
+ if (indices && !indices.includes(index))
668
+ indices.push(index);
602
669
  }
603
670
  }
604
- const preparedGroups = groups && new Map(
605
- [...groups].filter(([index]) => !indices || indices.includes(index)).map(([index, group]) => [
606
- index,
607
- group.prepare(next[index] ?? "")
608
- ])
609
- );
671
+ const preparedGroups = groups && new Map([...groups].filter(([index]) => !indices || indices.includes(index)).map(([index, group]) => [
672
+ index,
673
+ group.prepare(next[index] ?? "")
674
+ ]));
610
675
  if (preparedControls && !preview) {
611
676
  while (!dirty && !disposed) {
612
677
  for (const control of preparedControls.values()) {
613
678
  control.publish();
614
- if (dirty || disposed) break;
679
+ if (dirty || disposed)
680
+ break;
615
681
  }
616
- if (!signalUpdates?.size || dirty || disposed) break;
682
+ if (!signalUpdates?.size || dirty || disposed)
683
+ break;
617
684
  const pending = [...signalUpdates];
618
685
  signalUpdates.clear();
619
686
  for (const index of pending) {
@@ -622,22 +689,21 @@ function __adoptBindings(root, descriptor, source, options) {
622
689
  for (const [fieldIndex] of projection) {
623
690
  const group = groups?.get(fieldIndex);
624
691
  if (group)
625
- preparedGroups.set(
626
- fieldIndex,
627
- group.prepare(next[fieldIndex] ?? "")
628
- );
692
+ preparedGroups.set(fieldIndex, group.prepare(next[fieldIndex] ?? ""));
629
693
  }
630
694
  continue;
631
695
  }
632
696
  const control = controls?.get(index);
633
- if (control) preparedControls.set(index, control.prepareCurrent());
697
+ if (control)
698
+ preparedControls.set(index, control.prepareCurrent());
634
699
  else {
635
700
  next[index] = normalize(bindings[index], signalConnections.get(index).get());
636
701
  const group = groups?.get(index);
637
702
  if (group)
638
703
  preparedGroups.set(index, group.prepare(next[index] ?? ""));
639
704
  }
640
- if (indices && !indices.includes(index)) indices.push(index);
705
+ if (indices && !indices.includes(index))
706
+ indices.push(index);
641
707
  }
642
708
  }
643
709
  }
@@ -646,7 +712,8 @@ function __adoptBindings(root, descriptor, source, options) {
646
712
  validate: () => !retired && !disposed && revision === version && receipts.every((receipt) => receipt.validate()) && controlReceipts.every((control) => control.validate()),
647
713
  discard,
648
714
  commit() {
649
- if (disposed || retired || accepted) return;
715
+ if (disposed || retired || accepted)
716
+ return;
650
717
  accepted = true;
651
718
  busy = true;
652
719
  try {
@@ -654,8 +721,10 @@ function __adoptBindings(root, descriptor, source, options) {
654
721
  signalConnections.set(index, connection);
655
722
  for (const [index, connection] of preparedProjections ?? [])
656
723
  projections.set(index, connection);
657
- for (const receipt of receipts) receipt.commit();
658
- for (const control of preparedControls?.values() ?? []) control.publish();
724
+ for (const receipt of receipts)
725
+ receipt.commit();
726
+ for (const control of preparedControls?.values() ?? [])
727
+ control.publish();
659
728
  writePrepared(next, indices, preparedControls, preparedGroups);
660
729
  } finally {
661
730
  busy = false;
@@ -663,7 +732,8 @@ function __adoptBindings(root, descriptor, source, options) {
663
732
  }
664
733
  }
665
734
  };
666
- if (dirty || disposed) continue;
735
+ if (dirty || disposed)
736
+ continue;
667
737
  writePrepared(next, indices, preparedControls, preparedGroups);
668
738
  }
669
739
  } catch (error) {
@@ -679,14 +749,17 @@ function __adoptBindings(root, descriptor, source, options) {
679
749
  } finally {
680
750
  if (preview) {
681
751
  dirty ||= previousDirty;
682
- for (const index of previousUpdates ?? []) signalUpdates.add(index);
752
+ for (const index of previousUpdates ?? [])
753
+ signalUpdates.add(index);
683
754
  }
684
755
  busy = false;
685
- if (!preview) published?.();
756
+ if (!preview)
757
+ published?.();
686
758
  }
687
759
  };
688
760
  const refresh = () => {
689
- if (disposed) return;
761
+ if (disposed)
762
+ return;
690
763
  revision++;
691
764
  dirty = true;
692
765
  drain();
@@ -700,12 +773,14 @@ function __adoptBindings(root, descriptor, source, options) {
700
773
  const handle = { refresh, dispose };
701
774
  if (descriptor.handoff === "host") {
702
775
  published = () => {
703
- if (!publicationRetries?.size) return;
776
+ if (!publicationRetries?.size)
777
+ return;
704
778
  const pending = [...publicationRetries];
705
779
  publicationRetries.clear();
706
780
  for (const retry of pending)
707
781
  queueMicrotask(() => {
708
- if (!disposed) retry();
782
+ if (!disposed)
783
+ retry();
709
784
  });
710
785
  };
711
786
  const host = root;
@@ -723,16 +798,13 @@ function __adoptBindings(root, descriptor, source, options) {
723
798
  const nextSibling = sibling(host, false);
724
799
  let handoff;
725
800
  handle[import_control_handoff.BINDING_HANDOFF] = () => {
726
- if (handoff !== void 0) return handoff;
801
+ if (handoff !== void 0)
802
+ return handoff;
727
803
  return handoff = {
728
804
  id: descriptor.id,
729
805
  root: host,
730
806
  anchor: host,
731
- host: new Set(
732
- bindings.map(
733
- (binding) => binding[1] === "styleProperty" ? "style:" + binding[2] : binding[1].startsWith("style") ? "style" : binding[2]
734
- )
735
- ),
807
+ host: new Set(bindings.map((binding) => binding[1] === "styleProperty" ? "style:" + binding[2] : binding[1].startsWith("style") ? "style" : binding[2])),
736
808
  revision: () => busy ? -1 : revision,
737
809
  afterPublication: (callback) => {
738
810
  (publicationRetries ??= /* @__PURE__ */ new Set()).add(callback);
@@ -752,23 +824,17 @@ function __adoptBindings(root, descriptor, source, options) {
752
824
  for (let index = 0; index < bindings.length; index++) {
753
825
  const binding = bindings[index];
754
826
  const node = nodes[binding[0]];
755
- if (node === void 0) throw new TypeError((0, import_error_codes_client_generated.formatClientError)(328));
827
+ if (node === void 0)
828
+ throw new TypeError(process.env.NODE_ENV !== "production" ? "A DOM binding targets an unknown element." : __octaneNoArgError(328));
756
829
  owned.push([node, __claimBinding(node, binding)]);
757
830
  if (binding[1] === "control") {
758
- controls.set(
759
- index,
760
- controlFactory.claim(
761
- node,
762
- binding[2],
763
- (0, import_read_protocol.forwardNativeTransitionConsumer)(refresh, () => {
764
- if (!disposed) {
765
- revision++;
766
- signalUpdates.add(index);
767
- drain();
768
- }
769
- })
770
- )
771
- );
831
+ controls.set(index, controlFactory.claim(node, binding[2], (0, import_read_protocol.forwardNativeTransitionConsumer)(refresh, () => {
832
+ if (!disposed) {
833
+ revision++;
834
+ signalUpdates.add(index);
835
+ drain();
836
+ }
837
+ })));
772
838
  }
773
839
  if (binding[1] === "classGroup") {
774
840
  groups ??= /* @__PURE__ */ new Map();
@@ -777,9 +843,12 @@ function __adoptBindings(root, descriptor, source, options) {
777
843
  }
778
844
  signal?.addEventListener("abort", dispose, { once: true });
779
845
  const stop = source.subscribe(refresh);
780
- if (typeof stop !== "function") throw new TypeError((0, import_error_codes_client_generated.formatClientError)(329));
781
- if (disposed) stop();
782
- else unsubscribe = stop;
846
+ if (typeof stop !== "function")
847
+ throw new TypeError(process.env.NODE_ENV !== "production" ? "A DOM binding subscription must return a cleanup function." : __octaneNoArgError(329));
848
+ if (disposed)
849
+ stop();
850
+ else
851
+ unsubscribe = stop;
783
852
  busy = false;
784
853
  refresh();
785
854
  return handle;
@@ -793,9 +862,9 @@ function __adoptBindings(root, descriptor, source, options) {
793
862
  }
794
863
  function __adoptScalarBindings(root, descriptor, source, options) {
795
864
  if (descriptor.addressed || descriptor.handoff || descriptor.connectProjection || !descriptor.bindings.every(isFixedScalarChannel))
796
- throw new TypeError((0, import_error_codes_client_generated.formatClientError)(330));
865
+ throw new TypeError(process.env.NODE_ENV !== "production" ? "This DOM binding view requires the general adopter." : __octaneNoArgError(330));
797
866
  if (!source || typeof source.getSnapshot !== "function" || typeof source.subscribe !== "function")
798
- throw new TypeError((0, import_error_codes_client_generated.formatClientError)(325));
867
+ throw new TypeError(process.env.NODE_ENV !== "production" ? "DOM bindings require synchronous getSnapshot() and subscribe() methods." : __octaneNoArgError(325));
799
868
  const nodes = resolveFixedNodes(root, descriptor);
800
869
  const bindings = descriptor.bindings;
801
870
  const owned = [];
@@ -810,7 +879,8 @@ function __adoptScalarBindings(root, descriptor, source, options) {
810
879
  let unsubscribe;
811
880
  const signal = options?.signal;
812
881
  const dispose = () => {
813
- if (disposed) return;
882
+ if (disposed)
883
+ return;
814
884
  disposed = true;
815
885
  signal?.removeEventListener("abort", dispose);
816
886
  let failed = false;
@@ -827,37 +897,44 @@ function __adoptScalarBindings(root, descriptor, source, options) {
827
897
  }
828
898
  signalConnections?.clear();
829
899
  signalUpdates?.clear();
830
- for (let i = 0; i < owned.length; i++) __releaseBinding(owned[i][0], owned[i][1]);
900
+ for (let i = 0; i < owned.length; i++)
901
+ __releaseBinding(owned[i][0], owned[i][1]);
831
902
  owned.length = nodes.length = previous.length = 0;
832
903
  const stop = unsubscribe;
833
904
  unsubscribe = void 0;
834
905
  try {
835
906
  stop?.();
836
907
  } catch (error) {
837
- if (!failed) throw error;
908
+ if (!failed)
909
+ throw error;
838
910
  }
839
- if (failed) throw failure;
911
+ if (failed)
912
+ throw failure;
840
913
  };
841
914
  const writePrepared = (next, indices) => {
842
915
  for (let position = 0; position < (indices?.length ?? bindings.length) && !dirty && !disposed; position++) {
843
916
  const i = indices ? indices[position] : position;
844
- if (next[i] === previous[i]) continue;
917
+ if (next[i] === previous[i])
918
+ continue;
845
919
  const binding = bindings[i];
846
920
  writeFixedScalar(nodes[binding[0]], binding, next[i]);
847
921
  if (!disposed) {
848
922
  previous[i] = next[i];
849
923
  const node = owned[i][0];
850
924
  let claims2 = import_dom_binding_claims.domBindingClaims.get(node);
851
- if (claims2 === void 0) import_dom_binding_claims.domBindingClaims.set(node, claims2 = /* @__PURE__ */ new Map());
925
+ if (claims2 === void 0)
926
+ import_dom_binding_claims.domBindingClaims.set(node, claims2 = /* @__PURE__ */ new Map());
852
927
  claims2.set(owned[i][1], next[i]);
853
928
  }
854
929
  }
855
930
  };
856
931
  const drain = (preview = false) => {
857
- if (disposed) return;
858
- if (busy) return preview ? { validate: () => false, commit() {
859
- }, discard() {
860
- } } : void 0;
932
+ if (disposed)
933
+ return;
934
+ if (busy)
935
+ return preview ? { validate: () => false, commit() {
936
+ }, discard() {
937
+ } } : void 0;
861
938
  const version = revision;
862
939
  const previousDirty = dirty;
863
940
  const previousUpdates = preview && signalUpdates ? [...signalUpdates] : void 0;
@@ -866,13 +943,17 @@ function __adoptScalarBindings(root, descriptor, source, options) {
866
943
  let accepted = false;
867
944
  let retired = false;
868
945
  const discard = preview ? () => {
869
- if (accepted || retired) return;
946
+ if (accepted || retired)
947
+ return;
870
948
  retired = true;
871
- for (const receipt of receipts) receipt.discard();
949
+ for (const receipt of receipts)
950
+ receipt.discard();
872
951
  for (const [index, connection] of preparedSignals ?? [])
873
- if (connection !== signalConnections?.get(index)) connection.dispose();
952
+ if (connection !== signalConnections?.get(index))
953
+ connection.dispose();
874
954
  } : void 0;
875
- if (preview) dirty = true;
955
+ if (preview)
956
+ dirty = true;
876
957
  busy = true;
877
958
  try {
878
959
  while ((dirty || signalUpdates?.size) && !disposed) {
@@ -882,35 +963,39 @@ function __adoptScalarBindings(root, descriptor, source, options) {
882
963
  dirty = false;
883
964
  signalUpdates?.clear();
884
965
  const snapshot = source.getSnapshot();
885
- if (dirty || disposed) continue;
966
+ if (dirty || disposed)
967
+ continue;
886
968
  if (snapshot !== null && (typeof snapshot === "object" || typeof snapshot === "function") && typeof snapshot.then === "function" && !dirty && !disposed)
887
- throw new TypeError((0, import_error_codes_client_generated.formatClientError)(326));
888
- if (dirty || disposed) continue;
969
+ throw new TypeError(process.env.NODE_ENV !== "production" ? "DOM bindings require a synchronous snapshot, not a thenable." : __octaneNoArgError(326));
970
+ if (dirty || disposed)
971
+ continue;
889
972
  const values = descriptor.project(snapshot);
890
- if (dirty || disposed) continue;
973
+ if (dirty || disposed)
974
+ continue;
891
975
  if (!Array.isArray(values) || values.length !== bindings.length)
892
- throw new TypeError((0, import_error_codes_client_generated.formatClientError)(327));
976
+ throw new TypeError(process.env.NODE_ENV !== "production" ? "A DOM binding projection must return its synchronous scalar values." : __octaneNoArgError(327));
893
977
  let resolved = values;
894
978
  if (signalFactory && descriptor.signalIndices) {
895
979
  for (const index of descriptor.signalIndices) {
896
- if (disposed || dirty) break;
980
+ if (disposed || dirty)
981
+ break;
897
982
  let connection = preparedSignals.get(index);
898
983
  if (!connection && signalFactory.isSignal(values[index])) {
899
- connection = signalFactory.connect(
900
- (0, import_read_protocol.forwardNativeTransitionConsumer)(refresh, () => {
901
- if (!disposed) {
902
- revision++;
903
- signalUpdates.add(index);
904
- drain();
905
- }
906
- })
907
- );
984
+ connection = signalFactory.connect((0, import_read_protocol.forwardNativeTransitionConsumer)(refresh, () => {
985
+ if (!disposed) {
986
+ revision++;
987
+ signalUpdates.add(index);
988
+ drain();
989
+ }
990
+ }));
908
991
  preparedSignals.set(index, connection);
909
992
  }
910
993
  if (connection) {
911
- if (resolved === values) resolved = [...values];
994
+ if (resolved === values)
995
+ resolved = [...values];
912
996
  const receipt = preview ? connection.preview(values[index]) : void 0;
913
- if (receipt) receipts.push(receipt);
997
+ if (receipt)
998
+ receipts.push(receipt);
914
999
  resolved[index] = receipt ? receipt.value : connection.read(values[index]);
915
1000
  }
916
1001
  }
@@ -921,20 +1006,15 @@ function __adoptScalarBindings(root, descriptor, source, options) {
921
1006
  signalUpdates.clear();
922
1007
  next = [];
923
1008
  for (const index of indices)
924
- next[index] = normalizeFixedScalar(
925
- bindings[index],
926
- signalConnections.get(index).get()
927
- );
1009
+ next[index] = normalizeFixedScalar(bindings[index], signalConnections.get(index).get());
928
1010
  }
929
1011
  while (!preview && signalUpdates?.size && !dirty && !disposed) {
930
1012
  const pending = [...signalUpdates];
931
1013
  signalUpdates.clear();
932
1014
  for (const index of pending) {
933
- next[index] = normalizeFixedScalar(
934
- bindings[index],
935
- signalConnections.get(index).get()
936
- );
937
- if (indices && !indices.includes(index)) indices.push(index);
1015
+ next[index] = normalizeFixedScalar(bindings[index], signalConnections.get(index).get());
1016
+ if (indices && !indices.includes(index))
1017
+ indices.push(index);
938
1018
  }
939
1019
  }
940
1020
  if (preview)
@@ -942,20 +1022,23 @@ function __adoptScalarBindings(root, descriptor, source, options) {
942
1022
  validate: () => !retired && !disposed && revision === version && receipts.every((receipt) => receipt.validate()),
943
1023
  discard,
944
1024
  commit() {
945
- if (disposed || retired || accepted) return;
1025
+ if (disposed || retired || accepted)
1026
+ return;
946
1027
  accepted = true;
947
1028
  busy = true;
948
1029
  try {
949
1030
  for (const [index, connection] of preparedSignals ?? [])
950
1031
  signalConnections.set(index, connection);
951
- for (const receipt of receipts) receipt.commit();
1032
+ for (const receipt of receipts)
1033
+ receipt.commit();
952
1034
  writePrepared(next, indices);
953
1035
  } finally {
954
1036
  busy = false;
955
1037
  }
956
1038
  }
957
1039
  };
958
- if (dirty || disposed) continue;
1040
+ if (dirty || disposed)
1041
+ continue;
959
1042
  writePrepared(next, indices);
960
1043
  }
961
1044
  } catch (error) {
@@ -971,13 +1054,15 @@ function __adoptScalarBindings(root, descriptor, source, options) {
971
1054
  } finally {
972
1055
  if (preview) {
973
1056
  dirty ||= previousDirty;
974
- for (const index of previousUpdates ?? []) signalUpdates.add(index);
1057
+ for (const index of previousUpdates ?? [])
1058
+ signalUpdates.add(index);
975
1059
  }
976
1060
  busy = false;
977
1061
  }
978
1062
  };
979
1063
  const refresh = () => {
980
- if (disposed) return;
1064
+ if (disposed)
1065
+ return;
981
1066
  revision++;
982
1067
  dirty = true;
983
1068
  drain();
@@ -996,14 +1081,18 @@ function __adoptScalarBindings(root, descriptor, source, options) {
996
1081
  try {
997
1082
  for (let index = 0; index < bindings.length; index++) {
998
1083
  const node = nodes[bindings[index][0]];
999
- if (node === void 0) throw new TypeError((0, import_error_codes_client_generated.formatClientError)(328));
1084
+ if (node === void 0)
1085
+ throw new TypeError(process.env.NODE_ENV !== "production" ? "A DOM binding targets an unknown element." : __octaneNoArgError(328));
1000
1086
  owned.push([node, __claimBinding(node, bindings[index])]);
1001
1087
  }
1002
1088
  signal?.addEventListener("abort", dispose, { once: true });
1003
1089
  const stop = source.subscribe(refresh);
1004
- if (typeof stop !== "function") throw new TypeError((0, import_error_codes_client_generated.formatClientError)(329));
1005
- if (disposed) stop();
1006
- else unsubscribe = stop;
1090
+ if (typeof stop !== "function")
1091
+ throw new TypeError(process.env.NODE_ENV !== "production" ? "A DOM binding subscription must return a cleanup function." : __octaneNoArgError(329));
1092
+ if (disposed)
1093
+ stop();
1094
+ else
1095
+ unsubscribe = stop;
1007
1096
  busy = false;
1008
1097
  refresh();
1009
1098
  return handle;