octane 0.3.6 → 0.4.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.
@@ -149,6 +149,21 @@ for (const name of [
149
149
  ]) {
150
150
  KNOWN_SVG_PROPERTY_SPELLINGS.set(name.toLowerCase(), name);
151
151
  }
152
+ const NON_NATIVE_LOWERCASE_PROPERTIES = /* @__PURE__ */ new Set([
153
+ "autoFocus",
154
+ "defaultValue",
155
+ "defaultChecked",
156
+ "dangerouslySetInnerHTML",
157
+ "className",
158
+ "suppressContentEditableWarning",
159
+ "suppressHydrationWarning",
160
+ "suppressNativeChangeWarning",
161
+ "__octaneNativeChangeDiagnostic",
162
+ "acceptCharset",
163
+ "htmlFor",
164
+ "httpEquiv",
165
+ "viewBox"
166
+ ]);
152
167
  function hostPropertyWarning(name, value, tag, isSvg = false) {
153
168
  const lower = name.toLowerCase();
154
169
  if (name === "for" && tag === "label") return null;
@@ -164,6 +179,9 @@ function hostPropertyWarning(name, value, tag, isSvg = false) {
164
179
  if (name.startsWith("aria-") || /^aria[A-Z]/.test(name) || name.startsWith("data-")) return null;
165
180
  const known = KNOWN_PROPERTY_SPELLINGS.get(lower) ?? (isSvg ? KNOWN_SVG_PROPERTY_SPELLINGS.get(lower) : void 0);
166
181
  if (known !== void 0) {
182
+ if (!isSvg && name === lower && // Hyphenated/namespaced presentation aliases belong to SVG, not HTML.
183
+ !name.includes("-") && !name.includes(":") && !NON_NATIVE_LOWERCASE_PROPERTIES.has(known) && (import_constants.ATTRIBUTE_ALIASES.get(known) ?? lower) === lower)
184
+ return null;
167
185
  if (isSvg && import_constants.ATTRIBUTE_ALIASES.get(known) === name) return null;
168
186
  return name !== known ? `Invalid DOM property \`${name}\`. Did you mean \`${known}\`?` : null;
169
187
  }
@@ -85,6 +85,7 @@ __export(index_exports, {
85
85
  createElement: () => import_runtime.createElement,
86
86
  createHostContextRequest: () => import_runtime.createHostContextRequest,
87
87
  createPortal: () => import_runtime.createPortal,
88
+ createResizeObserver: () => import_resize_observer.createResizeObserver,
88
89
  createRoot: () => import_runtime.createRoot,
89
90
  createScopedElement: () => import_runtime.createScopedElement,
90
91
  createScopedValue: () => import_runtime.createScopedValue,
@@ -246,6 +247,7 @@ __export(index_exports, {
246
247
  });
247
248
  module.exports = __toCommonJS(index_exports);
248
249
  var import_trusted_html = require("./trusted-html.cjs");
250
+ var import_resize_observer = require("./resize-observer.cjs");
249
251
  var import_version = require("./version.cjs");
250
252
  var import_compatibility = require("./compatibility.cjs");
251
253
  var import_event_capture = require("./hydration/event-capture.cjs");
@@ -325,6 +327,7 @@ var import_method_dep = require("./method-dep.cjs");
325
327
  createElement,
326
328
  createHostContextRequest,
327
329
  createPortal,
330
+ createResizeObserver,
328
331
  createRoot,
329
332
  createScopedElement,
330
333
  createScopedValue,
@@ -0,0 +1,129 @@
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 resize_observer_exports = {};
20
+ __export(resize_observer_exports, {
21
+ createResizeObserver: () => createResizeObserver
22
+ });
23
+ module.exports = __toCommonJS(resize_observer_exports);
24
+ let queuedCallbacks = null;
25
+ let postTask;
26
+ function drainCallbacks() {
27
+ const callbacks = queuedCallbacks;
28
+ queuedCallbacks = null;
29
+ if (callbacks === null) return;
30
+ for (const callback of callbacks) {
31
+ try {
32
+ callback();
33
+ } catch (error) {
34
+ if (typeof reportError === "function") reportError(error);
35
+ else
36
+ setTimeout(() => {
37
+ throw error;
38
+ }, 0);
39
+ }
40
+ }
41
+ }
42
+ function enqueue(callback) {
43
+ if (queuedCallbacks !== null) {
44
+ queuedCallbacks.add(callback);
45
+ return;
46
+ }
47
+ queuedCallbacks = /* @__PURE__ */ new Set([callback]);
48
+ if (postTask === void 0) {
49
+ if (typeof MessageChannel === "undefined") {
50
+ postTask = () => {
51
+ setTimeout(drainCallbacks, 0);
52
+ };
53
+ } else {
54
+ const channel = new MessageChannel();
55
+ channel.port1.onmessage = drainCallbacks;
56
+ postTask = () => channel.port2.postMessage(null);
57
+ }
58
+ }
59
+ postTask();
60
+ }
61
+ function createResizeObserver(callback, ResizeObserverCtor = ResizeObserver) {
62
+ if (typeof callback !== "function")
63
+ throw new TypeError("ResizeObserver callback must be a function");
64
+ const entries = /* @__PURE__ */ new Map();
65
+ const boxes = /* @__PURE__ */ new Map();
66
+ let pending = false;
67
+ const deliver = () => {
68
+ if (!pending) return;
69
+ pending = false;
70
+ const batch = Array.from(entries.values());
71
+ entries.clear();
72
+ Reflect.apply(callback, observer, [batch, observer]);
73
+ };
74
+ const observer = new ResizeObserverCtor((batch) => {
75
+ pending = true;
76
+ for (const entry of batch) entries.set(entry.target, entry);
77
+ enqueue(deliver);
78
+ });
79
+ const observe = observer.observe;
80
+ const unobserve = observer.unobserve;
81
+ const disconnect = observer.disconnect;
82
+ const discard = (target) => {
83
+ if (entries.delete(target) && entries.size === 0) {
84
+ pending = false;
85
+ queuedCallbacks?.delete(deliver);
86
+ }
87
+ };
88
+ observer.observe = function(target, options) {
89
+ let box = "content-box";
90
+ let nativeOptions = options;
91
+ if (options !== null && (typeof options === "object" || typeof options === "function")) {
92
+ nativeOptions = {
93
+ get box() {
94
+ const value = options.box;
95
+ if (value === void 0) return void 0;
96
+ box = `${value}`;
97
+ return box;
98
+ }
99
+ };
100
+ }
101
+ observe.call(this, target, nativeOptions);
102
+ if (this !== observer) return;
103
+ if (boxes.get(target) !== box) discard(target);
104
+ boxes.set(target, box);
105
+ };
106
+ observer.unobserve = function(target) {
107
+ unobserve.call(this, target);
108
+ if (this !== observer) return;
109
+ boxes.delete(target);
110
+ discard(target);
111
+ if (boxes.size === 0 && entries.size === 0) {
112
+ pending = false;
113
+ queuedCallbacks?.delete(deliver);
114
+ }
115
+ };
116
+ observer.disconnect = function() {
117
+ disconnect.call(this);
118
+ if (this !== observer) return;
119
+ boxes.clear();
120
+ entries.clear();
121
+ pending = false;
122
+ queuedCallbacks?.delete(deliver);
123
+ };
124
+ return observer;
125
+ }
126
+ // Annotate the CommonJS export names for ESM import in node:
127
+ 0 && (module.exports = {
128
+ createResizeObserver
129
+ });
@@ -403,7 +403,6 @@ let NATIVE_BLOCK_RETRIES = null;
403
403
  let NATIVE_ADOPTION_RELEASES = null;
404
404
  let SIGNAL_BINDINGS_ENABLED = false;
405
405
  const SCOPE_SIGNAL_OWNERS = /* @__PURE__ */ new WeakMap();
406
- const SCOPE_SIGNAL_INSTANCE_KEYS = /* @__PURE__ */ new WeakMap();
407
406
  let RETAINED_SIGNAL_OWNERS;
408
407
  const SIGNAL_RETRY_LOCATIONS = /* @__PURE__ */ new WeakMap();
409
408
  function signalRetryBoundary(block) {
@@ -604,17 +603,30 @@ function rootSignalInstanceKey(ids) {
604
603
  return JSON.stringify([ids.signalState?.prefix ?? ids.prefix, "root"]);
605
604
  }
606
605
  function resolveSignalInstanceKey(scope) {
607
- const identity = SCOPE_SIGNAL_INSTANCE_KEYS.get(scope);
608
- if (identity === void 0 || typeof identity === "string") return identity;
606
+ const resolved = scope.signalInstanceResolved;
607
+ if (resolved !== void 0) return resolved;
608
+ const parent = scope.signalInstanceParent;
609
+ if (parent === null) return void 0;
609
610
  const key = structuralSignalInstanceKey(
610
- identity.parentScope,
611
- identity.invocationSite,
612
- identity.key,
613
- identity.hasKey
611
+ parent,
612
+ scope.signalInstanceSite,
613
+ scope.signalInstanceValue,
614
+ scope.signalInstanceHasKey
614
615
  );
615
- SCOPE_SIGNAL_INSTANCE_KEYS.set(scope, key);
616
+ scope.signalInstanceResolved = key;
616
617
  return key;
617
618
  }
619
+ function stampSignalInstanceKey(scope, key) {
620
+ if (typeof key === "string") {
621
+ scope.signalInstanceResolved = key;
622
+ return;
623
+ }
624
+ scope.signalInstanceParent = key.parentScope;
625
+ scope.signalInstanceSite = key.invocationSite;
626
+ scope.signalInstanceValue = key.key;
627
+ scope.signalInstanceHasKey = key.hasKey;
628
+ scope.signalInstanceResolved = void 0;
629
+ }
618
630
  function structuralSignalInstanceKey(parentScope, invocationSite, key, hasKey) {
619
631
  let base = resolveSignalInstanceKey(parentScope);
620
632
  const itemKeys = [];
@@ -645,7 +657,11 @@ function structuralSignalInstanceKey(parentScope, invocationSite, key, hasKey) {
645
657
  }
646
658
  function stampSignalInstance(scope, parentScope, invocationSite, key, hasKey) {
647
659
  if (SIGNAL_BINDINGS_ENABLED || import_document_owner.signalDocumentEnabled) {
648
- SCOPE_SIGNAL_INSTANCE_KEYS.set(scope, { parentScope, invocationSite, key, hasKey });
660
+ scope.signalInstanceParent = parentScope;
661
+ scope.signalInstanceSite = invocationSite;
662
+ scope.signalInstanceValue = key;
663
+ scope.signalInstanceHasKey = hasKey;
664
+ scope.signalInstanceResolved = void 0;
649
665
  }
650
666
  }
651
667
  function scopeSignalOwner(scope) {
@@ -6078,14 +6094,20 @@ function drainEffectEventUpdates() {
6078
6094
  for (let i = 0; i < q.length; i++) {
6079
6095
  const entry = q[i];
6080
6096
  const block = entry.block;
6081
- if (!entry.cell.active || NATIVE_READ_DRIVER?.publicationCurrent(entry) === false || blockSubtreeDisposed(block) || // Independently scheduled siblings may complete before another child
6082
- // suspends their shared boundary. That boundary hides the try
6083
- // subtree, so its completed payload is still uncommitted. Do not use the
6084
- // broader inactive check: hidden Activity renders intentionally publish
6085
- // fresh Effect Event bodies while their DOM/effects stay preserved.
6086
- findSuspenseHiddenTry(block) !== null || block.effectEventRenderVersion !== entry.renderVersion || block.effectEventCompletedVersion !== entry.renderVersion) {
6097
+ if (!entry.cell.active || NATIVE_READ_DRIVER?.publicationCurrent(entry) === false || blockSubtreeDisposed(block))
6098
+ continue;
6099
+ const hiddenOwner = findScheduledVisibilityOwner(block, true);
6100
+ if (block.renderStatus !== RENDER_VALID && hiddenOwner === null) continue;
6101
+ if (hiddenOwner !== null && hiddenOwner.__kind === "trySlotSlot") {
6102
+ const hiddenTry = hiddenOwner;
6103
+ deferHiddenRevealAction(hiddenTry, () => {
6104
+ if (entry.cell.active && !blockSubtreeDisposed(block) && block.effectEventRenderVersion === entry.renderVersion && block.effectEventCompletedVersion === entry.renderVersion)
6105
+ entry.cell.impl = entry.nextImpl;
6106
+ });
6087
6107
  continue;
6088
6108
  }
6109
+ if (block.effectEventRenderVersion !== entry.renderVersion || block.effectEventCompletedVersion !== entry.renderVersion)
6110
+ continue;
6089
6111
  entry.cell.impl = entry.nextImpl;
6090
6112
  }
6091
6113
  }
@@ -6532,6 +6554,11 @@ class BlockImpl {
6532
6554
  this.__activitySlot = void 0;
6533
6555
  this.__warmCache = void 0;
6534
6556
  this.__warmCacheEpisode = void 0;
6557
+ this.signalInstanceParent = null;
6558
+ this.signalInstanceSite = void 0;
6559
+ this.signalInstanceValue = void 0;
6560
+ this.signalInstanceHasKey = false;
6561
+ this.signalInstanceResolved = void 0;
6535
6562
  }
6536
6563
  }
6537
6564
  class ScopeImpl {
@@ -6551,6 +6578,11 @@ class ScopeImpl {
6551
6578
  this.mounted = false;
6552
6579
  this.slots = [];
6553
6580
  this.compilerMemo = null;
6581
+ this.signalInstanceParent = null;
6582
+ this.signalInstanceSite = void 0;
6583
+ this.signalInstanceValue = void 0;
6584
+ this.signalInstanceHasKey = false;
6585
+ this.signalInstanceResolved = void 0;
6554
6586
  }
6555
6587
  }
6556
6588
  function createBlock(kind, parentBlock, parentNode, startMarker, endMarker, body, props, extra, outputHandler = null) {
@@ -6695,7 +6727,8 @@ function endUrgentTransitionRender(block, render) {
6695
6727
  }
6696
6728
  function renderBlockInner(block) {
6697
6729
  if (block.renderStatus === RENDER_INVALID) block.renderStatus = RENDER_RETRYING;
6698
- if (WIP_CAPTURE !== null) recordCapturedRender(WIP_CAPTURE, block);
6730
+ if (WIP_CAPTURE !== null && WIP_CAPTURE.rootTransaction !== true)
6731
+ recordCapturedRender(WIP_CAPTURE, block);
6699
6732
  if (TRANSITION_JOURNAL !== null) {
6700
6733
  TRANSITION_JOURNAL.push(JOURNAL_RENDER, block, null, null);
6701
6734
  }
@@ -6773,7 +6806,7 @@ function renderBlockInner(block) {
6773
6806
  if (block.outputHandler !== null && (out !== void 0 || block.slots[0]?.returnedOutput === true)) {
6774
6807
  block.outputHandler(block, out ?? null);
6775
6808
  }
6776
- finishEffectRender(block);
6809
+ if (block.effectSlots !== null) finishEffectRender(block);
6777
6810
  if (!block.mounted) block.mounted = true;
6778
6811
  if (block.renderStatus === RENDER_RETRYING) block.renderStatus = RENDER_VALID;
6779
6812
  if (block.effectEventRenderVersion !== 0) {
@@ -7062,6 +7095,11 @@ class LiteBlockImpl {
7062
7095
  this.parentBlock = parentBlock;
7063
7096
  this.$$ctxValues = null;
7064
7097
  this.idState = parentBlock.idState;
7098
+ this.signalInstanceParent = null;
7099
+ this.signalInstanceSite = void 0;
7100
+ this.signalInstanceValue = void 0;
7101
+ this.signalInstanceHasKey = false;
7102
+ this.signalInstanceResolved = void 0;
7065
7103
  }
7066
7104
  }
7067
7105
  function componentSlotLite(parentScope, slotKey, host, comp, props, anchor, invocationSite) {
@@ -7130,9 +7168,14 @@ function componentSlotLite(parentScope, slotKey, host, comp, props, anchor, invo
7130
7168
  let profileThrown;
7131
7169
  const nativeToken = NATIVE_READ_DRIVER === null ? -1 : beginActiveNativeReadScope(scope);
7132
7170
  try {
7133
- if (import_document_owner.signalDocumentEnabled || scope.block.idState.renderOwner?.signalOwner !== void 0)
7134
- runWithBlockSignalOwner(scope, () => comp(props, scope, void 0));
7135
- else comp(props, scope, void 0);
7171
+ if (import_document_owner.signalDocumentEnabled || scope.block.idState.renderOwner?.signalOwner !== void 0) {
7172
+ const owner = scopeSignalOwner(scope);
7173
+ if (owner !== void 0 && (process.env.NODE_ENV === "production" || hydrateAttributeProbe === null))
7174
+ (0, import_document_owner.streamedSignalOwnerActivator)?.(owner);
7175
+ if (owner === void 0 || (0, import_owner_context.currentSignalOwner)() === owner) {
7176
+ comp(props, scope, void 0);
7177
+ } else (0, import_owner_context.runWithSignalOwner)(owner, () => comp(props, scope, void 0));
7178
+ } else comp(props, scope, void 0);
7136
7179
  if (!scope.mounted) scope.mounted = true;
7137
7180
  } catch (error) {
7138
7181
  profileDidThrow = true;
@@ -18788,7 +18831,7 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
18788
18831
  void 0,
18789
18832
  outputHandler
18790
18833
  );
18791
- if (signalInstanceKey !== void 0) SCOPE_SIGNAL_INSTANCE_KEYS.set(b, signalInstanceKey);
18834
+ if (signalInstanceKey !== void 0) stampSignalInstanceKey(b, signalInstanceKey);
18792
18835
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && typeof identity === "function")
18793
18836
  profileTrackComponent(b, identity);
18794
18837
  state.block = b;
@@ -18818,7 +18861,7 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
18818
18861
  void 0,
18819
18862
  outputHandler
18820
18863
  );
18821
- if (signalInstanceKey !== void 0) SCOPE_SIGNAL_INSTANCE_KEYS.set(b, signalInstanceKey);
18864
+ if (signalInstanceKey !== void 0) stampSignalInstanceKey(b, signalInstanceKey);
18822
18865
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && typeof identity === "function")
18823
18866
  profileTrackComponent(b, identity);
18824
18867
  if (state.inherited) b.exclusiveMarkers = true;
@@ -18859,7 +18902,7 @@ function renderOffscreen(parentBlock, domParent, afterNode, body, props, outputH
18859
18902
  env,
18860
18903
  outputHandler
18861
18904
  );
18862
- if (signalInstanceKey !== void 0) SCOPE_SIGNAL_INSTANCE_KEYS.set(block, signalInstanceKey);
18905
+ if (signalInstanceKey !== void 0) stampSignalInstanceKey(block, signalInstanceKey);
18863
18906
  if (retryLocation !== void 0) SIGNAL_RETRY_LOCATIONS.set(block, retryLocation);
18864
18907
  if (implicitBail) {
18865
18908
  block.$$implicitBail = true;
@@ -21216,7 +21259,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
21216
21259
  void 0,
21217
21260
  renderReturnedValue
21218
21261
  );
21219
- if (signalInstanceKey !== void 0) SCOPE_SIGNAL_INSTANCE_KEYS.set(b2, signalInstanceKey);
21262
+ if (signalInstanceKey !== void 0) stampSignalInstanceKey(b2, signalInstanceKey);
21220
21263
  preserveRootCreatedDom(b2);
21221
21264
  if (state.borrowed) b2.exclusiveMarkers = true;
21222
21265
  b2.$$implicitBail = true;
@@ -21312,7 +21355,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
21312
21355
  void 0,
21313
21356
  renderReturnedValue
21314
21357
  );
21315
- if (signalInstanceKey !== void 0) SCOPE_SIGNAL_INSTANCE_KEYS.set(b, signalInstanceKey);
21358
+ if (signalInstanceKey !== void 0) stampSignalInstanceKey(b, signalInstanceKey);
21316
21359
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__ && comp !== hostElementBody)
21317
21360
  (0, import_profiling.__profileTrackComponent)(b, !isBodyFn || (0, import_profiling.__profileHasComponentMetadata)(comp) ? comp : null);
21318
21361
  if (state.borrowed) b.exclusiveMarkers = true;
@@ -22461,6 +22504,7 @@ function tryBlock(parentScope, slotKey, domParent, tryBody, catchBody, pendingBo
22461
22504
  const parentBlock = parentScope.block;
22462
22505
  const hydration = activeHydration();
22463
22506
  let state = parentScope.slots[slotKey];
22507
+ let supersedesInputs = false;
22464
22508
  if (state === void 0) {
22465
22509
  let start;
22466
22510
  let end;
@@ -22512,8 +22556,8 @@ function tryBlock(parentScope, slotKey, domParent, tryBody, catchBody, pendingBo
22512
22556
  registerSlot(parentScope, newState);
22513
22557
  state = newState;
22514
22558
  } else {
22515
- if (state.retrySignalOwners !== void 0 && (state.tryBody !== tryBody || state.env !== env && depsChanged(state.env, env)))
22516
- clearSignalRetryOwners(state);
22559
+ supersedesInputs = (state.branch === 2 || state.retrySignalOwners !== void 0) && (state.tryBody !== tryBody || state.env !== env && depsChanged(state.env, env));
22560
+ if (state.retrySignalOwners !== void 0 && supersedesInputs) clearSignalRetryOwners(state);
22517
22561
  state.tryBody = tryBody;
22518
22562
  state.catchBody = catchBody;
22519
22563
  state.pendingBody = pendingBody;
@@ -22542,7 +22586,7 @@ function tryBlock(parentScope, slotKey, domParent, tryBody, catchBody, pendingBo
22542
22586
  s.block.extra = s.env;
22543
22587
  renderBlock(s.block);
22544
22588
  } else if (s.branch === 2 && s.tryBlock && !s.tryBlock.disposed && s.hiddenDom) {
22545
- attemptHiddenReveal(s, void 0, "parent");
22589
+ attemptHiddenReveal(s, void 0, supersedesInputs ? "parent" : "update");
22546
22590
  if (s.branch === 2) refreshPendingBody(s);
22547
22591
  } else if (s.branch === 2) {
22548
22592
  mountTry(s);
@@ -22678,7 +22722,8 @@ function takeInitialSuspenseHydration(state, hydration) {
22678
22722
  state.idState = {
22679
22723
  prefix: state.parentBlock.idState.prefix + "b" + boundaryId + "-",
22680
22724
  next: 0,
22681
- renderOwner: state.parentBlock.idState.renderOwner
22725
+ renderOwner: state.parentBlock.idState.renderOwner,
22726
+ signalState: state.parentBlock.idState.signalState
22682
22727
  };
22683
22728
  return {
22684
22729
  metadata: [marker],
@@ -22800,7 +22845,7 @@ function renderInitialSuspenseHydration(state, initial) {
22800
22845
  (0, import_read_protocol.setNativeAdoptionResolver)(previousNative);
22801
22846
  WIP_CAPTURE = previousCapture;
22802
22847
  currentHydration = previousHydration;
22803
- if (previousHydration !== null) previousHydration.node = state.end;
22848
+ if (previousHydration !== null) previousHydration.node = getNextSibling(state.end);
22804
22849
  }
22805
22850
  if (!failed) {
22806
22851
  if (state.retrySignalOwners !== void 0) clearSignalRetryOwners(state);
@@ -22844,7 +22889,7 @@ function renderInitialSuspenseHydration(state, initial) {
22844
22889
  });
22845
22890
  } finally {
22846
22891
  currentHydration = outerHydration;
22847
- if (outerHydration !== null) outerHydration.node = state.end;
22892
+ if (outerHydration !== null) outerHydration.node = getNextSibling(state.end);
22848
22893
  }
22849
22894
  }
22850
22895
  function mountTry(state) {
@@ -22916,7 +22961,8 @@ function mountTry(state) {
22916
22961
  state.idState = {
22917
22962
  prefix: state.parentBlock.idState.prefix + "b" + streamedBoundaryId + "-",
22918
22963
  next: 0,
22919
- renderOwner: state.parentBlock.idState.renderOwner
22964
+ renderOwner: state.parentBlock.idState.renderOwner,
22965
+ signalState: state.parentBlock.idState.signalState
22920
22966
  };
22921
22967
  }
22922
22968
  const freshIds = takeNativeFreshArm(hydration, adoptCursor, state.end, state.idState);
@@ -24504,12 +24550,43 @@ function preservesCommittedSuspense(block) {
24504
24550
  }
24505
24551
  return false;
24506
24552
  }
24553
+ function markerlessBranchRoots(scope, domParent, after, end = null) {
24554
+ let roots = 0;
24555
+ const slots = scope._slots;
24556
+ if (slots !== null) {
24557
+ for (let i = 0; i < slots.length; i++) {
24558
+ const slot = slots[i];
24559
+ if (slot.anchor === after && (slot.__kind === "ifBlockSlot" || slot.__kind === "switchBlockSlot" || slot.__kind === "componentSlotSlot" && slot.block?.parentNode === domParent)) {
24560
+ roots++;
24561
+ if (end !== null) {
24562
+ journalRootProperty(slot, "anchor", slot.anchor);
24563
+ slot.anchor = end;
24564
+ }
24565
+ }
24566
+ }
24567
+ }
24568
+ const children = scope.children;
24569
+ if (children !== null) {
24570
+ for (let i = 0; i < children.length; i++) {
24571
+ const child2 = children[i].scope;
24572
+ const block = child2.block;
24573
+ if (block !== scope.block && block.parentNode === domParent && block.endMarker === after) {
24574
+ roots += markerlessBranchRoots(child2, domParent, after, end) || 1;
24575
+ if (end !== null) {
24576
+ journalRootProperty(block, "endMarker", block.endMarker);
24577
+ block.endMarker = end;
24578
+ }
24579
+ }
24580
+ }
24581
+ }
24582
+ return roots;
24583
+ }
24507
24584
  function finalizeMarkerlessBranch(state, domParent, block, marker, before, after) {
24508
24585
  state.markerlessBefore = void 0;
24509
24586
  if (state.borrowed && state.start === null) return;
24510
24587
  const first = before ? getNextSibling(before) : getFirstChild(domParent);
24511
24588
  const last = after ? (STAGED_DOM?.view(after) ?? after).previousSibling : (STAGED_DOM?.view(domParent) ?? domParent).lastChild;
24512
- if (last !== null && first === last && first.nodeType === 1) {
24589
+ if (last !== null && first === last && first.nodeType === 1 && markerlessBranchRoots(block, domParent, after) <= 1) {
24513
24590
  block.startMarker = first;
24514
24591
  block.endMarker = first;
24515
24592
  state.end = first;
@@ -24523,6 +24600,7 @@ function finalizeMarkerlessBranch(state, domParent, block, marker, before, after
24523
24600
  block.exclusiveMarkers = true;
24524
24601
  state.start = start;
24525
24602
  state.end = end;
24603
+ markerlessBranchRoots(block, domParent, after, end);
24526
24604
  }
24527
24605
  }
24528
24606
  function replaceSharedBlockBoundary(parent, oldStart, oldEnd, newStart, newEnd) {
@@ -28084,8 +28162,43 @@ function hydrateRootWithOutputHandler(container, bodyOrElement, propsOrOptions,
28084
28162
  }
28085
28163
  function createIndependentHydrateActivator(body) {
28086
28164
  return (context) => {
28165
+ const { captures, element, manifest, signalOwner } = context;
28166
+ let intents = context.intents.length === 0 ? null : context.intents;
28167
+ const notify = intents === null ? null : (scope) => {
28168
+ if (intents === null || scope.block.disposed) return;
28169
+ const retryBatch = suspenseRetryBatchForSubtree(scope.block);
28170
+ if (retryBatch !== null) {
28171
+ const effect = scope.effectSlots.find((entry) => entry.connectedFn === notify);
28172
+ (retryBatch.afterCommit ??= []).push(() => {
28173
+ if (intents === null || scope.block.disposed || !effect.active) return;
28174
+ effectQueues[PASSIVE].push({
28175
+ scope,
28176
+ slot: effect.slot,
28177
+ fn: effect.connectedFn,
28178
+ order: effect.order,
28179
+ revision: effect.revision,
28180
+ args: effect.connectedArgs,
28181
+ phase: PASSIVE,
28182
+ seq: commitSeq++
28183
+ });
28184
+ if (!passiveScheduled) schedulePassiveFlush();
28185
+ });
28186
+ return;
28187
+ }
28188
+ const replays = intents;
28189
+ intents = null;
28190
+ for (const replay of replays) {
28191
+ if (!(0, import_event_capture.isHydrationSelectionIntentCurrent)(replay)) continue;
28192
+ const originalTarget = replay.event.target;
28193
+ if (originalTarget === null || originalTarget.nodeType !== 1 || !element.contains(originalTarget))
28194
+ continue;
28195
+ const target = originalTarget;
28196
+ target.dispatchEvent(cloneHydrationReplayEvent(replay.event, target));
28197
+ }
28198
+ };
28087
28199
  const content = (_props, scope, extra) => {
28088
- body(context.captures, scope, extra);
28200
+ body(captures, scope, extra);
28201
+ if (notify !== null) useEffect(notify, [scope], HYDRATE_NOTIFY_SLOT);
28089
28202
  };
28090
28203
  const framed = (_props, scope) => {
28091
28204
  tryBlock(scope, 0, scope.block.parentNode, content, null, null, scope.block.endMarker);
@@ -28093,19 +28206,18 @@ function createIndependentHydrateActivator(body) {
28093
28206
  const adapter = (_props, scope) => {
28094
28207
  componentSlotVoid(scope, 0, scope.block.parentNode, framed, void 0, scope.block.endMarker);
28095
28208
  };
28096
- const root = hydrateRoot(context.element, adapter, context.captures, {
28097
- identifierPrefix: context.manifest.boundaryId + "-",
28098
- identifierSeed: context.manifest.idSeed,
28099
- signalInstancePrefix: context.manifest.boundaryId,
28100
- ...context.signalOwner === void 0 ? {} : { signalOwner: context.signalOwner }
28209
+ const root = hydrateRoot(element, adapter, captures, {
28210
+ identifierPrefix: manifest.boundaryId + "-",
28211
+ identifierSeed: manifest.idSeed,
28212
+ signalInstancePrefix: manifest.boundaryId,
28213
+ ...signalOwner === void 0 ? {} : { signalOwner }
28101
28214
  });
28102
- for (const replay of context.intents) {
28103
- if (!(0, import_event_capture.isHydrationSelectionIntentCurrent)(replay)) continue;
28104
- const originalTarget = replay.event.target;
28105
- if (originalTarget === null || originalTarget.nodeType !== 1 || !context.element.contains(originalTarget))
28106
- continue;
28107
- const target = originalTarget;
28108
- target.dispatchEvent(cloneHydrationReplayEvent(replay.event, target));
28215
+ if (notify !== null) {
28216
+ const unmount = root.unmount;
28217
+ root.unmount = () => {
28218
+ intents = null;
28219
+ unmount();
28220
+ };
28109
28221
  }
28110
28222
  return root;
28111
28223
  };
@@ -42,6 +42,7 @@ __export(server_exports, {
42
42
  createContext: () => import_runtime_server.createContext,
43
43
  createElement: () => import_runtime_server.createElement,
44
44
  createPortal: () => import_runtime_server.createPortal,
45
+ createResizeObserver: () => import_resize_observer.createResizeObserver,
45
46
  createScopedElement: () => import_runtime_server.createScopedElement,
46
47
  createScopedValue: () => import_runtime_server.createScopedValue,
47
48
  createStreamedRegionPlacementFrame: () => import_streamed_region.createStreamedRegionPlacementFrame,
@@ -180,6 +181,7 @@ __export(server_exports, {
180
181
  });
181
182
  module.exports = __toCommonJS(server_exports);
182
183
  var import_trusted_html = require("../trusted-html.cjs");
184
+ var import_resize_observer = require("../resize-observer.cjs");
183
185
  var import_rpc = require("./rpc.cjs");
184
186
  var import_early_signals = require("./early-signals.cjs");
185
187
  var import_rpc_batch = require("./rpc-batch.cjs");
@@ -218,6 +220,7 @@ var import_runtime_server = require("../runtime.server.cjs");
218
220
  createContext,
219
221
  createElement,
220
222
  createPortal,
223
+ createResizeObserver,
221
224
  createScopedElement,
222
225
  createScopedValue,
223
226
  createStreamedRegionPlacementFrame,
@@ -537,6 +537,7 @@ function evaluate(node) {
537
537
  node.flags = ReactiveFlags.Mutable | ReactiveFlags.Watching;
538
538
  return true;
539
539
  }
540
+ if (historicalReader || (0, import_read_protocol.getNativeAdoptionResolver)()) return evaluateLiveNode(node);
540
541
  const previousNode = activeNode;
541
542
  const previousOwners = activeOwners;
542
543
  const previousObserver = (0, import_read_protocol.setNativeReadObserver)(null);
@@ -579,6 +580,16 @@ function evaluate(node) {
579
580
  commitState(node, next);
580
581
  return true;
581
582
  }
583
+ function evaluateLiveNode(node) {
584
+ const previousReader = setHistoricalReader(void 0);
585
+ const previousAdoption = (0, import_read_protocol.setNativeAdoptionResolver)(null);
586
+ try {
587
+ return evaluate(node);
588
+ } finally {
589
+ (0, import_read_protocol.setNativeAdoptionResolver)(previousAdoption);
590
+ setHistoricalReader(previousReader);
591
+ }
592
+ }
582
593
  function commitState(node, next) {
583
594
  const previous = node.state;
584
595
  node.state = next;
@@ -21,7 +21,7 @@ __export(version_exports, {
21
21
  version: () => version
22
22
  });
23
23
  module.exports = __toCommonJS(version_exports);
24
- const version = "0.3.6";
24
+ const version = "0.4.1";
25
25
  // Annotate the CommonJS export names for ESM import in node:
26
26
  0 && (module.exports = {
27
27
  version