@xyo-network/react-typedoc 2.64.0 → 2.64.2
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/browser/CommentViewer.js +3 -2
- package/dist/browser/CommentViewer.js.map +1 -1
- package/dist/browser/JsonViewerButton.js +4 -3
- package/dist/browser/JsonViewerButton.js.map +1 -1
- package/dist/browser/ProjectTwoPanelReflectionViewer.js +513 -5
- package/dist/browser/ProjectTwoPanelReflectionViewer.js.map +1 -1
- package/dist/browser/ReflectionViewer/Container.js +294 -7
- package/dist/browser/ReflectionViewer/Container.js.map +1 -1
- package/dist/browser/ReflectionViewer/Declaration.js +208 -7
- package/dist/browser/ReflectionViewer/Declaration.js.map +1 -1
- package/dist/browser/ReflectionViewer/DeclarationContainer.js +355 -6
- package/dist/browser/ReflectionViewer/DeclarationContainer.js.map +1 -1
- package/dist/browser/ReflectionViewer/NameViewer.js +157 -15
- package/dist/browser/ReflectionViewer/NameViewer.js.map +1 -1
- package/dist/browser/ReflectionViewer/Project.js +296 -7
- package/dist/browser/ReflectionViewer/Project.js.map +1 -1
- package/dist/browser/ReflectionViewer/ReflectionGroupViewer.js +237 -17
- package/dist/browser/ReflectionViewer/ReflectionGroupViewer.js.map +1 -1
- package/dist/browser/ReflectionViewer/ReflectionViewer.js +185 -9
- package/dist/browser/ReflectionViewer/ReflectionViewer.js.map +1 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/SomeTypeViewer.js +107 -5
- package/dist/browser/ReflectionViewer/SomeTypeViewer/SomeTypeViewer.js.map +1 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildArrayString.js +2 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildArrayString.js.map +1 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildIntersectionString.js +2 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildIntersectionString.js.map +1 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildReferenceString.js +2 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildReferenceString.js.map +1 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildReflectionString.js +2 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildReflectionString.js.map +1 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildTypeString.js +63 -6
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildTypeString.js.map +1 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildUnionString.js +2 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildUnionString.js.map +1 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/index.js +115 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/index.js.map +1 -1
- package/dist/browser/ReflectionViewer/index.js +412 -8
- package/dist/browser/ReflectionViewer/index.js.map +1 -1
- package/dist/browser/SourceViewer.js +3 -2
- package/dist/browser/SourceViewer.js.map +1 -1
- package/dist/browser/TreeViewer/Reflection.js +3 -2
- package/dist/browser/TreeViewer/Reflection.js.map +1 -1
- package/dist/browser/TreeViewer/ReflectionGroup.js +231 -11
- package/dist/browser/TreeViewer/ReflectionGroup.js.map +1 -1
- package/dist/browser/TreeViewer/index.js +299 -2
- package/dist/browser/TreeViewer/index.js.map +1 -1
- package/dist/browser/TwoPanelReflectionViewer.js +344 -18
- package/dist/browser/TwoPanelReflectionViewer.js.map +1 -1
- package/dist/browser/createLookup.js +2 -1
- package/dist/browser/createLookup.js.map +1 -1
- package/dist/browser/index.js +611 -9
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/resolveChildren.js +2 -1
- package/dist/browser/resolveChildren.js.map +1 -1
- package/dist/browser/trimFlagLabel.js +2 -1
- package/dist/browser/trimFlagLabel.js.map +1 -1
- package/dist/docs.json +72 -72
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/ReflectionViewer/Project.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport type { ProjectReflection, ReflectionGroup } from 'typedoc'\n\nimport { createLookup } from '../createLookup'\nimport { ContainerReflectionViewerProps } from './Container'\nimport { ReflectionGroupViewer } from './ReflectionGroupViewer'\nimport { ReflectionViewer } from './ReflectionViewer'\n\nexport const ProjectReflectionViewer: React.FC<ContainerReflectionViewerProps<ProjectReflection>> = ({\n reflection,\n hiddenFlags,\n itemRenderer = ReflectionViewer,\n ...props\n}) => {\n const lookup = useMemo(() => createLookup(reflection), [reflection])\n return (\n <ReflectionViewer title=\"ProjectReflectionViewer\" hiddenFlags={hiddenFlags} reflection={reflection} {...props}>\n {useMemo(() => {\n return reflection.groups?.map((group: ReflectionGroup) => {\n return (\n <ReflectionGroupViewer\n autoscroll\n variant=\"h6\"\n lookup={lookup}\n key={group.title}\n renderer={itemRenderer}\n group={group}\n reflection={reflection}\n alignItems=\"stretch\"\n hiddenFlags={hiddenFlags}\n />\n )\n })\n }, [lookup, reflection, hiddenFlags, itemRenderer])}\n </ReflectionViewer>\n )\n}\n"],"mappings":"AAoBY;AApBZ,SAAS,eAAe;AAGxB,SAAS,oBAAoB;AAE7B,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AAE1B,MAAM,0BAAuF,CAAC;AAAA,EACnG;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,GAAG;AACL,MAAM;AACJ,QAAM,SAAS,QAAQ,MAAM,aAAa,UAAU,GAAG,CAAC,UAAU,CAAC;AACnE,SACE,oBAAC,oBAAiB,OAAM,2BAA0B,aAA0B,YAAyB,GAAG,OACrG,kBAAQ,MAAM;AACb,WAAO,WAAW,QAAQ,IAAI,CAAC,UAA2B;AACxD,aACE;AAAA,QAAC;AAAA;AAAA,UACC,YAAU;AAAA,UACV,SAAQ;AAAA,UACR;AAAA,UAEA,UAAU;AAAA,UACV;AAAA,UACA;AAAA,UACA,YAAW;AAAA,UACX;AAAA;AAAA,QALK,MAAM;AAAA,MAMb;AAAA,IAEJ,CAAC;AAAA,EACH,GAAG,CAAC,QAAQ,YAAY,aAAa,YAAY,CAAC,GACpD;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/ReflectionViewer/Project.tsx","../../../src/createLookup.ts","../../../src/ReflectionViewer/ReflectionGroupViewer.tsx","../../../src/JsonViewerButton.tsx","../../../src/resolveChildren.ts","../../../src/ReflectionViewer/ReflectionViewer.tsx","../../../src/CommentViewer.tsx","../../../src/ReflectionViewer/NameViewer.tsx","../../../src/trimFlagLabel.ts","../../../src/ReflectionViewer/SomeTypeViewer/SomeTypeViewer.tsx","../../../src/ReflectionViewer/SomeTypeViewer/buildArrayString.tsx","../../../src/ReflectionViewer/SomeTypeViewer/buildIntersectionString.tsx","../../../src/ReflectionViewer/SomeTypeViewer/buildReferenceString.ts","../../../src/ReflectionViewer/SomeTypeViewer/buildReflectionString.tsx","../../../src/ReflectionViewer/SomeTypeViewer/buildUnionString.tsx","../../../src/ReflectionViewer/SomeTypeViewer/buildTypeString.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport type { ProjectReflection, ReflectionGroup } from 'typedoc'\n\nimport { createLookup } from '../createLookup'\nimport { ContainerReflectionViewerProps } from './Container'\nimport { ReflectionGroupViewer } from './ReflectionGroupViewer'\nimport { ReflectionViewer } from './ReflectionViewer'\n\nexport const ProjectReflectionViewer: React.FC<ContainerReflectionViewerProps<ProjectReflection>> = ({\n reflection,\n hiddenFlags,\n itemRenderer = ReflectionViewer,\n ...props\n}) => {\n const lookup = useMemo(() => createLookup(reflection), [reflection])\n return (\n <ReflectionViewer title=\"ProjectReflectionViewer\" hiddenFlags={hiddenFlags} reflection={reflection} {...props}>\n {useMemo(() => {\n return reflection.groups?.map((group: ReflectionGroup) => {\n return (\n <ReflectionGroupViewer\n autoscroll\n variant=\"h6\"\n lookup={lookup}\n key={group.title}\n renderer={itemRenderer}\n group={group}\n reflection={reflection}\n alignItems=\"stretch\"\n hiddenFlags={hiddenFlags}\n />\n )\n })\n }, [lookup, reflection, hiddenFlags, itemRenderer])}\n </ReflectionViewer>\n )\n}\n","import type { ContainerReflection, DeclarationReflection } from 'typedoc'\n\nexport const createLookup = <T extends DeclarationReflection>(reflection: ContainerReflection) => {\n const lookup: Record<number, T> = {}\n reflection.children?.forEach((item) => (lookup[item.id] = item as unknown as T))\n return lookup\n}\n","import { Typography } from '@mui/material'\nimport { FlexCol, FlexRow } from '@xylabs/react-flexbox'\nimport { useEffect } from 'react'\nimport { useLocation } from 'react-router-dom'\nimport type { ContainerReflection, ReflectionFlags, ReflectionGroup } from 'typedoc'\n\nimport { JsonViewerButton } from '../JsonViewerButton'\nimport { resolveChildren } from '../resolveChildren'\nimport { ReflectionViewer } from './ReflectionViewer'\nimport { FlagFilter, ReflectionViewerProps } from './ReflectionViewerProps'\n\nexport interface ReflectionGroupViewerProps extends ReflectionViewerProps<ContainerReflection> {\n autoscroll?: boolean\n group: ReflectionGroup\n reflection: ContainerReflection\n renderer?: React.FC<ReflectionViewerProps>\n}\n\nexport const ReflectionGroupViewer: React.FC<ReflectionGroupViewerProps> = ({\n autoscroll = false,\n children,\n hiddenFlags,\n group,\n lookup,\n renderer = ReflectionViewer,\n variant,\n ...props\n}) => {\n const hide = (flags?: ReflectionFlags, hiddenFlags: FlagFilter[] = []) => {\n let hide = false\n hiddenFlags.map((hiddenFlag) => {\n if (flags?.[hiddenFlag]) {\n hide = true\n }\n })\n return hide\n }\n\n const resolvedChildern = resolveChildren(group, lookup) ?? []\n\n const visibleChildren = hiddenFlags\n ? resolvedChildern.reduce((acc, item) => {\n return acc + (hide(item.flags, hiddenFlags) ? 0 : 1)\n }, 0)\n : 1\n\n const { hash } = useLocation()\n useEffect(() => {\n if (hash && autoscroll) {\n document.querySelector(hash)?.scrollIntoView({ behavior: 'smooth' })\n }\n }, [hash, autoscroll])\n return visibleChildren > 0 ? (\n <FlexCol title=\"ReflectionGroupViewer\" {...props}>\n <FlexRow marginY={1} justifyContent=\"flex-start\">\n <Typography variant={variant}>{group.title}</Typography>\n <JsonViewerButton\n jsonViewProps={{ collapsed: 1 }}\n size=\"small\"\n variant=\"contained\"\n padding={0}\n marginX={1}\n src={resolveChildren(group, lookup)}\n />\n </FlexRow>\n {resolveChildren(group, lookup).map((reflection) => {\n return reflection ? (\n // I wrap this in a div since React does not understand that they have keys using the Renderer\n <div id={reflection.name} key={reflection.id}>\n {renderer({ hiddenFlags, lookup, margin: 1, padding: 1, reflection })}\n </div>\n ) : null\n })}\n {children}\n </FlexCol>\n ) : null\n}\n","import { Dialog, DialogActions, DialogContent, DialogTitle } from '@mui/material'\nimport { ButtonEx, ButtonExProps } from '@xylabs/react-button'\nimport { lazy, Suspense, useState } from 'react'\nimport { ReactJsonViewProps } from 'react-json-view'\n\nconst JsonView = lazy(() => import(/* webpackChunkName: \"jsonView\" */ 'react-json-view'))\n\nexport interface JsonViewerButtonProps extends ButtonExProps {\n jsonViewProps?: Partial<ReactJsonViewProps>\n src: object\n}\n\nexport const JsonViewerButton: React.FC<JsonViewerButtonProps> = ({ jsonViewProps, src, title, ...props }) => {\n const [open, setOpen] = useState(false)\n return (\n <>\n <ButtonEx onClick={() => setOpen(!open)} {...props}>\n JSON\n </ButtonEx>\n <Dialog open={open} onClose={() => setOpen(false)}>\n {title ? <DialogTitle>{title}</DialogTitle> : null}\n <DialogContent>\n <Suspense fallback={<div />}>\n <JsonView src={src} {...jsonViewProps} />\n </Suspense>\n </DialogContent>\n <DialogActions>\n <ButtonEx onClick={() => setOpen(false)}>Close</ButtonEx>\n </DialogActions>\n </Dialog>\n </>\n )\n}\n","import type { Reflection } from 'typedoc'\n\nimport { ReflectionLookup } from './ReflectionLookup'\nimport { SomeReflection } from './SomeReflection'\n\ntype ReflectionWithChildren = { children: Reflection[] }\n\nexport const resolveChildren = <T extends SomeReflection>(reflection: ReflectionWithChildren, lookup: ReflectionLookup = {}): T[] => {\n return (reflection.children?.map((child) => {\n switch (typeof child) {\n case 'object':\n return child\n case 'number': {\n const childObj = lookup[child]\n if (childObj === undefined) {\n throw Error(`Child Reference Not Found [${child}]`)\n }\n return childObj\n }\n default:\n throw Error(`Invalid Child Type [${typeof child}, ${child}]`)\n }\n }) ?? []) as T[]\n}\n","import { FlexCol } from '@xylabs/react-flexbox'\nimport type { ReflectionFlags } from 'typedoc'\n\nimport { CommentViewer } from '../CommentViewer'\nimport { SomeReflection } from '../SomeReflection'\nimport { NameViewer } from './NameViewer'\nimport { FlagFilter, ReflectionViewerProps } from './ReflectionViewerProps'\n\nconst hide = (flags?: ReflectionFlags, hiddenFlags: FlagFilter[] = []) => {\n let hide = false\n hiddenFlags.map((hiddenFlag) => {\n if (flags?.[hiddenFlag]) {\n hide = true\n }\n })\n return hide\n}\n\nexport const ReflectionViewer: React.FC<ReflectionViewerProps> = ({ variant, nameViewer, children, reflection, hiddenFlags, ...props }) => {\n const someReflection = reflection as SomeReflection\n\n return hide(reflection?.flags, hiddenFlags) ? null : (\n <FlexCol title=\"ReflectionViewer\" alignItems=\"stretch\" {...props}>\n {nameViewer === undefined ? (\n <NameViewer marginY={0.25} variant={variant} reflection={someReflection} reflectionViewer={ReflectionViewer} />\n ) : (\n nameViewer\n )}\n {reflection.comment ? <CommentViewer comment={reflection.comment} /> : null}\n {/*sources && reflection.sources && children ? (\n <>\n {reflection.sources.map((source, index) => {\n return <SourceViewer key={index} source={source} />\n })}\n </>\n ) : null*/}\n {someReflection.parameters?.map((parameter) => {\n return <ReflectionViewer hiddenFlags={hiddenFlags} marginY={0.25} marginX={1} key={parameter.id} reflection={parameter} />\n }) ?? null}\n {children}\n </FlexCol>\n )\n}\n","import { Typography } from '@mui/material'\nimport { FlexBoxProps, FlexCol } from '@xylabs/react-flexbox'\nimport type { Comment } from 'typedoc'\n\nexport interface CommentViewerProps extends FlexBoxProps {\n comment: Comment\n}\n\nexport const CommentViewer: React.FC<CommentViewerProps> = ({ comment, ...props }) => {\n return (\n <FlexCol alignItems=\"stretch\" {...props}>\n <Typography variant=\"body2\">{comment.summary[0]?.text}</Typography>\n </FlexCol>\n )\n}\n","import { Chip, Stack, Typography, TypographyVariant } from '@mui/material'\nimport { FlexBoxProps, FlexRow } from '@xylabs/react-flexbox'\n\nimport { JsonViewerButton } from '../JsonViewerButton'\nimport { SomeReflection } from '../SomeReflection'\nimport { trimFlagLabel } from '../trimFlagLabel'\nimport { ReflectionViewerProps } from './ReflectionViewerProps'\nimport { SomeTypeViewer } from './SomeTypeViewer'\n\nexport interface NameViewerProps extends FlexBoxProps {\n reflection: SomeReflection\n reflectionViewer: React.FC<ReflectionViewerProps>\n variant?: TypographyVariant\n}\n\nexport const NameViewer: React.FC<NameViewerProps> = ({ reflectionViewer, variant, reflection, ...props }) => {\n return (\n <FlexRow justifyContent=\"flex-start\" {...props}>\n <FlexRow marginRight={1}>\n <Typography variant={variant} noWrap>\n {reflection.name}\n {reflection.type ? <>: </> : null}\n </Typography>\n <SomeTypeViewer reflection={reflection} reflectionViewer={reflectionViewer} />\n </FlexRow>\n <Stack direction=\"row\" spacing={1}>\n <Chip size=\"small\" label={reflection.kind} />\n {reflection.flags\n ? Object.entries(reflection.flags).map(([flag, value]) => {\n return value ? <Chip size=\"small\" key={flag} label={trimFlagLabel(flag)} variant=\"outlined\" /> : null\n })\n : null}\n </Stack>\n {document && document?.location.hostname === 'localhost' && (\n <JsonViewerButton jsonViewProps={{ collapsed: 1 }} size=\"small\" variant=\"contained\" padding={0} marginX={1} src={reflection} />\n )}\n </FlexRow>\n )\n}\n","export const trimFlagLabel = (label: string) => {\n if (label.startsWith('is')) {\n return label.substring(2)\n }\n return label\n}\n","import { Typography, TypographyProps } from '@mui/material'\n\nimport { SomeReflection } from '../../SomeReflection'\nimport { ReflectionViewerProps } from '../ReflectionViewerProps'\nimport { buildTypeString } from './buildTypeString'\n\nexport interface SomeTypeViewerProps extends TypographyProps {\n opacity?: number\n reflection: SomeReflection\n reflectionViewer: React.FC<ReflectionViewerProps>\n}\n\nexport const SomeTypeViewer: React.FC<SomeTypeViewerProps> = ({ opacity = 0.5, reflection, reflectionViewer, ...props }) => {\n const typeReactNode = reflection.type ? buildTypeString(reflection.type, reflectionViewer) : ''\n if (typeof typeReactNode === 'string') {\n return (\n <Typography title=\"SomeTypeViewer\" style={{ opacity }} {...props}>\n {typeReactNode}\n </Typography>\n )\n }\n return <>{typeReactNode}</>\n}\n","import type { ArrayType } from 'typedoc'\n\nimport { ReflectionViewerProps } from '../ReflectionViewerProps'\nimport { TypeBuilder } from './TypeBuilder'\n\nexport const buildArrayString = (typeObj: ArrayType, reflectionViewer: React.FC<ReflectionViewerProps>, typeBuilder: TypeBuilder) => {\n const parts: string[] = []\n const typeString = typeBuilder(typeObj.elementType, reflectionViewer)\n if (typeof typeString === 'string') {\n parts.push(typeString)\n }\n parts.push('[]')\n return parts\n}\n","import type { IntersectionType } from 'typedoc'\n\nimport { ReflectionViewerProps } from '../ReflectionViewerProps'\nimport { TypeBuilder } from './TypeBuilder'\n\nexport const buildIntersectionString = (typeObj: IntersectionType, reflectionViewer: React.FC<ReflectionViewerProps>, typeBuilder: TypeBuilder) => {\n const parts: string[] = []\n if (typeObj.types) {\n parts.push(\n typeObj.types\n .map((arg) => {\n return typeBuilder(arg, reflectionViewer)\n })\n .join(' & '),\n )\n }\n return parts\n}\n","import type { ReferenceType } from 'typedoc'\n\nimport { ReflectionViewerProps } from '../ReflectionViewerProps'\nimport { TypeBuilder } from './TypeBuilder'\n\nexport const buildReferenceString = (typeObj: ReferenceType, reflectionViewer: React.FC<ReflectionViewerProps>, typeBuilder: TypeBuilder) => {\n const parts: string[] = []\n parts.push(typeObj.name)\n if (typeObj.typeArguments) {\n parts.push('<')\n parts.push(\n typeObj.typeArguments\n .map((arg) => {\n return typeBuilder(arg, reflectionViewer)\n })\n .join(', '),\n )\n parts.push('>')\n }\n return parts\n}\n","import type { ReflectionType } from 'typedoc'\n\nimport { ReflectionViewerProps } from '../ReflectionViewerProps'\n\nexport const buildRelfectionString = (typeObj: ReflectionType, reflectionViewer: React.FC<ReflectionViewerProps>) => {\n if (typeObj.declaration) {\n return <>{reflectionViewer({ reflection: typeObj.declaration })}</>\n }\n}\n","import type { UnionType } from 'typedoc'\n\nimport { ReflectionViewerProps } from '../ReflectionViewerProps'\nimport { TypeBuilder } from './TypeBuilder'\n\nexport const buildUnionString = (typeObj: UnionType, reflectionViewer: React.FC<ReflectionViewerProps>, typeBuilder: TypeBuilder) => {\n const parts: string[] = []\n if (typeObj.types) {\n parts.push(\n typeObj.types\n .map((arg) => {\n return typeBuilder(arg, reflectionViewer)\n })\n .join(' | '),\n )\n }\n return parts\n}\n","import { ReactNode } from 'react'\nimport type { SomeType, Type } from 'typedoc'\n\nimport { ReflectionViewerProps } from '../ReflectionViewerProps'\nimport { buildArrayString } from './buildArrayString'\nimport { buildIntersectionString } from './buildIntersectionString'\nimport { buildReferenceString } from './buildReferenceString'\nimport { buildRelfectionString } from './buildReflectionString'\nimport { buildUnionString } from './buildUnionString'\nimport { TypeBuilder } from './TypeBuilder'\n\nexport const buildTypeString: TypeBuilder = (type: SomeType | Type, reflectionViewer: React.FC<ReflectionViewerProps>): ReactNode => {\n const someType = type as SomeType\n const parts: string[] = []\n\n switch (someType.type) {\n case 'intrinsic':\n parts.push(someType.name)\n break\n case 'intersection': {\n parts.push(...buildIntersectionString(someType, reflectionViewer, buildTypeString))\n break\n }\n case 'literal':\n parts.push(JSON.stringify(someType.value))\n break\n case 'array': {\n parts.push(...buildArrayString(someType, reflectionViewer, buildTypeString))\n break\n }\n case 'reference': {\n parts.push(...buildReferenceString(someType, reflectionViewer, buildTypeString))\n break\n }\n case 'union': {\n parts.push(...buildUnionString(someType, reflectionViewer, buildTypeString))\n break\n }\n case 'reflection': {\n return buildRelfectionString(someType, reflectionViewer)\n }\n default:\n parts.push('#')\n parts.push(someType.type)\n parts.push('#')\n break\n }\n return parts.join('')\n}\n"],"mappings":";AAAA,SAAS,eAAe;;;ACEjB,IAAM,eAAe,CAAkC,eAAoC;AAChG,QAAM,SAA4B,CAAC;AACnC,aAAW,UAAU,QAAQ,CAAC,SAAU,OA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,gBAAAA,KAAC,SAAI,IAAI,WAAW,MACjB,mBAAS,EAAE,aAAa,QAAQ,QAAQ,GAAG,SAAS,GAAG,WAAW,CAAC,KADvC,WAAW,EAE1C;AAAA,UACE;AAAA,IACN,CAAC;AAAA,IACA;AAAA,KACH,IACE;AACN;;;AFxDY,gBAAAO,YAAA;AAZL,IAAM,0BAAuF,CAAC;AAAA,EACnG;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,GAAG;AACL,MAAM;AACJ,QAAM,SAAS,QAAQ,MAAM,aAAa,UAAU,GAAG,CAAC,UAAU,CAAC;AACnE,SACE,gBAAAA,KAAC,oBAAiB,OAAM,2BAA0B,aAA0B,YAAyB,GAAG,OACrG,kBAAQ,MAAM;AACb,WAAO,WAAW,QAAQ,IAAI,CAAC,UAA2B;AACxD,aACE,gBAAAA;AAAA,QAAC;AAAA;AAAA,UACC,YAAU;AAAA,UACV,SAAQ;AAAA,UACR;AAAA,UAEA,UAAU;AAAA,UACV;AAAA,UACA;AAAA,UACA,YAAW;AAAA,UACX;AAAA;AAAA,QALK,MAAM;AAAA,MAMb;AAAA,IAEJ,CAAC;AAAA,EACH,GAAG,CAAC,QAAQ,YAAY,aAAa,YAAY,CAAC,GACpD;AAEJ;","names":["Typography","FlexCol","FlexRow","FlexCol","jsx","Typography","Typography","Fragment","jsx","Fragment","jsx","Typography","Fragment","jsx","jsxs","Typography","jsx","jsxs","hide","FlexCol","jsx","jsxs","hide","hiddenFlags","FlexCol","FlexRow","Typography","jsx"]}
|
|
@@ -1,12 +1,232 @@
|
|
|
1
|
-
|
|
2
|
-
import { Typography } from "@mui/material";
|
|
3
|
-
import { FlexCol, FlexRow } from "@xylabs/react-flexbox";
|
|
1
|
+
// src/ReflectionViewer/ReflectionGroupViewer.tsx
|
|
2
|
+
import { Typography as Typography4 } from "@mui/material";
|
|
3
|
+
import { FlexCol as FlexCol3, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
|
|
4
4
|
import { useEffect } from "react";
|
|
5
5
|
import { useLocation } from "react-router-dom";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
|
|
6
|
+
|
|
7
|
+
// src/JsonViewerButton.tsx
|
|
8
|
+
import { Dialog, DialogActions, DialogContent, DialogTitle } from "@mui/material";
|
|
9
|
+
import { ButtonEx } from "@xylabs/react-button";
|
|
10
|
+
import { lazy, Suspense, useState } from "react";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
var JsonView = lazy(() => import(
|
|
13
|
+
/* webpackChunkName: "jsonView" */
|
|
14
|
+
"react-json-view"
|
|
15
|
+
));
|
|
16
|
+
var JsonViewerButton = ({ jsonViewProps, src, title, ...props }) => {
|
|
17
|
+
const [open, setOpen] = useState(false);
|
|
18
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19
|
+
/* @__PURE__ */ jsx(ButtonEx, { onClick: () => setOpen(!open), ...props, children: "JSON" }),
|
|
20
|
+
/* @__PURE__ */ jsxs(Dialog, { open, onClose: () => setOpen(false), children: [
|
|
21
|
+
title ? /* @__PURE__ */ jsx(DialogTitle, { children: title }) : null,
|
|
22
|
+
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", {}), children: /* @__PURE__ */ jsx(JsonView, { src, ...jsonViewProps }) }) }),
|
|
23
|
+
/* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(ButtonEx, { onClick: () => setOpen(false), children: "Close" }) })
|
|
24
|
+
] })
|
|
25
|
+
] });
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// src/resolveChildren.ts
|
|
29
|
+
var resolveChildren = (reflection, lookup = {}) => {
|
|
30
|
+
return reflection.children?.map((child) => {
|
|
31
|
+
switch (typeof child) {
|
|
32
|
+
case "object":
|
|
33
|
+
return child;
|
|
34
|
+
case "number": {
|
|
35
|
+
const childObj = lookup[child];
|
|
36
|
+
if (childObj === void 0) {
|
|
37
|
+
throw Error(`Child Reference Not Found [${child}]`);
|
|
38
|
+
}
|
|
39
|
+
return childObj;
|
|
40
|
+
}
|
|
41
|
+
default:
|
|
42
|
+
throw Error(`Invalid Child Type [${typeof child}, ${child}]`);
|
|
43
|
+
}
|
|
44
|
+
}) ?? [];
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// src/ReflectionViewer/ReflectionViewer.tsx
|
|
48
|
+
import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
|
|
49
|
+
|
|
50
|
+
// src/CommentViewer.tsx
|
|
51
|
+
import { Typography } from "@mui/material";
|
|
52
|
+
import { FlexCol } from "@xylabs/react-flexbox";
|
|
53
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
54
|
+
var CommentViewer = ({ comment, ...props }) => {
|
|
55
|
+
return /* @__PURE__ */ jsx2(FlexCol, { alignItems: "stretch", ...props, children: /* @__PURE__ */ jsx2(Typography, { variant: "body2", children: comment.summary[0]?.text }) });
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// src/ReflectionViewer/NameViewer.tsx
|
|
59
|
+
import { Chip, Stack, Typography as Typography3 } from "@mui/material";
|
|
60
|
+
import { FlexRow } from "@xylabs/react-flexbox";
|
|
61
|
+
|
|
62
|
+
// src/trimFlagLabel.ts
|
|
63
|
+
var trimFlagLabel = (label) => {
|
|
64
|
+
if (label.startsWith("is")) {
|
|
65
|
+
return label.substring(2);
|
|
66
|
+
}
|
|
67
|
+
return label;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// src/ReflectionViewer/SomeTypeViewer/SomeTypeViewer.tsx
|
|
71
|
+
import { Typography as Typography2 } from "@mui/material";
|
|
72
|
+
|
|
73
|
+
// src/ReflectionViewer/SomeTypeViewer/buildArrayString.tsx
|
|
74
|
+
var buildArrayString = (typeObj, reflectionViewer, typeBuilder) => {
|
|
75
|
+
const parts = [];
|
|
76
|
+
const typeString = typeBuilder(typeObj.elementType, reflectionViewer);
|
|
77
|
+
if (typeof typeString === "string") {
|
|
78
|
+
parts.push(typeString);
|
|
79
|
+
}
|
|
80
|
+
parts.push("[]");
|
|
81
|
+
return parts;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// src/ReflectionViewer/SomeTypeViewer/buildIntersectionString.tsx
|
|
85
|
+
var buildIntersectionString = (typeObj, reflectionViewer, typeBuilder) => {
|
|
86
|
+
const parts = [];
|
|
87
|
+
if (typeObj.types) {
|
|
88
|
+
parts.push(
|
|
89
|
+
typeObj.types.map((arg) => {
|
|
90
|
+
return typeBuilder(arg, reflectionViewer);
|
|
91
|
+
}).join(" & ")
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
return parts;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// src/ReflectionViewer/SomeTypeViewer/buildReferenceString.ts
|
|
98
|
+
var buildReferenceString = (typeObj, reflectionViewer, typeBuilder) => {
|
|
99
|
+
const parts = [];
|
|
100
|
+
parts.push(typeObj.name);
|
|
101
|
+
if (typeObj.typeArguments) {
|
|
102
|
+
parts.push("<");
|
|
103
|
+
parts.push(
|
|
104
|
+
typeObj.typeArguments.map((arg) => {
|
|
105
|
+
return typeBuilder(arg, reflectionViewer);
|
|
106
|
+
}).join(", ")
|
|
107
|
+
);
|
|
108
|
+
parts.push(">");
|
|
109
|
+
}
|
|
110
|
+
return parts;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// src/ReflectionViewer/SomeTypeViewer/buildReflectionString.tsx
|
|
114
|
+
import { Fragment as Fragment2, jsx as jsx3 } from "react/jsx-runtime";
|
|
115
|
+
var buildRelfectionString = (typeObj, reflectionViewer) => {
|
|
116
|
+
if (typeObj.declaration) {
|
|
117
|
+
return /* @__PURE__ */ jsx3(Fragment2, { children: reflectionViewer({ reflection: typeObj.declaration }) });
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// src/ReflectionViewer/SomeTypeViewer/buildUnionString.tsx
|
|
122
|
+
var buildUnionString = (typeObj, reflectionViewer, typeBuilder) => {
|
|
123
|
+
const parts = [];
|
|
124
|
+
if (typeObj.types) {
|
|
125
|
+
parts.push(
|
|
126
|
+
typeObj.types.map((arg) => {
|
|
127
|
+
return typeBuilder(arg, reflectionViewer);
|
|
128
|
+
}).join(" | ")
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
return parts;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// src/ReflectionViewer/SomeTypeViewer/buildTypeString.tsx
|
|
135
|
+
var buildTypeString = (type, reflectionViewer) => {
|
|
136
|
+
const someType = type;
|
|
137
|
+
const parts = [];
|
|
138
|
+
switch (someType.type) {
|
|
139
|
+
case "intrinsic":
|
|
140
|
+
parts.push(someType.name);
|
|
141
|
+
break;
|
|
142
|
+
case "intersection": {
|
|
143
|
+
parts.push(...buildIntersectionString(someType, reflectionViewer, buildTypeString));
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
case "literal":
|
|
147
|
+
parts.push(JSON.stringify(someType.value));
|
|
148
|
+
break;
|
|
149
|
+
case "array": {
|
|
150
|
+
parts.push(...buildArrayString(someType, reflectionViewer, buildTypeString));
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
case "reference": {
|
|
154
|
+
parts.push(...buildReferenceString(someType, reflectionViewer, buildTypeString));
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
case "union": {
|
|
158
|
+
parts.push(...buildUnionString(someType, reflectionViewer, buildTypeString));
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
case "reflection": {
|
|
162
|
+
return buildRelfectionString(someType, reflectionViewer);
|
|
163
|
+
}
|
|
164
|
+
default:
|
|
165
|
+
parts.push("#");
|
|
166
|
+
parts.push(someType.type);
|
|
167
|
+
parts.push("#");
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
return parts.join("");
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// src/ReflectionViewer/SomeTypeViewer/SomeTypeViewer.tsx
|
|
174
|
+
import { Fragment as Fragment3, jsx as jsx4 } from "react/jsx-runtime";
|
|
175
|
+
var SomeTypeViewer = ({ opacity = 0.5, reflection, reflectionViewer, ...props }) => {
|
|
176
|
+
const typeReactNode = reflection.type ? buildTypeString(reflection.type, reflectionViewer) : "";
|
|
177
|
+
if (typeof typeReactNode === "string") {
|
|
178
|
+
return /* @__PURE__ */ jsx4(Typography2, { title: "SomeTypeViewer", style: { opacity }, ...props, children: typeReactNode });
|
|
179
|
+
}
|
|
180
|
+
return /* @__PURE__ */ jsx4(Fragment3, { children: typeReactNode });
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
// src/ReflectionViewer/NameViewer.tsx
|
|
184
|
+
import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
185
|
+
var NameViewer = ({ reflectionViewer, variant, reflection, ...props }) => {
|
|
186
|
+
return /* @__PURE__ */ jsxs2(FlexRow, { justifyContent: "flex-start", ...props, children: [
|
|
187
|
+
/* @__PURE__ */ jsxs2(FlexRow, { marginRight: 1, children: [
|
|
188
|
+
/* @__PURE__ */ jsxs2(Typography3, { variant, noWrap: true, children: [
|
|
189
|
+
reflection.name,
|
|
190
|
+
reflection.type ? /* @__PURE__ */ jsx5(Fragment4, { children: ":\xA0" }) : null
|
|
191
|
+
] }),
|
|
192
|
+
/* @__PURE__ */ jsx5(SomeTypeViewer, { reflection, reflectionViewer })
|
|
193
|
+
] }),
|
|
194
|
+
/* @__PURE__ */ jsxs2(Stack, { direction: "row", spacing: 1, children: [
|
|
195
|
+
/* @__PURE__ */ jsx5(Chip, { size: "small", label: reflection.kind }),
|
|
196
|
+
reflection.flags ? Object.entries(reflection.flags).map(([flag, value]) => {
|
|
197
|
+
return value ? /* @__PURE__ */ jsx5(Chip, { size: "small", label: trimFlagLabel(flag), variant: "outlined" }, flag) : null;
|
|
198
|
+
}) : null
|
|
199
|
+
] }),
|
|
200
|
+
document && document?.location.hostname === "localhost" && /* @__PURE__ */ jsx5(JsonViewerButton, { jsonViewProps: { collapsed: 1 }, size: "small", variant: "contained", padding: 0, marginX: 1, src: reflection })
|
|
201
|
+
] });
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
// src/ReflectionViewer/ReflectionViewer.tsx
|
|
205
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
206
|
+
var hide = (flags, hiddenFlags = []) => {
|
|
207
|
+
let hide2 = false;
|
|
208
|
+
hiddenFlags.map((hiddenFlag) => {
|
|
209
|
+
if (flags?.[hiddenFlag]) {
|
|
210
|
+
hide2 = true;
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
return hide2;
|
|
214
|
+
};
|
|
215
|
+
var ReflectionViewer = ({ variant, nameViewer, children, reflection, hiddenFlags, ...props }) => {
|
|
216
|
+
const someReflection = reflection;
|
|
217
|
+
return hide(reflection?.flags, hiddenFlags) ? null : /* @__PURE__ */ jsxs3(FlexCol2, { title: "ReflectionViewer", alignItems: "stretch", ...props, children: [
|
|
218
|
+
nameViewer === void 0 ? /* @__PURE__ */ jsx6(NameViewer, { marginY: 0.25, variant, reflection: someReflection, reflectionViewer: ReflectionViewer }) : nameViewer,
|
|
219
|
+
reflection.comment ? /* @__PURE__ */ jsx6(CommentViewer, { comment: reflection.comment }) : null,
|
|
220
|
+
someReflection.parameters?.map((parameter) => {
|
|
221
|
+
return /* @__PURE__ */ jsx6(ReflectionViewer, { hiddenFlags, marginY: 0.25, marginX: 1, reflection: parameter }, parameter.id);
|
|
222
|
+
}) ?? null,
|
|
223
|
+
children
|
|
224
|
+
] });
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
// src/ReflectionViewer/ReflectionGroupViewer.tsx
|
|
228
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
229
|
+
var ReflectionGroupViewer = ({
|
|
10
230
|
autoscroll = false,
|
|
11
231
|
children,
|
|
12
232
|
hiddenFlags,
|
|
@@ -16,18 +236,18 @@ const ReflectionGroupViewer = ({
|
|
|
16
236
|
variant,
|
|
17
237
|
...props
|
|
18
238
|
}) => {
|
|
19
|
-
const
|
|
20
|
-
let
|
|
239
|
+
const hide2 = (flags, hiddenFlags2 = []) => {
|
|
240
|
+
let hide3 = false;
|
|
21
241
|
hiddenFlags2.map((hiddenFlag) => {
|
|
22
242
|
if (flags?.[hiddenFlag]) {
|
|
23
|
-
|
|
243
|
+
hide3 = true;
|
|
24
244
|
}
|
|
25
245
|
});
|
|
26
|
-
return
|
|
246
|
+
return hide3;
|
|
27
247
|
};
|
|
28
248
|
const resolvedChildern = resolveChildren(group, lookup) ?? [];
|
|
29
249
|
const visibleChildren = hiddenFlags ? resolvedChildern.reduce((acc, item) => {
|
|
30
|
-
return acc + (
|
|
250
|
+
return acc + (hide2(item.flags, hiddenFlags) ? 0 : 1);
|
|
31
251
|
}, 0) : 1;
|
|
32
252
|
const { hash } = useLocation();
|
|
33
253
|
useEffect(() => {
|
|
@@ -35,10 +255,10 @@ const ReflectionGroupViewer = ({
|
|
|
35
255
|
document.querySelector(hash)?.scrollIntoView({ behavior: "smooth" });
|
|
36
256
|
}
|
|
37
257
|
}, [hash, autoscroll]);
|
|
38
|
-
return visibleChildren > 0 ? /* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
/* @__PURE__ */
|
|
258
|
+
return visibleChildren > 0 ? /* @__PURE__ */ jsxs4(FlexCol3, { title: "ReflectionGroupViewer", ...props, children: [
|
|
259
|
+
/* @__PURE__ */ jsxs4(FlexRow2, { marginY: 1, justifyContent: "flex-start", children: [
|
|
260
|
+
/* @__PURE__ */ jsx7(Typography4, { variant, children: group.title }),
|
|
261
|
+
/* @__PURE__ */ jsx7(
|
|
42
262
|
JsonViewerButton,
|
|
43
263
|
{
|
|
44
264
|
jsonViewProps: { collapsed: 1 },
|
|
@@ -53,7 +273,7 @@ const ReflectionGroupViewer = ({
|
|
|
53
273
|
resolveChildren(group, lookup).map((reflection) => {
|
|
54
274
|
return reflection ? (
|
|
55
275
|
// I wrap this in a div since React does not understand that they have keys using the Renderer
|
|
56
|
-
/* @__PURE__ */
|
|
276
|
+
/* @__PURE__ */ jsx7("div", { id: reflection.name, children: renderer({ hiddenFlags, lookup, margin: 1, padding: 1, reflection }) }, reflection.id)
|
|
57
277
|
) : null;
|
|
58
278
|
}),
|
|
59
279
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/ReflectionViewer/ReflectionGroupViewer.tsx"],"sourcesContent":["import { Typography } from '@mui/material'\nimport { FlexCol, FlexRow } from '@xylabs/react-flexbox'\nimport { useEffect } from 'react'\nimport { useLocation } from 'react-router-dom'\nimport type { ContainerReflection, ReflectionFlags, ReflectionGroup } from 'typedoc'\n\nimport { JsonViewerButton } from '../JsonViewerButton'\nimport { resolveChildren } from '../resolveChildren'\nimport { ReflectionViewer } from './ReflectionViewer'\nimport { FlagFilter, ReflectionViewerProps } from './ReflectionViewerProps'\n\nexport interface ReflectionGroupViewerProps extends ReflectionViewerProps<ContainerReflection> {\n autoscroll?: boolean\n group: ReflectionGroup\n reflection: ContainerReflection\n renderer?: React.FC<ReflectionViewerProps>\n}\n\nexport const ReflectionGroupViewer: React.FC<ReflectionGroupViewerProps> = ({\n autoscroll = false,\n children,\n hiddenFlags,\n group,\n lookup,\n renderer = ReflectionViewer,\n variant,\n ...props\n}) => {\n const hide = (flags?: ReflectionFlags, hiddenFlags: FlagFilter[] = []) => {\n let hide = false\n hiddenFlags.map((hiddenFlag) => {\n if (flags?.[hiddenFlag]) {\n hide = true\n }\n })\n return hide\n }\n\n const resolvedChildern = resolveChildren(group, lookup) ?? []\n\n const visibleChildren = hiddenFlags\n ? resolvedChildern.reduce((acc, item) => {\n return acc + (hide(item.flags, hiddenFlags) ? 0 : 1)\n }, 0)\n : 1\n\n const { hash } = useLocation()\n useEffect(() => {\n if (hash && autoscroll) {\n document.querySelector(hash)?.scrollIntoView({ behavior: 'smooth' })\n }\n }, [hash, autoscroll])\n return visibleChildren > 0 ? (\n <FlexCol title=\"ReflectionGroupViewer\" {...props}>\n <FlexRow marginY={1} justifyContent=\"flex-start\">\n <Typography variant={variant}>{group.title}</Typography>\n <JsonViewerButton\n jsonViewProps={{ collapsed: 1 }}\n size=\"small\"\n variant=\"contained\"\n padding={0}\n marginX={1}\n src={resolveChildren(group, lookup)}\n />\n </FlexRow>\n {resolveChildren(group, lookup).map((reflection) => {\n return reflection ? (\n // I wrap this in a div since React does not understand that they have keys using the Renderer\n <div id={reflection.name} key={reflection.id}>\n {renderer({ hiddenFlags, lookup, margin: 1, padding: 1, reflection })}\n </div>\n ) : null\n })}\n {children}\n </FlexCol>\n ) : null\n}\n"],"mappings":"AAsDM,SACE,KADF;AAtDN,SAAS,kBAAkB;AAC3B,SAAS,SAAS,eAAe;AACjC,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAG5B,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AAU1B,MAAM,wBAA8D,CAAC;AAAA,EAC1E,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,OAAO,CAAC,OAAyBA,eAA4B,CAAC,MAAM;AACxE,QAAIC,QAAO;AACX,IAAAD,aAAY,IAAI,CAAC,eAAe;AAC9B,UAAI,QAAQ,UAAU,GAAG;AACvB,QAAAC,QAAO;AAAA,MACT;AAAA,IACF,CAAC;AACD,WAAOA;AAAA,EACT;AAEA,QAAM,mBAAmB,gBAAgB,OAAO,MAAM,KAAK,CAAC;AAE5D,QAAM,kBAAkB,cACpB,iBAAiB,OAAO,CAAC,KAAK,SAAS;AACrC,WAAO,OAAO,KAAK,KAAK,OAAO,WAAW,IAAI,IAAI;AAAA,EACpD,GAAG,CAAC,IACJ;AAEJ,QAAM,EAAE,KAAK,IAAI,YAAY;AAC7B,YAAU,MAAM;AACd,QAAI,QAAQ,YAAY;AACtB,eAAS,cAAc,IAAI,GAAG,eAAe,EAAE,UAAU,SAAS,CAAC;AAAA,IACrE;AAAA,EACF,GAAG,CAAC,MAAM,UAAU,CAAC;AACrB,SAAO,kBAAkB,IACvB,qBAAC,WAAQ,OAAM,yBAAyB,GAAG,OACzC;AAAA,yBAAC,WAAQ,SAAS,GAAG,gBAAe,cAClC;AAAA,0BAAC,cAAW,SAAmB,gBAAM,OAAM;AAAA,MAC3C;AAAA,QAAC;AAAA;AAAA,UACC,eAAe,EAAE,WAAW,EAAE;AAAA,UAC9B,MAAK;AAAA,UACL,SAAQ;AAAA,UACR,SAAS;AAAA,UACT,SAAS;AAAA,UACT,KAAK,gBAAgB,OAAO,MAAM;AAAA;AAAA,MACpC;AAAA,OACF;AAAA,IACC,gBAAgB,OAAO,MAAM,EAAE,IAAI,CAAC,eAAe;AAClD,aAAO;AAAA;AAAA,QAEL,oBAAC,SAAI,IAAI,WAAW,MACjB,mBAAS,EAAE,aAAa,QAAQ,QAAQ,GAAG,SAAS,GAAG,WAAW,CAAC,KADvC,WAAW,EAE1C;AAAA,UACE;AAAA,IACN,CAAC;AAAA,IACA;AAAA,KACH,IACE;AACN;","names":["hiddenFlags","hide"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/ReflectionViewer/ReflectionGroupViewer.tsx","../../../src/JsonViewerButton.tsx","../../../src/resolveChildren.ts","../../../src/ReflectionViewer/ReflectionViewer.tsx","../../../src/CommentViewer.tsx","../../../src/ReflectionViewer/NameViewer.tsx","../../../src/trimFlagLabel.ts","../../../src/ReflectionViewer/SomeTypeViewer/SomeTypeViewer.tsx","../../../src/ReflectionViewer/SomeTypeViewer/buildArrayString.tsx","../../../src/ReflectionViewer/SomeTypeViewer/buildIntersectionString.tsx","../../../src/ReflectionViewer/SomeTypeViewer/buildReferenceString.ts","../../../src/ReflectionViewer/SomeTypeViewer/buildReflectionString.tsx","../../../src/ReflectionViewer/SomeTypeViewer/buildUnionString.tsx","../../../src/ReflectionViewer/SomeTypeViewer/buildTypeString.tsx"],"sourcesContent":["import { Typography } from '@mui/material'\nimport { FlexCol, FlexRow } from '@xylabs/react-flexbox'\nimport { useEffect } from 'react'\nimport { useLocation } from 'react-router-dom'\nimport type { ContainerReflection, ReflectionFlags, ReflectionGroup } from 'typedoc'\n\nimport { JsonViewerButton } from '../JsonViewerButton'\nimport { resolveChildren } from '../resolveChildren'\nimport { ReflectionViewer } from './ReflectionViewer'\nimport { FlagFilter, ReflectionViewerProps } from './ReflectionViewerProps'\n\nexport interface ReflectionGroupViewerProps extends ReflectionViewerProps<ContainerReflection> {\n autoscroll?: boolean\n group: ReflectionGroup\n reflection: ContainerReflection\n renderer?: React.FC<ReflectionViewerProps>\n}\n\nexport const ReflectionGroupViewer: React.FC<ReflectionGroupViewerProps> = ({\n autoscroll = false,\n children,\n hiddenFlags,\n group,\n lookup,\n renderer = ReflectionViewer,\n variant,\n ...props\n}) => {\n const hide = (flags?: ReflectionFlags, hiddenFlags: FlagFilter[] = []) => {\n let hide = false\n hiddenFlags.map((hiddenFlag) => {\n if (flags?.[hiddenFlag]) {\n hide = true\n }\n })\n return hide\n }\n\n const resolvedChildern = resolveChildren(group, lookup) ?? []\n\n const visibleChildren = hiddenFlags\n ? resolvedChildern.reduce((acc, item) => {\n return acc + (hide(item.flags, hiddenFlags) ? 0 : 1)\n }, 0)\n : 1\n\n const { hash } = useLocation()\n useEffect(() => {\n if (hash && autoscroll) {\n document.querySelector(hash)?.scrollIntoView({ behavior: 'smooth' })\n }\n }, [hash, autoscroll])\n return visibleChildren > 0 ? (\n <FlexCol title=\"ReflectionGroupViewer\" {...props}>\n <FlexRow marginY={1} justifyContent=\"flex-start\">\n <Typography variant={variant}>{group.title}</Typography>\n <JsonViewerButton\n jsonViewProps={{ collapsed: 1 }}\n size=\"small\"\n variant=\"contained\"\n padding={0}\n marginX={1}\n src={resolveChildren(group, lookup)}\n />\n </FlexRow>\n {resolveChildren(group, lookup).map((reflection) => {\n return reflection ? (\n // I wrap this in a div since React does not understand that they have keys using the Renderer\n <div id={reflection.name} key={reflection.id}>\n {renderer({ hiddenFlags, lookup, margin: 1, padding: 1, reflection })}\n </div>\n ) : null\n })}\n {children}\n </FlexCol>\n ) : null\n}\n","import { Dialog, DialogActions, DialogContent, DialogTitle } from '@mui/material'\nimport { ButtonEx, ButtonExProps } from '@xylabs/react-button'\nimport { lazy, Suspense, useState } from 'react'\nimport { ReactJsonViewProps } from 'react-json-view'\n\nconst JsonView = lazy(() => import(/* webpackChunkName: \"jsonView\" */ 'react-json-view'))\n\nexport interface JsonViewerButtonProps extends ButtonExProps {\n jsonViewProps?: Partial<ReactJsonViewProps>\n src: object\n}\n\nexport const JsonViewerButton: React.FC<JsonViewerButtonProps> = ({ jsonViewProps, src, title, ...props }) => {\n const [open, setOpen] = useState(false)\n return (\n <>\n <ButtonEx onClick={() => setOpen(!open)} {...props}>\n JSON\n </ButtonEx>\n <Dialog open={open} onClose={() => setOpen(false)}>\n {title ? <DialogTitle>{title}</DialogTitle> : null}\n <DialogContent>\n <Suspense fallback={<div />}>\n <JsonView src={src} {...jsonViewProps} />\n </Suspense>\n </DialogContent>\n <DialogActions>\n <ButtonEx onClick={() => setOpen(false)}>Close</ButtonEx>\n </DialogActions>\n </Dialog>\n </>\n )\n}\n","import type { Reflection } from 'typedoc'\n\nimport { ReflectionLookup } from './ReflectionLookup'\nimport { SomeReflection } from './SomeReflection'\n\ntype ReflectionWithChildren = { children: Reflection[] }\n\nexport const resolveChildren = <T extends SomeReflection>(reflection: ReflectionWithChildren, lookup: ReflectionLookup = {}): T[] => {\n return (reflection.children?.map((child) => {\n switch (typeof child) {\n case 'object':\n return child\n case 'number': {\n const childObj = lookup[child]\n if (childObj === undefined) {\n throw Error(`Child Reference Not Found [${child}]`)\n }\n return childObj\n }\n default:\n throw Error(`Invalid Child Type [${typeof child}, ${child}]`)\n }\n }) ?? []) as T[]\n}\n","import { FlexCol } from '@xylabs/react-flexbox'\nimport type { ReflectionFlags } from 'typedoc'\n\nimport { CommentViewer } from '../CommentViewer'\nimport { SomeReflection } from '../SomeReflection'\nimport { NameViewer } from './NameViewer'\nimport { FlagFilter, ReflectionViewerProps } from './ReflectionViewerProps'\n\nconst hide = (flags?: ReflectionFlags, hiddenFlags: FlagFilter[] = []) => {\n let hide = false\n hiddenFlags.map((hiddenFlag) => {\n if (flags?.[hiddenFlag]) {\n hide = true\n }\n })\n return hide\n}\n\nexport const ReflectionViewer: React.FC<ReflectionViewerProps> = ({ variant, nameViewer, children, reflection, hiddenFlags, ...props }) => {\n const someReflection = reflection as SomeReflection\n\n return hide(reflection?.flags, hiddenFlags) ? null : (\n <FlexCol title=\"ReflectionViewer\" alignItems=\"stretch\" {...props}>\n {nameViewer === undefined ? (\n <NameViewer marginY={0.25} variant={variant} reflection={someReflection} reflectionViewer={ReflectionViewer} />\n ) : (\n nameViewer\n )}\n {reflection.comment ? <CommentViewer comment={reflection.comment} /> : null}\n {/*sources && reflection.sources && children ? (\n <>\n {reflection.sources.map((source, index) => {\n return <SourceViewer key={index} source={source} />\n })}\n </>\n ) : null*/}\n {someReflection.parameters?.map((parameter) => {\n return <ReflectionViewer hiddenFlags={hiddenFlags} marginY={0.25} marginX={1} key={parameter.id} reflection={parameter} />\n }) ?? null}\n {children}\n </FlexCol>\n )\n}\n","import { Typography } from '@mui/material'\nimport { FlexBoxProps, FlexCol } from '@xylabs/react-flexbox'\nimport type { Comment } from 'typedoc'\n\nexport interface CommentViewerProps extends FlexBoxProps {\n comment: Comment\n}\n\nexport const CommentViewer: React.FC<CommentViewerProps> = ({ comment, ...props }) => {\n return (\n <FlexCol alignItems=\"stretch\" {...props}>\n <Typography variant=\"body2\">{comment.summary[0]?.text}</Typography>\n </FlexCol>\n )\n}\n","import { Chip, Stack, Typography, TypographyVariant } from '@mui/material'\nimport { FlexBoxProps, FlexRow } from '@xylabs/react-flexbox'\n\nimport { JsonViewerButton } from '../JsonViewerButton'\nimport { SomeReflection } from '../SomeReflection'\nimport { trimFlagLabel } from '../trimFlagLabel'\nimport { ReflectionViewerProps } from './ReflectionViewerProps'\nimport { SomeTypeViewer } from './SomeTypeViewer'\n\nexport interface NameViewerProps extends FlexBoxProps {\n reflection: SomeReflection\n reflectionViewer: React.FC<ReflectionViewerProps>\n variant?: TypographyVariant\n}\n\nexport const NameViewer: React.FC<NameViewerProps> = ({ reflectionViewer, variant, reflection, ...props }) => {\n return (\n <FlexRow justifyContent=\"flex-start\" {...props}>\n <FlexRow marginRight={1}>\n <Typography variant={variant} noWrap>\n {reflection.name}\n {reflection.type ? <>: </> : null}\n </Typography>\n <SomeTypeViewer reflection={reflection} reflectionViewer={reflectionViewer} />\n </FlexRow>\n <Stack direction=\"row\" spacing={1}>\n <Chip size=\"small\" label={reflection.kind} />\n {reflection.flags\n ? Object.entries(reflection.flags).map(([flag, value]) => {\n return value ? <Chip size=\"small\" key={flag} label={trimFlagLabel(flag)} variant=\"outlined\" /> : null\n })\n : null}\n </Stack>\n {document && document?.location.hostname === 'localhost' && (\n <JsonViewerButton jsonViewProps={{ collapsed: 1 }} size=\"small\" variant=\"contained\" padding={0} marginX={1} src={reflection} />\n )}\n </FlexRow>\n )\n}\n","export const trimFlagLabel = (label: string) => {\n if (label.startsWith('is')) {\n return label.substring(2)\n }\n return label\n}\n","import { Typography, TypographyProps } from '@mui/material'\n\nimport { SomeReflection } from '../../SomeReflection'\nimport { ReflectionViewerProps } from '../ReflectionViewerProps'\nimport { buildTypeString } from './buildTypeString'\n\nexport interface SomeTypeViewerProps extends TypographyProps {\n opacity?: number\n reflection: SomeReflection\n reflectionViewer: React.FC<ReflectionViewerProps>\n}\n\nexport const SomeTypeViewer: React.FC<SomeTypeViewerProps> = ({ opacity = 0.5, reflection, reflectionViewer, ...props }) => {\n const typeReactNode = reflection.type ? buildTypeString(reflection.type, reflectionViewer) : ''\n if (typeof typeReactNode === 'string') {\n return (\n <Typography title=\"SomeTypeViewer\" style={{ opacity }} {...props}>\n {typeReactNode}\n </Typography>\n )\n }\n return <>{typeReactNode}</>\n}\n","import type { ArrayType } from 'typedoc'\n\nimport { ReflectionViewerProps } from '../ReflectionViewerProps'\nimport { TypeBuilder } from './TypeBuilder'\n\nexport const buildArrayString = (typeObj: ArrayType, reflectionViewer: React.FC<ReflectionViewerProps>, typeBuilder: TypeBuilder) => {\n const parts: string[] = []\n const typeString = typeBuilder(typeObj.elementType, reflectionViewer)\n if (typeof typeString === 'string') {\n parts.push(typeString)\n }\n parts.push('[]')\n return parts\n}\n","import type { IntersectionType } from 'typedoc'\n\nimport { ReflectionViewerProps } from '../ReflectionViewerProps'\nimport { TypeBuilder } from './TypeBuilder'\n\nexport const buildIntersectionString = (typeObj: IntersectionType, reflectionViewer: React.FC<ReflectionViewerProps>, typeBuilder: TypeBuilder) => {\n const parts: string[] = []\n if (typeObj.types) {\n parts.push(\n typeObj.types\n .map((arg) => {\n return typeBuilder(arg, reflectionViewer)\n })\n .join(' & '),\n )\n }\n return parts\n}\n","import type { ReferenceType } from 'typedoc'\n\nimport { ReflectionViewerProps } from '../ReflectionViewerProps'\nimport { TypeBuilder } from './TypeBuilder'\n\nexport const buildReferenceString = (typeObj: ReferenceType, reflectionViewer: React.FC<ReflectionViewerProps>, typeBuilder: TypeBuilder) => {\n const parts: string[] = []\n parts.push(typeObj.name)\n if (typeObj.typeArguments) {\n parts.push('<')\n parts.push(\n typeObj.typeArguments\n .map((arg) => {\n return typeBuilder(arg, reflectionViewer)\n })\n .join(', '),\n )\n parts.push('>')\n }\n return parts\n}\n","import type { ReflectionType } from 'typedoc'\n\nimport { ReflectionViewerProps } from '../ReflectionViewerProps'\n\nexport const buildRelfectionString = (typeObj: ReflectionType, reflectionViewer: React.FC<ReflectionViewerProps>) => {\n if (typeObj.declaration) {\n return <>{reflectionViewer({ reflection: typeObj.declaration })}</>\n }\n}\n","import type { UnionType } from 'typedoc'\n\nimport { ReflectionViewerProps } from '../ReflectionViewerProps'\nimport { TypeBuilder } from './TypeBuilder'\n\nexport const buildUnionString = (typeObj: UnionType, reflectionViewer: React.FC<ReflectionViewerProps>, typeBuilder: TypeBuilder) => {\n const parts: string[] = []\n if (typeObj.types) {\n parts.push(\n typeObj.types\n .map((arg) => {\n return typeBuilder(arg, reflectionViewer)\n })\n .join(' | '),\n )\n }\n return parts\n}\n","import { ReactNode } from 'react'\nimport type { SomeType, Type } from 'typedoc'\n\nimport { ReflectionViewerProps } from '../ReflectionViewerProps'\nimport { buildArrayString } from './buildArrayString'\nimport { buildIntersectionString } from './buildIntersectionString'\nimport { buildReferenceString } from './buildReferenceString'\nimport { buildRelfectionString } from './buildReflectionString'\nimport { buildUnionString } from './buildUnionString'\nimport { TypeBuilder } from './TypeBuilder'\n\nexport const buildTypeString: TypeBuilder = (type: SomeType | Type, reflectionViewer: React.FC<ReflectionViewerProps>): ReactNode => {\n const someType = type as SomeType\n const parts: string[] = []\n\n switch (someType.type) {\n case 'intrinsic':\n parts.push(someType.name)\n break\n case 'intersection': {\n parts.push(...buildIntersectionString(someType, reflectionViewer, buildTypeString))\n break\n }\n case 'literal':\n parts.push(JSON.stringify(someType.value))\n break\n case 'array': {\n parts.push(...buildArrayString(someType, reflectionViewer, buildTypeString))\n break\n }\n case 'reference': {\n parts.push(...buildReferenceString(someType, reflectionViewer, buildTypeString))\n break\n }\n case 'union': {\n parts.push(...buildUnionString(someType, reflectionViewer, buildTypeString))\n break\n }\n case 'reflection': {\n return buildRelfectionString(someType, reflectionViewer)\n }\n default:\n parts.push('#')\n parts.push(someType.type)\n parts.push('#')\n break\n }\n return parts.join('')\n}\n"],"mappings":";AAAA,SAAS,cAAAA,mBAAkB;AAC3B,SAAS,WAAAC,UAAS,WAAAC,gBAAe;AACjC,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;;;ACH5B,SAAS,QAAQ,eAAe,eAAe,mBAAmB;AAClE,SAAS,gBAA+B;AACxC,SAAS,MAAM,UAAU,gB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typography","Fragment","jsx","jsxs","Typography","jsx","jsxs","hide","FlexCol","jsx","jsxs","hide","hiddenFlags","FlexCol","FlexRow","Typography"]}
|
|
@@ -1,8 +1,184 @@
|
|
|
1
|
-
|
|
1
|
+
// src/ReflectionViewer/ReflectionViewer.tsx
|
|
2
|
+
import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
|
|
3
|
+
|
|
4
|
+
// src/CommentViewer.tsx
|
|
5
|
+
import { Typography } from "@mui/material";
|
|
2
6
|
import { FlexCol } from "@xylabs/react-flexbox";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var CommentViewer = ({ comment, ...props }) => {
|
|
9
|
+
return /* @__PURE__ */ jsx(FlexCol, { alignItems: "stretch", ...props, children: /* @__PURE__ */ jsx(Typography, { variant: "body2", children: comment.summary[0]?.text }) });
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// src/ReflectionViewer/NameViewer.tsx
|
|
13
|
+
import { Chip, Stack, Typography as Typography3 } from "@mui/material";
|
|
14
|
+
import { FlexRow } from "@xylabs/react-flexbox";
|
|
15
|
+
|
|
16
|
+
// src/JsonViewerButton.tsx
|
|
17
|
+
import { Dialog, DialogActions, DialogContent, DialogTitle } from "@mui/material";
|
|
18
|
+
import { ButtonEx } from "@xylabs/react-button";
|
|
19
|
+
import { lazy, Suspense, useState } from "react";
|
|
20
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
21
|
+
var JsonView = lazy(() => import(
|
|
22
|
+
/* webpackChunkName: "jsonView" */
|
|
23
|
+
"react-json-view"
|
|
24
|
+
));
|
|
25
|
+
var JsonViewerButton = ({ jsonViewProps, src, title, ...props }) => {
|
|
26
|
+
const [open, setOpen] = useState(false);
|
|
27
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
28
|
+
/* @__PURE__ */ jsx2(ButtonEx, { onClick: () => setOpen(!open), ...props, children: "JSON" }),
|
|
29
|
+
/* @__PURE__ */ jsxs(Dialog, { open, onClose: () => setOpen(false), children: [
|
|
30
|
+
title ? /* @__PURE__ */ jsx2(DialogTitle, { children: title }) : null,
|
|
31
|
+
/* @__PURE__ */ jsx2(DialogContent, { children: /* @__PURE__ */ jsx2(Suspense, { fallback: /* @__PURE__ */ jsx2("div", {}), children: /* @__PURE__ */ jsx2(JsonView, { src, ...jsonViewProps }) }) }),
|
|
32
|
+
/* @__PURE__ */ jsx2(DialogActions, { children: /* @__PURE__ */ jsx2(ButtonEx, { onClick: () => setOpen(false), children: "Close" }) })
|
|
33
|
+
] })
|
|
34
|
+
] });
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// src/trimFlagLabel.ts
|
|
38
|
+
var trimFlagLabel = (label) => {
|
|
39
|
+
if (label.startsWith("is")) {
|
|
40
|
+
return label.substring(2);
|
|
41
|
+
}
|
|
42
|
+
return label;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// src/ReflectionViewer/SomeTypeViewer/SomeTypeViewer.tsx
|
|
46
|
+
import { Typography as Typography2 } from "@mui/material";
|
|
47
|
+
|
|
48
|
+
// src/ReflectionViewer/SomeTypeViewer/buildArrayString.tsx
|
|
49
|
+
var buildArrayString = (typeObj, reflectionViewer, typeBuilder) => {
|
|
50
|
+
const parts = [];
|
|
51
|
+
const typeString = typeBuilder(typeObj.elementType, reflectionViewer);
|
|
52
|
+
if (typeof typeString === "string") {
|
|
53
|
+
parts.push(typeString);
|
|
54
|
+
}
|
|
55
|
+
parts.push("[]");
|
|
56
|
+
return parts;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// src/ReflectionViewer/SomeTypeViewer/buildIntersectionString.tsx
|
|
60
|
+
var buildIntersectionString = (typeObj, reflectionViewer, typeBuilder) => {
|
|
61
|
+
const parts = [];
|
|
62
|
+
if (typeObj.types) {
|
|
63
|
+
parts.push(
|
|
64
|
+
typeObj.types.map((arg) => {
|
|
65
|
+
return typeBuilder(arg, reflectionViewer);
|
|
66
|
+
}).join(" & ")
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
return parts;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// src/ReflectionViewer/SomeTypeViewer/buildReferenceString.ts
|
|
73
|
+
var buildReferenceString = (typeObj, reflectionViewer, typeBuilder) => {
|
|
74
|
+
const parts = [];
|
|
75
|
+
parts.push(typeObj.name);
|
|
76
|
+
if (typeObj.typeArguments) {
|
|
77
|
+
parts.push("<");
|
|
78
|
+
parts.push(
|
|
79
|
+
typeObj.typeArguments.map((arg) => {
|
|
80
|
+
return typeBuilder(arg, reflectionViewer);
|
|
81
|
+
}).join(", ")
|
|
82
|
+
);
|
|
83
|
+
parts.push(">");
|
|
84
|
+
}
|
|
85
|
+
return parts;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// src/ReflectionViewer/SomeTypeViewer/buildReflectionString.tsx
|
|
89
|
+
import { Fragment as Fragment2, jsx as jsx3 } from "react/jsx-runtime";
|
|
90
|
+
var buildRelfectionString = (typeObj, reflectionViewer) => {
|
|
91
|
+
if (typeObj.declaration) {
|
|
92
|
+
return /* @__PURE__ */ jsx3(Fragment2, { children: reflectionViewer({ reflection: typeObj.declaration }) });
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// src/ReflectionViewer/SomeTypeViewer/buildUnionString.tsx
|
|
97
|
+
var buildUnionString = (typeObj, reflectionViewer, typeBuilder) => {
|
|
98
|
+
const parts = [];
|
|
99
|
+
if (typeObj.types) {
|
|
100
|
+
parts.push(
|
|
101
|
+
typeObj.types.map((arg) => {
|
|
102
|
+
return typeBuilder(arg, reflectionViewer);
|
|
103
|
+
}).join(" | ")
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
return parts;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// src/ReflectionViewer/SomeTypeViewer/buildTypeString.tsx
|
|
110
|
+
var buildTypeString = (type, reflectionViewer) => {
|
|
111
|
+
const someType = type;
|
|
112
|
+
const parts = [];
|
|
113
|
+
switch (someType.type) {
|
|
114
|
+
case "intrinsic":
|
|
115
|
+
parts.push(someType.name);
|
|
116
|
+
break;
|
|
117
|
+
case "intersection": {
|
|
118
|
+
parts.push(...buildIntersectionString(someType, reflectionViewer, buildTypeString));
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
case "literal":
|
|
122
|
+
parts.push(JSON.stringify(someType.value));
|
|
123
|
+
break;
|
|
124
|
+
case "array": {
|
|
125
|
+
parts.push(...buildArrayString(someType, reflectionViewer, buildTypeString));
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
case "reference": {
|
|
129
|
+
parts.push(...buildReferenceString(someType, reflectionViewer, buildTypeString));
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
case "union": {
|
|
133
|
+
parts.push(...buildUnionString(someType, reflectionViewer, buildTypeString));
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
case "reflection": {
|
|
137
|
+
return buildRelfectionString(someType, reflectionViewer);
|
|
138
|
+
}
|
|
139
|
+
default:
|
|
140
|
+
parts.push("#");
|
|
141
|
+
parts.push(someType.type);
|
|
142
|
+
parts.push("#");
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
return parts.join("");
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// src/ReflectionViewer/SomeTypeViewer/SomeTypeViewer.tsx
|
|
149
|
+
import { Fragment as Fragment3, jsx as jsx4 } from "react/jsx-runtime";
|
|
150
|
+
var SomeTypeViewer = ({ opacity = 0.5, reflection, reflectionViewer, ...props }) => {
|
|
151
|
+
const typeReactNode = reflection.type ? buildTypeString(reflection.type, reflectionViewer) : "";
|
|
152
|
+
if (typeof typeReactNode === "string") {
|
|
153
|
+
return /* @__PURE__ */ jsx4(Typography2, { title: "SomeTypeViewer", style: { opacity }, ...props, children: typeReactNode });
|
|
154
|
+
}
|
|
155
|
+
return /* @__PURE__ */ jsx4(Fragment3, { children: typeReactNode });
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
// src/ReflectionViewer/NameViewer.tsx
|
|
159
|
+
import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
160
|
+
var NameViewer = ({ reflectionViewer, variant, reflection, ...props }) => {
|
|
161
|
+
return /* @__PURE__ */ jsxs2(FlexRow, { justifyContent: "flex-start", ...props, children: [
|
|
162
|
+
/* @__PURE__ */ jsxs2(FlexRow, { marginRight: 1, children: [
|
|
163
|
+
/* @__PURE__ */ jsxs2(Typography3, { variant, noWrap: true, children: [
|
|
164
|
+
reflection.name,
|
|
165
|
+
reflection.type ? /* @__PURE__ */ jsx5(Fragment4, { children: ":\xA0" }) : null
|
|
166
|
+
] }),
|
|
167
|
+
/* @__PURE__ */ jsx5(SomeTypeViewer, { reflection, reflectionViewer })
|
|
168
|
+
] }),
|
|
169
|
+
/* @__PURE__ */ jsxs2(Stack, { direction: "row", spacing: 1, children: [
|
|
170
|
+
/* @__PURE__ */ jsx5(Chip, { size: "small", label: reflection.kind }),
|
|
171
|
+
reflection.flags ? Object.entries(reflection.flags).map(([flag, value]) => {
|
|
172
|
+
return value ? /* @__PURE__ */ jsx5(Chip, { size: "small", label: trimFlagLabel(flag), variant: "outlined" }, flag) : null;
|
|
173
|
+
}) : null
|
|
174
|
+
] }),
|
|
175
|
+
document && document?.location.hostname === "localhost" && /* @__PURE__ */ jsx5(JsonViewerButton, { jsonViewProps: { collapsed: 1 }, size: "small", variant: "contained", padding: 0, marginX: 1, src: reflection })
|
|
176
|
+
] });
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
// src/ReflectionViewer/ReflectionViewer.tsx
|
|
180
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
181
|
+
var hide = (flags, hiddenFlags = []) => {
|
|
6
182
|
let hide2 = false;
|
|
7
183
|
hiddenFlags.map((hiddenFlag) => {
|
|
8
184
|
if (flags?.[hiddenFlag]) {
|
|
@@ -11,13 +187,13 @@ const hide = (flags, hiddenFlags = []) => {
|
|
|
11
187
|
});
|
|
12
188
|
return hide2;
|
|
13
189
|
};
|
|
14
|
-
|
|
190
|
+
var ReflectionViewer = ({ variant, nameViewer, children, reflection, hiddenFlags, ...props }) => {
|
|
15
191
|
const someReflection = reflection;
|
|
16
|
-
return hide(reflection?.flags, hiddenFlags) ? null : /* @__PURE__ */
|
|
17
|
-
nameViewer === void 0 ? /* @__PURE__ */
|
|
18
|
-
reflection.comment ? /* @__PURE__ */
|
|
192
|
+
return hide(reflection?.flags, hiddenFlags) ? null : /* @__PURE__ */ jsxs3(FlexCol2, { title: "ReflectionViewer", alignItems: "stretch", ...props, children: [
|
|
193
|
+
nameViewer === void 0 ? /* @__PURE__ */ jsx6(NameViewer, { marginY: 0.25, variant, reflection: someReflection, reflectionViewer: ReflectionViewer }) : nameViewer,
|
|
194
|
+
reflection.comment ? /* @__PURE__ */ jsx6(CommentViewer, { comment: reflection.comment }) : null,
|
|
19
195
|
someReflection.parameters?.map((parameter) => {
|
|
20
|
-
return /* @__PURE__ */
|
|
196
|
+
return /* @__PURE__ */ jsx6(ReflectionViewer, { hiddenFlags, marginY: 0.25, marginX: 1, reflection: parameter }, parameter.id);
|
|
21
197
|
}) ?? null,
|
|
22
198
|
children
|
|
23
199
|
] });
|