@powerlines/plugin-alloy 0.25.27 → 0.25.28

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 (87) hide show
  1. package/dist/core/components/output.cjs +7 -19
  2. package/dist/core/components/output.mjs +7 -19
  3. package/dist/core/components/output.mjs.map +1 -1
  4. package/dist/core/components/single-line-comment.cjs +8 -7
  5. package/dist/core/components/single-line-comment.mjs +8 -7
  6. package/dist/core/components/single-line-comment.mjs.map +1 -1
  7. package/dist/core/components/source-file.cjs +7 -12
  8. package/dist/core/components/source-file.mjs +7 -12
  9. package/dist/core/components/source-file.mjs.map +1 -1
  10. package/dist/core/components/spacing.cjs +6 -7
  11. package/dist/core/components/spacing.mjs +6 -7
  12. package/dist/core/components/spacing.mjs.map +1 -1
  13. package/dist/core/contexts/context.mjs.map +1 -1
  14. package/dist/core/contexts/meta.mjs.map +1 -1
  15. package/dist/core/contexts/reflection.mjs.map +1 -1
  16. package/dist/core/helpers/code.mjs.map +1 -1
  17. package/dist/helpers/capnp.mjs.map +1 -1
  18. package/dist/helpers/create-builtin.mjs.map +1 -1
  19. package/dist/helpers/refkey.mjs.map +1 -1
  20. package/dist/helpers/typescript.mjs.map +1 -1
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/markdown/components/front-matter.cjs +9 -14
  23. package/dist/markdown/components/front-matter.mjs +9 -14
  24. package/dist/markdown/components/front-matter.mjs.map +1 -1
  25. package/dist/markdown/components/markdown-file.cjs +41 -89
  26. package/dist/markdown/components/markdown-file.mjs +41 -89
  27. package/dist/markdown/components/markdown-file.mjs.map +1 -1
  28. package/dist/markdown/components/markdown-table.cjs +20 -52
  29. package/dist/markdown/components/markdown-table.mjs +20 -52
  30. package/dist/markdown/components/markdown-table.mjs.map +1 -1
  31. package/dist/markdown/contexts/markdown-table.mjs.map +1 -1
  32. package/dist/render.cjs +4 -10
  33. package/dist/render.mjs +4 -10
  34. package/dist/render.mjs.map +1 -1
  35. package/dist/typescript/components/builtin-file.cjs +9 -31
  36. package/dist/typescript/components/builtin-file.mjs +9 -31
  37. package/dist/typescript/components/builtin-file.mjs.map +1 -1
  38. package/dist/typescript/components/class-declaration.cjs +80 -193
  39. package/dist/typescript/components/class-declaration.mjs +80 -193
  40. package/dist/typescript/components/class-declaration.mjs.map +1 -1
  41. package/dist/typescript/components/dynamic-import-statement.cjs +1 -2
  42. package/dist/typescript/components/dynamic-import-statement.mjs +1 -2
  43. package/dist/typescript/components/dynamic-import-statement.mjs.map +1 -1
  44. package/dist/typescript/components/entry-file.cjs +3 -10
  45. package/dist/typescript/components/entry-file.mjs +3 -10
  46. package/dist/typescript/components/entry-file.mjs.map +1 -1
  47. package/dist/typescript/components/infrastructure-file.cjs +3 -10
  48. package/dist/typescript/components/infrastructure-file.mjs +3 -10
  49. package/dist/typescript/components/infrastructure-file.mjs.map +1 -1
  50. package/dist/typescript/components/interface-declaration.cjs +47 -134
  51. package/dist/typescript/components/interface-declaration.mjs +47 -134
  52. package/dist/typescript/components/interface-declaration.mjs.map +1 -1
  53. package/dist/typescript/components/object-declaration.cjs +35 -79
  54. package/dist/typescript/components/object-declaration.mjs +35 -79
  55. package/dist/typescript/components/object-declaration.mjs.map +1 -1
  56. package/dist/typescript/components/property-name.cjs +3 -3
  57. package/dist/typescript/components/property-name.mjs +3 -3
  58. package/dist/typescript/components/property-name.mjs.map +1 -1
  59. package/dist/typescript/components/record-expression.mjs.map +1 -1
  60. package/dist/typescript/components/tsdoc-reflection.cjs +53 -232
  61. package/dist/typescript/components/tsdoc-reflection.mjs +53 -232
  62. package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
  63. package/dist/typescript/components/tsdoc.cjs +140 -306
  64. package/dist/typescript/components/tsdoc.mjs +140 -306
  65. package/dist/typescript/components/tsdoc.mjs.map +1 -1
  66. package/dist/typescript/components/type-declaration.cjs +9 -22
  67. package/dist/typescript/components/type-declaration.mjs +9 -22
  68. package/dist/typescript/components/type-declaration.mjs.map +1 -1
  69. package/dist/typescript/components/type-parameters.cjs +33 -60
  70. package/dist/typescript/components/type-parameters.mjs +33 -60
  71. package/dist/typescript/components/type-parameters.mjs.map +1 -1
  72. package/dist/typescript/components/typescript-file.cjs +65 -155
  73. package/dist/typescript/components/typescript-file.mjs +65 -155
  74. package/dist/typescript/components/typescript-file.mjs.map +1 -1
  75. package/dist/typescript/contexts/lexical-scope.cjs +1 -7
  76. package/dist/typescript/contexts/lexical-scope.mjs +1 -7
  77. package/dist/typescript/contexts/lexical-scope.mjs.map +1 -1
  78. package/dist/typescript/contexts/member-scope.cjs +2 -7
  79. package/dist/typescript/contexts/member-scope.mjs +2 -7
  80. package/dist/typescript/contexts/member-scope.mjs.map +1 -1
  81. package/dist/typescript/helpers/get-call-signature-props.mjs.map +1 -1
  82. package/dist/typescript/helpers/utilities.mjs.map +1 -1
  83. package/dist/yaml/components/yaml-file.cjs +48 -103
  84. package/dist/yaml/components/yaml-file.mjs +48 -103
  85. package/dist/yaml/components/yaml-file.mjs.map +1 -1
  86. package/package.json +7 -7
  87. package/dist/_virtual/_rolldown/runtime.mjs +0 -3
