@powerlines/plugin-alloy 0.26.75 → 0.26.77

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.
Files changed (164) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +29 -1
  2. package/dist/core/components/index.cjs +12 -1
  3. package/dist/core/components/index.mjs +7 -1
  4. package/dist/core/components/infrastructure-file.cjs +48 -1
  5. package/dist/core/components/infrastructure-file.mjs +45 -1
  6. package/dist/core/components/infrastructure-file.mjs.map +1 -1
  7. package/dist/core/components/output.cjs +41 -1
  8. package/dist/core/components/output.mjs +39 -1
  9. package/dist/core/components/output.mjs.map +1 -1
  10. package/dist/core/components/single-line-comment.cjs +23 -1
  11. package/dist/core/components/single-line-comment.mjs +21 -1
  12. package/dist/core/components/single-line-comment.mjs.map +1 -1
  13. package/dist/core/components/source-file.cjs +64 -1
  14. package/dist/core/components/source-file.mjs +61 -1
  15. package/dist/core/components/source-file.mjs.map +1 -1
  16. package/dist/core/components/spacing.cjs +20 -1
  17. package/dist/core/components/spacing.mjs +18 -1
  18. package/dist/core/components/spacing.mjs.map +1 -1
  19. package/dist/core/contexts/context.cjs +41 -1
  20. package/dist/core/contexts/context.mjs +36 -1
  21. package/dist/core/contexts/context.mjs.map +1 -1
  22. package/dist/core/contexts/index.cjs +22 -1
  23. package/dist/core/contexts/index.mjs +5 -1
  24. package/dist/core/contexts/meta.cjs +41 -1
  25. package/dist/core/contexts/meta.mjs +36 -1
  26. package/dist/core/contexts/meta.mjs.map +1 -1
  27. package/dist/core/contexts/reflection.cjs +80 -1
  28. package/dist/core/contexts/reflection.mjs +70 -1
  29. package/dist/core/contexts/reflection.mjs.map +1 -1
  30. package/dist/core/helpers/code.cjs +34 -1
  31. package/dist/core/helpers/code.mjs +32 -1
  32. package/dist/core/helpers/code.mjs.map +1 -1
  33. package/dist/core/helpers/index.cjs +4 -1
  34. package/dist/core/helpers/index.mjs +3 -1
  35. package/dist/core/index.cjs +37 -1
  36. package/dist/core/index.mjs +14 -1
  37. package/dist/hcl/components/block-declaration.cjs +34 -1
  38. package/dist/hcl/components/block-declaration.mjs +32 -1
  39. package/dist/hcl/components/block-declaration.mjs.map +1 -1
  40. package/dist/hcl/components/hcl-file.cjs +83 -1
  41. package/dist/hcl/components/hcl-file.mjs +80 -1
  42. package/dist/hcl/components/hcl-file.mjs.map +1 -1
  43. package/dist/hcl/components/index.cjs +11 -1
  44. package/dist/hcl/components/index.mjs +6 -1
  45. package/dist/hcl/components/packer-file.cjs +29 -1
  46. package/dist/hcl/components/packer-file.mjs +27 -1
  47. package/dist/hcl/components/packer-file.mjs.map +1 -1
  48. package/dist/hcl/components/terraform-file.cjs +30 -1
  49. package/dist/hcl/components/terraform-file.mjs +28 -1
  50. package/dist/hcl/components/terraform-file.mjs.map +1 -1
  51. package/dist/hcl/index.cjs +12 -1
  52. package/dist/hcl/index.mjs +7 -1
  53. package/dist/helpers/capnp.cjs +245 -37
  54. package/dist/helpers/capnp.mjs +227 -37
  55. package/dist/helpers/capnp.mjs.map +1 -1
  56. package/dist/helpers/create-builtin.cjs +20 -1
  57. package/dist/helpers/create-builtin.mjs +18 -1
  58. package/dist/helpers/create-builtin.mjs.map +1 -1
  59. package/dist/helpers/index.cjs +25 -1
  60. package/dist/helpers/index.mjs +6 -1
  61. package/dist/helpers/refkey.cjs +17 -1
  62. package/dist/helpers/refkey.mjs +15 -1
  63. package/dist/helpers/refkey.mjs.map +1 -1
  64. package/dist/helpers/typescript.cjs +43 -19
  65. package/dist/helpers/typescript.mjs +41 -19
  66. package/dist/helpers/typescript.mjs.map +1 -1
  67. package/dist/index.cjs +55 -1
  68. package/dist/index.mjs +51 -1
  69. package/dist/index.mjs.map +1 -1
  70. package/dist/markdown/components/front-matter.cjs +29 -1
  71. package/dist/markdown/components/front-matter.mjs +27 -1
  72. package/dist/markdown/components/front-matter.mjs.map +1 -1
  73. package/dist/markdown/components/heading.cjs +24 -1
  74. package/dist/markdown/components/heading.mjs +22 -1
  75. package/dist/markdown/components/heading.mjs.map +1 -1
  76. package/dist/markdown/components/index.cjs +13 -1
  77. package/dist/markdown/components/index.mjs +6 -1
  78. package/dist/markdown/components/markdown-file.cjs +135 -1
  79. package/dist/markdown/components/markdown-file.mjs +132 -1
  80. package/dist/markdown/components/markdown-file.mjs.map +1 -1
  81. package/dist/markdown/components/markdown-table.cjs +102 -1
  82. package/dist/markdown/components/markdown-table.mjs +98 -1
  83. package/dist/markdown/components/markdown-table.mjs.map +1 -1
  84. package/dist/markdown/contexts/index.cjs +7 -1
  85. package/dist/markdown/contexts/index.mjs +3 -1
  86. package/dist/markdown/contexts/markdown-table.cjs +38 -1
  87. package/dist/markdown/contexts/markdown-table.mjs +33 -1
  88. package/dist/markdown/contexts/markdown-table.mjs.map +1 -1
  89. package/dist/markdown/index.cjs +20 -1
  90. package/dist/markdown/index.mjs +9 -1
  91. package/dist/render.cjs +91 -1
  92. package/dist/render.mjs +88 -1
  93. package/dist/render.mjs.map +1 -1
  94. package/dist/types/components.cjs +9 -0
  95. package/dist/types/components.mjs +9 -1
  96. package/dist/types/index.mjs +1 -1
  97. package/dist/types/plugin.mjs +1 -1
  98. package/dist/typescript/components/builtin-file.cjs +63 -1
  99. package/dist/typescript/components/builtin-file.mjs +61 -1
  100. package/dist/typescript/components/builtin-file.mjs.map +1 -1
  101. package/dist/typescript/components/class-declaration.cjs +306 -1
  102. package/dist/typescript/components/class-declaration.mjs +299 -1
  103. package/dist/typescript/components/class-declaration.mjs.map +1 -1
  104. package/dist/typescript/components/dynamic-import-statement.cjs +26 -1
  105. package/dist/typescript/components/dynamic-import-statement.mjs +24 -1
  106. package/dist/typescript/components/dynamic-import-statement.mjs.map +1 -1
  107. package/dist/typescript/components/entry-file.cjs +43 -1
  108. package/dist/typescript/components/entry-file.mjs +40 -1
  109. package/dist/typescript/components/entry-file.mjs.map +1 -1
  110. package/dist/typescript/components/index.cjs +64 -1
  111. package/dist/typescript/components/index.mjs +15 -1
  112. package/dist/typescript/components/interface-declaration.cjs +239 -1
  113. package/dist/typescript/components/interface-declaration.mjs +234 -1
  114. package/dist/typescript/components/interface-declaration.mjs.map +1 -1
  115. package/dist/typescript/components/object-declaration.cjs +139 -1
  116. package/dist/typescript/components/object-declaration.mjs +136 -1
  117. package/dist/typescript/components/object-declaration.mjs.map +1 -1
  118. package/dist/typescript/components/property-name.cjs +32 -1
  119. package/dist/typescript/components/property-name.mjs +30 -1
  120. package/dist/typescript/components/property-name.mjs.map +1 -1
  121. package/dist/typescript/components/record-expression.cjs +13 -3
  122. package/dist/typescript/components/record-expression.mjs +11 -3
  123. package/dist/typescript/components/record-expression.mjs.map +1 -1
  124. package/dist/typescript/components/tsdoc-reflection.cjs +331 -1
  125. package/dist/typescript/components/tsdoc-reflection.mjs +324 -1
  126. package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
  127. package/dist/typescript/components/tsdoc.cjs +497 -1
  128. package/dist/typescript/components/tsdoc.mjs +475 -1
  129. package/dist/typescript/components/tsdoc.mjs.map +1 -1
  130. package/dist/typescript/components/type-declaration.cjs +39 -1
  131. package/dist/typescript/components/type-declaration.mjs +37 -1
  132. package/dist/typescript/components/type-declaration.mjs.map +1 -1
  133. package/dist/typescript/components/type-parameters.cjs +83 -1
  134. package/dist/typescript/components/type-parameters.mjs +81 -1
  135. package/dist/typescript/components/type-parameters.mjs.map +1 -1
  136. package/dist/typescript/components/typescript-file.cjs +221 -1
  137. package/dist/typescript/components/typescript-file.mjs +217 -1
  138. package/dist/typescript/components/typescript-file.mjs.map +1 -1
  139. package/dist/typescript/contexts/index.cjs +4 -1
  140. package/dist/typescript/contexts/index.mjs +3 -1
  141. package/dist/typescript/contexts/lexical-scope.cjs +26 -1
  142. package/dist/typescript/contexts/lexical-scope.mjs +24 -1
  143. package/dist/typescript/contexts/lexical-scope.mjs.map +1 -1
  144. package/dist/typescript/contexts/member-scope.cjs +24 -1
  145. package/dist/typescript/contexts/member-scope.mjs +22 -1
  146. package/dist/typescript/contexts/member-scope.mjs.map +1 -1
  147. package/dist/typescript/helpers/get-call-signature-props.cjs +26 -1
  148. package/dist/typescript/helpers/get-call-signature-props.mjs +24 -1
  149. package/dist/typescript/helpers/get-call-signature-props.mjs.map +1 -1
  150. package/dist/typescript/helpers/index.cjs +6 -1
  151. package/dist/typescript/helpers/index.mjs +4 -1
  152. package/dist/typescript/helpers/utilities.cjs +15 -1
  153. package/dist/typescript/helpers/utilities.mjs +13 -1
  154. package/dist/typescript/helpers/utilities.mjs.map +1 -1
  155. package/dist/typescript/index.cjs +73 -1
  156. package/dist/typescript/index.mjs +21 -1
  157. package/dist/yaml/components/index.cjs +5 -1
  158. package/dist/yaml/components/index.mjs +3 -1
  159. package/dist/yaml/components/yaml-file.cjs +149 -1
  160. package/dist/yaml/components/yaml-file.mjs +146 -1
  161. package/dist/yaml/components/yaml-file.mjs.map +1 -1
  162. package/dist/yaml/index.cjs +6 -1
  163. package/dist/yaml/index.mjs +4 -1
  164. package/package.json +6 -6
