@barefootjs/jsx 0.39.2 → 0.39.4

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.
Files changed (98) hide show
  1. package/dist/adapters/boolean-result.d.ts +32 -0
  2. package/dist/adapters/boolean-result.d.ts.map +1 -0
  3. package/dist/adapters/line-statement-text.d.ts +17 -0
  4. package/dist/adapters/line-statement-text.d.ts.map +1 -0
  5. package/dist/analyzer.d.ts +1 -0
  6. package/dist/analyzer.d.ts.map +1 -1
  7. package/dist/augment-inherited-props.d.ts +20 -0
  8. package/dist/augment-inherited-props.d.ts.map +1 -1
  9. package/dist/errors.d.ts +1 -0
  10. package/dist/errors.d.ts.map +1 -1
  11. package/dist/html-types.d.ts +15 -0
  12. package/dist/html-types.d.ts.map +1 -1
  13. package/dist/index.d.ts +6 -2
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +595 -140
  16. package/dist/ir-to-client-js/collect-elements.d.ts.map +1 -1
  17. package/dist/ir-to-client-js/control-flow/plan/build-composite-loop.d.ts.map +1 -1
  18. package/dist/ir-to-client-js/control-flow/plan/build-event-delegation.d.ts.map +1 -1
  19. package/dist/ir-to-client-js/control-flow/plan/build-inner-loop.d.ts +5 -0
  20. package/dist/ir-to-client-js/control-flow/plan/build-inner-loop.d.ts.map +1 -1
  21. package/dist/ir-to-client-js/control-flow/plan/event-delegation.d.ts +7 -0
  22. package/dist/ir-to-client-js/control-flow/plan/event-delegation.d.ts.map +1 -1
  23. package/dist/ir-to-client-js/control-flow/plan/insert.d.ts +2 -0
  24. package/dist/ir-to-client-js/control-flow/plan/insert.d.ts.map +1 -1
  25. package/dist/ir-to-client-js/control-flow/plan/loop.d.ts +2 -0
  26. package/dist/ir-to-client-js/control-flow/plan/loop.d.ts.map +1 -1
  27. package/dist/ir-to-client-js/control-flow/shared.d.ts.map +1 -1
  28. package/dist/ir-to-client-js/control-flow/stringify/composite-loop.d.ts.map +1 -1
  29. package/dist/ir-to-client-js/control-flow/stringify/event-delegation.d.ts.map +1 -1
  30. package/dist/ir-to-client-js/control-flow/stringify/loop.d.ts +14 -0
  31. package/dist/ir-to-client-js/control-flow/stringify/loop.d.ts.map +1 -1
  32. package/dist/ir-to-client-js/html-template.d.ts.map +1 -1
  33. package/dist/ir-to-client-js/imports.d.ts +2 -2
  34. package/dist/ir-to-client-js/imports.d.ts.map +1 -1
  35. package/dist/ir-to-client-js/phases/rest-attr-applications.d.ts +3 -1
  36. package/dist/ir-to-client-js/phases/rest-attr-applications.d.ts.map +1 -1
  37. package/dist/ir-to-client-js/reactivity.d.ts.map +1 -1
  38. package/dist/ir-to-client-js/safe-html.d.ts +6 -0
  39. package/dist/ir-to-client-js/safe-html.d.ts.map +1 -1
  40. package/dist/ir-to-client-js/types.d.ts +12 -0
  41. package/dist/ir-to-client-js/types.d.ts.map +1 -1
  42. package/dist/ir-to-client-js/utils.d.ts.map +1 -1
  43. package/dist/nullable-signal-attr.d.ts +94 -0
  44. package/dist/nullable-signal-attr.d.ts.map +1 -0
  45. package/dist/profiler.d.ts +9 -1
  46. package/dist/profiler.d.ts.map +1 -1
  47. package/dist/scope/root-prop-alias.d.ts +43 -0
  48. package/dist/scope/root-prop-alias.d.ts.map +1 -0
  49. package/package.json +2 -2
  50. package/src/__tests__/__snapshots__/doc-examples.test.ts.snap +3 -3
  51. package/src/__tests__/attribute-fallback-wrap.test.ts +24 -0
  52. package/src/__tests__/boolean-result.test.ts +27 -0
  53. package/src/__tests__/compiler-stress-1244.test.ts +10 -13
  54. package/src/__tests__/conditional-fallback-wrap.test.ts +20 -0
  55. package/src/__tests__/csr-template-loop-shadow.test.ts +83 -0
  56. package/src/__tests__/html-event-handler-names.test.ts +107 -0
  57. package/src/__tests__/line-statement-text.test.ts +25 -0
  58. package/src/__tests__/lookup-literal-const.test.ts +46 -0
  59. package/src/__tests__/loop-param-accessor-key-member-safety.test.ts +66 -19
  60. package/src/__tests__/nullable-signal-attr.test.ts +124 -0
  61. package/src/__tests__/profile-binding-ids.test.ts +102 -0
  62. package/src/__tests__/profile-turn-markers.test.ts +22 -0
  63. package/src/__tests__/profiler.test.ts +10 -9
  64. package/src/__tests__/root-prop-alias.test.ts +62 -0
  65. package/src/__tests__/ssr-portal-ref-callback.test.ts +88 -13
  66. package/src/adapters/boolean-result.ts +89 -0
  67. package/src/adapters/line-statement-text.ts +24 -0
  68. package/src/analyzer.ts +50 -26
  69. package/src/augment-inherited-props.ts +49 -0
  70. package/src/errors.ts +11 -0
  71. package/src/html-types.ts +15 -0
  72. package/src/index.ts +16 -2
  73. package/src/ir-to-client-js/collect-elements.ts +18 -4
  74. package/src/ir-to-client-js/control-flow/plan/build-component-loop.ts +2 -2
  75. package/src/ir-to-client-js/control-flow/plan/build-composite-loop.ts +2 -0
  76. package/src/ir-to-client-js/control-flow/plan/build-event-delegation.ts +13 -0
  77. package/src/ir-to-client-js/control-flow/plan/build-inner-loop.ts +7 -2
  78. package/src/ir-to-client-js/control-flow/plan/event-delegation.ts +7 -0
  79. package/src/ir-to-client-js/control-flow/plan/insert.ts +2 -0
  80. package/src/ir-to-client-js/control-flow/plan/loop.ts +2 -0
  81. package/src/ir-to-client-js/control-flow/shared.ts +2 -0
  82. package/src/ir-to-client-js/control-flow/stringify/branch-loop.ts +6 -3
  83. package/src/ir-to-client-js/control-flow/stringify/composite-loop.ts +7 -4
  84. package/src/ir-to-client-js/control-flow/stringify/event-delegation.ts +21 -6
  85. package/src/ir-to-client-js/control-flow/stringify/insert.ts +6 -1
  86. package/src/ir-to-client-js/control-flow/stringify/loop.ts +55 -8
  87. package/src/ir-to-client-js/html-template.ts +59 -8
  88. package/src/ir-to-client-js/imports.ts +3 -1
  89. package/src/ir-to-client-js/phases/rest-attr-applications.ts +8 -2
  90. package/src/ir-to-client-js/reactivity.ts +1 -0
  91. package/src/ir-to-client-js/safe-html.ts +10 -0
  92. package/src/ir-to-client-js/stringify/declaration-emit.ts +5 -5
  93. package/src/ir-to-client-js/types.ts +12 -0
  94. package/src/ir-to-client-js/utils.ts +88 -117
  95. package/src/jsx-to-ir.ts +145 -32
  96. package/src/nullable-signal-attr.ts +202 -0
  97. package/src/profiler.ts +79 -10
  98. package/src/scope/root-prop-alias.ts +81 -0
