@xyo-network/react-typedoc 2.64.0 → 2.64.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.
- package/dist/browser/CommentViewer.js +3 -2
- package/dist/browser/CommentViewer.js.map +1 -1
- package/dist/browser/JsonViewerButton.js +4 -3
- package/dist/browser/JsonViewerButton.js.map +1 -1
- package/dist/browser/ProjectTwoPanelReflectionViewer.js +513 -5
- package/dist/browser/ProjectTwoPanelReflectionViewer.js.map +1 -1
- package/dist/browser/ReflectionViewer/Container.js +294 -7
- package/dist/browser/ReflectionViewer/Container.js.map +1 -1
- package/dist/browser/ReflectionViewer/Declaration.js +208 -7
- package/dist/browser/ReflectionViewer/Declaration.js.map +1 -1
- package/dist/browser/ReflectionViewer/DeclarationContainer.js +355 -6
- package/dist/browser/ReflectionViewer/DeclarationContainer.js.map +1 -1
- package/dist/browser/ReflectionViewer/NameViewer.js +157 -15
- package/dist/browser/ReflectionViewer/NameViewer.js.map +1 -1
- package/dist/browser/ReflectionViewer/Project.js +296 -7
- package/dist/browser/ReflectionViewer/Project.js.map +1 -1
- package/dist/browser/ReflectionViewer/ReflectionGroupViewer.js +237 -17
- package/dist/browser/ReflectionViewer/ReflectionGroupViewer.js.map +1 -1
- package/dist/browser/ReflectionViewer/ReflectionViewer.js +185 -9
- package/dist/browser/ReflectionViewer/ReflectionViewer.js.map +1 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/SomeTypeViewer.js +107 -5
- package/dist/browser/ReflectionViewer/SomeTypeViewer/SomeTypeViewer.js.map +1 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildArrayString.js +2 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildArrayString.js.map +1 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildIntersectionString.js +2 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildIntersectionString.js.map +1 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildReferenceString.js +2 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildReferenceString.js.map +1 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildReflectionString.js +2 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildReflectionString.js.map +1 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildTypeString.js +63 -6
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildTypeString.js.map +1 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildUnionString.js +2 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/buildUnionString.js.map +1 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/index.js +115 -1
- package/dist/browser/ReflectionViewer/SomeTypeViewer/index.js.map +1 -1
- package/dist/browser/ReflectionViewer/index.js +412 -8
- package/dist/browser/ReflectionViewer/index.js.map +1 -1
- package/dist/browser/SourceViewer.js +3 -2
- package/dist/browser/SourceViewer.js.map +1 -1
- package/dist/browser/TreeViewer/Reflection.js +3 -2
- package/dist/browser/TreeViewer/Reflection.js.map +1 -1
- package/dist/browser/TreeViewer/ReflectionGroup.js +231 -11
- package/dist/browser/TreeViewer/ReflectionGroup.js.map +1 -1
- package/dist/browser/TreeViewer/index.js +299 -2
- package/dist/browser/TreeViewer/index.js.map +1 -1
- package/dist/browser/TwoPanelReflectionViewer.js +344 -18
- package/dist/browser/TwoPanelReflectionViewer.js.map +1 -1
- package/dist/browser/createLookup.js +2 -1
- package/dist/browser/createLookup.js.map +1 -1
- package/dist/browser/index.js +611 -9
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/resolveChildren.js +2 -1
- package/dist/browser/resolveChildren.js.map +1 -1
- package/dist/browser/trimFlagLabel.js +2 -1
- package/dist/browser/trimFlagLabel.js.map +1 -1
- package/dist/docs.json +72 -72
- package/package.json +6 -6
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// src/CommentViewer.tsx
|
|
2
2
|
import { Typography } from "@mui/material";
|
|
3
3
|
import { FlexCol } from "@xylabs/react-flexbox";
|
|
4
|
-
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
var CommentViewer = ({ comment, ...props }) => {
|
|
5
6
|
return /* @__PURE__ */ jsx(FlexCol, { alignItems: "stretch", ...props, children: /* @__PURE__ */ jsx(Typography, { variant: "body2", children: comment.summary[0]?.text }) });
|
|
6
7
|
};
|
|
7
8
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/CommentViewer.tsx"],"sourcesContent":["import { Typography } from '@mui/material'\nimport { FlexBoxProps, FlexCol } from '@xylabs/react-flexbox'\nimport type { Comment } from 'typedoc'\n\nexport interface CommentViewerProps extends FlexBoxProps {\n comment: Comment\n}\n\nexport const CommentViewer: React.FC<CommentViewerProps> = ({ comment, ...props }) => {\n return (\n <FlexCol alignItems=\"stretch\" {...props}>\n <Typography variant=\"body2\">{comment.summary[0]?.text}</Typography>\n </FlexCol>\n )\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/CommentViewer.tsx"],"sourcesContent":["import { Typography } from '@mui/material'\nimport { FlexBoxProps, FlexCol } from '@xylabs/react-flexbox'\nimport type { Comment } from 'typedoc'\n\nexport interface CommentViewerProps extends FlexBoxProps {\n comment: Comment\n}\n\nexport const CommentViewer: React.FC<CommentViewerProps> = ({ comment, ...props }) => {\n return (\n <FlexCol alignItems=\"stretch\" {...props}>\n <Typography variant=\"body2\">{comment.summary[0]?.text}</Typography>\n </FlexCol>\n )\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAC3B,SAAuB,eAAe;AAUhC;AAHC,IAAM,gBAA8C,CAAC,EAAE,SAAS,GAAG,MAAM,MAAM;AACpF,SACE,oBAAC,WAAQ,YAAW,WAAW,GAAG,OAChC,8BAAC,cAAW,SAAQ,SAAS,kBAAQ,QAAQ,CAAC,GAAG,MAAK,GACxD;AAEJ;","names":[]}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
// src/JsonViewerButton.tsx
|
|
2
2
|
import { Dialog, DialogActions, DialogContent, DialogTitle } from "@mui/material";
|
|
3
3
|
import { ButtonEx } from "@xylabs/react-button";
|
|
4
4
|
import { lazy, Suspense, useState } from "react";
|
|
5
|
-
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var JsonView = lazy(() => import(
|
|
6
7
|
/* webpackChunkName: "jsonView" */
|
|
7
8
|
"react-json-view"
|
|
8
9
|
));
|
|
9
|
-
|
|
10
|
+
var JsonViewerButton = ({ jsonViewProps, src, title, ...props }) => {
|
|
10
11
|
const [open, setOpen] = useState(false);
|
|
11
12
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12
13
|
/* @__PURE__ */ jsx(ButtonEx, { onClick: () => setOpen(!open), ...props, children: "JSON" }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/JsonViewerButton.tsx"],"sourcesContent":["import { Dialog, DialogActions, DialogContent, DialogTitle } from '@mui/material'\nimport { ButtonEx, ButtonExProps } from '@xylabs/react-button'\nimport { lazy, Suspense, useState } from 'react'\nimport { ReactJsonViewProps } from 'react-json-view'\n\nconst JsonView = lazy(() => import(/* webpackChunkName: \"jsonView\" */ 'react-json-view'))\n\nexport interface JsonViewerButtonProps extends ButtonExProps {\n jsonViewProps?: Partial<ReactJsonViewProps>\n src: object\n}\n\nexport const JsonViewerButton: React.FC<JsonViewerButtonProps> = ({ jsonViewProps, src, title, ...props }) => {\n const [open, setOpen] = useState(false)\n return (\n <>\n <ButtonEx onClick={() => setOpen(!open)} {...props}>\n JSON\n </ButtonEx>\n <Dialog open={open} onClose={() => setOpen(false)}>\n {title ? <DialogTitle>{title}</DialogTitle> : null}\n <DialogContent>\n <Suspense fallback={<div />}>\n <JsonView src={src} {...jsonViewProps} />\n </Suspense>\n </DialogContent>\n <DialogActions>\n <ButtonEx onClick={() => setOpen(false)}>Close</ButtonEx>\n </DialogActions>\n </Dialog>\n </>\n )\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/JsonViewerButton.tsx"],"sourcesContent":["import { Dialog, DialogActions, DialogContent, DialogTitle } from '@mui/material'\nimport { ButtonEx, ButtonExProps } from '@xylabs/react-button'\nimport { lazy, Suspense, useState } from 'react'\nimport { ReactJsonViewProps } from 'react-json-view'\n\nconst JsonView = lazy(() => import(/* webpackChunkName: \"jsonView\" */ 'react-json-view'))\n\nexport interface JsonViewerButtonProps extends ButtonExProps {\n jsonViewProps?: Partial<ReactJsonViewProps>\n src: object\n}\n\nexport const JsonViewerButton: React.FC<JsonViewerButtonProps> = ({ jsonViewProps, src, title, ...props }) => {\n const [open, setOpen] = useState(false)\n return (\n <>\n <ButtonEx onClick={() => setOpen(!open)} {...props}>\n JSON\n </ButtonEx>\n <Dialog open={open} onClose={() => setOpen(false)}>\n {title ? <DialogTitle>{title}</DialogTitle> : null}\n <DialogContent>\n <Suspense fallback={<div />}>\n <JsonView src={src} {...jsonViewProps} />\n </Suspense>\n </DialogContent>\n <DialogActions>\n <ButtonEx onClick={() => setOpen(false)}>Close</ButtonEx>\n </DialogActions>\n </Dialog>\n </>\n )\n}\n"],"mappings":";AAAA,SAAS,QAAQ,eAAe,eAAe,mBAAmB;AAClE,SAAS,gBAA+B;AACxC,SAAS,MAAM,UAAU,gBAAgB;AAarC,mBACE,KAGA,YAJF;AAVJ,IAAM,WAAW,KAAK,MAAM;AAAA;AAAA,EAA0C;AAAiB,CAAC;AAOjF,IAAM,mBAAoD,CAAC,EAAE,eAAe,KAAK,OAAO,GAAG,MAAM,MAAM;AAC5G,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,KAAK;AACtC,SACE,iCACE;AAAA,wBAAC,YAAS,SAAS,MAAM,QAAQ,CAAC,IAAI,GAAI,GAAG,OAAO,kBAEpD;AAAA,IACA,qBAAC,UAAO,MAAY,SAAS,MAAM,QAAQ,KAAK,GAC7C;AAAA,cAAQ,oBAAC,eAAa,iBAAM,IAAiB;AAAA,MAC9C,oBAAC,iBACC,8BAAC,YAAS,UAAU,oBAAC,SAAI,GACvB,8BAAC,YAAS,KAAW,GAAG,eAAe,GACzC,GACF;AAAA,MACA,oBAAC,iBACC,8BAAC,YAAS,SAAS,MAAM,QAAQ,KAAK,GAAG,mBAAK,GAChD;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -1,14 +1,522 @@
|
|
|
1
|
-
|
|
1
|
+
// src/ProjectTwoPanelReflectionViewer.tsx
|
|
2
2
|
import { assertEx } from "@xylabs/assert";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
|
|
4
|
+
// src/createLookup.ts
|
|
5
|
+
var createLookup = (reflection) => {
|
|
6
|
+
const lookup = {};
|
|
7
|
+
reflection.children?.forEach((item) => lookup[item.id] = item);
|
|
8
|
+
return lookup;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// src/ReflectionViewer/ReflectionGroupViewer.tsx
|
|
12
|
+
import { Typography as Typography4 } from "@mui/material";
|
|
13
|
+
import { FlexCol as FlexCol3, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
|
|
14
|
+
import { useEffect } from "react";
|
|
15
|
+
import { useLocation } from "react-router-dom";
|
|
16
|
+
|
|
17
|
+
// src/JsonViewerButton.tsx
|
|
18
|
+
import { Dialog, DialogActions, DialogContent, DialogTitle } from "@mui/material";
|
|
19
|
+
import { ButtonEx } from "@xylabs/react-button";
|
|
20
|
+
import { lazy, Suspense, useState } from "react";
|
|
21
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
+
var JsonView = lazy(() => import(
|
|
23
|
+
/* webpackChunkName: "jsonView" */
|
|
24
|
+
"react-json-view"
|
|
25
|
+
));
|
|
26
|
+
var JsonViewerButton = ({ jsonViewProps, src, title, ...props }) => {
|
|
27
|
+
const [open, setOpen] = useState(false);
|
|
28
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
29
|
+
/* @__PURE__ */ jsx(ButtonEx, { onClick: () => setOpen(!open), ...props, children: "JSON" }),
|
|
30
|
+
/* @__PURE__ */ jsxs(Dialog, { open, onClose: () => setOpen(false), children: [
|
|
31
|
+
title ? /* @__PURE__ */ jsx(DialogTitle, { children: title }) : null,
|
|
32
|
+
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", {}), children: /* @__PURE__ */ jsx(JsonView, { src, ...jsonViewProps }) }) }),
|
|
33
|
+
/* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(ButtonEx, { onClick: () => setOpen(false), children: "Close" }) })
|
|
34
|
+
] })
|
|
35
|
+
] });
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// src/resolveChildren.ts
|
|
39
|
+
var resolveChildren = (reflection, lookup = {}) => {
|
|
40
|
+
return reflection.children?.map((child) => {
|
|
41
|
+
switch (typeof child) {
|
|
42
|
+
case "object":
|
|
43
|
+
return child;
|
|
44
|
+
case "number": {
|
|
45
|
+
const childObj = lookup[child];
|
|
46
|
+
if (childObj === void 0) {
|
|
47
|
+
throw Error(`Child Reference Not Found [${child}]`);
|
|
48
|
+
}
|
|
49
|
+
return childObj;
|
|
50
|
+
}
|
|
51
|
+
default:
|
|
52
|
+
throw Error(`Invalid Child Type [${typeof child}, ${child}]`);
|
|
53
|
+
}
|
|
54
|
+
}) ?? [];
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// src/ReflectionViewer/ReflectionViewer.tsx
|
|
58
|
+
import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
|
|
59
|
+
|
|
60
|
+
// src/CommentViewer.tsx
|
|
61
|
+
import { Typography } from "@mui/material";
|
|
62
|
+
import { FlexCol } from "@xylabs/react-flexbox";
|
|
63
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
64
|
+
var CommentViewer = ({ comment, ...props }) => {
|
|
65
|
+
return /* @__PURE__ */ jsx2(FlexCol, { alignItems: "stretch", ...props, children: /* @__PURE__ */ jsx2(Typography, { variant: "body2", children: comment.summary[0]?.text }) });
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// src/ReflectionViewer/NameViewer.tsx
|
|
69
|
+
import { Chip, Stack, Typography as Typography3 } from "@mui/material";
|
|
70
|
+
import { FlexRow } from "@xylabs/react-flexbox";
|
|
71
|
+
|
|
72
|
+
// src/trimFlagLabel.ts
|
|
73
|
+
var trimFlagLabel = (label) => {
|
|
74
|
+
if (label.startsWith("is")) {
|
|
75
|
+
return label.substring(2);
|
|
76
|
+
}
|
|
77
|
+
return label;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// src/ReflectionViewer/SomeTypeViewer/SomeTypeViewer.tsx
|
|
81
|
+
import { Typography as Typography2 } from "@mui/material";
|
|
82
|
+
|
|
83
|
+
// src/ReflectionViewer/SomeTypeViewer/buildArrayString.tsx
|
|
84
|
+
var buildArrayString = (typeObj, reflectionViewer, typeBuilder) => {
|
|
85
|
+
const parts = [];
|
|
86
|
+
const typeString = typeBuilder(typeObj.elementType, reflectionViewer);
|
|
87
|
+
if (typeof typeString === "string") {
|
|
88
|
+
parts.push(typeString);
|
|
89
|
+
}
|
|
90
|
+
parts.push("[]");
|
|
91
|
+
return parts;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// src/ReflectionViewer/SomeTypeViewer/buildIntersectionString.tsx
|
|
95
|
+
var buildIntersectionString = (typeObj, reflectionViewer, typeBuilder) => {
|
|
96
|
+
const parts = [];
|
|
97
|
+
if (typeObj.types) {
|
|
98
|
+
parts.push(
|
|
99
|
+
typeObj.types.map((arg) => {
|
|
100
|
+
return typeBuilder(arg, reflectionViewer);
|
|
101
|
+
}).join(" & ")
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
return parts;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// src/ReflectionViewer/SomeTypeViewer/buildReferenceString.ts
|
|
108
|
+
var buildReferenceString = (typeObj, reflectionViewer, typeBuilder) => {
|
|
109
|
+
const parts = [];
|
|
110
|
+
parts.push(typeObj.name);
|
|
111
|
+
if (typeObj.typeArguments) {
|
|
112
|
+
parts.push("<");
|
|
113
|
+
parts.push(
|
|
114
|
+
typeObj.typeArguments.map((arg) => {
|
|
115
|
+
return typeBuilder(arg, reflectionViewer);
|
|
116
|
+
}).join(", ")
|
|
117
|
+
);
|
|
118
|
+
parts.push(">");
|
|
119
|
+
}
|
|
120
|
+
return parts;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// src/ReflectionViewer/SomeTypeViewer/buildReflectionString.tsx
|
|
124
|
+
import { Fragment as Fragment2, jsx as jsx3 } from "react/jsx-runtime";
|
|
125
|
+
var buildRelfectionString = (typeObj, reflectionViewer) => {
|
|
126
|
+
if (typeObj.declaration) {
|
|
127
|
+
return /* @__PURE__ */ jsx3(Fragment2, { children: reflectionViewer({ reflection: typeObj.declaration }) });
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// src/ReflectionViewer/SomeTypeViewer/buildUnionString.tsx
|
|
132
|
+
var buildUnionString = (typeObj, reflectionViewer, typeBuilder) => {
|
|
133
|
+
const parts = [];
|
|
134
|
+
if (typeObj.types) {
|
|
135
|
+
parts.push(
|
|
136
|
+
typeObj.types.map((arg) => {
|
|
137
|
+
return typeBuilder(arg, reflectionViewer);
|
|
138
|
+
}).join(" | ")
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
return parts;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// src/ReflectionViewer/SomeTypeViewer/buildTypeString.tsx
|
|
145
|
+
var buildTypeString = (type, reflectionViewer) => {
|
|
146
|
+
const someType = type;
|
|
147
|
+
const parts = [];
|
|
148
|
+
switch (someType.type) {
|
|
149
|
+
case "intrinsic":
|
|
150
|
+
parts.push(someType.name);
|
|
151
|
+
break;
|
|
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
|
+
case "array": {
|
|
160
|
+
parts.push(...buildArrayString(someType, reflectionViewer, buildTypeString));
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
case "reference": {
|
|
164
|
+
parts.push(...buildReferenceString(someType, reflectionViewer, buildTypeString));
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
case "union": {
|
|
168
|
+
parts.push(...buildUnionString(someType, reflectionViewer, buildTypeString));
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
case "reflection": {
|
|
172
|
+
return buildRelfectionString(someType, reflectionViewer);
|
|
173
|
+
}
|
|
174
|
+
default:
|
|
175
|
+
parts.push("#");
|
|
176
|
+
parts.push(someType.type);
|
|
177
|
+
parts.push("#");
|
|
178
|
+
break;
|
|
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, { jsonViewProps: { collapsed: 1 }, 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 hide2 = false;
|
|
218
|
+
hiddenFlags.map((hiddenFlag) => {
|
|
219
|
+
if (flags?.[hiddenFlag]) {
|
|
220
|
+
hide2 = true;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
return hide2;
|
|
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 ReflectionGroupViewer = ({
|
|
240
|
+
autoscroll = false,
|
|
241
|
+
children,
|
|
242
|
+
hiddenFlags,
|
|
243
|
+
group,
|
|
244
|
+
lookup,
|
|
245
|
+
renderer = ReflectionViewer,
|
|
246
|
+
variant,
|
|
247
|
+
...props
|
|
248
|
+
}) => {
|
|
249
|
+
const hide2 = (flags, hiddenFlags2 = []) => {
|
|
250
|
+
let hide3 = false;
|
|
251
|
+
hiddenFlags2.map((hiddenFlag) => {
|
|
252
|
+
if (flags?.[hiddenFlag]) {
|
|
253
|
+
hide3 = true;
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
return hide3;
|
|
257
|
+
};
|
|
258
|
+
const resolvedChildern = resolveChildren(group, lookup) ?? [];
|
|
259
|
+
const visibleChildren = hiddenFlags ? resolvedChildern.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(
|
|
272
|
+
JsonViewerButton,
|
|
273
|
+
{
|
|
274
|
+
jsonViewProps: { collapsed: 1 },
|
|
275
|
+
size: "small",
|
|
276
|
+
variant: "contained",
|
|
277
|
+
padding: 0,
|
|
278
|
+
marginX: 1,
|
|
279
|
+
src: resolveChildren(group, lookup)
|
|
280
|
+
}
|
|
281
|
+
)
|
|
282
|
+
] }),
|
|
283
|
+
resolveChildren(group, lookup).map((reflection) => {
|
|
284
|
+
return reflection ? (
|
|
285
|
+
// I wrap this in a div since React does not understand that they have keys using the Renderer
|
|
286
|
+
/* @__PURE__ */ jsx7("div", { id: reflection.name, children: renderer({ hiddenFlags, lookup, margin: 1, padding: 1, reflection }) }, reflection.id)
|
|
287
|
+
) : null;
|
|
288
|
+
}),
|
|
289
|
+
children
|
|
290
|
+
] }) : null;
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
// src/ReflectionViewer/Container.tsx
|
|
294
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
295
|
+
var ContainerReflectionViewer = ({
|
|
296
|
+
children,
|
|
297
|
+
reflection,
|
|
298
|
+
hiddenFlags,
|
|
299
|
+
itemRenderer = ReflectionViewer,
|
|
300
|
+
...props
|
|
301
|
+
}) => {
|
|
302
|
+
const lookup = createLookup(reflection);
|
|
303
|
+
return /* @__PURE__ */ jsxs5(ReflectionViewer, { title: "ContainerReflectionViewer", sources: true, reflection, lookup, ...props, children: [
|
|
304
|
+
reflection.groups?.map((group) => {
|
|
305
|
+
return /* @__PURE__ */ jsx8(
|
|
306
|
+
ReflectionGroupViewer,
|
|
307
|
+
{
|
|
308
|
+
margin: 1,
|
|
309
|
+
lookup,
|
|
310
|
+
renderer: itemRenderer,
|
|
311
|
+
group,
|
|
312
|
+
reflection,
|
|
313
|
+
hiddenFlags,
|
|
314
|
+
alignItems: "stretch"
|
|
315
|
+
},
|
|
316
|
+
group.title
|
|
317
|
+
);
|
|
318
|
+
}),
|
|
319
|
+
children
|
|
320
|
+
] });
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
// src/ReflectionViewer/Declaration.tsx
|
|
324
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
325
|
+
var DeclarationReflectionViewer = ({ reflection, hiddenFlags, ...props }) => {
|
|
326
|
+
const safeSignatures = (signatures) => {
|
|
327
|
+
return Array.isArray(signatures) ? signatures : signatures ? [signatures] : void 0;
|
|
328
|
+
};
|
|
329
|
+
return /* @__PURE__ */ jsxs6(
|
|
330
|
+
ReflectionViewer,
|
|
331
|
+
{
|
|
332
|
+
nameViewer: reflection.signatures || reflection.getSignature || reflection.setSignature ? null : void 0,
|
|
333
|
+
title: "DeclarationReflectionViewer",
|
|
334
|
+
hiddenFlags,
|
|
335
|
+
reflection,
|
|
336
|
+
...props,
|
|
337
|
+
children: [
|
|
338
|
+
reflection.signatures?.map((signature) => {
|
|
339
|
+
return /* @__PURE__ */ jsx9(ReflectionViewer, { hiddenFlags, reflection: signature }, signature.id);
|
|
340
|
+
}),
|
|
341
|
+
safeSignatures(reflection.getSignature)?.map((signature) => {
|
|
342
|
+
return /* @__PURE__ */ jsx9(ReflectionViewer, { marginX: 1, hiddenFlags, reflection: signature }, signature.id);
|
|
343
|
+
}),
|
|
344
|
+
safeSignatures(reflection.setSignature)?.map((signature) => {
|
|
345
|
+
return /* @__PURE__ */ jsx9(ReflectionViewer, { marginX: 1, hiddenFlags, reflection: signature }, signature.id);
|
|
346
|
+
})
|
|
347
|
+
]
|
|
348
|
+
}
|
|
349
|
+
);
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
// src/ReflectionViewer/DeclarationContainer.tsx
|
|
353
|
+
import { useTheme } from "@mui/material";
|
|
354
|
+
import { useLocation as useLocation2 } from "react-router-dom";
|
|
355
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
356
|
+
var DeclarationContainerReflectionViewer = ({
|
|
357
|
+
reflection,
|
|
358
|
+
lookup,
|
|
359
|
+
itemRenderer = DeclarationReflectionViewer,
|
|
360
|
+
...props
|
|
361
|
+
}) => {
|
|
362
|
+
const { hash } = useLocation2();
|
|
363
|
+
const theme = useTheme();
|
|
364
|
+
return /* @__PURE__ */ jsx10(
|
|
365
|
+
ContainerReflectionViewer,
|
|
366
|
+
{
|
|
367
|
+
title: "DeclarationContainerReflectionViewer",
|
|
368
|
+
paper: hash.substring(1) === reflection.name,
|
|
369
|
+
bgcolor: hash.substring(1) === reflection.name ? theme.palette.background.default : void 0,
|
|
370
|
+
lookup,
|
|
371
|
+
itemRenderer,
|
|
372
|
+
reflection,
|
|
373
|
+
...props
|
|
374
|
+
}
|
|
375
|
+
);
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
// src/TwoPanelReflectionViewer.tsx
|
|
379
|
+
import { Search } from "@mui/icons-material";
|
|
380
|
+
import { TextField, useTheme as useTheme2 } from "@mui/material";
|
|
381
|
+
import { FlexCol as FlexCol5, FlexGrowCol, FlexRow as FlexRow3 } from "@xylabs/react-flexbox";
|
|
382
|
+
import { useMemo, useState as useState2 } from "react";
|
|
383
|
+
|
|
384
|
+
// src/TreeViewer/Reflection.tsx
|
|
385
|
+
import { Add, Remove } from "@mui/icons-material";
|
|
386
|
+
import { Typography as Typography5 } from "@mui/material";
|
|
387
|
+
import { TreeItem, TreeView } from "@mui/x-tree-view";
|
|
388
|
+
import { FlexCol as FlexCol4 } from "@xylabs/react-flexbox";
|
|
389
|
+
import { useNavigate } from "react-router-dom";
|
|
390
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
391
|
+
var ReflectionTreeViewer = ({ lookup, reflection, searchTerm, ...props }) => {
|
|
392
|
+
const navigate = useNavigate();
|
|
393
|
+
return /* @__PURE__ */ jsx11(FlexCol4, { alignItems: "stretch", ...props, children: /* @__PURE__ */ jsx11(
|
|
394
|
+
TreeView,
|
|
395
|
+
{
|
|
396
|
+
"aria-label": "XYO SDK Documentation",
|
|
397
|
+
defaultExpandIcon: /* @__PURE__ */ jsx11(Add, {}),
|
|
398
|
+
defaultCollapseIcon: /* @__PURE__ */ jsx11(Remove, {}),
|
|
399
|
+
defaultExpanded: reflection.groups ? [reflection.groups[0].title] : [],
|
|
400
|
+
children: reflection.groups?.map((group, index) => /* @__PURE__ */ jsx11(TreeItem, { nodeId: group.title, label: /* @__PURE__ */ jsx11(Typography5, { variant: "h6", children: group.title }), children: group.children.map((child, jndex) => {
|
|
401
|
+
const searchTermTrimmed = searchTerm?.trim().toLowerCase();
|
|
402
|
+
const childReflection = typeof child === "number" ? lookup?.[child] : child;
|
|
403
|
+
return childReflection && (!searchTermTrimmed || childReflection.name.toLowerCase().indexOf(searchTermTrimmed) !== -1) ? /* @__PURE__ */ jsx11(
|
|
404
|
+
TreeItem,
|
|
405
|
+
{
|
|
406
|
+
nodeId: `declaration-${childReflection?.id}`,
|
|
407
|
+
label: childReflection.name,
|
|
408
|
+
onClick: () => {
|
|
409
|
+
const hash = `#${childReflection.name}`;
|
|
410
|
+
navigate({ hash });
|
|
411
|
+
document.querySelector(hash)?.scrollIntoView({ behavior: "smooth" });
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
`secondary-${index}- ${jndex}`
|
|
415
|
+
) : null;
|
|
416
|
+
}) }, `primary-${index}`))
|
|
417
|
+
}
|
|
418
|
+
) });
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
// src/TwoPanelReflectionViewer.tsx
|
|
422
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
423
|
+
var TwoPanelReflectionViewer = ({
|
|
424
|
+
reflection,
|
|
425
|
+
itemRenderer = ReflectionViewer,
|
|
426
|
+
hiddenFlags,
|
|
427
|
+
...props
|
|
428
|
+
}) => {
|
|
429
|
+
const lookup = useMemo(() => createLookup(reflection), [reflection]);
|
|
430
|
+
const theme = useTheme2();
|
|
431
|
+
const [searchTerm, setSearchTerm] = useState2();
|
|
432
|
+
const onSearchTermChange = (e) => {
|
|
433
|
+
setSearchTerm(e.target.value);
|
|
434
|
+
};
|
|
435
|
+
const reflectionGroups = useMemo(() => {
|
|
436
|
+
return reflection.groups?.map((group) => {
|
|
437
|
+
return /* @__PURE__ */ jsx12(
|
|
438
|
+
ReflectionGroupViewer,
|
|
439
|
+
{
|
|
440
|
+
autoscroll: true,
|
|
441
|
+
variant: "h6",
|
|
442
|
+
lookup,
|
|
443
|
+
renderer: itemRenderer,
|
|
444
|
+
group,
|
|
445
|
+
reflection,
|
|
446
|
+
alignItems: "stretch",
|
|
447
|
+
hiddenFlags
|
|
448
|
+
},
|
|
449
|
+
group.title
|
|
450
|
+
);
|
|
451
|
+
});
|
|
452
|
+
}, [itemRenderer, lookup, reflection, hiddenFlags]);
|
|
453
|
+
const NavigationCol = (props2) => {
|
|
454
|
+
return /* @__PURE__ */ jsxs7(FlexCol5, { ...props2, children: [
|
|
455
|
+
/* @__PURE__ */ jsx12(
|
|
456
|
+
TextField,
|
|
457
|
+
{
|
|
458
|
+
fullWidth: true,
|
|
459
|
+
InputProps: {
|
|
460
|
+
startAdornment: /* @__PURE__ */ jsx12(Search, {})
|
|
461
|
+
},
|
|
462
|
+
onChange: onSearchTermChange
|
|
463
|
+
}
|
|
464
|
+
),
|
|
465
|
+
/* @__PURE__ */ jsx12(FlexGrowCol, { marginTop: 1, alignItems: "stretch", children: /* @__PURE__ */ jsx12(
|
|
466
|
+
ReflectionTreeViewer,
|
|
467
|
+
{
|
|
468
|
+
justifyContent: "flex-start",
|
|
469
|
+
position: "absolute",
|
|
470
|
+
top: 0,
|
|
471
|
+
left: 0,
|
|
472
|
+
right: 0,
|
|
473
|
+
bottom: 0,
|
|
474
|
+
overflow: "scroll",
|
|
475
|
+
searchTerm,
|
|
476
|
+
hiddenFlags,
|
|
477
|
+
reflection,
|
|
478
|
+
lookup,
|
|
479
|
+
border: `1px solid ${theme.palette.grey["300"]}`,
|
|
480
|
+
borderRadius: 1,
|
|
481
|
+
paddingY: 1
|
|
482
|
+
}
|
|
483
|
+
) })
|
|
484
|
+
] });
|
|
485
|
+
};
|
|
486
|
+
const DetailsCol = (props2) => {
|
|
487
|
+
return /* @__PURE__ */ jsx12(FlexGrowCol, { ...props2, children: /* @__PURE__ */ jsx12(FlexGrowCol, { alignItems: "stretch", children: /* @__PURE__ */ jsx12(
|
|
488
|
+
FlexCol5,
|
|
489
|
+
{
|
|
490
|
+
alignItems: "stretch",
|
|
491
|
+
justifyContent: "flex-start",
|
|
492
|
+
position: "absolute",
|
|
493
|
+
top: 0,
|
|
494
|
+
left: 0,
|
|
495
|
+
right: 0,
|
|
496
|
+
bottom: 0,
|
|
497
|
+
overflow: "scroll",
|
|
498
|
+
borderRadius: 1,
|
|
499
|
+
padding: 1,
|
|
500
|
+
border: `1px solid ${theme.palette.grey["300"]}`,
|
|
501
|
+
children: reflectionGroups
|
|
502
|
+
}
|
|
503
|
+
) }) });
|
|
504
|
+
};
|
|
505
|
+
return /* @__PURE__ */ jsxs7(FlexRow3, { alignItems: "stretch", justifyContent: "start", sx: { overflowY: "scroll" }, ...props, children: [
|
|
506
|
+
/* @__PURE__ */ jsx12(NavigationCol, { minWidth: 320, alignItems: "stretch", justifyContent: "flex-start", overflow: "hidden" }),
|
|
507
|
+
/* @__PURE__ */ jsx12(DetailsCol, { marginLeft: 1, alignItems: "stretch", justifyContent: "flex-start", overflow: "hidden" })
|
|
508
|
+
] });
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
// src/ProjectTwoPanelReflectionViewer.tsx
|
|
512
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
513
|
+
var ProjectTwoPanelReflectionViewer = ({
|
|
6
514
|
reflection,
|
|
7
515
|
itemRenderer = DeclarationContainerReflectionViewer,
|
|
8
516
|
...props
|
|
9
517
|
}) => {
|
|
10
518
|
assertEx(reflection.isProject, "Project expected to be Project");
|
|
11
|
-
return /* @__PURE__ */
|
|
519
|
+
return /* @__PURE__ */ jsx13(TwoPanelReflectionViewer, { itemRenderer, reflection, ...props });
|
|
12
520
|
};
|
|
13
521
|
export {
|
|
14
522
|
ProjectTwoPanelReflectionViewer
|