@powerlines/plugin-alloy 0.26.19 → 0.26.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/components/infrastructure-file.cjs +9 -14
- package/dist/core/components/infrastructure-file.mjs +9 -14
- package/dist/core/components/infrastructure-file.mjs.map +1 -1
- package/dist/core/components/output.cjs +10 -17
- package/dist/core/components/output.mjs +10 -17
- package/dist/core/components/output.mjs.map +1 -1
- package/dist/core/components/single-line-comment.cjs +4 -6
- package/dist/core/components/single-line-comment.mjs +4 -6
- package/dist/core/components/single-line-comment.mjs.map +1 -1
- package/dist/core/components/source-file.cjs +6 -10
- package/dist/core/components/source-file.mjs +6 -10
- package/dist/core/components/source-file.mjs.map +1 -1
- package/dist/core/components/spacing.cjs +4 -6
- package/dist/core/components/spacing.mjs +4 -6
- package/dist/core/components/spacing.mjs.map +1 -1
- package/dist/hcl/components/block-declaration.cjs +8 -12
- package/dist/hcl/components/block-declaration.mjs +8 -12
- package/dist/hcl/components/block-declaration.mjs.map +1 -1
- package/dist/hcl/components/hcl-file.cjs +21 -35
- package/dist/hcl/components/hcl-file.mjs +22 -36
- package/dist/hcl/components/hcl-file.mjs.map +1 -1
- package/dist/hcl/components/packer-file.cjs +8 -8
- package/dist/hcl/components/packer-file.mjs +8 -8
- package/dist/hcl/components/packer-file.mjs.map +1 -1
- package/dist/hcl/components/terraform-file.cjs +8 -8
- package/dist/hcl/components/terraform-file.mjs +8 -8
- package/dist/hcl/components/terraform-file.mjs.map +1 -1
- package/dist/helpers/capnp.cjs +1 -1
- package/dist/helpers/capnp.mjs +1 -1
- package/dist/helpers/capnp.mjs.map +1 -1
- package/dist/index.cjs +7 -12
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +7 -11
- package/dist/index.mjs.map +1 -1
- package/dist/markdown/components/front-matter.cjs +7 -9
- package/dist/markdown/components/front-matter.mjs +7 -9
- package/dist/markdown/components/front-matter.mjs.map +1 -1
- package/dist/markdown/components/markdown-file.cjs +44 -76
- package/dist/markdown/components/markdown-file.mjs +44 -76
- package/dist/markdown/components/markdown-file.mjs.map +1 -1
- package/dist/markdown/components/markdown-table.cjs +28 -49
- package/dist/markdown/components/markdown-table.mjs +28 -49
- package/dist/markdown/components/markdown-table.mjs.map +1 -1
- package/dist/markdown/contexts/markdown-table.mjs.map +1 -1
- package/dist/render.cjs +3 -3
- package/dist/render.mjs +4 -4
- package/dist/render.mjs.map +1 -1
- package/dist/typescript/components/builtin-file.cjs +20 -30
- package/dist/typescript/components/builtin-file.mjs +20 -30
- package/dist/typescript/components/builtin-file.mjs.map +1 -1
- package/dist/typescript/components/class-declaration.cjs +100 -165
- package/dist/typescript/components/class-declaration.mjs +100 -165
- package/dist/typescript/components/class-declaration.mjs.map +1 -1
- package/dist/typescript/components/dynamic-import-statement.cjs +6 -2
- package/dist/typescript/components/dynamic-import-statement.mjs +6 -2
- package/dist/typescript/components/dynamic-import-statement.mjs.map +1 -1
- package/dist/typescript/components/entry-file.cjs +8 -11
- package/dist/typescript/components/entry-file.mjs +8 -11
- package/dist/typescript/components/entry-file.mjs.map +1 -1
- package/dist/typescript/components/interface-declaration.cjs +74 -127
- package/dist/typescript/components/interface-declaration.mjs +74 -127
- package/dist/typescript/components/interface-declaration.mjs.map +1 -1
- package/dist/typescript/components/object-declaration.cjs +50 -84
- package/dist/typescript/components/object-declaration.mjs +50 -84
- package/dist/typescript/components/object-declaration.mjs.map +1 -1
- package/dist/typescript/components/property-name.cjs +3 -3
- package/dist/typescript/components/property-name.mjs +3 -3
- package/dist/typescript/components/property-name.mjs.map +1 -1
- package/dist/typescript/components/record-expression.mjs.map +1 -1
- package/dist/typescript/components/tsdoc-reflection.cjs +108 -241
- package/dist/typescript/components/tsdoc-reflection.mjs +108 -241
- package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
- package/dist/typescript/components/tsdoc.cjs +168 -265
- package/dist/typescript/components/tsdoc.mjs +168 -265
- package/dist/typescript/components/tsdoc.mjs.map +1 -1
- package/dist/typescript/components/type-declaration.cjs +15 -20
- package/dist/typescript/components/type-declaration.mjs +15 -20
- package/dist/typescript/components/type-declaration.mjs.map +1 -1
- package/dist/typescript/components/type-parameters.cjs +29 -55
- package/dist/typescript/components/type-parameters.mjs +29 -55
- package/dist/typescript/components/type-parameters.mjs.map +1 -1
- package/dist/typescript/components/typescript-file.cjs +74 -135
- package/dist/typescript/components/typescript-file.mjs +74 -135
- package/dist/typescript/components/typescript-file.mjs.map +1 -1
- package/dist/typescript/contexts/lexical-scope.cjs +3 -5
- package/dist/typescript/contexts/lexical-scope.mjs +3 -5
- package/dist/typescript/contexts/lexical-scope.mjs.map +1 -1
- package/dist/typescript/contexts/member-scope.cjs +3 -5
- package/dist/typescript/contexts/member-scope.mjs +3 -5
- package/dist/typescript/contexts/member-scope.mjs.map +1 -1
- package/dist/yaml/components/yaml-file.cjs +47 -92
- package/dist/yaml/components/yaml-file.mjs +47 -92
- package/dist/yaml/components/yaml-file.mjs.map +1 -1
- package/package.json +6 -6
|
@@ -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_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
5
|
let _alloy_js_core = require("@alloy-js/core");
|
|
6
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
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,72 +36,44 @@ 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 ? (0, _alloy_js_core_jsx_runtime.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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, {
|
|
89
|
-
property: prop,
|
|
90
|
-
get defaultValue() {
|
|
91
|
-
return props.defaultValue?.value?.[prop.getNameAsString()];
|
|
92
|
-
}
|
|
93
|
-
})
|
|
94
|
-
});
|
|
95
|
-
} });
|
|
96
|
-
} })
|
|
97
|
-
];
|
|
98
|
-
}
|
|
99
|
-
})];
|
|
100
|
-
}
|
|
101
|
-
}), (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
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
|
|
102
49
|
}
|
|
103
|
-
}
|
|
104
|
-
|
|
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, {
|
|
69
|
+
property: prop,
|
|
70
|
+
defaultValue: props.defaultValue?.value?.[prop.getNameAsString()]
|
|
71
|
+
})
|
|
72
|
+
}) }) })
|
|
73
|
+
]
|
|
74
|
+
})]
|
|
75
|
+
}), /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {})]
|
|
76
|
+
})
|
|
105
77
|
});
|
|
106
78
|
}
|
|
107
79
|
/**
|
|
@@ -109,28 +81,22 @@ function ObjectDeclaration(props) {
|
|
|
109
81
|
*/
|
|
110
82
|
function ObjectDeclarationProperty(props) {
|
|
111
83
|
const [{ property, defaultValue }] = (0, _alloy_js_core.splitProps)(props, ["property", "defaultValue"]);
|
|
112
|
-
return (0, _alloy_js_core_jsx_runtime.
|
|
84
|
+
return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(require_core_contexts_reflection.ReflectionPropertyContext.Provider, {
|
|
113
85
|
value: {
|
|
114
86
|
property,
|
|
115
87
|
defaultValue
|
|
116
88
|
},
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return (0, _powerlines_deepkit_utilities.stringifyDefaultValue)(property, defaultValue);
|
|
129
|
-
}
|
|
130
|
-
}),
|
|
131
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
132
|
-
];
|
|
133
|
-
}
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(require_typescript_components_tsdoc_reflection.TSDocReflectionProperty, {
|
|
91
|
+
reflection: property,
|
|
92
|
+
defaultValue
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.ObjectProperty, {
|
|
95
|
+
name: property.getNameAsString(),
|
|
96
|
+
value: (0, _powerlines_deepkit_utilities.stringifyDefaultValue)(property, defaultValue)
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {})
|
|
99
|
+
]
|
|
134
100
|
});
|
|
135
101
|
}
|
|
136
102
|
|
|
@@ -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";
|
|
4
3
|
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,72 +34,44 @@ 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 ?
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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, {
|
|
87
|
-
property: prop,
|
|
88
|
-
get defaultValue() {
|
|
89
|
-
return props.defaultValue?.value?.[prop.getNameAsString()];
|
|
90
|
-
}
|
|
91
|
-
})
|
|
92
|
-
});
|
|
93
|
-
} });
|
|
94
|
-
} })
|
|
95
|
-
];
|
|
96
|
-
}
|
|
97
|
-
})];
|
|
98
|
-
}
|
|
99
|
-
}), createIntrinsic("hbr", {})];
|
|
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
|
|
100
47
|
}
|
|
101
|
-
}
|
|
102
|
-
|
|
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, {
|
|
67
|
+
property: prop,
|
|
68
|
+
defaultValue: props.defaultValue?.value?.[prop.getNameAsString()]
|
|
69
|
+
})
|
|
70
|
+
}) }) })
|
|
71
|
+
]
|
|
72
|
+
})]
|
|
73
|
+
}), /* @__PURE__ */ jsx("hbr", {})]
|
|
74
|
+
})
|
|
103
75
|
});
|
|
104
76
|
}
|
|
105
77
|
/**
|
|
@@ -107,28 +79,22 @@ function ObjectDeclaration(props) {
|
|
|
107
79
|
*/
|
|
108
80
|
function ObjectDeclarationProperty(props) {
|
|
109
81
|
const [{ property, defaultValue }] = splitProps(props, ["property", "defaultValue"]);
|
|
110
|
-
return
|
|
82
|
+
return /* @__PURE__ */ jsxs(ReflectionPropertyContext.Provider, {
|
|
111
83
|
value: {
|
|
112
84
|
property,
|
|
113
85
|
defaultValue
|
|
114
86
|
},
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return stringifyDefaultValue(property, defaultValue);
|
|
127
|
-
}
|
|
128
|
-
}),
|
|
129
|
-
createIntrinsic("hbr", {})
|
|
130
|
-
];
|
|
131
|
-
}
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ jsx(TSDocReflectionProperty, {
|
|
89
|
+
reflection: property,
|
|
90
|
+
defaultValue
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ jsx(ObjectProperty, {
|
|
93
|
+
name: property.getNameAsString(),
|
|
94
|
+
value: stringifyDefaultValue(property, defaultValue)
|
|
95
|
+
}),
|
|
96
|
+
/* @__PURE__ */ jsx("hbr", {})
|
|
97
|
+
]
|
|
132
98
|
});
|
|
133
99
|
}
|
|
134
100
|
|
|
@@ -1 +1 @@
|
|
|
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\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 !item.isRuntime() &&\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 => (\n <ObjectDeclarationProperty\n property={prop}\n defaultValue={\n props.defaultValue?.value?.[prop.getNameAsString()]\n }\n />\n )}\n </For>\n </ObjectExpression>\n )}\n </ValueTypeSymbolSlot>\n </CoreDeclaration>\n </Show>\n <hbr />\n </ReflectionClassContext.Provider>\n </Show>\n );\n}\n\nexport interface ObjectDeclarationPropertyProps extends ComponentProps {\n property: ReflectionProperty;\n defaultValue?: any;\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, defaultValue }] = splitProps(props, [\n \"property\",\n \"defaultValue\"\n ]);\n\n return (\n <ReflectionPropertyContext.Provider value={{ property, defaultValue }}>\n <TSDocReflectionProperty\n reflection={property}\n defaultValue={defaultValue}\n />\n <ObjectProperty\n name={property.getNameAsString()}\n value={stringifyDefaultValue(property, defaultValue)}\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\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 !item.isRuntime() &&\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 => (\n <ObjectDeclarationProperty\n property={prop}\n defaultValue={\n props.defaultValue?.value?.[prop.getNameAsString()]\n }\n />\n )}\n </For>\n </ObjectExpression>\n )}\n </ValueTypeSymbolSlot>\n </CoreDeclaration>\n </Show>\n <hbr />\n </ReflectionClassContext.Provider>\n </Show>\n );\n}\n\nexport interface ObjectDeclarationPropertyProps extends ComponentProps {\n property: ReflectionProperty;\n defaultValue?: any;\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, defaultValue }] = splitProps(props, [\n \"property\",\n \"defaultValue\"\n ]);\n\n return (\n <ReflectionPropertyContext.Provider value={{ property, defaultValue }}>\n <TSDocReflectionProperty\n reflection={property}\n defaultValue={defaultValue}\n />\n <ObjectProperty\n name={property.getNameAsString()}\n value={stringifyDefaultValue(property, defaultValue)}\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
|
|
23
|
-
else return
|
|
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) });
|
|
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 { 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 ["#",
|
|
21
|
-
else return
|
|
20
|
+
if (declSymbol.isPrivateMemberSymbol) return /* @__PURE__ */ jsxs(Fragment, { children: ["#", declSymbol.name] });
|
|
21
|
+
else return /* @__PURE__ */ jsx(Fragment, { children: 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;
|
|
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 +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":";;;
|
|
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"}
|