@bemedev/mind-flow 0.0.1
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/lib/helpers/createContext.d.ts +21 -0
- package/lib/helpers/createContext.d.ts.map +1 -0
- package/lib/index.cjs.js +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.es.js +859 -0
- package/lib/output.css +2 -0
- package/lib/server.cjs.js +1058 -0
- package/lib/server.es.js +1056 -0
- package/lib/services/main.machine.d.ts +1198 -0
- package/lib/services/main.machine.d.ts.map +1 -0
- package/lib/services/main.typings.d.ts +68 -0
- package/lib/services/main.typings.d.ts.map +1 -0
- package/lib/ui/Flow.d.ts +13 -0
- package/lib/ui/Flow.d.ts.map +1 -0
- package/lib/ui/components/Bounds.d.ts +10 -0
- package/lib/ui/components/Bounds.d.ts.map +1 -0
- package/lib/ui/components/EdgeComponent.d.ts +20 -0
- package/lib/ui/components/EdgeComponent.d.ts.map +1 -0
- package/lib/ui/components/EdgesBoard.d.ts +9 -0
- package/lib/ui/components/EdgesBoard.d.ts.map +1 -0
- package/lib/ui/components/FlowChart.context.d.ts +1228 -0
- package/lib/ui/components/FlowChart.context.d.ts.map +1 -0
- package/lib/ui/components/FlowChart.d.ts +63 -0
- package/lib/ui/components/FlowChart.d.ts.map +1 -0
- package/lib/ui/components/FlowChart.data.d.ts +67 -0
- package/lib/ui/components/FlowChart.data.d.ts.map +1 -0
- package/lib/ui/components/NodeComponent.d.ts +34 -0
- package/lib/ui/components/NodeComponent.d.ts.map +1 -0
- package/lib/ui/components/NodesBoard.d.ts +9 -0
- package/lib/ui/components/NodesBoard.d.ts.map +1 -0
- package/lib/ui/components/classes.d.ts +6 -0
- package/lib/ui/components/classes.d.ts.map +1 -0
- package/package.json +146 -0
- package/src/README.md +36 -0
- package/src/helpers/createContext.ts +37 -0
- package/src/index.ts +3 -0
- package/src/input.css +15 -0
- package/src/services/main.machine.ts +247 -0
- package/src/services/main.typings.ts +50 -0
- package/src/ui/Flow.tsx +18 -0
- package/src/ui/components/Bounds.tsx +87 -0
- package/src/ui/components/EdgeComponent.tsx +106 -0
- package/src/ui/components/EdgesBoard.tsx +56 -0
- package/src/ui/components/FlowChart.context.ts +373 -0
- package/src/ui/components/FlowChart.data.ts +89 -0
- package/src/ui/components/FlowChart.tsx +112 -0
- package/src/ui/components/NodeComponent.tsx +288 -0
- package/src/ui/components/NodesBoard.tsx +298 -0
- package/src/ui/components/classes.ts +85 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowChart.context.d.ts","sourceRoot":"","sources":["../../../src/ui/components/FlowChart.context.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAU,MAAM,6BAA6B,CAAC;AAQjE,4EAA4E;AAC5E,KAAK,UAAU,GAAG;IAChB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,MAAM,EAAE,KAAK,CAAC;IACd,gEAAgE;IAChE,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,qEAAqE;IACrE,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,oEAAoE;IACpE,WAAW,CAAC,EAAE,KAAK,CAAC;CACrB,CAAC;AAEF,uEAAuE;AACvE,MAAM,MAAM,IAAI,GAAG;IACjB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,2BAA2B;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,2BAA2B;IAC3B,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAWF;;;GAGG;AACH,eAAO,MAAO,QAAQ,sCAAE,OAAO;;;;sCAUK,MAAM,WAAW,MAAM,KAAG,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiTlE,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { inferT } from '@bemedev/app/typings';
|
|
2
|
+
import { Component } from 'solid-js';
|
|
3
|
+
import { edgeJSON, nodeJSON } from '../../services/main.typings';
|
|
4
|
+
/**
|
|
5
|
+
* Serialized node properties type inferred from schema
|
|
6
|
+
* {@linkcode nodeJSON}.
|
|
7
|
+
*/
|
|
8
|
+
export type NodeProps = inferT<typeof nodeJSON>;
|
|
9
|
+
/**
|
|
10
|
+
* Serialized edge properties type inferred from schema
|
|
11
|
+
* {@linkcode edgeJSON}.
|
|
12
|
+
*/
|
|
13
|
+
export type EdgeProps = inferT<typeof edgeJSON>;
|
|
14
|
+
/**
|
|
15
|
+
* Configuration options and callback handlers for the {@linkcode FlowChart}
|
|
16
|
+
* component.
|
|
17
|
+
*/
|
|
18
|
+
export type FlowProps = {
|
|
19
|
+
/** Initial flowchart state configuration with nodes and edges. */
|
|
20
|
+
config?: {
|
|
21
|
+
nodes?: (NodeProps & {
|
|
22
|
+
id: string;
|
|
23
|
+
})[];
|
|
24
|
+
edges?: (EdgeProps & {
|
|
25
|
+
id: string;
|
|
26
|
+
})[];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Callback triggered when a new node is created.
|
|
30
|
+
*
|
|
31
|
+
* @param node - The created node object of type {@linkcode NodeProps}.
|
|
32
|
+
*/
|
|
33
|
+
onNodeAdded?: (node: NodeProps) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Callback triggered when a node is deleted.
|
|
36
|
+
*
|
|
37
|
+
* @param nodeId - The identifier of the deleted node.
|
|
38
|
+
*/
|
|
39
|
+
onNodeDeleted?: (nodeId: string) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Callback triggered when an edge is created.
|
|
42
|
+
*
|
|
43
|
+
* @param edge - The created edge object of type {@linkcode EdgeProps}.
|
|
44
|
+
*/
|
|
45
|
+
onEdgeAdded?: (edge: EdgeProps) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Callback triggered when an edge is deleted.
|
|
48
|
+
*
|
|
49
|
+
* @param edgeId - The identifier of the deleted edge.
|
|
50
|
+
*/
|
|
51
|
+
onEdgeDeleted?: (edgeId: string) => void;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Flowchart board canvas component that renders interactive nodes, edges,
|
|
55
|
+
* pan/zoom, and toolbar controls.
|
|
56
|
+
*
|
|
57
|
+
* @param props - Flowchart configuration and event handlers of type
|
|
58
|
+
* {@linkcode FlowProps}.
|
|
59
|
+
*
|
|
60
|
+
* @returns The rendered Solid component.
|
|
61
|
+
*/
|
|
62
|
+
export declare const FlowChart: Component<FlowProps>;
|
|
63
|
+
//# sourceMappingURL=FlowChart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowChart.d.ts","sourceRoot":"","sources":["../../../src/ui/components/FlowChart.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAsB,MAAM,UAAU,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAKtE;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,kEAAkE;IAClE,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,CAAC,SAAS,GAAG;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC,EAAE,CAAC;QACvC,KAAK,CAAC,EAAE,CAAC,SAAS,GAAG;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC,EAAE,CAAC;KACxC,CAAC;IACF;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACxC;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACxC;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C,CAAC;AAIF;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,EAAE,SAAS,CAAC,SAAS,CA6C1C,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { NodeProps } from './FlowChart';
|
|
2
|
+
/**
|
|
3
|
+
* Horizontal gap in pixels between a parent node and newly created child
|
|
4
|
+
* node.
|
|
5
|
+
*/
|
|
6
|
+
export declare const PARENT_CHILD_GAP_WIDTH = 100;
|
|
7
|
+
/** Border width in pixels for a node container. */
|
|
8
|
+
export declare const NODE_BORDER_WIDTH = 1.5;
|
|
9
|
+
/** Diameter in pixels of a node connection handle. */
|
|
10
|
+
export declare const HANDLE_SIZE = 12;
|
|
11
|
+
/** Radius in pixels of a node connection handle. */
|
|
12
|
+
export declare const HANDLE_RADIUS: number;
|
|
13
|
+
/** Top margin in pixels for positioning connection handles. */
|
|
14
|
+
export declare const HANDLE_MARGIN_TOP = 12;
|
|
15
|
+
/** Horizontal container offset in pixels for handle placement. */
|
|
16
|
+
export declare const HANDLE_CONTAINER_OFFSET_X = 18;
|
|
17
|
+
/** Y-axis center coordinate in pixels of a handle. */
|
|
18
|
+
export declare const HANDLE_CENTER_Y: number;
|
|
19
|
+
/** X-axis center offset in pixels from the node container edge. */
|
|
20
|
+
export declare const HANDLE_CENTER_X_OFFSET: number;
|
|
21
|
+
/** Default X offset in pixels for input connection handles. */
|
|
22
|
+
export declare const DEFAULT_INPUT_OFFSET_X: number;
|
|
23
|
+
/** Default Y offset in pixels for input connection handles. */
|
|
24
|
+
export declare const DEFAULT_INPUT_OFFSET_Y: number;
|
|
25
|
+
/** Default 2D offset coordinates for input connection handles. */
|
|
26
|
+
export declare const DEFAULT_INPUT_OFFSET: {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Dimensions representing width and height of the flow chart container
|
|
32
|
+
* canvas.
|
|
33
|
+
*/
|
|
34
|
+
export declare const CONTAINER_DIMENSIONS: {
|
|
35
|
+
WIDTH: number;
|
|
36
|
+
HEIGHT: number;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Computes default output handle offset coordinates given a node width.
|
|
40
|
+
*
|
|
41
|
+
* @param width - Node width in pixels, defaults to `0`.
|
|
42
|
+
*
|
|
43
|
+
* @returns 2D offset coordinates for the output handle.
|
|
44
|
+
*/
|
|
45
|
+
export declare const getDefaultOutputOffset: (width?: number) => {
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
};
|
|
49
|
+
/** Top offset in pixels for node action toolbars. */
|
|
50
|
+
export declare const TOOLBAR_TOP_OFFSET = 30;
|
|
51
|
+
/** Safety buffer in pixels applied above the toolbar. */
|
|
52
|
+
export declare const TOOLBAR_BUFFER = 5;
|
|
53
|
+
/**
|
|
54
|
+
* Boundary padding constraints for node dragging and positioning within
|
|
55
|
+
* the viewport.
|
|
56
|
+
*/
|
|
57
|
+
export declare const BOUNDS_CONSTRAINTS: {
|
|
58
|
+
horizontal: number;
|
|
59
|
+
vertical: number;
|
|
60
|
+
};
|
|
61
|
+
/** Multiplier factor used to compute canvas virtual scroll dimensions. */
|
|
62
|
+
export declare const CANVAS_FACTOR = 5;
|
|
63
|
+
/** Default node items provided when no initial configuration is given. */
|
|
64
|
+
export declare const DEFAULT_NODES: (NodeProps & {
|
|
65
|
+
id: string;
|
|
66
|
+
})[];
|
|
67
|
+
//# sourceMappingURL=FlowChart.data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowChart.data.d.ts","sourceRoot":"","sources":["../../../src/ui/components/FlowChart.data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAG1C,mDAAmD;AACnD,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,sDAAsD;AACtD,eAAO,MAAM,WAAW,KAAK,CAAC;AAE9B,oDAAoD;AACpD,eAAO,MAAM,aAAa,QAAkB,CAAC;AAE7C,+DAA+D;AAC/D,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,kEAAkE;AAClE,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAE5C,sDAAsD;AACtD,eAAO,MAAM,eAAe,QAAoC,CAAC;AAEjE,mEAAmE;AACnE,eAAO,MAAM,sBAAsB,QAC4B,CAAC;AAEhE,+DAA+D;AAC/D,eAAO,MAAM,sBAAsB,QAA0B,CAAC;AAE9D,+DAA+D;AAC/D,eAAO,MAAM,sBAAsB,QAAkB,CAAC;AAEtD,kEAAkE;AAClE,eAAO,MAAM,oBAAoB;;;CAGhC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;CAAgC,CAAC;AAElE;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GAAI,cAAS;;;CAG9C,CAAC;AAEH,qDAAqD;AACrD,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,yDAAyD;AACzD,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;CAG9B,CAAC;AAEF,0EAA0E;AAC1E,eAAO,MAAM,aAAa,IAAI,CAAC;AAG/B,0EAA0E;AAC1E,eAAO,MAAM,aAAa,EAAE,CAAC,SAAS,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,EAOvD,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Component } from 'solid-js';
|
|
2
|
+
declare module 'solid-js' {
|
|
3
|
+
namespace JSX {
|
|
4
|
+
interface Directives {
|
|
5
|
+
draggable: any;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/** Properties for rendering an individual flowchart node component. */
|
|
10
|
+
type Props = {
|
|
11
|
+
/** Unique identifier of the node. */
|
|
12
|
+
id: string;
|
|
13
|
+
/** Horizontal position of the node in board coordinates. */
|
|
14
|
+
x: number;
|
|
15
|
+
/** Vertical position of the node in board coordinates. */
|
|
16
|
+
y: number;
|
|
17
|
+
/** Optional header label for the node. */
|
|
18
|
+
label?: string;
|
|
19
|
+
/** Body content text of the node. */
|
|
20
|
+
content: string;
|
|
21
|
+
/** Whether the node has an input handle. */
|
|
22
|
+
input: boolean;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Interactive flowchart node component supporting dragging, selection,
|
|
26
|
+
* handle connections, and child/sibling creation.
|
|
27
|
+
*
|
|
28
|
+
* @param props - Node rendering properties of type {@linkcode Props}.
|
|
29
|
+
*
|
|
30
|
+
* @returns The rendered Solid component.
|
|
31
|
+
*/
|
|
32
|
+
export declare const NodeComponent: Component<Props>;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=NodeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeComponent.d.ts","sourceRoot":"","sources":["../../../src/ui/components/NodeComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAoC,MAAM,UAAU,CAAC;AAWvE,OAAO,QAAQ,UAAU,CAAC;IACxB,UAAU,GAAG,CAAC;QACZ,UAAU,UAAU;YAClB,SAAS,EAAE,GAAG,CAAC;SAChB;KACF;CACF;AAED,uEAAuE;AACvE,KAAK,KAAK,GAAG;IACX,qCAAqC;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,4DAA4D;IAC5D,CAAC,EAAE,MAAM,CAAC;IACV,0DAA0D;IAC1D,CAAC,EAAE,MAAM,CAAC;IACV,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,CAAC,KAAK,CAiP1C,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Component } from 'solid-js';
|
|
2
|
+
/**
|
|
3
|
+
* Interactive board component containing the drag-drop viewport, zoom
|
|
4
|
+
* controls, panning gestures, and rendered nodes/edges.
|
|
5
|
+
*
|
|
6
|
+
* @returns The rendered Solid component.
|
|
7
|
+
*/
|
|
8
|
+
export declare const NodesBoard: Component;
|
|
9
|
+
//# sourceMappingURL=NodesBoard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodesBoard.d.ts","sourceRoot":"","sources":["../../../src/ui/components/NodesBoard.tsx"],"names":[],"mappings":"AAOA,OAAO,EACL,SAAS,EAOV,MAAM,UAAU,CAAC;AAOlB;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,SA6QxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classes.d.ts","sourceRoot":"","sources":["../../../src/ui/components/classes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,OAAO,UAgFnB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bemedev/mind-flow",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Flow Chart UI library for Solid.js applications",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"diagram",
|
|
7
|
+
"flow",
|
|
8
|
+
"flowchart",
|
|
9
|
+
"solid-js",
|
|
10
|
+
"ui-library"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"author": {
|
|
14
|
+
"name": "chlbri",
|
|
15
|
+
"email": "bri_lvi@icloud.com",
|
|
16
|
+
"url": "https://bemedev.vercel.app"
|
|
17
|
+
},
|
|
18
|
+
"maintainers": [
|
|
19
|
+
{
|
|
20
|
+
"email": "bri_lvi@icloud.com",
|
|
21
|
+
"name": "chlbri",
|
|
22
|
+
"url": "https://bemedev.vercel.app"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./lib/index.d.ts",
|
|
28
|
+
"node": {
|
|
29
|
+
"import": "./lib/server.es.js",
|
|
30
|
+
"require": "./lib/server.cjs.js"
|
|
31
|
+
},
|
|
32
|
+
"browser": {
|
|
33
|
+
"import": "./lib/index.es.js",
|
|
34
|
+
"require": "./lib/index.cjs.js"
|
|
35
|
+
},
|
|
36
|
+
"import": "./lib/index.es.js",
|
|
37
|
+
"require": "./lib/index.cjs.js"
|
|
38
|
+
},
|
|
39
|
+
"./style.css": "./lib/output.css"
|
|
40
|
+
},
|
|
41
|
+
"contributors": [
|
|
42
|
+
{
|
|
43
|
+
"email": "bri_lvi@icloud.com",
|
|
44
|
+
"name": "chlbri",
|
|
45
|
+
"url": "https://bemedev.vercel.app"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "https://github.com/chlbri/mind-app"
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"lib",
|
|
54
|
+
"src"
|
|
55
|
+
],
|
|
56
|
+
"type": "module",
|
|
57
|
+
"main": "lib/index.es.js",
|
|
58
|
+
"module": "lib/index.es.js",
|
|
59
|
+
"types": "lib/index.d.ts",
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"dequal": "^2.0.3",
|
|
62
|
+
"nanoid": "^6.0.1"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@bemedev/app": "^1.11.0",
|
|
66
|
+
"@bemedev/app-cli": "^1.11.0",
|
|
67
|
+
"@bemedev/app-solidjs": "^1.11.0",
|
|
68
|
+
"@bemedev/fsf": "^1.0.1",
|
|
69
|
+
"@bemedev/rollup-config": "^0.2.2",
|
|
70
|
+
"@bemedev/vitest-alias": "^0.0.3",
|
|
71
|
+
"@bemedev/vitest-exclude": "^0.1.1",
|
|
72
|
+
"@bemedev/vitest-extended": "^1.5.3",
|
|
73
|
+
"@rollup/plugin-babel": "^7.1.0",
|
|
74
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
75
|
+
"@size-limit/file": "^13.0.3",
|
|
76
|
+
"@tailwindcss/cli": "^4.3.3",
|
|
77
|
+
"@tailwindcss/vite": "^4.3.3",
|
|
78
|
+
"@types/node": "^26.2.0",
|
|
79
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
80
|
+
"babel-preset-solid": "^1.9.15",
|
|
81
|
+
"glob": "^13.0.6",
|
|
82
|
+
"globals": "^17.11.0",
|
|
83
|
+
"husky": "^9.1.7",
|
|
84
|
+
"onchange": "^7.1.0",
|
|
85
|
+
"oxfmt": "^0.64.0",
|
|
86
|
+
"oxlint": "^1.79.0",
|
|
87
|
+
"pretty-quick": "^4.2.2",
|
|
88
|
+
"rimraf": "^6.1.3",
|
|
89
|
+
"rolldown": "^1.2.4",
|
|
90
|
+
"rollup": "^4.62.4",
|
|
91
|
+
"rollup-preset-solid": "^3.0.0",
|
|
92
|
+
"size-limit": "^13.0.3",
|
|
93
|
+
"solid-js": "^1.9.15",
|
|
94
|
+
"tailwindcss": "^4.3.3",
|
|
95
|
+
"tslib": "^2.8.1",
|
|
96
|
+
"typescript": "^7.0.2",
|
|
97
|
+
"vite": "^8.2.1",
|
|
98
|
+
"vite-plugin-dts": "^5.0.3",
|
|
99
|
+
"vite-plugin-solid": "^2.11.14",
|
|
100
|
+
"vite-tsconfig-paths": "^6.1.1",
|
|
101
|
+
"vitest": "^4.1.11"
|
|
102
|
+
},
|
|
103
|
+
"peerDependencies": {
|
|
104
|
+
"@bemedev/app": "^1.11.0",
|
|
105
|
+
"@bemedev/app-solidjs": "^1.11.0",
|
|
106
|
+
"@thisbeyond/solid-dnd": "^0.7.5",
|
|
107
|
+
"solid-js": "^1.9.15"
|
|
108
|
+
},
|
|
109
|
+
"size-limit": [
|
|
110
|
+
{
|
|
111
|
+
"path": "lib/index.es.js",
|
|
112
|
+
"limit": "50 KB"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"path": "lib/index.cjs.js",
|
|
116
|
+
"limit": "50 KB"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"engines": {
|
|
120
|
+
"node": ">=22"
|
|
121
|
+
},
|
|
122
|
+
"scripts": {
|
|
123
|
+
"build": "pnpm rm:lib && pnpm run build:server && pnpm run build:client && pnpm run build:css",
|
|
124
|
+
"build:client": "vite build",
|
|
125
|
+
"build:server": "vite build --mode server",
|
|
126
|
+
"build:css": "pnpx @tailwindcss/cli -i ./input.css -o ../lib/output.css --minify --cwd ./src",
|
|
127
|
+
"build:css:watch": "pnpm run build:css --watch",
|
|
128
|
+
"pretest": "pnpm run build",
|
|
129
|
+
"posttest": "pnpm run size",
|
|
130
|
+
"_ci": "pnpm run lint && pnpm run test",
|
|
131
|
+
"ci": "CI_START=$(date +%s) && pnpm run _ci && pnpm run p-q && echo \"\n✅ CI takes $(($(date +%s) - CI_START))s\n\"",
|
|
132
|
+
"fmt": "oxfmt",
|
|
133
|
+
"fmt:check": "oxfmt --check",
|
|
134
|
+
"_lint": "oxlint",
|
|
135
|
+
"lint:fix": "oxlint --fix",
|
|
136
|
+
"lint": "pnpm run fmt && pnpm run lint:fix",
|
|
137
|
+
"p-q": "pretty-quick",
|
|
138
|
+
"rm": "pnpx rimraf ./node_modules ./pnpm-lock.yaml",
|
|
139
|
+
"rm:lib": "pnpx rimraf -- lib",
|
|
140
|
+
"size": "size-limit",
|
|
141
|
+
"test": "pnpm run test:coverage --no-coverage",
|
|
142
|
+
"test:only": "pnpm run test:coverage --no-coverage",
|
|
143
|
+
"test:coverage": "vitest run --passWithNoTests",
|
|
144
|
+
"test:watch": "vitest"
|
|
145
|
+
}
|
|
146
|
+
}
|
package/src/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Flow Chart UI Library
|
|
2
|
+
|
|
3
|
+
This is a self-contained UI library for creating interactive flow charts in
|
|
4
|
+
Solid.js applications.
|
|
5
|
+
|
|
6
|
+
## Structure
|
|
7
|
+
|
|
8
|
+
- `services/` - State management and business logic
|
|
9
|
+
- `ui/components/` - Solid.js components for the flow chart
|
|
10
|
+
- `helpers/` - Utility functions
|
|
11
|
+
- `index.ts` - Public API exports
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Import the library components from `~/`:
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { FlowChart, Provider } from '~/';
|
|
19
|
+
|
|
20
|
+
export const MyComponent = () => {
|
|
21
|
+
return (
|
|
22
|
+
<Provider>
|
|
23
|
+
<FlowChart />
|
|
24
|
+
</Provider>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Exports
|
|
30
|
+
|
|
31
|
+
- `FlowChart` - Main flow chart component
|
|
32
|
+
- `Provider` - Context provider for flow chart state
|
|
33
|
+
- `useFlow` - Hook to access flow chart context
|
|
34
|
+
- `NodeProps` - Type definition for node properties
|
|
35
|
+
- `EdgeProps` - Type definition for edge properties
|
|
36
|
+
- `Edge` - Type definition for edge data
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext as createSolidContext,
|
|
3
|
+
useContext,
|
|
4
|
+
type ParentComponent,
|
|
5
|
+
} from 'solid-js';
|
|
6
|
+
|
|
7
|
+
/** Context options type extracted from Solid's `createContext`. */
|
|
8
|
+
type Options = Parameters<typeof createSolidContext>[1];
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Creates a Solid context provider component and a custom hook to consume
|
|
12
|
+
* it.
|
|
13
|
+
*
|
|
14
|
+
* @template T - The type of the context value.
|
|
15
|
+
*
|
|
16
|
+
* @param context - Factory function returning a non-nullable context value
|
|
17
|
+
* of type `NonNullable<T>`.
|
|
18
|
+
* @param options - Optional context configuration of type
|
|
19
|
+
* {@linkcode Options}.
|
|
20
|
+
*
|
|
21
|
+
* @returns A tuple containing the Provider component of type
|
|
22
|
+
* {@linkcode ParentComponent}, the accessor hook, and the Solid context
|
|
23
|
+
* object.
|
|
24
|
+
*/
|
|
25
|
+
export const createContext = <const T>(
|
|
26
|
+
context: () => NonNullable<T>,
|
|
27
|
+
options?: Options,
|
|
28
|
+
) => {
|
|
29
|
+
const _context = createSolidContext(context(), options);
|
|
30
|
+
|
|
31
|
+
const Provider: ParentComponent = ({ children }) =>
|
|
32
|
+
_context.Provider({ value: _context.defaultValue, children });
|
|
33
|
+
|
|
34
|
+
const _useContext = () => useContext(_context);
|
|
35
|
+
|
|
36
|
+
return [Provider, _useContext, _context] as const;
|
|
37
|
+
};
|
package/src/index.ts
ADDED
package/src/input.css
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@import 'tailwindcss';
|
|
2
|
+
|
|
3
|
+
@custom-variant dark (&:is(.dark *));
|
|
4
|
+
|
|
5
|
+
@utility no-scrollbar {
|
|
6
|
+
&::-webkit-scrollbar {
|
|
7
|
+
display: none;
|
|
8
|
+
}
|
|
9
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
10
|
+
scrollbar-width: none; /* Firefox */
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@utility pointer-events-all {
|
|
14
|
+
pointer-events: all;
|
|
15
|
+
}
|