@barefootjs/jsx 0.35.5 → 0.35.7

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 (106) hide show
  1. package/dist/analyzer-context.d.ts +5 -4
  2. package/dist/analyzer-context.d.ts.map +1 -1
  3. package/dist/analyzer.d.ts.map +1 -1
  4. package/dist/errors.d.ts +0 -1
  5. package/dist/errors.d.ts.map +1 -1
  6. package/dist/index.js +6745 -6488
  7. package/dist/ir-to-client-js/compute-prop-usage.d.ts +6 -0
  8. package/dist/ir-to-client-js/compute-prop-usage.d.ts.map +1 -1
  9. package/dist/ir-to-client-js/control-flow/plan/build-event-delegation.d.ts +3 -2
  10. package/dist/ir-to-client-js/control-flow/plan/build-event-delegation.d.ts.map +1 -1
  11. package/dist/ir-to-client-js/control-flow/plan/build-loop.d.ts +12 -2
  12. package/dist/ir-to-client-js/control-flow/plan/build-loop.d.ts.map +1 -1
  13. package/dist/ir-to-client-js/control-flow/plan/event-collision.d.ts +40 -0
  14. package/dist/ir-to-client-js/control-flow/plan/event-collision.d.ts.map +1 -0
  15. package/dist/ir-to-client-js/control-flow/plan/event-delegation.d.ts +13 -0
  16. package/dist/ir-to-client-js/control-flow/plan/event-delegation.d.ts.map +1 -1
  17. package/dist/ir-to-client-js/control-flow/plan/loop-delegation-index.d.ts +45 -0
  18. package/dist/ir-to-client-js/control-flow/plan/loop-delegation-index.d.ts.map +1 -0
  19. package/dist/ir-to-client-js/control-flow/plan/types.d.ts +2 -0
  20. package/dist/ir-to-client-js/control-flow/plan/types.d.ts.map +1 -1
  21. package/dist/ir-to-client-js/control-flow/stringify/event-delegation.d.ts +12 -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.d.ts +2 -1
  24. package/dist/ir-to-client-js/control-flow.d.ts.map +1 -1
  25. package/dist/ir-to-client-js/emit-reactive.d.ts +7 -3
  26. package/dist/ir-to-client-js/emit-reactive.d.ts.map +1 -1
  27. package/dist/ir-to-client-js/generate-init.d.ts.map +1 -1
  28. package/dist/ir-to-client-js/html-template.d.ts.map +1 -1
  29. package/dist/ir-to-client-js/index.d.ts +1 -0
  30. package/dist/ir-to-client-js/index.d.ts.map +1 -1
  31. package/dist/ir-to-client-js/phases/event-handlers.d.ts +9 -1
  32. package/dist/ir-to-client-js/phases/event-handlers.d.ts.map +1 -1
  33. package/dist/ir-to-client-js/phases/props-event-handlers.d.ts +5 -0
  34. package/dist/ir-to-client-js/phases/props-event-handlers.d.ts.map +1 -1
  35. package/dist/ir-to-client-js/phases/props-extraction.d.ts +15 -13
  36. package/dist/ir-to-client-js/phases/props-extraction.d.ts.map +1 -1
  37. package/dist/ir-to-client-js/phases.d.ts +12 -1
  38. package/dist/ir-to-client-js/phases.d.ts.map +1 -1
  39. package/dist/ir-to-client-js/plan/build-declaration-emit.d.ts.map +1 -1
  40. package/dist/ir-to-client-js/prune-unused-prop-extractions.d.ts +50 -0
  41. package/dist/ir-to-client-js/prune-unused-prop-extractions.d.ts.map +1 -1
  42. package/dist/ir-to-client-js/rewrite-destructured-props.d.ts +29 -0
  43. package/dist/ir-to-client-js/rewrite-destructured-props.d.ts.map +1 -0
  44. package/dist/ir-to-client-js/utils.d.ts +9 -0
  45. package/dist/ir-to-client-js/utils.d.ts.map +1 -1
  46. package/dist/jsx-to-ir.d.ts.map +1 -1
  47. package/dist/prop-rewrite.d.ts.map +1 -1
  48. package/dist/props-binding.d.ts +123 -1
  49. package/dist/props-binding.d.ts.map +1 -1
  50. package/dist/ssr-defaults.d.ts.map +1 -1
  51. package/dist/static-literal.d.ts +20 -8
  52. package/dist/static-literal.d.ts.map +1 -1
  53. package/dist/types.d.ts +7 -0
  54. package/dist/types.d.ts.map +1 -1
  55. package/package.json +2 -2
  56. package/src/__tests__/__snapshots__/doc-examples.test.ts.snap +31 -35
  57. package/src/__tests__/aliased-destructured-prop-csr.test.ts +19 -7
  58. package/src/__tests__/body-destructured-prop-default-arrow.test.ts +142 -0
  59. package/src/__tests__/body-destructured-prop-default-propsparams.test.ts +153 -0
  60. package/src/__tests__/body-destructured-props-live.test.ts +245 -0
  61. package/src/__tests__/client-js-generation.test.ts +11 -4
  62. package/src/__tests__/client-only-date-lowering.test.ts +5 -2
  63. package/src/__tests__/destructured-from-props-localconst-value.test.ts +17 -6
  64. package/src/__tests__/destructured-props-live.test.ts +167 -0
  65. package/src/__tests__/doc-examples.test.ts +2 -4
  66. package/src/__tests__/event-delegation-container-collision-2930.test.ts +197 -0
  67. package/src/__tests__/format-error.test.ts +5 -3
  68. package/src/__tests__/issue-2960-multi-root-cond-same-tag.test.ts +141 -0
  69. package/src/__tests__/live-only-props.test.ts +160 -0
  70. package/src/__tests__/prop-references.test.ts +26 -17
  71. package/src/__tests__/props-destructuring.test.ts +6 -275
  72. package/src/__tests__/prune-unused-prop-extractions.test.ts +11 -5
  73. package/src/__tests__/signal-getter-not-called.test.ts +5 -0
  74. package/src/__tests__/ssr-defaults.test.ts +83 -0
  75. package/src/__tests__/staged-ir/02-shadow-guards.test.ts +12 -5
  76. package/src/__tests__/static-literal.test.ts +39 -4
  77. package/src/analyzer-context.ts +8 -7
  78. package/src/analyzer.ts +88 -89
  79. package/src/errors.ts +7 -8
  80. package/src/ir-to-client-js/compute-prop-usage.ts +19 -0
  81. package/src/ir-to-client-js/control-flow/plan/build-event-delegation.ts +5 -0
  82. package/src/ir-to-client-js/control-flow/plan/build-loop.ts +27 -11
  83. package/src/ir-to-client-js/control-flow/plan/event-collision.ts +55 -0
  84. package/src/ir-to-client-js/control-flow/plan/event-delegation.ts +13 -0
  85. package/src/ir-to-client-js/control-flow/plan/loop-delegation-index.ts +79 -0
  86. package/src/ir-to-client-js/control-flow/plan/types.ts +2 -0
  87. package/src/ir-to-client-js/control-flow/stringify/event-delegation.ts +50 -10
  88. package/src/ir-to-client-js/control-flow.ts +68 -31
  89. package/src/ir-to-client-js/emit-reactive.ts +12 -8
  90. package/src/ir-to-client-js/generate-init.ts +6 -0
  91. package/src/ir-to-client-js/html-template.ts +65 -9
  92. package/src/ir-to-client-js/index.ts +45 -3
  93. package/src/ir-to-client-js/phases/event-handlers.ts +10 -0
  94. package/src/ir-to-client-js/phases/props-event-handlers.ts +6 -0
  95. package/src/ir-to-client-js/phases/props-extraction.ts +29 -48
  96. package/src/ir-to-client-js/phases.ts +17 -3
  97. package/src/ir-to-client-js/plan/build-declaration-emit.ts +6 -5
  98. package/src/ir-to-client-js/prune-unused-prop-extractions.ts +31 -10
  99. package/src/ir-to-client-js/rewrite-destructured-props.ts +222 -0
  100. package/src/ir-to-client-js/utils.ts +14 -0
  101. package/src/jsx-to-ir.ts +96 -48
  102. package/src/prop-rewrite.ts +11 -0
  103. package/src/props-binding.ts +185 -6
  104. package/src/ssr-defaults.ts +10 -5
  105. package/src/static-literal.ts +21 -9
  106. package/src/types.ts +7 -0
