octane 0.2.11 → 0.2.13

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 (264) hide show
  1. package/README.md +5 -0
  2. package/dist/behavior-root.d.ts +13 -3
  3. package/dist/behavior-root.js +28 -5
  4. package/dist/cjs/behavior-root.cjs +32 -6
  5. package/dist/cjs/class-names.cjs +49 -0
  6. package/dist/cjs/constants.cjs +9 -0
  7. package/dist/cjs/context-epoch.cjs +38 -0
  8. package/dist/cjs/css.cjs +6 -27
  9. package/dist/cjs/data-encoding.cjs +160 -0
  10. package/dist/cjs/dom-binding-handoff.cjs +93 -0
  11. package/dist/cjs/dom-binding-protocol.cjs +115 -0
  12. package/dist/cjs/dom-binding-styles.cjs +292 -0
  13. package/dist/cjs/dom-bindings.cjs +700 -0
  14. package/dist/cjs/dom-focused-move.cjs +66 -0
  15. package/dist/cjs/dom-stage.cjs +896 -0
  16. package/dist/cjs/dom-tables.cjs +4 -94
  17. package/dist/cjs/error-codes.client.generated.cjs +33 -0
  18. package/dist/cjs/error-codes.server.generated.cjs +24 -0
  19. package/dist/cjs/hydration/control-capture.cjs +244 -0
  20. package/dist/cjs/hydration/event-capture.cjs +125 -43
  21. package/dist/cjs/hydration/interaction-config.cjs +50 -2
  22. package/dist/cjs/hydration-markers.cjs +37 -0
  23. package/dist/cjs/independent-hydration-protocol.cjs +106 -0
  24. package/dist/cjs/index.cjs +9 -0
  25. package/dist/cjs/runtime.cjs +6397 -1683
  26. package/dist/cjs/runtime.server.cjs +1465 -213
  27. package/dist/cjs/server/early-signals.cjs +45 -0
  28. package/dist/cjs/server/index.cjs +47 -0
  29. package/dist/cjs/server/rpc-batch.cjs +149 -0
  30. package/dist/cjs/server/rpc-stream.cjs +146 -0
  31. package/dist/cjs/server/rpc.cjs +34 -15
  32. package/dist/cjs/server/signal-query-observation.cjs +158 -0
  33. package/dist/cjs/server/streamed-region.cjs +52 -0
  34. package/dist/cjs/server/streamed-signals.cjs +512 -0
  35. package/dist/cjs/server-call.cjs +103 -0
  36. package/dist/cjs/server-rpc-batch-client.cjs +141 -0
  37. package/dist/cjs/server-rpc-client.cjs +94 -27
  38. package/dist/cjs/server-rpc-protocol.cjs +141 -0
  39. package/dist/cjs/server-rpc-stream-client.cjs +118 -0
  40. package/dist/cjs/signals/actions.cjs +474 -0
  41. package/dist/cjs/signals/client.cjs +4 -1
  42. package/dist/cjs/signals/computations.cjs +460 -0
  43. package/dist/cjs/signals/control-binding.cjs +368 -0
  44. package/dist/cjs/signals/derived-facade.cjs +50 -0
  45. package/dist/cjs/signals/document-owner.cjs +71 -0
  46. package/dist/cjs/signals/early-values.cjs +155 -0
  47. package/dist/cjs/signals/encoding.cjs +6 -95
  48. package/dist/cjs/signals/engine.cjs +276 -12
  49. package/dist/cjs/signals/errors.cjs +18 -0
  50. package/dist/cjs/signals/facade.cjs +477 -0
  51. package/dist/cjs/signals/graph.cjs +166 -20
  52. package/dist/cjs/signals/handle-protocol.cjs +36 -0
  53. package/dist/cjs/signals/index.cjs +81 -2
  54. package/dist/cjs/signals/native-read-client.cjs +10 -0
  55. package/dist/cjs/signals/owner-context.cjs +112 -0
  56. package/dist/cjs/signals/query-attempt-observer.cjs +68 -0
  57. package/dist/cjs/signals/query-facade.cjs +72 -0
  58. package/dist/cjs/signals/read-protocol.cjs +54 -0
  59. package/dist/cjs/signals/requests.cjs +287 -14
  60. package/dist/cjs/signals/scalar-computations.cjs +76 -0
  61. package/dist/cjs/signals/server.cjs +4 -1
  62. package/dist/cjs/signals/transition-candidate.cjs +567 -0
  63. package/dist/cjs/signals/transition-state.cjs +106 -0
  64. package/dist/cjs/signals/types.cjs +50 -0
  65. package/dist/cjs/stream-protocol.cjs +3 -0
  66. package/dist/cjs/streamed-signals-protocol.cjs +159 -0
  67. package/dist/cjs/style-values.cjs +122 -0
  68. package/dist/cjs/trusted-html.cjs +30 -0
  69. package/dist/cjs/version.cjs +1 -1
  70. package/dist/class-names.d.ts +5 -0
  71. package/dist/class-names.js +25 -0
  72. package/dist/compiler/bundler.js +51 -22
  73. package/dist/compiler/compile.js +2534 -581
  74. package/dist/compiler/dom-binding-program.js +935 -0
  75. package/dist/compiler/dom-binding-request.js +57 -0
  76. package/dist/compiler/dom-bindings.js +2245 -0
  77. package/dist/compiler/hook-deps.js +759 -10
  78. package/dist/compiler/hydrate-boundaries.js +358 -15
  79. package/dist/compiler/index.d.ts +39 -2
  80. package/dist/compiler/index.js +1 -0
  81. package/dist/compiler/native-attribute-reads.js +127 -0
  82. package/dist/compiler/native-change-diagnostics.js +32 -38
  83. package/dist/compiler/native-read-diagnostics.js +69 -8
  84. package/dist/compiler/native-read-types.js +80 -34
  85. package/dist/compiler/parser.node.js +1 -1
  86. package/dist/compiler/renderer-boundaries.js +40 -0
  87. package/dist/compiler/server-context.js +118 -0
  88. package/dist/compiler/signal-attempt-reads.js +479 -0
  89. package/dist/compiler/signal-declarations.js +557 -0
  90. package/dist/compiler/signal-start-reads.js +413 -0
  91. package/dist/compiler/slot-hooks.d.ts +3 -1
  92. package/dist/compiler/slot-hooks.js +168 -34
  93. package/dist/compiler/strong-auto-memo.js +90 -0
  94. package/dist/compiler/strong-html.js +143 -0
  95. package/dist/compiler/strong-mode.js +764 -66
  96. package/dist/compiler/strong-template-policy.js +307 -0
  97. package/dist/compiler/template-ir.js +200 -0
  98. package/dist/compiler/typescript.d.ts +2 -0
  99. package/dist/compiler/typescript.js +2 -0
  100. package/dist/compiler/vite.d.ts +3 -1
  101. package/dist/compiler/vite.js +122 -4
  102. package/dist/compiler/volar.LICENSES.txt +1 -1
  103. package/dist/compiler/volar.d.ts +6 -1
  104. package/dist/compiler/volar.js +750 -1433
  105. package/dist/constants.d.ts +1 -0
  106. package/dist/constants.js +10 -0
  107. package/dist/context-epoch.d.ts +2 -0
  108. package/dist/context-epoch.js +13 -0
  109. package/dist/css.d.ts +2 -5
  110. package/dist/css.js +2 -23
  111. package/dist/data-encoding.d.ts +9 -0
  112. package/dist/data-encoding.js +134 -0
  113. package/dist/dom-binding-classes.d.ts +15 -0
  114. package/dist/dom-binding-classes.js +129 -0
  115. package/dist/dom-binding-controls.d.ts +2 -0
  116. package/dist/dom-binding-controls.js +6 -0
  117. package/dist/dom-binding-handoff.d.ts +55 -0
  118. package/dist/dom-binding-handoff.js +62 -0
  119. package/dist/dom-binding-program.d.ts +300 -0
  120. package/dist/dom-binding-program.js +1625 -0
  121. package/dist/dom-binding-projections.d.ts +15 -0
  122. package/dist/dom-binding-projections.js +187 -0
  123. package/dist/dom-binding-protocol.d.ts +13 -0
  124. package/dist/dom-binding-protocol.js +88 -0
  125. package/dist/dom-binding-signals.d.ts +21 -0
  126. package/dist/dom-binding-signals.js +109 -0
  127. package/dist/dom-binding-styles.d.ts +17 -0
  128. package/dist/dom-binding-styles.js +272 -0
  129. package/dist/dom-bindings.d.ts +89 -0
  130. package/dist/dom-bindings.js +670 -0
  131. package/dist/dom-focused-move.d.ts +6 -0
  132. package/dist/dom-focused-move.js +42 -0
  133. package/dist/dom-stage.d.ts +52 -0
  134. package/dist/dom-stage.js +872 -0
  135. package/dist/dom-tables.d.ts +1 -3
  136. package/dist/dom-tables.js +1 -91
  137. package/dist/error-codes.client.generated.d.ts +9 -0
  138. package/dist/error-codes.client.generated.js +33 -0
  139. package/dist/error-codes.server.generated.d.ts +6 -0
  140. package/dist/error-codes.server.generated.js +24 -0
  141. package/dist/hydration/control-capture.d.ts +62 -0
  142. package/dist/hydration/control-capture.js +223 -0
  143. package/dist/hydration/document-lifecycle.d.ts +23 -0
  144. package/dist/hydration/document-lifecycle.js +80 -0
  145. package/dist/hydration/event-capture.d.ts +20 -1
  146. package/dist/hydration/event-capture.js +128 -42
  147. package/dist/hydration/independent-island.d.ts +45 -0
  148. package/dist/hydration/independent-island.js +233 -0
  149. package/dist/hydration/index.d.ts +8 -1
  150. package/dist/hydration/index.js +55 -1
  151. package/dist/hydration/interaction-config.d.ts +5 -0
  152. package/dist/hydration/interaction-config.js +44 -1
  153. package/dist/hydration/stream-delivery.d.ts +32 -0
  154. package/dist/hydration/stream-delivery.js +333 -0
  155. package/dist/hydration/stream-receiver.d.ts +26 -0
  156. package/dist/hydration/stream-receiver.js +204 -0
  157. package/dist/hydration/stream-result-receiver.d.ts +70 -0
  158. package/dist/hydration/stream-result-receiver.js +246 -0
  159. package/dist/hydration/streamed-signals.d.ts +44 -0
  160. package/dist/hydration/streamed-signals.js +186 -0
  161. package/dist/hydration/types.d.ts +6 -0
  162. package/dist/hydration-markers.d.ts +7 -0
  163. package/dist/hydration-markers.js +10 -0
  164. package/dist/independent-hydration-protocol.d.ts +31 -0
  165. package/dist/independent-hydration-protocol.js +80 -0
  166. package/dist/index.d.ts +3 -0
  167. package/dist/index.js +6 -0
  168. package/dist/internal/signal-read.d.ts +1 -0
  169. package/dist/internal/signal-read.js +4 -0
  170. package/dist/jsx-runtime-strong.d.ts +33 -0
  171. package/dist/jsx-runtime.d.ts +58 -2
  172. package/dist/public-types.d.ts +15 -1
  173. package/dist/runtime.d.ts +297 -23
  174. package/dist/runtime.js +6405 -1679
  175. package/dist/runtime.server.d.ts +110 -27
  176. package/dist/runtime.server.js +1458 -213
  177. package/dist/server/early-signals.d.ts +14 -0
  178. package/dist/server/early-signals.js +34 -0
  179. package/dist/server/index.d.ts +11 -2
  180. package/dist/server/index.js +50 -1
  181. package/dist/server/rpc-batch.d.ts +17 -0
  182. package/dist/server/rpc-batch.js +129 -0
  183. package/dist/server/rpc-stream.d.ts +9 -0
  184. package/dist/server/rpc-stream.js +125 -0
  185. package/dist/server/rpc.d.ts +5 -1
  186. package/dist/server/rpc.js +37 -13
  187. package/dist/server/signal-query-observation.d.ts +3 -0
  188. package/dist/server/signal-query-observation.js +134 -0
  189. package/dist/server/streamed-region.d.ts +15 -0
  190. package/dist/server/streamed-region.js +30 -0
  191. package/dist/server/streamed-signals.d.ts +45 -0
  192. package/dist/server/streamed-signals.js +488 -0
  193. package/dist/server-call.d.ts +41 -0
  194. package/dist/server-call.js +75 -0
  195. package/dist/server-rpc-batch-client.d.ts +7 -0
  196. package/dist/server-rpc-batch-client.js +119 -0
  197. package/dist/server-rpc-client.d.ts +3 -1
  198. package/dist/server-rpc-client.js +99 -27
  199. package/dist/server-rpc-protocol.d.ts +47 -0
  200. package/dist/server-rpc-protocol.js +109 -0
  201. package/dist/server-rpc-stream-client.d.ts +5 -0
  202. package/dist/server-rpc-stream-client.js +98 -0
  203. package/dist/signals/actions.d.ts +12 -0
  204. package/dist/signals/actions.js +466 -0
  205. package/dist/signals/client.d.ts +2 -0
  206. package/dist/signals/client.js +1 -0
  207. package/dist/signals/computations.d.ts +37 -0
  208. package/dist/signals/computations.js +455 -0
  209. package/dist/signals/control-binding.d.ts +31 -0
  210. package/dist/signals/control-binding.js +353 -0
  211. package/dist/signals/derived-facade.d.ts +3 -0
  212. package/dist/signals/derived-facade.js +25 -0
  213. package/dist/signals/document-owner.d.ts +10 -0
  214. package/dist/signals/document-owner.js +43 -0
  215. package/dist/signals/early-values.d.ts +24 -0
  216. package/dist/signals/early-values.js +124 -0
  217. package/dist/signals/encoding.d.ts +1 -3
  218. package/dist/signals/encoding.js +3 -93
  219. package/dist/signals/engine.d.ts +53 -4
  220. package/dist/signals/engine.js +275 -16
  221. package/dist/signals/errors.d.ts +7 -0
  222. package/dist/signals/errors.js +16 -0
  223. package/dist/signals/facade.d.ts +74 -0
  224. package/dist/signals/facade.js +452 -0
  225. package/dist/signals/graph.d.ts +52 -6
  226. package/dist/signals/graph.js +174 -19
  227. package/dist/signals/handle-protocol.d.ts +4 -0
  228. package/dist/signals/handle-protocol.js +11 -0
  229. package/dist/signals/index.d.ts +12 -3
  230. package/dist/signals/index.js +71 -2
  231. package/dist/signals/native-read-client.d.ts +3 -0
  232. package/dist/signals/native-read-client.js +10 -0
  233. package/dist/signals/owner-context.d.ts +22 -0
  234. package/dist/signals/owner-context.js +77 -0
  235. package/dist/signals/query-attempt-observer.d.ts +49 -0
  236. package/dist/signals/query-attempt-observer.js +41 -0
  237. package/dist/signals/query-facade.d.ts +3 -0
  238. package/dist/signals/query-facade.js +49 -0
  239. package/dist/signals/read-protocol.d.ts +37 -2
  240. package/dist/signals/read-protocol.js +44 -0
  241. package/dist/signals/requests.d.ts +38 -5
  242. package/dist/signals/requests.js +298 -15
  243. package/dist/signals/scalar-computations.d.ts +2 -0
  244. package/dist/signals/scalar-computations.js +60 -0
  245. package/dist/signals/server.d.ts +2 -0
  246. package/dist/signals/server.js +1 -0
  247. package/dist/signals/transition-candidate.d.ts +71 -0
  248. package/dist/signals/transition-candidate.js +557 -0
  249. package/dist/signals/transition-state.d.ts +51 -0
  250. package/dist/signals/transition-state.js +70 -0
  251. package/dist/signals/types.d.ts +95 -5
  252. package/dist/signals/types.js +20 -0
  253. package/dist/stream-protocol.d.ts +0 -5
  254. package/dist/stream-protocol.js +3 -0
  255. package/dist/streamed-signals-protocol.d.ts +60 -0
  256. package/dist/streamed-signals-protocol.js +130 -0
  257. package/dist/style-values.d.ts +3 -0
  258. package/dist/style-values.js +96 -0
  259. package/dist/trusted-html.d.ts +17 -0
  260. package/dist/trusted-html.js +6 -0
  261. package/dist/universal-core.d.ts +6 -0
  262. package/dist/universal-core.js +214 -202
  263. package/dist/version.js +1 -1
  264. package/package.json +48 -5
