@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
@@ -0,0 +1,199 @@
1
+ import type { Children } from "./component.js";
2
+ export interface IntrinsicElements {
3
+ /**
4
+ * Attempt to render the children on a single line if possible. If a group
5
+ * contains `<breakParent />` or a hard line, or if the group exceeds the
6
+ * print width, all linebreaks in the group will be broken.
7
+ */
8
+ group: { shouldBreak?: boolean; id?: symbol; children: Children };
9
+
10
+ /**
11
+ * A regular line break. This will break if the line exceeds the print
12
+ * width, otherwise it will be a space.
13
+ */
14
+ line: {};
15
+
16
+ /**
17
+ * A regular line break. This will break if the line exceeds the print
18
+ * width, otherwise it will be a space.
19
+ */
20
+ br: {};
21
+
22
+ /**
23
+ * A hard line break. This is a line that will always break, even if the
24
+ * group does not exceed print width.
25
+ */
26
+ hardline: {};
27
+
28
+ /**
29
+ * A hard line break. This is a line that will always break, even if the
30
+ * group does not exceed print width.
31
+ */
32
+ hbr: {};
33
+
34
+ /**
35
+ * A soft line break. This will break if the line exceeds the print width,
36
+ * otherwise it will be be nothing.
37
+ */
38
+ softline: {};
39
+
40
+ /**
41
+ * A soft line break. This will break if the line exceeds the print width,
42
+ * otherwise it will be be nothing.
43
+ */
44
+ sbr: {};
45
+
46
+ /**
47
+ * A literal line break. This will always break, even if the group does not
48
+ * exceed print width. The new line will ignore indentation.
49
+ */
50
+ literalline: {};
51
+
52
+ /**
53
+ * A literal line break. This will always break, even if the group does not
54
+ * exceed print width. The new line will ignore indentation.
55
+ */
56
+ lbr: {};
57
+
58
+ /**
59
+ * Increase the indentation level of the children of this component.
60
+ * Indentation is determined by the print options provided to the Output
61
+ * component or source file.
62
+ */
63
+ indent: { children: Children };
64
+
65
+ /**
66
+ * Indent the children of this component if the group specified by `groupId`
67
+ * is broken (or not broken if `negate` is passed). The specified group must
68
+ * already be printed.
69
+ */
70
+ indentIfBreak: { children: Children; groupId: symbol; negate?: boolean };
71
+
72
+ /**
73
+ * Similar to `group`, but will only place a line break before the last
74
+ * segment to exceed the print width. This is useful for formatting
75
+ * paragraphs of text where breaks are inserted prior to words which would
76
+ * otherwise exceed the print width.
77
+ */
78
+ fill: { children: Children };
79
+
80
+ /**
81
+ * Force the parent group to break.
82
+ */
83
+ breakParent: {};
84
+
85
+ /**
86
+ * Print children if the current group or already printed group specified by
87
+ * `groupId` is broken. Otherwise, `flatContents` is printed instead.
88
+ */
89
+ ifBreak: { children: Children; flatContents?: Children; groupId?: symbol };
90
+
91
+ /**
92
+ * Print this content at the end of the line. Useful for things like line
93
+ * comments.
94
+ */
95
+ lineSuffix: { children: Children };
96
+
97
+ /**
98
+ * Force any line suffixes to print at this point.
99
+ */
100
+ lineSuffixBoundary: {};
101
+
102
+ /**
103
+ * Decrease the indentation level of the children of this component.
104
+ * Indentation is determined by the print options provided to the Output
105
+ * component or source file.
106
+ */
107
+ dedent: { children: Children };
108
+
109
+ /**
110
+ * Indent the children of this component by either the number of characters
111
+ * indicated by the `width` prop, or by the provided string indicated by the
112
+ * `string` prop.
113
+ */
114
+ align:
115
+ | { children: Children; width: number }
116
+ | { children: Children; string: string };
117
+
118
+ /**
119
+ * Mark the current indentation level as "root" for the purposes of literal
120
+ * line breaks and `dedentToRoot`.
121
+ */
122
+ markAsRoot: { children: Children };
123
+
124
+ /**
125
+ * Decrease the indentation level to the root level specified by
126
+ * `<markAsRoot />`, or else to no indentation.
127
+ */
128
+ dedentToRoot: { children: Children };
129
+ }
130
+ export interface IntrinsicElementBase<
131
+ TKey extends keyof IntrinsicElements = keyof IntrinsicElements,
132
+ > {
133
+ [intrinsicElementKey]: true;
134
+ name: TKey;
135
+ props: IntrinsicElements[TKey];
136
+ }
137
+
138
+ export function createIntrinsic<TKey extends keyof IntrinsicElements>(
139
+ name: TKey,
140
+ props: IntrinsicElements[TKey],
141
+ ): IntrinsicElementBase<TKey> {
142
+ return {
143
+ [intrinsicElementKey]: true,
144
+ name,
145
+ props,
146
+ };
147
+ }
148
+
149
+ export function isIntrinsicElement(type: unknown): type is IntrinsicElement {
150
+ return (
151
+ typeof type === "object" && type !== null && intrinsicElementKey in type
152
+ );
153
+ }
154
+
155
+ export const intrinsicElementKey = Symbol();
156
+ export type IndentIntrinsicElement = IntrinsicElementBase<"indent">;
157
+ export type IndentIfBreakIntrinsicElement =
158
+ IntrinsicElementBase<"indentIfBreak">;
159
+ export type BrIntrinsicElement = IntrinsicElementBase<"br">;
160
+ export type LineIntrinsicElement = IntrinsicElementBase<"line">;
161
+ export type HbrIntrinsicElement = IntrinsicElementBase<"hbr">;
162
+ export type HardlineIntrinsicElement = IntrinsicElementBase<"hardline">;
163
+ export type SbrIntrinsicElement = IntrinsicElementBase<"sbr">;
164
+ export type SoftlineIntrinsicElement = IntrinsicElementBase<"softline">;
165
+ export type GroupIntrinsicElement = IntrinsicElementBase<"group">;
166
+ export type AlignIntrinsicElement = IntrinsicElementBase<"align">;
167
+ export type FillIntrinsicElement = IntrinsicElementBase<"fill">;
168
+ export type BreakParentIntrinsicElement = IntrinsicElementBase<"breakParent">;
169
+ export type LineSuffixIntrinsicElement = IntrinsicElementBase<"lineSuffix">;
170
+ export type LineSuffixBoundaryIntrinsicElement =
171
+ IntrinsicElementBase<"lineSuffixBoundary">;
172
+ export type DedentIntrinsicElement = IntrinsicElementBase<"dedent">;
173
+ export type DedentToRootIntrinsicElement = IntrinsicElementBase<"dedentToRoot">;
174
+ export type MarkAsRootIntrinsicElement = IntrinsicElementBase<"markAsRoot">;
175
+ export type LiterallineIntrinsicElement = IntrinsicElementBase<"literalline">;
176
+ export type LbrIntrinsicElement = IntrinsicElementBase<"lbr">;
177
+ export type IfBreakIntrinsicElement = IntrinsicElementBase<"ifBreak">;
178
+
179
+ export type IntrinsicElement =
180
+ | IndentIntrinsicElement
181
+ | IndentIfBreakIntrinsicElement
182
+ | BrIntrinsicElement
183
+ | LineIntrinsicElement
184
+ | HbrIntrinsicElement
185
+ | HardlineIntrinsicElement
186
+ | SbrIntrinsicElement
187
+ | SoftlineIntrinsicElement
188
+ | GroupIntrinsicElement
189
+ | AlignIntrinsicElement
190
+ | FillIntrinsicElement
191
+ | BreakParentIntrinsicElement
192
+ | LineSuffixIntrinsicElement
193
+ | LineSuffixBoundaryIntrinsicElement
194
+ | DedentIntrinsicElement
195
+ | LiterallineIntrinsicElement
196
+ | LbrIntrinsicElement
197
+ | DedentToRootIntrinsicElement
198
+ | MarkAsRootIntrinsicElement
199
+ | IfBreakIntrinsicElement;
package/src/slot.ts CHANGED
@@ -1,12 +1,11 @@
1
1
  import { ref, Ref } from "@vue/reactivity";