@@ -22,4 +22,10 @@ initScopeConstants: readonly ConstantInfo[]): Map<string, PropUsage>;
22
22
  /** Convenience predicate: does this prop need a `{}` default in the
23
23
  * destructure to guard against `undefined.xxx` at runtime? */
24
24
  export declare function propHasPropertyAccess(u: PropUsage | undefined): boolean;
25
+ /**
26
+ * Which of `propNames` guard a conditional branch. A prop in this set must
27
+ * NOT get a `{}` fallback even when it has property access — `{}` is truthy,
28
+ * so the branch would always render when the caller omits the prop.
29
+ */
30
+ export declare function computePropsUsedAsConditions(ctx: Pick<ClientJsContext, 'conditionalElements' | 'clientOnlyConditionals'>, propNames: ReadonlySet<string>): Set<string>;
25
31
  //# sourceMappingURL=compute-prop-usage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compute-prop-usage.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/compute-prop-usage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAGjD,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,eAAe;AACpB;;;kCAGkC;AAClC,kBAAkB,EAAE,SAAS,YAAY,EAAE,GAC1C,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAoCxB;AAED;+DAC+D;AAC/D,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAGvE"}
1
+ {"version":3,"file":"compute-prop-usage.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/compute-prop-usage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAGjD,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,eAAe;AACpB;;;kCAGkC;AAClC,kBAAkB,EAAE,SAAS,YAAY,EAAE,GAC1C,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAoCxB;AAED;+DAC+D;AAC/D,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAGvE;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,qBAAqB,GAAG,wBAAwB,CAAC,EAC5E,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,GAC7B,GAAG,CAAC,MAAM,CAAC,CASb"}
@@ -10,13 +10,14 @@
10
10
  */
11
11
  import type { TopLevelLoop, BranchLoop, LoopChildEvent } from '../../types.ts';
12
12
  import type { EventDelegationPlan } from './types.ts';
13
- export declare function buildDynamicLoopDelegationPlan(elem: TopLevelLoop, profileComponentName?: string): EventDelegationPlan;
13
+ import type { ContainerOwnHandler } from './event-collision.ts';
14
+ export declare function buildDynamicLoopDelegationPlan(elem: TopLevelLoop, profileComponentName?: string, ownHandlers?: Map<string, ContainerOwnHandler>): EventDelegationPlan;
14
15
  export declare function buildBranchLoopDelegationPlan(loop: BranchLoop, cv: string, profileComponentName?: string): EventDelegationPlan;
15
16
  /**
16
17
  * Build a Plan for the static-array event-delegation block. Static arrays have
17
18
  * no `data-key` markers, so the lookup walks up to the container's direct
18
19
  * child and uses `indexOf` (with optional sibling offset).
19
20
  */
20
- export declare function buildStaticArrayDelegationPlan(elem: TopLevelLoop, profileComponentName?: string): EventDelegationPlan;
21
+ export declare function buildStaticArrayDelegationPlan(elem: TopLevelLoop, profileComponentName?: string, ownHandlers?: Map<string, ContainerOwnHandler>): EventDelegationPlan;
21
22
  export type { LoopChildEvent };
22
23
  //# sourceMappingURL=build-event-delegation.d.ts.map
@@ -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;AAI9E,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,YAAY,CAAA;AAEnB,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,YAAY,EAClB,oBAAoB,CAAC,EAAE,MAAM,GAC5B,mBAAmB,CA8BrB;AAKD,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,UAAU,EAChB,EAAE,EAAE,MAAM,EACV,oBAAoB,CAAC,EAAE,MAAM,GAC5B,mBAAmB,CAuBrB;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,YAAY,EAClB,oBAAoB,CAAC,EAAE,MAAM,GAC5B,mBAAmB,CAyBrB;AA6CD,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;AAI9E,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAE/D,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,YAAY,EAClB,oBAAoB,CAAC,EAAE,MAAM,EAC7B,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAC7C,mBAAmB,CA+BrB;AAKD,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,UAAU,EAChB,EAAE,EAAE,MAAM,EACV,oBAAoB,CAAC,EAAE,MAAM,GAC5B,mBAAmB,CAuBrB;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,YAAY,EAClB,oBAAoB,CAAC,EAAE,MAAM,EAC7B,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAC7C,mBAAmB,CA0BrB;AA6CD,YAAY,EAAE,cAAc,EAAE,CAAA"}
@@ -35,9 +35,19 @@ export interface BuildLoopPlanOptions {
35
35
  */
36
36
  lazyScope?: LazyRowScopeInfo;
37
37
  }
