v-nuxt-ui 0.1.36 → 0.2.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.
Files changed (72) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +1 -0
  3. package/dist/runtime/components/Watermark.d.vue.ts +3 -3
  4. package/dist/runtime/components/Watermark.vue.d.ts +3 -3
  5. package/dist/runtime/components/button/CircleColor.d.vue.ts +17 -0
  6. package/dist/runtime/components/button/CircleColor.vue +37 -0
  7. package/dist/runtime/components/button/CircleColor.vue.d.ts +17 -0
  8. package/dist/runtime/components/flow/FlowEdge.client.vue +170 -41
  9. package/dist/runtime/components/flow/FlowEditor.client.d.vue.ts +51 -0
  10. package/dist/runtime/components/flow/FlowEditor.client.vue +294 -0
  11. package/dist/runtime/components/flow/FlowEditor.client.vue.d.ts +51 -0
  12. package/dist/runtime/components/flow/FlowNode.client.d.vue.ts +13 -2
  13. package/dist/runtime/components/flow/FlowNode.client.vue +44 -48
  14. package/dist/runtime/components/flow/FlowNode.client.vue.d.ts +13 -2
  15. package/dist/runtime/components/flow/FlowToolbar.d.vue.ts +41 -5
  16. package/dist/runtime/components/flow/FlowToolbar.vue +554 -88
  17. package/dist/runtime/components/flow/FlowToolbar.vue.d.ts +41 -5
  18. package/dist/runtime/components/flow/FlowToolbarItemWrapper.d.vue.ts +17 -0
  19. package/dist/runtime/components/flow/FlowToolbarItemWrapper.vue +16 -0
  20. package/dist/runtime/components/flow/FlowToolbarItemWrapper.vue.d.ts +17 -0
  21. package/dist/runtime/components/sys/flow/CreateModal.d.vue.ts +13 -0
  22. package/dist/runtime/components/sys/flow/CreateModal.vue +32 -0
  23. package/dist/runtime/components/sys/flow/CreateModal.vue.d.ts +13 -0
  24. package/dist/runtime/components/sys/flow/EditNodeModal.d.vue.ts +13 -0
  25. package/dist/runtime/components/sys/flow/EditNodeModal.vue +30 -0
  26. package/dist/runtime/components/sys/flow/EditNodeModal.vue.d.ts +13 -0
  27. package/dist/runtime/components/sys/flow/Table.d.vue.ts +3 -0
  28. package/dist/runtime/components/sys/flow/Table.vue +98 -0
  29. package/dist/runtime/components/sys/flow/Table.vue.d.ts +3 -0
  30. package/dist/runtime/components/sys/table/CreateModal.vue +9 -191
  31. package/dist/runtime/components/sys/table/Table.vue +0 -11
  32. package/dist/runtime/components/sys/table/TableColumnList.d.vue.ts +54 -0
  33. package/dist/runtime/components/sys/table/TableColumnList.vue +196 -0
  34. package/dist/runtime/components/sys/table/TableColumnList.vue.d.ts +54 -0
  35. package/dist/runtime/components/sys/table/TableColumnModal.d.vue.ts +3 -13
  36. package/dist/runtime/components/sys/table/TableColumnModal.vue +32 -100
  37. package/dist/runtime/components/sys/table/TableColumnModal.vue.d.ts +3 -13
  38. package/dist/runtime/components/table/query/order/Item.d.vue.ts +2 -2
  39. package/dist/runtime/components/table/query/order/Item.vue.d.ts +2 -2
  40. package/dist/runtime/composables/api/sys/index.d.ts +3 -0
  41. package/dist/runtime/composables/api/sys/index.js +3 -0
  42. package/dist/runtime/composables/api/sys/useFlowApi.d.ts +2 -0
  43. package/dist/runtime/composables/api/sys/useFlowApi.js +5 -0
  44. package/dist/runtime/composables/api/sys/useFlowEdgeApi.d.ts +2 -0
  45. package/dist/runtime/composables/api/sys/useFlowEdgeApi.js +3 -0
  46. package/dist/runtime/composables/api/sys/useFlowNodeApi.d.ts +2 -0
  47. package/dist/runtime/composables/api/sys/useFlowNodeApi.js +3 -0
  48. package/dist/runtime/composables/flow/index.d.ts +3 -0
  49. package/dist/runtime/composables/flow/index.js +3 -0
  50. package/dist/runtime/composables/flow/useFlow.d.ts +33 -0
  51. package/dist/runtime/composables/flow/useFlow.js +401 -0
  52. package/dist/runtime/composables/flow/useFlowNode.d.ts +17 -0
  53. package/dist/runtime/composables/flow/useFlowNode.js +106 -0
  54. package/dist/runtime/composables/flow/useFlowResize.d.ts +21 -0
  55. package/dist/runtime/composables/flow/useFlowResize.js +84 -0
  56. package/dist/runtime/composables/flow/useFlowStyles.d.ts +62 -9
  57. package/dist/runtime/composables/flow/useFlowStyles.js +127 -23
  58. package/dist/runtime/composables/table/useTableColumnPermission.d.ts +36 -0
  59. package/dist/runtime/composables/useSidebarMenu.js +0 -2
  60. package/dist/runtime/composables/useTheme.d.ts +1 -1
  61. package/dist/runtime/composables/useTheme.js +0 -1
  62. package/dist/runtime/constants/flow.d.ts +166 -0
  63. package/dist/runtime/constants/flow.js +171 -0
  64. package/dist/runtime/index.css +1 -1
  65. package/dist/runtime/types/models/flow.d.ts +61 -0
  66. package/dist/runtime/types/models/flow.js +0 -0
  67. package/dist/runtime/types/models/index.d.ts +1 -0
  68. package/dist/runtime/types/models/index.js +1 -0
  69. package/dist/runtime/types/models/table.d.ts +1 -0
  70. package/dist/runtime/types/storage.d.ts +3 -4
  71. package/dist/runtime/types/storage.js +3 -4
  72. package/package.json +3 -2
