@powerlines/plugin-alloy 0.25.33 → 0.25.35

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 (80) hide show
  1. package/README.md +1 -1
  2. package/dist/core/components/output.cjs +17 -10
  3. package/dist/core/components/output.mjs +17 -10
  4. package/dist/core/components/output.mjs.map +1 -1
  5. package/dist/core/components/single-line-comment.cjs +6 -4
  6. package/dist/core/components/single-line-comment.mjs +6 -4
  7. package/dist/core/components/single-line-comment.mjs.map +1 -1
  8. package/dist/core/components/source-file.cjs +10 -6
  9. package/dist/core/components/source-file.mjs +10 -6
  10. package/dist/core/components/source-file.mjs.map +1 -1
  11. package/dist/core/components/spacing.cjs +6 -4
  12. package/dist/core/components/spacing.mjs +6 -4
  13. package/dist/core/components/spacing.mjs.map +1 -1
  14. package/dist/index.cjs +13 -18
  15. package/dist/index.d.cts.map +1 -1
  16. package/dist/index.d.mts.map +1 -1
  17. package/dist/index.mjs +12 -17
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/markdown/components/front-matter.cjs +9 -7
  20. package/dist/markdown/components/front-matter.mjs +9 -7
  21. package/dist/markdown/components/front-matter.mjs.map +1 -1
  22. package/dist/markdown/components/markdown-file.cjs +76 -44
  23. package/dist/markdown/components/markdown-file.mjs +76 -44
  24. package/dist/markdown/components/markdown-file.mjs.map +1 -1
  25. package/dist/markdown/components/markdown-table.cjs +49 -28
  26. package/dist/markdown/components/markdown-table.mjs +49 -28
  27. package/dist/markdown/components/markdown-table.mjs.map +1 -1
  28. package/dist/render.cjs +3 -3
  29. package/dist/render.mjs +4 -4
  30. package/dist/render.mjs.map +1 -1
  31. package/dist/typescript/components/builtin-file.cjs +29 -19
  32. package/dist/typescript/components/builtin-file.mjs +30 -20
  33. package/dist/typescript/components/builtin-file.mjs.map +1 -1
  34. package/dist/typescript/components/class-declaration.cjs +165 -100
  35. package/dist/typescript/components/class-declaration.mjs +165 -100
  36. package/dist/typescript/components/class-declaration.mjs.map +1 -1
  37. package/dist/typescript/components/dynamic-import-statement.cjs +2 -6
  38. package/dist/typescript/components/dynamic-import-statement.mjs +2 -6
  39. package/dist/typescript/components/dynamic-import-statement.mjs.map +1 -1
  40. package/dist/typescript/components/entry-file.cjs +9 -6
  41. package/dist/typescript/components/entry-file.mjs +10 -7
  42. package/dist/typescript/components/entry-file.mjs.map +1 -1
  43. package/dist/typescript/components/infrastructure-file.cjs +9 -6
  44. package/dist/typescript/components/infrastructure-file.mjs +10 -7
  45. package/dist/typescript/components/infrastructure-file.mjs.map +1 -1
  46. package/dist/typescript/components/interface-declaration.cjs +121 -70
  47. package/dist/typescript/components/interface-declaration.mjs +121 -70
  48. package/dist/typescript/components/interface-declaration.mjs.map +1 -1
  49. package/dist/typescript/components/object-declaration.cjs +76 -44
  50. package/dist/typescript/components/object-declaration.mjs +76 -44
  51. package/dist/typescript/components/object-declaration.mjs.map +1 -1
  52. package/dist/typescript/components/property-name.cjs +3 -3
  53. package/dist/typescript/components/property-name.mjs +3 -3
  54. package/dist/typescript/components/property-name.mjs.map +1 -1
  55. package/dist/typescript/components/record-expression.mjs.map +1 -1
  56. package/dist/typescript/components/tsdoc-reflection.cjs +225 -104
  57. package/dist/typescript/components/tsdoc-reflection.mjs +225 -104
  58. package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
  59. package/dist/typescript/components/tsdoc.cjs +255 -160
  60. package/dist/typescript/components/tsdoc.mjs +255 -160
  61. package/dist/typescript/components/tsdoc.mjs.map +1 -1
  62. package/dist/typescript/components/type-declaration.cjs +20 -15
  63. package/dist/typescript/components/type-declaration.mjs +20 -15
  64. package/dist/typescript/components/type-declaration.mjs.map +1 -1
  65. package/dist/typescript/components/type-parameters.cjs +55 -29
  66. package/dist/typescript/components/type-parameters.mjs +55 -29
  67. package/dist/typescript/components/type-parameters.mjs.map +1 -1
  68. package/dist/typescript/components/typescript-file.cjs +145 -80
  69. package/dist/typescript/components/typescript-file.mjs +145 -80
  70. package/dist/typescript/components/typescript-file.mjs.map +1 -1
  71. package/dist/typescript/contexts/lexical-scope.cjs +5 -3
  72. package/dist/typescript/contexts/lexical-scope.mjs +5 -3
  73. package/dist/typescript/contexts/lexical-scope.mjs.map +1 -1
  74. package/dist/typescript/contexts/member-scope.cjs +5 -3
  75. package/dist/typescript/contexts/member-scope.mjs +5 -3
  76. package/dist/typescript/contexts/member-scope.mjs.map +1 -1
  77. package/dist/yaml/components/yaml-file.cjs +92 -47
  78. package/dist/yaml/components/yaml-file.mjs +92 -47
  79. package/dist/yaml/components/yaml-file.mjs.map +1 -1
  80. package/package.json +16 -17
