@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/src/code.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// it should be possible to share logic between this and the babel transform, but
|
|
3
3
|
// this is an exercise for the future.
|
|
4
4
|
import { hbr, indent } from "./components/stc/sti.js";
|
|
5
|
-
import { Child, Children } from "./
|
|
5
|
+
import type { Child, Children } from "./runtime/component.js";
|
|
6
6
|
|
|
7
7
|
export function text(
|
|
8
8
|
template: TemplateStringsArray,
|
package/src/components/Block.tsx
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { computed } from "@vue/reactivity";
|
|
2
|
+
import type { Children } from "../runtime/component.js";
|
|
3
|
+
import { childrenArray } from "../utils.jsx";
|
|
4
|
+
import { Indent } from "./Indent.jsx";
|
|
2
5
|
|
|
3
6
|
export interface BlockProps {
|
|
4
7
|
/**
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { OutputSymbol } from "../binder.js";
|
|
2
1
|
import { useContext } from "../context.js";
|
|
3
2
|
import { BinderContext } from "../context/binder.js";
|
|
4
3
|
import { DeclarationContext } from "../context/declaration.js";
|
|
5
|
-
import {
|
|
4
|
+
import { onCleanup } from "../reactivity.js";
|
|
6
5
|
import { Refkey } from "../refkey.js";
|
|
6
|
+
import type { Children } from "../runtime/component.js";
|
|
7
|
+
import { OutputSymbol } from "../symbols/output-symbol.js";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Create a declaration by providing an already created symbol. The symbol is
|
|
@@ -68,18 +69,18 @@ export function Declaration(props: DeclarationProps) {
|
|
|
68
69
|
throw new Error("Need binder context to create declarations");
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
let declaration;
|
|
72
|
+
let declaration: OutputSymbol;
|
|
72
73
|
if ("symbol" in props) {
|
|
73
74
|
declaration = props.symbol;
|
|
74
75
|
} else {
|
|
75
|
-
declaration =
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
declaration = new OutputSymbol(props.name, {
|
|
77
|
+
binder,
|
|
78
|
+
refkeys: [props.refkey ?? []].flat(),
|
|
78
79
|
metadata: props.metadata,
|
|
79
80
|
});
|
|
80
81
|
|
|
81
82
|
onCleanup(() => {
|
|
82
|
-
|
|
83
|
+
declaration.delete();
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
86
|
|
package/src/components/For.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Children, memo } from "@alloy-js/core/jsx-runtime";
|
|
2
1
|
import { isRef, Ref } from "@vue/reactivity";
|
|
2
|
+
import { memo } from "../reactivity.js";
|
|
3
|
+
import type { Children } from "../runtime/component.js";
|
|
3
4
|
import { baseListPropsToMapJoinArgs, mapJoin } from "../utils.js";
|
|
4
5
|
import { BaseListProps } from "./List.jsx";
|
|
5
6
|
|
package/src/components/List.tsx
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { splitProps } from "../props-combinators.js";
|
|
2
|
+
import { memo } from "../reactivity.js";
|
|
3
|
+
import type { Children } from "../runtime/component.js";
|
|
2
4
|
import { childrenArray } from "../utils.js";
|
|
3
5
|
import { For } from "./For.jsx";
|
|
4
6
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { OutputSymbol, OutputSymbolFlags } from "../binder.js";
|
|
2
1
|
import { useContext } from "../context.js";
|
|
3
2
|
import { BinderContext } from "../context/binder.js";
|
|
4
3
|
import { MemberDeclarationContext } from "../context/member-declaration.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import type { Refkey } from "../refkey.js";
|
|
5
|
+
import type { Children } from "../runtime/component.js";
|
|
6
|
+
import { OutputSymbolFlags } from "../symbols/flags.js";
|
|
7
|
+
import { OutputSymbol } from "../symbols/output-symbol.js";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Create a member declaration by providing a symbol name and optional symbol
|
|
@@ -85,9 +86,9 @@ export function MemberDeclaration(props: MemberDeclarationProps) {
|
|
|
85
86
|
"Must provide a member name, or else provide a member symbol",
|
|
86
87
|
);
|
|
87
88
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
|
|
90
|
+
declaration = new OutputSymbol(infoProps.name!, {
|
|
91
|
+
refkeys: infoProps.refkey,
|
|
91
92
|
metadata: infoProps.metadata,
|
|
92
93
|
flags:
|
|
93
94
|
infoProps.static ?
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { OutputSymbol } from "../binder.js";
|
|
2
|
-
import { Children } from "../jsx-runtime.js";
|
|
3
|
-
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5
|
-
import { OutputSymbolFlags } from "../binder.js";
|
|
6
1
|
import { MemberScopeContext } from "../context/member-scope.js";
|
|
2
|
+
import type { Children } from "../runtime/component.js";
|
|
3
|
+
import type { OutputSymbol } from "../symbols/output-symbol.js";
|
|
7
4
|
export interface MemberScopeProps {
|
|
8
5
|
/**
|
|
9
6
|
* The name of the member scope.
|
|
@@ -5,9 +5,10 @@ import {
|
|
|
5
5
|
} from "../binder.js";
|
|
6
6
|
import { BinderContext } from "../context/binder.js";
|
|
7
7
|
import { NamePolicyContext } from "../context/name-policy.js";
|
|
8
|
-
import { Children, getContext } from "../jsx-runtime.js";
|
|
9
8
|
import { NamePolicy } from "../name-policy.js";
|
|
9
|
+
import { getContext } from "../reactivity.js";
|
|
10
10
|
import { PrintTreeOptions } from "../render.js";
|
|
11
|
+
import type { Children } from "../runtime/component.js";
|
|
11
12
|
import { extensionEffects } from "../slot.js";
|
|
12
13
|
import { SourceDirectory } from "./SourceDirectory.js";
|
|
13
14
|
|
package/src/components/Prose.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
2
1
|
import { computed } from "@vue/reactivity";
|
|
3
2
|
import { useContext } from "../context.js";
|
|
4
3
|
import { BinderContext } from "../context/binder.js";
|
|
5
4
|
import type { Refkey } from "../refkey.js";
|
|
5
|
+
import type { Children } from "../runtime/component.js";
|
|
6
6
|
|
|
7
7
|
export interface ReferenceOrContentProps {
|
|
8
8
|
readonly refkey: Refkey;
|
package/src/components/Scope.tsx
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { OutputScope } from "../binder.js";
|
|
2
|
-
import { useContext } from "../context.js";
|
|
3
|
-
import { BinderContext } from "../context/binder.js";
|
|
4
1
|
import { ScopeContext } from "../context/scope.js";
|
|
5
|
-
import { Children } from "../
|
|
2
|
+
import type { Children } from "../runtime/component.js";
|
|
3
|
+
import { OutputScope } from "../symbols/output-scope.js";
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
* Declare a scope by providing an already created scope. The scope is merely
|
|
@@ -53,11 +51,9 @@ export function Scope(props: ScopeProps) {
|
|
|
53
51
|
if ("value" in props) {
|
|
54
52
|
scope = props.value;
|
|
55
53
|
} else {
|
|
56
|
-
|
|
57
|
-
scope = binder.createScope({
|
|
54
|
+
scope = new OutputScope(props.name ?? "", {
|
|
58
55
|
kind: props.kind,
|
|
59
56
|
metadata: props.metadata,
|
|
60
|
-
name: props.name ?? "",
|
|
61
57
|
});
|
|
62
58
|
}
|
|
63
59
|
|
package/src/components/Show.tsx
CHANGED
|
@@ -2,7 +2,8 @@ import { shallowReactive } from "@vue/reactivity";
|
|
|
2
2
|
import { join } from "pathe";
|
|
3
3
|
import { useContext } from "../context.js";
|
|
4
4
|
import { SourceDirectoryContext } from "../context/source-directory.js";
|
|
5
|
-
import {
|
|
5
|
+
import { getContext } from "../reactivity.js";
|
|
6
|
+
import type { Children } from "../runtime/component.js";
|
|
6
7
|
|
|
7
8
|
export interface SourceDirectoryProps {
|
|
8
9
|
path: string;
|
|
@@ -2,9 +2,10 @@ import { join } from "pathe";
|
|
|
2
2
|
import { useContext } from "../context.js";
|
|
3
3
|
import { SourceDirectoryContext } from "../context/source-directory.js";
|
|
4
4
|
import { SourceFileContext } from "../context/source-file.js";
|
|
5
|
-
import {
|
|
5
|
+
import { getContext } from "../reactivity.js";
|
|
6
6
|
import { Refkey } from "../refkey.js";
|
|
7
7
|
import { PrintTreeOptions } from "../render.js";
|
|
8
|
+
import type { Children, ComponentDefinition } from "../runtime/component.js";
|
|
8
9
|
import { Show } from "./Show.jsx";
|
|
9
10
|
|
|
10
11
|
export interface SourceFileProps extends PrintTreeOptions {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { memo } from "../reactivity.js";
|
|
2
|
+
import { type Children, taggedComponent } from "../runtime/component.js";
|
|
2
3
|
import { childrenArray, findKeyedChildren } from "../utils.js";
|
|
3
4
|
|
|
4
5
|
export interface SwitchProps {
|
package/src/components/Wrap.tsx
CHANGED
package/src/context/binder.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Binder } from "../binder.js";
|
|
1
|
+
import type { Binder } from "../binder.js";
|
|
2
2
|
import {
|
|
3
|
-
ComponentContext,
|
|
3
|
+
type ComponentContext,
|
|
4
4
|
createNamedContext,
|
|
5
5
|
useContext,
|
|
6
6
|
} from "../context.js";
|
|
@@ -15,5 +15,5 @@ export const BinderContext: ComponentContext<Binder> =
|
|
|
15
15
|
createNamedContext("Binder");
|
|
16
16
|
|
|
17
17
|
export function useBinder() {
|
|
18
|
-
return useContext(BinderContext)
|
|
18
|
+
return useContext(BinderContext);
|
|
19
19
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OutputSymbol } from "../binder.js";
|
|
2
1
|
import { ComponentContext, createNamedContext } from "../context.js";
|
|
2
|
+
import type { OutputSymbol } from "../symbols/output-symbol.js";
|
|
3
3
|
|
|
4
4
|
export const DeclarationContext: ComponentContext<OutputSymbol> =
|
|
5
5
|
createNamedContext("Declaration");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { OutputSymbol } from "../binder.js";
|
|
2
1
|
import {
|
|
3
2
|
ComponentContext,
|
|
4
3
|
createNamedContext,
|
|
5
4
|
useContext,
|
|
6
5
|
} from "../context.js";
|
|
6
|
+
import type { OutputSymbol } from "../symbols/output-symbol.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Provides the symbol for the member currently being declared.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { OutputScope } from "../binder.js";
|
|
2
1
|
import {
|
|
3
2
|
ComponentContext,
|
|
4
3
|
createNamedContext,
|
|
5
4
|
useContext,
|
|
6
5
|
} from "../context.js";
|
|
6
|
+
import type { OutputScope } from "../symbols/output-scope.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The member scope context provides the instance and static member scopes that
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
createNamedContext,
|
|
4
4
|
useContext,
|
|
5
5
|
} from "../context.js";
|
|
6
|
-
import { NamePolicy } from "../name-policy.js";
|
|
6
|
+
import type { NamePolicy } from "../name-policy.js";
|
|
7
7
|
|
|
8
8
|
export const NamePolicyContext: ComponentContext<NamePolicy<string>> =
|
|
9
9
|
createNamedContext<NamePolicy<string>>("NamePolicy", {
|
package/src/context/scope.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { OutputScope } from "../binder.js";
|
|
2
1
|
import {
|
|
3
2
|
ComponentContext,
|
|
4
3
|
createNamedContext,
|
|
5
4
|
useContext,
|
|
6
5
|
} from "../context.js";
|
|
6
|
+
import type { OutputScope } from "../symbols/output-scope.js";
|
|
7
7
|
|
|
8
8
|
export const ScopeContext: ComponentContext<OutputScope> =
|
|
9
9
|
createNamedContext("Scope");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentContext, createNamedContext } from "../context.js";
|
|
2
|
-
import { SourceFileContext } from "./source-file.js";
|
|
2
|
+
import type { SourceFileContext } from "./source-file.js";
|
|
3
3
|
|
|
4
4
|
export interface SourceDirectoryContext {
|
|
5
5
|
contents: (SourceDirectoryContext | SourceFileContext)[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentContext, createNamedContext } from "../context.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { Refkey } from "../refkey.js";
|
|
3
|
+
import { ComponentDefinition } from "../runtime/component.js";
|
|
4
4
|
|
|
5
5
|
export interface SourceFileContext {
|
|
6
6
|
path: string;
|
package/src/context.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { shallowRef } from "@vue/reactivity";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
effect,
|
|
6
|
-
getContext,
|
|
7
|
-
} from "./jsx-runtime.js";
|
|
8
|
-
import { stc, StcSignature } from "./stc.js";
|
|
2
|
+
import { effect, getContext } from "./reactivity.js";
|
|
3
|
+
import type { Children, ComponentDefinition } from "./runtime/component.js";
|
|
4
|
+
import { stc, type StcSignature } from "./stc.js";
|
|
9
5
|
|
|
10
6
|
export interface ComponentContext<T> {
|
|
11
7
|
id: symbol;
|
package/src/debug.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { isReactive } from "@vue/reactivity";
|
|
|
2
2
|
import Table from "cli-table3";
|
|
3
3
|
import pc from "picocolors";
|
|
4
4
|
import { contextsByKey } from "./context.js";
|
|
5
|
-
import { Context, getContext } from "./
|
|
5
|
+
import { Context, getContext } from "./reactivity.js";
|
|
6
6
|
|
|
7
7
|
interface DebugInterface {
|
|
8
8
|
component: {
|
|
@@ -206,3 +206,7 @@ function kvTable(sep = " ") {
|
|
|
206
206
|
style: { "padding-left": 0, "padding-right": 0 },
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
|
+
|
|
210
|
+
export function shouldDebug() {
|
|
211
|
+
return typeof process !== "undefined" && !!process.env?.ALLOY_DEBUG;
|
|
212
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export {
|
|
2
|
+
TrackOpTypes,
|
|
3
|
+
TriggerOpTypes,
|
|
2
4
|
computed,
|
|
3
5
|
isProxy,
|
|
4
6
|
isReactive,
|
|
@@ -10,7 +12,13 @@ export {
|
|
|
10
12
|
toRaw,
|
|
11
13
|
toRef,
|
|
12
14
|
toRefs,
|
|
15
|
+
track,
|
|
16
|
+
trigger,
|
|
17
|
+
watch,
|
|
18
|
+
type Reactive,
|
|
13
19
|
type Ref,
|
|
20
|
+
type ShallowReactive,
|
|
21
|
+
type ShallowRef,
|
|
14
22
|
type ToRef,
|
|
15
23
|
type ToRefs,
|
|
16
24
|
} from "@vue/reactivity";
|
|
@@ -19,12 +27,18 @@ export * from "./code.js";
|
|
|
19
27
|
export * from "./components/index.js";
|
|
20
28
|
export * from "./context.js";
|
|
21
29
|
export * from "./context/index.js";
|
|
22
|
-
export * from "./jsx-runtime.js";
|
|
23
30
|
export * from "./name-policy.js";
|
|
31
|
+
export * from "./props-combinators.js";
|
|
32
|
+
export * from "./reactive-union-set.js";
|
|
33
|
+
export * from "./reactivity.js";
|
|
24
34
|
export * from "./refkey.js";
|
|
25
35
|
export * from "./render.js";
|
|
36
|
+
export * from "./runtime/component.js";
|
|
37
|
+
export * from "./runtime/intrinsic.js";
|
|
26
38
|
export * from "./stc.js";
|
|
27
39
|
export * from "./sti.js";
|
|
40
|
+
export * from "./symbols/index.js";
|
|
41
|
+
export * from "./symbols/symbol-flow.js";
|
|
28
42
|
export * from "./tap.js";
|
|
29
43
|
export * from "./utils.js";
|
|
30
44
|
export * from "./write-output.js";
|