@@ -1,14 +1,67 @@
1
+ import type { WritableComputedRef } from 'vue';
2
+ import type { FlowEdgeStrokeType, FlowEdgePathType, FlowArrowType } from '#v/constants';
3
+ /** 连接线样式存储结构 */
4
+ export interface FlowEdgeStylesState {
5
+ strokeWidth: number;
6
+ markerStart: FlowArrowType;
7
+ markerEnd: FlowArrowType;
8
+ animated: boolean;
9
+ strokeType: FlowEdgeStrokeType;
10
+ pathType: FlowEdgePathType;
11
+ color: string;
12
+ labelColor: string;
13
+ }
14
+ /** 节点样式存储结构 */
15
+ export interface FlowNodeStylesState {
16
+ borderWidth: number;
17
+ borderRadius: number;
18
+ borderColor: string;
19
+ bgColor: string;
20
+ fontColor: string;
21
+ fontSize: number;
22
+ handleSize: number;
23
+ handleColor: string;
24
+ }
25
+ /** 颜色模式存储结构 */
26
+ export type FlowColorMode = 'unified' | 'custom';
27
+ export interface FlowColorModeState {
28
+ /** 统一 / 自定义 */
29
+ mode: FlowColorMode;
30
+ /** 统一模式下选中的 Tailwind 颜色名(例如 'blue'),空字符串 = 默认 */
31
+ colorName: string;
32
+ }
33
+ /** 连接点大小预览标记(全局共享,改变 handleSize 后临时显示所有 handles) */
34
+ declare const _handleSizePreview: import("vue").Ref<boolean, boolean>;
35
+ export declare const handleSizePreview: Readonly<typeof _handleSizePreview>;
1
36
  /**
2
37
  * Flow 样式设置 Composable
3
- * 管理连接线和节点的样式配置
38
+ * localStorage 以对象形式存储,返回各字段的可写 computed ref
4
39
  */
5
40
  export declare function useFlowStyles(): {
6
- edgeStrokeWidth: import("@vueuse/core").RemovableRef<number>;
7
- edgeMarkerStart: import("@vueuse/core").RemovableRef<boolean>;
8
- edgeMarkerEnd: import("@vueuse/core").RemovableRef<boolean>;
9
- nodeBorderWidth: import("@vueuse/core").RemovableRef<number>;
10
- setEdgeStrokeWidth: (width: number) => void;
11
- toggleEdgeMarkerStart: () => void;
12
- toggleEdgeMarkerEnd: () => void;
13
- setNodeBorderWidth: (width: number) => void;
41
+ colorMode: WritableComputedRef<FlowColorMode, FlowColorMode>;
42
+ unifiedColor: WritableComputedRef<string, string>;
43
+ isUnifiedMode: import("vue").ComputedRef<boolean>;
44
+ edgeStrokeWidth: WritableComputedRef<number, number>;
45
+ edgeMarkerStart: WritableComputedRef<FlowArrowType, FlowArrowType>;
46
+ edgeMarkerEnd: WritableComputedRef<FlowArrowType, FlowArrowType>;
47
+ edgeAnimated: WritableComputedRef<boolean, boolean>;
48
+ edgeStrokeType: WritableComputedRef<FlowEdgeStrokeType, FlowEdgeStrokeType>;
49
+ edgePathType: WritableComputedRef<FlowEdgePathType, FlowEdgePathType>;
50
+ edgeColor: WritableComputedRef<string, string>;
51
+ edgeLabelColor: WritableComputedRef<string, string>;
52
+ nodeBorderWidth: WritableComputedRef<number, number>;
53
+ nodeBorderRadius: WritableComputedRef<number, number>;
54
+ nodeBorderColor: WritableComputedRef<string, string>;
55
+ nodeBgColor: WritableComputedRef<string, string>;
56
+ nodeFontColor: WritableComputedRef<string, string>;
57
+ nodeFontSize: WritableComputedRef<number, number>;
58
+ nodeHandleSize: WritableComputedRef<number, number>;
59
+ nodeHandleColor: WritableComputedRef<string, string>;
60
+ effectiveNodeBorderColor: import("vue").ComputedRef<string>;
61
+ effectiveNodeBgColor: import("vue").ComputedRef<string>;
62
+ effectiveNodeFontColor: import("vue").ComputedRef<string>;
63
+ effectiveNodeHandleColor: import("vue").ComputedRef<string>;
64
+ effectiveEdgeColor: import("vue").ComputedRef<string>;
65
+ effectiveEdgeLabelColor: import("vue").ComputedRef<string>;
14
66
  };
67
+ export {};
@@ -1,32 +1,136 @@
1
+ import { computed, ref } from "vue";
1
2
  import { StorageKey } from "#v/types";