38
+ /** Which `LoopPlan` variant `buildLoopPlan` would build for a given loop. */
39
+ export type LoopVariantKind = 'plain' | 'static' | 'composite' | 'component';
38
40
  /**
39
- * The single public builder. Selects the variant via the decision tree
40
- * described above and returns the discriminated `LoopPlan`.
41
+ * Classify which variant `buildLoopPlan` would build for `elem`, without
42
+ * building it. Mirrors the decision tree below exactly — pulled out so a
43
+ * caller that only needs the classification (e.g. the event-delegation
44
+ * eligibility precompute, #2930) doesn't have to duplicate these predicates
45
+ * or pay for building the full `LoopPlan`.
46
+ */
47
+ export declare function classifyLoopKind(elem: TopLevelLoop): LoopVariantKind;
48
+ /**
49
+ * The single public builder. Dispatches via `classifyLoopKind` and returns
50
+ * the discriminated `LoopPlan`.
41
51
  */
42
52
  export declare function buildLoopPlan(elem: TopLevelLoop, opts: BuildLoopPlanOptions): LoopPlan;
43
53
  /** @internal — prefer `buildLoopPlan`. Exported for the branch-loop wrapper only. */
@@ -1 +1 @@
1
- {"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;AAcvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAIjE,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;IAC7B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAA;CAC7B;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,oBAAoB,GAAG,QAAQ,CAsBtF;AAED,qFAAqF;AACrF,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,YAAY,EAClB,oBAAoB,CAAC,EAAE,MAAM,EAC7B,SAAS,CAAC,EAAE,gBAAgB,GAC3B,aAAa,CAmGf;AAED,0CAA0C;AAC1C,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,YAAY,EAAE,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,cAAc,CAmCpI"}
1
+ {"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;AAcvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAIjE,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;IAC7B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAA;CAC7B;AAED,6EAA6E;AAC7E,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,CAAA;AAE5E;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,GAAG,eAAe,CAcpE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,oBAAoB,GAAG,QAAQ,CAYtF;AAED,qFAAqF;AACrF,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,YAAY,EAClB,oBAAoB,CAAC,EAAE,MAAM,EAC7B,SAAS,CAAC,EAAE,gBAAgB,GAC3B,aAAa,CAmGf;AAED,0CAA0C;AAC1C,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,YAAY,EAAE,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,cAAc,CAmCpI"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Find a container's own directly-authored event handler that collides with
3
+ * a `.map()` row's delegated dispatcher for the same DOM event (#2930).
4
+ *
5
+ * `.map()` rows compiled via delegation share their delegated listener's
6
+ * node with the loop's static container — the compiler registers ONE
7
+ * `addEventListener` on the container, resolving `event.target` back to a
8
+ * row. When the container ALSO carries its own handler for the same event,
9
+ * both end up as separate `addEventListener` calls on the identical DOM
10
+ * node, so a row's `stopPropagation()` can't stop the container's own
11
+ * handler: native DOM `stopPropagation()` only blocks bubbling to *other
12
+ * nodes*, never other listeners already registered on the *same* node.
13
+ *
14
+ * This is the one place that answers "does this container slot have its own
15
+ * handler for this event" — both `phases/event-handlers.ts` (which must
16
+ * suppress the direct listener when the answer is yes) and
17
+ * `control-flow.ts` (which must fold that handler into the delegated
18
+ * dispatcher instead) call it, rather than answering the question twice.
19
+ */
20
+ import type { InteractiveElement } from '../../types.ts';
21
+ export interface ContainerOwnHandler {
22
+ /** The container element's own slot id (used for profile-mode turn ids). */
23
+ slotId: string;
24
+ /** Original (pre-DOM-mapped) event name, e.g. 'contextmenu'. */
25
+ eventName: string;
26
+ handler: string;
27
+ }
28
+ /**
29
+ * Find the container's own handler for `domEventName`, if any.
30
+ *
31
+ * Returns `null` for a non-bubbling event (focus/blur/…) — those delegate
32
+ * in capture mode, and a container's own bubble-phase handler there only
33
+ * ever fires when the container itself is the event target, never for a
34
+ * descendant row, so there is no collision to resolve. Also returns `null`
35
+ * when `containerSlotId` lives inside a conditional branch — that slot's
36
+ * own handler (if any) is bound by `insert()`'s `bindEvents` in a separate
37
+ * scope this check doesn't cover.
38
+ */
39
+ export declare function findContainerOwnHandler(interactiveElements: InteractiveElement[], conditionalSlotIds: Set<string>, containerSlotId: string, domEventName: string): ContainerOwnHandler | null;
40
+ //# sourceMappingURL=event-collision.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-collision.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/plan/event-collision.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAGxD,MAAM,WAAW,mBAAmB;IAClC,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAA;IACd,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,mBAAmB,EAAE,kBAAkB,EAAE,EACzC,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,EAC/B,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,GACnB,mBAAmB,GAAG,IAAI,CAO5B"}
@@ -5,6 +5,7 @@
5
5
  * container variable and the per-event item-lookup strategy.
6
6
  */
7
7
  import type { LoopChildEvent, LoopOffset, TopLevelLoop } from '../../types.ts';
8
+ import type { ContainerOwnHandler } from './event-collision.ts';
8
9
  /**
9
10
  * Plan for a loop's event-delegation block. Covers three legacy emitters:
10
11
  * - `emitDynamicLoopEventDelegation` (top-level dynamic loop)
@@ -31,6 +32,18 @@ export interface EventDelegationPlan {
31
32
  * profiling is off, so the emitted dispatcher is unchanged (SR8).
32
33
  */
33
34
  profileComponentName?: string;
