@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,121 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { useTheme } from "@mui/material";
3
- import { d as d3, S as Spectral } from "../../../../../index-DJYqRcxJ.js";
4
- import { useMyLocalStorageItem } from "../../../../../hooks/useMyLocalStorage.js";
5
- import { StorageKey } from "../../../../../utils/constants.js";
6
- import { buildHorizontalLine, buildVerticalLine } from "../../../../../utils/line.js";
7
- import { i as isNil } from "../../../../../isNil-CIubwp4T.js";
8
- import { useMemo } from "react";
9
- import { cyrb53 } from "../../../../../utils/graph.js";
10
- const BundleLine = ({
11
- bundle,
12
- linesByLevel,
13
- paddingByLevel,
14
- maxArcRadius,
15
- lineWidth,
16
- linePaddingX,
17
- linePaddingY,
18
- highlightedPath,
19
- nodeLocations,
20
- inputsByNode,
21
- outputsByNode,
22
- lineDirection,
23
- colorTheme
24
- }) => {
25
- const theme = useTheme();
26
- const [colorSetting] = useMyLocalStorageItem(StorageKey.COLOR_SCHEME, "Spectral");
27
- const [forceColorSetting] = useMyLocalStorageItem(StorageKey.FORCE_COLOR_SETTING, "Spectral");
28
- const colorScheme = useMemo(
29
- () => forceColorSetting ? colorSetting : colorTheme || colorSetting,
30
- [colorSetting, colorTheme, forceColorSetting]
31
- );
32
- const color = useMemo(
33
- () => (d3[`interpolate${colorScheme}`] ?? Spectral)(cyrb53(JSON.stringify(bundle))),
34
- [bundle, colorScheme]
35
- );
36
- const opacities = useMemo(
37
- () => (_bundle) => highlightedPath.size === 0 || _bundle.sources.some((source) => highlightedPath.has(source.id)) && _bundle.destinations.some((destination) => highlightedPath.has(destination.id)) ? 1 : 0.2,
38
- [highlightedPath]
39
- );
40
- const arrows = [];
41
- const d = bundle.sources.flatMap((source) => {
42
- const result = bundle.destinations.flatMap((dest) => {
43
- var _a, _b;
44
- linesByLevel[dest.level].delete(bundle.id);
45
- const [parentX, rawParentY] = nodeLocations[source.id];
46
- const parentY = rawParentY + (((_a = outputsByNode[source.id]) == null ? void 0 : _a.size) ?? 0) * linePaddingY;
47
- const [childX, rawChildY, childHeight] = nodeLocations[dest.id];
48
- const childY = rawChildY + (((_b = inputsByNode[dest.id]) == null ? void 0 : _b.size) ?? 0 + +(source.id === dest.id)) * linePaddingY;
49
- const distanceX = childX - parentX;
50
- const distanceY = childY - parentY;
51
- const arcRadius = Math.min(Math.abs(distanceY / 3), maxArcRadius);
52
- if (lineDirection === "horizontal") {
53
- return buildHorizontalLine({
54
- paddingAtLevel: paddingByLevel[dest.level],
55
- numLines: linesByLevel[dest.level].size,
56
- nodeLocations,
57
- dest,
58
- distanceX,
59
- distanceY,
60
- childX,
61
- childY,
62
- childHeight,
63
- parentX,
64
- parentY,
65
- linePaddingX,
66
- arcRadius
67
- });
68
- } else {
69
- return buildVerticalLine({
70
- paddingAtLevel: paddingByLevel[dest.level],
71
- numLines: linesByLevel[dest.level].size,
72
- distanceX,
73
- distanceY,
74
- childX,
75
- childY,
76
- childHeight,
77
- parentX,
78
- parentY,
79
- linePaddingX,
80
- arcRadius
81
- });
82
- }
83
- });
84
- return result;
85
- }).join("\n");
86
- bundle.destinations.forEach((dest) => {
87
- if (isNil(inputsByNode[dest.id])) {
88
- inputsByNode[dest.id] = /* @__PURE__ */ new Set();
89
- }
90
- inputsByNode[dest.id].add(bundle.id);
91
- });
92
- bundle.sources.forEach((source) => {
93
- if (isNil(outputsByNode[source.id])) {
94
- outputsByNode[source.id] = /* @__PURE__ */ new Set();
95
- }
96
- outputsByNode[source.id].add(bundle.id);
97
- });
98
- return /* @__PURE__ */ jsxs("g", { className: "path", style: { opacity: opacities(bundle) }, children: [
99
- /* @__PURE__ */ jsx(
100
- "path",
101
- {
102
- d,
103
- style: { fill: "none", stroke: theme.palette.background.paper, strokeWidth: lineWidth + 3 }
104
- },
105
- bundle.id + "-bg"
106
- ),
107
- /* @__PURE__ */ jsx(
108
- "path",
109
- {
110
- d,
111
- strokeWidth: lineWidth,
112
- style: { fill: "none", stroke: color, strokeWidth: lineWidth }
113
- },
114
- bundle.id + "-fg"
115
- ),
116
- arrows
117
- ] }, bundle.id);
118
- };
119
- export {
120
- BundleLine as default
121
- };
@@ -1,9 +0,0 @@
1
- import { FC } from 'react';
2
-
3
- declare const Triangle: FC<{
4
- x: number;
5
- y: number;
6
- fill: string;
7
- lineWidth: number;
8
- }>;
9
- export default Triangle;
@@ -1,26 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { useTheme } from "@mui/material";
3
- const Triangle = ({ x, y, fill, lineWidth }) => {
4
- const theme = useTheme();
5
- return /* @__PURE__ */ jsxs("g", { className: "arrow", children: [
6
- /* @__PURE__ */ jsx(
7
- "polygon",
8
- {
9
- points: `${x},${y - 1.5 * lineWidth} ${x - 2 * lineWidth},${y + 1.5 * lineWidth} ${x + 2 * lineWidth},${y + 1.5 * lineWidth}`,
10
- style: { fill },
11
- stroke: theme.palette.background.paper,
12
- strokeWidth: 2
13
- }
14
- ),
15
- /* @__PURE__ */ jsx(
16
- "polygon",
17
- {
18
- points: `${x - lineWidth / 2},${y - 2 * lineWidth} ${x + lineWidth / 2},${y - 2 * lineWidth} ${x + lineWidth / 2},${y + 2 * lineWidth} ${x - lineWidth / 2},${y + 2 * lineWidth}`,
19
- style: { fill }
20
- }
21
- )
22
- ] });
23
- };
24
- export {
25
- Triangle as default
26
- };
@@ -1,36 +0,0 @@
1
- import { NestedDataset, ZoomField } from "../../../../../types/graph";
2
- import { MutableRefObject } from 'react';
3
-
4
- interface TreeOptions {
5
- textColor: string;
6
- nodeColor: {
7
- border: string;
8
- center: string;
9
- };
10
- letterSize: number;
11
- letterWidth: number;
12
- xSpacing: number;
13
- ySpacing: number;
14
- nodeRadius: number;
15
- maxArcRadius: number;
16
- linePaddingX: number;
17
- linePaddingY: number;
18
- lineWidth: number;
19
- enableEntryPadding: boolean;
20
- truncateLabels: boolean;
21
- enableTimestamps: boolean;
22
- rowStep: number;
23
- belowPrevious: boolean;
24
- iconOrientation: 'horizontal' | 'vertical';
25
- lineDirection: 'horizontal' | 'vertical';
26
- colorTheme?: string;
27
- }
28
- declare const _default: import('react').NamedExoticComponent<{
29
- svgRef?: MutableRefObject<SVGSVGElement>;
30
- graph: NestedDataset;
31
- labelKeys: ZoomField[];
32
- onNodeSelectionChanged: (nodeIds: string[]) => void;
33
- options?: Partial<TreeOptions>;
34
- zoom: d3.ZoomTransform;
35
- }>;
36
- export default _default;
@@ -1,485 +0,0 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { useTheme, colors, Box } from "@mui/material";
3
- import useComparator from "../../../../../hooks/useComparator.js";
4
- import useMyHighlights from "../../../../../hooks/useMyHighlights.js";
5
- import { useMyLocalStorageItem } from "../../../../../hooks/useMyLocalStorage.js";
6
- import { StorageKey, BUNDLE_SEPARATOR } from "../../../../../utils/constants.js";
7
- import { c as cloneDeep } from "../../../../../cloneDeep-CjP5k9zW.js";
8
- import { g as get } from "../../../../../get-D3C3lEU3.js";
9
- import { i as isNil } from "../../../../../isNil-CIubwp4T.js";
10
- import { b as baseExtremum, a as baseGt, i as isIterateeCall } from "../../../../../_baseExtremum-B1o1zHjR.js";
11
- import { i as identity } from "../../../../../identity-CPGTqrE4.js";
12
- import { t as toFinite } from "../../../../../toFinite-CArjry_l.js";
13
- import { b as baseSum } from "../../../../../_baseSum-D0WC1dN0.js";
14
- import { memo, useMemo } from "react";
15
- import NodeCard from "../../elements/NodeCard.js";
16
- import getIcon from "../icons/index.js";
17
- import Leaf from "../Leaf.js";
18
- import BundleLine from "./BundleLine.js";
19
- function max(array) {
20
- return array && array.length ? baseExtremum(array, identity, baseGt) : void 0;
21
- }
22
- var nativeCeil = Math.ceil, nativeMax = Math.max;
23
- function baseRange(start, end, step, fromRight) {
24
- var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result = Array(length);
25
- while (length--) {
26
- result[++index] = start;
27
- start += step;
28
- }
29
- return result;
30
- }
31
- function createRange(fromRight) {
32
- return function(start, end, step) {
33
- if (step && typeof step != "number" && isIterateeCall(start, end, step)) {
34
- end = step = void 0;
35
- }
36
- start = toFinite(start);
37
- if (end === void 0) {
38
- end = start;
39
- start = 0;
40
- } else {
41
- end = toFinite(end);
42
- }
43
- step = step === void 0 ? start < end ? 1 : -1 : toFinite(step);
44
- return baseRange(start, end, step);
45
- };
46
- }
47
- var range = createRange();
48
- function sum(array) {
49
- return array && array.length ? baseSum(array, identity) : 0;
50
- }
51
- const DEFAULT_OPTIONS = {
52
- textColor: "white",
53
- nodeColor: {
54
- border: "grey",
55
- center: "white"
56
- },
57
- letterSize: 10,
58
- letterWidth: 6.5,
59
- xSpacing: 8,
60
- ySpacing: 20,
61
- nodeRadius: 6,
62
- maxArcRadius: 8,
63
- linePaddingX: 10,
64
- linePaddingY: 10,
65
- lineWidth: 3,
66
- enableEntryPadding: true,
67
- truncateLabels: true,
68
- enableTimestamps: true,
69
- iconOrientation: "vertical",
70
- lineDirection: "horizontal",
71
- rowStep: null,
72
- // We'll make this dynamic
73
- belowPrevious: false
74
- };
75
- DEFAULT_OPTIONS.rowStep = DEFAULT_OPTIONS.ySpacing * 2;
76
- const Tree = ({ svgRef, graph, labelKeys, onNodeSelectionChanged, zoom, options = {} }) => {
77
- var _a, _b, _c;
78
- const combinedOptions = useMemo(
79
- () => {
80
- var _a2, _b2;
81
- return {
82
- ...DEFAULT_OPTIONS,
83
- ...options,
84
- ...((_b2 = (_a2 = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a2.visualization) == null ? void 0 : _b2.config) ?? {}
85
- };
86
- },
87
- [(_b = (_a = graph == null ? void 0 : graph.metadata.display) == null ? void 0 : _a.visualization) == null ? void 0 : _b.config, options]
88
- );
89
- const {
90
- xSpacing: baseXSpacing,
91
- ySpacing: baseYSpacing,
92
- linePaddingX: baseLinePaddingX,
93
- linePaddingY: baseLinePaddingY
94
- } = combinedOptions;
95
- const { runComparators, runComparator } = useComparator();
96
- const { onNodeHoveredChanged, onNodeClicked, nodeOpacities, highlightedPath, highlightedNodes, hoveredNode } = useMyHighlights(graph, (nodeIds) => onNodeSelectionChanged(nodeIds));
97
- const theme = useTheme();
98
- const isDark = useMemo(() => theme.palette.mode === "dark", [theme]);
99
- const [showCardsSettings] = useMyLocalStorageItem(StorageKey.SHOW_CARDS, false);
100
- const [cardCutoff] = useMyLocalStorageItem(StorageKey.CARD_CUTOFF, 2.5);
101
- const showCards = useMemo(() => zoom.k > cardCutoff && showCardsSettings, [cardCutoff, showCardsSettings, zoom.k]);
102
- const levels = useMemo(
103
- () => graph.data.map(
104
- (level, levelIndex) => level.map((node) => ({
105
- ...node,
106
- parents: node == null ? void 0 : node.edges,
107
- level: levelIndex
108
- }))
109
- ),
110
- [graph.data]
111
- );
112
- const flatNodes = useMemo(() => levels.flat(), [levels]);
113
- const [xSpacing, linePaddingX, ySpacing, linePaddingY] = useMemo(() => {
114
- const baseValues = [
115
- [baseXSpacing, baseLinePaddingX],
116
- [baseYSpacing, baseLinePaddingY]
117
- ];
118
- if (zoom.k > 1 && showCardsSettings) {
119
- return baseValues.flatMap(
120
- (arr, index) => arr.map((_v) => _v * Math.pow(2.5 - index * 1.25, Math.min(zoom.k, 2.5) - 1))
121
- );
122
- } else {
123
- return baseValues.flat();
124
- }
125
- }, [baseLinePaddingX, baseLinePaddingY, baseXSpacing, baseYSpacing, showCardsSettings, zoom.k]);
126
- let portBounds;
127
- if (!graph || !svgRef.current) {
128
- portBounds = [
129
- [0, 0],
130
- [0, 0]
131
- ];
132
- } else {
133
- const data = svgRef.current.getBoundingClientRect();
134
- portBounds = [zoom.invert([0, 0]), zoom.invert([data.width, data.height])];
135
- }
136
- const bundles = useMemo(() => {
137
- const bundlesDict = {};
138
- flatNodes.forEach((node) => {
139
- if (!node.parents) {
140
- return;
141
- }
142
- const bundleId = node.parents.join(BUNDLE_SEPARATOR);
143
- if (bundlesDict[bundleId]) {
144
- bundlesDict[bundleId].destinations.push(node);
145
- } else {
146
- bundlesDict[bundleId] = {
147
- id: bundleId,
148
- sources: node.parents.map((parent) => flatNodes.find((_node) => _node.id === parent)),
149
- destinations: [node]
150
- };
151
- }
152
- });
153
- return Object.values(bundlesDict);
154
- }, [flatNodes]);
155
- const layoutData = useMemo(() => {
156
- const {
157
- letterSize,
158
- letterWidth,
159
- enableEntryPadding,
160
- truncateLabels,
161
- rowStep,
162
- belowPrevious
163
- } = combinedOptions;
164
- let currentX = 0;
165
- let currentY = 0;
166
- const nodeLocations = {};
167
- const linesByLevel = {};
168
- const paddingByLevel = {};
169
- const inputs = {};
170
- const outputs = {};
171
- levels.forEach((level, levelIndex) => {
172
- let longestLabel = 0;
173
- level.forEach((node) => {
174
- var _a2;
175
- const validKeys = labelKeys == null ? void 0 : labelKeys.filter((_comparator) => runComparator(_comparator, node));
176
- const labelKey = (_a2 = validKeys == null ? void 0 : validKeys.pop()) == null ? void 0 : _a2.label;
177
- const labelRows = (labelKey == null ? void 0 : labelKey.split(",").map((key) => get(node, key)).filter((val) => !!val)) ?? [];
178
- if (labelRows.length < 1) {
179
- node.id.split("\n").forEach((line) => labelRows.push(line));
180
- }
181
- const labelHeight = labelRows.length * letterSize;
182
- currentY += labelHeight;
183
- nodeLocations[node.id] = [+currentX, +currentY, -linePaddingY];
184
- currentY += ySpacing;
185
- if (enableEntryPadding) {
186
- longestLabel = Math.max(longestLabel, max((labelRows == null ? void 0 : labelRows.map((row) => row.toString().length)) ?? [node.id.length]));
187
- }
188
- });
189
- currentX += xSpacing + (!truncateLabels ? longestLabel : Math.min(longestLabel, 44)) * letterWidth;
190
- if (!belowPrevious) {
191
- currentY = (levelIndex + 1) * rowStep;
192
- } else {
193
- currentY += rowStep;
194
- }
195
- });
196
- bundles.forEach((bundle) => {
197
- bundle.sources.forEach((source) => {
198
- if (!outputs[source.id]) {
199
- outputs[source.id] = /* @__PURE__ */ new Set();
200
- }
201
- outputs[source.id].add(bundle.id);
202
- });
203
- bundle.destinations.forEach((dest) => {
204
- if (isNil(linesByLevel[dest.level])) {
205
- linesByLevel[dest.level] = /* @__PURE__ */ new Set();
206
- }
207
- if (!inputs[dest.id]) {
208
- inputs[dest.id] = /* @__PURE__ */ new Set();
209
- }
210
- linesByLevel[dest.level].add(bundle.id);
211
- inputs[dest.id].add(bundle.id);
212
- });
213
- });
214
- Object.entries(linesByLevel).forEach(([level, lines]) => paddingByLevel[level] = lines.size);
215
- levels.forEach((level, levelIndex) => {
216
- const indexesSoFar = range(levelIndex + 1);
217
- const paddingArray = indexesSoFar.map((_levelIndex) => paddingByLevel[_levelIndex] ?? 0);
218
- const totalPadding = sum(paddingArray) * linePaddingX;
219
- level.forEach((node) => {
220
- nodeLocations[node.id][0] += totalPadding;
221
- });
222
- });
223
- flatNodes.forEach((node) => {
224
- var _a2, _b2, _c2;
225
- let maxHeight = max([((_a2 = inputs[node.id]) == null ? void 0 : _a2.size) - 1, ((_b2 = outputs[node.id]) == null ? void 0 : _b2.size) - 1, 0]) * linePaddingY;
226
- if ((_c2 = inputs[node.id]) == null ? void 0 : _c2.has(node.id)) {
227
- maxHeight += linePaddingY;
228
- }
229
- nodeLocations[node.id][2] = maxHeight;
230
- const levelIndex = levels[node.level].findIndex((_node) => _node.id === node.id);
231
- levels[node.level].filter((__, index) => levelIndex < index).forEach((_node) => {
232
- nodeLocations[_node.id][1] += maxHeight;
233
- });
234
- });
235
- return {
236
- nodeLocations,
237
- linesByLevel,
238
- paddingByLevel
239
- };
240
- }, [
241
- bundles,
242
- combinedOptions,
243
- flatNodes,
244
- labelKeys,
245
- levels,
246
- linePaddingX,
247
- linePaddingY,
248
- runComparator,
249
- xSpacing,
250
- ySpacing
251
- ]);
252
- const [timestamps, bundleElements, nodes] = useMemo(() => {
253
- const {
254
- textColor,
255
- letterSize,
256
- letterWidth,
257
- nodeRadius,
258
- nodeColor,
259
- maxArcRadius,
260
- lineWidth,
261
- truncateLabels,
262
- enableTimestamps,
263
- belowPrevious,
264
- iconOrientation,
265
- lineDirection,
266
- colorTheme
267
- } = combinedOptions;
268
- const { nodeLocations, linesByLevel, paddingByLevel } = layoutData;
269
- const _nodes = [];
270
- const _timestamps = [];
271
- flatNodes.forEach((node) => {
272
- var _a2, _b2, _c2, _d;
273
- const [x, y, _height] = nodeLocations[node.id];
274
- const labelKey = ((_a2 = labelKeys == null ? void 0 : labelKeys.filter((_comparator) => runComparator(_comparator, node)).pop()) == null ? void 0 : _a2.label) ?? "id";
275
- let label = labelKey == null ? void 0 : labelKey.split(",").map((key) => {
276
- let labelSection = get(node, key);
277
- if (labelSection && truncateLabels && labelSection.length > 44) {
278
- labelSection = labelSection.replace(/^(.{32}).+$/, "$1 (TRUNCATED)");
279
- }
280
- return labelSection;
281
- }).filter((section) => !!section).join("\n");
282
- if (!label) {
283
- if (node.id.length > 44) {
284
- label = node.id.replace(/^(.{32}).+$/, "$1 (TRUNCATED)");
285
- } else {
286
- label = node.id;
287
- }
288
- }
289
- if (belowPrevious && enableTimestamps && (node.timestamp || node.annotation)) {
290
- _timestamps.push(
291
- /* @__PURE__ */ jsxs(
292
- "g",
293
- {
294
- style: {
295
- cursor: "default",
296
- fontFamily: '"Lucida Console", monospace',
297
- fontSize: letterSize * 0.75 + "px"
298
- },
299
- children: [
300
- /* @__PURE__ */ jsx(
301
- "text",
302
- {
303
- x: portBounds[0][0] + xSpacing,
304
- y: y + (_height + nodeRadius) / 2,
305
- fill: theme.palette.getContrastText(theme.palette.background.paper),
306
- style: {
307
- fillOpacity: nodeOpacities(node.id) / 2,
308
- transition: theme.transitions.create(["fill-opacity"], {
309
- duration: theme.transitions.duration.short
310
- })
311
- },
312
- children: node.timestamp
313
- }
314
- ),
315
- node.annotation && node.annotation.split("\n").map((line, index) => {
316
- var _a3;
317
- return /* @__PURE__ */ jsx(
318
- "text",
319
- {
320
- x: portBounds[0][0] + (((_a3 = node.timestamp) == null ? void 0 : _a3.length) ?? 0) * letterWidth,
321
- y: y + (_height + nodeRadius) / 2 + index * letterSize,
322
- fill: isDark ? colors.orange[300] : colors.blue[900],
323
- style: {
324
- fillOpacity: nodeOpacities(node.id),
325
- transition: theme.transitions.create(["fill-opacity"], {
326
- duration: theme.transitions.duration.short
327
- })
328
- },
329
- children: line
330
- },
331
- line
332
- );
333
- })
334
- ]
335
- },
336
- node.id + "-timestamp"
337
- )
338
- );
339
- }
340
- if (!showCards) {
341
- const style = runComparators(
342
- (_c2 = (_b2 = graph.metadata.display) == null ? void 0 : _b2.styles) == null ? void 0 : _c2.filter((comparator) => comparator.type === "node"),
343
- node
344
- );
345
- const nodeOpacity = nodeOpacities(node.id);
346
- const icons = (_d = node.icons) == null ? void 0 : _d.map((icon) => [icon, getIcon(icon)]).filter(([__, icon]) => !!icon).map(([icon, Icon], index) => /* @__PURE__ */ jsx(
347
- Icon,
348
- {
349
- x: x - nodeRadius * 3 * (iconOrientation === "horizontal" ? index + 1 : 0),
350
- y: y - nodeRadius * 3 * (iconOrientation === "vertical" ? index + 1 : 0),
351
- size: letterSize * 1.5,
352
- style: {
353
- fillOpacity: nodeOpacity
354
- },
355
- circleStyle: {
356
- fillOpacity: nodeOpacity
357
- }
358
- },
359
- icon
360
- ));
361
- _nodes.push(
362
- /* @__PURE__ */ jsx(
363
- Leaf,
364
- {
365
- alwaysShowText: true,
366
- nodeId: node.id,
367
- label,
368
- height: _height,
369
- x,
370
- y,
371
- style,
372
- nodeRadius,
373
- nodeColor,
374
- nodeOpacity,
375
- letterSize,
376
- letterWidth,
377
- textColor,
378
- selected: highlightedNodes.has(node.id),
379
- onHoverChanged: onNodeHoveredChanged,
380
- onClick: onNodeClicked,
381
- children: icons
382
- },
383
- node.id
384
- )
385
- );
386
- }
387
- });
388
- const readonlyNodeLocations = cloneDeep(nodeLocations);
389
- const outputsByNode = {};
390
- const inputsByNode = {};
391
- const _bundleElements = bundles.map((bundle) => {
392
- return /* @__PURE__ */ jsx(
393
- BundleLine,
394
- {
395
- lineDirection,
396
- linesByLevel,
397
- paddingByLevel,
398
- nodeLocations: readonlyNodeLocations,
399
- outputsByNode,
400
- inputsByNode,
401
- bundle,
402
- maxArcRadius,
403
- lineWidth,
404
- linePaddingX,
405
- linePaddingY,
406
- highlightedPath,
407
- colorTheme
408
- },
409
- bundle.id
410
- );
411
- });
412
- return [_timestamps, _bundleElements, _nodes];
413
- }, [
414
- bundles,
415
- combinedOptions,
416
- (_c = graph.metadata.display) == null ? void 0 : _c.styles,
417
- flatNodes,
418
- highlightedNodes,
419
- highlightedPath,
420
- isDark,
421
- labelKeys,
422
- layoutData,
423
- linePaddingX,
424
- linePaddingY,
425
- nodeOpacities,
426
- onNodeClicked,
427
- onNodeHoveredChanged,
428
- portBounds,
429
- runComparator,
430
- runComparators,
431
- showCards,
432
- theme.palette,
433
- theme.transitions,
434
- xSpacing
435
- ]);
436
- const cards = useMemo(() => {
437
- const { nodeRadius, lineWidth } = combinedOptions;
438
- const { nodeLocations } = layoutData;
439
- return flatNodes.filter((node) => showCards || hoveredNode === node.id).map((node) => {
440
- const [x, y] = nodeLocations[node.id];
441
- return /* @__PURE__ */ jsx(
442
- Box,
443
- {
444
- onMouseOver: () => onNodeHoveredChanged(node.id, true),
445
- onMouseLeave: () => setTimeout(() => onNodeHoveredChanged(node.id, false), 100),
446
- sx: {
447
- position: "absolute",
448
- left: zoom.k * x + zoom.x,
449
- top: zoom.k * y + zoom.y,
450
- transform: `translateX(-${nodeRadius * 2}px) translateY(${lineWidth}px)`,
451
- backgroundColor: theme.palette.background.paper,
452
- maxWidth: "450px",
453
- maxHeight: "500px",
454
- overflow: "auto"
455
- },
456
- children: /* @__PURE__ */ jsx(NodeCard, { node })
457
- },
458
- node.id
459
- );
460
- });
461
- }, [
462
- combinedOptions,
463
- flatNodes,
464
- hoveredNode,
465
- layoutData,
466
- onNodeHoveredChanged,
467
- showCards,
468
- theme.palette.background.paper,
469
- zoom.k,
470
- zoom.x,
471
- zoom.y
472
- ]);
473
- return /* @__PURE__ */ jsxs(Fragment, { children: [
474
- /* @__PURE__ */ jsx("svg", { id: "viz", ref: svgRef, children: /* @__PURE__ */ jsxs("g", { id: "view", children: [
475
- timestamps,
476
- bundleElements,
477
- nodes
478
- ] }) }),
479
- cards
480
- ] });
481
- };
482
- const Tree$1 = memo(Tree);
483
- export {
484
- Tree$1 as default
485
- };
@@ -1,11 +0,0 @@
1
- import { RawEntry } from "../../../../../types/graph";
2
-
3
- export interface Node extends RawEntry {
4
- level: number;
5
- parents: string[];
6
- }
7
- export interface Bundle {
8
- id: string;
9
- sources: Node[];
10
- destinations: Node[];
11
- }