package/src/analyzer.ts CHANGED
@@ -1484,19 +1484,10 @@ function collectSignal(node: ts.VariableDeclaration, ctx: AnalyzerContext): void
1484
1484
  : null
1485
1485
  if (getterElided && !setter) return
1486
1486
  const getter = getterElided ? `__bfGet_${setter}` : (elements[0] as ts.BindingElement & { name: ts.Identifier }).name.text
1487
- const initialValue = callExpr.arguments[0] ? ctx.getJS(callExpr.arguments[0]) : ''
1487
+ const initialValue = signalInitialValueText(callExpr, ctx)
1488
1488
  const typedInitialValue = callExpr.arguments[0] ? callExpr.arguments[0].getText(ctx.sourceFile) : undefined
1489
1489
 
1490
- // Try to infer type from initial value or type argument
1491
- let type: TypeInfo = { kind: 'unknown', raw: 'unknown' }
1492
-
1493
- // Check for type argument: createSignal<number>(0)
1494
- if (callExpr.typeArguments && callExpr.typeArguments.length > 0) {
1495
- type = typeNodeToTypeInfo(callExpr.typeArguments[0], ctx.sourceFile) ?? type
1496
- } else {
1497
- // Infer from initial value
1498
- type = inferTypeFromValue(initialValue)
1499
- }
1490
+ const type = signalTypeInfo(callExpr, initialValue, ctx)
1500
1491
 
1501
1492
  const envReader = resolveEnvSignalKey(callExpr, ctx) ?? undefined
1502
1493
  // The factory as written (identifier, alias, or `ns.factory`), so emit re-emits
@@ -1730,6 +1721,44 @@ function isSignalIndexAccess(
1730
1721
  return null
1731
1722
  }
1732
1723
 