2
+ import { effect, memo } from "./reactivity.js";
2
3
  import {
3
4
  Children,
4
5
  Component,
5
6
  ComponentDefinition,
6
- effect,
7
- memo,
8
- } from "./jsx-runtime.js";
9
- import { OutputSymbol } from "./symbols/output-symbol.js";
7
+ } from "./runtime/component.js";
8
+ import type { OutputSymbol } from "./symbols/output-symbol.js";
10
9
 
11
10
  export interface SlotInstance extends ComponentDefinition {}
12
11
 
package/src/stc.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { code, text } from "./code.js";
2
- import type {
2
+ import {
3
3
  Children,
4
4
  ComponentCreator,
5
5
  ComponentDefinition,
6
- } from "./jsx-runtime.js";
6
+ } from "./runtime/component.js";
7
7
 
8
8
  export type MakeChildrenOptional<T extends object> =
9
9
  T extends { children?: any } ?
package/src/sti.ts CHANGED
@@ -1,19 +1,19 @@
1
1
  import { code, text } from "./code.js";
2
+ import { Children } from "./runtime/component.js";
2
3
  import {
3
- type Children,
4
4
  createIntrinsic,
5
- type IntrinsicElementBase,
6
- type JSX,
7
- } from "./jsx-runtime.js";
5
+ IntrinsicElementBase,
6
+ IntrinsicElements,
7
+ } from "./runtime/intrinsic.js";
8
8
 