@@ -2,8 +2,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
3
  const require_core_contexts_reflection = require('../../core/contexts/reflection.cjs');
4
4
  const require_typescript_components_tsdoc_reflection = require('./tsdoc-reflection.cjs');
5
- let _alloy_js_core = require("@alloy-js/core");
6
5
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
+ let _alloy_js_core = require("@alloy-js/core");
7
7
  let _powerlines_deepkit_utilities = require("@powerlines/deepkit/utilities");
8
8
  let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
9
9
  let _stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
@@ -36,41 +36,67 @@ function ObjectDeclaration(props) {
36
36
  });
37
37
  if (!props.type) ValueTypeSymbolSlot.moveMembersTo(sym);
38
38
  const keyword = props.var ? "var" : props.let ? "let" : "const";
39
- const type = props.type ? /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_typescript.TypeRefContext, { children: [": ", /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(TypeSymbolSlot, { children: props.type })] }) : void 0;
40
- return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
41
- when: !!props.reflection.value,
42
- children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(require_core_contexts_reflection.ReflectionClassContext.Provider, {
43
- value: {
44
- reflection: props.reflection.value,
45
- override: {
46
- name: objectName.value,
47
- type: objectType.value,
48
- defaultValue: props.defaultValue?.value
39
+ const type = props.type ? (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.TypeRefContext, { get children() {
40
+ return [": ", (0, _alloy_js_core_jsx_runtime.createComponent)(TypeSymbolSlot, { get children() {
41
+ return props.type;
42
+ } })];
43
+ } }) : void 0;
44
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
45
+ get when() {
46
+ return !!props.reflection.value;
47
+ },
48
+ get children() {
49
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(require_core_contexts_reflection.ReflectionClassContext.Provider, {
50
+ get value() {
51
+ return {
52
+ reflection: props.reflection.value,
53
+ override: {
54
+ name: objectName.value,
55
+ type: objectType.value,
56
+ defaultValue: props.defaultValue?.value
57
+ }
58
+ };
59
+ },
60
+ get children() {
61
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
62
+ get when() {
63
+ return !!objectName.value && !!objectType.value;
64
+ },
65
+ get children() {
66
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc_reflection.TSDocReflectionClass, { get reflection() {
67
+ return props.reflection.value;
68
+ } }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Declaration, {
69
+ symbol: sym,
70
+ get children() {
71
+ return [
72
+ (0, _alloy_js_core_jsx_runtime.memo)(() => props.export ? "export " : ""),
73
+ (0, _alloy_js_core_jsx_runtime.memo)(() => props.default ? "default " : ""),
74
+ keyword,
75
+ " ",
76
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Name, {}),
77
+ type,
78
+ " =",
79
+ " ",
80
+ (0, _alloy_js_core_jsx_runtime.createComponent)(ValueTypeSymbolSlot, { get children() {
81
+ return props.initializer ?? props.children ?? (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ObjectExpression, { get children() {
82
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
83
+ get each() {
84
+ return properties.value ?? [];
85
+ },
86
+ comma: true,
87
+ doubleHardline: true,
88
+ children: (prop) => (0, _alloy_js_core_jsx_runtime.createComponent)(ObjectDeclarationProperty, { property: prop })
89
+ });
90
+ } });
91
+ } })
92
+ ];
93
+ }
94
+ })];
95
+ }
96
+ }), (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
49
97
  }
50
- },
51
- children: [/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core.Show, {
52
- when: !!objectName.value && !!objectType.value,
53
- children: [/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(require_typescript_components_tsdoc_reflection.TSDocReflectionClass, { reflection: props.reflection.value }), /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core.Declaration, {
54
- symbol: sym,
55
- children: [
56
- props.export ? "export " : "",
57
- props.default ? "default " : "",
58
- keyword,
59
- " ",
60
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Name, {}),
61
- type,
62
- " =",
63
- " ",
64
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(ValueTypeSymbolSlot, { children: props.initializer ?? props.children ?? /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.ObjectExpression, { children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.For, {
65
- each: properties.value ?? [],
66
- comma: true,
67
- doubleHardline: true,
68
- children: (prop) => /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(ObjectDeclarationProperty, { property: prop })
69
- }) }) })
70
- ]
71
- })]
72
- }), /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {})]
73
- })
98
+ });
99
+ }
74
100
  });
