octane 0.2.12 → 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 (243) 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/css.cjs +6 -27
  8. package/dist/cjs/data-encoding.cjs +160 -0
  9. package/dist/cjs/dom-binding-handoff.cjs +93 -0
  10. package/dist/cjs/dom-binding-protocol.cjs +115 -0
  11. package/dist/cjs/dom-binding-styles.cjs +292 -0
  12. package/dist/cjs/dom-bindings.cjs +700 -0
  13. package/dist/cjs/dom-focused-move.cjs +66 -0
  14. package/dist/cjs/dom-tables.cjs +4 -94
  15. package/dist/cjs/error-codes.client.generated.cjs +33 -0
  16. package/dist/cjs/error-codes.server.generated.cjs +19 -0
  17. package/dist/cjs/hydration/control-capture.cjs +244 -0
  18. package/dist/cjs/hydration/event-capture.cjs +125 -43
  19. package/dist/cjs/hydration/interaction-config.cjs +50 -2
  20. package/dist/cjs/hydration-markers.cjs +37 -0
  21. package/dist/cjs/independent-hydration-protocol.cjs +106 -0
  22. package/dist/cjs/index.cjs +6 -0
  23. package/dist/cjs/runtime.cjs +2791 -215
  24. package/dist/cjs/runtime.server.cjs +716 -76
  25. package/dist/cjs/server/early-signals.cjs +45 -0
  26. package/dist/cjs/server/index.cjs +44 -0
  27. package/dist/cjs/server/rpc-batch.cjs +149 -0
  28. package/dist/cjs/server/rpc-stream.cjs +146 -0
  29. package/dist/cjs/server/rpc.cjs +34 -15
  30. package/dist/cjs/server/signal-query-observation.cjs +158 -0
  31. package/dist/cjs/server/streamed-region.cjs +52 -0
  32. package/dist/cjs/server/streamed-signals.cjs +512 -0
  33. package/dist/cjs/server-call.cjs +103 -0
  34. package/dist/cjs/server-rpc-batch-client.cjs +141 -0
  35. package/dist/cjs/server-rpc-client.cjs +94 -27
  36. package/dist/cjs/server-rpc-protocol.cjs +141 -0
  37. package/dist/cjs/server-rpc-stream-client.cjs +118 -0
  38. package/dist/cjs/signals/actions.cjs +474 -0
  39. package/dist/cjs/signals/client.cjs +4 -1
  40. package/dist/cjs/signals/computations.cjs +460 -0
  41. package/dist/cjs/signals/control-binding.cjs +368 -0
  42. package/dist/cjs/signals/derived-facade.cjs +50 -0
  43. package/dist/cjs/signals/document-owner.cjs +71 -0
  44. package/dist/cjs/signals/early-values.cjs +155 -0
  45. package/dist/cjs/signals/encoding.cjs +6 -95
  46. package/dist/cjs/signals/engine.cjs +276 -12
  47. package/dist/cjs/signals/errors.cjs +18 -0
  48. package/dist/cjs/signals/facade.cjs +477 -0
  49. package/dist/cjs/signals/graph.cjs +163 -20
  50. package/dist/cjs/signals/handle-protocol.cjs +36 -0
  51. package/dist/cjs/signals/index.cjs +81 -2
  52. package/dist/cjs/signals/native-read-client.cjs +10 -0
  53. package/dist/cjs/signals/owner-context.cjs +112 -0
  54. package/dist/cjs/signals/query-attempt-observer.cjs +68 -0
  55. package/dist/cjs/signals/query-facade.cjs +72 -0
  56. package/dist/cjs/signals/read-protocol.cjs +32 -0
  57. package/dist/cjs/signals/requests.cjs +287 -14
  58. package/dist/cjs/signals/scalar-computations.cjs +76 -0
  59. package/dist/cjs/signals/server.cjs +4 -1
  60. package/dist/cjs/signals/transition-candidate.cjs +567 -0
  61. package/dist/cjs/signals/transition-state.cjs +106 -0
  62. package/dist/cjs/signals/types.cjs +50 -0
  63. package/dist/cjs/stream-protocol.cjs +3 -0
  64. package/dist/cjs/streamed-signals-protocol.cjs +159 -0
  65. package/dist/cjs/style-values.cjs +122 -0
  66. package/dist/cjs/version.cjs +1 -1
  67. package/dist/class-names.d.ts +5 -0
  68. package/dist/class-names.js +25 -0
  69. package/dist/compiler/bundler.js +34 -6
  70. package/dist/compiler/compile.js +2234 -559
  71. package/dist/compiler/dom-binding-program.js +935 -0
  72. package/dist/compiler/dom-binding-request.js +57 -0
  73. package/dist/compiler/dom-bindings.js +2245 -0
  74. package/dist/compiler/hook-deps.js +26 -0
  75. package/dist/compiler/hydrate-boundaries.js +358 -15
  76. package/dist/compiler/index.d.ts +38 -1
  77. package/dist/compiler/index.js +1 -0
  78. package/dist/compiler/native-attribute-reads.js +127 -0
  79. package/dist/compiler/native-read-diagnostics.js +48 -9
  80. package/dist/compiler/native-read-types.js +55 -32
  81. package/dist/compiler/server-context.js +118 -0
  82. package/dist/compiler/signal-attempt-reads.js +479 -0
  83. package/dist/compiler/signal-declarations.js +557 -0
  84. package/dist/compiler/signal-start-reads.js +413 -0
  85. package/dist/compiler/slot-hooks.js +57 -10
  86. package/dist/compiler/template-ir.js +200 -0
  87. package/dist/compiler/typescript.d.ts +2 -0
  88. package/dist/compiler/typescript.js +2 -0
  89. package/dist/compiler/vite.d.ts +3 -1
  90. package/dist/compiler/vite.js +122 -4
  91. package/dist/compiler/volar.d.ts +6 -1
  92. package/dist/compiler/volar.js +674 -143
  93. package/dist/constants.d.ts +1 -0
  94. package/dist/constants.js +10 -0
  95. package/dist/css.d.ts +2 -5
  96. package/dist/css.js +2 -23
  97. package/dist/data-encoding.d.ts +9 -0
  98. package/dist/data-encoding.js +134 -0
  99. package/dist/dom-binding-classes.d.ts +15 -0
  100. package/dist/dom-binding-classes.js +129 -0
  101. package/dist/dom-binding-controls.d.ts +2 -0
  102. package/dist/dom-binding-controls.js +6 -0
  103. package/dist/dom-binding-handoff.d.ts +55 -0
  104. package/dist/dom-binding-handoff.js +62 -0
  105. package/dist/dom-binding-program.d.ts +300 -0
  106. package/dist/dom-binding-program.js +1625 -0
  107. package/dist/dom-binding-projections.d.ts +15 -0
  108. package/dist/dom-binding-projections.js +187 -0
  109. package/dist/dom-binding-protocol.d.ts +13 -0
  110. package/dist/dom-binding-protocol.js +88 -0
  111. package/dist/dom-binding-signals.d.ts +21 -0
  112. package/dist/dom-binding-signals.js +109 -0
  113. package/dist/dom-binding-styles.d.ts +17 -0
  114. package/dist/dom-binding-styles.js +272 -0
  115. package/dist/dom-bindings.d.ts +89 -0
  116. package/dist/dom-bindings.js +670 -0
  117. package/dist/dom-focused-move.d.ts +6 -0
  118. package/dist/dom-focused-move.js +42 -0
  119. package/dist/dom-tables.d.ts +1 -3
  120. package/dist/dom-tables.js +1 -91
  121. package/dist/error-codes.client.generated.d.ts +9 -0
  122. package/dist/error-codes.client.generated.js +33 -0
  123. package/dist/error-codes.server.generated.d.ts +5 -0
  124. package/dist/error-codes.server.generated.js +19 -0
  125. package/dist/hydration/control-capture.d.ts +62 -0
  126. package/dist/hydration/control-capture.js +223 -0
  127. package/dist/hydration/document-lifecycle.d.ts +23 -0
  128. package/dist/hydration/document-lifecycle.js +80 -0
  129. package/dist/hydration/event-capture.d.ts +20 -1
  130. package/dist/hydration/event-capture.js +128 -42
  131. package/dist/hydration/independent-island.d.ts +45 -0
  132. package/dist/hydration/independent-island.js +233 -0
  133. package/dist/hydration/index.d.ts +8 -1
  134. package/dist/hydration/index.js +55 -1
  135. package/dist/hydration/interaction-config.d.ts +5 -0
  136. package/dist/hydration/interaction-config.js +44 -1
  137. package/dist/hydration/stream-delivery.d.ts +32 -0
  138. package/dist/hydration/stream-delivery.js +333 -0
  139. package/dist/hydration/stream-receiver.d.ts +26 -0
  140. package/dist/hydration/stream-receiver.js +204 -0
  141. package/dist/hydration/stream-result-receiver.d.ts +70 -0
  142. package/dist/hydration/stream-result-receiver.js +246 -0
  143. package/dist/hydration/streamed-signals.d.ts +44 -0
  144. package/dist/hydration/streamed-signals.js +186 -0
  145. package/dist/hydration/types.d.ts +6 -0
  146. package/dist/hydration-markers.d.ts +7 -0
  147. package/dist/hydration-markers.js +10 -0
  148. package/dist/independent-hydration-protocol.d.ts +31 -0
  149. package/dist/independent-hydration-protocol.js +80 -0
  150. package/dist/index.d.ts +2 -0
  151. package/dist/index.js +4 -0
  152. package/dist/internal/signal-read.d.ts +1 -0
  153. package/dist/internal/signal-read.js +4 -0
  154. package/dist/jsx-runtime.d.ts +45 -6
  155. package/dist/public-types.d.ts +15 -1
  156. package/dist/runtime.d.ts +259 -21
  157. package/dist/runtime.js +2812 -220
  158. package/dist/runtime.server.d.ts +86 -6
  159. package/dist/runtime.server.js +712 -76
  160. package/dist/server/early-signals.d.ts +14 -0
  161. package/dist/server/early-signals.js +34 -0
  162. package/dist/server/index.d.ts +10 -2
  163. package/dist/server/index.js +48 -1
  164. package/dist/server/rpc-batch.d.ts +17 -0
  165. package/dist/server/rpc-batch.js +129 -0
  166. package/dist/server/rpc-stream.d.ts +9 -0
  167. package/dist/server/rpc-stream.js +125 -0
  168. package/dist/server/rpc.d.ts +5 -1
  169. package/dist/server/rpc.js +37 -13
  170. package/dist/server/signal-query-observation.d.ts +3 -0
  171. package/dist/server/signal-query-observation.js +134 -0
  172. package/dist/server/streamed-region.d.ts +15 -0
  173. package/dist/server/streamed-region.js +30 -0
  174. package/dist/server/streamed-signals.d.ts +45 -0
  175. package/dist/server/streamed-signals.js +488 -0
  176. package/dist/server-call.d.ts +41 -0
  177. package/dist/server-call.js +75 -0
  178. package/dist/server-rpc-batch-client.d.ts +7 -0
  179. package/dist/server-rpc-batch-client.js +119 -0
  180. package/dist/server-rpc-client.d.ts +3 -1
  181. package/dist/server-rpc-client.js +99 -27
  182. package/dist/server-rpc-protocol.d.ts +47 -0
  183. package/dist/server-rpc-protocol.js +109 -0
  184. package/dist/server-rpc-stream-client.d.ts +5 -0
  185. package/dist/server-rpc-stream-client.js +98 -0
  186. package/dist/signals/actions.d.ts +12 -0
  187. package/dist/signals/actions.js +466 -0
  188. package/dist/signals/client.d.ts +2 -0
  189. package/dist/signals/client.js +1 -0
  190. package/dist/signals/computations.d.ts +37 -0
  191. package/dist/signals/computations.js +455 -0
  192. package/dist/signals/control-binding.d.ts +31 -0
  193. package/dist/signals/control-binding.js +353 -0
  194. package/dist/signals/derived-facade.d.ts +3 -0
  195. package/dist/signals/derived-facade.js +25 -0
  196. package/dist/signals/document-owner.d.ts +10 -0
  197. package/dist/signals/document-owner.js +43 -0
  198. package/dist/signals/early-values.d.ts +24 -0
  199. package/dist/signals/early-values.js +124 -0
  200. package/dist/signals/encoding.d.ts +1 -3
  201. package/dist/signals/encoding.js +3 -93
  202. package/dist/signals/engine.d.ts +53 -4
  203. package/dist/signals/engine.js +275 -16
  204. package/dist/signals/errors.d.ts +7 -0
  205. package/dist/signals/errors.js +16 -0
  206. package/dist/signals/facade.d.ts +74 -0
  207. package/dist/signals/facade.js +452 -0
  208. package/dist/signals/graph.d.ts +50 -5
  209. package/dist/signals/graph.js +170 -19
  210. package/dist/signals/handle-protocol.d.ts +4 -0
  211. package/dist/signals/handle-protocol.js +11 -0
  212. package/dist/signals/index.d.ts +12 -3
  213. package/dist/signals/index.js +71 -2
  214. package/dist/signals/native-read-client.d.ts +3 -0
  215. package/dist/signals/native-read-client.js +10 -0
  216. package/dist/signals/owner-context.d.ts +22 -0
  217. package/dist/signals/owner-context.js +77 -0
  218. package/dist/signals/query-attempt-observer.d.ts +49 -0
  219. package/dist/signals/query-attempt-observer.js +41 -0
  220. package/dist/signals/query-facade.d.ts +3 -0
  221. package/dist/signals/query-facade.js +49 -0
  222. package/dist/signals/read-protocol.d.ts +32 -3
  223. package/dist/signals/read-protocol.js +26 -0
  224. package/dist/signals/requests.d.ts +38 -5
  225. package/dist/signals/requests.js +298 -15
  226. package/dist/signals/scalar-computations.d.ts +2 -0
  227. package/dist/signals/scalar-computations.js +60 -0
  228. package/dist/signals/server.d.ts +2 -0
  229. package/dist/signals/server.js +1 -0
  230. package/dist/signals/transition-candidate.d.ts +71 -0
  231. package/dist/signals/transition-candidate.js +557 -0
  232. package/dist/signals/transition-state.d.ts +51 -0
  233. package/dist/signals/transition-state.js +70 -0
  234. package/dist/signals/types.d.ts +95 -5
  235. package/dist/signals/types.js +20 -0
  236. package/dist/stream-protocol.d.ts +0 -5
  237. package/dist/stream-protocol.js +3 -0
  238. package/dist/streamed-signals-protocol.d.ts +60 -0
  239. package/dist/streamed-signals-protocol.js +130 -0
  240. package/dist/style-values.d.ts +3 -0
  241. package/dist/style-values.js +96 -0
  242. package/dist/version.js +1 -1
  243. package/package.json +37 -1
