v-nuxt-ui 0.2.8 → 0.2.10

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/module.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "dependencies": [
8
8
  "@nuxt/ui"
9
9
  ],
10
- "version": "0.2.8",
10
+ "version": "0.2.10",
11
11
  "builder": {
12
12
  "@nuxt/module-builder": "1.0.2",
13
13
  "unbuild": "3.6.1"
@@ -42,6 +42,7 @@ const {
42
42
  edgePathType,
43
43
  edgeAnimated,
44
44
  edgeStrokeType,
45
+ edgeColorOpacity,
45
46
  effectiveEdgeColor,
46
47
  effectiveEdgeLabelColor,
47
48
  effectiveNodeBorderColor
@@ -114,7 +115,8 @@ const markersToRender = computed(() => {
114
115
  const edgeStyle = computed(() => {
115
116
  const base = {
116
117
  ...props.style,
117
- stroke: strokeColor.value
118
+ stroke: strokeColor.value,
119
+ opacity: edgeColorOpacity.value / 100
118
120
  };
119
121
  if (edgeAnimated.value) {
120
122
  const strokeOpt = FLOW_EDGE_STROKE_TYPES.find((t) => t.type === edgeStrokeType.value);
@@ -27,13 +27,13 @@ type __VLS_Props = {
27
27
  fitViewPadding?: number;
28
28
  noFlowNodeBorder?: boolean;
29
29
  };
30
- declare var __VLS_21: {
30
+ declare var __VLS_22: {
31
31
  data: any;
32
- }, __VLS_62: {};
32
+ }, __VLS_63: {};
33
33
  type __VLS_Slots = {} & {
34
- node?: (props: typeof __VLS_21) => any;
34
+ node?: (props: typeof __VLS_22) => any;
35
35
  } & {
36
- default?: (props: typeof __VLS_62) => any;
36
+ default?: (props: typeof __VLS_63) => any;
37
37
  };
38
38
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
39
39
  "update:modelValue": (value: Flow) => any;
@@ -55,6 +55,7 @@ const {
55
55
  edgeStrokeType,
56
56
  edgePathType,
57
57
  edgeColor,
58
+ edgeColorOpacity,
58
59
  edgeLabelColor,
59
60
  nodeShowBorder,
60
61
  nodeBorderWidth,
@@ -126,7 +127,8 @@ watchEffect(() => {
126
127
  edge.style = {
127
128
  strokeWidth: edgeStrokeWidth.value,
128
129
  ...dasharray ? { strokeDasharray: dasharray } : {},
129
- ...effectiveEdgeColor.value ? { stroke: effectiveEdgeColor.value } : {}
130
+ ...effectiveEdgeColor.value ? { stroke: effectiveEdgeColor.value } : {},
131
+ opacity: edgeColorOpacity.value / 100
130
132
  };
131
133
  edge.markerStart = void 0;
132
134
  edge.markerEnd = void 0;
@@ -209,7 +211,8 @@ const defaultEdgeOptions = computed(() => {
209
211
  style: {
210
212
  strokeWidth: edgeStrokeWidth.value,
211
213
  ...dasharray ? { strokeDasharray: dasharray } : {},
212
- ...effectiveEdgeColor.value ? { stroke: effectiveEdgeColor.value } : {}
214
+ ...effectiveEdgeColor.value ? { stroke: effectiveEdgeColor.value } : {},
215
+ opacity: edgeColorOpacity.value / 100
213
216
  },
214
217
  // Markers are handled by FlowEdge custom SVG markers
215
218
  markerStart: void 0,
@@ -217,11 +220,33 @@ const defaultEdgeOptions = computed(() => {
217
220
  animated: false
218
221
  };
219
222
  });
223
+ const flowContainer = ref(null);
224
+ let resizeObserver = null;
225
+ let prevWidth = 0;
226
+ onMounted(() => {
227
+ const el = flowContainer.value?.$el ?? flowContainer.value;
228
+ if (!el) return;
229
+ prevWidth = el.clientWidth;
230
+ resizeObserver = new ResizeObserver((entries) => {
231
+ const entry = entries[0];
232
+ if (!entry) return;
233
+ const newWidth = entry.contentRect.width;
234
+ if (newWidth !== prevWidth) {
235
+ prevWidth = newWidth;
236
+ nextTick(() => vueFlowFitView({ padding: props.fitViewPadding }));
237
+ }
238
+ });
239
+ resizeObserver.observe(el);
240
+ });
241
+ onBeforeUnmount(() => {
242
+ resizeObserver?.disconnect();
243
+ });
220
244
  const isValidConnection = () => true;
221
245
  </script>
222
246
 
223
247
  <template>
224
248
  <VueFlow
249
+ ref="flowContainer"
225
250
  v-model:nodes="nodes"
226
251
  v-model:edges="edges"
227
252
  :default-zoom="defaultZoom"
@@ -273,6 +298,7 @@ const isValidConnection = () => true;
273
298
  :edge-marker-end="edgeMarkerEnd"
274
299
  :edge-animated="edgeAnimated"
275
300
  :edge-color="edgeColor"
301
+ :edge-color-opacity="edgeColorOpacity"
276
302
  :edge-label-color="edgeLabelColor"
277
303
  :node-show-border="nodeShowBorder"
278
304
  :node-border-width="nodeBorderWidth"
@@ -290,6 +316,7 @@ const isValidConnection = () => true;
290
316
  :on-edge-marker-end-change="(v) => edgeMarkerEnd = v"
291
317
  :on-toggle-edge-animated="() => edgeAnimated = !edgeAnimated"
292
318
  :on-edge-color-change="(v) => edgeColor = v"
319
+ :on-edge-color-opacity-change="(v) => edgeColorOpacity = v"
293
320
  :on-edge-label-color-change="(v) => edgeLabelColor = v"
294
321
  :on-toggle-node-show-border="() => nodeShowBorder = !nodeShowBorder"
295
322
  :on-node-border-width-change="(v) => nodeBorderWidth = v"
@@ -27,13 +27,13 @@ type __VLS_Props = {
27
27
  fitViewPadding?: number;
28
28
  noFlowNodeBorder?: boolean;
29
29
  };
30
- declare var __VLS_21: {
30
+ declare var __VLS_22: {
31
31
  data: any;
32
- }, __VLS_62: {};
32
+ }, __VLS_63: {};
33
33
  type __VLS_Slots = {} & {
34
- node?: (props: typeof __VLS_21) => any;
34
+ node?: (props: typeof __VLS_22) => any;
35
35
  } & {
36
- default?: (props: typeof __VLS_62) => any;
36
+ default?: (props: typeof __VLS_63) => any;
37
37
  };
38
38
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
39
39
  "update:modelValue": (value: Flow) => any;
@@ -10,6 +10,7 @@ type __VLS_Props = {
10
10
  edgeMarkerStart?: FlowArrowType;
11
11
  edgeMarkerEnd?: FlowArrowType;
12
12
  edgeAnimated?: boolean;
13
+ edgeColorOpacity?: number;
13
14
  edgeColor?: string;
14
15
  edgeLabelColor?: string;
15
16
  editable?: boolean;
@@ -34,6 +35,7 @@ type __VLS_Props = {
34
35
  onEdgeMarkerStartChange?: (type: FlowArrowType) => void;
35
36
  onEdgeMarkerEndChange?: (type: FlowArrowType) => void;
36
37
  onToggleEdgeAnimated?: () => void;
38
+ onEdgeColorOpacityChange?: (opacity: number) => void;
37
39
  onEdgeColorChange?: (color: string) => void;
38
40
  onEdgeLabelColorChange?: (color: string) => void;
39
41
  onToggleNodeShowBorder?: () => void;
@@ -25,6 +25,7 @@ defineProps({
25
25
  edgeMarkerStart: { type: String, required: false },
26
26
  edgeMarkerEnd: { type: String, required: false },
27
27
  edgeAnimated: { type: Boolean, required: false },
28
+ edgeColorOpacity: { type: Number, required: false },
28
29
  edgeColor: { type: String, required: false },
29
30
  edgeLabelColor: { type: String, required: false },
30
31
  editable: { type: Boolean, required: false },
@@ -46,6 +47,7 @@ defineProps({
46
47
  onEdgeMarkerStartChange: { type: Function, required: false },
47
48
  onEdgeMarkerEndChange: { type: Function, required: false },
48
49
  onToggleEdgeAnimated: { type: Function, required: false },
50
+ onEdgeColorOpacityChange: { type: Function, required: false },
49
51
  onEdgeColorChange: { type: Function, required: false },
50
52
  onEdgeLabelColorChange: { type: Function, required: false },
51
53
  onToggleNodeShowBorder: { type: Function, required: false },
@@ -550,6 +552,19 @@ function getStrokeDasharray(value) {
550
552
  </div>
551
553
  </FlowToolbarItemWrapper>
552
554
 
555
+ <!-- 颜色透明度 -->
556
+ <FlowToolbarItemWrapper label="颜色透明度">
557
+ <USlider
558
+ :model-value="edgeColorOpacity ?? 100"
559
+ :min="0"
560
+ :max="100"
561
+ :step="5"
562
+ size="sm"
563
+ class="flex-1"
564
+ @update:model-value="(v) => onEdgeColorOpacityChange?.(v ?? 100)"
565
+ />
566
+ </FlowToolbarItemWrapper>
567
+
553
568
  <!-- 连接线颜色 -->
554
569
  <div :class="{ 'opacity-40 pointer-events-none': isUnifiedMode }">
555
570
  <FlowToolbarItemWrapper label="连接线颜色">
@@ -10,6 +10,7 @@ type __VLS_Props = {
10
10
  edgeMarkerStart?: FlowArrowType;
11
11
  edgeMarkerEnd?: FlowArrowType;
12
12
  edgeAnimated?: boolean;
13
+ edgeColorOpacity?: number;
13
14
  edgeColor?: string;
14
15
  edgeLabelColor?: string;
15
16
  editable?: boolean;
@@ -34,6 +35,7 @@ type __VLS_Props = {
34
35
  onEdgeMarkerStartChange?: (type: FlowArrowType) => void;
35
36
  onEdgeMarkerEndChange?: (type: FlowArrowType) => void;
36
37
  onToggleEdgeAnimated?: () => void;
38
+ onEdgeColorOpacityChange?: (opacity: number) => void;
37
39
  onEdgeColorChange?: (color: string) => void;
38
40
  onEdgeLabelColorChange?: (color: string) => void;
39
41
  onToggleNodeShowBorder?: () => void;
@@ -9,6 +9,7 @@ export interface FlowEdgeStylesState {
9
9
  strokeType: FlowEdgeStrokeType;
10
10
  pathType: FlowEdgePathType;
11
11
  color: string;
12
+ colorOpacity: number;
12
13
  labelColor: string;
13
14
  }
14
15
  /** 节点样式存储结构 */
@@ -49,6 +50,7 @@ export declare function useFlowStyles(): {
49
50
  edgeStrokeType: WritableComputedRef<FlowEdgeStrokeType, FlowEdgeStrokeType>;
50
51
  edgePathType: WritableComputedRef<FlowEdgePathType, FlowEdgePathType>;
51
52
  edgeColor: WritableComputedRef<string, string>;
53
+ edgeColorOpacity: WritableComputedRef<number, number>;
52
54
  edgeLabelColor: WritableComputedRef<string, string>;
53
55
  nodeShowBorder: WritableComputedRef<boolean, boolean>;
54
56
  nodeBorderWidth: WritableComputedRef<number, number>;
@@ -10,6 +10,7 @@ const EDGE_DEFAULTS = {
10
10
  strokeType: "solid",
11
11
  pathType: "smoothstep",
12
12
  color: "",
13
+ colorOpacity: 100,
13
14
  labelColor: ""
14
15
  };
15
16
  const NODE_DEFAULTS = {
@@ -74,6 +75,7 @@ export function useFlowStyles() {
74
75
  const edgeStrokeType = useField(edgeStore, "strokeType");
75
76
  const edgePathType = useField(edgeStore, "pathType");
76
77
  const edgeColor = useField(edgeStore, "color");
78
+ const edgeColorOpacity = useField(edgeStore, "colorOpacity");
77
79
  const edgeLabelColor = useField(edgeStore, "labelColor");
78
80
  const nodeShowBorder = useField(nodeStore, "showBorder");
79
81
  const nodeBorderWidth = useField(nodeStore, "borderWidth");
@@ -117,6 +119,7 @@ export function useFlowStyles() {
117
119
  edgeStrokeType,
118
120
  edgePathType,
119
121
  edgeColor,
122
+ edgeColorOpacity,
120
123
  edgeLabelColor,
121
124
  // 节点(原始自定义值,用于 UI 绑定)
122
125
  nodeShowBorder,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "v-nuxt-ui",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "Veken UI Component Library - Reusable Nuxt UI components, composables, and utilities for enterprise applications",
5
5
  "type": "module",
6
6
  "style": "./dist/runtime/index.css",