@powerlines/plugin-alloy 0.23.40 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/core/components/output.d.cts +2 -2
  2. package/dist/core/components/single-line-comment.d.cts +2 -2
  3. package/dist/core/components/single-line-comment.d.mts +2 -2
  4. package/dist/core/components/source-file.d.cts +2 -2
  5. package/dist/core/components/source-file.d.mts +2 -2
  6. package/dist/core/components/spacing.d.cts +2 -2
  7. package/dist/core/components/spacing.d.cts.map +1 -1
  8. package/dist/markdown/components/front-matter.d.cts +2 -2
  9. package/dist/markdown/components/front-matter.d.cts.map +1 -1
  10. package/dist/markdown/components/front-matter.d.mts +2 -2
  11. package/dist/markdown/components/markdown-file.d.cts +3 -3
  12. package/dist/markdown/components/markdown-file.d.cts.map +1 -1
  13. package/dist/markdown/components/markdown-table.d.cts +4 -4
  14. package/dist/markdown/components/markdown-table.d.cts.map +1 -1
  15. package/dist/markdown/components/markdown-table.d.mts +4 -4
  16. package/dist/markdown/contexts/markdown-table.d.cts.map +1 -1
  17. package/dist/typescript/components/builtin-file.d.cts +2 -2
  18. package/dist/typescript/components/builtin-file.d.mts +2 -2
  19. package/dist/typescript/components/dynamic-import-statement.d.cts +2 -2
  20. package/dist/typescript/components/entry-file.d.cts +2 -2
  21. package/dist/typescript/components/entry-file.d.mts +2 -2
  22. package/dist/typescript/components/index.cjs +3 -0
  23. package/dist/typescript/components/index.d.cts +2 -2
  24. package/dist/typescript/components/index.d.mts +2 -2
  25. package/dist/typescript/components/index.mjs +2 -2
  26. package/dist/typescript/components/interface-declaration.cjs +6 -3
  27. package/dist/typescript/components/interface-declaration.d.cts +6 -2
  28. package/dist/typescript/components/interface-declaration.d.cts.map +1 -1
  29. package/dist/typescript/components/interface-declaration.d.mts +6 -2
  30. package/dist/typescript/components/interface-declaration.d.mts.map +1 -1
  31. package/dist/typescript/components/interface-declaration.mjs +7 -4
  32. package/dist/typescript/components/interface-declaration.mjs.map +1 -1
  33. package/dist/typescript/components/object-declaration.d.cts +3 -3
  34. package/dist/typescript/components/object-declaration.d.mts +3 -3
  35. package/dist/typescript/components/object-declaration.d.mts.map +1 -1
  36. package/dist/typescript/components/property-name.d.cts +2 -2
  37. package/dist/typescript/components/property-name.d.mts +2 -2
  38. package/dist/typescript/components/tsdoc-reflection.cjs +192 -89
  39. package/dist/typescript/components/tsdoc-reflection.d.cts +33 -8
  40. package/dist/typescript/components/tsdoc-reflection.d.cts.map +1 -1
  41. package/dist/typescript/components/tsdoc-reflection.d.mts +33 -8
  42. package/dist/typescript/components/tsdoc-reflection.d.mts.map +1 -1
  43. package/dist/typescript/components/tsdoc-reflection.mjs +193 -93
  44. package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
  45. package/dist/typescript/components/tsdoc.d.cts.map +1 -1
  46. package/dist/typescript/components/type-declaration.d.cts +2 -2
  47. package/dist/typescript/components/type-declaration.d.cts.map +1 -1
  48. package/dist/typescript/components/type-declaration.d.mts +2 -2
  49. package/dist/typescript/contexts/lexical-scope.d.cts +2 -2
  50. package/dist/typescript/contexts/lexical-scope.d.cts.map +1 -1
  51. package/dist/typescript/contexts/lexical-scope.d.mts +2 -2
  52. package/dist/typescript/contexts/lexical-scope.d.mts.map +1 -1
  53. package/dist/typescript/index.cjs +3 -0
  54. package/dist/typescript/index.d.cts +2 -2
  55. package/dist/typescript/index.d.mts +2 -2
  56. package/dist/typescript/index.mjs +2 -2
  57. package/package.json +7 -7