@@ -1 +1,149 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../core/contexts/context.cjs`),t=require(`../../core/components/source-file.cjs`),n=require(`../../core/components/single-line-comment.cjs`);let r=require(`@alloy-js/core/jsx-runtime`),i=require(`@alloy-js/core`),a=require(`@stryke/string-format/title-case`),o=require(`powerlines/utils`),s=require(`@stryke/type-checks`);function c({key:e,value:t}){return[(0,r.createComponent)(i.Show,{get when(){return!!e},children:i.code`${e}:`}),(0,r.createComponent)(i.Show,{when:typeof t==`string`||typeof t==`number`||typeof t==`boolean`,get children(){return i.code` ${String(t)}`}}),(0,r.createComponent)(i.Show,{get when(){return(0,r.memo)(()=>!!(0,s.isSetObject)(t))()&&!Array.isArray(t)},get children(){return(0,r.createComponent)(i.For,{get each(){return Object.entries(t)},children:([e,t])=>(0,r.createComponent)(c,{key:e,value:t})})}}),(0,r.createComponent)(i.Show,{get when(){return Array.isArray(t)},get children(){return(0,r.createComponent)(i.For,{each:t,children:e=>(0,r.createComponent)(c,{value:e})})}})]}function l({data:e}){return[(0,r.createComponent)(i.Show,{get when(){return!!e},get children(){return(0,r.createComponent)(i.For,{get each(){return Object.entries(e??{})},children:([e,t])=>(0,r.createComponent)(c,{key:e,value:t})})}})]}function u(e){let[{children:n,path:a,data:o,header:s},c]=(0,i.splitProps)(e,[`children`,`path`,`data`,`header`]);return(0,r.createComponent)(t.SourceFile,(0,r.mergeProps)(c,{path:a,get header(){return(0,r.createComponent)(d,{children:s})},filetype:`yaml`,get children(){return[(0,r.createComponent)(i.Show,{get when(){return!!o},get children(){return(0,r.createComponent)(l,{data:o})}}),(0,r.createComponent)(i.Show,{get when(){return!!n},get children(){return[n,(0,r.createIntrinsic)(`hbr`,{})]}})]}}))}function d(t){let{children:s}=t,c=e.usePowerlinesSafe();return[(0,r.createComponent)(i.Show,{get when(){return!!s},get children(){return[s,(0,r.createIntrinsic)(`hbr`,{})]}}),(0,r.createComponent)(n.SingleLineComment,{get children(){return`Generated by ${(0,a.titleCase)(c?.config?.framework)||`Powerlines`}`}}),(0,r.createIntrinsic)(`hbr`,{}),(0,r.createComponent)(n.SingleLineComment,{variant:`yaml`,get children(){return(0,o.getFileHeaderWarning)(c)}}),(0,r.createIntrinsic)(`hbr`,{})]}exports.YamlFile=u,exports.YamlFileHeader=d;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
+ const require_core_contexts_context = require('../../core/contexts/context.cjs');
4
+ const require_core_components_source_file = require('../../core/components/source-file.cjs');
5
+ const require_core_components_single_line_comment = require('../../core/components/single-line-comment.cjs');
6
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
7
+ let _alloy_js_core = require("@alloy-js/core");
8
+ let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
9
+ let powerlines_utils = require("powerlines/utils");
10
+ let _stryke_type_checks = require("@stryke/type-checks");
11
+
12
+ //#region src/yaml/components/yaml-file.tsx
13
+ function YamlFileDataItem({ key, value }) {
14
+ return [
15
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
16
+ get when() {
17
+ return Boolean(key);
18
+ },
19
+ children: _alloy_js_core.code`${key}:`
20
+ }),
21
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
22
+ when: typeof value === "string" || typeof value === "number" || typeof value === "boolean",
23
+ get children() {
24
+ return _alloy_js_core.code` ${String(value)}`;
25
+ }
26
+ }),
27
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
28
+ get when() {
29
+ return (0, _alloy_js_core_jsx_runtime.memo)(() => !!(0, _stryke_type_checks.isSetObject)(value))() && !Array.isArray(value);
30
+ },
31
+ get children() {
32
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
33
+ get each() {
34
+ return Object.entries(value);
35
+ },
36
+ children: ([nestedKey, nestedValue]) => (0, _alloy_js_core_jsx_runtime.createComponent)(YamlFileDataItem, {
37
+ key: nestedKey,
38
+ value: nestedValue
39
+ })
40
+ });
41
+ }
42
+ }),
43
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
44
+ get when() {
45
+ return Array.isArray(value);
46
+ },
47
+ get children() {
48
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
49
+ each: value,
50
+ children: (item) => (0, _alloy_js_core_jsx_runtime.createComponent)(YamlFileDataItem, { value: item })
51
+ });
52
+ }
53
+ })
54
+ ];
55
+ }
56
+ function YamlFileData({ data }) {
57
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
58
+ get when() {
59
+ return Boolean(data);
60
+ },
61
+ get children() {
62
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
63
+ get each() {
64
+ return Object.entries(data ?? {});
65
+ },
66
+ children: ([key, value]) => (0, _alloy_js_core_jsx_runtime.createComponent)(YamlFileDataItem, {
67
+ key,
68
+ value
69
+ })
70
+ });
71
+ }
72
+ })];
73
+ }
74
+ /**
75
+ * A base component representing a Powerlines generated YAML source file.
76
+ *
77
+ * @remarks
78
+ * The file content can be provided either through the `data` prop, which accepts a nested object representing the YAML structure, or through the `children` prop, which allows for custom YAML content to be rendered. The `header` prop can be used to provide custom header content for the YAML file, which is rendered above the generated file header warning and generation comment.
79
+ *
80
+ * @param props - The properties for the source file.
81
+ * @returns The rendered source file component.
82
+ */
83
+ function YamlFile(props) {
84
+ const [{ children, path, data, header }, rest] = (0, _alloy_js_core.splitProps)(props, [
85
+ "children",
86
+ "path",
87
+ "data",
88
+ "header"
89
+ ]);
90
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_source_file.SourceFile, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
91
+ path,
92
+ get header() {
93
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(YamlFileHeader, { children: header });
94
+ },
95
+ filetype: "yaml",
96
+ get children() {
97
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
98
+ get when() {
99
+ return Boolean(data);
100
+ },
101
+ get children() {
102
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(YamlFileData, { data });
103
+ }
104
+ }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
105
+ get when() {
106
+ return Boolean(children);
107
+ },
108
+ get children() {
109
+ return [children, (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
110
+ }
111
+ })];
112
+ }
113
+ }));
114
+ }
115
+ /**
116
+ * Renders the header for a Powerlines YAML source file.
117
+ *
118
+ * @param props - The properties for the source file header.
119
+ * @returns The rendered source file header.
120
+ */
121
+ function YamlFileHeader(props) {
122
+ const { children } = props;
123
+ const context = require_core_contexts_context.usePowerlinesSafe();
124
+ return [
125
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
126
+ get when() {
127
+ return Boolean(children);
128
+ },
129
+ get children() {
130
+ return [children, (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
131
+ }
132
+ }),
133
+ (0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_single_line_comment.SingleLineComment, { get children() {
134
+ return `Generated by ${(0, _stryke_string_format_title_case.titleCase)(context?.config?.framework) || "Powerlines"}`;
135
+ } }),
136
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
137
+ (0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_single_line_comment.SingleLineComment, {
138
+ variant: "yaml",
139
+ get children() {
140
+ return (0, powerlines_utils.getFileHeaderWarning)(context);
141
+ }
142
+ }),
143
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
144
+ ];
145
+ }
146
+
147
+ //#endregion
148
+ exports.YamlFile = YamlFile;
149
+ exports.YamlFileHeader = YamlFileHeader;
@@ -1,2 +1,147 @@
1
- import{usePowerlinesSafe as e}from"../../core/contexts/context.mjs";import{SourceFile as t}from"../../core/components/source-file.mjs";import{SingleLineComment as n}from"../../core/components/single-line-comment.mjs";import{createComponent as r,createIntrinsic as i,memo as a,mergeProps as o}from"@alloy-js/core/jsx-runtime";import{For as s,Show as c,code as l,splitProps as u}from"@alloy-js/core";import{titleCase as d}from"@stryke/string-format/title-case";import{getFileHeaderWarning as f}from"powerlines/utils";import{isSetObject as p}from"@stryke/type-checks";function m({key:e,value:t}){return[r(c,{get when(){return!!e},children:l`${e}:`}),r(c,{when:typeof t==`string`||typeof t==`number`||typeof t==`boolean`,get children(){return l` ${String(t)}`}}),r(c,{get when(){return a(()=>!!p(t))()&&!Array.isArray(t)},get children(){return r(s,{get each(){return Object.entries(t)},children:([e,t])=>r(m,{key:e,value:t})})}}),r(c,{get when(){return Array.isArray(t)},get children(){return r(s,{each:t,children:e=>r(m,{value:e})})}})]}function h({data:e}){return[r(c,{get when(){return!!e},get children(){return r(s,{get each(){return Object.entries(e??{})},children:([e,t])=>r(m,{key:e,value:t})})}})]}function g(e){let[{children:n,path:a,data:s,header:l},d]=u(e,[`children`,`path`,`data`,`header`]);return r(t,o(d,{path:a,get header(){return r(_,{children:l})},filetype:`yaml`,get children(){return[r(c,{get when(){return!!s},get children(){return r(h,{data:s})}}),r(c,{get when(){return!!n},get children(){return[n,i(`hbr`,{})]}})]}}))}function _(t){let{children:a}=t,o=e();return[r(c,{get when(){return!!a},get children(){return[a,i(`hbr`,{})]}}),r(n,{get children(){return`Generated by ${d(o?.config?.framework)||`Powerlines`}`}}),i(`hbr`,{}),r(n,{variant:`yaml`,get children(){return f(o)}}),i(`hbr`,{})]}export{g as YamlFile,_ as YamlFileHeader};
1
+ import { usePowerlinesSafe } from "../../core/contexts/context.mjs";
2
+ import { SourceFile } from "../../core/components/source-file.mjs";
3
+ import { SingleLineComment } from "../../core/components/single-line-comment.mjs";
4
+ import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
5
+ import { For, Show, code, splitProps } from "@alloy-js/core";
6
+ import { titleCase } from "@stryke/string-format/title-case";
7
+ import { getFileHeaderWarning } from "powerlines/utils";
8
+ import { isSetObject } from "@stryke/type-checks";
9
+
10
+ //#region src/yaml/components/yaml-file.tsx
11
+ function YamlFileDataItem({ key, value }) {
12
+ return [
13
+ createComponent(Show, {
14
+ get when() {
15
+ return Boolean(key);
16
+ },
17
+ children: code`${key}:`
18
+ }),
19
+ createComponent(Show, {
20
+ when: typeof value === "string" || typeof value === "number" || typeof value === "boolean",
21
+ get children() {
22
+ return code` ${String(value)}`;
23
+ }
24
+ }),
25
+ createComponent(Show, {
26
+ get when() {
27
+ return memo(() => !!isSetObject(value))() && !Array.isArray(value);
28
+ },
29
+ get children() {
30
+ return createComponent(For, {
31
+ get each() {
32
+ return Object.entries(value);
33
+ },
34
+ children: ([nestedKey, nestedValue]) => createComponent(YamlFileDataItem, {
35
+ key: nestedKey,
36
+ value: nestedValue
37
+ })
38
+ });
39
+ }
40
+ }),
41
+ createComponent(Show, {
42
+ get when() {
43
+ return Array.isArray(value);
44
+ },
45
+ get children() {
46
+ return createComponent(For, {
47
+ each: value,
48
+ children: (item) => createComponent(YamlFileDataItem, { value: item })
49
+ });
50
+ }
51
+ })
52
+ ];
53
+ }
54
+ function YamlFileData({ data }) {
55
+ return [createComponent(Show, {
56
+ get when() {
57
+ return Boolean(data);
58
+ },
59
+ get children() {
60
+ return createComponent(For, {
61
+ get each() {
62
+ return Object.entries(data ?? {});
63
+ },
64
+ children: ([key, value]) => createComponent(YamlFileDataItem, {
65
+ key,
66
+ value
67
+ })
68
+ });
69
+ }
70
+ })];
71
+ }
72
+ /**
73
+ * A base component representing a Powerlines generated YAML source file.
74
+ *
75
+ * @remarks
76
+ * The file content can be provided either through the `data` prop, which accepts a nested object representing the YAML structure, or through the `children` prop, which allows for custom YAML content to be rendered. The `header` prop can be used to provide custom header content for the YAML file, which is rendered above the generated file header warning and generation comment.
77
+ *
78
+ * @param props - The properties for the source file.
79
+ * @returns The rendered source file component.
80
+ */
81
+ function YamlFile(props) {
82
+ const [{ children, path, data, header }, rest] = splitProps(props, [
83
+ "children",
84
+ "path",
85
+ "data",
86
+ "header"
87
+ ]);
88
+ return createComponent(SourceFile, mergeProps(rest, {
89
+ path,
90
+ get header() {
91
+ return createComponent(YamlFileHeader, { children: header });
92
+ },
93
+ filetype: "yaml",
94
+ get children() {
95
+ return [createComponent(Show, {
96
+ get when() {
97
+ return Boolean(data);
98
+ },
99
+ get children() {
100
+ return createComponent(YamlFileData, { data });
101
+ }
102
+ }), createComponent(Show, {
103
+ get when() {
104
+ return Boolean(children);
105
+ },
106
+ get children() {
107
+ return [children, createIntrinsic("hbr", {})];
108
+ }
109
+ })];
110
+ }
111
+ }));
112
+ }
113
+ /**
114
+ * Renders the header for a Powerlines YAML source file.
115
+ *
116
+ * @param props - The properties for the source file header.
117
+ * @returns The rendered source file header.
118
+ */
119
+ function YamlFileHeader(props) {
120
+ const { children } = props;
121
+ const context = usePowerlinesSafe();
122
+ return [
123
+ createComponent(Show, {
124
+ get when() {
125
+ return Boolean(children);
126
+ },
127
+ get children() {
128
+ return [children, createIntrinsic("hbr", {})];
129
+ }
130
+ }),
131
+ createComponent(SingleLineComment, { get children() {
132
+ return `Generated by ${titleCase(context?.config?.framework) || "Powerlines"}`;
133
+ } }),
134
+ createIntrinsic("hbr", {}),
135
+ createComponent(SingleLineComment, {
136
+ variant: "yaml",
137
+ get children() {
138
+ return getFileHeaderWarning(context);
139
+ }
140
+ }),
141
+ createIntrinsic("hbr", {})
142
+ ];
143
+ }
144
+
145
+ //#endregion
146
+ export { YamlFile, YamlFileHeader };
2
147
  //# sourceMappingURL=yaml-file.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"yaml-file.mjs","names":[],"sources":["../../../src/yaml/components/yaml-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 type { Children } from \"@alloy-js/core\";\nimport { code, For, Show, splitProps } from \"@alloy-js/core\";\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\";\n\nexport interface YamlData {\n [key: string]: string | number | boolean | YamlData | YamlData[];\n}\n\ninterface YamlFileDataItemProps {\n value: string | number | boolean | YamlData | YamlData[];\n key?: string;\n}\n\nfunction YamlFileDataItem({ key, value }: YamlFileDataItemProps) {\n return (\n <>\n <Show when={Boolean(key)}>{code`${key}:`}</Show>\n <Show\n when={\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\"\n }>\n {code` ${String(value)}`}\n </Show>\n <Show when={isSetObject(value) && !Array.isArray(value)}>\n <For each={Object.entries(value as YamlData)}>\n {([nestedKey, nestedValue]) => (\n <YamlFileDataItem key={nestedKey} value={nestedValue} />\n )}\n </For>\n </Show>\n <Show when={Array.isArray(value)}>\n <For each={value as YamlData[]}>\n {item => <YamlFileDataItem value={item} />}\n </For>\n </Show>\n </>\n );\n}\n\ninterface YamlFileDataProps {\n data?: YamlData;\n}\n\nfunction YamlFileData({ data }: YamlFileDataProps) {\n return (\n <>\n <Show when={Boolean(data)}>\n <For each={Object.entries(data ?? {})}>\n {([key, value]) => <YamlFileDataItem key={key} value={value} />}\n </For>\n </Show>\n </>\n );\n}\n\nexport type YamlFileProps = Omit<SourceFileProps, \"filetype\"> &\n ComponentProps & {\n header?: Children;\n data?: YamlData;\n };\n\n/**\n * A base component representing a Powerlines generated YAML source file.\n *\n * @remarks\n * The file content can be provided either through the `data` prop, which accepts a nested object representing the YAML structure, or through the `children` prop, which allows for custom YAML content to be rendered. The `header` prop can be used to provide custom header content for the YAML file, which is rendered above the generated file header warning and generation comment.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function YamlFile(props: YamlFileProps) {\n const [{ children, path, data, header }, rest] = splitProps(props, [\n \"children\",\n \"path\",\n \"data\",\n \"header\"\n ]);\n\n return (\n <SourceFile\n {...rest}\n path={path}\n header={<YamlFileHeader>{header}</YamlFileHeader>}\n filetype=\"yaml\">\n <Show when={Boolean(data)}>\n <YamlFileData data={data} />\n </Show>\n <Show when={Boolean(children)}>\n <>\n {children}\n <hbr />\n </>\n </Show>\n </SourceFile>\n );\n}\n\n/**\n * Renders the header for a Powerlines YAML source file.\n *\n * @param props - The properties for the source file header.\n * @returns The rendered source file header.\n */\nexport function YamlFileHeader(props: SourceFileHeaderProps) {\n const { children } = props;\n\n const context = usePowerlinesSafe();\n\n return (\n <>\n <Show when={Boolean(children)}>\n <>\n {children}\n <hbr />\n </>\n </Show>\n <SingleLineComment>{`Generated by ${\n titleCase(context?.config?.framework) || \"Powerlines\"\n }`}</SingleLineComment>\n <hbr />\n <SingleLineComment variant=\"yaml\">\n {getFileHeaderWarning(context!)}\n </SingleLineComment>\n <hbr />\n </>\n );\n}\n"],"mappings":"ikBA4BA,MACE,SACF,aAEA,IAAA,MAAU,CACR,MAAO,EAAS,GAElB,SAAA,CAAA,GAAA,EAAA,UAEA,KAAS,OAAA,GAAkB,UAAY,OAAG,GAAA,UAAuB,OAAA,GAAA,UAC/D,IAAM,UAAC,CACJ,MAAA,EAAA,KAAA,OAAA,EAAA,IAEF,CAAC,CAAE,EAAC,EAAA,CACH,IAAI,MAAK,CACP,OAAI,MAAgB,CAAC,CAAC,EAAS,EAAA,CAAA,EAAA,EAAA,CAAA,MAAA,QAAA,EAAA,EAEjC,IAAI,UAAS,CACX,OAAG,EAAA,EAAA,CACD,IAAC,MAAS,CACV,OAAI,OAAA,QAAA,EAAA,EAEJ,UAAW,CAAA,EAAO,KAAiB,EAAU,EAAA,CAC3C,IAAG,EACH,MAAG,EACJ,CAAC,CACH,CAAC,EAEL,CAAC,CAAE,EAAkB,EAAA,CACpB,IAAI,MAAK,CACP,OAAK,MAAQ,QAAC,EAAA,EAEhB,IAAI,UAAI,CACN,OAAA,EAAA,EAAA,CACH,KAAA,EACH,SAAA,GAAA,EAAA,EAAA,CAAA,MAAA,EAES,CAAC,CACH,CAAC,KAIR,SAAS,EAAA,CACP,QACC,CACD,MAAO,CAAA,EAAiB,EAAQ,CAC9B,IAAI,MAAK,CACP,MAAO,EAAA,GAET,IAAE,UAAA,CACH,OAAA,EAAA,EAAA,CACH,IAAA,MAAA,+BAGE,UAAiB,CAAA,EAAA,KAAA,EAAA,EAAA,CACN,MACF,QACR,CAAA,IAGA,CAAC,CAAC,CAWL,SAAU,EAAA,EAAA,CACR,GAAG,CAAI,CACL,WACA,OAAA,OAEF,UACG,GAAA,EAAA,EAAA,CAAA,WAAA,OAAA,OAAA,SAAA,CAAA,CACH,OAAO,EAAK,EAAA,EAAA,EAAA,CACJ,OACN,IAAE,QAAS,CACT,OAAA,EAAe,EAAA,CACd,SAAW,EACX,CAAC,EAEJ,SAAQ,OACR,IAAI,UAAC,CACH,MAAK,CAAA,EAAQ,EAAA,CACX,IAAG,MAAK,CACN,MAAA,EAAA,GAEJ,IAAA,UAAU,CACb,OAAA,EAAA,EAAA,CACH,OAAA,CAAA,EAGG,CAAA,CAAO,EAAkB,EAAA,CAC3B,IAAA,MAAA,CACS,MAAO,EAAK,GAEpB,IAAA,UAAA,CACK,MAAS,CAAA,EAAA,EAAsB,MAAA,EAAA,CAAA,CAAA,SAatC,SAAO,EAAoB,EAAU,CACnC,GAAM,CACJ,YACE,EACC,EAAA,GAA2B,CAChC,MAAO,CAAA,EAAA,EAAqB,CAC1B,IAAI,MAAA,CACF,MAAM,EAAA,GAET,IAAA,UAAA,CACH,MAAA,CAAA,EAAA,EAAA,MAAA,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"yaml-file.mjs","names":[],"sources":["../../../src/yaml/components/yaml-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 type { Children } from \"@alloy-js/core\";\nimport { code, For, Show, splitProps } from \"@alloy-js/core\";\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\";\n\nexport interface YamlData {\n [key: string]: string | number | boolean | YamlData | YamlData[];\n}\n\ninterface YamlFileDataItemProps {\n value: string | number | boolean | YamlData | YamlData[];\n key?: string;\n}\n\nfunction YamlFileDataItem({ key, value }: YamlFileDataItemProps) {\n return (\n <>\n <Show when={Boolean(key)}>{code`${key}:`}</Show>\n <Show\n when={\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\"\n }>\n {code` ${String(value)}`}\n </Show>\n <Show when={isSetObject(value) && !Array.isArray(value)}>\n <For each={Object.entries(value as YamlData)}>\n {([nestedKey, nestedValue]) => (\n <YamlFileDataItem key={nestedKey} value={nestedValue} />\n )}\n </For>\n </Show>\n <Show when={Array.isArray(value)}>\n <For each={value as YamlData[]}>\n {item => <YamlFileDataItem value={item} />}\n </For>\n </Show>\n </>\n );\n}\n\ninterface YamlFileDataProps {\n data?: YamlData;\n}\n\nfunction YamlFileData({ data }: YamlFileDataProps) {\n return (\n <>\n <Show when={Boolean(data)}>\n <For each={Object.entries(data ?? {})}>\n {([key, value]) => <YamlFileDataItem key={key} value={value} />}\n </For>\n </Show>\n </>\n );\n}\n\nexport type YamlFileProps = Omit<SourceFileProps, \"filetype\"> &\n ComponentProps & {\n header?: Children;\n data?: YamlData;\n };\n\n/**\n * A base component representing a Powerlines generated YAML source file.\n *\n * @remarks\n * The file content can be provided either through the `data` prop, which accepts a nested object representing the YAML structure, or through the `children` prop, which allows for custom YAML content to be rendered. The `header` prop can be used to provide custom header content for the YAML file, which is rendered above the generated file header warning and generation comment.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function YamlFile(props: YamlFileProps) {\n const [{ children, path, data, header }, rest] = splitProps(props, [\n \"children\",\n \"path\",\n \"data\",\n \"header\"\n ]);\n\n return (\n <SourceFile\n {...rest}\n path={path}\n header={<YamlFileHeader>{header}</YamlFileHeader>}\n filetype=\"yaml\">\n <Show when={Boolean(data)}>\n <YamlFileData data={data} />\n </Show>\n <Show when={Boolean(children)}>\n <>\n {children}\n <hbr />\n </>\n </Show>\n </SourceFile>\n );\n}\n\n/**\n * Renders the header for a Powerlines YAML source file.\n *\n * @param props - The properties for the source file header.\n * @returns The rendered source file header.\n */\nexport function YamlFileHeader(props: SourceFileHeaderProps) {\n const { children } = props;\n\n const context = usePowerlinesSafe();\n\n return (\n <>\n <Show when={Boolean(children)}>\n <>\n {children}\n <hbr />\n </>\n </Show>\n <SingleLineComment>{`Generated by ${\n titleCase(context?.config?.framework) || \"Powerlines\"\n }`}</SingleLineComment>\n <hbr />\n <SingleLineComment variant=\"yaml\">\n {getFileHeaderWarning(context!)}\n </SingleLineComment>\n <hbr />\n </>\n );\n}\n"],"mappings":";;;;;;;;;;4BA4BA,KACE,SACF;;;GAEA,IAAA,OAAU;AACR,WAAO,QAAS,IAAO;;GAEzB,UAAA,IAAA,GAAA,IAAA;;;GAEA,MAAS,OAAA,UAAkB,YAAY,OAAG,UAAA,YAAuB,OAAA,UAAA;GAC/D,IAAM,WAAC;AACJ,WAAA,IAAA,KAAA,OAAA,MAAA;;GAEF,CAAC;EAAE,gBAAC,MAAA;GACH,IAAI,OAAK;AACP,WAAI,WAAgB,CAAC,CAAC,YAAS,MAAA,CAAA,EAAA,IAAA,CAAA,MAAA,QAAA,MAAA;;GAEjC,IAAI,WAAS;AACX,WAAG,gBAAA,KAAA;KACD,IAAC,OAAS;AACV,aAAI,OAAA,QAAA,MAAA;;KAEJ,WAAW,CAAA,WAAO,iBAAiB,gBAAU,kBAAA;MAC3C,KAAG;MACH,OAAG;MACJ,CAAC;KACH,CAAC;;GAEL,CAAC;EAAE,gBAAkB,MAAA;GACpB,IAAI,OAAK;AACP,WAAK,MAAQ,QAAC,MAAA;;GAEhB,IAAI,WAAI;AACN,WAAA,gBAAA,KAAA;KACH,MAAA;KACH,WAAA,SAAA,gBAAA,kBAAA,eAES,CAAC;KACH,CAAC;;;;;AAIR,SAAS,aAAA,EACP,QACC;AACD,QAAO,CAAA,gBAAiB,MAAQ;EAC9B,IAAI,OAAK;AACP,UAAO,QAAA,KAAA;;EAET,IAAE,WAAA;AACH,UAAA,gBAAA,KAAA;IACH,IAAA,OAAA;;;IAGE,WAAiB,CAAA,KAAA,WAAA,gBAAA,kBAAA;KACN;KACF;KACR,CAAA;;;EAGA,CAAC,CAAC;;;;;;;;;;;AAWL,SAAU,SAAA,OAAA;CACR,MAAG,CAAI,EACL,UACA,YAEF,UACG,QAAA,WAAA,OAAA;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA;AACH,QAAO,gBAAK,YAAA,WAAA,MAAA;EACJ;EACN,IAAE,SAAS;AACT,UAAA,gBAAe,gBAAA,EACd,UAAW,QACX,CAAC;;EAEJ,UAAQ;EACR,IAAI,WAAC;AACH,UAAK,CAAA,gBAAQ,MAAA;IACX,IAAG,OAAK;AACN,YAAA,QAAA,KAAA;;IAEJ,IAAA,WAAU;AACb,YAAA,gBAAA,cAAA,EACH;;IAGG,CAAA,EAAO,gBAAkB,MAAA;IAC3B,IAAA,OAAA;AACS,YAAO,QAAK,SAAW;;IAE/B,IAAA,WAAA;AACK,YAAS,CAAA,UAAA,gBAAsB,OAAA,EAAA,CAAA,CAAA;;;;;;;;;;;;AAatC,SAAO,eAAoB,OAAU;CACnC,MAAM,EACJ,aACE;CACJ,MAAK,UAAA,mBAA2B;AAChC,QAAO;EAAA,gBAAA,MAAqB;GAC1B,IAAI,OAAA;AACF,WAAM,QAAA,SAAA;;GAET,IAAA,WAAA;AACH,WAAA,CAAA,UAAA,gBAAA,OAAA,EAAA,CAAA,CAAA"}
