octane 0.13.6 → 0.13.8

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.
@@ -83,6 +83,7 @@ __export(index_exports, {
83
83
  compilerCacheMappedArray: () => import_runtime.compilerCacheMappedArray,
84
84
  compilerOwnsContextProvider: () => import_runtime.compilerOwnsContextProvider,
85
85
  componentSlot: () => import_runtime.componentSlot,
86
+ componentSlotFromConfig: () => import_runtime.componentSlotFromConfig,
86
87
  componentSlotLite: () => import_runtime.componentSlotLite,
87
88
  componentSlotVoid: () => import_runtime.componentSlotVoid,
88
89
  createCompiledContext: () => import_runtime.createCompiledContext,
@@ -334,6 +335,7 @@ var import_method_dep = require("./method-dep.cjs");
334
335
  compilerCacheMappedArray,
335
336
  compilerOwnsContextProvider,
336
337
  componentSlot,
338
+ componentSlotFromConfig,
337
339
  componentSlotLite,
338
340
  componentSlotVoid,
339
341
  createCompiledContext,
@@ -98,6 +98,7 @@ __export(runtime_exports, {
98
98
  compilerOpaqueTag: () => compilerOpaqueTag,
99
99
  compilerOwnsContextProvider: () => compilerOwnsContextProvider,
100
100
  componentSlot: () => componentSlot,
101
+ componentSlotFromConfig: () => componentSlotFromConfig,
101
102
  componentSlotLite: () => componentSlotLite,
102
103
  componentSlotVoid: () => componentSlotVoid,
103
104
  createCompiledContext: () => createCompiledContext,
@@ -9861,14 +9862,25 @@ function createCompiledContext(defaultValue) {
9861
9862
  function CompiledContext(props, scope) {
9862
9863
  provideContext(scope, props.context, props.value);
9863
9864
  const children = props.children;
9864
- if (children == null) return;
9865
+ if (children == null) {
9866
+ const previous2 = scope.hooks?.get(CHILDREN_DIALECT_SLOT);
9867
+ if (previous2 !== void 0 && previous2 !== 2) {
9868
+ resetScopeChildren(scope);
9869
+ if (scope.block.disposed) return;
9870
+ ensureHooks(scope).set(CHILDREN_DIALECT_SLOT, 2);
9871
+ }
9872
+ return;
9873
+ }
9865
9874
  if (!isChildrenBlock(children)) {
9866
9875
  throw new TypeError((0, import_error_codes_client_generated.formatClientError)(345));
9867
9876
  }
9868
9877
  const dialect = children[CHILDREN_BODY] ?? children;
9869
9878
  const previous = scope.hooks?.get(CHILDREN_DIALECT_SLOT);
9870
9879
  if (previous !== dialect) {
9871
- if (previous !== void 0) {
9880
+ if (previous === 2) {
9881
+ resetScopeChildren(scope);
9882
+ if (scope.block.disposed) return;
9883
+ } else if (previous !== void 0) {
9872
9884
  invalidateSharedBodyOutput(scope);
9873
9885
  if (TRANSITION_JOURNAL !== null && !ROOT_RENDER_ROLLBACK) {
9874
9886
  const hooks = scope.hooks;
@@ -9884,6 +9896,7 @@ function initializeContext(ctx, defaultValue) {
9884
9896
  ctx.$$kind = import_runtime_tags.CONTEXT_TAG;
9885
9897
  ctx.defaultValue = defaultValue;
9886
9898
  ctx.$$version = 0;
9899
+ ctx.$$providerVersion = 0;
9887
9900
  (0, import_context_identity.registerContext)(ctx);
9888
9901
  if (__octaneDev) {
9889
9902
  (0, import_context_identity.defineRemovedContextMembers)(ctx);
@@ -9898,7 +9911,7 @@ function renderClientContextProvider(context, props, renderScope) {
9898
9911
  const scope = renderScope;
9899
9912
  provideContext(scope, ctx, props.value);
9900
9913
  const children = props.children;
9901
- if (children != null) {
9914
+ if (children != null || scope.hooks?.get(CHILDREN_DIALECT_SLOT) !== void 0) {
9902
9915
  const dialect = typeof children === "function" ? children[CHILDREN_BODY] ?? children : 2;
9903
9916
  const previous = scope.hooks?.get(CHILDREN_DIALECT_SLOT);
9904
9917
  if (previous !== dialect) {
@@ -9958,6 +9971,7 @@ function provideContext(scope, context, value) {
9958
9971
  else values.delete(context);
9959
9972
  });
9960
9973
  if (had) {
9974
+ context.$$providerVersion = context.$$providerVersion === context.$$version ? context.$$version + 1 : -1;
9961
9975
  context.$$version++;
9962
9976
  (0, import_context_epoch.bumpContextEpoch)();
9963
9977
  }
@@ -11472,12 +11486,29 @@ function promoteMemoAncestry(scope) {
11472
11486
  function recordContextDependency(block, context) {
11473
11487
  if (block === null || !block.memoInChain) return;
11474
11488
  SKIPPED_ROW_REFRESH = refreshSkippedRows;
11475
- (block.$$ctxDirect ??= /* @__PURE__ */ new Map()).set(context, context.$$version);
11489
+ const direct = block.$$ctxDirect ??= /* @__PURE__ */ new Map();
11490
+ const previous = direct.get(context);
11491
+ direct.set(context, context.$$version);
11476
11492
  for (let current = block; current !== null; current = current.parentBlock) {
11477
11493
  if (current.body?.__memo === true || current.$$implicitBail === true) {
11478
11494
  (current.$$ctxReads ??= /* @__PURE__ */ new Map()).set(context, context.$$version);
11479
11495
  }
11480
11496
  }
11497
+ return previous;
11498
+ }
11499
+ function recordLocalContextValue(reader, block, context, value, previous) {
11500
+ if (reader === null || block === null || !block.memoInChain) return;
11501
+ if (typeof previous === "number" || context.$$providerVersion !== context.$$version) return;
11502
+ const cache = reader.$$ctxCache;
11503
+ const owner = cache === context ? reader.$$ctxCacheOwner : cache !== null && reader.$$ctxCacheOwner === null ? cache.get(context) : void 0;
11504
+ if (owner === null || owner === void 0 || owner === DEFAULT_CTX) return;
11505
+ if (previous !== void 0) {
11506
+ if (previous.owner !== owner || !Object.is(previous.value, value)) return;
11507
+ previous.version = context.$$version;
11508
+ block.$$ctxDirect.set(context, previous);
11509
+ } else {
11510
+ block.$$ctxDirect.set(context, { version: context.$$version, owner, value });
11511
+ }
11481
11512
  }
11482
11513
  let SCOPED_READ_TRACKING = false;
11483
11514
  let SCOPED_READS = null;
@@ -11635,8 +11666,10 @@ function readContextFrom(reader, block, context) {
11635
11666
  return context.defaultValue;
11636
11667
  }
11637
11668
  function readContextFromScope(scope, context) {
11638
- recordContextDependency(scope.block, context);
11639
- return readContextFrom(scope, scope.block, context);
11669
+ const previous = recordContextDependency(scope.block, context);
11670
+ const value = readContextFrom(scope, scope.block, context);
11671
+ recordLocalContextValue(scope, scope.block, context, value, previous);
11672
+ return value;
11640
11673
  }
11641
11674
  function getRendererOwnerVisibility(scope) {
11642
11675
  if (findHiddenActivity(scope.block) !== null) return "activity";
@@ -11654,8 +11687,10 @@ function reportRendererOwnerError(scope, error) {
11654
11687
  }
11655
11688
  }
11656
11689
  function useContextInternal(context) {
11657
- recordContextDependency(CURRENT_BLOCK, context);
11658
- return readContextFrom(CURRENT_SCOPE, CURRENT_BLOCK, context);
11690
+ const previous = recordContextDependency(CURRENT_BLOCK, context);
11691
+ const value = readContextFrom(CURRENT_SCOPE, CURRENT_BLOCK, context);
11692
+ recordLocalContextValue(CURRENT_SCOPE, CURRENT_BLOCK, context, value, previous);
11693
+ return value;
11659
11694
  }
11660
11695
  class SuspenseException {
11661
11696
  constructor(thenable) {
@@ -12685,7 +12720,13 @@ function parseTemplate(html, ns, frag) {
12685
12720
  initDomOperations();
12686
12721
  const t = (STAGED_DOM ? STAGED_DOM.view(document) : document).createElement("template");
12687
12722
  if (ns === 0) {
12688
- (STAGED_DOM ? STAGED_DOM.view(t) : t).innerHTML = frag ? `<octane-frag>${html}</octane-frag>` : html;
12723
+ (STAGED_DOM ? STAGED_DOM.view(t) : t).innerHTML = html;
12724
+ if (frag) {
12725
+ const owner = t.content.ownerDocument;
12726
+ const wrapper = (STAGED_DOM ? STAGED_DOM.view(owner) : owner).createElement("octane-frag");
12727
+ (STAGED_DOM ? STAGED_DOM.view(wrapper) : wrapper).appendChild(t.content);
12728
+ return fragmentTemplate(wrapper);
12729
+ }
12689
12730
  const root = getFirstChild(t.content);
12690
12731
  if (root.nodeType === 1 && root.localName === "octane-frag") {
12691
12732
  return fragmentTemplate(root);
@@ -21711,6 +21752,31 @@ function componentSlotVoid(parentScope, slotKey, domParent, comp, props, invocat
21711
21752
  invocationSite
21712
21753
  );
21713
21754
  }
21755
+ function componentSlotFromConfig(parentScope, slotKey, domParent, comp, config, invocationSite, anchor) {
21756
+ if (typeof comp === "function" && (0, import_renderer_bridge.isRendererContext)(comp)) {
21757
+ (0, import_renderer_bridge.registerClientRendererBridge)(renderClientContextProvider, flushSync);
21758
+ }
21759
+ const key = hasElementConfigKey(config) ? "" + config.key : void 0;
21760
+ const props = copyElementConfig(config);
21761
+ (0, import_shared_value_helpers.applyElementDefaultProps)(comp, props);
21762
+ const body = comp === Fragment ? props.ref != null || import_has_own.hasOwnProp.call(props, "ref") ? renderFragmentRefDescriptor : renderFragmentConfig : comp;
21763
+ componentSlot(
21764
+ parentScope,
21765
+ slotKey,
21766
+ domParent,
21767
+ body,
21768
+ props,
21769
+ invocationSite,
21770
+ anchor,
21771
+ false,
21772
+ false,
21773
+ key,
21774
+ true
21775
+ );
21776
+ }
21777
+ function renderFragmentConfig(props) {
21778
+ return props.children;
21779
+ }
21714
21780
  function rejectCompiledReturn(_block, _out, reset) {
21715
21781
  if (reset !== true) {
21716
21782
  throw new TypeError((0, import_error_codes_client_generated.formatClientError)(346));
@@ -21865,7 +21931,7 @@ function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body,
21865
21931
  registerSlot(parentScope, state);
21866
21932
  }
21867
21933
  const nextKey = key === void 0 ? NO_KEY : "" + key;
21868
- const keyChanged = key !== void 0 && state.prevKey !== NO_KEY && nextKey !== state.prevKey;
21934
+ const keyChanged = nextKey !== state.prevKey;
21869
21935
  const replacing = identity !== state.currentComp || keyChanged;
21870
21936
  const journaledSlot = ROOT_RENDER_TRANSACTION !== null && state.block !== null && replacing;
21871
21937
  if (journaledSlot) {
@@ -25039,8 +25105,12 @@ function ctxDepsChanged(block) {
25039
25105
  function ctxDirectChanged(block) {
25040
25106
  const direct = block.$$ctxDirect;
25041
25107
  if (direct === null) return false;
25042
- for (const [ctx, version] of direct) {
25043
- if (ctx.$$version !== version) return true;
25108
+ for (const [ctx, read] of direct) {
25109
+ const version = typeof read === "number" ? read : read.version;
25110
+ if (ctx.$$version === version) continue;
25111
+ if (typeof read === "number" || ctx.$$providerVersion !== ctx.$$version || !Object.is(read.owner.$$ctxValues?.get(ctx), read.value))
25112
+ return true;
25113
+ read.version = ctx.$$version;
25044
25114
  }
25045
25115
  return false;
25046
25116
  }
@@ -25109,7 +25179,8 @@ function restampCtxDeps(block) {
25109
25179
  }
25110
25180
  }
25111
25181
  if (hasDirect) {
25112
- for (const [ctx, v] of direct) {
25182
+ for (const [ctx, read] of direct) {
25183
+ const v = typeof read === "number" ? read : read.version;
25113
25184
  const cur = m.get(ctx);
25114
25185
  if (cur !== v) {
25115
25186
  const live = ctx.$$version;
@@ -32627,6 +32698,7 @@ function scriptResource(attrs) {
32627
32698
  compilerOpaqueTag,
32628
32699
  compilerOwnsContextProvider,
32629
32700
  componentSlot,
32701
+ componentSlotFromConfig,
32630
32702
  componentSlotLite,
32631
32703
  componentSlotVoid,
32632
32704
  createCompiledContext,
@@ -128,6 +128,7 @@ __export(runtime_server_exports, {
128
128
  ssrChildrenSources: () => ssrChildrenSources,
129
129
  ssrClass: () => ssrClass,
130
130
  ssrComponent: () => ssrComponent,
131
+ ssrComponentFromConfig: () => ssrComponentFromConfig,
131
132
  ssrComponentNS: () => ssrComponentNS,
132
133
  ssrControl: () => ssrControl,
133
134
  ssrElement: () => ssrElement,
@@ -1453,34 +1454,16 @@ function ssrTextPre(v) {
1453
1454
  const s = ssrText(v);
1454
1455
  return s.charCodeAt(0) === 10 ? "\n" + s : s;
1455
1456
  }
1456
- function ssrComponentDescriptor(d, scope, keyScoped) {
1457
- if (SCOPED_ELEMENT_PROPS.has(d.props)) {
1458
- return ssrComponent(
1459
- scope,
1460
- d.type,
1461
- d.props,
1462
- void 0,
1463
- d.key ?? void 0,
1464
- keyScoped,
1465
- d.__octaneInvocationSite
1466
- );
1467
- }
1457
+ function descriptorProps(d) {
1458
+ if (SCOPED_ELEMENT_PROPS.has(d.props)) return d.props;
1468
1459
  const children = d.children;
1469
- if (children == null || children === d.props?.children) {
1470
- return ssrComponent(
1471
- scope,
1472
- d.type,
1473
- d.props,
1474
- void 0,
1475
- d.key ?? void 0,
1476
- keyScoped,
1477
- d.__octaneInvocationSite
1478
- );
1479
- }
1460
+ return children == null || children === d.props?.children ? d.props : { ...d.props, children };
1461
+ }
1462
+ function ssrComponentDescriptor(d, scope, keyScoped) {
1480
1463
  return ssrComponent(
1481
1464
  scope,
1482
1465
  d.type,
1483
- { ...d.props, children },
1466
+ descriptorProps(d),
1484
1467
  void 0,
1485
1468
  d.key ?? void 0,
1486
1469
  keyScoped,
@@ -3473,6 +3456,16 @@ function ssrComponentNS(parent, comp, props, namespace, inherit, key, invocation
3473
3456
  NEXT_COMPONENT_NAMESPACE = previous;
3474
3457
  }
3475
3458
  }
3459
+ function ssrComponentFromConfig(parent, comp, config, invocationSite, namespace = null) {
3460
+ const key = hasElementConfigKey(config) ? "" + config.key : void 0;
3461
+ const props = copyElementConfig(config);
3462
+ (0, import_shared_value_helpers.applyElementDefaultProps)(comp, props);
3463
+ const body = comp === Fragment ? props.ref != null || import_has_own.hasOwnProp.call(props, "ref") ? renderFragmentRefDescriptor : renderFragmentConfig : comp;
3464
+ return namespace === null ? ssrComponent(parent, body, props, false, key, void 0, invocationSite) : ssrComponentNS(parent, body, props, namespace, false, key, invocationSite);
3465
+ }
3466
+ function renderFragmentConfig(props, scope) {
3467
+ return ssrHtml(ssrChild(props.children, scope));
3468
+ }
3476
3469
  function ssrInNamespace(namespace, render) {
3477
3470
  const frame = FRAME;
3478
3471
  if (frame === null) return render();
@@ -5288,6 +5281,10 @@ function spliceHead(body, head, documentRoot = isDocumentRoot(body)) {
5288
5281
  function renderEntryValue(props, scope) {
5289
5282
  return ssrHtml(ssrChild(props.value, scope));
5290
5283
  }
5284
+ function renderEntry(entry, props, options) {
5285
+ if (typeof entry === "function") return [entry, props, options];
5286
+ return isElementDescriptor(entry) && typeof entry.type === "function" ? [entry.type, descriptorProps(entry), options ?? props] : [renderEntryValue, { value: entry }, options ?? props];
5287
+ }
5291
5288
  const MAX_SUSPENSE_PASSES = 50;
5292
5289
  let SUSPENSE_TIMEOUT_MS = 1e4;
5293
5290
  function setSsrSuspenseTimeout(ms) {
@@ -6141,11 +6138,8 @@ function insertBufferedInjection(pass, injection) {
6141
6138
  pass.body = tailStart === -1 ? pass.body + injection : pass.body.slice(0, tailStart) + injection + pass.body.slice(tailStart);
6142
6139
  }
6143
6140
  async function prerender(entryComponent, props, options) {
6144
- const component = typeof entryComponent === "function" ? entryComponent : renderEntryValue;
6145
- if (typeof entryComponent !== "function") {
6146
- options ??= props;
6147
- props = { value: entryComponent };
6148
- }
6141
+ let component;
6142
+ [component, props, options] = renderEntry(entryComponent, props, options);
6149
6143
  const preparedOptions = needsAutomaticSignalInjection(options) ? await prepareAutomaticSignalInjection(options) : options;
6150
6144
  const injection = preparedOptions?.injection;
6151
6145
  const cancelRender = injection === void 0 ? void 0 : new AbortController();
@@ -6276,11 +6270,8 @@ function renderHostedAttempt(session, component, props, options) {
6276
6270
  return { status: "complete", html: body, head: pass.head, cssEntries: pass.cssEntries };
6277
6271
  }
6278
6272
  function renderToString(entryComponent, props, options) {
6279
- const component = typeof entryComponent === "function" ? entryComponent : renderEntryValue;
6280
- if (typeof entryComponent !== "function") {
6281
- options ??= props;
6282
- props = { value: entryComponent };
6283
- }
6273
+ let component;
6274
+ [component, props, options] = renderEntry(entryComponent, props, options);
6284
6275
  options?.signal?.throwIfAborted();
6285
6276
  const nonceAttr = nonceAttrOf(options);
6286
6277
  const resolved = newResolvedMap(options ?? null);
@@ -6306,11 +6297,8 @@ function renderToString(entryComponent, props, options) {
6306
6297
  );
6307
6298
  }
6308
6299
  function renderToStaticMarkup(entryComponent, props, options) {
6309
- const component = typeof entryComponent === "function" ? entryComponent : renderEntryValue;
6310
- if (typeof entryComponent !== "function") {
6311
- options ??= props;
6312
- props = { value: entryComponent };
6313
- }
6300
+ let component;
6301
+ [component, props, options] = renderEntry(entryComponent, props, options);
6314
6302
  options?.signal?.throwIfAborted();
6315
6303
  const nonceAttr = nonceAttrOf(options);
6316
6304
  const resolved = newResolvedMap(options ?? null);
@@ -7658,11 +7646,8 @@ async function runStream(component, props, options, sink, resolved, cancelInject
7658
7646
  sink.allReady();
7659
7647
  }
7660
7648
  function renderToPipeableStream(entryComponent, props, options) {
7661
- const component = typeof entryComponent === "function" ? entryComponent : renderEntryValue;
7662
- if (typeof entryComponent !== "function") {
7663
- options ??= props;
7664
- props = { value: entryComponent };
7665
- }
7649
+ let component;
7650
+ [component, props, options] = renderEntry(entryComponent, props, options);
7666
7651
  const controller = new AbortController();
7667
7652
  let removeOuterAbort;
7668
7653
  if (options?.signal) {
@@ -7906,11 +7891,8 @@ function renderToPipeableStream(entryComponent, props, options) {
7906
7891
  };
7907
7892
  }
7908
7893
  function renderToReadableStream(entryComponent, props, options) {
7909
- const component = typeof entryComponent === "function" ? entryComponent : renderEntryValue;
7910
- if (typeof entryComponent !== "function") {
7911
- options ??= props;
7912
- props = { value: entryComponent };
7913
- }
7894
+ let component;
7895
+ [component, props, options] = renderEntry(entryComponent, props, options);
7914
7896
  if (needsAutomaticSignalInjection(options)) {
7915
7897
  return prepareAutomaticSignalInjection(options).then(
7916
7898
  (prepared) => renderToReadableStream(component, props, prepared)
@@ -8502,6 +8484,7 @@ function preinitModule(href, options) {
8502
8484
  ssrChildrenSources,
8503
8485
  ssrClass,
8504
8486
  ssrComponent,
8487
+ ssrComponentFromConfig,
8505
8488
  ssrComponentNS,
8506
8489
  ssrControl,
8507
8490
  ssrElement,
@@ -107,6 +107,7 @@ __export(server_exports, {
107
107
  ssrChildrenSources: () => import_runtime_server.ssrChildrenSources,
108
108
  ssrClass: () => import_runtime_server.ssrClass,
109
109
  ssrComponent: () => import_runtime_server.ssrComponent,
110
+ ssrComponentFromConfig: () => import_runtime_server.ssrComponentFromConfig,
110
111
  ssrComponentNS: () => import_runtime_server.ssrComponentNS,
111
112
  ssrControl: () => import_runtime_server.ssrControl,
112
113
  ssrElement: () => import_runtime_server.ssrElement,
@@ -292,6 +293,7 @@ var import_runtime_server = require("../runtime.server.cjs");
292
293
  ssrChildrenSources,
293
294
  ssrClass,
294
295
  ssrComponent,
296
+ ssrComponentFromConfig,
295
297
  ssrComponentNS,
296
298
  ssrControl,
297
299
  ssrElement,
@@ -64,7 +64,8 @@ function serializeScopeRead(root, read) {
64
64
  const scope = root.owner;
65
65
  if (!scope.seedable) return [];
66
66
  const rootEntry = scopeSeedEntry(scope, root, read);
67
- if (!rootEntry) return void 0;
67
+ if (!rootEntry)
68
+ return read === "snapshot" && root.state?.snapshot.status !== "ready" ? [] : void 0;
68
69
  const owners = /* @__PURE__ */ new Map();
69
70
  const keys = /* @__PURE__ */ new Map();
70
71
  const seen = /* @__PURE__ */ new Set();
@@ -21,7 +21,7 @@ __export(version_exports, {
21
21
  version: () => version
22
22
  });
23
23
  module.exports = __toCommonJS(version_exports);
24
- const version = "0.13.6";
24
+ const version = "0.13.8";
25
25
  // Annotate the CommonJS export names for ESM import in node:
26
26
  0 && (module.exports = {
27
27
  version