@powerlines/plugin-alloy 0.26.76 → 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,2 +1,37 @@
1
- import{createNamedContext as e,useContext as t}from"@alloy-js/core";const n=e(`Powerlines`);function r(){return t(n)}function i(){return r()??void 0}function a(){let e=i();if(!e)throw Error("Powerlines - Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");return e}export{n as PowerlinesContext,a as usePowerlines,r as usePowerlinesContext,i as usePowerlinesSafe};
1
+ import { createNamedContext, useContext } from "@alloy-js/core";
2
+
3
+ //#region src/core/contexts/context.ts
4
+ /**
5
+ * The Powerlines context used in template rendering.
6
+ */
7
+ const PowerlinesContext = createNamedContext("Powerlines");
8
+ /**
9
+ * Hook to access the Powerlines Context.
10
+ *
11
+ * @returns The Context.
12
+ */
13
+ function usePowerlinesContext() {
14
+ return useContext(PowerlinesContext);
15
+ }
16
+ /**
17
+ * Hook to safely access the {@link PluginContext | Powerlines context}.
18
+ *
19
+ * @returns The Powerlines context or undefined if not set.
20
+ */
21
+ function usePowerlinesSafe() {
22
+ return usePowerlinesContext() ?? void 0;
23
+ }
24
+ /**
25
+ * Hook to access the {@link PluginContext | Powerlines context}.
26
+ *
27
+ * @returns The Powerlines context.
28
+ */
29
+ function usePowerlines() {
30
+ const powerlines = usePowerlinesSafe();
31
+ if (!powerlines) throw new Error("Powerlines - Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
32
+ return powerlines;
33
+ }
34
+
35
+ //#endregion
36
+ export { PowerlinesContext, usePowerlines, usePowerlinesContext, usePowerlinesSafe };
2
37
  //# sourceMappingURL=context.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.mjs","names":[],"sources":["../../../src/core/contexts/context.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 {\n ComponentContext,\n createNamedContext,\n useContext\n} from \"@alloy-js/core\";\nimport type { PluginContext } from \"powerlines\";\n\n/**\n * The Powerlines context used in template rendering.\n */\nexport const PowerlinesContext: ComponentContext<PluginContext> =\n createNamedContext<PluginContext>(\"Powerlines\");\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function usePowerlinesContext<\n TContext extends PluginContext = PluginContext\n>(): TContext | undefined {\n return useContext(PowerlinesContext) as TContext | undefined;\n}\n\n/**\n * Hook to safely access the {@link PluginContext | Powerlines context}.\n *\n * @returns The Powerlines context or undefined if not set.\n */\nexport function usePowerlinesSafe<\n TContext extends PluginContext = PluginContext\n>(): TContext | undefined {\n const powerlines = usePowerlinesContext<TContext>();\n\n return powerlines ?? undefined;\n}\n\n/**\n * Hook to access the {@link PluginContext | Powerlines context}.\n *\n * @returns The Powerlines context.\n */\nexport function usePowerlines<\n TContext extends PluginContext = PluginContext\n>(): TContext {\n const powerlines = usePowerlinesSafe<TContext>();\n if (!powerlines) {\n throw new Error(\n \"Powerlines - Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return powerlines;\n}\n"],"mappings":"oEAsBA,MAAS,EAAc,EAAA,aAAA,CAOvB,SAAE,GAAmC,aASrC,SAAgB,GAAU,CAE1B,OADoB,GACpB,EAAA,IAAA,GAQA,SAAW,GAAqB,CAC9B,IAAG,EAAW,GAAU,CACxB,GAAA,CAAK,EAAA,MAAA,MAAA,sLAAA,CAGP,OAAA"}
1
+ {"version":3,"file":"context.mjs","names":[],"sources":["../../../src/core/contexts/context.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 {\n ComponentContext,\n createNamedContext,\n useContext\n} from \"@alloy-js/core\";\nimport type { PluginContext } from \"powerlines\";\n\n/**\n * The Powerlines context used in template rendering.\n */\nexport const PowerlinesContext: ComponentContext<PluginContext> =\n createNamedContext<PluginContext>(\"Powerlines\");\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function usePowerlinesContext<\n TContext extends PluginContext = PluginContext\n>(): TContext | undefined {\n return useContext(PowerlinesContext) as TContext | undefined;\n}\n\n/**\n * Hook to safely access the {@link PluginContext | Powerlines context}.\n *\n * @returns The Powerlines context or undefined if not set.\n */\nexport function usePowerlinesSafe<\n TContext extends PluginContext = PluginContext\n>(): TContext | undefined {\n const powerlines = usePowerlinesContext<TContext>();\n\n return powerlines ?? undefined;\n}\n\n/**\n * Hook to access the {@link PluginContext | Powerlines context}.\n *\n * @returns The Powerlines context.\n */\nexport function usePowerlines<\n TContext extends PluginContext = PluginContext\n>(): TContext {\n const powerlines = usePowerlinesSafe<TContext>();\n if (!powerlines) {\n throw new Error(\n \"Powerlines - Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return powerlines;\n}\n"],"mappings":";;;;;;AAsBA,MAAS,oBAAc,mBAAA,aAAA;;;;;;AAOvB,SAAE,uBAAmC;;;;;;;;AASrC,SAAgB,oBAAU;AAE1B,QADoB,sBACpB,IAAA;;;;;;;AAQA,SAAW,gBAAqB;CAC9B,MAAG,aAAW,mBAAU;AACxB,KAAA,CAAK;AAGP,QAAA"}
@@ -1 +1,22 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./context.cjs`),t=require(`./meta.cjs`),n=require(`./reflection.cjs`);exports.MetaContext=t.MetaContext,exports.PowerlinesContext=e.PowerlinesContext,exports.ReflectionClassContext=n.ReflectionClassContext,exports.ReflectionMethodContext=n.ReflectionMethodContext,exports.ReflectionParameterContext=n.ReflectionParameterContext,exports.ReflectionPropertyContext=n.ReflectionPropertyContext,exports.useMeta=t.useMeta,exports.useMetaContext=t.useMetaContext,exports.useMetaSafe=t.useMetaSafe,exports.usePowerlines=e.usePowerlines,exports.usePowerlinesContext=e.usePowerlinesContext,exports.usePowerlinesSafe=e.usePowerlinesSafe,exports.useReflectionClass=n.useReflectionClass,exports.useReflectionMethod=n.useReflectionMethod,exports.useReflectionParameter=n.useReflectionParameter,exports.useReflectionProperty=n.useReflectionProperty,exports.useReflectionPropertyContext=n.useReflectionPropertyContext;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_core_contexts_context = require('./context.cjs');
3
+ const require_core_contexts_meta = require('./meta.cjs');
4
+ const require_core_contexts_reflection = require('./reflection.cjs');
5
+
6
+ exports.MetaContext = require_core_contexts_meta.MetaContext;
7
+ exports.PowerlinesContext = require_core_contexts_context.PowerlinesContext;
8
+ exports.ReflectionClassContext = require_core_contexts_reflection.ReflectionClassContext;
9
+ exports.ReflectionMethodContext = require_core_contexts_reflection.ReflectionMethodContext;
10
+ exports.ReflectionParameterContext = require_core_contexts_reflection.ReflectionParameterContext;
11
+ exports.ReflectionPropertyContext = require_core_contexts_reflection.ReflectionPropertyContext;
12
+ exports.useMeta = require_core_contexts_meta.useMeta;
13
+ exports.useMetaContext = require_core_contexts_meta.useMetaContext;
14
+ exports.useMetaSafe = require_core_contexts_meta.useMetaSafe;
15
+ exports.usePowerlines = require_core_contexts_context.usePowerlines;
16
+ exports.usePowerlinesContext = require_core_contexts_context.usePowerlinesContext;
17
+ exports.usePowerlinesSafe = require_core_contexts_context.usePowerlinesSafe;
18
+ exports.useReflectionClass = require_core_contexts_reflection.useReflectionClass;
19
+ exports.useReflectionMethod = require_core_contexts_reflection.useReflectionMethod;
20
+ exports.useReflectionParameter = require_core_contexts_reflection.useReflectionParameter;
21
+ exports.useReflectionProperty = require_core_contexts_reflection.useReflectionProperty;
22
+ exports.useReflectionPropertyContext = require_core_contexts_reflection.useReflectionPropertyContext;
@@ -1 +1,5 @@
1
- import{PowerlinesContext as e,usePowerlines as t,usePowerlinesContext as n,usePowerlinesSafe as r}from"./context.mjs";import{MetaContext as i,useMeta as a,useMetaContext as o,useMetaSafe as s}from"./meta.mjs";import{ReflectionClassContext as c,ReflectionMethodContext as l,ReflectionParameterContext as u,ReflectionPropertyContext as d,useReflectionClass as f,useReflectionMethod as p,useReflectionParameter as m,useReflectionProperty as h,useReflectionPropertyContext as g}from"./reflection.mjs";export{i as MetaContext,e as PowerlinesContext,c as ReflectionClassContext,l as ReflectionMethodContext,u as ReflectionParameterContext,d as ReflectionPropertyContext,a as useMeta,o as useMetaContext,s as useMetaSafe,t as usePowerlines,n as usePowerlinesContext,r as usePowerlinesSafe,f as useReflectionClass,p as useReflectionMethod,m as useReflectionParameter,h as useReflectionProperty,g as useReflectionPropertyContext};
1
+ import { PowerlinesContext, usePowerlines, usePowerlinesContext, usePowerlinesSafe } from "./context.mjs";
2
+ import { MetaContext, useMeta, useMetaContext, useMetaSafe } from "./meta.mjs";
3
+ import { ReflectionClassContext, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty, useReflectionPropertyContext } from "./reflection.mjs";
4
+
5
+ export { MetaContext, PowerlinesContext, ReflectionClassContext, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, useMeta, useMetaContext, useMetaSafe, usePowerlines, usePowerlinesContext, usePowerlinesSafe, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty, useReflectionPropertyContext };
@@ -1 +1,41 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`@alloy-js/core`);const t=(0,e.createNamedContext)(`Meta`);function n(){return(0,e.useContext)(t)}function r(){return n()??void 0}function i(){let e=r();if(!e)throw Error("Powerlines metadata is not available in the rendering context. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");return e}exports.MetaContext=t,exports.useMeta=i,exports.useMetaContext=n,exports.useMetaSafe=r;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
+ let _alloy_js_core = require("@alloy-js/core");
4
+
5
+ //#region src/core/contexts/meta.ts
6
+ /**
7
+ * The Powerlines meta context used to determine metadata of files generated during rendering.
8
+ */
9
+ const MetaContext = (0, _alloy_js_core.createNamedContext)("Meta");
10
+ /**
11
+ * Hook to access the Powerlines Context.
12
+ *
13
+ * @returns The Context.
14
+ */
15
+ function useMetaContext() {
16
+ return (0, _alloy_js_core.useContext)(MetaContext);
17
+ }
18
+ /**
19
+ * Hook to safely access the render context's metadata.
20
+ *
21
+ * @returns The Powerlines context or undefined if not set.
22
+ */
23
+ function useMetaSafe() {
24
+ return useMetaContext() ?? void 0;
25
+ }
26
+ /**
27
+ * Hook to access the render context's metadata.
28
+ *
29
+ * @returns The Powerlines context.
30
+ */
31
+ function useMeta() {
32
+ const meta = useMetaSafe();
33
+ if (!meta) throw new Error("Powerlines metadata is not available in the rendering context. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
34
+ return meta;
35
+ }
36
+
37
+ //#endregion
38
+ exports.MetaContext = MetaContext;
39
+ exports.useMeta = useMeta;
40
+ exports.useMetaContext = useMetaContext;
41
+ exports.useMetaSafe = useMetaSafe;
@@ -1,2 +1,37 @@
1
- import{createNamedContext as e,useContext as t}from"@alloy-js/core";const n=e(`Meta`);function r(){return t(n)}function i(){return r()??void 0}function a(){let e=i();if(!e)throw Error("Powerlines metadata is not available in the rendering context. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");return e}export{n as MetaContext,a as useMeta,r as useMetaContext,i as useMetaSafe};
1
+ import { createNamedContext, useContext } from "@alloy-js/core";
2
+
3
+ //#region src/core/contexts/meta.ts
4
+ /**
5
+ * The Powerlines meta context used to determine metadata of files generated during rendering.
6
+ */
7
+ const MetaContext = createNamedContext("Meta");
8
+ /**
9
+ * Hook to access the Powerlines Context.
10
+ *
11
+ * @returns The Context.
12
+ */
13
+ function useMetaContext() {
14
+ return useContext(MetaContext);
15
+ }
16
+ /**
17
+ * Hook to safely access the render context's metadata.
18
+ *
19
+ * @returns The Powerlines context or undefined if not set.
20
+ */
21
+ function useMetaSafe() {
22
+ return useMetaContext() ?? void 0;
23
+ }
24
+ /**
25
+ * Hook to access the render context's metadata.
26
+ *
27
+ * @returns The Powerlines context.
28
+ */
29
+ function useMeta() {
30
+ const meta = useMetaSafe();
31
+ if (!meta) throw new Error("Powerlines metadata is not available in the rendering context. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
32
+ return meta;
33
+ }
34
+
35
+ //#endregion
36
+ export { MetaContext, useMeta, useMetaContext, useMetaSafe };
2
37
  //# sourceMappingURL=meta.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"meta.mjs","names":[],"sources":["../../../src/core/contexts/meta.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 {\n ComponentContext,\n createNamedContext,\n useContext\n} from \"@alloy-js/core\";\nimport type { StoragePreset } from \"powerlines\";\n\nexport interface MetaItem {\n /**\n * The kind of metadata item.\n */\n kind?: \"builtin\" | \"entry\" | string;\n\n /**\n * Whether to skip formatting for this output.\n */\n skipFormat?: boolean;\n\n /**\n * The storage preset or adapter name for the output files.\n *\n * @remarks\n * If not specified, the output mode will be determined by the provided `output.mode` value.\n */\n storage?: StoragePreset | string;\n\n [key: string]: any;\n}\n\n/**\n * The Powerlines meta context used to determine metadata of files generated during rendering.\n */\nexport const MetaContext: ComponentContext<Record<string, MetaItem>> =\n createNamedContext<Record<string, MetaItem>>(\"Meta\");\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function useMetaContext(): Record<string, MetaItem> | undefined {\n return useContext(MetaContext);\n}\n\n/**\n * Hook to safely access the render context's metadata.\n *\n * @returns The Powerlines context or undefined if not set.\n */\nexport function useMetaSafe(): Record<string, MetaItem> | undefined {\n const meta = useMetaContext();\n\n return meta ?? undefined;\n}\n\n/**\n * Hook to access the render context's metadata.\n *\n * @returns The Powerlines context.\n */\nexport function useMeta(): Record<string, MetaItem> {\n const meta = useMetaSafe();\n if (!meta) {\n throw new Error(\n \"Powerlines metadata is not available in the rendering context. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return meta;\n}\n"],"mappings":"oEAsBA,MAAS,EAAc,EAAA,OAAA,CAOvB,SAAU,GAAqB,aAS/B,SAAG,GAAA,CAED,OADI,GACM,EAAA,IAAA,GAQZ,SAAO,GAAgB,CACrB,IAAA,EAAA,GAAA,CACF,GAAM,CAAC,EACL,MAAA,MAAkB,oNAAkC,CAEpD,OAAA"}
1
+ {"version":3,"file":"meta.mjs","names":[],"sources":["../../../src/core/contexts/meta.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 {\n ComponentContext,\n createNamedContext,\n useContext\n} from \"@alloy-js/core\";\nimport type { StoragePreset } from \"powerlines\";\n\nexport interface MetaItem {\n /**\n * The kind of metadata item.\n */\n kind?: \"builtin\" | \"entry\" | string;\n\n /**\n * Whether to skip formatting for this output.\n */\n skipFormat?: boolean;\n\n /**\n * The storage preset or adapter name for the output files.\n *\n * @remarks\n * If not specified, the output mode will be determined by the provided `output.mode` value.\n */\n storage?: StoragePreset | string;\n\n [key: string]: any;\n}\n\n/**\n * The Powerlines meta context used to determine metadata of files generated during rendering.\n */\nexport const MetaContext: ComponentContext<Record<string, MetaItem>> =\n createNamedContext<Record<string, MetaItem>>(\"Meta\");\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function useMetaContext(): Record<string, MetaItem> | undefined {\n return useContext(MetaContext);\n}\n\n/**\n * Hook to safely access the render context's metadata.\n *\n * @returns The Powerlines context or undefined if not set.\n */\nexport function useMetaSafe(): Record<string, MetaItem> | undefined {\n const meta = useMetaContext();\n\n return meta ?? undefined;\n}\n\n/**\n * Hook to access the render context's metadata.\n *\n * @returns The Powerlines context.\n */\nexport function useMeta(): Record<string, MetaItem> {\n const meta = useMetaSafe();\n if (!meta) {\n throw new Error(\n \"Powerlines metadata is not available in the rendering context. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return meta;\n}\n"],"mappings":";;;;;;AAsBA,MAAS,cAAc,mBAAA,OAAA;;;;;;AAOvB,SAAU,iBAAqB;;;;;;;;AAS/B,SAAG,cAAA;AAED,QADI,gBACM,IAAA;;;;;;;AAQZ,SAAO,UAAgB;CACrB,MAAA,OAAA,aAAA;AACF,KAAM,CAAC,KACL,OAAA,IAAA,MAAkB,oNAAkC;AAEpD,QAAA"}
@@ -1 +1,80 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`@alloy-js/core`);const t=(0,e.createContext)();function n(){let n=(0,e.useContext)(t);if(!n)throw Error("Powerlines - ReflectionClass Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");return n}const r=(0,e.createNamedContext)(`ReflectionProperty`);function i(){let t=(0,e.useContext)(r);if(!t)throw Error("Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");return t}function a(){let e=i();if(!e)throw Error("Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");return e}const o=(0,e.createNamedContext)(`ReflectionMethod`);function s(){let t=(0,e.useContext)(o);if(!t)throw Error("Powerlines - Reflection Method Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");return t}const c=(0,e.createNamedContext)(`ReflectionParameter`);function l(){return(0,e.useContext)(c)}exports.ReflectionClassContext=t,exports.ReflectionMethodContext=o,exports.ReflectionParameterContext=c,exports.ReflectionPropertyContext=r,exports.useReflectionClass=n,exports.useReflectionMethod=s,exports.useReflectionParameter=l,exports.useReflectionProperty=a,exports.useReflectionPropertyContext=i;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
+ let _alloy_js_core = require("@alloy-js/core");
4
+
5
+ //#region src/core/contexts/reflection.ts
6
+ /**
7
+ * The reflection class context used in template rendering.
8
+ */
9
+ const ReflectionClassContext = (0, _alloy_js_core.createContext)();
10
+ /**
11
+ * Hook to access the Reflection context.
12
+ *
13
+ * @returns A reactive version of the current reflection.
14
+ */
15
+ function useReflectionClass() {
16
+ const context = (0, _alloy_js_core.useContext)(ReflectionClassContext);
17
+ if (!context) throw new Error("Powerlines - ReflectionClass Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
18
+ return context;
19
+ }
20
+ /**
21
+ * The reflection property context used in template rendering.
22
+ */
23
+ const ReflectionPropertyContext = (0, _alloy_js_core.createNamedContext)("ReflectionProperty");
24
+ /**
25
+ * Hook to access the Reflection Property context.
26
+ *
27
+ * @returns A reactive version of the current reflection.
28
+ */
29
+ function useReflectionPropertyContext() {
30
+ const context = (0, _alloy_js_core.useContext)(ReflectionPropertyContext);
31
+ if (!context) throw new Error("Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
32
+ return context;
33
+ }
34
+ /**
35
+ * Hook to access the Reflection Property context.
36
+ *
37
+ * @returns A reactive version of the current reflection.
38
+ */
39
+ function useReflectionProperty() {
40
+ const context = useReflectionPropertyContext();
41
+ if (!context) throw new Error("Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
42
+ return context;
43
+ }
44
+ /**
45
+ * The reflection method context used in template rendering.
46
+ */
47
+ const ReflectionMethodContext = (0, _alloy_js_core.createNamedContext)("ReflectionMethod");
48
+ /**
49
+ * Hook to access the Reflection Method context.
50
+ *
51
+ * @returns A reactive version of the current reflection.
52
+ */
53
+ function useReflectionMethod() {
54
+ const context = (0, _alloy_js_core.useContext)(ReflectionMethodContext);
55
+ if (!context) throw new Error("Powerlines - Reflection Method Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
56
+ return context;
57
+ }
58
+ /**
59
+ * The reflection parameter context used in template rendering.
60
+ */
61
+ const ReflectionParameterContext = (0, _alloy_js_core.createNamedContext)("ReflectionParameter");
62
+ /**
63
+ * Hook to access the Reflection Parameter context.
64
+ *
65
+ * @returns A reactive version of the current reflection.
66
+ */
67
+ function useReflectionParameter() {
68
+ return (0, _alloy_js_core.useContext)(ReflectionParameterContext);
69
+ }
70
+
71
+ //#endregion
72
+ exports.ReflectionClassContext = ReflectionClassContext;
73
+ exports.ReflectionMethodContext = ReflectionMethodContext;
74
+ exports.ReflectionParameterContext = ReflectionParameterContext;
75
+ exports.ReflectionPropertyContext = ReflectionPropertyContext;
76
+ exports.useReflectionClass = useReflectionClass;
77
+ exports.useReflectionMethod = useReflectionMethod;
78
+ exports.useReflectionParameter = useReflectionParameter;
79
+ exports.useReflectionProperty = useReflectionProperty;
80
+ exports.useReflectionPropertyContext = useReflectionPropertyContext;
@@ -1,2 +1,71 @@
1
- import{createContext as e,createNamedContext as t,useContext as n}from"@alloy-js/core";const r=e();function i(){let e=n(r);if(!e)throw Error("Powerlines - ReflectionClass Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");return e}const a=t(`ReflectionProperty`);function o(){let e=n(a);if(!e)throw Error("Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");return e}function s(){let e=o();if(!e)throw Error("Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");return e}const c=t(`ReflectionMethod`);function l(){let e=n(c);if(!e)throw Error("Powerlines - Reflection Method Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");return e}const u=t(`ReflectionParameter`);function d(){return n(u)}export{r as ReflectionClassContext,c as ReflectionMethodContext,u as ReflectionParameterContext,a as ReflectionPropertyContext,i as useReflectionClass,l as useReflectionMethod,d as useReflectionParameter,s as useReflectionProperty,o as useReflectionPropertyContext};
1
+ import { createContext, createNamedContext, useContext } from "@alloy-js/core";
2
+
3
+ //#region src/core/contexts/reflection.ts
4
+ /**
5
+ * The reflection class context used in template rendering.
6
+ */
7
+ const ReflectionClassContext = createContext();
8
+ /**
9
+ * Hook to access the Reflection context.
10
+ *
11
+ * @returns A reactive version of the current reflection.
12
+ */
13
+ function useReflectionClass() {
14
+ const context = useContext(ReflectionClassContext);
15
+ if (!context) throw new Error("Powerlines - ReflectionClass Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
16
+ return context;
17
+ }
18
+ /**
19
+ * The reflection property context used in template rendering.
20
+ */
21
+ const ReflectionPropertyContext = createNamedContext("ReflectionProperty");
22
+ /**
23
+ * Hook to access the Reflection Property context.
24
+ *
25
+ * @returns A reactive version of the current reflection.
26
+ */
27
+ function useReflectionPropertyContext() {
28
+ const context = useContext(ReflectionPropertyContext);
29
+ if (!context) throw new Error("Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
30
+ return context;
31
+ }
32
+ /**
33
+ * Hook to access the Reflection Property context.
34
+ *
35
+ * @returns A reactive version of the current reflection.
36
+ */
37
+ function useReflectionProperty() {
38
+ const context = useReflectionPropertyContext();
39
+ if (!context) throw new Error("Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
40
+ return context;
41
+ }
42
+ /**
43
+ * The reflection method context used in template rendering.
44
+ */
45
+ const ReflectionMethodContext = createNamedContext("ReflectionMethod");
46
+ /**
47
+ * Hook to access the Reflection Method context.
48
+ *
49
+ * @returns A reactive version of the current reflection.
50
+ */
51
+ function useReflectionMethod() {
52
+ const context = useContext(ReflectionMethodContext);
53
+ if (!context) throw new Error("Powerlines - Reflection Method Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
54
+ return context;
55
+ }
56
+ /**
57
+ * The reflection parameter context used in template rendering.
58
+ */
59
+ const ReflectionParameterContext = createNamedContext("ReflectionParameter");
60
+ /**
61
+ * Hook to access the Reflection Parameter context.
62
+ *
63
+ * @returns A reactive version of the current reflection.
64
+ */
65
+ function useReflectionParameter() {
66
+ return useContext(ReflectionParameterContext);
67
+ }
68
+
69
+ //#endregion
70
+ export { ReflectionClassContext, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty, useReflectionPropertyContext };
2
71
  //# sourceMappingURL=reflection.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"reflection.mjs","names":[],"sources":["../../../src/core/contexts/reflection.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\";\nimport type {\n ReflectionClass,\n ReflectionMethod,\n ReflectionParameter,\n ReflectionProperty\n} from \"@powerlines/deepkit/vendor/type\";\nimport { ReflectionOverrideInterface } from \"../../types/components\";\n\nexport interface ReflectionClassContextInterface<\n T extends Record<string, any> = Record<string, any>\n> {\n reflection: ReflectionClass<T>;\n override?: ReflectionOverrideInterface<T>;\n}\n\n/**\n * The reflection class context used in template rendering.\n */\nexport const ReflectionClassContext: ComponentContext<\n ReflectionClassContextInterface<any>\n> = createContext<ReflectionClassContextInterface<any>>();\n\n/**\n * Hook to access the Reflection context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useReflectionClass<\n T extends Record<string, any> = Record<string, any>\n>() {\n const context = useContext<ReflectionClassContextInterface<T>>(\n ReflectionClassContext\n )!;\n\n if (!context) {\n throw new Error(\n \"Powerlines - ReflectionClass Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return context;\n}\n\nexport interface ReflectionPropertyContextInterface {\n property: ReflectionProperty;\n defaultValue?: any;\n}\n\n/**\n * The reflection property context used in template rendering.\n */\nexport const ReflectionPropertyContext: ComponentContext<ReflectionPropertyContextInterface> =\n createNamedContext<ReflectionPropertyContextInterface>(\"ReflectionProperty\");\n\n/**\n * Hook to access the Reflection Property context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useReflectionPropertyContext() {\n const context = useContext<ReflectionPropertyContextInterface>(\n ReflectionPropertyContext\n )!;\n\n if (!context) {\n throw new Error(\n \"Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return context;\n}\n\n/**\n * Hook to access the Reflection Property context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useReflectionProperty() {\n const context = useReflectionPropertyContext();\n\n if (!context) {\n throw new Error(\n \"Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return context;\n}\n\n/**\n * The reflection method context used in template rendering.\n */\nexport const ReflectionMethodContext: ComponentContext<ReflectionMethod> =\n createNamedContext<ReflectionMethod>(\"ReflectionMethod\");\n\n/**\n * Hook to access the Reflection Method context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useReflectionMethod() {\n const context = useContext<ReflectionMethod>(ReflectionMethodContext)!;\n\n if (!context) {\n throw new Error(\n \"Powerlines - Reflection Method Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return context;\n}\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const ReflectionParameterContext: ComponentContext<ReflectionParameter> =\n createNamedContext<ReflectionParameter>(\"ReflectionParameter\");\n\n/**\n * Hook to access the Reflection Parameter context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useReflectionParameter() {\n return useContext<ReflectionParameter>(ReflectionParameterContext)!;\n}\n"],"mappings":"uFAuBA,MAAE,EAAmB,GAAA,CAOrB,SAAE,GAAA,CACA,IAAA,EAAY,EAAe,EAAG,CAC9B,GAAA,CAAA,EACF,MAAA,MAAA,sMAAA,CAEE,OAAA,EAKF,MAAI,EAAc,EAAuC,qBAAA,CAOzD,SAAgB,GAAkB,CAChC,IAAE,EAAc,EAAS,EAAyB,CAClD,GAAE,CAAA,EACF,MAAM,MAAU,0MAA8C,CAE9D,OAAE,EAQJ,SAAgB,GAAA,CAChB,IAAA,EAAA,GAAA,OAEA,MAAO,MAAU,0MAAmC,CAElD,OAAA,EAMF,MAAa,EAA0B,EAAkB,mBAAA,CAOzD,SAAE,GAAA,CACF,IAAO,EAAS,EAAA,EAA+B,CAC7C,GAAA,CAAK,EACH,MAAA,MAAA,wMAAA,2CAeJ,SAAc,GAAwB,CACpC,OAAA,EAAA,EAAA"}
1
+ {"version":3,"file":"reflection.mjs","names":[],"sources":["../../../src/core/contexts/reflection.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\";\nimport type {\n ReflectionClass,\n ReflectionMethod,\n ReflectionParameter,\n ReflectionProperty\n} from \"@powerlines/deepkit/vendor/type\";\nimport { ReflectionOverrideInterface } from \"../../types/components\";\n\nexport interface ReflectionClassContextInterface<\n T extends Record<string, any> = Record<string, any>\n> {\n reflection: ReflectionClass<T>;\n override?: ReflectionOverrideInterface<T>;\n}\n\n/**\n * The reflection class context used in template rendering.\n */\nexport const ReflectionClassContext: ComponentContext<\n ReflectionClassContextInterface<any>\n> = createContext<ReflectionClassContextInterface<any>>();\n\n/**\n * Hook to access the Reflection context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useReflectionClass<\n T extends Record<string, any> = Record<string, any>\n>() {\n const context = useContext<ReflectionClassContextInterface<T>>(\n ReflectionClassContext\n )!;\n\n if (!context) {\n throw new Error(\n \"Powerlines - ReflectionClass Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return context;\n}\n\nexport interface ReflectionPropertyContextInterface {\n property: ReflectionProperty;\n defaultValue?: any;\n}\n\n/**\n * The reflection property context used in template rendering.\n */\nexport const ReflectionPropertyContext: ComponentContext<ReflectionPropertyContextInterface> =\n createNamedContext<ReflectionPropertyContextInterface>(\"ReflectionProperty\");\n\n/**\n * Hook to access the Reflection Property context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useReflectionPropertyContext() {\n const context = useContext<ReflectionPropertyContextInterface>(\n ReflectionPropertyContext\n )!;\n\n if (!context) {\n throw new Error(\n \"Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return context;\n}\n\n/**\n * Hook to access the Reflection Property context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useReflectionProperty() {\n const context = useReflectionPropertyContext();\n\n if (!context) {\n throw new Error(\n \"Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return context;\n}\n\n/**\n * The reflection method context used in template rendering.\n */\nexport const ReflectionMethodContext: ComponentContext<ReflectionMethod> =\n createNamedContext<ReflectionMethod>(\"ReflectionMethod\");\n\n/**\n * Hook to access the Reflection Method context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useReflectionMethod() {\n const context = useContext<ReflectionMethod>(ReflectionMethodContext)!;\n\n if (!context) {\n throw new Error(\n \"Powerlines - Reflection Method Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return context;\n}\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const ReflectionParameterContext: ComponentContext<ReflectionParameter> =\n createNamedContext<ReflectionParameter>(\"ReflectionParameter\");\n\n/**\n * Hook to access the Reflection Parameter context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useReflectionParameter() {\n return useContext<ReflectionParameter>(ReflectionParameterContext)!;\n}\n"],"mappings":";;;;;;AAuBA,MAAE,yBAAmB,eAAA;;;;;;AAOrB,SAAE,qBAAA;CACA,MAAA,UAAY,WAAe,uBAAG;AAC9B,KAAA,CAAA,QACF,OAAA,IAAA,MAAA,sMAAA;AAEE,QAAA;;;;;AAKF,MAAI,4BAAc,mBAAuC,qBAAA;;;;;;AAOzD,SAAgB,+BAAkB;CAChC,MAAE,UAAc,WAAS,0BAAyB;AAClD,KAAE,CAAA,QACF,OAAM,IAAA,MAAU,0MAA8C;AAE9D,QAAE;;;;;;;AAQJ,SAAgB,wBAAA;CAChB,MAAA,UAAA,8BAAA;cAEA,OAAO,IAAA,MAAU,0MAAmC;AAElD,QAAA;;;;;AAMF,MAAa,0BAA0B,mBAAkB,mBAAA;;;;;;AAOzD,SAAE,sBAAA;CACF,MAAO,UAAS,WAAA,wBAA+B;AAC7C,KAAA,CAAK,QACH,OAAA,IAAA,MAAA,wMAAA;;;;;;;;;;;;AAeJ,SAAc,yBAAwB;AACpC,QAAA,WAAA,2BAAA"}
@@ -1 +1,34 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`@alloy-js/core`);function t(t,...n){if(t.filter(e=>e.trim()).length===0&&n.length===0)throw Error("The `code` function cannot be used with a template that contains only whitespace. Please provide a non-empty template.");return(0,e.code)(t,...n)}exports.code=t;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
+ let _alloy_js_core = require("@alloy-js/core");
4
+
5
+ //#region src/core/helpers/code.ts
6
+ /**
7
+ * Turn the provided string template into Children by replacing literal line
8
+ * breaks with hardlines and automatically indenting indented content. Similar
9
+ * in spirit to the `<code>` element in HTML.
10
+ *
11
+ * @see {@link text} for a similar function which treats whitespace similar to
12
+ * JSX template bodies.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * code`
17
+ * function greet(name: string) {
18
+ * console.log("Hello, " + name + "!");
19
+ * }
20
+ * `
21
+ * ```
22
+ *
23
+ * @param template - The template string to be processed into Children.
24
+ * @param substitutions - Any interpolated values within the template, which will be treated as Children and properly indented.
25
+ * @returns A Children representation of the provided template string, with proper handling of line breaks and indentation.
26
+ * @throws Will throw an error if the provided template contains only whitespace, as this is likely a mistake and would cause a less recognizable "Cannot read properties of undefined" exception later in the processing.
27
+ */
28
+ function code(template, ...substitutions) {
29
+ if (template.filter((seg) => seg.trim()).length === 0 && substitutions.length === 0) throw new Error("The `code` function cannot be used with a template that contains only whitespace. Please provide a non-empty template.");
30
+ return (0, _alloy_js_core.code)(template, ...substitutions);
31
+ }
32
+
33
+ //#endregion
34
+ exports.code = code;
@@ -1,2 +1,33 @@
1
- import{code as e}from"@alloy-js/core";function t(t,...n){if(t.filter(e=>e.trim()).length===0&&n.length===0)throw Error("The `code` function cannot be used with a template that contains only whitespace. Please provide a non-empty template.");return e(t,...n)}export{t as code};
1
+ import { code as code$1 } from "@alloy-js/core";
2
+
3
+ //#region src/core/helpers/code.ts
4
+ /**
5
+ * Turn the provided string template into Children by replacing literal line
6
+ * breaks with hardlines and automatically indenting indented content. Similar
7
+ * in spirit to the `<code>` element in HTML.
8
+ *
9
+ * @see {@link text} for a similar function which treats whitespace similar to
10
+ * JSX template bodies.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * code`
15
+ * function greet(name: string) {
16
+ * console.log("Hello, " + name + "!");
17
+ * }
18
+ * `
19
+ * ```
20
+ *
21
+ * @param template - The template string to be processed into Children.
22
+ * @param substitutions - Any interpolated values within the template, which will be treated as Children and properly indented.
23
+ * @returns A Children representation of the provided template string, with proper handling of line breaks and indentation.
24
+ * @throws Will throw an error if the provided template contains only whitespace, as this is likely a mistake and would cause a less recognizable "Cannot read properties of undefined" exception later in the processing.
25
+ */
26
+ function code(template, ...substitutions) {
27
+ if (template.filter((seg) => seg.trim()).length === 0 && substitutions.length === 0) throw new Error("The `code` function cannot be used with a template that contains only whitespace. Please provide a non-empty template.");
28
+ return code$1(template, ...substitutions);
29
+ }
30
+
31
+ //#endregion
32
+ export { code };
2
33
  //# sourceMappingURL=code.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"code.mjs","names":[],"sources":["../../../src/core/helpers/code.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 { code as baseCode, Children } from \"@alloy-js/core\";\n\n/**\n * Turn the provided string template into Children by replacing literal line\n * breaks with hardlines and automatically indenting indented content. Similar\n * in spirit to the `<code>` element in HTML.\n *\n * @see {@link text} for a similar function which treats whitespace similar to\n * JSX template bodies.\n *\n * @example\n * ```ts\n * code`\n * function greet(name: string) {\n * console.log(\"Hello, \" + name + \"!\");\n * }\n * `\n * ```\n *\n * @param template - The template string to be processed into Children.\n * @param substitutions - Any interpolated values within the template, which will be treated as Children and properly indented.\n * @returns A Children representation of the provided template string, with proper handling of line breaks and indentation.\n * @throws Will throw an error if the provided template contains only whitespace, as this is likely a mistake and would cause a less recognizable \"Cannot read properties of undefined\" exception later in the processing.\n */\nexport function code(\n template: TemplateStringsArray,\n ...substitutions: Children[]\n): Children {\n if (\n template.filter(seg => seg.trim()).length === 0 &&\n substitutions.length === 0\n ) {\n throw new Error(\n \"The `code` function cannot be used with a template that contains only whitespace. Please provide a non-empty template.\"\n );\n }\n\n return baseCode(template, ...substitutions);\n}\n"],"mappings":"sCA0CA,SAAgB,EAAI,EAAA,GAAA,EAAA,CAClB,GAAA,EAAU,OAAA,GAAA,EAAoB,MAAA,CAAA,CAAA,SAAA,GAAA,EAAA,SAAA,EAC5B,MAAC,MAAe,yHAAS,CAE3B,OAAG,EAAA,EAAA,GAAA,EAAA"}
1
+ {"version":3,"file":"code.mjs","names":[],"sources":["../../../src/core/helpers/code.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 { code as baseCode, Children } from \"@alloy-js/core\";\n\n/**\n * Turn the provided string template into Children by replacing literal line\n * breaks with hardlines and automatically indenting indented content. Similar\n * in spirit to the `<code>` element in HTML.\n *\n * @see {@link text} for a similar function which treats whitespace similar to\n * JSX template bodies.\n *\n * @example\n * ```ts\n * code`\n * function greet(name: string) {\n * console.log(\"Hello, \" + name + \"!\");\n * }\n * `\n * ```\n *\n * @param template - The template string to be processed into Children.\n * @param substitutions - Any interpolated values within the template, which will be treated as Children and properly indented.\n * @returns A Children representation of the provided template string, with proper handling of line breaks and indentation.\n * @throws Will throw an error if the provided template contains only whitespace, as this is likely a mistake and would cause a less recognizable \"Cannot read properties of undefined\" exception later in the processing.\n */\nexport function code(\n template: TemplateStringsArray,\n ...substitutions: Children[]\n): Children {\n if (\n template.filter(seg => seg.trim()).length === 0 &&\n substitutions.length === 0\n ) {\n throw new Error(\n \"The `code` function cannot be used with a template that contains only whitespace. Please provide a non-empty template.\"\n );\n }\n\n return baseCode(template, ...substitutions);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAgB,KAAI,UAAA,GAAA,eAAA;AAClB,KAAA,SAAU,QAAA,QAAA,IAAoB,MAAA,CAAA,CAAA,WAAA,KAAA,cAAA,WAAA,EAC5B,OAAC,IAAA,MAAe,yHAAS;AAE3B,QAAG,OAAA,UAAA,GAAA,cAAA"}
@@ -1 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./code.cjs`);exports.code=e.code;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_core_helpers_code = require('./code.cjs');
3
+
4
+ exports.code = require_core_helpers_code.code;
@@ -1 +1,3 @@
1
- import{code as e}from"./code.mjs";export{e as code};
1
+ import { code } from "./code.mjs";
2
+
3
+ export { code };
@@ -1 +1,37 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./contexts/context.cjs`),t=require(`./contexts/meta.cjs`),n=require(`./components/source-file.cjs`),r=require(`./components/infrastructure-file.cjs`),i=require(`./contexts/reflection.cjs`);require(`./contexts/index.cjs`);const a=require(`./components/output.cjs`),o=require(`./components/single-line-comment.cjs`),s=require(`./components/spacing.cjs`);require(`./components/index.cjs`);const c=require(`./helpers/code.cjs`);require(`./helpers/index.cjs`),exports.InfrastructureFile=r.InfrastructureFile,exports.MetaContext=t.MetaContext,exports.Output=a.Output,exports.PowerlinesContext=e.PowerlinesContext,exports.ReflectionClassContext=i.ReflectionClassContext,exports.ReflectionMethodContext=i.ReflectionMethodContext,exports.ReflectionParameterContext=i.ReflectionParameterContext,exports.ReflectionPropertyContext=i.ReflectionPropertyContext,exports.SingleLineComment=o.SingleLineComment,exports.SourceFile=n.SourceFile,exports.Spacing=s.Spacing,exports.code=c.code,exports.useMeta=t.useMeta,exports.useMetaContext=t.useMetaContext,exports.useMetaSafe=t.useMetaSafe,exports.usePowerlines=e.usePowerlines,exports.usePowerlinesContext=e.usePowerlinesContext,exports.usePowerlinesSafe=e.usePowerlinesSafe,exports.useReflectionClass=i.useReflectionClass,exports.useReflectionMethod=i.useReflectionMethod,exports.useReflectionParameter=i.useReflectionParameter,exports.useReflectionProperty=i.useReflectionProperty,exports.useReflectionPropertyContext=i.useReflectionPropertyContext;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_core_contexts_context = require('./contexts/context.cjs');
3
+ const require_core_contexts_meta = require('./contexts/meta.cjs');
4
+ const require_core_components_source_file = require('./components/source-file.cjs');
5
+ const require_core_components_infrastructure_file = require('./components/infrastructure-file.cjs');
6
+ const require_core_contexts_reflection = require('./contexts/reflection.cjs');
7
+ require('./contexts/index.cjs');
8
+ const require_core_components_output = require('./components/output.cjs');
9
+ const require_core_components_single_line_comment = require('./components/single-line-comment.cjs');
10
+ const require_core_components_spacing = require('./components/spacing.cjs');
11
+ require('./components/index.cjs');
12
+ const require_core_helpers_code = require('./helpers/code.cjs');
13
+ require('./helpers/index.cjs');
14
+
15
+ exports.InfrastructureFile = require_core_components_infrastructure_file.InfrastructureFile;
16
+ exports.MetaContext = require_core_contexts_meta.MetaContext;
17
+ exports.Output = require_core_components_output.Output;
18
+ exports.PowerlinesContext = require_core_contexts_context.PowerlinesContext;
19
+ exports.ReflectionClassContext = require_core_contexts_reflection.ReflectionClassContext;
20
+ exports.ReflectionMethodContext = require_core_contexts_reflection.ReflectionMethodContext;
21
+ exports.ReflectionParameterContext = require_core_contexts_reflection.ReflectionParameterContext;
22
+ exports.ReflectionPropertyContext = require_core_contexts_reflection.ReflectionPropertyContext;
23
+ exports.SingleLineComment = require_core_components_single_line_comment.SingleLineComment;
24
+ exports.SourceFile = require_core_components_source_file.SourceFile;
25
+ exports.Spacing = require_core_components_spacing.Spacing;
26
+ exports.code = require_core_helpers_code.code;
27
+ exports.useMeta = require_core_contexts_meta.useMeta;
28
+ exports.useMetaContext = require_core_contexts_meta.useMetaContext;
29
+ exports.useMetaSafe = require_core_contexts_meta.useMetaSafe;
30
+ exports.usePowerlines = require_core_contexts_context.usePowerlines;
31
+ exports.usePowerlinesContext = require_core_contexts_context.usePowerlinesContext;
32
+ exports.usePowerlinesSafe = require_core_contexts_context.usePowerlinesSafe;
33
+ exports.useReflectionClass = require_core_contexts_reflection.useReflectionClass;
34
+ exports.useReflectionMethod = require_core_contexts_reflection.useReflectionMethod;
35
+ exports.useReflectionParameter = require_core_contexts_reflection.useReflectionParameter;
36
+ exports.useReflectionProperty = require_core_contexts_reflection.useReflectionProperty;
37
+ exports.useReflectionPropertyContext = require_core_contexts_reflection.useReflectionPropertyContext;
@@ -1 +1,14 @@
1
- import{PowerlinesContext as e,usePowerlines as t,usePowerlinesContext as n,usePowerlinesSafe as r}from"./contexts/context.mjs";import{MetaContext as i,useMeta as a,useMetaContext as o,useMetaSafe as s}from"./contexts/meta.mjs";import{SourceFile as c}from"./components/source-file.mjs";import{InfrastructureFile as l}from"./components/infrastructure-file.mjs";import{ReflectionClassContext as u,ReflectionMethodContext as d,ReflectionParameterContext as f,ReflectionPropertyContext as p,useReflectionClass as m,useReflectionMethod as h,useReflectionParameter as g,useReflectionProperty as _,useReflectionPropertyContext as v}from"./contexts/reflection.mjs";import"./contexts/index.mjs";import{Output as y}from"./components/output.mjs";import{SingleLineComment as b}from"./components/single-line-comment.mjs";import{Spacing as x}from"./components/spacing.mjs";import"./components/index.mjs";import{code as S}from"./helpers/code.mjs";import"./helpers/index.mjs";export{l as InfrastructureFile,i as MetaContext,y as Output,e as PowerlinesContext,u as ReflectionClassContext,d as ReflectionMethodContext,f as ReflectionParameterContext,p as ReflectionPropertyContext,b as SingleLineComment,c as SourceFile,x as Spacing,S as code,a as useMeta,o as useMetaContext,s as useMetaSafe,t as usePowerlines,n as usePowerlinesContext,r as usePowerlinesSafe,m as useReflectionClass,h as useReflectionMethod,g as useReflectionParameter,_ as useReflectionProperty,v as useReflectionPropertyContext};
1
+ import { PowerlinesContext, usePowerlines, usePowerlinesContext, usePowerlinesSafe } from "./contexts/context.mjs";
2
+ import { MetaContext, useMeta, useMetaContext, useMetaSafe } from "./contexts/meta.mjs";
3
+ import { SourceFile } from "./components/source-file.mjs";
4
+ import { InfrastructureFile } from "./components/infrastructure-file.mjs";
5
+ import { ReflectionClassContext, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty, useReflectionPropertyContext } from "./contexts/reflection.mjs";
6
+ import "./contexts/index.mjs";
7
+ import { Output } from "./components/output.mjs";
8
+ import { SingleLineComment } from "./components/single-line-comment.mjs";
9
+ import { Spacing } from "./components/spacing.mjs";
10
+ import "./components/index.mjs";
11
+ import { code } from "./helpers/code.mjs";
12
+ import "./helpers/index.mjs";
13
+
14
+ export { InfrastructureFile, MetaContext, Output, PowerlinesContext, ReflectionClassContext, ReflectionMethodContext, ReflectionParameterContext, ReflectionPropertyContext, SingleLineComment, SourceFile, Spacing, code, useMeta, useMetaContext, useMetaSafe, usePowerlines, usePowerlinesContext, usePowerlinesSafe, useReflectionClass, useReflectionMethod, useReflectionParameter, useReflectionProperty, useReflectionPropertyContext };
@@ -1 +1,34 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../core/helpers/code.cjs`);let t=require(`@alloy-js/core/jsx-runtime`),n=require(`@alloy-js/core`);function r(r){let{children:i,type:a,label:o}=r;return[(0,t.memo)(()=>e.code`${a} ${Array.isArray(o)?o.join(` `):o} {`),(0,t.createComponent)(n.Prose,{get children(){return(0,t.createComponent)(n.Show,{get when(){return!!i},children:i})}}),e.code`} `]}exports.BlockDeclaration=r;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
+ const require_core_helpers_code = require('../../core/helpers/code.cjs');
4
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
+ let _alloy_js_core = require("@alloy-js/core");
6
+
7
+ //#region src/hcl/components/block-declaration.tsx
8
+ /**
9
+ * A base component representing a block declaration in HCL. The children are rendered as a prose element, which means that they are broken into multiple lines. This component can be used to create more specific block declaration components, such as resource blocks, provider blocks, etc.
10
+ *
11
+ * @see https://developer.hashicorp.com/terraform/language#about-the-terraform-language
12
+ * @see https://opentofu.org/docs/language/attr-as-blocks/#summary
13
+ *
14
+ * @param props - The properties for the source file.
15
+ * @returns The rendered source file component.
16
+ */
17
+ function BlockDeclaration(props) {
18
+ const { children, type, label } = props;
19
+ return [
20
+ (0, _alloy_js_core_jsx_runtime.memo)(() => require_core_helpers_code.code`${type} ${Array.isArray(label) ? label.join(" ") : label} {`),
21
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Prose, { get children() {
22
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
23
+ get when() {
24
+ return Boolean(children);
25
+ },
26
+ children
27
+ });
28
+ } }),
29
+ require_core_helpers_code.code`} `
30
+ ];
31
+ }
32
+
33
+ //#endregion
34
+ exports.BlockDeclaration = BlockDeclaration;
@@ -1,2 +1,33 @@
1
- import{code as e}from"../../core/helpers/code.mjs";import{createComponent as t,memo as n}from"@alloy-js/core/jsx-runtime";import{Prose as r,Show as i}from"@alloy-js/core";function a(a){let{children:o,type:s,label:c}=a;return[n(()=>e`${s} ${Array.isArray(c)?c.join(` `):c} {`),t(r,{get children(){return t(i,{get when(){return!!o},children:o})}}),e`} `]}export{a as BlockDeclaration};
1
+ import { code as code$1 } from "../../core/helpers/code.mjs";
2
+ import { createComponent, memo } from "@alloy-js/core/jsx-runtime";
3
+ import { Prose, Show } from "@alloy-js/core";
4
+
5
+ //#region src/hcl/components/block-declaration.tsx
6
+ /**
7
+ * A base component representing a block declaration in HCL. The children are rendered as a prose element, which means that they are broken into multiple lines. This component can be used to create more specific block declaration components, such as resource blocks, provider blocks, etc.
8
+ *
9
+ * @see https://developer.hashicorp.com/terraform/language#about-the-terraform-language
10
+ * @see https://opentofu.org/docs/language/attr-as-blocks/#summary
11
+ *
12
+ * @param props - The properties for the source file.
13
+ * @returns The rendered source file component.
14
+ */
15
+ function BlockDeclaration(props) {
16
+ const { children, type, label } = props;
17
+ return [
18
+ memo(() => code$1`${type} ${Array.isArray(label) ? label.join(" ") : label} {`),
19
+ createComponent(Prose, { get children() {
20
+ return createComponent(Show, {
21
+ get when() {
22
+ return Boolean(children);
23
+ },
24
+ children
25
+ });
26
+ } }),
27
+ code$1`} `
28
+ ];
29
+ }
30
+
31
+ //#endregion
32
+ export { BlockDeclaration };
2
33
  //# sourceMappingURL=block-declaration.mjs.map