octane 0.4.2 → 0.4.3

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 (57) hide show
  1. package/dist/cjs/context-identity.cjs +29 -0
  2. package/dist/cjs/dom-stage.cjs +24 -18
  3. package/dist/cjs/error-codes.server.generated.cjs +5 -0
  4. package/dist/cjs/hydration-markers.cjs +12 -0
  5. package/dist/cjs/index.cjs +2 -0
  6. package/dist/cjs/runtime.cjs +253 -393
  7. package/dist/cjs/runtime.server.cjs +137 -35
  8. package/dist/cjs/server/index.cjs +2 -0
  9. package/dist/cjs/server/streamed-signals.cjs +41 -9
  10. package/dist/cjs/signals/client.cjs +1 -6
  11. package/dist/cjs/signals/engine.cjs +1 -12
  12. package/dist/cjs/version.cjs +1 -1
  13. package/dist/compiler/client-only-server.js +1 -28
  14. package/dist/compiler/compile-renderer-boundaries.js +1 -22
  15. package/dist/compiler/compile-universal.js +1 -22
  16. package/dist/compiler/compile.js +782 -359
  17. package/dist/compiler/dom-binding-fixed-props.js +11 -1
  18. package/dist/compiler/generated-origin.js +46 -0
  19. package/dist/compiler/hydrate-boundaries.js +88 -52
  20. package/dist/compiler/plain-hook-memo.js +5 -1
  21. package/dist/compiler/pure-factories.js +66 -0
  22. package/dist/compiler/register.js +4 -1
  23. package/dist/compiler/slot-hooks.js +113 -186
  24. package/dist/compiler/typescript-lowering.js +763 -0
  25. package/dist/compiler/void-roots.js +239 -0
  26. package/dist/compiler/volar.js +91 -38
  27. package/dist/context-identity.d.ts +14 -0
  28. package/dist/context-identity.js +28 -0
  29. package/dist/dom-stage.js +24 -18
  30. package/dist/error-codes.server.generated.d.ts +1 -0
  31. package/dist/error-codes.server.generated.js +5 -0
  32. package/dist/hydration/idle.js +1 -0
  33. package/dist/hydration/independent-island.js +53 -2
  34. package/dist/hydration/media.js +1 -0
  35. package/dist/hydration/types.d.ts +5 -0
  36. package/dist/hydration/visible.js +1 -0
  37. package/dist/hydration-markers.d.ts +8 -0
  38. package/dist/hydration-markers.js +8 -0
  39. package/dist/index.d.ts +1 -1
  40. package/dist/index.js +2 -0
  41. package/dist/runtime.d.ts +25 -40
  42. package/dist/runtime.js +254 -398
  43. package/dist/runtime.server.d.ts +23 -2
  44. package/dist/runtime.server.js +142 -36
  45. package/dist/server/index.d.ts +1 -1
  46. package/dist/server/index.js +2 -0
  47. package/dist/server/streamed-signals.js +41 -9
  48. package/dist/signals/client.js +3 -8
  49. package/dist/signals/engine.d.ts +0 -2
  50. package/dist/signals/engine.js +1 -13
  51. package/dist/universal-core.js +1 -1
  52. package/dist/version.js +1 -1
  53. package/package.json +1 -1
  54. package/dist/cjs/signals/diagnostic-local-hook.cjs +0 -37
  55. package/dist/compiler/local-void-roots.js +0 -154
  56. package/dist/signals/diagnostic-local-hook.d.ts +0 -8
  57. package/dist/signals/diagnostic-local-hook.js +0 -12
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var context_identity_exports = {};
20
20
  __export(context_identity_exports, {
21
+ defineRemovedContextMembers: () => defineRemovedContextMembers,
21
22
  isContext: () => isContext,
22
23
  registerContext: () => registerContext
23
24
  });
@@ -36,8 +37,36 @@ function isContext(value) {
36
37
  const identities = globalThis[CONTEXT_IDENTITIES];
37
38
  return identities != null && identities.has(value) === true;
38
39
  }
