octane 0.2.7 → 0.2.10

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.
@@ -131,6 +131,7 @@ __export(runtime_exports, {
131
131
  injectStyle: () => injectStyle,
132
132
  invokeManualHook: () => invokeManualHook,
133
133
  isChildrenBlock: () => isChildrenBlock,
134
+ isHydratingStyle: () => isHydratingStyle,
134
135
  isInActScope: () => isInActScope,
135
136
  isValidElement: () => isValidElement,
136
137
  keyedForBlock: () => keyedForBlock,
@@ -188,6 +189,7 @@ __export(runtime_exports, {
188
189
  queueRefAttach: () => queueRefAttach,
189
190
  queueRefDetach: () => queueRefDetach,
190
191
  readContextFromScope: () => readContextFromScope,
192
+ registerWarmPlan: () => registerWarmPlan,
191
193
  renderBlock: () => renderBlock,
192
194
  renderClientContextProvider: () => renderClientContextProvider,
193
195
  replaceRef: () => replaceRef,
@@ -228,6 +230,7 @@ __export(runtime_exports, {
228
230
  setStringData: () => setStringData,
229
231
  setStringDataIfChanged: () => setStringDataIfChanged,
230
232
  setStyle: () => setStyle,
233
+ setStyleProperties: () => setStyleProperties,
231
234
  setStyleProperty: () => setStyleProperty,
232
235
  setText: () => setText,
233
236
  setTransitionFallbackTimeout: () => setTransitionFallbackTimeout,
@@ -3799,7 +3802,7 @@ function runEffectBody(e) {
3799
3802
  CURRENT_EFFECT_PHASE = e.phase;
3800
3803
  EFFECT_BODY_DEPTH++;
3801
3804
  try {
3802
- cleanup = e.fn.apply(null, e.args ?? []);
3805
+ cleanup = e.fn.apply(null, e.args);
3803
3806
  } finally {
3804
3807
  EFFECT_BODY_DEPTH--;
3805
3808
  CURRENT_EFFECT_PHASE = previousPhase;
@@ -4021,6 +4024,7 @@ class BlockImpl {
4021
4024
  this.$$ctxReads = null;
4022
4025
  this.$$ctxDirect = null;
4023
4026
  this.$$ctxCache = null;
4027
+ this.$$ctxCacheOwner = null;
4024
4028
  this.$$implicitBail = false;
4025
4029
  this.__thenableIdx = 0;
4026
4030
  this.drainStamp = 0;
@@ -4067,6 +4071,7 @@ class ScopeImpl {
4067
4071
  this.$$ctxValues = null;
4068
4072
  this.$$ctxReads = null;
4069
4073
  this.$$ctxCache = null;
4074
+ this.$$ctxCacheOwner = null;
4070
4075
  this.mounted = false;
4071
4076
  this.slots = [];
4072
4077
  }
@@ -7068,7 +7073,8 @@ function bindRendererRegionOwner(props) {
7068
7073
  const binding = { bridge, release };
7069
7074
  RENDERER_REGION_DOM_BINDINGS.set(root, binding);
7070
7075
  RENDERER_REGION_DOM_OWNERS.set(root, bridge);
7071
- root.$$ctxCache?.clear();
7076
+ root.$$ctxCache = null;
7077
+ root.$$ctxCacheOwner = null;
7072
7078
  if (previous === void 0) {
7073
7079
  (root.cleanups ??= []).push(() => {
7074
7080
  const current = RENDERER_REGION_DOM_BINDINGS.get(root);
@@ -7183,11 +7189,31 @@ function createNativeScopedResolver(read) {
7183
7189
  }
7184
7190
  };
7185
7191
  }
7192
+ function cacheContextOwner(reader, context, owner) {
7193
+ if (reader === null) return;
7194
+ const cache = reader.$$ctxCache;
7195
+ if (cache === null) {
7196
+ reader.$$ctxCache = context;
7197
+ reader.$$ctxCacheOwner = owner;
7198
+ return;
7199
+ }
7200
+ const inlineOwner = reader.$$ctxCacheOwner;
7201
+ if (inlineOwner !== null) {
7202
+ const spill = /* @__PURE__ */ new Map();
7203
+ spill.set(cache, inlineOwner);
7204
+ spill.set(context, owner);
7205
+ reader.$$ctxCache = spill;
7206
+ reader.$$ctxCacheOwner = null;
7207
+ } else {
7208
+ cache.set(context, owner);
7209
+ }
7210
+ }
7186
7211
  function readContextFrom(reader, block, context) {
7187
7212
  if (SCOPED_READ_TRACKING) (SCOPED_READS ??= /* @__PURE__ */ new Map()).set(context, context.$$version);
7188
- if (reader !== null && reader.$$ctxCache !== null) {
7189
- const hit = reader.$$ctxCache.get(context);
7190
- if (hit !== void 0) {
7213
+ if (reader !== null) {
7214
+ const cache = reader.$$ctxCache;
7215
+ const hit = cache === context ? reader.$$ctxCacheOwner : cache !== null && reader.$$ctxCacheOwner === null ? cache.get(context) : void 0;
7216
+ if (hit !== null && hit !== void 0) {
7191
7217
  if (hit === DEFAULT_CTX) {
7192
7218
  const bridge2 = rendererRegionOwnerForBlock(block);
7193
7219
  return bridge2 === null ? context.defaultValue : bridge2.readContext(context);
@@ -7199,7 +7225,7 @@ function readContextFrom(reader, block, context) {
7199
7225
  while (scope !== null) {
7200
7226
  const values = scope.$$ctxValues;
7201
7227
  if (values !== null && values.has(context)) {
7202
- if (reader !== null) (reader.$$ctxCache ??= /* @__PURE__ */ new Map()).set(context, scope);
7228
+ cacheContextOwner(reader, context, scope);
7203
7229
  return values.get(context);
7204
7230
  }
7205
7231
  scope = scope.parent;
@@ -7208,14 +7234,14 @@ function readContextFrom(reader, block, context) {
7208
7234
  while (current !== null) {
7209
7235
  const values = current.$$ctxValues;
7210
7236
  if (values !== null && values.has(context)) {
7211
- if (reader !== null) (reader.$$ctxCache ??= /* @__PURE__ */ new Map()).set(context, current);
7237
+ cacheContextOwner(reader, context, current);
7212
7238
  return values.get(context);
7213
7239
  }
7214
7240
  current = current.parentBlock;
7215
7241
  }
7216
7242
  const bridge = rendererRegionOwnerForBlock(block);
7217
7243
  if (bridge !== null) return bridge.readContext(context);
7218
- if (reader !== null) (reader.$$ctxCache ??= /* @__PURE__ */ new Map()).set(context, DEFAULT_CTX);
7244
+ cacheContextOwner(reader, context, DEFAULT_CTX);
7219
7245
  return context.defaultValue;
7220
7246
  }
7221
7247
  function readContextFromScope(scope, context) {
@@ -7431,7 +7457,7 @@ function warnUseWaterfall(block, idx) {
7431
7457
  }
7432
7458
  function useBatch(items, warm) {
7433
7459
  if (items.length === 0) {
7434
- if (warm !== void 0) ACTIVE_WARM_PLANS.push({ block: CURRENT_BLOCK, fn: warm });
7460
+ if (warm !== void 0) ACTIVE_WARM_PLANS.push(CURRENT_BLOCK, warm, void 0);
7435
7461
  return;
7436
7462
  }
7437
7463
  const hydration = activeHydration();
@@ -7458,9 +7484,13 @@ function useBatch(items, warm) {
7458
7484
  });
7459
7485
  throw new SuspenseException(combined);
7460
7486
  }
7487
+ function registerWarmPlan(fn, props) {
7488
+ ACTIVE_WARM_PLANS.push(CURRENT_BLOCK, fn, props);
7489
+ }
7461
7490
  let CURRENT_WARM = null;
7462
7491
  let CURRENT_WARM_CLAIMS = null;
7463
7492
  let WARM_EVER = false;
7493
+ let LATEST_WARM_CACHE_EPISODE = 0;
7464
7494
  let WARM_DEPTH = 0;
7465
7495
  const WARM_DEPTH_CAP = 64;
7466
7496
  const WARM_MISS = /* @__PURE__ */ Symbol("octane.warm.miss");
@@ -7485,16 +7515,18 @@ function warmCacheForOwner(owner) {
7485
7515
  }
7486
7516
  owner.__warmCache = cache;
7487
7517
  owner.__warmCacheEpisode = CURRENT_WARM_EPISODE;
7518
+ if (CURRENT_WARM_EPISODE > LATEST_WARM_CACHE_EPISODE)
7519
+ LATEST_WARM_CACHE_EPISODE = CURRENT_WARM_EPISODE;
7488
7520
  return cache;
7489
7521
  }
7490
7522
  function recordRealWarmMemo(slot, deps, source) {
7491
7523
  const block = CURRENT_BLOCK;
7492
7524
  if (block === null) return false;
7493
7525
  let owner = null;
7494
- for (let i = 0; i < ACTIVE_WARM_PLANS.length; i++) {
7495
- const plan = ACTIVE_WARM_PLANS[i];
7496
- if (!blockIsAncestor(plan.block, block)) continue;
7497
- owner = plan.block;
7526
+ for (let i = 0; i < ACTIVE_WARM_PLANS.length; i += 3) {
7527
+ const planBlock = ACTIVE_WARM_PLANS[i];
7528
+ if (!blockIsAncestor(planBlock, block)) continue;
7529
+ owner = planBlock;
7498
7530
  break;
7499
7531
  }
7500
7532
  if (owner === null) return false;
@@ -7557,11 +7589,11 @@ function runActiveWarmPlans(local) {
7557
7589
  const block = CURRENT_BLOCK;
7558
7590
  let plans = null;
7559
7591
  let owner = block;
7560
- for (let i = 0; i < ACTIVE_WARM_PLANS.length; i++) {
7561
- const plan = ACTIVE_WARM_PLANS[i];
7562
- if (!blockIsAncestor(plan.block, block)) continue;
7563
- (plans ??= []).push(plan);
7564
- if (plans.length === 1) owner = plan.block;
7592
+ for (let i = 0; i < ACTIVE_WARM_PLANS.length; i += 3) {
7593
+ const planBlock = ACTIVE_WARM_PLANS[i];
7594
+ if (!blockIsAncestor(planBlock, block)) continue;
7595
+ (plans ??= []).push(i);
7596
+ if (plans.length === 1) owner = planBlock;
7565
7597
  }
7566
7598
  if (plans === null && local === void 0) return;
7567
7599
  runWarm(() => {
@@ -7569,7 +7601,8 @@ function runActiveWarmPlans(local) {
7569
7601
  for (let i = 0; i < plans.length; i++) {
7570
7602
  CURRENT_WARM_CLAIMS = /* @__PURE__ */ new Set();
7571
7603
  try {
7572
- plans[i].fn();
7604
+ const index = plans[i];
7605
+ ACTIVE_WARM_PLANS[index + 1](ACTIVE_WARM_PLANS[index + 2]);
7573
7606
  } catch {
7574
7607
  }
7575
7608
  }
@@ -7702,7 +7735,7 @@ function markWarm(component, plan) {
7702
7735
  return component;
7703
7736
  }
7704
7737
  function adoptWarmEntry(slot, deps, accept) {
7705
- let b = CURRENT_BLOCK;
7738
+ let b = CURRENT_WARM_EPISODE <= LATEST_WARM_CACHE_EPISODE ? CURRENT_BLOCK : null;
7706
7739
  while (b !== null) {
7707
7740
  const cache = b.__warmCache;
7708
7741
  if (b.__warmCacheEpisode === CURRENT_WARM_EPISODE && cache !== void 0) {
@@ -8121,8 +8154,10 @@ function getFirstChild(node) {
8121
8154
  function getNextSibling(node) {
8122
8155
  return nextSiblingGetter === void 0 ? node.nextSibling : nextSiblingGetter.call(node);
8123
8156
  }
8124
- function seedExpando(proto, key) {
8125
- if (!(key in proto)) proto[key] = void 0;
8157
+ function seedExpando(proto, key, enumerable = true) {
8158
+ if (key in proto) return;
8159
+ if (enumerable) proto[key] = void 0;
8160
+ else Object.defineProperty(proto, key, { value: void 0, writable: true, configurable: true });
8126
8161
  }
8127
8162
  let domOperationsReady = false;
8128
8163
  function initDomOperations() {
@@ -8140,6 +8175,11 @@ function initDomOperations() {
8140
8175
  seedExpando(elementProto, "__oct_suppress");
8141
8176
  seedExpando(elementProto, "__oct_frag");
8142
8177
  seedExpando(elementProto, "__oct_vfrag");
8178
+ seedExpando(elementProto, DANGER_HTML_ACTIVE, false);
8179
+ seedExpando(elementProto, DANGER_HTML_STATIC_CHILD, false);
8180
+ seedExpando(elementProto, DANGER_HTML_SPREAD_CHILD, false);
8181
+ seedExpando(elementProto, DEOPT_DESC, false);
8182
+ seedExpando(elementProto, DEFAULT_VALUE_BASELINE, false);
8143
8183
  if (process.env.NODE_ENV !== "production") {
8144
8184
  seedExpando(elementProto, "__oct_loc");
8145
8185
  }
@@ -8147,6 +8187,7 @@ function initDomOperations() {
8147
8187
  if (typeof CharacterData !== "undefined" && Object.isExtensible(CharacterData.prototype)) {
8148
8188
  seedExpando(CharacterData.prototype, "$$portalEnd");
8149
8189
  seedExpando(CharacterData.prototype, "$$deoptKey");
8190
+ seedExpando(CharacterData.prototype, DEOPT_DESC, false);
8150
8191
  }
8151
8192
  }
8152
8193
  const LAZY_TEMPLATE = /* @__PURE__ */ Symbol("octane.lazy-template");
@@ -8692,7 +8733,7 @@ class HydrationCapability {
8692
8733
  this.classWrites.clear();
8693
8734
  }
8694
8735
  }
8695
- applyStyle(el, value, _prev, staticCss) {
8736
+ applyStyle(el, value, _prev, staticCss, entries) {
8696
8737
  const mode = hydrationMismatchMode(el);
8697
8738
  if (mode === 1) return true;
8698
8739
  const style = el.style;
@@ -8700,7 +8741,14 @@ class HydrationCapability {
8700
8741
  const before = style.cssText;
8701
8742
  const expectedStyle = document.createElement("div").style;
8702
8743
  if (staticCss !== void 0) expectedStyle.cssText = staticCss;
8703
- applyStyleValue(el, expectedStyle, value, void 0);
8744
+ if (entries === void 0) applyStyleValue(el, expectedStyle, value, void 0);
8745
+ else {
8746
+ for (let i = 0; i < entries.length; i += 2) {
8747
+ const entry = entries[i + 1];
8748
+ if (entry != null && typeof entry !== "boolean")
8749
+ applyStyleProperty(el, expectedStyle, entries[i], entry);
8750
+ }
8751
+ }
8704
8752
  const expected = expectedStyle.cssText;
8705
8753
  const expectsStyleAttribute = expected !== "";
8706
8754
  if (before === expected && hadStyleAttribute === expectsStyleAttribute) return true;
@@ -10159,6 +10207,9 @@ function setDeoptClass(el, value) {
10159
10207
  }
10160
10208
  }
10161
10209
  const IMPORTANT_SUFFIX = "!important";
10210
+ function isHydratingStyle() {
10211
+ return activeHydration() !== null;
10212
+ }
10162
10213
  function setStyle(el, value, prev) {
10163
10214
  const style = el.style;
10164
10215
  const hydration = activeHydration();
@@ -10181,6 +10232,26 @@ function setStyleProperty(el, name, value, staticCss, previous) {
10181
10232
  if (remove) style.removeProperty((0, import_css.styleName)(name));
10182
10233
  else applyStyleProperty(el, style, name, value);
10183
10234
  }
10235
+ function setStyleProperties(el, entries, staticCss) {
10236
+ const hydration = activeHydration();
10237
+ if (hydration !== null) {
10238
+ hydration.applyStyle(el, null, void 0, staticCss, entries);
10239
+ return;
10240
+ }
10241
+ const style = el.style;
10242
+ let journaled = false;
10243
+ for (let i = 0; i < entries.length; i += 2) {
10244
+ const value = entries[i + 1];
10245
+ if (value == null || typeof value === "boolean") continue;
10246
+ if (!journaled && TRANSITION_JOURNAL !== null) {
10247
+ journalAttr(el, "style");
10248
+ journaled = true;
10249
+ }
10250
+ const name = entries[i];
10251
+ if (hiddenStyleWriter !== null && hiddenStyleWriter(el, value, void 0, name)) continue;
10252
+ applyStyleProperty(el, style, name, value);
10253
+ }
10254
+ }
10184
10255
  function applyStyleValue(el, style, value, prev) {
10185
10256
  if (value == null || value === false || value === "") {
10186
10257
  if (prev && typeof prev === "object") {
@@ -10816,6 +10887,10 @@ function isEventRoot(node, epoch) {
10816
10887
  return membership !== void 0 && membership.count > 0;
10817
10888
  }
10818
10889
  function prepareDelegatedEvent(event, listener) {
10890
+ if (_delegationTargets.size === 1 && portalEventTargetCount === 0) {
10891
+ event[EVENT_ROOT_EPOCH] = eventRootEpoch;
10892
+ return;
10893
+ }
10819
10894
  const path = event.composedPath();
10820
10895
  if (_delegationTargets.size === 1) {
10821
10896
  event[EVENT_ROOT_EPOCH] = eventRootEpoch;
@@ -11363,6 +11438,11 @@ function finishCaptureDispatch(event) {
11363
11438
  return;
11364
11439
  }
11365
11440
  if (!DISCRETE_EVENTS.has(type)) return;
11441
+ if (pendingRestores.length === 0) {
11442
+ if (!RESTORE_EVENTS.has(type)) return;
11443
+ const tag = event.target?.localName;
11444
+ if (tag !== "input" && tag !== "textarea" && tag !== "select") return;
11445
+ }
11366
11446
  const bubbleVersion = event[DELEGATED_BUBBLE_VERSION];
11367
11447
  const fallback = () => {
11368
11448
  if (event[DELEGATED_BUBBLE_VERSION] === bubbleVersion) {
@@ -11374,7 +11454,8 @@ function finishCaptureDispatch(event) {
11374
11454
  else queueMicrotask(fallback);
11375
11455
  }
11376
11456
  function dispatchDelegated(event) {
11377
- if (delegatedCapture(event.type)) prepareDelegatedEvent(event, this);
11457
+ const nativeCapture = delegatedCapture(event.type);
11458
+ let path = nativeCapture ? prepareDelegatedEvent(event, this) : void 0;
11378
11459
  event[DELEGATED_BUBBLE_VERSION] = (event[DELEGATED_BUBBLE_VERSION] || 0) + 1;
11379
11460
  maybeEnqueueRestore(event);
11380
11461
  const key = "$$" + event.type;
@@ -11389,12 +11470,14 @@ function dispatchDelegated(event) {
11389
11470
  let stop;
11390
11471
  let propagationStarted = false;
11391
11472
  try {
11392
- if (delegatedCapture(event.type) && _delegatedCapture.has(event.type) && dispatchDelegatedCapture.call(this, event))
11393
- return;
11473
+ if (nativeCapture && _delegatedCapture.has(event.type)) {
11474
+ path ??= event.composedPath();
11475
+ if (dispatchDelegatedCapture.call(this, event, path)) return;
11476
+ }
11394
11477
  if (!_delegated.has(event.type)) return;
11395
11478
  if (node?.nodeType === 1 && isHtmlCustomElement(node) && (event.type === "invalid" || EMULATED_BUBBLING_EVENTS.includes(event.type)))
11396
11479
  return;
11397
- buildDelegatedPath(event, this);
11480
+ buildDelegatedPath(event, this, path);
11398
11481
  snapshotDelegatedSlots(pathBase, key, event);
11399
11482
  stop = Object.getOwnPropertyDescriptor(event, "stopPropagation");
11400
11483
  propagationStarted = true;
@@ -11431,9 +11514,10 @@ function dispatchDelegated(event) {
11431
11514
  maybeFlushDiscrete(event.type);
11432
11515
  }
11433
11516
  }
11434
- function dispatchDelegatedCapture(event) {
11435
- const path = prepareDelegatedEvent(event, this);
11517
+ function dispatchDelegatedCapture(event, path) {
11518
+ path ??= prepareDelegatedEvent(event, this);
11436
11519
  if (!_delegatedCapture.has(event.type)) return false;
11520
+ path ??= event.composedPath();
11437
11521
  if (!event.bubbles || !_delegated.has(event.type)) maybeEnqueueRestore(event);
11438
11522
  const key = CAPTURE_PREFIX + event.type;
11439
11523
  const pathBase = CAPTURE_PATH.length;
@@ -12830,6 +12914,14 @@ function elementKeyWasProvided(descriptor) {
12830
12914
  }
12831
12915
  const ELEMENTS_MISSING_LIST_KEY = /* @__PURE__ */ new WeakSet();
12832
12916
  const SCOPED_ELEMENT_PROPS = /* @__PURE__ */ new WeakSet();
12917
+ const SCOPED_CHILDREN_RESOLVER = /* @__PURE__ */ Symbol("octane.scopedChildren");
12918
+ const SCOPED_CHILDREN_PROPERTY = {
12919
+ configurable: true,
12920
+ enumerable: true,
12921
+ get: function() {
12922
+ return this[SCOPED_CHILDREN_RESOLVER]();
12923
+ }
12924
+ };
12833
12925
  function hasElementConfigKey(config) {
12834
12926
  if (config == null || typeof config !== "object" && typeof config !== "function") return false;
12835
12927
  if (process.env.NODE_ENV !== "production" && import_has_own.hasOwnProp.call(config, "key")) {
@@ -12846,6 +12938,83 @@ function copyElementConfig(config) {
12846
12938
  }
12847
12939
  return props;
12848
12940
  }
12941
+ function restoreWritableScopedChildren(props, name, value) {
12942
+ const inherited = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(props), name);
12943
+ if (inherited?.get === void 0 && inherited?.set === void 0) return false;
12944
+ Object.defineProperty(props, "children", {
12945
+ configurable: true,
12946
+ enumerable: true,
12947
+ writable: true,
12948
+ value
12949
+ });
12950
+ return true;
12951
+ }
12952
+ function copyScopedElementConfig(type, config, resolve) {
12953
+ if (config != null && import_has_own.hasOwnProp.call(config, "__proto__") || import_has_own.hasOwnProp.call(Object.prototype, "children")) {
12954
+ const props2 = copyElementConfig(config);
12955
+ (0, import_shared_value_helpers.applyElementDefaultProps)(type, props2);
12956
+ Object.defineProperty(props2, SCOPED_CHILDREN_RESOLVER, { value: resolve });
12957
+ Object.defineProperty(props2, "children", SCOPED_CHILDREN_PROPERTY);
12958
+ SCOPED_ELEMENT_PROPS.add(props2);
12959
+ return props2;
12960
+ }
12961
+ const props = {};
12962
+ Object.defineProperty(props, SCOPED_CHILDREN_RESOLVER, { value: resolve });
12963
+ let copiedChildren;
12964
+ let hasCopiedChildren = false;
12965
+ let childrenAreWritable = false;
12966
+ if (config != null) {
12967
+ for (const name in config) {
12968
+ if (name === "key" || !import_has_own.hasOwnProp.call(config, name)) continue;
12969
+ if (name === "children") {
12970
+ copiedChildren = config[name];
12971
+ Object.defineProperty(props, "children", SCOPED_CHILDREN_PROPERTY);
12972
+ hasCopiedChildren = true;
12973
+ } else {
12974
+ const value = config[name];
12975
+ if (hasCopiedChildren && !childrenAreWritable && !import_has_own.hasOwnProp.call(props, name) && restoreWritableScopedChildren(props, name, copiedChildren)) {
12976
+ childrenAreWritable = true;
12977
+ }
12978
+ props[name] = value;
12979
+ }
12980
+ }
12981
+ }
12982
+ const defaults = type?.defaultProps;
12983
+ if (defaults != null) {
12984
+ for (const name in defaults) {
12985
+ if (name === "children") {
12986
+ if ((childrenAreWritable ? props.children : hasCopiedChildren ? copiedChildren : props.children) === void 0) {
12987
+ copiedChildren = defaults[name];
12988
+ if (childrenAreWritable) {
12989
+ props.children = copiedChildren;
12990
+ } else if (!hasCopiedChildren) {
12991
+ if ("children" in props) {
12992
+ props.children = copiedChildren;
12993
+ } else {
12994
+ Object.defineProperty(props, "children", SCOPED_CHILDREN_PROPERTY);
12995
+ hasCopiedChildren = true;
12996
+ }
12997
+ }
12998
+ }
12999
+ } else {
13000
+ if (hasCopiedChildren && !childrenAreWritable && !import_has_own.hasOwnProp.call(props, name) && restoreWritableScopedChildren(props, name, copiedChildren)) {
13001
+ childrenAreWritable = true;
13002
+ }
13003
+ if (props[name] === void 0) props[name] = defaults[name];
13004
+ }
13005
+ }
13006
+ }
13007
+ if (childrenAreWritable || !hasCopiedChildren)
13008
+ Object.defineProperty(props, "children", SCOPED_CHILDREN_PROPERTY);
13009
+ SCOPED_ELEMENT_PROPS.add(props);
13010
+ return props;
13011
+ }
13012
+ function scopedElementRecord(type, props, key, ref, resolve) {
13013
+ const descriptor = { $$kind: ELEMENT_TAG, type, props, key, ref };
13014
+ Object.defineProperty(descriptor, SCOPED_CHILDREN_RESOLVER, { value: resolve });
13015
+ Object.defineProperty(descriptor, "children", SCOPED_CHILDREN_PROPERTY);
13016
+ return descriptor;
13017
+ }
12849
13018
  function finalizeElementDescriptor(descriptor) {
12850
13019
  if (process.env.NODE_ENV !== "production") {
12851
13020
  Object.freeze(descriptor.props);
@@ -12854,6 +13023,33 @@ function finalizeElementDescriptor(descriptor) {
12854
13023
  return descriptor;
12855
13024
  }
12856
13025
  const SCOPED_VALUE_RECORD = /* @__PURE__ */ Symbol("octane.scopedValue");
13026
+ function scopedValueType() {
13027
+ return this[SCOPED_VALUE_RECORD]().type;
13028
+ }
13029
+ function scopedValueProps() {
13030
+ return this[SCOPED_VALUE_RECORD]().props;
13031
+ }
13032
+ function scopedValueKey() {
13033
+ const next = this[SCOPED_VALUE_RECORD]();
13034
+ const key = next.key;
13035
+ if (key === null && KEYED_ELEMENT_DESCRIPTORS.has(next)) {
13036
+ KEYED_ELEMENT_DESCRIPTORS.add(this);
13037
+ }
13038
+ return key;
13039
+ }
13040
+ function scopedValueRef() {
13041
+ return this[SCOPED_VALUE_RECORD]().ref;
13042
+ }
13043
+ function scopedValueChildren() {
13044
+ return this[SCOPED_VALUE_RECORD]().children;
13045
+ }
13046
+ const SCOPED_VALUE_PROPERTIES = {
13047
+ type: { configurable: true, enumerable: true, get: scopedValueType },
13048
+ props: { configurable: true, enumerable: true, get: scopedValueProps },
13049
+ key: { configurable: true, enumerable: true, get: scopedValueKey },
13050
+ ref: { configurable: true, enumerable: true, get: scopedValueRef },
13051
+ children: { configurable: true, enumerable: true, get: scopedValueChildren }
13052
+ };
12857
13053
  function createScopedValue(readElement) {
12858
13054
  return scopedValueDescriptor(createScopedResolver(readElement));
12859
13055
  }
@@ -12861,30 +13057,13 @@ function nativeCreateScopedValue(readElement) {
12861
13057
  return scopedValueDescriptor(createNativeScopedResolver(readElement));
12862
13058
  }
12863
13059
  function scopedValueDescriptor(resolve) {
12864
- const descriptor = {
12865
- $$kind: ELEMENT_TAG,
12866
- get type() {
12867
- return resolve().type;
12868
- },
12869
- get props() {
12870
- return resolve().props;
12871
- },
12872
- get key() {
12873
- const next = resolve();
12874
- const key = next.key;
12875
- if (key === null && KEYED_ELEMENT_DESCRIPTORS.has(next)) {
12876
- KEYED_ELEMENT_DESCRIPTORS.add(descriptor);
12877
- }
12878
- return key;
12879
- },
12880
- get ref() {
12881
- return resolve().ref;
12882
- },
12883
- get children() {
12884
- return resolve().children;
12885
- }
12886
- };
13060
+ const descriptor = { $$kind: ELEMENT_TAG };
12887
13061
  Object.defineProperty(descriptor, SCOPED_VALUE_RECORD, { value: resolve });
13062
+ Object.defineProperty(descriptor, "type", SCOPED_VALUE_PROPERTIES.type);
13063
+ Object.defineProperty(descriptor, "props", SCOPED_VALUE_PROPERTIES.props);
13064
+ Object.defineProperty(descriptor, "key", SCOPED_VALUE_PROPERTIES.key);
13065
+ Object.defineProperty(descriptor, "ref", SCOPED_VALUE_PROPERTIES.ref);
13066
+ Object.defineProperty(descriptor, "children", SCOPED_VALUE_PROPERTIES.children);
12888
13067
  if (process.env.NODE_ENV !== "production") Object.freeze(descriptor);
12889
13068
  return descriptor;
12890
13069
  }
@@ -12898,20 +13077,14 @@ function scopedElementDescriptor(type, props, children) {
12898
13077
  const src = props ?? null;
12899
13078
  const hasKey = hasElementConfigKey(src);
12900
13079
  const key = hasKey ? "" + src.key : null;
12901
- const copiedProps = copyElementConfig(src);
12902
- (0, import_shared_value_helpers.applyElementDefaultProps)(type, copiedProps);
12903
- const childProperty = { configurable: true, enumerable: true, get: children };
12904
- Object.defineProperty(copiedProps, "children", childProperty);
12905
- SCOPED_ELEMENT_PROPS.add(copiedProps);
12906
- const descriptor = {
12907
- $$kind: ELEMENT_TAG,
13080
+ const copiedProps = copyScopedElementConfig(type, src, children);
13081
+ const descriptor = scopedElementRecord(
12908
13082
  type,
12909
- props: copiedProps,
13083
+ copiedProps,
12910
13084
  key,
12911
- ref: copiedProps.ref !== void 0 ? copiedProps.ref : null,
12912
- children: null
12913
- };
12914
- Object.defineProperty(descriptor, "children", childProperty);
13085
+ copiedProps.ref !== void 0 ? copiedProps.ref : null,
13086
+ children
13087
+ );
12915
13088
  if (key === null && src != null && (typeof src === "object" || typeof src === "function") && "key" in src) {
12916
13089
  KEYED_ELEMENT_DESCRIPTORS.add(descriptor);
12917
13090
  }
@@ -12961,9 +13134,15 @@ function cloneElement(element, config, ...children) {
12961
13134
  throw new Error((0, import_error_codes_client_generated.formatClientError)(4));
12962
13135
  }
12963
13136
  let scopedChildren;
13137
+ let copiedGetter;
12964
13138
  let props;
12965
13139
  if (SCOPED_ELEMENT_PROPS.has(element.props)) {
12966
- scopedChildren = Object.getOwnPropertyDescriptor(element, "children").get;
13140
+ const get = Object.getOwnPropertyDescriptor(element, "children").get;
13141
+ if (get === SCOPED_CHILDREN_PROPERTY.get) {
13142
+ scopedChildren = element[SCOPED_CHILDREN_RESOLVER];
13143
+ } else {
13144
+ copiedGetter = get === SCOPED_VALUE_PROPERTIES.children.get ? () => get.call(element) : get;
13145
+ }
12967
13146
  props = {};
12968
13147
  for (const name in element.props) {
12969
13148
  if (name !== "key" && name !== "children" && import_has_own.hasOwnProp.call(element.props, name)) {
@@ -12990,30 +13169,49 @@ function cloneElement(element, config, ...children) {
12990
13169
  }
12991
13170
  const n = children.length;
12992
13171
  let kids;
12993
- let childProperty;
13172
+ let keepsScopedChildren = false;
12994
13173
  if (n === 1) {
12995
13174
  kids = children[0];
12996
13175
  } else if (n > 1) {
12997
13176
  POSITIONAL_CHILDREN.add(children);
12998
13177
  kids = children;
12999
- } else if (scopedChildren !== void 0 && !replacedChildren) {
13000
- childProperty = { configurable: true, enumerable: true, get: scopedChildren };
13001
- Object.defineProperty(props, "children", childProperty);
13178
+ } else if ((scopedChildren !== void 0 || copiedGetter !== void 0) && !replacedChildren) {
13179
+ if (copiedGetter === void 0) {
13180
+ Object.defineProperty(props, SCOPED_CHILDREN_RESOLVER, { value: scopedChildren });
13181
+ }
13182
+ Object.defineProperty(
13183
+ props,
13184
+ "children",
13185
+ copiedGetter === void 0 ? SCOPED_CHILDREN_PROPERTY : { configurable: true, enumerable: true, get: copiedGetter }
13186
+ );
13002
13187
  SCOPED_ELEMENT_PROPS.add(props);
13188
+ keepsScopedChildren = true;
13003
13189
  kids = null;
13004
13190
  } else {
13005
13191
  kids = "children" in props ? props.children : element.children;
13006
13192
  }
13007
13193
  if (n > 0) props.children = kids;
13008
- const descriptor = {
13009
- $$kind: ELEMENT_TAG,
13010
- type: element.type,
13011
- props,
13012
- key,
13013
- ref: props.ref !== void 0 ? props.ref : null,
13014
- children: kids ?? null
13015
- };
13016
- if (childProperty !== void 0) Object.defineProperty(descriptor, "children", childProperty);
13194
+ const ref = props.ref !== void 0 ? props.ref : null;
13195
+ let descriptor;
13196
+ if (keepsScopedChildren && copiedGetter === void 0) {
13197
+ descriptor = scopedElementRecord(element.type, props, key, ref, scopedChildren);
13198
+ } else {
13199
+ descriptor = {
13200
+ $$kind: ELEMENT_TAG,
13201
+ type: element.type,
13202
+ props,
13203
+ key,
13204
+ ref,
13205
+ children: kids ?? null
13206
+ };
13207
+ if (keepsScopedChildren) {
13208
+ Object.defineProperty(descriptor, "children", {
13209
+ configurable: true,
13210
+ enumerable: true,
13211
+ get: copiedGetter
13212
+ });
13213
+ }
13214
+ }
13017
13215
  if (key === null && (elementKeyWasProvided(element) || config != null && import_has_own.hasOwnProp.call(config, "key"))) {
13018
13216
  KEYED_ELEMENT_DESCRIPTORS.add(descriptor);
13019
13217
  }
@@ -13024,20 +13222,42 @@ function cloneElement(element, config, ...children) {
13024
13222
  }
13025
13223
  function cloneAndReplaceElementKey(element, key) {
13026
13224
  const scoped = SCOPED_ELEMENT_PROPS.has(element.props);
13027
- const descriptor = {
13028
- $$kind: ELEMENT_TAG,
13029
- type: element.type,
13030
- props: element.props,
13031
- key,
13032
- ref: element.ref,
13033
- children: scoped ? null : element.children
13034
- };
13225
+ let descriptor;
13035
13226
  if (scoped) {
13036
- Object.defineProperty(descriptor, "children", {
13037
- configurable: true,
13038
- enumerable: true,
13039
- get: Object.getOwnPropertyDescriptor(element, "children").get
13040
- });
13227
+ const get = Object.getOwnPropertyDescriptor(element, "children").get;
13228
+ if (get === SCOPED_CHILDREN_PROPERTY.get) {
13229
+ descriptor = scopedElementRecord(
13230
+ element.type,
13231
+ element.props,
13232
+ key,
13233
+ element.ref,
13234
+ element[SCOPED_CHILDREN_RESOLVER]
13235
+ );
13236
+ } else {
13237
+ const copiedGetter = get === SCOPED_VALUE_PROPERTIES.children.get ? () => get.call(element) : get;
13238
+ descriptor = {
13239
+ $$kind: ELEMENT_TAG,
13240
+ type: element.type,
13241
+ props: element.props,
13242
+ key,
13243
+ ref: element.ref,
13244
+ children: null
13245
+ };
13246
+ Object.defineProperty(descriptor, "children", {
13247
+ configurable: true,
13248
+ enumerable: true,
13249
+ get: copiedGetter
13250
+ });
13251
+ }
13252
+ } else {
13253
+ descriptor = {
13254
+ $$kind: ELEMENT_TAG,
13255
+ type: element.type,
13256
+ props: element.props,
13257
+ key,
13258
+ ref: element.ref,
13259
+ children: element.children
13260
+ };
13041
13261
  }
13042
13262
  if (ELEMENTS_MISSING_LIST_KEY.has(element)) ELEMENTS_MISSING_LIST_KEY.add(descriptor);
13043
13263
  return finalizeElementDescriptor(descriptor);
@@ -13958,7 +14178,7 @@ function hostComponent(scope, slot, tag, props, childrenBody, anchor) {
13958
14178
  if (typeof childrenBody === "function") {
13959
14179
  state.latest = childrenBody;
13960
14180
  if (state.body === void 0) {
13961
- state.body = ((...args) => state.latest(...args));
14181
+ state.body = (props2, scope2, extra) => state.latest(props2, scope2, extra);
13962
14182
  }
13963
14183
  childSlot(state.childScope, 0, el, state.body, null, false, el);
13964
14184
  } else if (childrenBody != null || state.childScope.slots[0] !== void 0) {
@@ -14122,20 +14342,48 @@ function renderFragmentRefDescriptor(descriptor, scope) {
14122
14342
  function deoptWrapperKind(value) {
14123
14343
  return POSITIONAL_CHILDREN.has(value) ? "fragment" : "array";
14124
14344
  }
14125
- function scopedDeoptKey(path, item, index, key) {
14345
+ const DEOPT_KEY_STRINGIFY = JSON.stringify;
14346
+ function nestedImplicitKeyPrefix(path) {
14347
+ if (JSON.stringify !== DEOPT_KEY_STRINGIFY || "toJSON" in path) return null;
14348
+ for (let i = 0; i < path.length; i++) {
14349
+ const type = typeof path[i];
14350
+ if (type !== "string" && type !== "number") return null;
14351
+ }
14352
+ return "[" + JSON.stringify(path) + ',"index",';
14353
+ }
14354
+ function appendScopedDeoptKey(outKeys, path, item, index, key, implicitPrefix) {
14126
14355
  const explicit = (isElementDescriptor(item) || item?.$$kind === PORTAL_TAG) && item.key != null;
14127
- if (path.length === 0) return explicit ? "k" + String(key) : "i" + index;
14128
- return JSON.stringify([path, explicit ? "key" : "index", explicit ? String(key) : index]);
14356
+ if (path.length === 0) {
14357
+ outKeys.push(explicit ? "k" + String(key) : index);
14358
+ return implicitPrefix;
14359
+ }
14360
+ if (!explicit) {
14361
+ if (implicitPrefix === void 0) implicitPrefix = nestedImplicitKeyPrefix(path);
14362
+ if (implicitPrefix !== null && JSON.stringify === DEOPT_KEY_STRINGIFY && !("toJSON" in path)) {
14363
+ outKeys.push(implicitPrefix + index + "]");
14364
+ return implicitPrefix;
14365
+ }
14366
+ }
14367
+ outKeys.push(JSON.stringify([path, explicit ? "key" : "index", explicit ? String(key) : index]));
14368
+ return implicitPrefix;
14129
14369
  }
14130
14370
  function flattenReactChildContainer(outItems, outKeys, children, kind, path) {
14131
14371
  const keyFn = kind === "fragment" ? deoptKeyPositional : deoptKey;
14132
14372
  const count = children.length;
14373
+ let implicitPrefix = count > 1 ? void 0 : null;
14133
14374
  for (let i = 0; i < count; i++) {
14134
14375
  const item = children[i];
14135
14376
  if (isFragmentDescriptor(item)) {
14136
14377
  if (item.ref != null || import_has_own.hasOwnProp.call(item.props, "ref")) {
14137
14378
  outItems.push(fragmentRefDescriptor(item));
14138
- outKeys.push(scopedDeoptKey(path, item, i, keyFn(item, i)));
14379
+ implicitPrefix = appendScopedDeoptKey(
14380
+ outKeys,
14381
+ path,
14382
+ item,
14383
+ i,
14384
+ keyFn(item, i),
14385
+ implicitPrefix
14386
+ );
14139
14387
  continue;
14140
14388
  }
14141
14389
  const nested = fragmentDescriptorChildren(item);
@@ -14158,15 +14406,18 @@ function flattenReactChildContainer(outItems, outKeys, children, kind, path) {
14158
14406
  continue;
14159
14407
  }
14160
14408
  outItems.push(item);
14161
- outKeys.push(scopedDeoptKey(path, item, i, keyFn(item, i)));
14409
+ implicitPrefix = appendScopedDeoptKey(outKeys, path, item, i, keyFn(item, i), implicitPrefix);
14162
14410
  }
14163
14411
  }
14412
+ function singleDeoptKey(item, key) {
14413
+ return (isElementDescriptor(item) || item?.$$kind === PORTAL_TAG) && item.key != null ? "k" + String(key) : 0;
14414
+ }
14164
14415
  function prepareDeoptList(value, forceSingle = false, includeKeyedSingle = true) {
14165
14416
  if (isFragmentDescriptor(value)) {
14166
14417
  if (value.ref != null || import_has_own.hasOwnProp.call(value.props, "ref")) {
14167
14418
  return {
14168
14419
  items: [fragmentRefDescriptor(value)],
14169
- keys: [scopedDeoptKey([], value, 0, value.key ?? 0)]
14420
+ keys: [singleDeoptKey(value, value.key ?? 0)]
14170
14421
  };
14171
14422
  }
14172
14423
  const items = [];
@@ -14182,10 +14433,10 @@ function prepareDeoptList(value, forceSingle = false, includeKeyedSingle = true)
14182
14433
  return { items, keys };
14183
14434
  }
14184
14435
  if (includeKeyedSingle && isElementDescriptor(value) && value.key != null) {
14185
- return { items: [value], keys: [scopedDeoptKey([], value, 0, value.key)] };
14436
+ return { items: [value], keys: [singleDeoptKey(value, value.key)] };
14186
14437
  }
14187
14438
  if (forceSingle) {
14188
- return { items: [value], keys: [scopedDeoptKey([], value, 0, deoptKeyPositional(value, 0))] };
14439
+ return { items: [value], keys: [singleDeoptKey(value, deoptKeyPositional(value, 0))] };
14189
14440
  }
14190
14441
  return null;
14191
14442
  }
@@ -16014,29 +16265,36 @@ function shallowEqualPropsExact(a, b) {
16014
16265
  }
16015
16266
  return true;
16016
16267
  }
16268
+ const MEMO_OWNER = /* @__PURE__ */ Symbol("memoOwner");
16269
+ const MEMO_MARKER_DESCRIPTOR = {
16270
+ get() {
16271
+ return this === this[MEMO_OWNER];
16272
+ }
16273
+ };
16274
+ const MEMO_DEFAULT_PROPS_DESCRIPTOR = {
16275
+ configurable: true,
16276
+ // Static hoisters must copy `type` along with this accessor.
16277
+ get() {
16278
+ return this.type.defaultProps;
16279
+ },
16280
+ set(value) {
16281
+ this.type.defaultProps = value;
16282
+ }
16283
+ };
16017
16284
  // @__NO_SIDE_EFFECTS__
16018
16285
  function memo(component, arePropsEqual) {
16019
16286
  function memoWrapper(props, scope, extra) {
16020
16287
  return component(props, scope, extra);
16021
16288
  }
16289
+ Object.defineProperty(memoWrapper, MEMO_OWNER, { value: memoWrapper });
16022
16290
  Object.defineProperty(memoWrapper, "type", { value: component });
16023
16291
  Object.defineProperty(memoWrapper, "displayName", {
16024
16292
  configurable: true,
16025
16293
  writable: true,
16026
16294
  value: component.displayName || component.name || "Memo"
16027
16295
  });
16028
- Object.defineProperty(memoWrapper, "__memo", {
16029
- get() {
16030
- return this === memoWrapper;
16031
- }
16032
- });
16033
- Object.defineProperty(memoWrapper, "defaultProps", {
16034
- configurable: true,
16035
- get: () => component.defaultProps,
16036
- set: (value) => {
16037
- component.defaultProps = value;
16038
- }
16039
- });
16296
+ Object.defineProperty(memoWrapper, "__memo", MEMO_MARKER_DESCRIPTOR);
16297
+ Object.defineProperty(memoWrapper, "defaultProps", MEMO_DEFAULT_PROPS_DESCRIPTOR);
16040
16298
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__)
16041
16299
  (0, import_profiling.__profileComponentSource)(memoWrapper, component);
16042
16300
  if (arePropsEqual) Object.defineProperty(memoWrapper, "__compare", { value: arePropsEqual });
@@ -22500,6 +22758,7 @@ function scriptResource(attrs) {
22500
22758
  injectStyle,
22501
22759
  invokeManualHook,
22502
22760
  isChildrenBlock,
22761
+ isHydratingStyle,
22503
22762
  isInActScope,
22504
22763
  isValidElement,
22505
22764
  keyedForBlock,
@@ -22557,6 +22816,7 @@ function scriptResource(attrs) {
22557
22816
  queueRefAttach,
22558
22817
  queueRefDetach,
22559
22818
  readContextFromScope,
22819
+ registerWarmPlan,
22560
22820
  renderBlock,
22561
22821
  renderClientContextProvider,
22562
22822
  replaceRef,
@@ -22597,6 +22857,7 @@ function scriptResource(attrs) {
22597
22857
  setStringData,
22598
22858
  setStringDataIfChanged,
22599
22859
  setStyle,
22860
+ setStyleProperties,
22600
22861
  setStyleProperty,
22601
22862
  setText,
22602
22863
  setTransitionFallbackTimeout,