@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.
- package/dist/src/binder.d.ts +2 -1
- package/dist/src/binder.d.ts.map +1 -1
- package/dist/src/binder.js +2 -2
- package/dist/src/code.d.ts +1 -1
- package/dist/src/code.d.ts.map +1 -1
- package/dist/src/components/Block.d.ts +1 -1
- package/dist/src/components/Block.d.ts.map +1 -1
- package/dist/src/components/Declaration.d.ts +1 -1
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js +1 -1
- package/dist/src/components/For.d.ts +1 -1
- package/dist/src/components/For.d.ts.map +1 -1
- package/dist/src/components/For.js +1 -1
- package/dist/src/components/Indent.d.ts +1 -1
- package/dist/src/components/Indent.d.ts.map +1 -1
- package/dist/src/components/List.d.ts +1 -1
- package/dist/src/components/List.d.ts.map +1 -1
- package/dist/src/components/List.js +2 -1
- package/dist/src/components/MemberDeclaration.d.ts +2 -2
- package/dist/src/components/MemberDeclaration.d.ts.map +1 -1
- package/dist/src/components/MemberDeclaration.js +2 -1
- package/dist/src/components/MemberScope.d.ts +2 -2
- package/dist/src/components/MemberScope.d.ts.map +1 -1
- package/dist/src/components/Output.d.ts +1 -1
- package/dist/src/components/Output.d.ts.map +1 -1
- package/dist/src/components/Output.js +1 -1
- package/dist/src/components/Prose.d.ts +1 -1
- package/dist/src/components/Prose.d.ts.map +1 -1
- package/dist/src/components/ReferenceOrContent.d.ts +1 -1
- package/dist/src/components/ReferenceOrContent.d.ts.map +1 -1
- package/dist/src/components/Scope.d.ts +1 -1
- package/dist/src/components/Scope.d.ts.map +1 -1
- package/dist/src/components/Show.d.ts +1 -1
- package/dist/src/components/Show.d.ts.map +1 -1
- package/dist/src/components/SourceDirectory.d.ts +1 -1
- package/dist/src/components/SourceDirectory.d.ts.map +1 -1
- package/dist/src/components/SourceDirectory.js +1 -1
- package/dist/src/components/SourceFile.d.ts +1 -1
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/SourceFile.js +1 -1
- package/dist/src/components/StatementList.d.ts +1 -1
- package/dist/src/components/StatementList.d.ts.map +1 -1
- package/dist/src/components/Switch.d.ts +2 -2
- package/dist/src/components/Switch.d.ts.map +1 -1
- package/dist/src/components/Switch.js +2 -1
- package/dist/src/components/Wrap.d.ts +1 -1
- package/dist/src/components/Wrap.d.ts.map +1 -1
- package/dist/src/context/binder.d.ts +1 -1
- package/dist/src/context/binder.d.ts.map +1 -1
- package/dist/src/context/source-file.d.ts +1 -1
- package/dist/src/context/source-file.d.ts.map +1 -1
- package/dist/src/context.d.ts +2 -2
- package/dist/src/context.d.ts.map +1 -1
- package/dist/src/context.js +1 -1
- package/dist/src/debug.d.ts +1 -0
- package/dist/src/debug.d.ts.map +1 -1
- package/dist/src/debug.js +4 -1
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -1
- package/dist/src/jsx-runtime.d.ts +4 -281
- package/dist/src/jsx-runtime.d.ts.map +1 -1
- package/dist/src/jsx-runtime.js +3 -319
- package/dist/src/props-combinators.d.ts +19 -0
- package/dist/src/props-combinators.d.ts.map +1 -0
- package/dist/src/props-combinators.js +108 -0
- package/dist/src/reactive-union-set.d.ts.map +1 -1
- package/dist/src/reactive-union-set.js +1 -1
- package/dist/src/reactivity.d.ts +75 -0
- package/dist/src/reactivity.d.ts.map +1 -0
- package/dist/src/reactivity.js +141 -0
- package/dist/src/render.d.ts +5 -1
- package/dist/src/render.d.ts.map +1 -1
- package/dist/src/render.js +68 -15
- package/dist/src/runtime/component.d.ts +24 -0
- package/dist/src/runtime/component.d.ts.map +1 -0
- package/dist/src/runtime/component.js +19 -0
- package/dist/src/runtime/intrinsic.d.ts +168 -0
- package/dist/src/runtime/intrinsic.d.ts.map +1 -0
- package/dist/src/runtime/intrinsic.js +11 -0
- package/dist/src/slot.d.ts +2 -2
- package/dist/src/slot.d.ts.map +1 -1
- package/dist/src/slot.js +1 -1
- package/dist/src/stc.d.ts +1 -1
- package/dist/src/stc.d.ts.map +1 -1
- package/dist/src/sti.d.ts +7 -6
- package/dist/src/sti.d.ts.map +1 -1
- package/dist/src/sti.js +1 -1
- package/dist/src/symbols/flags.d.ts +70 -0
- package/dist/src/symbols/flags.d.ts.map +1 -0
- package/dist/src/symbols/flags.js +72 -0
- package/dist/src/symbols/index.d.ts +1 -0
- package/dist/src/symbols/index.d.ts.map +1 -1
- package/dist/src/symbols/index.js +1 -0
- package/dist/src/symbols/output-scope.d.ts +2 -24
- package/dist/src/symbols/output-scope.d.ts.map +1 -1
- package/dist/src/symbols/output-scope.js +1 -25
- package/dist/src/symbols/output-symbol.d.ts +2 -47
- package/dist/src/symbols/output-symbol.d.ts.map +1 -1
- package/dist/src/symbols/output-symbol.js +2 -48
- package/dist/src/symbols/symbol-flow.d.ts.map +1 -1
- package/dist/src/symbols/symbol-flow.js +2 -2
- package/dist/src/symbols/symbol-slot.d.ts +1 -1
- package/dist/src/symbols/symbol-slot.d.ts.map +1 -1
- package/dist/src/symbols/symbol-slot.js +1 -1
- package/dist/src/symbols/symbol-table.d.ts +3 -3
- package/dist/src/symbols/symbol-table.d.ts.map +1 -1
- package/dist/src/tap.d.ts +1 -1
- package/dist/src/tap.d.ts.map +1 -1
- package/dist/src/tracer.d.ts +60 -3
- package/dist/src/tracer.d.ts.map +1 -1
- package/dist/src/tracer.js +60 -5
- package/dist/src/utils.d.ts +4 -3
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +2 -1
- package/dist/test/props-with-defaults.test.js +1 -1
- package/dist/test/reactive-union-set.test.js +1 -1
- package/dist/test/reactivity/cleanup.test.js +2 -1
- package/dist/test/reactivity/memo.test.js +1 -1
- package/dist/test/reactivity/untrack.test.js +1 -1
- package/dist/test/rendering/memoization.test.js +2 -1
- package/dist/test/split-props.test.js +1 -1
- package/dist/test/symbols/output-scope.test.js +2 -1
- package/dist/test/symbols/output-symbol.test.js +4 -3
- package/dist/test/symbols/resolution.test.js +2 -1
- package/dist/test/symbols/utils.d.ts +3 -2
- package/dist/test/symbols/utils.d.ts.map +1 -1
- package/dist/test/symbols/utils.js +2 -1
- package/dist/testing/extend-expect.d.ts +15 -0
- package/dist/testing/extend-expect.d.ts.map +1 -1
- package/dist/testing/extend-expect.js +2 -1
- package/dist/testing/render.d.ts +1 -1
- package/dist/testing/render.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -4
- package/src/binder.ts +3 -5
- package/src/code.ts +1 -1
- package/src/components/Block.tsx +1 -1
- package/src/components/Declaration.tsx +2 -1
- package/src/components/For.tsx +2 -1
- package/src/components/Indent.tsx +1 -1
- package/src/components/List.tsx +3 -1
- package/src/components/MemberDeclaration.tsx +4 -3
- package/src/components/MemberScope.tsx +2 -2
- package/src/components/Output.tsx +2 -1
- package/src/components/Prose.tsx +1 -1
- package/src/components/ReferenceOrContent.tsx +1 -1
- package/src/components/Scope.tsx +1 -1
- package/src/components/Show.tsx +1 -1
- package/src/components/SourceDirectory.tsx +2 -1
- package/src/components/SourceFile.tsx +2 -1
- package/src/components/StatementList.tsx +1 -1
- package/src/components/Switch.tsx +2 -1
- package/src/components/Wrap.tsx +1 -1
- package/src/context/binder.ts +1 -1
- package/src/context/source-file.ts +1 -1
- package/src/context.ts +3 -7
- package/src/debug.ts +5 -1
- package/src/index.ts +4 -1
- package/src/jsx-runtime.ts +15 -690
- package/src/props-combinators.ts +148 -0
- package/src/reactive-union-set.ts +1 -1
- package/src/reactivity.ts +230 -0
- package/src/render.ts +97 -26
- package/src/runtime/component.ts +67 -0
- package/src/runtime/intrinsic.ts +199 -0
- package/src/slot.ts +3 -4
- package/src/stc.ts +2 -2
- package/src/sti.ts +11 -11
- package/src/symbols/flags.ts +82 -0
- package/src/symbols/index.ts +1 -0
- package/src/symbols/output-scope.ts +2 -29
- package/src/symbols/output-symbol.ts +2 -55
- package/src/symbols/symbol-flow.ts +3 -7
- package/src/symbols/symbol-slot.tsx +2 -1
- package/src/symbols/symbol-table.ts +3 -3
- package/src/tap.ts +1 -1
- package/src/tracer.ts +38 -4
- package/src/utils.tsx +7 -5
- package/temp/api.json +984 -1261
- package/test/props-with-defaults.test.ts +1 -1
- package/test/reactive-union-set.test.tsx +1 -1
- package/test/reactivity/cleanup.test.tsx +2 -1
- package/test/reactivity/memo.test.tsx +1 -1
- package/test/reactivity/untrack.test.ts +1 -1
- package/test/rendering/basic.test.tsx +1 -1
- package/test/rendering/memoization.test.tsx +1 -1
- package/test/split-props.test.ts +1 -1
- package/test/symbols/output-scope.test.ts +2 -4
- package/test/symbols/output-symbol.test.ts +4 -7
- package/test/symbols/resolution.test.ts +2 -4
- package/test/symbols/utils.ts +3 -5
- package/test/utils.test.tsx +1 -1
- package/testing/extend-expect.ts +16 -0
- 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
|
-
|
|
7
|
-
|
|
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
|
|
2
|
+
import {
|
|
3
3
|
Children,
|
|
4
4
|
ComponentCreator,
|
|
5
5
|
ComponentDefinition,
|
|
6
|
-
} from "./
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
} from "./
|
|
5
|
+
IntrinsicElementBase,
|
|
6
|
+
IntrinsicElements,
|
|
7
|
+
} from "./runtime/intrinsic.js";
|
|
8
8
|
|
|
9
|
-
export type StiSignature<T extends keyof
|
|
9
|
+
export type StiSignature<T extends keyof IntrinsicElements> = (
|
|
10
10
|
...args: unknown extends T ? []
|
|
11
|
-
: {} extends Omit<
|
|
12
|
-
[props?:
|
|
13
|
-
: [props:
|
|
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
|
|
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
|
|
29
|
+
export function sti<T extends keyof IntrinsicElements>(
|
|
30
30
|
name: T,
|
|
31
31
|
): StiSignature<T> {
|
|
32
32
|
return (...args) => {
|
|
33
|
-
const props:
|
|
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
|
+
}
|
package/src/symbols/index.ts
CHANGED
|
@@ -20,37 +20,10 @@ import {
|
|
|
20
20
|
traceEffect,
|
|
21
21
|
TracePhase,
|
|
22
22
|
} from "../tracer.js";
|
|
23
|
-
import {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 "./
|
|
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 {
|
|
6
|
-
import {
|
|
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 "./
|
|
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
|
/**
|