caplink-saas-ui-shared-component-library 0.5.4 → 0.5.6

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.
@@ -24,6 +24,7 @@ export type NodeProps<T extends Node = Node> = Pick<T, 'id' | 'data' | 'sourcePo
24
24
  export type DefaultNodeDataProps = {
25
25
  content: React.ReactNode;
26
26
  className?: string;
27
+ hideHandles?: boolean;
27
28
  targetHandleClassName?: string;
28
29
  sourceHandleClassName?: string;
29
30
  } & Record<string, unknown>;
@@ -50,6 +51,9 @@ export type EdgePosition = {
50
51
  export type EdgeProps<T extends Edge = Edge> = Pick<T, 'id' | 'animated' | 'data' | 'style' | 'selected' | 'source' | 'target' | 'selectable' | 'deletable'> & EdgePosition & {
51
52
  markerEnd?: string;
52
53
  };
54
+ export type DefaultEdgeProps = {
55
+ edgePath?: 'simpleBezier' | 'smoothStep';
56
+ } & Record<string, unknown>;
53
57
  export declare enum Position {
54
58
  Left = "left",
55
59
  Top = "top",
@@ -100,7 +104,11 @@ export type UseDagProps = {
100
104
  deleteNodes: (node: Node | Node[]) => void;
101
105
  deleteEdges: (edge: Edge | Edge[]) => void;
102
106
  getNodeEdges: (nodeId: string) => Edge[];
103
- changeOrientation: (direction: 'vertical' | 'horizontal') => {
107
+ changeOrientation: (props: {
108
+ direction: 'vertical' | 'horizontal';
109
+ nodeHeight?: number;
110
+ nodeWidth?: number;
111
+ }) => {
104
112
  nodes: Node[];
105
113
  edges: Edge[];
106
114
  };
@@ -1,10 +1,11 @@
1
1
  import { HandleType, Node } from '@xyflow/react';
2
+ import { PropsWithChildren } from 'react';
2
3
 
3
- export type AdjacentNodesProps = {
4
+ export type AdjacentNodesProps = PropsWithChildren<{
4
5
  title?: string;
5
6
  nodeId: string;
6
7
  type: HandleType;
7
8
  nodeValueKey: string;
8
9
  onFindAdjacentNodes?: (nodes: Node[]) => void;
9
- };
10
+ }>;
10
11
  export declare function AdjacentNodes(props: AdjacentNodesProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,3 +1,3 @@
1
- import { EdgeProps } from '../../model';
1
+ import { DefaultEdgeProps, Edge, EdgeProps } from '../../model/dag-types';
2
2
 
3
- export declare function DefaultEdge({ sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, markerEnd, source, target, }: EdgeProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function DefaultEdge({ sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, markerEnd, source, target, data, }: EdgeProps<Edge<DefaultEdgeProps>>): import("react/jsx-runtime").JSX.Element;
@@ -7,5 +7,7 @@ export type ButtonChangeOrientationProps = {
7
7
  edges: Edge[];
8
8
  }) => void;
9
9
  shouldFitView?: boolean;
10
+ nodeHeight?: number;
11
+ nodeWidth?: number;
10
12
  };
11
- export declare const ButtonChangeOrientation: ({ onClick, orientation, shouldFitView, }: ButtonChangeOrientationProps) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const ButtonChangeOrientation: ({ onClick, orientation, shouldFitView, nodeHeight, nodeWidth, }: ButtonChangeOrientationProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,11 @@
1
1
  import { Edge, Node, Position } from '@xyflow/react';
2
2
 
3
- interface GetLayoutedElementsProps {
3
+ export interface GetLayoutedElementsProps {
4
4
  nodes: Node[];
5
5
  edges: Edge[];
6
6
  direction?: 'vertical' | 'horizontal';
7
+ nodeWidth?: number;
8
+ nodeHeight?: number;
7
9
  }
8
10
  export declare const getLayoutedElements: (props: GetLayoutedElementsProps) => {
9
11
  nodes: {
@@ -46,4 +48,3 @@ export declare const getLayoutedElements: (props: GetLayoutedElementsProps) => {
46
48
  }[];
47
49
  edges: Edge[];
48
50
  };
49
- export {};
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ import { FloatButton, FloatButtonProps } from './shared/ui/float-button';
14
14
  import { IconButtonProps } from './shared/ui/icon-button';
15
15
  import { MatrixTypes, SpreadsheetTypes } from './types';
16
16
  import { Position, Connection, DagProps, DefaultNodeDataProps, Edge, EdgePosition, EdgeProps, Node, NodeProps, UseDagProps } from './components/dag/model';
17
+ import { GetLayoutedElementsProps } from './components/dag/utils/get-layout-elements';
17
18
 
18
19
  export declare const CapLink: {
19
20
  Spreadsheet: typeof Spreadsheet;
@@ -40,7 +41,7 @@ export declare const CapLink: {
40
41
  useDag: () => UseDagProps;
41
42
  useGetAdjacentNodes: ({ nodeId, type }: useGetAdjacentNodesProps) => import('@xyflow/react').Node[];
42
43
  AdjacentNodes: typeof AdjacentNodes;
43
- ButtonChangeOrientation: ({ onClick, orientation, shouldFitView, }: ButtonChangeOrientationProps) => import("react/jsx-runtime").JSX.Element;
44
+ ButtonChangeOrientation: ({ onClick, orientation, shouldFitView, nodeHeight, nodeWidth, }: ButtonChangeOrientationProps) => import("react/jsx-runtime").JSX.Element;
44
45
  ButtonZoomIn: () => import("react/jsx-runtime").JSX.Element;
45
46
  ButtonZoomOut: () => import("react/jsx-runtime").JSX.Element;
46
47
  FloatMenu: typeof FloatMenu;
@@ -100,5 +101,46 @@ export declare const CapLink: {
100
101
  }[];
101
102
  }>;
102
103
  };
104
+ getLayoutedElements: (props: GetLayoutedElementsProps) => {
105
+ nodes: {
106
+ targetPosition: import('@xyflow/system').Position;
107
+ sourcePosition: import('@xyflow/system').Position;
108
+ position: {
109
+ x: number;
110
+ y: number;
111
+ };
112
+ id: string;
113
+ data: Record<string, unknown>;
114
+ type?: string | undefined;
115
+ hidden?: boolean | undefined;
116
+ selected?: boolean | undefined;
117
+ dragging?: boolean | undefined;
118
+ draggable?: boolean | undefined;
119
+ selectable?: boolean | undefined;
120
+ connectable?: boolean | undefined;
121
+ deletable?: boolean | undefined;
122
+ dragHandle?: string | undefined;
123
+ width?: number | undefined;
124
+ height?: number | undefined;
125
+ initialWidth?: number | undefined;
126
+ initialHeight?: number | undefined;
127
+ parentId?: string | undefined;
128
+ zIndex?: number | undefined;
129
+ extent?: "parent" | import('@xyflow/system').CoordinateExtent | undefined;
130
+ expandParent?: boolean | undefined;
131
+ ariaLabel?: string | undefined;
132
+ origin?: import('@xyflow/system').NodeOrigin | undefined;
133
+ handles?: import('@xyflow/system').NodeHandle[] | undefined;
134
+ measured?: {
135
+ width?: number | undefined;
136
+ height?: number | undefined;
137
+ } | undefined;
138
+ style?: import('react').CSSProperties | undefined;
139
+ className?: string | undefined;
140
+ resizing?: boolean | undefined;
141
+ focusable?: boolean | undefined;
142
+ }[];
143
+ edges: import('@xyflow/react').Edge[];
144
+ };
103
145
  };
104
- export type { FileUploaderProps, ImageUploaderProps, MatrixTypes, SpreadsheetTypes, SearchNodeProps, IconButtonProps, FloatButtonProps, ContentSplitProps, SidebarProps, useGetAdjacentNodesProps, AdjacentNodesProps, ButtonChangeOrientationProps, FloatMenuProps, Connection, DagProps, DefaultNodeDataProps, Edge, EdgePosition, EdgeProps, Node, NodeProps, UseDagProps, Position, };
146
+ export type { FileUploaderProps, ImageUploaderProps, MatrixTypes, SpreadsheetTypes, SearchNodeProps, IconButtonProps, FloatButtonProps, ContentSplitProps, SidebarProps, useGetAdjacentNodesProps, AdjacentNodesProps, ButtonChangeOrientationProps, FloatMenuProps, Connection, DagProps, DefaultNodeDataProps, Edge, EdgePosition, EdgeProps, Node, NodeProps, UseDagProps, Position, GetLayoutedElementsProps };