@alloy-js/core 0.17.0 → 0.18.0-dev.3

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 (195) hide show
  1. package/dist/src/binder.d.ts +2 -1
  2. package/dist/src/binder.d.ts.map +1 -1
  3. package/dist/src/binder.js +2 -2
  4. package/dist/src/code.d.ts +1 -1
  5. package/dist/src/code.d.ts.map +1 -1
  6. package/dist/src/components/Block.d.ts +1 -1
  7. package/dist/src/components/Block.d.ts.map +1 -1
  8. package/dist/src/components/Declaration.d.ts +1 -1
  9. package/dist/src/components/Declaration.d.ts.map +1 -1
  10. package/dist/src/components/Declaration.js +1 -1
  11. package/dist/src/components/For.d.ts +1 -1
  12. package/dist/src/components/For.d.ts.map +1 -1
  13. package/dist/src/components/For.js +1 -1
  14. package/dist/src/components/Indent.d.ts +1 -1
  15. package/dist/src/components/Indent.d.ts.map +1 -1
  16. package/dist/src/components/List.d.ts +1 -1
  17. package/dist/src/components/List.d.ts.map +1 -1
  18. package/dist/src/components/List.js +2 -1
  19. package/dist/src/components/MemberDeclaration.d.ts +2 -2
  20. package/dist/src/components/MemberDeclaration.d.ts.map +1 -1
  21. package/dist/src/components/MemberDeclaration.js +2 -1
  22. package/dist/src/components/MemberScope.d.ts +2 -2
  23. package/dist/src/components/MemberScope.d.ts.map +1 -1
  24. package/dist/src/components/Output.d.ts +1 -1
  25. package/dist/src/components/Output.d.ts.map +1 -1
  26. package/dist/src/components/Output.js +1 -1
  27. package/dist/src/components/Prose.d.ts +1 -1
  28. package/dist/src/components/Prose.d.ts.map +1 -1
  29. package/dist/src/components/ReferenceOrContent.d.ts +1 -1
  30. package/dist/src/components/ReferenceOrContent.d.ts.map +1 -1
  31. package/dist/src/components/Scope.d.ts +1 -1
  32. package/dist/src/components/Scope.d.ts.map +1 -1
  33. package/dist/src/components/Show.d.ts +1 -1
  34. package/dist/src/components/Show.d.ts.map +1 -1
  35. package/dist/src/components/SourceDirectory.d.ts +1 -1
  36. package/dist/src/components/SourceDirectory.d.ts.map +1 -1
  37. package/dist/src/components/SourceDirectory.js +1 -1
  38. package/dist/src/components/SourceFile.d.ts +1 -1
  39. package/dist/src/components/SourceFile.d.ts.map +1 -1
  40. package/dist/src/components/SourceFile.js +1 -1
  41. package/dist/src/components/StatementList.d.ts +1 -1
  42. package/dist/src/components/StatementList.d.ts.map +1 -1
  43. package/dist/src/components/Switch.d.ts +2 -2
  44. package/dist/src/components/Switch.d.ts.map +1 -1
  45. package/dist/src/components/Switch.js +2 -1
  46. package/dist/src/components/Wrap.d.ts +1 -1
  47. package/dist/src/components/Wrap.d.ts.map +1 -1
  48. package/dist/src/context/binder.d.ts +1 -1
  49. package/dist/src/context/binder.d.ts.map +1 -1
  50. package/dist/src/context/source-file.d.ts +1 -1
  51. package/dist/src/context/source-file.d.ts.map +1 -1
  52. package/dist/src/context.d.ts +2 -2
  53. package/dist/src/context.d.ts.map +1 -1
  54. package/dist/src/context.js +1 -1
  55. package/dist/src/debug.d.ts +1 -0
  56. package/dist/src/debug.d.ts.map +1 -1
  57. package/dist/src/debug.js +4 -1
  58. package/dist/src/index.d.ts +4 -1
  59. package/dist/src/index.d.ts.map +1 -1
  60. package/dist/src/index.js +4 -1
  61. package/dist/src/jsx-runtime.d.ts +4 -281
  62. package/dist/src/jsx-runtime.d.ts.map +1 -1
  63. package/dist/src/jsx-runtime.js +3 -319
  64. package/dist/src/props-combinators.d.ts +19 -0
  65. package/dist/src/props-combinators.d.ts.map +1 -0
  66. package/dist/src/props-combinators.js +108 -0
  67. package/dist/src/reactive-union-set.d.ts.map +1 -1
  68. package/dist/src/reactive-union-set.js +1 -1
  69. package/dist/src/reactivity.d.ts +75 -0
  70. package/dist/src/reactivity.d.ts.map +1 -0
  71. package/dist/src/reactivity.js +141 -0
  72. package/dist/src/render.d.ts +5 -1
  73. package/dist/src/render.d.ts.map +1 -1
  74. package/dist/src/render.js +68 -15
  75. package/dist/src/runtime/component.d.ts +24 -0
  76. package/dist/src/runtime/component.d.ts.map +1 -0
  77. package/dist/src/runtime/component.js +19 -0
  78. package/dist/src/runtime/intrinsic.d.ts +168 -0
  79. package/dist/src/runtime/intrinsic.d.ts.map +1 -0
  80. package/dist/src/runtime/intrinsic.js +11 -0
  81. package/dist/src/slot.d.ts +2 -2
  82. package/dist/src/slot.d.ts.map +1 -1
  83. package/dist/src/slot.js +1 -1
  84. package/dist/src/stc.d.ts +1 -1
  85. package/dist/src/stc.d.ts.map +1 -1
  86. package/dist/src/sti.d.ts +7 -6
  87. package/dist/src/sti.d.ts.map +1 -1
  88. package/dist/src/sti.js +1 -1
  89. package/dist/src/symbols/flags.d.ts +70 -0
  90. package/dist/src/symbols/flags.d.ts.map +1 -0
  91. package/dist/src/symbols/flags.js +72 -0
  92. package/dist/src/symbols/index.d.ts +1 -0
  93. package/dist/src/symbols/index.d.ts.map +1 -1
  94. package/dist/src/symbols/index.js +1 -0
  95. package/dist/src/symbols/output-scope.d.ts +2 -24
  96. package/dist/src/symbols/output-scope.d.ts.map +1 -1
  97. package/dist/src/symbols/output-scope.js +1 -25
  98. package/dist/src/symbols/output-symbol.d.ts +2 -47
  99. package/dist/src/symbols/output-symbol.d.ts.map +1 -1
  100. package/dist/src/symbols/output-symbol.js +2 -48
  101. package/dist/src/symbols/symbol-flow.d.ts.map +1 -1
  102. package/dist/src/symbols/symbol-flow.js +2 -2
  103. package/dist/src/symbols/symbol-slot.d.ts +1 -1
  104. package/dist/src/symbols/symbol-slot.d.ts.map +1 -1
  105. package/dist/src/symbols/symbol-slot.js +1 -1
  106. package/dist/src/symbols/symbol-table.d.ts +3 -3
  107. package/dist/src/symbols/symbol-table.d.ts.map +1 -1
  108. package/dist/src/tap.d.ts +1 -1
  109. package/dist/src/tap.d.ts.map +1 -1
  110. package/dist/src/tracer.d.ts +60 -3
  111. package/dist/src/tracer.d.ts.map +1 -1
  112. package/dist/src/tracer.js +60 -5
  113. package/dist/src/utils.d.ts +4 -3
  114. package/dist/src/utils.d.ts.map +1 -1
  115. package/dist/src/utils.js +2 -1
  116. package/dist/test/props-with-defaults.test.js +1 -1
  117. package/dist/test/reactive-union-set.test.js +1 -1
  118. package/dist/test/reactivity/cleanup.test.js +2 -1
  119. package/dist/test/reactivity/memo.test.js +1 -1
  120. package/dist/test/reactivity/untrack.test.js +1 -1
  121. package/dist/test/rendering/memoization.test.js +2 -1
  122. package/dist/test/split-props.test.js +1 -1
  123. package/dist/test/symbols/output-scope.test.js +2 -1
  124. package/dist/test/symbols/output-symbol.test.js +4 -3
  125. package/dist/test/symbols/resolution.test.js +2 -1
  126. package/dist/test/symbols/utils.d.ts +3 -2
  127. package/dist/test/symbols/utils.d.ts.map +1 -1
  128. package/dist/test/symbols/utils.js +2 -1
  129. package/dist/testing/extend-expect.d.ts +15 -0
  130. package/dist/testing/extend-expect.d.ts.map +1 -1
  131. package/dist/testing/extend-expect.js +2 -1
  132. package/dist/testing/render.d.ts +1 -1
  133. package/dist/testing/render.d.ts.map +1 -1
  134. package/dist/tsconfig.tsbuildinfo +1 -1
  135. package/package.json +7 -4
  136. package/src/binder.ts +3 -5
  137. package/src/code.ts +1 -1
  138. package/src/components/Block.tsx +1 -1
  139. package/src/components/Declaration.tsx +2 -1
  140. package/src/components/For.tsx +2 -1
  141. package/src/components/Indent.tsx +1 -1
  142. package/src/components/List.tsx +3 -1
  143. package/src/components/MemberDeclaration.tsx +4 -3
  144. package/src/components/MemberScope.tsx +2 -2
  145. package/src/components/Output.tsx +2 -1
  146. package/src/components/Prose.tsx +1 -1
  147. package/src/components/ReferenceOrContent.tsx +1 -1
  148. package/src/components/Scope.tsx +1 -1
  149. package/src/components/Show.tsx +1 -1
  150. package/src/components/SourceDirectory.tsx +2 -1
  151. package/src/components/SourceFile.tsx +2 -1
  152. package/src/components/StatementList.tsx +1 -1
  153. package/src/components/Switch.tsx +2 -1
  154. package/src/components/Wrap.tsx +1 -1
  155. package/src/context/binder.ts +1 -1
  156. package/src/context/source-file.ts +1 -1
  157. package/src/context.ts +3 -7
  158. package/src/debug.ts +5 -1
  159. package/src/index.ts +4 -1
  160. package/src/jsx-runtime.ts +15 -690
  161. package/src/props-combinators.ts +148 -0
  162. package/src/reactive-union-set.ts +1 -1
  163. package/src/reactivity.ts +230 -0
  164. package/src/render.ts +97 -26
  165. package/src/runtime/component.ts +67 -0
  166. package/src/runtime/intrinsic.ts +199 -0
  167. package/src/slot.ts +3 -4
  168. package/src/stc.ts +2 -2
  169. package/src/sti.ts +11 -11
  170. package/src/symbols/flags.ts +82 -0
  171. package/src/symbols/index.ts +1 -0
  172. package/src/symbols/output-scope.ts +2 -29
  173. package/src/symbols/output-symbol.ts +2 -55
  174. package/src/symbols/symbol-flow.ts +3 -7
  175. package/src/symbols/symbol-slot.tsx +2 -1
  176. package/src/symbols/symbol-table.ts +3 -3
  177. package/src/tap.ts +1 -1
  178. package/src/tracer.ts +38 -4
  179. package/src/utils.tsx +7 -5
  180. package/temp/api.json +984 -1261
  181. package/test/props-with-defaults.test.ts +1 -1
  182. package/test/reactive-union-set.test.tsx +1 -1
  183. package/test/reactivity/cleanup.test.tsx +2 -1
  184. package/test/reactivity/memo.test.tsx +1 -1
  185. package/test/reactivity/untrack.test.ts +1 -1
  186. package/test/rendering/basic.test.tsx +1 -1
  187. package/test/rendering/memoization.test.tsx +1 -1
  188. package/test/split-props.test.ts +1 -1
  189. package/test/symbols/output-scope.test.ts +2 -4
  190. package/test/symbols/output-symbol.test.ts +4 -7
  191. package/test/symbols/resolution.test.ts +2 -4
  192. package/test/symbols/utils.ts +3 -5
  193. package/test/utils.test.tsx +1 -1
  194. package/testing/extend-expect.ts +16 -0
  195. package/testing/render.ts +1 -2