35
+ /**
36
+ * The container's own directly-authored handler(s) to invoke after this
37
+ * plan's delegated dispatch(es) run — and only if none of them called
38
+ * `stopPropagation()`/`stopImmediatePropagation()` (#2930). Keyed by DOM
39
+ * event name (the `eventsByName` grouping key the stringifier already
40
+ * builds). Populated only on the ONE delegation plan chosen as "last" for
41
+ * a given (container slot, DOM event) pair — see `LoopDelegationIndex`
42
+ * (`plan/loop-delegation-index.ts`) — so every other plan sharing that
43
+ * pair keeps emitting its listener byte-identical to before. `undefined`
44
+ * (the common case: no collision) keeps the emitted listener unchanged.
45
+ */
46
+ ownHandlers?: Map<string, ContainerOwnHandler>;
34
47
  }
35
48
  /**
36
49
  * How to look up the loop item from an event target. Each variant is the
@@ -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,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M,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,sDAAsD;IACtD,wBAAwB,EAAE,SAAS,MAAM,EAAE,CAAA;IAC3C,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;AAC9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAE/D;;;;;;;;;;;;;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;IAC7B;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAA;CAC/C;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,uFAAuF;IACvF,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B;;;;;;;;;OASG;IACH,wBAAwB,EAAE,SAAS,MAAM,EAAE,CAAA;IAC3C,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,sDAAsD;IACtD,wBAAwB,EAAE,SAAS,MAAM,EAAE,CAAA;IAC3C,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,sDAAsD;IACtD,wBAAwB,EAAE,SAAS,MAAM,EAAE,CAAA;IAC3C,wEAAwE;IACxE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB;;;;;OAKG;IACH,MAAM,EAAE,UAAU,GAAG,IAAI,CAAA;CAC1B"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Precompute which `.map()` loops will emit a delegated event listener for
3
+ * which (container slot, DOM event) pairs — the fact both the direct-handler
4
+ * phase and the loop-delegation phase need to agree on when a container also
5
+ * carries its own handler for the same event (#2930).
6
+ *
7
+ * Built once (independent of the phases that actually emit code, and before
8
+ * either of them runs — `event-handlers` precedes `loop-updates` in
9
+ * `phases.ts`) from `ClientJsContext.loopElements` alone, via
10
+ * `classifyLoopKind` — the same predicates `buildLoopPlan` uses, without
11
+ * building the full `LoopPlan`.
12
+ */
13
+ import type { TopLevelLoop } from '../../types.ts';
14
+ import { type LoopVariantKind } from './build-loop.ts';
15
+ export interface LoopDelegationIndex {
16
+ /**
17
+ * True when SOME loop under `containerSlotId` delegates `domEventName`.
18
+ * The direct listener in `phases/event-handlers.ts` must be suppressed
19
+ * whenever this is true, regardless of how many loops share the pair —
20
+ * only one of them (see `isLastDelegator`) actually invokes the
21
+ * container's own handler; the others must not also emit it separately.
22
+ */
23
+ isDelegated(containerSlotId: string, domEventName: string): boolean;
24
+ /**
25
+ * True when the loop at `loopIndex` (its position in `loopElements`,
26
+ * matching emission order) is the LAST loop delegating this pair. Only
27
+ * that loop's dispatcher can safely gate the container's own handler: an
28
+ * earlier delegated listener sharing the pair may still see a row call
29
+ * `stopPropagation()` after its own dispatch has already run and decided
30
+ * whether to fire the container's own handler.
31
+ */
32
+ isLastDelegator(containerSlotId: string, domEventName: string, loopIndex: number): boolean;
33
+ }
34
+ export declare function buildLoopDelegationIndex(loopElements: readonly TopLevelLoop[]): LoopDelegationIndex;
35
+ /**
36
+ * Which delegation builder (`control-flow.ts`'s `emitLoopEventDelegation`)
37
+ * would use for `elem`, or `null` if it doesn't delegate at all —
38
+ * `'component'`/`'composite'` loops' events ride on the child component's
39
+ * own event surface instead. The single shared gate so this index and the
40
+ * actual emission can't silently diverge (#2930 review) — previously each
41
+ * re-implemented the same `kind === 'static' && !childComponent` /
42
+ * `kind === 'plain' && !useElementReconciliation` check inline.
43
+ */
44
+ export declare function loopEventDelegationVariant(elem: TopLevelLoop, kind: LoopVariantKind): 'static' | 'dynamic' | null;
45
+ //# sourceMappingURL=loop-delegation-index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loop-delegation-index.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/plan/loop-delegation-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,gBAAgB,CAAA;AAElE,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAExE,MAAM,WAAW,mBAAmB;IAClC;;;;;;OAMG;IACH,WAAW,CAAC,eAAe,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAA;IACnE;;;;;;;OAOG;IACH,eAAe,CAAC,eAAe,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAA;CAC3F;AAED,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,SAAS,YAAY,EAAE,GAAG,mBAAmB,CAcnG;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,eAAe,GACpB,QAAQ,GAAG,SAAS,GAAG,IAAI,CAK7B"}
@@ -14,6 +14,7 @@
14
14
  * `CompositeLoopPlan`, `StaticLoopPlan`),
15
15
  * `NestedComponentInit`
16
16
  * event-delegation.ts — `EventDelegationPlan`, `ItemLookup` family
17
+ * event-collision.ts — `ContainerOwnHandler`
17
18
  *
18
19
  * This file lets callers continue to write
19
20
  * `import type { ... } from '../plan/types.ts'` without caring which file