40
+ function defineRemovedContextMembers(context) {
41
+ let consumerWarned = false;
42
+ Object.defineProperties(context, {
43
+ Consumer: {
44
+ configurable: true,
45
+ get() {
46
+ if (!consumerWarned) {
47
+ consumerWarned = true;
48
+ console.error(
49
+ "Octane has no Context.Consumer. Read the context directly with use(Context) or useContext(Context) in the child component \u2014 Octane hooks are call-site keyed, so the read is legal behind any condition the render-prop form was working around."
50
+ );
51
+ }
52
+ return void 0;
53
+ }
54
+ },
55
+ Provider: {
56
+ configurable: true,
57
+ get() {
58
+ const error = new Error(
59
+ "[OCTANE_CONTEXT_PROVIDER] Context.Provider was removed. Render the context itself as the provider: <Context value={...}>...</Context>."
60
+ );
61
+ error.code = "OCTANE_CONTEXT_PROVIDER";
62
+ throw error;
63
+ }
64
+ }
65
+ });
66
+ }
39
67
  // Annotate the CommonJS export names for ESM import in node:
40
68
  0 && (module.exports = {
69
+ defineRemovedContextMembers,
41
70
  isContext,
42
71
  registerContext
43
72
  });
@@ -508,19 +508,19 @@ class DOMStage {
508
508
  }
