@barefootjs/jsx 0.40.1 → 0.41.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 (211) hide show
  1. package/dist/adapters/boolean-result.d.ts +32 -10
  2. package/dist/adapters/boolean-result.d.ts.map +1 -1
  3. package/dist/adapters/brace-delimiter-text.d.ts +18 -0
  4. package/dist/adapters/brace-delimiter-text.d.ts.map +1 -0
  5. package/dist/adapters/callback-method.d.ts +45 -5
  6. package/dist/adapters/callback-method.d.ts.map +1 -1
  7. package/dist/adapters/component-props.d.ts +3 -4
  8. package/dist/adapters/component-props.d.ts.map +1 -1
  9. package/dist/adapters/computed-const.d.ts +11 -1
  10. package/dist/adapters/computed-const.d.ts.map +1 -1
  11. package/dist/adapters/dsl-template-adapter.d.ts +24 -12
  12. package/dist/adapters/dsl-template-adapter.d.ts.map +1 -1
  13. package/dist/adapters/loop-bound-names.d.ts +9 -1
  14. package/dist/adapters/loop-bound-names.d.ts.map +1 -1
  15. package/dist/adapters/loop-row-type.d.ts +59 -0
  16. package/dist/adapters/loop-row-type.d.ts.map +1 -0
  17. package/dist/adapters/nil-reading.d.ts +63 -0
  18. package/dist/adapters/nil-reading.d.ts.map +1 -0
  19. package/dist/adapters/non-primitive-equality.d.ts +33 -0
  20. package/dist/adapters/non-primitive-equality.d.ts.map +1 -0
  21. package/dist/adapters/number-value.d.ts +5 -3
  22. package/dist/adapters/number-value.d.ts.map +1 -1
  23. package/dist/adapters/operand-typing.d.ts +126 -0
  24. package/dist/adapters/operand-typing.d.ts.map +1 -0
  25. package/dist/adapters/parsed-expr-emitter.d.ts +80 -12
  26. package/dist/adapters/parsed-expr-emitter.d.ts.map +1 -1
  27. package/dist/adapters/primitive-plan.d.ts +320 -0
  28. package/dist/adapters/primitive-plan.d.ts.map +1 -0
  29. package/dist/adapters/prop-classes.d.ts +5 -0
  30. package/dist/adapters/prop-classes.d.ts.map +1 -1
  31. package/dist/analyzer-context.d.ts +4 -0
  32. package/dist/analyzer-context.d.ts.map +1 -1
  33. package/dist/analyzer.d.ts.map +1 -1
  34. package/dist/augment-inherited-props.d.ts +63 -8
  35. package/dist/augment-inherited-props.d.ts.map +1 -1
  36. package/dist/compiler.d.ts.map +1 -1
  37. package/dist/event-handler-name.d.ts +12 -0
  38. package/dist/event-handler-name.d.ts.map +1 -1
  39. package/dist/expression-parser.d.ts +8 -0
  40. package/dist/expression-parser.d.ts.map +1 -1
  41. package/dist/index.d.ts +20 -11
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +4903 -2311
  44. package/dist/ir-to-client-js/build-references.d.ts.map +1 -1
  45. package/dist/ir-to-client-js/child-props-object.d.ts +106 -0
  46. package/dist/ir-to-client-js/child-props-object.d.ts.map +1 -0
  47. package/dist/ir-to-client-js/collect-elements.d.ts.map +1 -1
  48. package/dist/ir-to-client-js/control-flow/plan/build-inner-loop.d.ts.map +1 -1
  49. package/dist/ir-to-client-js/control-flow/plan/build-loop-child-arm.d.ts.map +1 -1
  50. package/dist/ir-to-client-js/control-flow/shared.d.ts.map +1 -1
  51. package/dist/ir-to-client-js/control-flow/stringify/claim-plan.d.ts +4 -2
  52. package/dist/ir-to-client-js/control-flow/stringify/claim-plan.d.ts.map +1 -1
  53. package/dist/ir-to-client-js/html-template.d.ts.map +1 -1
  54. package/dist/ir-to-client-js/imports.d.ts +2 -2
  55. package/dist/ir-to-client-js/imports.d.ts.map +1 -1
  56. package/dist/ir-to-client-js/index.d.ts +2 -6
  57. package/dist/ir-to-client-js/index.d.ts.map +1 -1
  58. package/dist/ir-to-client-js/phases/props-extraction.d.ts +3 -3
  59. package/dist/ir-to-client-js/plan/build-declaration-emit.d.ts.map +1 -1
  60. package/dist/ir-to-client-js/plan/build-static-array-child-init.d.ts.map +1 -1
  61. package/dist/ir-to-client-js/plan/static-array-child-init.d.ts +30 -18
  62. package/dist/ir-to-client-js/plan/static-array-child-init.d.ts.map +1 -1
  63. package/dist/ir-to-client-js/prop-handling.d.ts.map +1 -1
  64. package/dist/ir-to-client-js/prune-unused-prop-extractions.d.ts +3 -1
  65. package/dist/ir-to-client-js/prune-unused-prop-extractions.d.ts.map +1 -1
  66. package/dist/ir-to-client-js/stringify/static-array-child-init.d.ts +3 -2
  67. package/dist/ir-to-client-js/stringify/static-array-child-init.d.ts.map +1 -1
  68. package/dist/jsx-to-ir.d.ts +1 -0
  69. package/dist/jsx-to-ir.d.ts.map +1 -1
  70. package/dist/nullable-signal-attr.d.ts +51 -34
  71. package/dist/nullable-signal-attr.d.ts.map +1 -1
  72. package/dist/prop-rewrite.d.ts +7 -0
  73. package/dist/prop-rewrite.d.ts.map +1 -1
  74. package/dist/props-binding.d.ts +58 -13
  75. package/dist/props-binding.d.ts.map +1 -1
  76. package/dist/props-object-whole-read.d.ts +15 -0
  77. package/dist/props-object-whole-read.d.ts.map +1 -0
  78. package/dist/rich-type-refusal.d.ts.map +1 -1
  79. package/dist/scope/binding-scope.d.ts +85 -10
  80. package/dist/scope/binding-scope.d.ts.map +1 -1
  81. package/dist/scope/lexical-scope-walk.d.ts +3 -2
  82. package/dist/scope/lexical-scope-walk.d.ts.map +1 -1
  83. package/dist/scope/root-prop-alias.d.ts +10 -7
  84. package/dist/scope/root-prop-alias.d.ts.map +1 -1
  85. package/dist/ssr-defaults.d.ts +39 -3
  86. package/dist/ssr-defaults.d.ts.map +1 -1
  87. package/dist/strip-types.d.ts +13 -0
  88. package/dist/strip-types.d.ts.map +1 -1
  89. package/dist/template-position-walk.d.ts +21 -3
  90. package/dist/template-position-walk.d.ts.map +1 -1
  91. package/dist/types.d.ts +90 -0
  92. package/dist/types.d.ts.map +1 -1
  93. package/package.json +2 -2
  94. package/src/__tests__/__snapshots__/doc-examples.test.ts.snap +9 -9
  95. package/src/__tests__/binding-scope.test.ts +89 -1
  96. package/src/__tests__/body-destructure-props-object-alias.test.ts +123 -0
  97. package/src/__tests__/body-destructured-prop-default-arrow.test.ts +2 -2
  98. package/src/__tests__/body-destructured-props-live.test.ts +5 -5
  99. package/src/__tests__/boolean-result.test.ts +22 -5
  100. package/src/__tests__/brace-delimiter-text.test.ts +26 -0
  101. package/src/__tests__/callback-method.test.ts +62 -2
  102. package/src/__tests__/child-components-in-map.test.ts +1 -1
  103. package/src/__tests__/client-js-generation.test.ts +3 -3
  104. package/src/__tests__/computed-const.test.ts +103 -0
  105. package/src/__tests__/destructure-default-reads-earlier-param.test.ts +7 -7
  106. package/src/__tests__/destructured-props-live.test.ts +1 -1
  107. package/src/__tests__/emit-to-string-call.test.ts +2 -1
  108. package/src/__tests__/hydration-payload-analysis.test.ts +166 -0
  109. package/src/__tests__/issue-2724-prop-alias-loop-not-static.test.ts +7 -7
  110. package/src/__tests__/issue-2754-rest-spread-needs-slot.test.ts +5 -2
  111. package/src/__tests__/issue-2798-static-nested-loop-bindings.test.ts +1 -1
  112. package/src/__tests__/issue-2835-props-type-member-name-collision.test.ts +4 -4
  113. package/src/__tests__/issue-3044-nested-prop-object-array-not-static.test.ts +1 -1
  114. package/src/__tests__/issue-3688-props-spread-child-csr.test.ts +2 -1
  115. package/src/__tests__/issue-3713-props-spread-loop-row.test.ts +65 -0
  116. package/src/__tests__/issue-3861-object-spread-child.test.ts +102 -0
  117. package/src/__tests__/lookup-literal-const.test.ts +9 -3
  118. package/src/__tests__/loop-index-reactivity.test.ts +2 -2
  119. package/src/__tests__/loop-param-accessor-key-member-safety.test.ts +1 -1
  120. package/src/__tests__/loop-plan.test.ts +1 -1
  121. package/src/__tests__/loop-row-const-initializer-shadow.test.ts +146 -0
  122. package/src/__tests__/loop-row-type.test.ts +64 -0
  123. package/src/__tests__/lowering-value-position.test.ts +4 -0
  124. package/src/__tests__/memo-body-expr.test.ts +2 -2
  125. package/src/__tests__/module-const-destructure-default.test.ts +156 -0
  126. package/src/__tests__/nested-loop-index-param.test.ts +1 -1
  127. package/src/__tests__/nested-loop-reactive-attrs.test.ts +2 -2
  128. package/src/__tests__/nested-row-shadowing.test.ts +2 -2
  129. package/src/__tests__/nil-reading.test.ts +78 -0
  130. package/src/__tests__/nullable-signal-attr.test.ts +109 -48
  131. package/src/__tests__/primitive-plan.test.ts +494 -0
  132. package/src/__tests__/profile-loop-binding-ids.test.ts +2 -2
  133. package/src/__tests__/profile-nested-binding-ids.test.ts +2 -2
  134. package/src/__tests__/prop-default-undefined-only.test.ts +115 -0
  135. package/src/__tests__/prop-references.test.ts +2 -2
  136. package/src/__tests__/props-destructuring.test.ts +17 -0
  137. package/src/__tests__/props-object-whole-read.test.ts +40 -0
  138. package/src/__tests__/prune-unused-prop-extractions.test.ts +3 -3
  139. package/src/__tests__/reactive-attrs-in-map.test.ts +1 -1
  140. package/src/__tests__/reactive-factory-inlining.test.ts +4 -1
  141. package/src/__tests__/renamed-body-destructure-template.test.ts +7 -7
  142. package/src/__tests__/rest-binding-gaps.test.ts +192 -0
  143. package/src/__tests__/rewrite-destructured-props.test.ts +1 -1
  144. package/src/__tests__/root-prop-alias.test.ts +53 -8
  145. package/src/__tests__/ssr-defaults.test.ts +113 -25
  146. package/src/__tests__/static-loop-csr-materialize.test.ts +2 -2
  147. package/src/__tests__/static-record-literal-array.test.ts +171 -0
  148. package/src/__tests__/string-concat-identifier.test.ts +40 -1
  149. package/src/__tests__/written-binding-substitution.test.ts +8 -8
  150. package/src/adapters/boolean-result.ts +72 -66
  151. package/src/adapters/brace-delimiter-text.ts +25 -0
  152. package/src/adapters/callback-method.ts +159 -27
  153. package/src/adapters/component-props.ts +3 -4
  154. package/src/adapters/computed-const.ts +238 -4
  155. package/src/adapters/dsl-template-adapter.ts +62 -26
  156. package/src/adapters/loop-bound-names.ts +9 -1
  157. package/src/adapters/loop-plan.ts +1 -1
  158. package/src/adapters/loop-row-type.ts +149 -0
  159. package/src/adapters/nil-reading.ts +295 -0
  160. package/src/adapters/non-primitive-equality.ts +92 -0
  161. package/src/adapters/number-value.ts +17 -4
  162. package/src/adapters/operand-typing.ts +522 -0
  163. package/src/adapters/parsed-expr-emitter.ts +183 -19
  164. package/src/adapters/primitive-plan.ts +765 -0
  165. package/src/adapters/prop-classes.ts +16 -3
  166. package/src/analyzer-context.ts +6 -0
  167. package/src/analyzer.ts +532 -26
  168. package/src/augment-inherited-props.ts +108 -10
  169. package/src/compiler.ts +17 -0
  170. package/src/event-handler-name.ts +15 -0
  171. package/src/expression-parser.ts +70 -1
  172. package/src/index.ts +35 -16
  173. package/src/ir-to-client-js/build-references.ts +69 -0
  174. package/src/ir-to-client-js/child-props-object.ts +240 -0
  175. package/src/ir-to-client-js/collect-elements.ts +31 -63
  176. package/src/ir-to-client-js/control-flow/plan/build-inner-loop.ts +8 -1
  177. package/src/ir-to-client-js/control-flow/plan/build-loop-child-arm.ts +31 -28
  178. package/src/ir-to-client-js/control-flow/shared.ts +20 -22
  179. package/src/ir-to-client-js/control-flow/stringify/claim-plan.ts +5 -3
  180. package/src/ir-to-client-js/control-flow/stringify/inner-loop.ts +2 -2
  181. package/src/ir-to-client-js/control-flow/stringify/lazy-row.ts +1 -1
  182. package/src/ir-to-client-js/control-flow/stringify/loop-child-arm.ts +2 -2
  183. package/src/ir-to-client-js/control-flow/stringify/loop.ts +1 -1
  184. package/src/ir-to-client-js/control-flow/stringify/reactive-effects.ts +3 -3
  185. package/src/ir-to-client-js/html-template.ts +43 -17
  186. package/src/ir-to-client-js/imports.ts +2 -2
  187. package/src/ir-to-client-js/index.ts +53 -11
  188. package/src/ir-to-client-js/phases/props-extraction.ts +11 -7
  189. package/src/ir-to-client-js/plan/build-declaration-emit.ts +40 -7
  190. package/src/ir-to-client-js/plan/build-static-array-child-init.ts +31 -14
  191. package/src/ir-to-client-js/plan/static-array-child-init.ts +27 -18
  192. package/src/ir-to-client-js/prop-handling.ts +22 -3
  193. package/src/ir-to-client-js/prune-unused-prop-extractions.ts +58 -5
  194. package/src/ir-to-client-js/rewrite-destructured-props.ts +31 -1
  195. package/src/ir-to-client-js/stringify/static-array-child-init.ts +26 -10
  196. package/src/jsx-to-ir.ts +459 -37
  197. package/src/nullable-signal-attr.ts +200 -110
  198. package/src/prop-rewrite.ts +30 -6
  199. package/src/props-binding.ts +84 -19
  200. package/src/props-object-whole-read.ts +87 -0
  201. package/src/rich-type-refusal.ts +2 -1
  202. package/src/scope/binding-scope.ts +182 -18
  203. package/src/scope/lexical-scope-walk.ts +4 -3
  204. package/src/scope/root-prop-alias.ts +15 -8
  205. package/src/ssr-defaults.ts +100 -11
  206. package/src/strip-types.ts +31 -3
  207. package/src/template-position-walk.ts +57 -28
  208. package/src/types.ts +87 -0
  209. package/dist/adapters/ambiguous-nil-arithmetic.d.ts +0 -41
  210. package/dist/adapters/ambiguous-nil-arithmetic.d.ts.map +0 -1
  211. package/src/adapters/ambiguous-nil-arithmetic.ts +0 -94
