@alloy-js/core 0.16.0 → 0.18.0-dev.2
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/CHANGELOG.md +15 -0
- package/dist/src/binder.d.ts +19 -235
- package/dist/src/binder.d.ts.map +1 -1
- package/dist/src/binder.js +85 -386
- 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/Block.js +3 -1
- package/dist/src/components/Declaration.d.ts +2 -2
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js +6 -5
- 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 +3 -1
- package/dist/src/components/MemberDeclaration.d.ts +3 -3
- package/dist/src/components/MemberDeclaration.d.ts.map +1 -1
- package/dist/src/components/MemberDeclaration.js +4 -4
- package/dist/src/components/MemberScope.d.ts +2 -2
- package/dist/src/components/MemberScope.d.ts.map +1 -1
- package/dist/src/components/MemberScope.js +0 -2
- 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 +2 -2
- package/dist/src/components/Scope.d.ts.map +1 -1
- package/dist/src/components/Scope.js +3 -6
- 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/StatementList.js +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/assignment.d.ts +1 -1
- package/dist/src/context/assignment.d.ts.map +1 -1
- package/dist/src/context/binder.d.ts +3 -3
- package/dist/src/context/binder.d.ts.map +1 -1
- package/dist/src/context/declaration.d.ts +1 -1
- package/dist/src/context/declaration.d.ts.map +1 -1
- package/dist/src/context/member-declaration.d.ts +1 -1
- package/dist/src/context/member-declaration.d.ts.map +1 -1
- package/dist/src/context/member-declaration.js +0 -1
- package/dist/src/context/member-scope.d.ts +1 -1
- package/dist/src/context/member-scope.d.ts.map +1 -1
- package/dist/src/context/name-policy.d.ts +1 -1
- package/dist/src/context/name-policy.d.ts.map +1 -1
- package/dist/src/context/scope.d.ts +1 -1
- package/dist/src/context/scope.d.ts.map +1 -1
- package/dist/src/context/source-directory.d.ts +1 -1
- package/dist/src/context/source-directory.d.ts.map +1 -1
- package/dist/src/context/source-file.d.ts +2 -2
- 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 +8 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +8 -2
- package/dist/src/jsx-runtime.d.ts +4 -272
- package/dist/src/jsx-runtime.d.ts.map +1 -1
- package/dist/src/jsx-runtime.js +3 -315
- 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 +29 -0
- package/dist/src/reactive-union-set.d.ts.map +1 -0
- package/dist/src/reactive-union-set.js +183 -0
- 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/refkey.d.ts +36 -0
- package/dist/src/refkey.d.ts.map +1 -1
- package/dist/src/refkey.js +40 -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/scheduler.d.ts +2 -2
- package/dist/src/scheduler.d.ts.map +1 -1
- package/dist/src/scheduler.js +27 -6
- 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 +7 -0
- package/dist/src/symbols/index.d.ts.map +1 -0
- package/dist/src/symbols/index.js +6 -0
- package/dist/src/symbols/output-scope.d.ts +94 -0
- package/dist/src/symbols/output-scope.d.ts.map +1 -0
- package/dist/src/symbols/output-scope.js +222 -0
- package/dist/src/symbols/output-symbol.d.ts +89 -0
- package/dist/src/symbols/output-symbol.d.ts.map +1 -0
- package/dist/src/symbols/output-symbol.js +333 -0
- package/dist/src/symbols/symbol-flow.d.ts +13 -0
- package/dist/src/symbols/symbol-flow.d.ts.map +1 -0
- package/dist/src/symbols/symbol-flow.js +74 -0
- package/dist/src/symbols/symbol-slot.d.ts +12 -0
- package/dist/src/symbols/symbol-slot.d.ts.map +1 -0
- package/dist/src/symbols/symbol-slot.js +36 -0
- package/dist/src/symbols/symbol-table.d.ts +14 -0
- package/dist/src/symbols/symbol-table.d.ts.map +1 -0
- package/dist/src/symbols/symbol-table.js +42 -0
- package/dist/src/tap.d.ts +3 -2
- package/dist/src/tap.d.ts.map +1 -1
- package/dist/src/tracer.d.ts +238 -0
- package/dist/src/tracer.d.ts.map +1 -0
- package/dist/src/tracer.js +496 -0
- package/dist/src/tsdoc-metadata.json +1 -1
- 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/components/slot.test.js +5 -7
- package/dist/test/props-with-defaults.test.js +1 -1
- package/dist/test/reactive-union-set.test.d.ts +2 -0
- package/dist/test/reactive-union-set.test.d.ts.map +1 -0
- package/dist/test/reactive-union-set.test.js +170 -0
- 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.d.ts +2 -0
- package/dist/test/symbols/output-scope.test.d.ts.map +1 -0
- package/dist/test/symbols/output-scope.test.js +343 -0
- package/dist/test/symbols/output-symbol.test.d.ts +2 -0
- package/dist/test/symbols/output-symbol.test.d.ts.map +1 -0
- package/dist/test/symbols/output-symbol.test.js +447 -0
- package/dist/test/symbols/resolution.test.d.ts +2 -0
- package/dist/test/symbols/resolution.test.d.ts.map +1 -0
- package/dist/test/symbols/resolution.test.js +141 -0
- package/dist/test/symbols/utils.d.ts +25 -0
- package/dist/test/symbols/utils.d.ts.map +1 -0
- package/dist/test/symbols/utils.js +47 -0
- 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 +28 -24
- package/src/binder.ts +146 -672
- package/src/code.ts +1 -1
- package/src/components/Block.tsx +4 -1
- package/src/components/Declaration.tsx +8 -7
- 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 +7 -6
- package/src/components/MemberScope.tsx +2 -5
- 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 +3 -7
- 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 +2 -1
- package/src/components/Switch.tsx +2 -1
- package/src/components/Wrap.tsx +1 -1
- package/src/context/assignment.ts +1 -1
- package/src/context/binder.ts +3 -3
- package/src/context/declaration.ts +1 -1
- package/src/context/member-declaration.ts +1 -1
- package/src/context/member-scope.ts +1 -1
- package/src/context/name-policy.ts +1 -1
- package/src/context/scope.ts +1 -1
- package/src/context/source-directory.ts +1 -1
- package/src/context/source-file.ts +2 -2
- package/src/context.ts +3 -7
- package/src/debug.ts +5 -1
- package/src/index.ts +15 -1
- package/src/jsx-runtime.ts +15 -674
- package/src/props-combinators.ts +148 -0
- package/src/reactive-union-set.ts +238 -0
- package/src/reactivity.ts +230 -0
- package/src/refkey.ts +40 -0
- package/src/render.ts +97 -26
- package/src/runtime/component.ts +67 -0
- package/src/runtime/intrinsic.ts +199 -0
- package/src/scheduler.ts +31 -6
- 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 +6 -0
- package/src/symbols/output-scope.ts +296 -0
- package/src/symbols/output-symbol.ts +459 -0
- package/src/symbols/symbol-flow.ts +100 -0
- package/src/symbols/symbol-slot.tsx +48 -0
- package/src/symbols/symbol-table.ts +72 -0
- package/src/tap.ts +3 -2
- package/src/tracer.ts +474 -0
- package/src/utils.tsx +7 -5
- package/temp/api.json +7446 -5133
- package/test/components/slot.test.tsx +8 -11
- package/test/props-with-defaults.test.ts +1 -1
- package/test/reactive-union-set.test.tsx +191 -0
- 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 +300 -0
- package/test/symbols/output-symbol.test.ts +456 -0
- package/test/symbols/resolution.test.ts +170 -0
- package/test/symbols/utils.ts +93 -0
- package/test/utils.test.tsx +1 -1
- package/testing/extend-expect.ts +16 -0
- package/testing/render.ts +1 -2
- package/LICENSE +0 -7
- package/dist/test/symbols.test.d.ts +0 -2
- package/dist/test/symbols.test.d.ts.map +0 -1
- package/dist/test/symbols.test.js +0 -884
- package/test/symbols.test.ts +0 -1006
package/dist/src/binder.js
CHANGED
|
@@ -1,103 +1,11 @@
|
|
|
1
|
-
import { computed,
|
|
2
|
-
import { useBinder } from "./context/binder.js";
|
|
1
|
+
import { computed, ref, shallowRef } from "@vue/reactivity";
|
|
3
2
|
import { useMemberScope } from "./context/member-scope.js";
|
|
4
3
|
import { useScope } from "./context/scope.js";
|
|
5
|
-
import { effect,
|
|
4
|
+
import { effect, untrack } from "./reactivity.js";
|
|
6
5
|
import { refkey } from "./refkey.js";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
export let OutputSymbolFlags = /*#__PURE__*/function (OutputSymbolFlags) {
|
|
12
|
-
OutputSymbolFlags[OutputSymbolFlags["None"] = 0] = "None";
|
|
13
|
-
/**
|
|
14
|
-
* The symbol is an instance member container. Symbols with this flag will have a
|
|
15
|
-
* instanceMemberScope property that contains symbols for instance members.
|
|
16
|
-
*/
|
|
17
|
-
OutputSymbolFlags[OutputSymbolFlags["InstanceMemberContainer"] = 1] = "InstanceMemberContainer";
|
|
18
|
-
/**
|
|
19
|
-
* The symbol is a static member container. Symbols with this flag will have a
|
|
20
|
-
* staticMemberScope property that contains symbols for static members.
|
|
21
|
-
*/
|
|
22
|
-
OutputSymbolFlags[OutputSymbolFlags["StaticMemberContainer"] = 2] = "StaticMemberContainer";
|
|
23
|
-
/**
|
|
24
|
-
* Whether this symbol contains members of any kind.
|
|
25
|
-
*/
|
|
26
|
-
OutputSymbolFlags[OutputSymbolFlags["MemberContainer"] = 3] = "MemberContainer";
|
|
27
|
-
/**
|
|
28
|
-
* Whether this symbol is an instance member of another symbol (i.e that it is
|
|
29
|
-
* stored in an instance member scope).
|
|
30
|
-
*/
|
|
31
|
-
OutputSymbolFlags[OutputSymbolFlags["InstanceMember"] = 4] = "InstanceMember";
|
|
32
|
-
/**
|
|
33
|
-
* Whether this symbol is a static member of another symbol (i.e that it is
|
|
34
|
-
* stored in a static member scope).
|
|
35
|
-
*/
|
|
36
|
-
OutputSymbolFlags[OutputSymbolFlags["StaticMember"] = 8] = "StaticMember";
|
|
37
|
-
/**
|
|
38
|
-
* Whether this is an instance member or static member of another symbol.
|
|
39
|
-
*/
|
|
40
|
-
OutputSymbolFlags[OutputSymbolFlags["Member"] = 12] = "Member";
|
|
41
|
-
return OutputSymbolFlags;
|
|
42
|
-
}({});
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* An output symbol is a named entity that can be referenced in your output
|
|
46
|
-
* code. Referencing symbols is generally accomplished by using a
|
|
47
|
-
* {@link Refkey}.
|
|
48
|
-
*
|
|
49
|
-
* @remarks
|
|
50
|
-
*
|
|
51
|
-
* This interface is the base implementation of symbol. Generally, most
|
|
52
|
-
* languages will have subtypes of this interface that provide additional,
|
|
53
|
-
* language-specific metadata about declared symbols. For example, symbols in
|
|
54
|
-
* TypeScript need to track whether they are exported or what kind of symbol
|
|
55
|
-
* they are (e.g. type, value, parameter, etc.)
|
|
56
|
-
*
|
|
57
|
-
* Symbols are reactive values, which allows you to observe changes to the symbol
|
|
58
|
-
* information. For example, a symbol's name may change if it becomes conflicted
|
|
59
|
-
* with a symbol that is added later.
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Flags that describe an output scope.
|
|
64
|
-
*/
|
|
65
|
-
export let OutputScopeFlags = /*#__PURE__*/function (OutputScopeFlags) {
|
|
66
|
-
OutputScopeFlags[OutputScopeFlags["None"] = 0] = "None";
|
|
67
|
-
/**
|
|
68
|
-
* This scope is a static member scope.
|
|
69
|
-
*/
|
|
70
|
-
OutputScopeFlags[OutputScopeFlags["StaticMemberScope"] = 1] = "StaticMemberScope";
|
|
71
|
-
/**
|
|
72
|
-
* This scope is an instance member scope.
|
|
73
|
-
*/
|
|
74
|
-
OutputScopeFlags[OutputScopeFlags["InstanceMemberScope"] = 2] = "InstanceMemberScope";
|
|
75
|
-
/**
|
|
76
|
-
* This scope is a member scope. Scopes with this flag will have an `owner`
|
|
77
|
-
* property that points to the symbol whose member this scope holds.
|
|
78
|
-
*/
|
|
79
|
-
OutputScopeFlags[OutputScopeFlags["MemberScope"] = 3] = "MemberScope";
|
|
80
|
-
return OutputScopeFlags;
|
|
81
|
-
}({});
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* A container of symbols accessible within some scope in your output code.
|
|
85
|
-
*
|
|
86
|
-
* @remarks
|
|
87
|
-
*
|
|
88
|
-
* Scopes form a tree. All scopes except the global scope have a parent scope
|
|
89
|
-
* identified by `parent`. Scopes can have nested scopes which can be accessed
|
|
90
|
-
* using the `children` property. Whether a child scope can be accessed from
|
|
91
|
-
* the parent scope is determined by each language's scoping rules.
|
|
92
|
-
*
|
|
93
|
-
* This interface is the base implementation of scope. Generally, most languages
|
|
94
|
-
* will have subtypes of this interface that provide additional metadata about
|
|
95
|
-
* the scope. For example, TypeScript scopes need to track whether the scope
|
|
96
|
-
* represents a package, module, class, function, etc.
|
|
97
|
-
*
|
|
98
|
-
* Scopes are reactive values, which allows you to observe changes to the scope
|
|
99
|
-
* within a reactive context.
|
|
100
|
-
*/
|
|
6
|
+
import { OutputSymbolFlags } from "./symbols/flags.js";
|
|
7
|
+
import { OutputScope } from "./symbols/output-scope.js";
|
|
8
|
+
import { formatRefkeys, formatSymbol, formatSymbolName, trace, TracePhase } from "./tracer.js";
|
|
101
9
|
|
|
102
10
|
/**
|
|
103
11
|
* The binder tracks all output scopes and symbols. Scopes are nested containers
|
|
@@ -142,150 +50,37 @@ export let OutputScopeFlags = /*#__PURE__*/function (OutputScopeFlags) {
|
|
|
142
50
|
|
|
143
51
|
export function createOutputBinder(options = {}) {
|
|
144
52
|
const binder = {
|
|
145
|
-
createScope,
|
|
146
|
-
createSymbol,
|
|
147
|
-
deleteSymbol,
|
|
148
53
|
resolveDeclarationByKey,
|
|
149
54
|
getSymbolForRefkey,
|
|
150
|
-
addStaticMembersToSymbol,
|
|
151
|
-
addInstanceMembersToSymbol,
|
|
152
|
-
instantiateSymbolInto,
|
|
153
55
|
findSymbolName,
|
|
154
56
|
findScopeName,
|
|
155
57
|
resolveFQN: resolveFQN,
|
|
156
|
-
globalScope: undefined
|
|
58
|
+
globalScope: undefined,
|
|
59
|
+
notifyScopeCreated,
|
|
60
|
+
notifySymbolCreated,
|
|
61
|
+
notifySymbolDeleted,
|
|
62
|
+
nameConflictResolver: options.nameConflictResolver
|
|
157
63
|
};
|
|
158
|
-
|
|
159
|
-
binder.globalScope = reactive({
|
|
160
|
-
kind: "global",
|
|
161
|
-
name: "<global>",
|
|
162
|
-
symbols: new Set(),
|
|
163
|
-
symbolsByRefkey: new Map(),
|
|
164
|
-
children: new Set(),
|
|
165
|
-
parent: undefined,
|
|
64
|
+
binder.globalScope = new OutputScope("<global>", {
|
|
166
65
|
binder,
|
|
167
|
-
|
|
168
|
-
getSymbolNames: symbolNames(globalSymbols)
|
|
66
|
+
kind: "global"
|
|
169
67
|
});
|
|
170
68
|
const knownDeclarations = new Map();
|
|
171
69
|
const waitingDeclarations = new Map();
|
|
172
70
|
const waitingSymbolNames = new Map();
|
|
173
71
|
const waitingScopeNames = new Map();
|
|
174
|
-
const deconflictJobs = new Map();
|
|
175
72
|
return binder;
|
|
176
|
-
function
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
name,
|
|
180
|
-
parent,
|
|
181
|
-
owner,
|
|
182
|
-
flags = OutputScopeFlags.None,
|
|
183
|
-
metadata = {},
|
|
184
|
-
...rest
|
|
185
|
-
} = args;
|
|
186
|
-
if (flags & OutputScopeFlags.MemberScope) {
|
|
187
|
-
if (!owner) {
|
|
188
|
-
throw new Error("Member scopes must have an owner");
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// member scopes don't have a parent regular scope. Perhaps in the future
|
|
193
|
-
// their parent would be something like a prototype object.
|
|
194
|
-
let parentScope;
|
|
195
|
-
if (parent) {
|
|
196
|
-
parentScope = parent;
|
|
197
|
-
} else if (flags & OutputScopeFlags.MemberScope) {
|
|
198
|
-
parentScope = undefined;
|
|
199
|
-
} else {
|
|
200
|
-
parentScope = useScope() ?? binder.globalScope;
|
|
201
|
-
}
|
|
202
|
-
const symbols = reactive(new Set());
|
|
203
|
-
const symbolsByRefkey = reactive(new Map());
|
|
204
|
-
const scope = reactive({
|
|
205
|
-
kind: kind,
|
|
206
|
-
name: name,
|
|
207
|
-
symbols,
|
|
208
|
-
symbolsByRefkey,
|
|
209
|
-
children: new Set(),
|
|
210
|
-
parent: parentScope,
|
|
211
|
-
flags,
|
|
212
|
-
owner,
|
|
213
|
-
binder,
|
|
214
|
-
metadata,
|
|
215
|
-
...rest,
|
|
216
|
-
getSymbolNames: symbolNames(symbols)
|
|
217
|
-
});
|
|
218
|
-
if (parentScope) {
|
|
219
|
-
parentScope.children.add(scope);
|
|
220
|
-
}
|
|
221
|
-
if (waitingScopeNames.has(parentScope)) {
|
|
222
|
-
const waiting = waitingScopeNames.get(parentScope);
|
|
223
|
-
if (waiting?.has(name)) {
|
|
224
|
-
const ref = waiting.get(name);
|
|
225
|
-
ref.value = scope;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
return scope;
|
|
229
|
-
}
|
|
230
|
-
function createSymbol(args) {
|
|
231
|
-
const {
|
|
232
|
-
name,
|
|
233
|
-
scope = useDefaultScope(args.flags),
|
|
234
|
-
refkey,
|
|
235
|
-
flags = OutputSymbolFlags.None,
|
|
236
|
-
metadata = {},
|
|
237
|
-
...rest
|
|
238
|
-
} = args;
|
|
239
|
-
const allRefkeys = [refkey ?? []].flat();
|
|
240
|
-
if (!scope) {
|
|
241
|
-
throw new Error("No scope was provided and no scope could be found in context");
|
|
242
|
-
}
|
|
243
|
-
if (flags & OutputSymbolFlags.Member && (scope.flags & OutputScopeFlags.MemberScope) === 0) {
|
|
244
|
-
throw new Error("Member symbols must be stored in a member scope.");
|
|
245
|
-
}
|
|
246
|
-
if (scope.flags & OutputScopeFlags.StaticMemberScope) {
|
|
247
|
-
if (~flags & OutputSymbolFlags.InstanceMember && ~flags & OutputSymbolFlags.StaticMember) {
|
|
248
|
-
throw new Error("Symbols stored in a member scope must have either OutputSymbolFlags.InstanceMember or OutputSymbolFlags.StaticMember flags");
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
const symbol = reactive({
|
|
252
|
-
originalName: name,
|
|
253
|
-
name: name,
|
|
254
|
-
scope,
|
|
255
|
-
refkeys: allRefkeys,
|
|
256
|
-
binder,
|
|
257
|
-
flags,
|
|
258
|
-
metadata,
|
|
259
|
-
...rest
|
|
260
|
-
});
|
|
261
|
-
if (args.flags && args.flags & OutputSymbolFlags.InstanceMemberContainer) {
|
|
262
|
-
symbol.instanceMemberScope = createScope({
|
|
263
|
-
kind: "member",
|
|
264
|
-
name: "instance members",
|
|
265
|
-
parent: undefined,
|
|
266
|
-
owner: symbol,
|
|
267
|
-
flags: OutputScopeFlags.InstanceMemberScope
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
if (args.flags && args.flags & OutputSymbolFlags.StaticMemberContainer) {
|
|
271
|
-
symbol.staticMemberScope = createScope({
|
|
272
|
-
kind: "member",
|
|
273
|
-
name: "static members",
|
|
274
|
-
parent: undefined,
|
|
275
|
-
owner: symbol,
|
|
276
|
-
flags: OutputScopeFlags.StaticMemberScope
|
|
277
|
-
});
|
|
73
|
+
function notifyScopeCreated(scope) {
|
|
74
|
+
if (!scope.parent || !waitingScopeNames.has(scope.parent)) {
|
|
75
|
+
return;
|
|
278
76
|
}
|
|
279
|
-
scope.
|
|
280
|
-
|
|
281
|
-
scope.
|
|
77
|
+
const waiting = waitingScopeNames.get(scope.parent);
|
|
78
|
+
if (waiting?.has(scope.name)) {
|
|
79
|
+
const ref = waiting.get(scope.name);
|
|
80
|
+
ref.value = scope;
|
|
282
81
|
}
|
|
283
|
-
deconflict(symbol);
|
|
284
|
-
notifyRefkey(symbol);
|
|
285
|
-
return symbol;
|
|
286
82
|
}
|
|
287
|
-
function
|
|
288
|
-
symbol.scope.symbols.delete(symbol);
|
|
83
|
+
function notifySymbolDeleted(symbol) {
|
|
289
84
|
if (!refkey) {
|
|
290
85
|
return;
|
|
291
86
|
}
|
|
@@ -295,101 +90,25 @@ export function createOutputBinder(options = {}) {
|
|
|
295
90
|
resolution.value = undefined;
|
|
296
91
|
}
|
|
297
92
|
}
|
|
298
|
-
function
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
effect(() => {
|
|
306
|
-
// copy instance members if it's an instance‐container
|
|
307
|
-
if (source.flags & OutputSymbolFlags.InstanceMemberContainer) {
|
|
308
|
-
copyMembers(source.instanceMemberScope.symbols, target, target.staticMemberScope);
|
|
93
|
+
function hasTransientScope(symbol) {
|
|
94
|
+
let sym = symbol;
|
|
95
|
+
let transient = false;
|
|
96
|
+
while (sym) {
|
|
97
|
+
if (sym.flags & OutputSymbolFlags.Transient) {
|
|
98
|
+
transient = true;
|
|
99
|
+
break;
|
|
309
100
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
if (source.flags & OutputSymbolFlags.StaticMemberContainer) {
|
|
313
|
-
copyMembers(source.staticMemberScope.symbols, target, target.staticMemberScope);
|
|
101
|
+
if (sym.flags & ~OutputSymbolFlags.Member) {
|
|
102
|
+
break;
|
|
314
103
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Recursively copy `symbols` from `sourceSym` into `intoScope` of `targetSym`.
|
|
319
|
-
* Always marks each instantiation as StaticMember so lookups use dot notation (e.g. Parent.child)
|
|
320
|
-
* and preserves any StaticMemberContainer flag to auto create newSym.staticMemberScope.
|
|
321
|
-
*/
|
|
322
|
-
function copyMembers(symbols, targetSym, intoScope) {
|
|
323
|
-
for (const srcSym of symbols) {
|
|
324
|
-
untrack(() => {
|
|
325
|
-
const wantKey = refkey(targetSym.refkeys[0], srcSym.refkeys[0]);
|
|
326
|
-
|
|
327
|
-
// create the new symbol. Preserve StaticMemberContainer if present
|
|
328
|
-
const newSym = createSymbol({
|
|
329
|
-
name: srcSym.name,
|
|
330
|
-
scope: intoScope,
|
|
331
|
-
refkey: wantKey,
|
|
332
|
-
flags: srcSym.flags | OutputSymbolFlags.StaticMember
|
|
333
|
-
});
|
|
334
|
-
onCleanup(() => {
|
|
335
|
-
binder.deleteSymbol(newSym);
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
// if the source symbol itself was a container of static members,
|
|
339
|
-
// recurse into the newSym.staticMemberScope that createSymbol just gave us
|
|
340
|
-
if (srcSym.staticMemberScope && srcSym.staticMemberScope.symbols.size > 0) {
|
|
341
|
-
// ensure we have that scope
|
|
342
|
-
addStaticMembersToSymbol(newSym);
|
|
343
|
-
copyMembers(srcSym.staticMemberScope.symbols, newSym, newSym.staticMemberScope);
|
|
344
|
-
}
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
function addStaticMembersToSymbol(symbol) {
|
|
350
|
-
if (symbol.flags & OutputSymbolFlags.StaticMemberContainer) {
|
|
351
|
-
// nothing to do.
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
symbol.flags |= OutputSymbolFlags.StaticMemberContainer;
|
|
355
|
-
symbol.staticMemberScope = createScope({
|
|
356
|
-
kind: "member",
|
|
357
|
-
name: "static members",
|
|
358
|
-
parent: undefined,
|
|
359
|
-
owner: symbol,
|
|
360
|
-
flags: OutputScopeFlags.StaticMemberScope
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
function addInstanceMembersToSymbol(symbol) {
|
|
364
|
-
if (symbol.flags & OutputSymbolFlags.InstanceMemberContainer) {
|
|
365
|
-
// nothing to do.
|
|
366
|
-
return;
|
|
367
|
-
}
|
|
368
|
-
symbol.flags |= OutputSymbolFlags.InstanceMemberContainer;
|
|
369
|
-
symbol.instanceMemberScope = createScope({
|
|
370
|
-
kind: "member",
|
|
371
|
-
name: "instance members",
|
|
372
|
-
parent: undefined,
|
|
373
|
-
owner: symbol,
|
|
374
|
-
flags: OutputScopeFlags.InstanceMemberScope
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
function resolveDeclarationByKey(currentScope, currentMemberScope, key) {
|
|
378
|
-
const targetDeclaration = knownDeclarations.get(key);
|
|
379
|
-
if (targetDeclaration) {
|
|
380
|
-
// this any cast hides a ridiculous error, fix it probably
|
|
381
|
-
return shallowRef(buildResult(currentScope, currentMemberScope, targetDeclaration));
|
|
382
|
-
} else {
|
|
383
|
-
return waitForRefkey(key, symbol => {
|
|
384
|
-
if (symbol) {
|
|
385
|
-
return buildResult(currentScope, currentMemberScope, symbol);
|
|
386
|
-
} else {
|
|
387
|
-
return undefined;
|
|
388
|
-
}
|
|
389
|
-
});
|
|
104
|
+
sym = sym.scope.owner;
|
|
390
105
|
}
|
|
106
|
+
return transient;
|
|
391
107
|
}
|
|
392
108
|
function buildResult(currentScope, currentMemberScope, targetDeclarationBase) {
|
|
109
|
+
trace(TracePhase.resolve.success, () => {
|
|
110
|
+
return `Resolved ${formatRefkeys(targetDeclarationBase.refkeys)} to ${formatSymbol(targetDeclarationBase)}`;
|
|
111
|
+
});
|
|
393
112
|
if (targetDeclarationBase.flags & OutputSymbolFlags.InstanceMember) {
|
|
394
113
|
// todo: handle referencing nested objects by refkey
|
|
395
114
|
return {
|
|
@@ -445,70 +164,56 @@ export function createOutputBinder(options = {}) {
|
|
|
445
164
|
}
|
|
446
165
|
return chain;
|
|
447
166
|
}
|
|
448
|
-
function
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
if (existingNames.length < 2) {
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
queueJob(deconflictJobForScopeAndName(scope, symbol.name, options.nameConflictResolver));
|
|
455
|
-
}
|
|
456
|
-
function deconflictJobForScopeAndName(scope, name, handler) {
|
|
457
|
-
if (!deconflictJobs.has(scope)) {
|
|
458
|
-
deconflictJobs.set(scope, new Map());
|
|
167
|
+
function getSymbolForRefkey(refkey) {
|
|
168
|
+
if (waitingDeclarations.has(refkey)) {
|
|
169
|
+
return waitingDeclarations.get(refkey);
|
|
459
170
|
}
|
|
460
|
-
const
|
|
461
|
-
|
|
462
|
-
|
|
171
|
+
const symbolRef = shallowRef();
|
|
172
|
+
waitingDeclarations.set(refkey, symbolRef);
|
|
173
|
+
if (knownDeclarations.has(refkey)) {
|
|
174
|
+
symbolRef.value = knownDeclarations.get(refkey);
|
|
463
175
|
}
|
|
464
|
-
|
|
465
|
-
const conflictedSymbols = [...scope.symbols].filter(sym => sym.name === name);
|
|
466
|
-
if (handler) {
|
|
467
|
-
handler(name, conflictedSymbols);
|
|
468
|
-
} else {
|
|
469
|
-
defaultConflictHandler(name, conflictedSymbols);
|
|
470
|
-
}
|
|
471
|
-
jobs.delete(name);
|
|
472
|
-
};
|
|
473
|
-
jobs.set(name, job);
|
|
474
|
-
return job;
|
|
176
|
+
return symbolRef;
|
|
475
177
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
function getSymbolForRefkey(refkey) {
|
|
487
|
-
const symbol = knownDeclarations.get(refkey);
|
|
488
|
-
if (symbol) {
|
|
489
|
-
return shallowRef(symbol);
|
|
490
|
-
} else {
|
|
491
|
-
if (waitingDeclarations.has(refkey)) {
|
|
492
|
-
return waitingDeclarations.get(refkey);
|
|
493
|
-
} else {
|
|
494
|
-
const declSignal = shallowRef();
|
|
495
|
-
waitingDeclarations.set(refkey, declSignal);
|
|
496
|
-
return declSignal;
|
|
178
|
+
function resolveDeclarationByKey(currentScope, currentMemberScope, refkey) {
|
|
179
|
+
const resolvedSymbol = getSymbolForRefkey(refkey);
|
|
180
|
+
return computed(() => {
|
|
181
|
+
trace(TracePhase.resolve.pending, () => `Resolving ${formatRefkeys(refkey)}.`);
|
|
182
|
+
const symbol = resolvedSymbol.value;
|
|
183
|
+
if (!symbol) {
|
|
184
|
+
trace(TracePhase.resolve.failure, () => `No symbol for ${formatRefkeys(refkey)}.`);
|
|
185
|
+
return undefined;
|
|
497
186
|
}
|
|
498
|
-
|
|
187
|
+
trace(TracePhase.resolve.pending, () => `${formatRefkeys(refkey)} resolved to ${formatSymbolName(symbol)}.`);
|
|
188
|
+
if (hasTransientScope(symbol)) {
|
|
189
|
+
trace(TracePhase.resolve.failure, () => `Symbol ${formatSymbolName(symbol)} in transient scope.`);
|
|
190
|
+
return undefined;
|
|
191
|
+
}
|
|
192
|
+
trace(TracePhase.resolve.success, () => `${formatRefkeys(refkey)} successfully resolved to ${formatSymbolName(symbol)}.`);
|
|
193
|
+
return buildResult(currentScope, currentMemberScope, symbol);
|
|
194
|
+
});
|
|
499
195
|
}
|
|
500
|
-
function
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
} else {
|
|
505
|
-
declSignal = shallowRef();
|
|
506
|
-
waitingDeclarations.set(refkey, declSignal);
|
|
196
|
+
function notifySymbolCreated(symbol) {
|
|
197
|
+
if (symbol.flags & OutputSymbolFlags.Transient) {
|
|
198
|
+
// just ignore transient symbols.
|
|
199
|
+
return;
|
|
507
200
|
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
201
|
+
effect(oldRefkeys => {
|
|
202
|
+
trace(TracePhase.resolve.pending, () => `Notifying resolutions for ${formatRefkeys(symbol.refkeys)}.`);
|
|
203
|
+
if (oldRefkeys) {
|
|
204
|
+
for (const refkey of oldRefkeys) {
|
|
205
|
+
if (!symbol.refkeys.includes(refkey)) {
|
|
206
|
+
// remove the old refkey from the known declarations
|
|
207
|
+
knownDeclarations.delete(refkey);
|
|
208
|
+
|
|
209
|
+
// reset any waiting declarations
|
|
210
|
+
if (waitingDeclarations.has(refkey)) {
|
|
211
|
+
const signal = waitingDeclarations.get(refkey);
|
|
212
|
+
signal.value = undefined;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
512
217
|
for (const refkey of symbol.refkeys) {
|
|
513
218
|
// notify those waiting for this refkey
|
|
514
219
|
knownDeclarations.set(refkey, symbol);
|
|
@@ -526,6 +231,7 @@ export function createOutputBinder(options = {}) {
|
|
|
526
231
|
}
|
|
527
232
|
}
|
|
528
233
|
}
|
|
234
|
+
return [...symbol.refkeys];
|
|
529
235
|
});
|
|
530
236
|
}
|
|
531
237
|
function findSymbolName(scope, name) {
|
|
@@ -550,7 +256,7 @@ export function createOutputBinder(options = {}) {
|
|
|
550
256
|
scope ??= binder.globalScope;
|
|
551
257
|
for (const child of scope.children) {
|
|
552
258
|
if (child.name === name) {
|
|
553
|
-
return
|
|
259
|
+
return shallowRef(child);
|
|
554
260
|
}
|
|
555
261
|
}
|
|
556
262
|
const scopeRef = shallowRef(undefined);
|
|
@@ -618,9 +324,12 @@ export function createOutputBinder(options = {}) {
|
|
|
618
324
|
* is declared, the ref will be updated with the resolution result.
|
|
619
325
|
*/
|
|
620
326
|
export function resolve(refkey) {
|
|
621
|
-
const scope = useScope()
|
|
327
|
+
const scope = useScope();
|
|
622
328
|
const memberScope = useMemberScope();
|
|
623
|
-
const binder = scope
|
|
329
|
+
const binder = scope?.binder ?? memberScope?.instanceMembers?.binder ?? memberScope?.staticMembers?.binder;
|
|
330
|
+
if (!binder) {
|
|
331
|
+
throw new Error("Can't resolve refkey without a binder");
|
|
332
|
+
}
|
|
624
333
|
return binder.resolveDeclarationByKey(scope, memberScope?.instanceMembers, refkey);
|
|
625
334
|
}
|
|
626
335
|
const createSymbolsSymbol = Symbol();
|
|
@@ -630,16 +339,6 @@ export function getSymbolCreator(creator) {
|
|
|
630
339
|
export function getSymbolCreatorSymbol() {
|
|
631
340
|
return createSymbolsSymbol;
|
|
632
341
|
}
|
|
633
|
-
function symbolNames(symbols) {
|
|
634
|
-
return memo(() => {
|
|
635
|
-
const names = new Set();
|
|
636
|
-
for (const sym of symbols.values()) {
|
|
637
|
-
names.add(sym.name);
|
|
638
|
-
}
|
|
639
|
-
return names;
|
|
640
|
-
});
|
|
641
|
-
}
|
|
642
|
-
|
|
643
342
|
/**
|
|
644
343
|
* Use symbol flags to determine the scope in which a symbol with those flags
|
|
645
344
|
* should be declared given the current context.
|
package/dist/src/code.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Children } from "./
|
|
1
|
+
import type { Children } from "./runtime/component.js";
|
|
2
2
|
export declare function text(template: TemplateStringsArray, ...substitutions: Children[]): Children;
|
|
3
3
|
/**
|
|
4
4
|
* Turn the provided string template into Children by replacing literal line
|
package/dist/src/code.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../src/code.ts"],"names":[],"mappings":"AAIA,OAAO,EAAS,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../src/code.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAS,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAE9D,wBAAgB,IAAI,CAClB,QAAQ,EAAE,oBAAoB,EAC9B,GAAG,aAAa,EAAE,QAAQ,EAAE,GAC3B,QAAQ,CAmBV;AAQD;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAClB,QAAQ,EAAE,oBAAoB,EAC9B,GAAG,aAAa,EAAE,QAAQ,EAAE,GAC3B,QAAQ,CAiFV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Block.d.ts","sourceRoot":"","sources":["../../../src/components/Block.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Block.d.ts","sourceRoot":"","sources":["../../../src/components/Block.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAIxD,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,YAYtC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { memo as _$memo, createComponent as _$createComponent, createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { computed } from "@vue/reactivity";
|
|
3
|
+
import { childrenArray } from "../utils.js";
|
|
4
|
+
import { Indent } from "./Indent.js";
|
|
3
5
|
/**
|
|
4
6
|
* Create an indented block of source text. The block has `opener` text which is
|
|
5
7
|
* added prior to the block, which defaults to `"{"`, and `closer` text which is
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OutputSymbol } from "../binder.js";
|
|
2
|
-
import { Children } from "../jsx-runtime.js";
|
|
3
1
|
import { Refkey } from "../refkey.js";
|
|
2
|
+
import type { Children } from "../runtime/component.js";
|
|
3
|
+
import { OutputSymbol } from "../symbols/output-symbol.js";
|
|
4
4
|
/**
|
|
5
5
|
* Create a declaration by providing an already created symbol. The symbol is
|
|
6
6
|
* merely exposed via {@link DeclarationContext}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Declaration.d.ts","sourceRoot":"","sources":["../../../src/components/Declaration.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Declaration.d.ts","sourceRoot":"","sources":["../../../src/components/Declaration.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,MAAM,EAAE,YAAY,CAAC;IAErB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEnC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,MAAM,gBAAgB,GACxB,0BAA0B,GAC1B,wBAAwB,CAAC;AAE7B;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,YA0BlD"}
|
|
@@ -2,7 +2,8 @@ import { memo as _$memo, createComponent as _$createComponent } from "@alloy-js/
|
|
|
2
2
|
import { useContext } from "../context.js";
|
|
3
3
|
import { BinderContext } from "../context/binder.js";
|
|
4
4
|
import { DeclarationContext } from "../context/declaration.js";
|
|
5
|
-
import { onCleanup } from "../
|
|
5
|
+
import { onCleanup } from "../reactivity.js";
|
|
6
|
+
import { OutputSymbol } from "../symbols/output-symbol.js";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Create a declaration by providing an already created symbol. The symbol is
|
|
@@ -39,13 +40,13 @@ export function Declaration(props) {
|
|
|
39
40
|
if ("symbol" in props) {
|
|
40
41
|
declaration = props.symbol;
|
|
41
42
|
} else {
|
|
42
|
-
declaration =
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
declaration = new OutputSymbol(props.name, {
|
|
44
|
+
binder,
|
|
45
|
+
refkeys: [props.refkey ?? []].flat(),
|
|
45
46
|
metadata: props.metadata
|
|
46
47
|
});
|
|
47
48
|
onCleanup(() => {
|
|
48
|
-
|
|
49
|
+
declaration.delete();
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
return _$createComponent(DeclarationContext.Provider, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
2
1
|
import { Ref } from "@vue/reactivity";
|
|
2
|
+
import type { Children } from "../runtime/component.js";
|
|
3
3
|
import { BaseListProps } from "./List.jsx";
|
|
4
4
|
export type ForCallbackArgs<T> = number extends keyof T ? [value: T[number]] : T extends Ref<infer U> ? ForCallbackArgs<U> : T extends () => infer U ? ForCallbackArgs<U> : T extends Map<infer U, infer V> ? [key: U, value: V] : T extends Set<infer U> ? [value: U] : T extends IterableIterator<infer U> ? [value: U] : [];
|
|
5
5
|
export interface ForProps<T extends ForSupportedCollections | (() => ForSupportedCollections) | Ref<ForSupportedCollections>, U extends Children> extends BaseListProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"For.d.ts","sourceRoot":"","sources":["../../../src/components/For.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"For.d.ts","sourceRoot":"","sources":["../../../src/components/For.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,MAAM,eAAe,CAAC,CAAC,IAC3B,MAAM,SAAS,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GACzC,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,GAC3C,CAAC,SAAS,MAAM,MAAM,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,GAC5C,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,GACpD,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,GACnC,CAAC,SAAS,gBAAgB,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,GAChD,EAAE,CAAC;AAEP,MAAM,WAAW,QAAQ,CACvB,CAAC,SACG,uBAAuB,GACvB,CAAC,MAAM,uBAAuB,CAAC,GAC/B,GAAG,CAAC,uBAAuB,CAAC,EAChC,CAAC,SAAS,QAAQ,CAClB,SAAQ,aAAa;IACrB;;OAEG;IACH,IAAI,EAAE,CAAC,CAAC;IAER;;OAEG;IACH,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAEjE;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,uBAAuB,GAC/B,SAAS,OAAO,EAAE,GAClB,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,GAC7B,WAAW,CAAC,OAAO,CAAC,GACpB,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,GAAG,CACjB,CAAC,SACG,uBAAuB,GACvB,CAAC,MAAM,uBAAuB,CAAC,GAC/B,GAAG,CAAC,uBAAuB,CAAC,EAChC,CAAC,SAAS,QAAQ,EAClB,KAAK,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,aAetB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { memo } from "@alloy-js/core/jsx-runtime";
|
|
2
1
|
import { isRef } from "@vue/reactivity";
|
|
2
|
+
import { memo } from "../reactivity.js";
|
|
3
3
|
import { baseListPropsToMapJoinArgs, mapJoin } from "../utils.js";
|
|
4
4
|
/**
|
|
5
5
|
* The For component iterates over the provided array and invokes the child
|