@pipelex/mthds-ui 0.34.1 → 0.35.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.
- package/README.md +20 -4
- package/dist/chunk-F63A55IE.js +54 -0
- package/dist/chunk-F63A55IE.js.map +1 -0
- package/dist/chunk-JJG2TO7P.js +473 -0
- package/dist/chunk-JJG2TO7P.js.map +1 -0
- package/dist/form/react/index.d.ts +1 -1
- package/dist/graph/index.d.ts +2 -2
- package/dist/graph/react/index.d.ts +2 -2
- package/dist/graph/react/index.js +115 -157
- package/dist/graph/react/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/progressSnapshot-VZ4PLul9.d.ts +191 -0
- package/dist/static-graph/index.d.ts +1 -1
- package/dist/timeline/index.d.ts +339 -0
- package/dist/timeline/index.js +70 -0
- package/dist/timeline/index.js.map +1 -0
- package/dist/timeline/react/RunTimeline.css +503 -0
- package/dist/timeline/react/index.d.ts +68 -0
- package/dist/timeline/react/index.js +402 -0
- package/dist/timeline/react/index.js.map +1 -0
- package/dist/{types-MvxsDLCo.d.ts → types-CTrrBpQf.d.ts} +1 -1
- package/package.json +10 -1
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import {
|
|
3
|
+
detectSystemTheme,
|
|
4
|
+
useSystemTheme
|
|
5
|
+
} from "../../chunk-F63A55IE.js";
|
|
2
6
|
import {
|
|
3
7
|
GRAPH_STYLES,
|
|
4
8
|
GRAPH_STYLE_PIPELINES,
|
|
@@ -37,7 +41,6 @@ import {
|
|
|
37
41
|
GRAPH_DIRECTION,
|
|
38
42
|
GRAPH_SPEC_MODE,
|
|
39
43
|
GRAPH_STYLE,
|
|
40
|
-
GRAPH_THEME,
|
|
41
44
|
GRAPH_THEME_MODE,
|
|
42
45
|
NODE_TYPE_SIMPLE_DECISION,
|
|
43
46
|
NODE_TYPE_SIMPLE_FRAME,
|
|
@@ -68,7 +71,7 @@ import "./viewer/GraphToolbar.css";
|
|
|
68
71
|
import "./styles/simple/SimpleStyle.css";
|
|
69
72
|
|
|
70
73
|
// src/graph/react/viewer/GraphViewer.tsx
|
|
71
|
-
import
|
|
74
|
+
import React12 from "react";
|
|
72
75
|
import {
|
|
73
76
|
ReactFlow,
|
|
74
77
|
useNodesState,
|
|
@@ -77,53 +80,8 @@ import {
|
|
|
77
80
|
BackgroundVariant
|
|
78
81
|
} from "@xyflow/react";
|
|
79
82
|
|
|
80
|
-
// src/graph/react/viewer/useSystemTheme.ts
|
|
81
|
-
import React from "react";
|
|
82
|
-
var PREFERS_DARK_QUERY = "(prefers-color-scheme: dark)";
|
|
83
|
-
function prefersDarkToTheme(prefersDark) {
|
|
84
|
-
return prefersDark ? GRAPH_THEME.DARK : GRAPH_THEME.LIGHT;
|
|
85
|
-
}
|
|
86
|
-
function detectSystemTheme() {
|
|
87
|
-
if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
88
|
-
return GRAPH_THEME.DARK;
|
|
89
|
-
}
|
|
90
|
-
return prefersDarkToTheme(window.matchMedia(PREFERS_DARK_QUERY).matches);
|
|
91
|
-
}
|
|
92
|
-
function subscribeToSystemTheme(onChange) {
|
|
93
|
-
if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
94
|
-
return () => {
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
const mql = window.matchMedia(PREFERS_DARK_QUERY);
|
|
98
|
-
if (typeof mql.addEventListener === "function") {
|
|
99
|
-
mql.addEventListener("change", onChange);
|
|
100
|
-
return () => mql.removeEventListener("change", onChange);
|
|
101
|
-
}
|
|
102
|
-
mql.addListener(onChange);
|
|
103
|
-
return () => mql.removeListener(onChange);
|
|
104
|
-
}
|
|
105
|
-
function systemThemeStore(injected) {
|
|
106
|
-
if (injected !== void 0) {
|
|
107
|
-
return {
|
|
108
|
-
subscribe: () => () => {
|
|
109
|
-
},
|
|
110
|
-
getSnapshot: () => injected,
|
|
111
|
-
getServerSnapshot: () => injected
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
return {
|
|
115
|
-
subscribe: subscribeToSystemTheme,
|
|
116
|
-
getSnapshot: detectSystemTheme,
|
|
117
|
-
getServerSnapshot: () => GRAPH_THEME.DARK
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
function useSystemTheme(injected) {
|
|
121
|
-
const store = React.useMemo(() => systemThemeStore(injected), [injected]);
|
|
122
|
-
return React.useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
83
|
// src/graph/react/detail/StuffResultPanel.tsx
|
|
126
|
-
import * as
|
|
84
|
+
import * as React from "react";
|
|
127
85
|
import {
|
|
128
86
|
buildResultField,
|
|
129
87
|
getPipeInputForm,
|
|
@@ -149,7 +107,7 @@ function StuffResultPanel({
|
|
|
149
107
|
saveFiles,
|
|
150
108
|
downloads
|
|
151
109
|
}) {
|
|
152
|
-
const field =
|
|
110
|
+
const field = React.useMemo(
|
|
153
111
|
() => {
|
|
154
112
|
var _a;
|
|
155
113
|
return (_a = fromProducer(pipeIoContracts, outputForm, producerPipeRef)) != null ? _a : fromConsumer(pipeIoContracts, inputForm, consumer);
|
|
@@ -223,7 +181,7 @@ function resultDescriptors(graph) {
|
|
|
223
181
|
}
|
|
224
182
|
|
|
225
183
|
// src/graph/react/detail/DetailPanel.tsx
|
|
226
|
-
import
|
|
184
|
+
import React2 from "react";
|
|
227
185
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
228
186
|
function DetailPanel({
|
|
229
187
|
isOpen,
|
|
@@ -234,7 +192,7 @@ function DetailPanel({
|
|
|
234
192
|
onResizeHandleMouseDown,
|
|
235
193
|
closeOnEscape = true
|
|
236
194
|
}) {
|
|
237
|
-
|
|
195
|
+
React2.useEffect(() => {
|
|
238
196
|
if (!isOpen || !closeOnEscape) return;
|
|
239
197
|
const onKeyDown = (e) => {
|
|
240
198
|
if (e.key === "Escape") onClose();
|
|
@@ -266,7 +224,7 @@ function DetailPanel({
|
|
|
266
224
|
}
|
|
267
225
|
|
|
268
226
|
// src/graph/react/detail/useResizable.ts
|
|
269
|
-
import
|
|
227
|
+
import React3 from "react";
|
|
270
228
|
var MAX_WIDTH_RATIO = 0.6;
|
|
271
229
|
function useResizable({
|
|
272
230
|
defaultWidth,
|
|
@@ -274,11 +232,11 @@ function useResizable({
|
|
|
274
232
|
maxWidth,
|
|
275
233
|
containerRef
|
|
276
234
|
}) {
|
|
277
|
-
const [width, setWidth] =
|
|
278
|
-
const [isDragging, setIsDragging] =
|
|
279
|
-
const dragRef =
|
|
280
|
-
const rafRef =
|
|
281
|
-
const handleMouseDown =
|
|
235
|
+
const [width, setWidth] = React3.useState(defaultWidth);
|
|
236
|
+
const [isDragging, setIsDragging] = React3.useState(false);
|
|
237
|
+
const dragRef = React3.useRef({ startX: 0, startWidth: 0, maxAllowed: maxWidth });
|
|
238
|
+
const rafRef = React3.useRef(null);
|
|
239
|
+
const handleMouseDown = React3.useCallback(
|
|
282
240
|
(e) => {
|
|
283
241
|
var _a;
|
|
284
242
|
e.preventDefault();
|
|
@@ -292,7 +250,7 @@ function useResizable({
|
|
|
292
250
|
},
|
|
293
251
|
[width, maxWidth, containerRef]
|
|
294
252
|
);
|
|
295
|
-
|
|
253
|
+
React3.useEffect(() => {
|
|
296
254
|
if (!isDragging) return;
|
|
297
255
|
const onMouseMove = (e) => {
|
|
298
256
|
if (rafRef.current !== null) cancelAnimationFrame(rafRef.current);
|
|
@@ -330,7 +288,7 @@ function useResizable({
|
|
|
330
288
|
}
|
|
331
289
|
|
|
332
290
|
// src/graph/react/detail/PipeDetailPanel.tsx
|
|
333
|
-
import
|
|
291
|
+
import React5 from "react";
|
|
334
292
|
|
|
335
293
|
// src/graph/react/detail/sections/shared.tsx
|
|
336
294
|
import { useState } from "react";
|
|
@@ -1244,8 +1202,8 @@ function PipeDetailPanel({ node, spec, onConceptClick }) {
|
|
|
1244
1202
|
const badge = PIPE_TYPE_BADGES[pipeType];
|
|
1245
1203
|
const status = node.status;
|
|
1246
1204
|
const statusColor = (_a = STATUS_COLORS[status]) != null ? _a : "#6272a4";
|
|
1247
|
-
const blueprint =
|
|
1248
|
-
const [usageExpanded, setUsageExpanded] =
|
|
1205
|
+
const blueprint = React5.useMemo(() => resolveNodeBlueprint(spec, node), [spec, node]);
|
|
1206
|
+
const [usageExpanded, setUsageExpanded] = React5.useState(false);
|
|
1249
1207
|
const inputs = (_c = (_b = node.io) == null ? void 0 : _b.inputs) != null ? _c : [];
|
|
1250
1208
|
const outputs = (_e = (_d = node.io) == null ? void 0 : _d.outputs) != null ? _e : [];
|
|
1251
1209
|
const description = (_f = blueprint == null ? void 0 : blueprint.description) != null ? _f : node.description;
|
|
@@ -1470,7 +1428,7 @@ function GenericExecutionData({ entries }) {
|
|
|
1470
1428
|
}
|
|
1471
1429
|
|
|
1472
1430
|
// src/graph/react/detail/ConceptDetailPanel.tsx
|
|
1473
|
-
import
|
|
1431
|
+
import React6 from "react";
|
|
1474
1432
|
import { Fragment as Fragment12, jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1475
1433
|
function ConceptDetailPanel({
|
|
1476
1434
|
concept,
|
|
@@ -1507,8 +1465,8 @@ function ConceptDetailPanel({
|
|
|
1507
1465
|
function ConceptBody({ concept, ioData, isDryRun, renderData }) {
|
|
1508
1466
|
const dataView = ioData && !isDryRun ? renderData == null ? void 0 : renderData() : void 0;
|
|
1509
1467
|
const hasData = Boolean(dataView);
|
|
1510
|
-
const [activeTab, setActiveTab] =
|
|
1511
|
-
const baseId =
|
|
1468
|
+
const [activeTab, setActiveTab] = React6.useState(hasData ? "data" : "structure");
|
|
1469
|
+
const baseId = React6.useId();
|
|
1512
1470
|
const tabId = (tab) => `${baseId}-tab-${tab}`;
|
|
1513
1471
|
const panelId = (tab) => `${baseId}-tabpanel-${tab}`;
|
|
1514
1472
|
const structure = concept.json_schema ? /* @__PURE__ */ jsxs18("div", { children: [
|
|
@@ -1730,7 +1688,7 @@ function hydrateLabels(nodes) {
|
|
|
1730
1688
|
}
|
|
1731
1689
|
|
|
1732
1690
|
// src/graph/react/viewer/GraphToolbar.tsx
|
|
1733
|
-
import
|
|
1691
|
+
import React9 from "react";
|
|
1734
1692
|
import { Panel } from "@xyflow/react";
|
|
1735
1693
|
|
|
1736
1694
|
// src/graph/react/viewer/ValidationPanel.tsx
|
|
@@ -1850,14 +1808,14 @@ function ValidationPanel({
|
|
|
1850
1808
|
}
|
|
1851
1809
|
|
|
1852
1810
|
// src/graph/react/viewer/StyleMenu.tsx
|
|
1853
|
-
import
|
|
1811
|
+
import React8 from "react";
|
|
1854
1812
|
|
|
1855
1813
|
// src/graph/react/viewer/usePopoverDismiss.ts
|
|
1856
|
-
import
|
|
1814
|
+
import React7 from "react";
|
|
1857
1815
|
function usePopoverDismiss(open, wrapperRef, onDismiss) {
|
|
1858
|
-
const onDismissRef =
|
|
1816
|
+
const onDismissRef = React7.useRef(onDismiss);
|
|
1859
1817
|
onDismissRef.current = onDismiss;
|
|
1860
|
-
|
|
1818
|
+
React7.useEffect(() => {
|
|
1861
1819
|
if (!open) return;
|
|
1862
1820
|
const onPointerDown = (event) => {
|
|
1863
1821
|
const wrapper = wrapperRef.current;
|
|
@@ -1914,18 +1872,18 @@ function styleMenuLabel(style) {
|
|
|
1914
1872
|
return `Graph style: ${GRAPH_STYLES[style].name} \u2014 choose how the graph is drawn`;
|
|
1915
1873
|
}
|
|
1916
1874
|
function StyleMenu({ value, options, onChange, placement }) {
|
|
1917
|
-
const [open, setOpen] =
|
|
1918
|
-
const [activeIndex, setActiveIndex] =
|
|
1919
|
-
const wrapperRef =
|
|
1920
|
-
const buttonRef =
|
|
1921
|
-
const itemRefs =
|
|
1922
|
-
const menuId =
|
|
1875
|
+
const [open, setOpen] = React8.useState(false);
|
|
1876
|
+
const [activeIndex, setActiveIndex] = React8.useState(0);
|
|
1877
|
+
const wrapperRef = React8.useRef(null);
|
|
1878
|
+
const buttonRef = React8.useRef(null);
|
|
1879
|
+
const itemRefs = React8.useRef([]);
|
|
1880
|
+
const menuId = React8.useId();
|
|
1923
1881
|
usePopoverDismiss(open, wrapperRef, (reason) => {
|
|
1924
1882
|
var _a;
|
|
1925
1883
|
setOpen(false);
|
|
1926
1884
|
if (reason === "escape") (_a = buttonRef.current) == null ? void 0 : _a.focus();
|
|
1927
1885
|
});
|
|
1928
|
-
|
|
1886
|
+
React8.useEffect(() => {
|
|
1929
1887
|
var _a;
|
|
1930
1888
|
if (!open) return;
|
|
1931
1889
|
const index = Math.max(0, options.indexOf(value));
|
|
@@ -2396,11 +2354,11 @@ function GraphToolbar({
|
|
|
2396
2354
|
const orientation = toolbarOrientation(position);
|
|
2397
2355
|
const setValidationOpen = onValidationOpenChange != null ? onValidationOpenChange : (() => {
|
|
2398
2356
|
});
|
|
2399
|
-
const setValidationOpenRef =
|
|
2357
|
+
const setValidationOpenRef = React9.useRef(setValidationOpen);
|
|
2400
2358
|
setValidationOpenRef.current = setValidationOpen;
|
|
2401
|
-
const validationRef =
|
|
2402
|
-
const validationPanelId =
|
|
2403
|
-
|
|
2359
|
+
const validationRef = React9.useRef(null);
|
|
2360
|
+
const validationPanelId = React9.useId();
|
|
2361
|
+
React9.useEffect(() => {
|
|
2404
2362
|
if (validationState === void 0) setValidationOpenRef.current(false);
|
|
2405
2363
|
}, [validationState]);
|
|
2406
2364
|
usePopoverDismiss(validationOpen, validationRef, () => setValidationOpenRef.current(false));
|
|
@@ -2565,7 +2523,7 @@ function GraphToolbar({
|
|
|
2565
2523
|
}
|
|
2566
2524
|
|
|
2567
2525
|
// src/graph/react/viewer/StillFit.tsx
|
|
2568
|
-
import
|
|
2526
|
+
import React10 from "react";
|
|
2569
2527
|
import { useEdges, useNodes, useNodesInitialized, useReactFlow, useStore } from "@xyflow/react";
|
|
2570
2528
|
|
|
2571
2529
|
// src/graph/react/viewer/stillViewport.ts
|
|
@@ -2612,7 +2570,7 @@ function StillFit({ onHeight }) {
|
|
|
2612
2570
|
const nodes = useNodes();
|
|
2613
2571
|
const edges = useEdges();
|
|
2614
2572
|
const { getNodesBounds, setViewport } = useReactFlow();
|
|
2615
|
-
|
|
2573
|
+
React10.useLayoutEffect(() => {
|
|
2616
2574
|
if (!nodesInitialized || nodes.length === 0) return;
|
|
2617
2575
|
const bounds = stillContentBounds(
|
|
2618
2576
|
getNodesBounds(nodes),
|
|
@@ -3427,20 +3385,20 @@ function GraphViewer(props) {
|
|
|
3427
3385
|
onValidationIssueClick
|
|
3428
3386
|
} = props;
|
|
3429
3387
|
const graphspecProp = (_a = graph == null ? void 0 : graph.graphSpec) != null ? _a : null;
|
|
3430
|
-
const graphspec =
|
|
3388
|
+
const graphspec = React12.useMemo(
|
|
3431
3389
|
() => graphspecProp === null ? null : validateGraphSpec(graphspecProp),
|
|
3432
3390
|
[graphspecProp]
|
|
3433
3391
|
);
|
|
3434
|
-
const [direction, setDirection] =
|
|
3392
|
+
const [direction, setDirection] = React12.useState(
|
|
3435
3393
|
() => {
|
|
3436
3394
|
var _a2, _b2;
|
|
3437
3395
|
return (_b2 = (_a2 = initialDirection != null ? initialDirection : config.direction) != null ? _a2 : DEFAULT_GRAPH_CONFIG.direction) != null ? _b2 : GRAPH_DIRECTION.TB;
|
|
3438
3396
|
}
|
|
3439
3397
|
);
|
|
3440
3398
|
const externalMode = resolveExternalThemeMode(themeProp, config.theme);
|
|
3441
|
-
const [mode, setMode] =
|
|
3442
|
-
const prevExternalModeRef =
|
|
3443
|
-
|
|
3399
|
+
const [mode, setMode] = React12.useState(externalMode);
|
|
3400
|
+
const prevExternalModeRef = React12.useRef(externalMode);
|
|
3401
|
+
React12.useEffect(() => {
|
|
3444
3402
|
if (externalMode !== prevExternalModeRef.current) {
|
|
3445
3403
|
prevExternalModeRef.current = externalMode;
|
|
3446
3404
|
setMode(externalMode);
|
|
@@ -3448,13 +3406,13 @@ function GraphViewer(props) {
|
|
|
3448
3406
|
}, [externalMode]);
|
|
3449
3407
|
const systemTheme = useSystemTheme(systemThemeProp);
|
|
3450
3408
|
const resolvedTheme = resolveActiveTheme(mode, systemTheme);
|
|
3451
|
-
const onThemeChangeRef =
|
|
3409
|
+
const onThemeChangeRef = React12.useRef(onThemeChange);
|
|
3452
3410
|
onThemeChangeRef.current = onThemeChange;
|
|
3453
|
-
const prevReportedRef =
|
|
3411
|
+
const prevReportedRef = React12.useRef({
|
|
3454
3412
|
mode,
|
|
3455
3413
|
resolvedTheme
|
|
3456
3414
|
});
|
|
3457
|
-
|
|
3415
|
+
React12.useEffect(() => {
|
|
3458
3416
|
var _a2;
|
|
3459
3417
|
const prev = prevReportedRef.current;
|
|
3460
3418
|
if (prev.mode !== mode || prev.resolvedTheme !== resolvedTheme) {
|
|
@@ -3463,48 +3421,48 @@ function GraphViewer(props) {
|
|
|
3463
3421
|
}
|
|
3464
3422
|
}, [mode, resolvedTheme]);
|
|
3465
3423
|
const externalStyle = resolveGraphStyle(graphStyleProp, config.graphStyle);
|
|
3466
|
-
const [graphStyle, setGraphStyle] =
|
|
3467
|
-
const prevExternalStyleRef =
|
|
3468
|
-
|
|
3424
|
+
const [graphStyle, setGraphStyle] = React12.useState(externalStyle);
|
|
3425
|
+
const prevExternalStyleRef = React12.useRef(externalStyle);
|
|
3426
|
+
React12.useEffect(() => {
|
|
3469
3427
|
if (externalStyle !== prevExternalStyleRef.current) {
|
|
3470
3428
|
prevExternalStyleRef.current = externalStyle;
|
|
3471
3429
|
setGraphStyle(externalStyle);
|
|
3472
3430
|
}
|
|
3473
3431
|
}, [externalStyle]);
|
|
3474
|
-
const onGraphStyleChangeRef =
|
|
3432
|
+
const onGraphStyleChangeRef = React12.useRef(onGraphStyleChange);
|
|
3475
3433
|
onGraphStyleChangeRef.current = onGraphStyleChange;
|
|
3476
|
-
const prevReportedStyleRef =
|
|
3477
|
-
|
|
3434
|
+
const prevReportedStyleRef = React12.useRef(graphStyle);
|
|
3435
|
+
React12.useEffect(() => {
|
|
3478
3436
|
var _a2;
|
|
3479
3437
|
if (prevReportedStyleRef.current !== graphStyle) {
|
|
3480
3438
|
prevReportedStyleRef.current = graphStyle;
|
|
3481
3439
|
(_a2 = onGraphStyleChangeRef.current) == null ? void 0 : _a2.call(onGraphStyleChangeRef, graphStyle);
|
|
3482
3440
|
}
|
|
3483
3441
|
}, [graphStyle]);
|
|
3484
|
-
const graphStyleRef =
|
|
3442
|
+
const graphStyleRef = React12.useRef(graphStyle);
|
|
3485
3443
|
graphStyleRef.current = graphStyle;
|
|
3486
3444
|
const styleCapabilities = GRAPH_STYLES[graphStyle].capabilities;
|
|
3487
3445
|
const effectiveFoldMode = (_c = (_b = initialFoldMode != null ? initialFoldMode : config.foldMode) != null ? _b : DEFAULT_GRAPH_CONFIG.foldMode) != null ? _c : FOLD_MODE.EXPANDED;
|
|
3488
|
-
const [showControllers, setShowControllers] =
|
|
3446
|
+
const [showControllers, setShowControllers] = React12.useState(() => {
|
|
3489
3447
|
var _a2, _b2;
|
|
3490
3448
|
if (effectiveFoldMode === FOLD_MODE.FOLDED) return true;
|
|
3491
3449
|
return (_b2 = (_a2 = initialShowControllers != null ? initialShowControllers : config.showControllers) != null ? _a2 : DEFAULT_GRAPH_CONFIG.showControllers) != null ? _b2 : false;
|
|
3492
3450
|
});
|
|
3493
|
-
const foldModeRef =
|
|
3451
|
+
const foldModeRef = React12.useRef(effectiveFoldMode);
|
|
3494
3452
|
foldModeRef.current = effectiveFoldMode;
|
|
3495
|
-
const containerRef =
|
|
3496
|
-
const [detailSelection, setDetailSelection] =
|
|
3497
|
-
const [conceptOverride, setConceptOverride] =
|
|
3453
|
+
const containerRef = React12.useRef(null);
|
|
3454
|
+
const [detailSelection, setDetailSelection] = React12.useState(null);
|
|
3455
|
+
const [conceptOverride, setConceptOverride] = React12.useState(null);
|
|
3498
3456
|
const {
|
|
3499
3457
|
width: panelWidth,
|
|
3500
3458
|
isDragging: isPanelDragging,
|
|
3501
3459
|
handleMouseDown: onResizeMouseDown
|
|
3502
3460
|
} = useResizable({ defaultWidth: 380, minWidth: 280, maxWidth: 800, containerRef });
|
|
3503
|
-
|
|
3461
|
+
React12.useEffect(() => {
|
|
3504
3462
|
setDetailSelection(null);
|
|
3505
3463
|
setConceptOverride(null);
|
|
3506
3464
|
}, [graphspec]);
|
|
3507
|
-
|
|
3465
|
+
React12.useEffect(() => {
|
|
3508
3466
|
const el = containerRef.current;
|
|
3509
3467
|
if (!el) return;
|
|
3510
3468
|
const themePalette = getPaletteForTheme(resolvedTheme);
|
|
@@ -3519,15 +3477,15 @@ function GraphViewer(props) {
|
|
|
3519
3477
|
}
|
|
3520
3478
|
};
|
|
3521
3479
|
}, [config.paletteColors, resolvedTheme]);
|
|
3522
|
-
const [stillHeight, setStillHeight] =
|
|
3480
|
+
const [stillHeight, setStillHeight] = React12.useState(STILL_PLACEHOLDER_HEIGHT_PX);
|
|
3523
3481
|
const [nodes, setNodes, onNodesChange] = useNodesState([]);
|
|
3524
3482
|
const [edges, setEdges, onEdgesChange] = useEdgesState([]);
|
|
3525
|
-
const reactFlowRef =
|
|
3526
|
-
const initialDataRef =
|
|
3527
|
-
const rawGraphDataRef =
|
|
3528
|
-
const layoutCacheRef =
|
|
3529
|
-
const [expandedControllers, setExpandedControllers] =
|
|
3530
|
-
const toggleCollapse =
|
|
3483
|
+
const reactFlowRef = React12.useRef(null);
|
|
3484
|
+
const initialDataRef = React12.useRef(null);
|
|
3485
|
+
const rawGraphDataRef = React12.useRef(null);
|
|
3486
|
+
const layoutCacheRef = React12.useRef(null);
|
|
3487
|
+
const [expandedControllers, setExpandedControllers] = React12.useState(/* @__PURE__ */ new Set());
|
|
3488
|
+
const toggleCollapse = React12.useCallback((controllerId) => {
|
|
3531
3489
|
setExpandedControllers((prev) => {
|
|
3532
3490
|
const next = new Set(prev);
|
|
3533
3491
|
if (next.has(controllerId)) next.delete(controllerId);
|
|
@@ -3535,17 +3493,17 @@ function GraphViewer(props) {
|
|
|
3535
3493
|
return next;
|
|
3536
3494
|
});
|
|
3537
3495
|
}, []);
|
|
3538
|
-
const [foldedControllers, setFoldedControllers] =
|
|
3539
|
-
const styleDefaultFoldsRef =
|
|
3540
|
-
const readerOpenedRef =
|
|
3541
|
-
const markReaderFolds =
|
|
3496
|
+
const [foldedControllers, setFoldedControllers] = React12.useState(/* @__PURE__ */ new Set());
|
|
3497
|
+
const styleDefaultFoldsRef = React12.useRef(/* @__PURE__ */ new Set());
|
|
3498
|
+
const readerOpenedRef = React12.useRef(/* @__PURE__ */ new Set());
|
|
3499
|
+
const markReaderFolds = React12.useCallback((ids, folded) => {
|
|
3542
3500
|
for (const id of ids) {
|
|
3543
3501
|
styleDefaultFoldsRef.current.delete(id);
|
|
3544
3502
|
if (folded) readerOpenedRef.current.delete(id);
|
|
3545
3503
|
else readerOpenedRef.current.add(id);
|
|
3546
3504
|
}
|
|
3547
3505
|
}, []);
|
|
3548
|
-
const toggleFold =
|
|
3506
|
+
const toggleFold = React12.useCallback(
|
|
3549
3507
|
(controllerId, options) => {
|
|
3550
3508
|
setFoldedControllers((prev) => {
|
|
3551
3509
|
const next = new Set(prev);
|
|
@@ -3563,45 +3521,45 @@ function GraphViewer(props) {
|
|
|
3563
3521
|
[markReaderFolds]
|
|
3564
3522
|
);
|
|
3565
3523
|
const edgeType = config.edgeType || EDGE_TYPE.DEFAULT;
|
|
3566
|
-
const layoutConfig =
|
|
3524
|
+
const layoutConfig = React12.useMemo(
|
|
3567
3525
|
() => ({ nodesep: config.nodesep, ranksep: config.ranksep }),
|
|
3568
3526
|
[config.nodesep, config.ranksep]
|
|
3569
3527
|
);
|
|
3570
|
-
const showControllersRef =
|
|
3528
|
+
const showControllersRef = React12.useRef(showControllers);
|
|
3571
3529
|
showControllersRef.current = showControllers;
|
|
3572
|
-
const directionRef =
|
|
3530
|
+
const directionRef = React12.useRef(direction);
|
|
3573
3531
|
directionRef.current = direction;
|
|
3574
|
-
const layoutConfigRef =
|
|
3532
|
+
const layoutConfigRef = React12.useRef(layoutConfig);
|
|
3575
3533
|
layoutConfigRef.current = layoutConfig;
|
|
3576
|
-
const initialZoomRef =
|
|
3534
|
+
const initialZoomRef = React12.useRef(config.initialZoom);
|
|
3577
3535
|
initialZoomRef.current = config.initialZoom;
|
|
3578
|
-
const panToTopRef =
|
|
3536
|
+
const panToTopRef = React12.useRef(config.panToTop);
|
|
3579
3537
|
panToTopRef.current = config.panToTop;
|
|
3580
|
-
const interactiveRef =
|
|
3538
|
+
const interactiveRef = React12.useRef(interactive);
|
|
3581
3539
|
interactiveRef.current = interactive;
|
|
3582
|
-
const expandedRef =
|
|
3540
|
+
const expandedRef = React12.useRef(expandedControllers);
|
|
3583
3541
|
expandedRef.current = expandedControllers;
|
|
3584
|
-
const toggleCollapseRef =
|
|
3542
|
+
const toggleCollapseRef = React12.useRef(toggleCollapse);
|
|
3585
3543
|
toggleCollapseRef.current = toggleCollapse;
|
|
3586
|
-
const foldedRef =
|
|
3544
|
+
const foldedRef = React12.useRef(foldedControllers);
|
|
3587
3545
|
foldedRef.current = foldedControllers;
|
|
3588
|
-
const toggleFoldRef =
|
|
3546
|
+
const toggleFoldRef = React12.useRef(toggleFold);
|
|
3589
3547
|
toggleFoldRef.current = toggleFold;
|
|
3590
|
-
const isFirstFoldEffect =
|
|
3591
|
-
const prevFoldSizeRef =
|
|
3592
|
-
const skipNextFoldEffectRef =
|
|
3593
|
-
const statusMapRef =
|
|
3548
|
+
const isFirstFoldEffect = React12.useRef(true);
|
|
3549
|
+
const prevFoldSizeRef = React12.useRef(0);
|
|
3550
|
+
const skipNextFoldEffectRef = React12.useRef(false);
|
|
3551
|
+
const statusMapRef = React12.useRef(statusMap);
|
|
3594
3552
|
statusMapRef.current = statusMap;
|
|
3595
|
-
const validationIssuesRef =
|
|
3553
|
+
const validationIssuesRef = React12.useRef(validationIssues);
|
|
3596
3554
|
validationIssuesRef.current = validationIssues;
|
|
3597
|
-
const selectedNodeIdRef =
|
|
3555
|
+
const selectedNodeIdRef = React12.useRef(null);
|
|
3598
3556
|
selectedNodeIdRef.current = (_d = detailSelection == null ? void 0 : detailSelection.nodeId) != null ? _d : null;
|
|
3599
|
-
const [validationOpen, setValidationOpen] =
|
|
3600
|
-
const openValidationPanel =
|
|
3557
|
+
const [validationOpen, setValidationOpen] = React12.useState(false);
|
|
3558
|
+
const openValidationPanel = React12.useCallback(() => setValidationOpen(true), []);
|
|
3601
3559
|
const validationWidgetAvailable = validationState !== void 0 && !hideToolbar && interactive;
|
|
3602
|
-
const validationWidgetAvailableRef =
|
|
3560
|
+
const validationWidgetAvailableRef = React12.useRef(validationWidgetAvailable);
|
|
3603
3561
|
validationWidgetAvailableRef.current = validationWidgetAvailable;
|
|
3604
|
-
const decorateNodes =
|
|
3562
|
+
const decorateNodes = React12.useCallback(
|
|
3605
3563
|
(nodes2) => {
|
|
3606
3564
|
var _a2, _b2, _c2;
|
|
3607
3565
|
const raw = rawGraphDataRef.current;
|
|
@@ -3622,7 +3580,7 @@ function GraphViewer(props) {
|
|
|
3622
3580
|
},
|
|
3623
3581
|
[openValidationPanel]
|
|
3624
3582
|
);
|
|
3625
|
-
const frameLayout =
|
|
3583
|
+
const frameLayout = React12.useCallback(
|
|
3626
3584
|
(style, layout, graphspec2, analysis) => GRAPH_STYLE_PIPELINES[style].frame({
|
|
3627
3585
|
nodes: cloneCachedNodes(layout.nodes),
|
|
3628
3586
|
edges: layout.edges,
|
|
@@ -3641,18 +3599,18 @@ function GraphViewer(props) {
|
|
|
3641
3599
|
const data = initialDataRef.current;
|
|
3642
3600
|
return cache !== null && data !== null && cache.graphspec === data._graphspec && cache.graphStyle === data._graphStyle;
|
|
3643
3601
|
};
|
|
3644
|
-
const nodesRef =
|
|
3602
|
+
const nodesRef = React12.useRef([]);
|
|
3645
3603
|
nodesRef.current = nodes;
|
|
3646
|
-
const onValidationIssueClickRef =
|
|
3604
|
+
const onValidationIssueClickRef = React12.useRef(onValidationIssueClick);
|
|
3647
3605
|
onValidationIssueClickRef.current = onValidationIssueClick;
|
|
3648
|
-
const flashTimeoutRef =
|
|
3649
|
-
|
|
3606
|
+
const flashTimeoutRef = React12.useRef(null);
|
|
3607
|
+
React12.useEffect(
|
|
3650
3608
|
() => () => {
|
|
3651
3609
|
if (flashTimeoutRef.current) clearTimeout(flashTimeoutRef.current);
|
|
3652
3610
|
},
|
|
3653
3611
|
[]
|
|
3654
3612
|
);
|
|
3655
|
-
const handleValidationIssueClick =
|
|
3613
|
+
const handleValidationIssueClick = React12.useCallback(
|
|
3656
3614
|
(index, issue) => {
|
|
3657
3615
|
var _a2, _b2, _c2;
|
|
3658
3616
|
(_a2 = onValidationIssueClickRef.current) == null ? void 0 : _a2.call(onValidationIssueClickRef, index, issue);
|
|
@@ -3695,7 +3653,7 @@ function GraphViewer(props) {
|
|
|
3695
3653
|
},
|
|
3696
3654
|
[setNodes]
|
|
3697
3655
|
);
|
|
3698
|
-
|
|
3656
|
+
React12.useEffect(() => {
|
|
3699
3657
|
if (!initialDataRef.current) return;
|
|
3700
3658
|
let cancelled = false;
|
|
3701
3659
|
void (async () => {
|
|
@@ -3740,7 +3698,7 @@ function GraphViewer(props) {
|
|
|
3740
3698
|
cancelled = true;
|
|
3741
3699
|
};
|
|
3742
3700
|
}, [direction, layoutConfig]);
|
|
3743
|
-
|
|
3701
|
+
React12.useEffect(() => {
|
|
3744
3702
|
const cache = layoutCacheRef.current;
|
|
3745
3703
|
const data = initialDataRef.current;
|
|
3746
3704
|
if (!cache || !data || !cacheMatchesData()) return;
|
|
@@ -3748,7 +3706,7 @@ function GraphViewer(props) {
|
|
|
3748
3706
|
setNodes(decorateNodes(withControllers.nodes));
|
|
3749
3707
|
setEdges(toAppEdges(withControllers.edges));
|
|
3750
3708
|
}, [showControllers, expandedControllers, toggleCollapse, toggleFold, decorateNodes]);
|
|
3751
|
-
|
|
3709
|
+
React12.useEffect(() => {
|
|
3752
3710
|
var _a2;
|
|
3753
3711
|
if (!graphspec) {
|
|
3754
3712
|
initialDataRef.current = null;
|
|
@@ -3867,7 +3825,7 @@ function GraphViewer(props) {
|
|
|
3867
3825
|
cancelled = true;
|
|
3868
3826
|
};
|
|
3869
3827
|
}, [graphspec, edgeType, graphStyle]);
|
|
3870
|
-
|
|
3828
|
+
React12.useEffect(() => {
|
|
3871
3829
|
if (isFirstFoldEffect.current) {
|
|
3872
3830
|
isFirstFoldEffect.current = false;
|
|
3873
3831
|
prevFoldSizeRef.current = foldedControllers.size;
|
|
@@ -3944,7 +3902,7 @@ function GraphViewer(props) {
|
|
|
3944
3902
|
cancelled = true;
|
|
3945
3903
|
};
|
|
3946
3904
|
}, [foldedControllers, toggleFold]);
|
|
3947
|
-
|
|
3905
|
+
React12.useEffect(() => {
|
|
3948
3906
|
const cache = layoutCacheRef.current;
|
|
3949
3907
|
const data = initialDataRef.current;
|
|
3950
3908
|
if (!cache || !data || !cacheMatchesData()) return;
|
|
@@ -3952,14 +3910,14 @@ function GraphViewer(props) {
|
|
|
3952
3910
|
setNodes(decorateNodes(withControllers.nodes));
|
|
3953
3911
|
setEdges(toAppEdges(withControllers.edges));
|
|
3954
3912
|
}, [statusMap, decorateNodes]);
|
|
3955
|
-
|
|
3913
|
+
React12.useEffect(() => {
|
|
3956
3914
|
const cache = layoutCacheRef.current;
|
|
3957
3915
|
const data = initialDataRef.current;
|
|
3958
3916
|
if (!cache || !data || !cacheMatchesData()) return;
|
|
3959
3917
|
const withControllers = frameLayout(cache.graphStyle, cache, data._graphspec, data._analysis);
|
|
3960
3918
|
setNodes(decorateNodes(withControllers.nodes));
|
|
3961
3919
|
}, [validationIssues, validationWidgetAvailable, decorateNodes]);
|
|
3962
|
-
const onNodeClick =
|
|
3920
|
+
const onNodeClick = React12.useCallback(
|
|
3963
3921
|
(event, node) => {
|
|
3964
3922
|
const nodeData = node.data;
|
|
3965
3923
|
onNodeSelect == null ? void 0 : onNodeSelect(node.id, nodeData, event);
|
|
@@ -4000,7 +3958,7 @@ function GraphViewer(props) {
|
|
|
4000
3958
|
conceptOverride
|
|
4001
3959
|
]
|
|
4002
3960
|
);
|
|
4003
|
-
const onInit =
|
|
3961
|
+
const onInit = React12.useCallback(
|
|
4004
3962
|
(reactFlowInstance) => {
|
|
4005
3963
|
reactFlowRef.current = reactFlowInstance;
|
|
4006
3964
|
if (onReactFlowInit) {
|
|
@@ -4009,8 +3967,8 @@ function GraphViewer(props) {
|
|
|
4009
3967
|
},
|
|
4010
3968
|
[onReactFlowInit]
|
|
4011
3969
|
);
|
|
4012
|
-
const prevInteractiveRef =
|
|
4013
|
-
|
|
3970
|
+
const prevInteractiveRef = React12.useRef(interactive);
|
|
3971
|
+
React12.useEffect(() => {
|
|
4014
3972
|
if (prevInteractiveRef.current === interactive) return;
|
|
4015
3973
|
prevInteractiveRef.current = interactive;
|
|
4016
3974
|
if (!interactive) {
|
|
@@ -4025,12 +3983,12 @@ function GraphViewer(props) {
|
|
|
4025
3983
|
}, 50);
|
|
4026
3984
|
return () => clearTimeout(timer);
|
|
4027
3985
|
}, [interactive]);
|
|
4028
|
-
const handlePaneClick =
|
|
3986
|
+
const handlePaneClick = React12.useCallback(() => {
|
|
4029
3987
|
setDetailSelection(null);
|
|
4030
3988
|
setConceptOverride(null);
|
|
4031
3989
|
onPaneClick == null ? void 0 : onPaneClick();
|
|
4032
3990
|
}, [onPaneClick]);
|
|
4033
|
-
const handleConceptClick =
|
|
3991
|
+
const handleConceptClick = React12.useCallback(
|
|
4034
3992
|
(conceptCode) => {
|
|
4035
3993
|
if (!graphspec) return;
|
|
4036
3994
|
const info = resolveConceptRef(graphspec, conceptCode);
|
|
@@ -4047,7 +4005,7 @@ function GraphViewer(props) {
|
|
|
4047
4005
|
const rawAnalysis = (_e = rawGraphDataRef.current) == null ? void 0 : _e.analysis;
|
|
4048
4006
|
const allControllerIds = rawAnalysis == null ? void 0 : rawAnalysis.controllerNodeIds;
|
|
4049
4007
|
const foldControlsAvailable = styleCapabilities.foldAll && (!styleCapabilities.controllerFrameToggle || showControllers);
|
|
4050
|
-
const foldAllProps =
|
|
4008
|
+
const foldAllProps = React12.useMemo(() => {
|
|
4051
4009
|
if (!foldControlsAvailable || !allControllerIds || allControllerIds.size === 0) {
|
|
4052
4010
|
return {
|
|
4053
4011
|
onFoldAll: void 0,
|
|
@@ -4069,7 +4027,7 @@ function GraphViewer(props) {
|
|
|
4069
4027
|
expandAllDisabled: foldedControllers.size === 0
|
|
4070
4028
|
};
|
|
4071
4029
|
}, [foldControlsAvailable, allControllerIds, foldedControllers, markReaderFolds]);
|
|
4072
|
-
const styleMenuOptions =
|
|
4030
|
+
const styleMenuOptions = React12.useMemo(() => resolveStyleMenu(styleMenu), [styleMenu]);
|
|
4073
4031
|
return /* @__PURE__ */ jsxs27(
|
|
4074
4032
|
"div",
|
|
4075
4033
|
{
|