@mcurcio/patchbay 0.5.0 → 0.6.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 +7 -6
- package/dist/graph.css +1 -1
- package/dist/graph.js +636 -63
- package/dist/graph.js.map +1 -1
- package/dist/tokens.css +22 -2
- package/dist/types/graph/add-at/index.d.ts +2 -0
- package/dist/types/graph/add-at/useAddAt.d.ts +32 -0
- package/dist/types/graph/canvas-tools/CanvasTools.d.ts +40 -0
- package/dist/types/graph/canvas-tools/index.d.ts +2 -0
- package/dist/types/graph/canvas-tools/motion.d.ts +2 -0
- package/dist/types/graph/connect-hints/index.d.ts +4 -0
- package/dist/types/graph/connect-hints/mergeFlowProps.d.ts +10 -0
- package/dist/types/graph/connect-hints/useConnectHints.d.ts +48 -0
- package/dist/types/graph/follow-fit/index.d.ts +2 -0
- package/dist/types/graph/follow-fit/useFollowFit.d.ts +21 -0
- package/dist/types/graph/ghost-wire/GhostWire.d.ts +16 -0
- package/dist/types/graph/ghost-wire/index.d.ts +2 -0
- package/dist/types/graph/index.d.ts +8 -0
- package/dist/types/graph/node-box/NodeBox.d.ts +53 -0
- package/dist/types/graph/node-box/geometry.d.ts +47 -0
- package/dist/types/graph/node-box/index.d.ts +4 -0
- package/dist/types/graph/port-row/PortRow.d.ts +31 -0
- package/dist/types/graph/port-row/index.d.ts +2 -0
- package/dist/types/graph/wire/Wire.d.ts +27 -0
- package/dist/types/graph/wire/index.d.ts +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import "./PortRow.css";
|
|
3
|
+
/** Which side of the box a port is on: an input is a target handle on the left edge, an output a source on the right. */
|
|
4
|
+
export type PortSide = "input" | "output";
|
|
5
|
+
/**
|
|
6
|
+
* What a port shows while a wire is dragged: `origin` the handle the drag began at, `ok` a handle that accepts it,
|
|
7
|
+
* `no` one that refuses it, `null` no drag. An open enum; one it does not know is drawn as `null`.
|
|
8
|
+
*/
|
|
9
|
+
export type PortHint = "ok" | "no" | "origin" | null | (string & {});
|
|
10
|
+
export type PortRowProps = {
|
|
11
|
+
/** The handle id, passed to React Flow's `<Handle id>` unchanged (the app's own scheme). */
|
|
12
|
+
id: string;
|
|
13
|
+
/** `input` (a target handle on the left edge) or `output` (a source handle on the right edge). */
|
|
14
|
+
side: PortSide;
|
|
15
|
+
/** The port's name; a string is also its tooltip. */
|
|
16
|
+
label: ReactNode;
|
|
17
|
+
/** After the label in the muted code face: the port's type. */
|
|
18
|
+
typeLabel?: ReactNode;
|
|
19
|
+
/** While a wire is dragged: `origin`, `ok`, `no`, or `null` for no drag. Given, it wins over `<ConnectHints>`'. */
|
|
20
|
+
hint?: PortHint;
|
|
21
|
+
/** Why the port refuses the wire: the handle's and the row's tooltip while `hint` is `no`. */
|
|
22
|
+
reason?: string;
|
|
23
|
+
/** A problem with the port: a warning mark beside the label, with these as its words. */
|
|
24
|
+
problem?: string;
|
|
25
|
+
/** A slot at the row's inner end, toward the box's centre (a `Meter`). */
|
|
26
|
+
trailing?: ReactNode;
|
|
27
|
+
/** Whether a wire may start or end here; true by default (`<Handle isConnectable>`). */
|
|
28
|
+
connectable?: boolean;
|
|
29
|
+
};
|
|
30
|
+
/** Draws one port: its handle at the edge, its label and type, a problem's mark and a trailing slot. */
|
|
31
|
+
export declare function PortRow({ id, side, label, typeLabel, hint: ownHint, reason: ownReason, problem, trailing, connectable, }: PortRowProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Edge, type EdgeProps } from "@xyflow/react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import type { PillTone } from "../../primitives";
|
|
4
|
+
import "./Wire.css";
|
|
5
|
+
/** Pill's tones, the changes, `pending` and `refused`; any other string is drawn in the edge stroke. */
|
|
6
|
+
export type WireTone = PillTone | "added" | "removed" | "changed" | "pending" | "refused" | (string & {});
|
|
7
|
+
/** A wire's look, as React Flow's edge `data`. */
|
|
8
|
+
export type WireData = {
|
|
9
|
+
/** The stroke's tone; none, or one it does not know, is React Flow's edge stroke. */
|
|
10
|
+
tone?: WireTone;
|
|
11
|
+
/** The signal's level, 0 to 1 (clamped; not a number is 0): thickness and brightness. None is the plain wire. */
|
|
12
|
+
emphasis?: number;
|
|
13
|
+
/** Dashes: an edit not yet saved. */
|
|
14
|
+
dashed?: boolean;
|
|
15
|
+
/** Dots moving along the wire toward the input; not drawn under reduced motion. */
|
|
16
|
+
flow?: boolean;
|
|
17
|
+
/** An arrowhead at the input end, facing the handle's side. */
|
|
18
|
+
arrow?: boolean;
|
|
19
|
+
/** At the midpoint, on the raised surface; it takes no pointer events. */
|
|
20
|
+
label?: ReactNode;
|
|
21
|
+
/** The wire's tooltip, on its hit path. */
|
|
22
|
+
title?: string;
|
|
23
|
+
};
|
|
24
|
+
/** An edge drawn by `Wire`: register it as `edgeTypes={{ wire: Wire }}`. */
|
|
25
|
+
export type WireEdge = Edge<WireData, "wire">;
|
|
26
|
+
/** Draws a wire between two handles: its tone, level, dashes, flow, arrow, label and tooltip from the edge's data. */
|
|
27
|
+
export declare function Wire({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, data, selected, interactionWidth, markerStart, markerEnd, style, }: EdgeProps<WireEdge>): import("react").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcurcio/patchbay",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "A React component library for graph-based editors and live dashboards: design tokens and themes, primitives, and React Flow graph components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"check": "pnpm typecheck && pnpm lint && pnpm format:check && pnpm test && pnpm build"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@xyflow/react": "^12.
|
|
77
|
+
"@xyflow/react": "^12.1.0",
|
|
78
78
|
"knobly": "^1.0.0",
|
|
79
79
|
"react": "^19.0.0",
|
|
80
80
|
"react-dom": "^19.0.0"
|