@alloy-js/core 0.1.0
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/LICENSE.txt +7 -0
- package/api-extractor.json +11 -0
- package/babel.config.cjs +4 -0
- package/dist/src/binder.d.ts +333 -0
- package/dist/src/binder.d.ts.map +1 -0
- package/dist/src/binder.js +444 -0
- package/dist/src/binder.js.map +1 -0
- package/dist/src/code.d.ts +3 -0
- package/dist/src/code.d.ts.map +1 -0
- package/dist/src/code.js +156 -0
- package/dist/src/code.js.map +1 -0
- package/dist/src/components/Declaration.d.ts +29 -0
- package/dist/src/components/Declaration.d.ts.map +1 -0
- package/dist/src/components/Declaration.js +47 -0
- package/dist/src/components/Declaration.js.map +1 -0
- package/dist/src/components/Indent.d.ts +13 -0
- package/dist/src/components/Indent.d.ts.map +1 -0
- package/dist/src/components/Indent.js +23 -0
- package/dist/src/components/Indent.js.map +1 -0
- package/dist/src/components/MemberDeclaration.d.ts +30 -0
- package/dist/src/components/MemberDeclaration.d.ts.map +1 -0
- package/dist/src/components/MemberDeclaration.js +52 -0
- package/dist/src/components/MemberDeclaration.js.map +1 -0
- package/dist/src/components/MemberName.d.ts +2 -0
- package/dist/src/components/MemberName.d.ts.map +1 -0
- package/dist/src/components/MemberName.js +11 -0
- package/dist/src/components/MemberName.js.map +1 -0
- package/dist/src/components/MemberScope.d.ts +27 -0
- package/dist/src/components/MemberScope.d.ts.map +1 -0
- package/dist/src/components/MemberScope.js +28 -0
- package/dist/src/components/MemberScope.js.map +1 -0
- package/dist/src/components/Name.d.ts +2 -0
- package/dist/src/components/Name.d.ts.map +1 -0
- package/dist/src/components/Name.js +11 -0
- package/dist/src/components/Name.js.map +1 -0
- package/dist/src/components/Output.d.ts +31 -0
- package/dist/src/components/Output.d.ts.map +1 -0
- package/dist/src/components/Output.js +44 -0
- package/dist/src/components/Output.js.map +1 -0
- package/dist/src/components/Scope.d.ts +10 -0
- package/dist/src/components/Scope.d.ts.map +1 -0
- package/dist/src/components/Scope.js +25 -0
- package/dist/src/components/Scope.js.map +1 -0
- package/dist/src/components/SourceDirectory.d.ts +7 -0
- package/dist/src/components/SourceDirectory.d.ts.map +1 -0
- package/dist/src/components/SourceDirectory.js +38 -0
- package/dist/src/components/SourceDirectory.js.map +1 -0
- package/dist/src/components/SourceFile.d.ts +12 -0
- package/dist/src/components/SourceFile.d.ts.map +1 -0
- package/dist/src/components/SourceFile.js +26 -0
- package/dist/src/components/SourceFile.js.map +1 -0
- package/dist/src/components/index.d.ts +11 -0
- package/dist/src/components/index.d.ts.map +1 -0
- package/dist/src/components/index.js +11 -0
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/components/stc/index.d.ts +26 -0
- package/dist/src/components/stc/index.d.ts.map +1 -0
- package/dist/src/components/stc/index.js +9 -0
- package/dist/src/components/stc/index.js.map +1 -0
- package/dist/src/context/assignment.d.ts +39 -0
- package/dist/src/context/assignment.d.ts.map +1 -0
- package/dist/src/context/assignment.js +39 -0
- package/dist/src/context/assignment.js.map +1 -0
- package/dist/src/context/binder.d.ts +9 -0
- package/dist/src/context/binder.d.ts.map +1 -0
- package/dist/src/context/binder.js +12 -0
- package/dist/src/context/binder.js.map +1 -0
- package/dist/src/context/declaration.d.ts +4 -0
- package/dist/src/context/declaration.d.ts.map +1 -0
- package/dist/src/context/declaration.js +3 -0
- package/dist/src/context/declaration.js.map +1 -0
- package/dist/src/context/indent.d.ts +5 -0
- package/dist/src/context/indent.d.ts.map +1 -0
- package/dist/src/context/indent.js +8 -0
- package/dist/src/context/indent.js.map +1 -0
- package/dist/src/context/index.d.ts +11 -0
- package/dist/src/context/index.d.ts.map +1 -0
- package/dist/src/context/index.js +11 -0
- package/dist/src/context/index.js.map +1 -0
- package/dist/src/context/member-declaration.d.ts +9 -0
- package/dist/src/context/member-declaration.d.ts.map +1 -0
- package/dist/src/context/member-declaration.js +9 -0
- package/dist/src/context/member-declaration.js.map +1 -0
- package/dist/src/context/member-scope.d.ts +13 -0
- package/dist/src/context/member-scope.d.ts.map +1 -0
- package/dist/src/context/member-scope.js +12 -0
- package/dist/src/context/member-scope.js.map +1 -0
- package/dist/src/context/name-policy.d.ts +5 -0
- package/dist/src/context/name-policy.d.ts.map +1 -0
- package/dist/src/context/name-policy.js +10 -0
- package/dist/src/context/name-policy.js.map +1 -0
- package/dist/src/context/scope.d.ts +5 -0
- package/dist/src/context/scope.d.ts.map +1 -0
- package/dist/src/context/scope.js +6 -0
- package/dist/src/context/scope.js.map +1 -0
- package/dist/src/context/source-directory.d.ts +9 -0
- package/dist/src/context/source-directory.d.ts.map +1 -0
- package/dist/src/context/source-directory.js +3 -0
- package/dist/src/context/source-directory.js.map +1 -0
- package/dist/src/context/source-file.d.ts +12 -0
- package/dist/src/context/source-file.d.ts.map +1 -0
- package/dist/src/context/source-file.js +3 -0
- package/dist/src/context/source-file.js.map +1 -0
- package/dist/src/context.d.ts +13 -0
- package/dist/src/context.d.ts.map +1 -0
- package/dist/src/context.js +30 -0
- package/dist/src/context.js.map +1 -0
- package/dist/src/index.d.ts +13 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +13 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/jsx-runtime.d.ts +43 -0
- package/dist/src/jsx-runtime.d.ts.map +1 -0
- package/dist/src/jsx-runtime.js +172 -0
- package/dist/src/jsx-runtime.js.map +1 -0
- package/dist/src/name-policy.d.ts +5 -0
- package/dist/src/name-policy.d.ts.map +1 -0
- package/dist/src/name-policy.js +8 -0
- package/dist/src/name-policy.js.map +1 -0
- package/dist/src/refkey.d.ts +9 -0
- package/dist/src/refkey.d.ts.map +1 -0
- package/dist/src/refkey.js +44 -0
- package/dist/src/refkey.js.map +1 -0
- package/dist/src/render.d.ts +147 -0
- package/dist/src/render.d.ts.map +1 -0
- package/dist/src/render.js +317 -0
- package/dist/src/render.js.map +1 -0
- package/dist/src/tsdoc-metadata.json +11 -0
- package/dist/src/utils.d.ts +80 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +219 -0
- package/dist/src/utils.js.map +1 -0
- package/dist/test/children.test.d.ts +2 -0
- package/dist/test/children.test.d.ts.map +1 -0
- package/dist/test/components/source-file.test.d.ts +2 -0
- package/dist/test/components/source-file.test.d.ts.map +1 -0
- package/dist/test/name-policy.test.d.ts +2 -0
- package/dist/test/name-policy.test.d.ts.map +1 -0
- package/dist/test/reactivity/ref-rendering.test.d.ts +2 -0
- package/dist/test/reactivity/ref-rendering.test.d.ts.map +1 -0
- package/dist/test/reactivity/test.test.d.ts +2 -0
- package/dist/test/reactivity/test.test.d.ts.map +1 -0
- package/dist/test/refkey.test.d.ts +2 -0
- package/dist/test/refkey.test.d.ts.map +1 -0
- package/dist/test/rendering/basic.test.d.ts +2 -0
- package/dist/test/rendering/basic.test.d.ts.map +1 -0
- package/dist/test/rendering/code.test.d.ts +2 -0
- package/dist/test/rendering/code.test.d.ts.map +1 -0
- package/dist/test/rendering/indent.test.d.ts +2 -0
- package/dist/test/rendering/indent.test.d.ts.map +1 -0
- package/dist/test/rendering/linebreaks.test.d.ts +2 -0
- package/dist/test/rendering/linebreaks.test.d.ts.map +1 -0
- package/dist/test/rendering/refkeys.test.d.ts +2 -0
- package/dist/test/rendering/refkeys.test.d.ts.map +1 -0
- package/dist/test/stc.test.d.ts +2 -0
- package/dist/test/stc.test.d.ts.map +1 -0
- package/dist/test/symbols.test.d.ts +2 -0
- package/dist/test/symbols.test.d.ts.map +1 -0
- package/dist/test/utils.test.d.ts +2 -0
- package/dist/test/utils.test.d.ts.map +1 -0
- package/dist/testing/extend-expect.d.ts +2 -0
- package/dist/testing/extend-expect.d.ts.map +1 -0
- package/dist/testing/extend-expect.js +22 -0
- package/dist/testing/extend-expect.js.map +1 -0
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +3 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/render.d.ts +7 -0
- package/dist/testing/render.d.ts.map +1 -0
- package/dist/testing/render.js +25 -0
- package/dist/testing/render.js.map +1 -0
- package/dist/testing/vitest.d.js +1 -0
- package/dist/testing/vitest.d.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +64 -0
- package/src/binder.ts +838 -0
- package/src/code.ts +220 -0
- package/src/components/Declaration.tsx +53 -0
- package/src/components/Indent.tsx +33 -0
- package/src/components/MemberDeclaration.tsx +62 -0
- package/src/components/MemberName.tsx +11 -0
- package/src/components/MemberScope.tsx +40 -0
- package/src/components/Name.tsx +11 -0
- package/src/components/Output.tsx +69 -0
- package/src/components/Scope.tsx +27 -0
- package/src/components/SourceDirectory.tsx +43 -0
- package/src/components/SourceFile.tsx +33 -0
- package/src/components/index.tsx +10 -0
- package/src/components/stc/index.ts +9 -0
- package/src/context/assignment.ts +57 -0
- package/src/context/binder.ts +14 -0
- package/src/context/declaration.ts +5 -0
- package/src/context/indent.ts +10 -0
- package/src/context/index.ts +10 -0
- package/src/context/member-declaration.ts +10 -0
- package/src/context/member-scope.ts +17 -0
- package/src/context/name-policy.ts +13 -0
- package/src/context/scope.ts +8 -0
- package/src/context/source-directory.ts +11 -0
- package/src/context/source-file.ts +12 -0
- package/src/context.ts +53 -0
- package/src/index.ts +21 -0
- package/src/jsx-runtime.ts +266 -0
- package/src/name-policy.ts +13 -0
- package/src/refkey.ts +62 -0
- package/src/render.ts +389 -0
- package/src/utils.ts +288 -0
- package/temp/api.json +8840 -0
- package/test/children.test.tsx +33 -0
- package/test/components/source-file.test.tsx +45 -0
- package/test/name-policy.test.tsx +19 -0
- package/test/reactivity/ref-rendering.test.tsx +50 -0
- package/test/reactivity/test.test.tsx +83 -0
- package/test/refkey.test.ts +32 -0
- package/test/rendering/basic.test.tsx +156 -0
- package/test/rendering/code.test.tsx +62 -0
- package/test/rendering/indent.test.tsx +608 -0
- package/test/rendering/linebreaks.test.tsx +72 -0
- package/test/rendering/refkeys.test.tsx +35 -0
- package/test/stc.test.tsx +21 -0
- package/test/symbols.test.ts +406 -0
- package/test/utils.test.tsx +150 -0
- package/testing/extend-expect.ts +20 -0
- package/testing/index.ts +2 -0
- package/testing/render.ts +37 -0
- package/testing/vitest.d.ts +10 -0
- package/tsconfig.json +17 -0
- package/vitest.config.ts +18 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { useContext } from "../context.js";
|
|
4
|
+
import { BinderContext } from "../context/binder.js";
|
|
5
|
+
import { DeclarationContext } from "../context/declaration.js";
|
|
6
|
+
import { refkey } from "../refkey.js";
|
|
7
|
+
/**
|
|
8
|
+
* Declares a symbol in the current scope for this component's children.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
*
|
|
12
|
+
* This component must be called in one of two ways: with a name and an optional
|
|
13
|
+
* refkey, or else passing in the symbol. When called with a name and refkey, a
|
|
14
|
+
* symbol will be created in the current scope (provided by
|
|
15
|
+
* {@link ScopeContext}) with that name and refkey. If a refkey is not provided,
|
|
16
|
+
* `refkey(props.name)` is used.
|
|
17
|
+
*
|
|
18
|
+
* When called with a symbol, that symbol is merely exposed via
|
|
19
|
+
* {@link DeclarationContext }. It is assumed that the caller of this component
|
|
20
|
+
* has created the symbol with the `createSymbol` API on the
|
|
21
|
+
* {@link BinderContext }.
|
|
22
|
+
*
|
|
23
|
+
* @see {@link BinderContext}
|
|
24
|
+
*/
|
|
25
|
+
export function Declaration(props) {
|
|
26
|
+
const binder = useContext(BinderContext);
|
|
27
|
+
if (!binder) {
|
|
28
|
+
throw new Error("Need binder context to create declarations");
|
|
29
|
+
}
|
|
30
|
+
let declaration;
|
|
31
|
+
if (props.symbol) {
|
|
32
|
+
declaration = props.symbol;
|
|
33
|
+
} else {
|
|
34
|
+
const rk = props.refkey ? props.refkey : refkey(props.name);
|
|
35
|
+
declaration = binder.createSymbol({
|
|
36
|
+
name: props.name,
|
|
37
|
+
refkey: rk
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return _$createComponent(DeclarationContext.Provider, {
|
|
41
|
+
value: declaration,
|
|
42
|
+
get children() {
|
|
43
|
+
return props.children;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=Declaration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Declaration.js","names":["useContext","BinderContext","DeclarationContext","refkey","Declaration","props","binder","Error","declaration","symbol","rk","name","createSymbol","_$createComponent","Provider","value","children"],"sources":["../../../src/components/Declaration.tsx"],"sourcesContent":[null],"mappings":";;AAEA,SAASA,UAAU,QAAQ,eAAe;AAC1C,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,kBAAkB,QAAQ,2BAA2B;AAC9D,SAAiBC,MAAM,QAAQ,cAAc;AAS7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAACC,KAAuB,EAAE;EACnD,MAAMC,MAAM,GAAGN,UAAU,CAACC,aAAa,CAAC;EACxC,IAAI,CAACK,MAAM,EAAE;IACX,MAAM,IAAIC,KAAK,CAAC,4CAA4C,CAAC;EAC/D;EAEA,IAAIC,WAAW;EACf,IAAIH,KAAK,CAACI,MAAM,EAAE;IAChBD,WAAW,GAAGH,KAAK,CAACI,MAAM;EAC5B,CAAC,MAAM;IACL,MAAMC,EAAE,GAAGL,KAAK,CAACF,MAAM,GAAGE,KAAK,CAACF,MAAM,GAAGA,MAAM,CAACE,KAAK,CAACM,IAAI,CAAC;IAC3DH,WAAW,GAAGF,MAAM,CAACM,YAAY,CAAC;MAChCD,IAAI,EAAEN,KAAK,CAACM,IAAK;MACjBR,MAAM,EAAEO;IACV,CAAC,CAAC;EACJ;EAEA,OAAAG,iBAAA,CAAQX,kBAAkB,CAACY,QAAQ;IAACC,KAAK,EAAEP,WAAW;IAAA,IAAAQ,SAAA;MAAA,OACnDX,KAAK,CAACW,QAAQ;IAAA;EAAA;AAEnB","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
export interface IndentProps {
|
|
3
|
+
children?: Children;
|
|
4
|
+
indent?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IndentState {
|
|
7
|
+
level: number;
|
|
8
|
+
indent: string;
|
|
9
|
+
indentString: string;
|
|
10
|
+
noLeading?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function Indent(props: IndentProps): any;
|
|
13
|
+
//# sourceMappingURL=Indent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Indent.d.ts","sourceRoot":"","sources":["../../../src/components/Indent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAItD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,OAgBxC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { useContext } from "../context.js";
|
|
3
|
+
import { IndentContext } from "../context/indent.js";
|
|
4
|
+
export function Indent(props) {
|
|
5
|
+
const previousIndent = useContext(IndentContext) ?? {
|
|
6
|
+
level: 0,
|
|
7
|
+
indent: props.indent ?? " ",
|
|
8
|
+
indentString: ""
|
|
9
|
+
};
|
|
10
|
+
const level = previousIndent.level + 1;
|
|
11
|
+
const currentIndent = {
|
|
12
|
+
level,
|
|
13
|
+
indent: props.indent ?? previousIndent.indent,
|
|
14
|
+
indentString: (props.indent ?? previousIndent.indent).repeat(level)
|
|
15
|
+
};
|
|
16
|
+
return _$createComponent(IndentContext.Provider, {
|
|
17
|
+
value: currentIndent,
|
|
18
|
+
get children() {
|
|
19
|
+
return props.children;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=Indent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Indent.js","names":["useContext","IndentContext","Indent","props","previousIndent","level","indent","indentString","currentIndent","repeat","_$createComponent","Provider","value","children"],"sources":["../../../src/components/Indent.tsx"],"sourcesContent":[null],"mappings":";AACA,SAASA,UAAU,QAAQ,eAAe;AAC1C,SAASC,aAAa,QAAQ,sBAAsB;AAcpD,OAAO,SAASC,MAAMA,CAACC,KAAkB,EAAE;EACzC,MAAMC,cAAc,GAAGJ,UAAU,CAACC,aAAa,CAAC,IAAI;IAClDI,KAAK,EAAE,CAAC;IACRC,MAAM,EAAEH,KAAK,CAACG,MAAM,IAAI,IAAI;IAC5BC,YAAY,EAAE;EAChB,CAAC;EAED,MAAMF,KAAK,GAAGD,cAAc,CAACC,KAAK,GAAG,CAAC;EAEtC,MAAMG,aAAa,GAAG;IACpBH,KAAK;IACLC,MAAM,EAAEH,KAAK,CAACG,MAAM,IAAIF,cAAc,CAACE,MAAM;IAC7CC,YAAY,EAAE,CAACJ,KAAK,CAACG,MAAM,IAAIF,cAAc,CAACE,MAAM,EAAEG,MAAM,CAACJ,KAAK;EACpE,CAAC;EAED,OAAAK,iBAAA,CAAQT,aAAa,CAACU,QAAQ;IAACC,KAAK,EAAEJ,aAAa;IAAA,IAAAK,SAAA;MAAA,OAAGV,KAAK,CAACU,QAAQ;IAAA;EAAA;AACtE","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { OutputSymbol } from "../binder.js";
|
|
3
|
+
import { Refkey } from "../refkey.js";
|
|
4
|
+
export interface MemberDeclarationProps {
|
|
5
|
+
name?: string;
|
|
6
|
+
refkey?: Refkey;
|
|
7
|
+
symbol?: OutputSymbol;
|
|
8
|
+
children?: Children;
|
|
9
|
+
static?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Declares a symbol in the current member scope for this component's children.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
*
|
|
16
|
+
* This component must be called in one of two ways: with a name and an optional
|
|
17
|
+
* refkey, or else passing in the symbol. When called with a name and refkey, a
|
|
18
|
+
* symbol will be created in the current scope (provided by
|
|
19
|
+
* {@link MemberDeclarationContext}) with that name and refkey. If a refkey is not
|
|
20
|
+
* provided, `refkey(props.name)` is used.
|
|
21
|
+
*
|
|
22
|
+
* When called with a symbol, that symbol is merely exposed via
|
|
23
|
+
* {@link MemberDeclarationContext}. It is assumed that the caller of this component
|
|
24
|
+
* has created the symbol with the `createSymbol` API on the
|
|
25
|
+
* {@link BinderContext}.
|
|
26
|
+
*
|
|
27
|
+
* @see {@link BinderContext}
|
|
28
|
+
*/
|
|
29
|
+
export declare function MemberDeclaration(props: MemberDeclarationProps): any;
|
|
30
|
+
//# sourceMappingURL=MemberDeclaration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemberDeclaration.d.ts","sourceRoot":"","sources":["../../../src/components/MemberDeclaration.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAqB,MAAM,cAAc,CAAC;AAI/D,OAAO,EAAE,MAAM,EAAU,MAAM,cAAc,CAAC;AAE9C,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,OA4B9D"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { OutputSymbolFlags } from "../binder.js";
|
|
4
|
+
import { useContext } from "../context.js";
|
|
5
|
+
import { BinderContext } from "../context/binder.js";
|
|
6
|
+
import { MemberDeclarationContext } from "../context/member-declaration.js";
|
|
7
|
+
import { refkey } from "../refkey.js";
|
|
8
|
+
/**
|
|
9
|
+
* Declares a symbol in the current member scope for this component's children.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
*
|
|
13
|
+
* This component must be called in one of two ways: with a name and an optional
|
|
14
|
+
* refkey, or else passing in the symbol. When called with a name and refkey, a
|
|
15
|
+
* symbol will be created in the current scope (provided by
|
|
16
|
+
* {@link MemberDeclarationContext}) with that name and refkey. If a refkey is not
|
|
17
|
+
* provided, `refkey(props.name)` is used.
|
|
18
|
+
*
|
|
19
|
+
* When called with a symbol, that symbol is merely exposed via
|
|
20
|
+
* {@link MemberDeclarationContext}. It is assumed that the caller of this component
|
|
21
|
+
* has created the symbol with the `createSymbol` API on the
|
|
22
|
+
* {@link BinderContext}.
|
|
23
|
+
*
|
|
24
|
+
* @see {@link BinderContext}
|
|
25
|
+
*/
|
|
26
|
+
export function MemberDeclaration(props) {
|
|
27
|
+
const binder = useContext(BinderContext);
|
|
28
|
+
if (!binder) {
|
|
29
|
+
throw new Error("Need binder context to create declarations");
|
|
30
|
+
}
|
|
31
|
+
let declaration;
|
|
32
|
+
if (props.symbol) {
|
|
33
|
+
declaration = props.symbol;
|
|
34
|
+
} else {
|
|
35
|
+
if (!props.name) {
|
|
36
|
+
throw new Error("Must provide a member name, or else provide a member symbol");
|
|
37
|
+
}
|
|
38
|
+
const rk = props.refkey ? props.refkey : refkey(props.name);
|
|
39
|
+
declaration = binder.createSymbol({
|
|
40
|
+
name: props.name,
|
|
41
|
+
refkey: rk,
|
|
42
|
+
flags: props.static ? OutputSymbolFlags.StaticMember : OutputSymbolFlags.InstanceMember
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return _$createComponent(MemberDeclarationContext.Provider, {
|
|
46
|
+
value: declaration,
|
|
47
|
+
get children() {
|
|
48
|
+
return props.children;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=MemberDeclaration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemberDeclaration.js","names":["OutputSymbolFlags","useContext","BinderContext","MemberDeclarationContext","refkey","MemberDeclaration","props","binder","Error","declaration","symbol","name","rk","createSymbol","flags","static","StaticMember","InstanceMember","_$createComponent","Provider","value","children"],"sources":["../../../src/components/MemberDeclaration.tsx"],"sourcesContent":[null],"mappings":";;AACA,SAAuBA,iBAAiB,QAAQ,cAAc;AAC9D,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,wBAAwB,QAAQ,kCAAkC;AAC3E,SAAiBC,MAAM,QAAQ,cAAc;AAU7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,KAA6B,EAAE;EAC/D,MAAMC,MAAM,GAAGN,UAAU,CAACC,aAAa,CAAC;EACxC,IAAI,CAACK,MAAM,EAAE;IACX,MAAM,IAAIC,KAAK,CAAC,4CAA4C,CAAC;EAC/D;EAEA,IAAIC,WAAW;EACf,IAAIH,KAAK,CAACI,MAAM,EAAE;IAChBD,WAAW,GAAGH,KAAK,CAACI,MAAM;EAC5B,CAAC,MAAM;IACL,IAAI,CAACJ,KAAK,CAACK,IAAI,EAAE;MACf,MAAM,IAAIH,KAAK,CACb,6DACF,CAAC;IACH;IACA,MAAMI,EAAE,GAAGN,KAAK,CAACF,MAAM,GAAGE,KAAK,CAACF,MAAM,GAAGA,MAAM,CAACE,KAAK,CAACK,IAAI,CAAC;IAC3DF,WAAW,GAAGF,MAAM,CAACM,YAAY,CAAC;MAChCF,IAAI,EAAEL,KAAK,CAACK,IAAK;MACjBP,MAAM,EAAEQ,EAAE;MACVE,KAAK,EAAER,KAAK,CAACS,MAAM,GACjBf,iBAAiB,CAACgB,YAAY,GAC9BhB,iBAAiB,CAACiB;IACtB,CAAC,CAAC;EACJ;EAEA,OAAAC,iBAAA,CAAQf,wBAAwB,CAACgB,QAAQ;IAACC,KAAK,EAAEX,WAAW;IAAA,IAAAY,SAAA;MAAA,OACzDf,KAAK,CAACe,QAAQ;IAAA;EAAA;AAEnB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemberName.d.ts","sourceRoot":"","sources":["../../../src/components/MemberName.tsx"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,QAOzB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { useContext } from "../context.js";
|
|
3
|
+
import { MemberDeclarationContext } from "../context/member-declaration.js";
|
|
4
|
+
export function MemberName() {
|
|
5
|
+
const declSymbol = useContext(MemberDeclarationContext);
|
|
6
|
+
if (!declSymbol) {
|
|
7
|
+
return "(no member declaration context)";
|
|
8
|
+
}
|
|
9
|
+
return _$memo(() => declSymbol.name);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=MemberName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemberName.js","names":["useContext","MemberDeclarationContext","MemberName","declSymbol","_$memo","name"],"sources":["../../../src/components/MemberName.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,UAAU,QAAQ,eAAe;AAC1C,SAASC,wBAAwB,QAAQ,kCAAkC;AAE3E,OAAO,SAASC,UAAUA,CAAA,EAAG;EAC3B,MAAMC,UAAU,GAAGH,UAAU,CAACC,wBAAwB,CAAC;EACvD,IAAI,CAACE,UAAU,EAAE;IACf,OAAO,iCAAiC;EAC1C;EAEA,OAAAC,MAAA,OAAUD,UAAU,CAACE,IAAI;AAC3B","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { OutputSymbol } from "../binder.js";
|
|
3
|
+
export interface MemberScopeProps {
|
|
4
|
+
/**
|
|
5
|
+
* The name of the member scope.
|
|
6
|
+
*/
|
|
7
|
+
name?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The symbol that owns these members. This symbol must have either
|
|
10
|
+
* {@link OutputSymbolFlags.InstanceMemberContainer} or
|
|
11
|
+
* {@link OutputSymbolFlags.StaticMemberContainer}.
|
|
12
|
+
*/
|
|
13
|
+
owner: OutputSymbol;
|
|
14
|
+
children?: Children;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Declare a member scope, which is a scope that holds instance and static
|
|
18
|
+
* members. This scope is then used for nested instance or static member
|
|
19
|
+
* declarations and resolution of instance members.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
*
|
|
23
|
+
* The member scope contains scopes for both instance and static members.
|
|
24
|
+
* However, it does not affect the resolution of static members.
|
|
25
|
+
*/
|
|
26
|
+
export declare function MemberScope(props: MemberScopeProps): any;
|
|
27
|
+
//# sourceMappingURL=MemberScope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemberScope.d.ts","sourceRoot":"","sources":["../../../src/components/MemberScope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAK5C,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,OAQlD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4
|
+
|
|
5
|
+
import { MemberScopeContext } from "../context/member-scope.js";
|
|
6
|
+
/**
|
|
7
|
+
* Declare a member scope, which is a scope that holds instance and static
|
|
8
|
+
* members. This scope is then used for nested instance or static member
|
|
9
|
+
* declarations and resolution of instance members.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
*
|
|
13
|
+
* The member scope contains scopes for both instance and static members.
|
|
14
|
+
* However, it does not affect the resolution of static members.
|
|
15
|
+
*/
|
|
16
|
+
export function MemberScope(props) {
|
|
17
|
+
const context = {
|
|
18
|
+
instanceMembers: props.owner.instanceMemberScope,
|
|
19
|
+
staticMembers: props.owner.staticMemberScope
|
|
20
|
+
};
|
|
21
|
+
return _$createComponent(MemberScopeContext.Provider, {
|
|
22
|
+
value: context,
|
|
23
|
+
get children() {
|
|
24
|
+
return props.children;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=MemberScope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemberScope.js","names":["MemberScopeContext","MemberScope","props","context","instanceMembers","owner","instanceMemberScope","staticMembers","staticMemberScope","_$createComponent","Provider","value","children"],"sources":["../../../src/components/MemberScope.tsx"],"sourcesContent":[null],"mappings":";;AAGA;;AAEA,SAASA,kBAAkB,QAAQ,4BAA4B;AAgB/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAACC,KAAuB,EAAE;EACnD,MAAMC,OAA2B,GAAG;IAClCC,eAAe,EAAEF,KAAK,CAACG,KAAK,CAACC,mBAAmB;IAChDC,aAAa,EAAEL,KAAK,CAACG,KAAK,CAACG;EAC7B,CAAC;EACD,OAAAC,iBAAA,CAAQT,kBAAkB,CAACU,QAAQ;IAACC,KAAK,EAAER,OAAO;IAAA,IAAAS,SAAA;MAAA,OAC7CV,KAAK,CAACU,QAAQ;IAAA;EAAA;AAErB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Name.d.ts","sourceRoot":"","sources":["../../../src/components/Name.tsx"],"names":[],"mappings":"AAGA,wBAAgB,IAAI,QAOnB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { useContext } from "../context.js";
|
|
3
|
+
import { DeclarationContext } from "../context/declaration.js";
|
|
4
|
+
export function Name() {
|
|
5
|
+
const declSymbol = useContext(DeclarationContext);
|
|
6
|
+
if (!declSymbol) {
|
|
7
|
+
return "";
|
|
8
|
+
}
|
|
9
|
+
return _$memo(() => declSymbol.name);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=Name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Name.js","names":["useContext","DeclarationContext","Name","declSymbol","_$memo","name"],"sources":["../../../src/components/Name.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,UAAU,QAAQ,eAAe;AAC1C,SAASC,kBAAkB,QAAQ,2BAA2B;AAE9D,OAAO,SAASC,IAAIA,CAAA,EAAG;EACrB,MAAMC,UAAU,GAAGH,UAAU,CAACC,kBAAkB,CAAC;EACjD,IAAI,CAACE,UAAU,EAAE;IACf,OAAO,EAAE;EACX;EAEA,OAAAC,MAAA,OAAUD,UAAU,CAACE,IAAI;AAC3B","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { SymbolCreator } from "../binder.js";
|
|
3
|
+
import { NamePolicy } from "../name-policy.js";
|
|
4
|
+
export interface OutputProps {
|
|
5
|
+
children?: Children;
|
|
6
|
+
/**
|
|
7
|
+
* External libraries whose symbols should be available for reference.
|
|
8
|
+
*/
|
|
9
|
+
externals?: SymbolCreator[];
|
|
10
|
+
/**
|
|
11
|
+
* Name policy to use for this output.
|
|
12
|
+
*/
|
|
13
|
+
namePolicy?: NamePolicy<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Policy for handling multiple symbols declared with the same name.
|
|
16
|
+
*/
|
|
17
|
+
nameConflictResolver?: (name: string, symbols: any[]) => void;
|
|
18
|
+
/**
|
|
19
|
+
* The base path for the output contents. Defaults to "."
|
|
20
|
+
*/
|
|
21
|
+
basePath?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* This component is the root component for all your emitted output. Place your
|
|
25
|
+
* various {@link SourceDirectory} and {@link SourceFile} components inside
|
|
26
|
+
* `Output` to create directories and files in your output directory.
|
|
27
|
+
*
|
|
28
|
+
* @see {@link NamePolicyContext}
|
|
29
|
+
*/
|
|
30
|
+
export declare function Output(props: OutputProps): any;
|
|
31
|
+
//# sourceMappingURL=Output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Output.d.ts","sourceRoot":"","sources":["../../../src/components/Output.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAGL,aAAa,EACd,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAK/C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,aAAa,EAAE,CAAC;IAE5B;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAEhC;;OAEG;IACH,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAE9D;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,OAyBxC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { createOutputBinder, getSymbolCreator } from "../binder.js";
|
|
4
|
+
import { BinderContext } from "../context/binder.js";
|
|
5
|
+
import { NamePolicyContext } from "../context/name-policy.js";
|
|
6
|
+
import { SourceDirectory } from "./SourceDirectory.js";
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* This component is the root component for all your emitted output. Place your
|
|
11
|
+
* various {@link SourceDirectory} and {@link SourceFile} components inside
|
|
12
|
+
* `Output` to create directories and files in your output directory.
|
|
13
|
+
*
|
|
14
|
+
* @see {@link NamePolicyContext}
|
|
15
|
+
*/
|
|
16
|
+
export function Output(props) {
|
|
17
|
+
const basePath = props.basePath ?? "./";
|
|
18
|
+
const binder = createOutputBinder({
|
|
19
|
+
nameConflictResolver: props.nameConflictResolver
|
|
20
|
+
});
|
|
21
|
+
const dir = _$createComponent(SourceDirectory, {
|
|
22
|
+
path: basePath,
|
|
23
|
+
get children() {
|
|
24
|
+
return props.children;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
if (props.externals) {
|
|
28
|
+
for (const global of props.externals) {
|
|
29
|
+
getSymbolCreator(global)(binder);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return _$createComponent(BinderContext.Provider, {
|
|
33
|
+
value: binder,
|
|
34
|
+
get children() {
|
|
35
|
+
return _$memo(() => !!props.namePolicy)() ? _$createComponent(NamePolicyContext.Provider, {
|
|
36
|
+
get value() {
|
|
37
|
+
return props.namePolicy;
|
|
38
|
+
},
|
|
39
|
+
children: dir
|
|
40
|
+
}) : dir;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=Output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Output.js","names":["createOutputBinder","getSymbolCreator","BinderContext","NamePolicyContext","SourceDirectory","Output","props","basePath","binder","nameConflictResolver","dir","_$createComponent","path","children","externals","global","Provider","value","_$memo","namePolicy"],"sources":["../../../src/components/Output.tsx"],"sourcesContent":[null],"mappings":";;AACA,SACEA,kBAAkB,EAClBC,gBAAgB,QAEX,cAAc;AACrB,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,iBAAiB,QAAQ,2BAA2B;AAE7D,SAASC,eAAe,QAAQ,sBAAsB;AACtD;;AA0BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,MAAMA,CAACC,KAAkB,EAAE;EACzC,MAAMC,QAAQ,GAAGD,KAAK,CAACC,QAAQ,IAAI,IAAI;EACvC,MAAMC,MAAM,GAAGR,kBAAkB,CAAC;IAChCS,oBAAoB,EAAEH,KAAK,CAACG;EAC9B,CAAC,CAAC;EACF,MAAMC,GAAG,GAAAC,iBAAA,CACNP,eAAe;IAACQ,IAAI,EAAEL,QAAQ;IAAA,IAAAM,SAAA;MAAA,OAC9BP,KAAK,CAACO,QAAQ;IAAA;EAAA,EACC;EAElB,IAAIP,KAAK,CAACQ,SAAS,EAAE;IACnB,KAAK,MAAMC,MAAM,IAAIT,KAAK,CAACQ,SAAS,EAAE;MACpCb,gBAAgB,CAACc,MAAM,CAAC,CAACP,MAAM,CAAC;IAClC;EACF;EAEA,OAAAG,iBAAA,CAAQT,aAAa,CAACc,QAAQ;IAACC,KAAK,EAAET,MAAM;IAAA,IAAAK,SAAA;MAAA,OAExCK,MAAA,SAAAZ,KAAK,CAACa,UAAU,MAAAR,iBAAA,CACbR,iBAAiB,CAACa,QAAQ;QAAA,IAACC,KAAKA,CAAA;UAAA,OAAEX,KAAK,CAACa,UAAU;QAAA;QAAAN,QAAA,EAChDH;MAAG,KAENA,GAAG;IAAA;EAAA;AAGX","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { OutputScope } from "../binder.js";
|
|
3
|
+
export interface ScopeProps {
|
|
4
|
+
kind?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
value?: OutputScope;
|
|
7
|
+
children?: Children;
|
|
8
|
+
}
|
|
9
|
+
export declare function Scope(props: ScopeProps): any;
|
|
10
|
+
//# sourceMappingURL=Scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Scope.d.ts","sourceRoot":"","sources":["../../../src/components/Scope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAK3C,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,OAatC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { useContext } from "../context.js";
|
|
4
|
+
import { BinderContext } from "../context/binder.js";
|
|
5
|
+
import { ScopeContext } from "../context/scope.js";
|
|
6
|
+
export function Scope(props) {
|
|
7
|
+
let scope;
|
|
8
|
+
if (props.value) {
|
|
9
|
+
scope = props.value;
|
|
10
|
+
} else {
|
|
11
|
+
const kind = props.kind ?? "file";
|
|
12
|
+
const binder = useContext(BinderContext);
|
|
13
|
+
scope = binder.createScope({
|
|
14
|
+
kind,
|
|
15
|
+
name: props.name
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return _$createComponent(ScopeContext.Provider, {
|
|
19
|
+
value: scope,
|
|
20
|
+
get children() {
|
|
21
|
+
return props.children;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=Scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Scope.js","names":["useContext","BinderContext","ScopeContext","Scope","props","scope","value","kind","binder","createScope","name","_$createComponent","Provider","children"],"sources":["../../../src/components/Scope.tsx"],"sourcesContent":[null],"mappings":";;AAEA,SAASA,UAAU,QAAQ,eAAe;AAC1C,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,YAAY,QAAQ,qBAAqB;AASlD,OAAO,SAASC,KAAKA,CAACC,KAAiB,EAAE;EACvC,IAAIC,KAAkB;EACtB,IAAID,KAAK,CAACE,KAAK,EAAE;IACfD,KAAK,GAAGD,KAAK,CAACE,KAAK;EACrB,CAAC,MAAM;IACL,MAAMC,IAAI,GAAGH,KAAK,CAACG,IAAI,IAAI,MAAM;IACjC,MAAMC,MAAM,GAAGR,UAAU,CAACC,aAAa,CAAE;IACzCI,KAAK,GAAGG,MAAM,CAACC,WAAW,CAAC;MAAEF,IAAI;MAAEG,IAAI,EAAEN,KAAK,CAACM;IAAM,CAAC,CAAC;EACzD;EAEA,OAAAC,iBAAA,CAAQT,YAAY,CAACU,QAAQ;IAACN,KAAK,EAAED,KAAK;IAAA,IAAAQ,SAAA;MAAA,OACrCT,KAAK,CAACS,QAAQ;IAAA;EAAA;AAErB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SourceDirectory.d.ts","sourceRoot":"","sources":["../../../src/components/SourceDirectory.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAc,MAAM,4BAA4B,CAAC;AAMlE,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,OAY1D"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { getContext } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { shallowReactive } from "@vue/reactivity";
|
|
4
|
+
import { join } from "pathe";
|
|
5
|
+
import { useContext } from "../context.js";
|
|
6
|
+
import { SourceDirectoryContext } from "../context/source-directory.js";
|
|
7
|
+
export function SourceDirectory(props) {
|
|
8
|
+
const parentDir = useContext(SourceDirectoryContext);
|
|
9
|
+
// todo: this can probably just use context.
|
|
10
|
+
const sdPath = parentDir ? join(parentDir.path, props.path) : props.path;
|
|
11
|
+
const nodeContext = getContext();
|
|
12
|
+
const context = createSourceDirectoryContext(props.path, parentDir);
|
|
13
|
+
nodeContext.meta ??= {};
|
|
14
|
+
nodeContext.meta.directory = {
|
|
15
|
+
path: sdPath
|
|
16
|
+
};
|
|
17
|
+
return _$createComponent(SourceDirectoryContext.Provider, {
|
|
18
|
+
value: context,
|
|
19
|
+
get children() {
|
|
20
|
+
return props.children;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function createSourceDirectoryContext(path = "./", parentDir) {
|
|
25
|
+
const contents = shallowReactive([]);
|
|
26
|
+
const context = {
|
|
27
|
+
path: parentDir ? join(parentDir.path, path) : path,
|
|
28
|
+
contents,
|
|
29
|
+
addContent(content) {
|
|
30
|
+
contents.push(content);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
if (parentDir) {
|
|
34
|
+
parentDir.addContent(context);
|
|
35
|
+
}
|
|
36
|
+
return context;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=SourceDirectory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SourceDirectory.js","names":["getContext","shallowReactive","join","useContext","SourceDirectoryContext","SourceDirectory","props","parentDir","sdPath","path","nodeContext","context","createSourceDirectoryContext","meta","directory","_$createComponent","Provider","value","children","contents","addContent","content","push"],"sources":["../../../src/components/SourceDirectory.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAAmBA,UAAU,QAAQ,4BAA4B;AACjE,SAASC,eAAe,QAAQ,iBAAiB;AACjD,SAASC,IAAI,QAAQ,OAAO;AAC5B,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,sBAAsB,QAAQ,gCAAgC;AAOvE,OAAO,SAASC,eAAeA,CAACC,KAA2B,EAAE;EAC3D,MAAMC,SAAS,GAAGJ,UAAU,CAACC,sBAAsB,CAAC;EACpD;EACA,MAAMI,MAAM,GAAGD,SAAS,GAAGL,IAAI,CAACK,SAAS,CAACE,IAAI,EAAEH,KAAK,CAACG,IAAI,CAAC,GAAGH,KAAK,CAACG,IAAI;EACxE,MAAMC,WAAW,GAAGV,UAAU,CAAC,CAAE;EACjC,MAAMW,OAAO,GAAGC,4BAA4B,CAACN,KAAK,CAACG,IAAI,EAAEF,SAAS,CAAC;EAEnEG,WAAW,CAACG,IAAI,KAAK,CAAC,CAAC;EACvBH,WAAW,CAACG,IAAI,CAACC,SAAS,GAAG;IAC3BL,IAAI,EAAED;EACR,CAAC;EACD,OAAAO,iBAAA,CAAQX,sBAAsB,CAACY,QAAQ;IAACC,KAAK,EAAEN,OAAO;IAAA,IAAAO,SAAA;MAAA,OAAGZ,KAAK,CAACY,QAAQ;IAAA;EAAA;AACzE;AAEA,SAASN,4BAA4BA,CACnCH,IAAY,GAAG,IAAI,EACnBF,SAAkC,EACV;EACxB,MAAMY,QAAQ,GAAGlB,eAAe,CAAC,EAAS,CAAC;EAC3C,MAAMU,OAA+B,GAAG;IACtCF,IAAI,EAAEF,SAAS,GAAGL,IAAI,CAACK,SAAS,CAACE,IAAI,EAAEA,IAAI,CAAC,GAAGA,IAAI;IACnDU,QAAQ;IACRC,UAAUA,CAACC,OAAO,EAAE;MAClBF,QAAQ,CAACG,IAAI,CAACD,OAAO,CAAC;IACxB;EACF,CAAC;EACD,IAAId,SAAS,EAAE;IACbA,SAAS,CAACa,UAAU,CAACT,OAAO,CAAC;EAC/B;EAEA,OAAOA,OAAO;AAChB","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Children, ComponentDefinition } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { Refkey } from "../refkey.js";
|
|
3
|
+
export interface SourceFileProps {
|
|
4
|
+
path: string;
|
|
5
|
+
filetype: string;
|
|
6
|
+
children?: Children[];
|
|
7
|
+
reference?: ComponentDefinition<{
|
|
8
|
+
refkey: Refkey;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
export declare function SourceFile(props: SourceFileProps): any;
|
|
12
|
+
//# sourceMappingURL=SourceFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SourceFile.d.ts","sourceRoot":"","sources":["../../../src/components/SourceFile.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,mBAAmB,EAEpB,MAAM,4BAA4B,CAAC;AAKpC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,mBAAmB,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,OAchD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { getContext } from "@alloy-js/core/jsx-runtime";
|
|
4
|
+
import { join } from "pathe";
|
|
5
|
+
import { useContext } from "../context.js";
|
|
6
|
+
import { SourceDirectoryContext } from "../context/source-directory.js";
|
|
7
|
+
import { SourceFileContext } from "../context/source-file.js";
|
|
8
|
+
export function SourceFile(props) {
|
|
9
|
+
const parentDirectory = useContext(SourceDirectoryContext);
|
|
10
|
+
const context = {
|
|
11
|
+
path: join(parentDirectory ? parentDirectory.path : "", props.path),
|
|
12
|
+
filetype: props.filetype,
|
|
13
|
+
reference: props.reference
|
|
14
|
+
};
|
|
15
|
+
parentDirectory?.addContent(context);
|
|
16
|
+
const nodeContext = getContext();
|
|
17
|
+
nodeContext.meta ??= {};
|
|
18
|
+
nodeContext.meta.sourceFile = context;
|
|
19
|
+
return _$createComponent(SourceFileContext.Provider, {
|
|
20
|
+
value: context,
|
|
21
|
+
get children() {
|
|
22
|
+
return props.children;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=SourceFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SourceFile.js","names":["getContext","join","useContext","SourceDirectoryContext","SourceFileContext","SourceFile","props","parentDirectory","context","path","filetype","reference","addContent","nodeContext","meta","sourceFile","_$createComponent","Provider","value","children"],"sources":["../../../src/components/SourceFile.tsx"],"sourcesContent":[null],"mappings":";;AAAA,SAGEA,UAAU,QACL,4BAA4B;AACnC,SAASC,IAAI,QAAQ,OAAO;AAC5B,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,sBAAsB,QAAQ,gCAAgC;AACvE,SAASC,iBAAiB,QAAQ,2BAA2B;AAU7D,OAAO,SAASC,UAAUA,CAACC,KAAsB,EAAE;EACjD,MAAMC,eAAe,GAAGL,UAAU,CAACC,sBAAsB,CAAE;EAC3D,MAAMK,OAA0B,GAAG;IACjCC,IAAI,EAAER,IAAI,CAACM,eAAe,GAAGA,eAAe,CAACE,IAAI,GAAG,EAAE,EAAEH,KAAK,CAACG,IAAI,CAAC;IACnEC,QAAQ,EAAEJ,KAAK,CAACI,QAAQ;IACxBC,SAAS,EAAEL,KAAK,CAACK;EACnB,CAAC;EACDJ,eAAe,EAAEK,UAAU,CAACJ,OAAO,CAAC;EACpC,MAAMK,WAAW,GAAGb,UAAU,CAAC,CAAE;EACjCa,WAAW,CAACC,IAAI,KAAK,CAAC,CAAC;EACvBD,WAAW,CAACC,IAAI,CAACC,UAAU,GAAGP,OAAO;EACrC,OAAAQ,iBAAA,CAAQZ,iBAAiB,CAACa,QAAQ;IAACC,KAAK,EAAEV,OAAO;IAAA,IAAAW,SAAA;MAAA,OAC9Cb,KAAK,CAACa,QAAQ;IAAA;EAAA;AAEnB","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./Declaration.js";
|
|
2
|
+
export * from "./Indent.js";
|
|
3
|
+
export * from "./MemberDeclaration.jsx";
|
|
4
|
+
export * from "./MemberName.jsx";
|
|
5
|
+
export * from "./MemberScope.jsx";
|
|
6
|
+
export * from "./Name.jsx";
|
|
7
|
+
export * from "./Output.js";
|
|
8
|
+
export * from "./Scope.js";
|
|
9
|
+
export * from "./SourceDirectory.js";
|
|
10
|
+
export * from "./SourceFile.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./Declaration.js";
|
|
2
|
+
export * from "./Indent.js";
|
|
3
|
+
export * from "./MemberDeclaration.js";
|
|
4
|
+
export * from "./MemberName.js";
|
|
5
|
+
export * from "./MemberScope.js";
|
|
6
|
+
export * from "./Name.js";
|
|
7
|
+
export * from "./Output.js";
|
|
8
|
+
export * from "./Scope.js";
|
|
9
|
+
export * from "./SourceDirectory.js";
|
|
10
|
+
export * from "./SourceFile.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/index.tsx"],"sourcesContent":[null],"mappings":"AAAA,cAAc,kBAAkB;AAChC,cAAc,aAAa;AAC3B;AACA;AACA;AACA;AACA,cAAc,aAAa;AAC3B,cAAc,YAAY;AAC1B,cAAc,sBAAsB;AACpC,cAAc,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as base from "../index.js";
|
|
2
|
+
export declare const Declaration: (props?: base.DeclarationProps | undefined) => import("../../jsx-runtime.js").ComponentCreator<base.DeclarationProps> & {
|
|
3
|
+
code(template: TemplateStringsArray, ...substitutions: import("../../jsx-runtime.js").Children[]): import("../../jsx-runtime.js").ComponentCreator<base.DeclarationProps>;
|
|
4
|
+
children(...children: import("../../jsx-runtime.js").Children[]): import("../../jsx-runtime.js").ComponentCreator<base.DeclarationProps>;
|
|
5
|
+
};
|
|
6
|
+
export declare const Indent: (props?: base.IndentProps | undefined) => import("../../jsx-runtime.js").ComponentCreator<base.IndentProps> & {
|
|
7
|
+
code(template: TemplateStringsArray, ...substitutions: import("../../jsx-runtime.js").Children[]): import("../../jsx-runtime.js").ComponentCreator<base.IndentProps>;
|
|
8
|
+
children(...children: import("../../jsx-runtime.js").Children[]): import("../../jsx-runtime.js").ComponentCreator<base.IndentProps>;
|
|
9
|
+
};
|
|
10
|
+
export declare const Output: (props?: base.OutputProps | undefined) => import("../../jsx-runtime.js").ComponentCreator<base.OutputProps> & {
|
|
11
|
+
code(template: TemplateStringsArray, ...substitutions: import("../../jsx-runtime.js").Children[]): import("../../jsx-runtime.js").ComponentCreator<base.OutputProps>;
|
|
12
|
+
children(...children: import("../../jsx-runtime.js").Children[]): import("../../jsx-runtime.js").ComponentCreator<base.OutputProps>;
|
|
13
|
+
};
|
|
14
|
+
export declare const Scope: (props?: base.ScopeProps | undefined) => import("../../jsx-runtime.js").ComponentCreator<base.ScopeProps> & {
|
|
15
|
+
code(template: TemplateStringsArray, ...substitutions: import("../../jsx-runtime.js").Children[]): import("../../jsx-runtime.js").ComponentCreator<base.ScopeProps>;
|
|
16
|
+
children(...children: import("../../jsx-runtime.js").Children[]): import("../../jsx-runtime.js").ComponentCreator<base.ScopeProps>;
|
|
17
|
+
};
|
|
18
|
+
export declare const SourceDirectory: (props: base.SourceDirectoryProps) => import("../../jsx-runtime.js").ComponentCreator<base.SourceDirectoryProps> & {
|
|
19
|
+
code(template: TemplateStringsArray, ...substitutions: import("../../jsx-runtime.js").Children[]): import("../../jsx-runtime.js").ComponentCreator<base.SourceDirectoryProps>;
|
|
20
|
+
children(...children: import("../../jsx-runtime.js").Children[]): import("../../jsx-runtime.js").ComponentCreator<base.SourceDirectoryProps>;
|
|
21
|
+
};
|
|
22
|
+
export declare const SourceFile: (props: base.SourceFileProps) => import("../../jsx-runtime.js").ComponentCreator<base.SourceFileProps> & {
|
|
23
|
+
code(template: TemplateStringsArray, ...substitutions: import("../../jsx-runtime.js").Children[]): import("../../jsx-runtime.js").ComponentCreator<base.SourceFileProps>;
|
|
24
|
+
children(...children: import("../../jsx-runtime.js").Children[]): import("../../jsx-runtime.js").ComponentCreator<base.SourceFileProps>;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/stc/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AAEpC,eAAO,MAAM,WAAW;;;CAAwB,CAAC;AACjD,eAAO,MAAM,MAAM;;;CAAmB,CAAC;AACvC,eAAO,MAAM,MAAM;;;CAAmB,CAAC;AACvC,eAAO,MAAM,KAAK;;;CAAkB,CAAC;AACrC,eAAO,MAAM,eAAe;;;CAA4B,CAAC;AACzD,eAAO,MAAM,UAAU;;;CAAuB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { stc } from "../../utils.js";
|
|
2
|
+
import * as base from "../index.js";
|
|
3
|
+
export const Declaration = stc(base.Declaration);
|
|
4
|
+
export const Indent = stc(base.Indent);
|
|
5
|
+
export const Output = stc(base.Output);
|
|
6
|
+
export const Scope = stc(base.Scope);
|
|
7
|
+
export const SourceDirectory = stc(base.SourceDirectory);
|
|
8
|
+
export const SourceFile = stc(base.SourceFile);
|
|
9
|
+
//# sourceMappingURL=index.js.map
|