footprint-explainable-ui 0.25.1 → 0.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/flowchart.cjs +36 -25
- package/dist/flowchart.cjs.map +1 -1
- package/dist/flowchart.js +37 -26
- package/dist/flowchart.js.map +1 -1
- package/dist/index.cjs +36 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +41 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/flowchart.cjs
CHANGED
|
@@ -1955,6 +1955,16 @@ function TraceFlow(props) {
|
|
|
1955
1955
|
var import_react18 = require("react");
|
|
1956
1956
|
var import_react19 = require("@xyflow/react");
|
|
1957
1957
|
|
|
1958
|
+
// src/components/FlowchartView/_internal/devWarn.ts
|
|
1959
|
+
function isDevModeEnv() {
|
|
1960
|
+
const proc = globalThis.process;
|
|
1961
|
+
return proc?.env?.NODE_ENV !== "production";
|
|
1962
|
+
}
|
|
1963
|
+
function devWarn(messageFn, ...extras) {
|
|
1964
|
+
if (!isDevModeEnv()) return;
|
|
1965
|
+
console.warn(messageFn(), ...extras);
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1958
1968
|
// src/components/FlowchartView/_internal/snapLinearSuccessors.ts
|
|
1959
1969
|
function snapLinearSuccessors(graph, options = {}) {
|
|
1960
1970
|
if (graph.nodes.length === 0) return graph;
|
|
@@ -2060,30 +2070,34 @@ function centerForkParents(graph, options = {}) {
|
|
|
2060
2070
|
(a, b) => b.position.y - a.position.y || a.position.x - b.position.x || a.id.localeCompare(b.id)
|
|
2061
2071
|
);
|
|
2062
2072
|
for (const n of order) {
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
const
|
|
2073
|
+
const outD = outDegree.get(n.id) ?? 0;
|
|
2074
|
+
const inD = inDegree.get(n.id) ?? 0;
|
|
2075
|
+
const isFork = outD >= 2 && inD <= 1;
|
|
2076
|
+
const isMerge = inD >= 2 && outD <= 1;
|
|
2077
|
+
if (!isFork && !isMerge) continue;
|
|
2078
|
+
const kin = ((isFork ? childrenOf.get(n.id) : predsOf.get(n.id)) ?? []).filter(
|
|
2066
2079
|
(k) => byId.get(k)?.parentId === n.parentId
|
|
2067
2080
|
// same compound only
|
|
2068
2081
|
);
|
|
2069
|
-
if (
|
|
2070
|
-
const centers =
|
|
2082
|
+
if (kin.length < 2) continue;
|
|
2083
|
+
const centers = kin.map(centerX);
|
|
2071
2084
|
const wN = width.get(n.id);
|
|
2072
2085
|
const span = (Math.min(...centers) + Math.max(...centers)) / 2;
|
|
2073
2086
|
workingX.set(n.id, clampX(n.id, span - wN / 2));
|
|
2087
|
+
const stepOf = isFork ? predsOf : childrenOf;
|
|
2074
2088
|
let curId = n.id;
|
|
2075
2089
|
const walked = /* @__PURE__ */ new Set([curId]);
|
|
2076
2090
|
for (; ; ) {
|
|
2077
|
-
const
|
|
2078
|
-
if (!
|
|
2079
|
-
const
|
|
2080
|
-
if (walked.has(
|
|
2081
|
-
if ((outDegree.get(
|
|
2082
|
-
if ((inDegree.get(
|
|
2083
|
-
if (byId.get(
|
|
2084
|
-
workingX.set(
|
|
2085
|
-
walked.add(
|
|
2086
|
-
curId =
|
|
2091
|
+
const nexts = stepOf.get(curId);
|
|
2092
|
+
if (!nexts || nexts.length !== 1) break;
|
|
2093
|
+
const m = nexts[0];
|
|
2094
|
+
if (walked.has(m)) break;
|
|
2095
|
+
if ((outDegree.get(m) ?? 0) > 1) break;
|
|
2096
|
+
if ((inDegree.get(m) ?? 0) > 1) break;
|
|
2097
|
+
if (byId.get(m)?.parentId !== byId.get(curId)?.parentId) break;
|
|
2098
|
+
workingX.set(m, clampX(m, centerX(curId) - width.get(m) / 2));
|
|
2099
|
+
walked.add(m);
|
|
2100
|
+
curId = m;
|
|
2087
2101
|
}
|
|
2088
2102
|
}
|
|
2089
2103
|
const nodes = graph.nodes.map(
|
|
@@ -2095,16 +2109,6 @@ function withForkCentering(base, options = {}) {
|
|
|
2095
2109
|
return (graph) => centerForkParents(base(graph), options);
|
|
2096
2110
|
}
|
|
2097
2111
|
|
|
2098
|
-
// src/components/FlowchartView/_internal/devWarn.ts
|
|
2099
|
-
function isDevModeEnv() {
|
|
2100
|
-
const proc = globalThis.process;
|
|
2101
|
-
return proc?.env?.NODE_ENV !== "production";
|
|
2102
|
-
}
|
|
2103
|
-
function devWarn(messageFn, ...extras) {
|
|
2104
|
-
if (!isDevModeEnv()) return;
|
|
2105
|
-
console.warn(messageFn(), ...extras);
|
|
2106
|
-
}
|
|
2107
|
-
|
|
2108
2112
|
// src/components/FlowchartView/_internal/notifyChange.ts
|
|
2109
2113
|
function createNotifier(label = "notifier") {
|
|
2110
2114
|
const listeners = /* @__PURE__ */ new Set();
|
|
@@ -2644,6 +2648,13 @@ function TracedFlow({
|
|
|
2644
2648
|
style
|
|
2645
2649
|
}) {
|
|
2646
2650
|
const layout = layoutProp ?? dagreTraceLayout;
|
|
2651
|
+
(0, import_react18.useEffect)(() => {
|
|
2652
|
+
if (layoutProp === dagreTraceLayout) {
|
|
2653
|
+
devWarn(
|
|
2654
|
+
() => "[footprint-explainable-ui] <TracedFlow layout={dagreTraceLayout}> bypasses the built-in measure-then-layout pipeline (content-exact sizing, fork/merge centering, straight spines). OMIT the `layout` prop to use it \u2014 passing the raw dagreTraceLayout silently forfeits every layout improvement eui ships."
|
|
2655
|
+
);
|
|
2656
|
+
}
|
|
2657
|
+
}, [layoutProp]);
|
|
2647
2658
|
const colors = (0, import_react18.useMemo)(
|
|
2648
2659
|
() => ({ ...DEFAULT_COLORS, ...colorOverrides ?? {} }),
|
|
2649
2660
|
[colorOverrides]
|