509
509
  setFormProperty(node, key, value) {
510
510
  if (node.localName === "input" && (key === "checked" || key === "defaultChecked") && this.state(node).type === "radio") {
511
- const projected2 = this.projection(node, true);
512
- const target2 = projected2.node;
513
- Reflect.set(target2, key, value);
514
- for (const [copy, original] of projected2.originals) {
511
+ const projected = this.projection(node, true);
512
+ const target = projected.node;
513
+ Reflect.set(target, key, value);
514
+ for (const [copy, original] of projected.originals) {
515
515
  if (copy.nodeType !== 1 || copy.localName !== "input") continue;
516
516
  const input = copy;
517
- if (input !== target2 && (input.type !== "radio" || input.name !== target2.name || input.form !== target2.form))
517
+ if (input !== target && (input.type !== "radio" || input.name !== target.name || input.form !== target.form))
518
518
  continue;
519
519
  this.states.set(original, this.inertDocument(original).importNode(input, false));
520
520
  this.values.get(original)?.delete("checked");
521
521
  }
522
522
  this.projections.clear();
523
- this.projections.set(projected2.root, projected2);
523
+ this.projections.set(projected.root, projected);
524
524
  this.enqueue(() => {
525
525
  Reflect.set(node, key, value, node);
526
526
  });
@@ -542,20 +542,26 @@ class DOMStage {
542
542
  } else if (node.localName !== "select" || key !== "value" && key !== "selectedIndex")
543
543
  return false;
544
544
  if (select === null) return false;
545
- const projected = this.projection(select);
546
- let target = projected.node;
547
- if (node !== select)
548
- for (const [copy, original] of projected.originals) {
549
- if (original === node) {
550
- target = copy;
551
- break;
545
+ if (node !== select && this.get(select, "multiple")) {
546
+ const state = this.state(node);
547
+ state.selected = value;
548
+ this.value(node, "selected", state.selected);
549
+ } else {
550
+ const projected = this.projection(select);
551
+ let target = projected.node;
552
+ if (node !== select)
553
+ for (const [copy, original] of projected.originals) {
554
+ if (original === node) {
555
+ target = copy;
556
+ break;
557
+ }
552
558
  }
559
+ Reflect.set(target, key, value);
560
+ for (const option of Array.from(projected.node.options)) {
561
+ const original = projected.originals.get(option);
562
+ this.state(original).selected = option.selected;
563
+ this.value(original, "selected", option.selected);
553
564
  }
554
- Reflect.set(target, key, value);
555
- for (const option of Array.from(projected.node.options)) {
556
- const original = projected.originals.get(option);
557
- this.state(original).selected = option.selected;
558
- this.value(original, "selected", option.selected);
559
565
  }
560
566
  this.enqueue(() => {
561
567
  Reflect.set(node, key, value, node);
@@ -173,6 +173,11 @@ function formatServerError(code, ...args) {
173
173
  return (0, import_error_message.formatDevErrorMessage)("Unsupported Octane server signal binding ABI.", args);
174
174
  case 73:
175
175
  return (0, import_error_message.formatDevErrorMessage)("Octane DOM bindings require unique list keys.", args);
176
+ case 80:
177
+ return (0, import_error_message.formatDevErrorMessage)(
178
+ "Independent Hydrate cannot activate a `%s` strategy because its lexical parent never runs on the client. Use load(), idle(), visible(), media(), interaction(), or never(), or remove `independent`.",
179
+ args
180
+ );
176
181
  default:
177
182
  return (0, import_error_message.formatUnknownDevErrorMessage)(code);
178
183
  }
@@ -18,12 +18,16 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var hydration_markers_exports = {};
20
20
  __export(hydration_markers_exports, {
21
+ HYDRATE_IDLE_TIMEOUT_ATTR: () => HYDRATE_IDLE_TIMEOUT_ATTR,
21
22
  HYDRATE_ID_ATTR: () => HYDRATE_ID_ATTR,
22
23
  HYDRATE_ID_COUNT_ATTR: () => HYDRATE_ID_COUNT_ATTR,
23
24
  HYDRATE_INDEPENDENT_ATTR: () => HYDRATE_INDEPENDENT_ATTR,
24
25
  HYDRATE_INPUT_ATTR: () => HYDRATE_INPUT_ATTR,
25
26
  HYDRATE_MARKER_SELECTOR: () => HYDRATE_MARKER_SELECTOR,
27
+ HYDRATE_MEDIA_ATTR: () => HYDRATE_MEDIA_ATTR,
26
28
  HYDRATE_SEED_ATTR: () => HYDRATE_SEED_ATTR,
29
+ HYDRATE_VISIBLE_MARGIN_ATTR: () => HYDRATE_VISIBLE_MARGIN_ATTR,
30
+ HYDRATE_VISIBLE_THRESHOLD_ATTR: () => HYDRATE_VISIBLE_THRESHOLD_ATTR,
27
31
  HYDRATE_WHEN_ATTR: () => HYDRATE_WHEN_ATTR,
28
32
  HYDRATION_END: () => HYDRATION_END,
29
33
  HYDRATION_FOR_ARM_INDEX: () => HYDRATION_FOR_ARM_INDEX,
@@ -42,6 +46,10 @@ const HYDRATE_INPUT_ATTR = "data-octane-input";
42
46
  const SIGNAL_CONTROL_ATTR = "data-octane-signal-control";
43
47
  const HYDRATE_ID_ATTR = "data-octane-hydrate-id";
44
48
  const HYDRATE_WHEN_ATTR = "data-octane-hydrate-when";
49
+ const HYDRATE_IDLE_TIMEOUT_ATTR = "data-octane-hydrate-timeout";
50
+ const HYDRATE_VISIBLE_MARGIN_ATTR = "data-octane-hydrate-root-margin";
51
+ const HYDRATE_VISIBLE_THRESHOLD_ATTR = "data-octane-hydrate-threshold";
52
+ const HYDRATE_MEDIA_ATTR = "data-octane-hydrate-media";
45
53
  const HYDRATE_ID_COUNT_ATTR = "data-octane-hydrate-id-count";
46
54
  const HYDRATE_SEED_ATTR = "data-octane-hydrate-seed";
47
55
  const HYDRATE_MARKER_SELECTOR = "[data-octane-hydrate-id]";
@@ -56,12 +64,16 @@ function formatUseId(prefix, ordinal) {
56
64
  }
57
65
  // Annotate the CommonJS export names for ESM import in node:
58
66
  0 && (module.exports = {
67
+ HYDRATE_IDLE_TIMEOUT_ATTR,
59
68
  HYDRATE_ID_ATTR,
60
69
  HYDRATE_ID_COUNT_ATTR,
61
70
  HYDRATE_INDEPENDENT_ATTR,
62
71
  HYDRATE_INPUT_ATTR,
63
72
  HYDRATE_MARKER_SELECTOR,
73
+ HYDRATE_MEDIA_ATTR,
64
74
  HYDRATE_SEED_ATTR,
75
+ HYDRATE_VISIBLE_MARGIN_ATTR,
76
+ HYDRATE_VISIBLE_THRESHOLD_ATTR,
65
77
  HYDRATE_WHEN_ATTR,
66
78
  HYDRATION_END,
67
79
  HYDRATION_FOR_ARM_INDEX,
@@ -42,6 +42,7 @@ __export(index_exports, {
42
42
  __useLinkedStateWithGetter: () => import_runtime.__useLinkedStateWithGetter,
43
43
  __useReducerWithGetter: () => import_runtime.__useReducerWithGetter,
44
44
  __useStateWithGetter: () => import_runtime.__useStateWithGetter,
45
+ __voidRootProps: () => import_runtime.__voidRootProps,
45
46
  __vtSeen: () => import_runtime.__vtSeen,
46
47
  act: () => import_runtime.act,
47
48
  activityBlock: () => import_runtime.activityBlock,
@@ -284,6 +285,7 @@ var import_method_dep = require("./method-dep.cjs");
284
285
  __useLinkedStateWithGetter,
285
286
  __useReducerWithGetter,
286
287
  __useStateWithGetter,
288
+ __voidRootProps,
287
289
  __vtSeen,
288
290
  act,
289
291
  activityBlock,