1724
+ /**
1725
+ * A `createSignal` call's initial value as JS text. A call with no argument
1726
+ * starts the signal as `undefined` (what the runtime does with a missing
1727
+ * argument), so it is recorded as `'undefined'` rather than `''` — every
1728
+ * consumer that splices the initial value into an expression (the SSR
1729
+ * getter, the CSR template, the client-JS call) would otherwise emit an
1730
+ * empty operand (#3215). `createQuery`'s factory path records the same.
1731
+ */
1732
+ function signalInitialValueText(callExpr: ts.CallExpression, ctx: AnalyzerContext): string {
1733
+ return callExpr.arguments[0] ? ctx.getJS(callExpr.arguments[0]) : 'undefined'
1734
+ }
1735
+
1736
+ /**
1737
+ * A `createSignal` call's value type: its type argument, else inferred from
1738
+ * the initial value. A zero-arg call with a type argument is `T | undefined`
1739
+ * (the zero-arg overload's return type), not `T` — a typed backend would
1740
+ * otherwise seed the type's zero value (`0`, `""`) where the signal holds
1741
+ * `undefined` (#3215).
1742
+ */
1743
+ function signalTypeInfo(callExpr: ts.CallExpression, initialValue: string, ctx: AnalyzerContext): TypeInfo {
1744
+ const typeArg = callExpr.typeArguments?.[0]
1745
+ if (!typeArg) return inferTypeFromValue(initialValue)
1746
+ const type = typeNodeToTypeInfo(typeArg, ctx.sourceFile) ?? { kind: 'unknown', raw: 'unknown' }
1747
+ return callExpr.arguments[0] ? type : withUndefined(type)
1748
+ }
1749
+
1750
+ /** `T | undefined`, flattening a union `T` and leaving one that already admits `undefined` as is. */
1751
+ function withUndefined(type: TypeInfo): TypeInfo {
1752
+ const members = type.kind === 'union' && type.unionTypes ? type.unionTypes : [type]
1753
+ if (members.some(t => t.kind === 'primitive' && t.primitive === 'undefined')) return type
1754
+ if (type.kind === 'unknown') return type
1755
+ return {
1756
+ kind: 'union',
1757
+ raw: `${type.raw} | undefined`,
1758
+ unionTypes: [...members, { kind: 'primitive', raw: 'undefined', primitive: 'undefined' }],
1759
+ }
1760
+ }
1761
+
1733
1762
  function collectSignalTupleRef(
1734
1763
  node: ts.VariableDeclaration,
1735
1764
  ctx: AnalyzerContext
@@ -1737,17 +1766,12 @@ function collectSignalTupleRef(
1737
1766
  const name = (node.name as ts.Identifier).text
1738
1767
  const callExpr = node.initializer as ts.CallExpression
1739
1768
 
1740
- const initialValue = callExpr.arguments[0] ? ctx.getJS(callExpr.arguments[0]) : ''
1769
+ const initialValue = signalInitialValueText(callExpr, ctx)
1741
1770
  const typedInitialValue = callExpr.arguments[0]
1742
1771
  ? callExpr.arguments[0].getText(ctx.sourceFile)
1743
1772
  : undefined
1744
1773
 
1745
- let type: TypeInfo = { kind: 'unknown', raw: 'unknown' }
1746
- if (callExpr.typeArguments && callExpr.typeArguments.length > 0) {
1747
- type = typeNodeToTypeInfo(callExpr.typeArguments[0], ctx.sourceFile) ?? type
1748
- } else {
1749
- type = inferTypeFromValue(initialValue)
1750
- }
1774
+ const type = signalTypeInfo(callExpr, initialValue, ctx)
1751
1775
 
1752
1776
  ctx.signalTupleRefs.set(name, {
1753
1777
  initialValue,
@@ -1773,17 +1797,12 @@ function collectSignalFromIndexAccess(
1773
1797
  // Pattern A — each declaration is a standalone signal. Pair [0] -> getter
1774
1798
  // or [1] -> setter; the missing half stays null.
1775
1799
  const callExpr = match.callExpr
1776
- const initialValue = callExpr.arguments[0] ? ctx.getJS(callExpr.arguments[0]) : ''
1800
+ const initialValue = signalInitialValueText(callExpr, ctx)
1777
1801
  const typedInitialValue = callExpr.arguments[0]
1778
1802
  ? callExpr.arguments[0].getText(ctx.sourceFile)
1779
1803
  : undefined
1780
1804
 
1781
- let type: TypeInfo = { kind: 'unknown', raw: 'unknown' }
1782
- if (callExpr.typeArguments && callExpr.typeArguments.length > 0) {
1783
- type = typeNodeToTypeInfo(callExpr.typeArguments[0], ctx.sourceFile) ?? type
1784
- } else {
1785
- type = inferTypeFromValue(initialValue)
1786
- }
1805
+ const type = signalTypeInfo(callExpr, initialValue, ctx)
1787
1806
 
1788
1807
  const loc = getSourceLocation(node, ctx.sourceFile, ctx.filePath)
1789
1808
  const initialFreeIdentifiers = callExpr.arguments[0]
@@ -2386,7 +2405,12 @@ function collectLocalDeclarations(root: ts.Node): Set<string> {
2386
2405
  // Reactive primitives are DOM-free. The context/portal entries here are
2387
2406
  // type-level shims — their implementations live in @barefootjs/client/runtime
2388
2407
  // and are emitted by the compiler for 'use client' components.
2389
- const CLIENT_EXPORTS = new Set([
2408
+ //
2409
+ // The compiler re-points a recognised import at `@barefootjs/client/runtime`
2410
+ // in client JS, and at the Hono SSR shim on the server, so every name here
2411
+ // must exist on both. `client-exports-contract.test.ts` (adapter-hono) pins
2412
+ // this set against both, and against the root entry's own exports (#3217).
2413
+ export const CLIENT_EXPORTS: ReadonlySet<string> = new Set([
2390
2414
  'createSignal', 'createEffect', 'createDisposableEffect', 'createMemo',
2391
2415
  'createRoot', 'onCleanup', 'onMount', 'untrack', 'batch', 'splitProps',
2392
2416
  'forwardProps', 'unwrap', '__slot',
@@ -514,6 +514,55 @@ export function lookupStaticRecordLiteral(
514
514
  return null
515
515
  }
516
516
 
517
+ /**
518
+ * Resolve a bare identifier bound to a literal-initialized `const` — module
519
+ * or component-function scope — to that literal, or `null` for any other
520
+ * shape so callers fall back to their generic lowering. The one decision
521
+ * every template-string adapter used to copy as its own `_resolveLiteralConst`
522
+ * (#3312): those copies matched numbers and strings by regex and missed
523
+ * booleans, so `const on = true` read as a ternary test lowered to an unbound
524
+ * template variable (the falsy branch, or a render-time error). Each adapter
525
+ * renders the returned literal — boolean, number, string or `null` — in its
526
+ * own syntax.
527
+ *
528
+ * Reads the analyzer's structured `parsed` literal when present (a negated
529
+ * number arrives as unary `-`), falling back to the value text for the same
530
+ * three shapes. `isShadowed` is REQUIRED, as in `lookupStaticRecordLiteral`:
531
+ * a name the enclosing loop binds is the row's own value (#2221).
532
+ */
533
+ export function lookupLiteralConst(
534
+ name: string,
535
+ constants: IRMetadata['localConstants'] | undefined,
536
+ isShadowed: (name: string) => boolean,
537
+ ): { kind: 'string' | 'number' | 'boolean' | 'null'; text: string } | null {
538
+ if (isShadowed(name)) return null
539
+ const c = (constants ?? []).find(lc => lc.name === name)
540
+ if (c?.value === undefined) return null
541
+ const p = c.parsed
542
+ if (p?.kind === 'literal') {
543
+ if (p.literalType === 'string' && typeof p.value === 'string') return { kind: 'string', text: p.value }
544
+ if (p.literalType === 'boolean' && typeof p.value === 'boolean') return { kind: 'boolean', text: String(p.value) }
545
+ if (p.literalType === 'null') return { kind: 'null', text: 'null' }
546
+ if (p.literalType === 'number' && typeof p.value === 'number' && Number.isFinite(p.value)) {
547
+ return { kind: 'number', text: String(p.value) }
548
+ }
549
+ }
550
+ if (
551
+ p?.kind === 'unary' && p.op === '-' &&
552
+ p.argument.kind === 'literal' && p.argument.literalType === 'number' &&
553
+ typeof p.argument.value === 'number' && Number.isFinite(p.argument.value)
554
+ ) {
555
+ return { kind: 'number', text: String(-p.argument.value) }
556
+ }
557
+ if (p) return null
558
+ const v = c.value.trim()
559
+ if (/^-?\d+(\.\d+)?$/.test(v)) return { kind: 'number', text: v }
560
+ if (v === 'true' || v === 'false') return { kind: 'boolean', text: v }
561
+ if (v === 'null') return { kind: 'null', text: 'null' }
562
+ const strLit = /^'([^'\\]*)'$/.exec(v) ?? /^"([^"\\]*)"$/.exec(v)
563
+ return strLit ? { kind: 'string', text: strLit[1] } : null
564
+ }
565
+
517
566
  /**
518
567
  * Statically evaluate `[<string literals>].join(<sep?>)` (e.g. a module-scope
519
568
  * `const stateClasses = ['…', …].join(' ')`) to its joined string, so SSR
package/src/errors.ts CHANGED
@@ -165,6 +165,14 @@ export const ErrorCodes = {
165
165
  // `/* @client */` before the ref expression. See
166
166
  // `packages/adapter-tests/limitations/ref-effect-attr-state-ssr.ts`.
167
167
  REF_ATTR_ABSENT_AT_SSR: 'BF063',
168
+ // A `ref` callback portals an element out of a `.map()` row
169
+ // (`createPortal(el, document.body, { ownerScope })`), but the row cannot
170
+ // be paired with the portaled element at hydration: the loop is nested or
171
+ // unkeyed, or the element is forwarded as a child component's children.
172
+ // SSR would place the element at its portal outlet with nothing linking it
173
+ // back to its row, so its delegated event handlers would stop running
174
+ // after hydration (#3318). A keyed top-level row is supported.
175
+ ROW_PORTAL_UNPAIRABLE: 'BF064',
168
176
 
169
177
  // Inline JSX-callback synthesis errors (BF080-BF089) — raised by the
170
178
  // preprocess-inline-jsx-callbacks pass (#1211) when an inline JSX-
@@ -298,6 +306,9 @@ const errorMessages: Record<ErrorCode, string> = {
298
306
  [ErrorCodes.REF_ATTR_ABSENT_AT_SSR]:
299
307
  'A ref callback writes an attribute on mount that the element\'s JSX never renders. A ref callback never runs at SSR, so the server HTML lacks the attribute and hydration adds it — the DOM visibly changes at the hydrate boundary.',
300
308
 
309
+ [ErrorCodes.ROW_PORTAL_UNPAIRABLE]:
310
+ 'A ref callback portals an element out of a .map() row that hydration cannot pair with the element (the row root itself, a nested or unkeyed loop, an element inside a reactive conditional in the row, or an element inside a child component\'s children), so its event handlers would stop running after hydration.',
311
+
301
312
  [ErrorCodes.INLINE_JSX_CALLBACK_CAPTURE]:
302
313
  "Inline JSX-returning arrow function captures a non-module identifier. Extract the callback into a top-level 'use client' component (e.g. `function MyNode(n) { return <div/> }` then `renderNode={MyNode}`) or pass captured values via component props.",
303
314
 
package/src/html-types.ts CHANGED
@@ -51,7 +51,11 @@ export interface BaseEventAttributes {
51
51
  onAnimationStart?: (event: AnimationEvent) => void
52
52
  onAnimationEnd?: (event: AnimationEvent) => void
53
53
  onAnimationIteration?: (event: AnimationEvent) => void
54
+ onAnimationCancel?: (event: AnimationEvent) => void
55
+ onTransitionStart?: (event: TransitionEvent) => void
56
+ onTransitionRun?: (event: TransitionEvent) => void
54
57
  onTransitionEnd?: (event: TransitionEvent) => void
58
+ onTransitionCancel?: (event: TransitionEvent) => void
55
59
  onCopy?: (event: ClipboardEvent) => void
56
60
  onCut?: (event: ClipboardEvent) => void
57
61
  onPaste?: (event: ClipboardEvent) => void
@@ -134,6 +138,17 @@ export interface HTMLBaseAttributes extends BaseEventAttributes {
134
138
  onPointerMove?: (event: PointerEvent) => void
135
139
  onPointerEnter?: (event: PointerEvent) => void
136
140
  onPointerLeave?: (event: PointerEvent) => void
141
+ onPointerCancel?: (event: PointerEvent) => void
142
+ onPointerOver?: (event: PointerEvent) => void
143
+ onPointerOut?: (event: PointerEvent) => void
144
+ onGotPointerCapture?: (event: PointerEvent) => void
145
+ onLostPointerCapture?: (event: PointerEvent) => void
146
+ onMouseOver?: MouseEventHandler<HTMLElement>
147
+ onMouseOut?: MouseEventHandler<HTMLElement>
148
+ onAuxClick?: MouseEventHandler<HTMLElement>
149
+ onFocusIn?: FocusEventHandler<HTMLElement>
150
+ onFocusOut?: FocusEventHandler<HTMLElement>
151
+ onBeforeInput?: InputEventHandler<HTMLElement>
137
152
  onContextMenu?: MouseEventHandler<HTMLElement>
138
153
  onDoubleClick?: MouseEventHandler<HTMLElement>
139
154
 
package/src/index.ts CHANGED
@@ -90,7 +90,7 @@ export type {
90
90
  export { isElidedFactoryGetter } from './types.ts'
91
91
 
92
92
  // Analyzer
93
- export { analyzeComponent, listComponentFunctions, listComponentFunctions as listExportedComponents, scanComponentFile, createProgramForFile, createAnchoredProgram, needsTypeBasedDetection, resolveRelativeImportToFile, REACTIVE_PRIMITIVES, BROWSER_ONLY_CLIENT_APIS, type AnalyzerContext, type ComponentFileScan } from './analyzer.ts'
93
+ export { analyzeComponent, listComponentFunctions, listComponentFunctions as listExportedComponents, scanComponentFile, createProgramForFile, createAnchoredProgram, needsTypeBasedDetection, resolveRelativeImportToFile, REACTIVE_PRIMITIVES, CLIENT_EXPORTS, BROWSER_ONLY_CLIENT_APIS, type AnalyzerContext, type ComponentFileScan } from './analyzer.ts'
94
94
  export { createProgramForCorpus, type SharedProgramOptions } from './shared-program.ts'
95
95
 
96
96
  // JSX to IR transformer
@@ -120,8 +120,20 @@ export { rewriteImportsForTemplate, rewriteDynamicImportsInSource } from './adap
120
120
  export { emitParsedExpr, groupBinaryOperand, groupObjectLiteralSegments, isStringTypedOperand, isStringConcatBinary } from './adapters/parsed-expr-emitter.ts'
121
121
  export type { ParsedExprEmitter, LoweringEmitter, HigherOrderMethod, ArrayMethod, SortMethod, LiteralType } from './adapters/parsed-expr-emitter.ts'
122
122
  export { collectLoopBoundNames } from './adapters/loop-bound-names.ts'
123
+ export { isBooleanResultParsed, stringifyBooleanTernaryBranches } from './adapters/boolean-result.ts'
123
124
  export { derivesScopeFromSlot } from './adapters/child-scope.ts'
124
125
  export { evaluateStaticLiteral, isFullyStaticLiteral, resolveStaticLoopSource } from './static-literal.ts'
126
+ export {
127
+ arithmeticOperandIsNull,
128
+ attrValueMayBeNullish,
129
+ collectNullableSignalGetters,
130
+ collectNullishAttrContext,
131
+ isNullableSignal,
132
+ isNullishLiteral,
133
+ NULL_COERCING_ARITHMETIC_OPS,
134
+ nullableSignalAttrGetter,
135
+ type NullishAttrContext,
136
+ } from './nullable-signal-attr.ts'
125
137
  export { importsSearchParams, searchParamsLocalNames, envSignalLocalNames, envSignalReaderFor, ENV_SIGNAL_READERS, queryHrefLocalNames, matchSearchParamsMethodCall } from './adapters/env-signal.ts'
126
138
  export type { EnvSignalReader } from './adapters/env-signal.ts'
127
139
  export { matchQueryHrefCall, queryHrefArgs, type QueryHrefCall, type QueryHrefTriple } from './query-href-lowering.ts'
@@ -152,6 +164,7 @@ export { emitIRNode } from './adapters/ir-node-emitter.ts'
152
164
  export type { IRNodeEmitter, EmitIRNode } from './adapters/ir-node-emitter.ts'
153
165
  export { emitAttrValue } from './adapters/attr-value-emitter.ts'
154
166
  export type { AttrValueEmitter } from './adapters/attr-value-emitter.ts'
167
+ export { escapeLineStatementSigil } from './adapters/line-statement-text.ts'
155
168
  export {
156
169
  isDangerousInnerHtmlAttr,
157
170
  resolveDangerousInnerHtml,
@@ -248,6 +261,7 @@ export { isLowerableLoopDestructure, isLowerableObjectRestDestructure } from './
248
261
  // Binding scope (#2482) — shared loop-bound-name resolution service
249
262
  export { BindingScope } from './scope/binding-scope.ts'
250
263
  export type { ScopeBindingSource, ScopeBinding, ScopeFrame, LoopBindingSource } from './scope/binding-scope.ts'
264
+ export { rootPropAliasNames, rootPropAliasesForLoop, rootPropReadName } from './scope/root-prop-alias.ts'
251
265
 
252
266
  // Debug analysis
253
267
  export {
@@ -362,7 +376,7 @@ export { BOOLEAN_ATTRS, isBooleanAttr } from './html-constants.ts'
362
376
  export { USE_CLIENT_DIRECTIVE, CLIENT_EXPRESSION_DIRECTIVE } from './directives.ts'
363
377
 
364
378
  // Shared props-object-pattern helpers for the Go / Mojo template adapters
365
- export { augmentInheritedPropAccesses, parseRecordIndexAccess, evalStringArrayJoin, collectModuleStringConsts, lookupStaticRecordLiteral, collectContextConsumers } from './augment-inherited-props.ts'
379
+ export { augmentInheritedPropAccesses, parseRecordIndexAccess, evalStringArrayJoin, collectModuleStringConsts, lookupStaticRecordLiteral, lookupLiteralConst, collectContextConsumers } from './augment-inherited-props.ts'
366
380
  export type { RecordIndexAccess, RecordIndexEntry, ContextConsumer } from './augment-inherited-props.ts'
367
381
 
368
382
  // HTML element attribute types
@@ -1253,9 +1253,16 @@ function collectFromElement(element: IRElement, ctx: ClientJsContext, insideCond
1253
1253
  */
1254
1254
  function collectBranchReactiveAttrs(node: IRNode, ctx: ClientJsContext): ConditionalBranchReactiveAttr[] {
1255
1255
  const attrs: ConditionalBranchReactiveAttr[] = []
1256
- walkIR(node, null, {
1257
- ...stopAt<null>('conditional', 'ifStatement', 'loop'),
1258
- element: ({ node: el, descend }) => {
1256
+ // Scope: the slot ids of the components whose `children` enclose the
1257
+ // current node — a parent-owned (`^sN`) element renders inside one of
1258
+ // them, which is how the runtime tells it from another component's
1259
+ // same-numbered forwarded element (#3324).
1260
+ walkIR<readonly string[]>(node, [], {
1261
+ ...stopAt<readonly string[]>('conditional', 'ifStatement', 'loop'),
1262
+ component: ({ node: c, scope, descend }) => {
1263
+ descend(c.slotId ? [...scope, c.slotId] : scope)
1264
+ },
1265
+ element: ({ node: el, scope, descend }) => {
1259
1266
  if (!el.slotId) {
1260
1267
  descend()
1261
1268
  return
@@ -1276,6 +1283,7 @@ function collectBranchReactiveAttrs(node: IRNode, ctx: ClientJsContext): Conditi
1276
1283
  if (!attr.clientOnly && !decideWrapForAttr(expanded.expr, ctx, attr).wrap) continue
1277
1284
  attrs.push({
1278
1285
  slotId: el.slotId,
1286
+ ...(el.slotId.startsWith('^') && { receiverSlotIds: scope }),
1279
1287
  attrName: attr.name,
1280
1288
  expression: expanded.expr,
1281
1289
  ...pickAttrMetaFromIR(attr),
@@ -1292,6 +1300,12 @@ function collectBranchReactiveAttrs(node: IRNode, ctx: ClientJsContext): Conditi
1292
1300
  * Collect reactive text expressions from a conditional branch IR subtree.
1293
1301
  * Walks the branch tree to find expression nodes that need createEffect updates.
1294
1302
  * Does NOT recurse into nested conditionals (they get their own insert() call).
1303
+ *
1304
+ * Uses the same wrap decision as top-level text (`decideWrapFromAstFlags`,
1305
+ * #937): a call the analyzer can't prove non-reactive (`{v().text}`, `v`
1306
+ * reading an untyped or class-held store) wraps too. Gating on
1307
+ * `n.reactive` alone left such text frozen at its first value inside a
1308
+ * branch while the same expression outside it updated (#3266).
1295
1309
  */
1296
1310
  function collectBranchTextEffects(node: IRNode): ConditionalBranchTextEffect[] {
1297
1311
  const effects: ConditionalBranchTextEffect[] = []
@@ -1302,7 +1316,7 @@ function collectBranchTextEffects(node: IRNode): ConditionalBranchTextEffect[] {
1302
1316
  // element / fragment / component / provider / async use default descent.
1303
1317
  ...stopAt<null>('conditional', 'ifStatement', 'loop'),
1304
1318
  expression: ({ node: n }) => {
1305
- if (n.reactive && n.slotId && !n.clientOnly) {
1319
+ if (decideWrapFromAstFlags(n).wrap && n.slotId && !n.clientOnly) {
1306
1320
  effects.push({ slotId: n.slotId, expression: n.expr })
1307
1321
  }
1308
1322
  },
@@ -62,7 +62,7 @@ function collectTextOnlySlotIds(nodes: readonly IRNode[], into: Set<string>): vo
62
62
  /** @internal — prefer `buildLoopPlan`. */
63
63
  export function buildComponentLoopPlan(elem: TopLevelLoop, profileComponentName?: string): ComponentLoopPlan {
64
64
  const { name } = elem.childComponent!
65
- const propsExpr = buildComponentPropsExpr(elem.childComponent!, elem.param, undefined, elem.index)
65
+ const propsExpr = buildComponentPropsExpr(elem.childComponent!, elem.param, elem.paramBindings, elem.index)
66
66
  const keyExpr = wrapLoopParamAsAccessor(elem.key || '__idx', elem.param, elem.paramBindings, elem.index)
67
67
  const { head: paramHead, unwrap: paramUnwrap } = destructureLoopParam(elem.param, elem.paramBindings)
68
68
 
@@ -103,7 +103,7 @@ export function buildComponentLoopPlan(elem: TopLevelLoop, profileComponentName?
103
103
  return {
104
104
  componentName: comp.name,
105
105
  selector: buildCompSelector(comp),
106
- propsExpr: buildComponentPropsExpr(comp, elem.param, undefined, elem.index),
106
+ propsExpr: buildComponentPropsExpr(comp, elem.param, elem.paramBindings, elem.index),
107
107
  // #3064: marker-scoped where possible — see `buildChildrenTextEffect`.
108
108
  childrenTextEffect: childrenRefsLoop
109
109
  ? buildChildrenTextEffect(comp.children!, rawChildrenExpr!, wrap)
@@ -62,6 +62,7 @@ export function buildTopLevelCompositePlan(elem: TopLevelLoop, profileComponentN
62
62
  outerLoopParam: elem.param,
63
63
  outerLoopParamBindings: elem.paramBindings,
64
64
  outerLoopIndex: elem.index,
65
+ rowHasPortal: elem.bindings.refs.some(r => r.ssrPortalOwner),
65
66
  }),
66
67
  loopParam: elem.param,
67
68
  loopParamBindings: elem.paramBindings,
@@ -125,6 +126,7 @@ export function buildBranchCompositePlan(loop: BranchLoop, cv: string, profileCo
125
126
  outerLoopParam: loop.param,
126
127
  outerLoopParamBindings: loop.paramBindings,
127
128
  outerLoopIndex: loop.index,
129
+ rowHasPortal: loop.bindings.refs.some(r => r.ssrPortalOwner),
128
130
  }),
129
131
  loopParam: loop.param,
130
132
  loopParamBindings: loop.paramBindings,
@@ -30,6 +30,7 @@ export function buildDynamicLoopDelegationPlan(
30
30
  events: elem.bindings.events,
31
31
  profileComponentName,
32
32
  ownHandlers,
33
+ ...(hasRowPortalRef(elem) && { relayRowPortals: true }),
33
34
  itemLookup: buildKeyedOrIndexLookup({
34
35
  // Chain `.filter()` / `.toSorted()` so the index-based lookup walks
35
36
  // the same array shape mapArray reconciled into the DOM (#1434).
@@ -69,6 +70,7 @@ export function buildBranchLoopDelegationPlan(
69
70
  containerVar: `__loop_${cv}`,
70
71
  events: loop.bindings.events,
71
72
  profileComponentName,
73
+ ...(hasRowPortalRef(loop) && { relayRowPortals: true }),
72
74
  itemLookup: buildKeyedOrIndexLookup({
73
75
  // See note on `buildDynamicLoopDelegationPlan` above (#1434).
74
76
  array: buildChainedArrayExpr(loop),
@@ -98,6 +100,12 @@ export function buildStaticArrayDelegationPlan(
98
100
  profileComponentName?: string,
99
101
  ownHandlers?: Map<string, ContainerOwnHandler>,
100
102
  ): EventDelegationPlan {
103
+ // A row-portaled element is not under its row, so the positional lookup
104
+ // cannot reach the row from it; the row key it carries can (#3318).
105
+ // BF064 guarantees a portaling loop is keyed.
106
+ if (hasRowPortalRef(elem) && elem.key !== null) {
107
+ return buildDynamicLoopDelegationPlan(elem, profileComponentName, ownHandlers)
108
+ }
101
109
  return {
102
110
  kind: 'event-delegation',
103
111
  containerVar: `_${varSlotId(elem.slotId)}`,
@@ -125,6 +133,11 @@ export function buildStaticArrayDelegationPlan(
125
133
  }
126
134
  }
127
135
 
136
+ /** A row `ref` callback of the loop portals its element out of the row (#3318). */
137
+ function hasRowPortalRef(loop: TopLevelLoop | BranchLoop): boolean {
138
+ return loop.bindings.refs.some(r => r.ssrPortalOwner)
139
+ }
140
+
128
141
  /**
129
142
  * Helper used by both the top-level and branch-scoped builders. Picks
130
143
  * `keyed` vs `dynamic-index` based on whether the loop has an explicit key.
@@ -88,6 +88,11 @@ export interface BuildInnerLoopsArgs {
88
88
  outerLoopParamBindings?: readonly LoopParamBinding[]
89
89
  /** Outer loop's index param name, when present (#2861). */
90
90
  outerLoopIndex?: string | null
91
+ /**
92
+ * The outer row portals an element out of itself (#3318), so a container
93
+ * inside it is looked up through the row's registered roots (`qsaItem`).
94
+ */
95
+ rowHasPortal?: boolean
91
96
  }
92
97
 
93
98
  /**
@@ -96,7 +101,7 @@ export interface BuildInnerLoopsArgs {
96
101
  * conditional branch are skipped (they're emitted by `stringifyBranchInnerLoops`).
97
102
  */
98
103
  export function buildInnerLoopsPlan(args: BuildInnerLoopsArgs): InnerLoopsPlan {
99
- const { levels, parentElVar, outerLoopParam, outerLoopParamBindings, outerLoopIndex } = args
104
+ const { levels, parentElVar, outerLoopParam, outerLoopParamBindings, outerLoopIndex, rowHasPortal } = args
100
105
  const wrapOuter = outerLoopParam
101
106
  ? (expr: string) => wrapLoopParamAsAccessor(expr, outerLoopParam, outerLoopParamBindings, outerLoopIndex)
102
107
  : (expr: string) => expr
@@ -119,7 +124,7 @@ export function buildInnerLoopsPlan(args: BuildInnerLoopsArgs): InnerLoopsPlan {
119
124
 
120
125
  const uidSuffix = `${inner.depth}_${i}`
121
126
  const containerExpr = inner.containerSlotId
122
- ? `qsa(${parentElVar}, '[bf="${inner.containerSlotId}"]')`
127
+ ? `${rowHasPortal ? 'qsaItem' : 'qsa'}(${parentElVar}, '[bf="${inner.containerSlotId}"]')`
123
128
  : parentElVar
124
129
 
125
130
  // #2865: every nested loop gets the full reactive `mapArray` emission,
@@ -46,6 +46,13 @@ export interface EventDelegationPlan {
46
46
  * (the common case: no collision) keeps the emitted listener unchanged.
47
47
  */
48
48
  ownHandlers?: Map<string, ContainerOwnHandler>
49
+ /**
50
+ * A row of this loop portals an element out of the container (#3318).
51
+ * The stringifier then also relays each listener to the adopted elements
52
+ * (`relayRowPortalEvents`) and accepts slot matches inside them
53
+ * (`isRowPortalOf`). `undefined` keeps the emitted listener unchanged.
54
+ */
55
+ relayRowPortals?: boolean
49
56
  }
50
57
 
51
58
  /**
@@ -117,6 +117,8 @@ export interface ArmTextEffect {
117
117
  */
118
118
  export interface ArmReactiveAttr extends AttrMeta {
119
119
  slotId: string
120
+ /** See `ConditionalBranchReactiveAttr.receiverSlotIds` (#3324). */
121
+ receiverSlotIds?: readonly string[]
120
122
  attrName: string
121
123
  expression: string
122
124
  }
@@ -112,6 +112,8 @@ export interface LoopChildRefBinding {
112
112
  * `reactiveAttrs` are already handled on the static path.
113
113
  */
114
114
  callback: string
115
+ /** The callback portals the element out of the row (#3318); see `LoopChildRef.ssrPortalOwner`. */
116
+ ssrPortalOwner?: boolean
115
117
  }
116
118
 
117
119
  /**
@@ -154,6 +154,7 @@ export function buildChildRefBindings(
154
154
  return refs.map(r => ({
155
155
  childSlotId: r.childSlotId,
156
156
  callback: wrapLoopParamAsAccessor(r.callback, loopParam, loopParamBindings, loopIndex),
157
+ ...(r.ssrPortalOwner && { ssrPortalOwner: true }),
157
158
  }))
158
159
  }
159
160
 
@@ -173,6 +174,7 @@ export function buildStaticChildRefBindings(
173
174
  return refs.map(r => ({
174
175
  childSlotId: r.childSlotId,
175
176
  callback: r.callback,
177
+ ...(r.ssrPortalOwner && { ssrPortalOwner: true }),
176
178
  }))
177
179
  }
178
180
 
@@ -14,7 +14,7 @@ import { stringifyCompositeLoop } from './composite-loop.ts'
14
14
  import { stringifyEventDelegation } from './event-delegation.ts'
15
15
  import { stringifyReactiveEffects } from './reactive-effects.ts'
16
16
  import { emitTemplateCloneInline, emitLoopItemElementSetup } from './template-parse.ts'
17
- import { emitLoopChildRefs } from './loop.ts'
17
+ import { emitLoopChildRefs, emitRowPortalClaim, rowPortalSlotIds } from './loop.ts'
18
18
  import { stringifyLazyRowLoop } from './lazy-row.ts'
19
19
  import type {
20
20
  BranchLoopPlan,
@@ -137,6 +137,9 @@ function emitPlain(lines: string[], plan: BranchPlainLoopPlan): void {
137
137
  indent: ' ',
138
138
  singleRootLayout: 'inline',
139
139
  })
140
+ // See `stringifyPlainLoop` (#3318).
141
+ emitRowPortalClaim(lines, childRefs, { indent: ' ', containerVar })
142
+ const itemLookup = bodyIsMultiRoot || rowPortalSlotIds(childRefs).length > 0
140
143
  if (reactiveEffects !== null || preambleRegions.length > 0) {
141
144
  // Row-granularity effects (§3(c)): mirrors `stringifyPlainLoop`'s
142
145
  // top-level call — attrs, outer texts, and preamble regions merge
@@ -144,12 +147,12 @@ function emitPlain(lines: string[], plan: BranchPlainLoopPlan): void {
144
147
  stringifyReactiveEffects(lines, reactiveEffects, {
145
148
  indent: ' ',
146
149
  elVar: '__el',
147
- bodyIsMultiRoot,
150
+ bodyIsMultiRoot: itemLookup,
148
151
  preambleRegions,
149
152
  mapPreambleWrapped,
150
153
  })
151
154
  }
152
- emitLoopChildRefs(lines, childRefs, { indent: ' ', elVar: '__el', bodyIsMultiRoot })
155
+ emitLoopChildRefs(lines, childRefs, { indent: ' ', elVar: '__el', bodyIsMultiRoot: itemLookup, containerVar })
153
156
  lines.push(` return __el`)
154
157
  lines.push(` }, '${markerId}'${loopBfId})`)
155
158
  }
@@ -34,7 +34,7 @@ import { emitComponentAndEventSetup } from '../shared.ts'
34
34
  import { stringifyInnerLoops } from './inner-loop.ts'
35
35
  import { stringifyReactiveEffects } from './reactive-effects.ts'
36
36
  import { emitLoopItemElementSetup } from './template-parse.ts'
37
- import { emitLoopChildRefs } from './loop.ts'
37
+ import { emitLoopChildRefs, emitRowPortalClaim, rowPortalSlotIds } from './loop.ts'
38
38
  import type { CompositeLoopPlan } from '../plan/types.ts'
39
39
 
40
40
  export function stringifyCompositeLoop(lines: string[], plan: CompositeLoopPlan): void {
@@ -125,16 +125,19 @@ export function stringifyCompositeLoop(lines: string[], plan: CompositeLoopPlan)
125
125
  // variant whose tail needs the row already connected.
126
126
  mountRow: true,
127
127
  })
128
- emitComponentAndEventSetup(lines, bodyIndent, '__el', compsArr, eventsArr, loopParam, loopParamBindings, bodyIsMultiRoot, loopIndex)
128
+ // See `stringifyPlainLoop` (#3318).
129
+ emitRowPortalClaim(lines, childRefs, { indent: bodyIndent, containerVar })
130
+ const itemLookup = bodyIsMultiRoot || rowPortalSlotIds(childRefs).length > 0
131
+ emitComponentAndEventSetup(lines, bodyIndent, '__el', compsArr, eventsArr, loopParam, loopParamBindings, itemLookup, loopIndex)
129
132
  if (innerLoops.length > 0) {
130
133
  stringifyInnerLoops(lines, innerLoops, bodyIndent, pc)
131
134
  }
132
135
 
133
136
  if (reactiveEffects) {
134
- stringifyReactiveEffects(lines, reactiveEffects, { indent: bodyIndent, elVar: '__el', bodyIsMultiRoot })
137
+ stringifyReactiveEffects(lines, reactiveEffects, { indent: bodyIndent, elVar: '__el', bodyIsMultiRoot: itemLookup })
135
138
  }
136
139
 
137
- emitLoopChildRefs(lines, childRefs, { indent: bodyIndent, elVar: '__el', bodyIsMultiRoot })
140
+ emitLoopChildRefs(lines, childRefs, { indent: bodyIndent, elVar: '__el', bodyIsMultiRoot: itemLookup, containerVar })
138
141
 
139
142
  lines.push(`${bodyIndent}return __el`)
140
143
  const loopBfId = profileLoopId ? `, ${JSON.stringify(profileLoopId)}` : ''
@@ -101,7 +101,7 @@ function preambleLineForHandler(
101
101
  }
102
102
 
103
103
  export function stringifyEventDelegation(lines: string[], plan: EventDelegationPlan): void {
104
- const { containerVar, events, itemLookup, profileComponentName, ownHandlers } = plan
104
+ const { containerVar, events, itemLookup, profileComponentName, ownHandlers, relayRowPortals } = plan
105
105
  const eventsByName = new Map<string, LoopChildEvent[]>()
106
106
  for (const ev of events) {
107
107
  if (!eventsByName.has(ev.eventName)) eventsByName.set(ev.eventName, [])
@@ -121,10 +121,14 @@ export function stringifyEventDelegation(lines: string[], plan: EventDelegationP
121
121
  const ownHandlerCall = ownHandler
122
122
  ? withTurn(`(${ownHandler.handler.trim()})(__bfEvt)`, profileComponentName, ownHandler.slotId, ownHandler.eventName)
123
123
  : null
124
- if (useCapture) {
125
- lines.push(` if (${containerVar}) ${containerVar}.addEventListener('${eventName}', (__bfEvt) => {`)
124
+ const listenedName = useCapture ? eventName : domEventName
125
+ if (relayRowPortals) {
126
+ // Named so the same listener can also be relayed to the elements rows
127
+ // portal out of the container (#3318).
128
+ lines.push(` if (${containerVar}) {`)
129
+ lines.push(` const __bfDl = (__bfEvt) => {`)
126
130
  } else {
127
- lines.push(` if (${containerVar}) ${containerVar}.addEventListener('${domEventName}', (__bfEvt) => {`)
131
+ lines.push(` if (${containerVar}) ${containerVar}.addEventListener('${listenedName}', (__bfEvt) => {`)
128
132
  }
129
133
  lines.push(` const target = __bfEvt.target`)
130
134
  for (const ev of evs) {
@@ -137,7 +141,12 @@ export function stringifyEventDelegation(lines: string[], plan: EventDelegationP
137
141
  // the `container.contains(...)` guard rejects the foreign match and the
138
142
  // handler falls through to the correct branch.
139
143
  lines.push(` const ${childVar}El = target.closest('[bf="${ev.childSlotId}"]')`)
140
- lines.push(` if (${childVar}El && ${containerVar}.contains(${childVar}El)) {`)
144
+ // A row-portaled element sits outside the container; the registry
145
+ // vouches for it instead (#3318).
146
+ const inContainer = relayRowPortals
147
+ ? `(${containerVar}.contains(${childVar}El) || isRowPortalOf(${childVar}El, ${containerVar}))`
148
+ : `${containerVar}.contains(${childVar}El)`
149
+ lines.push(` if (${childVar}El && ${inContainer}) {`)
141
150
  const handlerCall = withTurn(`(${ev.handler.trim()})(__bfEvt)`, profileComponentName, ev.childSlotId, ev.eventName)
142
151
  switch (itemLookup.kind) {
143
152
  case 'keyed':
@@ -179,7 +188,13 @@ export function stringifyEventDelegation(lines: string[], plan: EventDelegationP
179
188
  // own handler still fires — same as today's separate listener.
180
189
  lines.push(` if (!__bfEvt.cancelBubble) { ${ownHandlerCall} }`)
181
190
  }
182
- if (useCapture) {
191
+ if (relayRowPortals) {
192
+ const captureArg = useCapture ? ', true' : ''
193
+ lines.push(` }`)
194
+ lines.push(` ${containerVar}.addEventListener('${listenedName}', __bfDl${captureArg})`)
195
+ lines.push(` relayRowPortalEvents(${containerVar}, '${listenedName}', __bfDl${captureArg})`)
196
+ lines.push(` }`)
197
+ } else if (useCapture) {
183
198
  lines.push(` }, true)`)
184
199
  } else {
185
200
  lines.push(` })`)
@@ -162,7 +162,12 @@ function emitArmBody(
162
162
  for (const [slotId, attrs] of attrsBySlot) {
163
163
  const v = varSlotId(slotId)
164
164
  const elVar = `__ra_${v}`
165
- lines.push(`${indent}{ const ${elVar} = qsa(__branchScope, '[bf="${slotId}"]')`)
165
+ // A parent-owned slot passes the components it is forwarded into, so
166
+ // the lookup can cross into their scopes without resolving another
167
+ // component's same-numbered forwarded element (#3324).
168
+ const receivers = attrs[0].receiverSlotIds
169
+ const receiverArg = receivers && receivers.length > 0 ? `, ${JSON.stringify(receivers)}` : ''
170
+ lines.push(`${indent}{ const ${elVar} = qsa(__branchScope, '[bf="${slotId}"]'${receiverArg})`)
166
171
  lines.push(`${indent}${DEDUP_STORE_DECL}`)
167
172
  lines.push(`${indent}if (${elVar}) {`)
168
173
  let ordinal = 0