@@ -0,0 +1,50 @@
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 types_exports = {};
20
+ __export(types_exports, {
21
+ QUERY_REQUEST: () => QUERY_REQUEST,
22
+ SIGNAL_BINDING_IDENTITY: () => SIGNAL_BINDING_IDENTITY,
23
+ SIGNAL_BINDING_READ: () => SIGNAL_BINDING_READ,
24
+ SIGNAL_BINDING_SUBSCRIBE: () => SIGNAL_BINDING_SUBSCRIBE,
25
+ SIGNAL_HANDLE: () => SIGNAL_HANDLE,
26
+ SIGNAL_OWNER_RESOLVE: () => SIGNAL_OWNER_RESOLVE,
27
+ skip: () => skip
28
+ });
29
+ module.exports = __toCommonJS(types_exports);
30
+ const SIGNAL_HANDLE = /* @__PURE__ */ Symbol.for("octane.signal-handle");
31
+ const SIGNAL_BINDING_READ = /* @__PURE__ */ Symbol.for("octane.signal-binding-read");
32
+ const SIGNAL_BINDING_SUBSCRIBE = /* @__PURE__ */ Symbol.for(
33
+ "octane.signal-binding-subscribe"
34
+ );
35
+ const SIGNAL_BINDING_IDENTITY = /* @__PURE__ */ Symbol.for(
36
+ "octane.signal-binding-identity"
37
+ );
38
+ const QUERY_REQUEST = /* @__PURE__ */ Symbol.for("octane.query-request");
39
+ const SIGNAL_OWNER_RESOLVE = /* @__PURE__ */ Symbol.for("octane.signal-owner-resolve");
40
+ const skip = /* @__PURE__ */ Symbol.for("octane.query-skip");
41
+ // Annotate the CommonJS export names for ESM import in node:
42
+ 0 && (module.exports = {
43
+ QUERY_REQUEST,
44
+ SIGNAL_BINDING_IDENTITY,
45
+ SIGNAL_BINDING_READ,
46
+ SIGNAL_BINDING_SUBSCRIBE,
47
+ SIGNAL_HANDLE,
48
+ SIGNAL_OWNER_RESOLVE,
49
+ skip
50
+ });
@@ -26,12 +26,15 @@ __export(stream_protocol_exports, {
26
26
  streamTokenFromBoundaryId: () => streamTokenFromBoundaryId
27
27
  });