@@ -2,7 +2,6 @@ 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_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
5
  let _alloy_js_core = require("@alloy-js/core");
7
6
  let _powerlines_deepkit_utilities = require("@powerlines/deepkit/utilities");
8
7
  let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
@@ -36,91 +35,48 @@ function ObjectDeclaration(props) {
36
35
  });
37
36
  if (!props.type) ValueTypeSymbolSlot.moveMembersTo(sym);
38
37
  const keyword = props.var ? "var" : props.let ? "let" : "const";
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", {})];
97
- }
98
- });
38
+ const type = props.type ? <_alloy_js_typescript.TypeRefContext>
39
+ : <TypeSymbolSlot>{props.type}</TypeSymbolSlot>
40
+ </_alloy_js_typescript.TypeRefContext> : void 0;
41
+ return <_alloy_js_core.Show when={!!props.reflection.value}>
42
+ <require_core_contexts_reflection.ReflectionClassContext.Provider value={{
43
+ reflection: props.reflection.value,
44
+ override: {
45
+ name: objectName.value,
46
+ type: objectType.value,
47
+ defaultValue: props.defaultValue?.value
99
48
  }
100
- });
49
+ }}>
50
+ <_alloy_js_core.Show when={!!objectName.value && !!objectType.value}>
51
+ <require_typescript_components_tsdoc_reflection.TSDocReflectionClass reflection={props.reflection.value} />
52
+ <_alloy_js_core.Declaration symbol={sym}>
53
+ {props.export ? "export " : ""}
54
+ {props.default ? "default " : ""}
55
+ {keyword} <_alloy_js_core.Name />
56
+ {type} ={" "}
57
+ <ValueTypeSymbolSlot>
58
+ {props.initializer ?? props.children ?? <_alloy_js_typescript.ObjectExpression>
59
+ <_alloy_js_core.For each={properties.value ?? []} comma={true} doubleHardline={true}>
60
+ {(prop) => <ObjectDeclarationProperty property={prop} />}
61
+ </_alloy_js_core.For>
62
+ </_alloy_js_typescript.ObjectExpression>}
63
+ </ValueTypeSymbolSlot>
64
+ </_alloy_js_core.Declaration>
65
+ </_alloy_js_core.Show>
66
+ <hbr />
67
+ </require_core_contexts_reflection.ReflectionClassContext.Provider>
68
+ </_alloy_js_core.Show>;
101
69
  }
102
70
  /**
103
71
  * Generates a TypeScript object property for the given reflection class.
104
72
  */
105
73
  function ObjectDeclarationProperty(props) {
106
74
  const [{ property }] = (0, _alloy_js_core.splitProps)(props, ["property"]);
107
- return (0, _alloy_js_core_jsx_runtime.createComponent)(require_core_contexts_reflection.ReflectionPropertyContext.Provider, {
108
- value: property,
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
- }
123
- });
75
+ return <require_core_contexts_reflection.ReflectionPropertyContext.Provider value={property}>
76
+ <require_typescript_components_tsdoc_reflection.TSDocReflectionProperty reflection={property} />
77
+ <_alloy_js_typescript.ObjectProperty name={property.getNameAsString()} value={(0, _powerlines_deepkit_utilities.stringifyDefaultValue)(property)} />
78
+ <hbr />
79
+ </require_core_contexts_reflection.ReflectionPropertyContext.Provider>;
124
80
  }
125
81
 
126
82
  //#endregion
@@ -1,6 +1,5 @@
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";
4
3
  import { Declaration, For, Name, Show, computed, createSymbolSlot, splitProps } from "@alloy-js/core";
5
4
  import { stringifyDefaultValue } from "@powerlines/deepkit/utilities";
6
5
  import { camelCase } from "@stryke/string-format/camel-case";
@@ -34,91 +33,48 @@ function ObjectDeclaration(props) {
34
33
  });
35
34
  if (!props.type) ValueTypeSymbolSlot.moveMembersTo(sym);
