@cccsaurora/clue-ui 0.15.0-dev.31 → 0.15.0

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.
Files changed (257) hide show
  1. package/package.json +143 -39
  2. package/ActionForm-DgfJwTzt.js +0 -436
  3. package/AnnotationPreview-BvNpZOP0.js +0 -188
  4. package/ClueEnrichContext-DXwLVp0M.js +0 -518
  5. package/FlexOne-BSYAhhtG.js +0 -9
  6. package/_Map-kgDsDYxq.js +0 -64
  7. package/_MapCache-DabaaWfq.js +0 -161
  8. package/_Uint8Array-BlVVH1tp.js +0 -129
  9. package/_baseAssignValue-CNbcU6Nb.js +0 -25
  10. package/_baseClone-D3a8Pa4T.js +0 -284
  11. package/_baseExtremum-B1o1zHjR.js +0 -33
  12. package/_baseFlatten-D4huXoEI.js +0 -92
  13. package/_baseGet-BSK_nnoz.js +0 -109
  14. package/_baseIsEqual-B5xLoweL.js +0 -238
  15. package/_baseIteratee-p6Nj07-n.js +0 -126
  16. package/_baseSlice-GAv_YFTT.js +0 -20
  17. package/_baseSum-D0WC1dN0.js +0 -13
  18. package/_baseUniq-CpupKWcL.js +0 -89
  19. package/_commonjsHelpers-CUmg6egw.js +0 -6
  20. package/_createAggregator-BpVy5xMi.js +0 -63
  21. package/_getPrototype-D1LAdQKO.js +0 -5
  22. package/_getTag-D3ToyefI.js +0 -126
  23. package/api/lookup/enrich.d.ts +0 -10
  24. package/api/lookup/index.d.ts +0 -5
  25. package/api/lookup/types.d.ts +0 -5
  26. package/api/lookup/types_detection.d.ts +0 -5
  27. package/cloneDeep-CjP5k9zW.js +0 -8
  28. package/components/AnnotationBody.d.ts +0 -6
  29. package/components/AnnotationBody.js +0 -56
  30. package/components/AnnotationDetailPopover.d.ts +0 -14
  31. package/components/AnnotationDetailPopover.js +0 -61
  32. package/components/AnnotationDetails.d.ts +0 -8
  33. package/components/AnnotationDetails.js +0 -172
  34. package/components/AnnotationEntry.d.ts +0 -6
  35. package/components/AnnotationEntry.js +0 -59
  36. package/components/AnnotationPreview.d.ts +0 -14
  37. package/components/AnnotationPreview.js +0 -11
  38. package/components/ClassificationChip.d.ts +0 -11
  39. package/components/ClassificationChip.js +0 -52
  40. package/components/CountBadge.d.ts +0 -8
  41. package/components/CountBadge.js +0 -34
  42. package/components/EnrichedCard.d.ts +0 -14
  43. package/components/EnrichedCard.js +0 -162
  44. package/components/EnrichedChip.d.ts +0 -9
  45. package/components/EnrichedChip.js +0 -176
  46. package/components/EnrichedTypography.d.ts +0 -16
  47. package/components/EnrichedTypography.js +0 -178
  48. package/components/ErrorBoundary.d.ts +0 -15
  49. package/components/ErrorBoundary.js +0 -36
  50. package/components/RetryFailedEnrichments.d.ts +0 -2
  51. package/components/RetryFailedEnrichments.js +0 -13
  52. package/components/SourcePicker.d.ts +0 -2
  53. package/components/SourcePicker.js +0 -98
  54. package/components/actions/ActionForm.d.ts +0 -6
  55. package/components/actions/ActionForm.js +0 -16
  56. package/components/actions/ExecutePopover.d.ts +0 -10
  57. package/components/actions/ExecutePopover.js +0 -93
  58. package/components/actions/ResultModal.d.ts +0 -9
  59. package/components/actions/ResultModal.js +0 -46
  60. package/components/actions/form/schemaAdapter.d.ts +0 -3
  61. package/components/actions/form/schemaAdapter.js +0 -47
  62. package/components/display/graph/ExpandMoreButton.d.ts +0 -7
  63. package/components/display/graph/ExpandMoreButton.js +0 -18
  64. package/components/display/graph/elements/NodeCard.d.ts +0 -10
  65. package/components/display/graph/elements/NodeCard.js +0 -146
  66. package/components/display/graph/elements/NodeTag.d.ts +0 -9
  67. package/components/display/graph/elements/NodeTag.js +0 -17
  68. package/components/display/graph/index.d.ts +0 -9
  69. package/components/display/graph/index.js +0 -438
  70. package/components/display/graph/visualizations/Leaf.d.ts +0 -25
  71. package/components/display/graph/visualizations/Leaf.js +0 -125
  72. package/components/display/graph/visualizations/cloud/index.d.ts +0 -24
  73. package/components/display/graph/visualizations/cloud/index.js +0 -141
  74. package/components/display/graph/visualizations/icons/BaseIcon.d.ts +0 -12
  75. package/components/display/graph/visualizations/icons/BaseIcon.js +0 -37
  76. package/components/display/graph/visualizations/icons/BugIcon.d.ts +0 -5
  77. package/components/display/graph/visualizations/icons/BugIcon.js +0 -18
  78. package/components/display/graph/visualizations/icons/HostIcon.d.ts +0 -5
  79. package/components/display/graph/visualizations/icons/HostIcon.js +0 -24
  80. package/components/display/graph/visualizations/icons/NetworkIcon.d.ts +0 -5
  81. package/components/display/graph/visualizations/icons/NetworkIcon.js +0 -24
  82. package/components/display/graph/visualizations/icons/ProcessIcon.d.ts +0 -5
  83. package/components/display/graph/visualizations/icons/ProcessIcon.js +0 -18
  84. package/components/display/graph/visualizations/icons/TargetIcon.d.ts +0 -5
  85. package/components/display/graph/visualizations/icons/TargetIcon.js +0 -19
  86. package/components/display/graph/visualizations/icons/index.d.ts +0 -2
  87. package/components/display/graph/visualizations/icons/index.js +0 -16
  88. package/components/display/graph/visualizations/panels/NodePanel.d.ts +0 -8
  89. package/components/display/graph/visualizations/panels/NodePanel.js +0 -12
  90. package/components/display/graph/visualizations/tree/BundleLine.d.ts +0 -29
  91. package/components/display/graph/visualizations/tree/BundleLine.js +0 -121
  92. package/components/display/graph/visualizations/tree/Triangle.d.ts +0 -9
  93. package/components/display/graph/visualizations/tree/Triangle.js +0 -26
  94. package/components/display/graph/visualizations/tree/index.d.ts +0 -36
  95. package/components/display/graph/visualizations/tree/index.js +0 -485
  96. package/components/display/graph/visualizations/tree/types.d.ts +0 -11
  97. package/components/display/graph/visualizations/tree/types.js +0 -1
  98. package/components/display/icons/Iconified.d.ts +0 -9
  99. package/components/display/icons/Iconified.js +0 -29
  100. package/components/display/json/index.d.ts +0 -14
  101. package/components/display/json/index.js +0 -12
  102. package/components/display/markdown/DynamicTabs.d.ts +0 -8
  103. package/components/display/markdown/DynamicTabs.js +0 -26
  104. package/components/display/markdown/index.d.ts +0 -9
  105. package/components/display/markdown/index.js +0 -13389
  106. package/components/display/markdown/markdownPlugins/tabs.d.ts +0 -3
  107. package/components/display/markdown/markdownPlugins/tabs.js +0 -4
  108. package/components/enrichment/EnrichPopover.d.ts +0 -10
  109. package/components/enrichment/EnrichPopover.js +0 -88
  110. package/components/fetchers/Fetcher.d.ts +0 -17
  111. package/components/fetchers/Fetcher.js +0 -188
  112. package/components/fetchers/PreviewModal.d.ts +0 -8
  113. package/components/fetchers/PreviewModal.js +0 -22
  114. package/components/fetchers/StatusChip.d.ts +0 -8
  115. package/components/fetchers/StatusChip.js +0 -30
  116. package/components/group/Entry.d.ts +0 -8
  117. package/components/group/Entry.js +0 -15
  118. package/components/group/Group.d.ts +0 -12
  119. package/components/group/Group.js +0 -15
  120. package/components/group/GroupControl.d.ts +0 -4
  121. package/components/group/GroupControl.js +0 -103
  122. package/components/stats/QueryStatus.d.ts +0 -4
  123. package/components/stats/QueryStatus.js +0 -61
  124. package/countBy-C69WslUA.js +0 -14
  125. package/data/event.d.ts +0 -12
  126. package/data/event.js +0 -8
  127. package/database/index.d.ts +0 -4
  128. package/database/index.js +0 -4
  129. package/database/selector.schema.json.d.ts +0 -119
  130. package/database/status.schema.json.d.ts +0 -38
  131. package/database/types.d.ts +0 -64
  132. package/debounce-bV0h5FC5.js +0 -92
  133. package/en/translation.json +0 -135
  134. package/fr/translation.json +0 -135
  135. package/get-D3C3lEU3.js +0 -8
  136. package/groupBy-DC2oOuBN.js +0 -14
  137. package/hooks/ClueActionContext.d.ts +0 -86
  138. package/hooks/ClueActionContext.js +0 -18
  139. package/hooks/ClueComponentContext.d.ts +0 -10
  140. package/hooks/ClueComponentContext.js +0 -40
  141. package/hooks/ClueConfigProvider.d.ts +0 -12
  142. package/hooks/ClueConfigProvider.js +0 -23
  143. package/hooks/ClueDatabaseContext.d.ts +0 -10
  144. package/hooks/ClueDatabaseContext.js +0 -23
  145. package/hooks/ClueEnrichContext.d.ts +0 -6
  146. package/hooks/ClueEnrichContext.js +0 -15
  147. package/hooks/ClueEnrichContextType.d.ts +0 -113
  148. package/hooks/ClueEnrichProps.d.ts +0 -81
  149. package/hooks/ClueFetcherContext.d.ts +0 -35
  150. package/hooks/ClueFetcherContext.js +0 -88
  151. package/hooks/ClueGroupContext.d.ts +0 -14
  152. package/hooks/ClueGroupContext.js +0 -23
  153. package/hooks/CluePopupContext.d.ts +0 -24
  154. package/hooks/CluePopupContext.js +0 -12
  155. package/hooks/ClueProvider.d.ts +0 -9
  156. package/hooks/ClueProvider.js +0 -14
  157. package/hooks/selectors.d.ts +0 -10
  158. package/hooks/selectors.js +0 -24
  159. package/hooks/useAnnotations.d.ts +0 -24
  160. package/hooks/useAnnotations.js +0 -69
  161. package/hooks/useClue.d.ts +0 -4
  162. package/hooks/useClue.js +0 -8
  163. package/hooks/useClueActions.d.ts +0 -4
  164. package/hooks/useClueActions.js +0 -5
  165. package/hooks/useClueConfig.d.ts +0 -1
  166. package/hooks/useClueConfig.js +0 -8
  167. package/hooks/useClueTypeConfig.d.ts +0 -17
  168. package/hooks/useClueTypeConfig.js +0 -7
  169. package/hooks/useComparator.d.ts +0 -16
  170. package/hooks/useComparator.js +0 -1060
  171. package/hooks/useErrors.d.ts +0 -17
  172. package/hooks/useErrors.js +0 -35
  173. package/hooks/useMyHighlights.d.ts +0 -11
  174. package/hooks/useMyHighlights.js +0 -74
  175. package/hooks/useMyLocalStorage.d.ts +0 -16
  176. package/hooks/useMyLocalStorage.js +0 -80
  177. package/iconify-CXMreGTg.js +0 -1782
  178. package/icons/Action.d.ts +0 -9
  179. package/icons/Action.js +0 -90
  180. package/icons/Assessment.d.ts +0 -11
  181. package/icons/Assessment.js +0 -123
  182. package/icons/Context.d.ts +0 -12
  183. package/icons/Context.js +0 -83
  184. package/icons/Opinion.d.ts +0 -11
  185. package/icons/Opinion.js +0 -125
  186. package/icons/iconMap.d.ts +0 -7
  187. package/icons/iconMap.js +0 -10
  188. package/identity-CPGTqrE4.js +0 -6
  189. package/index-BDVjGvMI.js +0 -696
  190. package/index-BDrtH5ec.js +0 -465
  191. package/index-C9lySIVX.js +0 -1172
  192. package/index-DJYqRcxJ.js +0 -15750
  193. package/index-Dn2NHyXg.js +0 -17654
  194. package/index.css +0 -21
  195. package/isEmpty-BQkZubqU.js +0 -29
  196. package/isNil-CIubwp4T.js +0 -6
  197. package/isObject-FTY-5JQX.js +0 -7
  198. package/isObjectLike-OAgjjZye.js +0 -48
  199. package/isSymbol-Xd2FsJyp.js +0 -8
  200. package/isUndefined-CE8h73dH.js +0 -10
  201. package/last-CUCl67Im.js +0 -7
  202. package/main.d.ts +0 -42
  203. package/main.js +0 -70
  204. package/public/manifest.json +0 -16
  205. package/public/robots.txt +0 -3
  206. package/public/svg/dark/clue-h.svg +0 -52
  207. package/public/svg/dark/clue-icon1-simple.svg +0 -33
  208. package/public/svg/dark/clue-icon1.svg +0 -44
  209. package/public/svg/dark/clue-icon2-simple.svg +0 -26
  210. package/public/svg/dark/clue-icon2.svg +0 -37
  211. package/public/svg/dark/clue-name.svg +0 -14
  212. package/public/svg/dark/clue-v.svg +0 -52
  213. package/public/svg/light/clue-h.svg +0 -60
  214. package/public/svg/light/clue-icon1-simple.svg +0 -37
  215. package/public/svg/light/clue-icon1.svg +0 -48
  216. package/public/svg/light/clue-icon2-simple.svg +0 -30
  217. package/public/svg/light/clue-icon2.svg +0 -41
  218. package/public/svg/light/clue-name.svg +0 -14
  219. package/public/svg/light/clue-v.svg +0 -60
  220. package/sortBy-B-UKp4GT.js +0 -100
  221. package/sumBy-MYkDPHZL.js +0 -8
  222. package/tabs-xGuUGsJd.js +0 -254
  223. package/text/Frequency.d.ts +0 -9
  224. package/text/Frequency.js +0 -49
  225. package/toFinite-CArjry_l.js +0 -16
  226. package/toNumber-DPxy1FBy.js +0 -39
  227. package/types/EnrichmentProps.d.ts +0 -73
  228. package/types/RunningActionData.d.ts +0 -15
  229. package/types/WithActionData.d.ts +0 -9
  230. package/types/action.d.ts +0 -25
  231. package/types/config.d.ts +0 -16
  232. package/types/fetcher.d.ts +0 -60
  233. package/types/graph.d.ts +0 -101
  234. package/types/lookup.d.ts +0 -62
  235. package/types/network.d.ts +0 -9
  236. package/useClueTypeConfig-D9ZSxa4F.js +0 -3096
  237. package/utils/chain.d.ts +0 -14
  238. package/utils/chain.js +0 -106
  239. package/utils/classificationParser.d.ts +0 -195
  240. package/utils/classificationParser.js +0 -553
  241. package/utils/constants.d.ts +0 -26
  242. package/utils/constants.js +0 -36
  243. package/utils/graph.d.ts +0 -13
  244. package/utils/graph.js +0 -79
  245. package/utils/hashUtil.d.ts +0 -6
  246. package/utils/hashUtil.js +0 -11
  247. package/utils/line.d.ts +0 -28
  248. package/utils/line.js +0 -136
  249. package/utils/loggerUtil.d.ts +0 -6
  250. package/utils/loggerUtil.js +0 -8
  251. package/utils/sessionStorage.d.ts +0 -9
  252. package/utils/sessionStorage.js +0 -51
  253. package/utils/utils.d.ts +0 -13
  254. package/utils/utils.js +0 -11
  255. package/utils/window.d.ts +0 -3
  256. package/utils/window.js +0 -24
  257. package/utils-CxIhC2xH.js +0 -4182