28
28
  module.exports = __toCommonJS(stream_protocol_exports);
29
+ var import_dom_binding_protocol = require("./dom-binding-protocol.cjs");
29
30
  const STREAM_BOUNDARY_ATTR = "data-oct-b";
30
31
  const HYDRATE_STREAM_TOKEN_ATTR = "data-octane-stream-token";
31
32
  function hydrationMarkerMultiplicity(data, open) {
32
33
  const marker = open ? "[" : "]";
33
34
  if (data === marker) return 1;
34
35
  if (open && (data === "[f0" || data === "[f1")) return 1;
36
+ if (open && (data.startsWith("[b;") || data.startsWith("[f")) && (0, import_dom_binding_protocol.isBindingOpenComment)(data))
37
+ return 1;
35
38
  if (data.length < 2 || data.charCodeAt(0) !== marker.charCodeAt(0)) return 0;
36
39
  const first = data.charCodeAt(1);
37
40
  if (first < 49 || first > 57) return 0;
@@ -0,0 +1,159 @@
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 streamed_signals_protocol_exports = {};
20
+ __export(streamed_signals_protocol_exports, {
21
+ decodeStreamedRendererFrame: () => decodeStreamedRendererFrame,
22
+ encodeStreamedRendererFrameForScript: () => encodeStreamedRendererFrameForScript,
23
+ isStreamFrameIdentity: () => isStreamFrameIdentity,
24
+ isStreamedRendererFrame: () => isStreamedRendererFrame,
25
+ sameStreamFrameIdentity: () => sameStreamFrameIdentity,
26
+ streamFrameIdentityKey: () => streamFrameIdentityKey
27
+ });
28
+ module.exports = __toCommonJS(streamed_signals_protocol_exports);
29
+ function isRecord(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
+ for (const key of Reflect.ownKeys(value)) {
34
+ if (typeof key !== "string") return false;
35
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
36
+ if (!descriptor.enumerable || !("value" in descriptor)) return false;
37
+ }
38
+ return true;
39
+ }
40
+ function isKey(value) {
41
+ return typeof value === "string" && value.length > 0 && value.length <= 1024;
42
+ }
43
+ function isCounter(value) {
44
+ return Number.isSafeInteger(value) && value >= 0;
45
+ }
46
+ function hasOnly(record, allowed) {
47
+ return Object.keys(record).every((key) => allowed.has(key));
48
+ }
49
+ const IDENTITY_KEYS = /* @__PURE__ */ new Set([
50
+ "protocol",
51
+ "buildId",
52
+ "documentId",
53
+ "ownerKey",
54
+ "instanceKey",
55
+ "nodeKey",
56
+ "selectionKey",
57
+ "selectionGeneration",
58
+ "attempt"
59
+ ]);
60
+ function isStreamFrameIdentity(value) {
61
+ if (!isRecord(value) || !hasOnly(value, IDENTITY_KEYS)) return false;
62
+ return value.protocol === 1 && isKey(value.buildId) && isKey(value.documentId) && isKey(value.ownerKey) && isKey(value.instanceKey) && isKey(value.nodeKey) && isKey(value.selectionKey) && isCounter(value.selectionGeneration) && isCounter(value.attempt);
63
+ }
64
+ function isEncodedSignalValue(value, depth = 0) {
65
+ if (depth > 100 || !Array.isArray(value) || typeof value[0] !== "string") return false;
66
+ const tag = value[0];
67
+ if (tag === "undefined" || tag === "null") return value.length === 1;
68
+ if (value.length !== 2) return false;
69
+ if (tag === "boolean") return typeof value[1] === "boolean";
70
+ if (tag === "string") return typeof value[1] === "string";
71
+ if (tag === "number") {
72
+ return value[1] === "-0" || typeof value[1] === "number" && Number.isFinite(value[1]) && !Object.is(value[1], -0);
73
+ }
74
+ if (tag === "array") {
75
+ return Array.isArray(value[1]) && value[1].every((item) => isEncodedSignalValue(item, depth + 1));
76
+ }
77
+ if (tag !== "object" || !Array.isArray(value[1])) return false;
78
+ let previous;
79
+ for (const entry of value[1]) {
80
+ if (!Array.isArray(entry) || entry.length !== 2 || typeof entry[0] !== "string" || previous !== void 0 && entry[0] <= previous || !isEncodedSignalValue(entry[1], depth + 1)) {
81
+ return false;
82
+ }
83
+ previous = entry[0];
84
+ }
85
+ return true;
86
+ }
87
+ function isHistoricalFrame(value) {
88
+ return isRecord(value) && value.version === 1 && isKey(value.scopeKey) && Array.isArray(value.entries);
89
+ }
90
+ const RESULT_BASE_KEYS = /* @__PURE__ */ new Set(["identity", "sequence", "channel", "kind"]);
91
+ function isStreamedRendererFrame(value) {
92
+ if (!isRecord(value) || !isStreamFrameIdentity(value.identity) || !isCounter(value.sequence)) {
93
+ return false;
94
+ }
95
+ if (value.channel === "result") {
96
+ if (value.kind === "open") {
97
+ return hasOnly(value, /* @__PURE__ */ new Set([...RESULT_BASE_KEYS, "resource"])) && (value.resource === "promise" || value.resource === "stream");
98
+ }
99
+ if (value.kind === "value") {
100
+ return hasOnly(value, /* @__PURE__ */ new Set([...RESULT_BASE_KEYS, "value"])) && isEncodedSignalValue(value.value);
101
+ }
102
+ if (value.kind === "error") {
103
+ return hasOnly(value, /* @__PURE__ */ new Set([...RESULT_BASE_KEYS, "code"])) && isKey(value.code);
104
+ }
105
+ return value.kind === "complete" && hasOnly(value, RESULT_BASE_KEYS);
106
+ }
107
+ if (value.channel !== "placement" || value.kind !== "html") return false;
108
+ const allowed = /* @__PURE__ */ new Set([
109
+ "identity",
110
+ "sequence",
111
+ "channel",
112
+ "kind",
113
+ "contentRevision",
114
+ "baseRevision",
115
+ "mode",
116
+ "html",
117
+ "historicalFrame",
118
+ "styles"
119
+ ]);
120
+ if (!hasOnly(value, allowed) || !isCounter(value.contentRevision) || value.mode !== "full" && value.mode !== "delta" || typeof value.html !== "string" || !isHistoricalFrame(value.historicalFrame) || !Array.isArray(value.styles) || !value.styles.every(isKey) || new Set(value.styles).size !== value.styles.length) {
121
+ return false;
122
+ }
123
+ if (value.mode === "delta") return isCounter(value.baseRevision);
124
+ return value.baseRevision === void 0 || isCounter(value.baseRevision);
125
+ }
126
+ function decodeStreamedRendererFrame(json) {
127
+ const value = JSON.parse(json);
128
+ if (!isStreamedRendererFrame(value)) throw new Error("Invalid Octane streamed renderer frame.");
129
+ return value;
130
+ }
131
+ function encodeStreamedRendererFrameForScript(frame) {
132
+ if (!isStreamedRendererFrame(frame)) throw new Error("Invalid Octane streamed renderer frame.");
133
+ return JSON.stringify(frame).replace(/&/g, "\\u0026").replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
134
+ }
135
+ function sameStreamFrameIdentity(a, b) {
136
+ return a.protocol === b.protocol && a.buildId === b.buildId && a.documentId === b.documentId && a.ownerKey === b.ownerKey && a.instanceKey === b.instanceKey && a.nodeKey === b.nodeKey && a.selectionKey === b.selectionKey && a.selectionGeneration === b.selectionGeneration && a.attempt === b.attempt;
137
+ }
138
+ function streamFrameIdentityKey(identity) {
139
+ return JSON.stringify([
140
+ identity.protocol,
141
+ identity.buildId,
142
+ identity.documentId,
143
+ identity.ownerKey,
144
+ identity.instanceKey,
145
+ identity.nodeKey,
146
+ identity.selectionKey,
147
+ identity.selectionGeneration,
148
+ identity.attempt
149
+ ]);
150
+ }
151
+ // Annotate the CommonJS export names for ESM import in node:
152
+ 0 && (module.exports = {
153
+ decodeStreamedRendererFrame,
154
+ encodeStreamedRendererFrameForScript,
155
+ isStreamFrameIdentity,
156
+ isStreamedRendererFrame,
157
+ sameStreamFrameIdentity,
158
+ streamFrameIdentityKey
159
+ });
@@ -0,0 +1,122 @@
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 style_values_exports = {};
20
+ __export(style_values_exports, {
21
+ cssStyleValue: () => cssStyleValue,
22
+ hyphenateStyleName: () => hyphenateStyleName,
23
+ isUnitlessStyleProp: () => isUnitlessStyleProp
24
+ });
25
+ module.exports = __toCommonJS(style_values_exports);
26
+ const UNITLESS_STYLE_PROPS = /* @__PURE__ */ new Set();
27
+ for (const base of [
28
+ "animationIterationCount",
29
+ "aspectRatio",
30
+ "borderImageOutset",
31
+ "borderImageSlice",
32
+ "borderImageWidth",
33
+ "boxFlex",
34
+ "boxFlexGroup",
35
+ "boxOrdinalGroup",
36
+ "columnCount",
37
+ "columns",
38
+ "flex",
39
+ "flexGrow",
40
+ "flexPositive",
41
+ "flexShrink",
42
+ "flexNegative",
43
+ "flexOrder",
44
+ "gridArea",
45
+ "gridRow",
46
+ "gridRowEnd",
47
+ "gridRowSpan",
48
+ "gridRowStart",
49
+ "gridColumn",
50
+ "gridColumnEnd",
51
+ "gridColumnSpan",
52
+ "gridColumnStart",
53
+ "fontWeight",
54
+ "lineClamp",
55
+ "lineHeight",
56
+ "opacity",
57
+ "order",
58
+ "orphans",
59
+ "scale",
60
+ "tabSize",
61
+ "widows",
62
+ "zIndex",
63
+ "zoom",
64
+ "fillOpacity",
65
+ "floodOpacity",
66
+ "stopOpacity",
67
+ "strokeDasharray",
68
+ "strokeDashoffset",
69
+ "strokeMiterlimit",
70
+ "strokeOpacity",
71
+ "strokeWidth"
72
+ ]) {
73
+ const c = base.toLowerCase();
74
+ UNITLESS_STYLE_PROPS.add(c);
75
+ UNITLESS_STYLE_PROPS.add("webkit" + c);
76
+ UNITLESS_STYLE_PROPS.add("ms" + c);
77
+ UNITLESS_STYLE_PROPS.add("moz" + c);
78
+ UNITLESS_STYLE_PROPS.add("o" + c);
79
+ }
80
+ const unitlessStylePropCache = /* @__PURE__ */ new Map();
81
+ function isUnitlessStyleProp(name) {
82
+ const cached = unitlessStylePropCache.get(name);
83
+ if (cached !== void 0) return cached;
84
+ const result = UNITLESS_STYLE_PROPS.has(name.replaceAll("-", "").toLowerCase());
85
+ unitlessStylePropCache.set(name, result);
86
+ return result;
87
+ }
88
+ function cssStyleValue(name, value) {
89
+ if (typeof value === "number" && value !== 0 && name.charCodeAt(0) !== 45 && !isUnitlessStyleProp(name)) {
90
+ return value + "px";
91
+ }
92
+ return typeof value === "string" ? value.trim() : "" + value;
93
+ }
94
+ function hyphenateStyleName(name) {
95
+ if (name === "cssFloat") return "float";
96
+ if (name.charCodeAt(0) === 45) return name;
97
+ let hasUpper = false;
98
+ for (let i = 0; i < name.length; i++) {
99
+ const c = name.charCodeAt(i);
100
+ if (c >= 65 && c <= 90) {
101
+ hasUpper = true;
102
+ break;
103
+ }
104
+ }
105
+ if (!hasUpper) return name;
106
+ let out = "";
107
+ for (let i = 0; i < name.length; i++) {
108
+ const c = name.charCodeAt(i);
109
+ if (c >= 65 && c <= 90) out += "-" + String.fromCharCode(c + 32);
110
+ else out += name[i];
111
+ }
112
+ if (out.charCodeAt(0) === 109 && out.charCodeAt(1) === 115 && out.charCodeAt(2) === 45) {
113
+ out = "-" + out;
114
+ }
115
+ return out;
116
+ }
117
+ // Annotate the CommonJS export names for ESM import in node:
118
+ 0 && (module.exports = {
119
+ cssStyleValue,
120
+ hyphenateStyleName,
121
+ isUnitlessStyleProp
122
+ });
@@ -21,7 +21,7 @@ __export(version_exports, {
21
21
  version: () => version
22
22
  });
23
23
  module.exports = __toCommonJS(version_exports);
24
- const version = "0.2.12";
24
+ const version = "0.2.13";
25
25
  // Annotate the CommonJS export names for ESM import in node:
26
26
  0 && (module.exports = {
27
27
  version
@@ -0,0 +1,5 @@
1
+ /**
2
+ * clsx-style class composition (strings, numbers, arrays, objects, nesting;
3
+ * falsy drops out). Octane's `class`/`className` semantics at every apply site.
4
+ */
5
+ export declare function normalizeClass(value: unknown): string;
@@ -0,0 +1,25 @@
1
+ function normalizeClass(value) {
2
+ if (typeof value === "string") return value;
3
+ if (typeof value !== "object") {
4
+ return typeof value === "number" && value ? "" + value : "";
5
+ }
6
+ if (value === null) return "";
7
+ let str = "";
8
+ if (Array.isArray(value)) {
9
+ for (let i = 0; i < value.length; i++) {
10
+ const item = value[i];
11
+ if (item) {
12
+ const inner = normalizeClass(item);
13
+ if (inner) str = str ? str + " " + inner : inner;
14
+ }
15
+ }
16
+ } else {
17
+ for (const k in value) {
18
+ if (value[k]) str = str ? str + " " + k : k;
19
+ }
20
+ }
21
+ return str;
22
+ }
23
+ export {
24
+ normalizeClass
25
+ };
@@ -14,6 +14,7 @@ import * as nodeFs from 'node:fs';
14
14
  import * as nodeModule from 'node:module';
15
15
  import * as nodePath from 'node:path';
16
16
  import { parseModule } from '@tsrx/core';
17
+ export { DOM_BINDING_COMPILER_ABI_VERSION } from './dom-bindings.js';
17
18
  import {
18
19
  compile,
19
20
  compileForBundler,
@@ -23,6 +24,7 @@ import {
23
24
  } from './compile.js';
24
25
  import { validateRendererModuleSource } from './compile-universal.js';
25
26
  import { HYDRATE_QUERY_PARAM, hydrateBoundaryPathFromId } from './hydrate-boundaries.js';
27
+ import { parseDomBindingRequest, formatDomBindingRequest } from './dom-binding-request.js';
26
28
  import {
27
29
  DOM_RENDERER_MODULE,
28
30
  normalizeRendererConfig,
@@ -54,6 +56,7 @@ export {
54
56
  CLIENT_REFERENCE_MANIFEST_VERSION,
55
57
  createClientReferenceManifest,
56
58
  } from './client-only-server.js';
59
+ export const INDEPENDENT_HYDRATION_MANIFEST_FILENAME = 'octane-independent-hydration.json';
57
60
  export {
58
61
  DOM_RENDERER_ID,
59
62
  DOM_RENDERER_MODULE,
@@ -516,6 +519,7 @@ class OctaneBundlerCompiler {
516
519
  profile: options.profile === true,
517
520
  inlineHookMemo: options.inlineHookMemo !== false,
518
521
  strong: options.strong === true,
522
+ knownAttributeSpreads: options.knownAttributeSpreads,
519
523
  universalRuntime: normalizeUniversalRuntime(options.universalRuntime),
520
524
  };
521
525
  this.renderers = normalizeRendererConfig(options.renderers);
@@ -1064,6 +1068,10 @@ class OctaneBundlerCompiler {
1064
1068
  );
1065
1069
  const file = cleanModuleId(id);
1066
1070
  const hydrateBoundaryPath = hydrateBoundaryPathFromId(id);
1071
+ const bindingRequest = parseDomBindingRequest(id);
1072
+ if (bindingRequest !== null && hydrateBoundaryPath !== null) {
1073
+ throw new Error('Octane DOM binding and Hydrate queries cannot be combined.');
1074
+ }
1067
1075
  const collected = {
1068
1076
  dependencies: new Set(),
1069
1077
  missingDependencies: new Set(),
@@ -1096,7 +1104,7 @@ class OctaneBundlerCompiler {
1096
1104
  options.universalRuntime ?? this.defaults.universalRuntime,
1097
1105
  );
1098
1106
  const filename = this._canonicalModuleId(file);
1099
- const targetRuntimeRequests = (source, kind) => {
1107
+ const targetRuntimeRequests = (source, kind, streamedSignals = false) => {
1100
1108
  if (environment !== 'server' || options.explicitRuntimeRequests !== true) return null;
1101
1109
  const runtimeResult = rewriteServerRuntimeRequests(source, filename);
1102
1110
  if (runtimeResult === null) return null;
@@ -1104,6 +1112,7 @@ class OctaneBundlerCompiler {
1104
1112
  code: runtimeResult.code,
1105
1113
  map: runtimeResult.map,
1106
1114
  kind,
1115
+ ...(streamedSignals ? { streamedSignals: true } : null),
1107
1116
  ...finishMetadata(collected),
1108
1117
  };
1109
1118
  };
@@ -1131,6 +1140,9 @@ class OctaneBundlerCompiler {
1131
1140
  const fullCompile =
1132
1141
  this._isFullCompileSource(file, collected) &&
1133
1142
  this._passesOwnershipGate(file, filename, pragmaOwned);
1143
+ if (bindingRequest !== null && !fullCompile) {
1144
+ throw new Error('Octane DOM binding queries require a compiler-owned .tsrx/.tsx view.');
1145
+ }
1134
1146
  // The narrow-the-rule config error concerns modules Octane owns. Under
1135
1147
  // the ownership gate a host-owned project module (unmarked, or in an
1136
1148
  // excluded path) may legitimately sit inside a client-only include in a
@@ -1177,13 +1189,22 @@ class OctaneBundlerCompiler {
1177
1189
  !hasRendererBoundaries &&
1178
1190
  typeof options.resolveCssModuleConstant === 'function';
1179
1191
  const compileFilename =
1180
- hydrateBoundaryPath === null
1181
- ? filename
1182
- : `${filename}?${HYDRATE_QUERY_PARAM}=${encodeURIComponent(hydrateBoundaryPath)}`;
1192
+ bindingRequest !== null
1193
+ ? formatDomBindingRequest(filename, bindingRequest)
1194
+ : hydrateBoundaryPath === null
1195
+ ? filename
1196
+ : `${filename}?${HYDRATE_QUERY_PARAM}=${encodeURIComponent(hydrateBoundaryPath)}`;
1183
1197
  const compileOptions = {
1184
1198
  hmr,
1185
1199
  mode: environment,
1186
1200
  dev,
1201
+ ...(renderer.target === 'dom' &&
1202
+ (options.knownAttributeSpreads ?? this.defaults.knownAttributeSpreads) !== undefined
1203
+ ? {
1204
+ knownAttributeSpreads:
1205
+ options.knownAttributeSpreads ?? this.defaults.knownAttributeSpreads,
1206
+ }
1207
+ : null),
1187
1208
  ...(renderer.target === 'dom' && options.textTypeFacts !== undefined
1188
1209
  ? { textTypeFacts: options.textTypeFacts }
1189
1210
  : null),
@@ -1223,9 +1244,12 @@ class OctaneBundlerCompiler {
1223
1244
  let out;
1224
1245
  let voidComponentAst = null;
1225
1246
  let cssModuleConstantImports;
1226
- if (collectVoidComponentExports || collectCssModuleConstants) {
1247
+ let independentWidgets;
1248
+ const collectIndependentWidgets = code.includes('Hydrate') && code.includes('independent');
1249
+ if (collectVoidComponentExports || collectCssModuleConstants || collectIndependentWidgets) {
1227
1250
  const compilation = compileForBundler(code, compileFilename, compileOptions);
1228
1251
  out = compilation.result;
1252
+ if (collectIndependentWidgets) independentWidgets = compilation.independentWidgets;
1229
1253
  if (collectVoidComponentExports) voidComponentAst = compilation.hydrateAst;
1230
1254
  if (collectCssModuleConstants) {
1231
1255
  cssModuleConstantImports = compilation.cssModuleConstantImports;
@@ -1239,6 +1263,8 @@ class OctaneBundlerCompiler {
1239
1263
  map: out.map,
1240
1264
  diagnostics: out.diagnostics,
1241
1265
  kind: 'compile',
1266
+ ...(out.streamedSignals === true ? { streamedSignals: true } : null),
1267
+ ...(out.bindingConstants === undefined ? null : { bindingConstants: out.bindingConstants }),
1242
1268
  renderer,
1243
1269
  ...(out.universalRuntime === undefined ? null : { universalRuntime: out.universalRuntime }),
1244
1270
  ...(clientReference === null ? null : { clientReference }),
@@ -1248,6 +1274,7 @@ class OctaneBundlerCompiler {
1248
1274
  voidComponentExports: findVoidComponentExports(voidComponentAst, filename),
1249
1275
  }),
1250
1276
  ...(cssModuleConstantImports === undefined ? null : { cssModuleConstantImports }),
1277
+ ...(independentWidgets === undefined ? null : { independentWidgets }),
1251
1278
  descriptorChildrenExports:
1252
1279
  preparedDescriptorChildrenExports === null
1253
1280
  ? findDescriptorChildrenExports(code, filename)
@@ -1342,10 +1369,11 @@ class OctaneBundlerCompiler {
1342
1369
  if (out === null) return passThrough();
1343
1370
  // Strong plain modules report nonfatal hints like compiled modules do.
1344
1371
  this._forwardCompileDiagnostics(out.diagnostics);
1345
- const slotted = targetRuntimeRequests(out.code, 'slots') ?? {
1372
+ const slotted = targetRuntimeRequests(out.code, 'slots', out.streamedSignals) ?? {
1346
1373
  code: out.code,
1347
1374
  map: out.map,
1348
1375
  kind: 'slots',
1376
+ ...(out.streamedSignals === true ? { streamedSignals: true } : null),
1349
1377
  ...finishMetadata(collected),
1350
1378
  };
1351
1379
  return out.diagnostics === undefined ? slotted : { ...slotted, diagnostics: out.diagnostics };