@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.
Files changed (58) hide show
  1. package/dist/browser/CommentViewer.js +3 -2
  2. package/dist/browser/CommentViewer.js.map +1 -1
  3. package/dist/browser/JsonViewerButton.js +4 -3
  4. package/dist/browser/JsonViewerButton.js.map +1 -1
  5. package/dist/browser/ProjectTwoPanelReflectionViewer.js +513 -5
  6. package/dist/browser/ProjectTwoPanelReflectionViewer.js.map +1 -1
  7. package/dist/browser/ReflectionViewer/Container.js +294 -7
  8. package/dist/browser/ReflectionViewer/Container.js.map +1 -1
  9. package/dist/browser/ReflectionViewer/Declaration.js +208 -7
  10. package/dist/browser/ReflectionViewer/Declaration.js.map +1 -1
  11. package/dist/browser/ReflectionViewer/DeclarationContainer.js +355 -6
  12. package/dist/browser/ReflectionViewer/DeclarationContainer.js.map +1 -1
  13. package/dist/browser/ReflectionViewer/NameViewer.js +157 -15
  14. package/dist/browser/ReflectionViewer/NameViewer.js.map +1 -1
  15. package/dist/browser/ReflectionViewer/Project.js +296 -7
  16. package/dist/browser/ReflectionViewer/Project.js.map +1 -1
  17. package/dist/browser/ReflectionViewer/ReflectionGroupViewer.js +237 -17
  18. package/dist/browser/ReflectionViewer/ReflectionGroupViewer.js.map +1 -1
  19. package/dist/browser/ReflectionViewer/ReflectionViewer.js +185 -9
  20. package/dist/browser/ReflectionViewer/ReflectionViewer.js.map +1 -1
  21. package/dist/browser/ReflectionViewer/SomeTypeViewer/SomeTypeViewer.js +107 -5
  22. package/dist/browser/ReflectionViewer/SomeTypeViewer/SomeTypeViewer.js.map +1 -1
  23. package/dist/browser/ReflectionViewer/SomeTypeViewer/buildArrayString.js +2 -1
  24. package/dist/browser/ReflectionViewer/SomeTypeViewer/buildArrayString.js.map +1 -1
  25. package/dist/browser/ReflectionViewer/SomeTypeViewer/buildIntersectionString.js +2 -1
  26. package/dist/browser/ReflectionViewer/SomeTypeViewer/buildIntersectionString.js.map +1 -1
  27. package/dist/browser/ReflectionViewer/SomeTypeViewer/buildReferenceString.js +2 -1
  28. package/dist/browser/ReflectionViewer/SomeTypeViewer/buildReferenceString.js.map +1 -1
  29. package/dist/browser/ReflectionViewer/SomeTypeViewer/buildReflectionString.js +2 -1
  30. package/dist/browser/ReflectionViewer/SomeTypeViewer/buildReflectionString.js.map +1 -1
  31. package/dist/browser/ReflectionViewer/SomeTypeViewer/buildTypeString.js +63 -6
  32. package/dist/browser/ReflectionViewer/SomeTypeViewer/buildTypeString.js.map +1 -1
  33. package/dist/browser/ReflectionViewer/SomeTypeViewer/buildUnionString.js +2 -1
  34. package/dist/browser/ReflectionViewer/SomeTypeViewer/buildUnionString.js.map +1 -1
  35. package/dist/browser/ReflectionViewer/SomeTypeViewer/index.js +115 -1
  36. package/dist/browser/ReflectionViewer/SomeTypeViewer/index.js.map +1 -1
  37. package/dist/browser/ReflectionViewer/index.js +412 -8
  38. package/dist/browser/ReflectionViewer/index.js.map +1 -1
  39. package/dist/browser/SourceViewer.js +3 -2
  40. package/dist/browser/SourceViewer.js.map +1 -1
  41. package/dist/browser/TreeViewer/Reflection.js +3 -2
  42. package/dist/browser/TreeViewer/Reflection.js.map +1 -1
  43. package/dist/browser/TreeViewer/ReflectionGroup.js +231 -11
  44. package/dist/browser/TreeViewer/ReflectionGroup.js.map +1 -1
  45. package/dist/browser/TreeViewer/index.js +299 -2
  46. package/dist/browser/TreeViewer/index.js.map +1 -1
  47. package/dist/browser/TwoPanelReflectionViewer.js +344 -18
  48. package/dist/browser/TwoPanelReflectionViewer.js.map +1 -1
  49. package/dist/browser/createLookup.js +2 -1
  50. package/dist/browser/createLookup.js.map +1 -1
  51. package/dist/browser/index.js +611 -9
  52. package/dist/browser/index.js.map +1 -1
  53. package/dist/browser/resolveChildren.js +2 -1
  54. package/dist/browser/resolveChildren.js.map +1 -1
  55. package/dist/browser/trimFlagLabel.js +2 -1
  56. package/dist/browser/trimFlagLabel.js.map +1 -1
  57. package/dist/docs.json +72 -72
  58. package/package.json +6 -6
