@particle-academy/fancy-flow 0.40.2 → 0.40.4

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/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { removeNodes, removeEdges, cloneSubgraph, alignNodes, distributeNodes, reconnectEdge, assignToLane, removeFromLane, duplicateNode, setEdgeLabel, FlowCanvas } from './chunk-5UCWY7G3.js';
2
- export { ActionNode, DecisionNode, FlowCanvas, FlowViewer, NodeShell, OutputNode, SubgraphNode, TriggerNode, alignNodes, cloneSubgraph, defaultNodeTypes, distributeNodes, reconnectEdge } from './chunk-5UCWY7G3.js';
1
+ import { removeNodes, removeEdges, cloneSubgraph, alignNodes, distributeNodes, reconnectEdge, assignToLane, removeFromLane, duplicateNode, setEdgeLabel, FlowCanvas } from './chunk-WOO4B7M5.js';
2
+ export { ActionNode, DecisionNode, FlowCanvas, FlowViewer, NodeShell, OutputNode, SubgraphNode, TriggerNode, alignNodes, cloneSubgraph, defaultNodeTypes, distributeNodes, reconnectEdge } from './chunk-WOO4B7M5.js';
3
3
  import { useFlowState, useFlowRun, useFlowHistory, applyOutputsToNodes, applyStatusesToNodes } from './chunk-A6RFLGWV.js';
4
4
  export { applyOutputsToNodes, applyStatusesToNodes, createHistory, useFlowHistory, useFlowRun, useFlowState } from './chunk-A6RFLGWV.js';
5
5
  export { runCohort } from './chunk-QZTGV3ZL.js';
package/dist/screens.cjs CHANGED
@@ -9422,6 +9422,36 @@ function HelperLines({ horizontal, vertical }) {
9422
9422
  )
9423
9423
  ] });
9424
9424
  }
9425
+ function readDocumentTheme() {
9426
+ if (typeof document === "undefined") return "light";
9427
+ const root2 = document.documentElement;
9428
+ const attr = root2.getAttribute("data-theme");
9429
+ if (attr === "dark" || attr === "light") return attr;
9430
+ if (root2.classList.contains("dark")) return "dark";
9431
+ return typeof window !== "undefined" && window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
9432
+ }
9433
+ function useResolvedColorMode(explicit) {
9434
+ const [resolved, setResolved] = ReactExports.useState("light");
9435
+ const pinned = explicit === "light" || explicit === "dark" ? explicit : void 0;
9436
+ ReactExports.useEffect(() => {
9437
+ if (pinned) return;
9438
+ if (typeof document === "undefined") return;
9439
+ const sync = () => setResolved(readDocumentTheme());
9440
+ sync();
9441
+ const observer = new MutationObserver(sync);
9442
+ observer.observe(document.documentElement, {
9443
+ attributes: true,
9444
+ attributeFilter: ["class", "data-theme"]
9445
+ });
9446
+ const media = window.matchMedia?.("(prefers-color-scheme: dark)");
9447
+ media?.addEventListener?.("change", sync);
9448
+ return () => {
9449
+ observer.disconnect();
9450
+ media?.removeEventListener?.("change", sync);
9451
+ };
9452
+ }, [pinned]);
9453
+ return pinned ?? resolved;
9454
+ }
9425
9455
  function preventScrollWhileZooming(event) {
9426
9456
  if (event.shiftKey) event.preventDefault();
9427
9457
  }
@@ -9494,6 +9524,7 @@ function FlowCanvas({
9494
9524
  },
9495
9525
  [showHelperLines, onNodesChange]
9496
9526
  );
9527
+ const resolvedColorMode = useResolvedColorMode(colorMode);
9497
9528
  return /* @__PURE__ */ jsxRuntime.jsxs(
9498
9529
  "div",
9499
9530
  {
@@ -9501,8 +9532,8 @@ function FlowCanvas({
9501
9532
  "ff-canvas",
9502
9533
  // colorMode drives BOTH react-flow's chrome (below) and our `ff-` styles
9503
9534
  // via the shared `.dark` class / light opt-out — one theme signal.
9504
- colorMode === "dark" ? "dark" : "",
9505
- colorMode === "light" ? "ff-canvas--light" : "",
9535
+ resolvedColorMode === "dark" ? "dark" : "",
9536
+ resolvedColorMode === "light" ? "ff-canvas--light" : "",
9506
9537
  className ?? ""
9507
9538
  ].filter(Boolean).join(" "),
9508
9539
  style: { height, ...style2 },
@@ -9514,7 +9545,7 @@ function FlowCanvas({
9514
9545
  nodes: orderedNodes,
9515
9546
  edges,
9516
9547
  onNodesChange: handleNodesChange,
9517
- colorMode,
9548
+ colorMode: resolvedColorMode,
9518
9549
  nodeTypes: mergedNodeTypes,
9519
9550
  edgeTypes: mergedEdgeTypes,
9520
9551
  fitView: true,