@@ -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":""}
@@ -1,5 +1,5 @@
1
1
  import { ComponentProps } from "../../types/components.cjs";
2
- import * as _alloy_js_core18 from "@alloy-js/core";
2
+ import * as _alloy_js_core17 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>): _alloy_js_core18.Children;
20
+ declare function ObjectDeclaration<T extends Record<string, any> = Record<string, any>>(props: ObjectDeclarationProps<T>): _alloy_js_core17.Children;
21
21
  /**
22
22
  * Generates a TypeScript object property for the given reflection class.
23
23
  */
24
- declare function ObjectDeclarationProperty(props: ObjectDeclarationPropertyProps): _alloy_js_core18.Children;
24
+ declare function ObjectDeclarationProperty(props: ObjectDeclarationPropertyProps): _alloy_js_core17.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 _alloy_js_core9 from "@alloy-js/core";
2
+ import * as _alloy_js_core18 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>): _alloy_js_core9.Children;
20
+ declare function ObjectDeclaration<T extends Record<string, any> = Record<string, any>>(props: ObjectDeclarationProps<T>): _alloy_js_core18.Children;
21
21
  /**
22
22
  * Generates a TypeScript object property for the given reflection class.
23
23
  */
24
- declare function ObjectDeclarationProperty(props: ObjectDeclarationPropertyProps): _alloy_js_core9.Children;
24
+ declare function ObjectDeclarationProperty(props: ObjectDeclarationPropertyProps): _alloy_js_core18.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,eAAA,CAAG,QAdxB;;AAKV;AAOA;AACY,iBAkHI,yBAAA,CAlHJ,KAAA,EAmHH,8BAnHG,CAAA,EAmH2B,eAAA,CAAA,QAnH3B;AAAsB,8BAAA,GAAA,EAAA;AACF,yCAAA,GAAA,EAAA;AAAvB,iDAAA,GAAA,EAAA"}
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"}
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core16 from "@alloy-js/core";
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): _alloy_js_core16.Children;
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 _alloy_js_core18 from "@alloy-js/core";
1
+ import * as _alloy_js_core16 from "@alloy-js/core";
2
2
 
3
3
  //#region src/typescript/components/property-name.d.ts