@@ -1,10 +1,230 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ // src/TreeViewer/ReflectionGroup.tsx
2
+ import { Typography as Typography4 } from "@mui/material";
3
+ import { FlexCol as FlexCol3, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
4
+
5
+ // src/JsonViewerButton.tsx
6
+ import { Dialog, DialogActions, DialogContent, DialogTitle } from "@mui/material";
7
+ import { ButtonEx } from "@xylabs/react-button";
8
+ import { lazy, Suspense, useState } from "react";
9
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ var JsonView = lazy(() => import(
11
+ /* webpackChunkName: "jsonView" */
12
+ "react-json-view"
13
+ ));
14
+ var JsonViewerButton = ({ jsonViewProps, src, title, ...props }) => {
15
+ const [open, setOpen] = useState(false);
16
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
17
+ /* @__PURE__ */ jsx(ButtonEx, { onClick: () => setOpen(!open), ...props, children: "JSON" }),
18
+ /* @__PURE__ */ jsxs(Dialog, { open, onClose: () => setOpen(false), children: [
19
+ title ? /* @__PURE__ */ jsx(DialogTitle, { children: title }) : null,
20
+ /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", {}), children: /* @__PURE__ */ jsx(JsonView, { src, ...jsonViewProps }) }) }),
21
+ /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(ButtonEx, { onClick: () => setOpen(false), children: "Close" }) })
22
+ ] })
23
+ ] });
24
+ };
25
+
26
+ // src/resolveChildren.ts
27
+ var resolveChildren = (reflection, lookup = {}) => {
28
+ return reflection.children?.map((child) => {
29
+ switch (typeof child) {
30
+ case "object":
31
+ return child;
32
+ case "number": {
33
+ const childObj = lookup[child];
34
+ if (childObj === void 0) {
35
+ throw Error(`Child Reference Not Found [${child}]`);
36
+ }
37
+ return childObj;
38
+ }
39
+ default:
40
+ throw Error(`Invalid Child Type [${typeof child}, ${child}]`);
41
+ }
42
+ }) ?? [];
43
+ };
44
+
45
+ // src/ReflectionViewer/ReflectionViewer.tsx
46
+ import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
47
+
48
+ // src/CommentViewer.tsx
2
49
  import { Typography } from "@mui/material";
