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.js
CHANGED
|
@@ -1875,7 +1875,7 @@ function TraceFlow(props) {
|
|
|
1875
1875
|
}
|
|
1876
1876
|
|
|
1877
1877
|
// src/components/FlowchartView/TracedFlow.tsx
|
|
1878
|
-
import { useCallback as useCallback3, useMemo as useMemo5, useRef as useRef5, useState as useState4 } from "react";
|
|
1878
|
+
import { useCallback as useCallback3, useEffect as useEffect7, useMemo as useMemo5, useRef as useRef5, useState as useState4 } from "react";
|
|
1879
1879
|
import {
|
|
1880
1880
|
ReactFlow as ReactFlow2,
|
|
1881
1881
|
Background as Background2,
|
|
@@ -1883,6 +1883,16 @@ import {
|
|
|
1883
1883
|
MarkerType as MarkerType2
|
|
1884
1884
|
} from "@xyflow/react";
|
|
1885
1885
|
|
|
1886
|
+
// src/components/FlowchartView/_internal/devWarn.ts
|
|
1887
|
+
function isDevModeEnv() {
|
|
1888
|
+
const proc = globalThis.process;
|
|
1889
|
+
return proc?.env?.NODE_ENV !== "production";
|
|
1890
|
+
}
|
|
1891
|
+
function devWarn(messageFn, ...extras) {
|
|
1892
|
+
if (!isDevModeEnv()) return;
|
|
1893
|
+
console.warn(messageFn(), ...extras);
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1886
1896
|
// src/components/FlowchartView/_internal/snapLinearSuccessors.ts
|
|
1887
1897
|
function snapLinearSuccessors(graph, options = {}) {
|
|
1888
1898
|
if (graph.nodes.length === 0) return graph;
|
|
@@ -1988,30 +1998,34 @@ function centerForkParents(graph, options = {}) {
|
|
|
1988
1998
|
(a, b) => b.position.y - a.position.y || a.position.x - b.position.x || a.id.localeCompare(b.id)
|
|
1989
1999
|
);
|
|
1990
2000
|
for (const n of order) {
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
const
|
|
2001
|
+
const outD = outDegree.get(n.id) ?? 0;
|
|
2002
|
+
const inD = inDegree.get(n.id) ?? 0;
|
|
2003
|
+
const isFork = outD >= 2 && inD <= 1;
|
|
2004
|
+
const isMerge = inD >= 2 && outD <= 1;
|
|
2005
|
+
if (!isFork && !isMerge) continue;
|
|
2006
|
+
const kin = ((isFork ? childrenOf.get(n.id) : predsOf.get(n.id)) ?? []).filter(
|
|
1994
2007
|
(k) => byId.get(k)?.parentId === n.parentId
|
|
1995
2008
|
// same compound only
|
|
1996
2009
|
);
|
|
1997
|
-
if (
|
|
1998
|
-
const centers =
|
|
2010
|
+
if (kin.length < 2) continue;
|
|
2011
|
+
const centers = kin.map(centerX);
|
|
1999
2012
|
const wN = width.get(n.id);
|
|
2000
2013
|
const span = (Math.min(...centers) + Math.max(...centers)) / 2;
|
|
2001
2014
|
workingX.set(n.id, clampX(n.id, span - wN / 2));
|
|
2015
|
+
const stepOf = isFork ? predsOf : childrenOf;
|
|
2002
2016
|
let curId = n.id;
|
|
2003
2017
|
const walked = /* @__PURE__ */ new Set([curId]);
|
|
2004
2018
|
for (; ; ) {
|
|
2005
|
-
const
|
|
2006
|
-
if (!
|
|
2007
|
-
const
|
|
2008
|
-
if (walked.has(
|
|
2009
|
-
if ((outDegree.get(
|
|
2010
|
-
if ((inDegree.get(
|
|
2011
|
-
if (byId.get(
|
|
2012
|
-
workingX.set(
|
|
2013
|
-
walked.add(
|
|
2014
|
-
curId =
|
|
2019
|
+
const nexts = stepOf.get(curId);
|
|
2020
|
+
if (!nexts || nexts.length !== 1) break;
|
|
2021
|
+
const m = nexts[0];
|
|
2022
|
+
if (walked.has(m)) break;
|
|
2023
|
+
if ((outDegree.get(m) ?? 0) > 1) break;
|
|
2024
|
+
if ((inDegree.get(m) ?? 0) > 1) break;
|
|
2025
|
+
if (byId.get(m)?.parentId !== byId.get(curId)?.parentId) break;
|
|
2026
|
+
workingX.set(m, clampX(m, centerX(curId) - width.get(m) / 2));
|
|
2027
|
+
walked.add(m);
|
|
2028
|
+
curId = m;
|
|
2015
2029
|
}
|
|
2016
2030
|
}
|
|
2017
2031
|
const nodes = graph.nodes.map(
|
|
@@ -2023,16 +2037,6 @@ function withForkCentering(base, options = {}) {
|
|
|
2023
2037
|
return (graph) => centerForkParents(base(graph), options);
|
|
2024
2038
|
}
|
|
2025
2039
|
|
|
2026
|
-
// src/components/FlowchartView/_internal/devWarn.ts
|
|
2027
|
-
function isDevModeEnv() {
|
|
2028
|
-
const proc = globalThis.process;
|
|
2029
|
-
return proc?.env?.NODE_ENV !== "production";
|
|
2030
|
-
}
|
|
2031
|
-
function devWarn(messageFn, ...extras) {
|
|
2032
|
-
if (!isDevModeEnv()) return;
|
|
2033
|
-
console.warn(messageFn(), ...extras);
|
|
2034
|
-
}
|
|
2035
|
-
|
|
2036
2040
|
// src/components/FlowchartView/_internal/notifyChange.ts
|
|
2037
2041
|
function createNotifier(label = "notifier") {
|
|
2038
2042
|
const listeners = /* @__PURE__ */ new Set();
|
|
@@ -2572,6 +2576,13 @@ function TracedFlow({
|
|
|
2572
2576
|
style
|
|
2573
2577
|
}) {
|
|
2574
2578
|
const layout = layoutProp ?? dagreTraceLayout;
|
|
2579
|
+
useEffect7(() => {
|
|
2580
|
+
if (layoutProp === dagreTraceLayout) {
|
|
2581
|
+
devWarn(
|
|
2582
|
+
() => "[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."
|
|
2583
|
+
);
|
|
2584
|
+
}
|
|
2585
|
+
}, [layoutProp]);
|
|
2575
2586
|
const colors = useMemo5(
|
|
2576
2587
|
() => ({ ...DEFAULT_COLORS, ...colorOverrides ?? {} }),
|
|
2577
2588
|
[colorOverrides]
|