@widget-js/mindmap 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/dist/constants/flow-constants.d.ts +14 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +60876 -0
- package/dist/index.umd.js +1313 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/mind-map/algo-node.d.ts +14 -0
- package/dist/mind-map/delete-node-dialog.d.ts +10 -0
- package/dist/mind-map/index.d.ts +16 -0
- package/dist/mind-map/mind-map-toolbar.d.ts +14 -0
- package/dist/mind-map/registry.d.ts +2 -0
- package/dist/mind-map/rename-node-dialog.d.ts +11 -0
- package/dist/mind-map/use-graph-init.d.ts +22 -0
- package/dist/mind-map/use-graph-operations.d.ts +32 -0
- package/dist/mind-map/use-keyboard-shortcuts.d.ts +12 -0
- package/dist/mind-map/utils.d.ts +11 -0
- package/dist/types/MindNode.d.ts +12 -0
- package/dist/ui/button-group.d.ts +12 -0
- package/dist/ui/button.d.ts +11 -0
- package/dist/ui/context-menu.d.ts +26 -0
- package/dist/ui/dialog.d.ts +18 -0
- package/dist/ui/input.d.ts +3 -0
- package/dist/ui/kbd.d.ts +3 -0
- package/dist/ui/separator.d.ts +5 -0
- package/dist/ui/toggle.d.ts +10 -0
- package/package.json +59 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Cell } from '@antv/x6';
|
|
2
|
+
|
|
3
|
+
export interface NodeStatus {
|
|
4
|
+
id: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
checked?: boolean;
|
|
7
|
+
collapsed?: boolean;
|
|
8
|
+
editing?: boolean;
|
|
9
|
+
readonly?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare function AlgoNode(props: {
|
|
12
|
+
node: Cell;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export default AlgoNode;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
interface DeleteNodeDialogProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onOpenChange: (open: boolean) => void;
|
|
6
|
+
nodeName: string;
|
|
7
|
+
onConfirm: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const DeleteNodeDialog: React.FC<DeleteNodeDialogProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MindNode } from '../types/MindNode';
|
|
2
|
+
|
|
3
|
+
interface MindMapProps {
|
|
4
|
+
data: MindNode;
|
|
5
|
+
isDarkMode?: boolean;
|
|
6
|
+
title?: string;
|
|
7
|
+
showCheckboxes?: boolean;
|
|
8
|
+
showGrid?: boolean;
|
|
9
|
+
readonly?: boolean;
|
|
10
|
+
onNodeChange?: (data: MindNode, type: 'create' | 'delete' | 'update' | 'check' | 'collapse' | 'undo') => void;
|
|
11
|
+
}
|
|
12
|
+
export interface MindMapRef {
|
|
13
|
+
exportGraph: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const MindMap: import('react').ForwardRefExoticComponent<MindMapProps & import('react').RefAttributes<MindMapRef>>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
interface MindMapToolbarProps {
|
|
4
|
+
zoomIn: () => void;
|
|
5
|
+
zoomOut: () => void;
|
|
6
|
+
zoomToOne: () => void;
|
|
7
|
+
exportGraph: () => void;
|
|
8
|
+
showCheckboxes: boolean;
|
|
9
|
+
onToggleCheckboxes: (checked: boolean) => void;
|
|
10
|
+
showGrid: boolean;
|
|
11
|
+
onToggleGrid: (checked: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const MindMapToolbar: React.FC<MindMapToolbarProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
interface RenameNodeDialogProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onOpenChange: (open: boolean) => void;
|
|
6
|
+
value: string;
|
|
7
|
+
onChange: (value: string) => void;
|
|
8
|
+
onConfirm: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const RenameNodeDialog: React.FC<RenameNodeDialogProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MindNode } from '../types/MindNode';
|
|
2
|
+
import { Graph } from '@antv/x6';
|
|
3
|
+
|
|
4
|
+
interface UseGraphInitProps {
|
|
5
|
+
containerRef: React.RefObject<HTMLDivElement>;
|
|
6
|
+
graphRef: React.RefObject<Graph | null>;
|
|
7
|
+
treeDataRef: React.RefObject<any>;
|
|
8
|
+
renderRef: React.RefObject<(() => void) | null>;
|
|
9
|
+
selectedNodeIdRef: React.RefObject<string | null>;
|
|
10
|
+
themeRef: React.RefObject<'light' | 'dark'>;
|
|
11
|
+
data: MindNode;
|
|
12
|
+
isDarkMode: boolean;
|
|
13
|
+
showCheckboxes: boolean;
|
|
14
|
+
showGrid: boolean;
|
|
15
|
+
readonly: boolean;
|
|
16
|
+
onNodeChange?: (data: MindNode, type: 'create' | 'delete' | 'update' | 'check' | 'collapse' | 'undo') => void;
|
|
17
|
+
openCreateDialog: (parentId: string) => void;
|
|
18
|
+
openDeleteDialog: (nodeId: string) => void;
|
|
19
|
+
openRenameDialog: (nodeId: string) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare function useGraphInit({ containerRef, graphRef, treeDataRef, renderRef, selectedNodeIdRef, themeRef, data, isDarkMode, showCheckboxes, showGrid, readonly, onNodeChange, openCreateDialog, openDeleteDialog, openRenameDialog, }: UseGraphInitProps): void;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Graph } from '@antv/x6';
|
|
2
|
+
import { MindNode } from '../types/MindNode';
|
|
3
|
+
|
|
4
|
+
interface UseGraphOperationsProps {
|
|
5
|
+
graphRef: React.RefObject<Graph | null>;
|
|
6
|
+
treeDataRef: React.RefObject<any>;
|
|
7
|
+
renderRef: React.RefObject<(() => void) | null>;
|
|
8
|
+
selectedNodeIdRef: React.RefObject<string | null>;
|
|
9
|
+
onNodeChange?: (data: MindNode, type: 'create' | 'delete' | 'update' | 'check' | 'collapse' | 'undo') => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function useGraphOperations({ graphRef, treeDataRef, renderRef, selectedNodeIdRef, onNodeChange, }: UseGraphOperationsProps): {
|
|
12
|
+
renameOpen: boolean;
|
|
13
|
+
setRenameOpen: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
14
|
+
renameNodeId: string | null;
|
|
15
|
+
setRenameNodeId: import('react').Dispatch<import('react').SetStateAction<string | null>>;
|
|
16
|
+
renameValue: string;
|
|
17
|
+
setRenameValue: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
18
|
+
deleteOpen: boolean;
|
|
19
|
+
setDeleteOpen: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
20
|
+
deleteNodeId: string | null;
|
|
21
|
+
setDeleteNodeId: import('react').Dispatch<import('react').SetStateAction<string | null>>;
|
|
22
|
+
deleteNodeName: string;
|
|
23
|
+
setDeleteNodeName: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
24
|
+
openRenameDialog: (nodeId: string) => void;
|
|
25
|
+
openCreateDialog: (parentId: string) => void;
|
|
26
|
+
openDeleteDialog: (nodeId: string) => void;
|
|
27
|
+
applyRename: () => void;
|
|
28
|
+
applyDelete: () => void;
|
|
29
|
+
applyCreateChild: (parentId: string, nodeValue: string) => void;
|
|
30
|
+
applyCreateSibling: (nodeId: string, nodeValue: string) => void;
|
|
31
|
+
};
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
interface UseKeyboardShortcutsProps {
|
|
4
|
+
renameOpen: boolean;
|
|
5
|
+
readonly: boolean;
|
|
6
|
+
selectedNodeIdRef: React.MutableRefObject<string | null>;
|
|
7
|
+
applyCreateSibling: (id: string, name: string) => void;
|
|
8
|
+
applyCreateChild: (id: string, name: string) => void;
|
|
9
|
+
openDeleteDialog: (id: string) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function useKeyboardShortcuts({ renameOpen, readonly, selectedNodeIdRef, applyCreateSibling, applyCreateChild, openDeleteDialog, }: UseKeyboardShortcutsProps): void;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MindNode } from '../types/MindNode';
|
|
2
|
+
|
|
3
|
+
export declare function getMindNodeData(node: any): MindNode;
|
|
4
|
+
export declare function findNodeInTree(root: any, id: string): any;
|
|
5
|
+
export declare function findNodeWithParent(root: any, id: string, parent?: any): {
|
|
6
|
+
node: any;
|
|
7
|
+
parent: any;
|
|
8
|
+
index: number;
|
|
9
|
+
} | null;
|
|
10
|
+
export declare function transformData(data: any): any;
|
|
11
|
+
export declare function getVisibleData(node: any): any;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { Separator } from './separator';
|
|
3
|
+
|
|
4
|
+
declare const buttonGroupVariants: (props?: ({
|
|
5
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
6
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
|
+
declare function ButtonGroup({ className, orientation, ...props }: React.ComponentProps<'div'> & VariantProps<typeof buttonGroupVariants>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function ButtonGroupText({ className, asChild, ...props }: React.ComponentProps<'div'> & {
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare function ButtonGroupSeparator({ className, orientation, ...props }: React.ComponentProps<typeof Separator>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
declare const buttonVariants: (props?: ({
|
|
5
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
6
|
+
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
7
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
8
|
+
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ContextMenu as ContextMenuPrimitive } from 'radix-ui';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
declare function ContextMenu({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function ContextMenuTrigger({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function ContextMenuGroup({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Group>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function ContextMenuPortal({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function ContextMenuSub({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Sub>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare function ContextMenuRadioGroup({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function ContextMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & {
|
|
11
|
+
inset?: boolean;
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function ContextMenuSubContent({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function ContextMenuContent({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare function ContextMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
|
|
16
|
+
inset?: boolean;
|
|
17
|
+
variant?: 'default' | 'destructive';
|
|
18
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare function ContextMenuCheckboxItem({ className, children, checked, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare function ContextMenuRadioItem({ className, children, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem>): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
declare function ContextMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Label> & {
|
|
22
|
+
inset?: boolean;
|
|
23
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare function ContextMenuSeparator({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
declare function ContextMenuShortcut({ className, ...props }: React.ComponentProps<'span'>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Dialog as DialogPrimitive } from 'radix-ui';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
10
|
+
showCloseButton?: boolean;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare function DialogHeader({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function DialogFooter({ className, showCloseButton, children, ...props }: React.ComponentProps<'div'> & {
|
|
14
|
+
showCloseButton?: boolean;
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
package/dist/ui/kbd.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Separator as SeparatorPrimitive } from 'radix-ui';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
declare function Separator({ className, orientation, decorative, ...props }: React.ComponentProps<typeof SeparatorPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export { Separator };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { Toggle as TogglePrimitive } from 'radix-ui';
|
|
3
|
+
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
declare const toggleVariants: (props?: ({
|
|
6
|
+
variant?: "default" | "outline" | null | undefined;
|
|
7
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
8
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
9
|
+
declare function Toggle({ className, variant, size, ...props }: React.ComponentProps<typeof TogglePrimitive.Root> & VariantProps<typeof toggleVariants>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export { Toggle, toggleVariants };
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@widget-js/mindmap",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"author": {
|
|
5
|
+
"name": "Neo Fu",
|
|
6
|
+
"email": "rtugeek@gmail.com"
|
|
7
|
+
},
|
|
8
|
+
"description": "A React MindMap component using AntV X6",
|
|
9
|
+
"main": "./dist/index.umd.js",
|
|
10
|
+
"module": "./dist/index.es.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./dist/index.es.js",
|
|
18
|
+
"require": "./dist/index.umd.js",
|
|
19
|
+
"types": "./dist/index.d.ts"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"react": "^19.0.0",
|
|
27
|
+
"react-dom": "^19.0.0",
|
|
28
|
+
"tailwindcss": "^3.0.0 || ^4.0.0"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@antv/hierarchy": "^0.7.1",
|
|
32
|
+
"@antv/x6": "^3.1.6",
|
|
33
|
+
"@antv/x6-react-shape": "^3.0.1",
|
|
34
|
+
"class-variance-authority": "^0.7.1",
|
|
35
|
+
"clsx": "^2.1.1",
|
|
36
|
+
"insert-css": "^2.0.0",
|
|
37
|
+
"lucide-react": "^0.563.0",
|
|
38
|
+
"radix-ui": "^1.4.3",
|
|
39
|
+
"sonner": "^2.0.7",
|
|
40
|
+
"tailwind-merge": "^3.4.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^20.0.0",
|
|
44
|
+
"@types/react": "^19.0.0",
|
|
45
|
+
"@types/react-dom": "^19.0.0",
|
|
46
|
+
"@vitejs/plugin-react": "^4.2.0",
|
|
47
|
+
"autoprefixer": "^10.4.19",
|
|
48
|
+
"postcss": "^8.4.38",
|
|
49
|
+
"rollup-plugin-visualizer": "^6.0.5",
|
|
50
|
+
"tailwindcss": "^4.1.18",
|
|
51
|
+
"typescript": "^5.0.0",
|
|
52
|
+
"vite": "^5.0.0",
|
|
53
|
+
"vite-plugin-dts": "^3.0.0"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "vite build",
|
|
57
|
+
"lint": "eslint ."
|
|
58
|
+
}
|
|
59
|
+
}
|