@xyo-network/react-typedoc 2.77.0 → 2.77.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.
@@ -1,594 +1,2 @@
1
- // src/CommentViewer.tsx
2
- import { Typography } from "@mui/material";
3
- import { FlexCol } from "@xylabs/react-flexbox";
4
- import { jsx } from "react/jsx-runtime";
5
- var CommentViewer = ({ comment, ...props }) => {
6
- return /* @__PURE__ */ jsx(FlexCol, { alignItems: "stretch", ...props, children: /* @__PURE__ */ jsx(Typography, { variant: "body2", children: comment.summary[0]?.text }) });
7
- };
8
-
9
- // src/JsonViewerButton.tsx
10
- import { Dialog, DialogActions, DialogContent, DialogTitle } from "@mui/material";
11
- import { ButtonEx } from "@xylabs/react-button";
12
- import { JsonViewerEx } from "@xyo-network/react-payload-raw-info";
13
- import { useState } from "react";
14
- import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
15
- var JsonViewerButton = ({ jsonViewProps, src, title, ...props }) => {
16
- const [open, setOpen] = useState(false);
17
- return /* @__PURE__ */ jsxs(Fragment, { children: [
18
- /* @__PURE__ */ jsx2(ButtonEx, { onClick: () => setOpen(!open), ...props, children: "JSON" }),
19
- /* @__PURE__ */ jsxs(Dialog, { open, onClose: () => setOpen(false), children: [
20
- title ? /* @__PURE__ */ jsx2(DialogTitle, { children: title }) : null,
21
- /* @__PURE__ */ jsx2(DialogContent, { children: /* @__PURE__ */ jsx2(JsonViewerEx, { value: src, ...jsonViewProps }) }),
22
- /* @__PURE__ */ jsx2(DialogActions, { children: /* @__PURE__ */ jsx2(ButtonEx, { onClick: () => setOpen(false), children: "Close" }) })
23
- ] })
24
- ] });
25
- };
26
-
27
- // src/ProjectTwoPanelReflectionViewer.tsx
28
- import { assertEx } from "@xylabs/assert";
29
-
30
- // src/createLookup.ts
31
- var createLookup = (reflection) => {
32
- const lookup = {};
33
- if (reflection.children)
34
- for (const item of reflection.children)
35
- lookup[item.id] = item;
36
- return lookup;
37
- };
38
-
39
- // src/ReflectionViewer/ReflectionGroupViewer.tsx
40
- import { Typography as Typography4 } from "@mui/material";
41
- import { FlexCol as FlexCol3, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
42
- import { useEffect } from "react";
43
- import { useLocation } from "react-router-dom";
44
-
45
- // src/resolveChildren.ts
46
- var resolveChildren = (reflection, lookup = {}) => {
47
- return reflection.children?.map((child) => {
48
- switch (typeof child) {
49
- case "object": {
50
- return child;
51
- }
52
- case "number": {
53
- const childObj = lookup[child];
54
- if (childObj === void 0) {
55
- throw new Error(`Child Reference Not Found [${child}]`);
56
- }
57
- return childObj;
58
- }
59
- default: {
60
- throw new Error(`Invalid Child Type [${typeof child}, ${child}]`);
61
- }
62
- }
63
- }) ?? [];
64
- };
65
-
66
- // src/ReflectionViewer/ReflectionViewer.tsx
67
- import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
68
-
69
- // src/ReflectionViewer/NameViewer.tsx
70
- import { Chip, Stack, Typography as Typography3 } from "@mui/material";
71
- import { FlexRow } from "@xylabs/react-flexbox";
72
-
73
- // src/trimFlagLabel.ts
74
- var trimFlagLabel = (label) => {
75
- if (label.startsWith("is")) {
76
- return label.slice(2);
77
- }
78
- return label;
79
- };
80
-
81
- // src/ReflectionViewer/SomeTypeViewer/SomeTypeViewer.tsx
82
- import { Typography as Typography2 } from "@mui/material";
83
-
84
- // src/ReflectionViewer/SomeTypeViewer/buildArrayString.tsx
85
- var buildArrayString = (typeObj, reflectionViewer, typeBuilder) => {
86
- const parts = [];
87
- const typeString = typeBuilder(typeObj.elementType, reflectionViewer);
88
- if (typeof typeString === "string") {
89
- parts.push(typeString);
90
- }
91
- parts.push("[]");
92
- return parts;
93
- };
94
-
95
- // src/ReflectionViewer/SomeTypeViewer/buildIntersectionString.tsx
96
- var buildIntersectionString = (typeObj, reflectionViewer, typeBuilder) => {
97
- const parts = [];
98
- if (typeObj.types) {
99
- parts.push(
100
- typeObj.types.map((arg) => {
101
- return typeBuilder(arg, reflectionViewer);
102
- }).join(" & ")
103
- );
104
- }
105
- return parts;
106
- };
107
-
108
- // src/ReflectionViewer/SomeTypeViewer/buildReferenceString.ts
109
- var buildReferenceString = (typeObj, reflectionViewer, typeBuilder) => {
110
- const parts = [];
111
- parts.push(typeObj.name);
112
- if (typeObj.typeArguments) {
113
- parts.push(
114
- "<",
115
- typeObj.typeArguments.map((arg) => {
116
- return typeBuilder(arg, reflectionViewer);
117
- }).join(", "),
118
- ">"
119
- );
120
- }
121
- return parts;
122
- };
123
-
124
- // src/ReflectionViewer/SomeTypeViewer/buildReflectionString.tsx
125
- import { Fragment as Fragment2, jsx as jsx3 } from "react/jsx-runtime";
126
- var buildRelfectionString = (typeObj, reflectionViewer) => {
127
- if (typeObj.declaration) {
128
- return /* @__PURE__ */ jsx3(Fragment2, { children: reflectionViewer({ reflection: typeObj.declaration }) });
129
- }
130
- };
131
-
132
- // src/ReflectionViewer/SomeTypeViewer/buildUnionString.tsx
133
- var buildUnionString = (typeObj, reflectionViewer, typeBuilder) => {
134
- const parts = [];
135
- if (typeObj.types) {
136
- parts.push(
137
- typeObj.types.map((arg) => {
138
- return typeBuilder(arg, reflectionViewer);
139
- }).join(" | ")
140
- );
141
- }
142
- return parts;
143
- };
144
-
145
- // src/ReflectionViewer/SomeTypeViewer/buildTypeString.tsx
146
- var buildTypeString = (type, reflectionViewer) => {
147
- const someType = type;
148
- const parts = [];
149
- switch (someType.type) {
150
- case "intrinsic": {
151
- parts.push(someType.name);
152
- break;
153
- }
154
- case "intersection": {
155
- parts.push(...buildIntersectionString(someType, reflectionViewer, buildTypeString));
156
- break;
157
- }
158
- case "literal": {
159
- parts.push(JSON.stringify(someType.value));
160
- break;
161
- }
162
- case "array": {
163
- parts.push(...buildArrayString(someType, reflectionViewer, buildTypeString));
164
- break;
165
- }
166
- case "reference": {
167
- parts.push(...buildReferenceString(someType, reflectionViewer, buildTypeString));
168
- break;
169
- }
170
- case "union": {
171
- parts.push(...buildUnionString(someType, reflectionViewer, buildTypeString));
172
- break;
173
- }
174
- case "reflection": {
175
- return buildRelfectionString(someType, reflectionViewer);
176
- }
177
- default: {
178
- parts.push("#", someType.type, "#");
179
- break;
180
- }
181
- }
182
- return parts.join("");
183
- };
184
-
185
- // src/ReflectionViewer/SomeTypeViewer/SomeTypeViewer.tsx
186
- import { Fragment as Fragment3, jsx as jsx4 } from "react/jsx-runtime";
187
- var SomeTypeViewer = ({ opacity = 0.5, reflection, reflectionViewer, ...props }) => {
188
- const typeReactNode = reflection.type ? buildTypeString(reflection.type, reflectionViewer) : "";
189
- if (typeof typeReactNode === "string") {
190
- return /* @__PURE__ */ jsx4(Typography2, { title: "SomeTypeViewer", style: { opacity }, ...props, children: typeReactNode });
191
- }
192
- return /* @__PURE__ */ jsx4(Fragment3, { children: typeReactNode });
193
- };
194
-
195
- // src/ReflectionViewer/NameViewer.tsx
196
- import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
197
- var NameViewer = ({ reflectionViewer, variant, reflection, ...props }) => {
198
- return /* @__PURE__ */ jsxs2(FlexRow, { justifyContent: "flex-start", ...props, children: [
199
- /* @__PURE__ */ jsxs2(FlexRow, { marginRight: 1, children: [
200
- /* @__PURE__ */ jsxs2(Typography3, { variant, noWrap: true, children: [
201
- reflection.name,
202
- reflection.type ? /* @__PURE__ */ jsx5(Fragment4, { children: ":\xA0" }) : null
203
- ] }),
204
- /* @__PURE__ */ jsx5(SomeTypeViewer, { reflection, reflectionViewer })
205
- ] }),
206
- /* @__PURE__ */ jsxs2(Stack, { direction: "row", spacing: 1, children: [
207
- /* @__PURE__ */ jsx5(Chip, { size: "small", label: reflection.kind }),
208
- reflection.flags ? Object.entries(reflection.flags).map(([flag, value]) => {
209
- return value ? /* @__PURE__ */ jsx5(Chip, { size: "small", label: trimFlagLabel(flag), variant: "outlined" }, flag) : null;
210
- }) : null
211
- ] }),
212
- document && document?.location.hostname === "localhost" && /* @__PURE__ */ jsx5(JsonViewerButton, { size: "small", variant: "contained", padding: 0, marginX: 1, src: reflection })
213
- ] });
214
- };
215
-
216
- // src/ReflectionViewer/ReflectionViewer.tsx
217
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
218
- var hide = (flags, hiddenFlags = []) => {
219
- let hide3 = false;
220
- hiddenFlags.map((hiddenFlag) => {
221
- if (flags?.[hiddenFlag]) {
222
- hide3 = true;
223
- }
224
- });
225
- return hide3;
226
- };
227
- var ReflectionViewer = ({ variant, nameViewer, children, reflection, hiddenFlags, ...props }) => {
228
- const someReflection = reflection;
229
- return hide(reflection?.flags, hiddenFlags) ? null : /* @__PURE__ */ jsxs3(FlexCol2, { title: "ReflectionViewer", alignItems: "stretch", ...props, children: [
230
- nameViewer === void 0 ? /* @__PURE__ */ jsx6(NameViewer, { marginY: 0.25, variant, reflection: someReflection, reflectionViewer: ReflectionViewer }) : nameViewer,
231
- reflection.comment ? /* @__PURE__ */ jsx6(CommentViewer, { comment: reflection.comment }) : null,
232
- someReflection.parameters?.map((parameter) => {
233
- return /* @__PURE__ */ jsx6(ReflectionViewer, { hiddenFlags, marginY: 0.25, marginX: 1, reflection: parameter }, parameter.id);
234
- }) ?? null,
235
- children
236
- ] });
237
- };
238
-
239
- // src/ReflectionViewer/ReflectionGroupViewer.tsx
240
- import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
241
- var hide2 = (flags, hiddenFlags = []) => {
242
- let hide3 = false;
243
- hiddenFlags.map((hiddenFlag) => {
244
- if (flags?.[hiddenFlag]) {
245
- hide3 = true;
246
- }
247
- });
248
- return hide3;
249
- };
250
- var ReflectionGroupViewer = ({
251
- autoScroll = false,
252
- children,
253
- hiddenFlags,
254
- group,
255
- lookup,
256
- renderer = ReflectionViewer,
257
- variant,
258
- ...props
259
- }) => {
260
- const resolvedChildren = resolveChildren(group, lookup) ?? [];
261
- const visibleChildren = hiddenFlags ? resolvedChildren.reduce((acc, item) => {
262
- return acc + (hide2(item.flags, hiddenFlags) ? 0 : 1);
263
- }, 0) : 1;
264
- const { hash } = useLocation();
265
- useEffect(() => {
266
- if (hash && autoScroll) {
267
- document.querySelector(hash)?.scrollIntoView({ behavior: "smooth" });
268
- }
269
- }, [hash, autoScroll]);
270
- return visibleChildren > 0 ? /* @__PURE__ */ jsxs4(FlexCol3, { title: "ReflectionGroupViewer", ...props, children: [
271
- /* @__PURE__ */ jsxs4(FlexRow2, { marginY: 1, justifyContent: "flex-start", children: [
272
- /* @__PURE__ */ jsx7(Typography4, { variant, children: group.title }),
273
- /* @__PURE__ */ jsx7(JsonViewerButton, { size: "small", variant: "contained", padding: 0, marginX: 1, src: resolveChildren(group, lookup) })
274
- ] }),
275
- resolveChildren(group, lookup).map((reflection) => {
276
- return reflection ? (
277
- // I wrap this in a div since React does not understand that they have keys using the Renderer
278
- /* @__PURE__ */ jsx7("div", { id: reflection.name, children: renderer({ hiddenFlags, lookup, margin: 1, padding: 1, reflection }) }, reflection.id)
279
- ) : null;
280
- }),
281
- children
282
- ] }) : null;
283
- };
284
-
285
- // src/ReflectionViewer/Container.tsx
286
- import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
287
- var ContainerReflectionViewer = ({
288
- children,
289
- reflection,
290
- hiddenFlags,
291
- itemRenderer = ReflectionViewer,
292
- ...props
293
- }) => {
294
- const lookup = createLookup(reflection);
295
- return /* @__PURE__ */ jsxs5(ReflectionViewer, { title: "ContainerReflectionViewer", sources: true, reflection, lookup, ...props, children: [
296
- reflection.groups?.map((group) => {
297
- return /* @__PURE__ */ jsx8(
298
- ReflectionGroupViewer,
299
- {
300
- margin: 1,
301
- lookup,
302
- renderer: itemRenderer,
303
- group,
304
- reflection,
305
- hiddenFlags,
306
- alignItems: "stretch"
307
- },
308
- group.title
309
- );
310
- }),
311
- children
312
- ] });
313
- };
314
-
315
- // src/ReflectionViewer/Declaration.tsx
316
- import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
317
- var DeclarationReflectionViewer = ({ reflection, hiddenFlags, ...props }) => {
318
- const safeSignatures = (signatures) => {
319
- return Array.isArray(signatures) ? signatures : signatures ? [signatures] : void 0;
320
- };
321
- return /* @__PURE__ */ jsxs6(
322
- ReflectionViewer,
323
- {
324
- nameViewer: reflection.signatures || reflection.getSignature || reflection.setSignature ? null : void 0,
325
- title: "DeclarationReflectionViewer",
326
- hiddenFlags,
327
- reflection,
328
- ...props,
329
- children: [
330
- reflection.signatures?.map((signature) => {
331
- return /* @__PURE__ */ jsx9(ReflectionViewer, { hiddenFlags, reflection: signature }, signature.id);
332
- }),
333
- safeSignatures(reflection.getSignature)?.map((signature) => {
334
- return /* @__PURE__ */ jsx9(ReflectionViewer, { marginX: 1, hiddenFlags, reflection: signature }, signature.id);
335
- }),
336
- safeSignatures(reflection.setSignature)?.map((signature) => {
337
- return /* @__PURE__ */ jsx9(ReflectionViewer, { marginX: 1, hiddenFlags, reflection: signature }, signature.id);
338
- })
339
- ]
340
- }
341
- );
342
- };
343
-
344
- // src/ReflectionViewer/DeclarationContainer.tsx
345
- import { useTheme } from "@mui/material";
346
- import { useLocation as useLocation2 } from "react-router-dom";
347
- import { jsx as jsx10 } from "react/jsx-runtime";
348
- var DeclarationContainerReflectionViewer = ({
349
- reflection,
350
- lookup,
351
- itemRenderer = DeclarationReflectionViewer,
352
- ...props
353
- }) => {
354
- const { hash } = useLocation2();
355
- const theme = useTheme();
356
- return /* @__PURE__ */ jsx10(
357
- ContainerReflectionViewer,
358
- {
359
- title: "DeclarationContainerReflectionViewer",
360
- paper: hash.slice(1) === reflection.name,
361
- bgcolor: hash.slice(1) === reflection.name ? theme.palette.background.default : void 0,
362
- lookup,
363
- itemRenderer,
364
- reflection,
365
- ...props
366
- }
367
- );
368
- };
369
-
370
- // src/ReflectionViewer/Project.tsx
371
- import { useMemo } from "react";
372
- import { jsx as jsx11 } from "react/jsx-runtime";
373
- var ProjectReflectionViewer = ({
374
- reflection,
375
- hiddenFlags,
376
- itemRenderer = ReflectionViewer,
377
- ...props
378
- }) => {
379
- const lookup = useMemo(() => createLookup(reflection), [reflection]);
380
- return /* @__PURE__ */ jsx11(ReflectionViewer, { title: "ProjectReflectionViewer", hiddenFlags, reflection, ...props, children: useMemo(() => {
381
- return reflection.groups?.map((group) => {
382
- return /* @__PURE__ */ jsx11(
383
- ReflectionGroupViewer,
384
- {
385
- autoScroll: true,
386
- variant: "h6",
387
- lookup,
388
- renderer: itemRenderer,
389
- group,
390
- reflection,
391
- alignItems: "stretch",
392
- hiddenFlags
393
- },
394
- group.title
395
- );
396
- });
397
- }, [lookup, reflection, hiddenFlags, itemRenderer]) });
398
- };
399
-
400
- // src/TwoPanelReflectionViewer.tsx
401
- import { Search } from "@mui/icons-material";
402
- import { TextField, useTheme as useTheme2 } from "@mui/material";
403
- import { FlexCol as FlexCol6, FlexGrowCol, FlexRow as FlexRow4 } from "@xylabs/react-flexbox";
404
- import { useMemo as useMemo2, useState as useState2 } from "react";
405
-
406
- // src/TreeViewer/Reflection.tsx
407
- import { Add, Remove } from "@mui/icons-material";
408
- import { Typography as Typography5 } from "@mui/material";
409
- import { TreeItem, TreeView } from "@mui/x-tree-view";
410
- import { FlexCol as FlexCol4 } from "@xylabs/react-flexbox";
411
- import { useNavigate } from "react-router-dom";
412
- import { jsx as jsx12 } from "react/jsx-runtime";
413
- var ReflectionTreeViewer = ({ lookup, reflection, searchTerm, ...props }) => {
414
- const navigate = useNavigate();
415
- return /* @__PURE__ */ jsx12(FlexCol4, { alignItems: "stretch", ...props, children: /* @__PURE__ */ jsx12(
416
- TreeView,
417
- {
418
- "aria-label": "XYO SDK Documentation",
419
- defaultExpandIcon: /* @__PURE__ */ jsx12(Add, {}),
420
- defaultCollapseIcon: /* @__PURE__ */ jsx12(Remove, {}),
421
- defaultExpanded: reflection.groups ? [reflection.groups[0].title] : [],
422
- children: reflection.groups?.map((group, index) => /* @__PURE__ */ jsx12(TreeItem, { nodeId: group.title, label: /* @__PURE__ */ jsx12(Typography5, { variant: "h6", children: group.title }), children: group.children.map((child, jndex) => {
423
- const searchTermTrimmed = searchTerm?.trim().toLowerCase();
424
- const childReflection = typeof child === "number" ? lookup?.[child] : child;
425
- return childReflection && (!searchTermTrimmed || childReflection.name.toLowerCase().includes(searchTermTrimmed)) ? /* @__PURE__ */ jsx12(
426
- TreeItem,
427
- {
428
- nodeId: `declaration-${childReflection?.id}`,
429
- label: childReflection.name,
430
- onClick: () => {
431
- const hash = `#${childReflection.name}`;
432
- navigate({ hash });
433
- document.querySelector(hash)?.scrollIntoView({ behavior: "smooth" });
434
- }
435
- },
436
- `secondary-${index}- ${jndex}`
437
- ) : null;
438
- }) }, `primary-${index}`))
439
- }
440
- ) });
441
- };
442
-
443
- // src/TreeViewer/ReflectionGroup.tsx
444
- import { Typography as Typography6 } from "@mui/material";
445
- import { FlexCol as FlexCol5, FlexRow as FlexRow3 } from "@xylabs/react-flexbox";
446
- import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
447
- var ReflectionGroupTreeViewer = ({
448
- variant,
449
- group,
450
- children,
451
- lookup,
452
- renderer = ReflectionViewer,
453
- ...props
454
- }) => {
455
- return /* @__PURE__ */ jsxs7(FlexCol5, { ...props, children: [
456
- /* @__PURE__ */ jsxs7(FlexRow3, { marginY: 1, justifyContent: "flex-start", children: [
457
- /* @__PURE__ */ jsx13(Typography6, { variant, children: group.title }),
458
- /* @__PURE__ */ jsx13(JsonViewerButton, { size: "small", variant: "contained", padding: 0, marginX: 1, src: resolveChildren(group, lookup) })
459
- ] }),
460
- resolveChildren(group, lookup).map((reflection) => {
461
- return reflection ? (
462
- // I wrap this in a div since React does not understand that they have keys using the Renderer
463
- /* @__PURE__ */ jsx13("div", { children: renderer({ lookup, margin: 1, reflection }) }, reflection.id)
464
- ) : null;
465
- }),
466
- children
467
- ] });
468
- };
469
-
470
- // src/TwoPanelReflectionViewer.tsx
471
- import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
472
- var TwoPanelReflectionViewer = ({
473
- reflection,
474
- itemRenderer = ReflectionViewer,
475
- hiddenFlags,
476
- ...props
477
- }) => {
478
- const lookup = useMemo2(() => createLookup(reflection), [reflection]);
479
- const theme = useTheme2();
480
- const [searchTerm, setSearchTerm] = useState2();
481
- const onSearchTermChange = (e) => {
482
- setSearchTerm(e.target.value);
483
- };
484
- const reflectionGroups = useMemo2(() => {
485
- return reflection.groups?.map((group) => {
486
- return /* @__PURE__ */ jsx14(
487
- ReflectionGroupViewer,
488
- {
489
- autoScroll: true,
490
- variant: "h6",
491
- lookup,
492
- renderer: itemRenderer,
493
- group,
494
- reflection,
495
- alignItems: "stretch",
496
- hiddenFlags
497
- },
498
- group.title
499
- );
500
- });
501
- }, [itemRenderer, lookup, reflection, hiddenFlags]);
502
- const NavigationCol = (props2) => {
503
- return /* @__PURE__ */ jsxs8(FlexCol6, { ...props2, children: [
504
- /* @__PURE__ */ jsx14(
505
- TextField,
506
- {
507
- fullWidth: true,
508
- InputProps: {
509
- startAdornment: /* @__PURE__ */ jsx14(Search, {})
510
- },
511
- onChange: onSearchTermChange
512
- }
513
- ),
514
- /* @__PURE__ */ jsx14(FlexGrowCol, { marginTop: 1, alignItems: "stretch", children: /* @__PURE__ */ jsx14(
515
- ReflectionTreeViewer,
516
- {
517
- justifyContent: "flex-start",
518
- position: "absolute",
519
- top: 0,
520
- left: 0,
521
- right: 0,
522
- bottom: 0,
523
- overflow: "scroll",
524
- searchTerm,
525
- hiddenFlags,
526
- reflection,
527
- lookup,
528
- border: `1px solid ${theme.palette.grey["300"]}`,
529
- borderRadius: 1,
530
- paddingY: 1
531
- }
532
- ) })
533
- ] });
534
- };
535
- const DetailsCol = (props2) => {
536
- return /* @__PURE__ */ jsx14(FlexGrowCol, { ...props2, children: /* @__PURE__ */ jsx14(FlexGrowCol, { alignItems: "stretch", children: /* @__PURE__ */ jsx14(
537
- FlexCol6,
538
- {
539
- alignItems: "stretch",
540
- justifyContent: "flex-start",
541
- position: "absolute",
542
- top: 0,
543
- left: 0,
544
- right: 0,
545
- bottom: 0,
546
- overflow: "scroll",
547
- borderRadius: 1,
548
- padding: 1,
549
- border: `1px solid ${theme.palette.grey["300"]}`,
550
- children: reflectionGroups
551
- }
552
- ) }) });
553
- };
554
- return /* @__PURE__ */ jsxs8(FlexRow4, { alignItems: "stretch", justifyContent: "start", sx: { overflowY: "scroll" }, ...props, children: [
555
- /* @__PURE__ */ jsx14(NavigationCol, { minWidth: 320, alignItems: "stretch", justifyContent: "flex-start", overflow: "hidden" }),
556
- /* @__PURE__ */ jsx14(DetailsCol, { marginLeft: 1, alignItems: "stretch", justifyContent: "flex-start", overflow: "hidden" })
557
- ] });
558
- };
559
-
560
- // src/ProjectTwoPanelReflectionViewer.tsx
561
- import { jsx as jsx15 } from "react/jsx-runtime";
562
- var ProjectTwoPanelReflectionViewer = ({
563
- reflection,
564
- itemRenderer = DeclarationContainerReflectionViewer,
565
- ...props
566
- }) => {
567
- assertEx(reflection.isProject, () => "Project expected to be Project");
568
- return /* @__PURE__ */ jsx15(TwoPanelReflectionViewer, { itemRenderer, reflection, ...props });
569
- };
570
-
571
- // src/SourceViewer.tsx
572
- import { Typography as Typography7 } from "@mui/material";
573
- import { FlexCol as FlexCol7 } from "@xylabs/react-flexbox";
574
- import { jsx as jsx16 } from "react/jsx-runtime";
575
- var SourceViewer = ({ source, ...props }) => {
576
- return /* @__PURE__ */ jsx16(FlexCol7, { alignItems: "stretch", ...props, children: /* @__PURE__ */ jsx16(Typography7, { style: { opacity: 0.5 }, variant: "body2", children: /* @__PURE__ */ jsx16("i", { children: source.fileName }) }) });
577
- };
578
- export {
579
- CommentViewer,
580
- ContainerReflectionViewer,
581
- DeclarationContainerReflectionViewer,
582
- DeclarationReflectionViewer,
583
- JsonViewerButton,
584
- ProjectReflectionViewer,
585
- ProjectTwoPanelReflectionViewer,
586
- ReflectionGroupTreeViewer,
587
- ReflectionGroupViewer,
588
- ReflectionTreeViewer,
589
- ReflectionViewer,
590
- SomeTypeViewer,
591
- SourceViewer,
592
- TwoPanelReflectionViewer
593
- };
1
+ import{Typography as ie}from"@mui/material";import{FlexCol as ne}from"@xylabs/react-flexbox";import{jsx as B}from"react/jsx-runtime";var I=({comment:e,...r})=>B(ne,{alignItems:"stretch",...r,children:B(ie,{variant:"body2",children:e.summary[0]?.text})});import{Dialog as pe,DialogActions as le,DialogContent as ae,DialogTitle as ce}from"@mui/material";import{ButtonEx as D}from"@xylabs/react-button";import{JsonViewerEx as me}from"@xyo-network/react-payload-raw-info";import{useState as se}from"react";import{Fragment as fe,jsx as y,jsxs as G}from"react/jsx-runtime";var w=({jsonViewProps:e,src:r,title:o,...t})=>{let[i,n]=se(!1);return G(fe,{children:[y(D,{onClick:()=>n(!i),...t,children:"JSON"}),G(pe,{open:i,onClose:()=>n(!1),children:[o?y(ce,{children:o}):null,y(ae,{children:y(me,{value:r,...e})}),y(le,{children:y(D,{onClick:()=>n(!1),children:"Close"})})]})]})};import{assertEx as Ke}from"@xylabs/assert";var g=e=>{let r={};if(e.children)for(let o of e.children)r[o.id]=o;return r};import{Typography as Te}from"@mui/material";import{FlexCol as Fe,FlexRow as Pe}from"@xylabs/react-flexbox";import{useEffect as Se}from"react";import{useLocation as be}from"react-router-dom";var u=(e,r={})=>e.children?.map(o=>{switch(typeof o){case"object":return o;case"number":{let t=r[o];if(t===void 0)throw new Error(`Child Reference Not Found [${o}]`);return t}default:throw new Error(`Invalid Child Type [${typeof o}, ${o}]`)}})??[];import{FlexCol as xe}from"@xylabs/react-flexbox";import{Chip as j,Stack as we,Typography as ge}from"@mui/material";import{FlexRow as W}from"@xylabs/react-flexbox";var E=e=>e.startsWith("is")?e.slice(2):e;import{Typography as de}from"@mui/material";var L=(e,r,o)=>{let t=[],i=o(e.elementType,r);return typeof i=="string"&&t.push(i),t.push("[]"),t};var N=(e,r,o)=>{let t=[];return e.types&&t.push(e.types.map(i=>o(i,r)).join(" & ")),t};var A=(e,r,o)=>{let t=[];return t.push(e.name),e.typeArguments&&t.push("<",e.typeArguments.map(i=>o(i,r)).join(", "),">"),t};import{Fragment as ue,jsx as Re}from"react/jsx-runtime";var J=(e,r)=>{if(e.declaration)return Re(ue,{children:r({reflection:e.declaration})})};var $=(e,r,o)=>{let t=[];return e.types&&t.push(e.types.map(i=>o(i,r)).join(" | ")),t};var C=(e,r)=>{let o=e,t=[];switch(o.type){case"intrinsic":{t.push(o.name);break}case"intersection":{t.push(...N(o,r,C));break}case"literal":{t.push(JSON.stringify(o.value));break}case"array":{t.push(...L(o,r,C));break}case"reference":{t.push(...A(o,r,C));break}case"union":{t.push(...$(o,r,C));break}case"reflection":return J(o,r);default:{t.push("#",o.type,"#");break}}return t.join("")};import{Fragment as ye,jsx as X}from"react/jsx-runtime";var Y=({opacity:e=.5,reflection:r,reflectionViewer:o,...t})=>{let i=r.type?C(r.type,o):"";return typeof i=="string"?X(de,{title:"SomeTypeViewer",style:{opacity:e},...t,children:i}):X(ye,{children:i})};import{Fragment as Ce,jsx as h,jsxs as T}from"react/jsx-runtime";var z=({reflectionViewer:e,variant:r,reflection:o,...t})=>T(W,{justifyContent:"flex-start",...t,children:[T(W,{marginRight:1,children:[T(ge,{variant:r,noWrap:!0,children:[o.name,o.type?h(Ce,{children:":\xA0"}):null]}),h(Y,{reflection:o,reflectionViewer:e})]}),T(we,{direction:"row",spacing:1,children:[h(j,{size:"small",label:o.kind}),o.flags?Object.entries(o.flags).map(([i,n])=>n?h(j,{size:"small",label:E(i),variant:"outlined"},i):null):null]}),document&&document?.location.hostname==="localhost"&&h(w,{size:"small",variant:"contained",padding:0,marginX:1,src:o})]});import{jsx as F,jsxs as he}from"react/jsx-runtime";var Ve=(e,r=[])=>{let o=!1;return r.map(t=>{e?.[t]&&(o=!0)}),o},p=({variant:e,nameViewer:r,children:o,reflection:t,hiddenFlags:i,...n})=>{let l=t;return Ve(t?.flags,i)?null:he(xe,{title:"ReflectionViewer",alignItems:"stretch",...n,children:[r===void 0?F(z,{marginY:.25,variant:e,reflection:l,reflectionViewer:p}):r,t.comment?F(I,{comment:t.comment}):null,l.parameters?.map(a=>F(p,{hiddenFlags:i,marginY:.25,marginX:1,reflection:a},a.id))??null,o]})};import{jsx as P,jsxs as U}from"react/jsx-runtime";var ke=(e,r=[])=>{let o=!1;return r.map(t=>{e?.[t]&&(o=!0)}),o},x=({autoScroll:e=!1,children:r,hiddenFlags:o,group:t,lookup:i,renderer:n=p,variant:l,...a})=>{let V=u(t,i)??[],d=o?V.reduce((m,s)=>m+(ke(s.flags,o)?0:1),0):1,{hash:c}=be();return Se(()=>{c&&e&&document.querySelector(c)?.scrollIntoView({behavior:"smooth"})},[c,e]),d>0?U(Fe,{title:"ReflectionGroupViewer",...a,children:[U(Pe,{marginY:1,justifyContent:"flex-start",children:[P(Te,{variant:l,children:t.title}),P(w,{size:"small",variant:"contained",padding:0,marginX:1,src:u(t,i)})]}),u(t,i).map(m=>m?P("div",{id:m.name,children:n({hiddenFlags:o,lookup:i,margin:1,padding:1,reflection:m})},m.id):null),r]}):null};import{jsx as ve,jsxs as Be}from"react/jsx-runtime";var M=({children:e,reflection:r,hiddenFlags:o,itemRenderer:t=p,...i})=>{let n=g(r);return Be(p,{title:"ContainerReflectionViewer",sources:!0,reflection:r,lookup:n,...i,children:[r.groups?.map(l=>ve(x,{margin:1,lookup:n,renderer:t,group:l,reflection:r,hiddenFlags:o,alignItems:"stretch"},l.title)),e]})};import{jsx as S,jsxs as Ie}from"react/jsx-runtime";var q=({reflection:e,hiddenFlags:r,...o})=>{let t=i=>Array.isArray(i)?i:i?[i]:void 0;return Ie(p,{nameViewer:e.signatures||e.getSignature||e.setSignature?null:void 0,title:"DeclarationReflectionViewer",hiddenFlags:r,reflection:e,...o,children:[e.signatures?.map(i=>S(p,{hiddenFlags:r,reflection:i},i.id)),t(e.getSignature)?.map(i=>S(p,{marginX:1,hiddenFlags:r,reflection:i},i.id)),t(e.setSignature)?.map(i=>S(p,{marginX:1,hiddenFlags:r,reflection:i},i.id))]})};import{useTheme as De}from"@mui/material";import{useLocation as Ge}from"react-router-dom";import{jsx as Ee}from"react/jsx-runtime";var H=({reflection:e,lookup:r,itemRenderer:o=q,...t})=>{let{hash:i}=Ge(),n=De();return Ee(M,{title:"DeclarationContainerReflectionViewer",paper:i.slice(1)===e.name,bgcolor:i.slice(1)===e.name?n.palette.background.default:void 0,lookup:r,itemRenderer:o,reflection:e,...t})};import{useMemo as K}from"react";import{jsx as O}from"react/jsx-runtime";var Vr=({reflection:e,hiddenFlags:r,itemRenderer:o=p,...t})=>{let i=K(()=>g(e),[e]);return O(p,{title:"ProjectReflectionViewer",hiddenFlags:r,reflection:e,...t,children:K(()=>e.groups?.map(n=>O(x,{autoScroll:!0,variant:"h6",lookup:i,renderer:o,group:n,reflection:e,alignItems:"stretch",hiddenFlags:r},n.title)),[i,e,r,o])})};import{Search as ze}from"@mui/icons-material";import{TextField as Ue,useTheme as Me}from"@mui/material";import{FlexCol as ee,FlexGrowCol as k,FlexRow as qe}from"@xylabs/react-flexbox";import{useMemo as oe,useState as He}from"react";import{Add as Le,Remove as Ne}from"@mui/icons-material";import{Typography as Ae}from"@mui/material";import{TreeItem as Q,TreeView as Je}from"@mui/x-tree-view";import{FlexCol as $e}from"@xylabs/react-flexbox";import{useNavigate as Xe}from"react-router-dom";import{jsx as R}from"react/jsx-runtime";var Z=({lookup:e,reflection:r,searchTerm:o,...t})=>{let i=Xe();return R($e,{alignItems:"stretch",...t,children:R(Je,{"aria-label":"XYO SDK Documentation",defaultExpandIcon:R(Le,{}),defaultCollapseIcon:R(Ne,{}),defaultExpanded:r.groups?[r.groups[0].title]:[],children:r.groups?.map((n,l)=>R(Q,{nodeId:n.title,label:R(Ae,{variant:"h6",children:n.title}),children:n.children.map((a,V)=>{let d=o?.trim().toLowerCase(),c=typeof a=="number"?e?.[a]:a;return c&&(!d||c.name.toLowerCase().includes(d))?R(Q,{nodeId:`declaration-${c?.id}`,label:c.name,onClick:()=>{let m=`#${c.name}`;i({hash:m}),document.querySelector(m)?.scrollIntoView({behavior:"smooth"})}},`secondary-${l}- ${V}`):null})},`primary-${l}`))})})};import{Typography as Ye}from"@mui/material";import{FlexCol as je,FlexRow as We}from"@xylabs/react-flexbox";import{jsx as b,jsxs as _}from"react/jsx-runtime";var Jr=({variant:e,group:r,children:o,lookup:t,renderer:i=p,...n})=>_(je,{...n,children:[_(We,{marginY:1,justifyContent:"flex-start",children:[b(Ye,{variant:e,children:r.title}),b(w,{size:"small",variant:"contained",padding:0,marginX:1,src:u(r,t)})]}),u(r,t).map(l=>l?b("div",{children:i({lookup:t,margin:1,reflection:l})},l.id):null),o]});import{jsx as f,jsxs as re}from"react/jsx-runtime";var te=({reflection:e,itemRenderer:r=p,hiddenFlags:o,...t})=>{let i=oe(()=>g(e),[e]),n=Me(),[l,a]=He(),V=s=>{a(s.target.value)},d=oe(()=>e.groups?.map(s=>f(x,{autoScroll:!0,variant:"h6",lookup:i,renderer:r,group:s,reflection:e,alignItems:"stretch",hiddenFlags:o},s.title)),[r,i,e,o]);return re(qe,{alignItems:"stretch",justifyContent:"start",sx:{overflowY:"scroll"},...t,children:[f(s=>re(ee,{...s,children:[f(Ue,{fullWidth:!0,InputProps:{startAdornment:f(ze,{})},onChange:V}),f(k,{marginTop:1,alignItems:"stretch",children:f(Z,{justifyContent:"flex-start",position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"scroll",searchTerm:l,hiddenFlags:o,reflection:e,lookup:i,border:`1px solid ${n.palette.grey[300]}`,borderRadius:1,paddingY:1})})]}),{minWidth:320,alignItems:"stretch",justifyContent:"flex-start",overflow:"hidden"}),f(s=>f(k,{...s,children:f(k,{alignItems:"stretch",children:f(ee,{alignItems:"stretch",justifyContent:"flex-start",position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"scroll",borderRadius:1,padding:1,border:`1px solid ${n.palette.grey[300]}`,children:d})})}),{marginLeft:1,alignItems:"stretch",justifyContent:"flex-start",overflow:"hidden"})]})};import{jsx as Oe}from"react/jsx-runtime";var rt=({reflection:e,itemRenderer:r=H,...o})=>(Ke(e.isProject,()=>"Project expected to be Project"),Oe(te,{itemRenderer:r,reflection:e,...o}));import{Typography as Qe}from"@mui/material";import{FlexCol as Ze}from"@xylabs/react-flexbox";import{jsx as v}from"react/jsx-runtime";var at=({source:e,...r})=>v(Ze,{alignItems:"stretch",...r,children:v(Qe,{style:{opacity:.5},variant:"body2",children:v("i",{children:e.fileName})})});export{I as CommentViewer,M as ContainerReflectionViewer,H as DeclarationContainerReflectionViewer,q as DeclarationReflectionViewer,w as JsonViewerButton,Vr as ProjectReflectionViewer,rt as ProjectTwoPanelReflectionViewer,Jr as ReflectionGroupTreeViewer,x as ReflectionGroupViewer,Z as ReflectionTreeViewer,p as ReflectionViewer,Y as SomeTypeViewer,at as SourceViewer,te as TwoPanelReflectionViewer};
594
2
  //# sourceMappingURL=index.js.map