octane 0.12.1 → 0.13.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 (76) hide show
  1. package/LICENSE +28 -0
  2. package/dist/cjs/dom-bindings.cjs +13 -4
  3. package/dist/cjs/dom-stage.cjs +1 -1
  4. package/dist/cjs/event-names.cjs +149 -0
  5. package/dist/cjs/host-budget.cjs +5 -0
  6. package/dist/cjs/host-property-diagnostics.cjs +21 -0
  7. package/dist/cjs/host-task.cjs +3 -0
  8. package/dist/cjs/profiling.cjs +338 -45
  9. package/dist/cjs/runtime.cjs +690 -465
  10. package/dist/cjs/runtime.server.cjs +4 -1
  11. package/dist/cjs/signals/engine.cjs +152 -165
  12. package/dist/cjs/signals/facade.cjs +20 -20
  13. package/dist/cjs/signals/graph.cjs +278 -90
  14. package/dist/cjs/signals/native-read-client.cjs +20 -10
  15. package/dist/cjs/signals/requests.cjs +104 -108
  16. package/dist/cjs/signals/scope-streams.cjs +54 -41
  17. package/dist/cjs/version.cjs +1 -1
  18. package/dist/compiler/bundler.js +34 -2
  19. package/dist/compiler/compile-universal.js +22 -3
  20. package/dist/compiler/compile-valdi.js +107 -19
  21. package/dist/compiler/compile.js +514 -137
  22. package/dist/compiler/dom-bindings.js +2 -1
  23. package/dist/compiler/index.d.ts +12 -2
  24. package/dist/compiler/renderers.js +8 -0
  25. package/dist/compiler/slot-hooks.js +50 -22
  26. package/dist/compiler/typescript-output.js +318 -0
  27. package/dist/compiler/valdi.d.ts +104 -0
  28. package/dist/compiler/vite.d.ts +4 -0
  29. package/dist/compiler/vite.js +100 -56
  30. package/dist/compiler/void-roots.js +45 -2
  31. package/dist/compiler/volar.d.ts +1 -0
  32. package/dist/compiler/volar.js +11 -10
  33. package/dist/dom-bindings.js +13 -4
  34. package/dist/dom-stage.js +1 -1
  35. package/dist/event-names.d.ts +12 -0
  36. package/dist/event-names.js +138 -0
  37. package/dist/host-budget.d.ts +2 -0
  38. package/dist/host-budget.js +4 -0
  39. package/dist/host-property-diagnostics.js +21 -0
  40. package/dist/host-task.js +3 -0
  41. package/dist/node/dom-bindings.js +13 -4
  42. package/dist/node/dom-stage.js +1 -1
  43. package/dist/node/event-names.js +138 -0
  44. package/dist/node/host-budget.js +4 -0
  45. package/dist/node/host-property-diagnostics.js +21 -0
  46. package/dist/node/host-task.js +3 -0
  47. package/dist/node/profiling.js +326 -45
  48. package/dist/node/runtime.js +694 -450
  49. package/dist/node/runtime.server.js +4 -1
  50. package/dist/node/signals/engine.js +149 -164
  51. package/dist/node/signals/facade.js +28 -21
  52. package/dist/node/signals/graph.js +278 -92
  53. package/dist/node/signals/native-read-client.js +20 -10
  54. package/dist/node/signals/requests.js +100 -108
  55. package/dist/node/signals/scope-streams.js +55 -40
  56. package/dist/node/version.js +1 -1
  57. package/dist/profiling.d.ts +93 -4
  58. package/dist/profiling.js +326 -45
  59. package/dist/runtime.d.ts +44 -29
  60. package/dist/runtime.js +694 -450
  61. package/dist/runtime.server.d.ts +30 -26
  62. package/dist/runtime.server.js +4 -1
  63. package/dist/signals/engine.d.ts +4 -15
  64. package/dist/signals/engine.js +149 -164
  65. package/dist/signals/facade.d.ts +5 -7
  66. package/dist/signals/facade.js +28 -21
  67. package/dist/signals/graph.d.ts +25 -11
  68. package/dist/signals/graph.js +278 -92
  69. package/dist/signals/native-read-client.js +20 -10
  70. package/dist/signals/requests.d.ts +4 -7
  71. package/dist/signals/requests.js +100 -108
  72. package/dist/signals/scope-streams.d.ts +11 -7
  73. package/dist/signals/scope-streams.js +55 -40
  74. package/dist/signals/transition-state.d.ts +2 -3
  75. package/dist/version.js +1 -1
  76. package/package.json +13 -2