@@ -15,8 +15,7 @@
15
15
  * a non-nil value.
16
16
  */
17
17
  import type { ParsedExpr } from './expression-parser.ts';
18
- import { BindingScope } from './scope/binding-scope.ts';
19
- import type { ComponentIR, MemoInfo, SignalInfo } from './types.ts';
18
+ import type { ComponentIR, IRMetadata, MemoInfo, SignalInfo } from './types.ts';
20
19
  /** `undefined` / `null` as a parsed initial value. */
21
20
  export declare function isNullishLiteral(expr: ParsedExpr | undefined): boolean;
22
21
  /**
@@ -43,6 +42,22 @@ export declare function collectNullableSignalGetters(ir: ComponentIR): Set<strin
43
42
  * survives into the signal.
44
43
  */
45
44
  export declare function collectAbsentPropSeedReads(ir: ComponentIR): Map<string, Set<string>>;
45
+ /**
46
+ * Whether `expr` is never `undefined` / `null` at SSR, so JS `expr ?? y` is
47
+ * `expr`, even when it is `false`, `''` or `0`: a boolean-result expression
48
+ * (a comparison, `!`, a boolean literal, `isBooleanResultParsed`), or a read
49
+ * of a required (not optional, not rest) prop declared as a string, number
50
+ * or boolean, or a union of them, read as its binding (`flag`) or as
51
+ * `<propsObjectName>.<key>`, with no binding shadowing the read.
52
+ */
53
+ export declare function isNeverNullishOperand(expr: ParsedExpr, metadata: Pick<IRMetadata, 'propsParams' | 'propsObjectName'>, isBound: (name: string) => boolean): boolean;
54
+ /**
55
+ * The params of `nullableProps` (`NullishAttrContext.nullableProps`) that
56
+ * `expr`'s value can be read whole from (`collectSeedPropReads`): the props
57
+ * whose absence an attribute bound to `expr` omits it for. A backend that
58
+ * types a prop by value (Go) makes these props nillable.
59
+ */
60
+ export declare function nullablePropsYieldedBy(expr: ParsedExpr | undefined, nullableProps: ReadonlyMap<string, string>): Set<string>;
46
61
  /**
47
62
  * The getter an attribute value reads when the whole value is a bare,
48
63
  * zero-argument getter call (`s()`); `null` for any other shape. A member
@@ -70,23 +85,37 @@ export interface NullishAttrContext {
70
85
  * (`arithmeticOperandIsUndefined`). */
