@pyreon/flow 0.9.0 → 0.11.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/src/types.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { VNodeChild } from '@pyreon/core'
2
- import type { Computed, Signal } from '@pyreon/reactivity'
1
+ import type { VNodeChild } from "@pyreon/core"
2
+ import type { Computed, Signal } from "@pyreon/reactivity"
3
3
 
4
4
  // ─── Position & Geometry ─────────────────────────────────────────────────────
5
5
 
@@ -25,13 +25,13 @@ export interface Viewport {
25
25
 
26
26
  // ─── Handle ──────────────────────────────────────────────────────────────────
27
27
 
28
- export type HandleType = 'source' | 'target'
28
+ export type HandleType = "source" | "target"
29
29
 
30
30
  export enum Position {
31
- Top = 'top',
32
- Right = 'right',
33
- Bottom = 'bottom',
34
- Left = 'left',
31
+ Top = "top",
32
+ Right = "right",
33
+ Bottom = "bottom",
34
+ Left = "left",
35
35
  }
36
36
 
37
37
  export interface HandleConfig {
@@ -71,7 +71,7 @@ export interface FlowNode<TData = Record<string, unknown>> {
71
71
 
72
72
  // ─── Edge ────────────────────────────────────────────────────────────────────
73
73
 
74
- export type EdgeType = 'bezier' | 'smoothstep' | 'straight' | 'step'
74
+ export type EdgeType = "bezier" | "smoothstep" | "straight" | "step"
75
75
 
76
76
  export interface FlowEdge {
77
77
  id?: string
@@ -104,10 +104,10 @@ export type ConnectionRule = Record<string, { outputs: string[] }>
104
104
  // ─── Node Change Events ──────────────────────────────────────────────────────
105
105
 
106
106
  export type NodeChange =
107
- | { type: 'position'; id: string; position: XYPosition }
108
- | { type: 'dimensions'; id: string; dimensions: Dimensions }
109
- | { type: 'select'; id: string; selected: boolean }
110
- | { type: 'remove'; id: string }
107
+ | { type: "position"; id: string; position: XYPosition }
108
+ | { type: "dimensions"; id: string; dimensions: Dimensions }
109
+ | { type: "select"; id: string; selected: boolean }
110
+ | { type: "remove"; id: string }
111
111
 
112
112
  // ─── Edge path result ────────────────────────────────────────────────────────
113
113
 
@@ -231,10 +231,7 @@ export interface FlowInstance {
231
231
  // ── Layout ───────────────────────────────────────────────────────────────
232
232
 
233
233
  /** Apply auto-layout using elkjs */
234
- layout: (
235
- algorithm?: LayoutAlgorithm,
236
- options?: LayoutOptions,
237
- ) => Promise<void>
234
+ layout: (algorithm?: LayoutAlgorithm, options?: LayoutOptions) => Promise<void>
238
235
 
239
236
  // ── Batch ────────────────────────────────────────────────────────────────
240
237
 
@@ -331,10 +328,7 @@ export interface FlowInstance {
331
328
  // ── Proximity connect ────────────────────────────────────────────────────
332
329
 
333
330
  /** Find the nearest unconnected node within threshold distance */
334
- getProximityConnection: (
335
- nodeId: string,
336
- threshold?: number,
337
- ) => Connection | null
331
+ getProximityConnection: (nodeId: string, threshold?: number) => Connection | null
338
332
 
339
333
  // ── Collision detection ─────────────────────────────────────────────────
340
334
 
@@ -348,11 +342,7 @@ export interface FlowInstance {
348
342
  /** Set drag boundaries for all nodes — [[minX, minY], [maxX, maxY]] or null to remove */
349
343
  setNodeExtent: (extent: [[number, number], [number, number]] | null) => void
350
344
  /** Clamp a position to the current node extent */
351
- clampToExtent: (
352
- position: XYPosition,
353
- nodeWidth?: number,
354
- nodeHeight?: number,
355
- ) => XYPosition
345
+ clampToExtent: (position: XYPosition, nodeWidth?: number, nodeHeight?: number) => XYPosition
356
346
 
357
347
  // ── Search / Filter ─────────────────────────────────────────────────────
358
348
 
@@ -368,11 +358,7 @@ export interface FlowInstance {
368
358
  /** Export the flow as a JSON-serializable object */
369
359
  toJSON: () => { nodes: FlowNode[]; edges: FlowEdge[]; viewport: Viewport }
370
360
  /** Import flow state from a JSON object */
371
- fromJSON: (data: {
372
- nodes: FlowNode[]
373
- edges: FlowEdge[]
374
- viewport?: Viewport
375
- }) => void
361
+ fromJSON: (data: { nodes: FlowNode[]; edges: FlowEdge[]; viewport?: Viewport }) => void
376
362
 
377
363
  // ── Viewport animation ─────────────────────────────────────────────────
378
364
 
@@ -404,23 +390,23 @@ export interface FlowInstance {
404
390
  // ─── Layout ──────────────────────────────────────────────────────────────────
405
391
 
406
392
  export type LayoutAlgorithm =
407
- | 'layered'
408
- | 'force'
409
- | 'stress'
410
- | 'tree'
411
- | 'radial'
412
- | 'box'
413
- | 'rectpacking'
393
+ | "layered"
394
+ | "force"
395
+ | "stress"
396
+ | "tree"
397
+ | "radial"
398
+ | "box"
399
+ | "rectpacking"
414
400
 
415
401
  export interface LayoutOptions {
416
402
  /** Layout direction — default: 'DOWN' */
417
- direction?: 'UP' | 'DOWN' | 'LEFT' | 'RIGHT'
403
+ direction?: "UP" | "DOWN" | "LEFT" | "RIGHT"
418
404
  /** Spacing between nodes — default: 50 */
419
405
  nodeSpacing?: number
420
406
  /** Spacing between layers — default: 80 */
421
407
  layerSpacing?: number
422
408
  /** Edge routing — default: 'orthogonal' */
423
- edgeRouting?: 'orthogonal' | 'splines' | 'polyline'
409
+ edgeRouting?: "orthogonal" | "splines" | "polyline"
424
410
  /** Whether to animate the layout transition — default: true */
425
411
  animate?: boolean
426
412
  /** Animation duration in ms — default: 300 */
@@ -437,7 +423,7 @@ export interface FlowProps {
437
423
  }
438
424
 
439
425
  export interface BackgroundProps {
440
- variant?: 'dots' | 'lines' | 'cross'
426
+ variant?: "dots" | "lines" | "cross"
441
427
  gap?: number
442
428
  size?: number
443
429
  color?: string
@@ -457,11 +443,11 @@ export interface ControlsProps {
457
443
  showZoomOut?: boolean
458
444
  showFitView?: boolean
459
445
  showLock?: boolean
460
- position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
446
+ position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"
461
447
  }
462
448
 
463
449
  export interface PanelProps {
464
- position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
450
+ position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"
465
451
  style?: string
466
452
  class?: string
467
453
  children?: VNodeChild