@@ -1,146 +0,0 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { Stack, Typography, Card, CardContent, Divider, Collapse } from "@mui/material";
3
- import { a as isPlainObject, f as flatten$1 } from "../../../../utils-CxIhC2xH.js";
4
- import { cssImportant } from "../../../../utils/graph.js";
5
- import { b as baseGet, c as castPath, t as toKey, a as arrayMap } from "../../../../_baseGet-BSK_nnoz.js";
6
- import { c as copyObject, g as getAllKeysIn, b as baseClone } from "../../../../_baseClone-D3a8Pa4T.js";
7
- import { l as last } from "../../../../last-CUCl67Im.js";
8
- import { b as baseSlice } from "../../../../_baseSlice-GAv_YFTT.js";
9
- import { b as baseFlatten, s as setToString, o as overRest } from "../../../../_baseFlatten-D4huXoEI.js";
10
- import { useState, useEffect, useCallback, Fragment as Fragment$1 } from "react";
11
- import Iconified from "../../icons/Iconified.js";
12
- import { J as JSONViewer } from "../../../../index-BDrtH5ec.js";
13
- import Markdown from "../../markdown/index.js";
14
- import ExpandMoreButton from "../ExpandMoreButton.js";
15
- import NodeTag from "./NodeTag.js";
16
- function flatten(array) {
17
- var length = array == null ? 0 : array.length;
18
- return length ? baseFlatten(array) : [];
19
- }
20
- function flatRest(func) {
21
- return setToString(overRest(func, void 0, flatten), func + "");
22
- }
23
- function parent(object, path) {
24
- return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
25
- }
26
- function baseUnset(object, path) {
27
- path = castPath(path, object);
28
- object = parent(object, path);
29
- return object == null || delete object[toKey(last(path))];
30
- }
31
- function customOmitClone(value) {
32
- return isPlainObject(value) ? void 0 : value;
33
- }
34
- var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
35
- var omit = flatRest(function(object, paths) {
36
- var result = {};
37
- if (object == null) {
38
- return result;
39
- }
40
- var isDeep = false;
41
- paths = arrayMap(paths, function(path) {
42
- path = castPath(path, object);
43
- isDeep || (isDeep = path.length > 1);
44
- return path;
45
- });
46
- copyObject(object, getAllKeysIn(object), result);
47
- if (isDeep) {
48
- result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
49
- }
50
- var length = paths.length;
51
- while (length--) {
52
- baseUnset(result, paths[length]);
53
- }
54
- return result;
55
- });
56
- const NodeCard = ({ node, sx = {} }) => {
57
- var _a;
58
- const [expanded, setExpanded] = useState(false);
59
- const [nodeExtraData, setNodeExtraData] = useState();
60
- const handleExpandClick = () => {
61
- setExpanded(!expanded);
62
- };
63
- useEffect(() => {
64
- setNodeExtraData(omit(node, ["id", "edges"]));
65
- }, [node]);
66
- const renderEdgeList = useCallback((edgeIds) => {
67
- return /* @__PURE__ */ jsxs(Stack, { alignSelf: "stretch", children: [
68
- /* @__PURE__ */ jsx(Typography, { textAlign: "left", variant: "body2", color: "text.secondary", children: "Edges" }),
69
- /* @__PURE__ */ jsx(Stack, { spacing: 0.25, children: edgeIds.map((edgeId) => /* @__PURE__ */ jsx(NodeTag, { nodeId: edgeId }, edgeId)) })
70
- ] });
71
- }, []);
72
- return /* @__PURE__ */ jsx(
73
- Card,
74
- {
75
- variant: "outlined",
76
- sx: {
77
- position: "relative",
78
- overflow: "auto",
79
- zIndex: expanded ? 100 : "initial",
80
- "& *": {
81
- opacity: 1
82
- },
83
- ...sx
84
- },
85
- children: /* @__PURE__ */ jsx(CardContent, { sx: { p: 1 }, children: /* @__PURE__ */ jsxs(
86
- Stack,
87
- {
88
- spacing: 1,
89
- sx: {
90
- textAlign: "left",
91
- wordBreak: "break-all",
92
- "& pre": {
93
- whiteSpace: "pre-wrap"
94
- }
95
- },
96
- children: [
97
- /* @__PURE__ */ jsx(NodeTag, { nodeId: node.id, label: node.id, type: "header", children: /* @__PURE__ */ jsx(
98
- ExpandMoreButton,
99
- {
100
- expand: expanded,
101
- onClick: handleExpandClick,
102
- "aria-expanded": expanded,
103
- "aria-label": "show more",
104
- size: "small",
105
- children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-expand-more", fontSize: "medium" })
106
- }
107
- ) }),
108
- node.markdown && /* @__PURE__ */ jsxs(Fragment, { children: [
109
- /* @__PURE__ */ jsx(Divider, { flexItem: true }),
110
- /* @__PURE__ */ jsx(Markdown, { md: node.markdown, components: flatten$1(node) })
111
- ] }),
112
- !!((_a = node == null ? void 0 : node.edges) == null ? void 0 : _a.length) && /* @__PURE__ */ jsxs(Fragment$1, { children: [
113
- /* @__PURE__ */ jsx(Divider, { flexItem: true }),
114
- renderEdgeList(node == null ? void 0 : node.edges)
115
- ] }),
116
- /* @__PURE__ */ jsx(Collapse, { in: expanded, timeout: "auto", children: /* @__PURE__ */ jsxs(
117
- Stack,
118
- {
119
- justifyContent: "start",
120
- alignItems: "start",
121
- spacing: 1,
122
- sx: (theme) => ({
123
- "& > ul": {
124
- width: "100%",
125
- textAlign: "left",
126
- p: cssImportant(theme.spacing(1)),
127
- mx: cssImportant("0"),
128
- backgroundColor: cssImportant(theme.palette.background.paper)
129
- }
130
- }),
131
- children: [
132
- /* @__PURE__ */ jsx(Divider, { flexItem: true }),
133
- /* @__PURE__ */ jsx(Typography, { textAlign: "left", variant: "body1", children: "Metadata:" }),
134
- /* @__PURE__ */ jsx(JSONViewer, { data: nodeExtraData })
135
- ]
136
- }
137
- ) })
138
- ]
139
- }
140
- ) })
141
- }
142
- );
143
- };
144
- export {
145
- NodeCard as default
146
- };
@@ -1,9 +0,0 @@
1
- import { FC, PropsWithChildren } from 'react';
2
-
3
- interface TagOptions {
4
- nodeId: string;
5
- label?: string;
6
- type?: 'header' | 'content';
7
- }
8
- declare const NodeTag: FC<PropsWithChildren<TagOptions>>;
9
- export default NodeTag;
@@ -1,17 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { Stack, Typography, Tooltip } from "@mui/material";
3
- import { F as FlexOne } from "../../../../FlexOne-BSYAhhtG.js";
4
- import Iconified from "../../icons/Iconified.js";
5
- const NodeTag = ({ nodeId, label = nodeId, type = "content", children }) => {
6
- return /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", pr: 1, children: [
7
- type === "header" ? /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", sx: { overflow: "hidden" }, children: [
8
- /* @__PURE__ */ jsx(Typography, { variant: "body1", sx: { wordWrap: "break-all" }, children: label.replace(" (TRUNCATED)", "") }),
9
- label.includes("TRUNCATED") && /* @__PURE__ */ jsx(Tooltip, { title: "Field is truncated.", children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-content-cut", fontSize: "small", style: { fontSize: "0.9em" } }) })
10
- ] }) : label,
11
- /* @__PURE__ */ jsx(FlexOne, {}),
12
- children
13
- ] });
14
- };
15
- export {
16
- NodeTag as default
17
- };
@@ -1,9 +0,0 @@
1
- import { StackProps } from '@mui/material';
2
- import { NestedDataset } from "../../../types/graph";
3
- import { FC } from 'react';
4
-
5
- declare const Graph: FC<{
6
- graph: NestedDataset;
7
- sx?: StackProps['sx'];
8
- }>;
9
- export default Graph;
@@ -1,438 +0,0 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { useMemo, useRef, useState, useEffect, useCallback, createElement } from "react";
3
- import { useTheme, lighten, darken, Stack, Card, Typography, alpha, Autocomplete, TextField, FormControl, InputLabel, Select, MenuItem, IconButton, Collapse } from "@mui/material";
4
- import { p as parseEvent } from "../../../index-BDrtH5ec.js";
5
- import { z as zoom, i as identity, s as select, t as transform, p as pointer } from "../../../index-DJYqRcxJ.js";
6
- import useComparator from "../../../hooks/useComparator.js";
7
- import { useMyLocalStorageItem } from "../../../hooks/useMyLocalStorage.js";
8
- import { StorageKey } from "../../../utils/constants.js";
9
- import { g as get } from "../../../get-D3C3lEU3.js";
10
- import { cssImportant } from "../../../utils/graph.js";
11
- import Iconified from "../icons/Iconified.js";
12
- import ExpandMoreButton from "./ExpandMoreButton.js";
13
- import Cloud from "./visualizations/cloud/index.js";
14
- import NodePanel from "./visualizations/panels/NodePanel.js";
15
- import Tree from "./visualizations/tree/index.js";
16
- const Graph = ({ graph, sx = {} }) => {
17
- var _a, _b, _c, _d, _e;
18
- const theme = useTheme();
19
- const isDark = useMemo(() => theme.palette.mode === "dark", [theme]);
20
- const { runComparator } = useComparator();
21
- const svgRef = useRef();
22
- const pointRef = useRef();
23
- const [showMousePos] = useMyLocalStorageItem(StorageKey.SHOW_MOUSE_POS, false);
24
- const [showCoordinates] = useMyLocalStorageItem(StorageKey.SHOW_COORDINATES, false);
25
- const [panelLocation] = useMyLocalStorageItem(StorageKey.PANEL_LOCATION, "vertical");
26
- const [relativeMousePos, setRelativeMousePos] = useState(["0", "0"]);
27
- const [absoluteMousePos, setAbsoluteMousePos] = useState(["0", "0"]);
28
- const [showPanel, setShowPanel] = useState(false);
29
- const nodeIds = useMemo(() => ((graph == null ? void 0 : graph.data) ?? []).flat(2).map((node) => node.id), [graph == null ? void 0 : graph.data]);
30
- const zoom$1 = useMemo(() => zoom().scaleExtent([0.1, 6]), []);
31
- const [currentZoom, setCurrentZoom] = useState(identity);
32
- const [nodeId, setNodeId] = useState("");
33
- const [selectedNodeIds, setSelectedNodeIds] = useState([]);
34
- const [viz, setViz] = useState(
35
- ((_b = (_a = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a.visualization) == null ? void 0 : _b.type) ?? "tree"
36
- );
37
- const [hasError, setHasError] = useState(false);
38
- useEffect(() => {
39
- setShowPanel(selectedNodeIds.length > 0);
40
- }, [selectedNodeIds]);
41
- const labelKeys = useMemo(
42
- () => {
43
- var _a2, _b2;
44
- return (_b2 = (_a2 = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a2.displayField) == null ? void 0 : _b2.filter((entry) => (entry.zoom ?? Number.MAX_SAFE_INTEGER) > currentZoom.k);
45
- },
46
- [(_c = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _c.displayField, currentZoom.k]
47
- );
48
- const onNodeChange = useCallback((node) => {
49
- setNodeId(node);
50
- }, []);
51
- const checkForNode = useCallback((_nodeId) => {
52
- const selector = _nodeId === "view" ? _nodeId : `node-${_nodeId ?? "will\\%never\\$ever\\*exist"}`;
53
- return select(`#${selector}`);
54
- }, []);
55
- const selectNode = useCallback(() => {
56
- if (!nodeId) {
57
- setHasError(true);
58
- return;
59
- }
60
- const nodeToGet = checkForNode(nodeId.replace(/[^A-Za-z0-9]*/g, ""));
61
- if (nodeToGet.empty()) {
62
- setHasError(true);
63
- return;
64
- }
65
- setHasError(false);
66
- setSelectedNodeIds([nodeId]);
67
- const clientRect = svgRef.current.getBoundingClientRect();
68
- const svg = select(svgRef.current);
69
- const box = nodeToGet.node().getBBox();
70
- svg.transition().duration(500).call(
71
- zoom$1.transform,
72
- identity.translate(clientRect.width / 2, clientRect.height / 2).scale(4).translate(-box.x, -box.y)
73
- );
74
- }, [checkForNode, nodeId, zoom$1.transform]);
75
- const onKeyPress = useCallback(
76
- (event) => {
77
- const parsedEvent = parseEvent(event);
78
- if (parsedEvent.isCtrl && parsedEvent.isEnter) {
79
- selectNode();
80
- }
81
- },
82
- [selectNode]
83
- );
84
- const findNode = useCallback((id) => ((graph == null ? void 0 : graph.data) ?? []).flat().find((n) => n.id === id), [graph == null ? void 0 : graph.data]);
85
- const resetZoom = useCallback(
86
- (instant = false) => {
87
- if (!graph) {
88
- return;
89
- }
90
- const box = select(svgRef.current).select("#view").node().getBBox();
91
- const clientRect = svgRef.current.getBoundingClientRect();
92
- const zoomLevel = Math.min(clientRect.width / (box.width + 25), (clientRect.height - 96) / box.height);
93
- let selection = select(svgRef.current);
94
- if (!instant) {
95
- selection = selection.transition().duration(500);
96
- }
97
- selection.call(
98
- zoom$1.transform,
99
- identity.translate(clientRect.width / 2, (clientRect.height + 96) / 2).scale(zoomLevel).translate(-box.width / 2, -box.height / 2 - 10)
100
- );
101
- },
102
- [zoom$1.transform, graph]
103
- );
104
- const onNodeSelectionChanged = useCallback((_nodeIds) => setSelectedNodeIds(_nodeIds), []);
105
- useEffect(() => {
106
- if (!graph) {
107
- return;
108
- }
109
- pointRef.current = svgRef.current.createSVGPoint();
110
- select(svgRef.current).call(
111
- zoom$1.on("zoom", (event) => {
112
- setCurrentZoom == null ? void 0 : setCurrentZoom(event.transform);
113
- select(svgRef.current).select("#view").attr("transform", event.transform);
114
- })
115
- );
116
- }, [setCurrentZoom, zoom$1, viz, graph]);
117
- useEffect(() => {
118
- if (showMousePos) {
119
- select(svgRef.current).on("mousemove", (event) => {
120
- const _zoom = transform(select(svgRef.current).select("#view").node());
121
- setAbsoluteMousePos(_zoom.invert(pointer(event)).map((n) => n.toFixed(0)));
122
- setRelativeMousePos(pointer(event).map((n) => n.toFixed(0)));
123
- });
124
- }
125
- }, [showMousePos, graph]);
126
- useEffect(() => {
127
- resetZoom();
128
- }, [viz, graph == null ? void 0 : graph.data]);
129
- useEffect(() => {
130
- var _a2, _b2, _c2, _d2;
131
- if ((_b2 = (_a2 = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a2.visualization) == null ? void 0 : _b2.type) {
132
- setViz((_d2 = (_c2 = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _c2.visualization) == null ? void 0 : _d2.type);
133
- }
134
- }, [(_e = (_d = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _d.visualization) == null ? void 0 : _e.type]);
135
- const treeOptions = useMemo(
136
- () => ({
137
- textColor: theme.palette.text.primary,
138
- backgroundColor: theme.palette.background.paper,
139
- nodeColor: {
140
- border: (isDark ? lighten : darken)(theme.palette.background.paper, 0.3),
141
- center: "white"
142
- }
143
- }),
144
- [isDark, theme.palette.background.paper, theme.palette.text.primary]
145
- );
146
- const cloudOptions = useMemo(
147
- () => ({
148
- textColor: theme.palette.text.primary,
149
- backgroundColor: theme.palette.background.paper,
150
- nodeColor: {
151
- border: (isDark ? lighten : darken)(theme.palette.background.paper, 0.3),
152
- center: "white"
153
- }
154
- }),
155
- [isDark, theme.palette.background.paper, theme.palette.text.primary]
156
- );
157
- const visualizations = useMemo(
158
- () => ({
159
- tree: () => /* @__PURE__ */ jsx(
160
- Tree,
161
- {
162
- svgRef,
163
- graph,
164
- labelKeys,
165
- onNodeSelectionChanged,
166
- zoom: currentZoom,
167
- options: treeOptions
168
- }
169
- ),
170
- cloud: () => /* @__PURE__ */ jsx(Cloud, { svgRef, graph, options: cloudOptions })
171
- }),
172
- [cloudOptions, currentZoom, graph, labelKeys, onNodeSelectionChanged, treeOptions]
173
- );
174
- const suggestions = useMemo(() => {
175
- return nodeIds.flatMap((id) => {
176
- var _a2, _b2;
177
- const node = (((_a2 = graph == null ? void 0 : graph.data) == null ? void 0 : _a2.flat()) ?? []).find((_node) => _node.id === id);
178
- if (!node) {
179
- return { id, value: id };
180
- }
181
- const key = ((_b2 = labelKeys == null ? void 0 : labelKeys.filter((comparator) => runComparator(comparator, node)).pop()) == null ? void 0 : _b2.label) ?? "id";
182
- const value = key.split(",").map((_key) => {
183
- var _a3;
184
- return (_a3 = get(node, _key)) == null ? void 0 : _a3.toString();
185
- }).filter((val) => !!val).map((_value) => ({ id, value: _value.trim() }));
186
- return value;
187
- });
188
- }, [graph == null ? void 0 : graph.data, labelKeys, nodeIds, runComparator]);
189
- return /* @__PURE__ */ jsxs(
190
- Stack,
191
- {
192
- direction: panelLocation === "vertical" ? "row" : "column",
193
- spacing: 1,
194
- overflow: "hidden",
195
- height: "100%",
196
- width: "100%",
197
- sx,
198
- children: [
199
- /* @__PURE__ */ jsx(Stack, { direction: "column", spacing: 1, sx: { position: "relative", flex: 1 }, children: /* @__PURE__ */ jsxs(
200
- Card,
201
- {
202
- variant: "outlined",
203
- sx: {
204
- flex: 1,
205
- position: "relative",
206
- maxHeight: `calc(100vh - 64px - ${theme.spacing(1)})`,
207
- "& #viz": {
208
- maxHeight: `calc(100vh - 64px - ${theme.spacing(1)})`,
209
- width: "100%",
210
- height: "100%",
211
- backgroundColor: theme.palette.background.paper
212
- },
213
- "& .path": {
214
- transition: theme.transitions.create(["opacity"], {
215
- duration: theme.transitions.duration.short
216
- })
217
- },
218
- "& .node": {
219
- cursor: "pointer",
220
- "& > path, & > text, & > polygon, & circle": {
221
- transition: theme.transitions.create(["stroke", "fill", "fill-opacity", "stroke-opacity"], {
222
- duration: theme.transitions.duration.short
223
- })
224
- },
225
- "&.hover > .center": {
226
- stroke: cssImportant(theme.palette.primary.main)
227
- },
228
- "&.hover > .border": {
229
- stroke: cssImportant(theme.palette.primary.dark)
230
- },
231
- "&.selected > .center": {
232
- stroke: cssImportant(theme.palette.success.main)
233
- },
234
- "&.selected > .border": {
235
- stroke: cssImportant(theme.palette.success.dark)
236
- },
237
- "&.selected.hover > .center": {
238
- stroke: cssImportant(theme.palette.primary.main)
239
- },
240
- "&.selected.hover > .border": {
241
- stroke: cssImportant(theme.palette.primary.dark)
242
- }
243
- }
244
- },
245
- children: [
246
- graph ? visualizations[viz]() : /* @__PURE__ */ jsxs(Fragment, { children: [
247
- /* @__PURE__ */ jsx("svg", { id: "viz", ref: svgRef, children: /* @__PURE__ */ jsx("g", { id: "view" }) }),
248
- /* @__PURE__ */ jsx(
249
- Typography,
250
- {
251
- variant: "h1",
252
- color: "text.secondary",
253
- sx: {
254
- position: "absolute",
255
- top: "50%",
256
- left: "50%",
257
- opacity: 0.3,
258
- transform: "translateX(-50%) translateY(-50%)"
259
- },
260
- children: "No dataset has been selected!"
261
- }
262
- )
263
- ] }),
264
- /* @__PURE__ */ jsx(
265
- Stack,
266
- {
267
- direction: "column",
268
- spacing: 1,
269
- sx: {
270
- position: "absolute",
271
- top: theme.spacing(1),
272
- left: theme.spacing(1),
273
- right: theme.spacing(1)
274
- },
275
- children: /* @__PURE__ */ jsxs(
276
- Stack,
277
- {
278
- direction: "row",
279
- spacing: 1,
280
- sx: {
281
- "& > div:first-of-type": {
282
- flex: 1,
283
- maxWidth: "775px",
284
- backgroundColor: alpha(theme.palette.background.paper, 0.8)
285
- }
286
- },
287
- children: [
288
- /* @__PURE__ */ jsx(
289
- Autocomplete,
290
- {
291
- disablePortal: true,
292
- onChange: (__, value) => onNodeChange(value.id),
293
- onKeyDown: onKeyPress,
294
- options: suggestions,
295
- sx: { width: "400px" },
296
- getOptionLabel: (option) => option.value,
297
- filterOptions: (options, state) => options.filter((opt) => opt.value.toLowerCase().includes(state.inputValue)),
298
- renderOption: (props, option) => /* @__PURE__ */ createElement("li", { ...props, key: option.id + option.value }, option.value),
299
- renderInput: (params) => /* @__PURE__ */ jsx(
300
- TextField,
301
- {
302
- ...params,
303
- error: hasError,
304
- label: "Enter a node ID, and press [ctrl + enter] to select it. [ctrl + space] will open an autocomplete menu."
305
- }
306
- )
307
- }
308
- ),
309
- /* @__PURE__ */ jsxs(FormControl, { sx: { minWidth: "150px", backgroundColor: alpha(theme.palette.background.paper, 0.8) }, children: [
310
- /* @__PURE__ */ jsx(InputLabel, { id: "viz-label", children: "Visualization" }),
311
- /* @__PURE__ */ jsx(
312
- Select,
313
- {
314
- label: "Visualization",
315
- labelId: "viz-label",
316
- value: viz,
317
- onChange: (event) => setViz(event.target.value),
318
- sx: { textTransform: "capitalize" },
319
- children: Object.keys(visualizations).map((_viz) => /* @__PURE__ */ jsx(MenuItem, { value: _viz, sx: { textTransform: "capitalize" }, children: _viz }, _viz))
320
- }
321
- )
322
- ] }),
323
- /* @__PURE__ */ jsx(
324
- ExpandMoreButton,
325
- {
326
- disabled: selectedNodeIds.length < 1,
327
- expand: showPanel,
328
- onClick: () => setShowPanel(!showPanel),
329
- "aria-expanded": showPanel,
330
- "aria-label": "show more",
331
- size: "small",
332
- sx: {
333
- marginLeft: "auto !important",
334
- alignSelf: "center"
335
- },
336
- children: /* @__PURE__ */ jsx(
337
- Iconified,
338
- {
339
- icon: panelLocation === "vertical" ? "ic:baseline-chevron-left" : "ic:baseline-expand-more",
340
- fontSize: "medium"
341
- }
342
- )
343
- }
344
- )
345
- ]
346
- }
347
- )
348
- }
349
- ),
350
- /* @__PURE__ */ jsx(
351
- Card,
352
- {
353
- variant: showCoordinates ? "elevation" : "outlined",
354
- elevation: showCoordinates ? 4 : 0,
355
- sx: {
356
- position: "absolute",
357
- bottom: theme.spacing(0.5),
358
- right: theme.spacing(0.5),
359
- px: 1,
360
- py: 0.5,
361
- border: "none !important"
362
- },
363
- children: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 0.5, alignItems: "center", children: [
364
- showCoordinates && /* @__PURE__ */ jsxs("span", { children: [
365
- currentZoom.x.toFixed(0),
366
- ", ",
367
- currentZoom.y.toFixed(0),
368
- " (",
369
- currentZoom.k.toFixed(2),
370
- "x)"
371
- ] }),
372
- /* @__PURE__ */ jsx(
373
- IconButton,
374
- {
375
- size: showCoordinates ? "small" : "medium",
376
- onClick: () => resetZoom(),
377
- disabled: currentZoom.k === identity.k && currentZoom.x === 0 && currentZoom.y === 0,
378
- children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-refresh", fontSize: showCoordinates ? "small" : "medium" })
379
- }
380
- )
381
- ] })
382
- }
383
- ),
384
- showMousePos && /* @__PURE__ */ jsx(
385
- Card,
386
- {
387
- variant: "elevation",
388
- elevation: 4,
389
- sx: {
390
- position: "absolute",
391
- bottom: theme.spacing(0.5),
392
- left: theme.spacing(0.5),
393
- px: 1,
394
- py: 0.5
395
- },
396
- children: /* @__PURE__ */ jsx("code", { children: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, children: [
397
- /* @__PURE__ */ jsxs("span", { children: [
398
- "(abs: ",
399
- absoluteMousePos.join(", "),
400
- ")"
401
- ] }),
402
- /* @__PURE__ */ jsxs("span", { children: [
403
- "(rel: ",
404
- relativeMousePos.join(", "),
405
- ")"
406
- ] })
407
- ] }) })
408
- }
409
- )
410
- ]
411
- }
412
- ) }),
413
- /* @__PURE__ */ jsx(
414
- Collapse,
415
- {
416
- in: showPanel && selectedNodeIds.length > 0,
417
- orientation: panelLocation === "vertical" ? "horizontal" : "vertical",
418
- appear: true,
419
- unmountOnExit: true,
420
- children: /* @__PURE__ */ jsx(
421
- Stack,
422
- {
423
- direction: "column",
424
- spacing: 1,
425
- sx: panelLocation === "vertical" ? { width: "450px", height: "100%" } : { width: "100%", height: "300px" },
426
- pb: 1,
427
- children: /* @__PURE__ */ jsx(NodePanel, { selectedNodeIds, findNode })
428
- }
429
- )
430
- }
431
- )
432
- ]
433
- }
434
- );
435
- };
436
- export {
437
- Graph as default
438
- };
@@ -1,25 +0,0 @@
1
- import { CSSProperties, FC, PropsWithChildren } from 'react';
2
-
3
- interface LeafPropsType {
4
- nodeId: string;
5
- label?: string;
6
- x: number;
7
- y: number;
8
- height: number;
9
- nodeRadius: number;
10
- nodeColor: {
11
- border: string;
12
- center: string;
13
- };
14
- nodeOpacity: number;
15
- letterSize: number;
16
- letterWidth: number;
17
- textColor: string;
18
- selected?: boolean;
19
- alwaysShowText?: boolean;
20
- style?: CSSProperties;
21
- onHoverChanged?: (nodeId: string, isHovered: boolean) => void;
22
- onClick?: (nodeId: string, isSelected: boolean, event: MouseEvent) => void;
23
- }
24
- declare const Leaf: FC<PropsWithChildren<LeafPropsType>>;
25
- export default Leaf;