@alloy-js/core 0.7.0 → 0.8.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/CHANGELOG.md +26 -0
- package/babel.config.cjs +1 -4
- package/dist/src/binder.d.ts +13 -12
- package/dist/src/binder.d.ts.map +1 -1
- package/dist/src/binder.js +11 -23
- package/dist/src/binder.js.map +1 -1
- package/dist/src/code.d.ts +11 -2
- package/dist/src/code.d.ts.map +1 -1
- package/dist/src/code.js +27 -2
- package/dist/src/code.js.map +1 -1
- package/dist/src/components/Block.d.ts +2 -2
- package/dist/src/components/Block.d.ts.map +1 -1
- package/dist/src/components/Block.js +6 -5
- package/dist/src/components/Block.js.map +1 -1
- package/dist/src/components/Declaration.d.ts +31 -7
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js +15 -7
- package/dist/src/components/Declaration.js.map +1 -1
- package/dist/src/components/For.d.ts +6 -0
- package/dist/src/components/For.d.ts.map +1 -1
- package/dist/src/components/For.js +2 -3
- package/dist/src/components/For.js.map +1 -1
- package/dist/src/components/Indent.d.ts +29 -1
- package/dist/src/components/Indent.d.ts.map +1 -1
- package/dist/src/components/Indent.js +7 -2
- package/dist/src/components/Indent.js.map +1 -1
- package/dist/src/components/List.d.ts +7 -3
- package/dist/src/components/List.d.ts.map +1 -1
- package/dist/src/components/List.js +1 -16
- package/dist/src/components/List.js.map +1 -1
- package/dist/src/components/MemberDeclaration.d.ts +35 -5
- package/dist/src/components/MemberDeclaration.d.ts.map +1 -1
- package/dist/src/components/MemberDeclaration.js +18 -7
- package/dist/src/components/MemberDeclaration.js.map +1 -1
- package/dist/src/components/MemberScope.d.ts +2 -0
- package/dist/src/components/MemberScope.d.ts.map +1 -1
- package/dist/src/components/MemberScope.js +2 -0
- package/dist/src/components/MemberScope.js.map +1 -1
- package/dist/src/components/Prose.d.ts +10 -0
- package/dist/src/components/Prose.d.ts.map +1 -0
- package/dist/src/components/Prose.js +23 -0
- package/dist/src/components/Prose.js.map +1 -0
- package/dist/src/components/Scope.d.ts +33 -2
- package/dist/src/components/Scope.d.ts.map +1 -1
- package/dist/src/components/Scope.js +20 -4
- package/dist/src/components/Scope.js.map +1 -1
- package/dist/src/components/SourceFile.d.ts +5 -0
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/SourceFile.js +10 -1
- package/dist/src/components/SourceFile.js.map +1 -1
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +1 -0
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/components/stc/index.d.ts +19 -95
- package/dist/src/components/stc/index.d.ts.map +1 -1
- package/dist/src/components/stc/index.js +3 -6
- package/dist/src/components/stc/index.js.map +1 -1
- package/dist/src/components/stc/sti.d.ts +9 -0
- package/dist/src/components/stc/sti.d.ts.map +1 -0
- package/dist/src/components/stc/sti.js +10 -0
- package/dist/src/components/stc/sti.js.map +1 -0
- package/dist/src/context/assignment.d.ts +6 -0
- package/dist/src/context/assignment.d.ts.map +1 -1
- package/dist/src/context/assignment.js +7 -0
- package/dist/src/context/assignment.js.map +1 -1
- package/dist/src/context.d.ts +2 -0
- package/dist/src/context.d.ts.map +1 -1
- package/dist/src/context.js +12 -9
- package/dist/src/context.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/jsx-runtime.d.ts +91 -0
- package/dist/src/jsx-runtime.d.ts.map +1 -1
- package/dist/src/jsx-runtime.js +46 -1
- package/dist/src/jsx-runtime.js.map +1 -1
- package/dist/src/stc.d.ts +5 -7
- package/dist/src/stc.d.ts.map +1 -1
- package/dist/src/stc.js +11 -23
- package/dist/src/stc.js.map +1 -1
- package/dist/src/sti.d.ts +11 -0
- package/dist/src/sti.d.ts.map +1 -0
- package/dist/src/sti.js +31 -0
- package/dist/src/sti.js.map +1 -0
- package/dist/src/tap.d.ts +69 -6
- package/dist/src/tap.d.ts.map +1 -1
- package/dist/src/tap.js +70 -0
- package/dist/src/tap.js.map +1 -1
- package/dist/src/utils.d.ts +5 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +20 -0
- package/dist/src/utils.js.map +1 -1
- package/dist/test/components/prose.test.d.ts +2 -0
- package/dist/test/components/prose.test.d.ts.map +1 -0
- package/dist/test/props-with-defaults.test.d.ts +2 -0
- package/dist/test/props-with-defaults.test.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/binder.ts +20 -29
- package/src/code.ts +37 -3
- package/src/components/Block.tsx +3 -6
- package/src/components/Declaration.tsx +43 -11
- package/src/components/For.tsx +10 -3
- package/src/components/Indent.tsx +38 -5
- package/src/components/List.tsx +14 -40
- package/src/components/MemberDeclaration.tsx +51 -12
- package/src/components/MemberScope.tsx +2 -0
- package/src/components/Prose.tsx +35 -0
- package/src/components/Scope.tsx +45 -5
- package/src/components/SourceFile.tsx +10 -0
- package/src/components/index.tsx +1 -0
- package/src/components/stc/index.ts +3 -6
- package/src/components/stc/sti.ts +10 -0
- package/src/context/assignment.ts +7 -1
- package/src/context.ts +15 -11
- package/src/index.ts +1 -0
- package/src/jsx-runtime.ts +158 -0
- package/src/stc.ts +35 -56
- package/src/sti.ts +63 -0
- package/src/tap.ts +69 -6
- package/src/{utils.ts → utils.tsx} +45 -0
- package/temp/api.json +1509 -428
- package/test/components/declaration.test.tsx +1 -1
- package/test/components/prose.test.tsx +36 -0
- package/test/components/source-file.test.tsx +17 -0
- package/test/props-with-defaults.test.ts +97 -0
- package/test/symbols.test.ts +0 -25
- package/vitest.config.ts +2 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"For.js","names":["memo","isRef","
|
|
1
|
+
{"version":3,"file":"For.js","names":["memo","isRef","baseListPropsToMapJoinArgs","mapJoin","For","props","cb","children","options","skipFalsy","maybeRef","each","value"],"sources":["../../../src/components/For.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAAmBA,IAAI,QAAQ,4BAA4B;AAC3D,SAASC,KAAK,QAAa,iBAAiB;AAC5C,SAASC,0BAA0B,EAAEC,OAAO,QAAQ,aAAa;AAqCjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,GAAGA,CAMjBC,KAAqB,EAAE;EACvB,MAAMC,EAAE,GAAGD,KAAK,CAACE,QAAQ;EACzB,MAAMC,OAAO,GAAGN,0BAA0B,CAACG,KAAK,CAAC;EACjDG,OAAO,CAACC,SAAS,GAAGJ,KAAK,CAACI,SAAS;EACnC,OAAOT,IAAI,CAAC,MAAM;IAChB,MAAMU,QAAQ,GAAGL,KAAK,CAACM,IAAI;IAE3B,OAAQR,OAAO,CACb,OAAOO,QAAQ,KAAK,UAAU,GAAGA,QAAQ,GACvC,MAAOT,KAAK,CAACS,QAAQ,CAAC,GAAGA,QAAQ,CAACE,KAAK,GAAGF,QAC3C,EACDJ,EAAE,EACFE,OACF,CAAC;EACH,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,9 +1,37 @@
|
|
|
1
1
|
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
export interface IndentProps {
|
|
3
3
|
children: Children;
|
|
4
|
+
/**
|
|
5
|
+
* Don't include a line break. The new indentation level will start after the
|
|
6
|
+
* first linebreak within the children.
|
|
7
|
+
*/
|
|
4
8
|
nobreak?: boolean;
|
|
5
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Use a regular line (`<br />`) to start (and optionally end with
|
|
11
|
+
* `trailingBreak`) the new indentation level.
|
|
12
|
+
*/
|
|
13
|
+
line?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Use a soft line (`<sbr />`) to start (and optionally end with
|
|
16
|
+
* `trailingBreak`) the new indentation level.
|
|
17
|
+
*/
|
|
18
|
+
softline?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Use a hard line (`<hbr />`) to start (and optionally end with
|
|
21
|
+
* `trailingBreak`) the new indentation level.
|
|
22
|
+
*/
|
|
23
|
+
hardline?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Place the configured line break at the end of the block after restoring the
|
|
26
|
+
* indentation level.
|
|
27
|
+
*/
|
|
6
28
|
trailingBreak?: boolean;
|
|
7
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Create an indented block of source text. The indented block starts a new line
|
|
32
|
+
* at the new indentation level and, with `trailingBreak`, ends with a new line
|
|
33
|
+
* after restoring the indentation level. The default line break is a hard line
|
|
34
|
+
* break suitable for typical blocks of statements but can be configured.
|
|
35
|
+
*/
|
|
8
36
|
export declare function Indent(props: IndentProps): Children;
|
|
9
37
|
//# sourceMappingURL=Indent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Indent.d.ts","sourceRoot":"","sources":["../../../src/components/Indent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Indent.d.ts","sourceRoot":"","sources":["../../../src/components/Indent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,QAAQ,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,YAiBxC"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Create an indented block of source text. The indented block starts a new line
|
|
5
|
+
* at the new indentation level and, with `trailingBreak`, ends with a new line
|
|
6
|
+
* after restoring the indentation level. The default line break is a hard line
|
|
7
|
+
* break suitable for typical blocks of statements but can be configured.
|
|
8
|
+
*/
|
|
3
9
|
export function Indent(props) {
|
|
4
|
-
const
|
|
5
|
-
const breakElem = props.nobreak ? "" : breakStyle === "hard" ? _$createIntrinsic("hbr", {}) : breakStyle === "soft" ? _$createIntrinsic("sbr", {}) : _$createIntrinsic("br", {});
|
|
10
|
+
const breakElem = props.nobreak ? "" : props.hardline ? _$createIntrinsic("hbr", {}) : props.softline ? _$createIntrinsic("sbr", {}) : props.line ? _$createIntrinsic("br", {}) : _$createIntrinsic("hbr", {});
|
|
6
11
|
return [_$createIntrinsic("indent", {
|
|
7
12
|
get children() {
|
|
8
13
|
return [breakElem, _$memo(() => props.children)];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Indent.js","names":["Indent","props","
|
|
1
|
+
{"version":3,"file":"Indent.js","names":["Indent","props","breakElem","nobreak","hardline","_$createIntrinsic","softline","line","children","_$memo","trailingBreak"],"sources":["../../../src/components/Indent.tsx"],"sourcesContent":[null],"mappings":";;AAmCA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,MAAMA,CAACC,KAAkB,EAAE;EACzC,MAAMC,SAAS,GACbD,KAAK,CAACE,OAAO,GAAG,EAAE,GAChBF,KAAK,CAACG,QAAQ,GAAAC,iBAAA,cACdJ,KAAK,CAACK,QAAQ,GAAAD,iBAAA,cACdJ,KAAK,CAACM,IAAI,GAAAF,iBAAA,aAAAA,iBAAA,WACH;EAEX,QAAAA,iBAAA;IAAA,IAAAG,SAAA;MAAA,QAGON,SAAS,EAAAO,MAAA,OACTR,KAAK,CAACO,QAAQ;IAAA;EAAA,IAAAC,MAAA,OAEhBR,KAAK,CAACS,aAAa,IAAIR,SAAS;AAGvC","ignoreList":[]}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { JoinOptions } from "../utils.js";
|
|
3
|
-
export type BreakKind = "none" | "space" | "soft" | "hard" | "literal";
|
|
4
2
|
export interface BaseListProps {
|
|
5
3
|
/** Text to place between each element */
|
|
6
4
|
joiner?: Children;
|
|
@@ -8,10 +6,17 @@ export interface BaseListProps {
|
|
|
8
6
|
comma?: boolean;
|
|
9
7
|
/** Place a semicolon between each element */
|
|
10
8
|
semicolon?: boolean;
|
|
9
|
+
/** Place a regular line (`<br />`) between each element */
|
|
11
10
|
line?: boolean;
|
|
11
|
+
/** Place a softline (`<sbr />`) between each element */
|
|
12
12
|
softline?: boolean;
|
|
13
|
+
/** Place a hardline (`<hbr />`) between each element */
|
|
13
14
|
hardline?: boolean;
|
|
15
|
+
/** Place two hardlines between each element */
|
|
16
|
+
doubleHardline?: boolean;
|
|
17
|
+
/** Place a literal line (`<lbr />`) between each element */
|
|
14
18
|
literalline?: boolean;
|
|
19
|
+
/** Place a space between each element */
|
|
15
20
|
space?: boolean;
|
|
16
21
|
/**
|
|
17
22
|
* Text to place at the end of the list when there is at least one item. If
|
|
@@ -23,7 +28,6 @@ export interface BaseListProps {
|
|
|
23
28
|
*/
|
|
24
29
|
enderPunctuation?: boolean;
|
|
25
30
|
}
|
|
26
|
-
export declare function baseListPropsToMapJoinArgs(props: BaseListProps): JoinOptions;
|
|
27
31
|
export interface ListProps extends BaseListProps {
|
|
28
32
|
children?: Children;
|
|
29
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../../src/components/List.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAoB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../../src/components/List.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAoB,MAAM,4BAA4B,CAAC;AAIxE,MAAM,WAAW,aAAa;IAC5B,yCAAyC;IACzC,MAAM,CAAC,EAAE,QAAQ,CAAC;IAElB,yCAAyC;IACzC,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,2DAA2D;IAC3D,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf,wDAAwD;IACxD,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,+CAA+C;IAC/C,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,yCAAyC;IACzC,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;QAGI;IACJ,KAAK,CAAC,EAAE,QAAQ,CAAC;IAEjB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,SAAU,SAAQ,aAAa;IAC9C,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,YAYpC"}
|
|
@@ -1,24 +1,8 @@
|
|
|
1
1
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { mergeProps as _$mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
3
|
-
import { createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
4
|
-
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
5
3
|
import { memo, splitProps } from "@alloy-js/core/jsx-runtime";
|
|
6
4
|
import { childrenArray } from "../utils.js";
|
|
7
5
|
import { For } from "./For.js";
|
|
8
|
-
export function baseListPropsToMapJoinArgs(props) {
|
|
9
|
-
let joiner, punctuation;
|
|
10
|
-
if ("joiner" in props) {
|
|
11
|
-
joiner = props.joiner;
|
|
12
|
-
} else {
|
|
13
|
-
punctuation = props.comma ? "," : props.semicolon ? ";" : "";
|
|
14
|
-
joiner = [punctuation, _$memo(() => _$memo(() => !!props.softline)() ? _$createIntrinsic("sbr", {}) : _$memo(() => !!props.hardline)() ? _$createIntrinsic("hbr", {}) : _$memo(() => !!props.literalline)() ? _$createIntrinsic("lbr", {}) : _$memo(() => !!props.line)() ? _$createIntrinsic("br", {}) : _$memo(() => !!props.space)() ? [" "] : _$createIntrinsic("hbr", {}))];
|
|
15
|
-
}
|
|
16
|
-
const ender = "ender" in props ? props.ender : props.enderPunctuation ? punctuation : undefined;
|
|
17
|
-
return {
|
|
18
|
-
joiner,
|
|
19
|
-
ender
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
6
|
/**
|
|
23
7
|
* Create a list of children with text between each child. The text to join with
|
|
24
8
|
* is specified by providing either `joiner` children, or providing boolean
|
|
@@ -34,6 +18,7 @@ export function List(props) {
|
|
|
34
18
|
return _$createComponent(For, _$mergeProps({
|
|
35
19
|
each: resolvedChildren
|
|
36
20
|
}, forProps, {
|
|
21
|
+
skipFalsy: true,
|
|
37
22
|
children: child => child
|
|
38
23
|
}));
|
|
39
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","names":["memo","splitProps","childrenArray","For","
|
|
1
|
+
{"version":3,"file":"List.js","names":["memo","splitProps","childrenArray","For","List","props","rest","forProps","resolvedChildren","children","preserveFragments","_$createComponent","_$mergeProps","each","skipFalsy","child"],"sources":["../../../src/components/List.tsx"],"sourcesContent":[null],"mappings":";;AAAA,SAAmBA,IAAI,EAAEC,UAAU,QAAQ,4BAA4B;AACvE,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,GAAG;AA8CZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,IAAIA,CAACC,KAAgB,EAAE;EACrC,MAAM,CAACC,IAAI,EAAEC,QAAQ,CAAC,GAAGN,UAAU,CAACI,KAAK,EAAE,CAAC,UAAU,CAAC,CAAC;EACxD,MAAMG,gBAAgB,GAAGR,IAAI,CAAC,MAC5BE,aAAa,CAAC,MAAMI,IAAI,CAACG,QAAQ,EAAE;IACjCC,iBAAiB,EAAE;EACrB,CAAC,CACH,CAAC;EACD,OAAAC,iBAAA,CACGR,GAAG,EAAAS,YAAA;IAACC,IAAI,EAAEL;EAAgB,GAAMD,QAAQ;IAAEO,SAAS;IAAAL,QAAA,EAChDM,KAAK,IAAKA;EAAK;AAGvB","ignoreList":[]}
|
|
@@ -1,13 +1,43 @@
|
|
|
1
1
|
import { OutputSymbol } from "../binder.js";
|
|
2
2
|
import { Children } from "../jsx-runtime.js";
|
|
3
3
|
import { Refkey } from "../refkey.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Create a member declaration by providing a symbol name and optional symbol
|
|
6
|
+
* metadata.
|
|
7
|
+
*/
|
|
8
|
+
export interface MemberDeclarationPropsWithInfo {
|
|
9
|
+
/**
|
|
10
|
+
* The name of this declaration.
|
|
11
|
+
*/
|
|
12
|
+
name: string;
|
|
13
|
+
/**
|
|
14
|
+
* The refkey or array refkeys for this declaration.
|
|
15
|
+
*/
|
|
16
|
+
refkey?: Refkey | Refkey[];
|
|
17
|
+
/**
|
|
18
|
+
* Additional metadata for the declared symbol.
|
|
19
|
+
*/
|
|
20
|
+
metadata?: Record<string, unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* Whether this is a static member. If not provided, the member is an instance
|
|
23
|
+
* member.
|
|
24
|
+
*/
|
|
9
25
|
static?: boolean;
|
|
26
|
+
children?: Children;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Create a declaration by providing an already created symbol. The symbol is
|
|
30
|
+
* merely exposed via {@link DeclarationContext}.
|
|
31
|
+
*/
|
|
32
|
+
export interface MemberDeclarationPropsWithSymbol {
|
|
33
|
+
/**
|
|
34
|
+
* The symbol being declared. When provided, the name, refkey, and metadata
|
|
35
|
+
* props are ignored.
|
|
36
|
+
*/
|
|
37
|
+
symbol: OutputSymbol;
|
|
38
|
+
children?: Children;
|
|
10
39
|
}
|
|
40
|
+
export type MemberDeclarationProps = MemberDeclarationPropsWithInfo | MemberDeclarationPropsWithSymbol;
|
|
11
41
|
/**
|
|
12
42
|
* Declares a symbol in the current member scope for this component's children.
|
|
13
43
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemberDeclaration.d.ts","sourceRoot":"","sources":["../../../src/components/MemberDeclaration.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,cAAc,CAAC;AAI/D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"MemberDeclaration.d.ts","sourceRoot":"","sources":["../../../src/components/MemberDeclaration.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,cAAc,CAAC;AAI/D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;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;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,gCAAgC;IAC/C;;;OAGG;IACH,MAAM,EAAE,YAAY,CAAC;IAErB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,MAAM,sBAAsB,GAC9B,8BAA8B,GAC9B,gCAAgC,CAAC;AAErC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,YAgC9D"}
|
|
@@ -4,7 +4,17 @@ import { OutputSymbolFlags } from "../binder.js";
|
|
|
4
4
|
import { useContext } from "../context.js";
|
|
5
5
|
import { BinderContext } from "../context/binder.js";
|
|
6
6
|
import { MemberDeclarationContext } from "../context/member-declaration.js";
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Create a member declaration by providing a symbol name and optional symbol
|
|
10
|
+
* metadata.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Create a declaration by providing an already created symbol. The symbol is
|
|
15
|
+
* merely exposed via {@link DeclarationContext}.
|
|
16
|
+
*/
|
|
17
|
+
|
|
8
18
|
/**
|
|
9
19
|
* Declares a symbol in the current member scope for this component's children.
|
|
10
20
|
*
|
|
@@ -29,17 +39,18 @@ export function MemberDeclaration(props) {
|
|
|
29
39
|
throw new Error("Need binder context to create declarations");
|
|
30
40
|
}
|
|
31
41
|
let declaration;
|
|
32
|
-
if (props.symbol) {
|
|
42
|
+
if ("symbol" in props && props.symbol) {
|
|
33
43
|
declaration = props.symbol;
|
|
34
44
|
} else {
|
|
35
|
-
|
|
45
|
+
const infoProps = props;
|
|
46
|
+
if (!infoProps.name) {
|
|
36
47
|
throw new Error("Must provide a member name, or else provide a member symbol");
|
|
37
48
|
}
|
|
38
|
-
const rk = props.refkey ? props.refkey : refkey(props.name);
|
|
39
49
|
declaration = binder.createSymbol({
|
|
40
|
-
name:
|
|
41
|
-
refkey:
|
|
42
|
-
|
|
50
|
+
name: infoProps.name,
|
|
51
|
+
refkey: infoProps.refkey,
|
|
52
|
+
metadata: infoProps.metadata,
|
|
53
|
+
flags: infoProps.static ? OutputSymbolFlags.StaticMember : OutputSymbolFlags.InstanceMember
|
|
43
54
|
});
|
|
44
55
|
}
|
|
45
56
|
return _$createComponent(MemberDeclarationContext.Provider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemberDeclaration.js","names":["OutputSymbolFlags","useContext","BinderContext","MemberDeclarationContext","
|
|
1
|
+
{"version":3,"file":"MemberDeclaration.js","names":["OutputSymbolFlags","useContext","BinderContext","MemberDeclarationContext","MemberDeclaration","props","binder","Error","declaration","symbol","infoProps","name","createSymbol","refkey","metadata","flags","static","StaticMember","InstanceMember","_$createComponent","Provider","value","children"],"sources":["../../../src/components/MemberDeclaration.tsx"],"sourcesContent":[null],"mappings":";;AAAA,SAAuBA,iBAAiB,QAAQ,cAAc;AAC9D,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,wBAAwB,QAAQ,kCAAkC;;AAI3E;AACA;AACA;AACA;;AAyBA;AACA;AACA;AACA;;AAeA;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,GAAGL,UAAU,CAACC,aAAa,CAAC;EACxC,IAAI,CAACI,MAAM,EAAE;IACX,MAAM,IAAIC,KAAK,CAAC,4CAA4C,CAAC;EAC/D;EAEA,IAAIC,WAAW;EACf,IAAI,QAAQ,IAAIH,KAAK,IAAIA,KAAK,CAACI,MAAM,EAAE;IACrCD,WAAW,GAAGH,KAAK,CAACI,MAAM;EAC5B,CAAC,MAAM;IACL,MAAMC,SAAS,GAAGL,KAAuC;IACzD,IAAI,CAACK,SAAS,CAACC,IAAI,EAAE;MACnB,MAAM,IAAIJ,KAAK,CACb,6DACF,CAAC;IACH;IACAC,WAAW,GAAGF,MAAM,CAACM,YAAY,CAAC;MAChCD,IAAI,EAAED,SAAS,CAACC,IAAK;MACrBE,MAAM,EAAEH,SAAS,CAACG,MAAM;MACxBC,QAAQ,EAAEJ,SAAS,CAACI,QAAQ;MAC5BC,KAAK,EACHL,SAAS,CAACM,MAAM,GACdhB,iBAAiB,CAACiB,YAAY,GAC9BjB,iBAAiB,CAACkB;IACxB,CAAC,CAAC;EACJ;EAEA,OAAAC,iBAAA,CACGhB,wBAAwB,CAACiB,QAAQ;IAACC,KAAK,EAAEb,WAAW;IAAA,IAAAc,SAAA;MAAA,OAClDjB,KAAK,CAACiB,QAAQ;IAAA;EAAA;AAGrB","ignoreList":[]}
|
|
@@ -22,6 +22,8 @@ export interface MemberScopeProps {
|
|
|
22
22
|
*
|
|
23
23
|
* The member scope contains scopes for both instance and static members.
|
|
24
24
|
* However, it does not affect the resolution of static members.
|
|
25
|
+
*
|
|
26
|
+
* @see {@link (MemberScopeContext:variable)}
|
|
25
27
|
*/
|
|
26
28
|
export declare function MemberScope(props: MemberScopeProps): Children;
|
|
27
29
|
//# sourceMappingURL=MemberScope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemberScope.d.ts","sourceRoot":"","sources":["../../../src/components/MemberScope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAK7C,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
|
|
1
|
+
{"version":3,"file":"MemberScope.d.ts","sourceRoot":"","sources":["../../../src/components/MemberScope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAK7C,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;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,YAUlD"}
|
|
@@ -12,6 +12,8 @@ import { MemberScopeContext } from "../context/member-scope.js";
|
|
|
12
12
|
*
|
|
13
13
|
* The member scope contains scopes for both instance and static members.
|
|
14
14
|
* However, it does not affect the resolution of static members.
|
|
15
|
+
*
|
|
16
|
+
* @see {@link (MemberScopeContext:variable)}
|
|
15
17
|
*/
|
|
16
18
|
export function MemberScope(props) {
|
|
17
19
|
const context = {
|
|
@@ -1 +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,CACGT,kBAAkB,CAACU,QAAQ;IAACC,KAAK,EAAER,OAAO;IAAA,IAAAS,SAAA;MAAA,OACxCV,KAAK,CAACU,QAAQ;IAAA;EAAA;AAGrB","ignoreList":[]}
|
|
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;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,CACGT,kBAAkB,CAACU,QAAQ;IAACC,KAAK,EAAER,OAAO;IAAA,IAAAS,SAAA;MAAA,OACxCV,KAAK,CAACU,QAAQ;IAAA;EAAA;AAGrB","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
export interface Prose {
|
|
3
|
+
children: Children;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Create a block of text which will break once a word exceeds the configured line width.
|
|
7
|
+
* The children are expected to be strings, and a <br /> is added between each word.
|
|
8
|
+
*/
|
|
9
|
+
export declare function Prose(props: Prose): Children;
|
|
10
|
+
//# sourceMappingURL=Prose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Prose.d.ts","sourceRoot":"","sources":["../../../src/components/Prose.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,MAAM,WAAW,KAAK;IACpB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,KAAK,YAuBjC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { childrenArray, computed } from "@alloy-js/core";
|
|
3
|
+
/**
|
|
4
|
+
* Create a block of text which will break once a word exceeds the configured line width.
|
|
5
|
+
* The children are expected to be strings, and a <br /> is added between each word.
|
|
6
|
+
*/
|
|
7
|
+
export function Prose(props) {
|
|
8
|
+
const brokenChildren = computed(() => {
|
|
9
|
+
const children = childrenArray(() => props.children);
|
|
10
|
+
return children.map(child => {
|
|
11
|
+
if (typeof child === "string") {
|
|
12
|
+
return child.trim().split(/\s+/).map(word => [word, _$createIntrinsic("br", {})]);
|
|
13
|
+
}
|
|
14
|
+
return child;
|
|
15
|
+
}).flat(2);
|
|
16
|
+
});
|
|
17
|
+
return _$createIntrinsic("fill", {
|
|
18
|
+
get children() {
|
|
19
|
+
return brokenChildren.value;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=Prose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Prose.js","names":["childrenArray","computed","Prose","props","brokenChildren","children","map","child","trim","split","word","_$createIntrinsic","flat","value"],"sources":["../../../src/components/Prose.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,gBAAgB;AAOxD;AACA;AACA;AACA;AACA,OAAO,SAASC,KAAKA,CAACC,KAAY,EAAE;EAClC,MAAMC,cAAc,GAAGH,QAAQ,CAAC,MAAM;IACpC,MAAMI,QAAQ,GAAGL,aAAa,CAAC,MAAMG,KAAK,CAACE,QAAQ,CAAC;IACpD,OAAOA,QAAQ,CACZC,GAAG,CAAEC,KAAK,IAAK;MACd,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;QAC7B,OAAOA,KAAK,CACTC,IAAI,CAAC,CAAC,CACNC,KAAK,CAAC,KAAK,CAAC,CACZH,GAAG,CAAEI,IAAI,KAELA,IAAI,EAAAC,iBAAA,WAGR,CAAC;MACN;MAEA,OAAOJ,KAAK;IACd,CAAC,CAAC,CACDK,IAAI,CAAC,CAAC,CAAC;EACZ,CAAC,CAAC;EAEF,OAAAD,iBAAA;IAAA,IAAAN,SAAA;MAAA,OAAcD,cAAc,CAACS,KAAK;IAAA;EAAA;AACpC","ignoreList":[]}
|
|
@@ -1,10 +1,41 @@
|
|
|
1
1
|
import { OutputScope } from "../binder.js";
|
|
2
2
|
import { Children } from "../jsx-runtime.js";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Declare a scope by providing an already created scope. The scope is merely
|
|
5
|
+
* exposed via {@link ScopeContext}.
|
|
6
|
+
*/
|
|
7
|
+
export interface ScopePropsWithValue {
|
|
8
|
+
/**
|
|
9
|
+
* The scope to use. If not provided, a new scope will be created.
|
|
10
|
+
*/
|
|
11
|
+
value: OutputScope;
|
|
12
|
+
children?: Children;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Create a scope by providing a name and optional metadata.
|
|
16
|
+
*/
|
|
17
|
+
export interface ScopePropsWithInfo {
|
|
18
|
+
/**
|
|
19
|
+
* The kind of scope. This may be used by application code to determine how
|
|
20
|
+
* to handle symbols in this scope. It is not used by the core framework.
|
|
21
|
+
*/
|
|
4
22
|
kind?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The name of this scope.
|
|
25
|
+
*/
|
|
5
26
|
name?: string;
|
|
6
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Additional metadata for the scope.
|
|
29
|
+
*/
|
|
30
|
+
metadata?: Record<string, unknown>;
|
|
7
31
|
children?: Children;
|
|
8
32
|
}
|
|
33
|
+
export type ScopeProps = ScopePropsWithValue | ScopePropsWithInfo;
|
|
34
|
+
/**
|
|
35
|
+
* Declare a scope for this component's children. Any symbols and scopes
|
|
36
|
+
* declared in the children of this component will be in this scope.
|
|
37
|
+
*
|
|
38
|
+
* @see {@link ScopeContext}
|
|
39
|
+
*/
|
|
9
40
|
export declare function Scope(props: ScopeProps): Children;
|
|
10
41
|
//# sourceMappingURL=Scope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Scope.d.ts","sourceRoot":"","sources":["../../../src/components/Scope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"Scope.d.ts","sourceRoot":"","sources":["../../../src/components/Scope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,EAAE,WAAW,CAAC;IAEnB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEnC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,MAAM,UAAU,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAElE;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,YAkBtC"}
|
|
@@ -3,16 +3,32 @@ import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
|
3
3
|
import { useContext } from "../context.js";
|
|
4
4
|
import { BinderContext } from "../context/binder.js";
|
|
5
5
|
import { ScopeContext } from "../context/scope.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Declare a scope by providing an already created scope. The scope is merely
|
|
9
|
+
* exposed via {@link ScopeContext}.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Create a scope by providing a name and optional metadata.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Declare a scope for this component's children. Any symbols and scopes
|
|
18
|
+
* declared in the children of this component will be in this scope.
|
|
19
|
+
*
|
|
20
|
+
* @see {@link ScopeContext}
|
|
21
|
+
*/
|
|
6
22
|
export function Scope(props) {
|
|
7
23
|
let scope;
|
|
8
|
-
if (props
|
|
24
|
+
if ("value" in props) {
|
|
9
25
|
scope = props.value;
|
|
10
26
|
} else {
|
|
11
|
-
const kind = props.kind ?? "file";
|
|
12
27
|
const binder = useContext(BinderContext);
|
|
13
28
|
scope = binder.createScope({
|
|
14
|
-
kind,
|
|
15
|
-
|
|
29
|
+
kind: props.kind,
|
|
30
|
+
metadata: props.metadata,
|
|
31
|
+
name: props.name ?? ""
|
|
16
32
|
});
|
|
17
33
|
}
|
|
18
34
|
return _$createComponent(ScopeContext.Provider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Scope.js","names":["useContext","BinderContext","ScopeContext","Scope","props","scope","value","
|
|
1
|
+
{"version":3,"file":"Scope.js","names":["useContext","BinderContext","ScopeContext","Scope","props","scope","value","binder","createScope","kind","metadata","name","_$createComponent","Provider","children"],"sources":["../../../src/components/Scope.tsx"],"sourcesContent":[null],"mappings":";;AACA,SAASA,UAAU,QAAQ,eAAe;AAC1C,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,YAAY,QAAQ,qBAAqB;;AAGlD;AACA;AACA;AACA;;AAUA;AACA;AACA;;AAuBA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,KAAKA,CAACC,KAAiB,EAAE;EACvC,IAAIC,KAAkB;EACtB,IAAI,OAAO,IAAID,KAAK,EAAE;IACpBC,KAAK,GAAGD,KAAK,CAACE,KAAK;EACrB,CAAC,MAAM;IACL,MAAMC,MAAM,GAAGP,UAAU,CAACC,aAAa,CAAE;IACzCI,KAAK,GAAGE,MAAM,CAACC,WAAW,CAAC;MACzBC,IAAI,EAAEL,KAAK,CAACK,IAAI;MAChBC,QAAQ,EAAEN,KAAK,CAACM,QAAQ;MACxBC,IAAI,EAAEP,KAAK,CAACO,IAAI,IAAI;IACtB,CAAC,CAAC;EACJ;EAEA,OAAAC,iBAAA,CACGV,YAAY,CAACW,QAAQ;IAACP,KAAK,EAAED,KAAK;IAAA,IAAAS,SAAA;MAAA,OAChCV,KAAK,CAACU,QAAQ;IAAA;EAAA;AAGrB","ignoreList":[]}
|
|
@@ -18,6 +18,11 @@ export interface SourceFileProps extends PrintTreeOptions {
|
|
|
18
18
|
reference?: ComponentDefinition<{
|
|
19
19
|
refkey: Refkey;
|
|
20
20
|
}>;
|
|
21
|
+
/**
|
|
22
|
+
* The header of the file. This is rendered before the contents of the file.
|
|
23
|
+
* This is useful for adding license headers or other metadata to the file.
|
|
24
|
+
*/
|
|
25
|
+
header?: Children;
|
|
21
26
|
}
|
|
22
27
|
export declare function SourceFile(props: SourceFileProps): Children;
|
|
23
28
|
//# sourceMappingURL=SourceFile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceFile.d.ts","sourceRoot":"","sources":["../../../src/components/SourceFile.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAc,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"SourceFile.d.ts","sourceRoot":"","sources":["../../../src/components/SourceFile.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAc,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;;OAGG;IACH,SAAS,CAAC,EAAE,mBAAmB,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD;;;OAGG;IACH,MAAM,CAAC,EAAE,QAAQ,CAAC;CACnB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,YA0BhD"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
3
|
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
3
4
|
import { join } from "pathe";
|
|
4
5
|
import { useContext } from "../context.js";
|
|
5
6
|
import { SourceDirectoryContext } from "../context/source-directory.js";
|
|
6
7
|
import { SourceFileContext } from "../context/source-file.js";
|
|
7
8
|
import { getContext } from "../jsx-runtime.js";
|
|
9
|
+
import { Show } from "./Show.js";
|
|
8
10
|
export function SourceFile(props) {
|
|
9
11
|
const parentDirectory = useContext(SourceDirectoryContext);
|
|
10
12
|
const context = {
|
|
@@ -24,7 +26,14 @@ export function SourceFile(props) {
|
|
|
24
26
|
return _$createComponent(SourceFileContext.Provider, {
|
|
25
27
|
value: context,
|
|
26
28
|
get children() {
|
|
27
|
-
return
|
|
29
|
+
return [_$createComponent(Show, {
|
|
30
|
+
get when() {
|
|
31
|
+
return props.header !== undefined;
|
|
32
|
+
},
|
|
33
|
+
get children() {
|
|
34
|
+
return [_$memo(() => props.header), _$createIntrinsic("hbr", {})];
|
|
35
|
+
}
|
|
36
|
+
}), _$memo(() => props.children)];
|
|
28
37
|
}
|
|
29
38
|
});
|
|
30
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceFile.js","names":["join","useContext","SourceDirectoryContext","SourceFileContext","getContext","SourceFile","props","parentDirectory","context","path","filetype","reference","addContent","nodeContext","meta","sourceFile","printOptions","printWidth","tabWidth","useTabs","_$createComponent","Provider","value","children"],"sources":["../../../src/components/SourceFile.tsx"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"file":"SourceFile.js","names":["join","useContext","SourceDirectoryContext","SourceFileContext","getContext","Show","SourceFile","props","parentDirectory","context","path","filetype","reference","addContent","nodeContext","meta","sourceFile","printOptions","printWidth","tabWidth","useTabs","_$createComponent","Provider","value","children","when","header","undefined","_$memo","_$createIntrinsic"],"sources":["../../../src/components/SourceFile.tsx"],"sourcesContent":[null],"mappings":";;;AAAA,SAASA,IAAI,QAAQ,OAAO;AAC5B,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,sBAAsB,QAAQ,gCAAgC;AACvE,SAASC,iBAAiB,QAAQ,2BAA2B;AAC7D,SAAwCC,UAAU,QAAQ,mBAAmB;AAG7E,SAASC,IAAI;AA2Bb,OAAO,SAASC,UAAUA,CAACC,KAAsB,EAAE;EACjD,MAAMC,eAAe,GAAGP,UAAU,CAACC,sBAAsB,CAAE;EAC3D,MAAMO,OAA0B,GAAG;IACjCC,IAAI,EAAEV,IAAI,CAACQ,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,GAAGV,UAAU,CAAC,CAAE;EACjCU,WAAW,CAACC,IAAI,KAAK,CAAC,CAAC;EACvBD,WAAW,CAACC,IAAI,CAACC,UAAU,GAAGP,OAAO;EACrCK,WAAW,CAACC,IAAI,CAACE,YAAY,GAAG;IAC9BC,UAAU,EAAEX,KAAK,CAACW,UAAU;IAC5BC,QAAQ,EAAEZ,KAAK,CAACY,QAAQ;IACxBC,OAAO,EAAEb,KAAK,CAACa;EACjB,CAAC;EAED,OAAAC,iBAAA,CACGlB,iBAAiB,CAACmB,QAAQ;IAACC,KAAK,EAAEd,OAAO;IAAA,IAAAe,SAAA;MAAA,QAAAH,iBAAA,CACvChB,IAAI;QAAA,IAACoB,IAAIA,CAAA;UAAA,OAAElB,KAAK,CAACmB,MAAM,KAAKC,SAAS;QAAA;QAAA,IAAAH,SAAA;UAAA,QAAAI,MAAA,OACnCrB,KAAK,CAACmB,MAAM,GAAAG,iBAAA;QAAA;MAAA,IAAAD,MAAA,OAGdrB,KAAK,CAACiB,QAAQ;IAAA;EAAA;AAGrB","ignoreList":[]}
|
|
@@ -8,6 +8,7 @@ export * from "./MemberName.jsx";
|
|
|
8
8
|
export * from "./MemberScope.jsx";
|
|
9
9
|
export * from "./Name.jsx";
|
|
10
10
|
export * from "./Output.js";
|
|
11
|
+
export * from "./Prose.jsx";
|
|
11
12
|
export * from "./Scope.js";
|
|
12
13
|
export * from "./Show.jsx";
|
|
13
14
|
export * from "./SourceDirectory.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,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,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/index.tsx"],"sourcesContent":[null],"mappings":"AAAA,cAAc,YAAY;AAC1B,cAAc,kBAAkB;AAChC,cAAc,UAAU;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,aAAa;AAC3B,cAAc,YAAY;AAC1B;AACA,cAAc,sBAAsB;AACpC,cAAc,iBAAiB;AAC/B;AACA;AACA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/index.tsx"],"sourcesContent":[null],"mappings":"AAAA,cAAc,YAAY;AAC1B,cAAc,kBAAkB;AAChC,cAAc,UAAU;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,aAAa;AAC3B;AACA,cAAc,YAAY;AAC1B;AACA,cAAc,sBAAsB;AACpC,cAAc,iBAAiB;AAC/B;AACA;AACA","ignoreList":[]}
|