panelui-web 0.0.0-stage → 0.1.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 +43 -2
- package/dist/components/bar-picker/index.d.ts +61 -0
- package/dist/components/bar-picker/index.js +139 -0
- package/dist/components/command-dock/index.d.ts +118 -0
- package/dist/components/command-dock/index.js +239 -0
- package/dist/components/day-grid/index.d.ts +87 -0
- package/dist/components/day-grid/index.js +251 -0
- package/dist/components/feedback/index.d.ts +135 -0
- package/dist/components/feedback/index.js +283 -0
- package/dist/components/flow/flow-paths.d.ts +94 -0
- package/dist/components/flow/flow-paths.js +270 -0
- package/dist/components/flow/index.d.ts +235 -0
- package/dist/components/flow/index.js +597 -0
- package/dist/components/kpi/index.d.ts +211 -0
- package/dist/components/kpi/index.js +243 -0
- package/dist/components/lane-board/index.d.ts +125 -0
- package/dist/components/lane-board/index.js +691 -0
- package/dist/components/planet/index.d.ts +132 -0
- package/dist/components/planet/index.js +653 -0
- package/dist/components/planet/land.d.ts +8 -0
- package/dist/components/planet/land.js +122 -0
- package/dist/components/range-meter/index.d.ts +70 -0
- package/dist/components/range-meter/index.js +170 -0
- package/dist/components/rolling-number/index.d.ts +46 -0
- package/dist/components/rolling-number/index.js +81 -0
- package/dist/components/tilt-card/index.d.ts +60 -0
- package/dist/components/tilt-card/index.js +114 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/lib/cn.d.ts +3 -0
- package/dist/lib/cn.js +6 -0
- package/package.json +72 -4
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flow — a canvas of nodes joined by edges, that you pan, zoom and rearrange.
|
|
3
|
+
*
|
|
4
|
+
* ```tsx
|
|
5
|
+
* <Flow>
|
|
6
|
+
* <Flow.Background variant="dots" />
|
|
7
|
+
* <Flow.Node id="source" position={{ x: 24, y: 40 }}>…</Flow.Node>
|
|
8
|
+
* <Flow.Node id="build" position={{ x: 24, y: 200 }}>…</Flow.Node>
|
|
9
|
+
* <Flow.Edge from="source" to="build" dashed animated arrow />
|
|
10
|
+
* <Flow.Controls />
|
|
11
|
+
* </Flow>
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* ## The same parts as the app
|
|
15
|
+
*
|
|
16
|
+
* The parts and their props are the app library's Flow, so a graph written
|
|
17
|
+
* for one reads the same in the other. What differs is the hand: here the
|
|
18
|
+
* pane is dragged with a mouse, zoomed with a pinch or with Control and the
|
|
19
|
+
* wheel, and every node can be reached and moved from the keyboard.
|
|
20
|
+
*
|
|
21
|
+
* ## Where the positions live
|
|
22
|
+
*
|
|
23
|
+
* A node's `position` is where it starts. From then on the canvas holds it:
|
|
24
|
+
* a drag moves it there, and `onNodeDragEnd` says where it came to rest. Pass
|
|
25
|
+
* a new `position` and the node goes to it, which is how nodes are driven
|
|
26
|
+
* from outside.
|
|
27
|
+
*
|
|
28
|
+
* Edges are drawn from the boxes of the nodes they join, measured off the
|
|
29
|
+
* page. An edge therefore follows a node whatever is inside it, and redraws
|
|
30
|
+
* as either end is dragged.
|
|
31
|
+
*
|
|
32
|
+
* ## Three gestures, one canvas
|
|
33
|
+
*
|
|
34
|
+
* The pane pans, a node drags, and a handle draws a new connection. Each is
|
|
35
|
+
* taken by the innermost thing under the pointer, which is what a hand
|
|
36
|
+
* expects.
|
|
37
|
+
*/
|
|
38
|
+
import { type ComponentProps, type ReactNode } from 'react';
|
|
39
|
+
import { type FlowPoint, type FlowRect, type FlowSide } from './flow-paths.js';
|
|
40
|
+
export type FlowEdgeVariant = 'bezier' | 'smoothstep' | 'step' | 'straight';
|
|
41
|
+
/** Which of the theme's roles an edge is drawn in. */
|
|
42
|
+
export type FlowColor = 'primary' | 'info' | 'success' | 'warning' | 'destructive';
|
|
43
|
+
/** Where the canvas is looking: how far it is panned, and how far zoomed. */
|
|
44
|
+
export interface FlowViewport {
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
zoom: number;
|
|
48
|
+
}
|
|
49
|
+
export interface FlowNodePosition {
|
|
50
|
+
x: number;
|
|
51
|
+
y: number;
|
|
52
|
+
}
|
|
53
|
+
/** One end of an edge: a node, and optionally one of its handles by `id`. */
|
|
54
|
+
export interface FlowEndpoint {
|
|
55
|
+
node: string;
|
|
56
|
+
handle?: string;
|
|
57
|
+
}
|
|
58
|
+
export type FlowEndpointReference = string | FlowEndpoint;
|
|
59
|
+
/** What `onConnect` is handed when a connection lands. */
|
|
60
|
+
export interface FlowConnection {
|
|
61
|
+
/** Node the drag started from. */
|
|
62
|
+
source: string;
|
|
63
|
+
/** Handle it started from, when that handle has an `id`. */
|
|
64
|
+
sourceHandle?: string;
|
|
65
|
+
/** Node it was dropped on. */
|
|
66
|
+
target: string;
|
|
67
|
+
/** Handle it was dropped on, when it landed on one with an `id`. */
|
|
68
|
+
targetHandle?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface FlowProps extends Omit<ComponentProps<'div'>, 'children'> {
|
|
71
|
+
/** Where the canvas looks to begin with. */
|
|
72
|
+
defaultViewport?: FlowViewport;
|
|
73
|
+
/** The furthest out it can be zoomed. */
|
|
74
|
+
minZoom?: number;
|
|
75
|
+
/** The furthest in it can be zoomed. */
|
|
76
|
+
maxZoom?: number;
|
|
77
|
+
/** Whether dragging the pane pans it. */
|
|
78
|
+
panOnDrag?: boolean;
|
|
79
|
+
/** Whether a pinch, or Control with the wheel, zooms it. */
|
|
80
|
+
zoomOnPinch?: boolean;
|
|
81
|
+
/** Fits every node into view once they have been measured. */
|
|
82
|
+
fitViewOnMount?: boolean;
|
|
83
|
+
/** The room left round the nodes when fitting them, in pixels. */
|
|
84
|
+
fitViewPadding?: number;
|
|
85
|
+
/** Called as the canvas is panned or zoomed. */
|
|
86
|
+
onViewportChange?: (viewport: FlowViewport) => void;
|
|
87
|
+
/** Called with a node's new position when a drag or a key press has moved it. */
|
|
88
|
+
onNodeDragEnd?: (id: string, position: FlowNodePosition) => void;
|
|
89
|
+
/** Called when a connection drawn from a handle lands on another node. */
|
|
90
|
+
onConnect?: (connection: FlowConnection) => void;
|
|
91
|
+
/** Decides whether a connection may land. Without it, any two different nodes may be joined. */
|
|
92
|
+
isValidConnection?: (connection: FlowConnection) => boolean;
|
|
93
|
+
/** What a screen reader calls the canvas. */
|
|
94
|
+
label?: string;
|
|
95
|
+
children?: ReactNode;
|
|
96
|
+
}
|
|
97
|
+
declare function FlowRoot({ defaultViewport, minZoom, maxZoom, panOnDrag, zoomOnPinch, fitViewOnMount, fitViewPadding, onViewportChange, onNodeDragEnd, onConnect, isValidConnection, label, className, children, onKeyDown, ...props }: FlowProps): import("react").JSX.Element;
|
|
98
|
+
declare namespace FlowRoot {
|
|
99
|
+
var displayName: string;
|
|
100
|
+
}
|
|
101
|
+
export interface FlowBackgroundProps {
|
|
102
|
+
/** Dots, a grid of lines, small crosses, or nothing. */
|
|
103
|
+
variant?: 'dots' | 'lines' | 'cross' | 'none';
|
|
104
|
+
/** The distance from one mark to the next, in pixels at a zoom of 1. */
|
|
105
|
+
gap?: number;
|
|
106
|
+
/** How big a mark is: a dot's radius, a line's thickness, half a cross's arm. */
|
|
107
|
+
size?: number;
|
|
108
|
+
className?: string;
|
|
109
|
+
}
|
|
110
|
+
/** The pattern behind the graph, which moves and scales with it. */
|
|
111
|
+
declare function FlowBackground({ variant, gap, size, className }: FlowBackgroundProps): import("react").ReactPortal | null;
|
|
112
|
+
declare namespace FlowBackground {
|
|
113
|
+
var displayName: string;
|
|
114
|
+
}
|
|
115
|
+
export interface FlowNodeProps extends Omit<ComponentProps<'div'>, 'id'> {
|
|
116
|
+
/** What edges and `onNodeDragEnd` call this node. */
|
|
117
|
+
id: string;
|
|
118
|
+
/** Where its top left corner is, on the graph. */
|
|
119
|
+
position: FlowNodePosition;
|
|
120
|
+
/** Whether it can be dragged and moved with the arrow keys. */
|
|
121
|
+
draggable?: boolean;
|
|
122
|
+
/** Draws it as the one that has been picked. */
|
|
123
|
+
selected?: boolean;
|
|
124
|
+
/** Called when it is pressed without being dragged, or with Enter. */
|
|
125
|
+
onPress?: () => void;
|
|
126
|
+
/** Called when Delete or Backspace is pressed on it. */
|
|
127
|
+
onDelete?: () => void;
|
|
128
|
+
/** How far one arrow key press moves it, in pixels. Shift moves four times as far. */
|
|
129
|
+
moveStep?: number;
|
|
130
|
+
}
|
|
131
|
+
/** A box on the graph. Whatever is inside it is yours. */
|
|
132
|
+
declare function FlowNode({ id, position, draggable, selected, onPress, onDelete, moveStep, className, style, children, ...props }: FlowNodeProps): import("react").JSX.Element;
|
|
133
|
+
declare namespace FlowNode {
|
|
134
|
+
var displayName: string;
|
|
135
|
+
}
|
|
136
|
+
export interface FlowGroupProps extends FlowNodeProps {
|
|
137
|
+
/** Written in the corner of the group. */
|
|
138
|
+
label?: ReactNode;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* A dashed box round a few things that belong together. It is a node like any
|
|
142
|
+
* other: it is dragged as one, and an edge can be joined to it.
|
|
143
|
+
*/
|
|
144
|
+
declare function FlowGroup({ id, position, draggable, selected: _selected, onPress, onDelete, moveStep, label, className, style, children, ...props }: FlowGroupProps): import("react").JSX.Element;
|
|
145
|
+
declare namespace FlowGroup {
|
|
146
|
+
var displayName: string;
|
|
147
|
+
}
|
|
148
|
+
export interface FlowHandleProps extends Omit<ComponentProps<'span'>, 'id'> {
|
|
149
|
+
/** A name for this handle, so an edge can be joined to it and not only to the node. */
|
|
150
|
+
id?: string;
|
|
151
|
+
/** Which face of the node it sits on. */
|
|
152
|
+
position?: FlowSide;
|
|
153
|
+
/** How far along that face, from 0 to 1. */
|
|
154
|
+
offset?: number;
|
|
155
|
+
}
|
|
156
|
+
/** A point on a node's edge that a connection can be drawn from, or dropped on. */
|
|
157
|
+
declare function FlowHandle({ id, position, offset, className, style, ...props }: FlowHandleProps): import("react").JSX.Element;
|
|
158
|
+
declare namespace FlowHandle {
|
|
159
|
+
var displayName: string;
|
|
160
|
+
}
|
|
161
|
+
export interface FlowEdgeProps {
|
|
162
|
+
/** Where it leaves from: a node's `id`, or `{ node, handle }`. */
|
|
163
|
+
from: FlowEndpointReference;
|
|
164
|
+
/** Where it arrives. */
|
|
165
|
+
to: FlowEndpointReference;
|
|
166
|
+
/** A curve, a rounded right-angled route, a square one, or a straight line. */
|
|
167
|
+
variant?: FlowEdgeVariant;
|
|
168
|
+
/** Sets the dashes marching towards the target. */
|
|
169
|
+
animated?: boolean;
|
|
170
|
+
/** Draws it dashed. */
|
|
171
|
+
dashed?: boolean;
|
|
172
|
+
/** One of the theme's roles. Without it the edge is a quiet grey. */
|
|
173
|
+
color?: FlowColor;
|
|
174
|
+
/** How thick the line is, in pixels at a zoom of 1. */
|
|
175
|
+
width?: number;
|
|
176
|
+
/** Draws an arrowhead where it arrives. */
|
|
177
|
+
arrow?: boolean;
|
|
178
|
+
/** The face it leaves from. Worked out from where the two nodes are when left out. */
|
|
179
|
+
fromSide?: FlowSide;
|
|
180
|
+
/** The face it arrives at. */
|
|
181
|
+
toSide?: FlowSide;
|
|
182
|
+
/** How round the corners of a `smoothstep` route are. */
|
|
183
|
+
radius?: number;
|
|
184
|
+
/** How far a routed edge runs straight out of a node before it turns. */
|
|
185
|
+
gap?: number;
|
|
186
|
+
/** How far a `bezier` bulges when its target is behind its source. */
|
|
187
|
+
curvature?: number;
|
|
188
|
+
}
|
|
189
|
+
/** A line from one node to another, which follows them as they move. */
|
|
190
|
+
declare function FlowEdge({ from, to, variant, animated, dashed, color, width, arrow, fromSide, toSide, radius, gap, curvature, }: FlowEdgeProps): import("react").JSX.Element | null;
|
|
191
|
+
declare namespace FlowEdge {
|
|
192
|
+
var displayName: string;
|
|
193
|
+
}
|
|
194
|
+
type FlowCorner = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
195
|
+
export interface FlowControlsProps extends Omit<ComponentProps<'div'>, 'children'> {
|
|
196
|
+
/** Shows the two zoom buttons. */
|
|
197
|
+
zoom?: boolean;
|
|
198
|
+
/** Shows the button that fits every node into view. */
|
|
199
|
+
fit?: boolean;
|
|
200
|
+
/** Shows the button that locks the canvas against panning, zooming and dragging. */
|
|
201
|
+
lock?: boolean;
|
|
202
|
+
/** How much one press of a zoom button zooms. */
|
|
203
|
+
step?: number;
|
|
204
|
+
/** Which corner of the canvas they sit in. */
|
|
205
|
+
position?: FlowCorner;
|
|
206
|
+
}
|
|
207
|
+
/** Buttons for what a pinch and a drag do, for anyone without either. */
|
|
208
|
+
declare function FlowControls({ zoom, fit, lock, step, position, className, ...props }: FlowControlsProps): import("react").ReactPortal | null;
|
|
209
|
+
declare namespace FlowControls {
|
|
210
|
+
var displayName: string;
|
|
211
|
+
}
|
|
212
|
+
export interface FlowMiniMapProps extends Omit<ComponentProps<'div'>, 'children'> {
|
|
213
|
+
/** How wide the map is, in pixels. */
|
|
214
|
+
width?: number;
|
|
215
|
+
/** How tall the map is, in pixels. */
|
|
216
|
+
height?: number;
|
|
217
|
+
/** Which corner of the canvas it sits in. */
|
|
218
|
+
position?: FlowCorner;
|
|
219
|
+
}
|
|
220
|
+
/** The whole graph, small, with the part in view marked on it. */
|
|
221
|
+
declare function FlowMiniMap({ width, height, position, className, style, ...props }: FlowMiniMapProps): import("react").ReactPortal | null;
|
|
222
|
+
declare namespace FlowMiniMap {
|
|
223
|
+
var displayName: string;
|
|
224
|
+
}
|
|
225
|
+
export declare const Flow: typeof FlowRoot & {
|
|
226
|
+
Background: typeof FlowBackground;
|
|
227
|
+
Node: typeof FlowNode;
|
|
228
|
+
Handle: typeof FlowHandle;
|
|
229
|
+
Edge: typeof FlowEdge;
|
|
230
|
+
Group: typeof FlowGroup;
|
|
231
|
+
Controls: typeof FlowControls;
|
|
232
|
+
MiniMap: typeof FlowMiniMap;
|
|
233
|
+
};
|
|
234
|
+
export { FlowBackground, FlowNode, FlowHandle, FlowEdge, FlowGroup, FlowControls, FlowMiniMap };
|
|
235
|
+
export type { FlowSide, FlowRect, FlowPoint };
|