4
4
  interface PropertyNameProps {
@@ -17,7 +17,7 @@ interface PropertyNameProps {
17
17
  * @remarks
18
18
  * If the name is not a valid JavaScript identifier, it will be quoted. If a `name` prop is provided, it will be used as the property name. Otherwise, the name will be taken from the {@link (MemberDeclarationContext:variable)}.
19
19
  */
20
- declare function PropertyName(props: PropertyNameProps): _alloy_js_core18.Children;
20
+ declare function PropertyName(props: PropertyNameProps): _alloy_js_core16.Children;
21
21
  declare type __ΩPropertyNameProps = any[];
22
22
  //#endregion
23
23
  export { PropertyName, PropertyNameProps, __ΩPropertyNameProps };
@@ -1,30 +1,36 @@
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");
9
11
  let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
10
12
 
11
13
  //#region src/typescript/components/tsdoc-reflection.tsx
12
14
  /**
13
- * Generates a TypeScript interface property for the given reflection class.
15
+ * 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
16
  */
15
17
  function TSDocReflectionClass(props) {
16
- const [{ children, heading }, rest] = (0, __alloy_js_core.splitProps)(props, ["heading", "children"]);
17
- const reflectionClass = require_core_contexts_reflection.useReflectionClass();
18
- const title = (0, __alloy_js_core.computed)(() => reflectionClass.reflection.getTitle() || (0, __stryke_string_format_title_case.titleCase)(reflectionClass.reflection.getName()));
19
- const computedHeading = (0, __alloy_js_core.computed)(() => heading || reflectionClass.reflection.getDescription() || title.value);
20
- const alias = (0, __alloy_js_core.computed)(() => reflectionClass.reflection.getAlias());
21
- const domain = (0, __alloy_js_core.computed)(() => reflectionClass.reflection.getDomain());
22
- const permission = (0, __alloy_js_core.computed)(() => reflectionClass.reflection.getPermission());
23
- const readonly = (0, __alloy_js_core.computed)(() => reflectionClass.reflection.isReadonly());
24
- const internal = (0, __alloy_js_core.computed)(() => reflectionClass.reflection.isInternal());
25
- const ignore = (0, __alloy_js_core.computed)(() => reflectionClass.reflection.isIgnored());
26
- const hidden = (0, __alloy_js_core.computed)(() => reflectionClass.reflection.isHidden());
18
+ const [{ children, heading, reflection }, rest] = (0, __alloy_js_core.splitProps)(props, [
19
+ "heading",
20
+ "children",
21
+ "reflection"
22
+ ]);
23
+ const title = (0, __alloy_js_core.computed)(() => reflection.getTitle() || (0, __stryke_string_format_title_case.titleCase)(reflection.getName()));
24
+ const computedHeading = (0, __alloy_js_core.computed)(() => heading || reflection.getDescription() || title.value);
25
+ const alias = (0, __alloy_js_core.computed)(() => reflection.getAlias());
26
+ const domain = (0, __alloy_js_core.computed)(() => reflection.getDomain());
27
+ const permission = (0, __alloy_js_core.computed)(() => reflection.getPermission());
28
+ const readonly = (0, __alloy_js_core.computed)(() => reflection.isReadonly());
29
+ const internal = (0, __alloy_js_core.computed)(() => reflection.isInternal());
30
+ const ignore = (0, __alloy_js_core.computed)(() => reflection.isIgnored());
31
+ const hidden = (0, __alloy_js_core.computed)(() => reflection.isHidden());
27
32
  if (!computedHeading.value || (0, __stryke_type_checks_is_set_string.isSetString)(computedHeading.value) && computedHeading.value.trim() === "") return null;
33
+ 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
34
  return (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDoc, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
29
35
  get heading() {
30
36
  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 +38,7 @@ function TSDocReflectionClass(props) {
32
38
  get children() {
33
39
  return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
34
40
  get when() {
35
- return (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);
41
+ return hasAttributes.value;
36
42
  },
37
43
  get children() {
38
44
  return (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDocAttributesTags, {
@@ -64,115 +70,212 @@ function TSDocReflectionClass(props) {
64
70
  }
65
71
  }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
66
72
  get when() {
67
- return (0, __alloy_js_core_jsx_runtime.memo)(() => !!Boolean(children))() && (0, __alloy_js_core.childrenArray)(() => children).length > 0;
73
+ 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
74
  },
69
75
  get children() {
70
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.List, { get children() {
76
+ return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
77
+ get when() {
78
+ return hasAttributes.value;
79
+ },
80
+ get children() {
81
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(require_core_components_spacing.Spacing, {});
82
+ }
83
+ }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.List, { get children() {
71
84
  return (0, __alloy_js_core.childrenArray)(() => children);
72
- } });
85
+ } })];
73
86
  }
74
87
  })];
75
88
  }
76
89
  }));
77
90
  }
78
91
  /**
79
- * Generates a TypeScript interface property for the given reflection class.
92
+ * 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.
93
+ */
94
+ function TSDocContextClass(props) {
95
+ const reflectionClass = require_core_contexts_reflection.useReflectionClass();
96
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocReflectionClass, (0, __alloy_js_core_jsx_runtime.mergeProps)(props, { get reflection() {
97
+ return reflectionClass.reflection;
98
+ } }));
99
+ }
100
+ /**
101
+ * 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
102
  */