9
- export type StiSignature<T extends keyof JSX.IntrinsicElements> = (
9
+ export type StiSignature<T extends keyof IntrinsicElements> = (
10
10
  ...args: unknown extends T ? []
11
- : {} extends Omit<JSX.IntrinsicElements[T], "children"> ?
12
- [props?: JSX.IntrinsicElements[T]]
13
- : [props: JSX.IntrinsicElements[T]]
11
+ : {} extends Omit<IntrinsicElements[T], "children"> ?
12
+ [props?: IntrinsicElements[T]]
13
+ : [props: IntrinsicElements[T]]
14
14
  ) => StiComponentCreator<T>;
15
15
 
16
- export type StiComponentCreator<T extends keyof JSX.IntrinsicElements> =
16
+ export type StiComponentCreator<T extends keyof IntrinsicElements> =
17
17
  (() => IntrinsicElementBase<T>) & {
18
18
  code(
19
19
  template: TemplateStringsArray,
@@ -26,11 +26,11 @@ export type StiComponentCreator<T extends keyof JSX.IntrinsicElements> =
26
26
  children(...children: Children[]): () => IntrinsicElementBase<T>;
27
27
  };
28
28
 
29
- export function sti<T extends keyof JSX.IntrinsicElements>(
29
+ export function sti<T extends keyof IntrinsicElements>(
30
30
  name: T,
31
31
  ): StiSignature<T> {
32
32
  return (...args) => {
33
- const props: JSX.IntrinsicElements[T] | undefined = args[0];
33
+ const props: IntrinsicElements[T] | undefined = args[0];
34
34
  const fn: StiComponentCreator<T> = () => createIntrinsic(name, props!);
35
35
  fn.children = (...children: Children[]) => {
36
36
  const propsWithChildren = {
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Flags that describe an output scope.
3
+ */
4
+ export enum OutputScopeFlags {
5
+ None = 0,
6
+
7
+ /**
8
+ * This scope is a static member scope.
9
+ */
10
+ StaticMemberScope = 1 << 0,
11
+
12
+ /**
13
+ * This scope is an instance member scope.
14
+ */
15
+ InstanceMemberScope = 1 << 1,
16
+
17
+ /**
18
+ * This scope is transient, and only exists to be merged with other scopes.
19
+ */
20
+ Transient = 1 << 2,
21
+
22
+ /**
23
+ * This scope is a member scope. Scopes with this flag will have an `owner`
24
+ * property that points to the symbol whose member this scope holds.
25
+ */
26
+ MemberScope = StaticMemberScope | InstanceMemberScope,
27
+ }
28
+
29
+ /**
30
+ * Flags that describe an output symbol.
31
+ */
32
+ export enum OutputSymbolFlags {
33
+ None = 0,
34
+
35
+ /**
36
+ * The symbol is an instance member container. Symbols with this flag will have a
37
+ * instanceMemberScope property that contains symbols for instance members.
38
+ */
39
+ InstanceMemberContainer = 1 << 0,
40
+
41
+ /**
42
+ * The symbol is a static member container. Symbols with this flag will have a
43
+ * staticMemberScope property that contains symbols for static members.
44
+ */
45
+ StaticMemberContainer = 1 << 1,
46
+
47
+ /**
48
+ * Whether this symbol contains members of any kind.
49
+ */
50
+ MemberContainer = InstanceMemberContainer | StaticMemberContainer,
51
+
52
+ /**
53
+ * Whether this symbol is an instance member of another symbol (i.e that it is
54
+ * stored in an instance member scope).
55
+ */
56
+ InstanceMember = 1 << 2,
57
+
58
+ /**
59
+ * Whether this symbol is a static member of another symbol (i.e that it is
60
+ * stored in a static member scope).
61
+ */
62
+ StaticMember = 1 << 3,
63
+
64
+ /**
65
+ * Transient symbols are not added to symbol tables and do not create
66
+ * referencable refkeys. They are used for temporary symbols that are intended
67
+ * to be used to calculate other symbols.
68
+ */
69
+ Transient = 1 << 4,
70
+
71
+ /**
72
+ * This symbol aliases another symbol. Only its name, flags, and scope are
73
+ * stored in this symbol. Otherwise, everything else is located on the alias
74
+ * target.
75
+ */
76
+ Alias = 1 << 5,
77
+
78
+ /**
79
+ * Whether this is an instance member or static member of another symbol.
80
+ */
81
+ Member = InstanceMember | StaticMember,
82
+ }
@@ -1,3 +1,4 @@
1
+ export * from "./flags.js";
1
2
  export * from "./output-scope.js";
2
3
  export * from "./output-symbol.js";
3
4
  export * from "./symbol-flow.js";
@@ -20,37 +20,10 @@ import {
20
20
  traceEffect,
21
21
  TracePhase,
22
22
  } from "../tracer.js";
23
- import { OutputSymbol } from "./output-symbol.js";
23
+ import { OutputScopeFlags } from "./flags.js";
24
+ import type { OutputSymbol } from "./output-symbol.js";
24
25
  import { SymbolTable } from "./symbol-table.js";
25
26
 
26
- /**
27
- * Flags that describe an output scope.
28
- */
29
- export enum OutputScopeFlags {
30
- None = 0,
31
-
32
- /**
33
- * This scope is a static member scope.
34
- */
35
- StaticMemberScope = 1 << 0,
36
-
37
- /**
38
- * This scope is an instance member scope.
39
- */
40
- InstanceMemberScope = 1 << 1,
41
-
42
- /**
43
- * This scope is transient, and only exists to be merged with other scopes.
44
- */
45
- Transient = 1 << 2,
46
-
47
- /**
48
- * This scope is a member scope. Scopes with this flag will have an `owner`
49
- * property that points to the symbol whose member this scope holds.
50
- */
51
- MemberScope = StaticMemberScope | InstanceMemberScope,
52
- }
53
-
54
27
  let scopeCount = 0;
55
28
 
56
29
  export interface OutputScopeOptions {
@@ -21,61 +21,8 @@ import {
21
21
  traceEffect,
22
22
  TracePhase,
23
23
  } from "../tracer.js";
24
- import { OutputScope, OutputScopeFlags } from "./output-scope.js";
25
- /**
26
- * Flags that describe an output symbol.
27
- */
28
- export enum OutputSymbolFlags {
29
- None = 0,
30
-
31
- /**
32
- * The symbol is an instance member container. Symbols with this flag will have a
33
- * instanceMemberScope property that contains symbols for instance members.
34
- */
35
- InstanceMemberContainer = 1 << 0,
36
-
37
- /**
38
- * The symbol is a static member container. Symbols with this flag will have a
39
- * staticMemberScope property that contains symbols for static members.
40
- */
41
- StaticMemberContainer = 1 << 1,
42
-
43
- /**
44
- * Whether this symbol contains members of any kind.
45
- */
46
- MemberContainer = InstanceMemberContainer | StaticMemberContainer,
47
-
48
- /**
49
- * Whether this symbol is an instance member of another symbol (i.e that it is
50
- * stored in an instance member scope).
51
- */
52
- InstanceMember = 1 << 2,
53
-
54
- /**
55
- * Whether this symbol is a static member of another symbol (i.e that it is
56
- * stored in a static member scope).
57
- */
58
- StaticMember = 1 << 3,
59
-
60
- /**
61
- * Transient symbols are not added to symbol tables and do not create
62
- * referencable refkeys. They are used for temporary symbols that are intended
63
- * to be used to calculate other symbols.
64
- */
65
- Transient = 1 << 4,
66
-
67
- /**
68
- * This symbol aliases another symbol. Only its name, flags, and scope are
69
- * stored in this symbol. Otherwise, everything else is located on the alias
70
- * target.
71
- */
72
- Alias = 1 << 5,
73
-
74
- /**
75
- * Whether this is an instance member or static member of another symbol.
76
- */
77
- Member = InstanceMember | StaticMember,
78
- }
24
+ import { OutputScopeFlags, OutputSymbolFlags } from "./flags.js";
25
+ import { OutputScope } from "./output-scope.js";
79
26
 
80
27
  export interface OutputSymbolOptions {
81
28
  binder?: Binder;
@@ -1,14 +1,10 @@
1
- import {
2
- Context,
3
- effect,
4
- getContext,
5
- onCleanup,
6
- } from "@alloy-js/core/jsx-runtime";
7
1
  import { isRef, Ref, shallowReactive } from "@vue/reactivity";
2
+ import { Context, effect, getContext, onCleanup } from "../reactivity.js";
8
3
 
9
4
  import { MemberScopeContext } from "../context/member-scope.js";
10
5
  import { ScopeContext } from "../context/scope.js";
11
- import { OutputSymbol, OutputSymbolFlags } from "./output-symbol.js";
6
+ import { OutputSymbolFlags } from "./flags.js";
7
+ import { OutputSymbol } from "./output-symbol.js";
12
8
 
13
9
  export interface TakeSymbolCallback {
14
10
  (symbol: OutputSymbol): void;
@@ -1,5 +1,6 @@
1
1
  import { Ref, ShallowReactive, shallowRef } from "@vue/reactivity";
2
- import { Children, effect, onCleanup } from "../jsx-runtime.js";
2
+ import { effect, onCleanup } from "../reactivity.js";
3
+ import type { Children } from "../runtime/component.js";
3
4
  import { OutputSymbol } from "./output-symbol.js";
4
5
  import { takeSymbols } from "./symbol-flow.js";
5
6
 
@@ -1,4 +1,4 @@
1
- import { NameConflictResolver } from "../binder.js";
1
+ import type { NameConflictResolver } from "../binder.js";
2
2
  import { ReactiveUnionSet } from "../reactive-union-set.js";
3
3
  import { queueJob } from "../scheduler.js";
4
4
  import {
@@ -7,8 +7,8 @@ import {
7
7
  trace,
8
8
  TracePhase,
9
9
  } from "../tracer.js";
10
- import { OutputScope } from "./output-scope.js";
11
- import { OutputSymbol } from "./output-symbol.js";
10
+ import type { OutputScope } from "./output-scope.js";
11
+ import type { OutputSymbol } from "./output-symbol.js";
12
12
 
13
13
  export class SymbolTable extends ReactiveUnionSet<OutputSymbol> {
14
14
  private _namesToDeconflict: Set<string> = new Set();
package/src/tap.ts CHANGED
@@ -4,7 +4,7 @@ import { DeclarationContext } from "./context/declaration.js";
4
4
  import { MemberDeclarationContext } from "./context/member-declaration.js";
5
5
  import { useScope } from "./context/scope.js";
6
6
  import { SourceFileContext } from "./context/source-file.js";
7
- import { ComponentDefinition } from "./jsx-runtime.js";
7
+ import type { ComponentDefinition } from "./runtime/component.js";
8
8
  import { OutputScope } from "./symbols/output-scope.js";
9
9
  import { OutputSymbol } from "./symbols/output-symbol.js";
10
10
 
package/src/tracer.ts CHANGED
@@ -1,9 +1,10 @@
1
- import { untrack } from "@alloy-js/core/jsx-runtime";
2
1
  import { effect, ReactiveEffectRunner } from "@vue/reactivity";
2
+ import { untrack } from "./reactivity.js";
3
3
  import type { Refkey } from "./refkey.js";
4
4
  import { scheduler } from "./scheduler.js";
5
- import { OutputScope, OutputScopeFlags } from "./symbols/output-scope.js";
6
- import { OutputSymbol, OutputSymbolFlags } from "./symbols/output-symbol.js";
5
+ import { OutputScopeFlags, OutputSymbolFlags } from "./symbols/flags.js";
6
+ import { type OutputScope } from "./symbols/output-scope.js";
7
+ import { type OutputSymbol } from "./symbols/output-symbol.js";
7
8
 
8
9
  // enable tracing for specific phases using a comma separated list of
9
10
  // dotted identifiers, e.g. `scope.update,symbol.create`.
@@ -30,7 +31,6 @@ debuggerIdsEnv.split(",").forEach((id) => {
30
31
  }
31
32
  });
32
33
  export const TracePhase = {
33
- render: {},
34
34
  scope: {
35
35
  update: {
36
36
  area: "scope",
@@ -112,6 +112,40 @@ export const TracePhase = {
112
112
  bg: { r: 100, g: 50, b: 50 },
113
113
  },
114
114
  },
115
+ effect: {
116
+ schedule: {
117
+ area: "effect",
118
+ subarea: "schedule",
119
+ bg: { r: 100, g: 100, b: 0 },
120
+ },
121
+ track: {
122
+ area: "effect",
123
+ subarea: "track",
124
+ bg: { r: 75, g: 75, b: 0 },
125
+ },
126
+ trigger: {
127
+ area: "effect",
128
+ subarea: "trigger",
129
+ bg: { r: 50, g: 50, b: 0 },
130
+ },
131
+ },
132
+ render: {
133
+ worker: {
134
+ area: "render",
135
+ subarea: "worker",
136
+ bg: { r: 100, g: 50, b: 0 },
137
+ },
138
+ appendChild: {
139
+ area: "render",
140
+ subarea: "appendChild",
141
+ bg: { r: 100, g: 50, b: 0 },
142
+ },
143
+ renderEffect: {
144
+ area: "render",
145
+ subarea: "render effect",
146
+ bg: { r: 100, g: 50, b: 0 },
147
+ },
148
+ },
115
149
  } as const;
116
150
 
117
151
  interface TracePhase extends TextFormat {
package/src/utils.tsx CHANGED
@@ -1,19 +1,21 @@
1
1
  import { toRaw } from "@vue/reactivity";
2
+ import { BaseListProps } from "./components/List.jsx";
2
3
  import {
3
- Children,
4
- ComponentCreator,
5
4
  createCustomContext,
6
5
  CustomContext,
7
6
  Disposable,
8
- isComponentCreator,
9
7
  memo,
10
8
  onCleanup,
11
9
  root,
12
10
  untrack,
13
- } from "./jsx-runtime.js";
11
+ } from "./reactivity.js";
14
12
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
15
- import { BaseListProps } from "./components/List.jsx";
16
13
  import { OutputDirectory, OutputFile, render } from "./render.js";
14
+ import {
15
+ Children,
16
+ ComponentCreator,
17
+ isComponentCreator,
18
+ } from "./runtime/component.js";
17
19
 
18
20
  export interface JoinOptions {
19
21
  /**