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