@xyo-network/react-typedoc 7.5.8 → 7.5.12

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 (39) hide show
  1. package/dist/browser/index.mjs +408 -434
  2. package/dist/browser/index.mjs.map +1 -1
  3. package/dist/browser/resolveChildren.d.ts +2 -2
  4. package/dist/browser/resolveChildren.d.ts.map +1 -1
  5. package/package.json +98 -32
  6. package/src/CommentViewer.tsx +0 -17
  7. package/src/JsonViewerButton.tsx +0 -37
  8. package/src/ProjectTwoPanelReflectionViewer.stories.tsx +0 -32
  9. package/src/ProjectTwoPanelReflectionViewer.tsx +0 -16
  10. package/src/ReflectionLookup.ts +0 -3
  11. package/src/ReflectionViewer/Container.tsx +0 -42
  12. package/src/ReflectionViewer/Declaration.tsx +0 -39
  13. package/src/ReflectionViewer/DeclarationContainer.tsx +0 -34
  14. package/src/ReflectionViewer/NameViewer.tsx +0 -48
  15. package/src/ReflectionViewer/Project.tsx +0 -37
  16. package/src/ReflectionViewer/ReflectionGroupViewer.tsx +0 -80
  17. package/src/ReflectionViewer/ReflectionViewer.tsx +0 -48
  18. package/src/ReflectionViewer/ReflectionViewerProps.tsx +0 -17
  19. package/src/ReflectionViewer/SomeTypeViewer/SomeTypeViewer.tsx +0 -27
  20. package/src/ReflectionViewer/SomeTypeViewer/TypeBuilder.ts +0 -6
  21. package/src/ReflectionViewer/SomeTypeViewer/buildArrayString.tsx +0 -14
  22. package/src/ReflectionViewer/SomeTypeViewer/buildIntersectionString.tsx +0 -18
  23. package/src/ReflectionViewer/SomeTypeViewer/buildReferenceString.ts +0 -20
  24. package/src/ReflectionViewer/SomeTypeViewer/buildReflectionString.tsx +0 -10
  25. package/src/ReflectionViewer/SomeTypeViewer/buildTypeString.tsx +0 -50
  26. package/src/ReflectionViewer/SomeTypeViewer/buildUnionString.tsx +0 -18
  27. package/src/ReflectionViewer/SomeTypeViewer/index.ts +0 -1
  28. package/src/ReflectionViewer/index.ts +0 -8
  29. package/src/SomeReflection.ts +0 -9
  30. package/src/SourceViewer.tsx +0 -19
  31. package/src/TreeViewer/Reflection.tsx +0 -67
  32. package/src/TreeViewer/ReflectionGroup.tsx +0 -39
  33. package/src/TreeViewer/index.ts +0 -2
  34. package/src/TwoPanelReflectionViewer.tsx +0 -93
  35. package/src/createLookup.ts +0 -7
  36. package/src/global.d.ts +0 -1
  37. package/src/index.ts +0 -9
  38. package/src/resolveChildren.ts +0 -26
  39. package/src/trimFlagLabel.ts +0 -6