package/LICENSE CHANGED
@@ -19,3 +19,31 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
+
23
+ ---
24
+
25
+ The dependency graph algorithms in src/signals/graph.ts are adapted from
26
+ Alien Signals 3.2.1, commit 8734d386d925025d0e99419bd9161c17b112c5ee:
27
+ https://github.com/stackblitz/alien-signals
28
+
29
+ MIT License
30
+
31
+ Copyright (c) 2024-present Johnson Chu
32
+
33
+ Permission is hereby granted, free of charge, to any person obtaining a copy
34
+ of this software and associated documentation files (the "Software"), to deal
35
+ in the Software without restriction, including without limitation the rights
36
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
37
+ copies of the Software, and to permit persons to whom the Software is
38
+ furnished to do so, subject to the following conditions:
39
+
40
+ The above copyright notice and this permission notice shall be included in all
41
+ copies or substantial portions of the Software.
42
+
43
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
44
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
46
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
47
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
48
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
49
+ SOFTWARE.
@@ -110,6 +110,13 @@ function isTextLeaf(node) {
110
110
  const first = node.firstChild;
111
111
  return first === null || !first.nextSibling && (first.nodeType === 3 || first.localName === "font");
112
112
  }
113
+ const htmlWhitespace = /^[\t\n\f\r ]*$/;
114
+ function skipBindingWhitespace(node) {
115
+ while (node !== null && node.nodeType === 3 && htmlWhitespace.test(node.nodeValue)) {
116
+ node = node.nextSibling;
117
+ }
118
+ return node;
119
+ }
113
120
  function resolveFixedNodes(root, descriptor) {
114
121
  assertBindingRoot(root, descriptor);
115
122
  const nodes = [];
@@ -122,12 +129,12 @@ function resolveFixedNodes(root, descriptor) {
122
129
  throw new Error(__octaneDev ? "DOM bindings cannot adopt a mismatched static element topology." : (0, import_error_message_no_arguments.formatNoArgumentErrorMessage)(318));
123
130
  }
124
131
  if (i !== 0) {
125
- cursors[parent] = node.nextSibling;
132
+ cursors[parent] = skipBindingWhitespace(node.nextSibling);
126
133
  childIndices[parent]++;
127
134
  }
128
135
  nodes.push(node);
129
136
  childIndices.push(0);
130
- cursors.push(text || children === null ? null : node.firstChild);
137
+ cursors.push(text || children === null ? null : skipBindingWhitespace(node.firstChild));
131
138
  }