2
- import { useLocalStorage } from "@vueuse/core";
3
+ import { useLocalStorage, useColorMode } from "@vueuse/core";
4
+ import { resolveFlowColor } from "#v/constants";
5
+ const EDGE_DEFAULTS = {
6
+ strokeWidth: 2,
7
+ markerStart: "none",
8
+ markerEnd: "arrow",
9
+ animated: false,
10
+ strokeType: "solid",
11
+ pathType: "smoothstep",
12
+ color: "",
13
+ labelColor: ""
14
+ };
15
+ const NODE_DEFAULTS = {
16
+ borderWidth: 2,
17
+ borderRadius: 6,
18
+ borderColor: "",
19
+ bgColor: "",
20
+ fontColor: "",
21
+ fontSize: 14,
22
+ handleSize: 6,
23
+ handleColor: ""
24
+ };
25
+ const COLOR_MODE_DEFAULTS = {
26
+ mode: "custom",
27
+ colorName: ""
28
+ };
29
+ function useField(source, key) {
30
+ return computed({
31
+ get: () => source.value[key],
32
+ set: (val) => {
33
+ source.value = { ...source.value, [key]: val };
34
+ }
35
+ });
36
+ }
37
+ const _handleSizePreview = ref(false);
38
+ let _handleSizePreviewTimer = null;
39
+ export const handleSizePreview = _handleSizePreview;
40
+ function triggerHandleSizePreview() {
41
+ if (_handleSizePreviewTimer) clearTimeout(_handleSizePreviewTimer);
42
+ _handleSizePreview.value = true;
43
+ _handleSizePreviewTimer = setTimeout(() => {
44
+ _handleSizePreview.value = false;
45
+ _handleSizePreviewTimer = null;
46
+ }, 1e3);
47
+ }
3
48
  export function useFlowStyles() {
4
- const edgeStrokeWidth = useLocalStorage(StorageKey.FLOW_EDGE_STROKE_WIDTH, 2);
5
- const edgeMarkerStart = useLocalStorage(StorageKey.FLOW_EDGE_MARKER_START, false);
6
- const edgeMarkerEnd = useLocalStorage(StorageKey.FLOW_EDGE_MARKER_END, true);
7
- const nodeBorderWidth = useLocalStorage(StorageKey.FLOW_NODE_BORDER_WIDTH, 2);
8
- const setEdgeStrokeWidth = (width) => {
9
- edgeStrokeWidth.value = Math.max(1, Math.min(5, width));
10
- };
11
- const toggleEdgeMarkerStart = () => {
12
- edgeMarkerStart.value = !edgeMarkerStart.value;
13
- };
14
- const toggleEdgeMarkerEnd = () => {
15
- edgeMarkerEnd.value = !edgeMarkerEnd.value;
16
- };
17
- const setNodeBorderWidth = (width) => {
18
- nodeBorderWidth.value = Math.max(1, Math.min(5, width));
19
- };
49
+ const edgeStore = useLocalStorage(
50
+ StorageKey.FLOW_EDGE_STYLES,
51
+ { ...EDGE_DEFAULTS },
52
+ { mergeDefaults: true }
53
+ );
54
+ const nodeStore = useLocalStorage(
55
+ StorageKey.FLOW_NODE_STYLES,
56
+ { ...NODE_DEFAULTS },
57
+ { mergeDefaults: true }
58
+ );
59
+ const colorModeStore = useLocalStorage(
60
+ StorageKey.FLOW_COLOR_MODE,
61
+ { ...COLOR_MODE_DEFAULTS },
62
+ { mergeDefaults: true }
63
+ );
64
+ const colorMode = useField(colorModeStore, "mode");
65
+ const unifiedColor = useField(colorModeStore, "colorName");
66
+ const isUnifiedMode = computed(() => colorMode.value === "unified");
67
+ const colorModeRef = useColorMode();
68
+ const isDark = computed(() => colorModeRef.value === "dark");
69
+ const edgeStrokeWidth = useField(edgeStore, "strokeWidth");
70
+ const edgeMarkerStart = useField(edgeStore, "markerStart");
71
+ const edgeMarkerEnd = useField(edgeStore, "markerEnd");
72
+ const edgeAnimated = useField(edgeStore, "animated");
73
+ const edgeStrokeType = useField(edgeStore, "strokeType");
74
+ const edgePathType = useField(edgeStore, "pathType");
75
+ const edgeColor = useField(edgeStore, "color");
76
+ const edgeLabelColor = useField(edgeStore, "labelColor");
77
+ const nodeBorderWidth = useField(nodeStore, "borderWidth");
78
+ const nodeBorderRadius = useField(nodeStore, "borderRadius");
79
+ const nodeBorderColor = useField(nodeStore, "borderColor");
80
+ const nodeBgColor = useField(nodeStore, "bgColor");
81
+ const nodeFontColor = useField(nodeStore, "fontColor");
82
+ const nodeFontSize = useField(nodeStore, "fontSize");
83
+ const _nodeHandleSize = useField(nodeStore, "handleSize");
84
+ const _nodeHandleColor = useField(nodeStore, "handleColor");
85
+ const nodeHandleSize = computed({
86
+ get: () => _nodeHandleSize.value,
87
+ set: (val) => {
88
+ _nodeHandleSize.value = val;
89
+ triggerHandleSizePreview();
90
+ }
91
+ });
92
+ const nodeHandleColor = computed({
93
+ get: () => _nodeHandleColor.value,
94
+ set: (val) => {
95
+ _nodeHandleColor.value = val;
96
+ triggerHandleSizePreview();
97
+ }
98
+ });
99
+ const effectiveNodeBorderColor = computed(() => resolveFlowColor(isUnifiedMode.value ? unifiedColor.value : nodeBorderColor.value, "border", isDark.value));
100
+ const effectiveNodeBgColor = computed(() => resolveFlowColor(isUnifiedMode.value ? unifiedColor.value : nodeBgColor.value, "bg", isDark.value));
101
+ const effectiveNodeFontColor = computed(() => resolveFlowColor(isUnifiedMode.value ? unifiedColor.value : nodeFontColor.value, "font", isDark.value));
102
+ const effectiveNodeHandleColor = computed(() => resolveFlowColor(isUnifiedMode.value ? unifiedColor.value : nodeHandleColor.value, "border", isDark.value));
103
+ const effectiveEdgeColor = computed(() => resolveFlowColor(isUnifiedMode.value ? unifiedColor.value : edgeColor.value, "border", isDark.value));
104
+ const effectiveEdgeLabelColor = computed(() => resolveFlowColor(isUnifiedMode.value ? unifiedColor.value : edgeLabelColor.value, "font", isDark.value));
20
105
  return {
21
- // 状态
106
+ // 颜色模式
107
+ colorMode,
108
+ unifiedColor,
109
+ isUnifiedMode,
110
+ // 连接线(原始自定义值,用于 UI 绑定)
22
111
  edgeStrokeWidth,
23
112
  edgeMarkerStart,
24
113
  edgeMarkerEnd,
114
+ edgeAnimated,
115
+ edgeStrokeType,
116
+ edgePathType,
117
+ edgeColor,
118
+ edgeLabelColor,
119
+ // 节点(原始自定义值,用于 UI 绑定)
25
120
  nodeBorderWidth,
26
- // 方法
27
- setEdgeStrokeWidth,
28
- toggleEdgeMarkerStart,
29
- toggleEdgeMarkerEnd,
30
- setNodeBorderWidth
121
+ nodeBorderRadius,
122
+ nodeBorderColor,
123
+ nodeBgColor,
124
+ nodeFontColor,
125
+ nodeFontSize,
126
+ nodeHandleSize,
127
+ nodeHandleColor,
128
+ // 有效颜色(统一 / 自定义 解析后,用于实际渲染)
129
+ effectiveNodeBorderColor,
130
+ effectiveNodeBgColor,
131
+ effectiveNodeFontColor,
132
+ effectiveNodeHandleColor,
133
+ effectiveEdgeColor,
134
+ effectiveEdgeLabelColor
31
135
  };
32
136
  }