71
86
  readonly undefinedSeededSignals?: ReadonlySet<string>;
72
87
  readonly memos: ReadonlyMap<string, MemoInfo>;
88
+ /** Props that can be absent or `null` at SSR (no default, optional or
89
+ * typed with `undefined` / `null`), by the name a read uses
90
+ * (`collectNullablePropReads`). */
91
+ readonly nullableProps?: ReadonlyMap<string, string>;
73
92
  /** Props declared as a number that may be `null` or absent (`n: number |
74
93
  * null`, `n?: number`), by the name a read uses: the binding name, and
75
94
  * `<propsObjectName>.<key>` for a member read (#3474), mapped to what the
76
95
  * engine's nil stands for there (`NullableNumberPropNil`, #3533). */
77
96
  readonly nullableNumberProps?: ReadonlyMap<string, NullableNumberPropNil>;
97
+ /** Props declared as a string or a boolean that may be `null` or absent
98
+ * (`s?: string`, `b: boolean | null`), keyed like {@link nullableNumberProps}.
99
+ * Read only for a relational operand (#3824 step 3): JS converts it with
100
+ * ToNumber unless both sides are strings, so its nil's reading decides the
101
+ * comparison (`undefined < 1` is false, `null < 1` is true). */
102
+ readonly nullableScalarProps?: ReadonlyMap<string, NullableScalarProp>;
103
+ }
104
+ /** A string or boolean prop's nil reading ({@link NullishAttrContext.nullableScalarProps}). */
105
+ export interface NullableScalarProp {
106
+ readonly family: 'string' | 'boolean';
107
+ readonly nil: NullableNumberPropNil;
78
108
  }
79
109
  /**
80
110
  * What a nullable number prop's nil stands for at SSR (#3533). JS reads an
81
- * absent prop as `undefined` (`NaN` in arithmetic) and a `null` one as `0`,
82
- * while a template engine holds both as the same nil, so the declared type
83
- * decides. A prop whose type admits `null` (`n: number | null`) reads its
111
+ * absent prop as `undefined` (`NaN` in arithmetic) and a `null` one as `0`;
112
+ * the declared type decides the coercion an adapter spells statically. A prop whose type admits `null` (`n: number | null`) reads its
84
113
  * nil as `null`. A prop that can only be absent (`n?: number`,
85
114
  * `n: number | undefined`) reads it as `undefined`; a present value, `0`
86
115
  * included, is unaffected. A prop that admits both (`n?: number | null`,
87
116
  * `n: number | null | undefined`) is `'either'`: the type cannot say which
88
- * one its nil stands for, so arithmetic over it is refused
89
- * (`arithmeticOperandNilIsAmbiguous`).
117
+ * one its nil stands for, so the operand is left to the runtime's helper,
118
+ * which reads the value itself (spec/js-undefined-value.md).
90
119
  */