81
103
  function TSDocReflectionProperty(props) {
82
- const [{ children }, rest] = (0, __alloy_js_core.splitProps)(props, ["children"]);
83
- const context = require_core_contexts_reflection.useReflectionProperty();
104
+ const [{ children, reflection }, rest] = (0, __alloy_js_core.splitProps)(props, ["children", "reflection"]);
105
+ 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
106
  return (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDoc, (0, __alloy_js_core_jsx_runtime.mergeProps)({ get heading() {
85
- return context.getDescription();
107
+ return reflection.getDescription();
86
108
  } }, rest, { get children() {
87
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDocAttributesTags, {
88
- type: context,
89
- get title() {
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();
109
+ return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
110
+ get when() {
111
+ return hasAttributes.value;
112
112
  },
113
- get defaultValue() {
114
- return context.getDefaultValue();
113
+ get children() {
114
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDocAttributesTags, {
115
+ type: reflection,
116
+ get title() {
117
+ return reflection.getTitle();
118
+ },
119
+ get alias() {
120
+ return reflection.getAlias();
121
+ },
122
+ get domain() {
123
+ return reflection.getDomain();
124
+ },
125
+ get permission() {
126
+ return reflection.getPermission();
127
+ },
128
+ get readonly() {
129
+ return reflection.isReadonly();
130
+ },
131
+ get internal() {
132
+ return reflection.isInternal();
133
+ },
134
+ get ignore() {
135
+ return reflection.isIgnored();
136
+ },
137
+ get hidden() {
138
+ return reflection.isHidden();
139
+ },
140
+ get defaultValue() {
141
+ return reflection.getDefaultValue();
142
+ }
143
+ });
115
144
  }
116
145
  }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
117
146
  get when() {
118
- return (0, __alloy_js_core_jsx_runtime.memo)(() => !!Boolean(children))() && (0, __alloy_js_core.childrenArray)(() => children).length > 0;
147
+ 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
148
  },
120
149
  get children() {
121
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.List, { get children() {
150
+ return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
151
+ get when() {
152
+ return hasAttributes.value;
153
+ },
154
+ get children() {
155
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(require_core_components_spacing.Spacing, {});
156
+ }
157
+ }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.List, { get children() {
122
158
  return (0, __alloy_js_core.childrenArray)(() => children);
123
- } });
159
+ } })];
124
160
  }
125
161
  })];
126
162
  } }));
127
163
  }
128
164
  /**
129
- * Generates a TypeScript interface property for the given reflection class.
165
+ * 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.
166
+ */
167
+ function TSDocContextProperty(props) {
168
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocReflectionProperty, (0, __alloy_js_core_jsx_runtime.mergeProps)(props, { reflection: require_core_contexts_reflection.useReflectionProperty() }));
169
+ }
170
+ /**
171
+ * 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
172
  */
