@powerlines/plugin-alloy 0.26.26 → 0.26.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/components/infrastructure-file.cjs +13 -8
- package/dist/core/components/infrastructure-file.mjs +13 -8
- package/dist/core/components/infrastructure-file.mjs.map +1 -1
- package/dist/core/components/output.cjs +17 -10
- package/dist/core/components/output.mjs +17 -10
- package/dist/core/components/output.mjs.map +1 -1
- package/dist/core/components/single-line-comment.cjs +6 -4
- package/dist/core/components/single-line-comment.mjs +6 -4
- package/dist/core/components/single-line-comment.mjs.map +1 -1
- package/dist/core/components/source-file.cjs +10 -6
- package/dist/core/components/source-file.mjs +10 -6
- package/dist/core/components/source-file.mjs.map +1 -1
- package/dist/core/components/spacing.cjs +6 -4
- package/dist/core/components/spacing.mjs +6 -4
- package/dist/core/components/spacing.mjs.map +1 -1
- package/dist/core/contexts/context.mjs.map +1 -1
- package/dist/core/contexts/meta.mjs.map +1 -1
- package/dist/core/contexts/reflection.mjs.map +1 -1
- package/dist/core/helpers/code.mjs.map +1 -1
- package/dist/hcl/components/block-declaration.cjs +12 -8
- package/dist/hcl/components/block-declaration.mjs +12 -8
- package/dist/hcl/components/block-declaration.mjs.map +1 -1
- package/dist/hcl/components/hcl-file.cjs +35 -21
- package/dist/hcl/components/hcl-file.mjs +36 -22
- package/dist/hcl/components/hcl-file.mjs.map +1 -1
- package/dist/hcl/components/packer-file.cjs +8 -8
- package/dist/hcl/components/packer-file.mjs +8 -8
- package/dist/hcl/components/packer-file.mjs.map +1 -1
- package/dist/hcl/components/terraform-file.cjs +8 -8
- package/dist/hcl/components/terraform-file.mjs +8 -8
- package/dist/hcl/components/terraform-file.mjs.map +1 -1
- package/dist/helpers/capnp.mjs.map +1 -1
- package/dist/helpers/create-builtin.mjs.map +1 -1
- package/dist/helpers/refkey.mjs.map +1 -1
- package/dist/helpers/typescript.mjs.map +1 -1
- package/dist/index.cjs +16 -8
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +15 -8
- package/dist/index.mjs.map +1 -1
- package/dist/markdown/components/front-matter.cjs +9 -7
- package/dist/markdown/components/front-matter.mjs +9 -7
- package/dist/markdown/components/front-matter.mjs.map +1 -1
- package/dist/markdown/components/markdown-file.cjs +76 -44
- package/dist/markdown/components/markdown-file.mjs +76 -44
- package/dist/markdown/components/markdown-file.mjs.map +1 -1
- package/dist/markdown/components/markdown-table.cjs +49 -28
- package/dist/markdown/components/markdown-table.mjs +49 -28
- package/dist/markdown/components/markdown-table.mjs.map +1 -1
- package/dist/markdown/contexts/markdown-table.mjs.map +1 -1
- package/dist/render.cjs +3 -3
- package/dist/render.mjs +4 -4
- package/dist/render.mjs.map +1 -1
- package/dist/types/components.cjs +9 -0
- package/dist/types/components.mjs +10 -1
- package/dist/types/components.mjs.map +1 -0
- package/dist/typescript/components/builtin-file.cjs +30 -20
- package/dist/typescript/components/builtin-file.mjs +30 -20
- package/dist/typescript/components/builtin-file.mjs.map +1 -1
- package/dist/typescript/components/class-declaration.cjs +180 -100
- package/dist/typescript/components/class-declaration.mjs +180 -100
- package/dist/typescript/components/class-declaration.mjs.map +1 -1
- package/dist/typescript/components/dynamic-import-statement.cjs +2 -6
- package/dist/typescript/components/dynamic-import-statement.mjs +2 -6
- package/dist/typescript/components/dynamic-import-statement.mjs.map +1 -1
- package/dist/typescript/components/entry-file.cjs +10 -7
- package/dist/typescript/components/entry-file.mjs +10 -7
- package/dist/typescript/components/entry-file.mjs.map +1 -1
- package/dist/typescript/components/interface-declaration.cjs +127 -74
- package/dist/typescript/components/interface-declaration.mjs +127 -74
- package/dist/typescript/components/interface-declaration.mjs.map +1 -1
- package/dist/typescript/components/object-declaration.cjs +84 -50
- package/dist/typescript/components/object-declaration.mjs +84 -50
- package/dist/typescript/components/object-declaration.mjs.map +1 -1
- package/dist/typescript/components/property-name.cjs +3 -3
- package/dist/typescript/components/property-name.mjs +3 -3
- package/dist/typescript/components/property-name.mjs.map +1 -1
- package/dist/typescript/components/record-expression.mjs.map +1 -1
- package/dist/typescript/components/tsdoc-reflection.cjs +241 -108
- package/dist/typescript/components/tsdoc-reflection.mjs +241 -108
- package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
- package/dist/typescript/components/tsdoc.cjs +265 -168
- package/dist/typescript/components/tsdoc.mjs +265 -168
- package/dist/typescript/components/tsdoc.mjs.map +1 -1
- package/dist/typescript/components/type-declaration.cjs +20 -15
- package/dist/typescript/components/type-declaration.mjs +20 -15
- package/dist/typescript/components/type-declaration.mjs.map +1 -1
- package/dist/typescript/components/type-parameters.cjs +56 -29
- package/dist/typescript/components/type-parameters.mjs +56 -29
- package/dist/typescript/components/type-parameters.mjs.map +1 -1
- package/dist/typescript/components/typescript-file.cjs +135 -74
- package/dist/typescript/components/typescript-file.mjs +135 -74
- package/dist/typescript/components/typescript-file.mjs.map +1 -1
- package/dist/typescript/contexts/lexical-scope.cjs +5 -3
- package/dist/typescript/contexts/lexical-scope.mjs +5 -3
- package/dist/typescript/contexts/lexical-scope.mjs.map +1 -1
- package/dist/typescript/contexts/member-scope.cjs +5 -3
- package/dist/typescript/contexts/member-scope.mjs +5 -3
- package/dist/typescript/contexts/member-scope.mjs.map +1 -1
- package/dist/typescript/helpers/get-call-signature-props.mjs.map +1 -1
- package/dist/typescript/helpers/utilities.mjs.map +1 -1
- package/dist/yaml/components/yaml-file.cjs +92 -47
- package/dist/yaml/components/yaml-file.mjs +92 -47
- package/dist/yaml/components/yaml-file.mjs.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-file.mjs","names":[],"sources":["../../../src/markdown/components/markdown-file.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Show, splitProps } from \"@alloy-js/core\";\nimport { Link } from \"@alloy-js/markdown\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetObject } from \"@stryke/type-checks\";\nimport { getFileHeaderWarning } from \"powerlines/utils\";\nimport { SingleLineComment } from \"../../core/components/single-line-comment\";\nimport { SourceFile, SourceFileProps } from \"../../core/components/source-file\";\nimport { usePowerlinesSafe } from \"../../core/contexts/context\";\nimport { ComponentProps, SourceFileHeaderProps } from \"../../types/components\";\nimport { FrontMatter, FrontMatterProps } from \"./front-matter\";\n\nexport type MarkdownFileProps = Omit<SourceFileProps, \"filetype\"> &\n ComponentProps &\n MarkdownFileHeaderProps;\n\n/**\n * A base component representing a Powerlines generated markdown source file.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function MarkdownFile(props: MarkdownFileProps) {\n const [{ children, storage, frontMatter }, rest] = splitProps(props, [\n \"children\",\n \"storage\",\n \"frontMatter\"\n ]);\n\n return (\n <SourceFile\n header={<MarkdownFileHeader frontMatter={frontMatter} />}\n {...rest}\n filetype=\"md\"\n reference={Link}\n storage={storage}>\n <Show when={Boolean(children)}>{children}</Show>\n </SourceFile>\n );\n}\n\nexport type MarkdownFileHeaderProps = SourceFileHeaderProps & {\n frontMatter?: FrontMatterProps[\"data\"];\n};\n\n/**\n * Renders the header for a Powerlines Typescript source file.\n *\n * @param props - The properties for the source file header.\n * @returns The rendered source file header.\n */\nexport function MarkdownFileHeader(props: MarkdownFileHeaderProps) {\n const [\n {\n children,\n disableEslint = true,\n disableBiome = true,\n disablePrettier = false,\n frontMatter\n }\n ] = splitProps(props, [\n \"children\",\n \"disableEslint\",\n \"disableBiome\",\n \"disablePrettier\",\n \"frontMatter\"\n ]);\n\n const context = usePowerlinesSafe();\n\n return (\n <>\n <Show\n when={isSetObject(frontMatter) && Object.keys(frontMatter).length > 0}>\n <FrontMatter data={frontMatter!} />\n </Show>\n <Show when={Boolean(disableEslint)}>\n <SingleLineComment variant=\"markdown\">\n {\"eslint-disable\"}\n </SingleLineComment>\n <hbr />\n </Show>\n <Show when={Boolean(disablePrettier)}>\n <SingleLineComment variant=\"markdown\">\n {\"prettier-ignore\"}\n </SingleLineComment>\n <hbr />\n </Show>\n <Show when={Boolean(disableBiome)}>\n <SingleLineComment variant=\"markdown\">\n {\"biome-ignore lint: disable\"}\n </SingleLineComment>\n <hbr />\n </Show>\n <Show\n when={\n Boolean(disableEslint) ||\n Boolean(disablePrettier) ||\n Boolean(disableBiome)\n }>\n <hbr />\n </Show>\n <Show when={Boolean(children)}>\n <>\n {children}\n <hbr />\n </>\n </Show>\n <SingleLineComment variant=\"markdown\">{`Generated by ${\n titleCase(context?.config?.framework) || \"Powerlines\"\n }`}</SingleLineComment>\n <hbr />\n <SingleLineComment variant=\"markdown\">\n {getFileHeaderWarning(context!)}\n </SingleLineComment>\n <hbr />\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"markdown-file.mjs","names":[],"sources":["../../../src/markdown/components/markdown-file.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Show, splitProps } from \"@alloy-js/core\";\nimport { Link } from \"@alloy-js/markdown\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetObject } from \"@stryke/type-checks\";\nimport { getFileHeaderWarning } from \"powerlines/utils\";\nimport { SingleLineComment } from \"../../core/components/single-line-comment\";\nimport { SourceFile, SourceFileProps } from \"../../core/components/source-file\";\nimport { usePowerlinesSafe } from \"../../core/contexts/context\";\nimport { ComponentProps, SourceFileHeaderProps } from \"../../types/components\";\nimport { FrontMatter, FrontMatterProps } from \"./front-matter\";\n\nexport type MarkdownFileProps = Omit<SourceFileProps, \"filetype\"> &\n ComponentProps &\n MarkdownFileHeaderProps;\n\n/**\n * A base component representing a Powerlines generated markdown source file.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function MarkdownFile(props: MarkdownFileProps) {\n const [{ children, storage, frontMatter }, rest] = splitProps(props, [\n \"children\",\n \"storage\",\n \"frontMatter\"\n ]);\n\n return (\n <SourceFile\n header={<MarkdownFileHeader frontMatter={frontMatter} />}\n {...rest}\n filetype=\"md\"\n reference={Link}\n storage={storage}>\n <Show when={Boolean(children)}>{children}</Show>\n </SourceFile>\n );\n}\n\nexport type MarkdownFileHeaderProps = SourceFileHeaderProps & {\n frontMatter?: FrontMatterProps[\"data\"];\n};\n\n/**\n * Renders the header for a Powerlines Typescript source file.\n *\n * @param props - The properties for the source file header.\n * @returns The rendered source file header.\n */\nexport function MarkdownFileHeader(props: MarkdownFileHeaderProps) {\n const [\n {\n children,\n disableEslint = true,\n disableBiome = true,\n disablePrettier = false,\n frontMatter\n }\n ] = splitProps(props, [\n \"children\",\n \"disableEslint\",\n \"disableBiome\",\n \"disablePrettier\",\n \"frontMatter\"\n ]);\n\n const context = usePowerlinesSafe();\n\n return (\n <>\n <Show\n when={isSetObject(frontMatter) && Object.keys(frontMatter).length > 0}>\n <FrontMatter data={frontMatter!} />\n </Show>\n <Show when={Boolean(disableEslint)}>\n <SingleLineComment variant=\"markdown\">\n {\"eslint-disable\"}\n </SingleLineComment>\n <hbr />\n </Show>\n <Show when={Boolean(disablePrettier)}>\n <SingleLineComment variant=\"markdown\">\n {\"prettier-ignore\"}\n </SingleLineComment>\n <hbr />\n </Show>\n <Show when={Boolean(disableBiome)}>\n <SingleLineComment variant=\"markdown\">\n {\"biome-ignore lint: disable\"}\n </SingleLineComment>\n <hbr />\n </Show>\n <Show\n when={\n Boolean(disableEslint) ||\n Boolean(disablePrettier) ||\n Boolean(disableBiome)\n }>\n <hbr />\n </Show>\n <Show when={Boolean(children)}>\n <>\n {children}\n <hbr />\n </>\n </Show>\n <SingleLineComment variant=\"markdown\">{`Generated by ${\n titleCase(context?.config?.framework) || \"Powerlines\"\n }`}</SingleLineComment>\n <hbr />\n <SingleLineComment variant=\"markdown\">\n {getFileHeaderWarning(context!)}\n </SingleLineComment>\n <hbr />\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmCA,SAAC,aAAA,OAAA;CACC,MAAE,CAAK,EACL,UACF,SACF,eACE,QAAS,WAAU,OAAS;EAAA;EAAc;EAAS;EAAgB,CAAC;AACpE,QAAG,gBAAS,YAAA,WAAA,EACV,IAAC,SAAQ;AACR,SAAA,gBAAW,oBAAA,EACZ;IAGD,EAAE,MAAA;EACD,UAAU;EACV,WAAU;EACR;EACF,IAAE,WAAW;AACX,UAAO,gBAAU,MAAA;IAChB,IAAK,OAAM;AACZ,YAAU,QAAA,SAAA;;IAEhB;;;EAGE,CAAA,CAAA;;;;;;;;AAQF,SAAE,mBAAA,OAAA;CACF,MAAO,CAAA,EACL,UACE,gBAAA,MACA,eAAU,MACV,kBAAkB,OAClB,iBACE,WAAA,OAAkB;EAAA;EAAK;EAAA;EAAA;EAAA;EAAA,CAAA;CAC3B,MAAI,UAAA,mBAAA;AACJ,QAAE;EAAA,gBAAA,MAAA;GACA,IAAE,OAAA;AACD,WAAQ,WAAC,CAAA,CAAA,YAAA,YAAA,CAAA,EAAA,IAAA,OAAA,KAAA,YAAA,CAAA,SAAA;;GAEV,IAAC,WAAa;AACb,WAAA,gBAAgB,aAAA,EAChB,MAAA,aACD,CAAA;;GAEF,CAAA;EAAA,gBAAgB,MAAA;;AAEhB,WAAO,QAAA,cAAA;;GAEL,IAAG,WAAA;AACD,WAAO,CAAC,gBAAY,mBAAuB;KACzC,SAAC;KACD,UAAI;KACL,CAAA,EAAA,gBAAmB,OAAA,EAAA,CAAA,CAAa;;GAEpC,CAAC;EAAE,gBAAa,MAAQ;GACvB,IAAI,OAAE;AACJ,WAAO,QAAC,gBAAA;;GAEV,IAAG,WAAW;AACZ,WAAG,CAAA,gBAAkB,mBAAkB;KACrC,SAAI;KACJ,UAAE;KACH,CAAC,EAAC,gBAAK,OAAA,EAAA,CAAA,CAAA;;GAEX,CAAC;EAAE,gBAAY,MAAQ;GACtB,IAAI,OAAC;AACH,WAAM,QAAM,aAAa;;GAE3B,IAAI,WAAM;AACR,WAAM,CAAA,gBAAA,mBAAA;KACL,SAAA;KACC,UAAK;KACN,CAAC,EAAE,gBAAQ,OAAgB,EAAA,CAAA,CAAA;;GAE/B,CAAC;EAAE,gBAAY,MAAY;GAC1B,IAAI,OAAC;AACH,WAAO,QAAC,cAAA,IAAA,QAAA,gBAAA,IAAA,QAAA,aAAA;;GAEV,IAAG,WAAW;AACZ,WAAG,gBAAA,OAAA,EAAA,CAAA;;GAEN,CAAC;EAAE,gBAAU,MAAA;GACZ,IAAI,OAAE;AACJ,WAAM,QAAA,SAAA;;GAER,IAAI,WAAU;AACZ,WAAK,CAAA,UAAA,gBAAiB,OAAA,EAAA,CAAA,CAAA;;GAEzB,CAAC;EAAE,gBAAkB,mBAAmB;GACvC,SAAK;GACL,IAAI,WAAA;AACF,WAAM,gBAAA,UAAA,SAAA,QAAA,UAAA,IAAA;;GAET,CAAA;EAAA,gBAAA,OAAA,EAAA,CAAA;EAAA,gBAAA,mBAAA;GACH,SAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
const require_markdown_contexts_markdown_table = require('../contexts/markdown-table.cjs');
|
|
4
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
5
4
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
6
6
|
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
7
7
|
let _stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
|
|
8
8
|
|
|
@@ -18,15 +18,21 @@ function MarkdownTable(props) {
|
|
|
18
18
|
align: "left",
|
|
19
19
|
width: 20
|
|
20
20
|
})));
|
|
21
|
-
return
|
|
22
|
-
value
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_markdown_contexts_markdown_table.MarkdownTableContext.Provider, {
|
|
22
|
+
get value() {
|
|
23
|
+
return {
|
|
24
|
+
columns: columns.value,
|
|
25
|
+
data
|
|
26
|
+
};
|
|
25
27
|
},
|
|
26
|
-
children
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
get children() {
|
|
29
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
30
|
+
get when() {
|
|
31
|
+
return Boolean(children);
|
|
32
|
+
},
|
|
33
|
+
children
|
|
34
|
+
});
|
|
35
|
+
}
|
|
30
36
|
});
|
|
31
37
|
}
|
|
32
38
|
/**
|
|
@@ -47,32 +53,47 @@ function MarkdownTableColumn(props) {
|
|
|
47
53
|
const textLength = (0, _alloy_js_core.computed)(() => {
|
|
48
54
|
return (children ? children.toString() : "").length;
|
|
49
55
|
});
|
|
50
|
-
return
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Prose, { get children() {
|
|
57
|
+
return [
|
|
58
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
59
|
+
get when() {
|
|
60
|
+
return indexRef.value === 0;
|
|
61
|
+
},
|
|
62
|
+
children: "|"
|
|
63
|
+
}),
|
|
64
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
65
|
+
get when() {
|
|
66
|
+
return Boolean(children);
|
|
67
|
+
},
|
|
68
|
+
get children() {
|
|
69
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Prose, { get children() {
|
|
70
|
+
return _alloy_js_core.code`${alignRef.value === "left" ? " ".repeat(widthRef.value - textLength.value - 1) : " "}${children}${alignRef.value === "right" ? " ".repeat(widthRef.value - textLength.value - 1) : " "}`;
|
|
71
|
+
} });
|
|
72
|
+
}
|
|
73
|
+
}),
|
|
74
|
+
"|"
|
|
75
|
+
];
|
|
76
|
+
} });
|
|
61
77
|
}
|
|
62
78
|
/**
|
|
63
79
|
* Component that provides a context for rendering markdown tables.
|
|
64
80
|
*/
|
|
65
81
|
function MarkdownTableColumnHeader(props) {
|
|
66
82
|
const [{ children, name }, rest] = (0, _alloy_js_core.splitProps)(props, ["children", "name"]);
|
|
67
|
-
return
|
|
68
|
-
...rest,
|
|
83
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(MarkdownTableColumn, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
69
84
|
name,
|
|
70
|
-
children
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
get children() {
|
|
86
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
87
|
+
get fallback() {
|
|
88
|
+
return (0, _stryke_string_format_title_case.titleCase)(name, { useDescriptions: false });
|
|
89
|
+
},
|
|
90
|
+
get when() {
|
|
91
|
+
return !(0, _stryke_type_checks_is_undefined.isUndefined)(children);
|
|
92
|
+
},
|
|
93
|
+
children
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}))];
|
|
76
97
|
}
|
|
77
98
|
|
|
78
99
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MarkdownTableContext, useMarkdownTable } from "../contexts/markdown-table.mjs";
|
|
2
|
+
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
3
|
import { Prose, Show, code, computed, splitProps } from "@alloy-js/core";
|
|
3
|
-
import { Fragment, jsx, jsxs } from "@alloy-js/core/jsx-runtime";
|
|
4
4
|
import { titleCase } from "@stryke/string-format/title-case";
|
|
5
5
|
import { isUndefined } from "@stryke/type-checks/is-undefined";
|
|
6
6
|
|
|
@@ -16,15 +16,21 @@ function MarkdownTable(props) {
|
|
|
16
16
|
align: "left",
|
|
17
17
|
width: 20
|
|
18
18
|
})));
|
|
19
|
-
return
|
|
20
|
-
value
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
return createComponent(MarkdownTableContext.Provider, {
|
|
20
|
+
get value() {
|
|
21
|
+
return {
|
|
22
|
+
columns: columns.value,
|
|
23
|
+
data
|
|
24
|
+
};
|
|
23
25
|
},
|
|
24
|
-
children
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
get children() {
|
|
27
|
+
return createComponent(Show, {
|
|
28
|
+
get when() {
|
|
29
|
+
return Boolean(children);
|
|
30
|
+
},
|
|
31
|
+
children
|
|
32
|
+
});
|
|
33
|
+
}
|
|
28
34
|
});
|
|
29
35
|
}
|
|
30
36
|
/**
|
|
@@ -45,32 +51,47 @@ function MarkdownTableColumn(props) {
|
|
|
45
51
|
const textLength = computed(() => {
|
|
46
52
|
return (children ? children.toString() : "").length;
|
|
47
53
|
});
|
|
48
|
-
return
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
return createComponent(Prose, { get children() {
|
|
55
|
+
return [
|
|
56
|
+
createComponent(Show, {
|
|
57
|
+
get when() {
|
|
58
|
+
return indexRef.value === 0;
|
|
59
|
+
},
|
|
60
|
+
children: "|"
|
|
61
|
+
}),
|
|
62
|
+
createComponent(Show, {
|
|
63
|
+
get when() {
|
|
64
|
+
return Boolean(children);
|
|
65
|
+
},
|
|
66
|
+
get children() {
|
|
67
|
+
return createComponent(Prose, { get children() {
|
|
68
|
+
return code`${alignRef.value === "left" ? " ".repeat(widthRef.value - textLength.value - 1) : " "}${children}${alignRef.value === "right" ? " ".repeat(widthRef.value - textLength.value - 1) : " "}`;
|
|
69
|
+
} });
|
|
70
|
+
}
|
|
71
|
+
}),
|
|
72
|
+
"|"
|
|
73
|
+
];
|
|
74
|
+
} });
|
|
59
75
|
}
|
|
60
76
|
/**
|
|
61
77
|
* Component that provides a context for rendering markdown tables.
|
|
62
78
|
*/
|
|
63
79
|
function MarkdownTableColumnHeader(props) {
|
|
64
80
|
const [{ children, name }, rest] = splitProps(props, ["children", "name"]);
|
|
65
|
-
return
|
|
66
|
-
...rest,
|
|
81
|
+
return [createComponent(MarkdownTableColumn, mergeProps(rest, {
|
|
67
82
|
name,
|
|
68
|
-
children
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
83
|
+
get children() {
|
|
84
|
+
return createComponent(Show, {
|
|
85
|
+
get fallback() {
|
|
86
|
+
return titleCase(name, { useDescriptions: false });
|
|
87
|
+
},
|
|
88
|
+
get when() {
|
|
89
|
+
return !isUndefined(children);
|
|
90
|
+
},
|
|
91
|
+
children
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}))];
|
|
74
95
|
}
|
|
75
96
|
|
|
76
97
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-table.mjs","names":[],"sources":["../../../src/markdown/components/markdown-table.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, Prose, Show, splitProps } from \"@alloy-js/core\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { ComponentProps } from \"../../types/components\";\nimport {\n MarkdownTableColumnContextInterface,\n MarkdownTableContext,\n useMarkdownTable\n} from \"../contexts/markdown-table\";\n\nexport interface MarkdownTableProps<\n T extends Record<string, any> = Record<string, any>\n> extends ComponentProps {\n data: T[];\n}\n\n/**\n * Component that provides a context for rendering markdown tables.\n */\nexport function MarkdownTable<\n T extends Record<string, any> = Record<string, any>\n>(props: MarkdownTableProps<T>) {\n const [{ children, data }] = splitProps(props, [\"children\", \"data\"]);\n\n const columns = computed(() =>\n Object.keys(data).map((name: string, index: number) => ({\n index,\n name,\n align: \"left\" as const,\n width: 20\n }))\n );\n\n return (\n <MarkdownTableContext.Provider value={{ columns: columns.value, data }}>\n <Show when={Boolean(children)}>{children}</Show>\n </MarkdownTableContext.Provider>\n );\n}\n\nexport type MarkdownTableColumnProps = ComponentProps &\n Partial<Pick<MarkdownTableColumnContextInterface, \"align\">> &\n Required<Pick<MarkdownTableColumnContextInterface, \"name\">> & {\n width?: number;\n };\n\n/**\n * Component that provides a context for rendering markdown tables.\n */\nexport function MarkdownTableColumn(props: MarkdownTableColumnProps) {\n const [{ children, width, align, name }] = splitProps(props, [\n \"children\",\n \"width\",\n \"align\",\n \"name\"\n ]);\n\n const tableContext = useMarkdownTable();\n const columnRef = computed(() =>\n tableContext?.columns.find(c => c.name === name)\n );\n\n const indexRef = computed(() => columnRef.value?.index ?? 0);\n const alignRef = computed(() => columnRef.value?.align ?? align ?? \"left\");\n const widthRef = computed(() => columnRef.value?.width ?? width ?? 20);\n\n const textLength = computed(() => {\n const content = children ? children.toString() : \"\";\n\n return content.length;\n });\n\n return (\n <Prose>\n <Show when={indexRef.value === 0}>{\"|\"}</Show>\n <Show when={Boolean(children)}>\n <Prose>{code`${\n alignRef.value === \"left\"\n ? \" \".repeat(widthRef.value - textLength.value - 1)\n : \" \"\n }${children}${\n alignRef.value === \"right\"\n ? \" \".repeat(widthRef.value - textLength.value - 1)\n : \" \"\n }`}</Prose>\n </Show>\n {\"|\"}\n </Prose>\n );\n}\n\n/**\n * Component that provides a context for rendering markdown tables.\n */\nexport function MarkdownTableColumnHeader(props: MarkdownTableColumnProps) {\n const [{ children, name }, rest] = splitProps(props, [\"children\", \"name\"]);\n\n return (\n <>\n <MarkdownTableColumn {...rest} name={name}>\n <Show\n fallback={titleCase(name, {\n useDescriptions: false\n })}\n when={!isUndefined(children)}>\n {children}\n </Show>\n </MarkdownTableColumn>\n </>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"markdown-table.mjs","names":[],"sources":["../../../src/markdown/components/markdown-table.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, Prose, Show, splitProps } from \"@alloy-js/core\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { ComponentProps } from \"../../types/components\";\nimport {\n MarkdownTableColumnContextInterface,\n MarkdownTableContext,\n useMarkdownTable\n} from \"../contexts/markdown-table\";\n\nexport interface MarkdownTableProps<\n T extends Record<string, any> = Record<string, any>\n> extends ComponentProps {\n data: T[];\n}\n\n/**\n * Component that provides a context for rendering markdown tables.\n */\nexport function MarkdownTable<\n T extends Record<string, any> = Record<string, any>\n>(props: MarkdownTableProps<T>) {\n const [{ children, data }] = splitProps(props, [\"children\", \"data\"]);\n\n const columns = computed(() =>\n Object.keys(data).map((name: string, index: number) => ({\n index,\n name,\n align: \"left\" as const,\n width: 20\n }))\n );\n\n return (\n <MarkdownTableContext.Provider value={{ columns: columns.value, data }}>\n <Show when={Boolean(children)}>{children}</Show>\n </MarkdownTableContext.Provider>\n );\n}\n\nexport type MarkdownTableColumnProps = ComponentProps &\n Partial<Pick<MarkdownTableColumnContextInterface, \"align\">> &\n Required<Pick<MarkdownTableColumnContextInterface, \"name\">> & {\n width?: number;\n };\n\n/**\n * Component that provides a context for rendering markdown tables.\n */\nexport function MarkdownTableColumn(props: MarkdownTableColumnProps) {\n const [{ children, width, align, name }] = splitProps(props, [\n \"children\",\n \"width\",\n \"align\",\n \"name\"\n ]);\n\n const tableContext = useMarkdownTable();\n const columnRef = computed(() =>\n tableContext?.columns.find(c => c.name === name)\n );\n\n const indexRef = computed(() => columnRef.value?.index ?? 0);\n const alignRef = computed(() => columnRef.value?.align ?? align ?? \"left\");\n const widthRef = computed(() => columnRef.value?.width ?? width ?? 20);\n\n const textLength = computed(() => {\n const content = children ? children.toString() : \"\";\n\n return content.length;\n });\n\n return (\n <Prose>\n <Show when={indexRef.value === 0}>{\"|\"}</Show>\n <Show when={Boolean(children)}>\n <Prose>{code`${\n alignRef.value === \"left\"\n ? \" \".repeat(widthRef.value - textLength.value - 1)\n : \" \"\n }${children}${\n alignRef.value === \"right\"\n ? \" \".repeat(widthRef.value - textLength.value - 1)\n : \" \"\n }`}</Prose>\n </Show>\n {\"|\"}\n </Prose>\n );\n}\n\n/**\n * Component that provides a context for rendering markdown tables.\n */\nexport function MarkdownTableColumnHeader(props: MarkdownTableColumnProps) {\n const [{ children, name }, rest] = splitProps(props, [\"children\", \"name\"]);\n\n return (\n <>\n <MarkdownTableColumn {...rest} name={name}>\n <Show\n fallback={titleCase(name, {\n useDescriptions: false\n })}\n when={!isUndefined(children)}>\n {children}\n </Show>\n </MarkdownTableColumn>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;CA4BA,MAAO,CAAA,EACH,UACF,UACK,WAAI,OAAA,CAAA,YAAA,OAAA,CAAA;CACX,MAAA,UAAA,eAAA,OAAA,KAAA,KAAA,CAAA,KAAA,MAAA,WAAA;;EAEE;EACC,OAAA;EACD,OAAA;EACF,EAAA,CAAM;AACJ,QAAE,gBAAuB,qBAAqB,UAAI;EAClD,IAAM,QAAC;AACP,UAAS;;IAEH;IACJ;;EAEA,IAAE,WAAI;AACJ,UAAO,gBAAe,MAAA;IACtB,IAAM,OAAC;AACP,YAAA,QAAA,SAAA;;;IAGJ,CAAM;;EAEL,CAAC;;;;;AAKJ,SAAY,oBAAwB,OAAG;CACrC,MAAA,CAAO,EACP,UACE,OACD,iBAED,WAAA,OAAA;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA;CACA,MAAC,eAAe,kBAAuB;CACvC,MAAA,YAAA,eAAA,cAAA,QAAA,MAAA,MAAA,EAAA,SAAA,KAAA,CAAA;CACF,MAAO,WAAS,eAAA,UAA2B,OAAA,SAAA,EAAA;CACzC,MAAM,WAAW,eAAe,UAAU,OAAC,SAAW,SAAO,OAAA;CAC7D,MAAG,WAAS,eAAA,UAAA,OAAA,SAAA,SAAA,GAAA;CACZ,MAAG,aAAM,eAAA;AAEP,UADO,WAAA,SAAA,UAAA,GAAA,IACF;GACL;iCAEF,IAAM,WAAA;AACN,SAAM;GAAA,gBAAwB,MAAC;IAC7B,IAAA,OAAc;AACf,YAAA,SAAA,UAAA;;IAEK,UAAU;IACX,CAAC;GAAA,gBAAoB,MAAM;IAC1B,IAAA,OAAW;;;IAGf,IAAM,WAAU;qCAET,IAAA,WAAc;AACrB,aAAA,IAAA,GAAA,SAAA,UAAA,SAAA,IAAA,OAAA,SAAA,QAAA,WAAA,QAAA,EAAA,GAAA,MAAA,WAAA,SAAA,UAAA,UAAA,IAAA,OAAA,SAAA,QAAA,WAAA,QAAA,EAAA,GAAA;QAEK,CAAA;;IAEF,CAAA;GAAA;GAAK;IAET,CAAC;;;;;AAMJ,SAAgB,0BAA0B,OAAA;CACxC,MAAM,CAAC,EACL,UACA,QACC,QAAK,WAAA,OAAA,CAAA,YAAA,OAAA,CAAA;AACR,QAAI,CAAA,gBAAK,qBAAA,WAAA,MAAA;EACR;EACH,IAAA,WAAA;;IAEE,IAAA,WAAA;AACC,YAAc,UAAU,MAAE,EAC3B,iBAAA,OACK,CAAA;;;AAGE,YAAA,CAAA,YAAA,SAAA;;IAEF;IACA,CAAC;;EAEL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-table.mjs","names":[],"sources":["../../../src/markdown/contexts/markdown-table.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ComponentContext } from \"@alloy-js/core\";\nimport { createContext, createNamedContext, useContext } from \"@alloy-js/core\";\n\nexport interface MarkdownTableColumnContextInterface<\n T extends Record<string, any> = Record<string, any>\n> {\n index: number;\n name: keyof T;\n align: \"left\" | \"right\" | \"center\";\n width: number;\n}\n\n/**\n * The Powerlines context used in template rendering.\n */\nexport const MarkdownTableColumnContext: ComponentContext<MarkdownTableColumnContextInterface> =\n createNamedContext<MarkdownTableColumnContextInterface>(\n \"MarkdownTableColumn\",\n {} as MarkdownTableColumnContextInterface\n );\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function useMarkdownTableColumn() {\n return useContext<MarkdownTableColumnContextInterface>(\n MarkdownTableColumnContext\n );\n}\n\nexport interface MarkdownTableContextInterface<\n T extends Record<string, any> = Record<string, any>\n> {\n columns: MarkdownTableColumnContextInterface<T>[];\n data: T[];\n}\n\n/**\n * The Powerlines context used in template rendering.\n */\nexport const MarkdownTableContext: ComponentContext<MarkdownTableContextInterface> =\n createContext<MarkdownTableContextInterface>({\n columns: [],\n data: []\n });\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function useMarkdownTable() {\n return useContext<MarkdownTableContextInterface>(MarkdownTableContext);\n}\n"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"markdown-table.mjs","names":[],"sources":["../../../src/markdown/contexts/markdown-table.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ComponentContext } from \"@alloy-js/core\";\nimport { createContext, createNamedContext, useContext } from \"@alloy-js/core\";\n\nexport interface MarkdownTableColumnContextInterface<\n T extends Record<string, any> = Record<string, any>\n> {\n index: number;\n name: keyof T;\n align: \"left\" | \"right\" | \"center\";\n width: number;\n}\n\n/**\n * The Powerlines context used in template rendering.\n */\nexport const MarkdownTableColumnContext: ComponentContext<MarkdownTableColumnContextInterface> =\n createNamedContext<MarkdownTableColumnContextInterface>(\n \"MarkdownTableColumn\",\n {} as MarkdownTableColumnContextInterface\n );\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function useMarkdownTableColumn() {\n return useContext<MarkdownTableColumnContextInterface>(\n MarkdownTableColumnContext\n );\n}\n\nexport interface MarkdownTableContextInterface<\n T extends Record<string, any> = Record<string, any>\n> {\n columns: MarkdownTableColumnContextInterface<T>[];\n data: T[];\n}\n\n/**\n * The Powerlines context used in template rendering.\n */\nexport const MarkdownTableContext: ComponentContext<MarkdownTableContextInterface> =\n createContext<MarkdownTableContextInterface>({\n columns: [],\n data: []\n });\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function useMarkdownTable() {\n return useContext<MarkdownTableContextInterface>(MarkdownTableContext);\n}\n"],"mappings":";;;;;;AAsBA,MAAY,6BAA6B,mBAAW,uBAAA,EAAA,CAAA;;;;;;;AAQlD,QAAA,WAAA,2BAAA;;;;;AAKF,MAAK,uBAAoB,cAAA;CACvB,SAAQ,EAAA;CACR,MAAC,EAAA;;;;;;;AAQH,SAAS,mBAAW;AAClB,QAAE,WAAA,qBAAA"}
|
package/dist/render.cjs
CHANGED
|
@@ -2,9 +2,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
const require_core_components_output = require('./core/components/output.cjs');
|
|
4
4
|
require('./core/index.cjs');
|
|
5
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
6
5
|
let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
7
6
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
7
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
8
8
|
|
|
9
9
|
//#region src/render.tsx
|
|
10
10
|
/**
|
|
@@ -23,7 +23,7 @@ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
|
23
23
|
*/
|
|
24
24
|
async function render(context, children) {
|
|
25
25
|
const meta = {};
|
|
26
|
-
const output = await (0, _alloy_js_core.renderAsync)(
|
|
26
|
+
const output = await (0, _alloy_js_core.renderAsync)((0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_output.Output, {
|
|
27
27
|
context,
|
|
28
28
|
meta,
|
|
29
29
|
children
|
|
@@ -80,7 +80,7 @@ async function render(context, children) {
|
|
|
80
80
|
* @returns The rendered output as a string.
|
|
81
81
|
*/
|
|
82
82
|
function renderString(context, children, options) {
|
|
83
|
-
return (0, _alloy_js_core.printTree)((0, _alloy_js_core.renderTree)(
|
|
83
|
+
return (0, _alloy_js_core.printTree)((0, _alloy_js_core.renderTree)((0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_output.Output, {
|
|
84
84
|
context,
|
|
85
85
|
children
|
|
86
86
|
})), options);
|
package/dist/render.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Output as Output$1 } from "./core/components/output.mjs";
|
|
2
2
|
import "./core/index.mjs";
|
|
3
|
-
import { printTree, renderAsync, renderTree, traverseOutput } from "@alloy-js/core";
|
|
4
3
|
import { findFileExtension } from "@stryke/path/file-path-fns";
|
|
5
|
-
import {
|
|
4
|
+
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
5
|
+
import { printTree, renderAsync, renderTree, traverseOutput } from "@alloy-js/core";
|
|
6
6
|
|
|
7
7
|
//#region src/render.tsx
|
|
8
8
|
/**
|
|
@@ -21,7 +21,7 @@ import { jsx } from "@alloy-js/core/jsx-runtime";
|
|
|
21
21
|
*/
|
|
22
22
|
async function render(context, children) {
|
|
23
23
|
const meta = {};
|
|
24
|
-
const output = await renderAsync(
|
|
24
|
+
const output = await renderAsync(createComponent(Output$1, {
|
|
25
25
|
context,
|
|
26
26
|
meta,
|
|
27
27
|
children
|
|
@@ -78,7 +78,7 @@ async function render(context, children) {
|
|
|
78
78
|
* @returns The rendered output as a string.
|
|
79
79
|
*/
|
|
80
80
|
function renderString(context, children, options) {
|
|
81
|
-
return printTree(renderTree(
|
|
81
|
+
return printTree(renderTree(createComponent(Output$1, {
|
|
82
82
|
context,
|
|
83
83
|
children
|
|
84
84
|
})), options);
|
package/dist/render.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.mjs","names":[
|
|
1
|
+
{"version":3,"file":"render.mjs","names":[],"sources":["../src/render.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n Children,\n printTree,\n PrintTreeOptions,\n renderAsync,\n renderTree,\n traverseOutput\n} from \"@alloy-js/core\";\nimport { findFileExtension } from \"@stryke/path/file-path-fns\";\nimport { PluginContext } from \"powerlines\";\nimport { MetaItem, Output } from \"./core\";\n\n/**\n * A function to render children components within the [Alloy](https://alloy-framework.github.io) context, and write any saved content to the file system.\n *\n * @example\n * ```tsx\n * import { render } from \"@powerlines/plugin-alloy/render\";\n *\n * await render(context, <> ... </>);\n * ```\n *\n * @param context - The Powerlines plugin context.\n * @param children - The children components to render.\n * @returns A promise that resolves when rendering is complete.\n */\nexport async function render<TContext extends PluginContext>(\n context: TContext,\n children: Children\n) {\n const meta = {} as Record<string, MetaItem>;\n const output = await renderAsync(\n <Output<TContext> context={context} meta={meta}>\n {children}\n </Output>\n );\n\n if (!Object.keys(output).length) {\n context.debug(\n \"No output files were rendered by Alloy-js component templates.\"\n );\n } else {\n context.debug(\n `Processing ${\n Object.keys(output).length\n } rendered output files from Alloy-js component templates.`\n );\n\n await traverseOutput(output, {\n visitDirectory: directory => {\n if (context.fs.existsSync(directory.path)) {\n return;\n }\n\n context.fs.mkdirSync(directory.path);\n },\n visitFile: file => {\n if (\"contents\" in file) {\n const metadata = meta[file.path] ?? {};\n if (metadata.kind === \"builtin\") {\n if (!metadata.id) {\n throw new Error(\n `Built-in file \"${\n file.path\n }\" is missing its ID in the render metadata.`\n );\n }\n\n context.emitBuiltinSync(file.contents, metadata.id, {\n skipFormat: metadata.skipFormat,\n storage: metadata.storage,\n extension: findFileExtension(file.path)\n });\n } else if (metadata.kind === \"entry\") {\n context.emitEntrySync(file.contents, file.path, {\n skipFormat: metadata.skipFormat,\n storage: metadata.storage,\n ...(metadata.typeDefinition ?? {})\n });\n } else if (metadata.kind === \"infrastructure\") {\n if (!metadata.id) {\n throw new Error(\n `Infrastructure file \"${\n file.path\n }\" is missing its ID in the render metadata.`\n );\n }\n\n context.emitInfrastructureSync(file.contents, metadata.id, {\n skipFormat: metadata.skipFormat,\n storage: metadata.storage,\n extension: findFileExtension(file.path)\n });\n } else {\n context.emitSync(file.contents, file.path, metadata);\n }\n } else {\n context.fs.copySync(file.sourcePath, file.path);\n }\n }\n });\n }\n}\n\n/**\n * A function to render children components within the [Alloy](https://alloy-framework.github.io) context and return the rendered output as a string.\n *\n * @example\n * ```tsx\n * import { renderString } from \"@powerlines/plugin-alloy/render\";\n *\n * const output = await renderString(context, <> ... </>);\n * ```\n *\n * @param context - The Powerlines plugin context.\n * @param children - The children components to render.\n * @param options - Optional print tree options.\n * @returns The rendered output as a string.\n */\nexport function renderString<TContext extends PluginContext>(\n context: TContext,\n children: Children,\n options?: PrintTreeOptions\n) {\n const tree = renderTree(\n <Output<TContext> context={context}>{children}</Output>\n );\n\n return printTree(tree, options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsCA,eAAK,OAAA,SAAA,UAAA;CACJ,MAAA,OAAA,EAAA;CACC,MAAE,SAAa,MAAM,YAAY,gBAAc,UAAA;EACvC;EACN;EACF;EACF,CAAA,CAAA;AACE,KAAA,CAAA,OAAS,KAAQ,OAAA,CAAA,OACjB,SAAU,MAAA,iEAAA;MACV;AACA,UAAU,MAAM,cAAU,OAAQ,KAAQ,OAAC,CAAA,OAAA,2DAAA;AAC3C,QAAM,eAAe,QAAA;GAClB,iBAAiB,cAAS;AACxB,QAAA,QAAQ,GAAA,WAAA,UAAA,KAAA,CACT;;;GAIF,YAAa,SAAA;AACV,QAAG,cAAa,MAAK;KACvB,MAAA,WAAA,KAAA,KAAA,SAAA,EAAA;AACI,SAAA,SAAA,SAAA,WAAA;AACG,UAAA,CAAK,SAAA,GACV,OAAY,IAAA,MAAA,kBAAA,KAAA,KAAA,6CAAA;AAEX,cAAS,gBAAkB,KAAM,UAAG,SAAU,IAAU;OAC3D,YAAA,SAAA;;OAEK,WAAe,kBAAQ,KAAA,KAAA;OAC3B,CAAA;gBACc,SAAG,SAAW,QACxB,SAAM,cAAA,KAAA,UAAA,KAAA,MAAA;MACR,YAAA,SAAA;;MAEA,GAAU,SAAC,kBAAyB,EAAA;MACrC,CAAA;cACc,SAAI,SAAA,kBAAA;AACb,UAAC,CAAA,SAAa,GAChB,OAAM,IAAQ,MAAG,wBAAqB,KAAA,KAAA,6CAAA;AAEpC,cAAK,uBAAa,KAAA,UAAA,SAAA,IAAA;OAChB,YAAU,SAAK;OACf,SAAS,SAAS;OAClB,WAAS,kBAAA,KAAA,KAAA;OACV,CAAC;WAEF,SAAA,SAAA,KAAA,UAAA,KAAA,MAAA,SAAA;UAGF,SAAI,GAAA,SAAY,KAAS,YAAU,KAAA,KAAA;;GAGxC,CAAC;;;;;;;;;;;;;;;;;;AAmBN,SAAc,aAAW,SAAA,UAAuB,SAAI;AAKlD,QAAO,UAJK,WAAA,gBAAA,UAAA;EACF;EACA;EACT,CAAC,CACW,EAAA,QAAA"}
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/types/components.ts
|
|
2
|
+
/**
|
|
3
|
+
* A type that represents the props of a component that can have children.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* A type that requires the `children` prop in a component.
|
|
7
|
+
*/
|
|
8
|
+
//#endregion
|
|
9
|
+
export { };
|
|
10
|
+
//# sourceMappingURL=components.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.mjs","names":[],"sources":["../../src/types/components.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children, Context } from \"@alloy-js/core\";\nimport type { SourceFileContext } from \"@alloy-js/typescript\";\nimport { ResolvedEntryTypeDefinition, StoragePreset } from \"powerlines\";\n\nexport interface CopyOutputFile {\n kind: \"file\";\n path: string;\n sourcePath: string;\n\n /**\n * The format of the output files\n *\n * @remarks\n * If not specified, the output mode will be determined by the provided \\`output.mode\\` value.\n */\n preset?: StoragePreset;\n}\n\nexport interface WriteOutputFile {\n kind: \"file\" | \"entry\" | \"builtin\";\n path: string;\n contents: string;\n filetype: string;\n\n /**\n * The format of the output files\n *\n * @remarks\n * If not specified, the output mode will be determined by the provided \\`output.mode\\` value.\n */\n preset?: StoragePreset;\n}\n\nexport type OutputFile =\n | (WriteOutputFile & { kind: \"file\" })\n | (WriteOutputFile & {\n kind: \"entry\";\n typeDefinition?: ResolvedEntryTypeDefinition;\n })\n | (WriteOutputFile & { kind: \"builtin\"; id: string })\n | CopyOutputFile;\n\nexport interface OutputDirectory {\n kind: \"directory\";\n path: string;\n contents: (OutputDirectory | OutputFile)[];\n}\n\nexport interface RenderEntryContext {\n typeDefinition: ResolvedEntryTypeDefinition;\n}\n\nexport interface RenderBuiltinContext {\n id: string;\n}\n\nexport interface RenderOutputContext {\n mode?: StoragePreset;\n}\n\nexport interface CopyFileOutputContext {\n path?: string;\n sourcePath?: string;\n}\n\nexport interface RenderContext extends Context {\n meta?: {\n copyFile?: CopyFileOutputContext;\n\n /**\n * The current context for the built-in module.\n */\n builtin?: RenderBuiltinContext;\n\n /**\n * The current context for the application entrypoint file being rendered.\n */\n entry?: RenderEntryContext;\n\n /**\n * The current context for output rendering.\n */\n output?: RenderOutputContext;\n } & Record<string, any>;\n}\n\n/**\n * A type that represents the props of a component that can have children.\n */\nexport interface ComponentProps {\n children?: Children;\n}\n\n/**\n * A type that requires the `children` prop in a component.\n */\nexport type ComponentPropsWithChildren = Omit<ComponentProps, \"children\"> &\n Required<Pick<ComponentProps, \"children\">>;\n\nexport interface BuiltinSourceFileContext extends SourceFileContext {\n /**\n * The runtime module identifier.\n */\n id: string;\n}\n\nexport interface ReflectionOverrideInterface<T> {\n name?: string | Children;\n type?: string | Children;\n extends?: string | false;\n defaultValue?: Partial<T>;\n}\n\nexport interface TypescriptFileImportItem {\n name: string;\n default?: boolean;\n alias?: string;\n type?: boolean;\n}\n\nexport type TypescriptFileImports = Record<\n string,\n null | string | Array<TypescriptFileImportItem | string>\n>;\n\nexport interface SourceFileHeaderProps extends ComponentProps {\n /**\n * If true, disables the ESLint directive at the top of the file.\n *\n * @defaultValue true\n */\n disableEslint?: boolean;\n\n /**\n * If true, disables the Biome directive at the top of the file.\n *\n * @defaultValue true\n */\n disableBiome?: boolean;\n\n /**\n * If true, disables the Prettier directive at the top of the file.\n *\n * @defaultValue false\n */\n disablePrettier?: boolean;\n}\n"],"mappings":""}
|
|
@@ -3,10 +3,10 @@ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
|
3
3
|
const require_core_contexts_context = require('../../core/contexts/context.cjs');
|
|
4
4
|
const require_typescript_components_tsdoc = require('./tsdoc.cjs');
|
|
5
5
|
const require_typescript_components_typescript_file = require('./typescript-file.cjs');
|
|
6
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
7
6
|
let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
8
|
-
let _stryke_path_replace = require("@stryke/path/replace");
|
|
9
7
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
8
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
9
|
+
let _stryke_path_replace = require("@stryke/path/replace");
|
|
10
10
|
let _stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
|
|
11
11
|
|
|
12
12
|
//#region src/typescript/components/builtin-file.tsx
|
|
@@ -27,26 +27,36 @@ function BuiltinFile(props) {
|
|
|
27
27
|
]);
|
|
28
28
|
const context = require_core_contexts_context.usePowerlinesSafe();
|
|
29
29
|
const path = (0, _alloy_js_core.computed)(() => (0, _stryke_path_replace.replacePath)(`${!(0, _stryke_type_checks_is_set.isSet)(tsx) ? id : (0, _stryke_path_replace.replaceExtension)(id)}${(0, _stryke_path_file_path_fns.hasFileExtension)(id) && !(0, _stryke_type_checks_is_set.isSet)(tsx) ? "" : tsx ? ".tsx" : ".ts"}`, context?.builtinsPath));
|
|
30
|
-
return
|
|
31
|
-
header
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_typescript_file.TypescriptFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({
|
|
31
|
+
get header() {
|
|
32
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_typescript_file.TypescriptFileHeader, {
|
|
33
|
+
get header() {
|
|
34
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDocModule, {
|
|
35
|
+
name: id,
|
|
36
|
+
children: description
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
get children() {
|
|
40
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_typescript_file.TypescriptFileHeaderImports, {
|
|
41
|
+
imports,
|
|
42
|
+
builtinImports
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
get meta() {
|
|
48
|
+
return {
|
|
49
|
+
kind: "builtin",
|
|
50
|
+
extension: tsx ? "tsx" : "ts",
|
|
51
|
+
id: (0, _stryke_path_replace.replaceExtension)(id)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}, rest, {
|
|
55
|
+
get path() {
|
|
56
|
+
return path.value;
|
|
45
57
|
},
|
|
46
|
-
...rest,
|
|
47
|
-
path: path.value,
|
|
48
58
|
children
|
|
49
|
-
});
|
|
59
|
+
}));
|
|
50
60
|
}
|
|
51
61
|
|
|
52
62
|
//#endregion
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { usePowerlinesSafe } from "../../core/contexts/context.mjs";
|
|
2
2
|
import { TSDocModule } from "./tsdoc.mjs";
|
|
3
3
|
import { TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports } from "./typescript-file.mjs";
|
|
4
|
-
import { computed, splitProps } from "@alloy-js/core";
|
|
5
4
|
import { hasFileExtension } from "@stryke/path/file-path-fns";
|
|
5
|
+
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
6
|
+
import { computed, splitProps } from "@alloy-js/core";
|
|
6
7
|
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
7
|
-
import { jsx } from "@alloy-js/core/jsx-runtime";
|
|
8
8
|
import { isSet } from "@stryke/type-checks/is-set";
|
|
9
9
|
|
|
10
10
|
//#region src/typescript/components/builtin-file.tsx
|
|
@@ -25,26 +25,36 @@ function BuiltinFile(props) {
|
|
|
25
25
|
]);
|
|
26
26
|
const context = usePowerlinesSafe();
|
|
27
27
|
const path = computed(() => replacePath(`${!isSet(tsx) ? id : replaceExtension(id)}${hasFileExtension(id) && !isSet(tsx) ? "" : tsx ? ".tsx" : ".ts"}`, context?.builtinsPath));
|
|
28
|
-
return
|
|
29
|
-
header
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
28
|
+
return createComponent(TypescriptFile, mergeProps({
|
|
29
|
+
get header() {
|
|
30
|
+
return createComponent(TypescriptFileHeader, {
|
|
31
|
+
get header() {
|
|
32
|
+
return createComponent(TSDocModule, {
|
|
33
|
+
name: id,
|
|
34
|
+
children: description
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
get children() {
|
|
38
|
+
return createComponent(TypescriptFileHeaderImports, {
|
|
39
|
+
imports,
|
|
40
|
+
builtinImports
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
get meta() {
|
|
46
|
+
return {
|
|
47
|
+
kind: "builtin",
|
|
48
|
+
extension: tsx ? "tsx" : "ts",
|
|
49
|
+
id: replaceExtension(id)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}, rest, {
|
|
53
|
+
get path() {
|
|
54
|
+
return path.value;
|
|
43
55
|
},
|
|
44
|
-
...rest,
|
|
45
|
-
path: path.value,
|
|
46
56
|
children
|
|
47
|
-
});
|
|
57
|
+
}));
|
|
48
58
|
}
|
|
49
59
|
|
|
50
60
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-file.mjs","names":[],"sources":["../../../src/typescript/components/builtin-file.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { computed, splitProps } from \"@alloy-js/core\";\nimport { hasFileExtension } from \"@stryke/path/file-path-fns\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { usePowerlinesSafe } from \"../../core/contexts/context\";\nimport type { TSDocModuleProps } from \"./tsdoc\";\nimport { TSDocModule } from \"./tsdoc\";\nimport {\n TypescriptFile,\n TypescriptFileHeader,\n TypescriptFileHeaderImports,\n TypescriptFileProps\n} from \"./typescript-file\";\n\nexport type BuiltinFileProps = Omit<TypescriptFileProps, \"path\"> &\n Omit<TSDocModuleProps, \"name\"> & {\n /**\n * The runtime module identifier.\n *\n * @remarks\n * This value will be included after the \\`storm:\\` prefix in the import statement.\n */\n id: string;\n\n /**\n * The description for the builtin module.\n */\n description?: string;\n\n /**\n * Whether the file is a TSX file.\n *\n * @defaultValue false\n */\n tsx?: boolean;\n };\n\n/**\n * A base component representing a Powerlines generated Typescript source file.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function BuiltinFile(props: BuiltinFileProps) {\n const [{ children, imports, builtinImports, id, description, tsx }, rest] =\n splitProps(props, [\n \"children\",\n \"imports\",\n \"builtinImports\",\n \"id\",\n \"description\",\n \"tsx\"\n ]);\n\n const context = usePowerlinesSafe();\n const path = computed(() =>\n replacePath(\n `${!isSet(tsx) ? id : replaceExtension(id)}${\n hasFileExtension(id) && !isSet(tsx) ? \"\" : tsx ? \".tsx\" : \".ts\"\n }`,\n context?.builtinsPath\n )\n );\n\n return (\n <TypescriptFile\n header={\n <TypescriptFileHeader\n header={<TSDocModule name={id}>{description}</TSDocModule>}>\n <TypescriptFileHeaderImports\n imports={imports}\n builtinImports={builtinImports}\n />\n </TypescriptFileHeader>\n }\n meta={{\n kind: \"builtin\",\n extension: tsx ? \"tsx\" : \"ts\",\n id: replaceExtension(id)\n }}\n {...rest}\n path={path.value}>\n {children}\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"builtin-file.mjs","names":[],"sources":["../../../src/typescript/components/builtin-file.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { computed, splitProps } from \"@alloy-js/core\";\nimport { hasFileExtension } from \"@stryke/path/file-path-fns\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { usePowerlinesSafe } from \"../../core/contexts/context\";\nimport type { TSDocModuleProps } from \"./tsdoc\";\nimport { TSDocModule } from \"./tsdoc\";\nimport {\n TypescriptFile,\n TypescriptFileHeader,\n TypescriptFileHeaderImports,\n TypescriptFileProps\n} from \"./typescript-file\";\n\nexport type BuiltinFileProps = Omit<TypescriptFileProps, \"path\"> &\n Omit<TSDocModuleProps, \"name\"> & {\n /**\n * The runtime module identifier.\n *\n * @remarks\n * This value will be included after the \\`storm:\\` prefix in the import statement.\n */\n id: string;\n\n /**\n * The description for the builtin module.\n */\n description?: string;\n\n /**\n * Whether the file is a TSX file.\n *\n * @defaultValue false\n */\n tsx?: boolean;\n };\n\n/**\n * A base component representing a Powerlines generated Typescript source file.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function BuiltinFile(props: BuiltinFileProps) {\n const [{ children, imports, builtinImports, id, description, tsx }, rest] =\n splitProps(props, [\n \"children\",\n \"imports\",\n \"builtinImports\",\n \"id\",\n \"description\",\n \"tsx\"\n ]);\n\n const context = usePowerlinesSafe();\n const path = computed(() =>\n replacePath(\n `${!isSet(tsx) ? id : replaceExtension(id)}${\n hasFileExtension(id) && !isSet(tsx) ? \"\" : tsx ? \".tsx\" : \".ts\"\n }`,\n context?.builtinsPath\n )\n );\n\n return (\n <TypescriptFile\n header={\n <TypescriptFileHeader\n header={<TSDocModule name={id}>{description}</TSDocModule>}>\n <TypescriptFileHeaderImports\n imports={imports}\n builtinImports={builtinImports}\n />\n </TypescriptFileHeader>\n }\n meta={{\n kind: \"builtin\",\n extension: tsx ? \"tsx\" : \"ts\",\n id: replaceExtension(id)\n }}\n {...rest}\n path={path.value}>\n {children}\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgCA,SAAY,YAAgB,OAAO;CACjC,MAAK,CAAA,EACH,UACA,SACA,gBACA,IACA,aACA,OACA,QAAI,WAAM,OAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA;;CAEZ,MAAI,OAAA,eAAA,YAAA,GAAA,CAAA,MAAA,IAAA,GAAA,KAAA,iBAAA,GAAA,GAAA,iBAAA,GAAA,IAAA,CAAA,MAAA,IAAA,GAAA,KAAA,MAAA,SAAA,SAAA,SAAA,aAAA,CAAA;AACJ,QAAK,gBAAoB,gBAAY,WAAM;EACzC,IAAE,SAAA;AACF,UAAA,gBAAoB,sBAAA;;AAElB,YAAA,gBAAA,aAAA;MACC,MAAW;MACb,UAAA;MACG,CAAA;;IAEA,IAAE,WAAO;AACd,YAAA,gBAAA,6BAAA;;MAED;MACQ,CAAA;;IAEN,CAAA;;EAEF,IAAA,OAAA;AACI,UAAC;IACC,MAAG;IACP,WAAW,MAAO,QAAA;IACf,IAAA,iBAAS,GAAA;IACT;;EAEJ,EAAE,MAAK;EACN,IAAG,OAAA;AACD,UAAI,KAAA;;;EAGR,CAAA,CAAA"}
|