132
139
  for (let i = 0; i < nodes.length; i++) {
133
140
  if (childIndices[i] !== (descriptor.nodes[i][3] ?? 0)) {
@@ -174,9 +181,11 @@ function resolveAddressedNodes(root, descriptor) {
174
181
  }
175
182
  if (parent !== -1) {
176
183
  childCounts[parent]++;
177
- if (cursors[parent] !== void 0) cursors[parent] = node.nextSibling;
184
+ if (cursors[parent] !== void 0) cursors[parent] = skipBindingWhitespace(node.nextSibling);
178
185
  }
179
- cursors.push(text || children === null || openChildren ? void 0 : node.firstChild);
186
+ cursors.push(
187
+ text || children === null || openChildren ? void 0 : skipBindingWhitespace(node.firstChild)
188
+ );
180
189
  }
181
190
  for (let i = 0; i < descriptor.nodes.length; i++) {
182
191
  if (childCounts[i] !== (descriptor.nodes[i][3] ?? 0)) {
@@ -35,7 +35,7 @@ const EAGER_METADATA = /* @__PURE__ */ new Set([
35
35
  // maybeEnqueueRestore: native input/change event sequence state.
36
36
  "$$checkableActivation",
37
37
  "$$selectPick",
38
- // handleFormSubmit/publishManualFormPending: native submit lifetime counter.
38
+ // handleFormSubmit/publishRegisteredManualFormPending: native submit lifetime counter.
39
39
  "$$pendingSubmits"
40
40
  ]);
41
41
  const PROJECTED_PROPERTIES = /* @__PURE__ */ new Set([
@@ -18,6 +18,17 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var event_names_exports = {};
20
20
  __export(event_names_exports, {
21
+ EVENT_BUBBLE: () => EVENT_BUBBLE,
22
+ EVENT_CAPTURE: () => EVENT_CAPTURE,
23
+ EVENT_CUSTOM_NATIVE_ONLY: () => EVENT_CUSTOM_NATIVE_ONLY,
24
+ EVENT_DISABLED_ENTER: () => EVENT_DISABLED_ENTER,
25
+ EVENT_DISABLED_MOUSE: () => EVENT_DISABLED_MOUSE,
26
+ EVENT_DISCRETE: () => EVENT_DISCRETE,
27
+ EVENT_NATIVE_CAPTURE: () => EVENT_NATIVE_CAPTURE,
28
+ EVENT_RESTORE: () => EVENT_RESTORE,
29
+ EVENT_TARGET_ONLY: () => EVENT_TARGET_ONLY,
30
+ RESTORE_EVENT_LIST: () => RESTORE_EVENT_LIST,
31
+ delegatedEventFlags: () => delegatedEventFlags,
21
32
  isDelegatedEventProp: () => isDelegatedEventProp
22
33
  });
23
34
  module.exports = __toCommonJS(event_names_exports);
@@ -33,7 +44,145 @@ function isDelegatedEventProp(name) {
33
44
  }
34
45
  return delegatedEventProps.has(name);
35
46
  }
47
+ const EVENT_BUBBLE = 1;
48
+ const EVENT_CAPTURE = 2;
49
+ const EVENT_NATIVE_CAPTURE = 4;
50
+ const EVENT_TARGET_ONLY = 8;
51
+ const EVENT_DISCRETE = 16;
52
+ const EVENT_RESTORE = 32;
53
+ const EVENT_DISABLED_MOUSE = 64;
54
+ const EVENT_DISABLED_ENTER = 128;
55
+ const EVENT_CUSTOM_NATIVE_ONLY = 256;
56
+ const EMULATED_BUBBLING_EVENTS = [
57
+ "abort",
58
+ "beforetoggle",
59
+ "cancel",
60
+ "canplay",
61
+ "canplaythrough",
62
+ "close",
63
+ "durationchange",
64
+ "emptied",
65
+ "encrypted",
66
+ "ended",
67
+ "error",
68
+ "load",
69
+ "loadeddata",
70
+ "loadedmetadata",
71
+ "loadstart",
72
+ "pause",
73
+ "play",
74
+ "playing",
75
+ "progress",
76
+ "ratechange",
77
+ "resize",
78
+ "seeked",
79
+ "seeking",
80
+ "stalled",
81
+ "suspend",
82
+ "timeupdate",
83
+ "toggle",
84
+ "volumechange",
85
+ "waiting"
86
+ ];
87
+ const CAPTURE_DELEGATED = /* @__PURE__ */ new Set([
88
+ "focus",
89
+ "blur",
90
+ // `invalid` doesn't bubble either, but React's onInvalid propagates (a form's
91
+ // onInvalid observes its controls' invalid events) — so it gets the focus/blur
92
+ // walking treatment, NOT the enter/leave target-only one.
93
+ "invalid",
94
+ "pointerenter",
95
+ "pointerleave",
96
+ "mouseenter",
97
+ "mouseleave",
98
+ // Element `scroll`/`scrollend` don't bubble either. React 17+ made onScroll
99
+ // NON-bubbling (it fires only on the scrolled element), so they get the
100
+ // enter/leave target-only treatment below.
101
+ "scroll",
102
+ "scrollend",
103
+ ...EMULATED_BUBBLING_EVENTS
104
+ ]);
105
+ const TARGET_ONLY_DELEGATED = /* @__PURE__ */ new Set([
106
+ "pointerenter",
107
+ "pointerleave",
108
+ "mouseenter",
109
+ "mouseleave",
110
+ // React 17+ parity: onScroll fires on the scrolled element only (no synthetic
111
+ // bubbling), and ancestors receive their own scroll events natively.
112
+ "scroll",
113
+ "scrollend"
114
+ ]);
115
+ const DISCRETE_EVENTS = /* @__PURE__ */ new Set([
116
+ "auxclick",
117
+ "beforeblur",
118
+ "beforeinput",
119
+ "blur",
120
+ "cancel",
121
+ "change",
122
+ "click",
123
+ "close",
124
+ "compositionend",
125
+ "compositionstart",
126
+ "compositionupdate",
127
+ "contextmenu",
128
+ "copy",
129
+ "cut",
130
+ "dblclick",
131
+ "dragend",
132
+ "dragstart",
133
+ "drop",
134
+ "focus",
135
+ "focusin",
136
+ "focusout",
137
+ "fullscreenchange",
138
+ "gotpointercapture",
139
+ "hashchange",
140
+ "input",
141
+ "invalid",
142
+ "keydown",
143
+ "keypress",
144
+ "keyup",
145
+ "lostpointercapture",
146
+ "mousedown",
147
+ "mouseup",
148
+ "paste",
149
+ "pause",
150
+ "play",
151
+ "pointercancel",
152
+ "pointerdown",
153
+ "pointerup",
154
+ "popstate",
155
+ "ratechange",
156
+ "reset",
157
+ "resize",
158
+ "seeked",
159
+ "select",
160
+ "selectionchange",
161
+ "selectstart",
162
+ "submit",
163
+ "textInput",
164
+ "touchcancel",
165
+ "touchend",
166
+ "touchstart",
167
+ "volumechange"
168
+ ]);
169
+ const RESTORE_EVENT_LIST = ["input", "change", "click"];
170
+ const RESTORE_EVENTS = /* @__PURE__ */ new Set(RESTORE_EVENT_LIST);
171
+ function delegatedEventFlags(name) {
172
+ return (CAPTURE_DELEGATED.has(name) ? EVENT_NATIVE_CAPTURE : 0) | (TARGET_ONLY_DELEGATED.has(name) ? EVENT_TARGET_ONLY : 0) | (DISCRETE_EVENTS.has(name) ? EVENT_DISCRETE : 0) | (RESTORE_EVENTS.has(name) ? EVENT_RESTORE : 0) | (name === "click" || name === "dblclick" || name === "mousedown" || name === "mousemove" || name === "mouseup" ? EVENT_DISABLED_MOUSE : 0) | (name === "mouseenter" ? EVENT_DISABLED_ENTER : 0) | (name === "invalid" || EMULATED_BUBBLING_EVENTS.includes(name) ? EVENT_CUSTOM_NATIVE_ONLY : 0);
173
+ }
36
174
  // Annotate the CommonJS export names for ESM import in node:
37
175
  0 && (module.exports = {
176
+ EVENT_BUBBLE,
177
+ EVENT_CAPTURE,
178
+ EVENT_CUSTOM_NATIVE_ONLY,
179
+ EVENT_DISABLED_ENTER,
180
+ EVENT_DISABLED_MOUSE,
181
+ EVENT_DISCRETE,
182
+ EVENT_NATIVE_CAPTURE,
183
+ EVENT_RESTORE,
184
+ EVENT_TARGET_ONLY,
185
+ RESTORE_EVENT_LIST,
186
+ delegatedEventFlags,
38
187
  isDelegatedEventProp
39
188
  });
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var host_budget_exports = {};
20
20
  __export(host_budget_exports, {
21
+ hasPendingHostBudget: () => hasPendingHostBudget,
21
22
  yieldForHostBudget: () => yieldForHostBudget
22
23
  });
23
24
  module.exports = __toCommonJS(host_budget_exports);
@@ -25,6 +26,9 @@ var import_host_task = require("./host-task.cjs");
25
26
  const HOST_BUDGET_MS = 5;
26
27
  let started = 0;
27
28
  let sentinel;
29
+ function hasPendingHostBudget() {
30
+ return sentinel !== void 0;
31
+ }
28
32
  function yieldForHostBudget() {
29
33
  const now = typeof performance === "object" ? performance.now() : Date.now();
30
34
  if (sentinel === void 0) {
@@ -40,5 +44,6 @@ function yieldForHostBudget() {
40
44
  }
41
45
  // Annotate the CommonJS export names for ESM import in node:
42
46
  0 && (module.exports = {
47
+ hasPendingHostBudget,
43
48
  yieldForHostBudget
44
49
  });
@@ -27,16 +27,25 @@ __export(host_property_diagnostics_exports, {
27
27
  module.exports = __toCommonJS(host_property_diagnostics_exports);
28
28
  var import_constants = require("./constants.cjs");
29
29
  const KNOWN_CAMELCASE_PROPERTIES = /* @__PURE__ */ new Set([
30
+ "accessKey",
30
31
  "autoCapitalize",
31
32
  "autoComplete",
32
33
  "autoCorrect",
33
34
  "autoFocus",
34
35
  "autoPlay",
35
36
  "allowFullScreen",
37
+ "autoSave",
38
+ "cellPadding",
39
+ "cellSpacing",
36
40
  "charSet",
41
+ "classID",
37
42
  "className",
43
+ "colSpan",
38
44
  "contentEditable",
45
+ "contextMenu",
46
+ "controlsList",
39
47
  "dangerouslySetInnerHTML",
48
+ "dateTime",
40
49
  "defaultChecked",
41
50
  "defaultValue",
42
51
  "disablePictureInPicture",
@@ -49,6 +58,8 @@ const KNOWN_CAMELCASE_PROPERTIES = /* @__PURE__ */ new Set([
49
58
  "formMethod",
50
59
  "formNoValidate",
51
60
  "formTarget",
61
+ "frameBorder",
62
+ "hrefLang",
52
63
  "imageSizes",
53
64
  "imageSrcSet",
54
65
  "inputMode",
@@ -57,13 +68,22 @@ const KNOWN_CAMELCASE_PROPERTIES = /* @__PURE__ */ new Set([
57
68
  "itemRef",
58
69
  "itemScope",
59
70
  "itemType",
71
+ "keyParams",
72
+ "keyType",
73
+ "marginHeight",
74
+ "marginWidth",
60
75
  "maxLength",
76
+ "mediaGroup",
61
77
  "minLength",
62
78
  "noModule",
63
79
  "noValidate",
64
80
  "playsInline",
81
+ "popoverTarget",
82
+ "popoverTargetAction",
83
+ "radioGroup",
65
84
  "readOnly",
66
85
  "referrerPolicy",
86
+ "rowSpan",
67
87
  "spellCheck",
68
88
  "srcDoc",
69
89
  "srcLang",
@@ -72,6 +92,7 @@ const KNOWN_CAMELCASE_PROPERTIES = /* @__PURE__ */ new Set([
72
92
  "suppressHydrationWarning",
73
93
  "suppressNativeChangeWarning",
74
94
  "tabIndex",
95
+ "useMap",
75
96
  "viewBox"
76
97
  ]);
77
98
  const KNOWN_PROPERTY_SPELLINGS = /* @__PURE__ */ new Map();
@@ -21,7 +21,10 @@ __export(host_task_exports, {
21
21
  postHostTask: () => postHostTask
22
22
  });
23
23
  module.exports = __toCommonJS(host_task_exports);
24
+ var import_profiling = require("./profiling.cjs");
24
25
  function postHostTask(callback) {
26
+ if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__)
27
+ (0, import_profiling.__profileCount)(import_profiling.ProfileCounter.TASK_POST);
25
28
  const scheduler = globalThis.scheduler;
26
29
  if (typeof scheduler?.postTask === "function") {
27
30
  scheduler.postTask(callback);