@powerlines/plugin-alloy 0.23.40 → 0.24.1
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/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/components/spacing.d.cts +2 -2
- package/dist/core/components/spacing.d.mts +2 -2
- package/dist/core/contexts/reflection.d.cts.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.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-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/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 +3 -0
- package/dist/typescript/components/index.d.cts +2 -2
- package/dist/typescript/components/index.d.mts +2 -2
- package/dist/typescript/components/index.mjs +2 -2
- package/dist/typescript/components/interface-declaration.cjs +6 -3
- package/dist/typescript/components/interface-declaration.d.cts +6 -2
- package/dist/typescript/components/interface-declaration.d.cts.map +1 -1
- package/dist/typescript/components/interface-declaration.d.mts +6 -2
- package/dist/typescript/components/interface-declaration.d.mts.map +1 -1
- package/dist/typescript/components/interface-declaration.mjs +7 -4
- package/dist/typescript/components/interface-declaration.mjs.map +1 -1
- package/dist/typescript/components/object-declaration.cjs +4 -2
- package/dist/typescript/components/object-declaration.d.cts +3 -3
- package/dist/typescript/components/object-declaration.d.mts +3 -3
- package/dist/typescript/components/object-declaration.d.mts.map +1 -1
- package/dist/typescript/components/object-declaration.mjs +4 -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.mts +2 -2
- package/dist/typescript/components/tsdoc-reflection.cjs +220 -89
- package/dist/typescript/components/tsdoc-reflection.d.cts +33 -8
- package/dist/typescript/components/tsdoc-reflection.d.cts.map +1 -1
- package/dist/typescript/components/tsdoc-reflection.d.mts +32 -7
- package/dist/typescript/components/tsdoc-reflection.d.mts.map +1 -1
- package/dist/typescript/components/tsdoc-reflection.mjs +221 -93
- package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
- package/dist/typescript/components/tsdoc.cjs +11 -7
- package/dist/typescript/components/tsdoc.d.cts.map +1 -1
- package/dist/typescript/components/tsdoc.d.mts.map +1 -1
- package/dist/typescript/components/tsdoc.mjs +12 -8
- package/dist/typescript/components/tsdoc.mjs.map +1 -1
- package/dist/typescript/components/type-declaration.d.cts +2 -2
- package/dist/typescript/components/type-declaration.d.mts +2 -2
- package/dist/typescript/contexts/lexical-scope.d.cts +2 -2
- 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 +3 -0
- package/dist/typescript/index.d.cts +2 -2
- package/dist/typescript/index.d.mts +2 -2
- package/dist/typescript/index.mjs +2 -2
- package/package.json +17 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface-declaration.mjs","names":["Block","childrenArray","computed","createSymbol","createSymbolSlot","effect","emitSymbol","findUnkeyedChildren","For","MemberDeclaration","Name","Show","splitProps","takeSymbols","Declaration","ensureTypeRefContext","TSOutputSymbol","TSSymbolFlags","useTSLexicalScope","useTSMemberScope","useTSNamePolicy","stringifyType","pascalCase","isString","ReflectionClassContext","ReflectionPropertyContext","MemberScope","PropertyName","TSDoc","TSDocReflectionClass","TSDocReflectionProperty","TypeParameters","InterfaceExpression","props","scope","symbol","undefined","transient","binder","_$createIntrinsic","children","_$createComponent","ownerSymbol","InterfaceMember","type","readonly","when","Boolean","doc","heading","_$memo","indexer","optionality","optional","sym","name","staticMembers","refkeys","refkey","tsFlags","TypeSymbol","nullish","Nullish","None","namePolicy","for","taken","size","Array","from","isTransient","moveMembersTo","BaseInterfaceDeclaration","InterfaceDeclaration","ExprSlot","extendsPart","extends","filteredChildren","currentScope","types","default","export","metadata","ref","value","takenSymbols","_$mergeProps","nameKind","kind","typeParameters","parameters","reflection","rest","interfaceName","toString","getName","properties","getProperties","filter","item","isIgnored","sort","a","b","isReadonly","getNameAsString","localeCompare","length","fallback","Provider","each","doubleHardline","semicolon","prop","InterfaceDeclarationProperty","property","isOptional","isNullable","getType"],"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 {\n TSDocReflectionClass,\n TSDocReflectionProperty\n} 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\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={properties.value.length > 0}\n fallback={\n <BaseInterfaceDeclaration {...props} name={interfaceName.value} />\n }>\n <ReflectionClassContext.Provider\n value={{\n reflection: reflection!\n }}>\n <TSDocReflectionClass heading={doc} />\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 <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
|
+
{"version":3,"file":"interface-declaration.mjs","names":["Block","childrenArray","computed","createSymbol","createSymbolSlot","effect","emitSymbol","findUnkeyedChildren","For","MemberDeclaration","Name","Show","splitProps","takeSymbols","Declaration","ensureTypeRefContext","TSOutputSymbol","TSSymbolFlags","useTSLexicalScope","useTSMemberScope","useTSNamePolicy","stringifyType","pascalCase","isString","ReflectionClassContext","ReflectionPropertyContext","MemberScope","PropertyName","TSDoc","TSDocContextProperty","TSDocReflectionClass","TypeParameters","InterfaceExpression","props","scope","symbol","undefined","transient","binder","_$createIntrinsic","children","_$createComponent","ownerSymbol","InterfaceMember","type","readonly","when","Boolean","doc","heading","_$memo","indexer","optionality","optional","sym","name","staticMembers","refkeys","refkey","tsFlags","TypeSymbol","nullish","Nullish","None","namePolicy","for","taken","size","Array","from","isTransient","moveMembersTo","BaseInterfaceDeclaration","InterfaceDeclaration","ExprSlot","extendsPart","extends","filteredChildren","currentScope","types","default","export","metadata","ref","value","takenSymbols","_$mergeProps","nameKind","kind","typeParameters","parameters","reflection","rest","interfaceName","toString","getName","properties","getProperties","filter","item","isIgnored","sort","a","b","isReadonly","getNameAsString","localeCompare","length","fallback","Provider","each","doubleHardline","semicolon","prop","InterfaceDeclarationProperty","property","isOptional","isNullable","getType"],"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":""}
|
|
@@ -62,7 +62,9 @@ function ObjectDeclaration(props) {
|
|
|
62
62
|
return !!objectName.value && !!objectType.value;
|
|
63
63
|
},
|
|
64
64
|
get children() {
|
|
65
|
-
return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc_reflection.TSDocReflectionClass, {
|
|
65
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc_reflection.TSDocReflectionClass, { get reflection() {
|
|
66
|
+
return props.reflection.value;
|
|
67
|
+
} }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Declaration, {
|
|
66
68
|
symbol: sym,
|
|
67
69
|
get children() {
|
|
68
70
|
return [
|
|
@@ -105,7 +107,7 @@ function ObjectDeclarationProperty(props) {
|
|
|
105
107
|
value: property,
|
|
106
108
|
get children() {
|
|
107
109
|
return [
|
|
108
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc_reflection.TSDocReflectionProperty, {}),
|
|
110
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc_reflection.TSDocReflectionProperty, { reflection: property }),
|
|
109
111
|
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ObjectProperty, {
|
|
110
112
|
get name() {
|
|
111
113
|
return property.getNameAsString();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentProps } from "../../types/components.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _alloy_js_core16 from "@alloy-js/core";
|
|
3
3
|
import { ReflectionClass, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
|
|
4
4
|
import { VarDeclarationProps } from "@alloy-js/typescript";
|
|
5
5
|
|
|
@@ -17,11 +17,11 @@ interface ObjectDeclarationPropertyProps extends ComponentProps {
|
|
|
17
17
|
/**
|
|
18
18
|
* Generates a TypeScript object for the given reflection class.
|
|
19
19
|
*/
|
|
20
|
-
declare function ObjectDeclaration<T extends Record<string, any> = Record<string, any>>(props: ObjectDeclarationProps<T>):
|
|
20
|
+
declare function ObjectDeclaration<T extends Record<string, any> = Record<string, any>>(props: ObjectDeclarationProps<T>): _alloy_js_core16.Children;
|
|
21
21
|
/**
|
|
22
22
|
* Generates a TypeScript object property for the given reflection class.
|
|
23
23
|
*/
|
|
24
|
-
declare function ObjectDeclarationProperty(props: ObjectDeclarationPropertyProps):
|
|
24
|
+
declare function ObjectDeclarationProperty(props: ObjectDeclarationPropertyProps): _alloy_js_core16.Children;
|
|
25
25
|
declare type __ΩComputedRef = any[];
|
|
26
26
|
declare type __ΩObjectDeclarationProps = any[];
|
|
27
27
|
declare type __ΩObjectDeclarationPropertyProps = any[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentProps } from "../../types/components.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _alloy_js_core19 from "@alloy-js/core";
|
|
3
3
|
import { ReflectionClass, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
|
|
4
4
|
import { VarDeclarationProps } from "@alloy-js/typescript";
|
|
5
5
|
|
|
@@ -17,11 +17,11 @@ interface ObjectDeclarationPropertyProps extends ComponentProps {
|
|
|
17
17
|
/**
|
|
18
18
|
* Generates a TypeScript object for the given reflection class.
|
|
19
19
|
*/
|
|
20
|
-
declare function ObjectDeclaration<T extends Record<string, any> = Record<string, any>>(props: ObjectDeclarationProps<T>):
|
|
20
|
+
declare function ObjectDeclaration<T extends Record<string, any> = Record<string, any>>(props: ObjectDeclarationProps<T>): _alloy_js_core19.Children;
|
|
21
21
|
/**
|
|
22
22
|
* Generates a TypeScript object property for the given reflection class.
|
|
23
23
|
*/
|
|
24
|
-
declare function ObjectDeclarationProperty(props: ObjectDeclarationPropertyProps):
|
|
24
|
+
declare function ObjectDeclarationProperty(props: ObjectDeclarationPropertyProps): _alloy_js_core19.Children;
|
|
25
25
|
declare type __ΩComputedRef = any[];
|
|
26
26
|
declare type __ΩObjectDeclarationProps = any[];
|
|
27
27
|
declare type __ΩObjectDeclarationPropertyProps = any[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-declaration.d.mts","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"sourcesContent":[],"mappings":";;;;;;UAuDiB;kBACC;;AADD,UAIA,sBAHE,CAAA,UAIP,MAJO,CAAA,MAAA,EAAA,GAAA,CAAA,GAIe,MAJf,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,SAKT,mBALS,CAAA;EAGF,UAAA,CAAA,EAGF,WAHE,CAGU,eAHY,CAGI,CAHJ,CAAA,CAAA;EAC3B,YAAA,CAAA,EAGK,WAHL,CAGiB,OAHjB,CAGyB,CAHzB,CAAA,GAAA,SAAA,CAAA;;AAE+B,UAI1B,8BAAA,SAAuC,cAJb,CAAA;EAAhB,QAAA,EAKf,kBALe;;;;;AADjB,iBAYM,iBAZN,CAAA,UAaE,MAbF,CAAA,MAAA,EAAA,GAAA,CAAA,GAawB,MAbxB,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,KAAA,EAcD,sBAdC,CAcsB,CAdtB,CAAA,CAAA,EAcqB,
|
|
1
|
+
{"version":3,"file":"object-declaration.d.mts","names":[],"sources":["../../../src/typescript/components/object-declaration.tsx"],"sourcesContent":[],"mappings":";;;;;;UAuDiB;kBACC;;AADD,UAIA,sBAHE,CAAA,UAIP,MAJO,CAAA,MAAA,EAAA,GAAA,CAAA,GAIe,MAJf,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,SAKT,mBALS,CAAA;EAGF,UAAA,CAAA,EAGF,WAHE,CAGU,eAHY,CAGI,CAHJ,CAAA,CAAA;EAC3B,YAAA,CAAA,EAGK,WAHL,CAGiB,OAHjB,CAGyB,CAHzB,CAAA,GAAA,SAAA,CAAA;;AAE+B,UAI1B,8BAAA,SAAuC,cAJb,CAAA;EAAhB,QAAA,EAKf,kBALe;;;;;AADjB,iBAYM,iBAZN,CAAA,UAaE,MAbF,CAAA,MAAA,EAAA,GAAA,CAAA,GAawB,MAbxB,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,KAAA,EAcD,sBAdC,CAcsB,CAdtB,CAAA,CAAA,EAcqB,gBAAA,CAAG,QAdxB;;AAKV;AAOA;AACY,iBAkHI,yBAAA,CAlHJ,KAAA,EAmHH,8BAnHG,CAAA,EAmH2B,gBAAA,CAAA,QAnH3B;AAAsB,8BAAA,GAAA,EAAA;AACF,yCAAA,GAAA,EAAA;AAAvB,iDAAA,GAAA,EAAA"}
|
|
@@ -61,7 +61,9 @@ function ObjectDeclaration(props) {
|
|
|
61
61
|
return !!objectName.value && !!objectType.value;
|
|
62
62
|
},
|
|
63
63
|
get children() {
|
|
64
|
-
return [createComponent(TSDocReflectionClass, {
|
|
64
|
+
return [createComponent(TSDocReflectionClass, { get reflection() {
|
|
65
|
+
return props.reflection.value;
|
|
66
|
+
} }), createComponent(Declaration, {
|
|
65
67
|
symbol: sym,
|
|
66
68
|
get children() {
|
|
67
69
|
return [
|
|
@@ -104,7 +106,7 @@ function ObjectDeclarationProperty(props) {
|
|
|
104
106
|
value: property,
|
|
105
107
|
get children() {
|
|
106
108
|
return [
|
|
107
|
-
createComponent(TSDocReflectionProperty, {}),
|
|
109
|
+
createComponent(TSDocReflectionProperty, { reflection: property }),
|
|
108
110
|
createComponent(ObjectProperty, {
|
|
109
111
|
get name() {
|
|
110
112
|
return property.getNameAsString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-declaration.mjs","names":["computed","Declaration","CoreDeclaration","createSymbolSlot","For","Name","Show","splitProps","createValueSymbol","ObjectExpression","ObjectProperty","TSSymbolFlags","TypeRefContext","useTSNamePolicy","stringifyDefaultValue","camelCase","pascalCase","isString","isUndefined","ReflectionClassContext","ReflectionPropertyContext","TSDocReflectionClass","TSDocReflectionProperty","ObjectDeclaration","props","reflection","value","objectName","name","toString","getName","objectType","type","properties","getProperties","filter","item","isIgnored","defaultValue","getNameAsString","getAlias","reduce","ret","alias","undefined","getDefaultValue","sort","a","b","isReadonly","localeCompare","TypeSymbolSlot","ValueTypeSymbolSlot","sym","refkeys","refkey","default","export","metadata","tsFlags","nullish","Nullish","None","firstSymbol","namePolicy","for","moveMembersTo","keyword","var","let","_$createComponent","children","when","Provider","override","symbol","_$memo","initializer","each","comma","doubleHardline","prop","ObjectDeclarationProperty","property","_$createIntrinsic"],"sources":["../../../src/typescript/components/object-declaration.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n computed,\n Declaration as CoreDeclaration,\n createSymbolSlot,\n For,\n Name,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n createValueSymbol,\n ObjectExpression,\n ObjectProperty,\n TSSymbolFlags,\n TypeRefContext,\n useTSNamePolicy,\n VarDeclarationProps\n} from \"@alloy-js/typescript\";\nimport { stringifyDefaultValue } from \"@powerlines/deepkit/utilities\";\nimport type {\n ReflectionClass,\n ReflectionProperty\n} from \"@powerlines/deepkit/vendor/type\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport {\n ReflectionClassContext,\n ReflectionPropertyContext\n} from \"../../core/contexts/reflection\";\nimport { ComponentProps } from \"../../types/components\";\nimport {\n TSDocReflectionClass,\n TSDocReflectionProperty\n} from \"./tsdoc-reflection\";\n\nexport interface ComputedRef<T = any> {\n readonly value: T;\n}\n\nexport interface ObjectDeclarationProps<\n T extends Record<string, any> = Record<string, any>\n> extends VarDeclarationProps {\n reflection?: ComputedRef<ReflectionClass<T>>;\n defaultValue?: ComputedRef<Partial<T> | undefined>;\n}\n\nexport interface ObjectDeclarationPropertyProps extends ComponentProps {\n property: ReflectionProperty;\n}\n\n/**\n * Generates a TypeScript object for the given reflection class.\n */\nexport function ObjectDeclaration<\n T extends Record<string, any> = Record<string, any>\n>(props: ObjectDeclarationProps<T>) {\n if (!props.reflection?.value) {\n return null;\n }\n\n const objectName = computed(() =>\n camelCase(\n (isString(props.name) ? props.name : props.name.toString()) ||\n props.reflection!.value.getName()\n )\n );\n const objectType = computed(\n () => props.type || pascalCase(props.reflection!.value.getName())\n );\n const properties = computed(() =>\n props\n .reflection!.value.getProperties()\n .filter(\n item =>\n !item.isIgnored() &&\n !isUndefined(\n props.defaultValue?.value?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined(\n (props.defaultValue as Record<string, any>)?.value?.[alias]\n )\n ) {\n return (props.defaultValue as Record<string, any>)?.value?.[\n alias\n ];\n }\n\n return ret;\n }, undefined) ??\n item.getDefaultValue()\n )\n )\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) ||\n (!a.isReadonly() && !b.isReadonly())\n ? a.getNameAsString().localeCompare(b.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n )\n );\n\n const TypeSymbolSlot = createSymbolSlot();\n const ValueTypeSymbolSlot = createSymbolSlot();\n const sym = createValueSymbol(props.name, {\n refkeys: props.refkey,\n default: props.default,\n export: props.export,\n metadata: props.metadata,\n tsFlags: props.nullish ? TSSymbolFlags.Nullish : TSSymbolFlags.None,\n type: props.type ? TypeSymbolSlot.firstSymbol : undefined,\n namePolicy: useTSNamePolicy().for(\"variable\")\n });\n\n if (!props.type) {\n ValueTypeSymbolSlot.moveMembersTo(sym);\n }\n\n const keyword = props.var ? \"var\" : props.let ? \"let\" : \"const\";\n const type = props.type ? (\n <TypeRefContext>\n : <TypeSymbolSlot>{props.type}</TypeSymbolSlot>\n </TypeRefContext>\n ) : undefined;\n\n return (\n <Show when={!!props.reflection.value}>\n <ReflectionClassContext.Provider\n value={{\n reflection: props.reflection.value as ReflectionClass<any>,\n override: {\n name: objectName.value,\n type: objectType.value,\n defaultValue: props.defaultValue?.value\n }\n }}>\n <Show when={!!objectName.value && !!objectType.value}>\n <TSDocReflectionClass />\n <CoreDeclaration symbol={sym}>\n {props.export ? \"export \" : \"\"}\n {props.default ? \"default \" : \"\"}\n {keyword} <Name />\n {type} ={\" \"}\n <ValueTypeSymbolSlot>\n {props.initializer ?? props.children ?? (\n <ObjectExpression>\n <For\n each={properties.value ?? []}\n comma={true}\n doubleHardline={true}>\n {prop => <ObjectDeclarationProperty property={prop} />}\n </For>\n </ObjectExpression>\n )}\n </ValueTypeSymbolSlot>\n </CoreDeclaration>\n </Show>\n <hbr />\n </ReflectionClassContext.Provider>\n </Show>\n );\n}\n\n/**\n * Generates a TypeScript object property for the given reflection class.\n */\nexport function ObjectDeclarationProperty(\n props: ObjectDeclarationPropertyProps\n) {\n const [{ property }] = splitProps(props, [\"property\"]);\n\n return (\n <ReflectionPropertyContext.Provider value={property}>\n <TSDocReflectionProperty />\n <ObjectProperty\n name={property.getNameAsString()}\n value={stringifyDefaultValue(property)}\n />\n <hbr />\n </ReflectionPropertyContext.Provider>\n );\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"object-declaration.mjs","names":["computed","Declaration","CoreDeclaration","createSymbolSlot","For","Name","Show","splitProps","createValueSymbol","ObjectExpression","ObjectProperty","TSSymbolFlags","TypeRefContext","useTSNamePolicy","stringifyDefaultValue","camelCase","pascalCase","isString","isUndefined","ReflectionClassContext","ReflectionPropertyContext","TSDocReflectionClass","TSDocReflectionProperty","ObjectDeclaration","props","reflection","value","objectName","name","toString","getName","objectType","type","properties","getProperties","filter","item","isIgnored","defaultValue","getNameAsString","getAlias","reduce","ret","alias","undefined","getDefaultValue","sort","a","b","isReadonly","localeCompare","TypeSymbolSlot","ValueTypeSymbolSlot","sym","refkeys","refkey","default","export","metadata","tsFlags","nullish","Nullish","None","firstSymbol","namePolicy","for","moveMembersTo","keyword","var","let","_$createComponent","children","when","Provider","override","symbol","_$memo","initializer","each","comma","doubleHardline","prop","ObjectDeclarationProperty","property","_$createIntrinsic"],"sources":["../../../src/typescript/components/object-declaration.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n computed,\n Declaration as CoreDeclaration,\n createSymbolSlot,\n For,\n Name,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n createValueSymbol,\n ObjectExpression,\n ObjectProperty,\n TSSymbolFlags,\n TypeRefContext,\n useTSNamePolicy,\n VarDeclarationProps\n} from \"@alloy-js/typescript\";\nimport { stringifyDefaultValue } from \"@powerlines/deepkit/utilities\";\nimport type {\n ReflectionClass,\n ReflectionProperty\n} from \"@powerlines/deepkit/vendor/type\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport {\n ReflectionClassContext,\n ReflectionPropertyContext\n} from \"../../core/contexts/reflection\";\nimport { ComponentProps } from \"../../types/components\";\nimport {\n TSDocReflectionClass,\n TSDocReflectionProperty\n} from \"./tsdoc-reflection\";\n\nexport interface ComputedRef<T = any> {\n readonly value: T;\n}\n\nexport interface ObjectDeclarationProps<\n T extends Record<string, any> = Record<string, any>\n> extends VarDeclarationProps {\n reflection?: ComputedRef<ReflectionClass<T>>;\n defaultValue?: ComputedRef<Partial<T> | undefined>;\n}\n\nexport interface ObjectDeclarationPropertyProps extends ComponentProps {\n property: ReflectionProperty;\n}\n\n/**\n * Generates a TypeScript object for the given reflection class.\n */\nexport function ObjectDeclaration<\n T extends Record<string, any> = Record<string, any>\n>(props: ObjectDeclarationProps<T>) {\n if (!props.reflection?.value) {\n return null;\n }\n\n const objectName = computed(() =>\n camelCase(\n (isString(props.name) ? props.name : props.name.toString()) ||\n props.reflection!.value.getName()\n )\n );\n const objectType = computed(\n () => props.type || pascalCase(props.reflection!.value.getName())\n );\n const properties = computed(() =>\n props\n .reflection!.value.getProperties()\n .filter(\n item =>\n !item.isIgnored() &&\n !isUndefined(\n props.defaultValue?.value?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined(\n (props.defaultValue as Record<string, any>)?.value?.[alias]\n )\n ) {\n return (props.defaultValue as Record<string, any>)?.value?.[\n alias\n ];\n }\n\n return ret;\n }, undefined) ??\n item.getDefaultValue()\n )\n )\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) ||\n (!a.isReadonly() && !b.isReadonly())\n ? a.getNameAsString().localeCompare(b.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n )\n );\n\n const TypeSymbolSlot = createSymbolSlot();\n const ValueTypeSymbolSlot = createSymbolSlot();\n const sym = createValueSymbol(props.name, {\n refkeys: props.refkey,\n default: props.default,\n export: props.export,\n metadata: props.metadata,\n tsFlags: props.nullish ? TSSymbolFlags.Nullish : TSSymbolFlags.None,\n type: props.type ? TypeSymbolSlot.firstSymbol : undefined,\n namePolicy: useTSNamePolicy().for(\"variable\")\n });\n\n if (!props.type) {\n ValueTypeSymbolSlot.moveMembersTo(sym);\n }\n\n const keyword = props.var ? \"var\" : props.let ? \"let\" : \"const\";\n const type = props.type ? (\n <TypeRefContext>\n : <TypeSymbolSlot>{props.type}</TypeSymbolSlot>\n </TypeRefContext>\n ) : undefined;\n\n return (\n <Show when={!!props.reflection.value}>\n <ReflectionClassContext.Provider\n value={{\n reflection: props.reflection.value as ReflectionClass<any>,\n override: {\n name: objectName.value,\n type: objectType.value,\n defaultValue: props.defaultValue?.value\n }\n }}>\n <Show when={!!objectName.value && !!objectType.value}>\n <TSDocReflectionClass reflection={props.reflection.value} />\n <CoreDeclaration symbol={sym}>\n {props.export ? \"export \" : \"\"}\n {props.default ? \"default \" : \"\"}\n {keyword} <Name />\n {type} ={\" \"}\n <ValueTypeSymbolSlot>\n {props.initializer ?? props.children ?? (\n <ObjectExpression>\n <For\n each={properties.value ?? []}\n comma={true}\n doubleHardline={true}>\n {prop => <ObjectDeclarationProperty property={prop} />}\n </For>\n </ObjectExpression>\n )}\n </ValueTypeSymbolSlot>\n </CoreDeclaration>\n </Show>\n <hbr />\n </ReflectionClassContext.Provider>\n </Show>\n );\n}\n\n/**\n * Generates a TypeScript object property for the given reflection class.\n */\nexport function ObjectDeclarationProperty(\n props: ObjectDeclarationPropertyProps\n) {\n const [{ property }] = splitProps(props, [\"property\"]);\n\n return (\n <ReflectionPropertyContext.Provider value={property}>\n <TSDocReflectionProperty reflection={property} />\n <ObjectProperty\n name={property.getNameAsString()}\n value={stringifyDefaultValue(property)}\n />\n <hbr />\n </ReflectionPropertyContext.Provider>\n );\n}\n"],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core15 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):
|
|
20
|
+
declare function PropertyName(props: PropertyNameProps): _alloy_js_core15.Children;
|
|
21
21
|
declare type __ΩPropertyNameProps = any[];
|
|
22
22
|
//#endregion
|
|
23
23
|
export { PropertyName, PropertyNameProps, __ΩPropertyNameProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core17 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):
|
|
20
|
+
declare function PropertyName(props: PropertyNameProps): _alloy_js_core17.Children;
|
|
21
21
|
declare type __ΩPropertyNameProps = any[];
|
|
22
22
|
//#endregion
|
|
23
23
|
export { PropertyName, PropertyNameProps, __ΩPropertyNameProps };
|
|
@@ -1,30 +1,38 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_core_contexts_reflection = require('../../core/contexts/reflection.cjs');
|
|
3
|
+
const require_core_components_spacing = require('../../core/components/spacing.cjs');
|
|
3
4
|
const require_typescript_components_tsdoc = require('./tsdoc.cjs');
|
|
4
5
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
6
|
let __alloy_js_core = require("@alloy-js/core");
|
|
6
7
|
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
7
8
|
let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
|
|
9
|
+
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
8
10
|
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
11
|
+
let __stryke_type_checks = require("@stryke/type-checks");
|
|
9
12
|
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
10
13
|
|
|
11
14
|
//#region src/typescript/components/tsdoc-reflection.tsx
|
|
12
15
|
/**
|
|
13
|
-
* Generates a
|
|
16
|
+
* Generates a TSDoc documentation block for the given reflection class. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. This is useful for rendering additional details about the reflection that may not be included in the description, such as information about properties or methods of a class.
|
|
14
17
|
*/
|
|
15
18
|
function TSDocReflectionClass(props) {
|
|
16
|
-
const [{ children, heading }, rest] = (0, __alloy_js_core.splitProps)(props, [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
19
|
+
const [{ children, heading, reflection }, rest] = (0, __alloy_js_core.splitProps)(props, [
|
|
20
|
+
"heading",
|
|
21
|
+
"children",
|
|
22
|
+
"reflection"
|
|
23
|
+
]);
|
|
24
|
+
if (!(0, __stryke_type_checks.isSetObject)(reflection)) return null;
|
|
25
|
+
const title = (0, __alloy_js_core.computed)(() => reflection.getTitle() || (0, __stryke_string_format_title_case.titleCase)(reflection.getName()));
|
|
26
|
+
const computedHeading = (0, __alloy_js_core.computed)(() => heading || reflection.getDescription() || title.value);
|
|
27
|
+
const alias = (0, __alloy_js_core.computed)(() => reflection.getAlias());
|
|
28
|
+
const domain = (0, __alloy_js_core.computed)(() => reflection.getDomain());
|
|
29
|
+
const permission = (0, __alloy_js_core.computed)(() => reflection.getPermission());
|
|
30
|
+
const readonly = (0, __alloy_js_core.computed)(() => reflection.isReadonly());
|
|
31
|
+
const internal = (0, __alloy_js_core.computed)(() => reflection.isInternal());
|
|
32
|
+
const ignore = (0, __alloy_js_core.computed)(() => reflection.isIgnored());
|
|
33
|
+
const hidden = (0, __alloy_js_core.computed)(() => reflection.isHidden());
|
|
27
34
|
if (!computedHeading.value || (0, __stryke_type_checks_is_set_string.isSetString)(computedHeading.value) && computedHeading.value.trim() === "") return null;
|
|
35
|
+
const hasAttributes = (0, __alloy_js_core.computed)(() => (0, __stryke_type_checks_is_set_string.isSetString)(title.value) || !(0, __stryke_type_checks_is_undefined.isUndefined)(alias.value) && alias.value.length > 0 || !(0, __stryke_type_checks_is_undefined.isUndefined)(permission.value) && permission.value.length > 0 || (0, __stryke_type_checks_is_set_string.isSetString)(domain.value) || !(0, __stryke_type_checks_is_undefined.isUndefined)(readonly.value) || !(0, __stryke_type_checks_is_undefined.isUndefined)(internal.value) || !(0, __stryke_type_checks_is_undefined.isUndefined)(ignore.value) || !(0, __stryke_type_checks_is_undefined.isUndefined)(hidden.value));
|
|
28
36
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDoc, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
29
37
|
get heading() {
|
|
30
38
|
return (0, __alloy_js_core_jsx_runtime.memo)(() => !!(0, __stryke_type_checks_is_set_string.isSetString)(computedHeading.value))() ? computedHeading.value.trim() : computedHeading.value;
|
|
@@ -32,7 +40,7 @@ function TSDocReflectionClass(props) {
|
|
|
32
40
|
get children() {
|
|
33
41
|
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
34
42
|
get when() {
|
|
35
|
-
return
|
|
43
|
+
return hasAttributes.value;
|
|
36
44
|
},
|
|
37
45
|
get children() {
|
|
38
46
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDocAttributesTags, {
|
|
@@ -64,115 +72,238 @@ function TSDocReflectionClass(props) {
|
|
|
64
72
|
}
|
|
65
73
|
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
66
74
|
get when() {
|
|
67
|
-
return (0, __alloy_js_core_jsx_runtime.memo)(() =>
|
|
75
|
+
return (0, __alloy_js_core_jsx_runtime.memo)(() => !!!(0, __stryke_type_checks_is_undefined.isUndefined)(children))() && (0, __alloy_js_core.childrenArray)(() => children).filter(Boolean).length > 0;
|
|
68
76
|
},
|
|
69
77
|
get children() {
|
|
70
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.
|
|
78
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
79
|
+
get when() {
|
|
80
|
+
return hasAttributes.value;
|
|
81
|
+
},
|
|
82
|
+
get children() {
|
|
83
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_core_components_spacing.Spacing, {});
|
|
84
|
+
}
|
|
85
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.List, { get children() {
|
|
71
86
|
return (0, __alloy_js_core.childrenArray)(() => children);
|
|
72
|
-
} });
|
|
87
|
+
} })];
|
|
73
88
|
}
|
|
74
89
|
})];
|
|
75
90
|
}
|
|
76
91
|
}));
|
|
77
92
|
}
|
|
78
93
|
/**
|
|
79
|
-
*
|
|
94
|
+
* Uses the `useReflectionClass` hook to retrieve the reflection class from the context, and then renders a `TSDocReflectionClass` component with the retrieved reflection class. This is a convenience component that allows you to easily render a TSDoc documentation block for the current reflection class without having to manually retrieve the reflection class from the context.
|
|
95
|
+
*/
|
|
96
|
+
function TSDocContextClass(props) {
|
|
97
|
+
const reflectionClass = require_core_contexts_reflection.useReflectionClass();
|
|
98
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
99
|
+
get when() {
|
|
100
|
+
return (0, __stryke_type_checks.isSetObject)(reflectionClass.reflection);
|
|
101
|
+
},
|
|
102
|
+
get children() {
|
|
103
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocReflectionClass, (0, __alloy_js_core_jsx_runtime.mergeProps)(props, { get reflection() {
|
|
104
|
+
return reflectionClass.reflection;
|
|
105
|
+
} }));
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Generates a TSDoc documentation block for the given reflection property. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. This is useful for rendering additional details about the reflection that may not be included in the description, such as information about parameters of a method or properties of a class.
|
|
80
111
|
*/
|
|
81
112
|
function TSDocReflectionProperty(props) {
|
|
82
|
-
const [{ children }, rest] = (0, __alloy_js_core.splitProps)(props, ["children"]);
|
|
83
|
-
|
|
113
|
+
const [{ children, reflection }, rest] = (0, __alloy_js_core.splitProps)(props, ["children", "reflection"]);
|
|
114
|
+
if (!(0, __stryke_type_checks.isSetObject)(reflection)) return null;
|
|
115
|
+
const hasAttributes = (0, __alloy_js_core.computed)(() => (0, __stryke_type_checks_is_set_string.isSetString)(reflection.getTitle()) || !(0, __stryke_type_checks_is_undefined.isUndefined)(reflection.getAlias()) && reflection.getAlias().length > 0 || !(0, __stryke_type_checks_is_undefined.isUndefined)(reflection.getPermission()) && reflection.getPermission().length > 0 || (0, __stryke_type_checks_is_set_string.isSetString)(reflection.getDomain()) || !(0, __stryke_type_checks_is_undefined.isUndefined)(reflection.isReadonly()) || !(0, __stryke_type_checks_is_undefined.isUndefined)(reflection.isInternal()) || !(0, __stryke_type_checks_is_undefined.isUndefined)(reflection.isIgnored()) || !(0, __stryke_type_checks_is_undefined.isUndefined)(reflection.isHidden()) || reflection.hasDefault() && !(0, __stryke_type_checks_is_undefined.isUndefined)(reflection.getDefaultValue()));
|
|
84
116
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDoc, (0, __alloy_js_core_jsx_runtime.mergeProps)({ get heading() {
|
|
85
|
-
return
|
|
117
|
+
return reflection.getDescription();
|
|
86
118
|
} }, rest, { get children() {
|
|
87
|
-
return [(0, __alloy_js_core_jsx_runtime.createComponent)(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return context.getTitle();
|
|
91
|
-
},
|
|
92
|
-
get alias() {
|
|
93
|
-
return context.getAlias();
|
|
94
|
-
},
|
|
95
|
-
get domain() {
|
|
96
|
-
return context.getDomain();
|
|
97
|
-
},
|
|
98
|
-
get permission() {
|
|
99
|
-
return context.getPermission();
|
|
100
|
-
},
|
|
101
|
-
get readonly() {
|
|
102
|
-
return context.isReadonly();
|
|
103
|
-
},
|
|
104
|
-
get internal() {
|
|
105
|
-
return context.isInternal();
|
|
106
|
-
},
|
|
107
|
-
get ignore() {
|
|
108
|
-
return context.isIgnored();
|
|
109
|
-
},
|
|
110
|
-
get hidden() {
|
|
111
|
-
return context.isHidden();
|
|
119
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
120
|
+
get when() {
|
|
121
|
+
return hasAttributes.value;
|
|
112
122
|
},
|
|
113
|
-
get
|
|
114
|
-
return
|
|
123
|
+
get children() {
|
|
124
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDocAttributesTags, {
|
|
125
|
+
type: reflection,
|
|
126
|
+
get title() {
|
|
127
|
+
return reflection.getTitle();
|
|
128
|
+
},
|
|
129
|
+
get alias() {
|
|
130
|
+
return reflection.getAlias();
|
|
131
|
+
},
|
|
132
|
+
get domain() {
|
|
133
|
+
return reflection.getDomain();
|
|
134
|
+
},
|
|
135
|
+
get permission() {
|
|
136
|
+
return reflection.getPermission();
|
|
137
|
+
},
|
|
138
|
+
get readonly() {
|
|
139
|
+
return reflection.isReadonly();
|
|
140
|
+
},
|
|
141
|
+
get internal() {
|
|
142
|
+
return reflection.isInternal();
|
|
143
|
+
},
|
|
144
|
+
get ignore() {
|
|
145
|
+
return reflection.isIgnored();
|
|
146
|
+
},
|
|
147
|
+
get hidden() {
|
|
148
|
+
return reflection.isHidden();
|
|
149
|
+
},
|
|
150
|
+
get defaultValue() {
|
|
151
|
+
return reflection.getDefaultValue();
|
|
152
|
+
}
|
|
153
|
+
});
|
|
115
154
|
}
|
|
116
155
|
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
117
156
|
get when() {
|
|
118
|
-
return (0, __alloy_js_core_jsx_runtime.memo)(() =>
|
|
157
|
+
return (0, __alloy_js_core_jsx_runtime.memo)(() => !!!(0, __stryke_type_checks_is_undefined.isUndefined)(children))() && (0, __alloy_js_core.childrenArray)(() => children).filter(Boolean).length > 0;
|
|
119
158
|
},
|
|
120
159
|
get children() {
|
|
121
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.
|
|
160
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
161
|
+
get when() {
|
|
162
|
+
return hasAttributes.value;
|
|
163
|
+
},
|
|
164
|
+
get children() {
|
|
165
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_core_components_spacing.Spacing, {});
|
|
166
|
+
}
|
|
167
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.List, { get children() {
|
|
122
168
|
return (0, __alloy_js_core.childrenArray)(() => children);
|
|
123
|
-
} });
|
|
169
|
+
} })];
|
|
124
170
|
}
|
|
125
171
|
})];
|
|
126
172
|
} }));
|
|
127
173
|
}
|
|
128
174
|
/**
|
|
129
|
-
*
|
|
175
|
+
* Uses the `useReflectionProperty` hook to retrieve the reflection property from the context, and then renders a `TSDocReflectionProperty` component with the retrieved reflection property. This is a convenience component that allows you to easily render a TSDoc documentation block for the current reflection property without having to manually retrieve the reflection property from the context.
|
|
176
|
+
*/
|
|
177
|
+
function TSDocContextProperty(props) {
|
|
178
|
+
const reflection = require_core_contexts_reflection.useReflectionProperty();
|
|
179
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
180
|
+
get when() {
|
|
181
|
+
return (0, __stryke_type_checks.isSetObject)(reflection);
|
|
182
|
+
},
|
|
183
|
+
get children() {
|
|
184
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocReflectionProperty, (0, __alloy_js_core_jsx_runtime.mergeProps)(props, { reflection }));
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Generates a TSDoc documentation block for the given reflection method. This component will render the description of the reflection as the main content of the documentation block, and will render any additional attributes (such as title, alias, domain, permission, etc.) as tags in the documentation block. If there are child elements provided, they will be rendered as a list below the main content of the documentation block. Additionally, this component will render information about the parameters and return type of the method, if available.
|
|
130
190
|
*/
|
|
131
191
|
function TSDocReflectionMethod(props) {
|
|
132
|
-
const [{ children }, rest] = (0, __alloy_js_core.splitProps)(props, ["children"]);
|
|
133
|
-
|
|
192
|
+
const [{ children, reflection }, rest] = (0, __alloy_js_core.splitProps)(props, ["children", "reflection"]);
|
|
193
|
+
if (!(0, __stryke_type_checks.isSetObject)(reflection)) return null;
|
|
194
|
+
const heading = (0, __alloy_js_core.computed)(() => reflection.getDescription() || ((0, __stryke_type_checks_is_string.isString)(reflection.getName()) ? __alloy_js_core.code`${String(reflection.getName())} method definition` : void 0));
|
|
134
195
|
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDoc, (0, __alloy_js_core_jsx_runtime.mergeProps)({ get heading() {
|
|
135
|
-
return
|
|
196
|
+
return heading.value;
|
|
136
197
|
} }, rest, { get children() {
|
|
137
|
-
return [
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
198
|
+
return [
|
|
199
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDocAttributesTags, {
|
|
200
|
+
get title() {
|
|
201
|
+
return reflection.getTitle();
|
|
202
|
+
},
|
|
203
|
+
get alias() {
|
|
204
|
+
return reflection.getAlias();
|
|
205
|
+
},
|
|
206
|
+
get domain() {
|
|
207
|
+
return reflection.getDomain();
|
|
208
|
+
},
|
|
209
|
+
get permission() {
|
|
210
|
+
return reflection.getPermission();
|
|
211
|
+
},
|
|
212
|
+
get readonly() {
|
|
213
|
+
return reflection.isReadonly();
|
|
214
|
+
},
|
|
215
|
+
get internal() {
|
|
216
|
+
return reflection.isInternal();
|
|
217
|
+
},
|
|
218
|
+
get ignore() {
|
|
219
|
+
return reflection.isIgnored();
|
|
220
|
+
},
|
|
221
|
+
get hidden() {
|
|
222
|
+
return reflection.isHidden();
|
|
223
|
+
}
|
|
224
|
+
}),
|
|
225
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
226
|
+
get when() {
|
|
227
|
+
return (0, __alloy_js_core_jsx_runtime.memo)(() => !!Boolean(children))() && (0, __alloy_js_core.childrenArray)(() => children).length > 0;
|
|
228
|
+
},
|
|
229
|
+
get children() {
|
|
230
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.List, { get children() {
|
|
231
|
+
return (0, __alloy_js_core.childrenArray)(() => children);
|
|
232
|
+
} });
|
|
233
|
+
}
|
|
234
|
+
}),
|
|
235
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
236
|
+
get when() {
|
|
237
|
+
return reflection.getParameters().length > 0;
|
|
238
|
+
},
|
|
239
|
+
get children() {
|
|
240
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_core_components_spacing.Spacing, {}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
241
|
+
get each() {
|
|
242
|
+
return reflection.getParameters();
|
|
243
|
+
},
|
|
244
|
+
hardline: true,
|
|
245
|
+
get ender() {
|
|
246
|
+
return (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {});
|
|
247
|
+
},
|
|
248
|
+
children: (param) => (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDocParam, {
|
|
249
|
+
get name() {
|
|
250
|
+
return param.getName();
|
|
251
|
+
},
|
|
252
|
+
get optional() {
|
|
253
|
+
return param.isOptional();
|
|
254
|
+
},
|
|
255
|
+
get defaultValue() {
|
|
256
|
+
return (0, __alloy_js_core_jsx_runtime.memo)(() => !!param.hasDefault())() ? param.getDefaultValue() : void 0;
|
|
257
|
+
},
|
|
258
|
+
get children() {
|
|
259
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
260
|
+
get when() {
|
|
261
|
+
return Boolean(param.parameter.description);
|
|
262
|
+
},
|
|
263
|
+
get fallback() {
|
|
264
|
+
return __alloy_js_core.code`A parameter to provide a ${param.getName()} value to the function.`;
|
|
265
|
+
},
|
|
266
|
+
get children() {
|
|
267
|
+
return param.parameter.description;
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
})
|
|
272
|
+
})];
|
|
273
|
+
}
|
|
274
|
+
}),
|
|
275
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
276
|
+
get when() {
|
|
277
|
+
return reflection.getReturnType().kind !== __powerlines_deepkit_vendor_type.ReflectionKind.void;
|
|
278
|
+
},
|
|
279
|
+
get children() {
|
|
280
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_core_components_spacing.Spacing, {}), (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDocReturns, { get children() {
|
|
281
|
+
return __alloy_js_core.code`The return value of the function, which is of type ${(0, __powerlines_deepkit_vendor_type.stringifyType)(reflection.getReturnType())}.`;
|
|
282
|
+
} })];
|
|
283
|
+
}
|
|
284
|
+
})
|
|
285
|
+
];
|
|
172
286
|
} }));
|
|
173
287
|
}
|
|
288
|
+
/**
|
|
289
|
+
* Uses the `useReflectionMethod` hook to retrieve the reflection method from the context, and then renders a `TSDocReflectionMethod` component with the retrieved reflection method. This is a convenience component that allows you to easily render a TSDoc documentation block for the current reflection method without having to manually retrieve the reflection method from the context.
|
|
290
|
+
*/
|
|
291
|
+
function TSDocContextMethod(props) {
|
|
292
|
+
const reflection = require_core_contexts_reflection.useReflectionMethod();
|
|
293
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
294
|
+
get when() {
|
|
295
|
+
return (0, __stryke_type_checks.isSetObject)(reflection);
|
|
296
|
+
},
|
|
297
|
+
get children() {
|
|
298
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocReflectionMethod, (0, __alloy_js_core_jsx_runtime.mergeProps)(props, { reflection }));
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
}
|
|
174
302
|
|
|
175
303
|
//#endregion
|
|
304
|
+
exports.TSDocContextClass = TSDocContextClass;
|
|
305
|
+
exports.TSDocContextMethod = TSDocContextMethod;
|
|
306
|
+
exports.TSDocContextProperty = TSDocContextProperty;
|
|
176
307
|
exports.TSDocReflectionClass = TSDocReflectionClass;
|
|
177
308
|
exports.TSDocReflectionMethod = TSDocReflectionMethod;
|
|
178
309
|
exports.TSDocReflectionProperty = TSDocReflectionProperty;
|