131
173
  function TSDocReflectionMethod(props) {
132
- const [{ children }, rest] = (0, __alloy_js_core.splitProps)(props, ["children"]);
133
- const context = require_core_contexts_reflection.useReflectionMethod();
174
+ const [{ children, reflection }, rest] = (0, __alloy_js_core.splitProps)(props, ["children", "reflection"]);
134
175
  return (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDoc, (0, __alloy_js_core_jsx_runtime.mergeProps)({ get heading() {
135
- return context.getDescription() || ((0, __stryke_type_checks_is_string.isString)(context.getName()) ? __alloy_js_core.code`${String(context.getName())} method definition` : void 0);
176
+ return reflection.getDescription() || ((0, __stryke_type_checks_is_string.isString)(reflection.getName()) ? __alloy_js_core.code`${String(reflection.getName())} method definition` : void 0);
136
177
  } }, rest, { get children() {
137
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDocAttributesTags, {
138
- get title() {
139
- return context.getTitle();
140
- },
141
- get alias() {
142
- return context.getAlias();
143
- },
144
- get domain() {
145
- return context.getDomain();
146
- },
147
- get permission() {
148
- return context.getPermission();
149
- },
150
- get readonly() {
151
- return context.isReadonly();
152
- },
153
- get internal() {
154
- return context.isInternal();
155
- },
156
- get ignore() {
157
- return context.isIgnored();
158
- },
159
- get hidden() {
160
- return context.isHidden();
161
- }
162
- }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
163
- get when() {
164
- return (0, __alloy_js_core_jsx_runtime.memo)(() => !!Boolean(children))() && (0, __alloy_js_core.childrenArray)(() => children).length > 0;
165
- },
166
- get children() {
167
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.List, { get children() {
168
- return (0, __alloy_js_core.childrenArray)(() => children);
169
- } });
170
- }
171
- })];
178
+ return [
179
+ (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDocAttributesTags, {
180
+ get title() {
181
+ return reflection.getTitle();
182
+ },
183
+ get alias() {
184
+ return reflection.getAlias();
185
+ },
186
+ get domain() {
187
+ return reflection.getDomain();
188
+ },
189
+ get permission() {
190
+ return reflection.getPermission();
191
+ },
192
+ get readonly() {
193
+ return reflection.isReadonly();
194
+ },
195
+ get internal() {
196
+ return reflection.isInternal();
197
+ },
198
+ get ignore() {
199
+ return reflection.isIgnored();
200
+ },
201
+ get hidden() {
202
+ return reflection.isHidden();
203
+ }
204
+ }),
205
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
206
+ get when() {
207
+ return (0, __alloy_js_core_jsx_runtime.memo)(() => !!Boolean(children))() && (0, __alloy_js_core.childrenArray)(() => children).length > 0;
208
+ },
209
+ get children() {
210
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.List, { get children() {
211
+ return (0, __alloy_js_core.childrenArray)(() => children);
212
+ } });
213
+ }
214
+ }),
215
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
216
+ get when() {
217
+ return reflection.getParameters().length > 0;
218
+ },
219
+ get children() {
220
+ return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_core_components_spacing.Spacing, {}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
221
+ get each() {
222
+ return reflection.getParameters();
223
+ },
224
+ hardline: true,
225
+ get ender() {
226
+ return (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {});
227
+ },
228
+ children: (param) => (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDocParam, {
229
+ get name() {
230
+ return param.getName();
231
+ },
232
+ get optional() {
233
+ return param.isOptional();
234
+ },
235
+ get defaultValue() {
236
+ return (0, __alloy_js_core_jsx_runtime.memo)(() => !!param.hasDefault())() ? param.getDefaultValue() : void 0;
237
+ },
238
+ get children() {
239
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
240
+ get when() {
241
+ return Boolean(param.parameter.description);
242
+ },
243
+ get fallback() {
244
+ return __alloy_js_core.code`A parameter to provide a ${param.getName()} value to the function.`;
245
+ },
246
+ get children() {
247
+ return param.parameter.description;
248
+ }
249
+ });
250
+ }
251
+ })
252
+ })];
253
+ }
254
+ }),
255
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
256
+ get when() {
257
+ return reflection.getReturnType().kind !== __powerlines_deepkit_vendor_type.ReflectionKind.void;
258
+ },
259
+ get children() {
260
+ 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() {
261
+ return __alloy_js_core.code`The return value of the function, which is of type ${(0, __powerlines_deepkit_vendor_type.stringifyType)(reflection.getReturnType())}.`;
262
+ } })];
263
+ }
264
+ })
265
+ ];
172
266
  } }));
173
267
  }
268
+ /**
269
+ * 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.
270
+ */
271
+ function TSDocContextMethod(props) {
272
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocReflectionMethod, (0, __alloy_js_core_jsx_runtime.mergeProps)(props, { reflection: require_core_contexts_reflection.useReflectionMethod() }));
273
+ }
174
274
 
175
275
  //#endregion
276
+ exports.TSDocContextClass = TSDocContextClass;
277
+ exports.TSDocContextMethod = TSDocContextMethod;
278
+ exports.TSDocContextProperty = TSDocContextProperty;
176
279
  exports.TSDocReflectionClass = TSDocReflectionClass;
177
280
  exports.TSDocReflectionMethod = TSDocReflectionMethod;
178
281
  exports.TSDocReflectionProperty = TSDocReflectionProperty;
@@ -1,19 +1,44 @@
1
1
  import { TSDocProps } from "./tsdoc.cjs";