@@ -18,12 +18,20 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var event_capture_exports = {};
20
20
  __export(event_capture_exports, {
21
- HYDRATE_SUPPORTED_INTERACTION_EVENTS: () => HYDRATE_SUPPORTED_INTERACTION_EVENTS,
21
+ HYDRATE_SUPPORTED_INTERACTION_EVENTS: () => import_interaction_config2.HYDRATE_SUPPORTED_INTERACTION_EVENTS,
22
+ appendHydrationReplayIntent: () => appendHydrationReplayIntent,
23
+ applyHydrationControlCandidate: () => import_control_capture2.applyHydrationControlCandidate,
24
+ captureHydrationControlCandidate: () => import_control_capture2.captureHydrationControlCandidate,
25
+ consumeHydrationControl: () => import_control_capture2.consumeHydrationControl,
22
26
  hydrationEventPathWithin: () => hydrationEventPathWithin,
27
+ hydrationMarkerInteractionStatus: () => hydrationMarkerInteractionStatus,
23
28
  initializeHydrationEventCapture: () => initializeHydrationEventCapture,
29
+ initializeIndependentHydrationEventCapture: () => initializeIndependentHydrationEventCapture,
30
+ isHydrationSelectionIntentCurrent: () => isHydrationSelectionIntentCurrent,
24
31
  markDelegatedDynamicHydrationIntent: () => markDelegatedDynamicHydrationIntent,
25
32
  registerHydrationIntentBoundary: () => registerHydrationIntentBoundary,
26
33
  shouldPreventHydrationInteractionDefault: () => shouldPreventHydrationInteractionDefault,
34
+ snapshotHydrationControl: () => import_control_capture2.snapshotHydrationControl,
27
35
  takeDelegatedDynamicHydrationIntent: () => takeDelegatedDynamicHydrationIntent,
28
36
  takePendingHydrationIntents: () => takePendingHydrationIntents,
29
37
  unregisterHydrationIntentBoundary: () => unregisterHydrationIntentBoundary,
@@ -31,7 +39,12 @@ __export(event_capture_exports, {
31
39
  });
32
40
  module.exports = __toCommonJS(event_capture_exports);
33
41
  var import_interaction_config = require("./interaction-config.cjs");
42
+ var import_hydration_markers = require("../hydration-markers.cjs");
43
+ var import_dom_binding_handoff = require("../dom-binding-handoff.cjs");
44
+ var import_control_capture = require("./control-capture.cjs");
45
+ var import_control_capture2 = require("./control-capture.cjs");
34
46
  var import_stream_protocol = require("../stream-protocol.cjs");
47
+ var import_interaction_config2 = require("./interaction-config.cjs");
35
48
  const HYDRATE_MARKER_SELECTOR = "[data-octane-hydrate-id]";
36
49
  const HYDRATE_WHEN_ATTR = "data-octane-hydrate-when";
37
50
  function isHydrationNode(target) {
@@ -40,44 +53,39 @@ function isHydrationNode(target) {
40
53
  function isHydrationElement(target) {
41
54
  return isHydrationNode(target) && target.nodeType === 1;
42
55
  }
43
- const HYDRATE_SUPPORTED_INTERACTION_EVENTS = [
44
- "auxclick",
45
- "beforeinput",
46
- "click",
47
- "compositionend",
48
- "compositionstart",
49
- "compositionupdate",
50
- "contextmenu",
51
- "dblclick",
52
- "focusin",
53
- "input",
54
- "keydown",
55
- "keyup",
56
- "mousedown",
57
- "mouseenter",
58
- "mouseover",
59
- "mouseup",
60
- "pointerdown",
61
- "pointerenter",
62
- "pointerover",
63
- "pointerup",
64
- "touchend",
65
- "touchstart"
66
- ];
67
56
  function shouldPreventHydrationInteractionDefault(event) {
68
- switch (event.type) {
69
- case "beforeinput":
70
- case "compositionend":
71
- case "compositionstart":
72
- case "compositionupdate":
73
- case "input":
74
- case "mousedown":
75
- case "pointerdown":
76
- case "touchend":
77
- case "touchstart":
78
- return false;
79
- default:
80
- return event.cancelable;
57
+ return event.cancelable && !import_interaction_config.HYDRATE_NATIVE_DEFAULT_INTERACTION_EVENTS.includes(event.type);
58
+ }
59
+ let independentIntentSequences;
60
+ function advanceIndependentIntentSequence(ownerDocument) {
61
+ const sequence = (independentIntentSequences?.get(ownerDocument) ?? 0) + 1;
62
+ (independentIntentSequences ??= /* @__PURE__ */ new WeakMap()).set(ownerDocument, sequence);
63
+ return sequence;
64
+ }
65
+ function captureHydrationSelectionIntent(event, target, boundary, sequence) {
66
+ const click = event;
67
+ if (event.type !== "click" || click.button !== 0 || click.altKey || click.ctrlKey || click.metaKey || click.shiftKey)
68
+ return;
69
+ const control = target.closest(`button[${import_interaction_config.HYDRATE_SELECTION_ATTR}]`);
70
+ if (control === null || control.type !== "button" || control.closest(`[${import_hydration_markers.HYDRATE_INDEPENDENT_ATTR}]`) !== boundary)
71
+ return;
72
+ const group = control.getAttribute(import_interaction_config.HYDRATE_SELECTION_ATTR);
73
+ if (!group) return;
74
+ return { control, boundary, group, sequence };
75
+ }
76
+ function isHydrationSelectionIntentCurrent(intent) {
77
+ const selection = intent.selection;
78
+ if (selection === void 0) return true;
79
+ const { control, boundary, group } = selection;
80
+ return isHydrationElement(intent.event.target) && intent.event.target.isConnected && control.isConnected && boundary.isConnected && control.contains(intent.event.target) && control.type === "button" && control.getAttribute(import_interaction_config.HYDRATE_SELECTION_ATTR) === group && intent.event.target.closest(`[${import_hydration_markers.HYDRATE_INDEPENDENT_ATTR}]`) === boundary;
81
+ }
82
+ function appendHydrationReplayIntent(queue, intent) {
83
+ const selection = intent.selection;
84
+ const previous = queue[queue.length - 1];
85
+ if (selection !== void 0 && previous?.selection !== void 0 && selection.sequence === previous.selection.sequence + 1 && selection.boundary === previous.selection.boundary && selection.group === previous.selection.group && isHydrationSelectionIntentCurrent(previous)) {
86
+ queue[queue.length - 1] = intent;
87
+ } else {
88
+ queue.push(intent);
81
89
  }
82
90
  }
83
91
  const HYDRATE_BOUNDARIES = /* @__PURE__ */ new WeakMap();
@@ -85,6 +93,7 @@ const HYDRATE_PENDING_INTENTS = /* @__PURE__ */ new WeakMap();
85
93
  const HYDRATE_DELEGATED_DYNAMIC_MARKERS = /* @__PURE__ */ new WeakSet();
86
94
  const HYDRATE_HANDLED_INTENT_EVENTS = /* @__PURE__ */ new WeakSet();
87
95
  const HYDRATE_INTENT_DOCUMENTS = /* @__PURE__ */ new WeakSet();
96
+ let independentHydrationDocuments;
88
97
  function hydrationEventPathWithin(root, target) {
89
98
  if (!isHydrationNode(target)) return null;
90
99
  const streamToken = root.getAttribute(import_stream_protocol.HYDRATE_STREAM_TOKEN_ATTR);
@@ -109,6 +118,9 @@ function hydrationEventPathWithin(root, target) {
109
118
  function markerStatus(marker, eventType) {
110
119
  const boundary = HYDRATE_BOUNDARIES.get(marker);
111
120
  if (boundary !== void 0) return boundary(eventType);
121
+ return hydrationMarkerInteractionStatus(marker, eventType);
122
+ }
123
+ function hydrationMarkerInteractionStatus(marker, eventType) {
112
124
  const when = marker.getAttribute(HYDRATE_WHEN_ATTR);
113
125
  if (when === null) return "hydrated";
114
126
  if (when === "never") return "never";
@@ -118,17 +130,39 @@ function markerStatus(marker, eventType) {
118
130
  const events = custom === null ? import_interaction_config.HYDRATE_DEFAULT_INTERACTION_EVENTS : custom.split(/\s+/).filter(Boolean);
119
131
  return events.includes(eventType) ? "handles" : "dormant";
120
132
  }
121
- function handleEarlyHydrationIntent(event) {
133
+ function handleEarlyHydrationIntent(event, capturedSelection) {
122
134
  const target = event.target;
123
135
  if (!isHydrationElement(target)) return;
136
+ if ((event.type === "pointerenter" || event.type === "mouseenter") && independentHydrationDocuments?.has(target.ownerDocument)) {
137
+ const boundary = target.closest(HYDRATE_MARKER_SELECTOR);
138
+ const pointer = event;
139
+ if (boundary !== null && typeof pointer.clientX === "number" && typeof pointer.clientY === "number") {
140
+ const hit = target.ownerDocument.elementFromPoint?.(pointer.clientX, pointer.clientY);
141
+ const independent2 = hit?.closest(`[${import_hydration_markers.HYDRATE_INDEPENDENT_ATTR}]`);
142
+ if (independent2 && independent2 !== boundary && boundary.contains(independent2)) {
143
+ HYDRATE_HANDLED_INTENT_EVENTS.add(event);
144
+ return;
145
+ }
146
+ }
147
+ }
124
148
  const markers = [];
125
149
  let marker = target.closest(HYDRATE_MARKER_SELECTOR);
150
+ let independent = null;
126
151
  let matches = false;
127
152
  while (marker !== null) {
128
153
  markers.push(marker);
129
154
  matches ||= markerStatus(marker, event.type) === "handles";
155
+ if (marker.hasAttribute(import_hydration_markers.HYDRATE_INDEPENDENT_ATTR)) {
156
+ independent = marker;
157
+ HYDRATE_HANDLED_INTENT_EVENTS.add(event);
158
+ break;
159
+ }
130
160
  marker = marker.parentElement?.closest(HYDRATE_MARKER_SELECTOR) ?? null;
131
161
  }
162
+ if (independent !== null) {
163
+ const link = target.closest("a[href],area[href]");
164
+ if (link !== null && independent.contains(link)) return;
165
+ }
132
166
  if (!matches || markers.length === 0) return;
133
167
  markers.reverse();
134
168
  let candidate = null;
@@ -151,8 +185,24 @@ function handleEarlyHydrationIntent(event) {
151
185
  }
152
186
  const path = hydrationEventPathWithin(candidate, event.target);
153
187
  if (path === null) return;
154
- const intent = { event, path };
188
+ const sequence = independent !== null && capturedSelection === void 0 ? advanceIndependentIntentSequence(target.ownerDocument) : 0;
189
+ const selection = candidate === independent ? capturedSelection === void 0 ? captureHydrationSelectionIntent(event, target, candidate, sequence) : capturedSelection : void 0;
190
+ const intent = selection ? { event, path, selection } : { event, path };
155
191
  HYDRATE_HANDLED_INTENT_EVENTS.add(event);
192
+ if ((0, import_dom_binding_handoff.hasBindingHandoffEvent)(event)) {
193
+ intent.earlyBinding = true;
194
+ const activate = () => {
195
+ if (candidateBoundary !== void 0) candidateBoundary(event.type, intent);
196
+ else {
197
+ const pending = HYDRATE_PENDING_INTENTS.get(candidate) ?? [];
198
+ appendHydrationReplayIntent(pending, intent);
199
+ HYDRATE_PENDING_INTENTS.set(candidate, pending);
200
+ }
201
+ };
202
+ if (event.isTrusted) setTimeout(activate, 0);
203
+ else queueMicrotask(activate);
204
+ return;
205
+ }
156
206
  if (event.bubbles) {
157
207
  if (shouldPreventHydrationInteractionDefault(event)) event.preventDefault();
158
208
  event.stopPropagation();
@@ -162,21 +212,45 @@ function handleEarlyHydrationIntent(event) {
162
212
  candidateBoundary(event.type, intent);
163
213
  } else {
164
214
  const pending = HYDRATE_PENDING_INTENTS.get(candidate) ?? [];
165
- pending.push(intent);
215
+ appendHydrationReplayIntent(pending, intent);
166
216
  HYDRATE_PENDING_INTENTS.set(candidate, pending);
167
217
  }
168
218
  }
169
219
  function initializeHydrationEventCapture(ownerDocument) {
170
220
  const targetDocument = ownerDocument ?? (typeof document === "undefined" ? void 0 : document);
171
221
  if (targetDocument === void 0 || HYDRATE_INTENT_DOCUMENTS.has(targetDocument)) return;
222
+ const host = targetDocument;
223
+ const mailbox = host[import_interaction_config.EARLY_HYDRATION_INTENTS_KEY];
224
+ mailbox?.stop?.();
225
+ (0, import_control_capture.initializeHydrationControlCapture)(targetDocument);
226
+ const queued = mailbox?.q.splice(0);
227
+ host[import_interaction_config.EARLY_HYDRATION_INTENTS_KEY] = { version: 1, q: [], claimed: true };
228
+ if (mailbox?.overflow) {
229
+ throw new RangeError("Early independent Hydrate intent queue overflow; reload the document.");
230
+ }
172
231
  HYDRATE_INTENT_DOCUMENTS.add(targetDocument);
173
- for (let i = 0; i < HYDRATE_SUPPORTED_INTERACTION_EVENTS.length; i++) {
232
+ for (let i = 0; i < import_interaction_config.HYDRATE_SUPPORTED_INTERACTION_EVENTS.length; i++) {
174
233
  targetDocument.addEventListener(
175
- HYDRATE_SUPPORTED_INTERACTION_EVENTS[i],
234
+ import_interaction_config.HYDRATE_SUPPORTED_INTERACTION_EVENTS[i],
176
235
  handleEarlyHydrationIntent,
177
236
  true
178
237
  );
179
238
  }
239
+ if (queued !== void 0) {
240
+ for (const entry of queued) {
241
+ const [event, , boundary, , , , control, group] = entry;
242
+ const sequence = advanceIndependentIntentSequence(targetDocument);
243
+ if (!(0, import_control_capture.isEarlyHydrationIntentCurrent)(entry, targetDocument)) continue;
244
+ const selection = control === void 0 || group === void 0 ? null : { control, boundary, group, sequence };
245
+ if (selection !== null && !isHydrationSelectionIntentCurrent({ event, path: [], selection }))
246
+ continue;
247
+ handleEarlyHydrationIntent(event, selection);
248
+ }
249
+ }
250
+ }
251
+ function initializeIndependentHydrationEventCapture(ownerDocument) {
252
+ (independentHydrationDocuments ??= /* @__PURE__ */ new WeakSet()).add(ownerDocument);
253
+ initializeHydrationEventCapture(ownerDocument);
180
254
  }
181
255
  function registerHydrationIntentBoundary(marker, boundary) {
182
256
  HYDRATE_BOUNDARIES.set(marker, boundary);
@@ -201,11 +275,19 @@ function markDelegatedDynamicHydrationIntent(marker) {
201
275
  // Annotate the CommonJS export names for ESM import in node:
202
276
  0 && (module.exports = {
203
277
  HYDRATE_SUPPORTED_INTERACTION_EVENTS,
278
+ appendHydrationReplayIntent,
279
+ applyHydrationControlCandidate,
280
+ captureHydrationControlCandidate,
281
+ consumeHydrationControl,
204
282
  hydrationEventPathWithin,
283
+ hydrationMarkerInteractionStatus,
205
284
  initializeHydrationEventCapture,
285
+ initializeIndependentHydrationEventCapture,
286
+ isHydrationSelectionIntentCurrent,
206
287
  markDelegatedDynamicHydrationIntent,
207
288
  registerHydrationIntentBoundary,
208
289
  shouldPreventHydrationInteractionDefault,
290
+ snapshotHydrationControl,
209
291
  takeDelegatedDynamicHydrationIntent,
210
292
  takePendingHydrationIntents,
211
293
  unregisterHydrationIntentBoundary,
@@ -18,11 +18,54 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var interaction_config_exports = {};
20
20
  __export(interaction_config_exports, {
21
+ EARLY_HYDRATION_INTENTS_KEY: () => EARLY_HYDRATION_INTENTS_KEY,
22
+ EARLY_HYDRATION_INTENTS_LIMIT: () => EARLY_HYDRATION_INTENTS_LIMIT,
21
23
  HYDRATE_DEFAULT_INTERACTION_EVENTS: () => HYDRATE_DEFAULT_INTERACTION_EVENTS,
22
- HYDRATE_INTERACTION_EVENTS_ATTR: () => HYDRATE_INTERACTION_EVENTS_ATTR
24
+ HYDRATE_INTERACTION_EVENTS_ATTR: () => HYDRATE_INTERACTION_EVENTS_ATTR,
25
+ HYDRATE_NATIVE_DEFAULT_INTERACTION_EVENTS: () => HYDRATE_NATIVE_DEFAULT_INTERACTION_EVENTS,
26
+ HYDRATE_SELECTION_ATTR: () => HYDRATE_SELECTION_ATTR,
27
+ HYDRATE_SUPPORTED_INTERACTION_EVENTS: () => HYDRATE_SUPPORTED_INTERACTION_EVENTS
23
28
  });
24
29
  module.exports = __toCommonJS(interaction_config_exports);
25
30
  const HYDRATE_INTERACTION_EVENTS_ATTR = "data-octane-hydrate-interaction-events";
31
+ const HYDRATE_SELECTION_ATTR = "data-octane-hydrate-selection";
32
+ const EARLY_HYDRATION_INTENTS_KEY = "__octaneEarlyHydrationIntents";
33
+ const EARLY_HYDRATION_INTENTS_LIMIT = 256;
34
+ const HYDRATE_SUPPORTED_INTERACTION_EVENTS = [
35
+ "auxclick",
36
+ "beforeinput",
37
+ "click",
38
+ "compositionend",
39
+ "compositionstart",
40
+ "compositionupdate",
41
+ "contextmenu",
42
+ "dblclick",
43
+ "focusin",
44
+ "input",
45
+ "keydown",
46
+ "keyup",
47
+ "mousedown",
48
+ "mouseenter",
49
+ "mouseover",
50
+ "mouseup",
51
+ "pointerdown",
52
+ "pointerenter",
53
+ "pointerover",
54
+ "pointerup",
55
+ "touchend",
56
+ "touchstart"
57
+ ];
58
+ const HYDRATE_NATIVE_DEFAULT_INTERACTION_EVENTS = [
59
+ "beforeinput",
60
+ "compositionend",
61
+ "compositionstart",
62
+ "compositionupdate",
63
+ "input",
64
+ "mousedown",
65
+ "pointerdown",
66
+ "touchend",
67
+ "touchstart"
68
+ ];
26
69
  const HYDRATE_DEFAULT_INTERACTION_EVENTS = [
27
70
  "pointerenter",
28
71
  "focusin",
@@ -38,6 +81,11 @@ const HYDRATE_DEFAULT_INTERACTION_EVENTS = [
38
81
  ];
39
82
  // Annotate the CommonJS export names for ESM import in node:
40
83
  0 && (module.exports = {
84
+ EARLY_HYDRATION_INTENTS_KEY,
85
+ EARLY_HYDRATION_INTENTS_LIMIT,
41
86
  HYDRATE_DEFAULT_INTERACTION_EVENTS,
42
- HYDRATE_INTERACTION_EVENTS_ATTR
87
+ HYDRATE_INTERACTION_EVENTS_ATTR,
88
+ HYDRATE_NATIVE_DEFAULT_INTERACTION_EVENTS,
89
+ HYDRATE_SELECTION_ATTR,
90
+ HYDRATE_SUPPORTED_INTERACTION_EVENTS
43
91
  });
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var hydration_markers_exports = {};
20
+ __export(hydration_markers_exports, {
21
+ HYDRATE_INDEPENDENT_ATTR: () => HYDRATE_INDEPENDENT_ATTR,
22
+ HYDRATE_INPUT_ATTR: () => HYDRATE_INPUT_ATTR,
23
+ INDEPENDENT_HYDRATE_MANIFEST_ATTR: () => INDEPENDENT_HYDRATE_MANIFEST_ATTR,
24
+ SIGNAL_CONTROL_ATTR: () => SIGNAL_CONTROL_ATTR
25
+ });
26
+ module.exports = __toCommonJS(hydration_markers_exports);
27
+ const INDEPENDENT_HYDRATE_MANIFEST_ATTR = "data-octane-independent";
28
+ const HYDRATE_INDEPENDENT_ATTR = "data-octane-hydrate-independent";
29
+ const HYDRATE_INPUT_ATTR = "data-octane-input";
30
+ const SIGNAL_CONTROL_ATTR = "data-octane-signal-control";
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ HYDRATE_INDEPENDENT_ATTR,
34
+ HYDRATE_INPUT_ATTR,
35
+ INDEPENDENT_HYDRATE_MANIFEST_ATTR,
36
+ SIGNAL_CONTROL_ATTR
37
+ });
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let 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 });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var independent_hydration_protocol_exports = {};
20
+ __export(independent_hydration_protocol_exports, {
21
+ createIndependentHydrateManifest: () => createIndependentHydrateManifest,
22
+ isIndependentHydrateManifest: () => isIndependentHydrateManifest,
23
+ serializeIndependentHydrateManifest: () => serializeIndependentHydrateManifest
24
+ });
25
+ module.exports = __toCommonJS(independent_hydration_protocol_exports);
26
+ var import_data_encoding = require("./data-encoding.cjs");
27
+ function plainRecord(value) {
28
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
29
+ const prototype = Object.getPrototypeOf(value);
30
+ if (prototype !== Object.prototype && prototype !== null) return false;
31
+ return Reflect.ownKeys(value).every((key2) => {
32
+ if (typeof key2 !== "string") return false;
33
+ const descriptor = Object.getOwnPropertyDescriptor(value, key2);
34
+ return descriptor.enumerable && "value" in descriptor;
35
+ });
36
+ }
37
+ function key(value) {
38
+ return typeof value === "string" && value.length > 0 && value.length <= 1024;
39
+ }
40
+ function uniqueKeys(value) {
41
+ return Array.isArray(value) && value.every(key) && new Set(value).size === value.length;
42
+ }
43
+ function captures(value, count) {
44
+ if (!Array.isArray(value) || value.length !== count) return false;
45
+ try {
46
+ for (const capture of value) (0, import_data_encoding.decodeSignalValue)(capture);
47
+ return true;
48
+ } catch {
49
+ return false;
50
+ }
51
+ }
52
+ function isIndependentHydrateManifest(value) {
53
+ if (!plainRecord(value)) return false;
54
+ const allowed = /* @__PURE__ */ new Set([
55
+ "version",
56
+ "buildId",
57
+ "boundaryId",
58
+ "moduleId",
59
+ "exportName",
60
+ "captureSchema",
61
+ "captures",
62
+ "hookSeed",
63
+ "idSeed",
64
+ "signalSites",
65
+ "styles",
66
+ "parentDependencies"
67
+ ]);
68
+ if (!Object.keys(value).every((name) => allowed.has(name))) return false;
69
+ 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)) {
70
+ return false;
71
+ }
72
+ const names = /* @__PURE__ */ new Set();
73
+ for (const capture of value.captureSchema) {
74
+ if (!plainRecord(capture) || Object.keys(capture).length !== 2 || !key(capture.name) || capture.type !== "json" || names.has(capture.name)) {
75
+ return false;
76
+ }
77
+ names.add(capture.name);
78
+ }
79
+ return captures(value.captures, value.captureSchema.length);
80
+ }
81
+ function createIndependentHydrateManifest(template, values, instanceBoundaryId, buildId, build) {
82
+ const manifest = {
83
+ ...template,
84
+ buildId,
85
+ boundaryId: instanceBoundaryId,
86
+ moduleId: build.moduleId,
87
+ captures: values.map((value) => (0, import_data_encoding.encodeSignalValue)(value)),
88
+ styles: build.styles
89
+ };
90
+ if (!isIndependentHydrateManifest(manifest)) {
91
+ throw new TypeError("Invalid independent Hydrate manifest inputs.");
92
+ }
93
+ return Object.freeze(manifest);
94
+ }
95
+ function serializeIndependentHydrateManifest(manifest) {
96
+ if (!isIndependentHydrateManifest(manifest)) {
97
+ throw new TypeError("Invalid independent Hydrate manifest.");
98
+ }
99
+ return JSON.stringify(manifest).replace(/&/g, "\\u0026").replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
100
+ }
101
+ // Annotate the CommonJS export names for ESM import in node:
102
+ 0 && (module.exports = {
103
+ createIndependentHydrateManifest,
104
+ isIndependentHydrateManifest,
105
+ serializeIndependentHydrateManifest
106
+ });
@@ -27,6 +27,7 @@ __export(index_exports, {
27
27
  HMR: () => import_runtime.HMR,
28
28
  HYDRATION_RANGE_BOUNDARY: () => import_runtime.HYDRATION_RANGE_BOUNDARY,
29
29
  Hydrate: () => import_runtime.Hydrate,
30
+ ServerCallUncertainError: () => import_server_rpc_protocol.ServerCallUncertainError,
30
31
  StrictMode: () => import_compatibility.StrictMode,
31
32
  Suspense: () => import_runtime.Suspense,
32
33
  TsrxErrorBoundary: () => import_runtime.TsrxErrorBoundary,
@@ -63,6 +64,7 @@ __export(index_exports, {
63
64
  bag8: () => import_runtime.bag8,
64
65
  bag9: () => import_runtime.bag9,
65
66
  bagOf: () => import_runtime.bagOf,
67
+ batchServerCalls: () => import_server_rpc_batch_client.batchServerCalls,
66
68
  bindRendererRegionOwner: () => import_runtime.bindRendererRegionOwner,
67
69
  child: () => import_runtime.child,
68
70
  childSlot: () => import_runtime.childSlot,
@@ -206,6 +208,7 @@ __export(index_exports, {
206
208
  template: () => import_runtime.template,
207
209
  textHole: () => import_runtime.textHole,
208
210
  textSlot: () => import_runtime.textSlot,
211
+ trustHTML: () => import_trusted_html.trustHTML,
209
212
  tryBlock: () => import_runtime.tryBlock,
210
213
  unstable_Activity: () => import_runtime.Activity,
211
214
  unstable_ViewTransition: () => import_runtime.ViewTransition,
@@ -240,6 +243,7 @@ __export(index_exports, {
240
243
  withSlot: () => import_runtime.withSlot
241
244
  });
242
245
  module.exports = __toCommonJS(index_exports);
246
+ var import_trusted_html = require("./trusted-html.cjs");
243
247
  var import_version = require("./version.cjs");
244
248
  var import_compatibility = require("./compatibility.cjs");
245
249
  var import_event_capture = require("./hydration/event-capture.cjs");
@@ -247,6 +251,8 @@ var import_behavior_root = require("./behavior-root.cjs");
247
251
  var import_sub_slot = require("./sub-slot.cjs");
248
252
  var import_runtime = require("./runtime.cjs");
249
253
  var import_server_rpc_client = require("./server-rpc-client.cjs");
254
+ var import_server_rpc_protocol = require("./server-rpc-protocol.cjs");
255
+ var import_server_rpc_batch_client = require("./server-rpc-batch-client.cjs");
250
256
  var import_method_dep = require("./method-dep.cjs");
251
257
  // Annotate the CommonJS export names for ESM import in node:
252
258
  0 && (module.exports = {
@@ -259,6 +265,7 @@ var import_method_dep = require("./method-dep.cjs");
259
265
  HMR,
260
266
  HYDRATION_RANGE_BOUNDARY,
261
267
  Hydrate,
268
+ ServerCallUncertainError,
262
269
  StrictMode,
263
270
  Suspense,
264
271
  TsrxErrorBoundary,
@@ -295,6 +302,7 @@ var import_method_dep = require("./method-dep.cjs");
295
302
  bag8,
296
303
  bag9,
297
304
  bagOf,
305
+ batchServerCalls,
298
306
  bindRendererRegionOwner,
299
307
  child,
300
308
  childSlot,
@@ -438,6 +446,7 @@ var import_method_dep = require("./method-dep.cjs");
438
446
  template,
439
447
  textHole,
440
448
  textSlot,
449
+ trustHTML,
441
450
  tryBlock,
442
451
  unstable_Activity,
443
452
  unstable_ViewTransition,