@@ -24,5 +25,6 @@ export type { ReactiveEffectsPlan, ReactiveAttrSlot, ReactiveAttrEffect, Reactiv
24
25
  export type { InsertPlan, InsertArm, ArmBody, ArmEventBind, ArmRefBind, ArmChildComponentInit, ArmTextEffect, } from './insert.ts';
25
26
  export type { LoopPlan, PlainLoopPlan, ComponentLoopPlan, CompositeLoopPlan, StaticLoopPlan, StaticLoopMaterializePlan, NestedComponentInit, LoopChildRefBinding, } from './loop.ts';
26
27
  export type { EventDelegationPlan, ItemLookup, KeyedItemLookup, DynamicIndexItemLookup, StaticIndexItemLookup, } from './event-delegation.ts';
28
+ export type { ContainerOwnHandler } from './event-collision.ts';
27
29
  export type { ConditionalElement, LoopChildConditional, BranchLoop, LoopChildEvent, } from '../../types.ts';
28
30
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/plan/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC3C,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,uBAAuB,CAAA;AAC9B,YAAY,EACV,UAAU,EACV,SAAS,EACT,OAAO,EACP,YAAY,EACZ,UAAU,EACV,qBAAqB,EACrB,aAAa,GACd,MAAM,aAAa,CAAA;AACpB,YAAY,EACV,QAAQ,EACR,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,WAAW,CAAA;AAClB,YAAY,EACV,mBAAmB,EACnB,UAAU,EACV,eAAe,EACf,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,uBAAuB,CAAA;AAG9B,YAAY,EACV,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,EACV,cAAc,GACf,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ir-to-client-js/control-flow/plan/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC3C,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,uBAAuB,CAAA;AAC9B,YAAY,EACV,UAAU,EACV,SAAS,EACT,OAAO,EACP,YAAY,EACZ,UAAU,EACV,qBAAqB,EACrB,aAAa,GACd,MAAM,aAAa,CAAA;AACpB,YAAY,EACV,QAAQ,EACR,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,WAAW,CAAA;AAClB,YAAY,EACV,mBAAmB,EACnB,UAAU,EACV,eAAe,EACf,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,uBAAuB,CAAA;AAC9B,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAG/D,YAAY,EACV,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,EACV,cAAc,GACf,MAAM,gBAAgB,CAAA"}
@@ -30,6 +30,18 @@
30
30
  *
31
31
  * Each shape has a `hasBindings` variant that lands on a `__bfLoopItem`
32
32
  * sentinel before destructuring (#951 TDZ-safe).
33
+ *
34
+ * When `plan.ownHandlers` has an entry for the group's DOM event name
35
+ * (#2930 — the container itself also carries a directly-authored handler for
36
+ * this event), the shape above grows two additions, BOTH gated on
37
+ * `!__bfEvt.cancelBubble`: right after `<handlerCall>` (so a row's own
38
+ * `stopPropagation()` suppresses it), and again after the last event in the
39
+ * group (so a sibling `.map()` loop sharing this container/event — whose
40
+ * listener already ran, matched one of ITS rows, and called
41
+ * `stopPropagation()` — also suppresses it here, even though none of THIS
42
+ * loop's rows matched). A dispatch nothing has stopped (e.g. a click on the
43
+ * container's own background) still fires it, same as today's separate
44
+ * listener would.
33
45
  */
34
46
  import type { EventDelegationPlan } from '../plan/types.ts';
35
47
  export declare function stringifyEventDelegation(lines: string[], plan: EventDelegationPlan): void;
@@ -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;AAKH,OAAO,KAAK,EACV,mBAAmB,EAKpB,MAAM,kBAAkB,CAAA;AAsDzB,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAKH,OAAO,KAAK,EACV,mBAAmB,EAKpB,MAAM,kBAAkB,CAAA;AA+CzB,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAsFzF"}
@@ -20,6 +20,7 @@
20
20
  * control-flow.ts -> control-flow/{plan,stringify}/* -> legacy-helpers.ts
21
21
  */
22
22
  import type { ClientJsContext } from './types.ts';
23
+ import { type LoopDelegationIndex } from './control-flow/plan/loop-delegation-index.ts';
23
24
  /** Emit insert() calls for server-rendered reactive conditionals with branch configs. */
24
25
  export declare function emitConditionalUpdates(lines: string[], ctx: ClientJsContext): void;
25
26
  /** Emit insert() calls for client-only conditionals (not server-rendered). */
@@ -36,5 +37,5 @@ export declare function emitClientOnlyConditionals(lines: string[], ctx: ClientJ
36
37
  * - `'component' / 'composite'` → events ride on the component's own
37
38
  * event surface, no delegation pass needed
38
39
  */
39
- export declare function emitLoopUpdates(lines: string[], ctx: ClientJsContext, unsafeLocalNames: Set<string>): void;
40
+ export declare function emitLoopUpdates(lines: string[], ctx: ClientJsContext, unsafeLocalNames: Set<string>, conditionalSlotIds: Set<string>, loopDelegationIndex: LoopDelegationIndex): void;
40
41
  //# sourceMappingURL=control-flow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-flow.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/control-flow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,YAAY,CAAA;AAa/D,yFAAyF;AACzF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,eAAe,GAAG,IAAI,CAOlF;AAED,8EAA8E;AAC9E,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,eAAe,GAAG,IAAI,CAQtF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,eAAe,EAAE,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAmC1G"}
1
+ {"version":3,"file":"control-flow.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/control-flow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,YAAY,CAAA;AAa/D,OAAO,EAA8B,KAAK,mBAAmB,EAAE,MAAM,8CAA8C,CAAA;AAGnH,yFAAyF;AACzF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,eAAe,GAAG,IAAI,CAOlF;AAED,8EAA8E;AAC9E,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,eAAe,GAAG,IAAI,CAQtF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EAAE,EACf,GAAG,EAAE,eAAe,EACpB,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,EAC7B,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,EAC/B,mBAAmB,EAAE,mBAAmB,GACvC,IAAI,CAyCN"}
@@ -75,9 +75,13 @@ export declare function emitDedupedAttrUpdate(target: string, attrName: string,
75
75
  * or a name shadowed by an inner binding (`items.map((tag) => tag.x)`).
76
76
  * This function used to run its own `\btag\b`-style regex over the raw
77
77
  * expression text with no such distinction, so `queryHref(base, { tag: tag })`
78
- * rewrote the KEY too (`{ _p.tag: _p.tag }`, a syntax error) — #2741. Only
79
- * the default-value `(_p.x ?? <default>)` wrapping is specific to this call
80
- * site, supplied via `replacementFor` rather than a second copy of the walk.
78
+ * rewrote the KEY too (`{ _p.tag: _p.tag }`, a syntax error) — #2741.
79
+ *
80
+ * No `usage`/`usedAsCondition` is passed to `livePropReadExpr`: an attribute
81
+ * read is never a loop-array source or a conditional guard, so only the
82
+ * explicit destructure default applies here. The result survives the later
83
+ * whole-init-body rewrite (`rewriteDestructuredPropReads`) untouched — the
84
+ * `.name` slot of the `_p.x` it produces is a non-value position.
81
85
  */
82
86
  export declare function rewriteDestructuredPropsInExpr(expr: string, ctx: ClientJsContext): string;
83
87
  /** Emit createEffect blocks that update text nodes for reactive expressions. */
@@ -1 +1 @@
1
- {"version":3,"file":"emit-reactive.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/emit-reactive.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAc,MAAM,aAAa,CAAA;AAEvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AA0EjD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,EAAE,CAsC7G;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,mBAAmB,CAAA;AAEhD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,MAAM,EACf,KAAK,GAAE,MAAM,GAAG,IAA0B,GACzC,MAAM,EAAE,CAYV;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,eAAe,GAAG,M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E,MAAM,EAClB,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,MAAM,EACf,KAAK,GAAE,MAAM,GAAG,IAA0B,GACzC,MAAM,EAAE,CAYV;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,eAAe,GAAG,MAAM,CAyBzF;AAwMD,gFAAgF;AAChF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,eAAe,GAAG,IAAI,CAoFlF;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,eAAe,GAAG,IAAI,CAiBrF;AAED,kGAAkG;AAClG,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,eAAe,GAAG,IAAI,CAgCxF;AAED,+FAA+F;AAC/F,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,eAAe,GAAG,IAAI,CA2DpF;AAED,2FAA2F;AAC3F,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,eAAe,GAAG,IAAI,CAiDlF"}
@@ -1 +1 @@
1
- {"version":3,"file":"generate-init.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/generate-init.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAgBjD,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,WAAW,EACf,GAAG,EAAE,eAAe,EACpB,iBAAiB,CAAC,EAAE,MAAM,EAAE,EAC5B,mBAAmB,CAAC,EAAE,MAAM,EAAE,GAC7B,MAAM,CAwGR"}
1
+ {"version":3,"file":"generate-init.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/generate-init.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAiBjD,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,WAAW,EACf,GAAG,EAAE,eAAe,EACpB,iBAAiB,CAAC,EAAE,MAAM,EAAE,EAC5B,mBAAmB,CAAC,EAAE,MAAM,EAAE,GAC7B,MAAM,CA6GR"}
@@ -1 +1 @@
1
- {"version":3,"file":"html-template.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/html-template.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAwC,MAAM,EAAU,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAGxI,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAG/C,OAAO,EAAqC,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAEpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAIjD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAIxD;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI;IACvC,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;IAC9B,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;CAC/B,CAaA;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAwBnE;AAED;;;;;GAKG;AACH,wBAAgB,kCAAkC,IAAI;IACpD,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;IAC9B,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;IAC9B,oBAAoB,EAAE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,SAAS,EACnD,GAAG,EAAE,eAAe,EACpB,eAAe,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,EACrC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,EAC/B,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAC9B,kBAAkB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GACvC,MAAM,CAoBR;AAuHD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,eAAe,EACpB,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EACnD,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,EACjD,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,GAC9B,GAAG,CAAC,MAAM,CAAC,CAoDb;AAyYD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,CAiBpF"}
@@ -49,5 +49,6 @@ export declare function generateClientJsWithSourceMap(ir: ComponentIR, siblingCo
49
49
  export declare function analyzeClientNeeds(ir: ComponentIR): {
50
50
  needsInit: boolean;
51
51
  usedProps: string[];
52
+ liveOnlyProps: Record<string, string>;
52
53
  };
53
54
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,OAAO,KAAK,EACV,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,0BAA0B,CAAA;AAcjC,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAExE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS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,EAAE,MAAM,CAAC,CAAA;CAAE,CAiCpF"}
@@ -7,7 +7,15 @@
7
7
  *
8
8
  * `__scope` is the synthetic root slot id used when the component's
9
9
  * root element carries the listener (no `bf=` slot).
10
+ *
11
+ * A slot that is ALSO a `.map()` loop's container, with its own handler for
12
+ * the same DOM event a loop delegates, is skipped here too (#2930):
13
+ * `loopDelegationIndex` says so, and `control-flow.ts`'s `emitLoopUpdates`
14
+ * folds that handler into the delegated listener instead — emitting it here
15
+ * too would double-wire it back onto a separate `addEventListener` call,
16
+ * which is exactly the bug this split avoids.
10
17
  */
11
18
  import type { ClientJsContext } from '../types.ts';
12
- export declare function emitEventHandlers(lines: string[], ctx: ClientJsContext, conditionalSlotIds: Set<string>): void;
19
+ import type { LoopDelegationIndex } from '../control-flow/plan/loop-delegation-index.ts';
20
+ export declare function emitEventHandlers(lines: string[], ctx: ClientJsContext, conditionalSlotIds: Set<string>, loopDelegationIndex: LoopDelegationIndex): void;
13
21
  //# sourceMappingURL=event-handlers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"event-handlers.d.ts","sourceRoot":"","sources":["../../../src/ir-to-client-js/phases/event-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAGlD,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EAAE,EACf,GAAG,EAAE,eAAe,EACpB,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,GAC9B,IAAI,CAkBN"}
1
+ {"version":3,"file":"event-handlers.d.ts","sourceRoot":"","sources":["../../../src/ir-to-client-js/phases/event-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAA;AAExF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EAAE,EACf,GAAG,EAAE,eAAe,EACpB,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,EAC/B,mBAAmB,EAAE,mBAAmB,GACvC,IAAI,CAmBN"}
@@ -6,6 +6,11 @@
6
6
  * function / constant or destructured prop), emit
7
7
  * `const handlerName = _p.handlerName`. Subsequent emission can call
8
8
  * `handlerName(...)` without writing the prop accessor inline.
9
+ *
10
+ * Only for props-object mode, where a bare `handlerName` would otherwise be
11
+ * a `ReferenceError`. In destructured mode `rewriteDestructuredPropReads`
12
+ * already turns every handler-name read into a live `_p.handlerName`, so the
13
+ * alias would only be emitted to be left unused.
9
14
  */
10
15
  import type { ClientJsContext } from '../types.ts';
11
16
  export declare function emitPropsEventHandlers(lines: string[], ctx: ClientJsContext, usedFunctions: Set<string>, neededProps: Set<string>): void;
@@ -1 +1 @@
1
- {"version":3,"file":"props-event-handlers.d.ts","sourceRoot":"","sources":["../../../src/ir-to-client-js/phases/props-event-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAGlD,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EAAE,EACf,GAAG,EAAE,eAAe,EACpB,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,EAC1B,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,GACvB,IAAI,CAgBN"}
1
+ {"version":3,"file":"props-event-handlers.d.ts","sourceRoot":"","sources":["../../../src/ir-to-client-js/phases/props-event-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAGlD,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EAAE,EACf,GAAG,EAAE,eAAe,EACpB,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,EAC1B,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,GACvB,IAAI,CAiBN"}
@@ -1,19 +1,21 @@
1
1
  /**
2
- * `props-extraction` phase — emit `const propName = _p.propName ?? <default>`
3
- * declarations at the top of the init body.
2
+ * `props-extraction` phase — emit the one surviving one-time prop
3
+ * extraction, `const children = _p.children [?? <default>]`.
4
4
  *
5
- * The default value depends on usage:
6
- * - prop has explicit default → use it (wrap arrow defaults
7
- * in parens for syntax safety)
8
- * - prop is consumed as a loop array → `?? []`
9
- * - prop has property/index access → `?? {}` (skipped when the
10
- * prop is a conditional guard
11
- * so falsy values stay falsy)
12
- * - otherwise → no default
5
+ * `children` must stay a ONE-TIME read: a prop's slot-children value is a
6
+ * getter that INSTANTIATES child components when read (see
7
+ * `prune-unused-prop-extractions.ts`), so reading it live at every
8
+ * `{children}` reference would re-mount the children each time. Every
9
+ * other destructured prop is rewritten to a live read instead, by
10
+ * `rewriteDestructuredPropReads` (`generate-init.ts`).
13
11
  *
14
- * Skipped entirely when the component uses an opaque props object name
15
- * (`propsObjectName != null`) — in that case downstream code reads
16
- * `_p.X` directly via the late-stage rename.
12
+ * The line is composed from `propReadBase`/`propReadFallback` rather than
13
+ * `livePropReadExpr` so it stays unparenthesized — that exact
14
+ * `const X = _p.X [?? d]` shape is what `pruneUnusedPropExtractions`'s AST
15
+ * matcher recognizes when the init body never reads `children`.
16
+ *
17
+ * Skipped entirely for an opaque props object (`propsObjectName != null`):
18
+ * downstream code there reads `_p.X` directly via the late-stage rename.
17
19
  */
18
20
  import type { PropUsage } from '../../types.ts';
19
21
  import type { ClientJsContext } from '../types.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"props-extraction.d.ts","sourceRoot":"","sources":["../../../src/ir-to-client-js/phases/props-extraction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAGlD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EAAE,EACf,GAAG,EAAE,eAAe,EACpB,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,EACxB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,GAChC,IAAI,CAsCN"}
1
+ {"version":3,"file":"props-extraction.d.ts","sourceRoot":"","sources":["../../../src/ir-to-client-js/phases/props-extraction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAKlD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EAAE,EACf,GAAG,EAAE,eAAe,EACpB,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,EACxB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,GAChC,IAAI,CAcN"}
@@ -15,6 +15,7 @@
15
15
  import type { ComponentIR, PropUsage, ReferencesGraph } from '../types.ts';
16
16
  import type { ClientJsContext } from './types.ts';
17
17
  import type { LocalClassification } from './init-declarations.ts';
18
+ import { type LoopDelegationIndex } from './control-flow/plan/loop-delegation-index.ts';
18
19
  /**
19
20
  * Inputs available to every phase. Built once by `generateInitFunction`
20
21
  * before phase execution starts; phases read but never mutate.
@@ -28,6 +29,16 @@ export interface PhaseCtx {
28
29
  /** Slots that live inside a conditional branch (handled via `insert()`).
29
30
  * Cached so `event-handlers` and `ref-callbacks` don't recompute. */
30
31
  conditionalSlotIds: Set<string>;
32
+ /**
33
+ * Which (container slot, DOM event) pairs a top-level `.map()` loop will
34
+ * delegate, and which loop is last among those sharing a pair (#2930).
35
+ * Computed once, ahead of both `event-handlers` (which must suppress a
36
+ * container's own listener for a delegated pair) and `loop-updates`
37
+ * (which folds that handler into the delegated listener instead) — those
38
+ * two phases run in that order, so this can't be computed by either one
39
+ * lazily on first use.
40
+ */
41
+ loopDelegationIndex: LoopDelegationIndex;
31
42
  /** Local names that resolve to component-scope expressions and therefore
32
43
  * become `[]` / `undefined` when referenced from the CSR template (the
33
44
  * same set the registration emitter feeds `generateCsrTemplate`).
@@ -36,7 +47,7 @@ export interface PhaseCtx {
36
47
  unsafeLocalNames: Set<string>;
37
48
  }
38
49
  /** Build the read-only carrier that every phase consumes. */
39
- export declare function buildPhaseCtx(args: Omit<PhaseCtx, 'conditionalSlotIds'>): PhaseCtx;
50
+ export declare function buildPhaseCtx(args: Omit<PhaseCtx, 'conditionalSlotIds' | 'loopDelegationIndex'>): PhaseCtx;
40
51
  /**
41
52
  * String literal union of every phase id in `PHASES`. Typing `id` and
42
53
  * `dependsOn` against this union turns a typo (e.g. `'props-extractio'`
@@ -1 +1 @@
1
- {"version":3,"file":"phases.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/phases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAuBjE;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,eAAe,CAAA;IACpB,EAAE,EAAE,WAAW,CAAA;IACf,KAAK,EAAE,eAAe,CAAA;IACtB,cAAc,EAAE,mBAAmB,CAAA;IACnC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IACjC;0EACsE;IACtE,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC/B;;;;oEAIgE;IAChE,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAC9B;AAED,6DAA6D;AAC7D,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,oBAAoB,CAAC,G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ourceRoot":"","sources":["../../../src/ir-to-client-js/plan/build-declaration-emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAG3D,OAAO,KAAK,EAEV,mBAAmB,EAEpB,MAAM,uBAAuB,CAAA;AAE9B;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,kBAAkB,EAAE,WAAW,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAA;IAC7D,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;CAC3C;AAED,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,eAAe,EACpB,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,GAC7C,sBAAsB,CAMxB;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,eAAe,EACpB,OAAO,EAAE,sBAAsB,GAC9B,mBAAmB,CAkCrB"}
1
+ {"version":3,"file":"build-declaration-emit.d.ts","sourceRoot":"","sources":["../../../src/ir-to-client-js/plan/build-declaration-emit.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAI3D,OAAO,KAAK,EAEV,mBAAmB,EAEpB,MAAM,uBAAuB,CAAA;AAE9B;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,kBAAkB,EAAE,WAAW,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAA;IAC7D,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;CAC3C;AAED,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,eAAe,EACpB,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,GAC7C,sBAAsB,CAMxB;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,eAAe,EACpB,OAAO,EAAE,sBAAsB,GAC9B,mBAAmB,CAkCrB"}
@@ -1,3 +1,53 @@
1
+ /**
2
+ * Final-pass removal of prop-extraction consts the emitted init body never
3
+ * reads (`const children = _p.children` and friends).
4
+ *
5
+ * `emitPropsExtraction` mirrors the component's destructuring for every
6
+ * prop the REFERENCE GRAPH marks as used — but the graph also counts
7
+ * template-only references (e.g. `{children}` rendered as SSR-adopted
8
+ * content), which the init body never touches. The stray binding is not
9
+ * just dead weight: props arrive as GETTERS over the parent's reactive
10
+ * state, and a slot-children getter (`get children() { return
11
+ * [createComponent('Checkbox', …)] }`) INSTANTIATES child components when
12
+ * read. An init that eagerly evaluates it creates a second, duplicate
13
+ * child instance next to the `upsertChild` wiring the compiler also
14
+ * emits — double event listeners, toggles that cancel themselves out.
15
+ * The legacy site pipeline masked this by registration order (children
16
+ * modules registered after the parent's init queued, so the queued init
17
+ * ran against an already-hydrated tree); Vite's ESM import order
18
+ * registers children first and made the eager read bite (#2537's
19
+ * migration surfaced it on site/ui's form-builder).
20
+ *
21
+ * Mirrors `resolveFinalImports`'s shape: a TS AST walk over the finished
22
+ * code (never a regex — see CLAUDE.md), span-based splicing, iterated to
23
+ * a fixpoint so an extraction referenced only by another pruned
24
+ * extraction's default expression is removed too.
25
+ *
26
+ * Known limits, both erring toward FALSE-KEEP (an extraction survives and
27
+ * the eager getter read stays), never false-prune:
28
+ * - The reference scan is whole-file and scope-unaware: any other
29
+ * occurrence of the same identifier text as a value (a module-level
30
+ * helper's parameter named `children`, a local in an unrelated closure)
31
+ * keeps the extraction alive.
32
+ * - Splicing removes a statement's full leading trivia, so a comment an
33
+ * emitter attached directly above a pruned extraction goes with it.
34
+ */
35
+ import ts from 'typescript';
36
+ /**
37
+ * Does `init` read `<objectName>.<key>` or `<objectName>.<key> ?? <fallback>`?
38
+ * The one recognizer for "a prop read initializer", shared by
39
+ * `propExtractionName` below (which additionally requires the bound name to
40
+ * equal `key`, and always reads off `_p`), `rewriteBodyAliasReads`
41
+ * (`rewrite-destructured-props.ts`, which does not require the name match —
42
+ * a renamed alias's bound name differs from `key` by definition, but also
43
+ * always reads off `_p`), and `resolveBodyPropAliases` (`props-binding.ts`,
44
+ * which reads off the SOURCE-level props object name, e.g. `props` —
45
+ * `objectName` defaults to `_p` for the first two, post-rename, callers).
46
+ */
47
+ export declare function parsePropReadInitializer(init: ts.Expression, objectName?: string): {
48
+ key: string;
49
+ fallback: ts.Expression | null;
50
+ } | null;
1
51
  /**
2
52
  * Remove prop-extraction consts inside `init*` functions whose bound name
3
53
  * is never referenced as a value anywhere else in `code`. Returns the code
@@ -1 +1 @@
1
- {"version":3,"file":"prune-unused-prop-extractions.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/prune-unused-prop-extractions.ts"],"names":[],"mappings":"AA6DA;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAyC/D"}
1
+ {"version":3,"file":"prune-unused-prop-extractions.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/prune-unused-prop-extractions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EAAE,MAAM,YAAY,CAAA;AAI3B;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,EAAE,CAAC,UAAU,EACnB,UAAU,GAAE,MAAoB,GAC/B;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,EAAE,CAAC,UAAU,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,CAaxD;AAiBD;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAyC/D"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Live-read rewrite for destructured props.
3
+ *
4
+ * A destructured name can appear bare in a dozen raw-captured text shapes
5
+ * (effect bodies, memo computations, signal initials, handler bodies,
6
+ * `mapArray` row bodies, conditional thunks, …), so rewriting it per
7
+ * emitter would mean N places to keep in sync; the single door is the
8
+ * joined init body, same precedent as `rewritePropsObjectRef`
9
+ * (`rewrite-props-object.ts`) one step earlier in the same pipeline.
10
+ *
11
+ * Two shapes reach this door, dispatched on `ctx.propsObjectName`:
12
+ *
13
+ * - PARAMETER destructuring (`function Child({ value })`,
14
+ * `propsObjectName === null`) — `rewriteParamDestructuredReads`, Move
15
+ * B's original mechanism (#2932).
16
+ * - a BODY destructure or bare-member alias off the whole props object
17
+ * (`function Child(props) { const { value } = props; ... }`,
18
+ * `propsObjectName` set) — `rewriteBodyAliasReads` (#2934). Move B left
19
+ * this branch a no-op: `rewritePropsObjectRef` (the pass immediately
20
+ * before this one) already turns `props.value` into `_p.value`
21
+ * wherever the SOURCE wrote it as a member access, but a body
22
+ * destructure's downstream USES are bare identifiers (`value`, not
23
+ * `props.value`), which that rename never touches — they stayed
24
+ * captured at the local's ONE declaration-time read forever.
25
+ */
26
+ import type { PropUsage } from '../types.ts';
27
+ import type { ClientJsContext } from './types.ts';
28
+ export declare function rewriteDestructuredPropReads(code: string, ctx: ClientJsContext, propUsage: ReadonlyMap<string, PropUsage>): string;
29
+ //# sourceMappingURL=rewrite-destructured-props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rewrite-destructured-props.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/rewrite-destructured-props.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAO5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,eAAe,EACpB,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,GACxC,MAAM,CAIR"}