@barefootjs/jsx 0.31.3 → 0.31.5

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 (86) hide show
  1. package/dist/adapters/jsx-adapter.d.ts.map +1 -1
  2. package/dist/adapters/loop-bound-names.d.ts +18 -0
  3. package/dist/adapters/loop-bound-names.d.ts.map +1 -1
  4. package/dist/adapters/template-imports.d.ts +27 -15
  5. package/dist/adapters/template-imports.d.ts.map +1 -1
  6. package/dist/adapters/test-adapter.d.ts.map +1 -1
  7. package/dist/augment-inherited-props.d.ts +12 -2
  8. package/dist/augment-inherited-props.d.ts.map +1 -1
  9. package/dist/compiler.d.ts.map +1 -1
  10. package/dist/debug.d.ts.map +1 -1
  11. package/dist/free-refs.d.ts +11 -2
  12. package/dist/free-refs.d.ts.map +1 -1
  13. package/dist/identifier-pattern.d.ts +62 -0
  14. package/dist/identifier-pattern.d.ts.map +1 -0
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +968 -789
  18. package/dist/ir-to-client-js/collect-elements.d.ts +23 -2
  19. package/dist/ir-to-client-js/collect-elements.d.ts.map +1 -1
  20. package/dist/ir-to-client-js/control-flow/plan/build-event-delegation.d.ts.map +1 -1
  21. package/dist/ir-to-client-js/control-flow/plan/build-reactive-effects.d.ts.map +1 -1
  22. package/dist/ir-to-client-js/control-flow/plan/reactive-effects.d.ts +7 -0
  23. package/dist/ir-to-client-js/control-flow/plan/reactive-effects.d.ts.map +1 -1
  24. package/dist/ir-to-client-js/control-flow/stringify/event-delegation.d.ts.map +1 -1
  25. package/dist/ir-to-client-js/csr-substitute.d.ts +12 -1
  26. package/dist/ir-to-client-js/csr-substitute.d.ts.map +1 -1
  27. package/dist/ir-to-client-js/html-template.d.ts +20 -12
  28. package/dist/ir-to-client-js/html-template.d.ts.map +1 -1
  29. package/dist/ir-to-client-js/imports.d.ts.map +1 -1
  30. package/dist/ir-to-client-js/prop-handling.d.ts +25 -2
  31. package/dist/ir-to-client-js/prop-handling.d.ts.map +1 -1
  32. package/dist/ir-to-client-js/reactivity.d.ts +46 -2
  33. package/dist/ir-to-client-js/reactivity.d.ts.map +1 -1
  34. package/dist/ir-to-client-js/rewrite-props-object.d.ts.map +1 -1
  35. package/dist/ir-to-client-js/types.d.ts +16 -0
  36. package/dist/ir-to-client-js/types.d.ts.map +1 -1
  37. package/dist/ir-to-client-js/utils.d.ts +15 -0
  38. package/dist/ir-to-client-js/utils.d.ts.map +1 -1
  39. package/dist/jsx-to-ir.d.ts.map +1 -1
  40. package/dist/module-exports.d.ts +64 -0
  41. package/dist/module-exports.d.ts.map +1 -1
  42. package/dist/relocate.d.ts.map +1 -1
  43. package/dist/scope/binding-scope.d.ts +1 -1
  44. package/dist/types.d.ts +41 -0
  45. package/dist/types.d.ts.map +1 -1
  46. package/package.json +2 -2
  47. package/src/__tests__/binding-scope-ratchet.test.ts +146 -21
  48. package/src/__tests__/component-type-parameters.test.ts +70 -0
  49. package/src/__tests__/csr-materialize-loop-preamble-shadow.test.ts +85 -0
  50. package/src/__tests__/csr-substitute-enclosing-scope.test.ts +77 -0
  51. package/src/__tests__/free-refs.test.ts +1 -1
  52. package/src/__tests__/identifier-pattern.test.ts +170 -0
  53. package/src/__tests__/loop-child-reactive-attr-const-shadow.test.ts +107 -0
  54. package/src/__tests__/mutable-binding-writers.test.ts +133 -0
  55. package/src/__tests__/preamble-conditional-reactivity.test.ts +191 -0
  56. package/src/__tests__/rewrite-dynamic-imports.test.ts +98 -0
  57. package/src/__tests__/signal-setter-updater-type.test.ts +81 -0
  58. package/src/adapters/jsx-adapter.ts +31 -4
  59. package/src/adapters/loop-bound-names.ts +18 -0
  60. package/src/adapters/template-imports.ts +93 -0
  61. package/src/adapters/test-adapter.ts +4 -1
  62. package/src/augment-inherited-props.ts +13 -1
  63. package/src/compiler.ts +18 -0
  64. package/src/debug.ts +38 -24
  65. package/src/free-refs.ts +14 -5
  66. package/src/identifier-pattern.ts +79 -0
  67. package/src/index.ts +1 -1
  68. package/src/ir-to-client-js/collect-elements.ts +60 -16
  69. package/src/ir-to-client-js/control-flow/plan/build-event-delegation.ts +2 -1
  70. package/src/ir-to-client-js/control-flow/plan/build-reactive-effects.ts +1 -0
  71. package/src/ir-to-client-js/control-flow/plan/reactive-effects.ts +7 -0
  72. package/src/ir-to-client-js/control-flow/stringify/event-delegation.ts +2 -1
  73. package/src/ir-to-client-js/control-flow/stringify/reactive-effects.ts +12 -2
  74. package/src/ir-to-client-js/csr-substitute.ts +19 -2
  75. package/src/ir-to-client-js/html-template.ts +42 -31
  76. package/src/ir-to-client-js/imports.ts +2 -1
  77. package/src/ir-to-client-js/prop-handling.ts +28 -1
  78. package/src/ir-to-client-js/reactivity.ts +58 -6
  79. package/src/ir-to-client-js/rewrite-props-object.ts +2 -1
  80. package/src/ir-to-client-js/types.ts +16 -0
  81. package/src/ir-to-client-js/utils.ts +24 -8
  82. package/src/jsx-to-ir.ts +135 -10
  83. package/src/module-exports.ts +140 -2
  84. package/src/relocate.ts +2 -1
  85. package/src/scope/binding-scope.ts +1 -1
  86. package/src/types.ts +41 -0