36
35
  const keyword = props.var ? "var" : props.let ? "let" : "const";
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", {})];
95
- }
96
- });
36
+ const type = props.type ? <TypeRefContext>
37
+ : <TypeSymbolSlot>{props.type}</TypeSymbolSlot>
38
+ </TypeRefContext> : void 0;
39
+ return <Show when={!!props.reflection.value}>
40
+ <ReflectionClassContext.Provider value={{
41
+ reflection: props.reflection.value,
42
+ override: {
43
+ name: objectName.value,
44
+ type: objectType.value,
45
+ defaultValue: props.defaultValue?.value
97
46
  }
98
- });
47
+ }}>
48
+ <Show when={!!objectName.value && !!objectType.value}>
49
+ <TSDocReflectionClass reflection={props.reflection.value} />
50
+ <Declaration symbol={sym}>
51
+ {props.export ? "export " : ""}
52
+ {props.default ? "default " : ""}
53
+ {keyword} <Name />
54
+ {type} ={" "}
55
+ <ValueTypeSymbolSlot>
56
+ {props.initializer ?? props.children ?? <ObjectExpression>
57
+ <For each={properties.value ?? []} comma={true} doubleHardline={true}>
58
+ {(prop) => <ObjectDeclarationProperty property={prop} />}
59
+ </For>
60
+ </ObjectExpression>}
61
+ </ValueTypeSymbolSlot>
62
+ </Declaration>
63
+ </Show>
64
+ <hbr />
65
+ </ReflectionClassContext.Provider>
66
+ </Show>;
99
67
  }
100
68
  /**
101
69
  * Generates a TypeScript object property for the given reflection class.
102
70
  */
103
71
  function ObjectDeclarationProperty(props) {
104
72
  const [{ property }] = splitProps(props, ["property"]);
105
- return createComponent(ReflectionPropertyContext.Provider, {
106
- value: property,
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
- }
121
- });
73
+ return <ReflectionPropertyContext.Provider value={property}>
74
+ <TSDocReflectionProperty reflection={property} />
75
+ <ObjectProperty name={property.getNameAsString()} value={stringifyDefaultValue(property)} />
76
+ <hbr />
77
+ </ReflectionPropertyContext.Provider>;
122
78
  }
123
79
 
124
80
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"object-declaration.mjs","names":["computed","Declaration","CoreDeclaration","createSymbolSlot","For","Name","Show","splitProps","createValueSymbol","ObjectExpression","ObjectProperty","TSSymbolFlags","TypeRefContext","useTSNamePolicy","stringifyDefaultValue","camelCase","pascalCase","isString","isUndefined","ReflectionClassContext","ReflectionPropertyContext","TSDocReflectionClass","TSDocReflectionProperty","ObjectDeclaration","props","reflection","value","objectName","name","toString","getName","objectType","type","properties","getProperties","filter","item","isIgnored","defaultValue","getNameAsString","getAlias","reduce","ret","alias","undefined","getDefaultValue","sort","a","b","isReadonly","localeCompare","TypeSymbolSlot","ValueTypeSymbolSlot","sym","refkeys","refkey","default","export","metadata","tsFlags","nullish","Nullish","None","firstSymbol","namePolicy","for","moveMembersTo","keyword","var","let","_$createComponent","children","when","Provider","override","symbol","_$memo","initializer","each","comma","doubleHardline","prop","ObjectDeclarationProperty","property","_$createIntrinsic"],"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":""}
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,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_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
4
  let _alloy_js_core = require("@alloy-js/core");
5
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
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 ["#", (0, _alloy_js_core_jsx_runtime.memo)(() => declSymbol.name)];
23
- else return [(0, _alloy_js_core_jsx_runtime.memo)(() => quoteIfNeeded(declSymbol.name))];
22
+ if (declSymbol.isPrivateMemberSymbol) return <>#{declSymbol.name}</>;
23
+ else return <>{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";
3
2
  import { MemberDeclarationContext, useContext } from "@alloy-js/core";
3
+ import { 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 ["#", memo(() => declSymbol.name)];
21
- else return [memo(() => quoteIfNeeded(declSymbol.name))];
20
+ if (declSymbol.isPrivateMemberSymbol) return <>#{declSymbol.name}</>;
21
+ else return <>{quoteIfNeeded(declSymbol.name)}</>;
22
22
  }
23
23
  }
24
24
  function quoteIfNeeded(name) {
@@ -1 +1 @@
1
- {"version":3,"file":"property-name.mjs","names":["MemberDeclarationContext","useContext","memo","isValidJSIdentifier","PropertyName","props","name","private","quoteIfNeeded","declSymbol","isPrivateMemberSymbol","_$memo","replace"],"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":""}
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,EAAE,EAAE,WAAW,KAAK;MAE3B,QAAO,GAAG,cAAc,WAAW,KAAK,CAAC;;;AAK/C,SAAS,cAAc,MAAc;AACnC,KAAI,oBAAoB,KAAK,CAC3B,QAAO;KAEP,QAAO,IAAI,KAAK,QAAQ,MAAM,OAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"record-expression.mjs","names":["code","RecordExpression","elementType"],"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":""}
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"}