@@ -1,34 +0,0 @@
1
- import { useTheme } from '@mui/material'
2
- import React from 'react'
3
- import { useLocation } from 'react-router-dom'
4
- import type { DeclarationReflection } from 'typedoc'
5
-
6
- import type { ContainerReflectionViewerProps } from './Container.tsx'
7
- import { ContainerReflectionViewer } from './Container.tsx'
8
- import { DeclarationReflectionViewer } from './Declaration.tsx'
9
-
10
- export interface DeclarationContainerReflectionViewerProps extends ContainerReflectionViewerProps {
11
- reflection: DeclarationReflection
12
- }
13
-
14
- export const DeclarationContainerReflectionViewer: React.FC<DeclarationContainerReflectionViewerProps> = ({
15
- reflection,
16
- lookup,
17
- itemRenderer = DeclarationReflectionViewer,
18
- ...props
19
- }) => {
20
- const { hash } = useLocation()
21
- const theme = useTheme()
22
-
23
- return (
24
- <ContainerReflectionViewer
25
- title="DeclarationContainerReflectionViewer"
26
- paper={hash.slice(1) === reflection.name}
27
- bgcolor={hash.slice(1) === reflection.name ? theme.vars.palette.background.default : undefined}
28
- lookup={lookup}
29
- itemRenderer={itemRenderer}
30
- reflection={reflection}
31
- {...props}
32
- />
33
- )
34
- }
@@ -1,48 +0,0 @@
1
- import type { TypographyVariant } from '@mui/material'
2
- import {
3
- Chip, Stack, Typography,
4
- } from '@mui/material'
5
- import type { FlexBoxProps } from '@xylabs/react-flexbox'
6
- import { FlexRow } from '@xylabs/react-flexbox'
7
- import React from 'react'
8
-
9
- import { JsonViewerButton } from '../JsonViewerButton.tsx'
10
- import type { SomeReflection } from '../SomeReflection.ts'
11
- import { trimFlagLabel } from '../trimFlagLabel.ts'
12
- import type { ReflectionViewerProps } from './ReflectionViewerProps.tsx'
13
- import { SomeTypeViewer } from './SomeTypeViewer/index.ts'
14
-
15
- export interface NameViewerProps extends FlexBoxProps {
16
- reflection: SomeReflection
17
- reflectionViewer: React.FC<ReflectionViewerProps>
18
- variant?: TypographyVariant
19
- }
20
-
21
- export const NameViewer: React.FC<NameViewerProps> = ({
22
- reflectionViewer, variant, reflection, ...props
23
- }) => {
24
- return (
25
- <FlexRow justifyContent="flex-start" {...props}>
26
- <FlexRow marginRight={1}>
27
- <Typography variant={variant} noWrap>
28
- {reflection.name}
29
- {reflection.type
30
- ? <>:&nbsp;</>
31
- : null}
32
- </Typography>
33
- <SomeTypeViewer reflection={reflection} reflectionViewer={reflectionViewer} />
34
- </FlexRow>
35
- <Stack direction="row" spacing={1}>
36
- <Chip size="small" label={reflection.kind} />
37
- {reflection.flags
38
- ? Object.entries(reflection.flags).map(([flag, value]) => {
39
- return value ? <Chip size="small" key={flag} label={trimFlagLabel(flag)} variant="outlined" /> : null
40
- })
41
- : null}
42
- </Stack>
43
- {document && document?.location.hostname === 'localhost' && (
44
- <JsonViewerButton size="small" variant="contained" padding={0} marginX={1} src={reflection} />
45
- )}
46
- </FlexRow>
47
- )
48
- }
@@ -1,37 +0,0 @@
1
- import React, { useMemo } from 'react'
2
- import type { ProjectReflection, ReflectionGroup } from 'typedoc'
3
-
4
- import { createLookup } from '../createLookup.ts'
5
- import type { ContainerReflectionViewerProps } from './Container.tsx'
6
- import { ReflectionGroupViewer } from './ReflectionGroupViewer.tsx'
7
- import { ReflectionViewer } from './ReflectionViewer.tsx'
8
-
9
- export const ProjectReflectionViewer: React.FC<ContainerReflectionViewerProps<ProjectReflection>> = ({
10
- reflection,
11
- hiddenFlags,
12
- itemRenderer = ReflectionViewer,
13
- ...props
14
- }) => {
15
- const lookup = useMemo(() => createLookup(reflection), [reflection])
16
- return (
17
- <ReflectionViewer title="ProjectReflectionViewer" hiddenFlags={hiddenFlags} reflection={reflection} {...props}>
18
- {useMemo(() => {
19
- return reflection.groups?.map((group: ReflectionGroup) => {
20
- return (
21
- <ReflectionGroupViewer
22
- autoScroll
23
- variant="h6"
24
- lookup={lookup}
25
- key={group.title}
26
- renderer={itemRenderer}
27
- group={group}
28
- reflection={reflection}
29
- alignItems="stretch"
30
- hiddenFlags={hiddenFlags}
31
- />
32
- )
33
- })
34
- }, [lookup, reflection, hiddenFlags, itemRenderer])}
35
- </ReflectionViewer>
36
- )
37
- }
@@ -1,80 +0,0 @@
1
- import { Typography } from '@mui/material'
2
- import { FlexCol, FlexRow } from '@xylabs/react-flexbox'
3
- import React, { useEffect } from 'react'
4
- import { useLocation } from 'react-router-dom'
5
- import type {
6
- ContainerReflection, ReflectionFlags, ReflectionGroup,
7
- } from 'typedoc'
8
-
9
- import { JsonViewerButton } from '../JsonViewerButton.tsx'
10
- import { resolveChildren } from '../resolveChildren.ts'
11
- import { ReflectionViewer } from './ReflectionViewer.tsx'
12
- import type { FlagFilter, ReflectionViewerProps } from './ReflectionViewerProps.tsx'
13
-
14
- export interface ReflectionGroupViewerProps extends ReflectionViewerProps<ContainerReflection> {
15
- autoScroll?: boolean
16
- group: ReflectionGroup
17
- reflection: ContainerReflection
18
- renderer?: React.FC<ReflectionViewerProps>
19
- }
20
-
21
- const hide = (flags?: ReflectionFlags, hiddenFlags: FlagFilter[] = []) => {
22
- let hide = false
23
- for (const hiddenFlag of hiddenFlags) {
24
- if (flags?.[hiddenFlag]) {
25
- hide = true
26
- }
27
- }
28
- return hide
29
- }
30
-
31
- export const ReflectionGroupViewer: React.FC<ReflectionGroupViewerProps> = ({
32
- autoScroll = false,
33
- children,
34
- hiddenFlags,
35
- group,
36
- lookup,
37
- renderer = ReflectionViewer,
38
- variant,
39
- ...props
40
- }) => {
41
- const resolvedChildren = resolveChildren(group, lookup) ?? []
42
-
43
- const visibleChildren
44
- = hiddenFlags
45
- ? resolvedChildren.reduce((acc, item) => {
46
- return acc + (hide(item.flags, hiddenFlags) ? 0 : 1)
47
- }, 0)
48
- : 1
49
-
50
- const { hash } = useLocation()
51
- useEffect(() => {
52
- if (hash && autoScroll) {
53
- document.querySelector(hash)?.scrollIntoView({ behavior: 'smooth' })
54
- }
55
- }, [hash, autoScroll])
56
-
57
- return visibleChildren > 0
58
- ? (
59
- <FlexCol title="ReflectionGroupViewer" {...props}>
60
- <FlexRow marginY={1} justifyContent="flex-start">
61
- <Typography variant={variant}>{group.title}</Typography>
62
- <JsonViewerButton size="small" variant="contained" padding={0} marginX={1} src={resolveChildren(group, lookup)} />
63
- </FlexRow>
64
- {resolveChildren(group, lookup).map((reflection) => {
65
- return reflection
66
- // I wrap this in a div since React does not understand that they have keys using the Renderer
67
- ? (
68
- <div id={reflection.name} key={reflection.id}>
69
- {renderer({
70
- hiddenFlags, lookup, margin: 1, padding: 1, reflection,
71
- }) as React.ReactNode}
72
- </div>
73
- )
74
- : null
75
- })}
76
- {children}
77
- </FlexCol>
78
- )
79
- : null
80
- }
@@ -1,48 +0,0 @@
1
- import { FlexCol } from '@xylabs/react-flexbox'
2
- import React from 'react'
3
- import type { ReflectionFlags } from 'typedoc'
4
-
5
- import { CommentViewer } from '../CommentViewer.tsx'
6
- import type { SomeReflection } from '../SomeReflection.ts'
7
- import { NameViewer } from './NameViewer.tsx'
8
- import type { FlagFilter, ReflectionViewerProps } from './ReflectionViewerProps.tsx'
9
-
10
- const hide = (flags?: ReflectionFlags, hiddenFlags: FlagFilter[] = []) => {
11
- let hide = false
12
- for (const hiddenFlag of hiddenFlags) {
13
- if (flags?.[hiddenFlag]) {
14
- hide = true
15
- }
16
- }
17
- return hide
18
- }
19
-
20
- export const ReflectionViewer: React.FC<ReflectionViewerProps> = ({
21
- variant, nameViewer, children, reflection, hiddenFlags, ...props
22
- }) => {
23
- const someReflection = reflection as SomeReflection
24
-
25
- return hide(reflection?.flags, hiddenFlags)
26
- ? null
27
- : (
28
- <FlexCol title="ReflectionViewer" alignItems="stretch" {...props}>
29
- {nameViewer === undefined
30
- ? <NameViewer marginY={0.25} variant={variant} reflection={someReflection} reflectionViewer={ReflectionViewer} />
31
- : nameViewer}
32
- {reflection.comment
33
- ? <CommentViewer comment={reflection.comment} />
34
- : null}
35
- {/* sources && reflection.sources && children ? (
36
- <>
37
- {reflection.sources.map((source, index) => {
38
- return <SourceViewer key={index} source={source} />
39
- })}
40
- </>
41
- ) : null */}
42
- {someReflection.parameters?.map((parameter) => {
43
- return <ReflectionViewer hiddenFlags={hiddenFlags} marginY={0.25} marginX={1} key={parameter.id} reflection={parameter} />
44
- }) ?? null}
45
- {children}
46
- </FlexCol>
47
- )
48
- }
@@ -1,17 +0,0 @@
1
- import type { TypographyVariant } from '@mui/material'
2
- import type { FlexBoxProps } from '@xylabs/react-flexbox'
3
- import type { ReactElement } from 'react'
4
- import type { Reflection } from 'typedoc'
5
-
6
- import type { ReflectionLookup } from '../ReflectionLookup.ts'
7
-
8
- export type FlagFilter = 'isPublic' | 'isPrivate' | 'isProtected'
9
-
10
- export interface ReflectionViewerProps<T extends Reflection = Reflection> extends FlexBoxProps {
11
- hiddenFlags?: FlagFilter[]
12
- lookup?: ReflectionLookup
13
- nameViewer?: ReactElement | null
14
- reflection: T
15
- sources?: boolean
16
- variant?: TypographyVariant
17
- }
@@ -1,27 +0,0 @@
1
- import type { TypographyProps } from '@mui/material'
2
- import { Typography } from '@mui/material'
3
- import React from 'react'
4
-
5
- import type { SomeReflection } from '../../SomeReflection.ts'
6
- import type { ReflectionViewerProps } from '../ReflectionViewerProps.tsx'
7
- import { buildTypeString } from './buildTypeString.tsx'
8
-
9
- export interface SomeTypeViewerProps extends TypographyProps {
10
- opacity?: number
11
- reflection: SomeReflection
12
- reflectionViewer: React.FC<ReflectionViewerProps>
13
- }
14
-
15
- export const SomeTypeViewer: React.FC<SomeTypeViewerProps> = ({
16
- opacity = 0.5, reflection, reflectionViewer, ...props
17
- }) => {
18
- const typeReactNode = reflection.type ? buildTypeString(reflection.type, reflectionViewer) : ''
19
- if (typeof typeReactNode === 'string') {
20
- return (
21
- <Typography title="SomeTypeViewer" style={{ opacity }} {...props}>
22
- {typeReactNode}
23
- </Typography>
24
- )
25
- }
26
- return <>{typeReactNode}</>
27
- }
@@ -1,6 +0,0 @@
1
- import type { ReactNode } from 'react'
2
- import type { SomeType, Type } from 'typedoc'
3
-
4
- import type { ReflectionViewerProps } from '../ReflectionViewerProps.tsx'
5
-
6
- export type TypeBuilder = (type: SomeType | Type, reflectionViewer: React.FC<ReflectionViewerProps>, typeBuilder?: TypeBuilder) => ReactNode
@@ -1,14 +0,0 @@
1
- import type { ArrayType } from 'typedoc'
2
-
3
- import type { ReflectionViewerProps } from '../ReflectionViewerProps.tsx'
4
- import type { TypeBuilder } from './TypeBuilder.ts'
5
-
6
- export const buildArrayString = (typeObj: ArrayType, reflectionViewer: React.FC<ReflectionViewerProps>, typeBuilder: TypeBuilder) => {
7
- const parts: string[] = []
8
- const typeString = typeBuilder(typeObj.elementType, reflectionViewer)
9
- if (typeof typeString === 'string') {
10
- parts.push(typeString)
11
- }
12
- parts.push('[]')
13
- return parts
14
- }
@@ -1,18 +0,0 @@
1
- import type { IntersectionType } from 'typedoc'
2
-
3
- import type { ReflectionViewerProps } from '../ReflectionViewerProps.tsx'
4
- import type { TypeBuilder } from './TypeBuilder.ts'
5
-
6
- export const buildIntersectionString = (typeObj: IntersectionType, reflectionViewer: React.FC<ReflectionViewerProps>, typeBuilder: TypeBuilder) => {
7
- const parts: string[] = []
8
- if (typeObj.types) {
9
- parts.push(
10
- typeObj.types
11
- .map((arg) => {
12
- return typeBuilder(arg, reflectionViewer)
13
- })
14
- .join(' & '),
15
- )
16
- }
17
- return parts
18
- }
@@ -1,20 +0,0 @@
1
- import type { ReferenceType } from 'typedoc'
2
-
3
- import type { ReflectionViewerProps } from '../ReflectionViewerProps.tsx'
4
- import type { TypeBuilder } from './TypeBuilder.ts'
5
-
6
- export const buildReferenceString = (typeObj: ReferenceType, reflectionViewer: React.FC<ReflectionViewerProps>, typeBuilder: TypeBuilder) => {
7
- const parts: string[] = [typeObj.name]
8
- if (typeObj.typeArguments) {
9
- parts.push(
10
- '<',
11
- typeObj.typeArguments
12
- .map((arg) => {
13
- return typeBuilder(arg, reflectionViewer)
14
- })
15
- .join(', '),
16
- '>',
17
- )
18
- }
19
- return parts
20
- }
@@ -1,10 +0,0 @@
1
- import React from 'react'
2
- import type { ReflectionType } from 'typedoc'
3
-
4
- import type { ReflectionViewerProps } from '../ReflectionViewerProps.tsx'
5
-
6
- export const buildReflectionString = (typeObj: ReflectionType, reflectionViewer: React.FC<ReflectionViewerProps>) => {
7
- if (typeObj.declaration) {
8
- return <>{reflectionViewer({ reflection: typeObj.declaration })}</>
9
- }
10
- }
@@ -1,50 +0,0 @@
1
- import type { ReactNode } from 'react'
2
- import type { SomeType, Type } from 'typedoc'
3
-
4
- import type { ReflectionViewerProps } from '../ReflectionViewerProps.tsx'
5
- import { buildArrayString } from './buildArrayString.tsx'
6
- import { buildIntersectionString } from './buildIntersectionString.tsx'
7
- import { buildReferenceString } from './buildReferenceString.ts'
8
- import { buildReflectionString } from './buildReflectionString.tsx'
9
- import { buildUnionString } from './buildUnionString.tsx'
10
- import type { TypeBuilder } from './TypeBuilder.ts'
11
-
12
- export const buildTypeString: TypeBuilder = (type: SomeType | Type, reflectionViewer: React.FC<ReflectionViewerProps>): ReactNode => {
13
- const someType = type as SomeType
14
- const parts: string[] = []
15
-
16
- switch (someType.type) {
17
- case 'intrinsic': {
18
- parts.push(someType.name)
19
- break
20
- }
21
- case 'intersection': {
22
- parts.push(...buildIntersectionString(someType, reflectionViewer, buildTypeString))
23
- break
24
- }
25
- case 'literal': {
26
- parts.push(JSON.stringify(someType.value))
27
- break
28
- }
29
- case 'array': {
30
- parts.push(...buildArrayString(someType, reflectionViewer, buildTypeString))
31
- break
32
- }
33
- case 'reference': {
34
- parts.push(...buildReferenceString(someType, reflectionViewer, buildTypeString))
35
- break
36
- }
37
- case 'union': {
38
- parts.push(...buildUnionString(someType, reflectionViewer, buildTypeString))
39
- break
40
- }
41
- case 'reflection': {
42
- return buildReflectionString(someType, reflectionViewer)
43
- }
44
- default: {
45
- parts.push('#', someType.type, '#')
46
- break
47
- }
48
- }
49
- return parts.join('')
50
- }
@@ -1,18 +0,0 @@
1
- import type { UnionType } from 'typedoc'
2
-
3
- import type { ReflectionViewerProps } from '../ReflectionViewerProps.tsx'
4
- import type { TypeBuilder } from './TypeBuilder.ts'
5
-
6
- export const buildUnionString = (typeObj: UnionType, reflectionViewer: React.FC<ReflectionViewerProps>, typeBuilder: TypeBuilder) => {
7
- const parts: string[] = []
8
- if (typeObj.types) {
9
- parts.push(
10
- typeObj.types
11
- .map((arg) => {
12
- return typeBuilder(arg, reflectionViewer)
13
- })
14
- .join(' | '),
15
- )
16
- }
17
- return parts
18
- }
@@ -1 +0,0 @@
1
- export * from './SomeTypeViewer.tsx'
@@ -1,8 +0,0 @@
1
- export * from './Container.tsx'
2
- export * from './Declaration.tsx'
3
- export * from './DeclarationContainer.tsx'
4
- export * from './Project.tsx'
5
- export * from './ReflectionGroupViewer.tsx'
6
- export * from './ReflectionViewer.tsx'
7
- export * from './ReflectionViewerProps.tsx'
8
- export * from './SomeTypeViewer/index.ts'
@@ -1,9 +0,0 @@
1
- import type {
2
- ParameterReflection, Reflection, SomeType,
3
- } from 'typedoc'
4
-
5
- export type WithSomeType<T> = T & { type?: SomeType }
6
-
7
- export type WithSomeParameters<T> = T & { parameters?: ParameterReflection[] }
8
-
9
- export type SomeReflection = WithSomeParameters<WithSomeType<Reflection>>
@@ -1,19 +0,0 @@
1
- import { Typography } from '@mui/material'
2
- import type { FlexBoxProps } from '@xylabs/react-flexbox'
3
- import { FlexCol } from '@xylabs/react-flexbox'
4
- import React from 'react'
5
- import type { SourceReference } from 'typedoc'
6
-
7
- export interface SourceViewerProps extends FlexBoxProps {
8
- source: SourceReference
9
- }
10
-
11
- export const SourceViewer: React.FC<SourceViewerProps> = ({ source, ...props }) => {
12
- return (
13
- <FlexCol alignItems="stretch" {...props}>
14
- <Typography style={{ opacity: 0.5 }} variant="body2">
15
- <i>{source.fileName}</i>
16
- </Typography>
17
- </FlexCol>
18
- )
19
- }
@@ -1,67 +0,0 @@
1
- import { Add, Remove } from '@mui/icons-material'
2
- import { Typography } from '@mui/material'
3
- import { SimpleTreeView, TreeItem } from '@mui/x-tree-view'
4
- import type { FlexBoxProps } from '@xylabs/react-flexbox'
5
- import { FlexCol } from '@xylabs/react-flexbox'
6
- import React from 'react'
7
- import { useNavigate } from 'react-router-dom'
8
- import type { ContainerReflection, Reflection } from 'typedoc'
9
-
10
- import type { ReflectionLookup } from '../ReflectionLookup.ts'
11
- import type { FlagFilter } from '../ReflectionViewer/index.ts'
12
-
13
- export interface ReflectionTreeViewerProps<T extends Reflection = ContainerReflection> extends FlexBoxProps {
14
- hiddenFlags?: FlagFilter[]
15
- lookup?: ReflectionLookup
16
- reflection: T
17
- searchTerm?: string
18
- }
19
-
20
- export const ReflectionTreeViewer: React.FC<ReflectionTreeViewerProps> = ({
21
- lookup, reflection, searchTerm, ...props
22
- }) => {
23
- const navigate = useNavigate()
24
- return (
25
- <FlexCol alignItems="stretch" {...props}>
26
- {/* TODO - move this into a title component */}
27
- {/* {nameViewer === undefined ? <NameViewer variant={variant} reflection={reflection} /> : nameViewer} */}
28
- {/* {reflection.comment ? <CommentViewer comment={reflection.comment} /> : null} */}
29
- {/* {reflection.sources ? ( */}
30
- {/* <> */}
31
- {/* {reflection.sources.map((source, index) => { */}
32
- {/* return <SourceViewer key={index} source={source} /> */}
33
- {/* })} */}
34
- {/* </> */}
35
- {/* ) : null} */}
36
- {/* TODO - when searching do not include categories that dont have children, pull maps out of view */}
37
- <SimpleTreeView
38
- aria-label="XYO SDK Documentation"
39
- slots={{ collapseIcon: Remove, expandIcon: Add }}
40
- expandedItems={reflection.groups ? [reflection.groups[0].title] : []}
41
- >
42
- {reflection.groups?.map((group, index) => (
43
- <TreeItem key={`primary-${index}`} itemId={group.title} label={<Typography variant="h6">{group.title}</Typography>}>
44
- {group.children.map((child, jndex) => {
45
- const searchTermTrimmed = searchTerm?.trim().toLowerCase()
46
- const childReflection = typeof child === 'number' ? lookup?.[child as number] : child
47
- return childReflection && (!searchTermTrimmed || childReflection.name.toLowerCase().includes(searchTermTrimmed))
48
- ? (
49
- <TreeItem
50
- key={`secondary-${index}- ${jndex}`}
51
- itemId={`declaration-${childReflection?.id}`}
52
- label={childReflection.name}
53
- onClick={() => {
54
- const hash = `#${childReflection.name}`
55
- void navigate({ hash })
56
- document.querySelector(hash)?.scrollIntoView({ behavior: 'smooth' })
57
- }}
58
- />
59
- )
60
- : null
61
- })}
62
- </TreeItem>
63
- ))}
64
- </SimpleTreeView>
65
- </FlexCol>
66
- )
67
- }
@@ -1,39 +0,0 @@
1
- import { Typography } from '@mui/material'
2
- import { FlexCol, FlexRow } from '@xylabs/react-flexbox'
3
- import React from 'react'
4
-
5
- import { JsonViewerButton } from '../JsonViewerButton.tsx'
6
- import type { ReflectionGroupViewerProps } from '../ReflectionViewer/index.ts'
7
- import { ReflectionViewer } from '../ReflectionViewer/index.ts'
8
- import { resolveChildren } from '../resolveChildren.ts'
9
-
10
- export const ReflectionGroupTreeViewer: React.FC<ReflectionGroupViewerProps> = ({
11
- variant,
12
- group,
13
- children,
14
- lookup,
15
- renderer = ReflectionViewer,
16
- ...props
17
- }) => {
18
- return (
19
- <FlexCol {...props}>
20
- <FlexRow marginY={1} justifyContent="flex-start">
21
- <Typography variant={variant}>{group.title}</Typography>
22
- <JsonViewerButton size="small" variant="contained" padding={0} marginX={1} src={resolveChildren(group, lookup)} />
23
- </FlexRow>
24
- {resolveChildren(group, lookup).map((reflection) => {
25
- return reflection
26
- // I wrap this in a div since React does not understand that they have keys using the Renderer
27
- ? (
28
- <div key={reflection.id}>
29
- {renderer({
30
- lookup, margin: 1, reflection,
31
- }) as React.ReactNode}
32
- </div>
33
- )
34
- : null
35
- })}
36
- {children}
37
- </FlexCol>
38
- )
39
- }
@@ -1,2 +0,0 @@
1
- export * from './Reflection.tsx'
2
- export * from './ReflectionGroup.tsx'