3
- import { FlexCol, FlexRow } from "@xylabs/react-flexbox";
4
- import { JsonViewerButton } from "../JsonViewerButton";
5
- import { ReflectionViewer } from "../ReflectionViewer";
6
- import { resolveChildren } from "../resolveChildren";
7
- const ReflectionGroupTreeViewer = ({
50
+ import { FlexCol } from "@xylabs/react-flexbox";
51
+ import { jsx as jsx2 } from "react/jsx-runtime";
52
+ var CommentViewer = ({ comment, ...props }) => {
53
+ return /* @__PURE__ */ jsx2(FlexCol, { alignItems: "stretch", ...props, children: /* @__PURE__ */ jsx2(Typography, { variant: "body2", children: comment.summary[0]?.text }) });
54
+ };
55
+
56
+ // src/ReflectionViewer/NameViewer.tsx
57
+ import { Chip, Stack, Typography as Typography3 } from "@mui/material";
58
+ import { FlexRow } from "@xylabs/react-flexbox";
59
+
60
+ // src/trimFlagLabel.ts
61
+ var trimFlagLabel = (label) => {
62
+ if (label.startsWith("is")) {
63
+ return label.substring(2);
64
+ }
65
+ return label;
66
+ };
67
+
68
+ // src/ReflectionViewer/SomeTypeViewer/SomeTypeViewer.tsx
69
+ import { Typography as Typography2 } from "@mui/material";
70
+
71
+ // src/ReflectionViewer/SomeTypeViewer/buildArrayString.tsx
72
+ var buildArrayString = (typeObj, reflectionViewer, typeBuilder) => {
73
+ const parts = [];
74
+ const typeString = typeBuilder(typeObj.elementType, reflectionViewer);
75
+ if (typeof typeString === "string") {
76
+ parts.push(typeString);
77
+ }
78
+ parts.push("[]");
79
+ return parts;
80
+ };
81
+
82
+ // src/ReflectionViewer/SomeTypeViewer/buildIntersectionString.tsx
83
+ var buildIntersectionString = (typeObj, reflectionViewer, typeBuilder) => {
84
+ const parts = [];
85
+ if (typeObj.types) {
86
+ parts.push(
87
+ typeObj.types.map((arg) => {
88
+ return typeBuilder(arg, reflectionViewer);
89
+ }).join(" & ")
90
+ );
91
+ }
92
+ return parts;
93
+ };
94
+
95
+ // src/ReflectionViewer/SomeTypeViewer/buildReferenceString.ts
96
+ var buildReferenceString = (typeObj, reflectionViewer, typeBuilder) => {
97
+ const parts = [];
98
+ parts.push(typeObj.name);
99
+ if (typeObj.typeArguments) {
100
+ parts.push("<");
101
+ parts.push(
102
+ typeObj.typeArguments.map((arg) => {
103
+ return typeBuilder(arg, reflectionViewer);
104
+ }).join(", ")
105
+ );
106
+ parts.push(">");
107
+ }
108
+ return parts;
109
+ };
110
+
111
+ // src/ReflectionViewer/SomeTypeViewer/buildReflectionString.tsx
112
+ import { Fragment as Fragment2, jsx as jsx3 } from "react/jsx-runtime";
113
+ var buildRelfectionString = (typeObj, reflectionViewer) => {
114
+ if (typeObj.declaration) {
115
+ return /* @__PURE__ */ jsx3(Fragment2, { children: reflectionViewer({ reflection: typeObj.declaration }) });
116
+ }
117
+ };
118
+
119
+ // src/ReflectionViewer/SomeTypeViewer/buildUnionString.tsx
120
+ var buildUnionString = (typeObj, reflectionViewer, typeBuilder) => {
121
+ const parts = [];
122
+ if (typeObj.types) {
123
+ parts.push(
124
+ typeObj.types.map((arg) => {
125
+ return typeBuilder(arg, reflectionViewer);
126
+ }).join(" | ")
127
+ );
128
+ }
129
+ return parts;
130
+ };
131
+
132
+ // src/ReflectionViewer/SomeTypeViewer/buildTypeString.tsx
133
+ var buildTypeString = (type, reflectionViewer) => {
134
+ const someType = type;
135
+ const parts = [];
136
+ switch (someType.type) {
137
+ case "intrinsic":
138
+ parts.push(someType.name);
139
+ break;
140
+ case "intersection": {
141
+ parts.push(...buildIntersectionString(someType, reflectionViewer, buildTypeString));
142
+ break;
143
+ }
144
+ case "literal":
145
+ parts.push(JSON.stringify(someType.value));
146
+ break;
147
+ case "array": {
148
+ parts.push(...buildArrayString(someType, reflectionViewer, buildTypeString));
149
+ break;
150
+ }
151
+ case "reference": {
152
+ parts.push(...buildReferenceString(someType, reflectionViewer, buildTypeString));
153
+ break;
154
+ }
155
+ case "union": {
156
+ parts.push(...buildUnionString(someType, reflectionViewer, buildTypeString));
157
+ break;
158
+ }
159
+ case "reflection": {
160
+ return buildRelfectionString(someType, reflectionViewer);
161
+ }
162
+ default:
163
+ parts.push("#");
164
+ parts.push(someType.type);
165
+ parts.push("#");
166
+ break;
167
+ }
168
+ return parts.join("");
169
+ };
170
+
171
+ // src/ReflectionViewer/SomeTypeViewer/SomeTypeViewer.tsx
172
+ import { Fragment as Fragment3, jsx as jsx4 } from "react/jsx-runtime";
173
+ var SomeTypeViewer = ({ opacity = 0.5, reflection, reflectionViewer, ...props }) => {
174
+ const typeReactNode = reflection.type ? buildTypeString(reflection.type, reflectionViewer) : "";
175
+ if (typeof typeReactNode === "string") {
176
+ return /* @__PURE__ */ jsx4(Typography2, { title: "SomeTypeViewer", style: { opacity }, ...props, children: typeReactNode });
177
+ }
178
+ return /* @__PURE__ */ jsx4(Fragment3, { children: typeReactNode });
179
+ };
180
+
181
+ // src/ReflectionViewer/NameViewer.tsx
182
+ import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
183
+ var NameViewer = ({ reflectionViewer, variant, reflection, ...props }) => {
184
+ return /* @__PURE__ */ jsxs2(FlexRow, { justifyContent: "flex-start", ...props, children: [
185
+ /* @__PURE__ */ jsxs2(FlexRow, { marginRight: 1, children: [
186
+ /* @__PURE__ */ jsxs2(Typography3, { variant, noWrap: true, children: [
187
+ reflection.name,
188
+ reflection.type ? /* @__PURE__ */ jsx5(Fragment4, { children: ":\xA0" }) : null
189
+ ] }),
190
+ /* @__PURE__ */ jsx5(SomeTypeViewer, { reflection, reflectionViewer })
191
+ ] }),
192
+ /* @__PURE__ */ jsxs2(Stack, { direction: "row", spacing: 1, children: [
193
+ /* @__PURE__ */ jsx5(Chip, { size: "small", label: reflection.kind }),
194
+ reflection.flags ? Object.entries(reflection.flags).map(([flag, value]) => {
195
+ return value ? /* @__PURE__ */ jsx5(Chip, { size: "small", label: trimFlagLabel(flag), variant: "outlined" }, flag) : null;
196
+ }) : null
197
+ ] }),
198
+ document && document?.location.hostname === "localhost" && /* @__PURE__ */ jsx5(JsonViewerButton, { jsonViewProps: { collapsed: 1 }, size: "small", variant: "contained", padding: 0, marginX: 1, src: reflection })
199
+ ] });
200
+ };
201
+
202
+ // src/ReflectionViewer/ReflectionViewer.tsx
203
+ import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
204
+ var hide = (flags, hiddenFlags = []) => {
205
+ let hide2 = false;
206
+ hiddenFlags.map((hiddenFlag) => {
207
+ if (flags?.[hiddenFlag]) {
208
+ hide2 = true;
209
+ }
210
+ });
211
+ return hide2;
212
+ };
213
+ var ReflectionViewer = ({ variant, nameViewer, children, reflection, hiddenFlags, ...props }) => {
214
+ const someReflection = reflection;
215
+ return hide(reflection?.flags, hiddenFlags) ? null : /* @__PURE__ */ jsxs3(FlexCol2, { title: "ReflectionViewer", alignItems: "stretch", ...props, children: [
216
+ nameViewer === void 0 ? /* @__PURE__ */ jsx6(NameViewer, { marginY: 0.25, variant, reflection: someReflection, reflectionViewer: ReflectionViewer }) : nameViewer,
217
+ reflection.comment ? /* @__PURE__ */ jsx6(CommentViewer, { comment: reflection.comment }) : null,
218
+ someReflection.parameters?.map((parameter) => {
219
+ return /* @__PURE__ */ jsx6(ReflectionViewer, { hiddenFlags, marginY: 0.25, marginX: 1, reflection: parameter }, parameter.id);
220
+ }) ?? null,
221
+ children
222
+ ] });
223
+ };
224
+
225
+ // src/TreeViewer/ReflectionGroup.tsx
226
+ import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
227
+ var ReflectionGroupTreeViewer = ({
8
228
  variant,
9
229
  group,
10
230
  children,
@@ -12,10 +232,10 @@ const ReflectionGroupTreeViewer = ({
12
232
  renderer = ReflectionViewer,
13
233
  ...props
14
234
  }) => {
15
- return /* @__PURE__ */ jsxs(FlexCol, { ...props, children: [
16
- /* @__PURE__ */ jsxs(FlexRow, { marginY: 1, justifyContent: "flex-start", children: [
17
- /* @__PURE__ */ jsx(Typography, { variant, children: group.title }),
18
- /* @__PURE__ */ jsx(
235
+ return /* @__PURE__ */ jsxs4(FlexCol3, { ...props, children: [
236
+ /* @__PURE__ */ jsxs4(FlexRow2, { marginY: 1, justifyContent: "flex-start", children: [
237
+ /* @__PURE__ */ jsx7(Typography4, { variant, children: group.title }),
238
+ /* @__PURE__ */ jsx7(
19
239
  JsonViewerButton,
20
240
  {
21
241
  jsonViewProps: { collapsed: 1 },
@@ -30,7 +250,7 @@ const ReflectionGroupTreeViewer = ({
30
250
  resolveChildren(group, lookup).map((reflection) => {
31
251
  return reflection ? (
32
252
  // I wrap this in a div since React does not understand that they have keys using the Renderer
33
- /* @__PURE__ */ jsx("div", { children: renderer({ lookup, margin: 1, reflection }) }, reflection.id)
253
+ /* @__PURE__ */ jsx7("div", { children: renderer({ lookup, margin: 1, reflection }) }, reflection.id)
34
254
  ) : null;
35
255
  }),
36
256
  children
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/TreeViewer/ReflectionGroup.tsx"],"sourcesContent":["import { Typography } from '@mui/material'\nimport { FlexCol, FlexRow } from '@xylabs/react-flexbox'\n\nimport { JsonViewerButton } from '../JsonViewerButton'\nimport { ReflectionGroupViewerProps, ReflectionViewer } from '../ReflectionViewer'\nimport { resolveChildren } from '../resolveChildren'\n\nexport const ReflectionGroupTreeViewer: React.FC<ReflectionGroupViewerProps> = ({\n variant,\n group,\n children,\n lookup,\n renderer = ReflectionViewer,\n ...props\n}) => {\n return (\n <FlexCol {...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 key={reflection.id}>{renderer({ lookup, margin: 1, reflection })}</div>\n ) : null\n })}\n {children}\n </FlexCol>\n )\n}\n"],"mappings":"AAiBM,SACE,KADF;AAjBN,SAAS,kBAAkB;AAC3B,SAAS,SAAS,eAAe;AAEjC,SAAS,wBAAwB;AACjC,SAAqC,wBAAwB;AAC7D,SAAS,uBAAuB;AAEzB,MAAM,4BAAkE,CAAC;AAAA,EAC9E;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,GAAG;AACL,MAAM;AACJ,SACE,qBAAC,WAAS,GAAG,OACX;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,SAAyB,mBAAS,EAAE,QAAQ,QAAQ,GAAG,WAAW,CAAC,KAA1D,WAAW,EAAiD;AAAA,UACpE;AAAA,IACN,CAAC;AAAA,IACA;AAAA,KACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/TreeViewer/ReflectionGroup.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'\n\nimport { JsonViewerButton } from '../JsonViewerButton'\nimport { ReflectionGroupViewerProps, ReflectionViewer } from '../ReflectionViewer'\nimport { resolveChildren } from '../resolveChildren'\n\nexport const ReflectionGroupTreeViewer: React.FC<ReflectionGroupViewerProps> = ({\n variant,\n group,\n children,\n lookup,\n renderer = ReflectionViewer,\n ...props\n}) => {\n return (\n <FlexCol {...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 key={reflection.id}>{renderer({ lookup, margin: 1, reflection })}</div>\n ) : null\n })}\n {children}\n </FlexCol>\n )\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 ? <>:&nbsp;</> : 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;;;ACDjC,SAAS,QAAQ,eAAe,eAAe,mBAAmB;AAClE,SAAS,gBAA+B;AACxC,SAAS,MAAM,UAAU,gBAAgB;AAarC,mBACE,KAGA,YAJF;AAVJ,IAAM,WAAW,KAAK,MAAM;AAAA;AAAA,EAA0C;AAAiB,CAAC;AAOjF,IAAM,mBAAoD,CAAC,EAAE,eAAe,KAAK,OAAO,GAAG,MAAM,MAAM;AAC5G,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,KAAK;AACtC,SACE,iCACE;AAAA,wBAAC,YAAS,SAAS,MAAM,QAAQ,CAAC,IAAI,GAAI,GAAG,OAAO,kBAEpD;AAAA,IACA,qBAAC,UAAO,MAAY,SAAS,MAAM,QAAQ,KAAK,GAC7C;AAAA,cAAQ,oBAAC,eAAa,iBAAM,IAAiB;AAAA,MAC9C,oBAAC,iBACC,8BAAC,YAAS,UAAU,oBAAC,SAAI,GACvB,8BAAC,YAAS,KAAW,GAAG,eAAe,GACzC,GACF;AAAA,MACA,oBAAC,iBACC,8BAAC,YAAS,SAAS,MAAM,QAAQ,KAAK,GAAG,mBAAK,GAChD;AAAA,OACF;AAAA,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cAAW,SAAS,MAAM,SAAkB,YAAY,gBAAgB,kBAAkB,kBAAkB,IAE7G;AAAA,IAED,WAAW,UAAU,gBAAAA,KAAC,iBAAc,SAAS,WAAW,SAAS,IAAK;AAAA,IAQtE,eAAe,YAAY,IAAI,CAAC,cAAc;AAC7C,aAAO,gBAAAA,KAAC,oBAAiB,aAA0B,SAAS,MAAM,SAAS,GAAsB,YAAY,aAA1B,UAAU,EAA2B;AAAA,IAC1H,CAAC,KAAK;AAAA,IACL;AAAA,KACH;AAEJ;;;AHzBM,SACE,OAAAI,MADF,QAAAC,aAAA;AAVC,IAAM,4BAAkE,CAAC;AAAA,EAC9E;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,GAAG;AACL,MAAM;AACJ,SACE,gBAAAA,MAACC,UAAA,EAAS,GAAG,OACX;AAAA,oBAAAD,MAACE,UAAA,EAAQ,SAAS,GAAG,gBAAe,cAClC;AAAA,sBAAAH,KAACI,aAAA,EAAW,SAAmB,gBAAM,OAAM;AAAA,MAC3C,gBAAAJ;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,gBAAAA,KAAC,SAAyB,mBAAS,EAAE,QAAQ,QAAQ,GAAG,WAAW,CAAC,KAA1D,WAAW,EAAiD;AAAA,UACpE;AAAA,IACN,CAAC;AAAA,IACA;AAAA,KACH;AAEJ;","names":["Typography","FlexCol","FlexRow","FlexCol","jsx","Typography","Typography","Fragment","jsx","Fragment","jsx","Typography","Fragment","jsx","jsxs","Typography","jsx","jsxs","hide","FlexCol","jsx","jsxs","FlexCol","FlexRow","Typography"]}
@@ -1,3 +1,300 @@
1
- export * from "./Reflection";
2
- export * from "./ReflectionGroup";
1
+ // src/TreeViewer/Reflection.tsx
2
+ import { Add, Remove } from "@mui/icons-material";
3
+ import { Typography } from "@mui/material";
4
+ import { TreeItem, TreeView } from "@mui/x-tree-view";
5
+ import { FlexCol } from "@xylabs/react-flexbox";
6
+ import { useNavigate } from "react-router-dom";
7
+ import { jsx } from "react/jsx-runtime";
8
+ var ReflectionTreeViewer = ({ lookup, reflection, searchTerm, ...props }) => {
9
+ const navigate = useNavigate();
10
+ return /* @__PURE__ */ jsx(FlexCol, { alignItems: "stretch", ...props, children: /* @__PURE__ */ jsx(
11
+ TreeView,
12
+ {
13
+ "aria-label": "XYO SDK Documentation",
14
+ defaultExpandIcon: /* @__PURE__ */ jsx(Add, {}),
15
+ defaultCollapseIcon: /* @__PURE__ */ jsx(Remove, {}),
16
+ defaultExpanded: reflection.groups ? [reflection.groups[0].title] : [],
17
+ children: reflection.groups?.map((group, index) => /* @__PURE__ */ jsx(TreeItem, { nodeId: group.title, label: /* @__PURE__ */ jsx(Typography, { variant: "h6", children: group.title }), children: group.children.map((child, jndex) => {
18
+ const searchTermTrimmed = searchTerm?.trim().toLowerCase();
19
+ const childReflection = typeof child === "number" ? lookup?.[child] : child;
20
+ return childReflection && (!searchTermTrimmed || childReflection.name.toLowerCase().indexOf(searchTermTrimmed) !== -1) ? /* @__PURE__ */ jsx(
21
+ TreeItem,
22
+ {
23
+ nodeId: `declaration-${childReflection?.id}`,
24
+ label: childReflection.name,
25
+ onClick: () => {
26
+ const hash = `#${childReflection.name}`;
27
+ navigate({ hash });
28
+ document.querySelector(hash)?.scrollIntoView({ behavior: "smooth" });
29
+ }
30
+ },
31
+ `secondary-${index}- ${jndex}`
32
+ ) : null;
33
+ }) }, `primary-${index}`))
34
+ }
35
+ ) });
36
+ };
37
+
38
+ // src/TreeViewer/ReflectionGroup.tsx
39
+ import { Typography as Typography5 } from "@mui/material";
40
+ import { FlexCol as FlexCol4, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
41
+
42
+ // src/JsonViewerButton.tsx
43
+ import { Dialog, DialogActions, DialogContent, DialogTitle } from "@mui/material";
44
+ import { ButtonEx } from "@xylabs/react-button";
45
+ import { lazy, Suspense, useState } from "react";
46
+ import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
47
+ var JsonView = lazy(() => import(
48
+ /* webpackChunkName: "jsonView" */
49
+ "react-json-view"
50
+ ));
51
+ var JsonViewerButton = ({ jsonViewProps, src, title, ...props }) => {
52
+ const [open, setOpen] = useState(false);
53
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
54
+ /* @__PURE__ */ jsx2(ButtonEx, { onClick: () => setOpen(!open), ...props, children: "JSON" }),
55
+ /* @__PURE__ */ jsxs(Dialog, { open, onClose: () => setOpen(false), children: [
56
+ title ? /* @__PURE__ */ jsx2(DialogTitle, { children: title }) : null,
57
+ /* @__PURE__ */ jsx2(DialogContent, { children: /* @__PURE__ */ jsx2(Suspense, { fallback: /* @__PURE__ */ jsx2("div", {}), children: /* @__PURE__ */ jsx2(JsonView, { src, ...jsonViewProps }) }) }),
58
+ /* @__PURE__ */ jsx2(DialogActions, { children: /* @__PURE__ */ jsx2(ButtonEx, { onClick: () => setOpen(false), children: "Close" }) })
59
+ ] })
60
+ ] });
61
+ };
62
+
63
+ // src/resolveChildren.ts
64
+ var resolveChildren = (reflection, lookup = {}) => {
65
+ return reflection.children?.map((child) => {
66
+ switch (typeof child) {
67
+ case "object":
68
+ return child;
69
+ case "number": {
70
+ const childObj = lookup[child];
71
+ if (childObj === void 0) {
72
+ throw Error(`Child Reference Not Found [${child}]`);
73
+ }
74
+ return childObj;
75
+ }
76
+ default:
77
+ throw Error(`Invalid Child Type [${typeof child}, ${child}]`);
78
+ }
79
+ }) ?? [];
80
+ };
81
+
82
+ // src/ReflectionViewer/ReflectionViewer.tsx
83
+ import { FlexCol as FlexCol3 } from "@xylabs/react-flexbox";
84
+
85
+ // src/CommentViewer.tsx
86
+ import { Typography as Typography2 } from "@mui/material";
87
+ import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
88
+ import { jsx as jsx3 } from "react/jsx-runtime";
89
+ var CommentViewer = ({ comment, ...props }) => {
90
+ return /* @__PURE__ */ jsx3(FlexCol2, { alignItems: "stretch", ...props, children: /* @__PURE__ */ jsx3(Typography2, { variant: "body2", children: comment.summary[0]?.text }) });
91
+ };
92
+
93
+ // src/ReflectionViewer/NameViewer.tsx
94
+ import { Chip, Stack, Typography as Typography4 } from "@mui/material";
95
+ import { FlexRow } from "@xylabs/react-flexbox";
96
+
97
+ // src/trimFlagLabel.ts
98
+ var trimFlagLabel = (label) => {
99
+ if (label.startsWith("is")) {
100
+ return label.substring(2);
101
+ }
102
+ return label;
103
+ };
104
+
105
+ // src/ReflectionViewer/SomeTypeViewer/SomeTypeViewer.tsx
106
+ import { Typography as Typography3 } from "@mui/material";
107
+
108
+ // src/ReflectionViewer/SomeTypeViewer/buildArrayString.tsx
109
+ var buildArrayString = (typeObj, reflectionViewer, typeBuilder) => {
110
+ const parts = [];
111
+ const typeString = typeBuilder(typeObj.elementType, reflectionViewer);
112
+ if (typeof typeString === "string") {
113
+ parts.push(typeString);
114
+ }
115
+ parts.push("[]");
116
+ return parts;
117
+ };
118
+
119
+ // src/ReflectionViewer/SomeTypeViewer/buildIntersectionString.tsx
120
+ var buildIntersectionString = (typeObj, reflectionViewer, typeBuilder) => {
121
+ const parts = [];
122
+ if (typeObj.types) {
123
+ parts.push(
124
+ typeObj.types.map((arg) => {
125
+ return typeBuilder(arg, reflectionViewer);
126
+ }).join(" & ")
127
+ );
128
+ }
129
+ return parts;
130
+ };
131
+
132
+ // src/ReflectionViewer/SomeTypeViewer/buildReferenceString.ts
133
+ var buildReferenceString = (typeObj, reflectionViewer, typeBuilder) => {
134
+ const parts = [];
135
+ parts.push(typeObj.name);
136
+ if (typeObj.typeArguments) {
137
+ parts.push("<");
138
+ parts.push(
139
+ typeObj.typeArguments.map((arg) => {
140
+ return typeBuilder(arg, reflectionViewer);
141
+ }).join(", ")
142
+ );
143
+ parts.push(">");
144
+ }
145
+ return parts;
146
+ };
147
+
148
+ // src/ReflectionViewer/SomeTypeViewer/buildReflectionString.tsx
149
+ import { Fragment as Fragment2, jsx as jsx4 } from "react/jsx-runtime";
150
+ var buildRelfectionString = (typeObj, reflectionViewer) => {
151
+ if (typeObj.declaration) {
152
+ return /* @__PURE__ */ jsx4(Fragment2, { children: reflectionViewer({ reflection: typeObj.declaration }) });
153
+ }
154
+ };
155
+
156
+ // src/ReflectionViewer/SomeTypeViewer/buildUnionString.tsx
157
+ var buildUnionString = (typeObj, reflectionViewer, typeBuilder) => {
158
+ const parts = [];
159
+ if (typeObj.types) {
160
+ parts.push(
161
+ typeObj.types.map((arg) => {
162
+ return typeBuilder(arg, reflectionViewer);
163
+ }).join(" | ")
164
+ );
165
+ }
166
+ return parts;
167
+ };
168
+
169
+ // src/ReflectionViewer/SomeTypeViewer/buildTypeString.tsx
170
+ var buildTypeString = (type, reflectionViewer) => {
171
+ const someType = type;
172
+ const parts = [];
173
+ switch (someType.type) {
174
+ case "intrinsic":
175
+ parts.push(someType.name);
176
+ break;
177
+ case "intersection": {
178
+ parts.push(...buildIntersectionString(someType, reflectionViewer, buildTypeString));
179
+ break;
180
+ }
181
+ case "literal":
182
+ parts.push(JSON.stringify(someType.value));
183
+ break;
184
+ case "array": {
185
+ parts.push(...buildArrayString(someType, reflectionViewer, buildTypeString));
186
+ break;
187
+ }
188
+ case "reference": {
189
+ parts.push(...buildReferenceString(someType, reflectionViewer, buildTypeString));
190
+ break;
191
+ }
192
+ case "union": {
193
+ parts.push(...buildUnionString(someType, reflectionViewer, buildTypeString));
194
+ break;
195
+ }
196
+ case "reflection": {
197
+ return buildRelfectionString(someType, reflectionViewer);
198
+ }
199
+ default:
200
+ parts.push("#");
201
+ parts.push(someType.type);
202
+ parts.push("#");
203
+ break;
204
+ }
205
+ return parts.join("");
206
+ };
207
+
208
+ // src/ReflectionViewer/SomeTypeViewer/SomeTypeViewer.tsx
209
+ import { Fragment as Fragment3, jsx as jsx5 } from "react/jsx-runtime";
210
+ var SomeTypeViewer = ({ opacity = 0.5, reflection, reflectionViewer, ...props }) => {
211
+ const typeReactNode = reflection.type ? buildTypeString(reflection.type, reflectionViewer) : "";
212
+ if (typeof typeReactNode === "string") {
213
+ return /* @__PURE__ */ jsx5(Typography3, { title: "SomeTypeViewer", style: { opacity }, ...props, children: typeReactNode });
214
+ }
215
+ return /* @__PURE__ */ jsx5(Fragment3, { children: typeReactNode });
216
+ };
217
+
218
+ // src/ReflectionViewer/NameViewer.tsx
219
+ import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
220
+ var NameViewer = ({ reflectionViewer, variant, reflection, ...props }) => {
221
+ return /* @__PURE__ */ jsxs2(FlexRow, { justifyContent: "flex-start", ...props, children: [
222
+ /* @__PURE__ */ jsxs2(FlexRow, { marginRight: 1, children: [
223
+ /* @__PURE__ */ jsxs2(Typography4, { variant, noWrap: true, children: [
224
+ reflection.name,
225
+ reflection.type ? /* @__PURE__ */ jsx6(Fragment4, { children: ":\xA0" }) : null
226
+ ] }),
227
+ /* @__PURE__ */ jsx6(SomeTypeViewer, { reflection, reflectionViewer })
228
+ ] }),
229
+ /* @__PURE__ */ jsxs2(Stack, { direction: "row", spacing: 1, children: [
230
+ /* @__PURE__ */ jsx6(Chip, { size: "small", label: reflection.kind }),
231
+ reflection.flags ? Object.entries(reflection.flags).map(([flag, value]) => {
232
+ return value ? /* @__PURE__ */ jsx6(Chip, { size: "small", label: trimFlagLabel(flag), variant: "outlined" }, flag) : null;
233
+ }) : null
234
+ ] }),
235
+ document && document?.location.hostname === "localhost" && /* @__PURE__ */ jsx6(JsonViewerButton, { jsonViewProps: { collapsed: 1 }, size: "small", variant: "contained", padding: 0, marginX: 1, src: reflection })
236
+ ] });
237
+ };
238
+
239
+ // src/ReflectionViewer/ReflectionViewer.tsx
240
+ import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
241
+ var hide = (flags, hiddenFlags = []) => {
242
+ let hide2 = false;
243
+ hiddenFlags.map((hiddenFlag) => {
244
+ if (flags?.[hiddenFlag]) {
245
+ hide2 = true;
246
+ }
247
+ });
248
+ return hide2;
249
+ };
250
+ var ReflectionViewer = ({ variant, nameViewer, children, reflection, hiddenFlags, ...props }) => {
251
+ const someReflection = reflection;
252
+ return hide(reflection?.flags, hiddenFlags) ? null : /* @__PURE__ */ jsxs3(FlexCol3, { title: "ReflectionViewer", alignItems: "stretch", ...props, children: [
253
+ nameViewer === void 0 ? /* @__PURE__ */ jsx7(NameViewer, { marginY: 0.25, variant, reflection: someReflection, reflectionViewer: ReflectionViewer }) : nameViewer,
254
+ reflection.comment ? /* @__PURE__ */ jsx7(CommentViewer, { comment: reflection.comment }) : null,
255
+ someReflection.parameters?.map((parameter) => {
256
+ return /* @__PURE__ */ jsx7(ReflectionViewer, { hiddenFlags, marginY: 0.25, marginX: 1, reflection: parameter }, parameter.id);
257
+ }) ?? null,
258
+ children
259
+ ] });
260
+ };
261
+
262
+ // src/TreeViewer/ReflectionGroup.tsx
263
+ import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
264
+ var ReflectionGroupTreeViewer = ({
265
+ variant,
266
+ group,
267
+ children,
268
+ lookup,
269
+ renderer = ReflectionViewer,
270
+ ...props
271
+ }) => {
272
+ return /* @__PURE__ */ jsxs4(FlexCol4, { ...props, children: [
273
+ /* @__PURE__ */ jsxs4(FlexRow2, { marginY: 1, justifyContent: "flex-start", children: [
274
+ /* @__PURE__ */ jsx8(Typography5, { variant, children: group.title }),
275
+ /* @__PURE__ */ jsx8(
276
+ JsonViewerButton,
277
+ {
278
+ jsonViewProps: { collapsed: 1 },
279
+ size: "small",
280
+ variant: "contained",
281
+ padding: 0,
282
+ marginX: 1,
283
+ src: resolveChildren(group, lookup)
284
+ }
285
+ )
286
+ ] }),
287
+ resolveChildren(group, lookup).map((reflection) => {
288
+ return reflection ? (
289
+ // I wrap this in a div since React does not understand that they have keys using the Renderer
290
+ /* @__PURE__ */ jsx8("div", { children: renderer({ lookup, margin: 1, reflection }) }, reflection.id)
291
+ ) : null;
292
+ }),
293
+ children
294
+ ] });
295
+ };
296
+ export {
297
+ ReflectionGroupTreeViewer,
298
+ ReflectionTreeViewer
299
+ };
3
300
  //# sourceMappingURL=index.js.map