@@ -4,6 +4,24 @@ export declare function useTableColumnPermission(): {
4
4
  tblName?: string | undefined;
5
5
  label?: string | undefined;
6
6
  labelI18nKey?: string | undefined;
7
+ columns?: {
8
+ tableId?: number | undefined;
9
+ columnKey?: string | undefined;
10
+ label?: string | undefined;
11
+ labelI18nKey?: string | undefined;
12
+ order?: number | undefined;
13
+ width?: number | undefined;
14
+ fixed?: "left" | "right" | "" | undefined;
15
+ visible?: boolean | undefined;
16
+ id: number;
17
+ createdAt?: string | undefined;
18
+ updatedAt?: string | undefined;
19
+ version?: number | undefined;
20
+ createdBy?: number | undefined;
21
+ creator?: any;
22
+ updatedBy?: number | undefined;
23
+ updater?: any;
24
+ }[] | undefined;
7
25
  id: number;
8
26
  createdAt?: string | undefined;
9
27
  updatedAt?: string | undefined;
@@ -16,6 +34,24 @@ export declare function useTableColumnPermission(): {
16
34
  tblName?: string | undefined;
17
35
  label?: string | undefined;
18
36
  labelI18nKey?: string | undefined;
37
+ columns?: {
38
+ tableId?: number | undefined;
39
+ columnKey?: string | undefined;
40
+ label?: string | undefined;
41
+ labelI18nKey?: string | undefined;
42
+ order?: number | undefined;
43
+ width?: number | undefined;
44
+ fixed?: "left" | "right" | "" | undefined;
45
+ visible?: boolean | undefined;
46
+ id: number;
47
+ createdAt?: string | undefined;
48
+ updatedAt?: string | undefined;
49
+ version?: number | undefined;
50
+ createdBy?: number | undefined;
51
+ creator?: any;
52
+ updatedBy?: number | undefined;
53
+ updater?: any;
54
+ }[] | undefined;
19
55
  id: number;
20
56
  createdAt?: string | undefined;
21
57
  updatedAt?: string | undefined;
@@ -6,7 +6,6 @@ const constantMenus = ref([]);
6
6
  const bizMenus = ref([]);
7
7
  const menuMode = ref("static");
8
8
  export function setGlobalSidebarMenus(opts) {
9
- console.log("Setting global sidebar menus with options:", opts);
10
9
  if (opts.constantMenus) constantMenus.value = opts.constantMenus;
11
10
  if (opts.bizMenus) bizMenus.value = opts.bizMenus;
12
11
  if (opts.menuMode) menuMode.value = opts.menuMode;
@@ -51,7 +50,6 @@ export const _useSidebarMenus = () => {
51
50
  };
52
51
  watch([loginUserRoles, loginUserMenus, bizMenus], ([newRoles, newMenus]) => {
53
52
  setUserDynamicMenus(newRoles, newMenus);
54
- console.log(bizMenus.value.length, "123");
55
53
  }, { immediate: true });
56
54
  const expandSidebarMenu = (path) => {
57
55
  const expandRecursively = (menus) => {
@@ -15,7 +15,7 @@ export declare const useTheme: () => {
15
15
  value: "light" | "dark" | "auto";
16
16
  icon?: string;
17
17
  }[]>;
18
- mode: import("vue").WritableComputedRef<"auto" | "light" | "dark", "auto" | "light" | "dark">;
18
+ mode: import("vue").WritableComputedRef<"auto" | "dark" | "light", "auto" | "dark" | "light">;
19
19
  locale: import("vue").WritableComputedRef<I18nLocale, I18nLocale>;
20
20
  locales: import("@nuxt/ui").Locale<import("@nuxt/ui").Messages>[];
21
21
  sidebarSide: import("vue").WritableComputedRef<string | number | symbol, string | number | symbol | undefined>;
@@ -32,7 +32,6 @@ const _useTheme = () => {
32
32
  return appConfig.ui?.colors?.neutral;
33
33
  },
34
34
  set(option) {
35
- console.log(option, appConfig);
36
35
  appConfig.ui.colors.neutral = option;
37
36
  app.updateNeutralColor(option);
38
37
  }
@@ -1,4 +1,11 @@
1
1
  import { Position } from '@vue-flow/core';
2
+ import type { InjectionKey, Ref } from 'vue';
3
+ import type { FlowMousePosition } from '#v/types';
4
+ export declare const GRID_SIZE = 20;
5
+ /**
6
+ * Resize 边/角类型
7
+ */
8
+ export type ResizeEdge = 'top' | 'right' | 'bottom' | 'left' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
2
9
  export type HandlePosition = 'tl' | 'tr' | 'bl' | 'br' | 't1' | 't2' | 't3' | 'r1' | 'r2' | 'r3' | 'b1' | 'b2' | 'b3' | 'l1' | 'l2' | 'l3';
3
10
  export type ResizeDirection = 'horizontal' | 'vertical' | 'both';
4
11
  export interface FlowHandle {
@@ -9,4 +16,163 @@ export interface FlowHandle {
9
16
  y?: number;
10
17
  };
11
18
  }
19
+ /**
20
+ * 鼠标位置注入 Key
21
+ */
22
+ export declare const FLOW_MOUSE_POSITION_KEY: InjectionKey<Ref<FlowMousePosition>>;
12
23
  export declare const FLOW_HANDLES: FlowHandle[];
24
+ /**
25
+ * Handle 层级阈值(可配置)
26
+ */
27
+ export declare const FLOW_HANDLE_TIER_THRESHOLDS: {
28
+ readonly small: {
29
+ readonly maxWidth: 80;
30
+ readonly maxHeight: 40;
31
+ };
32
+ readonly medium: {
33
+ readonly maxWidth: 120;
34
+ readonly maxHeight: 80;
35
+ };
36
+ };
37
+ /**
38
+ * 连接线线型
39
+ */
40
+ export type FlowEdgeStrokeType = 'solid' | 'dashed' | 'dotted' | 'dashdot';
41
+ export interface FlowEdgeStrokeOption {
42
+ type: FlowEdgeStrokeType;
43
+ label: string;
44
+ dasharray: string;
45
+ }
46
+ export declare const FLOW_EDGE_STROKE_TYPES: FlowEdgeStrokeOption[];
47
+ /**
48
+ * 连接线路径类型
49
+ */
50
+ export type FlowEdgePathType = 'smoothstep' | 'bezier' | 'step' | 'straight';
51
+ export interface FlowEdgePathOption {
52
+ type: FlowEdgePathType;
53
+ label: string;
54
+ }
55
+ export declare const FLOW_EDGE_PATH_TYPES: FlowEdgePathOption[];
56
+ /**
57
+ * 颜色选项(用于 CircleColor 选色器)
58
+ * color 字段统一存储 Tailwind 颜色**名称**(如 'blue' / 'primary')
59
+ */
60
+ export interface FlowColorOption {
61
+ /** Tailwind 颜色名 */
62
+ color: string;
63
+ /** 同 color,传给 CircleColor 的 chip prop */
64
+ chip: string;
65
+ }
66
+ /** 所有颜色选项(primary + 17色),存的都是颜色名,不含 shade */
67
+ export declare const FLOW_COLORS: FlowColorOption[];
68
+ /**
69
+ * Light / Dark 模式下各用途的色阶映射
70
+ *
71
+ * | 用途 | light | dark |
72
+ * |-------------|-------|------|
73
+ * | bg (节点背景) | 50 | 950 |
74
+ * | border/edge/handle | 500 | 400 |
75
+ * | font/label | 600 | 400 |
76
+ */
77
+ export declare const FLOW_SHADE_MAP: {
78
+ readonly bg: {
79
+ readonly light: 50;
80
+ readonly dark: 950;
81
+ };
82
+ readonly border: {
83
+ readonly light: 500;
84
+ readonly dark: 400;
85
+ };
86
+ readonly font: {
87
+ readonly light: 600;
88
+ readonly dark: 400;
89
+ };
90
+ };
91
+ export type FlowColorRole = keyof typeof FLOW_SHADE_MAP;
92
+ /**
93
+ * 根据颜色名、用途角色和 dark/light 模式生成 CSS var
94
+ * 空名称返回空字符串,供兼容旧数据时回退使用
95
+ */
96
+ export declare function resolveFlowColor(name: string, role: FlowColorRole, isDark: boolean): string;
97
+ /**
98
+ * 箭头类型
99
+ */
100
+ export type FlowArrowType = 'none' | 'arrow' | 'diamond' | 'diamond-open' | 'circle' | 'circle-open';
101
+ export interface FlowArrowOption {
102
+ type: FlowArrowType;
103
+ label: string;
104
+ }
105
+ export declare const FLOW_ARROW_TYPES: FlowArrowOption[];
106
+ /** 粗细选项(连接线/边框通用) */
107
+ export declare const FLOW_WIDTH_ITEMS: {
108
+ label: string;
109
+ value: number;
110
+ }[];
111
+ /** 线型选项(带 dasharray 供 SVG 预览用) */
112
+ export declare const FLOW_STROKE_TYPE_ITEMS: {
113
+ label: string;
114
+ value: FlowEdgeStrokeType;
115
+ dasharray: string;
116
+ }[];
117
+ /** 路径类型选项 */
118
+ export declare const FLOW_PATH_TYPE_ITEMS: {
119
+ label: string;
120
+ value: FlowEdgePathType;
121
+ }[];
122
+ /** 箭头类型选项 */
123
+ export declare const FLOW_ARROW_TYPE_ITEMS: {
124
+ label: string;
125
+ value: FlowArrowType;
126
+ }[];
127
+ /** 圆角选项 */
128
+ export declare const FLOW_BORDER_RADIUS_ITEMS: {
129
+ label: string;
130
+ value: number;
131
+ }[];
132
+ /** 字号选项 */
133
+ export declare const FLOW_FONT_SIZE_ITEMS: {
134
+ label: string;
135
+ value: number;
136
+ twClass: string;
137
+ }[];
138
+ /** 连接点大小选项 */
139
+ export declare const FLOW_HANDLE_SIZE_ITEMS: {
140
+ label: string;
141
+ value: number;
142
+ }[];
143
+ export interface FlowPathPreview {
144
+ /** 'path' 用 <path d=...>,'line' 用 <line> */
145
+ shape: 'path' | 'line';
146
+ d?: string;
147
+ x1?: number;
148
+ y1?: number;
149
+ x2?: number;
150
+ y2?: number;
151
+ }
152
+ export declare const FLOW_PATH_PREVIEW: Record<FlowEdgePathType, FlowPathPreview>;
153
+ export interface FlowArrowSvgElement {
154
+ tag: 'line' | 'polygon' | 'circle';
155
+ attrs: Record<string, string | number>;
156
+ }
157
+ /**
158
+ * 起点箭头预览:箭头图形在左侧,尾线在右侧
159
+ */
160
+ export declare const FLOW_ARROW_PREVIEW_START: Record<FlowArrowType, FlowArrowSvgElement[]>;
161
+ /**
162
+ * 终点箭头预览:尾线在左侧,箭头图形在右侧
163
+ */
164
+ export declare const FLOW_ARROW_PREVIEW_END: Record<FlowArrowType, FlowArrowSvgElement[]>;
165
+ /**
166
+ * 节点鼠标接近阈值(px)
167
+ */
168
+ export declare const FLOW_NODE_PROXIMITY_THRESHOLD = 50;
169
+ /**
170
+ * Resize handle 配置
171
+ */
172
+ export interface FlowResizeHandleConfig {
173
+ edge: ResizeEdge;
174
+ class: string;
175
+ cursor: string;
176
+ zIndex: number;
177
+ }
178
+ export declare const FLOW_RESIZE_HANDLES: FlowResizeHandleConfig[];
@@ -1,4 +1,6 @@
1
1
  import { Position } from "@vue-flow/core";
2
+ export const GRID_SIZE = 20;
3
+ export const FLOW_MOUSE_POSITION_KEY = Symbol("flow-mouse-position");
2
4
  export const FLOW_HANDLES = [
3
5
  // 4个角 - 可以双向调整
4
6
  { id: "tl", position: Position.Top, offsetPercent: { x: 0 } },
@@ -22,3 +24,172 @@ export const FLOW_HANDLES = [
22
24
  { id: "l2", position: Position.Left, offsetPercent: { y: 50 } },
23
25
  { id: "l3", position: Position.Left, offsetPercent: { y: 75 } }
24
26
  ];
27
+ export const FLOW_HANDLE_TIER_THRESHOLDS = {
28
+ small: { maxWidth: 80, maxHeight: 40 },
29
+ medium: { maxWidth: 120, maxHeight: 80 }
30
+ };
31
+ export const FLOW_EDGE_STROKE_TYPES = [
32
+ { type: "solid", label: "\u5B9E\u7EBF", dasharray: "" },
33
+ { type: "dashed", label: "\u865A\u7EBF", dasharray: "8 4" },
34
+ { type: "dotted", label: "\u70B9\u7EBF", dasharray: "2 4" },
35
+ { type: "dashdot", label: "\u70B9\u5212\u7EBF", dasharray: "8 4 2 4" }
36
+ ];
37
+ export const FLOW_EDGE_PATH_TYPES = [
38
+ { type: "smoothstep", label: "\u5E73\u6ED1" },
39
+ { type: "bezier", label: "\u66F2\u7EBF" },
40
+ { type: "step", label: "\u76F4\u89D2" },
41
+ { type: "straight", label: "\u76F4\u7EBF" }
42
+ ];
43
+ const FLOW_COLOR_NAMES = [
44
+ "red",
45
+ "orange",
46
+ "amber",
47
+ "yellow",
48
+ "lime",
49
+ "green",
50
+ "emerald",
51
+ "teal",
52
+ "cyan",
53
+ "sky",
54
+ "blue",
55
+ "indigo",
56
+ "violet",
57
+ "purple",
58
+ "fuchsia",
59
+ "pink",
60
+ "rose"
61
+ ];
62
+ export const FLOW_COLORS = [
63
+ { color: "primary", chip: "primary" },
64
+ ...FLOW_COLOR_NAMES.map((name) => ({ color: name, chip: name }))
65
+ ];
66
+ export const FLOW_SHADE_MAP = {
67
+ bg: { light: 50, dark: 950 },
68
+ border: { light: 500, dark: 400 },
69
+ font: { light: 600, dark: 400 }
70
+ };
71
+ export function resolveFlowColor(name, role, isDark) {
72
+ if (!name) return "";
73
+ const shade = FLOW_SHADE_MAP[role][isDark ? "dark" : "light"];
74
+ if (name === "primary") {
75
+ return `var(--ui-color-${name}-${shade})`;
76
+ }
77
+ return `var(--color-${name}-${shade})`;
78
+ }
79
+ export const FLOW_ARROW_TYPES = [
80
+ { type: "none", label: "\u65E0" },
81
+ { type: "arrow", label: "\u4E09\u89D2\u5B9E\u5FC3" },
82
+ { type: "diamond", label: "\u83F1\u5F62\u5B9E\u5FC3" },
83
+ { type: "diamond-open", label: "\u83F1\u5F62\u7A7A\u5FC3" },
84
+ { type: "circle", label: "\u5706\u5F62\u5B9E\u5FC3" },
85
+ { type: "circle-open", label: "\u5706\u5F62\u7A7A\u5FC3" }
86
+ ];
87
+ export const FLOW_WIDTH_ITEMS = [
88
+ { label: "1", value: 1 },
89
+ { label: "2", value: 2 },
90
+ { label: "3", value: 3 },
91
+ { label: "4", value: 4 },
92
+ { label: "5", value: 5 }
93
+ ];
94
+ export const FLOW_STROKE_TYPE_ITEMS = FLOW_EDGE_STROKE_TYPES.map((o) => ({
95
+ label: o.label,
96
+ value: o.type,
97
+ dasharray: o.dasharray
98
+ }));
99
+ export const FLOW_PATH_TYPE_ITEMS = FLOW_EDGE_PATH_TYPES.map((o) => ({
100
+ label: o.label,
101
+ value: o.type
102
+ }));
103
+ export const FLOW_ARROW_TYPE_ITEMS = FLOW_ARROW_TYPES.map((o) => ({
104
+ label: o.label,
105
+ value: o.type
106
+ }));
107
+ export const FLOW_BORDER_RADIUS_ITEMS = [
108
+ { label: "0", value: 0 },
109
+ { label: "2", value: 2 },
110
+ { label: "4", value: 4 },
111
+ { label: "6", value: 6 },
112
+ { label: "8", value: 8 }
113
+ ];
114
+ export const FLOW_FONT_SIZE_ITEMS = [
115
+ { label: "xs", value: 12, twClass: "text-xs" },
116
+ { label: "sm", value: 14, twClass: "text-sm" },
117
+ { label: "base", value: 16, twClass: "text-base" },
118
+ { label: "lg", value: 18, twClass: "text-lg" },
119
+ { label: "xl", value: 20, twClass: "text-xl" }
120
+ ];
121
+ export const FLOW_HANDLE_SIZE_ITEMS = [
122
+ { label: "4", value: 4 },
123
+ { label: "6", value: 6 },
124
+ { label: "8", value: 8 },
125
+ { label: "10", value: 10 }
126
+ ];
127
+ export const FLOW_PATH_PREVIEW = {
128
+ smoothstep: { shape: "path", d: "M 0 12 L 6 12 Q 10 12 10 7 Q 10 2 14 2 L 20 2" },
129
+ bezier: { shape: "path", d: "M 0 12 C 10 12, 10 2, 20 2" },
130
+ step: { shape: "path", d: "M 0 12 L 10 12 L 10 2 L 20 2" },
131
+ straight: { shape: "line", x1: 0, y1: 12, x2: 20, y2: 2 }
132
+ };
133
+ export const FLOW_ARROW_PREVIEW_START = {
134
+ "none": [
135
+ { tag: "line", attrs: { "x1": 0, "y1": 5, "x2": 20, "y2": 5, "stroke": "currentColor", "stroke-width": 2 } }
136
+ ],
137
+ "arrow": [
138
+ { tag: "polygon", attrs: { points: "10,1 2,5 10,9", fill: "currentColor" } },
139
+ { tag: "line", attrs: { "x1": 8, "y1": 5, "x2": 20, "y2": 5, "stroke": "currentColor", "stroke-width": 2 } }
140
+ ],
141
+ "diamond": [
142
+ { tag: "polygon", attrs: { points: "2,5 7,1 12,5 7,9", fill: "currentColor" } },
143
+ { tag: "line", attrs: { "x1": 12, "y1": 5, "x2": 20, "y2": 5, "stroke": "currentColor", "stroke-width": 2 } }
144
+ ],
145
+ "diamond-open": [
146
+ { tag: "polygon", attrs: { "points": "2,5 7,1 12,5 7,9", "fill": "none", "stroke": "currentColor", "stroke-width": 1.5 } },
147
+ { tag: "line", attrs: { "x1": 12, "y1": 5, "x2": 20, "y2": 5, "stroke": "currentColor", "stroke-width": 2 } }
148
+ ],
149
+ "circle": [
150
+ { tag: "circle", attrs: { cx: 6, cy: 5, r: 4, fill: "currentColor" } },
151
+ { tag: "line", attrs: { "x1": 10, "y1": 5, "x2": 20, "y2": 5, "stroke": "currentColor", "stroke-width": 2 } }
152
+ ],
153
+ "circle-open": [
154
+ { tag: "circle", attrs: { "cx": 6, "cy": 5, "r": 3.5, "fill": "none", "stroke": "currentColor", "stroke-width": 1.5 } },
155
+ { tag: "line", attrs: { "x1": 10, "y1": 5, "x2": 20, "y2": 5, "stroke": "currentColor", "stroke-width": 2 } }
156
+ ]
157
+ };
158
+ export const FLOW_ARROW_PREVIEW_END = {
159
+ "none": [
160
+ { tag: "line", attrs: { "x1": 0, "y1": 5, "x2": 20, "y2": 5, "stroke": "currentColor", "stroke-width": 2 } }
161
+ ],
162
+ "arrow": [
163
+ { tag: "line", attrs: { "x1": 0, "y1": 5, "x2": 12, "y2": 5, "stroke": "currentColor", "stroke-width": 2 } },
164
+ { tag: "polygon", attrs: { points: "10,1 18,5 10,9", fill: "currentColor" } }
165
+ ],
166
+ "diamond": [
167
+ { tag: "line", attrs: { "x1": 0, "y1": 5, "x2": 8, "y2": 5, "stroke": "currentColor", "stroke-width": 2 } },
168
+ { tag: "polygon", attrs: { points: "8,5 13,1 18,5 13,9", fill: "currentColor" } }
169
+ ],
170
+ "diamond-open": [
171
+ { tag: "line", attrs: { "x1": 0, "y1": 5, "x2": 8, "y2": 5, "stroke": "currentColor", "stroke-width": 2 } },
172
+ { tag: "polygon", attrs: { "points": "8,5 13,1 18,5 13,9", "fill": "none", "stroke": "currentColor", "stroke-width": 1.5 } }
173
+ ],
174
+ "circle": [
175
+ { tag: "line", attrs: { "x1": 0, "y1": 5, "x2": 10, "y2": 5, "stroke": "currentColor", "stroke-width": 2 } },
176
+ { tag: "circle", attrs: { cx: 14, cy: 5, r: 4, fill: "currentColor" } }
177
+ ],
178
+ "circle-open": [
179
+ { tag: "line", attrs: { "x1": 0, "y1": 5, "x2": 10, "y2": 5, "stroke": "currentColor", "stroke-width": 2 } },
180
+ { tag: "circle", attrs: { "cx": 14, "cy": 5, "r": 3.5, "fill": "none", "stroke": "currentColor", "stroke-width": 1.5 } }
181
+ ]
182
+ };
183
+ export const FLOW_NODE_PROXIMITY_THRESHOLD = 50;
184
+ export const FLOW_RESIZE_HANDLES = [
185
+ // 4 边 (z-index: 5)
186
+ { edge: "top", class: "top-[-4px] left-[12px] right-[12px] h-[12px]", cursor: "ns-resize", zIndex: 5 },
187
+ { edge: "bottom", class: "bottom-[-4px] left-[12px] right-[12px] h-[12px]", cursor: "ns-resize", zIndex: 5 },
188
+ { edge: "left", class: "left-[-4px] top-[12px] bottom-[12px] w-[12px]", cursor: "ew-resize", zIndex: 5 },
189
+ { edge: "right", class: "right-[-4px] top-[12px] bottom-[12px] w-[12px]", cursor: "ew-resize", zIndex: 5 },
190
+ // 4 角 (z-index: 6, 优先于边)
191
+ { edge: "top-left", class: "top-[-4px] left-[-4px] w-[12px] h-[12px]", cursor: "nwse-resize", zIndex: 6 },
192
+ { edge: "top-right", class: "top-[-4px] right-[-4px] w-[12px] h-[12px]", cursor: "nesw-resize", zIndex: 6 },
193
+ { edge: "bottom-left", class: "bottom-[-4px] left-[-4px] w-[12px] h-[12px]", cursor: "nesw-resize", zIndex: 6 },
194
+ { edge: "bottom-right", class: "bottom-[-4px] right-[-4px] w-[12px] h-[12px]", cursor: "nwse-resize", zIndex: 6 }
195
+ ];