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