@powerlines/plugin-alloy 0.25.69 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/core/components/index.cjs +3 -1
- package/dist/core/components/index.d.cts +3 -2
- package/dist/core/components/index.d.mts +3 -2
- package/dist/core/components/index.mjs +3 -2
- package/dist/core/components/infrastructure-file.cjs +48 -0
- package/dist/core/components/infrastructure-file.d.cts +28 -0
- package/dist/core/components/infrastructure-file.d.cts.map +1 -0
- package/dist/core/components/infrastructure-file.d.mts +28 -0
- package/dist/core/components/infrastructure-file.d.mts.map +1 -0
- package/dist/core/components/infrastructure-file.mjs +46 -0
- package/dist/core/components/infrastructure-file.mjs.map +1 -0
- package/dist/core/components/output.d.cts +2 -2
- package/dist/core/components/output.d.cts.map +1 -1
- package/dist/core/components/output.d.mts +2 -2
- package/dist/core/components/output.d.mts.map +1 -1
- package/dist/core/components/single-line-comment.cjs +1 -1
- package/dist/core/components/single-line-comment.d.cts +3 -3
- package/dist/core/components/single-line-comment.d.cts.map +1 -1
- package/dist/core/components/single-line-comment.d.mts +3 -3
- package/dist/core/components/single-line-comment.d.mts.map +1 -1
- package/dist/core/components/single-line-comment.mjs +1 -1
- package/dist/core/components/single-line-comment.mjs.map +1 -1
- package/dist/core/components/source-file.d.cts +2 -2
- package/dist/core/components/source-file.d.cts.map +1 -1
- package/dist/core/components/source-file.d.mts +2 -2
- package/dist/core/components/source-file.d.mts.map +1 -1
- package/dist/core/components/spacing.d.cts +2 -2
- package/dist/core/components/spacing.d.cts.map +1 -1
- package/dist/core/components/spacing.d.mts +2 -2
- package/dist/core/components/spacing.d.mts.map +1 -1
- package/dist/core/contexts/index.cjs +2 -1
- package/dist/core/contexts/index.d.cts +2 -2
- package/dist/core/contexts/index.d.mts +2 -2
- package/dist/core/contexts/index.mjs +2 -2
- package/dist/core/contexts/reflection.cjs +13 -2
- package/dist/core/contexts/reflection.d.cts +14 -3
- package/dist/core/contexts/reflection.d.cts.map +1 -1
- package/dist/core/contexts/reflection.d.mts +14 -3
- package/dist/core/contexts/reflection.d.mts.map +1 -1
- package/dist/core/contexts/reflection.mjs +12 -2
- package/dist/core/contexts/reflection.mjs.map +1 -1
- package/dist/core/index.cjs +5 -2
- package/dist/core/index.d.cts +4 -3
- package/dist/core/index.d.mts +4 -3
- package/dist/core/index.mjs +4 -3
- package/dist/hcl/components/block-declaration.cjs +34 -0
- package/dist/hcl/components/block-declaration.d.cts +22 -0
- package/dist/hcl/components/block-declaration.d.cts.map +1 -0
- package/dist/hcl/components/block-declaration.d.mts +22 -0
- package/dist/hcl/components/block-declaration.d.mts.map +1 -0
- package/dist/hcl/components/block-declaration.mjs +33 -0
- package/dist/hcl/components/block-declaration.mjs.map +1 -0
- package/dist/hcl/components/hcl-file.cjs +83 -0
- package/dist/hcl/components/hcl-file.d.cts +27 -0
- package/dist/hcl/components/hcl-file.d.cts.map +1 -0
- package/dist/hcl/components/hcl-file.d.mts +27 -0
- package/dist/hcl/components/hcl-file.d.mts.map +1 -0
- package/dist/hcl/components/hcl-file.mjs +81 -0
- package/dist/hcl/components/hcl-file.mjs.map +1 -0
- package/dist/hcl/components/index.cjs +11 -0
- package/dist/hcl/components/index.d.cts +5 -0
- package/dist/hcl/components/index.d.mts +5 -0
- package/dist/hcl/components/index.mjs +6 -0
- package/dist/hcl/components/packer-file.cjs +29 -0
- package/dist/hcl/components/packer-file.d.cts +19 -0
- package/dist/hcl/components/packer-file.d.cts.map +1 -0
- package/dist/hcl/components/packer-file.d.mts +19 -0
- package/dist/hcl/components/packer-file.d.mts.map +1 -0
- package/dist/hcl/components/packer-file.mjs +28 -0
- package/dist/hcl/components/packer-file.mjs.map +1 -0
- package/dist/hcl/components/terraform-file.cjs +30 -0
- package/dist/hcl/components/terraform-file.d.cts +20 -0
- package/dist/hcl/components/terraform-file.d.cts.map +1 -0
- package/dist/hcl/components/terraform-file.d.mts +20 -0
- package/dist/hcl/components/terraform-file.d.mts.map +1 -0
- package/dist/hcl/components/terraform-file.mjs +29 -0
- package/dist/hcl/components/terraform-file.mjs.map +1 -0
- package/dist/hcl/index.cjs +12 -0
- package/dist/hcl/index.d.cts +5 -0
- package/dist/hcl/index.d.mts +5 -0
- package/dist/hcl/index.mjs +7 -0
- package/dist/helpers/capnp.cjs +2 -2
- package/dist/helpers/capnp.mjs +2 -2
- package/dist/helpers/typescript.cjs +1 -1
- package/dist/helpers/typescript.mjs +1 -1
- package/dist/markdown/components/front-matter.d.cts +2 -2
- package/dist/markdown/components/front-matter.d.cts.map +1 -1
- package/dist/markdown/components/front-matter.d.mts +2 -2
- package/dist/markdown/components/front-matter.d.mts.map +1 -1
- package/dist/markdown/components/markdown-file.cjs +1 -1
- package/dist/markdown/components/markdown-file.d.cts +3 -3
- package/dist/markdown/components/markdown-file.d.cts.map +1 -1
- package/dist/markdown/components/markdown-file.d.mts +3 -3
- package/dist/markdown/components/markdown-file.d.mts.map +1 -1
- package/dist/markdown/components/markdown-file.mjs +1 -1
- package/dist/markdown/components/markdown-table.d.cts +4 -4
- package/dist/markdown/components/markdown-table.d.cts.map +1 -1
- package/dist/markdown/components/markdown-table.d.mts +4 -4
- package/dist/markdown/components/markdown-table.d.mts.map +1 -1
- package/dist/typescript/components/builtin-file.d.cts +2 -2
- package/dist/typescript/components/builtin-file.d.cts.map +1 -1
- package/dist/typescript/components/builtin-file.d.mts +2 -2
- package/dist/typescript/components/builtin-file.d.mts.map +1 -1
- package/dist/typescript/components/dynamic-import-statement.d.cts +2 -2
- package/dist/typescript/components/dynamic-import-statement.d.cts.map +1 -1
- package/dist/typescript/components/dynamic-import-statement.d.mts +2 -2
- package/dist/typescript/components/dynamic-import-statement.d.mts.map +1 -1
- package/dist/typescript/components/entry-file.cjs +1 -1
- package/dist/typescript/components/entry-file.d.cts +2 -2
- package/dist/typescript/components/entry-file.d.cts.map +1 -1
- package/dist/typescript/components/entry-file.d.mts +2 -2
- package/dist/typescript/components/entry-file.d.mts.map +1 -1
- package/dist/typescript/components/entry-file.mjs +1 -1
- package/dist/typescript/components/index.cjs +0 -2
- package/dist/typescript/components/index.d.cts +1 -2
- package/dist/typescript/components/index.d.mts +1 -2
- package/dist/typescript/components/index.mjs +1 -2
- package/dist/typescript/components/interface-declaration.cjs +16 -6
- package/dist/typescript/components/interface-declaration.d.cts +6 -5
- package/dist/typescript/components/interface-declaration.d.cts.map +1 -1
- package/dist/typescript/components/interface-declaration.d.mts +5 -4
- package/dist/typescript/components/interface-declaration.d.mts.map +1 -1
- package/dist/typescript/components/interface-declaration.mjs +16 -6
- package/dist/typescript/components/interface-declaration.mjs.map +1 -1
- package/dist/typescript/components/object-declaration.cjs +8 -2
- package/dist/typescript/components/object-declaration.d.cts +7 -7
- package/dist/typescript/components/object-declaration.d.cts.map +1 -1
- package/dist/typescript/components/object-declaration.d.mts +6 -6
- package/dist/typescript/components/object-declaration.d.mts.map +1 -1
- package/dist/typescript/components/object-declaration.mjs +8 -2
- package/dist/typescript/components/object-declaration.mjs.map +1 -1
- package/dist/typescript/components/property-name.d.cts +2 -2
- package/dist/typescript/components/property-name.d.cts.map +1 -1
- package/dist/typescript/components/property-name.d.mts +2 -2
- package/dist/typescript/components/property-name.d.mts.map +1 -1
- package/dist/typescript/components/tsdoc-reflection.cjs +15 -4
- package/dist/typescript/components/tsdoc-reflection.d.cts +8 -7
- package/dist/typescript/components/tsdoc-reflection.d.cts.map +1 -1
- package/dist/typescript/components/tsdoc-reflection.d.mts +8 -7
- package/dist/typescript/components/tsdoc-reflection.d.mts.map +1 -1
- package/dist/typescript/components/tsdoc-reflection.mjs +16 -5
- package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
- package/dist/typescript/components/tsdoc.d.cts +1 -1
- package/dist/typescript/components/type-declaration.d.cts +2 -2
- package/dist/typescript/components/type-declaration.d.cts.map +1 -1
- package/dist/typescript/components/type-declaration.d.mts +2 -2
- package/dist/typescript/components/type-declaration.d.mts.map +1 -1
- package/dist/typescript/components/typescript-file.cjs +2 -2
- package/dist/typescript/components/typescript-file.mjs +2 -2
- package/dist/typescript/contexts/lexical-scope.d.cts +2 -2
- package/dist/typescript/contexts/lexical-scope.d.cts.map +1 -1
- package/dist/typescript/contexts/lexical-scope.d.mts +2 -2
- package/dist/typescript/contexts/lexical-scope.d.mts.map +1 -1
- package/dist/typescript/index.cjs +0 -2
- package/dist/typescript/index.d.cts +1 -2
- package/dist/typescript/index.d.mts +1 -2
- package/dist/typescript/index.mjs +1 -2
- package/dist/yaml/components/yaml-file.cjs +1 -1
- package/dist/yaml/components/yaml-file.mjs +1 -1
- package/package.json +104 -20
- package/dist/typescript/components/infrastructure-file.cjs +0 -40
- package/dist/typescript/components/infrastructure-file.d.cts +0 -21
- package/dist/typescript/components/infrastructure-file.d.cts.map +0 -1
- package/dist/typescript/components/infrastructure-file.d.mts +0 -21
- package/dist/typescript/components/infrastructure-file.d.mts.map +0 -1
- package/dist/typescript/components/infrastructure-file.mjs +0 -38
- package/dist/typescript/components/infrastructure-file.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TypescriptFileProps } from "./typescript-file.cjs";
|
|
2
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
3
3
|
import { ResolvedEntryTypeDefinition } from "powerlines";
|
|
4
4
|
|
|
5
5
|
//#region src/typescript/components/entry-file.d.ts
|
|
@@ -21,7 +21,7 @@ type EntryFileProps = TypescriptFileProps & {
|
|
|
21
21
|
* @param props - The properties for the source file.
|
|
22
22
|
* @returns The rendered source file component.
|
|
23
23
|
*/
|
|
24
|
-
declare function EntryFile(props: EntryFileProps): _alloy_js_core0.Children;
|
|
24
|
+
declare function EntryFile(props: EntryFileProps): _$_alloy_js_core0.Children;
|
|
25
25
|
declare type __ΩEntryFileProps = any[];
|
|
26
26
|
//#endregion
|
|
27
27
|
export { EntryFile, EntryFileProps, __ΩEntryFileProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-file.d.cts","names":[],"sources":["../../../src/typescript/components/entry-file.tsx"],"mappings":";;;;;KA4BY,cAAA,GAAiB,mBAAA;;;AAA7B;;;EAME,GAAA;EAN2B;;;EAW3B,cAAA,GAAiB,2BAAA;AAAA;;AASnB;;;;;iBAAgB,SAAA,CAAU,KAAA,EAAO,cAAA,GAAc,
|
|
1
|
+
{"version":3,"file":"entry-file.d.cts","names":[],"sources":["../../../src/typescript/components/entry-file.tsx"],"mappings":";;;;;KA4BY,cAAA,GAAiB,mBAAA;;;AAA7B;;;EAME,GAAA;EAN2B;;;EAW3B,cAAA,GAAiB,2BAAA;AAAA;;AASnB;;;;;iBAAgB,SAAA,CAAU,KAAA,EAAO,cAAA,GAAc,iBAAA,CAAA,QAAA;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TypescriptFileProps } from "./typescript-file.mjs";
|
|
2
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
3
3
|
import { ResolvedEntryTypeDefinition } from "powerlines";
|
|
4
4
|
|
|
5
5
|
//#region src/typescript/components/entry-file.d.ts
|
|
@@ -21,7 +21,7 @@ type EntryFileProps = TypescriptFileProps & {
|
|
|
21
21
|
* @param props - The properties for the source file.
|
|
22
22
|
* @returns The rendered source file component.
|
|
23
23
|
*/
|
|
24
|
-
declare function EntryFile(props: EntryFileProps): _alloy_js_core0.Children;
|
|
24
|
+
declare function EntryFile(props: EntryFileProps): _$_alloy_js_core0.Children;
|
|
25
25
|
declare type __ΩEntryFileProps = any[];
|
|
26
26
|
//#endregion
|
|
27
27
|
export { EntryFile, EntryFileProps, __ΩEntryFileProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-file.d.mts","names":[],"sources":["../../../src/typescript/components/entry-file.tsx"],"mappings":";;;;;KA4BY,cAAA,GAAiB,mBAAA;;;AAA7B;;;EAME,GAAA;EAN2B;;;EAW3B,cAAA,GAAiB,2BAAA;AAAA;;AASnB;;;;;iBAAgB,SAAA,CAAU,KAAA,EAAO,cAAA,GAAc,
|
|
1
|
+
{"version":3,"file":"entry-file.d.mts","names":[],"sources":["../../../src/typescript/components/entry-file.tsx"],"mappings":";;;;;KA4BY,cAAA,GAAiB,mBAAA;;;AAA7B;;;EAME,GAAA;EAN2B;;;EAW3B,cAAA,GAAiB,2BAAA;AAAA;;AASnB;;;;;iBAAgB,SAAA,CAAU,KAAA,EAAO,cAAA,GAAc,iBAAA,CAAA,QAAA;AAAA"}
|
|
@@ -4,8 +4,8 @@ import { hasFileExtension } from "@stryke/path/file-path-fns";
|
|
|
4
4
|
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
5
5
|
import { computed, splitProps } from "@alloy-js/core";
|
|
6
6
|
import { appendPath } from "@stryke/path/append";
|
|
7
|
-
import defu from "defu";
|
|
8
7
|
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
8
|
+
import defu from "defu";
|
|
9
9
|
import { isSet } from "@stryke/type-checks/is-set";
|
|
10
10
|
|
|
11
11
|
//#region src/typescript/components/entry-file.tsx
|
|
@@ -7,7 +7,6 @@ const require_typescript_components_type_parameters = require('./type-parameters
|
|
|
7
7
|
const require_typescript_components_class_declaration = require('./class-declaration.cjs');
|
|
8
8
|
const require_typescript_components_dynamic_import_statement = require('./dynamic-import-statement.cjs');
|
|
9
9
|
const require_typescript_components_entry_file = require('./entry-file.cjs');
|
|
10
|
-
const require_typescript_components_infrastructure_file = require('./infrastructure-file.cjs');
|
|
11
10
|
const require_typescript_components_tsdoc_reflection = require('./tsdoc-reflection.cjs');
|
|
12
11
|
const require_typescript_components_interface_declaration = require('./interface-declaration.cjs');
|
|
13
12
|
const require_typescript_components_object_declaration = require('./object-declaration.cjs');
|
|
@@ -23,7 +22,6 @@ exports.ClassPropertyGet = require_typescript_components_class_declaration.Class
|
|
|
23
22
|
exports.ClassPropertySet = require_typescript_components_class_declaration.ClassPropertySet;
|
|
24
23
|
exports.DynamicImportStatement = require_typescript_components_dynamic_import_statement.DynamicImportStatement;
|
|
25
24
|
exports.EntryFile = require_typescript_components_entry_file.EntryFile;
|
|
26
|
-
exports.InfrastructureFile = require_typescript_components_infrastructure_file.InfrastructureFile;
|
|
27
25
|
exports.InterfaceDeclaration = require_typescript_components_interface_declaration.InterfaceDeclaration;
|
|
28
26
|
exports.InterfaceDeclarationProperty = require_typescript_components_interface_declaration.InterfaceDeclarationProperty;
|
|
29
27
|
exports.InterfaceExpression = require_typescript_components_interface_declaration.InterfaceExpression;
|
|
@@ -5,11 +5,10 @@ import { TypeParameters, TypeParametersProps, __ΩTypeParametersProps } from "./
|
|
|
5
5
|
import { ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, __ΩClassDeclarationProps, __ΩClassFieldProps, __ΩClassMemberProps, __ΩClassMethodProps, __ΩClassPropertyProps } from "./class-declaration.cjs";
|
|
6
6
|
import { DynamicImportStatement, DynamicImportStatementProps, __ΩDynamicImportStatementProps } from "./dynamic-import-statement.cjs";
|
|
7
7
|
import { EntryFile, EntryFileProps, __ΩEntryFileProps } from "./entry-file.cjs";
|
|
8
|
-
import { InfrastructureFile, InfrastructureFileProps, __ΩInfrastructureFileProps } from "./infrastructure-file.cjs";
|
|
9
8
|
import { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, __ΩInterfaceDeclarationPropertyProps, __ΩInterfaceDeclarationProps, __ΩInterfaceExpressionProps, __ΩInterfaceIndexerMemberProps, __ΩInterfaceMemberProps, __ΩInterfaceMemberPropsBase, __ΩInterfacePropertyMemberProps } from "./interface-declaration.cjs";
|
|
10
9
|
import { ComputedRef, ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps, __ΩComputedRef, __ΩObjectDeclarationPropertyProps, __ΩObjectDeclarationProps } from "./object-declaration.cjs";
|
|
11
10
|
import { PropertyName, PropertyNameProps, __ΩPropertyNameProps } from "./property-name.cjs";
|
|
12
11
|
import { RecordExpression, RecordExpressionProps, __ΩRecordExpressionProps } from "./record-expression.cjs";
|
|
13
12
|
import { TSDocContextClass, TSDocContextMethod, TSDocContextProperty, TSDocReflectionClass, TSDocReflectionClassProps, TSDocReflectionMethod, TSDocReflectionMethodProps, TSDocReflectionProperty, TSDocReflectionPropertyProps, __ΩTSDocReflectionClassProps, __ΩTSDocReflectionMethodProps, __ΩTSDocReflectionPropertyProps } from "./tsdoc-reflection.cjs";
|
|
14
13
|
import { TypeDeclaration, TypeDeclarationProps, __ΩTypeDeclarationProps } from "./type-declaration.cjs";
|
|
15
|
-
export { BuiltinFile, BuiltinFileProps, ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, ComputedRef, DynamicImportStatement, DynamicImportStatementProps, EntryFile, EntryFileProps,
|
|
14
|
+
export { BuiltinFile, BuiltinFileProps, ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, ComputedRef, DynamicImportStatement, DynamicImportStatementProps, EntryFile, EntryFileProps, InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps, PropertyName, PropertyNameProps, RecordExpression, RecordExpressionProps, TSDoc, TSDocAlias, TSDocAttributesTags, TSDocAttributesTagsProps, TSDocContextClass, TSDocContextMethod, TSDocContextProperty, TSDocDefaultValue, TSDocDefaultValueProps, TSDocDomain, TSDocExample, TSDocExampleProps, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocModuleProps, TSDocParam, TSDocParamProps, TSDocParams, TSDocParamsProps, TSDocPermission, TSDocProps, TSDocReadonly, TSDocReflectionClass, TSDocReflectionClassProps, TSDocReflectionMethod, TSDocReflectionMethodProps, TSDocReflectionProperty, TSDocReflectionPropertyProps, TSDocRemarks, TSDocReturns, TSDocTag, TSDocTagProps, TSDocThrows, TSDocTitle, TypeDeclaration, TypeDeclarationProps, TypeParameters, TypeParametersProps, TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports, TypescriptFileHeaderImportsProps, TypescriptFileHeaderProps, TypescriptFileProps, __ΩBuiltinFileProps, __ΩClassDeclarationProps, __ΩClassFieldProps, __ΩClassMemberProps, __ΩClassMethodProps, __ΩClassPropertyProps, __ΩComputedRef, __ΩDynamicImportStatementProps, __ΩEntryFileProps, __ΩInterfaceDeclarationPropertyProps, __ΩInterfaceDeclarationProps, __ΩInterfaceExpressionProps, __ΩInterfaceIndexerMemberProps, __ΩInterfaceMemberProps, __ΩInterfaceMemberPropsBase, __ΩInterfacePropertyMemberProps, __ΩObjectDeclarationPropertyProps, __ΩObjectDeclarationProps, __ΩPropertyNameProps, __ΩRecordExpressionProps, __ΩTSDocAttributesTagsProps, __ΩTSDocDefaultValueProps, __ΩTSDocExampleProps, __ΩTSDocModuleProps, __ΩTSDocParamProps, __ΩTSDocParamsProps, __ΩTSDocProps, __ΩTSDocReflectionClassProps, __ΩTSDocReflectionMethodProps, __ΩTSDocReflectionPropertyProps, __ΩTSDocTagProps, __ΩTypeDeclarationProps, __ΩTypeParametersProps, __ΩTypescriptFileHeaderImportsProps, __ΩTypescriptFileHeaderProps, __ΩTypescriptFileProps };
|
|
@@ -5,11 +5,10 @@ import { TypeParameters, TypeParametersProps, __ΩTypeParametersProps } from "./
|
|
|
5
5
|
import { ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, __ΩClassDeclarationProps, __ΩClassFieldProps, __ΩClassMemberProps, __ΩClassMethodProps, __ΩClassPropertyProps } from "./class-declaration.mjs";
|
|
6
6
|
import { DynamicImportStatement, DynamicImportStatementProps, __ΩDynamicImportStatementProps } from "./dynamic-import-statement.mjs";
|
|
7
7
|
import { EntryFile, EntryFileProps, __ΩEntryFileProps } from "./entry-file.mjs";
|
|
8
|
-
import { InfrastructureFile, InfrastructureFileProps, __ΩInfrastructureFileProps } from "./infrastructure-file.mjs";
|
|
9
8
|
import { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, __ΩInterfaceDeclarationPropertyProps, __ΩInterfaceDeclarationProps, __ΩInterfaceExpressionProps, __ΩInterfaceIndexerMemberProps, __ΩInterfaceMemberProps, __ΩInterfaceMemberPropsBase, __ΩInterfacePropertyMemberProps } from "./interface-declaration.mjs";
|
|
10
9
|
import { ComputedRef, ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps, __ΩComputedRef, __ΩObjectDeclarationPropertyProps, __ΩObjectDeclarationProps } from "./object-declaration.mjs";
|
|
11
10
|
import { PropertyName, PropertyNameProps, __ΩPropertyNameProps } from "./property-name.mjs";
|
|
12
11
|
import { RecordExpression, RecordExpressionProps, __ΩRecordExpressionProps } from "./record-expression.mjs";
|
|
13
12
|
import { TSDocContextClass, TSDocContextMethod, TSDocContextProperty, TSDocReflectionClass, TSDocReflectionClassProps, TSDocReflectionMethod, TSDocReflectionMethodProps, TSDocReflectionProperty, TSDocReflectionPropertyProps, __ΩTSDocReflectionClassProps, __ΩTSDocReflectionMethodProps, __ΩTSDocReflectionPropertyProps } from "./tsdoc-reflection.mjs";
|
|
14
13
|
import { TypeDeclaration, TypeDeclarationProps, __ΩTypeDeclarationProps } from "./type-declaration.mjs";
|
|
15
|
-
export { BuiltinFile, BuiltinFileProps, ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, ComputedRef, DynamicImportStatement, DynamicImportStatementProps, EntryFile, EntryFileProps,
|
|
14
|
+
export { BuiltinFile, BuiltinFileProps, ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, ComputedRef, DynamicImportStatement, DynamicImportStatementProps, EntryFile, EntryFileProps, InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps, PropertyName, PropertyNameProps, RecordExpression, RecordExpressionProps, TSDoc, TSDocAlias, TSDocAttributesTags, TSDocAttributesTagsProps, TSDocContextClass, TSDocContextMethod, TSDocContextProperty, TSDocDefaultValue, TSDocDefaultValueProps, TSDocDomain, TSDocExample, TSDocExampleProps, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocModuleProps, TSDocParam, TSDocParamProps, TSDocParams, TSDocParamsProps, TSDocPermission, TSDocProps, TSDocReadonly, TSDocReflectionClass, TSDocReflectionClassProps, TSDocReflectionMethod, TSDocReflectionMethodProps, TSDocReflectionProperty, TSDocReflectionPropertyProps, TSDocRemarks, TSDocReturns, TSDocTag, TSDocTagProps, TSDocThrows, TSDocTitle, TypeDeclaration, TypeDeclarationProps, TypeParameters, TypeParametersProps, TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports, TypescriptFileHeaderImportsProps, TypescriptFileHeaderProps, TypescriptFileProps, __ΩBuiltinFileProps, __ΩClassDeclarationProps, __ΩClassFieldProps, __ΩClassMemberProps, __ΩClassMethodProps, __ΩClassPropertyProps, __ΩComputedRef, __ΩDynamicImportStatementProps, __ΩEntryFileProps, __ΩInterfaceDeclarationPropertyProps, __ΩInterfaceDeclarationProps, __ΩInterfaceExpressionProps, __ΩInterfaceIndexerMemberProps, __ΩInterfaceMemberProps, __ΩInterfaceMemberPropsBase, __ΩInterfacePropertyMemberProps, __ΩObjectDeclarationPropertyProps, __ΩObjectDeclarationProps, __ΩPropertyNameProps, __ΩRecordExpressionProps, __ΩTSDocAttributesTagsProps, __ΩTSDocDefaultValueProps, __ΩTSDocExampleProps, __ΩTSDocModuleProps, __ΩTSDocParamProps, __ΩTSDocParamsProps, __ΩTSDocProps, __ΩTSDocReflectionClassProps, __ΩTSDocReflectionMethodProps, __ΩTSDocReflectionPropertyProps, __ΩTSDocTagProps, __ΩTypeDeclarationProps, __ΩTypeParametersProps, __ΩTypescriptFileHeaderImportsProps, __ΩTypescriptFileHeaderProps, __ΩTypescriptFileProps };
|
|
@@ -6,11 +6,10 @@ import { TypeParameters } from "./type-parameters.mjs";
|
|
|
6
6
|
import { ClassDeclaration, ClassField, ClassMember, ClassMethod, ClassPropertyGet, ClassPropertySet } from "./class-declaration.mjs";
|
|
7
7
|
import { DynamicImportStatement } from "./dynamic-import-statement.mjs";
|
|
8
8
|
import { EntryFile } from "./entry-file.mjs";
|
|
9
|
-
import { InfrastructureFile } from "./infrastructure-file.mjs";
|
|
10
9
|
import { TSDocContextClass, TSDocContextMethod, TSDocContextProperty, TSDocReflectionClass, TSDocReflectionMethod, TSDocReflectionProperty } from "./tsdoc-reflection.mjs";
|
|
11
10
|
import { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceExpression, InterfaceMember } from "./interface-declaration.mjs";
|
|
12
11
|
import { ObjectDeclaration, ObjectDeclarationProperty } from "./object-declaration.mjs";
|
|
13
12
|
import { RecordExpression } from "./record-expression.mjs";
|
|
14
13
|
import { TypeDeclaration } from "./type-declaration.mjs";
|
|
15
14
|
|
|
16
|
-
export { BuiltinFile, ClassDeclaration, ClassField, ClassMember, ClassMethod, ClassPropertyGet, ClassPropertySet, DynamicImportStatement, EntryFile,
|
|
15
|
+
export { BuiltinFile, ClassDeclaration, ClassField, ClassMember, ClassMethod, ClassPropertyGet, ClassPropertySet, DynamicImportStatement, EntryFile, InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceExpression, InterfaceMember, ObjectDeclaration, ObjectDeclarationProperty, PropertyName, RecordExpression, TSDoc, TSDocAlias, TSDocAttributesTags, TSDocContextClass, TSDocContextMethod, TSDocContextProperty, TSDocDefaultValue, TSDocDomain, TSDocExample, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocParam, TSDocParams, TSDocPermission, TSDocReadonly, TSDocReflectionClass, TSDocReflectionMethod, TSDocReflectionProperty, TSDocRemarks, TSDocReturns, TSDocTag, TSDocThrows, TSDocTitle, TypeDeclaration, TypeParameters, TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports };
|
|
@@ -152,10 +152,11 @@ const BaseInterfaceDeclaration = (0, _alloy_js_typescript.ensureTypeRefContext)(
|
|
|
152
152
|
* Generates a TypeScript interface for the given reflection class.
|
|
153
153
|
*/
|
|
154
154
|
function InterfaceDeclaration(props) {
|
|
155
|
-
const [{ name, reflection, doc }, rest] = (0, _alloy_js_core.splitProps)(props, [
|
|
155
|
+
const [{ name, reflection, doc, defaultValue }, rest] = (0, _alloy_js_core.splitProps)(props, [
|
|
156
156
|
"name",
|
|
157
157
|
"reflection",
|
|
158
|
-
"doc"
|
|
158
|
+
"doc",
|
|
159
|
+
"defaultValue"
|
|
159
160
|
]);
|
|
160
161
|
const interfaceName = (0, _alloy_js_core.computed)(() => (0, _stryke_string_format_pascal_case.pascalCase)(((0, _stryke_type_checks_is_string.isString)(name) ? name : name.toString()) || reflection?.getName()));
|
|
161
162
|
const properties = (0, _alloy_js_core.computed)(() => reflection ? reflection.getProperties().filter((item) => !item.isIgnored()).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1) : []);
|
|
@@ -179,13 +180,19 @@ function InterfaceDeclaration(props) {
|
|
|
179
180
|
"export": true,
|
|
180
181
|
get name() {
|
|
181
182
|
return interfaceName.value;
|
|
182
|
-
}
|
|
183
|
+
},
|
|
184
|
+
defaultValue
|
|
183
185
|
}, rest, { get children() {
|
|
184
186
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
185
187
|
each: properties,
|
|
186
188
|
doubleHardline: true,
|
|
187
189
|
semicolon: true,
|
|
188
|
-
children: (prop) => (0, _alloy_js_core_jsx_runtime.createComponent)(InterfaceDeclarationProperty, {
|
|
190
|
+
children: (prop) => (0, _alloy_js_core_jsx_runtime.createComponent)(InterfaceDeclarationProperty, {
|
|
191
|
+
property: prop,
|
|
192
|
+
get defaultValue() {
|
|
193
|
+
return defaultValue?.value?.[prop.getNameAsString()];
|
|
194
|
+
}
|
|
195
|
+
})
|
|
189
196
|
});
|
|
190
197
|
} }))];
|
|
191
198
|
}
|
|
@@ -197,9 +204,12 @@ function InterfaceDeclaration(props) {
|
|
|
197
204
|
* Generates a TypeScript interface property for the given reflection class.
|
|
198
205
|
*/
|
|
199
206
|
function InterfaceDeclarationProperty(props) {
|
|
200
|
-
const [{ property }, rest] = (0, _alloy_js_core.splitProps)(props, ["property"]);
|
|
207
|
+
const [{ property, defaultValue }, rest] = (0, _alloy_js_core.splitProps)(props, ["property", "defaultValue"]);
|
|
201
208
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_core_contexts_reflection.ReflectionPropertyContext.Provider, {
|
|
202
|
-
value:
|
|
209
|
+
value: {
|
|
210
|
+
property,
|
|
211
|
+
defaultValue
|
|
212
|
+
},
|
|
203
213
|
get children() {
|
|
204
214
|
return [(0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc_reflection.TSDocContextProperty, {}), (0, _alloy_js_core_jsx_runtime.createComponent)(InterfaceMember, (0, _alloy_js_core_jsx_runtime.mergeProps)({
|
|
205
215
|
get name() {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ComponentProps } from "../../types/components.cjs";
|
|
2
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
3
|
-
import { Children, Namekey, Refkey } from "@alloy-js/core";
|
|
4
|
-
import { ReflectionClass, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
|
|
2
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
3
|
+
import { Children, Namekey, Ref, Refkey } from "@alloy-js/core";
|
|
5
4
|
import { CommonDeclarationProps, TypeParameterDescriptor } from "@alloy-js/typescript";
|
|
5
|
+
import { ReflectionClass, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
|
|
6
6
|
|
|
7
7
|
//#region src/typescript/components/interface-declaration.d.ts
|
|
8
8
|
interface InterfaceDeclarationProps<T extends Record<string, any> = Record<string, any>> extends CommonDeclarationProps, ComponentProps {
|
|
@@ -27,7 +27,7 @@ interface InterfaceDeclarationProps<T extends Record<string, any> = Record<strin
|
|
|
27
27
|
* @remarks
|
|
28
28
|
* This is used when the interface is used as a type for a variable declaration, to provide an initial value for the variable.
|
|
29
29
|
*/
|
|
30
|
-
defaultValue?: Partial<T
|
|
30
|
+
defaultValue?: Ref<Partial<T>>;
|
|
31
31
|
/**
|
|
32
32
|
* Documentation for the interface. This can be a string or any Alloy component that renders documentation content (such as `TSDoc`).
|
|
33
33
|
*/
|
|
@@ -35,11 +35,12 @@ interface InterfaceDeclarationProps<T extends Record<string, any> = Record<strin
|
|
|
35
35
|
}
|
|
36
36
|
interface InterfaceDeclarationPropertyProps extends Omit<InterfaceMemberProps, "name">, ComponentProps {
|
|
37
37
|
property: ReflectionProperty;
|
|
38
|
+
defaultValue?: any;
|
|
38
39
|
}
|
|
39
40
|
interface InterfaceExpressionProps {
|
|
40
41
|
children?: Children;
|
|
41
42
|
}
|
|
42
|
-
declare const InterfaceExpression: _alloy_js_core0.Component<InterfaceExpressionProps>;
|
|
43
|
+
declare const InterfaceExpression: _$_alloy_js_core0.Component<InterfaceExpressionProps>;
|
|
43
44
|
interface InterfaceMemberPropsBase {
|
|
44
45
|
type?: Children;
|
|
45
46
|
children?: Children;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface-declaration.d.cts","names":[],"sources":["../../../src/typescript/components/interface-declaration.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"interface-declaration.d.cts","names":[],"sources":["../../../src/typescript/components/interface-declaration.tsx"],"mappings":";;;;;;;UAmEiB,yBAAA,WACL,MAAA,gBAAsB,MAAA,uBAExB,sBAAA,EAAwB,cAAA;;;AAHlC;EAOE,OAAA,GAAU,QAAA;EAP8B;;;EAYxC,cAAA,GAAiB,uBAAA;EAAA;;;;;;EAQjB,UAAA,GAAa,eAAA,CAAgB,CAAA;EAjBrB;;;;;;EAyBR,YAAA,GAAe,GAAA,CAAI,OAAA,CAAQ,CAAA;EAzBnB;;;EA8BR,GAAA,GAAM,QAAA;AAAA;AAAA,UAGS,iCAAA,SACP,IAAA,CAAK,oBAAA,WAA+B,cAAA;EAC5C,QAAA,EAAU,kBAAA;EACV,YAAA;AAAA;AAAA,UAGe,wBAAA;EACf,QAAA,GAAW,QAAA;AAAA;AAAA,cAGA,mBAAA,EAAmB,iBAAA,CAAA,SAAA,CAAA,wBAAA;AAAA,UAoBf,wBAAA;EACf,IAAA,GAAO,QAAA;EACP,QAAA,GAAW,QAAA;EACX,QAAA;EACA,GAAA,GAAM,QAAA;EACN,MAAA,GAAS,MAAA,GAAS,MAAA;AAAA;AAAA,UAEH,4BAAA,SAAqC,wBAAA;EACpD,IAAA,WAAe,OAAA;EACf,QAAA;EACA,OAAA;AAAA;AAAA,UAGe,2BAAA,SAAoC,wBAAA;EACnD,OAAA,EAAS,QAAA;AAAA;AAAA,KAGC,oBAAA,GACR,4BAAA,GACA,2BAAA;;;;;;AA3CJ;;;;iBAsDgB,eAAA,CAAgB,KAAA,EAAO,oBAAA,GAAoB,QAAA;AAlD3D;;;AAAA,iBAiKgB,oBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,yBAAA,CAA0B,CAAA,IAAE,QAAA;;AA/IrC;;iBA8MgB,4BAAA,CACd,KAAA,EAAO,iCAAA,GAAiC,QAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentProps } from "../../types/components.mjs";
|
|
2
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
3
|
-
import { Children, Namekey, Refkey } from "@alloy-js/core";
|
|
2
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
3
|
+
import { Children, Namekey, Ref, Refkey } from "@alloy-js/core";
|
|
4
4
|
import { ReflectionClass, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
|
|
5
5
|
import { CommonDeclarationProps, TypeParameterDescriptor } from "@alloy-js/typescript";
|
|
6
6
|
|
|
@@ -27,7 +27,7 @@ interface InterfaceDeclarationProps<T extends Record<string, any> = Record<strin
|
|
|
27
27
|
* @remarks
|
|
28
28
|
* This is used when the interface is used as a type for a variable declaration, to provide an initial value for the variable.
|
|
29
29
|
*/
|
|
30
|
-
defaultValue?: Partial<T
|
|
30
|
+
defaultValue?: Ref<Partial<T>>;
|
|
31
31
|
/**
|
|
32
32
|
* Documentation for the interface. This can be a string or any Alloy component that renders documentation content (such as `TSDoc`).
|
|
33
33
|
*/
|
|
@@ -35,11 +35,12 @@ interface InterfaceDeclarationProps<T extends Record<string, any> = Record<strin
|
|
|
35
35
|
}
|
|
36
36
|
interface InterfaceDeclarationPropertyProps extends Omit<InterfaceMemberProps, "name">, ComponentProps {
|
|
37
37
|
property: ReflectionProperty;
|
|
38
|
+
defaultValue?: any;
|
|
38
39
|
}
|
|
39
40
|
interface InterfaceExpressionProps {
|
|
40
41
|
children?: Children;
|
|
41
42
|
}
|
|
42
|
-
declare const InterfaceExpression: _alloy_js_core0.Component<InterfaceExpressionProps>;
|
|
43
|
+
declare const InterfaceExpression: _$_alloy_js_core0.Component<InterfaceExpressionProps>;
|
|
43
44
|
interface InterfaceMemberPropsBase {
|
|
44
45
|
type?: Children;
|
|
45
46
|
children?: Children;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface-declaration.d.mts","names":[],"sources":["../../../src/typescript/components/interface-declaration.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"interface-declaration.d.mts","names":[],"sources":["../../../src/typescript/components/interface-declaration.tsx"],"mappings":";;;;;;;UAmEiB,yBAAA,WACL,MAAA,gBAAsB,MAAA,uBAExB,sBAAA,EAAwB,cAAA;;;AAHlC;EAOE,OAAA,GAAU,QAAA;EAP8B;;;EAYxC,cAAA,GAAiB,uBAAA;EAAA;;;;;;EAQjB,UAAA,GAAa,eAAA,CAAgB,CAAA;EAjBrB;;;;;;EAyBR,YAAA,GAAe,GAAA,CAAI,OAAA,CAAQ,CAAA;EAzBnB;;;EA8BR,GAAA,GAAM,QAAA;AAAA;AAAA,UAGS,iCAAA,SACP,IAAA,CAAK,oBAAA,WAA+B,cAAA;EAC5C,QAAA,EAAU,kBAAA;EACV,YAAA;AAAA;AAAA,UAGe,wBAAA;EACf,QAAA,GAAW,QAAA;AAAA;AAAA,cAGA,mBAAA,EAAmB,iBAAA,CAAA,SAAA,CAAA,wBAAA;AAAA,UAoBf,wBAAA;EACf,IAAA,GAAO,QAAA;EACP,QAAA,GAAW,QAAA;EACX,QAAA;EACA,GAAA,GAAM,QAAA;EACN,MAAA,GAAS,MAAA,GAAS,MAAA;AAAA;AAAA,UAEH,4BAAA,SAAqC,wBAAA;EACpD,IAAA,WAAe,OAAA;EACf,QAAA;EACA,OAAA;AAAA;AAAA,UAGe,2BAAA,SAAoC,wBAAA;EACnD,OAAA,EAAS,QAAA;AAAA;AAAA,KAGC,oBAAA,GACR,4BAAA,GACA,2BAAA;;;;;;AA3CJ;;;;iBAsDgB,eAAA,CAAgB,KAAA,EAAO,oBAAA,GAAoB,QAAA;AAlD3D;;;AAAA,iBAiKgB,oBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,yBAAA,CAA0B,CAAA,IAAE,QAAA;;AA/IrC;;iBA8MgB,4BAAA,CACd,KAAA,EAAO,iCAAA,GAAiC,QAAA;AAAA"}
|
|
@@ -150,10 +150,11 @@ const BaseInterfaceDeclaration = ensureTypeRefContext(function InterfaceDeclarat
|
|
|
150
150
|
* Generates a TypeScript interface for the given reflection class.
|
|
151
151
|
*/
|
|
152
152
|
function InterfaceDeclaration(props) {
|
|
153
|
-
const [{ name, reflection, doc }, rest] = splitProps(props, [
|
|
153
|
+
const [{ name, reflection, doc, defaultValue }, rest] = splitProps(props, [
|
|
154
154
|
"name",
|
|
155
155
|
"reflection",
|
|
156
|
-
"doc"
|
|
156
|
+
"doc",
|
|
157
|
+
"defaultValue"
|
|
157
158
|
]);
|
|
158
159
|
const interfaceName = computed(() => pascalCase((isString(name) ? name : name.toString()) || reflection?.getName()));
|
|
159
160
|
const properties = computed(() => reflection ? reflection.getProperties().filter((item) => !item.isIgnored()).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1) : []);
|
|
@@ -177,13 +178,19 @@ function InterfaceDeclaration(props) {
|
|
|
177
178
|
"export": true,
|
|
178
179
|
get name() {
|
|
179
180
|
return interfaceName.value;
|
|
180
|
-
}
|
|
181
|
+
},
|
|
182
|
+
defaultValue
|
|
181
183
|
}, rest, { get children() {
|
|
182
184
|
return createComponent(For, {
|
|
183
185
|
each: properties,
|
|
184
186
|
doubleHardline: true,
|
|
185
187
|
semicolon: true,
|
|
186
|
-
children: (prop) => createComponent(InterfaceDeclarationProperty, {
|
|
188
|
+
children: (prop) => createComponent(InterfaceDeclarationProperty, {
|
|
189
|
+
property: prop,
|
|
190
|
+
get defaultValue() {
|
|
191
|
+
return defaultValue?.value?.[prop.getNameAsString()];
|
|
192
|
+
}
|
|
193
|
+
})
|
|
187
194
|
});
|
|
188
195
|
} }))];
|
|
189
196
|
}
|
|
@@ -195,9 +202,12 @@ function InterfaceDeclaration(props) {
|
|
|
195
202
|
* Generates a TypeScript interface property for the given reflection class.
|
|
196
203
|
*/
|
|
197
204
|
function InterfaceDeclarationProperty(props) {
|
|
198
|
-
const [{ property }, rest] = splitProps(props, ["property"]);
|
|
205
|
+
const [{ property, defaultValue }, rest] = splitProps(props, ["property", "defaultValue"]);
|
|
199
206
|
return createComponent(ReflectionPropertyContext.Provider, {
|
|
200
|
-
value:
|
|
207
|
+
value: {
|
|
208
|
+
property,
|
|
209
|
+
defaultValue
|
|
210
|
+
},
|
|
201
211
|
get children() {
|
|
202
212
|
return [createComponent(TSDocContextProperty, {}), createComponent(InterfaceMember, mergeProps({
|
|
203
213
|
get name() {
|
|
@@ -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 ReflectionClass,\n ReflectionProperty,\n stringifyType\n} from \"@powerlines/deepkit/vendor/type\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport {\n ReflectionClassContext,\n ReflectionPropertyContext\n} from \"../../core/contexts/reflection\";\nimport { ComponentProps } from \"../../types/components\";\nimport { MemberScope } from \"../contexts/member-scope\";\nimport { PropertyName } from \"./property-name\";\nimport { TSDoc } from \"./tsdoc\";\nimport { TSDocContextProperty, TSDocReflectionClass } from \"./tsdoc-reflection\";\nimport { TypeParameters } from \"./type-parameters\";\n\nexport interface InterfaceDeclarationProps<\n T extends Record<string, any> = Record<string, any>\n>\n extends CommonDeclarationProps, 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 reflection class 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 reflection class.\n */\n reflection?: ReflectionClass<T>;\n\n /**\n * A default value for this interface.\n *\n * @remarks\n * This is used when the interface is used as a type for a variable declaration, to provide an initial value for the variable.\n */\n defaultValue?: Partial<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 extends Omit<InterfaceMemberProps, \"name\">, ComponentProps {\n property: ReflectionProperty;\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 type?: Children;\n children?: Children;\n readonly?: boolean;\n doc?: Children;\n refkey?: Refkey | Refkey[];\n}\nexport interface InterfacePropertyMemberProps extends InterfaceMemberPropsBase {\n name: string | Namekey;\n optional?: boolean;\n nullish?: boolean;\n}\n\nexport interface InterfaceIndexerMemberProps extends InterfaceMemberPropsBase {\n indexer: Children;\n}\n\nexport type InterfaceMemberProps =\n | InterfacePropertyMemberProps\n | InterfaceIndexerMemberProps;\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.type ?? props.children;\n const readonly = props.readonly ? \"readonly \" : \"\";\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 optionality = props.optional ? \"?\" : \"\";\n const scope = useTSMemberScope();\n const sym = createSymbol(\n TSOutputSymbol,\n props.name,\n scope.ownerSymbol.staticMembers,\n {\n refkeys: props.refkey,\n tsFlags:\n TSSymbolFlags.TypeSymbol |\n ((props.nullish ?? props.optional)\n ? TSSymbolFlags.Nullish\n : TSSymbolFlags.None),\n namePolicy: useTSNamePolicy().for(\"interface-member\"),\n binder: scope.binder\n }\n );\n\n const taken = takeSymbols();\n\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 {optionality}: {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(TSOutputSymbol, props.name, currentScope.types, {\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 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 reflection class.\n */\nexport function InterfaceDeclaration<\n T extends Record<string, any> = Record<string, any>\n>(props: InterfaceDeclarationProps<T>) {\n const [{ name, reflection, doc }, rest] = splitProps(props, [\n \"name\",\n \"reflection\",\n \"doc\"\n ]);\n\n const interfaceName = computed(() =>\n pascalCase(\n (isString(name) ? name : name.toString()) || reflection?.getName()\n )\n );\n\n const properties = computed(() =>\n reflection\n ? reflection\n .getProperties()\n .filter(item => !item.isIgnored())\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) ||\n (!a.isReadonly() && !b.isReadonly())\n ? a.getNameAsString().localeCompare(b.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n )\n : []\n );\n\n return (\n <Show\n when={reflection && properties.value.length > 0}\n fallback={\n <BaseInterfaceDeclaration {...props} name={interfaceName.value} />\n }>\n <ReflectionClassContext.Provider\n value={{\n reflection: reflection!\n }}>\n <TSDocReflectionClass<T> heading={doc} reflection={reflection!} />\n <BaseInterfaceDeclaration\n export={true}\n name={interfaceName.value}\n {...rest}>\n <For each={properties} doubleHardline={true} semicolon={true}>\n {prop => <InterfaceDeclarationProperty property={prop} />}\n </For>\n </BaseInterfaceDeclaration>\n </ReflectionClassContext.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 [{ property }, rest] = splitProps(props, [\"property\"]);\n\n return (\n <ReflectionPropertyContext.Provider value={property}>\n <TSDocContextProperty />\n <InterfaceMember\n name={property.getNameAsString()}\n readonly={property.isReadonly()}\n optional={property.isOptional()}\n nullish={property.isNullable()}\n type={stringifyType(property.getType())}\n {...rest}\n />\n </ReflectionPropertyContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAqEA,MAAU,sBAAwB,qBAAe,SAAA,oBAAA,OAAA;CAE/C,MAAK,SAAU,aAAU,gBAAmB,IAAI,QAAQ;EACtD,WAAA;EACF,QAHE,mBAAA,EAGQ;;AAEV,YAAE,OAAA;AACF,QAAO,gBAAa,SAAc,EAChC,IAAA,WAAA;AACF,SAAA,gBAAiB,eAA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EAC1B,IAAI,OAAO;AACT,WAAA,cAAA;MAEJ,CAAA,CAAA;;;AAGF,UAAO,gBAAA,uBAAA,UAAA;IACJ,OAAA,EACa,YACX;IACD,IAAE,WAAI;AACL,YAAA,CAAA,gBAAuB,sBAA0B;MAChD,SAAW;MACJ;MACN,CAAC,EAAC,gBAAe,0BAAkB,WAAiB;MACpD,UAAA;MACA,IAAA,OAAY;AACZ,cAAQ,cAAA;;MAER,EAAC,MAAA,EACF,IAAA,WAAW;AACb,aAAA,gBAAA,KAAA;OACH,MAAA;OACH,gBAAA;OACD,WAAA;2EAEC,UAAA,MACa,CAAA;OACb,CAAA;QAES,CAAC,CAAA,CAAA;;IAEL,CAAC;;EAEL,CAAC;;;;;AAMJ,SAAgB,6BAA6B,OAA0B;CACrE,MAAE,CAAA,EACD;AAED,QAAM,gBAAa,0BAAa,UAAA;EAC9B,OAAA;EACA,IAAI,WAAA;AACF,UAAK,CAAA,gBAAc,sBAAA,EAAA,CAAA,EAAA,gBAAA,iBAAA,WAAA;IACjB,IAAG,OAAO;AACR,YAAO,SAAO,iBAAA;;IAEhB,IAAI,WAAI;AACN,YAAO,SAAC,YAAkB;;IAE5B,IAAI,WAAM;AACR,YAAO,SAAE,YAAA;;IAEX,IAAC,UAAA;AACN,YAAA,SAAA,YAAA;;IAEK,IAAC,OAAA;AACJ,YAAA,cAAA,SAAA,SAAA,CAAA;;IAEC,EAAA,KAAQ,CAAC,CAAA;;EAEZ,CAAC"}
|
|
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 Ref,\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 ReflectionClass,\n ReflectionProperty,\n stringifyType\n} from \"@powerlines/deepkit/vendor/type\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport {\n ReflectionClassContext,\n ReflectionPropertyContext\n} from \"../../core/contexts/reflection\";\nimport { ComponentProps } from \"../../types/components\";\nimport { MemberScope } from \"../contexts/member-scope\";\nimport { PropertyName } from \"./property-name\";\nimport { TSDoc } from \"./tsdoc\";\nimport { TSDocContextProperty, TSDocReflectionClass } from \"./tsdoc-reflection\";\nimport { TypeParameters } from \"./type-parameters\";\n\nexport interface InterfaceDeclarationProps<\n T extends Record<string, any> = Record<string, any>\n>\n extends CommonDeclarationProps, 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 reflection class 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 reflection class.\n */\n reflection?: ReflectionClass<T>;\n\n /**\n * A default value for this interface.\n *\n * @remarks\n * This is used when the interface is used as a type for a variable declaration, to provide an initial value for the variable.\n */\n defaultValue?: Ref<Partial<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 extends Omit<InterfaceMemberProps, \"name\">, ComponentProps {\n property: ReflectionProperty;\n defaultValue?: any;\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 type?: Children;\n children?: Children;\n readonly?: boolean;\n doc?: Children;\n refkey?: Refkey | Refkey[];\n}\nexport interface InterfacePropertyMemberProps extends InterfaceMemberPropsBase {\n name: string | Namekey;\n optional?: boolean;\n nullish?: boolean;\n}\n\nexport interface InterfaceIndexerMemberProps extends InterfaceMemberPropsBase {\n indexer: Children;\n}\n\nexport type InterfaceMemberProps =\n | InterfacePropertyMemberProps\n | InterfaceIndexerMemberProps;\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.type ?? props.children;\n const readonly = props.readonly ? \"readonly \" : \"\";\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 optionality = props.optional ? \"?\" : \"\";\n const scope = useTSMemberScope();\n const sym = createSymbol(\n TSOutputSymbol,\n props.name,\n scope.ownerSymbol.staticMembers,\n {\n refkeys: props.refkey,\n tsFlags:\n TSSymbolFlags.TypeSymbol |\n ((props.nullish ?? props.optional)\n ? TSSymbolFlags.Nullish\n : TSSymbolFlags.None),\n namePolicy: useTSNamePolicy().for(\"interface-member\"),\n binder: scope.binder\n }\n );\n\n const taken = takeSymbols();\n\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 {optionality}: {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(TSOutputSymbol, props.name, currentScope.types, {\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 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 reflection class.\n */\nexport function InterfaceDeclaration<\n T extends Record<string, any> = Record<string, any>\n>(props: InterfaceDeclarationProps<T>) {\n const [{ name, reflection, doc, defaultValue }, rest] = splitProps(props, [\n \"name\",\n \"reflection\",\n \"doc\",\n \"defaultValue\"\n ]);\n\n const interfaceName = computed(() =>\n pascalCase(\n (isString(name) ? name : name.toString()) || reflection?.getName()\n )\n );\n\n const properties = computed(() =>\n reflection\n ? reflection\n .getProperties()\n .filter(item => !item.isIgnored())\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) ||\n (!a.isReadonly() && !b.isReadonly())\n ? a.getNameAsString().localeCompare(b.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n )\n : []\n );\n\n return (\n <Show\n when={reflection && properties.value.length > 0}\n fallback={\n <BaseInterfaceDeclaration {...props} name={interfaceName.value} />\n }>\n <ReflectionClassContext.Provider\n value={{\n reflection: reflection!\n }}>\n <TSDocReflectionClass<T> heading={doc} reflection={reflection!} />\n <BaseInterfaceDeclaration\n export={true}\n name={interfaceName.value}\n defaultValue={defaultValue}\n {...rest}>\n <For each={properties} doubleHardline={true} semicolon={true}>\n {prop => (\n <InterfaceDeclarationProperty\n property={prop}\n defaultValue={defaultValue?.value?.[prop.getNameAsString()]}\n />\n )}\n </For>\n </BaseInterfaceDeclaration>\n </ReflectionClassContext.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 [{ property, defaultValue }, rest] = splitProps(props, [\n \"property\",\n \"defaultValue\"\n ]);\n\n return (\n <ReflectionPropertyContext.Provider value={{ property, defaultValue }}>\n <TSDocContextProperty />\n <InterfaceMember\n name={property.getNameAsString()}\n readonly={property.isReadonly()}\n optional={property.isOptional()}\n nullish={property.isNullable()}\n type={stringifyType(property.getType())}\n {...rest}\n />\n </ReflectionPropertyContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAsEA,MAAU,sBAAwB,qBAAe,SAAA,oBAAA,OAAA;CAE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O;AACL,YAAA,cAAY,SAAU,SAAA,CAAA;;IAEzB,EAAE,KAAA,CAAA,CAAA;;EAEN,CAAC"}
|
|
@@ -110,10 +110,16 @@ function ObjectDeclaration(props) {
|
|
|
110
110
|
function ObjectDeclarationProperty(props) {
|
|
111
111
|
const [{ property, defaultValue }] = (0, _alloy_js_core.splitProps)(props, ["property", "defaultValue"]);
|
|
112
112
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_core_contexts_reflection.ReflectionPropertyContext.Provider, {
|
|
113
|
-
value:
|
|
113
|
+
value: {
|
|
114
|
+
property,
|
|
115
|
+
defaultValue
|
|
116
|
+
},
|
|
114
117
|
get children() {
|
|
115
118
|
return [
|
|
116
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc_reflection.TSDocReflectionProperty, {
|
|
119
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc_reflection.TSDocReflectionProperty, {
|
|
120
|
+
reflection: property,
|
|
121
|
+
defaultValue
|
|
122
|
+
}),
|
|
117
123
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ObjectProperty, {
|
|
118
124
|
get name() {
|
|
119
125
|
return property.getNameAsString();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentProps } from "../../types/components.cjs";
|
|
2
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
3
|
-
import { ReflectionClass, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
|
|
2
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
4
3
|
import { VarDeclarationProps } from "@alloy-js/typescript";
|
|
4
|
+
import { ReflectionClass, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
|
|
5
5
|
|
|
6
6
|
//#region src/typescript/components/object-declaration.d.ts
|
|
7
7
|
interface ComputedRef<T = any> {
|
|
@@ -11,18 +11,18 @@ interface ObjectDeclarationProps<T extends Record<string, any> = Record<string,
|
|
|
11
11
|
reflection?: ComputedRef<ReflectionClass<T>>;
|
|
12
12
|
defaultValue?: ComputedRef<Partial<T> | undefined>;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Generates a TypeScript object for the given reflection class.
|
|
16
|
+
*/
|
|
17
|
+
declare function ObjectDeclaration<T extends Record<string, any> = Record<string, any>>(props: ObjectDeclarationProps<T>): _$_alloy_js_core0.Children;
|
|
14
18
|
interface ObjectDeclarationPropertyProps extends ComponentProps {
|
|
15
19
|
property: ReflectionProperty;
|
|
16
20
|
defaultValue?: any;
|
|
17
21
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Generates a TypeScript object for the given reflection class.
|
|
20
|
-
*/
|
|
21
|
-
declare function ObjectDeclaration<T extends Record<string, any> = Record<string, any>>(props: ObjectDeclarationProps<T>): _alloy_js_core0.Children;
|
|
22
22
|
/**
|
|
23
23
|
* Generates a TypeScript object property for the given reflection class.
|
|
24
24
|
*/
|
|
25
|
-
declare function ObjectDeclarationProperty(props: ObjectDeclarationPropertyProps): _alloy_js_core0.Children;
|
|
25
|
+
declare function ObjectDeclarationProperty(props: ObjectDeclarationPropertyProps): _$_alloy_js_core0.Children;
|
|
26
26
|
declare type __ΩComputedRef = any[];
|
|
27
27
|
declare type __ΩObjectDeclarationProps = any[];
|
|
28
28
|
declare type __ΩObjectDeclarationPropertyProps = any[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-declaration.d.cts","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"mappings":";;;;;;UAuDiB,WAAA;EAAA,SACN,KAAA,EAAO,CAAA;AAAA;AAAA,UAGD,sBAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,mBAAA;EACR,UAAA,GAAa,WAAA,CAAY,eAAA,CAAgB,CAAA;EACzC,YAAA,GAAe,WAAA,CAAY,OAAA,CAAQ,CAAA;AAAA
|
|
1
|
+
{"version":3,"file":"object-declaration.d.cts","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"mappings":";;;;;;UAuDiB,WAAA;EAAA,SACN,KAAA,EAAO,CAAA;AAAA;AAAA,UAGD,sBAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,mBAAA;EACR,UAAA,GAAa,WAAA,CAAY,eAAA,CAAgB,CAAA;EACzC,YAAA,GAAe,WAAA,CAAY,OAAA,CAAQ,CAAA;AAAA;;;;iBAMrB,iBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,sBAAA,CAAuB,CAAA,IAAD,iBAAA,CAAG,QAAA;AAAA,UAqHjB,8BAAA,SAAuC,cAAA;EACtD,QAAA,EAAU,kBAAA;EACV,YAAA;AAAA;;;;iBAMc,yBAAA,CACd,KAAA,EAAO,8BAAA,GAA8B,iBAAA,CAAA,QAAA;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentProps } from "../../types/components.mjs";
|
|
2
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
3
3
|
import { ReflectionClass, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
|
|
4
4
|
import { VarDeclarationProps } from "@alloy-js/typescript";
|
|
5
5
|
|
|
@@ -11,18 +11,18 @@ interface ObjectDeclarationProps<T extends Record<string, any> = Record<string,
|
|
|
11
11
|
reflection?: ComputedRef<ReflectionClass<T>>;
|
|
12
12
|
defaultValue?: ComputedRef<Partial<T> | undefined>;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Generates a TypeScript object for the given reflection class.
|
|
16
|
+
*/
|
|
17
|
+
declare function ObjectDeclaration<T extends Record<string, any> = Record<string, any>>(props: ObjectDeclarationProps<T>): _$_alloy_js_core0.Children;
|
|
14
18
|
interface ObjectDeclarationPropertyProps extends ComponentProps {
|
|
15
19
|
property: ReflectionProperty;
|
|
16
20
|
defaultValue?: any;
|
|
17
21
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Generates a TypeScript object for the given reflection class.
|
|
20
|
-
*/
|
|
21
|
-
declare function ObjectDeclaration<T extends Record<string, any> = Record<string, any>>(props: ObjectDeclarationProps<T>): _alloy_js_core0.Children;
|
|
22
22
|
/**
|
|
23
23
|
* Generates a TypeScript object property for the given reflection class.
|
|
24
24
|
*/
|
|
25
|
-
declare function ObjectDeclarationProperty(props: ObjectDeclarationPropertyProps): _alloy_js_core0.Children;
|
|
25
|
+
declare function ObjectDeclarationProperty(props: ObjectDeclarationPropertyProps): _$_alloy_js_core0.Children;
|
|
26
26
|
declare type __ΩComputedRef = any[];
|
|
27
27
|
declare type __ΩObjectDeclarationProps = any[];
|
|
28
28
|
declare type __ΩObjectDeclarationPropertyProps = any[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-declaration.d.mts","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"mappings":";;;;;;UAuDiB,WAAA;EAAA,SACN,KAAA,EAAO,CAAA;AAAA;AAAA,UAGD,sBAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,mBAAA;EACR,UAAA,GAAa,WAAA,CAAY,eAAA,CAAgB,CAAA;EACzC,YAAA,GAAe,WAAA,CAAY,OAAA,CAAQ,CAAA;AAAA
|
|
1
|
+
{"version":3,"file":"object-declaration.d.mts","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"mappings":";;;;;;UAuDiB,WAAA;EAAA,SACN,KAAA,EAAO,CAAA;AAAA;AAAA,UAGD,sBAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,mBAAA;EACR,UAAA,GAAa,WAAA,CAAY,eAAA,CAAgB,CAAA;EACzC,YAAA,GAAe,WAAA,CAAY,OAAA,CAAQ,CAAA;AAAA;;;;iBAMrB,iBAAA,WACJ,MAAA,gBAAsB,MAAA,cAAA,CAChC,KAAA,EAAO,sBAAA,CAAuB,CAAA,IAAD,iBAAA,CAAG,QAAA;AAAA,UAqHjB,8BAAA,SAAuC,cAAA;EACtD,QAAA,EAAU,kBAAA;EACV,YAAA;AAAA;;;;iBAMc,yBAAA,CACd,KAAA,EAAO,8BAAA,GAA8B,iBAAA,CAAA,QAAA;AAAA"}
|
|
@@ -108,10 +108,16 @@ function ObjectDeclaration(props) {
|
|
|
108
108
|
function ObjectDeclarationProperty(props) {
|
|
109
109
|
const [{ property, defaultValue }] = splitProps(props, ["property", "defaultValue"]);
|
|
110
110
|
return createComponent(ReflectionPropertyContext.Provider, {
|
|
111
|
-
value:
|
|
111
|
+
value: {
|
|
112
|
+
property,
|
|
113
|
+
defaultValue
|
|
114
|
+
},
|
|
112
115
|
get children() {
|
|
113
116
|
return [
|
|
114
|
-
createComponent(TSDocReflectionProperty, {
|
|
117
|
+
createComponent(TSDocReflectionProperty, {
|
|
118
|
+
reflection: property,
|
|
119
|
+
defaultValue
|
|
120
|
+
}),
|
|
115
121
|
createComponent(ObjectProperty, {
|
|
116
122
|
get name() {
|
|
117
123
|
return property.getNameAsString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-declaration.mjs","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n computed,\n Declaration as CoreDeclaration,\n createSymbolSlot,\n For,\n Name,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n createValueSymbol,\n ObjectExpression,\n ObjectProperty,\n TSSymbolFlags,\n TypeRefContext,\n useTSNamePolicy,\n VarDeclarationProps\n} from \"@alloy-js/typescript\";\nimport { stringifyDefaultValue } from \"@powerlines/deepkit/utilities\";\nimport type {\n ReflectionClass,\n ReflectionProperty\n} from \"@powerlines/deepkit/vendor/type\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport {\n ReflectionClassContext,\n ReflectionPropertyContext\n} from \"../../core/contexts/reflection\";\nimport { ComponentProps } from \"../../types/components\";\nimport {\n TSDocReflectionClass,\n TSDocReflectionProperty\n} from \"./tsdoc-reflection\";\n\nexport interface ComputedRef<T = any> {\n readonly value: T;\n}\n\nexport interface ObjectDeclarationProps<\n T extends Record<string, any> = Record<string, any>\n> extends VarDeclarationProps {\n reflection?: ComputedRef<ReflectionClass<T>>;\n defaultValue?: ComputedRef<Partial<T> | undefined>;\n}\n\
|
|
1
|
+
{"version":3,"file":"object-declaration.mjs","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n computed,\n Declaration as CoreDeclaration,\n createSymbolSlot,\n For,\n Name,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n createValueSymbol,\n ObjectExpression,\n ObjectProperty,\n TSSymbolFlags,\n TypeRefContext,\n useTSNamePolicy,\n VarDeclarationProps\n} from \"@alloy-js/typescript\";\nimport { stringifyDefaultValue } from \"@powerlines/deepkit/utilities\";\nimport type {\n ReflectionClass,\n ReflectionProperty\n} from \"@powerlines/deepkit/vendor/type\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport {\n ReflectionClassContext,\n ReflectionPropertyContext\n} from \"../../core/contexts/reflection\";\nimport { ComponentProps } from \"../../types/components\";\nimport {\n TSDocReflectionClass,\n TSDocReflectionProperty\n} from \"./tsdoc-reflection\";\n\nexport interface ComputedRef<T = any> {\n readonly value: T;\n}\n\nexport interface ObjectDeclarationProps<\n T extends Record<string, any> = Record<string, any>\n> extends VarDeclarationProps {\n reflection?: ComputedRef<ReflectionClass<T>>;\n defaultValue?: ComputedRef<Partial<T> | undefined>;\n}\n\n/**\n * Generates a TypeScript object for the given reflection class.\n */\nexport function ObjectDeclaration<\n T extends Record<string, any> = Record<string, any>\n>(props: ObjectDeclarationProps<T>) {\n if (!props.reflection?.value) {\n return null;\n }\n\n const objectName = computed(() =>\n camelCase(\n (isString(props.name) ? props.name : props.name.toString()) ||\n props.reflection!.value.getName()\n )\n );\n const objectType = computed(\n () => props.type || pascalCase(props.reflection!.value.getName())\n );\n const properties = computed(() =>\n props\n .reflection!.value.getProperties()\n .filter(\n item =>\n !item.isIgnored() &&\n !isUndefined(\n props.defaultValue?.value?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined(\n (props.defaultValue as Record<string, any>)?.value?.[alias]\n )\n ) {\n return (props.defaultValue as Record<string, any>)?.value?.[\n alias\n ];\n }\n\n return ret;\n }, undefined) ??\n item.getDefaultValue()\n )\n )\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) ||\n (!a.isReadonly() && !b.isReadonly())\n ? a.getNameAsString().localeCompare(b.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n )\n );\n\n const TypeSymbolSlot = createSymbolSlot();\n const ValueTypeSymbolSlot = createSymbolSlot();\n const sym = createValueSymbol(props.name, {\n refkeys: props.refkey,\n default: props.default,\n export: props.export,\n metadata: props.metadata,\n tsFlags: props.nullish ? TSSymbolFlags.Nullish : TSSymbolFlags.None,\n type: props.type ? TypeSymbolSlot.firstSymbol : undefined,\n namePolicy: useTSNamePolicy().for(\"variable\")\n });\n\n if (!props.type) {\n ValueTypeSymbolSlot.moveMembersTo(sym);\n }\n\n const keyword = props.var ? \"var\" : props.let ? \"let\" : \"const\";\n const type = props.type ? (\n <TypeRefContext>\n : <TypeSymbolSlot>{props.type}</TypeSymbolSlot>\n </TypeRefContext>\n ) : undefined;\n\n return (\n <Show when={!!props.reflection.value}>\n <ReflectionClassContext.Provider\n value={{\n reflection: props.reflection.value as ReflectionClass<any>,\n override: {\n name: objectName.value,\n type: objectType.value,\n defaultValue: props.defaultValue?.value\n }\n }}>\n <Show when={!!objectName.value && !!objectType.value}>\n <TSDocReflectionClass reflection={props.reflection.value} />\n <CoreDeclaration symbol={sym}>\n {props.export ? \"export \" : \"\"}\n {props.default ? \"default \" : \"\"}\n {keyword} <Name />\n {type} ={\" \"}\n <ValueTypeSymbolSlot>\n {props.initializer ?? props.children ?? (\n <ObjectExpression>\n <For\n each={properties.value ?? []}\n comma={true}\n doubleHardline={true}>\n {prop => (\n <ObjectDeclarationProperty\n property={prop}\n defaultValue={\n props.defaultValue?.value?.[prop.getNameAsString()]\n }\n />\n )}\n </For>\n </ObjectExpression>\n )}\n </ValueTypeSymbolSlot>\n </CoreDeclaration>\n </Show>\n <hbr />\n </ReflectionClassContext.Provider>\n </Show>\n );\n}\n\nexport interface ObjectDeclarationPropertyProps extends ComponentProps {\n property: ReflectionProperty;\n defaultValue?: any;\n}\n\n/**\n * Generates a TypeScript object property for the given reflection class.\n */\nexport function ObjectDeclarationProperty(\n props: ObjectDeclarationPropertyProps\n) {\n const [{ property, defaultValue }] = splitProps(props, [\n \"property\",\n \"defaultValue\"\n ]);\n\n return (\n <ReflectionPropertyContext.Provider value={{ property, defaultValue }}>\n <TSDocReflectionProperty\n reflection={property}\n defaultValue={defaultValue}\n />\n <ObjectProperty\n name={property.getNameAsString()}\n value={stringifyDefaultValue(property, defaultValue)}\n />\n <hbr />\n </ReflectionPropertyContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAyCA,SAAS,kBAAmD,OAAA;AAC5D,KAAM,CAAC,MAAE,YAAa,MACtB,QAAS;CAET,MAAO,aAAA,eAAA,WAAA,SAAA,MAAA,KAAA,GAAA,MAAA,OAAA,MAAA,KAAA,UAAA,KAAA,MAAA,WAAA,MAAA,SAAA,CAAA,CAAA;CACL,MAAA,aAAA,eAAsB,MAAA,QAAA,WAAA,MAAA,WAAA,MAAA,SAAA,CAAA,CAAA;CACtB,MAAA,aAAA,eAAA,MAAA,WAAA,MAAA,eAAA,CAAA,QAAA,SAAA,CAAA,KAAA,WAAA,IAAA,CAAA,YAAA,MAAA,cAAA,QAAA,KAAA,iBAAA,KAAA,KAAA,UAAA,CAAA,QAAA,KAAA,UAAA;AACA,MAAM,YAAW,IAAA,IAAS,CAAA,YAAW,MAAA,cAAA,QAAA,OAAA,CACjC,QAAG,MAAA,cAA8C,QAAA;AAErD,SAAA;IACA,OAAA,IAAA,KAAA,iBAAA,CAAA,CAAA,CAAA,MAAA,GAAA,MAAA,EAAA,YAAA,IAAA,EAAA,YAAA,IAAA,CAAA,EAAA,YAAA,IAAA,CAAA,EAAA,YAAA,GAAA,EAAA,iBAAA,CAAA,cAAA,EAAA,iBAAA,CAAA,GAAA,EAAA,YAAA,GAAA,IAAA,GAAA,CAAA;CACA,MAAM,iBAAQ,kBAAW;;CAE3B,MAAO,MAAA,kBAAyB,MAAM,MAAA;EACpC,SAAS,MAAQ;EACnB,SAAA,MAAA;;EAEA,UAAO,MAAU;EACb,SAAQ,MAAO,UAAQ,cAAc,UAAW,cAAA;EAClD,MAAQ,MAAA,OAAA,eAAoB,cAAA;EAC5B,YAAa,iBAAY,CAAA,IAAA,WAAmB;EAC5C,CAAA;A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A,CAAC;UAAA;;QAEL,CAAC,CAAA;;MAEZ,CAAA,EAAA,gBAAA,OAAA,EAAA,CAAA,CAAA;;IAEG,CAAA;;EAEL,CAAA;;;;;AAUF,SAAgB,0BAAyB,OAAA;CACvC,MAAK,CAAA,EACH,UACA,kBACG,WAAW,OAAE,CAAA,YAAA,eAAA,CAAA;AAClB,QAAO,gBAAS,0BAAgB,UAAA;EAC9B,OAAO;GACL;GACA;GACD;EACD,IAAI,WAAW;AACb,UAAK;IAAA,gBAAqB,yBAAkB;KAC1C,YAAG;KACQ;KACZ,CAAC;IAAE,gBAAkB,gBAAgB;KACpC,IAAI,OAAC;AACH,aAAO,SAAO,iBAAA;;KAEhB,IAAI,QAAQ;AACV,aAAO,sBAAgB,UAAA,aAAA;;KAE1B,CAAC;IAAE,gBAAgB,OAAA,EAAW,CAAA;IAAA;;EAElC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
1
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
2
|
|
|
3
3
|
//#region src/typescript/components/property-name.d.ts
|
|
4
4
|
interface PropertyNameProps {
|
|
@@ -17,7 +17,7 @@ interface PropertyNameProps {
|
|
|
17
17
|
* @remarks
|
|
18
18
|
* If the name is not a valid JavaScript identifier, it will be quoted. If a `name` prop is provided, it will be used as the property name. Otherwise, the name will be taken from the {@link (MemberDeclarationContext:variable)}.
|
|
19
19
|
*/
|
|
20
|
-
declare function PropertyName(props: PropertyNameProps): _alloy_js_core0.Children;
|
|
20
|
+
declare function PropertyName(props: PropertyNameProps): _$_alloy_js_core0.Children;
|
|
21
21
|
declare type __ΩPropertyNameProps = any[];
|
|
22
22
|
//#endregion
|
|
23
23
|
export { PropertyName, PropertyNameProps, __ΩPropertyNameProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property-name.d.cts","names":[],"sources":["../../../src/typescript/components/property-name.tsx"],"mappings":";;;UAuBiB,iBAAA;;;AAAjB;EAIE,IAAA;;;;EAKA,OAAA;AAAA;;;;;;;iBASc,YAAA,CAAa,KAAA,EAAO,iBAAA,GAAiB,
|
|
1
|
+
{"version":3,"file":"property-name.d.cts","names":[],"sources":["../../../src/typescript/components/property-name.tsx"],"mappings":";;;UAuBiB,iBAAA;;;AAAjB;EAIE,IAAA;;;;EAKA,OAAA;AAAA;;;;;;;iBASc,YAAA,CAAa,KAAA,EAAO,iBAAA,GAAiB,iBAAA,CAAA,QAAA;AAAA"}
|