@powerlines/plugin-alloy 0.26.149 → 0.26.151

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 (30) hide show
  1. package/dist/core/contexts/schema.d.cts +2 -2
  2. package/dist/core/contexts/schema.d.cts.map +1 -1
  3. package/dist/core/contexts/schema.d.mts +2 -2
  4. package/dist/core/contexts/schema.d.mts.map +1 -1
  5. package/dist/typescript/components/index.d.cts +2 -2
  6. package/dist/typescript/components/index.d.mts +2 -2
  7. package/dist/typescript/components/interface-declaration.cjs +26 -13
  8. package/dist/typescript/components/interface-declaration.d.cts +18 -16
  9. package/dist/typescript/components/interface-declaration.d.cts.map +1 -1
  10. package/dist/typescript/components/interface-declaration.d.mts +18 -16
  11. package/dist/typescript/components/interface-declaration.d.mts.map +1 -1
  12. package/dist/typescript/components/interface-declaration.mjs +26 -13
  13. package/dist/typescript/components/interface-declaration.mjs.map +1 -1
  14. package/dist/typescript/components/object-declaration.cjs +19 -10
  15. package/dist/typescript/components/object-declaration.d.cts +10 -7
  16. package/dist/typescript/components/object-declaration.d.cts.map +1 -1
  17. package/dist/typescript/components/object-declaration.d.mts +10 -7
  18. package/dist/typescript/components/object-declaration.d.mts.map +1 -1
  19. package/dist/typescript/components/object-declaration.mjs +20 -11
  20. package/dist/typescript/components/object-declaration.mjs.map +1 -1
  21. package/dist/typescript/components/tsdoc-schema.cjs +7 -5
  22. package/dist/typescript/components/tsdoc-schema.d.cts +8 -7
  23. package/dist/typescript/components/tsdoc-schema.d.cts.map +1 -1
  24. package/dist/typescript/components/tsdoc-schema.d.mts +8 -7
  25. package/dist/typescript/components/tsdoc-schema.d.mts.map +1 -1
  26. package/dist/typescript/components/tsdoc-schema.mjs +7 -5
  27. package/dist/typescript/components/tsdoc-schema.mjs.map +1 -1
  28. package/dist/typescript/index.d.cts +2 -2
  29. package/dist/typescript/index.d.mts +2 -2
  30. package/package.json +6 -6
@@ -11,7 +11,7 @@ declare const SchemaContext: ComponentContext<JsonSchemaLike>;
11
11
  *
12
12
  * @returns A reactive version of the current schema.
13
13
  */
14
- declare function useSchema(): JsonSchemaLike;
14
+ declare function useSchema(): any;
15
15
  /**
16
16
  * The schema property context used in template rendering.
17
17
  */
@@ -21,7 +21,7 @@ declare const SchemaPropertyContext: ComponentContext<JsonSchemaLike>;
21
21
  *
22
22
  * @returns A reactive version of the current schema property.
23
23
  */
24
- declare function useSchemaProperty(): JsonSchemaLike;
24
+ declare function useSchemaProperty(): any;
25
25
  //#endregion
26
26
  export { SchemaContext, SchemaPropertyContext, useSchema, useSchemaProperty };
27
27
  //# sourceMappingURL=schema.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.cts","names":[],"sources":["../../../src/core/contexts/schema.ts"],"mappings":";;;;;;AAyBA;cAAa,aAAA,EAAe,gBAAgB,CAAC,cAAA;;;AAAc;AAQ3D;;iBAAgB,SAAA,CAAA,GAAS,cAAA;;AAAA;AAezB;cAAa,qBAAA,EAAuB,gBAAgB,CAAC,cAAA;;;AAAc;AAQnE;;iBAAgB,iBAAA,CAAA,GAAiB,cAAA"}
1
+ {"version":3,"file":"schema.d.cts","names":[],"sources":["../../../src/core/contexts/schema.ts"],"mappings":";;;;;;AAyBA;cAAa,aAAA,EAAe,gBAAgB,CAAC,cAAA;;;AAAc;AAQ3D;;iBAAgB,SAAA,CAAA;;AAAS;AAezB;cAAa,qBAAA,EAAuB,gBAAgB,CAAC,cAAA;;;AAAc;AAQnE;;iBAAgB,iBAAA,CAAA"}
@@ -11,7 +11,7 @@ declare const SchemaContext: ComponentContext<JsonSchemaLike>;
11
11
  *
12
12
  * @returns A reactive version of the current schema.
13
13
  */
14
- declare function useSchema(): JsonSchemaLike;
14
+ declare function useSchema(): any;
15
15
  /**
16
16
  * The schema property context used in template rendering.
17
17
  */
@@ -21,7 +21,7 @@ declare const SchemaPropertyContext: ComponentContext<JsonSchemaLike>;
21
21
  *
22
22
  * @returns A reactive version of the current schema property.
23
23
  */
24
- declare function useSchemaProperty(): JsonSchemaLike;
24
+ declare function useSchemaProperty(): any;
25
25
  //#endregion
26
26
  export { SchemaContext, SchemaPropertyContext, useSchema, useSchemaProperty };
27
27
  //# sourceMappingURL=schema.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.mts","names":[],"sources":["../../../src/core/contexts/schema.ts"],"mappings":";;;;;;AAyBA;cAAa,aAAA,EAAe,gBAAgB,CAAC,cAAA;;;AAAc;AAQ3D;;iBAAgB,SAAA,CAAA,GAAS,cAAA;;AAAA;AAezB;cAAa,qBAAA,EAAuB,gBAAgB,CAAC,cAAA;;;AAAc;AAQnE;;iBAAgB,iBAAA,CAAA,GAAiB,cAAA"}
1
+ {"version":3,"file":"schema.d.mts","names":[],"sources":["../../../src/core/contexts/schema.ts"],"mappings":";;;;;;AAyBA;cAAa,aAAA,EAAe,gBAAgB,CAAC,cAAA;;;AAAc;AAQ3D;;iBAAgB,SAAA,CAAA;;AAAS;AAezB;cAAa,qBAAA,EAAuB,gBAAgB,CAAC,cAAA;;;AAAc;AAQnE;;iBAAgB,iBAAA,CAAA"}
@@ -5,10 +5,10 @@ import { TypeParameters, TypeParametersProps } from "./type-parameters.cjs";
5
5
  import { ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet } from "./class-declaration.cjs";
6
6
  import { DynamicImportStatement, DynamicImportStatementProps } from "./dynamic-import-statement.cjs";
7
7
  import { EntryFile, EntryFileProps } from "./entry-file.cjs";
8
- import { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, InterfaceSchemaMemberProps } from "./interface-declaration.cjs";
8
+ import { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfaceSchemaMemberProps } from "./interface-declaration.cjs";
9
9
  import { ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps } from "./object-declaration.cjs";
10
10
  import { PropertyName, PropertyNameProps } from "./property-name.cjs";
11
11
  import { RecordExpression, RecordExpressionProps } from "./record-expression.cjs";
12
12
  import { TSDocObjectSchema, TSDocObjectSchemaProps, TSDocSchemaProperty, TSDocSchemaPropertyProps } from "./tsdoc-schema.cjs";
13
13
  import { TypeDeclaration, TypeDeclarationProps } from "./type-declaration.cjs";
14
- export { BuiltinFile, BuiltinFileProps, ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, DynamicImportStatement, DynamicImportStatementProps, EntryFile, EntryFileProps, InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, InterfaceSchemaMemberProps, ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps, PropertyName, PropertyNameProps, RecordExpression, RecordExpressionProps, TSDoc, TSDocAlias, TSDocAttributesTags, TSDocAttributesTagsProps, TSDocDefaultValue, TSDocDefaultValueProps, TSDocDomain, TSDocExample, TSDocExampleProps, TSDocGroup, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocModuleProps, TSDocObjectSchema, TSDocObjectSchemaProps, TSDocParam, TSDocParamProps, TSDocParams, TSDocParamsProps, TSDocPermission, TSDocProps, TSDocReadonly, TSDocRemarks, TSDocReturns, TSDocRuntime, TSDocSchemaProperty, TSDocSchemaPropertyProps, TSDocTag, TSDocTagProps, TSDocThrows, TSDocTitle, TypeDeclaration, TypeDeclarationProps, TypeParameters, TypeParametersProps, TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports, TypescriptFileHeaderImportsProps, TypescriptFileHeaderProps, TypescriptFileProps };
14
+ export { BuiltinFile, BuiltinFileProps, ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, DynamicImportStatement, DynamicImportStatementProps, EntryFile, EntryFileProps, InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfaceSchemaMemberProps, ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps, PropertyName, PropertyNameProps, RecordExpression, RecordExpressionProps, TSDoc, TSDocAlias, TSDocAttributesTags, TSDocAttributesTagsProps, TSDocDefaultValue, TSDocDefaultValueProps, TSDocDomain, TSDocExample, TSDocExampleProps, TSDocGroup, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocModuleProps, TSDocObjectSchema, TSDocObjectSchemaProps, TSDocParam, TSDocParamProps, TSDocParams, TSDocParamsProps, TSDocPermission, TSDocProps, TSDocReadonly, TSDocRemarks, TSDocReturns, TSDocRuntime, TSDocSchemaProperty, TSDocSchemaPropertyProps, TSDocTag, TSDocTagProps, TSDocThrows, TSDocTitle, TypeDeclaration, TypeDeclarationProps, TypeParameters, TypeParametersProps, TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports, TypescriptFileHeaderImportsProps, TypescriptFileHeaderProps, TypescriptFileProps };
@@ -5,10 +5,10 @@ import { TypeParameters, TypeParametersProps } from "./type-parameters.mjs";
5
5
  import { ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet } from "./class-declaration.mjs";
6
6
  import { DynamicImportStatement, DynamicImportStatementProps } from "./dynamic-import-statement.mjs";
7
7
  import { EntryFile, EntryFileProps } from "./entry-file.mjs";
8
- import { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, InterfaceSchemaMemberProps } from "./interface-declaration.mjs";
8
+ import { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfaceSchemaMemberProps } from "./interface-declaration.mjs";
9
9
  import { ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps } from "./object-declaration.mjs";
10
10
  import { PropertyName, PropertyNameProps } from "./property-name.mjs";
11
11
  import { RecordExpression, RecordExpressionProps } from "./record-expression.mjs";
12
12
  import { TSDocObjectSchema, TSDocObjectSchemaProps, TSDocSchemaProperty, TSDocSchemaPropertyProps } from "./tsdoc-schema.mjs";
13
13
  import { TypeDeclaration, TypeDeclarationProps } from "./type-declaration.mjs";
14
- export { BuiltinFile, BuiltinFileProps, ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, DynamicImportStatement, DynamicImportStatementProps, EntryFile, EntryFileProps, InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, InterfaceSchemaMemberProps, ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps, PropertyName, PropertyNameProps, RecordExpression, RecordExpressionProps, TSDoc, TSDocAlias, TSDocAttributesTags, TSDocAttributesTagsProps, TSDocDefaultValue, TSDocDefaultValueProps, TSDocDomain, TSDocExample, TSDocExampleProps, TSDocGroup, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocModuleProps, TSDocObjectSchema, TSDocObjectSchemaProps, TSDocParam, TSDocParamProps, TSDocParams, TSDocParamsProps, TSDocPermission, TSDocProps, TSDocReadonly, TSDocRemarks, TSDocReturns, TSDocRuntime, TSDocSchemaProperty, TSDocSchemaPropertyProps, TSDocTag, TSDocTagProps, TSDocThrows, TSDocTitle, TypeDeclaration, TypeDeclarationProps, TypeParameters, TypeParametersProps, TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports, TypescriptFileHeaderImportsProps, TypescriptFileHeaderProps, TypescriptFileProps };
14
+ export { BuiltinFile, BuiltinFileProps, ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, DynamicImportStatement, DynamicImportStatementProps, EntryFile, EntryFileProps, InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfaceSchemaMemberProps, ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps, PropertyName, PropertyNameProps, RecordExpression, RecordExpressionProps, TSDoc, TSDocAlias, TSDocAttributesTags, TSDocAttributesTagsProps, TSDocDefaultValue, TSDocDefaultValueProps, TSDocDomain, TSDocExample, TSDocExampleProps, TSDocGroup, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocModuleProps, TSDocObjectSchema, TSDocObjectSchemaProps, TSDocParam, TSDocParamProps, TSDocParams, TSDocParamsProps, TSDocPermission, TSDocProps, TSDocReadonly, TSDocRemarks, TSDocReturns, TSDocRuntime, TSDocSchemaProperty, TSDocSchemaPropertyProps, TSDocTag, TSDocTagProps, TSDocThrows, TSDocTitle, TypeDeclaration, TypeDeclarationProps, TypeParameters, TypeParametersProps, TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports, TypescriptFileHeaderImportsProps, TypescriptFileHeaderProps, TypescriptFileProps };
@@ -7,7 +7,6 @@ const require_typescript_components_type_parameters = require('./type-parameters
7
7
  const require_typescript_components_tsdoc_schema = require('./tsdoc-schema.cjs');
8
8
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
9
9
  let _alloy_js_core = require("@alloy-js/core");
10
- let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
11
10
  let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
12
11
  let _alloy_js_typescript = require("@alloy-js/typescript");
13
12
  let _powerlines_schema = require("@powerlines/schema");
@@ -61,11 +60,10 @@ function InterfaceMember(props) {
61
60
  "]: ",
62
61
  type
63
62
  ];
64
- const optional = !!(props.schema && "nullable" in props.schema && props.schema.nullable) || !!props.nullish;
65
63
  const scope = (0, _alloy_js_typescript.useTSMemberScope)();
66
64
  const sym = (0, _alloy_js_core.createSymbol)(_alloy_js_typescript.TSOutputSymbol, ((props.schema ? props.schema?.name : void 0) || (0, _stryke_type_checks_is_set_string.isSetString)(props.name) ? props.name : props.name.toString()) || (0, _stryke_unique_id_uuid.uuid)().replace(/-/g, ""), scope.ownerSymbol.staticMembers, {
67
65
  refkeys: props.refkey,
68
- tsFlags: _alloy_js_typescript.TSSymbolFlags.TypeSymbol | (optional ? _alloy_js_typescript.TSSymbolFlags.Nullish : _alloy_js_typescript.TSSymbolFlags.None),
66
+ tsFlags: _alloy_js_typescript.TSSymbolFlags.TypeSymbol | (!!(props.schema && (0, _powerlines_schema.isSchemaNullable)(props.schema)) || !!props.nullish ? _alloy_js_typescript.TSSymbolFlags.Nullish : _alloy_js_typescript.TSSymbolFlags.None),
69
67
  namePolicy: (0, _alloy_js_typescript.useTSNamePolicy)().for("interface-member"),
70
68
  binder: scope.binder
71
69
  });
@@ -91,7 +89,7 @@ function InterfaceMember(props) {
91
89
  }),
92
90
  readonly,
93
91
  (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_property_name.PropertyName, {}),
94
- optional ? "?" : "",
92
+ (0, _alloy_js_core_jsx_runtime.memo)(() => !props.required ? "?" : ""),
95
93
  ": ",
96
94
  type
97
95
  ];
@@ -195,7 +193,15 @@ function InterfaceDeclaration(props) {
195
193
  each: properties,
196
194
  doubleHardline: true,
197
195
  semicolon: true,
198
- children: (property) => (0, _alloy_js_core_jsx_runtime.createComponent)(InterfaceDeclarationProperty, { schema: property })
196
+ children: (property) => (0, _alloy_js_core_jsx_runtime.createComponent)(InterfaceDeclarationProperty, {
197
+ get name() {
198
+ return property.name;
199
+ },
200
+ schema: property,
201
+ get required() {
202
+ return !!property?.required;
203
+ }
204
+ })
199
205
  });
200
206
  } }))];
201
207
  }