91
120
  export type NullableNumberPropNil = 'null' | 'undefined' | 'either';
92
121
  export declare function collectNullishAttrContext(ir: ComponentIR): NullishAttrContext;
@@ -98,7 +127,8 @@ export declare function collectNullishAttrContext(ir: ComponentIR): NullishAttrC
98
127
  * nullish value through:
99
128
  *
100
129
  * - a read of a nullable signal or of a memo whose type or body can be
101
- * nullish (`label()` with `label = createMemo(() => s())`);
130
+ * nullish (`label()` with `label = createMemo(() => s())`), or of a prop
131
+ * that can be absent (`props.on && 'y'`);
102
132
  * - an optional member read (`user()?.name`), an index or computed-key read
103
133
  * (`pair[1]`, `row[key]`), or a member read of a value that can itself be
104
134
  * nullish;
@@ -143,8 +173,15 @@ export declare const NULL_COERCING_ARITHMETIC_OPS: ReadonlySet<string>;
143
173
  /** How a DSL adapter coerces an arithmetic operand (#3474): `'null'` reads a
144
174
  * nil as `0` (JS `ToNumber(null)`), `'undefined'` reads it as `NaN`
145
175
  * (`ToNumber(undefined)`), `null` leaves the operand as is. Either coercion
146
- * leaves a non-nil operand's value as it is. */
147
- export type ArithmeticCoercion = 'null' | 'undefined' | null;
176
+ * leaves a non-nil operand's value as it is: the operand is a number, so the
177
+ * runtime's JS `Number()` may spell `'undefined'`.
178
+ *
179
+ * `'undefined-keep'` (#3824 step 3) also reads a nil as `NaN`, but the
180
+ * operand is a string or boolean relational operand, which must reach the
181
+ * relational helper unconverted (`'a' < 'b'` compares strings), so the
182
+ * adapter spells it as a nil test: `NaN` when nil, the operand otherwise.
183
+ * `NaN` makes the comparison false, as `undefined < x` is in JS for any `x`. */
184
+ export type ArithmeticCoercion = 'null' | 'undefined' | 'undefined-keep' | null;
148
185
  /**
149
186
  * The one decision behind every DSL adapter's arithmetic over a nullish
150
187
  * operand (#3474). An operand known to be `null` / `undefined`
@@ -153,30 +190,10 @@ export type ArithmeticCoercion = 'null' | 'undefined' | null;
153
190
  * (`NullableNumberPropNil`, #3533), is coerced under the operators JS
154
191
  * applies `ToNumber` to ({@link NULL_COERCING_ARITHMETIC_OPS}), and under
155
192
  * `+` when the other operand is a number literal, where `+` cannot
156
- * concatenate. Unary minus applies `ToNumber` too: it passes `'-'` with no
157
- * `other`. Each adapter only spells the coercion; one whose engine already
158
- * reads nil as `0` spells `'null'` as the operand itself.
193
+ * concatenate. Unary minus and unary plus apply `ToNumber` too: each passes
194
+ * its operator (`'-'` / `'+'`) with no `other`. Each adapter only spells the
195
+ * coercion; one whose engine already reads nil as `0` spells `'null'` as the
196
+ * operand itself.
159
197
  */
160
198
  export declare function arithmeticOperandCoercion(op: string, operand: ParsedExpr | undefined, other: ParsedExpr | undefined, ctx: NullishAttrContext, isShadowed?: (name: string) => boolean): ArithmeticCoercion;
161
- /**
162
- * Whether an arithmetic operand reads a number prop whose type admits both
163
- * `null` and absence (`n?: number | null`), directly or through a memo
164
- * (#3700). JS reads the omitted prop as `undefined` (`NaN` in arithmetic)
165
- * and a `null` one as `0`; a template engine holds both as one nil and the
166
- * type cannot say which, so no spelling of {@link arithmeticOperandCoercion}
167
- * renders both. Template adapters refuse such an operand instead of
168
- * rendering one reading silently. Same operators and scope as
169
- * {@link arithmeticOperandCoercion}.
170
- */
171
- export declare function arithmeticOperandNilIsAmbiguous(op: string, operand: ParsedExpr | undefined, other: ParsedExpr | undefined, ctx: NullishAttrContext, isShadowed?: (name: string) => boolean): boolean;
172
- /**
173
- * Every arithmetic operand in `expr` that {@link arithmeticOperandNilIsAmbiguous}
174
- * matches, for a whole expression a template adapter lowers without visiting
175
- * each operator through its emitter (a memo body, a `.filter()` predicate, an
176
- * expression the runtime evaluator runs). Operands of binary operators and of
177
- * unary minus count. `scope` is where the expression is read; each arrow in
178
- * it enters its params as a callback frame (`BindingScope.enterCallback`),
179
- * so they shadow within its body only.
180
- */
181
- export declare function ambiguousNilArithmeticOperands(expr: ParsedExpr, ctx: NullishAttrContext, scope?: BindingScope): ParsedExpr[];
182
199
  //# sourceMappingURL=nullable-signal-attr.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nullable-signal-attr.d.ts","sourceRoot":"","sources":["../src/nullable-signal-attr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAY,MAAM,YAAY,CAAA;AAY7E,sDAAsD;AACtD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAItE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAG5D;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAKzE;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAcpF;AAuDD;;;;;GAKG;AACH,wBAAgB,kBAAkB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EACvB,UAAU,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAqB,GAClD,OAAO,CAET;AA0FD;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,EAAE,WAAW,CAAC,MAAM,CAAuC,CAAA;AAEpG;;;;;;;;;;gFAUgF;AAChF,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,WAAW,GAAG,gBAAgB,GAAG,IAAI,CAAA;AAE/E;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CACvC,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,UAAU,GAAG,SAAS,EAC/B,KAAK,EAAE,UAAU,GAAG,SAAS,EAC7B,GAAG,EAAE,kBAAkB,EACvB,UAAU,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAqB,GAClD,kBAAkB,CASpB"}
@@ -119,4 +119,11 @@ export declare function applyRegexPropRefRewrite(text: string, propRefs: Iterabl
119
119
  * `applyScopedPropRefRewrite`'s docstring.
120
120
  */
121
121
  export declare function rewriteBarePropRefs(text: string, node: ts.Node, propNames: Set<string>, extraPropRefs?: ReadonlySet<string>, propAliases?: ReadonlyMap<string, string>, replacementFor?: (localName: string, callerKey: string) => string): string | undefined;
122
+ /**
123
+ * `rewriteBarePropRefs` without the regex fallback: `null` when `text`
124
+ * does not parse as an expression, so the caller refuses the shape instead
125
+ * of splicing names the scope-blind regex would also hit inside an inner
126
+ * binding (`const one = 'a'` → `const _p.one = 'a'`, #3845).
127
+ */
128
+ export declare function rewriteBarePropRefsStructural(text: string, node: ts.Node, propNames: Set<string>, extraPropRefs?: ReadonlySet<string>, propAliases?: ReadonlyMap<string, string>, replacementFor?: (localName: string, callerKey: string) => string): string | undefined | null;
122
129
  //# sourceMappingURL=prop-rewrite.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prop-rewrite.d.ts","sourceRoot":"","sources":["../src/prop-rewrite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAA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AS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,GAChE,MAAM,GAAG,SAAS,GAAG,IAAI,CAI3B"}
@@ -262,12 +262,19 @@ export declare function boundPropLocalNames(b: PropsParamBindings): ReadonlySet<
262
262
  * never bound a parameter — so callers synthesize one of these instead of a
263
263
  * full `ParamInfo` (which would need a fabricated `type`/`optional`).
264
264
  */
265
- export type LivePropReadInfo = Pick<ParamInfo, 'name' | 'sourceName' | 'defaultValue' | 'defaultContainsArrow' | 'defaultParts'>;
265
+ export type LivePropReadInfo = Pick<ParamInfo, 'name' | 'sourceName' | 'defaultValue' | 'defaultContainsArrow' | 'defaultParts'> & {
266
+ /**
267
+ * The fallback is the author's own `??` (`const label = props.label ??
268
+ * 'x'`, a body alias), which replaces `null` too, not a destructure
269
+ * default, which replaces only `undefined`.
270
+ */
271
+ readonly coalescesNull?: boolean;
272
+ };
266
273
  /** `_p.<callerKey>` — `_p` is always keyed by the caller-facing name (#2524 CSR half). */
267
274
  export declare function propReadBase(p: LivePropReadInfo): string;
268
275
  /**
269
- * The text a destructure default contributes as the right operand of a `??`
270
- * prop read. An arrow (or function-expression) default needs its own
276
+ * The text a destructure default contributes to a prop read
277
+ * ({@link composePropRead}). An arrow (or function-expression) default needs its own
271
278
  * parens — `??` binds tighter than an arrow head, so `_p.onInput ?? () =>
272
279
  * {}` is a SyntaxError. The one implementation of that decision, shared by
273
280
  * `propReadFallback` below (every live `_p.X` read) and `collectConstant`'s
@@ -277,11 +284,23 @@ export declare function propReadBase(p: LivePropReadInfo): string;
277
284
  */
278
285
  export declare function coalesceDefaultText(defaultValue: string, defaultContainsArrow: boolean | undefined): string;
279
286
  /**
280
- * The `??` right-hand side for a prop read, or null when the bare read is
281
- * correct. Precedence:
287
+ * What a prop read falls back to:
288
+ * - `default`: the prop's destructure default, which JS applies to an
289
+ * absent or `undefined` prop only, never to `null`
290
+ * (`spec/js-undefined-value.md`, "Decisions" (6)).
291
+ * - `guard`: a value the compiler supplies for a defaultless prop so the
292
+ * read cannot throw (`[]` for a loop array, `{}` for a member read); it
293
+ * replaces either nil.
294
+ */
295
+ export interface PropReadFallback {
296
+ readonly kind: 'default' | 'guard';
297
+ readonly text: string;
298
+ }
299
+ /**
300
+ * The fallback of a prop read, or null when the bare read is correct.
301
+ * Precedence:
282
302
  * 1. an explicit destructure default (`{ x = 1 }`) — an arrow default gets
283
- * an extra paren, since `??` binds tighter than the arrow head and
284
- * `_p.onInput ?? () => {}` would be a syntax error.
303
+ * an extra paren, since `??` / `?:` bind tighter than the arrow head.
285
304
  * 2. `usedAsLoopArray` → `[]`.
286
305
  * 3. property/index access → `{}`, UNLESS the prop also guards a
287
306
  * conditional: `{}` is truthy, so that would always render the branch.
@@ -290,15 +309,41 @@ export declare function coalesceDefaultText(defaultValue: string, defaultContain
290
309
  * synthesized zero default would diverge from SSR instead (`size ?? 1`
291
310
  * seeds 1 server-side; a `_p.size ?? 0` read would hydrate to 0).
292
311
  */
293
- export declare function propReadFallback(p: LivePropReadInfo, usage: PropUsage | undefined, usedAsCondition: boolean): string | null;
312
+ export declare function propReadFallback(p: LivePropReadInfo, usage: PropUsage | undefined, usedAsCondition: boolean, retained?: ReadonlySet<string>): PropReadFallback | null;
313
+ /**
314
+ * A prop read `base` (a plain property read, `_p.x` / `props.x`, so reading
315
+ * it twice is safe) with its fallback, unparenthesized: a destructure
316
+ * default as `base === undefined ? default : base`, which keeps an explicit
317
+ * `null`, as JS does; a guard as `base ?? guard`. The one spelling every
318
+ * client-JS prop read and the body-destructure expansion share, and the
319
+ * shape `parsePropReadInitializer` recognizes.
320
+ */
321
+ export declare function composePropRead(base: string, fallback: PropReadFallback | null): string;
294
322
  /**
295
323
  * A prop's destructure default as client JS. A default that reads an earlier
296
324
  * binding of its own pattern (`{ off = false, on = off }`, #3531) renders each
297
- * read as that prop's own live read (`_p.off ?? false`), since the emitted
298
- * scope binds no `off`; any other default is its source text. Undefined when
299
- * the prop has no default.
325
+ * read as that prop's own live read (`_p.off === undefined ? false :
326
+ * _p.off`) where the emitted scope binds no `off`; any other default is its
327
+ * source text. `retained` names the earlier bindings that ARE locals of the
328
+ * emitted scope (`retainedPropLocals`): a read of one stays a read of that
329
+ * local, as in JS, so a default sharing an earlier binding's array, or
330
+ * reading a value a default assigned to it, sees that binding. Undefined
331
+ * when the prop has no default.
300
332
  */
301
- export declare function propDefaultText(p: LivePropReadInfo): string | undefined;
333
+ export declare function propDefaultText(p: LivePropReadInfo, retained?: ReadonlySet<string>): string | undefined;
334
+ /**
335
+ * The destructured prop bindings the init body keeps as locals, by local
336
+ * name: a written or mutated parameter (`let start = …`, `emitPropsExtraction`)
337
+ * and a body destructure of the props object that does not keep its declared
338
+ * value (`let { a } = props`, or one mutated later). Every other destructured
339
+ * binding is read live (`keepsDeclaredValue`). A default reading one of these
340
+ * reads the local ({@link propDefaultText}).
341
+ */
342
+ export declare function retainedPropLocals(b: {
343
+ propsObjectName: string | null;
344
+ propsParams: readonly ParamInfo[];
345
+ localConstants: readonly ConstantInfo[];
346
+ }): ReadonlySet<string>;
302
347
  /**
303
348
  * The live read of a destructured prop inside init scope, in the same shape
304
349
  * props-object mode emits for `props.X`. The one formula every live-read
@@ -315,7 +360,7 @@ export declare function propDefaultText(p: LivePropReadInfo): string | undefined
315
360
  * `pruneUnusedPropExtractions`'s AST matcher, so it composes
316
361
  * `propReadBase`/`propReadFallback` itself.
317
362
  */
318
- export declare function livePropReadExpr(p: LivePropReadInfo, usage: PropUsage | undefined, usedAsCondition: boolean): string;
363
+ export declare function livePropReadExpr(p: LivePropReadInfo, usage: PropUsage | undefined, usedAsCondition: boolean, retained?: ReadonlySet<string>): string;
319
364
  /**
320
365
  * The two component bindings that forward the caller's leftover props:
321
366
  * the destructured `...rest` binding and a whole undestructured `(props)`
@@ -1 +1 @@
1
- {"version":3,"file":"props-binding.d.ts","sourceRoot":"","sources":["../src/props-binding.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EA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B,gBAAgB,CAC9B,CAAC,EAAE,gBAAgB,EACnB,KAAK,EAAE,SAAS,GAAG,SAAS,EAC5B,eAAe,EAAE,OAAO,EACxB,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAC7B,MAAM,CAIR;AAED;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACvD,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,CAAC,GAAG,IAAI,GACnC,CAAC,GAAG,IAAI,CAUV;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,kBAAkB,EAC5B,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACvD,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,OAAO,GAAG,IAAI,CAMzB"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Whether a component observes its props object as a whole: any read of the
3
+ * props parameter other than a member read with a known key (`props.x`,
4
+ * `props['x']`). A whole read — `{...props}` on an element or a component,
5
+ * `Object.keys(props)`, `props[key]`, passing `props` to a function,
6
+ * `const { a, ...rest } = props` — can see a key the props type does not
7
+ * declare, so a caller's undeclared prop is not dead there.
8
+ *
9
+ * Syntactic, over the component's TS AST: a nested function, catch clause or
10
+ * block that rebinds the name shadows it, and a type position is not a read.
11
+ * A shadow this misses only makes the answer `true` more often.
12
+ */
13
+ import ts from 'typescript';
14
+ export declare function observesWholePropsObject(fn: ts.FunctionDeclaration | ts.ArrowFunction | ts.FunctionExpression, name: string): boolean;
15
+ //# sourceMappingURL=props-object-whole-read.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props-object-whole-read.d.ts","sourceRoot":"","sources":["../src/props-object-whole-read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,wBAAgB,wBAAwB,CACtC,EAAE,EAAE,EAAE,CAAC,mBAAmB,GAAG,EAAE,CAAC,aAAa,GAAG,EAAE,CAAC,kBAAkB,EACrE,IAAI,EAAE,MAAM,GACX,OAAO,CAaT"}
@@ -1 +1 @@
1
- {"version":3,"file":"rich-type-refusal.d.ts","sourceRoot":"","sources":["../src/rich-type-refusal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,KAAK,EACV,MAAM,EACN,UAAU,EACV,aAAa,EACb,cAAc,EAKf,MAAM,YAAY,CAAA;AAiBnB;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,CAQ1G;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,CAe1I"}
1
+ {"version":3,"file":"rich-type-refusal.d.ts","sourceRoot":"","sources":["../src/rich-type-refusal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,KAAK,EACV,MAAM,EACN,UAAU,EACV,aAAa,EACb,cAAc,EAKf,MAAM,YAAY,CAAA;AAkBnB;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,CAQ1G;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,CAe1I"}
@@ -29,11 +29,22 @@
29
29
  * "just names you can't resolve against component-level state."
30
30
  */
31
31
  /**
32
- * The identifier a template reads as the component's props object:
33
- * `props.X` is the component's prop `X` while no binding shadows `props`
34
- * (#3693).
32
+ * The identifier a template reads as the component's props object when the
33
+ * component does not name one itself: `props.X` is the component's prop `X`
34
+ * while no binding shadows `props` (#3693). A component that takes its props
35
+ * as one object names it with its parameter (`function C(p)`), and
36
+ * {@link BindingScope.forComponent} makes that name the props object instead.
35
37
  */
36
38
  export declare const PROPS_OBJECT_IDENTIFIER = "props";
39
+ /**
40
+ * The identifier that names the props object of a component whose props
41
+ * parameter is `propsObjectName` (`IRMetadata.propsObjectName`): that name
42
+ * (`function C(p)` → `p`), or {@link PROPS_OBJECT_IDENTIFIER} when the
43
+ * component destructures its props (`null`). The single answer to "which
44
+ * identifier is the component's props object"; {@link BindingScope.propsObject}
45
+ * carries it.
46
+ */
47
+ export declare function propsObjectIdentifier(propsObjectName: string | null | undefined): string;
37
48
  /**
38
49
  * How a name inside a `ScopeFrame` came to be bound — the row shapes
39
50
  * (`'item'`/`'index'`/`'destructure'`/`'preamble'`) for `'loop-row'` frames,
@@ -87,9 +98,27 @@ export interface LoopBindingSource {
87
98
  }
88
99
  /** Structural pick of `TypeInfo` (`packages/jsx/src/types.ts`). */
89
100
  export interface LoopValueType {
101
+ /** `TypeInfo.kind`; `'unknown'` for `any`, `unknown` and unresolved types. */
102
+ readonly kind?: string;
90
103
  readonly primitive?: string;
91
104
  readonly unionTypes?: readonly LoopValueType[];
105
+ /** A named type's name (`Row`), resolved through {@link NamedTypeFields}. */
106
+ readonly raw?: string;
107
+ readonly properties?: readonly LoopValueField[];
108
+ readonly elementType?: LoopValueType;
92
109
  }
110
+ /** Structural pick of `PropertyInfo` (`packages/jsx/src/types.ts`). */
111
+ export interface LoopValueField {
112
+ readonly name: string;
113
+ readonly type: LoopValueType;
114
+ /** `name?:` — the field may be absent, so its value may be `undefined`. */
115
+ readonly optional?: boolean;
116
+ }
117
+ /**
118
+ * The fields of a named type (`type Row = { … }`, an interface), by name;
119
+ * undefined when the component's file does not define it as an object type.
120
+ */
121
+ export type NamedTypeFields = (name: string) => readonly LoopValueField[] | undefined;
93
122
  /** Structural copy of `LoopBindingPathSegment` (`packages/jsx/src/types.ts`). */
94
123
  export type RowPathSegment = {
95
124
  readonly kind: 'field';
@@ -99,6 +128,34 @@ export type RowPathSegment = {
99
128
  readonly kind: 'index';
100
129
  readonly index: number;
101
130
  };
131
+ /**
132
+ * The type at `segments` below `type`, through object types, named types
133
+ * (`namedFields`) and array elements; null when a step is not known.
134
+ *
135
+ * A union resolves the path in each member and is the union of the results,
136
+ * null when any member has no such path. A field is therefore definitely a
137
+ * string only when it is one in every member: the element type of a
138
+ * `concat` (`loopRowType`) is the union of its receiver's and arguments'
139
+ * element types, so `Row` and a same-shaped `Other` both read `id: string`,
140
+ * while an `any` member or an omitted field reads nothing (#3762 review).
141
+ */
142
+ export declare function loopValueTypeAt(type: LoopValueType, segments: readonly RowPathSegment[], namedFields?: NamedTypeFields): LoopValueType | null;
143
+ /**
144
+ * The element type of an array type, or of a union whose every member is an
145
+ * array (a `concat` of arrays, a field read across `concat` rows): the union
146
+ * of their element types. Undefined for anything else. Every reader of an
147
+ * element type goes through this, so a union of arrays reads like an array
148
+ * (#3762 review).
149
+ */
150
+ export declare function arrayElementType<T extends LoopValueType>(type: T | null | undefined): T | undefined;
151
+ /**
152
+ * The union of `members`, normalised: one member, or members that are all
153
+ * structurally the same type, is that member itself, so `Row[] ∪ Row[]`
154
+ * keeps the plain `Row[]` shape.
155
+ */
156
+ export declare function unionOfLoopValueTypes<T extends LoopValueType>(members: readonly T[]): T;
157
+ /** Whether two types have the same structure: kind, name, primitive, fields, elements and members. */
158
+ export declare function isSameLoopValueShape(a: LoopValueType | undefined, b: LoopValueType | undefined): boolean;
102
159
  /**
103
160
  * A stack of `ScopeFrame`s, innermost frame at index 0 of the internal
104
161
  * array (i.e. `frames[0]` is what `enterLoopRow`/`enterCallback` most
@@ -108,8 +165,22 @@ export type RowPathSegment = {
108
165
  */
109
166
  export declare class BindingScope {
110
167
  private readonly frames;
168
+ readonly propsObject: string;
111
169
  static readonly EMPTY: BindingScope;
170
+ /**
171
+ * `propsObject`: the identifier that names the component's props object
172
+ * in this scope's component ({@link forComponent}). Every child scope
173
+ * keeps it.
174
+ */
112
175
  private constructor();
176
+ /**
177
+ * The empty scope of a component whose props object parameter is
178
+ * `propsObjectName` (`IRMetadata.propsObjectName`, decided in Phase 1):
179
+ * `function C(p)` reads its props as `p.X`, so `p` is the props object.
180
+ * A component that destructures its props (`null`) keeps
181
+ * {@link PROPS_OBJECT_IDENTIFIER}.
182
+ */
183
+ static forComponent(propsObjectName: string | null): BindingScope;
113
184
  /**
114
185
  * Child scope with a new `'loop-row'` frame for one loop's per-item
115
186
  * bindings. Parent (`this`) is not mutated; the returned scope is a
@@ -140,8 +211,8 @@ export declare class BindingScope {
140
211
  * `adapters/loop-bound-names.ts`'s `collectLoopBoundNames` adds BOTH
141
212
  * `node.param` AND every `paramBindings[i].name` unconditionally
142
213
  * (never skipping `param` in the destructured case) — a deliberately
143
- * coarser, over-inclusive collection used only to subtract names from
144
- * a flat string-typing Set (safe to over-exclude there). This method
214
+ * coarser, over-inclusive collection for whole-component "may be
215
+ * shadowed somewhere" checks (safe to over-exclude there). This method
145
216
  * follows the precise `jsx-to-ir.ts` `ctx.loopParams` semantics, since
146
217
  * that is the mechanism actually doing scope-shadowed name RESOLUTION
147
218
  * (the behavior `BindingScope` replaces), not coarse exclusion.
@@ -167,7 +238,7 @@ export declare class BindingScope {
167
238
  isBound(name: string): boolean;
168
239
  /**
169
240
  * Whether a binding here shadows the component's props object
170
- * ({@link PROPS_OBJECT_IDENTIFIER}): a `.map((props) => …)` row, a
241
+ * ({@link propsObject}): a `.map((props) => …)` row, a
171
242
  * destructured `({ props })` field, a preamble local or a callback param.
172
243
  * `props.X` then reads that binding's member, not the component's prop
173
244
  * `X` (#3693).
@@ -175,11 +246,15 @@ export declare class BindingScope {
175
246
  shadowsPropsObject(): boolean;
176
247
  /**
177
248
  * Resolve string typing at this position, respecting the nearest binding.
178
- * `componentProperty`: `name` is read as `props.<name>`, which is the
179
- * component's prop only while no binding shadows `props`; a shadowing
180
- * binding's member has no typing here.
249
+ * `componentProperty`: `name` is read as the literal `props.<name>`. That is
250
+ * the component's prop only when `props` is this component's props object
251
+ * and no binding shadows it; while a binding named `props` is in scope, it
252
+ * is that binding's member. `path`: the read is the member chain
253
+ * `name.<path…>` (`row.id`). A loop row binding resolves the chain against
254
+ * its row type (`LoopBindingSource.rowType`), through `namedFields` for a
255
+ * named type; an outer name has typing for itself only.
181
256
  */
182
- isStringValueName(name: string, outer: (name: string) => boolean, componentProperty?: boolean): boolean;
257
+ isStringValueName(name: string, outer: (name: string) => boolean, componentProperty?: boolean, path?: readonly string[], namedFields?: NamedTypeFields): boolean;
183
258
  /** Whether any frame is a loop row: the position sits inside a `.map()` row body. */
184
259
  insideLoopRow(): boolean;
185
260
  /** The names the innermost frame binds, in binding order. */
@@ -1 +1 @@
1
- {"version":3,"file":"binding-scope.d.ts","sourceRoot":"","sources":["../../src/scope/binding-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,UAAU,CAAA;AAE9C;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,UAAU,GAAG,OAAO,CAAA;AAExF,MAAM,WA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;;;;;;;;;OAgCG;IACH,eAAe,IAAI,WAAW,CAAC,MAAM,CAAC,CAYrC;IAED;;;OAGG;IACH,iBAAiB,IAAI,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAE7C;CACF"}
@@ -20,7 +20,8 @@ import ts from 'typescript';
20
20
  /**
21
21
  * Depth-first walk that maintains the binding stack described above and
22
22
  * reports every identifier along with whether a binding within `root`
23
- * currently shadows it.
23
+ * currently shadows it. `isShadowed` answers the same question for any
24
+ * other name at that identifier's position.
24
25
  */
25
- export declare function walkWithScope(root: ts.Node, visit: (ident: ts.Identifier, parent: ts.Node | undefined, shadowed: boolean) => void): void;
26
+ export declare function walkWithScope(root: ts.Node, visit: (ident: ts.Identifier, parent: ts.Node | undefined, shadowed: boolean, isShadowed: (name: string) => boolean) => void): void;
26
27
  //# sourceMappingURL=lexical-scope-walk.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lexical-scope-walk.d.ts","sourceRoot":"","sources":["../../src/scope/lexical-scope-walk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAA;AAyH3B;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,GACpF,IAAI,CAkBN"}
1
+ {"version":3,"file":"lexical-scope-walk.d.ts","sourceRoot":"","sources":["../../src/scope/lexical-scope-walk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAA;AAyH3B;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,KAAK,IAAI,GAC3H,IAAI,CAkBN"}
@@ -1,6 +1,6 @@
1
1
  import type { ParsedExpr } from '../expression-parser.ts';
2
2
  import type { ComponentIR } from '../types.ts';
3
- import { type BindingScope } from './binding-scope.ts';
3
+ import type { BindingScope } from './binding-scope.ts';
4
4
  /**
5
5
  * Root-prop aliases for template engines that flatten `props.X` to the bare
6
6
  * template variable `X` (#3314). A loop that binds the same name (`.map(value
@@ -44,13 +44,16 @@ export declare function rootPropReadName(name: string, scope: BindingScope, alia
44
44
  /**
45
45
  * Whether `expr` reads the component's props object at a position where
46
46
  * `isBound` answers which names a binding shadows: the bare identifier
47
- * `props` that no binding shadows (#3693). A `.map((props) => …)` row, a
48
- * destructured `({ props })` field, a preamble local or a callback param
49
- * named `props` is that binding instead, so `props.X` reads its member
50
- * rather than flattening to the component's prop `X`. Template emitters
51
- * flatten a `props.X` read only when this holds; `isBound` is the
47
+ * `propsObject` that no binding shadows (#3693). `propsObject` is the
48
+ * component's props object identifier, `BindingScope.propsObject`: the
49
+ * props parameter's own name (`function C(p)` reads `p.X`), or `props` for
50
+ * a component that destructures its props. A `.map((props) => …)` row, a
51
+ * destructured `({ props })` field, a preamble local or a callback param of
52
+ * that name is that binding instead, so `props.X` reads its member rather
53
+ * than flattening to the component's prop `X`. Template emitters flatten a
54
+ * props-object member read only when this holds; `isBound` is the
52
55
  * adapter's current `BindingScope` (`scope.isBound`), or, in a filter
53
56
  * predicate, the predicate's own params plus the enclosing scope.
54
57
  */
55
- export declare function isRootPropsObject(expr: ParsedExpr, isBound: (name: string) => boolean): boolean;
58
+ export declare function isRootPropsObject(expr: ParsedExpr, isBound: (name: string) => boolean, propsObject: string): boolean;
56
59
  //# sourceMappingURL=root-prop-alias.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"root-prop-alias.d.ts","sourceRoot":"","sources":["../../src/scope/root-prop-alias.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAA2B,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAE/E;;;;;;;;;;;GAWG;AAEH;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAmB5G;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAOnC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC,MAAM,CAGR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAE/F"}
1
+ {"version":3,"file":"root-prop-alias.d.ts","sourceRoot":"","sources":["../../src/scope/root-prop-alias.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD;;;;;;;;;;;GAWG;AAEH;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAmB5G;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAOnC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC,MAAM,CAGR;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,EAClC,WAAW,EAAE,MAAM,GAClB,OAAO,CAET"}
@@ -9,10 +9,19 @@ export interface SsrDefault {
9
9
  /**
10
10
  * Static fallback value when neither the caller's props nor the
11
11
  * adapter's own derivation supplies one. JSON-encodable: number,
12
- * string, boolean, null, or a tree of plain objects / arrays. `null`
13
- * when the source expression isn't statically evaluable.
12
+ * string, boolean, null, or a tree of plain objects / arrays, in which
13
+ * an `undefined` array element or object member is the sentinel
14
+ * `{"$undef": true}` (`UNDEFINED_SENTINEL`) that every runtime's seed
15
+ * decodes to its undefined value, and an object key that begins with `$`
16
+ * carries one more `$` (`encodeUndefinedMembers`). `null` when the source expression
17
+ * isn't statically evaluable.
18
+ *
19
+ * Absent on a prop entry whose prop has no destructure default
20
+ * (`spec/js-undefined-value.md`, "Shared: the seed and the default"):
21
+ * there is no default to fall back to, and every reader seeds such an
22
+ * entry with its nil, as {@link deriveStashFromDefaults} does.
14
23
  */
15
- value: unknown;
24
+ value?: unknown;
16
25
  /**
17
26
  * When set, the manifest consumer prefers `props[propName]` over
18
27
  * `value`. Mirrors destructured-prop defaults
@@ -90,6 +99,33 @@ export declare function deriveStashFromDefaults(defaults: Record<string, SsrDefa
90
99
  * exposes no template variables (no props, no signals, no memos).
91
100
  */
92
101
  export declare function extractSsrDefaults(metadata: IRMetadata): Record<string, SsrDefault> | undefined;
102
+ /**
103
+ * The manifest's spelling of JS `undefined` inside a seed value: the
104
+ * one-key sentinel the golden vectors use (`spec/js-undefined-value.md`,
105
+ * "JSON encoding for vectors"). JSON has no `undefined`, and dropping it
106
+ * would turn an array element into `null` and a present member into a
107
+ * missing key.
108
+ */
109
+ export declare const UNDEFINED_SENTINEL: Readonly<{
110
+ $undef: true;
111
+ }>;
112
+ /**
113
+ * `v` with each `undefined` array element and object member replaced by
114
+ * {@link UNDEFINED_SENTINEL}, as a new tree; a top-level `undefined` stays
115
+ * itself (the entry then has no `value`, which every seed reads as its
116
+ * undefined value). So that seed data shaped like the sentinel stays data,
117
+ * every object key that begins with `$` gets one more `$` (`$undef` to
118
+ * `$$undef`, `$$x` to `$$$x`): the only object left with the single key
119
+ * `$undef` is the sentinel, and {@link decodeUndefinedMembers} inverts the
120
+ * encoding exactly.
121
+ */
122
+ export declare function encodeUndefinedMembers(v: unknown): unknown;
123
+ /**
124
+ * {@link encodeUndefinedMembers} inverted: each sentinel (an object whose
125
+ * only key is `$undef`, holding `true`) becomes `undefined` again, and each
126
+ * key that begins with `$$` loses one leading `$`.
127
+ */
128
+ export declare function decodeUndefinedMembers(v: unknown): unknown;
93
129
  /**
94
130
  * Component-scope (non-module) `const` locals, by name → value source text.
95
131
  * `referencesOwnProp` and `collectPropRefsTransitive` (below) use this to