@@ -201,7 +201,7 @@ export class BindingScope {
201
201
  * qualifies, including a preamble local shadowing a module const.
202
202
  * These call `isBound` / `boundNames()`.
203
203
  * - REACTIVITY / SLOT-ID CLASSIFIERS (`referencesLoopParam`,
204
- * `hasReactiveAttributes`, and the `BindingEnvironment.loopParams`
204
+ * `hasReactiveAttributes`, and the `BindingEnvironment.loopValueBoundNames`
205
205
  * feed built from `makeBindingEnv`, all in `jsx-to-ir.ts`) ask
206
206
  * "does this expression read a value that changes per row and so
207
207
  * needs its own patchable slot" — a preamble local already gets
package/src/types.ts CHANGED
@@ -901,6 +901,28 @@ export interface MapCallbackPreamble {
901
901
  * keeps the plain interpolation it always had.
902
902
  */
903
903
  builderNames: string[]
904
+ /**
905
+ * The subset of {@link declaredNames} whose OWN initializer is itself
906
+ * reactive — reads a signal / memo / reactive prop, directly or
907
+ * transitively through an earlier preamble declaration (#2596). `undefined`
908
+ * (never an empty array) when the preamble contributes no such name, or
909
+ * when it isn't a value-only declaration sequence this analysis covers
910
+ * (see `preambleFromValueStatements`'s caller — a JSX-building preamble
911
+ * doesn't compute this and leaves it unset).
912
+ *
913
+ * Used to decide whether a loop-body CONDITIONAL whose condition
914
+ * bare-references a preamble local should carry the IR `reactive` flag
915
+ * (`markPreambleConditionalReactivity`, jsx-to-ir.ts). Deliberately NOT the
916
+ * same test `collectPreambleRegions`/`markPreambleAttrSlots` use for
917
+ * text/attr positions — those mark ANY reference to `declaredNames`
918
+ * reactive because their region-patch effect re-runs the whole preamble
919
+ * unconditionally on row update, and ordinary signal auto-tracking inside
920
+ * that effect picks up genuine dependencies regardless of the IR flag. A
921
+ * conditional instead swaps whole DOM subtrees via `insert()`, so it stays
922
+ * unwrapped unless the local it reads is proven to depend on an actual
923
+ * external signal — a bare `item.title`-derived local needs no such wrap.
924
+ */
925
+ reactiveNames?: string[]
904
926
  }
905
927
 
906
928
  /**
@@ -1940,6 +1962,25 @@ export interface IRMetadata {
1940
1962
  isClientComponent: boolean
1941
1963
  typeDefinitions: TypeDefinition[]
1942
1964
  propsType: TypeInfo | null
1965
+ /**
1966
+ * The component function's own generic type parameter list, verbatim
1967
+ * from source (each `node.getText()`, joined and wrapped in `<...>`),
1968
+ * e.g. `<NodeType extends NodeBase = NodeBase, EdgeType extends
1969
+ * EdgeBase = EdgeBase>`. `null` when the component isn't generic.
1970
+ *
1971
+ * A generic function component's props type (and often its body) keeps
1972
+ * referencing these names verbatim in emitted output (e.g. `props:
1973
+ * FlowComponentProps<NodeType, EdgeType>`, `createFlowStore<NodeType,
1974
+ * EdgeType>(props)`) — without the function's own declaration also
1975
+ * carrying the type parameters, those references are unresolved names
1976
+ * in the emitted `.tsx` (TS2304). Emitters that print a `function
1977
+ * <name>(...)` signature for the component must splice this verbatim
1978
+ * between the name and the parameter list. Optional (rather than
1979
+ * required) so the many hand-built `IRMetadata` test fixtures across
1980
+ * the suite don't need updating for a field that is `null` for the
1981
+ * overwhelming majority of (non-generic) components.
1982
+ */
1983
+ typeParameters?: string | null
1943
1984
  propsParams: ParamInfo[]
1944
1985
  /** Name of the props object parameter (e.g., 'props' in `function Component(props: Props)`) */
1945
1986
  propsObjectName: string | null