75
101
  }
76
102
  /**
@@ -78,16 +104,22 @@ function ObjectDeclaration(props) {
78
104
  */
79
105
  function ObjectDeclarationProperty(props) {
80
106
  const [{ property }] = (0, _alloy_js_core.splitProps)(props, ["property"]);
81
- return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(require_core_contexts_reflection.ReflectionPropertyContext.Provider, {
107
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(require_core_contexts_reflection.ReflectionPropertyContext.Provider, {
82
108
  value: property,
83
- children: [
84
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(require_typescript_components_tsdoc_reflection.TSDocReflectionProperty, { reflection: property }),
85
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.ObjectProperty, {
86
- name: property.getNameAsString(),
87
- value: (0, _powerlines_deepkit_utilities.stringifyDefaultValue)(property)
88
- }),
89
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {})
90
- ]
109
+ get children() {
110
+ return [
111
+ (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc_reflection.TSDocReflectionProperty, { reflection: property }),
112
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ObjectProperty, {
113
+ get name() {
114
+ return property.getNameAsString();
115
+ },
116
+ get value() {
117
+ return (0, _powerlines_deepkit_utilities.stringifyDefaultValue)(property);
118
+ }
119
+ }),
120
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
121
+ ];
122
+ }
91
123
  });
92
124
  }
93
125
 
@@ -1,7 +1,7 @@
1
1
  import { ReflectionClassContext, ReflectionPropertyContext } from "../../core/contexts/reflection.mjs";
2
2
  import { TSDocReflectionClass, TSDocReflectionProperty } from "./tsdoc-reflection.mjs";
3
+ import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
3
4
  import { Declaration, For, Name, Show, computed, createSymbolSlot, splitProps } from "@alloy-js/core";
4
- import { jsx, jsxs } from "@alloy-js/core/jsx-runtime";
5
5
  import { stringifyDefaultValue } from "@powerlines/deepkit/utilities";
6
6
  import { camelCase } from "@stryke/string-format/camel-case";
7
7
  import { isUndefined } from "@stryke/type-checks/is-undefined";
@@ -34,41 +34,67 @@ function ObjectDeclaration(props) {
34
34
  });
35
35
  if (!props.type) ValueTypeSymbolSlot.moveMembersTo(sym);
36
36
  const keyword = props.var ? "var" : props.let ? "let" : "const";