@@ -1,5 +1,6 @@
1
1
  import { isRef, Ref } from "@vue/reactivity";
2
- import { type Children, memo } from "../jsx-runtime.js";
2
+ import { memo } from "../reactivity.js";
3
+ import type { Children } from "../runtime/component.js";
3
4
  import { baseListPropsToMapJoinArgs, mapJoin } from "../utils.js";
4
5
  import { BaseListProps } from "./List.jsx";
5
6
 
@@ -1,4 +1,4 @@
1
- import type { Children } from "../jsx-runtime.js";
1
+ import type { Children } from "../runtime/component.js";
2
2
 
3
3
  export interface IndentProps {
4
4
  children: Children;
@@ -1,4 +1,6 @@
1
- import { Children, memo, splitProps } from "../jsx-runtime.js";
1
+ import { splitProps } from "../props-combinators.js";
2
+ import { memo } from "../reactivity.js";
3
+ import type { Children } from "../runtime/component.js";
2
4
  import { childrenArray } from "../utils.js";
3
5
  import { For } from "./For.jsx";
4
6
 
@@ -1,9 +1,10 @@
1
1
  import { useContext } from "../context.js";
2
2
  import { BinderContext } from "../context/binder.js";
3
3
  import { MemberDeclarationContext } from "../context/member-declaration.js";
4
- import { Children } from "../jsx-runtime.js";
5
- import { Refkey } from "../refkey.js";
6
- import { OutputSymbol, OutputSymbolFlags } from "../symbols/output-symbol.js";
4
+ import type { Refkey } from "../refkey.js";
5
+ import type { Children } from "../runtime/component.js";
6
+ import { OutputSymbolFlags } from "../symbols/flags.js";
7
+ import { OutputSymbol } from "../symbols/output-symbol.js";
7
8
 
8
9
  /**
9
10
  * Create a member declaration by providing a symbol name and optional symbol
@@ -1,6 +1,6 @@
1
1
  import { MemberScopeContext } from "../context/member-scope.js";
2
- import { Children } from "../jsx-runtime.js";
3
- import { OutputSymbol } from "../symbols/output-symbol.js";
2
+ import type { Children } from "../runtime/component.js";
3
+ import type { OutputSymbol } from "../symbols/output-symbol.js";
4
4
  export interface MemberScopeProps {
5
5
  /**
6
6
  * The name of the member scope.
@@ -5,9 +5,10 @@ import {
5
5
  } from "../binder.js";
6
6
  import { BinderContext } from "../context/binder.js";
7
7
  import { NamePolicyContext } from "../context/name-policy.js";
8
- import { Children, getContext } from "../jsx-runtime.js";
9
8
  import { NamePolicy } from "../name-policy.js";
9
+ import { getContext } from "../reactivity.js";
10
10
  import { PrintTreeOptions } from "../render.js";
11
+ import type { Children } from "../runtime/component.js";
11
12
  import { extensionEffects } from "../slot.js";
12
13
  import { SourceDirectory } from "./SourceDirectory.js";
13
14
 
@@ -1,5 +1,5 @@
1
1
  import { childrenArray, computed } from "@alloy-js/core";
2
- import type { Children } from "../jsx-runtime.js";
2
+ import type { Children } from "../runtime/component.js";
3
3
 
4
4
  export interface Prose {
5
5
  children: Children;
@@ -1,8 +1,8 @@
1
1
  import { computed } from "@vue/reactivity";
2
2
  import { useContext } from "../context.js";
3
3
  import { BinderContext } from "../context/binder.js";
4
- import type { Children } from "../jsx-runtime.js";
5
4
  import type { Refkey } from "../refkey.js";
5
+ import type { Children } from "../runtime/component.js";
6
6
 
7
7
  export interface ReferenceOrContentProps {
8
8
  readonly refkey: Refkey;
@@ -1,5 +1,5 @@
1
1
  import { ScopeContext } from "../context/scope.js";
2
- import { Children } from "../jsx-runtime.js";
2
+ import type { Children } from "../runtime/component.js";
3
3
  import { OutputScope } from "../symbols/output-scope.js";
4
4
 
5
5
  /**
@@ -1,4 +1,4 @@
1
- import type { Children } from "../jsx-runtime.js";
1
+ import type { Children } from "../runtime/component.js";
2
2
 
3
3
  export interface ShowProps {
4
4
  children: Children;
@@ -2,7 +2,8 @@ import { shallowReactive } from "@vue/reactivity";
2
2
  import { join } from "pathe";
3
3
  import { useContext } from "../context.js";
4
4
  import { SourceDirectoryContext } from "../context/source-directory.js";
5
- import { Children, getContext } from "../jsx-runtime.js";
5
+ import { getContext } from "../reactivity.js";
6
+ import type { Children } from "../runtime/component.js";
6
7
 
7
8
  export interface SourceDirectoryProps {
8
9
  path: string;
@@ -2,9 +2,10 @@ import { join } from "pathe";
2
2
  import { useContext } from "../context.js";
3
3
  import { SourceDirectoryContext } from "../context/source-directory.js";
4
4
  import { SourceFileContext } from "../context/source-file.js";
5
- import { Children, ComponentDefinition, getContext } from "../jsx-runtime.js";
5
+ import { getContext } from "../reactivity.js";
6
6
  import { Refkey } from "../refkey.js";
7
7
  import { PrintTreeOptions } from "../render.js";
8
+ import type { Children, ComponentDefinition } from "../runtime/component.js";
8
9
  import { Show } from "./Show.jsx";
9
10
 
10
11
  export interface SourceFileProps extends PrintTreeOptions {
@@ -1,4 +1,4 @@
1
- import type { Children } from "../jsx-runtime.js";
1
+ import type { Children } from "../runtime/component.js";
2
2
  import { List } from "./List.jsx";
3
3
 
4
4
  export interface StatementListProps {
@@ -1,4 +1,5 @@
1
- import { type Children, memo, taggedComponent } from "../jsx-runtime.js";
1
+ import { memo } from "../reactivity.js";
2
+ import { type Children, taggedComponent } from "../runtime/component.js";
2
3
  import { childrenArray, findKeyedChildren } from "../utils.js";
3
4
 
4
5
  export interface SwitchProps {
@@ -1,4 +1,4 @@
1
- import { Children, ComponentDefinition } from "../jsx-runtime.js";
1
+ import type { Children, ComponentDefinition } from "../runtime/component.js";
2
2
 
3
3
  export interface WrapProps<TProps> {
4
4
  /**
@@ -1,6 +1,6 @@
1
1
  import type { Binder } from "../binder.js";
2
2
  import {
3
- ComponentContext,
3
+ type ComponentContext,
4
4
  createNamedContext,
5
5
  useContext,
6
6
  } from "../context.js";
@@ -1,6 +1,6 @@
1
1
  import { ComponentContext, createNamedContext } from "../context.js";
2
- import type { ComponentDefinition } from "../jsx-runtime.js";
3
2
  import type { Refkey } from "../refkey.js";
3
+ import { ComponentDefinition } from "../runtime/component.js";
4
4
 
5
5
  export interface SourceFileContext {
6
6
  path: string;
package/src/context.ts CHANGED
@@ -1,11 +1,7 @@
1
1
  import { shallowRef } from "@vue/reactivity";
2
- import {
3
- Children,
4
- ComponentDefinition,
5
- effect,
6
- getContext,
7
- } from "./jsx-runtime.js";
8
- import { stc, StcSignature } from "./stc.js";
2
+ import { effect, getContext } from "./reactivity.js";
3
+ import type { Children, ComponentDefinition } from "./runtime/component.js";
4
+ import { stc, type StcSignature } from "./stc.js";
9
5
 
10
6
  export interface ComponentContext<T> {
11
7
  id: symbol;
package/src/debug.ts CHANGED
@@ -2,7 +2,7 @@ import { isReactive } from "@vue/reactivity";
2
2
  import Table from "cli-table3";
3
3
  import pc from "picocolors";
4
4
  import { contextsByKey } from "./context.js";
5
- import { Context, getContext } from "./jsx-runtime.js";
5
+ import { Context, getContext } from "./reactivity.js";
6
6
 
7
7
  interface DebugInterface {
8
8
  component: {
@@ -206,3 +206,7 @@ function kvTable(sep = " ") {
206
206
  style: { "padding-left": 0, "padding-right": 0 },
207
207
  });
208
208
  }
209
+
210
+ export function shouldDebug() {
211
+ return typeof process !== "undefined" && !!process.env?.ALLOY_DEBUG;
212
+ }
package/src/index.ts CHANGED
@@ -27,11 +27,14 @@ export * from "./code.js";
27
27
  export * from "./components/index.js";
28
28
  export * from "./context.js";
29
29
  export * from "./context/index.js";
30
- export * from "./jsx-runtime.js";
31
30
  export * from "./name-policy.js";
31
+ export * from "./props-combinators.js";
32
32
  export * from "./reactive-union-set.js";
33
+ export * from "./reactivity.js";
33
34
  export * from "./refkey.js";
34
35
  export * from "./render.js";
36
+ export * from "./runtime/component.js";
37
+ export * from "./runtime/intrinsic.js";
35
38
  export * from "./stc.js";
36
39
  export * from "./sti.js";
37
40
  export * from "./symbols/index.js";