octane 0.11.0 → 0.12.0

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.
@@ -22255,7 +22255,8 @@ function hostComponent(scope, slot, tag, props, childrenBody, anchor) {
22255
22255
  let state = scope.slots[slot];
22256
22256
  if (state === void 0) {
22257
22257
  enableDescriptorFormActions();
22258
- const el2 = (STAGED_DOM?.view(document) ?? document).createElement(tag);
22258
+ const elNs = inferTagNs(tag, deoptChildNamespace(block.parentNode));
22259
+ const el2 = elNs !== void 0 ? (STAGED_DOM?.view(document) ?? document).createElementNS(elNs, tag) : (STAGED_DOM?.view(document) ?? document).createElement(tag);
22259
22260
  state = {
22260
22261
  el: el2,
22261
22262
  anchor: null,
@@ -22822,6 +22823,23 @@ function nextDeoptOwnedChild(scan, adoptHydrationChildren) {
22822
22823
  }
22823
22824
  return null;
22824
22825
  }
22826
+ function promoteSelfMarkedItem(block) {
22827
+ const sm = block.startMarker;
22828
+ if (sm === null || sm !== block.endMarker || sm.nodeType === 8 || (STAGED_DOM?.view(sm) ?? sm).parentNode === null)
22829
+ return;
22830
+ const p = (STAGED_DOM?.view(sm) ?? sm).parentNode;
22831
+ if (ROOT_RENDER_TRANSACTION !== null) {
22832
+ journalRootRange(p, (STAGED_DOM?.view(sm) ?? sm).previousSibling, getNextSibling(sm));
22833
+ journalRootProperty(block, "startMarker", block.startMarker);
22834
+ journalRootProperty(block, "endMarker", block.endMarker);
22835
+ }
22836
+ const s = (STAGED_DOM?.view(document) ?? document).createComment("it");
22837
+ const e = (STAGED_DOM?.view(document) ?? document).createComment("/it");
22838
+ (STAGED_DOM?.view(p) ?? p).insertBefore(s, sm);
22839
+ (STAGED_DOM?.view(p) ?? p).insertBefore(e, getNextSibling(sm));
22840
+ block.startMarker = s;
22841
+ block.endMarker = e;
22842
+ }
22825
22843
  function deoptItemBody(item, scope) {
22826
22844
  const block = scope.block;
22827
22845
  const hydration = import_hydration_flag.hydrating ? activeHydration() : null;
@@ -22829,21 +22847,7 @@ function deoptItemBody(item, scope) {
22829
22847
  const itemType = isElementDescriptor(item) ? item.type : void 0;
22830
22848
  const hostItem = typeof itemType === "string";
22831
22849
  const needsBlocks = hostItem && existingChild?.__kind === "childSlot" && existingChild.currentComp === hostElementBody || typeof itemType === "function" || descNeedsBlocks(item);
22832
- const sm = block.startMarker;
22833
- if (sm !== null && sm === block.endMarker && sm.nodeType !== 8 && (STAGED_DOM?.view(sm) ?? sm).parentNode !== null && (needsBlocks || !hostItem)) {
22834
- const p = (STAGED_DOM?.view(sm) ?? sm).parentNode;
22835
- if (ROOT_RENDER_TRANSACTION !== null) {
22836
- journalRootRange(p, (STAGED_DOM?.view(sm) ?? sm).previousSibling, getNextSibling(sm));
22837
- journalRootProperty(block, "startMarker", block.startMarker);
22838
- journalRootProperty(block, "endMarker", block.endMarker);
22839
- }
22840
- const s = (STAGED_DOM?.view(document) ?? document).createComment("it");
22841
- const e = (STAGED_DOM?.view(document) ?? document).createComment("/it");
22842
- (STAGED_DOM?.view(p) ?? p).insertBefore(s, sm);
22843
- (STAGED_DOM?.view(p) ?? p).insertBefore(e, getNextSibling(sm));
22844
- block.startMarker = s;
22845
- block.endMarker = e;
22846
- }
22850
+ if (needsBlocks || !hostItem) promoteSelfMarkedItem(block);
22847
22851
  if (needsBlocks) {
22848
22852
  const stale = block.deoptNode;
22849
22853
  let transfer = null;
@@ -23004,9 +23008,20 @@ function mappedDeoptItemBody(item, scope) {
23004
23008
  if (state === void 0 || state.__kind === "componentSlotSlot") {
23005
23009
  const stale = block.deoptNode;
23006
23010
  if (stale !== null) {
23007
- detachDeoptTreeRefs(stale, null);
23008
- if ((STAGED_DOM?.view(stale) ?? stale).parentNode === block.parentNode)
23009
- domNode(block.parentNode).removeChild(stale);
23011
+ promoteSelfMarkedItem(block);
23012
+ journalRootProperty(block, "deoptNode", stale);
23013
+ const attached = (STAGED_DOM?.view(stale) ?? stale).parentNode === block.parentNode;
23014
+ if (attached && ROOT_RENDER_TRANSACTION !== null) {
23015
+ journalRootRange(
23016
+ block.parentNode,
23017
+ (STAGED_DOM?.view(stale) ?? stale).previousSibling,
23018
+ getNextSibling(stale)
23019
+ );
23020
+ deferRootRange(block.parentNode, stale, stale, () => detachDeoptTreeRefs(stale, null));
23021
+ } else {
23022
+ detachDeoptTreeRefs(stale, null);
23023
+ if (attached) domNode(block.parentNode).removeChild(stale);
23024
+ }
23010
23025
  block.deoptNode = null;
23011
23026
  }
23012
23027
  componentSlot(
@@ -29143,7 +29158,8 @@ function switchBlock(parentScope, slotKey, domParent, discriminant, cases, defau
29143
29158
  body,
29144
29159
  "switch",
29145
29160
  env,
29146
- lite !== void 0 && (lite & (nextIdx < 0 ? 1 : 2 << nextIdx)) !== 0
29161
+ // Only the first 30 cases have lite bits, and a shift count wraps at 32.
29162
+ lite !== void 0 && nextIdx < 30 && (lite & (nextIdx < 0 ? 1 : 2 << nextIdx)) !== 0
29147
29163
  );
29148
29164
  }
29149
29165
  function forBlock(parentScope, slotKey, domParent, inputItems, getKey, itemBody, flags, deps, emptyBody, anchor, ownEnd, signalSite) {
@@ -29411,9 +29427,11 @@ function mountFastHostItems(parentScope, state, parentNode, items, getKey, itemB
29411
29427
  block.currentRenderDeferred = deferred;
29412
29428
  CURRENT_SCOPE = block;
29413
29429
  CURRENT_BLOCK = block;
29430
+ NATIVE_READ_DRIVER?.beginRender(block);
29414
29431
  itemBody(item, block, deps);
29415
29432
  CURRENT_SCOPE = previousScope;
29416
29433
  CURRENT_BLOCK = previousBlock;
29434
+ NATIVE_READ_DRIVER?.endRender(block, true, false);
29417
29435
  block.mounted = true;
29418
29436
  const end = state.end;
29419
29437
  const root = (STAGED_DOM?.view(end) ?? end).previousSibling;
@@ -29432,6 +29450,7 @@ function mountFastHostItems(parentScope, state, parentNode, items, getKey, itemB
29432
29450
  CURRENT_SCOPE = previousScope;
29433
29451
  CURRENT_BLOCK = previousBlock;
29434
29452
  if (current !== null) {
29453
+ NATIVE_READ_DRIVER?.endRender(current, false, isSuspenseException(error));
29435
29454
  if (current.slots[0] !== void 0) {
29436
29455
  const end = state.end;
29437
29456
  const root = (STAGED_DOM?.view(end) ?? end).previousSibling;
@@ -1138,6 +1138,7 @@ function cloneElement(element, config, ...children) {
1138
1138
  if (n === 1) {
1139
1139
  kids = children[0];
1140
1140
  } else if (n > 1) {
1141
+ POSITIONAL_CHILDREN.add(children);
1141
1142
  kids = children;
1142
1143
  } else if (scopedChildren !== void 0 && !replacedChildren) {
1143
1144
  Object.defineProperty(
@@ -21,7 +21,7 @@ __export(version_exports, {
21
21
  version: () => version
22
22
  });
23
23
  module.exports = __toCommonJS(version_exports);
24
- const version = "0.11.0";
24
+ const version = "0.12.0";
25
25
  // Annotate the CommonJS export names for ESM import in node:
26
26
  0 && (module.exports = {
27
27
  version
@@ -433,7 +433,11 @@ function attributeEntries(node, state) {
433
433
  }
434
434
  const name = attribute.name?.type === 'JSXIdentifier' ? attribute.name.name : null;
435
435
  if (name === null) throw valdiError(state, attribute, 'namespaced attributes are unsupported.');
436
- if (name === 'ref' || name === 'children') {
436
+ if (
437
+ name === 'children' ||
438
+ (name === 'ref' &&
439
+ (intrinsicTag(node) === null || !state.renderer.capabilities?.includes('host-ref')))
440
+ ) {
437
441
  throw valdiError(state, attribute, `authored ${name} props are not supported yet.`);
438
442
  }
439
443
  return { name, value: attributeValue(attribute, state), origin: attribute };
@@ -598,6 +602,8 @@ function keyExpression(state, prototype, keys, explicit, origin) {
598
602
  }
599
603
 
600
604
  function mergedAttributes(entries, state, origin) {
605
+ const allowRef =
606
+ intrinsicTag(origin) !== null && state.renderer.capabilities?.includes('host-ref');
601
607
  const keyName = allocName(state, '__octaneValdiKey');
602
608
  const refName = allocName(state, '__octaneValdiRef');
603
609
  const childrenName = allocName(state, '__octaneValdiChildren');
@@ -611,18 +617,20 @@ function mergedAttributes(entries, state, origin) {
611
617
  );
612
618
  const pattern = b.object_pattern([
613
619
  b.prop('init', b.id('key'), b.id(keyName)),
614
- b.prop('init', b.id('ref'), b.id(refName)),
620
+ ...(allowRef ? [] : [b.prop('init', b.id('ref'), b.id(refName))]),
615
621
  b.prop('init', b.id('children'), b.id(childrenName)),
616
622
  b.rest(b.id(propsName)),
617
623
  ]);
618
624
  const prelude = [
619
625
  b.const(pattern, expression),
620
626
  b.if(
621
- b.logical(
622
- '||',
623
- b.binary('!==', b.id(refName), b.unary('void', b.literal(0))),
624
- b.binary('!==', b.id(childrenName), b.unary('void', b.literal(0))),
625
- ),
627
+ allowRef
628
+ ? b.binary('!==', b.id(childrenName), b.unary('void', b.literal(0)))
629
+ : b.logical(
630
+ '||',
631
+ b.binary('!==', b.id(refName), b.unary('void', b.literal(0))),
632
+ b.binary('!==', b.id(childrenName), b.unary('void', b.literal(0))),
633
+ ),
626
634
  b.block([
627
635
  b.throw_error('Octane Valdi compiler: spread ref/children props are not supported yet.'),
628
636
  ]),
@@ -648,7 +656,12 @@ function prepareAttributes(entries, state, origin) {
648
656
  const dynamic = [];
649
657
  let key = null;
650
658
  for (const entry of entries) {
651
- if (entry.name !== 'key' && counts.get(entry.name) === 1 && isStaticAttribute(entry.value)) {
659
+ if (
660
+ entry.name !== 'key' &&
661
+ entry.name !== 'ref' &&
662
+ counts.get(entry.name) === 1 &&
663
+ isStaticAttribute(entry.value)
664
+ ) {
652
665
  statics.push(withOrigin(b.literal(entry.name), entry.origin), entry.value);
653
666
  continue;
654
667
  }
@@ -762,10 +775,14 @@ function emitIntrinsicContents(node, state, attrs) {
762
775
  return statements;
763
776
  }
764
777
 
765
- function isEmptyChild(node) {
778
+ function isEmptyChild(node, state) {
779
+ const raw = node?.raw ?? node?.value ?? '';
766
780
  return (
767
781
  node == null ||
768
- (node.type === 'JSXText' && /^[ \t\r\n;]*$/.test(node.raw ?? node.value ?? '')) ||
782
+ (node.type === 'JSXText' &&
783
+ (state.renderer.text === 'host'
784
+ ? /^[ \t\r\n]*$/.test(raw) && /[\r\n]/.test(raw)
785
+ : /^[ \t\r\n;]*$/.test(raw))) ||
769
786
  (node.type === 'JSXExpressionContainer' && node.expression?.type === 'JSXEmptyExpression')
770
787
  );
771
788
  }
@@ -796,7 +813,7 @@ function emitElement(node, state, keys) {
796
813
  return statements;
797
814
  }
798
815
  const component = componentExpression(name, state, node);
799
- const children = (node.children ?? []).filter((child) => !isEmptyChild(child));
816
+ const children = (node.children ?? []).filter((child) => !isEmptyChild(child, state));
800
817
  if (children.length !== 0) {
801
818
  throw valdiError(state, node, 'component children/render props are not supported yet.');
802
819
  }
@@ -955,6 +972,16 @@ function emitRenderable(node, state, keys) {
955
972
  return emitNodes(value.children ?? [], state, keys, false);
956
973
  if (value?.type === 'JSXForExpression') return emitFor(value, state, keys);
957
974
  if (value?.type === 'JSXIfExpression') return emitIf(value, state, keys);
975
+ if (state.renderer.text === 'host') {
976
+ return [
977
+ writerStatement(
978
+ state,
979
+ 'appendText',
980
+ [assertNoTemplate(node, state, 'JSX within host text')],
981
+ node,
982
+ ),
983
+ ];
984
+ }
958
985
  throw valdiError(
959
986
  state,
960
987
  node,
@@ -1001,9 +1028,13 @@ function rewriteComponentStatement(node, state, keys, allowReturn) {
1001
1028
  function emitNodes(nodes, state, keys, allowReturn) {
1002
1029
  const output = [];
1003
1030
  for (const node of nodes) {
1004
- if (isEmptyChild(node)) continue;
1031
+ if (isEmptyChild(node, state)) continue;
1005
1032
  if (node.type === 'JSXText') {
1006
1033
  if (state.renderer.text === 'ignore') continue;
1034
+ if (state.renderer.text === 'host') {
1035
+ output.push(writerStatement(state, 'appendText', [b.literal(node.value)], node));
1036
+ continue;
1037
+ }
1007
1038
  throw valdiError(
1008
1039
  state,
1009
1040
  node,
@@ -1103,9 +1134,6 @@ export function compileValdi(
1103
1134
  'Octane profiling is not supported by the Valdi writer target yet.',
1104
1135
  );
1105
1136
  }
1106
- if (renderer.text === 'host') {
1107
- throw valdiError(state, ast, 'host text is unsupported; use text: "reject" or "ignore".');
1108
- }
1109
1137
  const boundaries = assertRendererBoundaryAnalysis(
1110
1138
  analyzeRendererBoundaries(source, {
1111
1139
  ast,
@@ -1138,7 +1166,20 @@ export function compileValdi(
1138
1166
  }
1139
1167
  const origin = ast.body?.[0] ?? ast;
1140
1168
  const guard = withOrigin(
1141
- b.stmt(call(state, 'assertValdiCompilerAbi', [b.literal(VALDI_COMPILER_ABI_VERSION)], origin)),
1169
+ b.stmt(
1170
+ call(
1171
+ state,
1172
+ 'assertValdiCompilerAbi',
1173
+ [
1174
+ b.literal(
1175
+ renderer.text === 'host' || renderer.capabilities?.includes('host-ref')
1176
+ ? 2
1177
+ : VALDI_COMPILER_ABI_VERSION,
1178
+ ),
1179
+ ],
1180
+ origin,
1181
+ ),
1182
+ ),
1142
1183
  origin,
1143
1184
  );
1144
1185
  const writerPrelude =
@@ -22137,7 +22137,8 @@ function hostComponent(scope, slot, tag, props, childrenBody, anchor) {
22137
22137
  let state = scope.slots[slot];
22138
22138
  if (state === void 0) {
22139
22139
  enableDescriptorFormActions();
22140
- const el2 = (STAGED_DOM?.view(document) ?? document).createElement(tag);
22140
+ const elNs = inferTagNs(tag, deoptChildNamespace(block.parentNode));
22141
+ const el2 = elNs !== void 0 ? (STAGED_DOM?.view(document) ?? document).createElementNS(elNs, tag) : (STAGED_DOM?.view(document) ?? document).createElement(tag);
22141
22142
  state = {
22142
22143
  el: el2,
22143
22144
  anchor: null,
@@ -22704,6 +22705,23 @@ function nextDeoptOwnedChild(scan, adoptHydrationChildren) {
22704
22705
  }
22705
22706
  return null;
22706
22707
  }
22708
+ function promoteSelfMarkedItem(block) {
22709
+ const sm = block.startMarker;
22710
+ if (sm === null || sm !== block.endMarker || sm.nodeType === 8 || (STAGED_DOM?.view(sm) ?? sm).parentNode === null)
22711
+ return;
22712
+ const p = (STAGED_DOM?.view(sm) ?? sm).parentNode;
22713
+ if (ROOT_RENDER_TRANSACTION !== null) {
22714
+ journalRootRange(p, (STAGED_DOM?.view(sm) ?? sm).previousSibling, getNextSibling(sm));
22715
+ journalRootProperty(block, "startMarker", block.startMarker);
22716
+ journalRootProperty(block, "endMarker", block.endMarker);
22717
+ }
22718
+ const s = (STAGED_DOM?.view(document) ?? document).createComment("it");
22719
+ const e = (STAGED_DOM?.view(document) ?? document).createComment("/it");
22720
+ (STAGED_DOM?.view(p) ?? p).insertBefore(s, sm);
22721
+ (STAGED_DOM?.view(p) ?? p).insertBefore(e, getNextSibling(sm));
22722
+ block.startMarker = s;
22723
+ block.endMarker = e;
22724
+ }
22707
22725
  function deoptItemBody(item, scope) {
22708
22726
  const block = scope.block;
22709
22727
  const hydration = hydrating ? activeHydration() : null;
@@ -22711,21 +22729,7 @@ function deoptItemBody(item, scope) {
22711
22729
  const itemType = isElementDescriptor(item) ? item.type : void 0;
22712
22730
  const hostItem = typeof itemType === "string";
22713
22731
  const needsBlocks = hostItem && existingChild?.__kind === "childSlot" && existingChild.currentComp === hostElementBody || typeof itemType === "function" || descNeedsBlocks(item);
22714
- const sm = block.startMarker;
22715
- if (sm !== null && sm === block.endMarker && sm.nodeType !== 8 && (STAGED_DOM?.view(sm) ?? sm).parentNode !== null && (needsBlocks || !hostItem)) {
22716
- const p = (STAGED_DOM?.view(sm) ?? sm).parentNode;
22717
- if (ROOT_RENDER_TRANSACTION !== null) {
22718
- journalRootRange(p, (STAGED_DOM?.view(sm) ?? sm).previousSibling, getNextSibling(sm));
22719
- journalRootProperty(block, "startMarker", block.startMarker);
22720
- journalRootProperty(block, "endMarker", block.endMarker);
22721
- }
22722
- const s = (STAGED_DOM?.view(document) ?? document).createComment("it");
22723
- const e = (STAGED_DOM?.view(document) ?? document).createComment("/it");
22724
- (STAGED_DOM?.view(p) ?? p).insertBefore(s, sm);
22725
- (STAGED_DOM?.view(p) ?? p).insertBefore(e, getNextSibling(sm));
22726
- block.startMarker = s;
22727
- block.endMarker = e;
22728
- }
22732
+ if (needsBlocks || !hostItem) promoteSelfMarkedItem(block);
22729
22733
  if (needsBlocks) {
22730
22734
  const stale = block.deoptNode;
22731
22735
  let transfer = null;
@@ -22886,9 +22890,20 @@ function mappedDeoptItemBody(item, scope) {
22886
22890
  if (state === void 0 || state.__kind === "componentSlotSlot") {
22887
22891
  const stale = block.deoptNode;
22888
22892
  if (stale !== null) {
22889
- detachDeoptTreeRefs(stale, null);
22890
- if ((STAGED_DOM?.view(stale) ?? stale).parentNode === block.parentNode)
22891
- domNode(block.parentNode).removeChild(stale);
22893
+ promoteSelfMarkedItem(block);
22894
+ journalRootProperty(block, "deoptNode", stale);
22895
+ const attached = (STAGED_DOM?.view(stale) ?? stale).parentNode === block.parentNode;
22896
+ if (attached && ROOT_RENDER_TRANSACTION !== null) {
22897
+ journalRootRange(
22898
+ block.parentNode,
22899
+ (STAGED_DOM?.view(stale) ?? stale).previousSibling,
22900
+ getNextSibling(stale)
22901
+ );
22902
+ deferRootRange(block.parentNode, stale, stale, () => detachDeoptTreeRefs(stale, null));
22903
+ } else {
22904
+ detachDeoptTreeRefs(stale, null);
22905
+ if (attached) domNode(block.parentNode).removeChild(stale);
22906
+ }
22892
22907
  block.deoptNode = null;
22893
22908
  }
22894
22909
  componentSlot(
@@ -29025,7 +29040,8 @@ function switchBlock(parentScope, slotKey, domParent, discriminant, cases, defau
29025
29040
  body,
29026
29041
  "switch",
29027
29042
  env,
29028
- lite !== void 0 && (lite & (nextIdx < 0 ? 1 : 2 << nextIdx)) !== 0
29043
+ // Only the first 30 cases have lite bits, and a shift count wraps at 32.
29044
+ lite !== void 0 && nextIdx < 30 && (lite & (nextIdx < 0 ? 1 : 2 << nextIdx)) !== 0
29029
29045
  );
29030
29046
  }
29031
29047
  function forBlock(parentScope, slotKey, domParent, inputItems, getKey, itemBody, flags, deps, emptyBody, anchor, ownEnd, signalSite) {
@@ -29293,9 +29309,11 @@ function mountFastHostItems(parentScope, state, parentNode, items, getKey, itemB
29293
29309
  block.currentRenderDeferred = deferred;
29294
29310
  CURRENT_SCOPE = block;
29295
29311
  CURRENT_BLOCK = block;
29312
+ NATIVE_READ_DRIVER?.beginRender(block);
29296
29313
  itemBody(item, block, deps);
29297
29314
  CURRENT_SCOPE = previousScope;
29298
29315
  CURRENT_BLOCK = previousBlock;
29316
+ NATIVE_READ_DRIVER?.endRender(block, true, false);
29299
29317
  block.mounted = true;
29300
29318
  const end = state.end;
29301
29319
  const root = (STAGED_DOM?.view(end) ?? end).previousSibling;
@@ -29314,6 +29332,7 @@ function mountFastHostItems(parentScope, state, parentNode, items, getKey, itemB
29314
29332
  CURRENT_SCOPE = previousScope;
29315
29333
  CURRENT_BLOCK = previousBlock;
29316
29334
  if (current !== null) {
29335
+ NATIVE_READ_DRIVER?.endRender(current, false, isSuspenseException(error));
29317
29336
  if (current.slots[0] !== void 0) {
29318
29337
  const end = state.end;
29319
29338
  const root = (STAGED_DOM?.view(end) ?? end).previousSibling;
@@ -1063,6 +1063,7 @@ function cloneElement(element, config, ...children) {
1063
1063
  if (n === 1) {
1064
1064
  kids = children[0];
1065
1065
  } else if (n > 1) {
1066
+ POSITIONAL_CHILDREN.add(children);
1066
1067
  kids = children;
1067
1068
  } else if (scopedChildren !== void 0 && !replacedChildren) {
1068
1069
  Object.defineProperty(
@@ -1,4 +1,4 @@
1
- const version = "0.11.0";
1
+ const version = "0.12.0";
2
2
  export {
3
3
  version
4
4
  };
package/dist/runtime.js CHANGED
@@ -22136,7 +22136,8 @@ function hostComponent(scope, slot, tag, props, childrenBody, anchor) {
22136
22136
  let state = scope.slots[slot];
22137
22137
  if (state === void 0) {
22138
22138
  enableDescriptorFormActions();
22139
- const el2 = (STAGED_DOM?.view(document) ?? document).createElement(tag);
22139
+ const elNs = inferTagNs(tag, deoptChildNamespace(block.parentNode));
22140
+ const el2 = elNs !== void 0 ? (STAGED_DOM?.view(document) ?? document).createElementNS(elNs, tag) : (STAGED_DOM?.view(document) ?? document).createElement(tag);
22140
22141
  state = {
22141
22142
  el: el2,
22142
22143
  anchor: null,
@@ -22703,6 +22704,23 @@ function nextDeoptOwnedChild(scan, adoptHydrationChildren) {
22703
22704
  }
22704
22705
  return null;
22705
22706
  }
22707
+ function promoteSelfMarkedItem(block) {
22708
+ const sm = block.startMarker;
22709
+ if (sm === null || sm !== block.endMarker || sm.nodeType === 8 || (STAGED_DOM?.view(sm) ?? sm).parentNode === null)
22710
+ return;
22711
+ const p = (STAGED_DOM?.view(sm) ?? sm).parentNode;
22712
+ if (ROOT_RENDER_TRANSACTION !== null) {
22713
+ journalRootRange(p, (STAGED_DOM?.view(sm) ?? sm).previousSibling, getNextSibling(sm));
22714
+ journalRootProperty(block, "startMarker", block.startMarker);
22715
+ journalRootProperty(block, "endMarker", block.endMarker);
22716
+ }
22717
+ const s = (STAGED_DOM?.view(document) ?? document).createComment("it");
22718
+ const e = (STAGED_DOM?.view(document) ?? document).createComment("/it");
22719
+ (STAGED_DOM?.view(p) ?? p).insertBefore(s, sm);
22720
+ (STAGED_DOM?.view(p) ?? p).insertBefore(e, getNextSibling(sm));
22721
+ block.startMarker = s;
22722
+ block.endMarker = e;
22723
+ }
22706
22724
  function deoptItemBody(item, scope) {
22707
22725
  const block = scope.block;
22708
22726
  const hydration = hydrating ? activeHydration() : null;
@@ -22710,21 +22728,7 @@ function deoptItemBody(item, scope) {
22710
22728
  const itemType = isElementDescriptor(item) ? item.type : void 0;
22711
22729
  const hostItem = typeof itemType === "string";
22712
22730
  const needsBlocks = hostItem && existingChild?.__kind === "childSlot" && existingChild.currentComp === hostElementBody || typeof itemType === "function" || descNeedsBlocks(item);
22713
- const sm = block.startMarker;
22714
- if (sm !== null && sm === block.endMarker && sm.nodeType !== 8 && (STAGED_DOM?.view(sm) ?? sm).parentNode !== null && (needsBlocks || !hostItem)) {
22715
- const p = (STAGED_DOM?.view(sm) ?? sm).parentNode;
22716
- if (ROOT_RENDER_TRANSACTION !== null) {
22717
- journalRootRange(p, (STAGED_DOM?.view(sm) ?? sm).previousSibling, getNextSibling(sm));
22718
- journalRootProperty(block, "startMarker", block.startMarker);
22719
- journalRootProperty(block, "endMarker", block.endMarker);
22720
- }
22721
- const s = (STAGED_DOM?.view(document) ?? document).createComment("it");
22722
- const e = (STAGED_DOM?.view(document) ?? document).createComment("/it");
22723
- (STAGED_DOM?.view(p) ?? p).insertBefore(s, sm);
22724
- (STAGED_DOM?.view(p) ?? p).insertBefore(e, getNextSibling(sm));
22725
- block.startMarker = s;
22726
- block.endMarker = e;
22727
- }
22731
+ if (needsBlocks || !hostItem) promoteSelfMarkedItem(block);
22728
22732
  if (needsBlocks) {
22729
22733
  const stale = block.deoptNode;
22730
22734
  let transfer = null;
@@ -22885,9 +22889,20 @@ function mappedDeoptItemBody(item, scope) {
22885
22889
  if (state === void 0 || state.__kind === "componentSlotSlot") {
22886
22890
  const stale = block.deoptNode;
22887
22891
  if (stale !== null) {
22888
- detachDeoptTreeRefs(stale, null);
22889
- if ((STAGED_DOM?.view(stale) ?? stale).parentNode === block.parentNode)
22890
- domNode(block.parentNode).removeChild(stale);
22892
+ promoteSelfMarkedItem(block);
22893
+ journalRootProperty(block, "deoptNode", stale);
22894
+ const attached = (STAGED_DOM?.view(stale) ?? stale).parentNode === block.parentNode;
22895
+ if (attached && ROOT_RENDER_TRANSACTION !== null) {
22896
+ journalRootRange(
22897
+ block.parentNode,
22898
+ (STAGED_DOM?.view(stale) ?? stale).previousSibling,
22899
+ getNextSibling(stale)
22900
+ );
22901
+ deferRootRange(block.parentNode, stale, stale, () => detachDeoptTreeRefs(stale, null));
22902
+ } else {
22903
+ detachDeoptTreeRefs(stale, null);
22904
+ if (attached) domNode(block.parentNode).removeChild(stale);
22905
+ }
22891
22906
  block.deoptNode = null;
22892
22907
  }
22893
22908
  componentSlot(
@@ -29024,7 +29039,8 @@ function switchBlock(parentScope, slotKey, domParent, discriminant, cases, defau
29024
29039
  body,
29025
29040
  "switch",
29026
29041
  env,
29027
- lite !== void 0 && (lite & (nextIdx < 0 ? 1 : 2 << nextIdx)) !== 0
29042
+ // Only the first 30 cases have lite bits, and a shift count wraps at 32.
29043
+ lite !== void 0 && nextIdx < 30 && (lite & (nextIdx < 0 ? 1 : 2 << nextIdx)) !== 0
29028
29044
  );
29029
29045
  }
29030
29046
  function forBlock(parentScope, slotKey, domParent, inputItems, getKey, itemBody, flags, deps, emptyBody, anchor, ownEnd, signalSite) {
@@ -29292,9 +29308,11 @@ function mountFastHostItems(parentScope, state, parentNode, items, getKey, itemB
29292
29308
  block.currentRenderDeferred = deferred;
29293
29309
  CURRENT_SCOPE = block;
29294
29310
  CURRENT_BLOCK = block;
29311
+ NATIVE_READ_DRIVER?.beginRender(block);
29295
29312
  itemBody(item, block, deps);
29296
29313
  CURRENT_SCOPE = previousScope;
29297
29314
  CURRENT_BLOCK = previousBlock;
29315
+ NATIVE_READ_DRIVER?.endRender(block, true, false);
29298
29316
  block.mounted = true;
29299
29317
  const end = state.end;
29300
29318
  const root = (STAGED_DOM?.view(end) ?? end).previousSibling;
@@ -29313,6 +29331,7 @@ function mountFastHostItems(parentScope, state, parentNode, items, getKey, itemB
29313
29331
  CURRENT_SCOPE = previousScope;
29314
29332
  CURRENT_BLOCK = previousBlock;
29315
29333
  if (current !== null) {
29334
+ NATIVE_READ_DRIVER?.endRender(current, false, isSuspenseException(error));
29316
29335
  if (current.slots[0] !== void 0) {
29317
29336
  const end = state.end;
29318
29337
  const root = (STAGED_DOM?.view(end) ?? end).previousSibling;
@@ -1062,6 +1062,7 @@ function cloneElement(element, config, ...children) {
1062
1062
  if (n === 1) {
1063
1063
  kids = children[0];
1064
1064
  } else if (n > 1) {
1065
+ POSITIONAL_CHILDREN.add(children);
1065
1066
  kids = children;
1066
1067
  } else if (scopedChildren !== void 0 && !replacedChildren) {
1067
1068
  Object.defineProperty(
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
- const version = "0.11.0";
1
+ const version = "0.12.0";
2
2
  export {
3
3
  version
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "octane",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": [