@barefootjs/client 0.33.4 → 0.34.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.
@@ -168757,10 +168757,22 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
168757
168757
  var import_typescript25 = __toESM(require_typescript(), 1);
168758
168758
 
168759
168759
  // ../jsx/src/analyzer.ts
168760
- var import_typescript9 = __toESM(require_typescript(), 1);
168760
+ var import_typescript10 = __toESM(require_typescript(), 1);
168761
168761
 
168762
168762
  // ../jsx/src/expression-parser.ts
168763
168763
  var import_typescript = __toESM(require_typescript(), 1);
168764
+
168765
+ // ../jsx/src/lowering-registry.ts
168766
+ var plugins = [];
168767
+ function registerLoweringPlugin(plugin) {
168768
+ const existing = plugins.findIndex((p) => p.name === plugin.name);
168769
+ if (existing >= 0)
168770
+ plugins[existing] = plugin;
168771
+ else
168772
+ plugins.push(plugin);
168773
+ }
168774
+
168775
+ // ../jsx/src/expression-parser.ts
168764
168776
  var UNSUPPORTED_METHODS = new Set([
168765
168777
  "filter",
168766
168778
  "map",
@@ -168833,7 +168845,7 @@ var EVAL_MATH_METHODS = new Set([
168833
168845
  ]);
168834
168846
 
168835
168847
  // ../jsx/src/prop-rewrite.ts
168836
- var import_typescript5 = __toESM(require_typescript(), 1);
168848
+ var import_typescript7 = __toESM(require_typescript(), 1);
168837
168849
 
168838
168850
  // ../jsx/src/ir-to-client-js/utils.ts
168839
168851
  var import_typescript3 = __toESM(require_typescript(), 1);
@@ -168967,18 +168979,45 @@ var SVG_XML_CAMEL_ATTRS = new Set([
168967
168979
  "zoomAndPan"
168968
168980
  ]);
168969
168981
  // ../jsx/src/ir-to-client-js/csr-substitute.ts
168982
+ var import_typescript5 = __toESM(require_typescript(), 1);
168983
+
168984
+ // ../jsx/src/props-binding.ts
168970
168985
  var import_typescript4 = __toESM(require_typescript(), 1);
168986
+ function isIdentifierName(key) {
168987
+ if (key.length === 0)
168988
+ return false;
168989
+ for (let i = 0;i < key.length; ) {
168990
+ const cp = key.codePointAt(i);
168991
+ const ok = i === 0 ? import_typescript4.default.isIdentifierStart(cp, import_typescript4.default.ScriptTarget.Latest) : import_typescript4.default.isIdentifierPart(cp, import_typescript4.default.ScriptTarget.Latest);
168992
+ if (!ok)
168993
+ return false;
168994
+ i += cp > 65535 ? 2 : 1;
168995
+ }
168996
+ return true;
168997
+ }
168998
+ function propsDestructureBinding(p) {
168999
+ const callerKey = p.sourceName ?? p.name;
169000
+ const localName = p.name;
169001
+ const binding = callerKey === localName ? localName : `${isIdentifierName(callerKey) ? callerKey : JSON.stringify(callerKey)}: ${localName}`;
169002
+ return p.defaultValue ? `${binding} = ${p.defaultValue}` : binding;
169003
+ }
169004
+ var EMPTY_SET = new Set;
169005
+
169006
+ // ../jsx/src/ir-to-client-js/csr-substitute.ts
168971
169007
  function extractFreeIdentifiersFromText(text) {
168972
169008
  if (!text || text.trim().length === 0)
168973
169009
  return new Set;
168974
- const sf = import_typescript4.default.createSourceFile("__free_ids__.ts", `(${text});`, import_typescript4.default.ScriptTarget.Latest, true, import_typescript4.default.ScriptKind.TS);
169010
+ const sf = import_typescript5.default.createSourceFile("__free_ids__.ts", `(${text});`, import_typescript5.default.ScriptTarget.Latest, true, import_typescript5.default.ScriptKind.TS);
168975
169011
  const stmt = sf.statements[0];
168976
- if (!stmt || !import_typescript4.default.isExpressionStatement(stmt))
169012
+ if (!stmt || !import_typescript5.default.isExpressionStatement(stmt))
168977
169013
  return new Set;
168978
- const expr = import_typescript4.default.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
169014
+ const expr = import_typescript5.default.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
168979
169015
  return extractFreeIdentifiersFromNode(expr);
168980
169016
  }
168981
169017
 
169018
+ // ../jsx/src/ir-to-client-js/rewrite-props-object.ts
169019
+ var import_typescript6 = __toESM(require_typescript(), 1);
169020
+
168982
169021
  // ../jsx/src/scope/binding-scope.ts
168983
169022
  class BindingScope {
168984
169023
  frames;
@@ -169100,27 +169139,6 @@ var SKELETON_PATH_FORCE_CLOSE_GROUPS = [
169100
169139
  new Set(["li"])
169101
169140
  ];
169102
169141
 
169103
- // ../jsx/src/props-binding.ts
169104
- var import_typescript6 = __toESM(require_typescript(), 1);
169105
- function isIdentifierName(key) {
169106
- if (key.length === 0)
169107
- return false;
169108
- for (let i = 0;i < key.length; ) {
169109
- const cp = key.codePointAt(i);
169110
- const ok = i === 0 ? import_typescript6.default.isIdentifierStart(cp, import_typescript6.default.ScriptTarget.Latest) : import_typescript6.default.isIdentifierPart(cp, import_typescript6.default.ScriptTarget.Latest);
169111
- if (!ok)
169112
- return false;
169113
- i += cp > 65535 ? 2 : 1;
169114
- }
169115
- return true;
169116
- }
169117
- function propsDestructureBinding(p) {
169118
- const callerKey = p.sourceName ?? p.name;
169119
- const localName = p.name;
169120
- const binding = callerKey === localName ? localName : `${isIdentifierName(callerKey) ? callerKey : JSON.stringify(callerKey)}: ${localName}`;
169121
- return p.defaultValue ? `${binding} = ${p.defaultValue}` : binding;
169122
- }
169123
-
169124
169142
  // ../jsx/src/instrumentation.ts
169125
169143
  var _counters = freshCounters();
169126
169144
  function freshCounters() {
@@ -169134,20 +169152,21 @@ function freshCounters() {
169134
169152
  }
169135
169153
 
169136
169154
  // ../jsx/src/analyzer-context.ts
169137
- var import_typescript8 = __toESM(require_typescript(), 1);
169155
+ var import_typescript9 = __toESM(require_typescript(), 1);
169138
169156
 
169139
169157
  // ../jsx/src/strip-types.ts
169140
- var import_typescript7 = __toESM(require_typescript(), 1);
169158
+ var import_typescript8 = __toESM(require_typescript(), 1);
169141
169159
 
169142
169160
  // ../jsx/src/analyzer-context.ts
169143
- var _typePrinter = import_typescript8.default.createPrinter({ removeComments: true, omitTrailingSemicolon: true });
169144
- var _blankTypeSourceFile = import_typescript8.default.createSourceFile("__bf_types__.ts", "", import_typescript8.default.ScriptTarget.Latest);
169161
+ var _typePrinter = import_typescript9.default.createPrinter({ removeComments: true, omitTrailingSemicolon: true });
169162
+ var _blankTypeSourceFile = import_typescript9.default.createSourceFile("__bf_types__.ts", "", import_typescript9.default.ScriptTarget.Latest);
169145
169163
 
169146
169164
  // ../jsx/src/errors.ts
169147
169165
  var ErrorCodes = {
169148
169166
  MISSING_USE_CLIENT: "BF001",
169149
169167
  CLIENT_IMPORTING_SERVER: "BF003",
169150
169168
  SIGNAL_OUTSIDE_COMPONENT: "BF011",
169169
+ PRIMITIVE_VIA_NAMESPACE_IMPORT: "BF013",
169151
169170
  UNSUPPORTED_JSX_PATTERN: "BF021",
169152
169171
  MISSING_KEY_IN_LIST: "BF023",
169153
169172
  MISSING_KEY_IN_NESTED_LIST: "BF024",
@@ -169180,6 +169199,7 @@ var errorMessages = {
169180
169199
  [ErrorCodes.MISSING_USE_CLIENT]: "'use client' directive required for components with createSignal or event handlers",
169181
169200
  [ErrorCodes.CLIENT_IMPORTING_SERVER]: "Client component cannot import server component",
169182
169201
  [ErrorCodes.SIGNAL_OUTSIDE_COMPONENT]: "Module-level reactive declaration (createSignal / createMemo) is not allowed. " + "The downstream codegen drops the declaration silently and every reference becomes a ReferenceError at SSR and at hydrate. " + "Move the declaration inside a component function so each mount gets its own state.",
169202
+ [ErrorCodes.PRIMITIVE_VIA_NAMESPACE_IMPORT]: "Reactive primitive called through a namespace import of '@barefootjs/client' (import * as ns) is not recognized; " + "the declaration is dropped and its references throw ReferenceError at hydrate. Import the primitive by name instead.",
169183
169203
  [ErrorCodes.UNSUPPORTED_JSX_PATTERN]: "Unsupported JSX pattern",
169184
169204
  [ErrorCodes.MISSING_KEY_IN_LIST]: "Missing key attribute in list rendering. Add a key prop for efficient updates",
169185
169205
  [ErrorCodes.MISSING_KEY_IN_NESTED_LIST]: "Nested .map() loop requires key attribute for event delegation. Add a key prop to elements in the inner loop",
@@ -169371,46 +169391,46 @@ function extractFreeIdentifiersFromNode(node) {
169371
169391
  const ids = new Set;
169372
169392
  const boundNames = new Set;
169373
169393
  function addBindingNames(name, out) {
169374
- if (import_typescript9.default.isIdentifier(name))
169394
+ if (import_typescript10.default.isIdentifier(name))
169375
169395
  out.push(name.text);
169376
- else if (import_typescript9.default.isObjectBindingPattern(name))
169396
+ else if (import_typescript10.default.isObjectBindingPattern(name))
169377
169397
  name.elements.forEach((e) => addBindingNames(e.name, out));
169378
- else if (import_typescript9.default.isArrayBindingPattern(name))
169398
+ else if (import_typescript10.default.isArrayBindingPattern(name))
169379
169399
  name.elements.forEach((e) => {
169380
- if (!import_typescript9.default.isOmittedExpression(e))
169400
+ if (!import_typescript10.default.isOmittedExpression(e))
169381
169401
  addBindingNames(e.name, out);
169382
169402
  });
169383
169403
  }
169384
169404
  function visit(n) {
169385
- if (import_typescript9.default.isTypeNode(n))
169405
+ if (import_typescript10.default.isTypeNode(n))
169386
169406
  return;
169387
- if (import_typescript9.default.isIdentifier(n)) {
169407
+ if (import_typescript10.default.isIdentifier(n)) {
169388
169408
  const parent = n.parent;
169389
- if (parent && import_typescript9.default.isPropertyAccessExpression(parent) && parent.name === n)
169409
+ if (parent && import_typescript10.default.isPropertyAccessExpression(parent) && parent.name === n)
169390
169410
  return;
169391
- if (parent && import_typescript9.default.isPropertyAssignment(parent) && parent.name === n)
169411
+ if (parent && import_typescript10.default.isPropertyAssignment(parent) && parent.name === n)
169392
169412
  return;
169393
- if (parent && import_typescript9.default.isParameter(parent) && parent.name === n)
169413
+ if (parent && import_typescript10.default.isParameter(parent) && parent.name === n)
169394
169414
  return;
169395
- if (parent && import_typescript9.default.isVariableDeclaration(parent) && parent.name === n)
169415
+ if (parent && import_typescript10.default.isVariableDeclaration(parent) && parent.name === n)
169396
169416
  return;
169397
169417
  if (boundNames.has(n.text))
169398
169418
  return;
169399
169419
  ids.add(n.text);
169400
169420
  return;
169401
169421
  }
169402
- if (import_typescript9.default.isArrowFunction(n)) {
169422
+ if (import_typescript10.default.isArrowFunction(n)) {
169403
169423
  const params = [];
169404
169424
  for (const p of n.parameters)
169405
169425
  addBindingNames(p.name, params);
169406
169426
  for (const name of params)
169407
169427
  boundNames.add(name);
169408
- import_typescript9.default.forEachChild(n, visit);
169428
+ import_typescript10.default.forEachChild(n, visit);
169409
169429
  for (const name of params)
169410
169430
  boundNames.delete(name);
169411
169431
  return;
169412
169432
  }
169413
- import_typescript9.default.forEachChild(n, visit);
169433
+ import_typescript10.default.forEachChild(n, visit);
169414
169434
  }
169415
169435
  visit(node);
169416
169436
  return ids;
@@ -169433,7 +169453,7 @@ var REACTIVE_PRIMITIVES = new Set([
169433
169453
  ]);
169434
169454
 
169435
169455
  // ../jsx/src/jsx-to-ir.ts
169436
- var import_typescript13 = __toESM(require_typescript(), 1);
169456
+ var import_typescript14 = __toESM(require_typescript(), 1);
169437
169457
 
169438
169458
  // ../jsx/src/types.ts
169439
169459
  var SCOPE_FORBIDDEN = {
@@ -169469,7 +169489,7 @@ var REACTIVE_BINDING_KINDS = new Set([
169469
169489
  ]);
169470
169490
 
169471
169491
  // ../jsx/src/module-exports.ts
169472
- var import_typescript10 = __toESM(require_typescript(), 1);
169492
+ var import_typescript11 = __toESM(require_typescript(), 1);
169473
169493
  function formatParamWithType(p) {
169474
169494
  const rest = p.isRest ? "..." : "";
169475
169495
  const optional = p.optional ? "?" : "";
@@ -169504,21 +169524,21 @@ function findAssignedNames(bodyText, candidates) {
169504
169524
  const assigned = new Set;
169505
169525
  if (candidates.size === 0)
169506
169526
  return assigned;
169507
- const sf = import_typescript10.default.createSourceFile("bf-assignment-scan.tsx", bodyText, import_typescript10.default.ScriptTarget.Latest, false, import_typescript10.default.ScriptKind.TSX);
169527
+ const sf = import_typescript11.default.createSourceFile("bf-assignment-scan.tsx", bodyText, import_typescript11.default.ScriptTarget.Latest, false, import_typescript11.default.ScriptKind.TSX);
169508
169528
  const record = (target) => {
169509
- if (import_typescript10.default.isIdentifier(target) && candidates.has(target.text)) {
169529
+ if (import_typescript11.default.isIdentifier(target) && candidates.has(target.text)) {
169510
169530
  assigned.add(target.text);
169511
169531
  }
169512
169532
  };
169513
169533
  const visit = (node) => {
169514
- if (import_typescript10.default.isBinaryExpression(node) && isAssignmentOperator(node.operatorToken.kind)) {
169534
+ if (import_typescript11.default.isBinaryExpression(node) && isAssignmentOperator(node.operatorToken.kind)) {
169515
169535
  record(node.left);
169516
- } else if ((import_typescript10.default.isPrefixUnaryExpression(node) || import_typescript10.default.isPostfixUnaryExpression(node)) && (node.operator === import_typescript10.default.SyntaxKind.PlusPlusToken || node.operator === import_typescript10.default.SyntaxKind.MinusMinusToken)) {
169536
+ } else if ((import_typescript11.default.isPrefixUnaryExpression(node) || import_typescript11.default.isPostfixUnaryExpression(node)) && (node.operator === import_typescript11.default.SyntaxKind.PlusPlusToken || node.operator === import_typescript11.default.SyntaxKind.MinusMinusToken)) {
169517
169537
  record(node.operand);
169518
169538
  }
169519
- import_typescript10.default.forEachChild(node, visit);
169539
+ import_typescript11.default.forEachChild(node, visit);
169520
169540
  };
169521
- import_typescript10.default.forEachChild(sf, visit);
169541
+ import_typescript11.default.forEachChild(sf, visit);
169522
169542
  return assigned;
169523
169543
  }
169524
169544
  function closeOverWritersOfMutableBindings(primaryRefs, declarations, mutableNames) {
@@ -169541,14 +169561,14 @@ function closeOverWritersOfMutableBindings(primaryRefs, declarations, mutableNam
169541
169561
  return reachable;
169542
169562
  }
169543
169563
  function isAssignmentOperator(kind) {
169544
- return kind >= import_typescript10.default.SyntaxKind.FirstAssignment && kind <= import_typescript10.default.SyntaxKind.LastAssignment;
169564
+ return kind >= import_typescript11.default.SyntaxKind.FirstAssignment && kind <= import_typescript11.default.SyntaxKind.LastAssignment;
169545
169565
  }
169546
169566
 
169547
169567
  // ../jsx/src/reactivity-checker.ts
169548
- var import_typescript11 = __toESM(require_typescript(), 1);
169568
+ var import_typescript12 = __toESM(require_typescript(), 1);
169549
169569
 
169550
169570
  // ../jsx/src/free-refs.ts
169551
- var import_typescript12 = __toESM(require_typescript(), 1);
169571
+ var import_typescript13 = __toESM(require_typescript(), 1);
169552
169572
  var _bindingMapCache = new WeakMap;
169553
169573
 
169554
169574
  // ../jsx/src/to-locale-date-lowering.ts
@@ -169996,28 +170016,16 @@ var KEYWORDS_AND_GLOBALS = new Set([
169996
170016
  ]);
169997
170017
 
169998
170018
  // ../jsx/src/ir-to-client-js/walk-prop-accesses.ts
169999
- var import_typescript14 = __toESM(require_typescript(), 1);
170000
-
170001
- // ../jsx/src/ir-to-client-js/imports.ts
170002
- var import_typescript16 = __toESM(require_typescript(), 1);
170003
-
170004
- // ../jsx/src/value-references.ts
170005
170019
  var import_typescript15 = __toESM(require_typescript(), 1);
170006
170020
 
170007
- // ../jsx/src/relocate.ts
170021
+ // ../jsx/src/ir-to-client-js/imports.ts
170008
170022
  var import_typescript17 = __toESM(require_typescript(), 1);
170009
170023
 
170010
- // ../jsx/src/lowering-registry.ts
170011
- var plugins = [];
170012
- function registerLoweringPlugin(plugin) {
170013
- const existing = plugins.findIndex((p) => p.name === plugin.name);
170014
- if (existing >= 0)
170015
- plugins[existing] = plugin;
170016
- else
170017
- plugins.push(plugin);
170018
- }
170024
+ // ../jsx/src/value-references.ts
170025
+ var import_typescript16 = __toESM(require_typescript(), 1);
170019
170026
 
170020
170027
  // ../jsx/src/relocate.ts
170028
+ var import_typescript18 = __toESM(require_typescript(), 1);
170021
170029
  var REGISTRY_SAFE_BINDING_KINDS = new Set([
170022
170030
  "global",
170023
170031
  "module-import",
@@ -170184,10 +170192,10 @@ function formatDateLocalNames(metadata) {
170184
170192
  }
170185
170193
 
170186
170194
  // ../jsx/src/ir-to-client-js/prune-unused-prop-extractions.ts
170187
- var import_typescript18 = __toESM(require_typescript(), 1);
170195
+ var import_typescript19 = __toESM(require_typescript(), 1);
170188
170196
 
170189
170197
  // ../jsx/src/ir-to-client-js/control-flow/plan/lazy-preamble.ts
170190
- var import_typescript19 = __toESM(require_typescript(), 1);
170198
+ var import_typescript20 = __toESM(require_typescript(), 1);
170191
170199
  var NO_PREAMBLE = {
170192
170200
  lazySafe: true,
170193
170201
  facts: { declaredNames: new Set, freeNames: new Set }
@@ -170237,7 +170245,7 @@ var INERT_BINDING_GLOBALS = new Set([
170237
170245
  ]);
170238
170246
 
170239
170247
  // ../jsx/src/ir-to-client-js/emit-reactive.ts
170240
- var import_typescript20 = __toESM(require_typescript(), 1);
170248
+ var import_typescript21 = __toESM(require_typescript(), 1);
170241
170249
 
170242
170250
  // ../jsx/src/ir-to-client-js/control-flow/stringify/event-delegation.ts
170243
170251
  var NON_BUBBLING_EVENTS = new Set([
@@ -170251,9 +170259,6 @@ var NON_BUBBLING_EVENTS = new Set([
170251
170259
  "pointerleave"
170252
170260
  ]);
170253
170261
 
170254
- // ../jsx/src/ir-to-client-js/rewrite-props-object.ts
170255
- var import_typescript21 = __toESM(require_typescript(), 1);
170256
-
170257
170262
  // ../jsx/src/ir-to-client-js/source-map.ts
170258
170263
  var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
170259
170264
  function encodeVLQ(value) {
@@ -6,6 +6,16 @@
6
6
  */
7
7
  import type { ComponentDef } from './types.ts';
8
8
  export declare function setParentScopeId(id: string | null): void;
9
+ /**
10
+ * Run `fn` with `_parentScopeId` temporarily set to `id`, restoring the
11
+ * previous value afterward (even if `fn` throws). A static loop's
12
+ * materialize `forEach` (#2833) runs during `init`, not template
13
+ * evaluation, so `_parentScopeId` is null there — this lets it evaluate the
14
+ * row's template as if it were still inside the parent's own template, so
15
+ * `renderChild` stamps `bf-h` with the same `__scopeId` the static init's
16
+ * `qsaChildScopes` selector interpolates.
17
+ */
18
+ export declare function withParentScope<T>(id: string | null, fn: () => T): T;
9
19
  /**
10
20
  * Where `mapArray` wants a fresh loop row connected before its `init` runs.
11
21
  *
@@ -81,9 +91,13 @@ export interface CreateComponentSlotInfo {
81
91
  mount: string;
82
92
  }
83
93
  /**
84
- * The `HTMLElement | DocumentFragment` return covers exactly one shape: a
94
+ * The `HTMLElement | DocumentFragment` return covers exactly two shapes: a
85
95
  * BARE call (no `mountAt`, no ambient row-mount point) for a genuine
86
- * fragment-root component (#2722). Every other combination a normal
96
+ * fragment-root component (#2722), or for a root-is-a-child-call comment
97
+ * wrapper mounted at the top level (#2728 — same rule: no single element
98
+ * can carry the `<!--bf-scope:-->` boundary comments to an unknown
99
+ * destination, so the caller gets the whole bundle back as a fragment).
100
+ * Every other combination — a normal
87
101
  * component, or a fragment-root one with `mountAt`/row-mount already
88
102
  * telling this function where to connect — still returns the real,
89
103
  * single `HTMLElement`, unchanged (that element stays the caller-visible
@@ -118,9 +132,17 @@ export declare function createComponent(nameOrDef: string | ComponentDef, props?
118
132
  * @param name - Component name (e.g., 'Spinner')
119
133
  * @param props - Props to pass to the template
120
134
  * @param key - Optional key for list reconciliation
135
+ * @param slotSuffix - Slot id in the parent (e.g. 's0') this child was rendered into
136
+ * @param loopItemRoot - True when this child IS a keyed loop's row root
137
+ * (`IRComponent.loopItemRoot`, #2833): it still gets slot identity
138
+ * (`bf-h`/`bf-m`, so a pure-CSR mount's static `qsaChildScopes` init can
139
+ * find it the same way it finds a slotted non-root child) but derives its
140
+ * OWN scope id rather than the parent's — matching Hono, which stamps
141
+ * `__bfParent`/`__bfMount` on a loop item root while still letting an
142
+ * interactive child's own `__scopeId` win over `__bfScope`.
121
143
  * @returns HTML string with scope marker
122
144
  */
123
- export declare function renderChild(name: string, props: Record<string, unknown>, key?: string | number, slotSuffix?: string): string;
145
+ export declare function renderChild(name: string, props: Record<string, unknown>, key?: string | number, slotSuffix?: string, loopItemRoot?: boolean): string;
124
146
  /**
125
147
  * Escape ">" inside HTML attribute values to prevent broken parsing.
126
148
  * UnoCSS classes like has-[>svg]:shrink-0 contain ">" which terminates
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/runtime/component.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAS9C,wBAAgB,gBAAgB,C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G;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAGzD;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEpD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAI9D;AAaD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,GAAG,gBAAgB,CAejF"}
@@ -15,7 +15,7 @@ export { mapArrayLazy, type LazyRowEntry, type LazyRowPlan } from './map-array-l
15
15
  export { patchLeaf } from './patch-leaf.ts';
16
16
  export { claimSlots, lazySlots, lazyClaimSlots, textOrNode, type SlotSpec, type ClaimPlan, type ClaimedSlots, type ClaimedSlotsRW, type SlotWriter } from './claim-slots.ts';
17
17
  export { registerTemplate, getTemplate, hasTemplate, type TemplateFn } from './template.ts';
18
- export { createComponent, mountRowRoot, renderChild, parseHTML, escapeAttr, escapeText, escapeTextOrNode, bfMarkup, isBfMarkup, escapeTextOrMarkup, markupOrEmpty, type BfMarkup, } from './component.ts';
18
+ export { createComponent, mountRowRoot, renderChild, withParentScope, parseHTML, escapeAttr, escapeText, escapeTextOrNode, bfMarkup, isBfMarkup, escapeTextOrMarkup, markupOrEmpty, type BfMarkup, } from './component.ts';
19
19
  export { applyRestAttrs } from './apply-rest-attrs.ts';
20
20
  export { spreadAttrs } from './spread-attrs.ts';
21
21
  export { styleToCss } from './style.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,UAAU,EACV,cAAc,EACd,UAAU,EACV,SAAS,EACT,OAA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,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAC9G,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACpH,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3F,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,YAAY,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACrG,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAQ3C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAG5C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAGrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGpC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAG1D,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA"}
@@ -1349,6 +1349,15 @@ var _parentScopeId = null;
1349
1349
  function setParentScopeId(id) {
1350
1350
  _parentScopeId = id;
1351
1351
  }
1352
+ function withParentScope(id, fn) {
1353
+ const prev = _parentScopeId;
1354
+ _parentScopeId = id;
1355
+ try {
1356
+ return fn();
1357
+ } finally {
1358
+ _parentScopeId = prev;
1359
+ }
1360
+ }
1352
1361
  var _rowMountPoint = null;
1353
1362
  function setRowMountPoint(p) {
1354
1363
  const prev = _rowMountPoint;
@@ -1415,12 +1424,14 @@ function materializeComponent(nameOrDef, props = {}, key, slot, mountAt, keyAttr
1415
1424
  const derivedScopeId = slot?.parent && slot.mount ? `${slot.parent}_${slot.mount}` : null;
1416
1425
  const scopeId = isCommentWrapper && !isFragmentRoot ? null : derivedScopeId ?? `${def?.name ?? name}_${generateId()}`;
1417
1426
  const prevParentScopeId = _parentScopeId;
1427
+ let wrapperScopeId = null;
1418
1428
  if (scopeId) {
1419
1429
  _parentScopeId = scopeId;
1420
1430
  } else if (slot?.parent) {
1421
1431
  _parentScopeId = slot.parent;
1422
1432
  } else if (!_parentScopeId) {
1423
- _parentScopeId = `${def?.name ?? name}_${generateId()}`;
1433
+ wrapperScopeId = `${def?.name ?? name}_${generateId()}`;
1434
+ _parentScopeId = wrapperScopeId;
1424
1435
  }
1425
1436
  let html;
1426
1437
  try {
@@ -1450,12 +1461,13 @@ function materializeComponent(nameOrDef, props = {}, key, slot, mountAt, keyAttr
1450
1461
  if (key !== undefined) {
1451
1462
  element.setAttribute(keyAttrName2, String(key));
1452
1463
  }
1453
- const fragmentComments = isFragmentRoot && scopeId ? {
1454
- start: document.createComment(`${BF_SCOPE_COMMENT_PREFIX}${scopeId}`),
1455
- end: document.createComment(`${BF_SCOPE_COMMENT_END_PREFIX}${scopeId}`)
1464
+ const commentScopeId = isFragmentRoot ? scopeId : isCommentWrapper ? wrapperScopeId : null;
1465
+ const fragmentComments = commentScopeId ? {
1466
+ start: document.createComment(`${BF_SCOPE_COMMENT_PREFIX}${commentScopeId}`),
1467
+ end: document.createComment(`${BF_SCOPE_COMMENT_END_PREFIX}${commentScopeId}`)
1456
1468
  } : null;
1457
1469
  if (fragmentComments) {
1458
- commentScopeRegistry.set(element, { commentNode: fragmentComments.start, scopeId });
1470
+ commentScopeRegistry.set(element, { commentNode: fragmentComments.start, scopeId: commentScopeId });
1459
1471
  }
1460
1472
  const rootIsDeferredPlaceholder = element.hasAttribute(BF_PLACEHOLDER);
1461
1473
  let bareFragment = null;
@@ -1518,16 +1530,18 @@ function spliceAttrsAfterFirstTag(html, attrs) {
1518
1530
  const insertPos = firstElMatch.index;
1519
1531
  return html.slice(0, insertPos) + html.slice(insertPos).replace(TAG_HEAD_PATTERN, `$1${attrs}`);
1520
1532
  }
1521
- function renderChild(name, props, key, slotSuffix) {
1533
+ function renderChild(name, props, key, slotSuffix, loopItemRoot) {
1522
1534
  const templateFn = getTemplate(name);
1523
- const suffix = slotSuffix ? `_${slotSuffix}` : "";
1524
1535
  const def = getRegisteredDef(name);
1525
1536
  const displayName = def?.name ?? name;
1526
1537
  const isFragmentRoot = def?.fragmentRoot === true;
1527
- const scopePrefix = _parentScopeId && slotSuffix ? _parentScopeId : `${displayName}_${generateId()}`;
1538
+ const hasSlot = !!(_parentScopeId && slotSuffix);
1539
+ const derivesFromParent = hasSlot && !loopItemRoot;
1540
+ const suffix = slotSuffix && !loopItemRoot ? `_${slotSuffix}` : "";
1541
+ const scopePrefix = derivesFromParent ? _parentScopeId : `${displayName}_${generateId()}`;
1528
1542
  const scopeId = `${scopePrefix}${suffix}`;
1529
1543
  const keyAttr = key !== undefined ? ` ${BF_KEY}="${key}"` : "";
1530
- const slotAttrs = _parentScopeId && slotSuffix ? ` ${BF_HOST}="${_parentScopeId}" ${BF_AT}="${slotSuffix}"` : "";
1544
+ const slotAttrs = hasSlot ? ` ${BF_HOST}="${_parentScopeId}" ${BF_AT}="${slotSuffix}"` : "";
1531
1545
  const bfsAttr = `${BF_SCOPE}="${scopeId}"`;
1532
1546
  if (!templateFn) {
1533
1547
  return isFragmentRoot ? `<!--${BF_SCOPE_COMMENT_PREFIX}${scopeId}--><div></div><!--${BF_SCOPE_COMMENT_END_PREFIX}${scopeId}-->` : `<div ${bfsAttr}${slotAttrs}${keyAttr}></div>`;
@@ -1542,7 +1556,7 @@ function renderChild(name, props, key, slotSuffix) {
1542
1556
  }
1543
1557
  let html = raw.trim().replace(PLACEHOLDER_ATTR_PATTERN, _parentScopeId ? ` bf-s="${_parentScopeId}"` : "");
1544
1558
  if (isFragmentRoot) {
1545
- const hostSuffix = _parentScopeId && slotSuffix ? `|h=${_parentScopeId}|m=${slotSuffix}` : "";
1559
+ const hostSuffix = hasSlot ? `|h=${_parentScopeId}|m=${slotSuffix}` : "";
1546
1560
  const keyedHtml = keyAttr ? spliceAttrsAfterFirstTag(html, keyAttr) : html;
1547
1561
  return `<!--${BF_SCOPE_COMMENT_PREFIX}${scopeId}${hostSuffix}-->${keyedHtml}<!--${BF_SCOPE_COMMENT_END_PREFIX}${scopeId}-->`;
1548
1562
  }
@@ -3382,6 +3396,7 @@ function setupStreaming() {
3382
3396
  w[BF_SEAM_DISPOSE_WITHIN] = disposeScope;
3383
3397
  }
3384
3398
  export {
3399
+ withParentScope,
3385
3400
  useContext,
3386
3401
  upsertChildItem,
3387
3402
  upsertChild,
@@ -1755,6 +1755,15 @@ var _parentScopeId = null;
1755
1755
  function setParentScopeId(id) {
1756
1756
  _parentScopeId = id;
1757
1757
  }
1758
+ function withParentScope(id, fn) {
1759
+ const prev = _parentScopeId;
1760
+ _parentScopeId = id;
1761
+ try {
1762
+ return fn();
1763
+ } finally {
1764
+ _parentScopeId = prev;
1765
+ }
1766
+ }
1758
1767
  var _rowMountPoint = null;
1759
1768
  function setRowMountPoint(p) {
1760
1769
  const prev = _rowMountPoint;
@@ -1821,12 +1830,14 @@ function materializeComponent(nameOrDef, props = {}, key, slot, mountAt, keyAttr
1821
1830
  const derivedScopeId = slot?.parent && slot.mount ? `${slot.parent}_${slot.mount}` : null;
1822
1831
  const scopeId = isCommentWrapper && !isFragmentRoot ? null : derivedScopeId ?? `${def?.name ?? name}_${generateId()}`;
1823
1832
  const prevParentScopeId = _parentScopeId;
1833
+ let wrapperScopeId = null;
1824
1834
  if (scopeId) {
1825
1835
  _parentScopeId = scopeId;
1826
1836
  } else if (slot?.parent) {
1827
1837
  _parentScopeId = slot.parent;
1828
1838
  } else if (!_parentScopeId) {
1829
- _parentScopeId = `${def?.name ?? name}_${generateId()}`;
1839
+ wrapperScopeId = `${def?.name ?? name}_${generateId()}`;
1840
+ _parentScopeId = wrapperScopeId;
1830
1841
  }
1831
1842
  let html;
1832
1843
  try {
@@ -1856,12 +1867,13 @@ function materializeComponent(nameOrDef, props = {}, key, slot, mountAt, keyAttr
1856
1867
  if (key !== undefined) {
1857
1868
  element.setAttribute(keyAttrName2, String(key));
1858
1869
  }
1859
- const fragmentComments = isFragmentRoot && scopeId ? {
1860
- start: document.createComment(`${BF_SCOPE_COMMENT_PREFIX}${scopeId}`),
1861
- end: document.createComment(`${BF_SCOPE_COMMENT_END_PREFIX}${scopeId}`)
1870
+ const commentScopeId = isFragmentRoot ? scopeId : isCommentWrapper ? wrapperScopeId : null;
1871
+ const fragmentComments = commentScopeId ? {
1872
+ start: document.createComment(`${BF_SCOPE_COMMENT_PREFIX}${commentScopeId}`),
1873
+ end: document.createComment(`${BF_SCOPE_COMMENT_END_PREFIX}${commentScopeId}`)
1862
1874
  } : null;
1863
1875
  if (fragmentComments) {
1864
- commentScopeRegistry.set(element, { commentNode: fragmentComments.start, scopeId });
1876
+ commentScopeRegistry.set(element, { commentNode: fragmentComments.start, scopeId: commentScopeId });
1865
1877
  }
1866
1878
  const rootIsDeferredPlaceholder = element.hasAttribute(BF_PLACEHOLDER);
1867
1879
  let bareFragment = null;
@@ -1924,16 +1936,18 @@ function spliceAttrsAfterFirstTag(html, attrs) {
1924
1936
  const insertPos = firstElMatch.index;
1925
1937
  return html.slice(0, insertPos) + html.slice(insertPos).replace(TAG_HEAD_PATTERN, `$1${attrs}`);
1926
1938
  }
1927
- function renderChild(name, props, key, slotSuffix) {
1939
+ function renderChild(name, props, key, slotSuffix, loopItemRoot) {
1928
1940
  const templateFn = getTemplate(name);
1929
- const suffix = slotSuffix ? `_${slotSuffix}` : "";
1930
1941
  const def = getRegisteredDef(name);
1931
1942
  const displayName = def?.name ?? name;
1932
1943
  const isFragmentRoot = def?.fragmentRoot === true;
1933
- const scopePrefix = _parentScopeId && slotSuffix ? _parentScopeId : `${displayName}_${generateId()}`;
1944
+ const hasSlot = !!(_parentScopeId && slotSuffix);
1945
+ const derivesFromParent = hasSlot && !loopItemRoot;
1946
+ const suffix = slotSuffix && !loopItemRoot ? `_${slotSuffix}` : "";
1947
+ const scopePrefix = derivesFromParent ? _parentScopeId : `${displayName}_${generateId()}`;
1934
1948
  const scopeId = `${scopePrefix}${suffix}`;
1935
1949
  const keyAttr = key !== undefined ? ` ${BF_KEY}="${key}"` : "";
1936
- const slotAttrs = _parentScopeId && slotSuffix ? ` ${BF_HOST}="${_parentScopeId}" ${BF_AT}="${slotSuffix}"` : "";
1950
+ const slotAttrs = hasSlot ? ` ${BF_HOST}="${_parentScopeId}" ${BF_AT}="${slotSuffix}"` : "";
1937
1951
  const bfsAttr = `${BF_SCOPE}="${scopeId}"`;
1938
1952
  if (!templateFn) {
1939
1953
  return isFragmentRoot ? `<!--${BF_SCOPE_COMMENT_PREFIX}${scopeId}--><div></div><!--${BF_SCOPE_COMMENT_END_PREFIX}${scopeId}-->` : `<div ${bfsAttr}${slotAttrs}${keyAttr}></div>`;
@@ -1948,7 +1962,7 @@ function renderChild(name, props, key, slotSuffix) {
1948
1962
  }
1949
1963
  let html = raw.trim().replace(PLACEHOLDER_ATTR_PATTERN, _parentScopeId ? ` bf-s="${_parentScopeId}"` : "");
1950
1964
  if (isFragmentRoot) {
1951
- const hostSuffix = _parentScopeId && slotSuffix ? `|h=${_parentScopeId}|m=${slotSuffix}` : "";
1965
+ const hostSuffix = hasSlot ? `|h=${_parentScopeId}|m=${slotSuffix}` : "";
1952
1966
  const keyedHtml = keyAttr ? spliceAttrsAfterFirstTag(html, keyAttr) : html;
1953
1967
  return `<!--${BF_SCOPE_COMMENT_PREFIX}${scopeId}${hostSuffix}-->${keyedHtml}<!--${BF_SCOPE_COMMENT_END_PREFIX}${scopeId}-->`;
1954
1968
  }
@@ -3781,6 +3795,7 @@ function setupStreaming() {
3781
3795
  w[BF_SEAM_DISPOSE_WITHIN] = disposeScope;
3782
3796
  }
3783
3797
  export {
3798
+ withParentScope,
3784
3799
  useContext,
3785
3800
  upsertChildItem,
3786
3801
  upsertChild,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barefootjs/client",
3
- "version": "0.33.4",
3
+ "version": "0.34.0",
4
4
  "description": "BarefootJS client package: reactive primitives (SSR-safe) plus browser runtime under the `/runtime` subpath (compiler target)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -55,7 +55,7 @@
55
55
  "directory": "packages/client"
56
56
  },
57
57
  "dependencies": {
58
- "@barefootjs/shared": "0.33.4"
58
+ "@barefootjs/shared": "0.34.0"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@barefootjs/jsx": ">=0.2.0"
@@ -35,6 +35,25 @@ export function setParentScopeId(id: string | null): void {
35
35
  _parentScopeId = id
36
36
  }
37
37
 
38
+ /**
39
+ * Run `fn` with `_parentScopeId` temporarily set to `id`, restoring the
40
+ * previous value afterward (even if `fn` throws). A static loop's
41
+ * materialize `forEach` (#2833) runs during `init`, not template
42
+ * evaluation, so `_parentScopeId` is null there — this lets it evaluate the
43
+ * row's template as if it were still inside the parent's own template, so
44
+ * `renderChild` stamps `bf-h` with the same `__scopeId` the static init's
45
+ * `qsaChildScopes` selector interpolates.
46
+ */
47
+ export function withParentScope<T>(id: string | null, fn: () => T): T {
48
+ const prev = _parentScopeId
49
+ _parentScopeId = id
50
+ try {
51
+ return fn()
52
+ } finally {
53
+ _parentScopeId = prev
54
+ }
55
+ }
56
+
38
57
  /**
39
58
  * Where `mapArray` wants a fresh loop row connected before its `init` runs.
40
59
  *
@@ -148,9 +167,13 @@ export interface CreateComponentSlotInfo {
148
167
  }
149
168
 
150
169
  /**
151
- * The `HTMLElement | DocumentFragment` return covers exactly one shape: a
170
+ * The `HTMLElement | DocumentFragment` return covers exactly two shapes: a
152
171
  * BARE call (no `mountAt`, no ambient row-mount point) for a genuine
153
- * fragment-root component (#2722). Every other combination a normal
172
+ * fragment-root component (#2722), or for a root-is-a-child-call comment
173
+ * wrapper mounted at the top level (#2728 — same rule: no single element
174
+ * can carry the `<!--bf-scope:-->` boundary comments to an unknown
175
+ * destination, so the caller gets the whole bundle back as a fragment).
176
+ * Every other combination — a normal
154
177
  * component, or a fragment-root one with `mountAt`/row-mount already
155
178
  * telling this function where to connect — still returns the real,
156
179
  * single `HTMLElement`, unchanged (that element stays the caller-visible
@@ -351,13 +374,18 @@ function materializeComponent(
351
374
  // wrapper materialized while an OUTER template eval is in flight keeps
352
375
  // inheriting that caller's ambient scope rather than being renamed under a
353
376
  // fresh random id. Only the genuinely-rootless mount is affected.
377
+ // #2728: also capture this derived id as `wrapperScopeId`, not just in
378
+ // `_parentScopeId` — step 7a needs it AFTER the template-eval `finally`
379
+ // block below restores `_parentScopeId` to its previous value.
354
380
  const prevParentScopeId = _parentScopeId
381
+ let wrapperScopeId: string | null = null
355
382
  if (scopeId) {
356
383
  _parentScopeId = scopeId
357
384
  } else if (slot?.parent) {
358
385
  _parentScopeId = slot.parent
359
386
  } else if (!_parentScopeId) {
360
- _parentScopeId = `${def?.name ?? name}_${generateId()}`
387
+ wrapperScopeId = `${def?.name ?? name}_${generateId()}`
388
+ _parentScopeId = wrapperScopeId
361
389
  }
362
390
  let html: string
363
391
  try {
@@ -447,14 +475,19 @@ function materializeComponent(
447
475
  // are built now and threaded through to wherever `element` ends up
448
476
  // connected below, exactly mirroring the SSR/hydrate shape:
449
477
  // <!--bf-scope:ID-->` + element + `<!--bf-/scope:ID-->`
450
- const fragmentComments = isFragmentRoot && scopeId
478
+ //
479
+ // A root-is-a-child-call wrapper (#2728) gets the same treatment under
480
+ // its own `wrapperScopeId`, captured separately since `_parentScopeId`
481
+ // is already restored by the `finally` block above by the time this runs.
482
+ const commentScopeId = isFragmentRoot ? scopeId : (isCommentWrapper ? wrapperScopeId : null)
483
+ const fragmentComments = commentScopeId
451
484
  ? {
452
- start: document.createComment(`${BF_SCOPE_COMMENT_PREFIX}${scopeId}`),
453
- end: document.createComment(`${BF_SCOPE_COMMENT_END_PREFIX}${scopeId}`),
485
+ start: document.createComment(`${BF_SCOPE_COMMENT_PREFIX}${commentScopeId}`),
486
+ end: document.createComment(`${BF_SCOPE_COMMENT_END_PREFIX}${commentScopeId}`),
454
487
  }
455
488
  : null
456
489
  if (fragmentComments) {
457
- commentScopeRegistry.set(element, { commentNode: fragmentComments.start, scopeId: scopeId! })
490
+ commentScopeRegistry.set(element, { commentNode: fragmentComments.start, scopeId: commentScopeId! })
458
491
  }
459
492
 
460
493
  // 7b. Connect before init.
@@ -654,16 +687,24 @@ function spliceAttrsAfterFirstTag(html: string, attrs: string): string {
654
687
  * @param name - Component name (e.g., 'Spinner')
655
688
  * @param props - Props to pass to the template
656
689
  * @param key - Optional key for list reconciliation
690
+ * @param slotSuffix - Slot id in the parent (e.g. 's0') this child was rendered into
691
+ * @param loopItemRoot - True when this child IS a keyed loop's row root
692
+ * (`IRComponent.loopItemRoot`, #2833): it still gets slot identity
693
+ * (`bf-h`/`bf-m`, so a pure-CSR mount's static `qsaChildScopes` init can
694
+ * find it the same way it finds a slotted non-root child) but derives its
695
+ * OWN scope id rather than the parent's — matching Hono, which stamps
696
+ * `__bfParent`/`__bfMount` on a loop item root while still letting an
697
+ * interactive child's own `__scopeId` win over `__bfScope`.
657
698
  * @returns HTML string with scope marker
658
699
  */
659
700
  export function renderChild(
660
701
  name: string,
661
702
  props: Record<string, unknown>,
662
703
  key?: string | number,
663
- slotSuffix?: string
704
+ slotSuffix?: string,
705
+ loopItemRoot?: boolean
664
706
  ): string {
665
707
  const templateFn = getTemplate(name)
666
- const suffix = slotSuffix ? `_${slotSuffix}` : ''
667
708
  // When inside an insert() branch template with a known parent scope,
668
709
  // use the parent scope ID so child scope IDs match the SSR convention
669
710
  // (e.g., ~ParentName_parentHash_s5 instead of ~Button_randomHash_s5).
@@ -687,14 +728,24 @@ export function renderChild(
687
728
  // `materializeComponent`'s equivalent fix) kept stamping `bf-s` onto an
688
729
  // element the SSR/hydrate reference never puts one on.
689
730
  const isFragmentRoot = def?.fragmentRoot === true
690
- const scopePrefix = (_parentScopeId && slotSuffix)
731
+ // Slot identity (bf-h/bf-m) and scope id (bf-s) are separate questions
732
+ // (#2833): a loop item root has slot identity — `hasSlot` — but, unlike an
733
+ // ordinary slotted child, does not DERIVE its scope id from the parent, so
734
+ // it gets no `_<slotSuffix>` suffix either (Hono's row root is
735
+ // `Name_<random>`, not `Name_<random>_s0`).
736
+ const hasSlot = !!(_parentScopeId && slotSuffix)
737
+ const derivesFromParent = hasSlot && !loopItemRoot
738
+ const suffix = (slotSuffix && !loopItemRoot) ? `_${slotSuffix}` : ''
739
+ const scopePrefix = derivesFromParent
691
740
  ? _parentScopeId
692
741
  : `${displayName}_${generateId()}`
693
742
  const scopeId = `${scopePrefix}${suffix}`
694
743
  const keyAttr = key !== undefined ? ` ${BF_KEY}="${key}"` : ''
695
744
  // Slot-relationship markers — only emitted when both host and slot are
696
- // known; top-level renders without parent context omit them.
697
- const slotAttrs = (_parentScopeId && slotSuffix)
745
+ // known; top-level renders without parent context omit them. Stamped
746
+ // regardless of `loopItemRoot`: a loop item root keeps slot identity even
747
+ // though it doesn't derive its scope id from it (see `hasSlot` above).
748
+ const slotAttrs = hasSlot
698
749
  ? ` ${BF_HOST}="${_parentScopeId}" ${BF_AT}="${slotSuffix}"`
699
750
  : ''
700
751
  const bfsAttr = `${BF_SCOPE}="${scopeId}"`
@@ -744,7 +795,7 @@ export function renderChild(
744
795
  // `wrapWithScopeComment`'s CSR mirror, same as `materializeComponent`'s
745
796
  // fix for a top-level mount.
746
797
  if (isFragmentRoot) {
747
- const hostSuffix = (_parentScopeId && slotSuffix) ? `|h=${_parentScopeId}|m=${slotSuffix}` : ''
798
+ const hostSuffix = hasSlot ? `|h=${_parentScopeId}|m=${slotSuffix}` : ''
748
799
  // #2732: `data-key` for a fragment-root loop row lands on the row's own
749
800
  // first element — the same "first element, not first node" convention
750
801
  // `IRElement.keyAttr` uses on the SSR side (jsx-to-ir.ts) — not on the
@@ -101,6 +101,7 @@ export {
101
101
  createComponent,
102
102
  mountRowRoot,
103
103
  renderChild,
104
+ withParentScope,
104
105
  parseHTML,
105
106
  escapeAttr,
106
107
  escapeText,