@particle-academy/fancy-flow 0.2.2 → 0.3.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 CHANGED
@@ -1,18 +1,41 @@
1
1
  # @particle-academy/fancy-flow
2
2
 
3
- Workflow editor + runner built on [React Flow](https://reactflow.dev/). Six built-in node kits, tokenized theme, topological execution with per-node status events.
3
+ Workflow editor + runner with six built-in node kits, tokenized theme, and topological execution with per-node status events. React Flow is bundled — consumers `npm install fancy-flow` and get nothing extra.
4
4
 
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm install @particle-academy/fancy-flow @xyflow/react
8
+ npm install @particle-academy/fancy-flow
9
9
  ```
10
10
 
11
11
  ```ts
12
- import "@xyflow/react/dist/style.css";
13
12
  import "@particle-academy/fancy-flow/styles.css";
14
13
  ```
15
14
 
15
+ No more `@xyflow/react` peer install since `0.3.0` — it's bundled into our dist and hidden behind the `defineNode` / `<NodePort>` authoring API (see "Custom nodes" below). React Flow's own stylesheet is included inside ours.
16
+
17
+ > **Why might I see two copies?** If your app *also* imports `@xyflow/react` directly somewhere (e.g. for a non-fancy-flow surface), your bundler will include both our bundled copy and yours. They won't share React-Flow's provider state. Two ways to avoid it: (a) author every custom node with `defineNode` + `<NodePort>` instead of importing react-flow yourself, or (b) tell your bundler to alias `@xyflow/react` to a single source. Cases where you actually need both are rare.
18
+
19
+ ## Custom nodes — no react-flow imports needed
20
+
21
+ ```tsx
22
+ import { defineNode, NodePort } from "@particle-academy/fancy-flow";
23
+
24
+ type MyData = { label: string; threshold: number };
25
+
26
+ export const ThresholdNode = defineNode<MyData>(({ data, selected }) => (
27
+ <div className={selected ? "node node--selected" : "node"}>
28
+ <NodePort side="left" type="target" id="in" />
29
+ <div className="node__title">{data.label}</div>
30
+ <div className="node__body">≥ {data.threshold}</div>
31
+ <NodePort side="right" type="source" id="pass" title="pass" />
32
+ <NodePort side="right" type="source" id="fail" title="fail" style={{ top: "70%" }} />
33
+ </div>
34
+ ));
35
+ ```
36
+
37
+ `defineNode` returns a memoized component compatible with the underlying engine; `<NodePort>` renders a connection handle. Together they cover what the typical node author needs — multiple ports, source vs target, position per side — without ever importing from `@xyflow/react`.
38
+
16
39
  ## Quick start
17
40
 
18
41
  ```tsx
@@ -0,0 +1,35 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __commonJS = (cb, mod) => function __require2() {
14
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from))
19
+ if (!__hasOwnProp.call(to, key) && key !== except)
20
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
+ mod
31
+ ));
32
+
33
+ export { __commonJS, __require, __toESM };
34
+ //# sourceMappingURL=chunk-7D4SUZUM.js.map
35
+ //# sourceMappingURL=chunk-7D4SUZUM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-7D4SUZUM.js"}