@powerlines/plugin-alloy 0.21.3 → 0.21.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/components/output.d.cts +2 -2
- package/dist/core/components/output.d.mts +2 -2
- package/dist/core/components/single-line-comment.d.cts +2 -2
- package/dist/core/components/single-line-comment.d.mts +2 -2
- package/dist/core/components/source-file.d.cts +2 -2
- package/dist/core/contexts/reflection.d.cts.map +1 -1
- package/dist/helpers/index.cjs +1 -1
- package/dist/helpers/index.d.cts +2 -2
- package/dist/helpers/index.d.mts +2 -2
- package/dist/helpers/index.mjs +2 -2
- package/dist/helpers/typescript.cjs +2 -2
- package/dist/helpers/typescript.d.cts +6 -6
- package/dist/helpers/typescript.d.cts.map +1 -1
- package/dist/helpers/typescript.d.mts +6 -6
- package/dist/helpers/typescript.d.mts.map +1 -1
- package/dist/helpers/typescript.mjs +2 -2
- package/dist/helpers/typescript.mjs.map +1 -1
- package/dist/markdown/components/front-matter.d.cts +2 -2
- package/dist/markdown/components/front-matter.d.mts +2 -2
- package/dist/markdown/components/markdown-file.d.mts +3 -3
- package/dist/markdown/components/markdown-table.d.cts +4 -4
- package/dist/typescript/components/builtin-file.d.cts +2 -2
- package/dist/typescript/components/builtin-file.d.mts +2 -2
- package/dist/typescript/components/class-declaration.cjs +40 -9
- package/dist/typescript/components/class-declaration.d.cts +31 -0
- package/dist/typescript/components/class-declaration.d.cts.map +1 -1
- package/dist/typescript/components/class-declaration.d.mts +31 -0
- package/dist/typescript/components/class-declaration.d.mts.map +1 -1
- package/dist/typescript/components/class-declaration.mjs +41 -10
- package/dist/typescript/components/class-declaration.mjs.map +1 -1
- package/dist/typescript/components/dynamic-import-statement.d.cts +2 -2
- package/dist/typescript/components/dynamic-import-statement.d.mts +2 -2
- package/dist/typescript/components/entry-file.d.cts +2 -2
- package/dist/typescript/components/entry-file.d.mts +2 -2
- package/dist/typescript/components/index.cjs +12 -10
- package/dist/typescript/components/index.d.cts +4 -4
- package/dist/typescript/components/index.d.mts +4 -4
- package/dist/typescript/components/index.mjs +5 -5
- package/dist/typescript/components/interface-declaration.cjs +225 -0
- package/dist/typescript/components/interface-declaration.d.cts +82 -0
- package/dist/typescript/components/interface-declaration.d.cts.map +1 -0
- package/dist/typescript/components/interface-declaration.d.mts +82 -0
- package/dist/typescript/components/interface-declaration.d.mts.map +1 -0
- package/dist/typescript/components/interface-declaration.mjs +222 -0
- package/dist/typescript/components/interface-declaration.mjs.map +1 -0
- package/dist/typescript/components/{typescript-object.cjs → object-declaration.cjs} +6 -6
- package/dist/typescript/components/object-declaration.d.cts +30 -0
- package/dist/typescript/components/object-declaration.d.cts.map +1 -0
- package/dist/typescript/components/object-declaration.d.mts +30 -0
- package/dist/typescript/components/object-declaration.d.mts.map +1 -0
- package/dist/typescript/components/{typescript-object.mjs → object-declaration.mjs} +6 -6
- package/dist/typescript/components/object-declaration.mjs.map +1 -0
- package/dist/typescript/components/{typescript-property-name.cjs → property-name.cjs} +3 -3
- package/dist/typescript/components/{typescript-property-name.d.mts → property-name.d.cts} +6 -6
- package/dist/typescript/components/property-name.d.cts.map +1 -0
- package/dist/typescript/components/{typescript-property-name.d.cts → property-name.d.mts} +7 -7
- package/dist/typescript/components/property-name.d.mts.map +1 -0
- package/dist/typescript/components/{typescript-property-name.mjs → property-name.mjs} +4 -4
- package/dist/typescript/components/property-name.mjs.map +1 -0
- package/dist/typescript/components/tsdoc-reflection.d.cts +4 -4
- package/dist/typescript/components/tsdoc-reflection.d.mts +4 -4
- package/dist/typescript/components/tsdoc-reflection.d.mts.map +1 -1
- package/dist/typescript/components/tsdoc.cjs +1 -1
- package/dist/typescript/components/tsdoc.mjs +1 -1
- package/dist/typescript/components/tsdoc.mjs.map +1 -1
- package/dist/typescript/contexts/lexical-scope.d.cts +2 -2
- package/dist/typescript/contexts/lexical-scope.d.cts.map +1 -1
- package/dist/typescript/index.cjs +11 -9
- package/dist/typescript/index.d.cts +4 -4
- package/dist/typescript/index.d.mts +4 -4
- package/dist/typescript/index.mjs +5 -5
- package/package.json +44 -44
- package/dist/typescript/components/typescript-interface.cjs +0 -73
- package/dist/typescript/components/typescript-interface.d.cts +0 -26
- package/dist/typescript/components/typescript-interface.d.cts.map +0 -1
- package/dist/typescript/components/typescript-interface.d.mts +0 -26
- package/dist/typescript/components/typescript-interface.d.mts.map +0 -1
- package/dist/typescript/components/typescript-interface.mjs +0 -72
- package/dist/typescript/components/typescript-interface.mjs.map +0 -1
- package/dist/typescript/components/typescript-object.d.cts +0 -30
- package/dist/typescript/components/typescript-object.d.cts.map +0 -1
- package/dist/typescript/components/typescript-object.d.mts +0 -30
- package/dist/typescript/components/typescript-object.d.mts.map +0 -1
- package/dist/typescript/components/typescript-object.mjs.map +0 -1
- package/dist/typescript/components/typescript-property-name.d.cts.map +0 -1
- package/dist/typescript/components/typescript-property-name.d.mts.map +0 -1
- package/dist/typescript/components/typescript-property-name.mjs.map +0 -1
|
@@ -6,15 +6,15 @@ import "./contexts/index.mjs";
|
|
|
6
6
|
import { getCallSignatureProps } from "./helpers/get-call-signature-props.mjs";
|
|
7
7
|
import { isValidJSIdentifier } from "./helpers/utilities.mjs";
|
|
8
8
|
import "./helpers/index.mjs";
|
|
9
|
+
import { PropertyName } from "./components/property-name.mjs";
|
|
9
10
|
import { TypeParameters } from "./components/type-parameters.mjs";
|
|
10
|
-
import { TypescriptPropertyName } from "./components/typescript-property-name.mjs";
|
|
11
11
|
import { ClassDeclaration, ClassField, ClassMember, ClassMethod } from "./components/class-declaration.mjs";
|
|
12
12
|
import { DynamicImportStatement } from "./components/dynamic-import-statement.mjs";
|
|
13
13
|
import { EntryFile } from "./components/entry-file.mjs";
|
|
14
|
-
import { RecordExpression } from "./components/record-expression.mjs";
|
|
15
14
|
import { TSDocReflectionClass, TSDocReflectionMethod, TSDocReflectionProperty } from "./components/tsdoc-reflection.mjs";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
15
|
+
import { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceExpression, InterfaceMember } from "./components/interface-declaration.mjs";
|
|
16
|
+
import { ObjectDeclaration, ObjectDeclarationProperty } from "./components/object-declaration.mjs";
|
|
17
|
+
import { RecordExpression } from "./components/record-expression.mjs";
|
|
18
18
|
import "./components/index.mjs";
|
|
19
19
|
|
|
20
|
-
export { BuiltinFile, ClassDeclaration, ClassField, ClassMember, ClassMethod, DynamicImportStatement, EntryFile, LexicalScope, RecordExpression, TSDoc, TSDocAlias, TSDocAttributesTags, TSDocDefaultValue, TSDocDomain, TSDocExample, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocParam, TSDocParams, TSDocPermission, TSDocReadonly, TSDocReflectionClass, TSDocReflectionMethod, TSDocReflectionProperty, TSDocRemarks, TSDocReturns, TSDocTag, TSDocThrows, TSDocTitle, TypeParameters,
|
|
20
|
+
export { BuiltinFile, ClassDeclaration, ClassField, ClassMember, ClassMethod, DynamicImportStatement, EntryFile, InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceExpression, InterfaceMember, LexicalScope, ObjectDeclaration, ObjectDeclarationProperty, PropertyName, RecordExpression, TSDoc, TSDocAlias, TSDocAttributesTags, TSDocDefaultValue, TSDocDomain, TSDocExample, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocParam, TSDocParams, TSDocPermission, TSDocReadonly, TSDocReflectionClass, TSDocReflectionMethod, TSDocReflectionProperty, TSDocRemarks, TSDocReturns, TSDocTag, TSDocThrows, TSDocTitle, TypeParameters, TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports, getCallSignatureProps, isValidJSIdentifier };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-alloy",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing various Alloy framework components and helper utilities.",
|
|
6
6
|
"repository": {
|
|
@@ -490,6 +490,48 @@
|
|
|
490
490
|
"default": "./dist/typescript/components/entry-file.mjs"
|
|
491
491
|
}
|
|
492
492
|
},
|
|
493
|
+
"./typescript/components/interface-declaration": {
|
|
494
|
+
"require": {
|
|
495
|
+
"types": "./dist/typescript/components/interface-declaration.d.cts",
|
|
496
|
+
"default": "./dist/typescript/components/interface-declaration.cjs"
|
|
497
|
+
},
|
|
498
|
+
"import": {
|
|
499
|
+
"types": "./dist/typescript/components/interface-declaration.d.mts",
|
|
500
|
+
"default": "./dist/typescript/components/interface-declaration.mjs"
|
|
501
|
+
},
|
|
502
|
+
"default": {
|
|
503
|
+
"types": "./dist/typescript/components/interface-declaration.d.mts",
|
|
504
|
+
"default": "./dist/typescript/components/interface-declaration.mjs"
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
"./typescript/components/object-declaration": {
|
|
508
|
+
"require": {
|
|
509
|
+
"types": "./dist/typescript/components/object-declaration.d.cts",
|
|
510
|
+
"default": "./dist/typescript/components/object-declaration.cjs"
|
|
511
|
+
},
|
|
512
|
+
"import": {
|
|
513
|
+
"types": "./dist/typescript/components/object-declaration.d.mts",
|
|
514
|
+
"default": "./dist/typescript/components/object-declaration.mjs"
|
|
515
|
+
},
|
|
516
|
+
"default": {
|
|
517
|
+
"types": "./dist/typescript/components/object-declaration.d.mts",
|
|
518
|
+
"default": "./dist/typescript/components/object-declaration.mjs"
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
"./typescript/components/property-name": {
|
|
522
|
+
"require": {
|
|
523
|
+
"types": "./dist/typescript/components/property-name.d.cts",
|
|
524
|
+
"default": "./dist/typescript/components/property-name.cjs"
|
|
525
|
+
},
|
|
526
|
+
"import": {
|
|
527
|
+
"types": "./dist/typescript/components/property-name.d.mts",
|
|
528
|
+
"default": "./dist/typescript/components/property-name.mjs"
|
|
529
|
+
},
|
|
530
|
+
"default": {
|
|
531
|
+
"types": "./dist/typescript/components/property-name.d.mts",
|
|
532
|
+
"default": "./dist/typescript/components/property-name.mjs"
|
|
533
|
+
}
|
|
534
|
+
},
|
|
493
535
|
"./typescript/components/record-expression": {
|
|
494
536
|
"require": {
|
|
495
537
|
"types": "./dist/typescript/components/record-expression.d.cts",
|
|
@@ -560,48 +602,6 @@
|
|
|
560
602
|
"default": "./dist/typescript/components/typescript-file.mjs"
|
|
561
603
|
}
|
|
562
604
|
},
|
|
563
|
-
"./typescript/components/typescript-interface": {
|
|
564
|
-
"require": {
|
|
565
|
-
"types": "./dist/typescript/components/typescript-interface.d.cts",
|
|
566
|
-
"default": "./dist/typescript/components/typescript-interface.cjs"
|
|
567
|
-
},
|
|
568
|
-
"import": {
|
|
569
|
-
"types": "./dist/typescript/components/typescript-interface.d.mts",
|
|
570
|
-
"default": "./dist/typescript/components/typescript-interface.mjs"
|
|
571
|
-
},
|
|
572
|
-
"default": {
|
|
573
|
-
"types": "./dist/typescript/components/typescript-interface.d.mts",
|
|
574
|
-
"default": "./dist/typescript/components/typescript-interface.mjs"
|
|
575
|
-
}
|
|
576
|
-
},
|
|
577
|
-
"./typescript/components/typescript-object": {
|
|
578
|
-
"require": {
|
|
579
|
-
"types": "./dist/typescript/components/typescript-object.d.cts",
|
|
580
|
-
"default": "./dist/typescript/components/typescript-object.cjs"
|
|
581
|
-
},
|
|
582
|
-
"import": {
|
|
583
|
-
"types": "./dist/typescript/components/typescript-object.d.mts",
|
|
584
|
-
"default": "./dist/typescript/components/typescript-object.mjs"
|
|
585
|
-
},
|
|
586
|
-
"default": {
|
|
587
|
-
"types": "./dist/typescript/components/typescript-object.d.mts",
|
|
588
|
-
"default": "./dist/typescript/components/typescript-object.mjs"
|
|
589
|
-
}
|
|
590
|
-
},
|
|
591
|
-
"./typescript/components/typescript-property-name": {
|
|
592
|
-
"require": {
|
|
593
|
-
"types": "./dist/typescript/components/typescript-property-name.d.cts",
|
|
594
|
-
"default": "./dist/typescript/components/typescript-property-name.cjs"
|
|
595
|
-
},
|
|
596
|
-
"import": {
|
|
597
|
-
"types": "./dist/typescript/components/typescript-property-name.d.mts",
|
|
598
|
-
"default": "./dist/typescript/components/typescript-property-name.mjs"
|
|
599
|
-
},
|
|
600
|
-
"default": {
|
|
601
|
-
"types": "./dist/typescript/components/typescript-property-name.d.mts",
|
|
602
|
-
"default": "./dist/typescript/components/typescript-property-name.mjs"
|
|
603
|
-
}
|
|
604
|
-
},
|
|
605
605
|
"./typescript/contexts": {
|
|
606
606
|
"require": {
|
|
607
607
|
"types": "./dist/typescript/contexts/index.d.cts",
|
|
@@ -721,5 +721,5 @@
|
|
|
721
721
|
"@types/node": "^24.10.13"
|
|
722
722
|
},
|
|
723
723
|
"publishConfig": { "access": "public" },
|
|
724
|
-
"gitHead": "
|
|
724
|
+
"gitHead": "a202e4de4e954ccb40b74b0666b8e08b5aeb1de8"
|
|
725
725
|
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_core_contexts_reflection = require('../../core/contexts/reflection.cjs');
|
|
3
|
-
const require_typescript_components_tsdoc_reflection = require('./tsdoc-reflection.cjs');
|
|
4
|
-
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
|
-
let __alloy_js_core = require("@alloy-js/core");
|
|
6
|
-
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
7
|
-
let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
8
|
-
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
9
|
-
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
10
|
-
|
|
11
|
-
//#region src/typescript/components/typescript-interface.tsx
|
|
12
|
-
/**
|
|
13
|
-
* Generates a TypeScript interface for the given reflection class.
|
|
14
|
-
*/
|
|
15
|
-
function TypeScriptInterface(props) {
|
|
16
|
-
const [{ name, reflection, doc }, rest] = (0, __alloy_js_core.splitProps)(props, [
|
|
17
|
-
"name",
|
|
18
|
-
"reflection",
|
|
19
|
-
"doc"
|
|
20
|
-
]);
|
|
21
|
-
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()));
|
|
22
|
-
const properties = 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);
|
|
23
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_core_contexts_reflection.ReflectionClassContext.Provider, {
|
|
24
|
-
value: { reflection },
|
|
25
|
-
get children() {
|
|
26
|
-
return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc_reflection.TSDocReflectionClass, { heading: doc }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.InterfaceDeclaration, (0, __alloy_js_core_jsx_runtime.mergeProps)({
|
|
27
|
-
"export": true,
|
|
28
|
-
get name() {
|
|
29
|
-
return interfaceName.value;
|
|
30
|
-
}
|
|
31
|
-
}, rest, { get children() {
|
|
32
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
33
|
-
each: properties,
|
|
34
|
-
doubleHardline: true,
|
|
35
|
-
semicolon: true,
|
|
36
|
-
children: (prop) => (0, __alloy_js_core_jsx_runtime.createComponent)(TypescriptInterfaceProperty, { property: prop })
|
|
37
|
-
});
|
|
38
|
-
} }))];
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Generates a TypeScript interface property for the given reflection class.
|
|
44
|
-
*/
|
|
45
|
-
function TypescriptInterfaceProperty(props) {
|
|
46
|
-
const [{ property }, rest] = (0, __alloy_js_core.splitProps)(props, ["property"]);
|
|
47
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_core_contexts_reflection.ReflectionPropertyContext.Provider, {
|
|
48
|
-
value: property,
|
|
49
|
-
get children() {
|
|
50
|
-
return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc_reflection.TSDocReflectionProperty, {}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.InterfaceMember, (0, __alloy_js_core_jsx_runtime.mergeProps)({
|
|
51
|
-
get name() {
|
|
52
|
-
return property.getNameAsString();
|
|
53
|
-
},
|
|
54
|
-
get readonly() {
|
|
55
|
-
return property.isReadonly();
|
|
56
|
-
},
|
|
57
|
-
get optional() {
|
|
58
|
-
return property.isOptional();
|
|
59
|
-
},
|
|
60
|
-
get nullish() {
|
|
61
|
-
return property.isNullable();
|
|
62
|
-
},
|
|
63
|
-
get type() {
|
|
64
|
-
return (0, __powerlines_deepkit_vendor_type.stringifyType)(property.getType());
|
|
65
|
-
}
|
|
66
|
-
}, rest))];
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
//#endregion
|
|
72
|
-
exports.TypeScriptInterface = TypeScriptInterface;
|
|
73
|
-
exports.TypescriptInterfaceProperty = TypescriptInterfaceProperty;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ComponentProps } from "../../types/components.cjs";
|
|
2
|
-
import * as _alloy_js_core4 from "@alloy-js/core";
|
|
3
|
-
import { ReflectionClass, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
|
|
4
|
-
import { InterfaceDeclarationProps, InterfaceMemberProps } from "@alloy-js/typescript";
|
|
5
|
-
|
|
6
|
-
//#region src/typescript/components/typescript-interface.d.ts
|
|
7
|
-
interface TypeScriptInterfaceProps<T extends Record<string, any> = Record<string, any>> extends InterfaceDeclarationProps, ComponentProps {
|
|
8
|
-
reflection: ReflectionClass<T>;
|
|
9
|
-
defaultValue?: Partial<T>;
|
|
10
|
-
}
|
|
11
|
-
interface TypescriptInterfacePropertyProps extends Omit<InterfaceMemberProps, "name">, ComponentProps {
|
|
12
|
-
property: ReflectionProperty;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Generates a TypeScript interface for the given reflection class.
|
|
16
|
-
*/
|
|
17
|
-
declare function TypeScriptInterface<T extends Record<string, any> = Record<string, any>>(props: TypeScriptInterfaceProps<T>): _alloy_js_core4.Children;
|
|
18
|
-
/**
|
|
19
|
-
* Generates a TypeScript interface property for the given reflection class.
|
|
20
|
-
*/
|
|
21
|
-
declare function TypescriptInterfaceProperty(props: TypescriptInterfacePropertyProps): _alloy_js_core4.Children;
|
|
22
|
-
declare type __ΩTypeScriptInterfaceProps = any[];
|
|
23
|
-
declare type __ΩTypescriptInterfacePropertyProps = any[];
|
|
24
|
-
//#endregion
|
|
25
|
-
export { TypeScriptInterface, TypeScriptInterfaceProps, TypescriptInterfaceProperty, TypescriptInterfacePropertyProps, __ΩTypeScriptInterfaceProps, __ΩTypescriptInterfacePropertyProps };
|
|
26
|
-
//# sourceMappingURL=typescript-interface.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-interface.d.cts","names":[],"sources":["../../../src/typescript/components/typescript-interface.tsx"],"sourcesContent":[],"mappings":";;;;;;UA0CiB,mCACL,sBAAsB,6BAExB,2BAA2B;cACvB,gBAAgB;iBACb,QAAQ;AALzB;AACY,UAOK,gCAAA,SACP,IARE,CAQG,oBARH,EAAA,MAAA,CAAA,EAQkC,cARlC,CAAA;EAAsB,QAAA,EAStB,kBATsB;;;;;AAExB,iBAaM,mBAbN,CAAA,UAcE,MAdF,CAAA,MAAA,EAAA,GAAA,CAAA,GAcwB,MAdxB,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,KAAA,EAeD,wBAfC,CAewB,CAfxB,CAAA,CAAA,EAeuB,eAAA,CAAG,QAf1B;;;AAKV;AACe,iBAmDC,2BAAA,CAnDD,KAAA,EAoDN,gCApDM,CAAA,EAoD0B,eAAA,CAAA,QApD1B;AACH,2CAAA,GAAA,EAAA;AADF,mDAAA,GAAA,EAAA"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ComponentProps } from "../../types/components.mjs";
|
|
2
|
-
import * as _alloy_js_core13 from "@alloy-js/core";
|
|
3
|
-
import { ReflectionClass, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
|
|
4
|
-
import { InterfaceDeclarationProps, InterfaceMemberProps } from "@alloy-js/typescript";
|
|
5
|
-
|
|
6
|
-
//#region src/typescript/components/typescript-interface.d.ts
|
|
7
|
-
interface TypeScriptInterfaceProps<T extends Record<string, any> = Record<string, any>> extends InterfaceDeclarationProps, ComponentProps {
|
|
8
|
-
reflection: ReflectionClass<T>;
|
|
9
|
-
defaultValue?: Partial<T>;
|
|
10
|
-
}
|
|
11
|
-
interface TypescriptInterfacePropertyProps extends Omit<InterfaceMemberProps, "name">, ComponentProps {
|
|
12
|
-
property: ReflectionProperty;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Generates a TypeScript interface for the given reflection class.
|
|
16
|
-
*/
|
|
17
|
-
declare function TypeScriptInterface<T extends Record<string, any> = Record<string, any>>(props: TypeScriptInterfaceProps<T>): _alloy_js_core13.Children;
|
|
18
|
-
/**
|
|
19
|
-
* Generates a TypeScript interface property for the given reflection class.
|
|
20
|
-
*/
|
|
21
|
-
declare function TypescriptInterfaceProperty(props: TypescriptInterfacePropertyProps): _alloy_js_core13.Children;
|
|
22
|
-
declare type __ΩTypeScriptInterfaceProps = any[];
|
|
23
|
-
declare type __ΩTypescriptInterfacePropertyProps = any[];
|
|
24
|
-
//#endregion
|
|
25
|
-
export { TypeScriptInterface, TypeScriptInterfaceProps, TypescriptInterfaceProperty, TypescriptInterfacePropertyProps, __ΩTypeScriptInterfaceProps, __ΩTypescriptInterfacePropertyProps };
|
|
26
|
-
//# sourceMappingURL=typescript-interface.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-interface.d.mts","names":[],"sources":["../../../src/typescript/components/typescript-interface.tsx"],"sourcesContent":[],"mappings":";;;;;;UA0CiB,mCACL,sBAAsB,6BAExB,2BAA2B;cACvB,gBAAgB;iBACb,QAAQ;AALzB;AACY,UAOK,gCAAA,SACP,IARE,CAQG,oBARH,EAAA,MAAA,CAAA,EAQkC,cARlC,CAAA;EAAsB,QAAA,EAStB,kBATsB;;;;;AAExB,iBAaM,mBAbN,CAAA,UAcE,MAdF,CAAA,MAAA,EAAA,GAAA,CAAA,GAcwB,MAdxB,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,KAAA,EAeD,wBAfC,CAewB,CAfxB,CAAA,CAAA,EAeuB,gBAAA,CAAG,QAf1B;;;AAKV;AACe,iBAmDC,2BAAA,CAnDD,KAAA,EAoDN,gCApDM,CAAA,EAoD0B,gBAAA,CAAA,QApD1B;AACH,2CAAA,GAAA,EAAA;AADF,mDAAA,GAAA,EAAA"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { ReflectionClassContext, ReflectionPropertyContext } from "../../core/contexts/reflection.mjs";
|
|
2
|
-
import { TSDocReflectionClass, TSDocReflectionProperty } from "./tsdoc-reflection.mjs";
|
|
3
|
-
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
4
|
-
import { For, computed, splitProps } from "@alloy-js/core";
|
|
5
|
-
import { stringifyType } from "@powerlines/deepkit/vendor/type";
|
|
6
|
-
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
7
|
-
import { isString } from "@stryke/type-checks/is-string";
|
|
8
|
-
import { InterfaceDeclaration, InterfaceMember } from "@alloy-js/typescript";
|
|
9
|
-
|
|
10
|
-
//#region src/typescript/components/typescript-interface.tsx
|
|
11
|
-
/**
|
|
12
|
-
* Generates a TypeScript interface for the given reflection class.
|
|
13
|
-
*/
|
|
14
|
-
function TypeScriptInterface(props) {
|
|
15
|
-
const [{ name, reflection, doc }, rest] = splitProps(props, [
|
|
16
|
-
"name",
|
|
17
|
-
"reflection",
|
|
18
|
-
"doc"
|
|
19
|
-
]);
|
|
20
|
-
const interfaceName = computed(() => pascalCase((isString(name) ? name : name.toString()) || reflection.getName()));
|
|
21
|
-
const properties = 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);
|
|
22
|
-
return createComponent(ReflectionClassContext.Provider, {
|
|
23
|
-
value: { reflection },
|
|
24
|
-
get children() {
|
|
25
|
-
return [createComponent(TSDocReflectionClass, { heading: doc }), createComponent(InterfaceDeclaration, mergeProps({
|
|
26
|
-
"export": true,
|
|
27
|
-
get name() {
|
|
28
|
-
return interfaceName.value;
|
|
29
|
-
}
|
|
30
|
-
}, rest, { get children() {
|
|
31
|
-
return createComponent(For, {
|
|
32
|
-
each: properties,
|
|
33
|
-
doubleHardline: true,
|
|
34
|
-
semicolon: true,
|
|
35
|
-
children: (prop) => createComponent(TypescriptInterfaceProperty, { property: prop })
|
|
36
|
-
});
|
|
37
|
-
} }))];
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Generates a TypeScript interface property for the given reflection class.
|
|
43
|
-
*/
|
|
44
|
-
function TypescriptInterfaceProperty(props) {
|
|
45
|
-
const [{ property }, rest] = splitProps(props, ["property"]);
|
|
46
|
-
return createComponent(ReflectionPropertyContext.Provider, {
|
|
47
|
-
value: property,
|
|
48
|
-
get children() {
|
|
49
|
-
return [createComponent(TSDocReflectionProperty, {}), createComponent(InterfaceMember, mergeProps({
|
|
50
|
-
get name() {
|
|
51
|
-
return property.getNameAsString();
|
|
52
|
-
},
|
|
53
|
-
get readonly() {
|
|
54
|
-
return property.isReadonly();
|
|
55
|
-
},
|
|
56
|
-
get optional() {
|
|
57
|
-
return property.isOptional();
|
|
58
|
-
},
|
|
59
|
-
get nullish() {
|
|
60
|
-
return property.isNullable();
|
|
61
|
-
},
|
|
62
|
-
get type() {
|
|
63
|
-
return stringifyType(property.getType());
|
|
64
|
-
}
|
|
65
|
-
}, rest))];
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
//#endregion
|
|
71
|
-
export { TypeScriptInterface, TypescriptInterfaceProperty };
|
|
72
|
-
//# sourceMappingURL=typescript-interface.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-interface.mjs","names":["computed","For","splitProps","InterfaceDeclaration","InterfaceMember","stringifyType","pascalCase","isString","ReflectionClassContext","ReflectionPropertyContext","TSDocReflectionClass","TSDocReflectionProperty","TypeScriptInterface","props","name","reflection","doc","rest","interfaceName","toString","getName","properties","getProperties","filter","item","isIgnored","sort","a","b","isReadonly","getNameAsString","localeCompare","_$createComponent","Provider","value","children","heading","_$mergeProps","each","doubleHardline","semicolon","prop","TypescriptInterfaceProperty","property","readonly","optional","isOptional","nullish","isNullable","type","getType"],"sources":["../../../src/typescript/components/typescript-interface.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 { computed, For, splitProps } from \"@alloy-js/core\";\nimport {\n InterfaceDeclaration,\n InterfaceDeclarationProps,\n InterfaceMember,\n InterfaceMemberProps\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 {\n TSDocReflectionClass,\n TSDocReflectionProperty\n} from \"./tsdoc-reflection\";\n\nexport interface TypeScriptInterfaceProps<\n T extends Record<string, any> = Record<string, any>\n>\n extends InterfaceDeclarationProps, ComponentProps {\n reflection: ReflectionClass<T>;\n defaultValue?: Partial<T>;\n}\n\nexport interface TypescriptInterfacePropertyProps\n extends Omit<InterfaceMemberProps, \"name\">, ComponentProps {\n property: ReflectionProperty;\n}\n\n/**\n * Generates a TypeScript interface for the given reflection class.\n */\nexport function TypeScriptInterface<\n T extends Record<string, any> = Record<string, any>\n>(props: TypeScriptInterfaceProps<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 = reflection\n .getProperties()\n .filter(item => !item.isIgnored())\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n ? a.getNameAsString().localeCompare(b.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n );\n\n return (\n <ReflectionClassContext.Provider\n value={{\n reflection\n }}>\n <TSDocReflectionClass heading={doc} />\n <InterfaceDeclaration export={true} name={interfaceName.value} {...rest}>\n <For each={properties} doubleHardline={true} semicolon={true}>\n {prop => <TypescriptInterfaceProperty property={prop} />}\n </For>\n </InterfaceDeclaration>\n </ReflectionClassContext.Provider>\n );\n}\n\n/**\n * Generates a TypeScript interface property for the given reflection class.\n */\nexport function TypescriptInterfaceProperty(\n props: TypescriptInterfacePropertyProps\n) {\n const [{ property }, rest] = splitProps(props, [\"property\"]);\n\n return (\n <ReflectionPropertyContext.Provider value={property}>\n <TSDocReflectionProperty />\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":""}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { ComponentProps } from "../../types/components.cjs";
|
|
2
|
-
import * as _alloy_js_core14 from "@alloy-js/core";
|
|
3
|
-
import { ReflectionClass, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
|
|
4
|
-
import { VarDeclarationProps } from "@alloy-js/typescript";
|
|
5
|
-
|
|
6
|
-
//#region src/typescript/components/typescript-object.d.ts
|
|
7
|
-
interface ComputedRef<T = any> {
|
|
8
|
-
readonly value: T;
|
|
9
|
-
}
|
|
10
|
-
interface TypescriptObjectProps<T extends Record<string, any> = Record<string, any>> extends VarDeclarationProps {
|
|
11
|
-
reflection?: ComputedRef<ReflectionClass<T>>;
|
|
12
|
-
defaultValue?: ComputedRef<Partial<T> | undefined>;
|
|
13
|
-
}
|
|
14
|
-
interface TypescriptObjectPropertyProps extends ComponentProps {
|
|
15
|
-
property: ReflectionProperty;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Generates a TypeScript object for the given reflection class.
|
|
19
|
-
*/
|
|
20
|
-
declare function TypescriptObject<T extends Record<string, any> = Record<string, any>>(props: TypescriptObjectProps<T>): _alloy_js_core14.Children;
|
|
21
|
-
/**
|
|
22
|
-
* Generates a TypeScript object property for the given reflection class.
|
|
23
|
-
*/
|
|
24
|
-
declare function TypescriptObjectProperty(props: TypescriptObjectPropertyProps): _alloy_js_core14.Children;
|
|
25
|
-
declare type __ΩComputedRef = any[];
|
|
26
|
-
declare type __ΩTypescriptObjectProps = any[];
|
|
27
|
-
declare type __ΩTypescriptObjectPropertyProps = any[];
|
|
28
|
-
//#endregion
|
|
29
|
-
export { ComputedRef, TypescriptObject, TypescriptObjectProperty, TypescriptObjectPropertyProps, TypescriptObjectProps, __ΩComputedRef, __ΩTypescriptObjectPropertyProps, __ΩTypescriptObjectProps };
|
|
30
|
-
//# sourceMappingURL=typescript-object.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-object.d.cts","names":[],"sources":["../../../src/typescript/components/typescript-object.tsx"],"sourcesContent":[],"mappings":";;;;;;UAuDiB;kBACC;;AADD,UAIA,qBAHE,CAAA,UAIP,MAJO,CAAA,MAAA,EAAA,GAAA,CAAA,GAIe,MAJf,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,SAKT,mBALS,CAAA;EAGF,UAAA,CAAA,EAGF,WAHuB,CAGX,eAHW,CAGK,CAHL,CAAA,CAAA;EAC1B,YAAA,CAAA,EAGK,WAHL,CAGiB,OAHjB,CAGyB,CAHzB,CAAA,GAAA,SAAA,CAAA;;AAE+B,UAI1B,6BAAA,SAAsC,cAJZ,CAAA;EAAhB,QAAA,EAKf,kBALe;;;;;AADjB,iBAYM,gBAZN,CAAA,UAaE,MAbF,CAAA,MAAA,EAAA,GAAA,CAAA,GAawB,MAbxB,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,KAAA,EAcD,qBAdC,CAcqB,CAdrB,CAAA,CAAA,EAcoB,gBAAA,CAAG,QAdvB;;AAKV;AAOA;AACY,iBAkHI,wBAAA,CAlHJ,KAAA,EAkHoC,6BAlHpC,CAAA,EAkHiE,gBAAA,CAAA,QAlHjE;AAAsB,8BAAA,GAAA,EAAA;AACH,wCAAA,GAAA,EAAA;AAAtB,gDAAA,GAAA,EAAA"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { ComponentProps } from "../../types/components.mjs";
|
|
2
|
-
import * as _alloy_js_core11 from "@alloy-js/core";
|
|
3
|
-
import { ReflectionClass, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
|
|
4
|
-
import { VarDeclarationProps } from "@alloy-js/typescript";
|
|
5
|
-
|
|
6
|
-
//#region src/typescript/components/typescript-object.d.ts
|
|
7
|
-
interface ComputedRef<T = any> {
|
|
8
|
-
readonly value: T;
|
|
9
|
-
}
|
|
10
|
-
interface TypescriptObjectProps<T extends Record<string, any> = Record<string, any>> extends VarDeclarationProps {
|
|
11
|
-
reflection?: ComputedRef<ReflectionClass<T>>;
|
|
12
|
-
defaultValue?: ComputedRef<Partial<T> | undefined>;
|
|
13
|
-
}
|
|
14
|
-
interface TypescriptObjectPropertyProps extends ComponentProps {
|
|
15
|
-
property: ReflectionProperty;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Generates a TypeScript object for the given reflection class.
|
|
19
|
-
*/
|
|
20
|
-
declare function TypescriptObject<T extends Record<string, any> = Record<string, any>>(props: TypescriptObjectProps<T>): _alloy_js_core11.Children;
|
|
21
|
-
/**
|
|
22
|
-
* Generates a TypeScript object property for the given reflection class.
|
|
23
|
-
*/
|
|
24
|
-
declare function TypescriptObjectProperty(props: TypescriptObjectPropertyProps): _alloy_js_core11.Children;
|
|
25
|
-
declare type __ΩComputedRef = any[];
|
|
26
|
-
declare type __ΩTypescriptObjectProps = any[];
|
|
27
|
-
declare type __ΩTypescriptObjectPropertyProps = any[];
|
|
28
|
-
//#endregion
|
|
29
|
-
export { ComputedRef, TypescriptObject, TypescriptObjectProperty, TypescriptObjectPropertyProps, TypescriptObjectProps, __ΩComputedRef, __ΩTypescriptObjectPropertyProps, __ΩTypescriptObjectProps };
|
|
30
|
-
//# sourceMappingURL=typescript-object.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-object.d.mts","names":[],"sources":["../../../src/typescript/components/typescript-object.tsx"],"sourcesContent":[],"mappings":";;;;;;UAuDiB;kBACC;;AADD,UAIA,qBAHE,CAAA,UAIP,MAJO,CAAA,MAAA,EAAA,GAAA,CAAA,GAIe,MAJf,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,SAKT,mBALS,CAAA;EAGF,UAAA,CAAA,EAGF,WAHuB,CAGX,eAHW,CAGK,CAHL,CAAA,CAAA;EAC1B,YAAA,CAAA,EAGK,WAHL,CAGiB,OAHjB,CAGyB,CAHzB,CAAA,GAAA,SAAA,CAAA;;AAE+B,UAI1B,6BAAA,SAAsC,cAJZ,CAAA;EAAhB,QAAA,EAKf,kBALe;;;;;AADjB,iBAYM,gBAZN,CAAA,UAaE,MAbF,CAAA,MAAA,EAAA,GAAA,CAAA,GAawB,MAbxB,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,KAAA,EAcD,qBAdC,CAcqB,CAdrB,CAAA,CAAA,EAcoB,gBAAA,CAAG,QAdvB;;AAKV;AAOA;AACY,iBAkHI,wBAAA,CAlHJ,KAAA,EAkHoC,6BAlHpC,CAAA,EAkHiE,gBAAA,CAAA,QAlHjE;AAAsB,8BAAA,GAAA,EAAA;AACH,wCAAA,GAAA,EAAA;AAAtB,gDAAA,GAAA,EAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-object.mjs","names":["computed","Declaration","CoreDeclaration","createSymbolSlot","For","Name","Show","splitProps","createValueSymbol","ObjectExpression","ObjectProperty","TSSymbolFlags","TypeRefContext","useTSNamePolicy","stringifyDefaultValue","camelCase","pascalCase","isString","isUndefined","ReflectionClassContext","ReflectionPropertyContext","TSDocReflectionClass","TSDocReflectionProperty","TypescriptObject","props","reflection","value","objectName","name","toString","getName","objectType","type","properties","getProperties","filter","item","isIgnored","defaultValue","getNameAsString","getAlias","reduce","ret","alias","undefined","getDefaultValue","sort","a","b","isReadonly","localeCompare","TypeSymbolSlot","ValueTypeSymbolSlot","sym","refkeys","refkey","default","export","metadata","tsFlags","nullish","Nullish","None","firstSymbol","namePolicy","for","moveMembersTo","keyword","var","let","_$createComponent","children","when","Provider","override","symbol","_$memo","initializer","each","comma","doubleHardline","prop","TypescriptObjectProperty","property","_$createIntrinsic"],"sources":["../../../src/typescript/components/typescript-object.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 TypescriptObjectProps<\n T extends Record<string, any> = Record<string, any>\n> extends VarDeclarationProps {\n reflection?: ComputedRef<ReflectionClass<T>>;\n defaultValue?: ComputedRef<Partial<T> | undefined>;\n}\n\nexport interface TypescriptObjectPropertyProps extends ComponentProps {\n property: ReflectionProperty;\n}\n\n/**\n * Generates a TypeScript object for the given reflection class.\n */\nexport function TypescriptObject<\n T extends Record<string, any> = Record<string, any>\n>(props: TypescriptObjectProps<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 />\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 => <TypescriptObjectProperty property={prop} />}\n </For>\n </ObjectExpression>\n )}\n </ValueTypeSymbolSlot>\n </CoreDeclaration>\n </Show>\n <hbr />\n </ReflectionClassContext.Provider>\n </Show>\n );\n}\n\n/**\n * Generates a TypeScript object property for the given reflection class.\n */\nexport function TypescriptObjectProperty(props: TypescriptObjectPropertyProps) {\n const [{ property }] = splitProps(props, [\"property\"]);\n\n return (\n <ReflectionPropertyContext.Provider value={property}>\n <TSDocReflectionProperty />\n <ObjectProperty\n name={property.getNameAsString()}\n value={stringifyDefaultValue(property)}\n />\n <hbr />\n </ReflectionPropertyContext.Provider>\n );\n}\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-property-name.d.cts","names":[],"sources":["../../../src/typescript/components/typescript-property-name.tsx"],"sourcesContent":[],"mappings":";;;UAuBiB,2BAAA;;;AAAjB;EAkBgB,IAAA,CAAA,EAAA,MAAA;;;;;;;;;;;;iBAAA,sBAAA,QAA8B,8BAA2B,gBAAA,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-property-name.d.mts","names":[],"sources":["../../../src/typescript/components/typescript-property-name.tsx"],"sourcesContent":[],"mappings":";;;UAuBiB,2BAAA;;;AAAjB;EAkBgB,IAAA,CAAA,EAAA,MAAA;;;;;;;;;;;;iBAAA,sBAAA,QAA8B,8BAA2B,eAAA,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-property-name.mjs","names":["MemberDeclarationContext","useContext","memo","isValidJSIdentifier","TypescriptPropertyName","props","name","private","quoteIfNeeded","declSymbol","isPrivateMemberSymbol","_$memo","replace"],"sources":["../../../src/typescript/components/typescript-property-name.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { MemberDeclarationContext, useContext } from \"@alloy-js/core\";\nimport { memo } from \"@alloy-js/core/jsx-runtime\";\nimport { TSOutputSymbol } from \"@alloy-js/typescript\";\nimport { isValidJSIdentifier } from \"../helpers/utilities\";\n\nexport interface TypescriptPropertyNameProps {\n /**\n * The name of the property.\n */\n name?: string;\n\n /**\n * Whether the property is a private property. If `true`, the property will be prefixed with `#`.\n */\n private?: boolean;\n}\n\n/**\n * A TypeScript property name for an interface, class, or object member.\n *\n * @remarks\n * If the name is not a valid JavaScript identifier, it will be quoted. If a `name` prop is provided, it will be used as the property name. Otherwise, the name will be taken from the {@link (MemberDeclarationContext:variable)}.\n */\nexport function TypescriptPropertyName(props: TypescriptPropertyNameProps) {\n if (props.name) {\n return memo(() => {\n if (props.private) {\n return `#${props.name}`;\n }\n return quoteIfNeeded(props.name!);\n });\n } else {\n const declSymbol = useContext(MemberDeclarationContext) as TSOutputSymbol;\n if (!declSymbol) {\n return \"(no member declaration context)\";\n }\n\n if (declSymbol.isPrivateMemberSymbol) {\n return <>#{declSymbol.name}</>;\n } else {\n return <>{quoteIfNeeded(declSymbol.name)}</>;\n }\n }\n}\n\nfunction quoteIfNeeded(name: string) {\n if (isValidJSIdentifier(name)) {\n return name;\n } else {\n return `\"${name.replace(/\"/g, '\\\\\"')}\"`;\n }\n}\n"],"mappings":""}
|