octane 0.15.0 → 0.16.1

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 (270) hide show
  1. package/dist/behavior-root.js +12 -13
  2. package/dist/cjs/behavior-root.cjs +12 -13
  3. package/dist/cjs/data-encoding.cjs +18 -0
  4. package/dist/cjs/dom-focused-move.cjs +62 -33
  5. package/dist/cjs/dom-tables.cjs +14 -0
  6. package/dist/cjs/error-codes.client.generated.cjs +43 -0
  7. package/dist/cjs/error-codes.server.generated.cjs +43 -0
  8. package/dist/cjs/hydration/dev-values.cjs +1 -1
  9. package/dist/cjs/independent-hydration-protocol.cjs +7 -20
  10. package/dist/cjs/index.cjs +2 -0
  11. package/dist/cjs/radio-group.cjs +7 -2
  12. package/dist/cjs/runtime/actions.cjs +73 -34
  13. package/dist/cjs/runtime/block.cjs +5 -5
  14. package/dist/cjs/runtime/branches.cjs +2 -21
  15. package/dist/cjs/runtime/child-slots.cjs +40 -16
  16. package/dist/cjs/runtime/commit.cjs +20 -6
  17. package/dist/cjs/runtime/component-slots.cjs +26 -15
  18. package/dist/cjs/runtime/context.cjs +14 -9
  19. package/dist/cjs/runtime/deopt.cjs +81 -84
  20. package/dist/cjs/runtime/drivers.cjs +25 -0
  21. package/dist/cjs/runtime/elements.cjs +5 -5
  22. package/dist/cjs/runtime/engine.cjs +44 -32
  23. package/dist/cjs/runtime/events.cjs +19 -12
  24. package/dist/cjs/runtime/forms.cjs +12 -13
  25. package/dist/cjs/runtime/host-props.cjs +20 -16
  26. package/dist/cjs/runtime/hydrate-boundary.cjs +1 -1
  27. package/dist/cjs/runtime/hydration-presentation.cjs +3 -2
  28. package/dist/cjs/runtime/hydration.cjs +15 -21
  29. package/dist/cjs/runtime/lists.cjs +25 -24
  30. package/dist/cjs/runtime/portals.cjs +2 -2
  31. package/dist/cjs/runtime/refs.cjs +4 -0
  32. package/dist/cjs/runtime/render.cjs +5 -3
  33. package/dist/cjs/runtime/roots.cjs +3 -2
  34. package/dist/cjs/runtime/signal-bindings.cjs +88 -47
  35. package/dist/cjs/runtime/signal-owners.cjs +3 -3
  36. package/dist/cjs/runtime/suspense.cjs +54 -115
  37. package/dist/cjs/runtime/templates.cjs +8 -5
  38. package/dist/cjs/runtime/transitions.cjs +61 -3
  39. package/dist/cjs/runtime.cjs +2 -0
  40. package/dist/cjs/runtime.server.cjs +2 -14
  41. package/dist/cjs/server/streamed-region.cjs +2 -2
  42. package/dist/cjs/server-rpc-batch-client.cjs +34 -59
  43. package/dist/cjs/server-rpc-client.cjs +114 -104
  44. package/dist/cjs/server-rpc-protocol.cjs +0 -59
  45. package/dist/cjs/server-rpc-stream-client.cjs +57 -1
  46. package/dist/cjs/signals/actions.cjs +3 -2
  47. package/dist/cjs/signals/computations.cjs +77 -69
  48. package/dist/cjs/signals/control-binding.cjs +2 -5
  49. package/dist/cjs/signals/engine.cjs +2 -25
  50. package/dist/cjs/signals/facade.cjs +16 -82
  51. package/dist/cjs/signals/graph.cjs +3 -7
  52. package/dist/cjs/signals/handle-protocol.cjs +5 -0
  53. package/dist/cjs/signals/index.cjs +14 -4
  54. package/dist/cjs/signals/native-adoption.cjs +112 -0
  55. package/dist/cjs/signals/native-read-seeds.cjs +4 -85
  56. package/dist/cjs/signals/requests.cjs +79 -73
  57. package/dist/cjs/signals/scalar-computations.cjs +61 -53
  58. package/dist/cjs/signals/server-reads.cjs +11 -2
  59. package/dist/cjs/signals/streamed-results.cjs +122 -0
  60. package/dist/cjs/stream-protocol.cjs +5 -3
  61. package/dist/cjs/streamed-signals-protocol.cjs +7 -20
  62. package/dist/cjs/trusted-types.cjs +41 -0
  63. package/dist/cjs/version.cjs +1 -1
  64. package/dist/compiler/compile-universal.js +287 -52
  65. package/dist/compiler/compile.js +192 -139
  66. package/dist/compiler/index.d.ts +11 -1
  67. package/dist/compiler/signal-declarations.js +33 -1
  68. package/dist/compiler/style-scopes.js +4 -1
  69. package/dist/compiler/template-ir.js +102 -0
  70. package/dist/compiler/typescript-output.js +6 -2
  71. package/dist/compiler/vite.js +20 -0
  72. package/dist/data-encoding.d.ts +4 -0
  73. package/dist/data-encoding.js +16 -0
  74. package/dist/dom-binding-program.js +4 -4
  75. package/dist/dom-binding-signals.d.ts +2 -2
  76. package/dist/dom-binding-signals.js +3 -4
  77. package/dist/dom-focused-move.d.ts +8 -3
  78. package/dist/dom-focused-move.js +61 -33
  79. package/dist/dom-tables.d.ts +1 -0
  80. package/dist/dom-tables.js +13 -0
  81. package/dist/error-codes.client.generated.d.ts +11 -0
  82. package/dist/error-codes.client.generated.js +43 -0
  83. package/dist/error-codes.server.generated.d.ts +11 -0
  84. package/dist/error-codes.server.generated.js +43 -0
  85. package/dist/hydration/dev-values.d.ts +2 -1
  86. package/dist/hydration/dev-values.js +1 -1
  87. package/dist/hydration/stream-receiver.js +2 -1
  88. package/dist/hydration/streamed-signals.js +2 -1
  89. package/dist/independent-hydration-protocol.js +5 -18
  90. package/dist/index.d.ts +1 -1
  91. package/dist/index.js +2 -1
  92. package/dist/internal/server-rpc.d.ts +8 -0
  93. package/dist/internal/server-rpc.js +7 -0
  94. package/dist/node/behavior-root.js +12 -13
  95. package/dist/node/data-encoding.js +16 -0
  96. package/dist/node/dom-binding-program.js +4 -4
  97. package/dist/node/dom-binding-signals.js +3 -4
  98. package/dist/node/dom-focused-move.js +61 -33
  99. package/dist/node/dom-tables.js +13 -0
  100. package/dist/node/error-codes.client.generated.js +43 -0
  101. package/dist/node/error-codes.server.generated.js +43 -0
  102. package/dist/node/hydration/dev-values.js +1 -1
  103. package/dist/node/hydration/stream-receiver.js +2 -1
  104. package/dist/node/hydration/streamed-signals.js +2 -1
  105. package/dist/node/independent-hydration-protocol.js +5 -18
  106. package/dist/node/index.js +2 -1
  107. package/dist/node/internal/server-rpc.js +7 -0
  108. package/dist/node/owner-kernel/hooks.js +0 -4
  109. package/dist/node/radio-group.js +5 -1
  110. package/dist/node/runtime/actions.js +78 -39
  111. package/dist/node/runtime/block.js +5 -5
  112. package/dist/node/runtime/branches.js +2 -21
  113. package/dist/node/runtime/child-slots.js +41 -22
  114. package/dist/node/runtime/commit.js +19 -6
  115. package/dist/node/runtime/component-slots.js +32 -24
  116. package/dist/node/runtime/context.js +19 -9
  117. package/dist/node/runtime/deopt.js +81 -85
  118. package/dist/node/runtime/drivers.js +29 -0
  119. package/dist/node/runtime/elements.js +4 -6
  120. package/dist/node/runtime/engine.js +40 -29
  121. package/dist/node/runtime/events.js +19 -12
  122. package/dist/node/runtime/forms.js +4 -5
  123. package/dist/node/runtime/host-props.js +20 -16
  124. package/dist/node/runtime/hydrate-boundary.js +2 -5
  125. package/dist/node/runtime/hydration-presentation.js +1 -2
  126. package/dist/node/runtime/hydration.js +5 -10
  127. package/dist/node/runtime/lists.js +26 -25
  128. package/dist/node/runtime/portals.js +3 -3
  129. package/dist/node/runtime/refs.js +3 -0
  130. package/dist/node/runtime/render.js +13 -7
  131. package/dist/node/runtime/roots.js +4 -2
  132. package/dist/node/runtime/signal-bindings.js +63 -21
  133. package/dist/node/runtime/signal-owners.js +3 -3
  134. package/dist/node/runtime/suspense.js +61 -116
  135. package/dist/node/runtime/templates.js +6 -3
  136. package/dist/node/runtime/transitions.js +59 -2
  137. package/dist/node/runtime.js +2 -0
  138. package/dist/node/runtime.server.js +2 -14
  139. package/dist/node/server/streamed-region.js +1 -1
  140. package/dist/node/server-rpc-batch-client.js +38 -58
  141. package/dist/node/server-rpc-client.js +106 -93
  142. package/dist/node/server-rpc-protocol.js +0 -57
  143. package/dist/node/server-rpc-response.js +131 -0
  144. package/dist/node/server-rpc-stream-client.js +56 -1
  145. package/dist/node/signals/actions.js +2 -9
  146. package/dist/node/signals/computations.js +73 -67
  147. package/dist/node/signals/control-binding.js +3 -6
  148. package/dist/node/signals/engine.js +1 -22
  149. package/dist/node/signals/facade.js +8 -84
  150. package/dist/node/signals/graph.js +1 -4
  151. package/dist/node/signals/handle-protocol.js +4 -0
  152. package/dist/node/signals/index.js +12 -4
  153. package/dist/node/signals/native-adoption.js +91 -0
  154. package/dist/node/signals/native-read-seeds.js +2 -82
  155. package/dist/node/signals/requests.js +74 -70
  156. package/dist/node/signals/scalar-computations.js +58 -52
  157. package/dist/node/signals/server-reads-elsewhere.js +17 -1
  158. package/dist/node/signals/server-reads.js +11 -1
  159. package/dist/node/signals/streamed-results.js +106 -0
  160. package/dist/node/stream-protocol.js +4 -3
  161. package/dist/node/streamed-signals-protocol.js +1 -14
  162. package/dist/node/trusted-types.js +16 -0
  163. package/dist/node/universal-core.js +62 -27
  164. package/dist/node/universal-native.js +3 -0
  165. package/dist/node/universal-styles.js +21 -0
  166. package/dist/node/universal.js +3 -0
  167. package/dist/node/version.js +1 -1
  168. package/dist/owner-kernel/hooks.d.ts +0 -1
  169. package/dist/owner-kernel/hooks.js +0 -4
  170. package/dist/radio-group.d.ts +2 -0
  171. package/dist/radio-group.js +5 -1
  172. package/dist/runtime/actions.js +78 -39
  173. package/dist/runtime/block.js +5 -5
  174. package/dist/runtime/branches.js +2 -21
  175. package/dist/runtime/child-slots.d.ts +8 -0
  176. package/dist/runtime/child-slots.js +41 -22
  177. package/dist/runtime/commit.d.ts +13 -5
  178. package/dist/runtime/commit.js +19 -6
  179. package/dist/runtime/component-slots.d.ts +3 -0
  180. package/dist/runtime/component-slots.js +32 -24
  181. package/dist/runtime/context.d.ts +9 -1
  182. package/dist/runtime/context.js +19 -9
  183. package/dist/runtime/deopt.d.ts +16 -5
  184. package/dist/runtime/deopt.js +81 -85
  185. package/dist/runtime/drivers.d.ts +32 -0
  186. package/dist/runtime/drivers.js +29 -0
  187. package/dist/runtime/effects.d.ts +1 -1
  188. package/dist/runtime/elements.d.ts +4 -0
  189. package/dist/runtime/elements.js +4 -6
  190. package/dist/runtime/engine.d.ts +6 -3
  191. package/dist/runtime/engine.js +40 -29
  192. package/dist/runtime/events.js +19 -12
  193. package/dist/runtime/forms.js +4 -5
  194. package/dist/runtime/host-props.d.ts +2 -2
  195. package/dist/runtime/host-props.js +20 -16
  196. package/dist/runtime/hydrate-boundary.js +2 -5
  197. package/dist/runtime/hydration-presentation.js +1 -2
  198. package/dist/runtime/hydration.d.ts +6 -9
  199. package/dist/runtime/hydration.js +5 -10
  200. package/dist/runtime/lists.js +26 -25
  201. package/dist/runtime/portals.js +3 -3
  202. package/dist/runtime/refs.d.ts +1 -0
  203. package/dist/runtime/refs.js +3 -0
  204. package/dist/runtime/render.js +13 -7
  205. package/dist/runtime/roots.js +4 -2
  206. package/dist/runtime/signal-bindings.d.ts +3 -4
  207. package/dist/runtime/signal-bindings.js +63 -21
  208. package/dist/runtime/signal-owners.js +3 -3
  209. package/dist/runtime/suspense.d.ts +1 -1
  210. package/dist/runtime/suspense.js +61 -116
  211. package/dist/runtime/templates.js +6 -3
  212. package/dist/runtime/transitions.d.ts +12 -1
  213. package/dist/runtime/transitions.js +59 -2
  214. package/dist/runtime/types.d.ts +5 -2
  215. package/dist/runtime.d.ts +1 -1
  216. package/dist/runtime.js +2 -0
  217. package/dist/runtime.server.js +2 -14
  218. package/dist/server/streamed-region.js +1 -1
  219. package/dist/server-rpc-batch-client.d.ts +12 -4
  220. package/dist/server-rpc-batch-client.js +38 -58
  221. package/dist/server-rpc-client.d.ts +24 -1
  222. package/dist/server-rpc-client.js +106 -93
  223. package/dist/server-rpc-protocol.d.ts +0 -6
  224. package/dist/server-rpc-protocol.js +0 -57
  225. package/dist/server-rpc-response.d.ts +6 -0
  226. package/dist/server-rpc-response.js +131 -0
  227. package/dist/server-rpc-stream-client.js +56 -1
  228. package/dist/signals/actions.js +2 -9
  229. package/dist/signals/computations.d.ts +22 -9
  230. package/dist/signals/computations.js +73 -67
  231. package/dist/signals/control-binding.js +3 -6
  232. package/dist/signals/engine.d.ts +1 -11
  233. package/dist/signals/engine.js +1 -22
  234. package/dist/signals/facade.d.ts +10 -16
  235. package/dist/signals/facade.js +8 -84
  236. package/dist/signals/graph.d.ts +0 -1
  237. package/dist/signals/graph.js +1 -4
  238. package/dist/signals/handle-protocol.d.ts +1 -1
  239. package/dist/signals/handle-protocol.js +4 -0
  240. package/dist/signals/index.d.ts +5 -1
  241. package/dist/signals/index.js +12 -4
  242. package/dist/signals/native-adoption.d.ts +18 -0
  243. package/dist/signals/native-adoption.js +91 -0
  244. package/dist/signals/native-read-seeds.d.ts +12 -17
  245. package/dist/signals/native-read-seeds.js +2 -82
  246. package/dist/signals/redeclaration.d.ts +9 -4
  247. package/dist/signals/requests.d.ts +19 -10
  248. package/dist/signals/requests.js +74 -70
  249. package/dist/signals/scalar-computations.d.ts +2 -0
  250. package/dist/signals/scalar-computations.js +58 -52
  251. package/dist/signals/server-reads-elsewhere.d.ts +4 -0
  252. package/dist/signals/server-reads-elsewhere.js +17 -1
  253. package/dist/signals/server-reads.d.ts +3 -1
  254. package/dist/signals/server-reads.js +11 -1
  255. package/dist/signals/streamed-results.d.ts +18 -0
  256. package/dist/signals/streamed-results.js +106 -0
  257. package/dist/stream-protocol.d.ts +2 -0
  258. package/dist/stream-protocol.js +4 -3
  259. package/dist/streamed-signals-protocol.js +1 -14
  260. package/dist/trusted-types.d.ts +18 -0
  261. package/dist/trusted-types.js +16 -0
  262. package/dist/universal-core.js +62 -27
  263. package/dist/universal-native.d.ts +2 -0
  264. package/dist/universal-native.js +3 -0
  265. package/dist/universal-styles.d.ts +15 -0
  266. package/dist/universal-styles.js +21 -0
  267. package/dist/universal.d.ts +2 -0
  268. package/dist/universal.js +3 -0
  269. package/dist/version.js +1 -1
  270. package/package.json +6 -1
