@barefootjs/jsx 0.26.3 → 0.27.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.
Files changed (99) hide show
  1. package/dist/compiler.d.ts.map +1 -1
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +735 -140
  5. package/dist/ir-to-client-js/build-references.d.ts.map +1 -1
  6. package/dist/ir-to-client-js/client-only-elision.d.ts +103 -0
  7. package/dist/ir-to-client-js/client-only-elision.d.ts.map +1 -0
  8. package/dist/ir-to-client-js/collect-elements.d.ts.map +1 -1
  9. package/dist/ir-to-client-js/control-flow/plan/branch-loop.d.ts +12 -1
  10. package/dist/ir-to-client-js/control-flow/plan/branch-loop.d.ts.map +1 -1
  11. package/dist/ir-to-client-js/control-flow/plan/build-branch-loop.d.ts.map +1 -1
  12. package/dist/ir-to-client-js/control-flow/plan/build-event-delegation.d.ts.map +1 -1
  13. package/dist/ir-to-client-js/control-flow/plan/build-loop.d.ts.map +1 -1
  14. package/dist/ir-to-client-js/control-flow/plan/event-delegation.d.ts +16 -1
  15. package/dist/ir-to-client-js/control-flow/plan/event-delegation.d.ts.map +1 -1
  16. package/dist/ir-to-client-js/control-flow/plan/loop.d.ts +27 -0
  17. package/dist/ir-to-client-js/control-flow/plan/loop.d.ts.map +1 -1
  18. package/dist/ir-to-client-js/control-flow/shared.d.ts +13 -2
  19. package/dist/ir-to-client-js/control-flow/shared.d.ts.map +1 -1
  20. package/dist/ir-to-client-js/control-flow/stringify/claim-plan.d.ts +54 -0
  21. package/dist/ir-to-client-js/control-flow/stringify/claim-plan.d.ts.map +1 -0
  22. package/dist/ir-to-client-js/control-flow/stringify/event-delegation.d.ts.map +1 -1
  23. package/dist/ir-to-client-js/control-flow/stringify/inner-loop.d.ts.map +1 -1
  24. package/dist/ir-to-client-js/control-flow/stringify/insert.d.ts.map +1 -1
  25. package/dist/ir-to-client-js/control-flow/stringify/loop-child-arm.d.ts.map +1 -1
  26. package/dist/ir-to-client-js/control-flow/stringify/loop.d.ts +19 -3
  27. package/dist/ir-to-client-js/control-flow/stringify/loop.d.ts.map +1 -1
  28. package/dist/ir-to-client-js/control-flow/stringify/reactive-effects.d.ts +63 -4
  29. package/dist/ir-to-client-js/control-flow/stringify/reactive-effects.d.ts.map +1 -1
  30. package/dist/ir-to-client-js/control-flow.d.ts +1 -1
  31. package/dist/ir-to-client-js/element-refs.d.ts +8 -3
  32. package/dist/ir-to-client-js/element-refs.d.ts.map +1 -1
  33. package/dist/ir-to-client-js/emit-reactive.d.ts +8 -1
  34. package/dist/ir-to-client-js/emit-reactive.d.ts.map +1 -1
  35. package/dist/ir-to-client-js/html-template.d.ts +73 -1
  36. package/dist/ir-to-client-js/html-template.d.ts.map +1 -1
  37. package/dist/ir-to-client-js/imports.d.ts +2 -2
  38. package/dist/ir-to-client-js/imports.d.ts.map +1 -1
  39. package/dist/ir-to-client-js/reactivity.d.ts.map +1 -1
  40. package/dist/ir-to-client-js/types.d.ts +35 -2
  41. package/dist/ir-to-client-js/types.d.ts.map +1 -1
  42. package/dist/ir-to-client-js/utils.d.ts +1 -1
  43. package/dist/jsx-to-ir.d.ts.map +1 -1
  44. package/dist/types.d.ts +70 -0
  45. package/dist/types.d.ts.map +1 -1
  46. package/package.json +2 -2
  47. package/src/__tests__/__snapshots__/doc-examples.test.ts.snap +555 -678
  48. package/src/__tests__/child-components-in-map.test.ts +4 -4
  49. package/src/__tests__/client-js-generation.test.ts +26 -12
  50. package/src/__tests__/compiler-runtime-contract.test.ts +4 -4
  51. package/src/__tests__/composite-branch-loop.test.ts +2 -2
  52. package/src/__tests__/cross-file-client-signal.test.ts +5 -1
  53. package/src/__tests__/delegated-handler-preamble.test.ts +153 -0
  54. package/src/__tests__/early-return-scope-var-ref.test.ts +10 -11
  55. package/src/__tests__/flatmap-segments.test.ts +182 -0
  56. package/src/__tests__/inline-jsx-callback.test.ts +6 -4
  57. package/src/__tests__/ir-jsx-props.test.ts +6 -5
  58. package/src/__tests__/loop-fallback-wrap.test.ts +3 -4
  59. package/src/__tests__/map-body-no-silent-divergence.test.ts +45 -0
  60. package/src/__tests__/module-level-signal.audit.test.ts +7 -2
  61. package/src/__tests__/nested-loop-conditional.test.ts +9 -7
  62. package/src/__tests__/nested-loop-reactive-attrs.test.ts +2 -2
  63. package/src/__tests__/preamble-region-patch.test.ts +156 -0
  64. package/src/__tests__/profile-cond-binding-ids.test.ts +3 -2
  65. package/src/__tests__/profile-loop-binding-ids.test.ts +4 -3
  66. package/src/__tests__/profile-nested-binding-ids.test.ts +11 -6
  67. package/src/__tests__/reactive-attrs-in-map.test.ts +6 -4
  68. package/src/__tests__/static-loop-csr-materialize.test.ts +3 -2
  69. package/src/__tests__/template-closure.test.ts +1 -1
  70. package/src/compiler.ts +11 -0
  71. package/src/index.ts +1 -0
  72. package/src/ir-to-client-js/build-references.ts +16 -0
  73. package/src/ir-to-client-js/client-only-elision.ts +273 -0
  74. package/src/ir-to-client-js/collect-elements.ts +74 -14
  75. package/src/ir-to-client-js/control-flow/plan/branch-loop.ts +12 -1
  76. package/src/ir-to-client-js/control-flow/plan/build-branch-loop.ts +11 -3
  77. package/src/ir-to-client-js/control-flow/plan/build-event-delegation.ts +19 -3
  78. package/src/ir-to-client-js/control-flow/plan/build-loop.ts +36 -0
  79. package/src/ir-to-client-js/control-flow/plan/event-delegation.ts +16 -1
  80. package/src/ir-to-client-js/control-flow/plan/loop.ts +28 -0
  81. package/src/ir-to-client-js/control-flow/shared.ts +27 -2
  82. package/src/ir-to-client-js/control-flow/stringify/branch-loop.ts +34 -4
  83. package/src/ir-to-client-js/control-flow/stringify/claim-plan.ts +68 -0
  84. package/src/ir-to-client-js/control-flow/stringify/event-delegation.ts +67 -19
  85. package/src/ir-to-client-js/control-flow/stringify/inner-loop.ts +18 -9
  86. package/src/ir-to-client-js/control-flow/stringify/insert.ts +17 -11
  87. package/src/ir-to-client-js/control-flow/stringify/loop-child-arm.ts +35 -16
  88. package/src/ir-to-client-js/control-flow/stringify/loop.ts +80 -14
  89. package/src/ir-to-client-js/control-flow/stringify/reactive-effects.ts +241 -31
  90. package/src/ir-to-client-js/control-flow.ts +1 -1
  91. package/src/ir-to-client-js/element-refs.ts +9 -11
  92. package/src/ir-to-client-js/emit-reactive.ts +50 -14
  93. package/src/ir-to-client-js/html-template.ts +144 -15
  94. package/src/ir-to-client-js/imports.ts +7 -4
  95. package/src/ir-to-client-js/reactivity.ts +7 -0
  96. package/src/ir-to-client-js/types.ts +34 -2
  97. package/src/ir-to-client-js/utils.ts +1 -1
  98. package/src/jsx-to-ir.ts +382 -15
  99. package/src/types.ts +72 -0