37
- const type = props.type ? /* @__PURE__ */ jsxs(TypeRefContext, { children: [": ", /* @__PURE__ */ jsx(TypeSymbolSlot, { children: props.type })] }) : void 0;
38
- return /* @__PURE__ */ jsx(Show, {
39
- when: !!props.reflection.value,
40
- children: /* @__PURE__ */ jsxs(ReflectionClassContext.Provider, {
41
- value: {
42
- reflection: props.reflection.value,
43
- override: {
44
- name: objectName.value,
45
- type: objectType.value,
46
- defaultValue: props.defaultValue?.value
37
+ const type = props.type ? createComponent(TypeRefContext, { get children() {
38
+ return [": ", createComponent(TypeSymbolSlot, { get children() {
39
+ return props.type;
40
+ } })];
41
+ } }) : void 0;
42
+ return createComponent(Show, {
43
+ get when() {
44
+ return !!props.reflection.value;
45
+ },
46
+ get children() {
47
+ return createComponent(ReflectionClassContext.Provider, {
48
+ get value() {
49
+ return {
50
+ reflection: props.reflection.value,
51
+ override: {
52
+ name: objectName.value,
53
+ type: objectType.value,
54
+ defaultValue: props.defaultValue?.value
55
+ }
56
+ };
57
+ },
58
+ get children() {
59
+ return [createComponent(Show, {
60
+ get when() {
61
+ return !!objectName.value && !!objectType.value;
62
+ },
63
+ get children() {
64
+ return [createComponent(TSDocReflectionClass, { get reflection() {
65
+ return props.reflection.value;
66
+ } }), createComponent(Declaration, {
67
+ symbol: sym,
68
+ get children() {
69
+ return [
70
+ memo(() => props.export ? "export " : ""),
71
+ memo(() => props.default ? "default " : ""),
72
+ keyword,
73
+ " ",
74
+ createComponent(Name, {}),
75
+ type,
76
+ " =",
77
+ " ",
78
+ createComponent(ValueTypeSymbolSlot, { get children() {
79
+ return props.initializer ?? props.children ?? createComponent(ObjectExpression, { get children() {
80
+ return createComponent(For, {
81
+ get each() {
82
+ return properties.value ?? [];
83
+ },
84
+ comma: true,
85
+ doubleHardline: true,
86
+ children: (prop) => createComponent(ObjectDeclarationProperty, { property: prop })
87
+ });
88
+ } });
89
+ } })
90
+ ];
91
+ }
92
+ })];
93
+ }
94
+ }), createIntrinsic("hbr", {})];
47
95
  }
48
- },
49
- children: [/* @__PURE__ */ jsxs(Show, {
50
- when: !!objectName.value && !!objectType.value,
51
- children: [/* @__PURE__ */ jsx(TSDocReflectionClass, { reflection: props.reflection.value }), /* @__PURE__ */ jsxs(Declaration, {
52
- symbol: sym,
53
- children: [
54
- props.export ? "export " : "",
55
- props.default ? "default " : "",
56
- keyword,
57
- " ",
58
- /* @__PURE__ */ jsx(Name, {}),
59
- type,
60
- " =",
61
- " ",
62
- /* @__PURE__ */ jsx(ValueTypeSymbolSlot, { children: props.initializer ?? props.children ?? /* @__PURE__ */ jsx(ObjectExpression, { children: /* @__PURE__ */ jsx(For, {
63
- each: properties.value ?? [],
64
- comma: true,
65
- doubleHardline: true,
66
- children: (prop) => /* @__PURE__ */ jsx(ObjectDeclarationProperty, { property: prop })
67
- }) }) })
68
- ]
69
- })]
70
- }), /* @__PURE__ */ jsx("hbr", {})]
71
- })
96
+ });
97
+ }
72
98
  });
73
99
  }
74
100
  /**
@@ -76,16 +102,22 @@ function ObjectDeclaration(props) {
76
102
  */
77
103
  function ObjectDeclarationProperty(props) {
78
104
  const [{ property }] = splitProps(props, ["property"]);
79
- return /* @__PURE__ */ jsxs(ReflectionPropertyContext.Provider, {
105
+ return createComponent(ReflectionPropertyContext.Provider, {
80
106
  value: property,
81
- children: [
82
- /* @__PURE__ */ jsx(TSDocReflectionProperty, { reflection: property }),
83
- /* @__PURE__ */ jsx(ObjectProperty, {
84
- name: property.getNameAsString(),
85
- value: stringifyDefaultValue(property)
86
- }),
87
- /* @__PURE__ */ jsx("hbr", {})
88
- ]
107
+ get children() {
108
+ return [
109
+ createComponent(TSDocReflectionProperty, { reflection: property }),
110
+ createComponent(ObjectProperty, {
111
+ get name() {
112
+ return property.getNameAsString();
113
+ },
114
+ get value() {
115
+ return stringifyDefaultValue(property);
116
+ }
117
+ }),
118
+ createIntrinsic("hbr", {})
119
+ ];
120
+ }
89
121
  });
90
122
  }
91
123
 
@@ -1 +1 @@
1
- {"version":3,"file":"object-declaration.mjs","names":["CoreDeclaration"],"sources":["../../../src/typescript/components/object-declaration.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n computed,\n Declaration as CoreDeclaration,\n createSymbolSlot,\n For,\n Name,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n createValueSymbol,\n ObjectExpression,\n ObjectProperty,\n TSSymbolFlags,\n TypeRefContext,\n useTSNamePolicy,\n VarDeclarationProps\n} from \"@alloy-js/typescript\";\nimport { stringifyDefaultValue } from \"@powerlines/deepkit/utilities\";\nimport type {\n ReflectionClass,\n ReflectionProperty\n} from \"@powerlines/deepkit/vendor/type\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport {\n ReflectionClassContext,\n ReflectionPropertyContext\n} from \"../../core/contexts/reflection\";\nimport { ComponentProps } from \"../../types/components\";\nimport {\n TSDocReflectionClass,\n TSDocReflectionProperty\n} from \"./tsdoc-reflection\";\n\nexport interface ComputedRef<T = any> {\n readonly value: T;\n}\n\nexport interface ObjectDeclarationProps<\n T extends Record<string, any> = Record<string, any>\n> extends VarDeclarationProps {\n reflection?: ComputedRef<ReflectionClass<T>>;\n defaultValue?: ComputedRef<Partial<T> | undefined>;\n}\n\nexport interface ObjectDeclarationPropertyProps extends ComponentProps {\n property: ReflectionProperty;\n}\n\n/**\n * Generates a TypeScript object for the given reflection class.\n */\nexport function ObjectDeclaration<\n T extends Record<string, any> = Record<string, any>\n>(props: ObjectDeclarationProps<T>) {\n if (!props.reflection?.value) {\n return null;\n }\n\n const objectName = computed(() =>\n camelCase(\n (isString(props.name) ? props.name : props.name.toString()) ||\n props.reflection!.value.getName()\n )\n );\n const objectType = computed(\n () => props.type || pascalCase(props.reflection!.value.getName())\n );\n const properties = computed(() =>\n props\n .reflection!.value.getProperties()\n .filter(\n item =>\n !item.isIgnored() &&\n !isUndefined(\n props.defaultValue?.value?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined(\n (props.defaultValue as Record<string, any>)?.value?.[alias]\n )\n ) {\n return (props.defaultValue as Record<string, any>)?.value?.[\n alias\n ];\n }\n\n return ret;\n }, undefined) ??\n item.getDefaultValue()\n )\n )\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) ||\n (!a.isReadonly() && !b.isReadonly())\n ? a.getNameAsString().localeCompare(b.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n )\n );\n\n const TypeSymbolSlot = createSymbolSlot();\n const ValueTypeSymbolSlot = createSymbolSlot();\n const sym = createValueSymbol(props.name, {\n refkeys: props.refkey,\n default: props.default,\n export: props.export,\n metadata: props.metadata,\n tsFlags: props.nullish ? TSSymbolFlags.Nullish : TSSymbolFlags.None,\n type: props.type ? TypeSymbolSlot.firstSymbol : undefined,\n namePolicy: useTSNamePolicy().for(\"variable\")\n });\n\n if (!props.type) {\n ValueTypeSymbolSlot.moveMembersTo(sym);\n }\n\n const keyword = props.var ? \"var\" : props.let ? \"let\" : \"const\";\n const type = props.type ? (\n <TypeRefContext>\n : <TypeSymbolSlot>{props.type}</TypeSymbolSlot>\n </TypeRefContext>\n ) : undefined;\n\n return (\n <Show when={!!props.reflection.value}>\n <ReflectionClassContext.Provider\n value={{\n reflection: props.reflection.value as ReflectionClass<any>,\n override: {\n name: objectName.value,\n type: objectType.value,\n defaultValue: props.defaultValue?.value\n }\n }}>\n <Show when={!!objectName.value && !!objectType.value}>\n <TSDocReflectionClass reflection={props.reflection.value} />\n <CoreDeclaration symbol={sym}>\n {props.export ? \"export \" : \"\"}\n {props.default ? \"default \" : \"\"}\n {keyword} <Name />\n {type} ={\" \"}\n <ValueTypeSymbolSlot>\n {props.initializer ?? props.children ?? (\n <ObjectExpression>\n <For\n each={properties.value ?? []}\n comma={true}\n doubleHardline={true}>\n {prop => <ObjectDeclarationProperty property={prop} />}\n </For>\n </ObjectExpression>\n )}\n </ValueTypeSymbolSlot>\n </CoreDeclaration>\n </Show>\n <hbr />\n </ReflectionClassContext.Provider>\n </Show>\n );\n}\n\n/**\n * Generates a TypeScript object property for the given reflection class.\n */\nexport function ObjectDeclarationProperty(\n props: ObjectDeclarationPropertyProps\n) {\n const [{ property }] = splitProps(props, [\"property\"]);\n\n return (\n <ReflectionPropertyContext.Provider value={property}>\n <TSDocReflectionProperty reflection={property} />\n <ObjectProperty\n name={property.getNameAsString()}\n value={stringifyDefaultValue(property)}\n />\n <hbr />\n </ReflectionPropertyContext.Provider>\n );\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"object-declaration.mjs","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n computed,\n Declaration as CoreDeclaration,\n createSymbolSlot,\n For,\n Name,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n createValueSymbol,\n ObjectExpression,\n ObjectProperty,\n TSSymbolFlags,\n TypeRefContext,\n useTSNamePolicy,\n VarDeclarationProps\n} from \"@alloy-js/typescript\";\nimport { stringifyDefaultValue } from \"@powerlines/deepkit/utilities\";\nimport type {\n ReflectionClass,\n ReflectionProperty\n} from \"@powerlines/deepkit/vendor/type\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport {\n ReflectionClassContext,\n ReflectionPropertyContext\n} from \"../../core/contexts/reflection\";\nimport { ComponentProps } from \"../../types/components\";\nimport {\n TSDocReflectionClass,\n TSDocReflectionProperty\n} from \"./tsdoc-reflection\";\n\nexport interface ComputedRef<T = any> {\n readonly value: T;\n}\n\nexport interface ObjectDeclarationProps<\n T extends Record<string, any> = Record<string, any>\n> extends VarDeclarationProps {\n reflection?: ComputedRef<ReflectionClass<T>>;\n defaultValue?: ComputedRef<Partial<T> | undefined>;\n}\n\nexport interface ObjectDeclarationPropertyProps extends ComponentProps {\n property: ReflectionProperty;\n}\n\n/**\n * Generates a TypeScript object for the given reflection class.\n */\nexport function ObjectDeclaration<\n T extends Record<string, any> = Record<string, any>\n>(props: ObjectDeclarationProps<T>) {\n if (!props.reflection?.value) {\n return null;\n }\n\n const objectName = computed(() =>\n camelCase(\n (isString(props.name) ? props.name : props.name.toString()) ||\n props.reflection!.value.getName()\n )\n );\n const objectType = computed(\n () => props.type || pascalCase(props.reflection!.value.getName())\n );\n const properties = computed(() =>\n props\n .reflection!.value.getProperties()\n .filter(\n item =>\n !item.isIgnored() &&\n !isUndefined(\n props.defaultValue?.value?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined(\n (props.defaultValue as Record<string, any>)?.value?.[alias]\n )\n ) {\n return (props.defaultValue as Record<string, any>)?.value?.[\n alias\n ];\n }\n\n return ret;\n }, undefined) ??\n item.getDefaultValue()\n )\n )\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) ||\n (!a.isReadonly() && !b.isReadonly())\n ? a.getNameAsString().localeCompare(b.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n )\n );\n\n const TypeSymbolSlot = createSymbolSlot();\n const ValueTypeSymbolSlot = createSymbolSlot();\n const sym = createValueSymbol(props.name, {\n refkeys: props.refkey,\n default: props.default,\n export: props.export,\n metadata: props.metadata,\n tsFlags: props.nullish ? TSSymbolFlags.Nullish : TSSymbolFlags.None,\n type: props.type ? TypeSymbolSlot.firstSymbol : undefined,\n namePolicy: useTSNamePolicy().for(\"variable\")\n });\n\n if (!props.type) {\n ValueTypeSymbolSlot.moveMembersTo(sym);\n }\n\n const keyword = props.var ? \"var\" : props.let ? \"let\" : \"const\";\n const type = props.type ? (\n <TypeRefContext>\n : <TypeSymbolSlot>{props.type}</TypeSymbolSlot>\n </TypeRefContext>\n ) : undefined;\n\n return (\n <Show when={!!props.reflection.value}>\n <ReflectionClassContext.Provider\n value={{\n reflection: props.reflection.value as ReflectionClass<any>,\n override: {\n name: objectName.value,\n type: objectType.value,\n defaultValue: props.defaultValue?.value\n }\n }}>\n <Show when={!!objectName.value && !!objectType.value}>\n <TSDocReflectionClass reflection={props.reflection.value} />\n <CoreDeclaration symbol={sym}>\n {props.export ? \"export \" : \"\"}\n {props.default ? \"default \" : \"\"}\n {keyword} <Name />\n {type} ={\" \"}\n <ValueTypeSymbolSlot>\n {props.initializer ?? props.children ?? (\n <ObjectExpression>\n <For\n each={properties.value ?? []}\n comma={true}\n doubleHardline={true}>\n {prop => <ObjectDeclarationProperty property={prop} />}\n </For>\n </ObjectExpression>\n )}\n </ValueTypeSymbolSlot>\n </CoreDeclaration>\n </Show>\n <hbr />\n </ReflectionClassContext.Provider>\n </Show>\n );\n}\n\n/**\n * Generates a TypeScript object property for the given reflection class.\n */\nexport function ObjectDeclarationProperty(\n props: ObjectDeclarationPropertyProps\n) {\n const [{ property }] = splitProps(props, [\"property\"]);\n\n return (\n <ReflectionPropertyContext.Provider value={property}>\n <TSDocReflectionProperty reflection={property} />\n <ObjectProperty\n name={property.getNameAsString()}\n value={stringifyDefaultValue(property)}\n />\n <hbr />\n </ReflectionPropertyContext.Provider>\n );\n}\n"],"mappings":"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"}
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
3
  const require_typescript_helpers_utilities = require('../helpers/utilities.cjs');
4
- let _alloy_js_core = require("@alloy-js/core");
5
4
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
+ let _alloy_js_core = require("@alloy-js/core");
6
6
 
7
7
  //#region src/typescript/components/property-name.tsx
8
8
  /**
@@ -19,8 +19,8 @@ function PropertyName(props) {
19
19
  else {
20
20
  const declSymbol = (0, _alloy_js_core.useContext)(_alloy_js_core.MemberDeclarationContext);
21
21
  if (!declSymbol) return "(no member declaration context)";
22
- if (declSymbol.isPrivateMemberSymbol) return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core_jsx_runtime.Fragment, { children: ["#", declSymbol.name] });
23
- else return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core_jsx_runtime.Fragment, { children: quoteIfNeeded(declSymbol.name) });
22
+ if (declSymbol.isPrivateMemberSymbol) return ["#", (0, _alloy_js_core_jsx_runtime.memo)(() => declSymbol.name)];
23
+ else return [(0, _alloy_js_core_jsx_runtime.memo)(() => quoteIfNeeded(declSymbol.name))];
24
24
  }
25
25
  }
26
26
  function quoteIfNeeded(name) {
@@ -1,6 +1,6 @@
1
1
  import { isValidJSIdentifier } from "../helpers/utilities.mjs";
2
+ import { memo } from "@alloy-js/core/jsx-runtime";
2
3
  import { MemberDeclarationContext, useContext } from "@alloy-js/core";
3
- import { Fragment, jsx, jsxs, memo } from "@alloy-js/core/jsx-runtime";
4
4
 
5
5
  //#region src/typescript/components/property-name.tsx
6
6
  /**
@@ -17,8 +17,8 @@ function PropertyName(props) {
17
17
  else {
18
18
  const declSymbol = useContext(MemberDeclarationContext);
19
19
  if (!declSymbol) return "(no member declaration context)";
20
- if (declSymbol.isPrivateMemberSymbol) return /* @__PURE__ */ jsxs(Fragment, { children: ["#", declSymbol.name] });
21
- else return /* @__PURE__ */ jsx(Fragment, { children: quoteIfNeeded(declSymbol.name) });
20
+ if (declSymbol.isPrivateMemberSymbol) return ["#", memo(() => declSymbol.name)];
21
+ else return [memo(() => quoteIfNeeded(declSymbol.name))];
22
22
  }
23
23
  }
24
24
  function quoteIfNeeded(name) {
@@ -1 +1 @@
1
- {"version":3,"file":"property-name.mjs","names":[],"sources":["../../../src/typescript/components/property-name.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 { MemberDeclarationContext, useContext } from \"@alloy-js/core\";\nimport { memo } from \"@alloy-js/core/jsx-runtime\";\nimport { TSOutputSymbol } from \"@alloy-js/typescript\";\nimport { isValidJSIdentifier } from \"../helpers/utilities\";\n\nexport interface PropertyNameProps {\n /**\n * The name of the property.\n */\n name?: string;\n\n /**\n * Whether the property is a private property. If `true`, the property will be prefixed with `#`.\n */\n private?: boolean;\n}\n\n/**\n * A TypeScript property name for an interface, class, or object member.\n *\n * @remarks\n * If the name is not a valid JavaScript identifier, it will be quoted. If a `name` prop is provided, it will be used as the property name. Otherwise, the name will be taken from the {@link (MemberDeclarationContext:variable)}.\n */\nexport function PropertyName(props: PropertyNameProps) {\n if (props.name) {\n return memo(() => {\n if (props.private) {\n return `#${props.name}`;\n }\n return quoteIfNeeded(props.name!);\n });\n } else {\n const declSymbol = useContext(MemberDeclarationContext) as TSOutputSymbol;\n if (!declSymbol) {\n return \"(no member declaration context)\";\n }\n\n if (declSymbol.isPrivateMemberSymbol) {\n return <>#{declSymbol.name}</>;\n } else {\n return <>{quoteIfNeeded(declSymbol.name)}</>;\n }\n }\n}\n\nfunction quoteIfNeeded(name: string) {\n if (isValidJSIdentifier(name)) {\n return name;\n } else {\n return `\"${name.replace(/\"/g, '\\\\\"')}\"`;\n }\n}\n"],"mappings":";;;;;;;;;;;AAyCA,SAAgB,aAAa,OAA0B;AACrD,KAAI,MAAM,KACR,QAAO,WAAW;AAChB,MAAI,MAAM,QACR,QAAO,IAAI,MAAM;AAEnB,SAAO,cAAc,MAAM,KAAM;GACjC;MACG;EACL,MAAM,aAAa,WAAW,yBAAyB;AACvD,MAAI,CAAC,WACH,QAAO;AAGT,MAAI,WAAW,sBACb,QAAO,4CAAE,KAAE,WAAW,KAAQ;MAE9B,QAAO,0CAAG,cAAc,WAAW,KAAK,EAAI;;;AAKlD,SAAS,cAAc,MAAc;AACnC,KAAI,oBAAoB,KAAK,CAC3B,QAAO;KAEP,QAAO,IAAI,KAAK,QAAQ,MAAM,OAAM,CAAC"}
1
+ {"version":3,"file":"property-name.mjs","names":[],"sources":["../../../src/typescript/components/property-name.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 { MemberDeclarationContext, useContext } from \"@alloy-js/core\";\nimport { memo } from \"@alloy-js/core/jsx-runtime\";\nimport { TSOutputSymbol } from \"@alloy-js/typescript\";\nimport { isValidJSIdentifier } from \"../helpers/utilities\";\n\nexport interface PropertyNameProps {\n /**\n * The name of the property.\n */\n name?: string;\n\n /**\n * Whether the property is a private property. If `true`, the property will be prefixed with `#`.\n */\n private?: boolean;\n}\n\n/**\n * A TypeScript property name for an interface, class, or object member.\n *\n * @remarks\n * If the name is not a valid JavaScript identifier, it will be quoted. If a `name` prop is provided, it will be used as the property name. Otherwise, the name will be taken from the {@link (MemberDeclarationContext:variable)}.\n */\nexport function PropertyName(props: PropertyNameProps) {\n if (props.name) {\n return memo(() => {\n if (props.private) {\n return `#${props.name}`;\n }\n return quoteIfNeeded(props.name!);\n });\n } else {\n const declSymbol = useContext(MemberDeclarationContext) as TSOutputSymbol;\n if (!declSymbol) {\n return \"(no member declaration context)\";\n }\n\n if (declSymbol.isPrivateMemberSymbol) {\n return <>#{declSymbol.name}</>;\n } else {\n return <>{quoteIfNeeded(declSymbol.name)}</>;\n }\n }\n}\n\nfunction quoteIfNeeded(name: string) {\n if (isValidJSIdentifier(name)) {\n return name;\n } else {\n return `\"${name.replace(/\"/g, '\\\\\"')}\"`;\n }\n}\n"],"mappings":";;;;;;;;;;;AAyCA,SAAgB,aAAa,OAA0B;AACrD,KAAI,MAAM,KACR,QAAO,WAAW;AAChB,MAAI,MAAM,QACR,QAAO,IAAI,MAAM;AAEnB,SAAO,cAAc,MAAM,KAAM;GACjC;MACG;EACL,MAAM,aAAa,WAAW,yBAAyB;AACvD,MAAI,CAAC,WACH,QAAO;uCAGP,QAAE,CAAA,KAAW,WAAA,WAAuB,KAAA,CAAA;MAEpC,QAAK,CAAA,WAAA,cAAA,WAAA,KAAA,CAAA,CAAA;;;AAIX,SAAA,cAAA,MAAA;+BAEA,QAAS;KAEL,QAAO,IAAI,KAAA,QAAA,MAAA,OAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"record-expression.mjs","names":[],"sources":["../../../src/typescript/components/record-expression.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 { Children, code } from \"@alloy-js/core\";\n\nexport interface RecordExpressionProps {\n elementType: Children;\n}\n\nexport function RecordExpression({ elementType }: RecordExpressionProps) {\n return code`\n Record<string, ${elementType}>\n `;\n}\n"],"mappings":";;;AAwBA,SAAgB,iBAAiB,EAAE,eAAsC;AACvE,QAAO,IAAI;mBACM,YAAY"}
1
+ {"version":3,"file":"record-expression.mjs","names":[],"sources":["../../../src/typescript/components/record-expression.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 { Children, code } from \"@alloy-js/core\";\n\nexport interface RecordExpressionProps {\n elementType: Children;\n}\n\nexport function RecordExpression({ elementType }: RecordExpressionProps) {\n return code`\n Record<string, ${elementType}>\n `;\n}\n"],"mappings":";;;AAsBA,SAAA,iBAAA,iBAEgB;AACd,QAAO,IAAI;mBACM,YAAY"}