@@ -1,4 +1,5 @@
1
1
  import { adoptBindings, mountBindings, unbound } from "./dom-bindings.js";
2
+ import { formatClientError } from "./error-codes.client.generated.js";
2
3
  import { captureFormSubmissions } from "./behavior-form-submissions.js";
3
4
  const documentRegistries = /* @__PURE__ */ new WeakMap();
4
5
  const DEFAULT_DOM = {
@@ -85,12 +86,12 @@ function contains(root, element, container = root.container) {
85
86
  }
86
87
  function assertActiveRoot(root) {
87
88
  if (root.disposed || root.controller.signal.aborted) {
88
- throw new Error("Cannot register behavior on a disposed behavior root.");
89
+ throw new Error(formatClientError(351));
89
90
  }
90
91
  }
91
92
  function assertContainedElement(root, element, label) {
92
93
  if (!root.dom.element(element) || !contains(root, element)) {
93
- throw new Error(`${label} must belong to the behavior root container and document.`);
94
+ throw new Error(formatClientError(352, label));
94
95
  }
95
96
  }
96
97
  function nearestRange(root, element) {
@@ -388,7 +389,7 @@ function installListeners(root, events) {
388
389
  if (events === void 0) return;
389
390
  for (const event of new Set(events)) {
390
391
  if (typeof event !== "string" || event.length === 0) {
391
- throw new Error("Behavior event names must be non-empty strings.");
392
+ throw new Error(formatClientError(353));
392
393
  }
393
394
  if (root.listeners.has(event)) continue;
394
395
  const listener = (nativeEvent) => handleDelegatedEvent(root, nativeEvent);
@@ -449,7 +450,7 @@ function activateBehavior(record) {
449
450
  function registerBehavior(root, entry) {
450
451
  assertActiveRoot(root);
451
452
  if (entry === null || typeof entry !== "object" || typeof entry.adopt !== "function") {
452
- throw new Error("A behavior entry requires an adopt(element, context) function.");
453
+ throw new Error(formatClientError(354));
453
454
  }
454
455
  if (typeof entry.target !== "string") {
455
456
  assertContainedElement(root, entry.target, "A behavior target");
@@ -457,19 +458,19 @@ function registerBehavior(root, entry) {
457
458
  root.dom.matches(root.container, entry.target);
458
459
  }
459
460
  if (entry.id !== void 0 && root.byId.has(entry.id)) {
460
- throw new Error(`A behavior with identity ${JSON.stringify(entry.id)} is already registered.`);
461
+ throw new Error(formatClientError(355, JSON.stringify(entry.id)));
461
462
  }
462
463
  const dependencies = [];
463
464
  for (const id of entry.dependencies ?? []) {
464
465
  const dependency = root.byId.get(id);
465
466
  if (dependency === void 0) {
466
- throw new Error(`Behavior dependency ${JSON.stringify(id)} is not registered.`);
467
+ throw new Error(formatClientError(356, JSON.stringify(id)));
467
468
  }
468
469
  dependencies.push(dependency);
469
470
  }
470
471
  for (const existing of root.behaviors) {
471
472
  if (entry.id !== void 0 && existing.entry.conflicts?.includes(entry.id) || existing.entry.id !== void 0 && entry.conflicts?.includes(existing.entry.id)) {
472
- throw new Error("The requested behavior conflicts with an existing behavior registration.");
473
+ throw new Error(formatClientError(357));
473
474
  }
474
475
  }
475
476
  const controller = createController(root.document);
@@ -549,7 +550,7 @@ function registerExternalRange(root, element, options) {
549
550
  assertActiveRoot(root);
550
551
  assertContainedElement(root, element, "An externally owned range");
551
552
  if (options === null || typeof options !== "object" || !("owner" in options)) {
552
- throw new Error("An external range requires an explicit owner identity.");
553
+ throw new Error(formatClientError(358));
553
554
  }
554
555
  const existing = root.registry.ranges.get(element);
555
556
  if (existing !== void 0) {
@@ -557,7 +558,7 @@ function registerExternalRange(root, element, options) {
557
558
  return existing.publicRange;
558
559
  }
559
560
  if (!options.replace) {
560
- throw new Error("External ownership conflict: pass replace: true to hand this range off.");
561
+ throw new Error(formatClientError(359));
561
562
  }
562
563
  if (!options.signal?.aborted) disposeRange(existing);
563
564
  }
@@ -675,15 +676,13 @@ function attachBehaviorRoot(container, options = {}) {
675
676
  const capture = options.formSubmissions;
676
677
  const document = capture === void 0 ? isElement(container) ? container.ownerDocument : null : capture.document(container);
677
678
  if (document === null) {
678
- throw new Error("A behavior root requires an element with an owner document.");
679
+ throw new Error(formatClientError(360));
679
680
  }
680
681
  let registry = registryFor(document);
681
682
  const existing = registry.roots.get(container);
682
683
  if (existing !== void 0) {
683
684
  if (!options.replace) {
684
- throw new Error(
685
- "This container already has a behavior root; pass replace: true to replace it."
686
- );
685
+ throw new Error(formatClientError(361));
687
686
  }
688
687
  if (!options.signal?.aborted) {
689
688
  disposeRoot(existing);
@@ -26,6 +26,7 @@ __export(behavior_root_exports, {
26
26
  });
27
27
  module.exports = __toCommonJS(behavior_root_exports);
28
28
  var import_dom_bindings = require("./dom-bindings.cjs");
29
+ var import_error_codes_client_generated = require("./error-codes.client.generated.cjs");
29
30
  var import_behavior_form_submissions = require("./behavior-form-submissions.cjs");
30
31
  const documentRegistries = /* @__PURE__ */ new WeakMap();
31
32
  const DEFAULT_DOM = {
@@ -112,12 +113,12 @@ function contains(root, element, container = root.container) {
112
113
  }
113
114
  function assertActiveRoot(root) {
114
115
  if (root.disposed || root.controller.signal.aborted) {
115
- throw new Error("Cannot register behavior on a disposed behavior root.");
116
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(351));
116
117
  }
117
118
  }
118
119
  function assertContainedElement(root, element, label) {
119
120
  if (!root.dom.element(element) || !contains(root, element)) {
120
- throw new Error(`${label} must belong to the behavior root container and document.`);
121
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(352, label));
121
122
  }
122
123
  }
123
124
  function nearestRange(root, element) {
@@ -415,7 +416,7 @@ function installListeners(root, events) {
415
416
  if (events === void 0) return;
416
417
  for (const event of new Set(events)) {
417
418
  if (typeof event !== "string" || event.length === 0) {
418
- throw new Error("Behavior event names must be non-empty strings.");
419
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(353));
419
420
  }
420
421
  if (root.listeners.has(event)) continue;
421
422
  const listener = (nativeEvent) => handleDelegatedEvent(root, nativeEvent);
@@ -476,7 +477,7 @@ function activateBehavior(record) {
476
477
  function registerBehavior(root, entry) {
477
478
  assertActiveRoot(root);
478
479
  if (entry === null || typeof entry !== "object" || typeof entry.adopt !== "function") {
479
- throw new Error("A behavior entry requires an adopt(element, context) function.");
480
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(354));
480
481
  }
481
482
  if (typeof entry.target !== "string") {
482
483
  assertContainedElement(root, entry.target, "A behavior target");
@@ -484,19 +485,19 @@ function registerBehavior(root, entry) {
484
485
  root.dom.matches(root.container, entry.target);
485
486
  }
486
487
  if (entry.id !== void 0 && root.byId.has(entry.id)) {
487
- throw new Error(`A behavior with identity ${JSON.stringify(entry.id)} is already registered.`);
488
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(355, JSON.stringify(entry.id)));
488
489
  }
489
490
  const dependencies = [];
490
491
  for (const id of entry.dependencies ?? []) {
491
492
  const dependency = root.byId.get(id);
492
493
  if (dependency === void 0) {
493
- throw new Error(`Behavior dependency ${JSON.stringify(id)} is not registered.`);
494
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(356, JSON.stringify(id)));
494
495
  }
495
496
  dependencies.push(dependency);
496
497
  }
497
498
  for (const existing of root.behaviors) {
498
499
  if (entry.id !== void 0 && existing.entry.conflicts?.includes(entry.id) || existing.entry.id !== void 0 && entry.conflicts?.includes(existing.entry.id)) {
499
- throw new Error("The requested behavior conflicts with an existing behavior registration.");
500
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(357));
500
501
  }
501
502
  }
502
503
  const controller = createController(root.document);
@@ -576,7 +577,7 @@ function registerExternalRange(root, element, options) {
576
577
  assertActiveRoot(root);
577
578
  assertContainedElement(root, element, "An externally owned range");
578
579
  if (options === null || typeof options !== "object" || !("owner" in options)) {
579
- throw new Error("An external range requires an explicit owner identity.");
580
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(358));
580
581
  }
581
582
  const existing = root.registry.ranges.get(element);
582
583
  if (existing !== void 0) {
@@ -584,7 +585,7 @@ function registerExternalRange(root, element, options) {
584
585
  return existing.publicRange;
585
586
  }
586
587
  if (!options.replace) {
587
- throw new Error("External ownership conflict: pass replace: true to hand this range off.");
588
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(359));
588
589
  }
589
590
  if (!options.signal?.aborted) disposeRange(existing);
590
591
  }
@@ -702,15 +703,13 @@ function attachBehaviorRoot(container, options = {}) {
702
703
  const capture = options.formSubmissions;
703
704
  const document = capture === void 0 ? isElement(container) ? container.ownerDocument : null : capture.document(container);
704
705
  if (document === null) {
705
- throw new Error("A behavior root requires an element with an owner document.");
706
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(360));
706
707
  }
707
708
  let registry = registryFor(document);
708
709
  const existing = registry.roots.get(container);
709
710
  if (existing !== void 0) {
710
711
  if (!options.replace) {
711
- throw new Error(
712
- "This container already has a behavior root; pass replace: true to replace it."
713
- );
712
+ throw new Error((0, import_error_codes_client_generated.formatClientError)(361));
714
713
  }
715
714
  if (!options.signal?.aborted) {
716
715
  disposeRoot(existing);
@@ -20,6 +20,8 @@ var data_encoding_exports = {};
20
20
  __export(data_encoding_exports, {
21
21
  decodeSignalValue: () => decodeSignalValue,
22
22
  encodeSignalValue: () => encodeSignalValue,
23
+ isKey: () => isKey,
24
+ isRecord: () => isRecord,
23
25
  snapshotSignalValue: () => snapshotSignalValue
24
26
  });
25
27
  module.exports = __toCommonJS(data_encoding_exports);
@@ -29,6 +31,20 @@ function unsupported() {
29
31
  "Signal request arguments and seeds require acyclic plain data: undefined, null, booleans, finite numbers, strings, dense arrays, and plain objects with enumerable string data properties."
30
32
  );
31
33
  }
34
+ function isRecord(value) {
35
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
36
+ const prototype = Object.getPrototypeOf(value);
37
+ if (prototype !== Object.prototype && prototype !== null) return false;
38
+ for (const key of Reflect.ownKeys(value)) {
39
+ if (typeof key !== "string") return false;
40
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
41
+ if (!descriptor.enumerable || !("value" in descriptor)) return false;
42
+ }
43
+ return true;
44
+ }
45
+ function isKey(value) {
46
+ return typeof value === "string" && value.length > 0 && value.length <= 1024;
47
+ }
32
48
  function encodeSignalValue(value, ancestors = /* @__PURE__ */ new Set()) {
33
49
  if (value === void 0) return ["undefined"];
34
50
  if (value === null) return ["null"];
@@ -156,5 +172,7 @@ function decodeSignalValue(encoded) {
156
172
  0 && (module.exports = {
157
173
  decodeSignalValue,
158
174
  encodeSignalValue,
175
+ isKey,
176
+ isRecord,
159
177
  snapshotSignalValue
160
178
  });
@@ -18,54 +18,83 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var dom_focused_move_exports = {};
20
20
  __export(dom_focused_move_exports, {
21
+ isChildOf: () => isChildOf,
21
22
  moveNativeNodeBefore: () => moveNativeNodeBefore
22
23
  });
23
24
  module.exports = __toCommonJS(dom_focused_move_exports);
24
25
  function moveNativeNodeBefore(parent, node, anchor, focused, contentEditable) {
25
- let containsFocused = node === focused;
26
- if (!containsFocused && focused !== null && node.nodeType === 1) {
27
- let candidate = focused;
28
- do {
29
- if (node.contains(candidate)) {
30
- containsFocused = true;
31
- break;
32
- }
33
- const root = candidate.getRootNode();
34
- candidate = root.nodeType === 11 ? root.host : void 0;
35
- } while (candidate !== void 0);
36
- }
37
- if (!containsFocused) {
38
- parent.insertBefore(node, anchor);
26
+ const move = nativeMove(parent);
27
+ if (move !== null && node.isConnected === true && parent.ownerDocument === node.ownerDocument && !(contentEditable && containsFocus(node, focused))) {
28
+ move.call(parent, node, anchor);
39
29
  return;
40
30
  }
41
- const moveBefore = parent.moveBefore;
42
- if (!contentEditable && typeof moveBefore === "function" && parent.isConnected && node.isConnected && parent.ownerDocument === node.ownerDocument) {
43
- moveBefore.call(parent, node, anchor);
31
+ if (!containsFocus(node, focused)) {
32
+ parent.insertBefore(node, anchor);
44
33
  return;
45
34
  }
46
- if (node.parentNode !== parent || anchor !== null && anchor.parentNode !== parent) {
35
+ if (!isChildOf(node, parent) || anchor !== null && !isChildOf(anchor, parent)) {
47
36
  parent.insertBefore(node, anchor);
48
37
  return;
49
38
  }
50
- if (node === anchor || node.nextSibling === anchor) return;
51
- if (anchor === null || (node.compareDocumentPosition(anchor) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0) {
52
- let cursor = node.nextSibling;
53
- while (cursor !== anchor) {
54
- const next = cursor.nextSibling;
55
- parent.insertBefore(cursor, node);
56
- cursor = next;
57
- }
58
- } else {
59
- const end = node.nextSibling;
60
- let cursor = anchor;
61
- while (cursor !== node) {
62
- const next = cursor.nextSibling;
63
- parent.insertBefore(cursor, end);
64
- cursor = next;
39
+ if (node === anchor || nextOf(node) === anchor) return;
40
+ const forward = anchor === null || // 4 is Node.DOCUMENT_POSITION_FOLLOWING.
41
+ (nodeProto(node).compareDocumentPosition.call(node, anchor) & 4) !== 0;
42
+ const siblings = [];
43
+ for (let cursor = forward ? nextOf(node) : anchor; cursor !== null && cursor !== (forward ? anchor : node); cursor = nextOf(cursor))
44
+ siblings.push(cursor);
45
+ const rotate = move ?? parent.insertBefore;
46
+ let after = node;
47
+ for (let i = 0; i < siblings.length; i++) {
48
+ const sibling = siblings[i];
49
+ if (!isChildOf(sibling, parent)) continue;
50
+ if (forward) rotate.call(parent, sibling, node);
51
+ else {
52
+ rotate.call(parent, sibling, nextOf(after));
53
+ if (isChildOf(sibling, parent)) after = sibling;
65
54
  }
66
55
  }
67
56
  }
57
+ let NODE_PROTO;
58
+ let parentNodeGetter;
59
+ let nextSiblingGetter;
60
+ function nodeProto(node) {
61
+ if (NODE_PROTO === void 0) {
62
+ let proto = Object.getPrototypeOf(node);
63
+ while (!Object.prototype.hasOwnProperty.call(proto, "nextSibling"))
64
+ proto = Object.getPrototypeOf(proto);
65
+ NODE_PROTO = proto;
66
+ }
67
+ return NODE_PROTO;
68
+ }
69
+ function nodeGetter(node, name) {
70
+ return Object.getOwnPropertyDescriptor(nodeProto(node), name).get;
71
+ }
72
+ function isChildOf(node, parent) {
73
+ parentNodeGetter ??= nodeGetter(node, "parentNode");
74
+ return parentNodeGetter.call(node) === parent;
75
+ }
76
+ function nextOf(node) {
77
+ nextSiblingGetter ??= nodeGetter(node, "nextSibling");
78
+ return nextSiblingGetter.call(node);
79
+ }
80
+ function nativeMove(parent) {
81
+ if (parent.isConnected !== true) return null;
82
+ const move = parent.moveBefore;
83
+ return typeof move === "function" ? move : null;
84
+ }
85
+ function containsFocus(node, focused) {
86
+ if (node === focused) return true;
87
+ if (focused === null || node.nodeType !== 1) return false;
88
+ let candidate = focused;
89
+ do {
90
+ if (nodeProto(node).contains.call(node, candidate)) return true;
91
+ const root = candidate.getRootNode();
92
+ candidate = root.nodeType === 11 ? root.host : void 0;
93
+ } while (candidate !== void 0);
94
+ return false;
95
+ }
68
96
  // Annotate the CommonJS export names for ESM import in node:
69
97
  0 && (module.exports = {
98
+ isChildOf,
70
99
  moveNativeNodeBefore
71
100
  });
@@ -24,6 +24,7 @@ __export(dom_tables_exports, {
24
24
  MATHML_ONLY_TAGS: () => MATHML_ONLY_TAGS,
25
25
  MUST_USE_PROPERTY_PROPS: () => MUST_USE_PROPERTY_PROPS,
26
26
  POSITIVE_NUMERIC_ATTR_PROPS: () => POSITIVE_NUMERIC_ATTR_PROPS,
27
+ RAW_TEXT_CONTENT: () => RAW_TEXT_CONTENT,
27
28
  READ_ONLY_VALUE_INPUT_TYPES: () => READ_ONLY_VALUE_INPUT_TYPES,
28
29
  SVG_ONLY_TAGS: () => SVG_ONLY_TAGS,
29
30
  VOID_ELEMENTS: () => VOID_ELEMENTS,
@@ -50,6 +51,18 @@ const VOID_ELEMENTS = /* @__PURE__ */ new Set([
50
51
  "track",
51
52
  "wbr"
52
53
  ]);
54
+ const RAW_TEXT_CONTENT = /* @__PURE__ */ new Set([
55
+ "textarea",
56
+ "title",
57
+ "script",
58
+ "style",
59
+ "xmp",
60
+ "iframe",
61
+ "noembed",
62
+ "noframes",
63
+ "noscript",
64
+ "plaintext"
65
+ ]);
53
66
  const READ_ONLY_VALUE_INPUT_TYPES = /* @__PURE__ */ new Set([
54
67
  "button",
55
68
  "checkbox",
@@ -418,6 +431,7 @@ function isEnumeratedBooleanAttr(name) {
418
431
  MATHML_ONLY_TAGS,
419
432
  MUST_USE_PROPERTY_PROPS,
420
433
  POSITIVE_NUMERIC_ATTR_PROPS,
434
+ RAW_TEXT_CONTENT,
421
435
  READ_ONLY_VALUE_INPUT_TYPES,
422
436
  SVG_ONLY_TAGS,
423
437
  VOID_ELEMENTS,
@@ -1085,6 +1085,49 @@ function formatClientError(code, ...args) {
1085
1085
  );
1086
1086
  case 350:
1087
1087
  return (0, import_error_message.formatDevErrorMessage)("__runOnCatch must be called from an active catch arm.", args);
1088
+ case 351:
1089
+ return (0, import_error_message.formatDevErrorMessage)("Cannot register behavior on a disposed behavior root.", args);
1090
+ case 352:
1091
+ return (0, import_error_message.formatDevErrorMessage)(
1092
+ "%s must belong to the behavior root container and document.",
1093
+ args
1094
+ );
1095
+ case 353:
1096
+ return (0, import_error_message.formatDevErrorMessage)("Behavior event names must be non-empty strings.", args);
1097
+ case 354:
1098
+ return (0, import_error_message.formatDevErrorMessage)(
1099
+ "A behavior entry requires an adopt(element, context) function.",
1100
+ args
1101
+ );
1102
+ case 355:
1103
+ return (0, import_error_message.formatDevErrorMessage)("A behavior with identity %s is already registered.", args);
1104
+ case 356:
1105
+ return (0, import_error_message.formatDevErrorMessage)("Behavior dependency %s is not registered.", args);
1106
+ case 357:
1107
+ return (0, import_error_message.formatDevErrorMessage)(
1108
+ "The requested behavior conflicts with an existing behavior registration.",
1109
+ args
1110
+ );
1111
+ case 358:
1112
+ return (0, import_error_message.formatDevErrorMessage)(
1113
+ "An external range requires an explicit owner identity.",
1114
+ args
1115
+ );
1116
+ case 359:
1117
+ return (0, import_error_message.formatDevErrorMessage)(
1118
+ "External ownership conflict: pass replace: true to hand this range off.",
1119
+ args
1120
+ );
1121
+ case 360:
1122
+ return (0, import_error_message.formatDevErrorMessage)(
1123
+ "A behavior root requires an element with an owner document.",
1124
+ args
1125
+ );
1126
+ case 361:
1127
+ return (0, import_error_message.formatDevErrorMessage)(
1128
+ "This container already has a behavior root; pass replace: true to replace it.",
1129
+ args
1130
+ );
1088
1131
  default:
1089
1132
  return (0, import_error_message.formatUnknownDevErrorMessage)(code);
1090
1133
  }
@@ -767,6 +767,49 @@ function formatServerError(code, ...args) {
767
767
  );
768
768
  case 350:
769
769
  return (0, import_error_message.formatDevErrorMessage)("__runOnCatch must be called from an active catch arm.", args);
770
+ case 351:
771
+ return (0, import_error_message.formatDevErrorMessage)("Cannot register behavior on a disposed behavior root.", args);
772
+ case 352:
773
+ return (0, import_error_message.formatDevErrorMessage)(
774
+ "%s must belong to the behavior root container and document.",
775
+ args
776
+ );
777
+ case 353:
778
+ return (0, import_error_message.formatDevErrorMessage)("Behavior event names must be non-empty strings.", args);
779
+ case 354:
780
+ return (0, import_error_message.formatDevErrorMessage)(
781
+ "A behavior entry requires an adopt(element, context) function.",
782
+ args
783
+ );
784
+ case 355:
785
+ return (0, import_error_message.formatDevErrorMessage)("A behavior with identity %s is already registered.", args);
786
+ case 356:
787
+ return (0, import_error_message.formatDevErrorMessage)("Behavior dependency %s is not registered.", args);
788
+ case 357:
789
+ return (0, import_error_message.formatDevErrorMessage)(
790
+ "The requested behavior conflicts with an existing behavior registration.",
791
+ args
792
+ );
793
+ case 358:
794
+ return (0, import_error_message.formatDevErrorMessage)(
795
+ "An external range requires an explicit owner identity.",
796
+ args
797
+ );
798
+ case 359:
799
+ return (0, import_error_message.formatDevErrorMessage)(
800
+ "External ownership conflict: pass replace: true to hand this range off.",
801
+ args
802
+ );
803
+ case 360:
804
+ return (0, import_error_message.formatDevErrorMessage)(
805
+ "A behavior root requires an element with an owner document.",
806
+ args
807
+ );
808
+ case 361:
809
+ return (0, import_error_message.formatDevErrorMessage)(
810
+ "This container already has a behavior root; pass replace: true to replace it.",
811
+ args
812
+ );
770
813
  default:
771
814
  return (0, import_error_message.formatUnknownDevErrorMessage)(code);
772
815
  }
@@ -77,7 +77,7 @@ function unpatchedHTML(pass, el, next) {
77
77
  let client;
78
78
  if (el.localName === "script") {
79
79
  server = el.textContent ?? "";
80
- client = next.replace(
80
+ client = String(next).replace(
81
81
  INLINE_SCRIPT_TOKEN,
82
82
  (_match, prefix, s, suffix) => `${prefix}${s === "s" ? "\\u0073" : "\\u0053"}${suffix}`
83
83
  ).replace(SCRIPT_DATA_NORMALIZATION, (match) => match === "\0" ? "\uFFFD" : "\n");
@@ -9,9 +9,9 @@ var __export = (target, all) => {
9
9
  };
10
10
  var __copyProps = (to, from, except, desc) => {
11
11
  if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key2 of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key2) && key2 !== except)
14
- __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
15
  }
16
16
  return to;
17
17
  };
@@ -26,21 +26,8 @@ module.exports = __toCommonJS(independent_hydration_protocol_exports);
26
26
  var import_error_message_no_arguments = require("./error-message-no-arguments.cjs");
27
27
  var import_data_encoding = require("./data-encoding.cjs");
28
28
  const __octaneDev = process.env.NODE_ENV !== "production";
29
- function plainRecord(value) {
30
- if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
31
- const prototype = Object.getPrototypeOf(value);
32
- if (prototype !== Object.prototype && prototype !== null) return false;
33
- return Reflect.ownKeys(value).every((key2) => {
34
- if (typeof key2 !== "string") return false;
35
- const descriptor = Object.getOwnPropertyDescriptor(value, key2);
36
- return descriptor.enumerable && "value" in descriptor;
37
- });
38
- }
39
- function key(value) {
40
- return typeof value === "string" && value.length > 0 && value.length <= 1024;
41
- }
42
29
  function uniqueKeys(value) {
43
- return Array.isArray(value) && value.every(key) && new Set(value).size === value.length;
30
+ return Array.isArray(value) && value.every(import_data_encoding.isKey) && new Set(value).size === value.length;
44
31
  }
45
32
  function captures(value, count) {
46
33
  if (!Array.isArray(value) || value.length !== count) return false;
@@ -52,7 +39,7 @@ function captures(value, count) {
52
39
  }
53
40
  }
54
41
  function isIndependentHydrateManifest(value) {
55
- if (!plainRecord(value)) return false;
42
+ if (!(0, import_data_encoding.isRecord)(value)) return false;
56
43
  const allowed = /* @__PURE__ */ new Set([
57
44
  "version",
58
45
  "buildId",
@@ -68,12 +55,12 @@ function isIndependentHydrateManifest(value) {
68
55
  "parentDependencies"
69
56
  ]);
70
57
  if (!Object.keys(value).every((name) => allowed.has(name))) return false;
71
- if (value["version"] !== 1 || !key(value["buildId"]) || !key(value["boundaryId"]) || !key(value["moduleId"]) || !key(value["exportName"]) || !Number.isSafeInteger(value["hookSeed"]) || value["hookSeed"] < 0 || !Number.isSafeInteger(value["idSeed"]) || value["idSeed"] < 0 || value["parentDependencies"] !== false || !uniqueKeys(value["signalSites"]) || !uniqueKeys(value["styles"]) || !Array.isArray(value["captureSchema"])) {
58
+ if (value["version"] !== 1 || !(0, import_data_encoding.isKey)(value["buildId"]) || !(0, import_data_encoding.isKey)(value["boundaryId"]) || !(0, import_data_encoding.isKey)(value["moduleId"]) || !(0, import_data_encoding.isKey)(value["exportName"]) || !Number.isSafeInteger(value["hookSeed"]) || value["hookSeed"] < 0 || !Number.isSafeInteger(value["idSeed"]) || value["idSeed"] < 0 || value["parentDependencies"] !== false || !uniqueKeys(value["signalSites"]) || !uniqueKeys(value["styles"]) || !Array.isArray(value["captureSchema"])) {
72
59
  return false;
73
60
  }
74
61
  const names = /* @__PURE__ */ new Set();
75
62
  for (const capture of value["captureSchema"]) {
76
- if (!plainRecord(capture) || Object.keys(capture).length !== 2 || !key(capture["name"]) || capture["type"] !== "json" || names.has(capture["name"])) {
63
+ if (!(0, import_data_encoding.isRecord)(capture) || Object.keys(capture).length !== 2 || !(0, import_data_encoding.isKey)(capture["name"]) || capture["type"] !== "json" || names.has(capture["name"])) {
77
64
  return false;
78
65
  }
79
66
  names.add(capture["name"]);
@@ -44,6 +44,7 @@ __export(index_exports, {
44
44
  __runOnCatch: () => import_runtime.__runOnCatch,
45
45
  __s: () => import_runtime.markSingleRoot,
46
46
  __serverRpc: () => import_server_rpc_client.__serverRpc,
47
+ __serverRpcStream: () => import_server_rpc_client.__serverRpcStream,
47
48
  __useCommittedState: () => import_runtime.__useCommittedState,
48
49
  __useLinkedStateWithGetter: () => import_runtime.__useLinkedStateWithGetter,
49
50
  __useReducerWithGetter: () => import_runtime.__useReducerWithGetter,
@@ -302,6 +303,7 @@ var import_method_dep = require("./method-dep.cjs");
302
303
  __runOnCatch,
303
304
  __s,
304
305
  __serverRpc,
306
+ __serverRpcStream,
305
307
  __useCommittedState,
306
308
  __useLinkedStateWithGetter,
307
309
  __useReducerWithGetter,
@@ -18,7 +18,8 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var radio_group_exports = {};
20
20
  __export(radio_group_exports, {
21
- radioGroupCandidates: () => radioGroupCandidates
21
+ radioGroupCandidates: () => radioGroupCandidates,
22
+ toControlledString: () => toControlledString
22
23
  });
23
24
  module.exports = __toCommonJS(radio_group_exports);
24
25
  function radioGroupCandidates(input) {
@@ -33,7 +34,11 @@ function radioGroupCandidates(input) {
33
34
  if (root === input) return [input];
34
35
  return root.nodeType === 9 ? root.getElementsByName(name) : root.querySelectorAll('input[type="radio"]');
35
36
  }
37
+ function toControlledString(value) {
38
+ return typeof value === "string" ? value : typeof value === "function" || typeof value === "symbol" ? "" : String(value);
39
+ }
36
40
  // Annotate the CommonJS export names for ESM import in node:
37
41
  0 && (module.exports = {
38
- radioGroupCandidates
42
+ radioGroupCandidates,
43
+ toControlledString
39
44
  });