@@ -1 +1,6 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./components/yaml-file.cjs`);require(`./components/index.cjs`),exports.YamlFile=e.YamlFile,exports.YamlFileHeader=e.YamlFileHeader;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_yaml_components_yaml_file = require('./components/yaml-file.cjs');
3
+ require('./components/index.cjs');
4
+
5
+ exports.YamlFile = require_yaml_components_yaml_file.YamlFile;
6
+ exports.YamlFileHeader = require_yaml_components_yaml_file.YamlFileHeader;
@@ -1 +1,4 @@
1
- import{YamlFile as e,YamlFileHeader as t}from"./components/yaml-file.mjs";import"./components/index.mjs";export{e as YamlFile,t as YamlFileHeader};
1
+ import { YamlFile, YamlFileHeader } from "./components/yaml-file.mjs";
2
+ import "./components/index.mjs";
3
+
4
+ export { YamlFile, YamlFileHeader };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-alloy",
3
- "version": "0.26.75",
3
+ "version": "0.26.77",
4
4
  "type": "module",
5
5
  "description": "A package containing various Alloy framework components and helper utilities.",
6
6
  "repository": {
@@ -908,8 +908,8 @@
908
908
  "@alloy-js/json": "0.23.0-dev.2",
909
909
  "@alloy-js/markdown": "0.23.0-dev.1",
910
910
  "@alloy-js/typescript": "0.23.0-dev.4",
911
- "@powerlines/deepkit": "^0.8.57",
912
- "@powerlines/plugin-babel": "^0.12.449",
911
+ "@powerlines/deepkit": "^0.8.59",
912
+ "@powerlines/plugin-babel": "^0.12.451",
913
913
  "@storm-software/config-tools": "^1.190.1",
914
914
  "@stryke/capnp": "^0.12.96",
915
915
  "@stryke/convert": "^0.7.3",
@@ -922,15 +922,15 @@
922
922
  "@stryke/types": "^0.12.0",
923
923
  "@stryke/unique-id": "^0.3.81",
924
924
  "defu": "^6.1.7",
925
- "powerlines": "^0.46.3",
925
+ "powerlines": "^0.46.5",
926
926
  "prettier": "^3.8.3",
927
927
  "unctx": "^2.5.0"
928
928
  },
929
929
  "devDependencies": {
930
- "@powerlines/plugin-plugin": "^0.12.407",
930
+ "@powerlines/plugin-plugin": "^0.12.409",
931
931
  "@types/node": "^25.6.0"
932
932
  },
933
933
  "peerDependencies": { "@babel/preset-typescript": ">=8.0.0-rc4" },
934
934
  "publishConfig": { "access": "public" },
935
- "gitHead": "9a51041e0817e438c49db05bb757b3bdbaf497ef"
935
+ "gitHead": "9af888c54e58a82744cc334a6b80da52429fa0ac"
936
936
  }