@@ -207,25 +213,32 @@ function InterfaceDeclaration(props) {
207
213
  * Generates a TypeScript interface property for the given reflection class.
208
214
  */
209
215
  function InterfaceDeclarationProperty(props) {
210
- const [{ schema }, rest] = (0, _alloy_js_core.splitProps)(props, ["schema"]);
211
- const name = (0, _alloy_js_core.computed)(() => schema?.name || (0, _stryke_string_format_camel_case.camelCase)(schema?.title || schema?.databaseSchemaName || schema?.$id));
216
+ const [{ schema, name, required, defaultValue }, rest] = (0, _alloy_js_core.splitProps)(props, [
217
+ "schema",
218
+ "name",
219
+ "required",
220
+ "defaultValue"
221
+ ]);
212
222
  return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
213
223
  get when() {
214
- return (0, _stryke_type_checks_is_set_string.isSetString)(name.value);
224
+ return (0, _stryke_type_checks_is_set_string.isSetString)(name);
215
225
  },
216
226
  get children() {
217
227
  return (0, _alloy_js_core_jsx_runtime.createComponent)(require_core_contexts_schema.SchemaPropertyContext.Provider, {
218
228
  value: schema,
219
229
  get children() {
220
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc_schema.TSDocSchemaProperty, { schema }), (0, _alloy_js_core_jsx_runtime.createComponent)(InterfaceMember, (0, _alloy_js_core_jsx_runtime.mergeProps)({
221
- get name() {
222
- return name.value;
223
- },
230
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc_schema.TSDocSchemaProperty, {
231
+ schema,
232
+ defaultValue
233
+ }), (0, _alloy_js_core_jsx_runtime.createComponent)(InterfaceMember, (0, _alloy_js_core_jsx_runtime.mergeProps)({
234
+ name,
235
+ schema,
236
+ required,
224
237
  get readOnly() {
225
238
  return schema?.readOnly;
226
239
  },
227
240
  get nullish() {
228
- return schema?.nullable || (0, _powerlines_schema.isSchemaNullable)(schema);
241
+ return (0, _powerlines_schema.isSchemaNullable)(schema);
229
242
  },
230
243
  get type() {
231
244
  return (0, _powerlines_schema.getPrimarySchemaType)(schema);
@@ -1,11 +1,11 @@
1
1
  import { ComponentProps } from "../../types/components.cjs";
2
2
  import { Children, Namekey, Refkey } from "@alloy-js/core";
3
3
  import { CommonDeclarationProps, TypeParameterDescriptor } from "@alloy-js/typescript";
4
- import { JsonSchema, JsonSchemaPrimitiveType, JsonSchemaProperty } from "@powerlines/schema";
4
+ import { JsonSchema, JsonSchemaPrimitiveType } from "@powerlines/schema";
5
5
  import { PartialKeys } from "@stryke/types/base";
6
6
 
7
7
  //#region src/typescript/components/interface-declaration.d.ts
8
- interface InterfaceDeclarationProps<T extends Record<string, any> = Record<string, any>> extends PartialKeys<CommonDeclarationProps, "name">, ComponentProps {
8
+ interface InterfaceDeclarationProps extends PartialKeys<CommonDeclarationProps, "name">, ComponentProps {
9
9
  /**
10
10
  * A base type that this interface extends. This can be used to represent inheritance
11
11
  */
@@ -20,37 +20,39 @@ interface InterfaceDeclarationProps<T extends Record<string, any> = Record<strin
20
20
  * @remarks
21
21
  * This is used to generate the members of the interface based on the properties of the schema.
22
22
  */
23
- schema?: JsonSchema<T>;
23
+ schema?: JsonSchema;
24
24
  /**
25
25
  * Documentation for the interface. This can be a string or any Alloy component that renders documentation content (such as `TSDoc`).
26
26
  */
27
27
  doc?: Children;
28
28
  }
29
- interface InterfaceDeclarationPropertyProps<T extends Record<string, any> = Record<string, any>> extends Omit<InterfaceMemberProps<T>, "name">, ComponentProps {
30
- schema: JsonSchemaProperty<T>;
31
- }
29
+ type InterfaceDeclarationPropertyProps = InterfaceMemberProps & ComponentProps & {
30
+ schema: JsonSchema;
31
+ name: string;
32
+ required: boolean;
33
+ defaultValue?: unknown;
34
+ };
32
35
  interface InterfaceExpressionProps {
33
36
  children?: Children;
34
37
  }
35
38
  declare const InterfaceExpression: import("@alloy-js/core").Component<InterfaceExpressionProps>;
36
39
  interface InterfaceMemberPropsBase {
37
40
  children?: Children;
41
+ name: string | Namekey;
38
42
  doc?: Children;
39
43
  refkey?: Refkey | Refkey[];
40
44
  readOnly?: boolean;
41
45
  type?: Children | JsonSchemaPrimitiveType | string;
42
46
  nullish?: boolean;
43
47
  }
44
- interface InterfacePropertyMemberProps extends InterfaceMemberPropsBase {
45
- name: string | Namekey;
46
- }
47
48
  interface InterfaceIndexerMemberProps extends InterfaceMemberPropsBase {
48
49
  indexer: Children;
49
50
  }
50
- interface InterfaceSchemaMemberProps<T extends Record<string, any> = Record<string, any>> extends InterfaceMemberPropsBase {
51
- schema: JsonSchemaProperty<T>;
51
+ interface InterfaceSchemaMemberProps extends InterfaceMemberPropsBase {
52
+ schema: JsonSchema;
53
+ required: boolean;
52
54
  }
53
- type InterfaceMemberProps<T extends Record<string, any> = Record<string, any>> = InterfacePropertyMemberProps | InterfaceIndexerMemberProps | InterfaceSchemaMemberProps<T>;
55
+ type InterfaceMemberProps = InterfaceIndexerMemberProps | InterfaceSchemaMemberProps;
54
56
  /**
55
57
  * Create a TypeScript interface member.
56
58
  *
@@ -60,15 +62,15 @@ type InterfaceMemberProps<T extends Record<string, any> = Record<string, any>> =
60
62
  * The type of the member can be provided either as the `type` prop or as the
61
63
  * children of the component.
62
64
  */
63
- declare function InterfaceMember<T extends Record<string, any> = Record<string, any>>(props: InterfaceMemberProps<T>): Children;
65
+ declare function InterfaceMember(props: InterfaceMemberProps): Children;
64
66
  /**
65
67
  * Generates a TypeScript interface for the given schema.
66
68
  */
67
- declare function InterfaceDeclaration<T extends Record<string, any> = Record<string, any>>(props: InterfaceDeclarationProps<T>): Children;
69
+ declare function InterfaceDeclaration(props: InterfaceDeclarationProps): Children;
68
70
  /**
69
71
  * Generates a TypeScript interface property for the given reflection class.
70
72
  */
71
- declare function InterfaceDeclarationProperty<T extends Record<string, any> = Record<string, any>>(props: InterfaceDeclarationPropertyProps<T>): Children;
73
+ declare function InterfaceDeclarationProperty(props: InterfaceDeclarationPropertyProps): Children;
72
74
  //#endregion
73
- export { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, InterfaceSchemaMemberProps };
75
+ export { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfaceSchemaMemberProps };
74
76
  //# sourceMappingURL=interface-declaration.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interface-declaration.d.cts","names":[],"sources":["../../../src/typescript/components/interface-declaration.tsx"],"mappings":";;;;;;;UA0EiB,yBAAA,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A,CAChC,KAAA,EAAO,iCAAA,CAAkC,CAAA,IAAE,QAAA"}
1
+ {"version":3,"file":"interface-declaration.d.cts","names":[],"sources":["../../../src/typescript/components/interface-declaration.tsx"],"mappings":";;;;;;;UAuEiB,yBAAA,SACP,WAAA,CAAY,sBAAA,WAAiC,cAAA;;AADvD;;EAKE,OAAA,GAAU,QAAA;EAJU;;;EASpB,cAAA,GAAiB,uBAAA;EAaX;;;;;;EALN,MAAA,GAAS,UAAA;EAjB4C;;;EAsBrD,GAAA,GAAM,QAAA;AAAA;AAAA,KAGI,iCAAA,GAAoC,oBAAA,GAC9C,cAAA;EACE,MAAA,EAAQ,UAAA;EACR,IAAA;EACA,QAAA;EACA,YAAA;AAAA;AAAA,UAGa,wBAAA;EACf,QAAA,GAAW,QAAQ;AAAA;AAAA,cAGR,mBAAA,2BAAmB,SAAA,CAAA,wBAAA;AAAA,UAoBf,wBAAA;EACf,QAAA,GAAW,QAAA;EACX,IAAA,WAAe,OAAA;EACf,GAAA,GAAM,QAAA;EACN,MAAA,GAAS,MAAA,GAAS,MAAA;EAClB,QAAA;EACA,IAAA,GAAO,QAAA,GAAW,uBAAA;EAClB,OAAA;AAAA;AAAA,UAGe,2BAAA,SAAoC,wBAAwB;EAC3E,OAAA,EAAS,QAAA;AAAA;AAAA,UAGM,0BAAA,SAAmC,wBAAwB;EAC1E,MAAA,EAAQ,UAAA;EACR,QAAA;AAAA;AAAA,KAGU,oBAAA,GACR,2BAAA,GACA,0BAA0B;AA5CT;AAGrB;;;;AAAgC;AAoBhC;;;AAvBqB,iBAuDL,eAAA,CAAgB,KAAA,EAAO,oBAAA,GAAoB,QAAA;;;;iBA6H3C,oBAAA,CAAqB,KAAA,EAAO,yBAAA,GAAyB,QAAA;;;;iBAoErD,4BAAA,CACd,KAAA,EAAO,iCAAA,GAAiC,QAAA"}
@@ -1,11 +1,11 @@
1
1
  import { ComponentProps } from "../../types/components.mjs";
2
2
  import { Children, Namekey, Refkey } from "@alloy-js/core";
3
3
  import { CommonDeclarationProps, TypeParameterDescriptor } from "@alloy-js/typescript";
4
- import { JsonSchema, JsonSchemaPrimitiveType, JsonSchemaProperty } from "@powerlines/schema";
4
+ import { JsonSchema, JsonSchemaPrimitiveType } from "@powerlines/schema";
5
5
  import { PartialKeys } from "@stryke/types/base";
6
6
 
7
7
  //#region src/typescript/components/interface-declaration.d.ts
8
- interface InterfaceDeclarationProps<T extends Record<string, any> = Record<string, any>> extends PartialKeys<CommonDeclarationProps, "name">, ComponentProps {
8
+ interface InterfaceDeclarationProps extends PartialKeys<CommonDeclarationProps, "name">, ComponentProps {
9
9
  /**
10
10
  * A base type that this interface extends. This can be used to represent inheritance
11
11
  */
@@ -20,37 +20,39 @@ interface InterfaceDeclarationProps<T extends Record<string, any> = Record<strin
20
20
  * @remarks
21
21
  * This is used to generate the members of the interface based on the properties of the schema.
22
22
  */
23
- schema?: JsonSchema<T>;
23
+ schema?: JsonSchema;
24
24
  /**
25
25
  * Documentation for the interface. This can be a string or any Alloy component that renders documentation content (such as `TSDoc`).
26
26
  */
27
27
  doc?: Children;
28
28
  }
29
- interface InterfaceDeclarationPropertyProps<T extends Record<string, any> = Record<string, any>> extends Omit<InterfaceMemberProps<T>, "name">, ComponentProps {
30
- schema: JsonSchemaProperty<T>;
31
- }
29
+ type InterfaceDeclarationPropertyProps = InterfaceMemberProps & ComponentProps & {
30
+ schema: JsonSchema;
31
+ name: string;
32
+ required: boolean;
33
+ defaultValue?: unknown;
34
+ };
32
35
  interface InterfaceExpressionProps {
33
36
  children?: Children;
34
37
  }
35
38
  declare const InterfaceExpression: import("@alloy-js/core").Component<InterfaceExpressionProps>;
36
39
  interface InterfaceMemberPropsBase {
37
40
  children?: Children;
41
+ name: string | Namekey;
38
42
  doc?: Children;
39
43
  refkey?: Refkey | Refkey[];
40
44
  readOnly?: boolean;
41
45
  type?: Children | JsonSchemaPrimitiveType | string;
42
46
  nullish?: boolean;
43
47
  }
44
- interface InterfacePropertyMemberProps extends InterfaceMemberPropsBase {
45
- name: string | Namekey;
46
- }
47
48
  interface InterfaceIndexerMemberProps extends InterfaceMemberPropsBase {
48
49
  indexer: Children;
49
50
  }
50
- interface InterfaceSchemaMemberProps<T extends Record<string, any> = Record<string, any>> extends InterfaceMemberPropsBase {
51
- schema: JsonSchemaProperty<T>;
51
+ interface InterfaceSchemaMemberProps extends InterfaceMemberPropsBase {
52
+ schema: JsonSchema;
53
+ required: boolean;
52
54
  }
53
- type InterfaceMemberProps<T extends Record<string, any> = Record<string, any>> = InterfacePropertyMemberProps | InterfaceIndexerMemberProps | InterfaceSchemaMemberProps<T>;
55
+ type InterfaceMemberProps = InterfaceIndexerMemberProps | InterfaceSchemaMemberProps;
54
56
  /**
55
57
  * Create a TypeScript interface member.
56
58
  *
@@ -60,15 +62,15 @@ type InterfaceMemberProps<T extends Record<string, any> = Record<string, any>> =
60
62
  * The type of the member can be provided either as the `type` prop or as the
61
63
  * children of the component.
62
64
  */
63
- declare function InterfaceMember<T extends Record<string, any> = Record<string, any>>(props: InterfaceMemberProps<T>): Children;
65
+ declare function InterfaceMember(props: InterfaceMemberProps): Children;
64
66
  /**
65
67
  * Generates a TypeScript interface for the given schema.
66
68
  */
67
- declare function InterfaceDeclaration<T extends Record<string, any> = Record<string, any>>(props: InterfaceDeclarationProps<T>): Children;
69
+ declare function InterfaceDeclaration(props: InterfaceDeclarationProps): Children;
68
70
  /**
69
71
  * Generates a TypeScript interface property for the given reflection class.
70
72
  */
71
- declare function InterfaceDeclarationProperty<T extends Record<string, any> = Record<string, any>>(props: InterfaceDeclarationPropertyProps<T>): Children;
73
+ declare function InterfaceDeclarationProperty(props: InterfaceDeclarationPropertyProps): Children;
72
74
  //#endregion
73
- export { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, InterfaceSchemaMemberProps };
75
+ export { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfaceSchemaMemberProps };
74
76
  //# sourceMappingURL=interface-declaration.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interface-declaration.d.mts","names":[],"sources":["../../../src/typescript/components/interface-declaration.tsx"],"mappings":";;;;;;;UA0EiB,yBAAA,WACL,MAAA,gBAAsB,MAAA,uBAExB,WAAA,CAAY,sBAAA,WAAiC,cAAA;;AAHvD;;EAOE,OAAA,GAAU,QAAA;EANA;;;EAWV,cAAA,GAAiB,uBAAA;EAAA;;;;;;EAQjB,MAAA,GAAS,UAAA,CAAW,CAAA;EAjB+C;;;EAsBnE,GAAA,GAAM,QAAA;AAAA;AAAA,UAGS,iCAAA,WACL,MAAA,gBAAsB,MAAA,uBAExB,IAAA,CAAK,oBAAA,CAAqB,CAAA,YAAa,cAAA;EAC/C,MAAA,EAAQ,kBAAA,CAAmB,CAAA;AAAA;AAAA,UAGZ,wBAAA;EACf,QAAA,GAAW,QAAQ;AAAA;AAAA,cAGR,mBAAA,2BAAmB,SAAA,CAAA,wBAAA;AAAA,UAoBf,wBAAA;EACf,QAAA,GAAW,QAAA;EACX,GAAA,GAAM,QAAA;EACN,MAAA,GAAS,MAAA,GAAS,MAAA;EAClB,QAAA;EACA,IAAA,GAAO,QAAA,GAAW,uBAAA;EAClB,OAAA;AAAA;AAAA,UAGe,4BAAA,SAAqC,wBAAwB;EAC5E,IAAA,WAAe,OAAA;AAAA;AAAA,UAGA,2BAAA,SAAoC,wBAAwB;EAC3E,OAAA,EAAS,QAAA;AAAA;AAAA,UAGM,0BAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,wBAAA;EACR,MAAA,EAAQ,kBAAA,CAAmB,CAAA;AAAA;AAAA,KAGjB,oBAAA,WACA,MAAA,gBAAsB,MAAA,iBAE9B,4BAAA,GACA,2BAAA,GACA,0BAAA,CAA2B,CAAA;;;;;;;;;;iBAWf,eAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,oBAAA,CAAqB,CAAA,IAAE,QAAA;;;AApEF;iBAyMd,oBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,yBAAA,CAA0B,CAAA,IAAE,QAAA;;;;iBA8DrB,4BAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,iCAAA,CAAkC,CAAA,IAAE,QAAA"}
1
+ {"version":3,"file":"interface-declaration.d.mts","names":[],"sources":["../../../src/typescript/components/interface-declaration.tsx"],"mappings":";;;;;;;UAuEiB,yBAAA,SACP,WAAA,CAAY,sBAAA,WAAiC,cAAA;;AADvD;;EAKE,OAAA,GAAU,QAAA;EAJU;;;EASpB,cAAA,GAAiB,uBAAA;EAaX;;;;;;EALN,MAAA,GAAS,UAAA;EAjB4C;;;EAsBrD,GAAA,GAAM,QAAA;AAAA;AAAA,KAGI,iCAAA,GAAoC,oBAAA,GAC9C,cAAA;EACE,MAAA,EAAQ,UAAA;EACR,IAAA;EACA,QAAA;EACA,YAAA;AAAA;AAAA,UAGa,wBAAA;EACf,QAAA,GAAW,QAAQ;AAAA;AAAA,cAGR,mBAAA,2BAAmB,SAAA,CAAA,wBAAA;AAAA,UAoBf,wBAAA;EACf,QAAA,GAAW,QAAA;EACX,IAAA,WAAe,OAAA;EACf,GAAA,GAAM,QAAA;EACN,MAAA,GAAS,MAAA,GAAS,MAAA;EAClB,QAAA;EACA,IAAA,GAAO,QAAA,GAAW,uBAAA;EAClB,OAAA;AAAA;AAAA,UAGe,2BAAA,SAAoC,wBAAwB;EAC3E,OAAA,EAAS,QAAA;AAAA;AAAA,UAGM,0BAAA,SAAmC,wBAAwB;EAC1E,MAAA,EAAQ,UAAA;EACR,QAAA;AAAA;AAAA,KAGU,oBAAA,GACR,2BAAA,GACA,0BAA0B;AA5CT;AAGrB;;;;AAAgC;AAoBhC;;;AAvBqB,iBAuDL,eAAA,CAAgB,KAAA,EAAO,oBAAA,GAAoB,QAAA;;;;iBA6H3C,oBAAA,CAAqB,KAAA,EAAO,yBAAA,GAAyB,QAAA;;;;iBAoErD,4BAAA,CACd,KAAA,EAAO,iCAAA,GAAiC,QAAA"}
@@ -6,7 +6,6 @@ import { TypeParameters } from "./type-parameters.mjs";
6
6
  import { TSDocObjectSchema, TSDocSchemaProperty } from "./tsdoc-schema.mjs";
7
7
  import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
8
8
  import { Block, For, MemberDeclaration, Name, Show, childrenArray, computed, createSymbol, createSymbolSlot, effect, emitSymbol, findUnkeyedChildren, splitProps, takeSymbols } from "@alloy-js/core";
9
- import { camelCase } from "@stryke/string-format/camel-case";
10
9
  import { pascalCase } from "@stryke/string-format/pascal-case";
11
10
  import { Declaration as Declaration$1, TSOutputSymbol, TSSymbolFlags, ensureTypeRefContext, useTSLexicalScope, useTSMemberScope, useTSNamePolicy } from "@alloy-js/typescript";
12
11
  import { getPrimarySchemaType, getPropertiesList, isSchemaNullable, stringifyType } from "@powerlines/schema";
@@ -60,11 +59,10 @@ function InterfaceMember(props) {
60
59
  "]: ",
61
60
  type
62
61
  ];
63
- const optional = !!(props.schema && "nullable" in props.schema && props.schema.nullable) || !!props.nullish;
64
62
  const scope = useTSMemberScope();
65
63
  const sym = createSymbol(TSOutputSymbol, ((props.schema ? props.schema?.name : void 0) || isSetString(props.name) ? props.name : props.name.toString()) || uuid().replace(/-/g, ""), scope.ownerSymbol.staticMembers, {
66
64
  refkeys: props.refkey,
67
- tsFlags: TSSymbolFlags.TypeSymbol | (optional ? TSSymbolFlags.Nullish : TSSymbolFlags.None),
65
+ tsFlags: TSSymbolFlags.TypeSymbol | (!!(props.schema && isSchemaNullable(props.schema)) || !!props.nullish ? TSSymbolFlags.Nullish : TSSymbolFlags.None),
68
66
  namePolicy: useTSNamePolicy().for("interface-member"),
69
67
  binder: scope.binder
70
68
  });
@@ -90,7 +88,7 @@ function InterfaceMember(props) {
90
88
  }),
91
89
  readonly,
92
90
  createComponent(PropertyName, {}),
93
- optional ? "?" : "",
91
+ memo(() => !props.required ? "?" : ""),
94
92
  ": ",
95
93
  type
96
94
  ];
@@ -194,7 +192,15 @@ function InterfaceDeclaration(props) {
194
192
  each: properties,
195
193
  doubleHardline: true,
196
194
  semicolon: true,
197
- children: (property) => createComponent(InterfaceDeclarationProperty, { schema: property })
195
+ children: (property) => createComponent(InterfaceDeclarationProperty, {
196
+ get name() {
197
+ return property.name;
198
+ },
199
+ schema: property,
200
+ get required() {
201
+ return !!property?.required;
202
+ }
203
+ })
198
204
  });
199
205
  } }))];
200
206
  }
@@ -206,25 +212,32 @@ function InterfaceDeclaration(props) {
206
212
  * Generates a TypeScript interface property for the given reflection class.
207
213
  */
208
214
  function InterfaceDeclarationProperty(props) {
209
- const [{ schema }, rest] = splitProps(props, ["schema"]);
210
- const name = computed(() => schema?.name || camelCase(schema?.title || schema?.databaseSchemaName || schema?.$id));
215
+ const [{ schema, name, required, defaultValue }, rest] = splitProps(props, [
216
+ "schema",
217
+ "name",
218
+ "required",
219
+ "defaultValue"
220
+ ]);
211
221
  return createComponent(Show, {
212
222
  get when() {
213
- return isSetString(name.value);
223
+ return isSetString(name);
214
224
  },
215
225
  get children() {
216
226
  return createComponent(SchemaPropertyContext.Provider, {
217
227
  value: schema,
218
228
  get children() {
219
- return [createComponent(TSDocSchemaProperty, { schema }), createComponent(InterfaceMember, mergeProps({
220
- get name() {
221
- return name.value;
222
- },
229
+ return [createComponent(TSDocSchemaProperty, {
230
+ schema,
231
+ defaultValue
232
+ }), createComponent(InterfaceMember, mergeProps({
233
+ name,
234
+ schema,
235
+ required,
223
236
  get readOnly() {
224
237
  return schema?.readOnly;
225
238
  },
226
239
  get nullish() {
227
- return schema?.nullable || isSchemaNullable(schema);
240
+ return isSchemaNullable(schema);
228
241
  },
229
242
  get type() {
230
243
  return getPrimarySchemaType(schema);
@@ -1 +1 @@
1
- {"version":3,"file":"interface-declaration.mjs","names":[],"sources":["../../../src/typescript/components/interface-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 Block,\n Children,\n childrenArray,\n computed,\n createSymbol,\n createSymbolSlot,\n effect,\n emitSymbol,\n findUnkeyedChildren,\n For,\n MemberDeclaration,\n Name,\n Namekey,\n Refkey,\n Show,\n splitProps,\n takeSymbols\n} from \"@alloy-js/core\";\nimport {\n CommonDeclarationProps,\n Declaration,\n ensureTypeRefContext,\n TSOutputSymbol,\n TSSymbolFlags,\n TypeParameterDescriptor,\n useTSLexicalScope,\n useTSMemberScope,\n useTSNamePolicy\n} from \"@alloy-js/typescript\";\nimport {\n getPrimarySchemaType,\n getPropertiesList,\n isSchemaNullable,\n JsonSchema,\n JsonSchemaLike,\n JsonSchemaPrimitiveType,\n JsonSchemaProperty,\n stringifyType\n} from \"@powerlines/schema\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { PartialKeys } from \"@stryke/types/base\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport {\n SchemaContext,\n SchemaPropertyContext\n} from \"../../core/contexts/schema\";\nimport { ComponentProps } from \"../../types/components\";\nimport { MemberScope } from \"../contexts/member-scope\";\nimport { PropertyName } from \"./property-name\";\nimport { TSDoc } from \"./tsdoc\";\nimport { TSDocObjectSchema, TSDocSchemaProperty } from \"./tsdoc-schema\";\nimport { TypeParameters } from \"./type-parameters\";\n\nexport interface InterfaceDeclarationProps<\n T extends Record<string, any> = Record<string, any>\n>\n extends PartialKeys<CommonDeclarationProps, \"name\">, ComponentProps {\n /**\n * A base type that this interface extends. This can be used to represent inheritance\n */\n extends?: Children;\n\n /**\n * The generic type parameters of the interface.\n */\n typeParameters?: TypeParameterDescriptor[] | string[];\n\n /**\n * The JSON Schema that describes the properties of this interface.\n *\n * @remarks\n * This is used to generate the members of the interface based on the properties of the schema.\n */\n schema?: JsonSchema<T>;\n\n /**\n * Documentation for the interface. This can be a string or any Alloy component that renders documentation content (such as `TSDoc`).\n */\n doc?: Children;\n}\n\nexport interface InterfaceDeclarationPropertyProps<\n T extends Record<string, any> = Record<string, any>\n>\n extends Omit<InterfaceMemberProps<T>, \"name\">, ComponentProps {\n schema: JsonSchemaProperty<T>;\n}\n\nexport interface InterfaceExpressionProps {\n children?: Children;\n}\n\nexport const InterfaceExpression = ensureTypeRefContext(\n function InterfaceExpression(props: InterfaceExpressionProps) {\n const scope = useTSLexicalScope();\n const symbol = createSymbol(TSOutputSymbol, \"\", undefined, {\n transient: true,\n binder: scope?.binder\n });\n\n emitSymbol(symbol);\n\n return (\n <group>\n <MemberScope ownerSymbol={symbol}>\n <Block>{props.children}</Block>\n </MemberScope>\n </group>\n );\n }\n);\n\nexport interface InterfaceMemberPropsBase {\n children?: Children;\n doc?: Children;\n refkey?: Refkey | Refkey[];\n readOnly?: boolean;\n type?: Children | JsonSchemaPrimitiveType | string;\n nullish?: boolean;\n}\n\nexport interface InterfacePropertyMemberProps extends InterfaceMemberPropsBase {\n name: string | Namekey;\n}\n\nexport interface InterfaceIndexerMemberProps extends InterfaceMemberPropsBase {\n indexer: Children;\n}\n\nexport interface InterfaceSchemaMemberProps<\n T extends Record<string, any> = Record<string, any>\n> extends InterfaceMemberPropsBase {\n schema: JsonSchemaProperty<T>;\n}\n\nexport type InterfaceMemberProps<\n T extends Record<string, any> = Record<string, any>\n> =\n | InterfacePropertyMemberProps\n | InterfaceIndexerMemberProps\n | InterfaceSchemaMemberProps<T>;\n\n/**\n * Create a TypeScript interface member.\n *\n * An interface member can either provide a `name` prop to create a named\n * property, or an `indexer` prop to define an indexer for the interface.\n *\n * The type of the member can be provided either as the `type` prop or as the\n * children of the component.\n */\nexport function InterfaceMember<\n T extends Record<string, any> = Record<string, any>\n>(props: InterfaceMemberProps<T>) {\n const type = (props as InterfaceSchemaMemberProps<T>).schema\n ? stringifyType<T[keyof T]>((props as InterfaceSchemaMemberProps<T>).schema)\n : (props.type ?? props.children);\n\n const readonly =\n ((props as InterfaceSchemaMemberProps<T>).schema &&\n (props as InterfaceSchemaMemberProps<T>).schema?.readOnly) ||\n (!(props as InterfaceSchemaMemberProps<T>).schema && props.readOnly)\n ? \"readonly \"\n : \"\";\n\n if (\"indexer\" in props) {\n return (\n <>\n <Show when={Boolean(props.doc)}>\n <TSDoc heading={props.doc} />\n </Show>\n {readonly}[{props.indexer}]: {type}\n </>\n );\n }\n\n const optional =\n !!(\n (props as InterfaceSchemaMemberProps<T>).schema &&\n \"nullable\" in (props as InterfaceSchemaMemberProps<T>).schema &&\n (props as InterfaceSchemaMemberProps<T>).schema.nullable\n ) || !!props.nullish;\n\n const scope = useTSMemberScope();\n const sym = createSymbol(\n TSOutputSymbol,\n (((props as InterfaceSchemaMemberProps<T>).schema\n ? (props as InterfaceSchemaMemberProps<T>).schema?.name\n : undefined) || isSetString((props as InterfacePropertyMemberProps).name)\n ? (props as InterfacePropertyMemberProps).name\n : (props as InterfacePropertyMemberProps).name.toString()) ||\n uuid().replace(/-/g, \"\"),\n scope.ownerSymbol.staticMembers,\n {\n refkeys: props.refkey,\n tsFlags:\n TSSymbolFlags.TypeSymbol |\n (optional ? TSSymbolFlags.Nullish : TSSymbolFlags.None),\n namePolicy: useTSNamePolicy().for(\"interface-member\"),\n binder: scope.binder\n }\n );\n\n const taken = takeSymbols();\n effect(() => {\n if (taken.size > 1) return;\n const symbol = Array.from(taken)[0];\n if (symbol?.isTransient) {\n symbol.moveMembersTo(sym);\n }\n });\n\n return (\n <MemberDeclaration symbol={sym}>\n <Show when={Boolean(props.doc)}>\n <TSDoc heading={props.doc} />\n </Show>\n {readonly}\n <PropertyName />\n {optional ? \"?\" : \"\"}: {type}\n </MemberDeclaration>\n );\n}\n\nconst BaseInterfaceDeclaration = ensureTypeRefContext(\n function InterfaceDeclaration(props: InterfaceDeclarationProps) {\n const ExprSlot = createSymbolSlot();\n\n const children = childrenArray(() => props.children);\n\n const extendsPart = props.extends ? <> extends {props.extends}</> : \"\";\n const filteredChildren = findUnkeyedChildren(children);\n const currentScope = useTSLexicalScope();\n\n const binder = currentScope?.binder;\n const sym = createSymbol(\n TSOutputSymbol,\n (isSetString(props.name) ? props.name : props.name?.toString()) ||\n uuid().replace(/-/g, \"\"),\n currentScope.types,\n {\n refkeys: props.refkey,\n default: props.default,\n export: props.export,\n metadata: props.metadata,\n tsFlags: TSSymbolFlags.TypeSymbol,\n namePolicy: useTSNamePolicy().for(\"interface\"),\n binder\n }\n );\n\n effect(() => {\n if (ExprSlot.ref.value) {\n const takenSymbols = ExprSlot.ref.value;\n for (const symbol of takenSymbols) {\n // ignore non-transient symbols (likely not the result of an expression).\n if (symbol.isTransient) {\n symbol.moveMembersTo(sym);\n }\n }\n }\n });\n\n return (\n <>\n <Show when={Boolean(props.doc)}>\n <TSDoc heading={props.doc} />\n </Show>\n <Declaration {...props} nameKind=\"interface\" kind=\"type\" symbol={sym}>\n interface <Name />\n {props.typeParameters && (\n <TypeParameters parameters={props.typeParameters} />\n )}\n {extendsPart}{\" \"}\n <ExprSlot>\n <InterfaceExpression>{filteredChildren}</InterfaceExpression>\n </ExprSlot>\n </Declaration>\n </>\n );\n }\n);\n\n/**\n * Generates a TypeScript interface for the given schema.\n */\nexport function InterfaceDeclaration<\n T extends Record<string, any> = Record<string, any>\n>(props: InterfaceDeclarationProps<T>) {\n const [{ name, schema, doc }, rest] = splitProps(props, [\n \"name\",\n \"schema\",\n \"doc\"\n ]);\n\n const interfaceName = computed(() =>\n pascalCase(isSetString(name) ? name : schema?.name || schema?.title || \"\")\n );\n const properties = computed(() =>\n schema\n ? getPropertiesList<T>(schema as Parameters<typeof getPropertiesList>[0])\n .filter(property => !property?.ignore)\n .sort((a, b) =>\n (a?.readOnly && b?.readOnly) || (!a?.readOnly && !b?.readOnly)\n ? !a.name && !b.name\n ? 0\n : !a.name\n ? -1\n : !b.name\n ? 1\n : a.name.localeCompare(b.name)\n : a?.readOnly\n ? 1\n : -1\n )\n : []\n );\n\n return (\n <Show\n when={schema && properties.value.length > 0}\n fallback={\n <BaseInterfaceDeclaration\n {...props}\n schema={{\n type: \"object\",\n name: interfaceName.value,\n properties: {}\n }}\n name={interfaceName.value}\n />\n }>\n <SchemaContext.Provider value={schema as JsonSchemaLike}>\n <TSDocObjectSchema heading={doc} schema={schema!} />\n <BaseInterfaceDeclaration\n export={true}\n name={interfaceName.value}\n {...rest}>\n <For each={properties} doubleHardline={true} semicolon={true}>\n {property => <InterfaceDeclarationProperty schema={property} />}\n </For>\n </BaseInterfaceDeclaration>\n </SchemaContext.Provider>\n </Show>\n );\n}\n\n/**\n * Generates a TypeScript interface property for the given reflection class.\n */\nexport function InterfaceDeclarationProperty<\n T extends Record<string, any> = Record<string, any>\n>(props: InterfaceDeclarationPropertyProps<T>) {\n const [{ schema }, rest] = splitProps(props, [\"schema\"]);\n\n const name = computed(\n () =>\n schema?.name ||\n camelCase(schema?.title || schema?.databaseSchemaName || schema?.$id)\n );\n\n return (\n <Show when={isSetString(name.value)}>\n <SchemaPropertyContext.Provider value={schema as JsonSchemaLike}>\n <TSDocSchemaProperty schema={schema} />\n <InterfaceMember\n name={name.value}\n readOnly={schema?.readOnly}\n nullish={schema?.nullable || isSchemaNullable<T[keyof T]>(schema)}\n type={getPrimarySchemaType<T[keyof T]>(schema)}\n {...rest}\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AC,OAAU;OACb,OAAW,cAAc;MAC/B;KACE,GAAO,MAAE,EACT,IAAO,WAAA;MACL,OAAa,gBAAY,KAAA;OACxB,MAAW;OACJ,gBAAE;OACJ,WAAM;OAChB,WAAA,aAAA,gBAAA,8BAAA,EACD,QAAA;MAEW,CAAC;KACH,EACJ,CAAA,CAAA,CAAK;IACT;GACE,CAAC;EACH;CACF,CAAC;AACH;;;;AAKA,SAAe,6BAAqB,OAAA;CAClC,MAAM,CAAA,EACJ,UACC,QAAE,WAAc,OAAA,CAAA,QAAA,CAAA;CACnB,MAAK,OAAQ,eAAe,QAAI,QAAA,UAAA,QAAA,SAAA,QAAA,sBAAA,QAAA,GAAA,CAAA;CAChC,OAAI,gBAAiB,MAAA;EACpB,IAAA,OAAA;GACH,OAAA,YAAA,KAAA,KAAA;;EAEA,IAAM,WAAA;GACJ,OAAS,gBAAoB,sBAAQ,UAAA;IACnC,OAAM;;KAEA,OAAA,CAAQ,gBAAkB,qBAAoB,SAE9C,CAAA,GAAA,gBAAoB,iBAAa,WAAe;MAChD,IAAA,OAAA;OACA,OAAA,KAAe;;MAEf,IAAM,WAAG;OACL,OAAE,QAAY;MACtB;MACC,IAAA,UAAkB;OACX,OAAC,QAAc,YAAG,iBAAA,MAAA;MAC1B;MACA,IAAA,OAAA;OACE,OAAS,qBAAY,MAAA;MACrB;KACA,GAAA,IAAQ,CAAA,CAAA;IACR;GACF,CAAC;EACH;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"interface-declaration.mjs","names":[],"sources":["../../../src/typescript/components/interface-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 Block,\n Children,\n childrenArray,\n computed,\n createSymbol,\n createSymbolSlot,\n effect,\n emitSymbol,\n findUnkeyedChildren,\n For,\n MemberDeclaration,\n Name,\n Namekey,\n Refkey,\n Show,\n splitProps,\n takeSymbols\n} from \"@alloy-js/core\";\nimport {\n CommonDeclarationProps,\n Declaration,\n ensureTypeRefContext,\n TSOutputSymbol,\n TSSymbolFlags,\n TypeParameterDescriptor,\n useTSLexicalScope,\n useTSMemberScope,\n useTSNamePolicy\n} from \"@alloy-js/typescript\";\nimport {\n getPrimarySchemaType,\n getPropertiesList,\n isSchemaNullable,\n JsonSchema,\n JsonSchemaPrimitiveType,\n stringifyType\n} from \"@powerlines/schema\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { PartialKeys } from \"@stryke/types/base\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport {\n SchemaContext,\n SchemaPropertyContext\n} from \"../../core/contexts/schema\";\nimport { ComponentProps } from \"../../types/components\";\nimport { MemberScope } from \"../contexts/member-scope\";\nimport { PropertyName } from \"./property-name\";\nimport { TSDoc } from \"./tsdoc\";\nimport { TSDocObjectSchema, TSDocSchemaProperty } from \"./tsdoc-schema\";\nimport { TypeParameters } from \"./type-parameters\";\n\nexport interface InterfaceDeclarationProps\n extends PartialKeys<CommonDeclarationProps, \"name\">, ComponentProps {\n /**\n * A base type that this interface extends. This can be used to represent inheritance\n */\n extends?: Children;\n\n /**\n * The generic type parameters of the interface.\n */\n typeParameters?: TypeParameterDescriptor[] | string[];\n\n /**\n * The JSON Schema that describes the properties of this interface.\n *\n * @remarks\n * This is used to generate the members of the interface based on the properties of the schema.\n */\n schema?: JsonSchema;\n\n /**\n * Documentation for the interface. This can be a string or any Alloy component that renders documentation content (such as `TSDoc`).\n */\n doc?: Children;\n}\n\nexport type InterfaceDeclarationPropertyProps = InterfaceMemberProps &\n ComponentProps & {\n schema: JsonSchema;\n name: string;\n required: boolean;\n defaultValue?: unknown;\n };\n\nexport interface InterfaceExpressionProps {\n children?: Children;\n}\n\nexport const InterfaceExpression = ensureTypeRefContext(\n function InterfaceExpression(props: InterfaceExpressionProps) {\n const scope = useTSLexicalScope();\n const symbol = createSymbol(TSOutputSymbol, \"\", undefined, {\n transient: true,\n binder: scope?.binder\n });\n\n emitSymbol(symbol);\n\n return (\n <group>\n <MemberScope ownerSymbol={symbol}>\n <Block>{props.children}</Block>\n </MemberScope>\n </group>\n );\n }\n);\n\nexport interface InterfaceMemberPropsBase {\n children?: Children;\n name: string | Namekey;\n doc?: Children;\n refkey?: Refkey | Refkey[];\n readOnly?: boolean;\n type?: Children | JsonSchemaPrimitiveType | string;\n nullish?: boolean;\n}\n\nexport interface InterfaceIndexerMemberProps extends InterfaceMemberPropsBase {\n indexer: Children;\n}\n\nexport interface InterfaceSchemaMemberProps extends InterfaceMemberPropsBase {\n schema: JsonSchema;\n required: boolean;\n}\n\nexport type InterfaceMemberProps =\n | InterfaceIndexerMemberProps\n | InterfaceSchemaMemberProps;\n\n/**\n * Create a TypeScript interface member.\n *\n * An interface member can either provide a `name` prop to create a named\n * property, or an `indexer` prop to define an indexer for the interface.\n *\n * The type of the member can be provided either as the `type` prop or as the\n * children of the component.\n */\nexport function InterfaceMember(props: InterfaceMemberProps) {\n const type = (props as InterfaceSchemaMemberProps).schema\n ? stringifyType((props as InterfaceSchemaMemberProps).schema)\n : (props.type ?? props.children);\n\n const readonly =\n ((props as InterfaceSchemaMemberProps).schema &&\n (props as InterfaceSchemaMemberProps).schema?.readOnly) ||\n (!(props as InterfaceSchemaMemberProps).schema && props.readOnly)\n ? \"readonly \"\n : \"\";\n\n if (\"indexer\" in props) {\n return (\n <>\n <Show when={Boolean(props.doc)}>\n <TSDoc heading={props.doc} />\n </Show>\n {readonly}[{props.indexer}]: {type}\n </>\n );\n }\n\n const scope = useTSMemberScope();\n const sym = createSymbol(\n TSOutputSymbol,\n ((props.schema ? props.schema?.name : undefined) || isSetString(props.name)\n ? props.name\n : props.name.toString()) || uuid().replace(/-/g, \"\"),\n scope.ownerSymbol.staticMembers,\n {\n refkeys: props.refkey,\n tsFlags:\n TSSymbolFlags.TypeSymbol |\n (!!(props.schema && isSchemaNullable(props.schema)) || !!props.nullish\n ? TSSymbolFlags.Nullish\n : TSSymbolFlags.None),\n namePolicy: useTSNamePolicy().for(\"interface-member\"),\n binder: scope.binder\n }\n );\n\n const taken = takeSymbols();\n effect(() => {\n if (taken.size > 1) return;\n const symbol = Array.from(taken)[0];\n if (symbol?.isTransient) {\n symbol.moveMembersTo(sym);\n }\n });\n\n return (\n <MemberDeclaration symbol={sym}>\n <Show when={Boolean(props.doc)}>\n <TSDoc heading={props.doc} />\n </Show>\n {readonly}\n <PropertyName />\n {!props.required ? \"?\" : \"\"}: {type}\n </MemberDeclaration>\n );\n}\n\nconst BaseInterfaceDeclaration = ensureTypeRefContext(\n function InterfaceDeclaration(props: InterfaceDeclarationProps) {\n const ExprSlot = createSymbolSlot();\n\n const children = childrenArray(() => props.children);\n\n const extendsPart = props.extends ? <> extends {props.extends}</> : \"\";\n const filteredChildren = findUnkeyedChildren(children);\n const currentScope = useTSLexicalScope();\n\n const binder = currentScope?.binder;\n const sym = createSymbol(\n TSOutputSymbol,\n (isSetString(props.name) ? props.name : props.name?.toString()) ||\n uuid().replace(/-/g, \"\"),\n currentScope.types,\n {\n refkeys: props.refkey,\n default: props.default,\n export: props.export,\n metadata: props.metadata,\n tsFlags: TSSymbolFlags.TypeSymbol,\n namePolicy: useTSNamePolicy().for(\"interface\"),\n binder\n }\n );\n\n effect(() => {\n if (ExprSlot.ref.value) {\n const takenSymbols = ExprSlot.ref.value;\n for (const symbol of takenSymbols) {\n // ignore non-transient symbols (likely not the result of an expression).\n if (symbol.isTransient) {\n symbol.moveMembersTo(sym);\n }\n }\n }\n });\n\n return (\n <>\n <Show when={Boolean(props.doc)}>\n <TSDoc heading={props.doc} />\n </Show>\n <Declaration {...props} nameKind=\"interface\" kind=\"type\" symbol={sym}>\n interface <Name />\n {props.typeParameters && (\n <TypeParameters parameters={props.typeParameters} />\n )}\n {extendsPart}{\" \"}\n <ExprSlot>\n <InterfaceExpression>{filteredChildren}</InterfaceExpression>\n </ExprSlot>\n </Declaration>\n </>\n );\n }\n);\n\n/**\n * Generates a TypeScript interface for the given schema.\n */\nexport function InterfaceDeclaration(props: InterfaceDeclarationProps) {\n const [{ name, schema, doc }, rest] = splitProps(props, [\n \"name\",\n \"schema\",\n \"doc\"\n ]);\n\n const interfaceName = computed(() =>\n pascalCase(isSetString(name) ? name : schema?.name || schema?.title || \"\")\n );\n const properties = computed(() =>\n schema\n ? getPropertiesList(schema as Parameters<typeof getPropertiesList>[0])\n .filter(property => !property?.ignore)\n .sort((a, b) =>\n (a?.readOnly && b?.readOnly) || (!a?.readOnly && !b?.readOnly)\n ? !a.name && !b.name\n ? 0\n : !a.name\n ? -1\n : !b.name\n ? 1\n : a.name.localeCompare(b.name)\n : a?.readOnly\n ? 1\n : -1\n )\n : []\n );\n\n return (\n <Show\n when={schema && properties.value.length > 0}\n fallback={\n <BaseInterfaceDeclaration\n {...props}\n schema={{\n type: \"object\",\n name: interfaceName.value,\n properties: {}\n }}\n name={interfaceName.value}\n />\n }>\n <SchemaContext.Provider value={schema as JsonSchema}>\n <TSDocObjectSchema heading={doc} schema={schema!} />\n <BaseInterfaceDeclaration\n export={true}\n name={interfaceName.value}\n {...rest}>\n <For each={properties} doubleHardline={true} semicolon={true}>\n {property => (\n <InterfaceDeclarationProperty\n name={property.name}\n schema={property}\n required={!!property?.required}\n />\n )}\n </For>\n </BaseInterfaceDeclaration>\n </SchemaContext.Provider>\n </Show>\n );\n}\n\n/**\n * Generates a TypeScript interface property for the given reflection class.\n */\nexport function InterfaceDeclarationProperty(\n props: InterfaceDeclarationPropertyProps\n) {\n const [{ schema, name, required, defaultValue }, rest] = splitProps(props, [\n \"schema\",\n \"name\",\n \"required\",\n \"defaultValue\"\n ]);\n\n return (\n <Show when={isSetString(name)}>\n <SchemaPropertyContext.Provider value={schema}>\n <TSDocSchemaProperty schema={schema} defaultValue={defaultValue} />\n <InterfaceMember\n name={name}\n schema={schema}\n required={required}\n readOnly={schema?.readOnly}\n nullish={isSchemaNullable(schema)}\n type={getPrimarySchemaType(schema)}\n {...rest}\n />\n </SchemaPropertyContext.Provider>\n </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiCA,MAAM,sBAAA,qBAAA,SAAA,oBAAA,OAAA;CAEJ,MAAA,SAAA,aAAA,gBAAA,IAAA,QAAA;EACA,WAAa;EACf,QAHY,kBAGL,GAAA;CACL,CAAA;CACA,WAAW,MAAA;CACX,OAAA,gBAAoB,SAAA,EACpB,IAAA,WAAc;EACd,OAAA,gBAAa,eAAA;GACb,aAAA;GACA,IAAA,WAAiB;IACjB,OAAA,gBAAgB,OAAA,EAChB,IAAA,WAAA;KACY,OAAI,MAAA;IACX,EACL,CAAA;GACA;EACA,CAAA;CACA,EACA,CAAA;AACF,CAAC;;;;;;;;;;AAUD,SAAS,gBAAuB,OAAM;CACtC,MAAQ,OAAC,MAAY,SAAS,cAAW,MAAO,MAAM,IAAA,MAAA,QAAA,MAAA;CACtD,MAAQ,WAAC,MAAe,UAAQ,MAAS,QAAK,YAAA,CAAA,MAAA,UAAA,MAAA,WAAA,cAAA;CAC9C,IAAM,aAAW,OACjB,OAAS;EAAA,gBAAmB,MAAA;GACtB,IAAG,OAAA;;GAEH;GACJ,IAAQ,WAAW;IACjB,OAAA,gBAAA,OAAA,EACG,IAAK,UAAU;KAClB,OAAA,MAAA;IACM;GAEN;EACA,CAAC;EAAG;EAAS;EAAK,WAAc,MAAI,OAAS;EAAA;EAAA;CAAA;CAE/C,MAAA,QAAc,iBAAG;;EAEf,SAAA,MAAA;EACA,SAAS,cAAa,cAAc,CAAA,EAAA,MAAU,UAAS,iBAAS,MAAA,MAAA,MAAA,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,CAAA;KACL;IACA;IACA,IAAI,OAAA;KACF,OAAE,cAAmB;IACzB;GACA,CAAA,CAAA;EACF;EACD,IAAA,WAAA;;IAEK,OAAO;IACP,IAAI,WAAG;KACP,OAAM,CAAI,gBAAY,mBAAA;MACpB,SAAS;MACH;KACV,CAAA,GAAO,gBAAkB,0BAAA,WAAA;MAC3B,UAAA;MACA,IAAA,OAAA;;MAEK;KACJ,GAAA,MAAA,EACO,IAAI,WAAU;MACZ,OAAC,gBAAqB,KAAA;OACxB,MAAA;OACG,gBAAA;OACR,WAAc;OACP,WAAY,aAAW,gBAAI,8BAAA;QACnC,IAAA,OAAiB;SACpB,OAAA,SAAA;QACH;;QAEM,IAAA,WAA2B;SACtB,OAAA,CAAA,CAAA,UAA4B;QACrB;;MAER,CAAA;OAEA,CAAA,CAAA,CAAA;IACN;GACA,CAAA;;CAEF,CAAC;AACH;;;;AAKA,SAAM,6BAAA,OAAA;CACJ,MAAM,CAAA,EACJ,QACA,MACA,UACA,gBACC,QAAG,WAAY,OAAA;EAAA;EAAsB;EAAC;EAAW;CAAA,CAAA;CACpD,OAAM,gBAAA,MAAA;EACJ,IAAE,OAAA;GACD,OAAA,YAAA,IAAA;;EAED,IAAA,WAAa;GACX,OAAI,gBAAoB,sBAAA,UAAA;IACtB,OAAM;IACN,IAAI,WAAO;KACT,OAAG,CAAA,gBAAqB,qBAAuB;MACrC;MACD;KACT,CAAA,GAAA,gBAAA,iBAAA,WAAA;MACF;MACF;MACA;;OAEK,OAAA,QAAA;MACJ;MACE,IAAK,UAAM;OACT,OAAM,iBAAqB,MAAA;MAC5B;MACD,IAAA,OAAc;OACb,OAAW,qBAAM,MAAA;MAChB;KACD,GAAG,IAAA,CAAA,CAAA;IACL;GACF,CAAC;EACH;CACF,CAAC;AACH"}
@@ -17,7 +17,7 @@ function ObjectDeclaration(props) {
17
17
  const { schema } = props;
18
18
  if (!schema) return null;
19
19
  const name = (0, _alloy_js_core.computed)(() => (0, _stryke_string_format_camel_case.camelCase)((0, _stryke_type_checks_is_set_string.isSetString)(props.name) ? props.name : schema?.name));
20
- const defaultValues = (0, _alloy_js_core.computed)(() => schema?.default || {});
20
+ const defaultValues = (0, _alloy_js_core.computed)(() => Object.fromEntries((0, _powerlines_schema.getPropertiesList)(schema).map((property) => [property.name, property.default]) || {}));
21
21
  const properties = (0, _alloy_js_core.computed)(() => (0, _powerlines_schema.getPropertiesList)(schema).filter((property) => !property?.ignore && !property?.runtime && !(0, _stryke_type_checks_is_undefined.isUndefined)(defaultValues.value[property.name] ?? property?.alias?.reduce((ret, alias) => {
22
22
  if ((0, _stryke_type_checks_is_undefined.isUndefined)(ret) && !(0, _stryke_type_checks_is_undefined.isUndefined)(defaultValues.value[alias])) return defaultValues.value[alias];
23
23
  return ret;
@@ -71,7 +71,12 @@ function ObjectDeclaration(props) {
71
71
  },
72
72
  comma: true,
73
73
  doubleHardline: true,
74
- children: (property) => (0, _alloy_js_core_jsx_runtime.createComponent)(ObjectDeclarationProperty, { schema: property })
74
+ children: (property) => (0, _alloy_js_core_jsx_runtime.createComponent)(ObjectDeclarationProperty, {
75
+ get name() {
76
+ return property.name;
77
+ },
78
+ schema: property
79
+ })
75
80
  });
76
81
  } });
77
82
  } })
@@ -89,24 +94,28 @@ function ObjectDeclaration(props) {
89
94
  * Generates a TypeScript object property for the given reflection class.
90
95
  */
91
96
  function ObjectDeclarationProperty(props) {
92
- const [{ schema }, rest] = (0, _alloy_js_core.splitProps)(props, ["schema"]);
93
- const name = (0, _alloy_js_core.computed)(() => schema?.name || (0, _stryke_string_format_camel_case.camelCase)(schema?.title || schema?.databaseSchemaName || schema?.$id));
97
+ const [{ schema, name, value }, rest] = (0, _alloy_js_core.splitProps)(props, [
98
+ "schema",
99
+ "name",
100
+ "value"
101
+ ]);
94
102
  return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
95
103
  get when() {
96
- return (0, _stryke_type_checks_is_set_string.isSetString)(name.value);
104
+ return (0, _stryke_type_checks_is_set_string.isSetString)(name);
97
105
  },
98
106
  get children() {
99
107
  return (0, _alloy_js_core_jsx_runtime.createComponent)(require_core_contexts_schema.SchemaPropertyContext.Provider, {
100
108
  value: schema,
101
109
  get children() {
102
110
  return [
103
- (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc_schema.TSDocSchemaProperty, { schema }),
111
+ (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc_schema.TSDocSchemaProperty, {
112
+ schema,
113
+ defaultValue: value
114
+ }),
104
115
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ObjectProperty, (0, _alloy_js_core_jsx_runtime.mergeProps)({
105
- get name() {
106
- return name.value;
107
- },
116
+ name,
108
117
  get value() {
109
- return (0, _alloy_js_core_jsx_runtime.memo)(() => !!!(0, _stryke_type_checks_is_undefined.isUndefined)(schema?.default))() ? JSON.stringify(schema?.default) : void 0;
118
+ return (0, _powerlines_schema.stringifyValue)(value, schema.type);
110
119
  }
111
120
  }, rest)),
112
121
  (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
@@ -1,22 +1,25 @@
1
1
  import { ComponentProps } from "../../types/components.cjs";
2
2
  import { VarDeclarationProps } from "@alloy-js/typescript";
3
- import { JsonSchema, JsonSchemaProperty } from "@powerlines/schema";
3
+ import { JsonSchema, JsonSchemaObject } from "@powerlines/schema";
4
4
 
5
5
  //#region src/typescript/components/object-declaration.d.ts
6
- interface ObjectDeclarationProps<T extends Record<string, any> = Record<string, any>> extends VarDeclarationProps {
7
- schema?: JsonSchema<T>;
6
+ interface ObjectDeclarationProps extends VarDeclarationProps {
7
+ schema?: JsonSchemaObject;
8
8
  }
9
9
  /**
10
10
  * Generates a TypeScript object for the given reflection class.
11
11
  */
12
- declare function ObjectDeclaration<T extends Record<string, any> = Record<string, any>>(props: ObjectDeclarationProps<T>): import("@alloy-js/core").Children;
13
- interface ObjectDeclarationPropertyProps<T extends Record<string, any> = Record<string, any>> extends ComponentProps {
14
- schema: JsonSchemaProperty<T>;
12
+ declare function ObjectDeclaration(props: ObjectDeclarationProps): import("@alloy-js/core").Children;
13
+ interface ObjectDeclarationPropertyProps extends ComponentProps {
14
+ name: string;
15
+ required?: boolean;
16
+ value?: unknown;
17
+ schema: JsonSchema;
15
18
  }
16
19
  /**
17
20
  * Generates a TypeScript object property for the given reflection class.
18
21
  */
19
- declare function ObjectDeclarationProperty<T extends Record<string, any> = Record<string, any>>(props: ObjectDeclarationPropertyProps<T>): import("@alloy-js/core").Children;
22
+ declare function ObjectDeclarationProperty(props: ObjectDeclarationPropertyProps): import("@alloy-js/core").Children;
20
23
  //#endregion
21
24
  export { ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps };
22
25
  //# sourceMappingURL=object-declaration.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"object-declaration.d.cts","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"mappings":";;;;;UAoDiB,sBAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,mBAAA;EACR,MAAA,GAAS,UAAA,CAAW,CAAA;AAAA;;;;iBAMN,iBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,sBAAA,CAAuB,CAAA,6BAAE,QAAA;AAAA,UAkGjB,8BAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,cAAA;EACR,MAAA,EAAQ,kBAAA,CAAmB,CAAA;AAAA;;;;iBAMb,yBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,8BAAA,CAA+B,CAAA,6BAAE,QAAA"}
1
+ {"version":3,"file":"object-declaration.d.cts","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"mappings":";;;;;UAqDiB,sBAAA,SAA+B,mBAAmB;EACjE,MAAA,GAAS,gBAAA;AAAA;;;;iBAMK,iBAAA,CAAkB,KAAA,EAAO,sBAAsB,4BAAA,QAAA;AAAA,UA0G9C,8BAAA,SAAuC,cAAc;EACpE,IAAA;EACA,QAAA;EACA,KAAA;EACA,MAAA,EAAQ,UAAA;AAAA;;;;iBAMM,yBAAA,CACd,KAAA,EAAO,8BAA8B,4BAAA,QAAA"}
@@ -1,22 +1,25 @@
1
1
  import { ComponentProps } from "../../types/components.mjs";
2
2
  import { VarDeclarationProps } from "@alloy-js/typescript";
3
- import { JsonSchema, JsonSchemaProperty } from "@powerlines/schema";
3
+ import { JsonSchema, JsonSchemaObject } from "@powerlines/schema";
4
4
 
5
5
  //#region src/typescript/components/object-declaration.d.ts
6
- interface ObjectDeclarationProps<T extends Record<string, any> = Record<string, any>> extends VarDeclarationProps {
7
- schema?: JsonSchema<T>;
6
+ interface ObjectDeclarationProps extends VarDeclarationProps {
7
+ schema?: JsonSchemaObject;
8
8
  }
9
9
  /**
10
10
  * Generates a TypeScript object for the given reflection class.
11
11
  */
12
- declare function ObjectDeclaration<T extends Record<string, any> = Record<string, any>>(props: ObjectDeclarationProps<T>): import("@alloy-js/core").Children;
13
- interface ObjectDeclarationPropertyProps<T extends Record<string, any> = Record<string, any>> extends ComponentProps {
14
- schema: JsonSchemaProperty<T>;
12
+ declare function ObjectDeclaration(props: ObjectDeclarationProps): import("@alloy-js/core").Children;
13
+ interface ObjectDeclarationPropertyProps extends ComponentProps {
14
+ name: string;
15
+ required?: boolean;
16
+ value?: unknown;
17
+ schema: JsonSchema;
15
18
  }
16
19
  /**
17
20
  * Generates a TypeScript object property for the given reflection class.
18
21
  */
19
- declare function ObjectDeclarationProperty<T extends Record<string, any> = Record<string, any>>(props: ObjectDeclarationPropertyProps<T>): import("@alloy-js/core").Children;
22
+ declare function ObjectDeclarationProperty(props: ObjectDeclarationPropertyProps): import("@alloy-js/core").Children;
20
23
  //#endregion
21
24
  export { ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps };
22
25
  //# sourceMappingURL=object-declaration.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"object-declaration.d.mts","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"mappings":";;;;;UAoDiB,sBAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,mBAAA;EACR,MAAA,GAAS,UAAA,CAAW,CAAA;AAAA;;;;iBAMN,iBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,sBAAA,CAAuB,CAAA,6BAAE,QAAA;AAAA,UAkGjB,8BAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,cAAA;EACR,MAAA,EAAQ,kBAAA,CAAmB,CAAA;AAAA;;;;iBAMb,yBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,8BAAA,CAA+B,CAAA,6BAAE,QAAA"}
1
+ {"version":3,"file":"object-declaration.d.mts","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"mappings":";;;;;UAqDiB,sBAAA,SAA+B,mBAAmB;EACjE,MAAA,GAAS,gBAAA;AAAA;;;;iBAMK,iBAAA,CAAkB,KAAA,EAAO,sBAAsB,4BAAA,QAAA;AAAA,UA0G9C,8BAAA,SAAuC,cAAc;EACpE,IAAA;EACA,QAAA;EACA,KAAA;EACA,MAAA,EAAQ,UAAA;AAAA;;;;iBAMM,yBAAA,CACd,KAAA,EAAO,8BAA8B,4BAAA,QAAA"}
@@ -5,7 +5,7 @@ import { Declaration, For, Name, Show, computed, createSymbolSlot, splitProps }
5
5
  import { camelCase } from "@stryke/string-format/camel-case";
6
6
  import { isUndefined } from "@stryke/type-checks/is-undefined";
7
7
  import { ObjectExpression, ObjectProperty, TSSymbolFlags, TypeRefContext, createValueSymbol, useTSNamePolicy } from "@alloy-js/typescript";
8
- import { getPropertiesList } from "@powerlines/schema";
8
+ import { getPropertiesList, stringifyValue } from "@powerlines/schema";
9
9
  import { isSetString } from "@stryke/type-checks/is-set-string";
10
10
 
11
11
  //#region src/typescript/components/object-declaration.tsx
@@ -16,7 +16,7 @@ function ObjectDeclaration(props) {
16
16
  const { schema } = props;
17
17
  if (!schema) return null;
18
18
  const name = computed(() => camelCase(isSetString(props.name) ? props.name : schema?.name));
19
- const defaultValues = computed(() => schema?.default || {});
19
+ const defaultValues = computed(() => Object.fromEntries(getPropertiesList(schema).map((property) => [property.name, property.default]) || {}));
20
20
  const properties = computed(() => getPropertiesList(schema).filter((property) => !property?.ignore && !property?.runtime && !isUndefined(defaultValues.value[property.name] ?? property?.alias?.reduce((ret, alias) => {
21
21
  if (isUndefined(ret) && !isUndefined(defaultValues.value[alias])) return defaultValues.value[alias];
22
22
  return ret;
@@ -70,7 +70,12 @@ function ObjectDeclaration(props) {
70
70
  },
71
71
  comma: true,
72
72
  doubleHardline: true,
73
- children: (property) => createComponent(ObjectDeclarationProperty, { schema: property })
73
+ children: (property) => createComponent(ObjectDeclarationProperty, {
74
+ get name() {
75
+ return property.name;
76
+ },
77
+ schema: property
78
+ })
74
79
  });
75
80
  } });
76
81
  } })
@@ -88,24 +93,28 @@ function ObjectDeclaration(props) {
88
93
  * Generates a TypeScript object property for the given reflection class.
89
94
  */
90
95
  function ObjectDeclarationProperty(props) {
91
- const [{ schema }, rest] = splitProps(props, ["schema"]);
92
- const name = computed(() => schema?.name || camelCase(schema?.title || schema?.databaseSchemaName || schema?.$id));
96
+ const [{ schema, name, value }, rest] = splitProps(props, [
97
+ "schema",
98
+ "name",
99
+ "value"
100
+ ]);
93
101
  return createComponent(Show, {
94
102
  get when() {
95
- return isSetString(name.value);
103
+ return isSetString(name);
96
104
  },
97
105
  get children() {
98
106
  return createComponent(SchemaPropertyContext.Provider, {
99
107
  value: schema,
100
108
  get children() {
101
109
  return [
102
- createComponent(TSDocSchemaProperty, { schema }),
110
+ createComponent(TSDocSchemaProperty, {
111
+ schema,
112
+ defaultValue: value
113
+ }),
103
114
  createComponent(ObjectProperty, mergeProps({
104
- get name() {
105
- return name.value;
106
- },
115
+ name,
107
116
  get value() {
108
- return memo(() => !!!isUndefined(schema?.default))() ? JSON.stringify(schema?.default) : void 0;
117
+ return stringifyValue(value, schema.type);
109
118
  }
110
119
  }, rest)),
111
120
  createIntrinsic("hbr", {})
@@ -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 {\n getPropertiesList,\n JsonSchema,\n JsonSchemaLike,\n JsonSchemaProperty\n} from \"@powerlines/schema\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport {\n SchemaContext,\n SchemaPropertyContext\n} from \"../../core/contexts/schema\";\nimport { ComponentProps } from \"../../types/components\";\nimport { TSDocObjectSchema, TSDocSchemaProperty } from \"./tsdoc-schema\";\n\nexport interface ObjectDeclarationProps<\n T extends Record<string, any> = Record<string, any>\n> extends VarDeclarationProps {\n schema?: JsonSchema<T>;\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 const { schema } = props;\n if (!schema) {\n return null;\n }\n\n const name = computed(() =>\n camelCase(isSetString(props.name) ? props.name : schema?.name)\n );\n\n const defaultValues = computed(\n () => (schema?.default || {}) as Record<string, unknown>\n );\n const properties = computed(() =>\n getPropertiesList<T>(schema)\n .filter(\n property =>\n !property?.ignore &&\n !property?.runtime &&\n !isUndefined(\n defaultValues.value[property.name] ??\n property?.alias?.reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined(defaultValues.value[alias])\n ) {\n return defaultValues.value[alias];\n }\n\n return ret;\n }, undefined as any) ??\n property?.default\n )\n )\n .sort((a, b) =>\n (a?.readOnly && b?.readOnly) || (!a?.readOnly && !b?.readOnly)\n ? a.name.localeCompare(b.name)\n : a?.readOnly\n ? 1\n : -1\n )\n );\n\n const TypeSymbolSlot = createSymbolSlot();\n const ValueTypeSymbolSlot = createSymbolSlot();\n const sym = createValueSymbol(name.value || \"schema\", {\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={!!schema}>\n <SchemaContext.Provider value={schema as JsonSchemaLike}>\n <Show when={!!name.value && !!type}>\n <TSDocObjectSchema schema={schema} />\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 {property => (\n <ObjectDeclarationProperty schema={property} />\n )}\n </For>\n </ObjectExpression>\n )}\n </ValueTypeSymbolSlot>\n </CoreDeclaration>\n </Show>\n <hbr />\n </SchemaContext.Provider>\n </Show>\n );\n}\n\nexport interface ObjectDeclarationPropertyProps<\n T extends Record<string, any> = Record<string, any>\n> extends ComponentProps {\n schema: JsonSchemaProperty<T>;\n}\n\n/**\n * Generates a TypeScript object property for the given reflection class.\n */\nexport function ObjectDeclarationProperty<\n T extends Record<string, any> = Record<string, any>\n>(props: ObjectDeclarationPropertyProps<T>) {\n const [{ schema }, rest] = splitProps(props, [\"schema\"]);\n\n const name = computed(\n () =>\n schema?.name ||\n camelCase(schema?.title || schema?.databaseSchemaName || schema?.$id)\n );\n\n return (\n <Show when={isSetString(name.value)}>\n <SchemaPropertyContext.Provider value={schema as JsonSchemaLike}>\n <TSDocSchemaProperty schema={schema} />\n <ObjectProperty\n name={name.value}\n value={\n !isUndefined(schema?.default)\n ? JSON.stringify(schema?.default)\n : undefined\n }\n {...rest}\n />\n <hbr />\n </SchemaPropertyContext.Provider>\n </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA+BA,SAAe,kBAAA,OAAA;CACb,MAAA,EACA,WACA;CACA,IAAI,CAAC,QACP,OAAO;CAEL,MAAA,OAAU,eAAA,UAAA,YAAA,MAAA,IAAA,IAAA,MAAA,OAAA,QAAA,IAAA,CAAA;CACV,MAAA,gBAAc,eAAA,QAAA,WAAA,CAAA,CAAA;CACd,MAAA,aAAA,eAAA,kBAAA,MAAA,EAAA,QAAA,aAAA,CAAA,UAAA,UAAA,CAAA,UAAA,WAAA,CAAA,YAAA,cAAA,MAAA,SAAA,SAAA,UAAA,OAAA,QAAA,KAAA,UAAA;EACA,IAAM,YAAY,GAAA,KAAO,CAAA,YAAA,cAAA,MAAA,MAAA,GACrB,OAAG,cAAkB,MAAC;EAE5B,OAAS;CACT,GAAA,MAAO,KAAA,UAAA,OAAA,CAAA,EAAA,MAAA,GAAA,MAAA,GAAA,YAAA,GAAA,YAAA,CAAA,G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BAAA,KAAA;;cAEU,OAAA,WAAA,SAAA,CAAA;aACC;aACH,OAAA;aACd,gBAAA;aACJ,WAAA,aAAA,gBAAA,2BAAA,EACc,QAAA,SACO,CAAA;YACR,CAAA;WACJ,EACD,CAAA;UACC,EACT,CAAA;SAAA;QACH;;MAEK;KACA,CAAA,GAAA,gBAAsB,OAAA,CAAA,CAAA,CAAA;IACtB;GACJ,CAAA;EACA;CACF,CAAC;AACH;;;;AAIA,SAAI,0BAAA,OAAA;UAEA,UACA,QAAA,WAAoB,OAAA,CAAA,QAAc,CAAG;CACvC,MAAA,OAAA,eAAA,QAAA,QAAA,UAAA,QAAA,SAAA,QAAA,sBAAA,QAAA,GAAA,CAAA;;EAEA,IAAM,OAAO;GACb,OAAW,YAAY,KAAG,KAAA;EACxB;EACA,IAAI,WAAC;GACH,OAAA,gBAAc,sBAAA,UAAA;IACd,OAAS;;KAEN,OAAA;MAAA,gBAAA,qBAAA,EACS,OACX,CAAA;MAAA,gBAAuB,gBAAiB,WAAc;OACpD,IAAK,OAAQ;QACX,OAAA,KAAA;OACA;OACC,IAAC,QAAM;QACN,OAAM,WAAW,CAAA,CAAA,CAAO,YAAO,QAAA,OAAA,CAAA,EAAA,IAAA,KAAA,UAAA,QAAA,OAAA,IAAA;OAChC;MACF,GAAG,IAAI,CAAC;MAAG,gBAAG,OAAA,CAAA,CAAA;KAAA;IAChB;GACF,CAAC;EACH;CACF,CAAC;AACH"}
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 {\n getPropertiesList,\n JsonSchema,\n JsonSchemaObject,\n JsonSchemaType,\n stringifyValue\n} from \"@powerlines/schema\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport {\n SchemaContext,\n SchemaPropertyContext\n} from \"../../core/contexts/schema\";\nimport { ComponentProps } from \"../../types/components\";\nimport { TSDocObjectSchema, TSDocSchemaProperty } from \"./tsdoc-schema\";\n\nexport interface ObjectDeclarationProps extends VarDeclarationProps {\n schema?: JsonSchemaObject;\n}\n\n/**\n * Generates a TypeScript object for the given reflection class.\n */\nexport function ObjectDeclaration(props: ObjectDeclarationProps) {\n const { schema } = props;\n if (!schema) {\n return null;\n }\n\n const name = computed(() =>\n camelCase(isSetString(props.name) ? props.name : schema?.name)\n );\n\n const defaultValues = computed(() =>\n Object.fromEntries(\n getPropertiesList(schema).map(property => [\n property.name,\n property.default\n ]) || {}\n )\n );\n const properties = computed(() =>\n getPropertiesList(schema)\n .filter(\n property =>\n !property?.ignore &&\n !property?.runtime &&\n !isUndefined(\n defaultValues.value[property.name] ??\n property?.alias?.reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined(defaultValues.value[alias])\n ) {\n return defaultValues.value[alias];\n }\n\n return ret;\n }, undefined as any) ??\n property?.default\n )\n )\n .sort((a, b) =>\n (a?.readOnly && b?.readOnly) || (!a?.readOnly && !b?.readOnly)\n ? a.name.localeCompare(b.name)\n : a?.readOnly\n ? 1\n : -1\n )\n );\n\n const TypeSymbolSlot = createSymbolSlot();\n const ValueTypeSymbolSlot = createSymbolSlot();\n const sym = createValueSymbol(name.value || \"schema\", {\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={!!schema}>\n <SchemaContext.Provider value={schema}>\n <Show when={!!name.value && !!type}>\n <TSDocObjectSchema schema={schema} />\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 {property => (\n <ObjectDeclarationProperty\n name={property.name}\n schema={property}\n />\n )}\n </For>\n </ObjectExpression>\n )}\n </ValueTypeSymbolSlot>\n </CoreDeclaration>\n </Show>\n <hbr />\n </SchemaContext.Provider>\n </Show>\n );\n}\n\nexport interface ObjectDeclarationPropertyProps extends ComponentProps {\n name: string;\n required?: boolean;\n value?: unknown;\n schema: JsonSchema;\n}\n\n/**\n * Generates a TypeScript object property for the given reflection class.\n */\nexport function ObjectDeclarationProperty(\n props: ObjectDeclarationPropertyProps\n) {\n const [{ schema, name, value }, rest] = splitProps(props, [\n \"schema\",\n \"name\",\n \"value\"\n ]);\n\n return (\n <Show when={isSetString(name)}>\n <SchemaPropertyContext.Provider value={schema}>\n <TSDocSchemaProperty schema={schema} defaultValue={value} />\n <ObjectProperty\n name={name}\n value={stringifyValue(\n value,\n (schema as { type?: JsonSchemaType }).type\n )}\n {...rest}\n />\n <hbr />\n </SchemaPropertyContext.Provider>\n </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA+BA,SAAe,kBAAA,OAAA;CACb,MAAA,EACA,WACA;CACA,IAAI,CAAC,QACP,OAAO;CAEL,MAAA,OAAU,eAAA,UAAA,YAAA,MAAA,IAAA,IAAA,MAAA,OAAA,QAAA,IAAA,CAAA;CACV,MAAA,gBAAgB,eAAA,OAAA,YAAA,kBAAA,MAAA,EAAA,KAAA,aAAA,CAAA,SAAA,MAAA,SAAA,OAAA,CAAA,KAAA,CAAA,CAAA,CAAA;CAChB,MAAA,aAAc,eAAA,kBAAA,MAAA,EAAA,QAAA,aAAA,CAAA,UAAA,UAAA,CAAA,UAAA,WAAA,CAAA,YAAA,cAAA,MAAA,SAAA,SAAA,UAAA,OAAA,QAAA,KAAA,UAAA;EACd,IAAA,YAAA,GAAA,KAAA,CAAA,YAAA,cAAA,MAAA,MAAA,GACI,OAAG,cAAkB,MAAA;EAE3B,OAAS;CACT,GAAA,MAAS,KAAA,UAAoB,OAAO,CAAC,EAAA,MAAK,GAAM,MAAI,GAAA,YAAU,GAAA,YAAA,CAAA,GAAA,YAAA,CAAA,GAAA,WAAA,EAAA,KAAA,cAAA,EAAA,IAAA,IAAA,GAAA,WAAA,IAAA,EAAA,CAAA;CAC9D,MAAO,iBAAA,iBAAA;CACL,MAAA,sBAAa,iBAAA;CACb,MAAA,MAAA,kBAAA,KAAA,SAAA,UAAA;EACA,SAAW,MAAM;EACnB,SAAS,MAAA;EACT,QAAS,MAAA;;EAET,SAAO,MAAU,UAAA,cAAuB,UAAQ,cAAmB;EACjE,MAAQ,MAAC,OAAA,eAAgB,cAAA;EAC3B,YAAA,gBAAA,EAAA,IAAA,UAAA;;CAEE,IAAA,CAAA,MAAA,MACC,oBAAY,cAAsB,GAAI;CAEzC,MAAO,UAAS,MAAA,MAAA,QAAkB,MAA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OAAA;GACC,OAAG,YAAgB,IAAA;EACrB;EACA,IAAE,WAAS;;IAEP,OAAC;IACJ,IAAK,WAAQ;KACX,OAAA;MAAA,gBAA6B,qBAAQ;OACxB;OACT,cAAA;MACD,CAAC;MAAA,gBAAgB,gBAAY,WAAA;OACrB;OACN,IAAC,QAAM;QACN,OAAQ,eAAQ,OAAA,OAAA,IAAA;OACjB;MACF,GAAG,IAAA,CAAA;MAAA,gBAAmB,OAAA,CAAA,CAAA;KAAA;IACxB;GACF,CAAC;EACH;CACF,CAAC;AACH"}
@@ -95,9 +95,13 @@ function TSDocObjectSchema(props) {
95
95
  * Generates a TSDoc documentation block for the given reflection property. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. This is useful for rendering additional details about the reflection that may not be included in the description, such as information about parameters of a method or properties of a class.
96
96
  */
97
97
  function TSDocSchemaProperty(props) {
98
- const [{ children, schema }, rest] = (0, _alloy_js_core.splitProps)(props, ["children", "schema"]);
98
+ const [{ children, schema, defaultValue }, rest] = (0, _alloy_js_core.splitProps)(props, [
99
+ "children",
100
+ "schema",
101
+ "defaultValue"
102
+ ]);
99
103
  if (!(0, _stryke_type_checks.isSetObject)(schema)) return null;
100
- const hasAttributes = (0, _alloy_js_core.computed)(() => (0, _stryke_type_checks_is_set_string.isSetString)(schema?.title) || !(0, _stryke_type_checks_is_undefined.isUndefined)(schema?.alias) && schema?.alias.length > 0 || !(0, _stryke_type_checks_is_undefined.isUndefined)(schema?.tags) && schema?.tags.length > 0 || !(0, _stryke_type_checks_is_undefined.isUndefined)(schema?.readOnly) || !(0, _stryke_type_checks_is_undefined.isUndefined)(schema?.internal) || !(0, _stryke_type_checks_is_undefined.isUndefined)(schema?.runtime) || !(0, _stryke_type_checks_is_undefined.isUndefined)(schema?.ignore) || !(0, _stryke_type_checks_is_undefined.isUndefined)(schema?.hidden) || !(0, _stryke_type_checks_is_undefined.isUndefined)(schema?.default));
104
+ const hasAttributes = (0, _alloy_js_core.computed)(() => (0, _stryke_type_checks_is_set_string.isSetString)(schema?.title) || !(0, _stryke_type_checks_is_undefined.isUndefined)(schema?.alias) && schema?.alias.length > 0 || !(0, _stryke_type_checks_is_undefined.isUndefined)(schema?.tags) && schema?.tags.length > 0 || !(0, _stryke_type_checks_is_undefined.isUndefined)(schema?.readOnly) || !(0, _stryke_type_checks_is_undefined.isUndefined)(schema?.internal) || !(0, _stryke_type_checks_is_undefined.isUndefined)(schema?.runtime) || !(0, _stryke_type_checks_is_undefined.isUndefined)(schema?.ignore) || !(0, _stryke_type_checks_is_undefined.isUndefined)(schema?.hidden) || !(0, _stryke_type_checks_is_undefined.isUndefined)(defaultValue));
101
105
  return (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDoc, (0, _alloy_js_core_jsx_runtime.mergeProps)({ get heading() {
102
106
  return schema?.description;
103
107
  } }, rest, { get children() {
@@ -134,9 +138,7 @@ function TSDocSchemaProperty(props) {
134
138
  get hidden() {
135
139
  return schema?.hidden;
136
140
  },
137
- get ["default"]() {
138
- return schema?.default;
139
- }
141
+ "default": defaultValue
140
142
  });
141
143
  }
142
144
  }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
@@ -1,21 +1,22 @@
1
1
  import { TSDocProps } from "./tsdoc.cjs";
2
- import { JsonSchema, JsonSchemaProperty } from "@powerlines/schema";
2
+ import { JsonSchema } from "@powerlines/schema";
3
3
 
4
4
  //#region src/typescript/components/tsdoc-schema.d.ts
5
- interface TSDocObjectSchemaProps<T extends Record<string, any> = Record<string, any>> extends TSDocProps {
6
- schema: JsonSchema<T>;
5
+ interface TSDocObjectSchemaProps extends TSDocProps {
6
+ schema: JsonSchema;
7
7
  }
8
8
  /**
9
9
  * Generates a TSDoc documentation block for the given reflection class. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. This is useful for rendering additional details about the reflection that may not be included in the description, such as information about properties or methods of a class.
10
10
  */
11
- declare function TSDocObjectSchema<T extends Record<string, any> = Record<string, any>>(props: TSDocObjectSchemaProps<T>): import("@alloy-js/core").Children;
12
- interface TSDocSchemaPropertyProps<T extends Record<string, any> = Record<string, any>> extends TSDocProps {
13
- schema: JsonSchemaProperty<T>;
11
+ declare function TSDocObjectSchema(props: TSDocObjectSchemaProps): import("@alloy-js/core").Children;
12
+ interface TSDocSchemaPropertyProps extends TSDocProps {
13
+ schema: JsonSchema;
14
+ defaultValue?: unknown;
14
15
  }
15
16
  /**
16
17
  * Generates a TSDoc documentation block for the given reflection property. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. This is useful for rendering additional details about the reflection that may not be included in the description, such as information about parameters of a method or properties of a class.
17
18
  */
18
- declare function TSDocSchemaProperty<T extends Record<string, any> = Record<string, any>>(props: TSDocSchemaPropertyProps<T>): import("@alloy-js/core").Children;
19
+ declare function TSDocSchemaProperty(props: TSDocSchemaPropertyProps): import("@alloy-js/core").Children;
19
20
  //#endregion
20
21
  export { TSDocObjectSchema, TSDocObjectSchemaProps, TSDocSchemaProperty, TSDocSchemaPropertyProps };
21
22
  //# sourceMappingURL=tsdoc-schema.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tsdoc-schema.d.cts","names":[],"sources":["../../../src/typescript/components/tsdoc-schema.tsx"],"mappings":";;;;UAqCiB,sBAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,UAAA;EACR,MAAA,EAAQ,UAAA,CAAW,CAAA;AAAA;;;;iBAML,iBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,sBAAA,CAAuB,CAAA,6BAAE,QAAA;AAAA,UA8EjB,wBAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,UAAA;EACR,MAAA,EAAQ,kBAAA,CAAmB,CAAA;AAAA;;;;iBAMb,mBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,wBAAA,CAAyB,CAAA,6BAAE,QAAA"}
1
+ {"version":3,"file":"tsdoc-schema.d.cts","names":[],"sources":["../../../src/typescript/components/tsdoc-schema.tsx"],"mappings":";;;;UAiCiB,sBAAA,SAA+B,UAAU;EACxD,MAAA,EAAQ,UAAA;AAAA;;;;iBAMM,iBAAA,CAAkB,KAAA,EAAO,sBAAsB,4BAAA,QAAA;AAAA,UA8E9C,wBAAA,SAAiC,UAAU;EAC1D,MAAA,EAAQ,UAAA;EACR,YAAA;AAAA;AAhFF;;;AAAA,iBAsFgB,mBAAA,CAAoB,KAAA,EAAO,wBAAwB,4BAAA,QAAA"}
@@ -1,21 +1,22 @@
1
1
  import { TSDocProps } from "./tsdoc.mjs";
2
- import { JsonSchema, JsonSchemaProperty } from "@powerlines/schema";
2
+ import { JsonSchema } from "@powerlines/schema";
3
3
 
4
4
  //#region src/typescript/components/tsdoc-schema.d.ts
5
- interface TSDocObjectSchemaProps<T extends Record<string, any> = Record<string, any>> extends TSDocProps {
6
- schema: JsonSchema<T>;
5
+ interface TSDocObjectSchemaProps extends TSDocProps {
6
+ schema: JsonSchema;
7
7
  }
8
8
  /**
9
9
  * Generates a TSDoc documentation block for the given reflection class. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. This is useful for rendering additional details about the reflection that may not be included in the description, such as information about properties or methods of a class.
10
10
  */
11
- declare function TSDocObjectSchema<T extends Record<string, any> = Record<string, any>>(props: TSDocObjectSchemaProps<T>): import("@alloy-js/core").Children;
12
- interface TSDocSchemaPropertyProps<T extends Record<string, any> = Record<string, any>> extends TSDocProps {
13
- schema: JsonSchemaProperty<T>;
11
+ declare function TSDocObjectSchema(props: TSDocObjectSchemaProps): import("@alloy-js/core").Children;
12
+ interface TSDocSchemaPropertyProps extends TSDocProps {
13
+ schema: JsonSchema;
14
+ defaultValue?: unknown;
14
15
  }
15
16
  /**
16
17
  * Generates a TSDoc documentation block for the given reflection property. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. This is useful for rendering additional details about the reflection that may not be included in the description, such as information about parameters of a method or properties of a class.
17
18
  */
18
- declare function TSDocSchemaProperty<T extends Record<string, any> = Record<string, any>>(props: TSDocSchemaPropertyProps<T>): import("@alloy-js/core").Children;
19
+ declare function TSDocSchemaProperty(props: TSDocSchemaPropertyProps): import("@alloy-js/core").Children;
19
20
  //#endregion
20
21
  export { TSDocObjectSchema, TSDocObjectSchemaProps, TSDocSchemaProperty, TSDocSchemaPropertyProps };
21
22
  //# sourceMappingURL=tsdoc-schema.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tsdoc-schema.d.mts","names":[],"sources":["../../../src/typescript/components/tsdoc-schema.tsx"],"mappings":";;;;UAqCiB,sBAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,UAAA;EACR,MAAA,EAAQ,UAAA,CAAW,CAAA;AAAA;;;;iBAML,iBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,sBAAA,CAAuB,CAAA,6BAAE,QAAA;AAAA,UA8EjB,wBAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,UAAA;EACR,MAAA,EAAQ,kBAAA,CAAmB,CAAA;AAAA;;;;iBAMb,mBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,wBAAA,CAAyB,CAAA,6BAAE,QAAA"}
1
+ {"version":3,"file":"tsdoc-schema.d.mts","names":[],"sources":["../../../src/typescript/components/tsdoc-schema.tsx"],"mappings":";;;;UAiCiB,sBAAA,SAA+B,UAAU;EACxD,MAAA,EAAQ,UAAA;AAAA;;;;iBAMM,iBAAA,CAAkB,KAAA,EAAO,sBAAsB,4BAAA,QAAA;AAAA,UA8E9C,wBAAA,SAAiC,UAAU;EAC1D,MAAA,EAAQ,UAAA;EACR,YAAA;AAAA;AAhFF;;;AAAA,iBAsFgB,mBAAA,CAAoB,KAAA,EAAO,wBAAwB,4BAAA,QAAA"}
@@ -94,9 +94,13 @@ function TSDocObjectSchema(props) {
94
94
  * Generates a TSDoc documentation block for the given reflection property. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. This is useful for rendering additional details about the reflection that may not be included in the description, such as information about parameters of a method or properties of a class.
95
95
  */
96
96
  function TSDocSchemaProperty(props) {
97
- const [{ children, schema }, rest] = splitProps(props, ["children", "schema"]);
97
+ const [{ children, schema, defaultValue }, rest] = splitProps(props, [
98
+ "children",
99
+ "schema",
100
+ "defaultValue"
101
+ ]);
98
102
  if (!isSetObject(schema)) return null;
99
- const hasAttributes = computed(() => isSetString(schema?.title) || !isUndefined(schema?.alias) && schema?.alias.length > 0 || !isUndefined(schema?.tags) && schema?.tags.length > 0 || !isUndefined(schema?.readOnly) || !isUndefined(schema?.internal) || !isUndefined(schema?.runtime) || !isUndefined(schema?.ignore) || !isUndefined(schema?.hidden) || !isUndefined(schema?.default));
103
+ const hasAttributes = computed(() => isSetString(schema?.title) || !isUndefined(schema?.alias) && schema?.alias.length > 0 || !isUndefined(schema?.tags) && schema?.tags.length > 0 || !isUndefined(schema?.readOnly) || !isUndefined(schema?.internal) || !isUndefined(schema?.runtime) || !isUndefined(schema?.ignore) || !isUndefined(schema?.hidden) || !isUndefined(defaultValue));
100
104
  return createComponent(TSDoc, mergeProps({ get heading() {
101
105
  return schema?.description;
102
106
  } }, rest, { get children() {
@@ -133,9 +137,7 @@ function TSDocSchemaProperty(props) {
133
137
  get hidden() {
134
138
  return schema?.hidden;
135
139
  },
136
- get ["default"]() {
137
- return schema?.default;
138
- }
140
+ "default": defaultValue
139
141
  });
140
142
  }
141
143
  }), createComponent(Show, {
@@ -1 +1 @@
1
- {"version":3,"file":"tsdoc-schema.mjs","names":[],"sources":["../../../src/typescript/components/tsdoc-schema.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 childrenArray,\n computed,\n List,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n getPrimarySchemaType,\n JsonSchema,\n JsonSchemaProperty\n} from \"@powerlines/schema\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetObject } from \"@stryke/type-checks\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { Spacing } from \"../../core/components/spacing\";\nimport { TSDoc, TSDocAttributesTags, TSDocProps } from \"./tsdoc\";\n\nexport interface TSDocObjectSchemaProps<\n T extends Record<string, any> = Record<string, any>\n> extends TSDocProps {\n schema: JsonSchema<T>;\n}\n\n/**\n * Generates a TSDoc documentation block for the given reflection class. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. This is useful for rendering additional details about the reflection that may not be included in the description, such as information about properties or methods of a class.\n */\nexport function TSDocObjectSchema<\n T extends Record<string, any> = Record<string, any>\n>(props: TSDocObjectSchemaProps<T>) {\n const [{ children, heading, schema }, rest] = splitProps(props, [\n \"heading\",\n \"children\",\n \"schema\"\n ]);\n\n if (!isSetObject(schema)) {\n return null;\n }\n\n const title = computed(() => schema?.title || titleCase(schema?.name));\n const computedHeading = computed(\n () => heading || schema?.description || title.value\n );\n\n const alias = computed(() => schema?.alias);\n const tags = computed(() => schema?.tags);\n const readOnly = computed(() => schema?.readOnly);\n const internal = computed(() => schema?.internal);\n const runtime = computed(() => schema?.runtime);\n const ignore = computed(() => schema?.ignore);\n const hidden = computed(() => schema?.hidden);\n\n if (\n !computedHeading.value ||\n (isSetString(computedHeading.value) && computedHeading.value.trim() === \"\")\n ) {\n return null;\n }\n\n const hasAttributes = computed(\n () =>\n isSetString(title.value) ||\n (!isUndefined(alias.value) && alias.value.length > 0) ||\n (!isUndefined(tags.value) && tags.value.length > 0) ||\n !isUndefined(readOnly.value) ||\n !isUndefined(internal.value) ||\n !isUndefined(runtime.value) ||\n !isUndefined(ignore.value) ||\n !isUndefined(hidden.value)\n );\n\n return (\n <TSDoc\n {...rest}\n heading={\n isSetString(computedHeading.value)\n ? computedHeading.value.trim()\n : computedHeading.value\n }>\n <Show when={hasAttributes.value}>\n <TSDocAttributesTags\n type={getPrimarySchemaType<T>(schema)}\n title={title.value}\n alias={alias.value}\n tags={tags.value}\n readOnly={Boolean(readOnly.value)}\n internal={Boolean(internal.value)}\n runtime={Boolean(runtime.value)}\n ignore={Boolean(ignore.value)}\n hidden={Boolean(hidden.value)}\n />\n </Show>\n <Show\n when={\n !isUndefined(children) &&\n childrenArray(() => children).filter(Boolean).length > 0\n }>\n <Show when={hasAttributes.value}>\n <Spacing />\n </Show>\n <List>{childrenArray(() => children)}</List>\n </Show>\n </TSDoc>\n );\n}\n\nexport interface TSDocSchemaPropertyProps<\n T extends Record<string, any> = Record<string, any>\n> extends TSDocProps {\n schema: JsonSchemaProperty<T>;\n}\n\n/**\n * Generates a TSDoc documentation block for the given reflection property. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. This is useful for rendering additional details about the reflection that may not be included in the description, such as information about parameters of a method or properties of a class.\n */\nexport function TSDocSchemaProperty<\n T extends Record<string, any> = Record<string, any>\n>(props: TSDocSchemaPropertyProps<T>) {\n const [{ children, schema }, rest] = splitProps(props, [\n \"children\",\n \"schema\"\n ]);\n\n if (!isSetObject(schema)) {\n return null;\n }\n\n const hasAttributes = computed(\n () =>\n isSetString(schema?.title) ||\n (!isUndefined(schema?.alias) && schema?.alias.length > 0) ||\n (!isUndefined(schema?.tags) && schema?.tags.length > 0) ||\n !isUndefined(schema?.readOnly) ||\n !isUndefined(schema?.internal) ||\n !isUndefined(schema?.runtime) ||\n !isUndefined(schema?.ignore) ||\n !isUndefined(schema?.hidden) ||\n !isUndefined(schema?.default)\n );\n\n return (\n <TSDoc heading={schema?.description} {...rest}>\n <Show when={hasAttributes.value}>\n <TSDocAttributesTags\n type={getPrimarySchemaType<T[keyof T]>(schema)}\n title={schema?.title}\n alias={schema?.alias}\n tags={schema?.tags}\n readOnly={schema?.readOnly}\n internal={schema?.internal}\n runtime={schema?.runtime}\n ignore={schema?.ignore}\n hidden={schema?.hidden}\n default={schema?.default}\n />\n </Show>\n <Show\n when={\n !isUndefined(children) &&\n childrenArray(() => children).filter(Boolean).length > 0\n }>\n <Show when={hasAttributes.value}>\n <Spacing />\n </Show>\n <List>{childrenArray(() => children)}</List>\n </Show>\n </TSDoc>\n );\n}\n\n// export interface TSDocReflectionMethodProps extends TSDocProps {\n// reflection: ReflectionMethod;\n// }\n\n// /**\n// * Generates a TSDoc documentation block for the given reflection method. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. Additionally, this component will render information about the parameters and return type of the method, if available.\n// */\n// export function TSDocReflectionMethod(props: TSDocReflectionMethodProps) {\n// const [{ children, reflection }, rest] = splitProps(props, [\n// \"children\",\n// \"reflection\"\n// ]);\n\n// if (!isSetObject(reflection)) {\n// return null;\n// }\n\n// const heading = computed(\n// () =>\n// reflection.getDescription() ||\n// (isString(reflection.getName())\n// ? code`${String(reflection.getName())} method definition`\n// : undefined)\n// );\n\n// return (\n// <TSDoc heading={heading.value} {...rest}>\n// <TSDocAttributesTags\n// title={reflection.getTitle()}\n// alias={reflection.getAlias()}\n// resourceId={reflection.getDomain()}\n// permission={reflection.getPermission()}\n// isReadonly={reflection.isReadonly()}\n// isInternal={reflection.isInternal()}\n// isRuntime={reflection.isRuntime()}\n// isIgnored={reflection.isIgnored()}\n// isHidden={reflection.isHidden()}\n// />\n// <Show\n// when={Boolean(children) && childrenArray(() => children).length > 0}>\n// <List>{childrenArray(() => children)}</List>\n// </Show>\n// <Show when={reflection.getParameters().length > 0}>\n// <Spacing />\n// <For each={reflection.getParameters()} hardline ender={<hbr />}>\n// {param => (\n// <TSDocParam\n// name={param.getName()}\n// optional={param.isOptional()}\n// defaultValue={\n// param.hasDefault() ? param.getDefaultValue() : undefined\n// }>\n// <Show\n// when={Boolean(param.parameter.description)}\n// fallback={code`A parameter to provide a ${param.getName()} value to the function.`}>\n// {param.parameter.description}\n// </Show>\n// </TSDocParam>\n// )}\n// </For>\n// </Show>\n// <Show when={reflection.getReturnType().kind !== ReflectionKind.void}>\n// <Spacing />\n// <TSDocReturns>\n// {code`The return value of the function, which is of type ${stringifyType(\n// reflection.getReturnType()\n// )}.`}\n// </TSDocReturns>\n// </Show>\n// </TSDoc>\n// );\n// }\n\n// /**\n// * Uses the `useReflectionMethod` hook to retrieve the reflection method from the context, and then renders a `TSDocReflectionMethod` component with the retrieved reflection method. This is a convenience component that allows you to easily render a TSDoc documentation block for the current reflection method without having to manually retrieve the reflection method from the context.\n// */\n// export function TSDocContextMethod(props: TSDocProps) {\n// const reflection = useReflectionMethod();\n\n// return (\n// <Show when={isSetObject(reflection)}>\n// <TSDocReflectionMethod {...props} reflection={reflection} />\n// </Show>\n// );\n// }\n"],"mappings":";;;;;;;;;;;;;;AA8BA,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;KACA,IAAA,WAAoB;MACpB,OAAY,QAAQ;KACpB;KACA,IAAA,UAAmB;MACnB,OAAY,QAAQ;KACxB;;MAEM,OAAA,QAAA;KACE;KACC,IAAI,SAAE;MACT,OAAA,QAAA;KACC;KACA,KAAO,aAAa;MACpB,OAAO,QAAQ;KACf;IACA,CAAA;GACF;EACF,CAAC,GAAG,gBAAiB,MAAO;GAC1B,IAAE,OAAQ;IACR,OAAO,WAAS,CAAA,CAAM,CAAA,YAAA,QAAA,CAAA,EAAA,KAAA,oBAAA,QAAA,EAAA,OAAA,OAAA,EAAA,SAAA;GACxB;GACA,IAAC,WAAA;IACD,OAAI,CAAA,gBAAA,MAAA;KACL,IAAA,OAAA;MACM,OAAA,cAAA;KACF;KACD,IAAA,WAAiB;MAClB,OAAA,gBAAA,SAAA,CAAA,CAAA;KACA;IACC,CAAC,GAAA,gBAAS,MAAA,EACV,IAAI,WAAA;KACA,OAAC,oBAAoB,QAAY;IACnC,EACN,CAAK,CAAA;GACR;EACH,CAAA,CAAA;GAEE,CAAC,CAAA;AACH"}
1
+ {"version":3,"file":"tsdoc-schema.mjs","names":[],"sources":["../../../src/typescript/components/tsdoc-schema.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 childrenArray,\n computed,\n List,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport { getPrimarySchemaType, JsonSchema } from \"@powerlines/schema\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetObject } from \"@stryke/type-checks\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { Spacing } from \"../../core/components/spacing\";\nimport { TSDoc, TSDocAttributesTags, TSDocProps } from \"./tsdoc\";\n\nexport interface TSDocObjectSchemaProps extends TSDocProps {\n schema: JsonSchema;\n}\n\n/**\n * Generates a TSDoc documentation block for the given reflection class. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. This is useful for rendering additional details about the reflection that may not be included in the description, such as information about properties or methods of a class.\n */\nexport function TSDocObjectSchema(props: TSDocObjectSchemaProps) {\n const [{ children, heading, schema }, rest] = splitProps(props, [\n \"heading\",\n \"children\",\n \"schema\"\n ]);\n\n if (!isSetObject(schema)) {\n return null;\n }\n\n const title = computed(() => schema?.title || titleCase(schema?.name));\n const computedHeading = computed(\n () => heading || schema?.description || title.value\n );\n\n const alias = computed(() => schema?.alias);\n const tags = computed(() => schema?.tags);\n const readOnly = computed(() => schema?.readOnly);\n const internal = computed(() => schema?.internal);\n const runtime = computed(() => schema?.runtime);\n const ignore = computed(() => schema?.ignore);\n const hidden = computed(() => schema?.hidden);\n\n if (\n !computedHeading.value ||\n (isSetString(computedHeading.value) && computedHeading.value.trim() === \"\")\n ) {\n return null;\n }\n\n const hasAttributes = computed(\n () =>\n isSetString(title.value) ||\n (!isUndefined(alias.value) && alias.value.length > 0) ||\n (!isUndefined(tags.value) && tags.value.length > 0) ||\n !isUndefined(readOnly.value) ||\n !isUndefined(internal.value) ||\n !isUndefined(runtime.value) ||\n !isUndefined(ignore.value) ||\n !isUndefined(hidden.value)\n );\n\n return (\n <TSDoc\n {...rest}\n heading={\n isSetString(computedHeading.value)\n ? computedHeading.value.trim()\n : computedHeading.value\n }>\n <Show when={hasAttributes.value}>\n <TSDocAttributesTags\n type={getPrimarySchemaType(schema)}\n title={title.value}\n alias={alias.value}\n tags={tags.value}\n readOnly={Boolean(readOnly.value)}\n internal={Boolean(internal.value)}\n runtime={Boolean(runtime.value)}\n ignore={Boolean(ignore.value)}\n hidden={Boolean(hidden.value)}\n />\n </Show>\n <Show\n when={\n !isUndefined(children) &&\n childrenArray(() => children).filter(Boolean).length > 0\n }>\n <Show when={hasAttributes.value}>\n <Spacing />\n </Show>\n <List>{childrenArray(() => children)}</List>\n </Show>\n </TSDoc>\n );\n}\n\nexport interface TSDocSchemaPropertyProps extends TSDocProps {\n schema: JsonSchema;\n defaultValue?: unknown;\n}\n\n/**\n * Generates a TSDoc documentation block for the given reflection property. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. This is useful for rendering additional details about the reflection that may not be included in the description, such as information about parameters of a method or properties of a class.\n */\nexport function TSDocSchemaProperty(props: TSDocSchemaPropertyProps) {\n const [{ children, schema, defaultValue }, rest] = splitProps(props, [\n \"children\",\n \"schema\",\n \"defaultValue\"\n ]);\n\n if (!isSetObject(schema)) {\n return null;\n }\n\n const hasAttributes = computed(\n () =>\n isSetString(schema?.title) ||\n (!isUndefined(schema?.alias) && schema?.alias.length > 0) ||\n (!isUndefined(schema?.tags) && schema?.tags.length > 0) ||\n !isUndefined(schema?.readOnly) ||\n !isUndefined(schema?.internal) ||\n !isUndefined(schema?.runtime) ||\n !isUndefined(schema?.ignore) ||\n !isUndefined(schema?.hidden) ||\n !isUndefined(defaultValue)\n );\n\n return (\n <TSDoc heading={schema?.description} {...rest}>\n <Show when={hasAttributes.value}>\n <TSDocAttributesTags\n type={getPrimarySchemaType(schema)}\n title={schema?.title}\n alias={schema?.alias}\n tags={schema?.tags}\n readOnly={schema?.readOnly}\n internal={schema?.internal}\n runtime={schema?.runtime}\n ignore={schema?.ignore}\n hidden={schema?.hidden}\n default={defaultValue}\n />\n </Show>\n <Show\n when={\n !isUndefined(children) &&\n childrenArray(() => children).filter(Boolean).length > 0\n }>\n <Show when={hasAttributes.value}>\n <Spacing />\n </Show>\n <List>{childrenArray(() => children)}</List>\n </Show>\n </TSDoc>\n );\n}\n\n// export interface TSDocReflectionMethodProps extends TSDocProps {\n// reflection: ReflectionMethod;\n// }\n\n// /**\n// * Generates a TSDoc documentation block for the given reflection method. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. Additionally, this component will render information about the parameters and return type of the method, if available.\n// */\n// export function TSDocReflectionMethod(props: TSDocReflectionMethodProps) {\n// const [{ children, reflection }, rest] = splitProps(props, [\n// \"children\",\n// \"reflection\"\n// ]);\n\n// if (!isSetObject(reflection)) {\n// return null;\n// }\n\n// const heading = computed(\n// () =>\n// reflection.getDescription() ||\n// (isString(reflection.getName())\n// ? code`${String(reflection.getName())} method definition`\n// : undefined)\n// );\n\n// return (\n// <TSDoc heading={heading.value} {...rest}>\n// <TSDocAttributesTags\n// title={reflection.getTitle()}\n// alias={reflection.getAlias()}\n// resourceId={reflection.getDomain()}\n// permission={reflection.getPermission()}\n// isReadonly={reflection.isReadonly()}\n// isInternal={reflection.isInternal()}\n// isRuntime={reflection.isRuntime()}\n// isIgnored={reflection.isIgnored()}\n// isHidden={reflection.isHidden()}\n// />\n// <Show\n// when={Boolean(children) && childrenArray(() => children).length > 0}>\n// <List>{childrenArray(() => children)}</List>\n// </Show>\n// <Show when={reflection.getParameters().length > 0}>\n// <Spacing />\n// <For each={reflection.getParameters()} hardline ender={<hbr />}>\n// {param => (\n// <TSDocParam\n// name={param.getName()}\n// optional={param.isOptional()}\n// defaultValue={\n// param.hasDefault() ? param.getDefaultValue() : undefined\n// }>\n// <Show\n// when={Boolean(param.parameter.description)}\n// fallback={code`A parameter to provide a ${param.getName()} value to the function.`}>\n// {param.parameter.description}\n// </Show>\n// </TSDocParam>\n// )}\n// </For>\n// </Show>\n// <Show when={reflection.getReturnType().kind !== ReflectionKind.void}>\n// <Spacing />\n// <TSDocReturns>\n// {code`The return value of the function, which is of type ${stringifyType(\n// reflection.getReturnType()\n// )}.`}\n// </TSDocReturns>\n// </Show>\n// </TSDoc>\n// );\n// }\n\n// /**\n// * Uses the `useReflectionMethod` hook to retrieve the reflection method from the context, and then renders a `TSDocReflectionMethod` component with the retrieved reflection method. This is a convenience component that allows you to easily render a TSDoc documentation block for the current reflection method without having to manually retrieve the reflection method from the context.\n// */\n// export function TSDocContextMethod(props: TSDocProps) {\n// const reflection = useReflectionMethod();\n\n// return (\n// <Show when={isSetObject(reflection)}>\n// <TSDocReflectionMethod {...props} reflection={reflection} />\n// </Show>\n// );\n// }\n"],"mappings":";;;;;;;;;;;;;;AA8BA,SAAgB,kBAAe,OAAK;CACpC,MAAQ,CAAC,YAET,SACE,UACF,QAAA,WAAA,OAAA;EAAA;EAAA;EAAA;CAAA,CAAA;2BAEE,OAAA;CAEA,MAAA,QAAA,eAAA,QAAA,SAAA,UAAA,QAAA,IAAA,CAAA;CACF,MAAO,kBAAS,eAAyB,WAAA,QAAA,eAAwB,MAAA,KAAA;CAC/D,MAAM,QAAG,eAAmB,QAAS,KAAK;CAC1C,MAAG,OAAQ,eAAA,QAAA,IAAA;CACX,MAAG,WAAS,eAAA,QAAA,QAAA;CACZ,MAAG,WAAM,eAAA,QAAA,QAAA;CACT,MAAE,UAAA,eAAA,QAAA,OAAA;;CAEF,MAAK,SAAA,eAAqB,QAAA,MAAA;CAC1B,IAAE,CAAA,gBAAW,SAAA,YAAA,gBAAA,KAAA,KAAA,gBAAA,MAAA,KAAA,MAAA,IACb,OAAA;CAEA,MAAM,gBAAgB,eAAe,YAAS,MAAS,KAAC,KAAQ,CAAA,YAAM,MAAA,KAAA,KAAA,MAAA,MAAA,SAAA,KAAA,CAAA,YAAA,KAAA,KAAA,KAAA,KAAA,MAAA,SAAA,KAAA,CAAA,YAAA,SAAA,KAAA,KAAA,CAAA,YAAA,SAAA,KAAA,KAAA,CAAA,YAAA,QAAA,KAAA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A;KACR;KACH,IAAA,WAAA;;KAEU;IACL,CAAA,GAAA,gBAAY,MAAgB,EAC9B,IAAA,WAAA;;IAEE,EACC,CAAA,CAAA;GACD;EACF,CAAA,CAAA;CACC,EACF,CAAC,CAAC;AACJ"}
@@ -5,7 +5,7 @@ import { TypeParameters, TypeParametersProps } from "./components/type-parameter
5
5
  import { ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet } from "./components/class-declaration.cjs";
6
6
  import { DynamicImportStatement, DynamicImportStatementProps } from "./components/dynamic-import-statement.cjs";
7
7
  import { EntryFile, EntryFileProps } from "./components/entry-file.cjs";
8
- import { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, InterfaceSchemaMemberProps } from "./components/interface-declaration.cjs";
8
+ import { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfaceSchemaMemberProps } from "./components/interface-declaration.cjs";
9
9
  import { ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps } from "./components/object-declaration.cjs";
10
10
  import { PropertyName, PropertyNameProps } from "./components/property-name.cjs";
11
11
  import { RecordExpression, RecordExpressionProps } from "./components/record-expression.cjs";
@@ -14,4 +14,4 @@ import { TypeDeclaration, TypeDeclarationProps } from "./components/type-declara
14
14
  import { LexicalScope, LexicalScopeProps, LexicalScopePropsWithScopeInfo, LexicalScopePropsWithScopeValue } from "./contexts/lexical-scope.cjs";
15
15
  import { getCallSignatureProps } from "./helpers/get-call-signature-props.cjs";
16
16
  import { isValidJSIdentifier } from "./helpers/utilities.cjs";
17
- export { BuiltinFile, BuiltinFileProps, ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, DynamicImportStatement, DynamicImportStatementProps, EntryFile, EntryFileProps, InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, InterfaceSchemaMemberProps, LexicalScope, LexicalScopeProps, LexicalScopePropsWithScopeInfo, LexicalScopePropsWithScopeValue, ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps, PropertyName, PropertyNameProps, RecordExpression, RecordExpressionProps, TSDoc, TSDocAlias, TSDocAttributesTags, TSDocAttributesTagsProps, TSDocDefaultValue, TSDocDefaultValueProps, TSDocDomain, TSDocExample, TSDocExampleProps, TSDocGroup, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocModuleProps, TSDocObjectSchema, TSDocObjectSchemaProps, TSDocParam, TSDocParamProps, TSDocParams, TSDocParamsProps, TSDocPermission, TSDocProps, TSDocReadonly, TSDocRemarks, TSDocReturns, TSDocRuntime, TSDocSchemaProperty, TSDocSchemaPropertyProps, TSDocTag, TSDocTagProps, TSDocThrows, TSDocTitle, TypeDeclaration, TypeDeclarationProps, TypeParameters, TypeParametersProps, TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports, TypescriptFileHeaderImportsProps, TypescriptFileHeaderProps, TypescriptFileProps, getCallSignatureProps, isValidJSIdentifier };
17
+ export { BuiltinFile, BuiltinFileProps, ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, DynamicImportStatement, DynamicImportStatementProps, EntryFile, EntryFileProps, InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfaceSchemaMemberProps, LexicalScope, LexicalScopeProps, LexicalScopePropsWithScopeInfo, LexicalScopePropsWithScopeValue, ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps, PropertyName, PropertyNameProps, RecordExpression, RecordExpressionProps, TSDoc, TSDocAlias, TSDocAttributesTags, TSDocAttributesTagsProps, TSDocDefaultValue, TSDocDefaultValueProps, TSDocDomain, TSDocExample, TSDocExampleProps, TSDocGroup, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocModuleProps, TSDocObjectSchema, TSDocObjectSchemaProps, TSDocParam, TSDocParamProps, TSDocParams, TSDocParamsProps, TSDocPermission, TSDocProps, TSDocReadonly, TSDocRemarks, TSDocReturns, TSDocRuntime, TSDocSchemaProperty, TSDocSchemaPropertyProps, TSDocTag, TSDocTagProps, TSDocThrows, TSDocTitle, TypeDeclaration, TypeDeclarationProps, TypeParameters, TypeParametersProps, TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports, TypescriptFileHeaderImportsProps, TypescriptFileHeaderProps, TypescriptFileProps, getCallSignatureProps, isValidJSIdentifier };
@@ -5,7 +5,7 @@ import { TypeParameters, TypeParametersProps } from "./components/type-parameter
5
5
  import { ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet } from "./components/class-declaration.mjs";
6
6
  import { DynamicImportStatement, DynamicImportStatementProps } from "./components/dynamic-import-statement.mjs";
7
7
  import { EntryFile, EntryFileProps } from "./components/entry-file.mjs";
8
- import { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, InterfaceSchemaMemberProps } from "./components/interface-declaration.mjs";
8
+ import { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfaceSchemaMemberProps } from "./components/interface-declaration.mjs";
9
9
  import { ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps } from "./components/object-declaration.mjs";
10
10
  import { PropertyName, PropertyNameProps } from "./components/property-name.mjs";
11
11
  import { RecordExpression, RecordExpressionProps } from "./components/record-expression.mjs";
@@ -14,4 +14,4 @@ import { TypeDeclaration, TypeDeclarationProps } from "./components/type-declara
14
14
  import { LexicalScope, LexicalScopeProps, LexicalScopePropsWithScopeInfo, LexicalScopePropsWithScopeValue } from "./contexts/lexical-scope.mjs";
15
15
  import { getCallSignatureProps } from "./helpers/get-call-signature-props.mjs";
16
16
  import { isValidJSIdentifier } from "./helpers/utilities.mjs";
17
- export { BuiltinFile, BuiltinFileProps, ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, DynamicImportStatement, DynamicImportStatementProps, EntryFile, EntryFileProps, InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, InterfaceSchemaMemberProps, LexicalScope, LexicalScopeProps, LexicalScopePropsWithScopeInfo, LexicalScopePropsWithScopeValue, ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps, PropertyName, PropertyNameProps, RecordExpression, RecordExpressionProps, TSDoc, TSDocAlias, TSDocAttributesTags, TSDocAttributesTagsProps, TSDocDefaultValue, TSDocDefaultValueProps, TSDocDomain, TSDocExample, TSDocExampleProps, TSDocGroup, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocModuleProps, TSDocObjectSchema, TSDocObjectSchemaProps, TSDocParam, TSDocParamProps, TSDocParams, TSDocParamsProps, TSDocPermission, TSDocProps, TSDocReadonly, TSDocRemarks, TSDocReturns, TSDocRuntime, TSDocSchemaProperty, TSDocSchemaPropertyProps, TSDocTag, TSDocTagProps, TSDocThrows, TSDocTitle, TypeDeclaration, TypeDeclarationProps, TypeParameters, TypeParametersProps, TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports, TypescriptFileHeaderImportsProps, TypescriptFileHeaderProps, TypescriptFileProps, getCallSignatureProps, isValidJSIdentifier };
17
+ export { BuiltinFile, BuiltinFileProps, ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, DynamicImportStatement, DynamicImportStatementProps, EntryFile, EntryFileProps, InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfaceSchemaMemberProps, LexicalScope, LexicalScopeProps, LexicalScopePropsWithScopeInfo, LexicalScopePropsWithScopeValue, ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps, PropertyName, PropertyNameProps, RecordExpression, RecordExpressionProps, TSDoc, TSDocAlias, TSDocAttributesTags, TSDocAttributesTagsProps, TSDocDefaultValue, TSDocDefaultValueProps, TSDocDomain, TSDocExample, TSDocExampleProps, TSDocGroup, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocModuleProps, TSDocObjectSchema, TSDocObjectSchemaProps, TSDocParam, TSDocParamProps, TSDocParams, TSDocParamsProps, TSDocPermission, TSDocProps, TSDocReadonly, TSDocRemarks, TSDocReturns, TSDocRuntime, TSDocSchemaProperty, TSDocSchemaPropertyProps, TSDocTag, TSDocTagProps, TSDocThrows, TSDocTitle, TypeDeclaration, TypeDeclarationProps, TypeParameters, TypeParametersProps, TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports, TypescriptFileHeaderImportsProps, TypescriptFileHeaderProps, TypescriptFileProps, getCallSignatureProps, isValidJSIdentifier };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-alloy",
3
- "version": "0.26.149",
3
+ "version": "0.26.151",
4
4
  "description": "A package containing various Alloy framework components and helper utilities.",
5
5
  "keywords": ["alloy-js", "powerlines", "powerlines-plugin"],
6
6
  "homepage": "https://stormsoftware.com",
@@ -292,8 +292,8 @@
292
292
  "@alloy-js/json": "^0.23.0",
293
293
  "@alloy-js/markdown": "^0.23.0",
294
294
  "@alloy-js/typescript": "^0.23.0",
295
- "@powerlines/deepkit": "0.9.38",
296
- "@powerlines/plugin-babel": "0.13.58",
295
+ "@powerlines/deepkit": "0.9.39",
296
+ "@powerlines/plugin-babel": "0.13.59",
297
297
  "@storm-software/config-tools": "^1.190.29",
298
298
  "@stryke/capnp": "^0.12.102",
299
299
  "@stryke/convert": "^0.7.7",
@@ -306,13 +306,13 @@
306
306
  "@stryke/types": "^0.12.4",
307
307
  "@stryke/unique-id": "^0.3.87",
308
308
  "defu": "^6.1.7",
309
- "powerlines": "0.47.62",
309
+ "powerlines": "0.47.63",
310
310
  "prettier": "^3.8.3",
311
311
  "unctx": "^2.5.0"
312
312
  },
313
313
  "devDependencies": {
314
314
  "@babel/preset-typescript": "8.0.0-rc.5",
315
- "@powerlines/plugin-plugin": "0.12.474",
315
+ "@powerlines/plugin-plugin": "0.12.475",
316
316
  "@types/node": "^25.9.1"
317
317
  },
318
318
  "peerDependencies": {
@@ -324,5 +324,5 @@
324
324
  "@babel/preset-typescript": { "optional": false }
325
325
  },
326
326
  "publishConfig": { "access": "public" },
327
- "gitHead": "0daef1eefc1aaf0d184b1517aad107c5f3e491bc"
327
+ "gitHead": "985eea96e52a002cb91b70e755ce4e35c8075347"
328
328
  }