@@ -1 +1 @@
1
- {"version":3,"file":"build-references.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/build-references.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAEV,MAAM,EAIN,eAAe,EAChB,MAAM,aAAa,CAAA;AAIpB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAYjD,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe,CAyT1F;AAMD;;2DAE2D;AAC3D,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,eAAe,GAAG,GAAG,CAAC,MAAM,CAAC,CAOxE;AAED;0CAC0C;AAC1C,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,GAAG,CAAC,MAAM,CAAC,CAMtE;AAED;6CAC6C;AAC7C,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,eAAe,GAAG,GAAG,CAAC,MAAM,CAAC,CAM5E;AAED;;qDAEqD;AACrD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAE3F;AAED;;8CAE8C;AAC9C,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,eAAe,EACtB,IAAI,EAAE,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,EACjD,IAAI,EAAE,MAAM,GACX,GAAG,CAAC,MAAM,CAAC,CAQb"}
1
+ {"version":3,"file":"build-references.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/build-references.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAEV,MAAM,EAIN,eAAe,EAChB,MAAM,aAAa,CAAA;AAIpB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAYjD,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe,CAyU1F;AAMD;;2DAE2D;AAC3D,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,eAAe,GAAG,GAAG,CAAC,MAAM,CAAC,CAOxE;AAED;0CAC0C;AAC1C,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,GAAG,CAAC,MAAM,CAAC,CAMtE;AAED;6CAC6C;AAC7C,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,eAAe,GAAG,GAAG,CAAC,MAAM,CAAC,CAM5E;AAED;;qDAEqD;AACrD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAE3F;AAED;;8CAE8C;AAC9C,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,eAAe,EACtB,IAAI,EAAE,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,EACjD,IAAI,EAAE,MAAM,GACX,GAAG,CAAC,MAAM,CAAC,CAQb"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Slot unification Step B (`spec/slot-unification.md` §3(b), §5 "Step B —
3
+ * marker elision"): decide, EXACTLY ONCE and BEFORE either `adapter.generate`
4
+ * (SSR) or `generateClientJs` (CSR) run, which `/* @client *\/` text slots
5
+ * can drop their `<!--bf:sN-->…<!--/-->` marker pair entirely from both
6
+ * outputs. Every consumer (all nine SSR adapters' `renderExpression`, and
7
+ * the CSR emitters in `html-template.ts`) reads the single
8
+ * `IRExpression.markerless` flag this pass writes — nobody re-derives the
9
+ * decision, per CLAUDE.md's "Never add compiler options/hooks for
10
+ * tool-specific output rewriting" spirit: one door in, everyone reads it.
11
+ *
12
+ * Scope — deliberately the NARROWEST slice of §3(b)'s elision rule that is
13
+ * fully sound today, not the general case:
14
+ *
15
+ * Only `expr.clientOnly && expr.slotId` expressions OUTSIDE any loop or
16
+ * conditional branch (i.e. reachable from the component's own render tree
17
+ * by walking only `element`/`text`/`expression`/`fragment` nodes).
18
+ *
19
+ * Why THIS slice and not ordinary reactive text slots (loop rows,
20
+ * conditional branches): every other kind of slot's SSR-rendered width is
21
+ * DATA-DEPENDENT — an ordinary `{item.name}` may render empty or non-empty
22
+ * per request, so a LATER sibling's absolute child-index path would only be
23
+ * valid for the specific width THIS request happened to produce, not for
24
+ * every request the compiled function ever serves. `/* @client *\/`
25
+ * expressions are the one case free of that problem: SSR can never evaluate
26
+ * client-only JS (the whole point of the escape valve), so its rendered
27
+ * width is deterministically ZERO on every request, for every adapter, with
28
+ * no data dependence at all. That determinism is what makes computing a
29
+ * real, reusable, hydration-safe path sound here without also solving the
30
+ * general "does an earlier sibling's width vary by request" problem.
31
+ *
32
+ * Path safety within that scope — the part that generalizes A3's
33
+ * `computeSkeletonSlotPaths` (`html-template.ts`) rather than reinventing
34
+ * it: paths are root-relative child-index chains, exactly like that
35
+ * function's, walked in document order with the SAME "once we hit something
36
+ * whose contributed width isn't a compile-time constant, every remaining
37
+ * sibling AND everything nested inside it loses eligibility" rule (nested
38
+ * content reached only through an uncertain-index sibling would resolve an
39
+ * absolute path through that uncertain index — silently wrong, not loud, so
40
+ * it must never be attempted). Concretely, walking a children list left to
41
+ * right:
42
+ * - a static `element` always contributes exactly one node — recurse into
43
+ * its own children as an independent, freshly-indexed scope (its own
44
+ * internal accounting can't leak out, and nothing external can poison
45
+ * it either, since the element itself is a fixed anchor regardless of
46
+ * what's inside it);
47
+ * - static `text` contributes a node per HTML-parser text-run-merging
48
+ * rules (adjacent text/expression children collapse into ONE Text
49
+ * node — mirrors `computeSkeletonSlotPaths`'s `pendingText` tracking);
50
+ * - a `clientOnly` expression with a slotId is the one ELIGIBLE case,
51
+ * PROVIDED it is not itself part of a merged text run (rule (i) — the
52
+ * `/* @client *\/` slot must not be immediately adjacent, once markers
53
+ * are gone, to loose text or another expression, or the HTML parser
54
+ * would merge them into one Text node with no way to tell which
55
+ * content is which). Once one is elided, this level (and everything
56
+ * nested inside any later sibling) is marked ineligible for the
57
+ * remainder of the walk at this level — see the "freeze" note below;
58
+ * - any other `expression` (a real reactive/static text or markup slot),
59
+ * any `conditional`/`loop`/`component`/`async`/`provider`/
60
+ * `if-statement`/`slot` node, is data-dependent or opaque width and
61
+ * FREEZES the rest of this children list (see below) — this is
62
+ * strictly conservative: it also means a `/* @client *\/` expression
63
+ * is never eligible once any of these appears earlier at the same
64
+ * level, even though `/* @client *\/`'s own width is always zero,
65
+ * because SIBLINGS reached only via nested recursion past that point
66
+ * would otherwise resolve an absolute path through the frozen node's
67
+ * uncertain contributed width;
68
+ * - the same hazard-tag / force-close-group / void-element / `<tr>`
69
+ * foster-parenting guards `computeSkeletonSlotPaths` uses (imported,
70
+ * not re-derived) abort the ENTIRE walk (a global bail, exactly like
71
+ * that function's `state.bailed`) — a parser hazard means every index
72
+ * computed anywhere in this tree is suspect, not just the ones near
73
+ * the hazard, so "don't guess" means don't guess about the blast
74
+ * radius either.
75
+ *
76
+ * "Freeze" (the one simplification versus a maximally-precise per-branch
77
+ * eligibility tracker): once ANY `/* @client *\/` slot at a given level is
78
+ * elided — OR once anything data-dependent/opaque is seen at that level —
79
+ * that level's remaining siblings (and anything nested only through them)
80
+ * stop being assigned real paths for the rest of THIS walk, even though a
81
+ * maximally precise analysis could sometimes still find one. This caps
82
+ * elision at (at most) one `/* @client *\/` slot per static subtree —
83
+ * conservative by design, matching the elision rule's own framing, and it
84
+ * guarantees two elided slots can never end up needing an insertion whose
85
+ * reference node depends on the other's still-unresolved width. Freezing is
86
+ * PER CHILDREN-LIST (an element's own children start a fresh, unfrozen
87
+ * scope) — global-bail is reserved for hazard tags alone.
88
+ *
89
+ * Deferred (loudly, not silently): ordinary reactive text slots in loop
90
+ * rows / conditional branches keep their markers — see above for why
91
+ * widening this to data-dependent-width content needs a materially
92
+ * different (and per-adapter-verified) safety argument that this PR does
93
+ * not attempt.
94
+ */
95
+ import type { IRNode } from '../types.ts';
96
+ /**
97
+ * Entry point: mutates `root`'s `expression` nodes in place, setting
98
+ * `markerless`/`elidedPath` on every eligible `/* @client *\/` slot found.
99
+ * Safe to call on any component's render tree; a tree with none simply
100
+ * mutates nothing.
101
+ */
102
+ export declare function decideClientOnlyElision(root: IRNode): void;
103
+ //# sourceMappingURL=client-only-elision.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-only-elision.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/client-only-elision.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6FG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAgB,MAAM,aAAa,CAAA;AAmBvD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"collect-elements.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/collect-elements.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAoC,KAAK,MAAM,EAAmC,MAAM,aAAa,CAAA;AACzH,OAAO,KAAK,EAAE,eAAe,EAA+H,iBAAiB,EAA0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;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,eAAe,EACpB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EACrC,iBAAiB,UAAQ,GACxB,IAAI,CAmSN;AAuYD;;;;;;;;;;GAUG;AAEH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,GAAG,EAAE,eAAe,EACpB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EACrC,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,SAAS,OAAO,aAAa,EAAE,gBAAgB,EAAE,GAAG,SAAS,GAC/E,iBAAiB,CAenB;AAED,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,eAAe,EACpB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EACrC,SAAS,CAAC,EAAE,MAAM,EAClB,iBAAiB,CAAC,EAAE,SAAS,OAAO,aAAa,EAAE,gBAAgB,EAAE,GACpE,oBAAoB,EAAE,CA4DxB"}
@@ -14,10 +14,16 @@
14
14
  * Replaces the legacy `emitBranchLoopBody` + `emitBranchLoopEventDelegation`
15
15
  * pair.
16
16
  */
17
- import type { CompositeLoopPlan, LoopChildRefBinding } from './loop.ts';
17
+ import type { CompositeLoopPlan, LoopChildRefBinding, PreambleRegionPlan } from './loop.ts';
18
18
  import type { EventDelegationPlan } from './event-delegation.ts';
19
19
  import type { ReactiveEffectsPlan } from './reactive-effects.ts';
20
20
  export interface BranchPlainLoopPlan {
21
+ /**
22
+ * flatMap descriptor mode — see `PlainLoopVariant.flatMapLeafItem`
23
+ * (plan/loop.ts): `arrayExpr` already flattens through the descriptor
24
+ * body and the stringifier emits the build-or-patch renderItem.
25
+ */
26
+ flatMapLeafItem?: boolean;
21
27
  kind: 'plain';
22
28
  /** See LoopPlanCommon.rowConstruction — required on every variant. */
23
29
  rowConstruction: 'string-template' | 'dom-ops';
@@ -76,6 +82,11 @@ export interface BranchPlainLoopPlan {
76
82
  * Undefined off → byte-identical (SR8).
77
83
  */
78
84
  profileLoopId?: string;
85
+ /**
86
+ * Preamble-patched regions (#2389) — non-empty forces the multi-line
87
+ * renderItem layout, mirroring the top-level plain plan.
88
+ */
89
+ preambleRegions: readonly PreambleRegionPlan[];
79
90
  }
80
91
  export interface BranchCompositeLoopPlan {
81
92
  kind: 'composite';
@@ -1 +1 @@
1
- {"version":3,"file":"branch-loop.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/plan/branch-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAEhE,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAA;IACb,sEAAsE;IACtE,eAAe,EAAE,iBAAiB,GAAG,SAAS,CAAA;IAC9C;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAA;IACvB,0EAA0E;IAC1E,YAAY,EAAE,MAAM,CAAA;IACpB,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAA;IAChB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAA;IACjB,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,mEAAmE;IACnE,SAAS,EAAE,MAAM,CAAA;IACjB,sEAAsE;IACtE,WAAW,EAAE,MAAM,CAAA;IACnB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAA;IAClB;;;;;;;;OAQG;IACH,kBAAkB,EAAE,MAAM,CAAA;IAC1B,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,eAAe,EAAE,mBAAmB,GAAG,IAAI,CAAA;IAC3C,+DAA+D;IAC/D,eAAe,EAAE,mBAAmB,CAAA;IACpC;;;;OAIG;IACH,SAAS,EAAE,SAAS,mBAAmB,EAAE,CAAA;IACzC;;;OAGG;IACH,eAAe,EAAE,OAAO,CAAA;IACxB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,WAAW,CAAA;IACjB,4DAA4D;IAC5D,SAAS,EAAE,iBAAiB,CAAA;IAC5B,0DAA0D;IAC1D,eAAe,EAAE,MAAM,CAAA;IACvB,0EAA0E;IAC1E,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,MAAM,cAAc,GAAG,mBAAmB,GAAG,uBAAuB,CAAA"}
1
+ {"version":3,"file":"branch-loop.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/plan/branch-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAC3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAEhE,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,IAAI,EAAE,OAAO,CAAA;IACb,sEAAsE;IACtE,eAAe,EAAE,iBAAiB,GAAG,SAAS,CAAA;IAC9C;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAA;IACvB,0EAA0E;IAC1E,YAAY,EAAE,MAAM,CAAA;IACpB,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAA;IAChB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAA;IACjB,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,mEAAmE;IACnE,SAAS,EAAE,MAAM,CAAA;IACjB,sEAAsE;IACtE,WAAW,EAAE,MAAM,CAAA;IACnB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAA;IAClB;;;;;;;;OAQG;IACH,kBAAkB,EAAE,MAAM,CAAA;IAC1B,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,eAAe,EAAE,mBAAmB,GAAG,IAAI,CAAA;IAC3C,+DAA+D;IAC/D,eAAe,EAAE,mBAAmB,CAAA;IACpC;;;;OAIG;IACH,SAAS,EAAE,SAAS,mBAAmB,EAAE,CAAA;IACzC;;;OAGG;IACH,eAAe,EAAE,OAAO,CAAA;IACxB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;OAGG;IACH,eAAe,EAAE,SAAS,kBAAkB,EAAE,CAAA;CAC/C;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,WAAW,CAAA;IACjB,4DAA4D;IAC5D,SAAS,EAAE,iBAAiB,CAAA;IAC5B,0DAA0D;IAC1D,eAAe,EAAE,MAAM,CAAA;IACvB,0EAA0E;IAC1E,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,MAAM,cAAc,GAAG,mBAAmB,GAAG,uBAAuB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"build-branch-loop.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/plan/build-branch-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAOhD,OAAO,KAAK,EAEV,cAAc,EAEf,MAAM,kBAAkB,CAAA;AAEzB,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,EAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,cAAc,CAwDnG"}
1
+ {"version":3,"file":"build-branch-loop.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/plan/build-branch-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAOhD,OAAO,KAAK,EAEV,cAAc,EAEf,MAAM,kBAAkB,CAAA;AAEzB,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,EAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,cAAc,CAgEnG"}
@@ -1 +1 @@
1
- {"version":3,"file":"build-event-delegation.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/plan/build-event-delegation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAG9E,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,YAAY,CAAA;AAEnB,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,YAAY,EAClB,oBAAoB,CAAC,EAAE,MAAM,GAC5B,mBAAmB,CAuBrB;AAKD,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,UAAU,EAChB,EAAE,EAAE,MAAM,EACV,oBAAoB,CAAC,EAAE,MAAM,GAC5B,mBAAmB,CAoBrB;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,YAAY,EAClB,oBAAoB,CAAC,EAAE,MAAM,GAC5B,mBAAmB,CAsBrB;AA0CD,YAAY,EAAE,cAAc,EAAE,CAAA"}
1
+ {"version":3,"file":"build-event-delegation.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/plan/build-event-delegation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAG9E,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,Y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 {"version":3,"file":"build-loop.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/plan/build-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EACV,YAAY,EAEb,MAAM,gBAAgB,CAAA;AAmBvB,OAAO,KAAK,EACV,QAAQ,EACR,aAAa,EAEb,cAAc,EACf,MAAM,YAAY,CAAA;AAEnB,qDAAqD;AACrD,MAAM,WAAW,oBAAoB;IACnC,8FAA8F;IAC9F,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC7B,qFAAqF;IACrF,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,oBAAoB,GAAG,QAAQ,CAsBtF;AAED,qFAAqF;AACrF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,EAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,aAAa,CA6EnG;AAED,0CAA0C;AAC1C,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,YAAY,EAAE,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,cAAc,CAmCpI"}
@@ -59,8 +59,19 @@ export interface KeyedItemLookup {
59
59
  * decision.
60
60
  */
61
61
  keyWithItem: string;
62
- /** Optional preamble line — emitted before the handler call. */
62
+ /** Optional preamble line — emitted before the handler call, inside the item guard. */
63
63
  mapPreamble: string | null;
64
+ /**
65
+ * `const`/`let`/function names `mapPreamble` declares (from
66
+ * `MapCallbackPreamble.declaredNames`). The stringifier only splices
67
+ * `mapPreamble` for an event whose handler text actually references one of
68
+ * these — a preamble that only feeds unused local state (e.g. a `cells`
69
+ * array builder never read by the click handler) is dead weight the
70
+ * delegated handler shouldn't pay for, and emitting it unconditionally is
71
+ * what let BUG-3's stale-context leaf render go unnoticed. Empty when
72
+ * `mapPreamble` is `null`.
73
+ */
74
+ mapPreambleDeclaredNames: readonly string[];
64
75
  /** True when `paramBindings` is non-empty — drives TDZ-safe lookup shape. */
65
76
  hasBindings: boolean;
66
77
  }
@@ -69,6 +80,8 @@ export interface DynamicIndexItemLookup {
69
80
  arrayExpr: string;
70
81
  param: string;
71
82
  mapPreamble: string | null;
83
+ /** See `KeyedItemLookup.mapPreambleDeclaredNames`. */
84
+ mapPreambleDeclaredNames: readonly string[];
72
85
  hasBindings: boolean;
73
86
  /** Loop index param name — see `KeyedItemLookup.indexParam` (#2189). */
74
87
  indexParam: string | null;
@@ -78,6 +91,8 @@ export interface StaticIndexItemLookup {
78
91
  arrayExpr: string;
79
92
  param: string;
80
93
  mapPreamble: string | null;
94
+ /** See `KeyedItemLookup.mapPreambleDeclaredNames`. */
95
+ mapPreambleDeclaredNames: readonly string[];
81
96
  /** Loop index param name — see `KeyedItemLookup.indexParam` (#2189). */
82
97
  indexParam: string | null;
83
98
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"event-delegation.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/plan/event-delegation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE9E;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,kBAAkB,CAAA;IACxB,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,UAAU,EAAE,UAAU,CAAA;IACtB;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAClB,eAAe,GACf,sBAAsB,GACtB,qBAAqB,CAAA;AAEzB,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,CAAA;IACb,+BAA+B;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,wFAAwF;IACxF,KAAK,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,sFAAsF;IACtF,aAAa,EAAE,YAAY,CAAC,eAAe,CAAC,CAAA;IAC5C;;;;;OAKG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB,gEAAgE;IAChE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,6EAA6E;IAC7E,WAAW,EAAE,OAAO,CAAA;CACrB;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,eAAe,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,WAAW,EAAE,OAAO,CAAA;IACpB,wEAAwE;IACxE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,cAAc,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,wEAAwE;IACxE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB;;;;;OAKG;IACH,MAAM,EAAE,UAAU,GAAG,IAAI,CAAA;CAC1B"}
1
+ {"version":3,"file":"event-delegation.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/plan/event-delegation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE9E;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,kBAAkB,CAAA;IACxB,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,UAAU,EAAE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B;;;;;OAKG;IACH,MAAM,EAAE,UAAU,GAAG,IAAI,CAAA;CAC1B"}
@@ -69,6 +69,18 @@ interface DynamicLoopCommon extends LoopPlanCommon {
69
69
  /** Statement to unwrap a destructured param at body entry. Empty when not needed. */
70
70
  paramUnwrap: string;
71
71
  }
72
+ /**
73
+ * A resolved preamble-patched region (#2389), ready to emit: `valueExpr` is
74
+ * already wrapped with the loop-param accessor and, for a `joinArrayChild`
75
+ * source, already carries the array-join ternary — the exact value
76
+ * `irToHtmlTemplate` computes for the same node in the row template, so a
77
+ * same-key update's re-patch stays byte-identical to what a fresh mount
78
+ * would render.
79
+ */
80
+ export interface PreambleRegionPlan {
81
+ slotId: string;
82
+ valueExpr: string;
83
+ }
72
84
  /** Per-item ref callback resolved against a child slot for emission (#1244). */
73
85
  export interface LoopChildRefBinding {
74
86
  /** bf slot ID of the target element (root or descendant of the body). */
@@ -136,6 +148,21 @@ interface PlainLoopVariant extends DynamicLoopCommon {
136
148
  * Empty when the loop has no key (only meaningful when `anchored`).
137
149
  */
138
150
  anchorKeyExpr: string;
151
+ /**
152
+ * flatMap descriptor mode (`LoopCore.flatMapClient`): `arrayExpr` already
153
+ * includes the `.flatMap(params => descriptorBody)` projection — the
154
+ * runtime reconciles the FLATTENED `({ k, h })` leaves — and `keyFn` keys
155
+ * on `d.k` (index fallback). The stringifier emits the build-or-patch
156
+ * renderItem (`patchLeaf`) instead of the template-clone shape; `template`
157
+ * is empty and `mapPreambleWrapped` unused in this mode.
158
+ */
159
+ flatMapLeafItem?: boolean;
160
+ /**
161
+ * Preamble-patched regions (#2389) — non-empty forces the multi-line
162
+ * renderItem layout (mirrors `childRefs`) so the region-patch effects have
163
+ * `__el` to query against.
164
+ */
165
+ preambleRegions: readonly PreambleRegionPlan[];
139
166
  }
140
167
  /**
141
168
  * Loop body is a single child component (with or without nested child
@@ -1 +1 @@
1
- {"version":3,"file":"loop.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/plan/loop.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cAAc,GAAG,OAAO,CAAC,QAAQ,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAA;AAElE;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,MAAM,CAAA;IACrB,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAA;IAChB,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAA;IACjB,+EAA+E;IAC/E,kBAAkB,EAAE;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;CACvD;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,oFAAoF;IACpF,YAAY,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,eAAe,EAAE,OAAO,CAAA;CACzB"}
1
+ {"version":3,"file":"loop.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/plan/loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,YAAY,EACb,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAErD,iDAAiD;AACjD,UAAU,cAAc;IACtB,uFAAuF;IACvF,YAAY,EAAE,MAAM,CAAA;IACpB,kGAAkG;IAClG,SAAS,EAAE,MAAM,CAAA;IACjB,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAA;IAClB;;;;;;;;OAQG;IACH,SAAS,EAAE,SAAS,mBAAmB,EAAE,CAAA;IACzC;;;;;;;;;;OAUG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YAAY,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,eAAe,EAAE,OAAO,CAAA;CACzB"}
@@ -13,9 +13,10 @@
13
13
  */
14
14
  import type { LoopChildEvent, LoopChildRef, TopLevelLoop, NestedLoop, CollectedLoop } from '../types.ts';
15
15
  import type { IRLoopChildComponent, LoopParamBinding } from '../../types.ts';
16
- import type { LoopChildRefBinding } from './plan/loop.ts';
16
+ import type { LoopChildRefBinding, PreambleRegionPlan } from './plan/loop.ts';
17
+ import type { PreambleRegionSource } from '../../types.ts';
17
18
  /**
18
- * Build the `keyFn` argument for mapArray / reconcileElements. `null` when
19
+ * Build the `keyFn` argument for mapArray / mapArrayAnchored. `null` when
19
20
  * the loop has no key expression. Every `CollectedLoop` variant (top-level /
20
21
  * branch / nested) carries an `index: string | null` field (#2218 threaded
21
22
  * it onto `NestedLoop` too), so the index param — when present — is always
@@ -115,6 +116,16 @@ export declare function destructureLoopParam(param: string, paramBindings?: read
115
116
  head: string;
116
117
  unwrap: string;
117
118
  };
119
+ /**
120
+ * Resolve `IRLoop.preambleRegions` (#2389) into ready-to-emit
121
+ * `PreambleRegionPlan`s: wrap each source expression with the loop-param
122
+ * accessor and, for a `joinArrayChild` source, apply the same array-join
123
+ * ternary `irToHtmlTemplate` uses for the identical node in the row
124
+ * template — so the region-patch effect's re-render matches what a fresh
125
+ * mount would have produced. Shared by the top-level (`build-loop.ts`) and
126
+ * branch (`build-branch-loop.ts`) plain-loop-plan builders.
127
+ */
128
+ export declare function buildPreambleRegionPlans(regions: readonly PreambleRegionSource[] | undefined, loopParam: string, loopParamBindings: readonly LoopParamBinding[] | undefined): readonly PreambleRegionPlan[];
118
129
  /**
119
130
  * Build a props object expression string from component prop definitions.
120
131
  * Shared by emitComponentLoopReconciliation and emitCompositeElementReconciliation.
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/ir-to-client-js/control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E,UAAU,GAAG,IAAI,CAAA;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,UAAU,EAAE,EACxB,WAAW,EAAE,oBAAoB,EAAE,EACnC,WAAW,EAAE,cAAc,EAAE,GAC5B,UAAU,EAAE,CAkBd;AAgBD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAIxF;AAED;;;;;;GAMG;AACH,oFAAoF;AACpF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,OAAO,CAKvF;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,EAAE,EAAE,MAAM,EAAE,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,YAAY,CAAC,kBAAkB,CAAC,GAAG,EAAE,EAC5C,MAAM,EAAE,cAAc,EAAE,EACxB,SAAS,CAAC,EAAE,MAAM,EAClB,iBAAiB,CAAC,EAAE,SAAS,gBAAgB,EAAE,EAC/C,eAAe,GAAE,OAAe,GAC/B,IAAI,CAuCN;AAED;;;;GAIG"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Claim-plan literal rendering — the compiler-side half of slot unification
3
+ * A3 (`spec/slot-unification.md` §4/§5-A3). The runtime's `SlotSpec`/
4
+ * `ClaimPlan` (`@barefootjs/client/runtime/claim-slots.ts`, A2) are pure
5
+ * data: `{ id, kind, path }` triples. This module is the single place that
6
+ * turns compile-time slot descriptors into that data's source-text form —
7
+ * every content-slot emission site (loop rows, preamble regions, dynamic
8
+ * text/JSX slots, `@client` expressions) renders its plan through
9
+ * `claimPlanLiteral`, never by hand-splicing strings, so the literal shape
10
+ * can only ever match `SlotSpec`.
11
+ *
12
+ * Paths are real root-relative child-index arrays wherever the caller
13
+ * already has them (the hoisted single-root loop skeleton, #2143's
14
+ * `SkeletonSlotPaths`); everywhere else a slot gets `path: []` and A2's
15
+ * `lazySlots`/`claimSlots` marker-scan fallback resolves it — sound, just a
16
+ * per-claim scan instead of an O(depth) walk. This is the explicit
17
+ * "cannot be statically pathed" escape valve `spec/slot-unification.md`
18
+ * §5-A3 sanctions, not a shortcut invented here.
19
+ */
20
+ export interface ClaimSlotSpec {
21
+ readonly id: string;
22
+ readonly kind: 'text' | 'markup';
23
+ /** Root-relative child-index path, used when the path is unconditionally
24
+ * valid at claim time. Ignored when `pathExpr` is set. */
25
+ readonly path: readonly number[];
26
+ /**
27
+ * Raw JS expression (already rendered source text) evaluating to a
28
+ * `number[]` at runtime, for the one case a plain literal can't express:
29
+ * a hoisted-skeleton path that's valid ONLY on the fresh-CSR-clone branch,
30
+ * never on the hydration-adopts-SSR branch (#2143 precedent — `__p` is
31
+ * nulled when `__existing` is truthy because the skeleton's simplified
32
+ * markup doesn't describe the real SSR-rendered tree). Typically
33
+ * `__existing ? [] : [1, 0]`. Overrides `path` when present.
34
+ */
35
+ readonly pathExpr?: string;
36
+ /**
37
+ * Slot unification Step B (`spec/slot-unification.md` §3(b), §5 Step B):
38
+ * true when NO marker was emitted for this slot — `path`'s last index is
39
+ * the slot's own position, not an anchor comment. Only ever set by
40
+ * `client-only-elision.ts`-derived callers; every other emission site
41
+ * omits it (falsy = today's marker-based behavior, unchanged).
42
+ */
43
+ readonly markerless?: boolean;
44
+ }
45
+ /** Render a `ClaimPlan` (an array of `SlotSpec`) as a source-text array literal. */
46
+ export declare function claimPlanLiteral(slots: readonly ClaimSlotSpec[]): string;
47
+ /**
48
+ * A stable JS identifier for the claimed-slot writer covering `slots`,
49
+ * derived from the first slot's id. Slot ids are unique per component (the
50
+ * `bf="sN"` marker namespace), so this can never collide across two
51
+ * distinct claim-plan call sites within the same emitted component.
52
+ */
53
+ export declare function claimWriterVarName(slots: readonly ClaimSlotSpec[], sanitize: (id: string) => string): string;
54
+ //# sourceMappingURL=claim-plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim-plan.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/stringify/claim-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAA;IAChC;+DAC2D;IAC3D,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IAChC;;;;;;;;OAQG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAC9B;AASD,oFAAoF;AACpF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,CAExE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAG5G"}
@@ -1 +1 @@
1
- {"version":3,"file":"event-delegation.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/stringify/event-delegation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAIH,OAAO,KAAK,EACV,mBAAmB,EAKpB,MAAM,kBAAkB,CAAA;AAkCzB,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAmDzF"}
1
+ {"version":3,"file":"event-delegation.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/stringify/event-delegation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAIH,OAAO,KAAK,EACV,mBAAmB,EAKpB,MAAM,kBAAkB,CAAA;AAsDzB,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAmDzF"}
@@ -1 +1 @@
1
- {"version":3,"file":"inner-loop.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/stringify/inner-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAOH,OAAO,KAAK,EAEV,cAAc,EACf,MAAM,uBAAuB,CAAA;AAE9B,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,MAAM,EACd,EAAE,CAAC,EAAE,MAAM,GACV,IAAI,CAQN"}
1
+ {"version":3,"file":"inner-loop.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/stringify/inner-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAQH,OAAO,KAAK,EAEV,cAAc,EACf,MAAM,uBAAuB,CAAA;AAE9B,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,MAAM,EACd,EAAE,CAAC,EAAE,MAAM,GACV,IAAI,CAQN"}
@@ -1 +1 @@
1
- {"version":3,"file":"insert.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/stringify/insert.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAgC,MAAM,kBAAkB,CAAA;AAKhF,MAAM,WAAW,sBAAsB;IACrC,2CAA2C;IAC3C,aAAa,EAAE,MAAM,CAAA;IACrB,yEAAyE;IACzE,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,sBAAsB,GAC3B,IAAI,CAgBN"}
1
+ {"version":3,"file":"insert.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/stringify/insert.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAgC,MAAM,kBAAkB,CAAA;AAMhF,MAAM,WAAW,sBAAsB;IACrC,2CAA2C;IAC3C,aAAa,EAAE,MAAM,CAAA;IACrB,yEAAyE;IACzE,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,sBAAsB,GAC3B,IAAI,CAgBN"}
@@ -1 +1 @@
1
- {"version":3,"file":"loop-child-arm.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/stringify/loop-child-arm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,OAAO,KAAK,EACV,6BAA6B,EAC7B,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAEnE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE,SAAS,gBAAgB,EAAE,EACjC,MAAM,EAAE,MAAM,EACd,EAAE,CAAC,EAAE,MAAM,GACV,IAAI,CAcN;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE,uBAAuB,EAC7B,MAAM,EAAE,MAAM,GACb,IAAI,CAYN;AAED;;;;;;;;GAQG;AACH,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE,6BAA6B,EACnC,MAAM,EAAE,MAAM,GACb,IAAI,CAIN;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE,oBAAoB,EAC1B,MAAM,EAAE,MAAM,EACd,EAAE,CAAC,EAAE,MAAM,GACV,IAAI,CAmDN;AAED;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,MAAM,EAAE,EACf,YAAY,EAAE,SAAS,wBAAwB,EAAE,EACjD,MAAM,EAAE,MAAM,EACd,EAAE,CAAC,EAAE,MAAM,GACV,IAAI,CAIN;AA0BD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EAAE,EACf,GAAG,EAAE,gBAAgB,EACrB,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,MAAM,GAAG,SAAS,GACrB,IAAI,CAsCN"}
1
+ {"version":3,"file":"loop-child-arm.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/stringify/loop-child-arm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH,OAAO,KAAK,EACV,6BAA6B,EAC7B,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAEnE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE,SAAS,gBAAgB,EAAE,EACjC,MAAM,EAAE,MAAM,EACd,EAAE,CAAC,EAAE,MAAM,GACV,IAAI,CAcN;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE,uBAAuB,EAC7B,MAAM,EAAE,MAAM,GACb,IAAI,CAYN;AAED;;;;;;;;GAQG;AACH,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE,6BAA6B,EACnC,MAAM,EAAE,MAAM,GACb,IAAI,CAIN;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE,oBAAoB,EAC1B,MAAM,EAAE,MAAM,EACd,EAAE,CAAC,EAAE,MAAM,GACV,IAAI,CA0DN;AAED;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,MAAM,EAAE,EACf,YAAY,EAAE,SAAS,wBAAwB,EAAE,EACjD,MAAM,EAAE,MAAM,EACd,EAAE,CAAC,EAAE,MAAM,GACV,IAAI,CAIN;AA0BD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EAAE,EACf,GAAG,EAAE,gBAAgB,EACrB,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,MAAM,GAAG,SAAS,GACrB,IAAI,CAiDN"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Stringify LoopPlan variants to source lines.
3
3
  *
4
- * Output shapes (preserved byte-identical from the legacy emitter):
4
+ * Output shapes:
5
5
  *
6
6
  * PlainLoopPlan, no reactive effects (single-line renderItem):
7
7
  * <indent>mapArray(() => <arr>, <container>, <keyFn>, (<head>, <idx>, __existing) =>
@@ -12,13 +12,18 @@
12
12
  * <indent> <unwrap?>
13
13
  * <indent> <preamble?>
14
14
  * <indent> const __el = __existing ?? (() => { ... })()
15
- * <indent> <reactive effects via stringifyReactiveEffects>
15
+ * <indent> <reactive effects + preamble regions via stringifyReactiveEffects
16
+ * <indent> row-granularity (spec/slot-unification.md §3(c)): attrs, outer
17
+ * <indent> texts, and preamble regions merge into ONE createEffect per row
18
+ * <indent> in normal builds; profile-mode builds keep the legacy
19
+ * <indent> one-effect-per-slot shape (see that module's docstring)>
16
20
  * <indent> return __el
17
21
  * <indent>})
18
22
  *
19
23
  * StaticLoopPlan: two parallel forEach blocks (attrs / texts) — see
20
24
  * emitStaticLoop. The forEach-duplication noted in observation O-4 is
21
- * preserved bug-for-bug; PR 5+ collapses them.
25
+ * preserved bug-for-bug; PR 5+ collapses them. Left untouched by the
26
+ * row-granularity pass above — a different (forEach, not mapArray) shape.
22
27
  *
23
28
  * Indent convention for plain loops: top-level emission uses `' '` (2 sp);
24
29
  * passed in via `topIndent`.
@@ -42,6 +47,17 @@ export declare function emitLoopChildRefs(lines: string[], refs: readonly LoopCh
42
47
  bodyIsMultiRoot: boolean;
43
48
  elementIndexBySlot?: ReadonlyMap<string, number>;
44
49
  }): void;
50
+ /**
51
+ * Preamble-patched regions (#2389 — `arr.map(t => { const cells = []; ...;
52
+ * return <tr>{cells}<td>{t.name}</td></tr> })`) used to get their own
53
+ * per-region `createEffect` here. Row-granularity effects (perf,
54
+ * spec/slot-unification.md §3(c)/§8) merged that into the SAME single row
55
+ * effect `stringifyReactiveEffects` now emits for attrs/outer texts — see
56
+ * that module's docstring. Both plain-loop-row call sites
57
+ * (`stringifyPlainLoop` below, `stringify/branch-loop.ts`'s `emitPlain`) pass
58
+ * `preambleRegions`/`mapPreambleWrapped` straight into
59
+ * `stringifyReactiveEffects` instead of calling a separate emitter.
60
+ */
45
61
  /**
46
62
  * Single dispatch over `LoopPlan` (#1253). Narrows on `plan.kind` and
47
63
  * delegates to the per-variant stringifier. Callers should consume this
@@ -1 +1 @@
1
- {"version":3,"file":"loop.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/stringify/loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AASH,OAAO,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAE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;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAoBnE;AAYD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE,aAAa,EACnB,SAAS,GAAE,MAAa,GACvB,IAAI,CAyJN;AAoDD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI,CAkH/E"}
@@ -6,15 +6,46 @@
6
6
  * bodies (events, child component inits, inner loops, nested conditionals,
7
7
  * branch-scoped texts) flow through the per-arm stringifiers in
8
8
  * `loop-child-arm.ts` — no legacy passthrough remains.
9
+ *
10
+ * Row-granularity effects (perf, spec/slot-unification.md §3(c)/§8, the
11
+ * deferred A3b): for the "plain loop row, top-level or branch-scoped" shape
12
+ * — the only shape where `stringifyReactiveEffects` is called alongside
13
+ * `PreambleRegionPlan`s from the SAME renderItem scope (`stringify/loop.ts`'s
14
+ * `stringifyPlainLoop`, `stringify/branch-loop.ts`'s `emitPlain`) — reactive
15
+ * attrs, outer texts, and preamble regions all read the SAME per-item signal
16
+ * dependency, so consolidating them into ONE `createEffect` per row removes
17
+ * N-1 effect objects and subscription-list entries per row without changing
18
+ * the firing profile. Composite loops, component loops, and the anchored
19
+ * (whole-item-conditional) loop shape keep the legacy one-effect-per-slot
20
+ * emission — their reactiveEffects never carry preamble regions, and
21
+ * consolidating them wasn't part of this pass's mechanically-verified scope
22
+ * (see the call sites' docstrings).
23
+ *
24
+ * Profile mode (#1690) carries a `<Component>#binding:<slotId>` id per
25
+ * effect so the profiler attributes a re-run to its source binding — merging
26
+ * bindings into one effect would make every binding on the row share one id.
27
+ * Resolution: profile mode (`plan.profileComponentName` set) keeps the
28
+ * granular per-slot/per-attr effect emission (`emitAttrSlotsGranular` /
29
+ * `emitOuterTexts` below); normal builds get the consolidated row effect.
30
+ * Preamble regions never carried a per-region bfId even before this pass, so
31
+ * they always consolidate into one effect regardless of profile mode.
9
32
  */
10
33
  import type { ReactiveEffectsPlan } from '../plan/reactive-effects.ts';
34
+ /** A resolved preamble-patched region (#2389) ready to merge into the row
35
+ * effect — same shape as `plan/loop.ts`'s `PreambleRegionPlan`, restated
36
+ * here so this module doesn't need a cross-import into the loop plan file
37
+ * for one two-field shape. */
38
+ export interface RowPreambleRegion {
39
+ slotId: string;
40
+ valueExpr: string;
41
+ }
11
42
  export interface StringifyReactiveEffectsOptions {
12
43
  /** Indent prefix for every emitted line. */
13
44
  indent: string;
14
45
  /**
15
46
  * Element variable to attach effects to (e.g., `__el`, `__existing`,
16
47
  * `__csrEl`). The stringifier never inspects it — it is simply substituted
17
- * into the qsa() / $t() / insert() call shapes.
48
+ * into the qsa() / lazySlots() / insert() call shapes.
18
49
  */
19
50
  elVar: string;
20
51
  /**
@@ -33,8 +64,36 @@ export interface StringifyReactiveEffectsOptions {
33
64
  * still resolves through the battle-tested runtime lookup.
34
65
  */
35
66
  elementIndexBySlot?: ReadonlyMap<string, number>;
36
- /** Same as `elementIndexBySlot`, for text-marker slots (`$t`). */
37
- textIndexBySlot?: ReadonlyMap<string, number>;
67
+ /**
68
+ * Rendered path EXPRESSION source (not a plain array — see
69
+ * `ClaimSlotSpec.pathExpr`) for outer text slots, keyed by slotId: perf,
70
+ * #2143's hoisted single-root loop skeleton
71
+ * (`SkeletonSlotPaths.textMarkerPaths`), guarded by `__existing` the same
72
+ * way `__p` is nulled on the hydration branch (the skeleton's simplified
73
+ * markup doesn't describe the real SSR-rendered tree). Only
74
+ * `stringifyPlainLoop`'s hoisted-skeleton path supplies these; every other
75
+ * caller omits it and each text slot's claim-plan entry gets `path: []`
76
+ * — A2's marker-scan fallback resolves it at claim time (sound, just
77
+ * slower), per `spec/slot-unification.md` §5-A3's explicit "cannot be
78
+ * statically pathed" allowance.
79
+ */
80
+ textClaimPathExprs?: ReadonlyMap<string, string>;
81
+ /**
82
+ * Preamble-patched regions (#2389) to merge into the SAME row effect as
83
+ * this scope's reactive attrs/outer texts (row-granularity effects,
84
+ * §3(c)) — only supplied by the plain-loop-row call sites
85
+ * (`stringify/loop.ts`, `stringify/branch-loop.ts`) where
86
+ * `PlainLoopVariant.preambleRegions` exists on the plan. Every other
87
+ * caller omits this and gets the legacy per-slot emission untouched.
88
+ */
89
+ preambleRegions?: readonly RowPreambleRegion[];
90
+ /**
91
+ * The loop callback's pre-return preamble (already wrapped with the loop
92
+ * param accessor), re-run once per row-effect tick — BEFORE any preamble
93
+ * region read — so `preambleRegions`' `valueExpr`s see freshly recomputed
94
+ * locals. Only meaningful alongside `preambleRegions`.
95
+ */
96
+ mapPreambleWrapped?: string;
38
97
  }
39
- export declare function stringifyReactiveEffects(lines: string[], plan: ReactiveEffectsPlan, opts: StringifyReactiveEffectsOptions): void;
98
+ export declare function stringifyReactiveEffects(lines: string[], plan: ReactiveEffectsPlan | null, opts: StringifyReactiveEffectsOptions): void;
40
99
  //# sourceMappingURL=reactive-effects.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reactive-effects.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/stringify/reactive-effects.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAEV,mBAAmB,EAEpB,MAAM,6BAA6B,CAAA;AAEpC,MAAM,WAAW,+BAA+B;IAC9C,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChD,kEAAkE;IAClE,eAAe,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC9C;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE,mBAAmB,EACzB,IAAI,EAAE,+BAA+B,GACpC,IAAI,CAmCN"}
1
+ {"version":3,"file":"reactive-effects.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/stringify/reactive-effects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAMH,OAAO,KAAK,EAGV,mBAAmB,EAEpB,MAAM,6BAA6B,CAAA;AAEpC;;;+BAG+B;AAC/B,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,+BAA+B;IAC9C,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChD;;;;;;;;;;;;OAYG;IACH,kBAAkB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChD;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAA;IAC9C;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE,mBAAmB,GAAG,IAAI,EAChC,IAAI,EAAE,+BAA+B,GACpC,IAAI,CA8BN"}
@@ -4,7 +4,7 @@
4
4
  * These three functions are called from `generate-init.ts` to emit the
5
5
  * client-side runtime calls that drive reactive conditionals
6
6
  * (`insert(...)`) and reactive loops (`mapArray(...)` /
7
- * `reconcileElements`) for a single component.
7
+ * `mapArrayAnchored(...)`) for a single component.
8
8
  *
9
9
  * Each entry point thinly wraps the Plan layer:
10
10
  *
@@ -2,13 +2,18 @@
2
2
  * Element ref declarations — `const [_s0, _s1] = $(…, 's0', 's1')`.
3
3
  *
4
4
  * Every element the init body needs to find at hydration time (events,
5
- * dynamic text, loops, refs, reactive attrs, reactive props, rest-attr
6
- * elements, child component slots) is emitted via one of three finders:
5
+ * loops, refs, reactive attrs, reactive props, rest-attr elements, child
6
+ * component slots) is emitted via one of two finders:
7
7
  *
8
8
  * `$(…)` — regular DOM elements (bf-*)
9
- * `$t(…)` — text comment markers for dynamic text (`<!--bf:sN-->`)
10
9
  * `$c(…)` — component slots (bf-s, component-rooted)
11
10
  *
11
+ * Dynamic text/JSX content slots (`<!--bf:sN-->` markers) don't need a ref
12
+ * here at all — they resolve through a claimed-slot writer built where
13
+ * they're used (`emitDynamicTextUpdates`/`emitClientOnlyExpressions` in
14
+ * `ir-to-client-js/emit-reactive.ts`, slot unification A3), not a
15
+ * pre-resolved `_sN` var.
16
+ *
12
17
  * Slots inside conditional branches are excluded here because
13
18
  * `insert()` bindEvents re-queries them when the branch activates.
14
19
  * Component slots take precedence over regular slots (#360): when a