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