2
- import * as _alloy_js_core0 from "@alloy-js/core";
2
+ import * as _alloy_js_core2 from "@alloy-js/core";
3
+ import { ReflectionClass, ReflectionMethod, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
3
4
 
4
5
  //#region src/typescript/components/tsdoc-reflection.d.ts
6
+ interface TSDocReflectionClassProps<T extends Record<string, any> = Record<string, any>> extends TSDocProps {
7
+ reflection: ReflectionClass<T>;
8
+ }
5
9
  /**
6
- * Generates a TypeScript interface property for the given reflection class.
10
+ * 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.
7
11
  */
8
- declare function TSDocReflectionClass<T extends Record<string, any> = Record<string, any>>(props: TSDocProps): _alloy_js_core0.Children;
12
+ declare function TSDocReflectionClass<T extends Record<string, any> = Record<string, any>>(props: TSDocReflectionClassProps<T>): _alloy_js_core2.Children;
9
13
  /**
10
- * Generates a TypeScript interface property for the given reflection class.
14
+ * 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.
11
15
  */
12
- declare function TSDocReflectionProperty(props: TSDocProps): _alloy_js_core0.Children;
16
+ declare function TSDocContextClass<T extends Record<string, any> = Record<string, any>>(props: TSDocProps): _alloy_js_core2.Children;
17
+ interface TSDocReflectionPropertyProps extends TSDocProps {
18
+ reflection: ReflectionProperty;
19
+ }
13
20
  /**
14
- * Generates a TypeScript interface property for the given reflection class.
21
+ * 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.
15
22
  */
16
- declare function TSDocReflectionMethod(props: TSDocProps): _alloy_js_core0.Children;
23
+ declare function TSDocReflectionProperty(props: TSDocReflectionPropertyProps): _alloy_js_core2.Children;
24
+ /**
25
+ * 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.
26
+ */
27
+ declare function TSDocContextProperty(props: TSDocProps): _alloy_js_core2.Children;
28
+ interface TSDocReflectionMethodProps extends TSDocProps {
29
+ reflection: ReflectionMethod;
30
+ }
31
+ /**
32
+ * 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.
33
+ */
34
+ declare function TSDocReflectionMethod(props: TSDocReflectionMethodProps): _alloy_js_core2.Children;
35
+ /**
36
+ * 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.
37
+ */
38
+ declare function TSDocContextMethod(props: TSDocProps): _alloy_js_core2.Children;
39
+ declare type __ΩTSDocReflectionClassProps = any[];
40
+ declare type __ΩTSDocReflectionPropertyProps = any[];
41
+ declare type __ΩTSDocReflectionMethodProps = any[];
17
42
  //#endregion
18
- export { TSDocReflectionClass, TSDocReflectionMethod, TSDocReflectionProperty };
43
+ export { TSDocContextClass, TSDocContextMethod, TSDocContextProperty, TSDocReflectionClass, TSDocReflectionClassProps, TSDocReflectionMethod, TSDocReflectionMethodProps, TSDocReflectionProperty, TSDocReflectionPropertyProps, __ΩTSDocReflectionClassProps, __ΩTSDocReflectionMethodProps, __ΩTSDocReflectionPropertyProps };
19
44
  //# sourceMappingURL=tsdoc-reflection.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tsdoc-reflection.d.cts","names":[],"sources":["../../../src/typescript/components/tsdoc-reflection.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAwCgB,iBAAA,oBAAoB,CAAA,UACxB,MADwB,CAAA,MAAA,EAAA,GAAA,CAAA,GACF,MADE,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,KAAA,EAE3B,UAF2B,CAAA,EAEjB,eAAA,CAAA,QAFiB;;;;AAEjB,iBAyEH,uBAAA,CAzEG,KAAA,EAyE4B,UAzE5B,CAAA,EAyEsC,eAAA,CAAA,QAzEtC;;AAyEnB;AA8BA;iBAAgB,qBAAA,QAA6B,aAAU,eAAA,CAAA"}
1
+ {"version":3,"file":"tsdoc-reflection.d.cts","names":[],"sources":["../../../src/typescript/components/tsdoc-reflection.tsx"],"sourcesContent":[],"mappings":";;;;;UAoDiB,oCACL,sBAAsB,6BACxB;cACI,gBAAgB;;AAH9B;;;AAG8B,iBAMd,oBANc,CAAA,UAOlB,MAPkB,CAAA,MAAA,EAAA,GAAA,CAAA,GAOI,MAPJ,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,KAAA,EAQrB,yBARqB,CAQK,CARL,CAAA,CAAA,EAQI,eAAA,CAAG,QARP;;;;AAMd,iBAgFA,iBAhFoB,CAAA,UAiFxB,MAjFwB,CAAA,MAAA,EAAA,GAAA,CAAA,GAiFF,MAjFE,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,KAAA,EAkF3B,UAlF2B,CAAA,EAkFjB,eAAA,CAAA,QAlFiB;AACxB,UAyFK,4BAAA,SAAqC,UAzF1C,CAAA;EAAsB,UAAA,EA0FpB,kBA1FoB;;;;;AA+ElB,iBAiBA,uBAAA,CAjBiB,KAAA,EAiBc,4BAjBd,CAAA,EAiB0C,eAAA,CAAA,QAjB1C;;;;AAEd,iBAqEH,oBAAA,CArEG,KAAA,EAqEyB,UArEzB,CAAA,EAqEmC,eAAA,CAAA,QArEnC;AAAA,UA2EF,0BAAA,SAAmC,UA3EjC,CAAA;EAQF,UAAA,EAoEH,gBApEG;AAOjB;AAsDA;AAMA;AAOA;AA+DgB,iBA/DA,qBAAA,CA+D0B,KAAU,EA/DP,0BA+DO,CAAA,EA/DmB,eAAA,CAAA,QA+DnB;;;;iBAApC,kBAAA,QAA0B,aAAU,eAAA,CAAA"}
@@ -1,19 +1,44 @@
1
1
  import { TSDocProps } from "./tsdoc.mjs";
2
- import * as _alloy_js_core11 from "@alloy-js/core";
2
+ import * as _alloy_js_core10 from "@alloy-js/core";
3
+ import { ReflectionClass, ReflectionMethod, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
3
4
 
4
5
  //#region src/typescript/components/tsdoc-reflection.d.ts
6
+ interface TSDocReflectionClassProps<T extends Record<string, any> = Record<string, any>> extends TSDocProps {
7
+ reflection: ReflectionClass<T>;
8
+ }
5
9
  /**
6
- * Generates a TypeScript interface property for the given reflection class.
10
+ * 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.
7
11
  */
8
- declare function TSDocReflectionClass<T extends Record<string, any> = Record<string, any>>(props: TSDocProps): _alloy_js_core11.Children;
12
+ declare function TSDocReflectionClass<T extends Record<string, any> = Record<string, any>>(props: TSDocReflectionClassProps<T>): _alloy_js_core10.Children;
9
13
  /**
10
- * Generates a TypeScript interface property for the given reflection class.
14
+ * 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.
11
15
  */
12
- declare function TSDocReflectionProperty(props: TSDocProps): _alloy_js_core11.Children;
16
+ declare function TSDocContextClass<T extends Record<string, any> = Record<string, any>>(props: TSDocProps): _alloy_js_core10.Children;
17
+ interface TSDocReflectionPropertyProps extends TSDocProps {
18
+ reflection: ReflectionProperty;
19
+ }
13
20
  /**
14
- * Generates a TypeScript interface property for the given reflection class.
21
+ * 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.
15
22
  */
16
- declare function TSDocReflectionMethod(props: TSDocProps): _alloy_js_core11.Children;
23
+ declare function TSDocReflectionProperty(props: TSDocReflectionPropertyProps): _alloy_js_core10.Children;
24
+ /**
25
+ * 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.
26
+ */
27
+ declare function TSDocContextProperty(props: TSDocProps): _alloy_js_core10.Children;
28
+ interface TSDocReflectionMethodProps extends TSDocProps {
29
+ reflection: ReflectionMethod;
30
+ }
31
+ /**
32
+ * 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.
33
+ */
34
+ declare function TSDocReflectionMethod(props: TSDocReflectionMethodProps): _alloy_js_core10.Children;
35
+ /**
36
+ * 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.
37
+ */
38
+ declare function TSDocContextMethod(props: TSDocProps): _alloy_js_core10.Children;
39
+ declare type __ΩTSDocReflectionClassProps = any[];
40
+ declare type __ΩTSDocReflectionPropertyProps = any[];
41
+ declare type __ΩTSDocReflectionMethodProps = any[];
17
42
  //#endregion
18
- export { TSDocReflectionClass, TSDocReflectionMethod, TSDocReflectionProperty };
43
+ export { TSDocContextClass, TSDocContextMethod, TSDocContextProperty, TSDocReflectionClass, TSDocReflectionClassProps, TSDocReflectionMethod, TSDocReflectionMethodProps, TSDocReflectionProperty, TSDocReflectionPropertyProps, __ΩTSDocReflectionClassProps, __ΩTSDocReflectionMethodProps, __ΩTSDocReflectionPropertyProps };
19
44
  //# sourceMappingURL=tsdoc-reflection.d.mts.map