@xyo-network/react-typedoc 2.77.2 → 2.78.1

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