@duxweb/dvha-pro 1.0.24 → 1.0.25
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/cjs/component.cjs +1 -1
- package/dist/cjs/components/chart/echart.cjs +1 -1
- package/dist/cjs/components/crop/imageCrop.cjs +1 -1
- package/dist/cjs/components/data/dynamicSelect.cjs +1 -1
- package/dist/cjs/components/data/selectModal.cjs +1 -1
- package/dist/cjs/components/form/drawerForm.cjs +1 -1
- package/dist/cjs/components/form/modalForm.cjs +1 -1
- package/dist/cjs/components/form/pageForm.cjs +1 -1
- package/dist/cjs/components/form/settingForm.cjs +1 -1
- package/dist/cjs/components/icon/icon.cjs +1 -1
- package/dist/cjs/components/image/components/CanvasRuler.cjs +1 -0
- package/dist/cjs/components/image/elements/circle.cjs +1 -0
- package/dist/cjs/components/image/elements/image.cjs +1 -0
- package/dist/cjs/components/image/elements/index.cjs +1 -0
- package/dist/cjs/components/image/elements/rect.cjs +1 -0
- package/dist/cjs/components/image/elements/text.cjs +1 -0
- package/dist/cjs/components/image/hooks/usePosterEditor.cjs +1 -0
- package/dist/cjs/components/image/pages/LeftToolbar.cjs +1 -0
- package/dist/cjs/components/image/pages/Panel.cjs +1 -0
- package/dist/cjs/components/image/pages/PanelItem.cjs +1 -0
- package/dist/cjs/components/image/pages/RightPanel.cjs +1 -0
- package/dist/cjs/components/image/posterEditor.cjs +1 -0
- package/dist/cjs/components/layout/list.cjs +1 -1
- package/dist/cjs/components/layout/table.cjs +1 -1
- package/dist/cjs/components/level/level.cjs +1 -1
- package/dist/cjs/components/table/table.cjs +1 -1
- package/dist/cjs/components/upload/file.cjs +1 -1
- package/dist/cjs/components/upload/image.cjs +1 -1
- package/dist/cjs/components/upload/manage/item.cjs +1 -1
- package/dist/cjs/components/upload/manager.cjs +1 -1
- package/dist/cjs/hooks/dialog.cjs +1 -1
- package/dist/cjs/hooks/drawer.cjs +1 -1
- package/dist/cjs/hooks/modal.cjs +1 -1
- package/dist/cjs/hooks/table/image.cjs +1 -1
- package/dist/cjs/hooks/table/media.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/pages/authLayout.cjs +1 -1
- package/dist/cjs/pages/layout/page.cjs +1 -1
- package/dist/cjs/pages/layout.cjs +1 -1
- package/dist/cjs/pages/login.cjs +1 -1
- package/dist/cjs/pages/menu/avatar.cjs +1 -1
- package/dist/cjs/pages/menu/button.cjs +1 -1
- package/dist/cjs/pages/menu/cmd.cjs +1 -1
- package/dist/cjs/pages/menu/main.cjs +1 -1
- package/dist/cjs/pages/menu/mobile.cjs +1 -1
- package/dist/cjs/pages/page404.cjs +1 -1
- package/dist/cjs/pages/pageStatus.cjs +1 -1
- package/dist/cjs/theme/uno.css.cjs +25 -1
- package/dist/esm/component.js +49 -47
- package/dist/esm/components/chart/echart.js +15 -13
- package/dist/esm/components/crop/imageCrop.js +15 -13
- package/dist/esm/components/data/dynamicSelect.js +15 -13
- package/dist/esm/components/data/selectModal.js +20 -18
- package/dist/esm/components/form/drawerForm.js +21 -19
- package/dist/esm/components/form/modalForm.js +15 -13
- package/dist/esm/components/form/pageForm.js +13 -11
- package/dist/esm/components/form/settingForm.js +12 -10
- package/dist/esm/components/icon/icon.js +15 -13
- package/dist/esm/components/image/components/CanvasRuler.js +113 -0
- package/dist/esm/components/image/elements/circle.js +127 -0
- package/dist/esm/components/image/elements/image.js +131 -0
- package/dist/esm/components/image/elements/index.js +46 -0
- package/dist/esm/components/image/elements/rect.js +171 -0
- package/dist/esm/components/image/elements/text.js +206 -0
- package/dist/esm/components/image/hooks/usePosterEditor.js +434 -0
- package/dist/esm/components/image/pages/LeftToolbar.js +40 -0
- package/dist/esm/components/image/pages/Panel.js +31 -0
- package/dist/esm/components/image/pages/PanelItem.js +22 -0
- package/dist/esm/components/image/pages/RightPanel.js +421 -0
- package/dist/esm/components/image/posterEditor.js +227 -0
- package/dist/esm/components/layout/list.js +16 -14
- package/dist/esm/components/layout/table.js +16 -14
- package/dist/esm/components/level/level.js +15 -13
- package/dist/esm/components/table/table.js +15 -13
- package/dist/esm/components/upload/file.js +98 -88
- package/dist/esm/components/upload/image.js +106 -94
- package/dist/esm/components/upload/manage/item.js +15 -13
- package/dist/esm/components/upload/manager.js +65 -63
- package/dist/esm/hooks/dialog.js +15 -13
- package/dist/esm/hooks/drawer.js +15 -13
- package/dist/esm/hooks/modal.js +15 -13
- package/dist/esm/hooks/table/image.js +15 -13
- package/dist/esm/hooks/table/media.js +15 -13
- package/dist/esm/index.js +213 -202
- package/dist/esm/pages/authLayout.js +15 -13
- package/dist/esm/pages/layout/page.js +15 -13
- package/dist/esm/pages/layout.js +7 -6
- package/dist/esm/pages/login.js +16 -15
- package/dist/esm/pages/menu/avatar.js +15 -13
- package/dist/esm/pages/menu/button.js +15 -13
- package/dist/esm/pages/menu/cmd.js +26 -24
- package/dist/esm/pages/menu/main.js +25 -23
- package/dist/esm/pages/menu/mobile.js +15 -13
- package/dist/esm/pages/page404.js +13 -11
- package/dist/esm/pages/pageStatus.js +15 -13
- package/dist/esm/theme/uno.css.js +25 -1
- package/dist/types/components/image/components/CanvasRuler.d.ts +43 -0
- package/dist/types/components/image/components/index.d.ts +1 -0
- package/dist/types/components/image/elements/circle.d.ts +3 -0
- package/dist/types/components/image/elements/image.d.ts +3 -0
- package/dist/types/components/image/elements/index.d.ts +15 -0
- package/dist/types/components/image/elements/rect.d.ts +3 -0
- package/dist/types/components/image/elements/text.d.ts +3 -0
- package/dist/types/components/image/elements/types.d.ts +51 -0
- package/dist/types/components/image/hooks/index.d.ts +1 -0
- package/dist/types/components/image/hooks/usePosterEditor.d.ts +48 -0
- package/dist/types/components/image/index.d.ts +4 -0
- package/dist/types/components/image/pages/LeftToolbar.d.ts +33 -0
- package/dist/types/components/image/pages/Panel.d.ts +11 -0
- package/dist/types/components/image/pages/PanelItem.d.ts +11 -0
- package/dist/types/components/image/pages/RightPanel.d.ts +208 -0
- package/dist/types/components/image/pages/index.d.ts +4 -0
- package/dist/types/components/image/posterEditor.d.ts +61 -0
- package/dist/types/components/image/types/editor.d.ts +47 -0
- package/dist/types/components/index.d.ts +2 -2
- package/dist/types/components/stats/number.d.ts +1 -1
- package/dist/types/components/upload/file.d.ts +5 -3
- package/dist/types/index.d.ts +1 -0
- package/dist/types/pages/layout/global.d.ts +0 -1
- package/package.json +6 -3
|
@@ -12,6 +12,17 @@ import "@tanstack/vue-query";
|
|
|
12
12
|
import "@duxweb/dvha-naiveui";
|
|
13
13
|
import "@vueuse/core";
|
|
14
14
|
import "pinia";
|
|
15
|
+
import "vue3-ace-editor";
|
|
16
|
+
import "ace-builds/src-noconflict/mode-vue";
|
|
17
|
+
import "ace-builds/src-noconflict/mode-javascript";
|
|
18
|
+
import "ace-builds/src-noconflict/mode-html";
|
|
19
|
+
import "ace-builds/src-noconflict/mode-json";
|
|
20
|
+
import "ace-builds/src-noconflict/mode-json5";
|
|
21
|
+
import "ace-builds/src-noconflict/theme-tomorrow_night";
|
|
22
|
+
import "ace-builds/src-noconflict/theme-tomorrow";
|
|
23
|
+
import "ace-builds/src-noconflict/ext-searchbox";
|
|
24
|
+
import "ace-builds/src-noconflict/ext-language_tools";
|
|
25
|
+
import "ace-builds/src-noconflict/mode-snippets";
|
|
15
26
|
import "vue-cropper";
|
|
16
27
|
import M from "../modal/modalPage.js";
|
|
17
28
|
import "jinrishici";
|
|
@@ -31,21 +42,12 @@ import "@vee-validate/i18n/dist/locale/zh_CN.json";
|
|
|
31
42
|
import "vue-command-palette";
|
|
32
43
|
import "../../pages/page404.js";
|
|
33
44
|
import "@iconify-json/tabler/icons.json";
|
|
34
|
-
import "
|
|
35
|
-
import "
|
|
36
|
-
import "ace-builds/src-noconflict/mode-javascript";
|
|
37
|
-
import "ace-builds/src-noconflict/mode-html";
|
|
38
|
-
import "ace-builds/src-noconflict/mode-json";
|
|
39
|
-
import "ace-builds/src-noconflict/mode-json5";
|
|
40
|
-
import "ace-builds/src-noconflict/theme-tomorrow_night";
|
|
41
|
-
import "ace-builds/src-noconflict/theme-tomorrow";
|
|
42
|
-
import "ace-builds/src-noconflict/ext-searchbox";
|
|
43
|
-
import "ace-builds/src-noconflict/ext-language_tools";
|
|
44
|
-
import "ace-builds/src-noconflict/mode-snippets";
|
|
45
|
+
import "../image/elements/index.js";
|
|
46
|
+
import "fabric";
|
|
45
47
|
function c(t) {
|
|
46
48
|
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !x(t);
|
|
47
49
|
}
|
|
48
|
-
const
|
|
50
|
+
const Dt = /* @__PURE__ */ b({
|
|
49
51
|
name: "DuxModalForm",
|
|
50
52
|
props: {
|
|
51
53
|
id: {
|
|
@@ -140,5 +142,5 @@ const ht = /* @__PURE__ */ b({
|
|
|
140
142
|
}
|
|
141
143
|
});
|
|
142
144
|
export {
|
|
143
|
-
|
|
145
|
+
Dt as DuxModalForm
|
|
144
146
|
};
|
|
@@ -7,15 +7,6 @@ import { DuxCard as F } from "../card/card.js";
|
|
|
7
7
|
import "clsx";
|
|
8
8
|
import "vue-echarts";
|
|
9
9
|
import "@vueuse/core";
|
|
10
|
-
import "vue-cropper";
|
|
11
|
-
import "jinrishici";
|
|
12
|
-
import "lodash-es";
|
|
13
|
-
import "vue-draggable-plus";
|
|
14
|
-
import "aieditor";
|
|
15
|
-
import { DuxFormLayout as C } from "./formLayout.js";
|
|
16
|
-
import "vee-validate";
|
|
17
|
-
import "@iconify-json/tabler/icons.json";
|
|
18
|
-
import "mime";
|
|
19
10
|
import "vue3-ace-editor";
|
|
20
11
|
import "ace-builds/src-noconflict/mode-vue";
|
|
21
12
|
import "ace-builds/src-noconflict/mode-javascript";
|
|
@@ -27,6 +18,17 @@ import "ace-builds/src-noconflict/theme-tomorrow";
|
|
|
27
18
|
import "ace-builds/src-noconflict/ext-searchbox";
|
|
28
19
|
import "ace-builds/src-noconflict/ext-language_tools";
|
|
29
20
|
import "ace-builds/src-noconflict/mode-snippets";
|
|
21
|
+
import "vue-cropper";
|
|
22
|
+
import "jinrishici";
|
|
23
|
+
import "lodash-es";
|
|
24
|
+
import "vue-draggable-plus";
|
|
25
|
+
import "aieditor";
|
|
26
|
+
import { DuxFormLayout as C } from "./formLayout.js";
|
|
27
|
+
import "vee-validate";
|
|
28
|
+
import "@iconify-json/tabler/icons.json";
|
|
29
|
+
import "../image/elements/index.js";
|
|
30
|
+
import "fabric";
|
|
31
|
+
import "mime";
|
|
30
32
|
import "dayjs";
|
|
31
33
|
import "@tanstack/vue-query";
|
|
32
34
|
import "@duxweb/dvha-naiveui";
|
|
@@ -43,7 +45,7 @@ import "@vee-validate/i18n/dist/locale/zh_CN.json";
|
|
|
43
45
|
import "vue-command-palette";
|
|
44
46
|
import { DuxPage as D } from "../../pages/page.js";
|
|
45
47
|
import "../../pages/page404.js";
|
|
46
|
-
const
|
|
48
|
+
const xt = /* @__PURE__ */ f({
|
|
47
49
|
name: "DuxPageForm",
|
|
48
50
|
props: {
|
|
49
51
|
id: {
|
|
@@ -141,5 +143,5 @@ const yt = /* @__PURE__ */ f({
|
|
|
141
143
|
}
|
|
142
144
|
});
|
|
143
145
|
export {
|
|
144
|
-
|
|
146
|
+
xt as DuxPageForm
|
|
145
147
|
};
|
|
@@ -6,14 +6,6 @@ import "vue-router";
|
|
|
6
6
|
import "clsx";
|
|
7
7
|
import "vue-echarts";
|
|
8
8
|
import "@vueuse/core";
|
|
9
|
-
import "vue-cropper";
|
|
10
|
-
import "jinrishici";
|
|
11
|
-
import "lodash-es";
|
|
12
|
-
import "vue-draggable-plus";
|
|
13
|
-
import "aieditor";
|
|
14
|
-
import "vee-validate";
|
|
15
|
-
import "@iconify-json/tabler/icons.json";
|
|
16
|
-
import "mime";
|
|
17
9
|
import "vue3-ace-editor";
|
|
18
10
|
import "ace-builds/src-noconflict/mode-vue";
|
|
19
11
|
import "ace-builds/src-noconflict/mode-javascript";
|
|
@@ -25,6 +17,16 @@ import "ace-builds/src-noconflict/theme-tomorrow";
|
|
|
25
17
|
import "ace-builds/src-noconflict/ext-searchbox";
|
|
26
18
|
import "ace-builds/src-noconflict/ext-language_tools";
|
|
27
19
|
import "ace-builds/src-noconflict/mode-snippets";
|
|
20
|
+
import "vue-cropper";
|
|
21
|
+
import "jinrishici";
|
|
22
|
+
import "lodash-es";
|
|
23
|
+
import "vue-draggable-plus";
|
|
24
|
+
import "aieditor";
|
|
25
|
+
import "vee-validate";
|
|
26
|
+
import "@iconify-json/tabler/icons.json";
|
|
27
|
+
import "../image/elements/index.js";
|
|
28
|
+
import "fabric";
|
|
29
|
+
import "mime";
|
|
28
30
|
import "dayjs";
|
|
29
31
|
import "@tanstack/vue-query";
|
|
30
32
|
import "@duxweb/dvha-naiveui";
|
|
@@ -41,7 +43,7 @@ import "@vee-validate/i18n/dist/locale/zh_CN.json";
|
|
|
41
43
|
import "vue-command-palette";
|
|
42
44
|
import { DuxPage as b } from "../../pages/page.js";
|
|
43
45
|
import "../../pages/page404.js";
|
|
44
|
-
const
|
|
46
|
+
const ct = /* @__PURE__ */ s({
|
|
45
47
|
name: "DuxSettingForm",
|
|
46
48
|
props: {
|
|
47
49
|
id: {
|
|
@@ -124,5 +126,5 @@ const lt = /* @__PURE__ */ s({
|
|
|
124
126
|
}
|
|
125
127
|
});
|
|
126
128
|
export {
|
|
127
|
-
|
|
129
|
+
ct as DuxSettingForm
|
|
128
130
|
};
|
|
@@ -6,6 +6,17 @@ import "vue-router";
|
|
|
6
6
|
import "@overlastic/vue";
|
|
7
7
|
import "clsx";
|
|
8
8
|
import "vue-echarts";
|
|
9
|
+
import "vue3-ace-editor";
|
|
10
|
+
import "ace-builds/src-noconflict/mode-vue";
|
|
11
|
+
import "ace-builds/src-noconflict/mode-javascript";
|
|
12
|
+
import "ace-builds/src-noconflict/mode-html";
|
|
13
|
+
import "ace-builds/src-noconflict/mode-json";
|
|
14
|
+
import "ace-builds/src-noconflict/mode-json5";
|
|
15
|
+
import "ace-builds/src-noconflict/theme-tomorrow_night";
|
|
16
|
+
import "ace-builds/src-noconflict/theme-tomorrow";
|
|
17
|
+
import "ace-builds/src-noconflict/ext-searchbox";
|
|
18
|
+
import "ace-builds/src-noconflict/ext-language_tools";
|
|
19
|
+
import "ace-builds/src-noconflict/mode-snippets";
|
|
9
20
|
import "vue-cropper";
|
|
10
21
|
import "jinrishici";
|
|
11
22
|
import "lodash-es";
|
|
@@ -25,23 +36,14 @@ import "vue-command-palette";
|
|
|
25
36
|
import "@duxweb/dvha-naiveui";
|
|
26
37
|
import "../../pages/page404.js";
|
|
27
38
|
import "@iconify-json/tabler/icons.json";
|
|
39
|
+
import "../image/elements/index.js";
|
|
40
|
+
import "fabric";
|
|
28
41
|
import "mime";
|
|
29
|
-
import "vue3-ace-editor";
|
|
30
|
-
import "ace-builds/src-noconflict/mode-vue";
|
|
31
|
-
import "ace-builds/src-noconflict/mode-javascript";
|
|
32
|
-
import "ace-builds/src-noconflict/mode-html";
|
|
33
|
-
import "ace-builds/src-noconflict/mode-json";
|
|
34
|
-
import "ace-builds/src-noconflict/mode-json5";
|
|
35
|
-
import "ace-builds/src-noconflict/theme-tomorrow_night";
|
|
36
|
-
import "ace-builds/src-noconflict/theme-tomorrow";
|
|
37
|
-
import "ace-builds/src-noconflict/ext-searchbox";
|
|
38
|
-
import "ace-builds/src-noconflict/ext-language_tools";
|
|
39
|
-
import "ace-builds/src-noconflict/mode-snippets";
|
|
40
42
|
import { useModal as c } from "../../hooks/modal.js";
|
|
41
43
|
import "dayjs";
|
|
42
44
|
import "@tanstack/vue-query";
|
|
43
45
|
import "pinia";
|
|
44
|
-
const
|
|
46
|
+
const ro = /* @__PURE__ */ n({
|
|
45
47
|
name: "DuxIconPicker",
|
|
46
48
|
props: {
|
|
47
49
|
defaultValue: String,
|
|
@@ -85,5 +87,5 @@ const to = /* @__PURE__ */ n({
|
|
|
85
87
|
}
|
|
86
88
|
});
|
|
87
89
|
export {
|
|
88
|
-
|
|
90
|
+
ro as DuxIconPicker
|
|
89
91
|
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { defineComponent as b, computed as s, createVNode as a } from "vue";
|
|
2
|
+
const m = /* @__PURE__ */ b({
|
|
3
|
+
name: "CanvasRuler",
|
|
4
|
+
props: {
|
|
5
|
+
canvasWidth: {
|
|
6
|
+
type: Number,
|
|
7
|
+
required: !0
|
|
8
|
+
},
|
|
9
|
+
canvasHeight: {
|
|
10
|
+
type: Number,
|
|
11
|
+
required: !0
|
|
12
|
+
},
|
|
13
|
+
canvasScale: {
|
|
14
|
+
type: Number,
|
|
15
|
+
required: !0
|
|
16
|
+
},
|
|
17
|
+
rulerSize: {
|
|
18
|
+
type: Number,
|
|
19
|
+
default: 20
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
setup(e) {
|
|
23
|
+
const n = (t, l) => {
|
|
24
|
+
const v = [];
|
|
25
|
+
let r = 10;
|
|
26
|
+
l < 0.5 ? r = 50 : l < 1 && (r = 25);
|
|
27
|
+
for (let i = 0; i <= t; i += r) {
|
|
28
|
+
const f = i * l, h = i % (r * 5) === 0;
|
|
29
|
+
v.push({
|
|
30
|
+
position: f,
|
|
31
|
+
value: i,
|
|
32
|
+
isMajor: h
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return v;
|
|
36
|
+
}, c = s(() => n(e.canvasWidth, e.canvasScale)), d = s(() => n(e.canvasHeight, e.canvasScale)), u = s(() => e.canvasWidth * e.canvasScale), o = s(() => e.canvasHeight * e.canvasScale);
|
|
37
|
+
return () => a("div", {
|
|
38
|
+
class: "absolute inset-0 pointer-events-none"
|
|
39
|
+
}, [a("div", {
|
|
40
|
+
class: "absolute flex justify-center left-6 top-0 right-0 bg-default",
|
|
41
|
+
style: {
|
|
42
|
+
height: `${e.rulerSize}px`
|
|
43
|
+
}
|
|
44
|
+
}, [a("div", {
|
|
45
|
+
class: "absolute top-0 bg-default",
|
|
46
|
+
style: {
|
|
47
|
+
left: "50%",
|
|
48
|
+
transform: "translateX(-50%)",
|
|
49
|
+
width: `${u.value}px`,
|
|
50
|
+
height: `${e.rulerSize}px`
|
|
51
|
+
}
|
|
52
|
+
}, [a("svg", {
|
|
53
|
+
width: u.value,
|
|
54
|
+
height: e.rulerSize,
|
|
55
|
+
class: "absolute top-0 left-0"
|
|
56
|
+
}, [c.value.map((t, l) => a("g", {
|
|
57
|
+
key: l
|
|
58
|
+
}, [a("line", {
|
|
59
|
+
x1: t.position,
|
|
60
|
+
y1: t.isMajor ? 0 : e.rulerSize / 2,
|
|
61
|
+
x2: t.position,
|
|
62
|
+
y2: e.rulerSize,
|
|
63
|
+
stroke: "rgba(0,0,0, 0.1)",
|
|
64
|
+
"stroke-width": "1"
|
|
65
|
+
}, null), t.isMajor && a("text", {
|
|
66
|
+
x: t.position + 2,
|
|
67
|
+
y: e.rulerSize - 6,
|
|
68
|
+
"font-size": "10",
|
|
69
|
+
stroke: "rgba(0,0,0, 0.1)",
|
|
70
|
+
"font-family": "monospace",
|
|
71
|
+
fill: "rgb(var(--ui-text-muted))"
|
|
72
|
+
}, [t.value])]))])])]), a("div", {
|
|
73
|
+
class: "absolute flex justify-center items-center flex-col top-6 left-0 bottom-0 bg-default border-r border-muted",
|
|
74
|
+
style: {
|
|
75
|
+
width: `${e.rulerSize}px`
|
|
76
|
+
}
|
|
77
|
+
}, [a("div", {
|
|
78
|
+
class: "absolute left-0 bg-default",
|
|
79
|
+
style: {
|
|
80
|
+
top: "50%",
|
|
81
|
+
transform: "translateY(-50%)",
|
|
82
|
+
width: `${e.rulerSize}px`,
|
|
83
|
+
height: `${o.value}px`
|
|
84
|
+
}
|
|
85
|
+
}, [a("svg", {
|
|
86
|
+
width: e.rulerSize,
|
|
87
|
+
height: o.value,
|
|
88
|
+
class: "absolute top-0 left-0"
|
|
89
|
+
}, [d.value.map((t, l) => a("g", {
|
|
90
|
+
key: l
|
|
91
|
+
}, [a("line", {
|
|
92
|
+
x1: t.isMajor ? 0 : e.rulerSize / 2,
|
|
93
|
+
y1: t.position,
|
|
94
|
+
x2: e.rulerSize,
|
|
95
|
+
y2: t.position,
|
|
96
|
+
stroke: "rgba(0,0,0, 0.1)",
|
|
97
|
+
"stroke-width": "1"
|
|
98
|
+
}, null), t.isMajor && a("text", {
|
|
99
|
+
x: e.rulerSize - 6,
|
|
100
|
+
y: t.position - 6,
|
|
101
|
+
"font-size": "10",
|
|
102
|
+
fill: "rgb(var(--ui-text-muted))",
|
|
103
|
+
"font-family": "monospace",
|
|
104
|
+
"text-anchor": "end",
|
|
105
|
+
transform: `rotate(-90, ${e.rulerSize - 2}, ${t.position - 2})`
|
|
106
|
+
}, [t.value])]))])])]), a("div", {
|
|
107
|
+
class: "absolute size-6 bg-default top-0 left-0"
|
|
108
|
+
}, null)]);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
export {
|
|
112
|
+
m as CanvasRuler
|
|
113
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Circle as c } from "fabric";
|
|
2
|
+
const r = {
|
|
3
|
+
type: "circle",
|
|
4
|
+
name: "圆形",
|
|
5
|
+
icon: "i-tabler:circle",
|
|
6
|
+
category: "basic",
|
|
7
|
+
defaultProps: {
|
|
8
|
+
type: "circle",
|
|
9
|
+
left: 100,
|
|
10
|
+
top: 100,
|
|
11
|
+
width: 100,
|
|
12
|
+
height: 100,
|
|
13
|
+
angle: 0,
|
|
14
|
+
scaleX: 1,
|
|
15
|
+
scaleY: 1,
|
|
16
|
+
visible: !0,
|
|
17
|
+
locked: !1,
|
|
18
|
+
radius: 50,
|
|
19
|
+
fill: "#00ff00",
|
|
20
|
+
stroke: "",
|
|
21
|
+
strokeWidth: 0,
|
|
22
|
+
strokeDashArray: null,
|
|
23
|
+
opacity: 1,
|
|
24
|
+
label: ""
|
|
25
|
+
},
|
|
26
|
+
createFabricObject: (e) => {
|
|
27
|
+
const l = new c({
|
|
28
|
+
left: e.left,
|
|
29
|
+
top: e.top,
|
|
30
|
+
radius: e.radius,
|
|
31
|
+
fill: e.fill,
|
|
32
|
+
stroke: e.stroke || void 0,
|
|
33
|
+
strokeWidth: e.strokeWidth,
|
|
34
|
+
strokeDashArray: e.strokeDashArray,
|
|
35
|
+
angle: e.angle,
|
|
36
|
+
scaleX: e.scaleX,
|
|
37
|
+
scaleY: e.scaleY,
|
|
38
|
+
opacity: e.opacity,
|
|
39
|
+
visible: e.visible,
|
|
40
|
+
selectable: !e.locked,
|
|
41
|
+
evented: !e.locked,
|
|
42
|
+
strokeUniform: !0,
|
|
43
|
+
lockUniScaling: !0
|
|
44
|
+
// 强制等比例缩放,确保圆形始终占满容器
|
|
45
|
+
});
|
|
46
|
+
return l.label = e.label, l;
|
|
47
|
+
},
|
|
48
|
+
getPropsFromFabricObject: (e) => {
|
|
49
|
+
const l = e, t = l.scaleX || 1, i = l.scaleY || 1, a = Math.round((l.radius || 50) * Math.max(t, i));
|
|
50
|
+
return {
|
|
51
|
+
type: "circle",
|
|
52
|
+
left: Math.round(l.left || 0),
|
|
53
|
+
top: Math.round(l.top || 0),
|
|
54
|
+
width: a * 2,
|
|
55
|
+
height: a * 2,
|
|
56
|
+
angle: Math.round(l.angle || 0),
|
|
57
|
+
scaleX: 1,
|
|
58
|
+
// 始终重置为1,将缩放应用到实际尺寸
|
|
59
|
+
scaleY: 1,
|
|
60
|
+
// 始终重置为1,将缩放应用到实际尺寸
|
|
61
|
+
visible: l.visible !== !1,
|
|
62
|
+
locked: !l.selectable,
|
|
63
|
+
radius: a,
|
|
64
|
+
fill: l.fill || "#00ff00",
|
|
65
|
+
stroke: l.stroke || "",
|
|
66
|
+
strokeWidth: Math.round(l.strokeWidth || 0),
|
|
67
|
+
strokeDashArray: l.strokeDashArray || null,
|
|
68
|
+
opacity: l.opacity || 1,
|
|
69
|
+
label: l.label || ""
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
getToolbarControls: (e) => [
|
|
73
|
+
{
|
|
74
|
+
key: "label",
|
|
75
|
+
label: "标签",
|
|
76
|
+
type: "text",
|
|
77
|
+
value: e.label,
|
|
78
|
+
options: { placeholder: "请输入标签" }
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
key: "radius",
|
|
82
|
+
label: "半径",
|
|
83
|
+
type: "number",
|
|
84
|
+
value: e.radius,
|
|
85
|
+
options: { min: 1, max: 1e3, step: 1 }
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
key: "fill",
|
|
89
|
+
label: "填充颜色",
|
|
90
|
+
type: "color",
|
|
91
|
+
value: e.fill
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
key: "stroke",
|
|
95
|
+
label: "边框颜色",
|
|
96
|
+
type: "color",
|
|
97
|
+
value: e.stroke
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
key: "strokeWidth",
|
|
101
|
+
label: "边框宽度",
|
|
102
|
+
type: "number",
|
|
103
|
+
value: e.strokeWidth,
|
|
104
|
+
options: { min: 0, max: 50, step: 1 }
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
key: "opacity",
|
|
108
|
+
label: "透明度",
|
|
109
|
+
type: "slider",
|
|
110
|
+
value: e.opacity,
|
|
111
|
+
options: { min: 0, max: 1, step: 0.01 }
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
onPropsChange: (e, l) => {
|
|
115
|
+
const t = l;
|
|
116
|
+
t.set({
|
|
117
|
+
radius: e.radius,
|
|
118
|
+
fill: e.fill,
|
|
119
|
+
stroke: e.stroke || void 0,
|
|
120
|
+
strokeWidth: e.strokeWidth,
|
|
121
|
+
opacity: e.opacity
|
|
122
|
+
}), t.label = e.label;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
export {
|
|
126
|
+
r as default
|
|
127
|
+
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { FabricImage as u } from "fabric";
|
|
2
|
+
const y = {
|
|
3
|
+
type: "image",
|
|
4
|
+
name: "图片",
|
|
5
|
+
icon: "i-tabler:photo",
|
|
6
|
+
category: "basic",
|
|
7
|
+
defaultProps: {
|
|
8
|
+
id: "",
|
|
9
|
+
type: "image",
|
|
10
|
+
left: 100,
|
|
11
|
+
top: 100,
|
|
12
|
+
width: 200,
|
|
13
|
+
height: 200,
|
|
14
|
+
angle: 0,
|
|
15
|
+
scaleX: 1,
|
|
16
|
+
scaleY: 1,
|
|
17
|
+
visible: !0,
|
|
18
|
+
locked: !1,
|
|
19
|
+
src: "",
|
|
20
|
+
opacity: 1
|
|
21
|
+
},
|
|
22
|
+
createFabricObject: (e) => u.fromURL(e.src || "", {
|
|
23
|
+
crossOrigin: "anonymous"
|
|
24
|
+
}).then((a) => (a.set({
|
|
25
|
+
left: e.left,
|
|
26
|
+
top: e.top,
|
|
27
|
+
width: e.width,
|
|
28
|
+
height: e.height,
|
|
29
|
+
angle: e.angle,
|
|
30
|
+
opacity: e.opacity,
|
|
31
|
+
visible: e.visible,
|
|
32
|
+
selectable: !e.locked,
|
|
33
|
+
evented: !e.locked
|
|
34
|
+
}), a)),
|
|
35
|
+
getPropsFromFabricObject: (e) => {
|
|
36
|
+
const a = e, t = (a.width || 200) * (a.scaleX || 1), i = (a.height || 200) * (a.scaleY || 1);
|
|
37
|
+
return {
|
|
38
|
+
type: "image",
|
|
39
|
+
left: Math.round(a.left || 0),
|
|
40
|
+
top: Math.round(a.top || 0),
|
|
41
|
+
width: Math.round(t),
|
|
42
|
+
height: Math.round(i),
|
|
43
|
+
angle: Math.round(a.angle || 0),
|
|
44
|
+
scaleX: a.scaleX || 1,
|
|
45
|
+
scaleY: a.scaleY || 1,
|
|
46
|
+
visible: a.visible !== !1,
|
|
47
|
+
locked: !a.selectable,
|
|
48
|
+
src: a.getSrc() || "",
|
|
49
|
+
opacity: a.opacity || 1,
|
|
50
|
+
cropX: 0,
|
|
51
|
+
cropY: 0,
|
|
52
|
+
borderRadius: 0
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
getToolbarControls: (e) => [
|
|
56
|
+
{
|
|
57
|
+
key: "src",
|
|
58
|
+
label: "选择图片",
|
|
59
|
+
type: "image",
|
|
60
|
+
value: e.src,
|
|
61
|
+
options: { placeholder: "点击选择图片文件" }
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
key: "width",
|
|
65
|
+
label: "宽度",
|
|
66
|
+
type: "number",
|
|
67
|
+
value: e.width,
|
|
68
|
+
options: { min: 10, max: 2e3, step: 1 }
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
key: "height",
|
|
72
|
+
label: "高度",
|
|
73
|
+
type: "number",
|
|
74
|
+
value: e.height,
|
|
75
|
+
options: { min: 10, max: 2e3, step: 1 }
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
key: "opacity",
|
|
79
|
+
label: "透明度",
|
|
80
|
+
type: "slider",
|
|
81
|
+
value: e.opacity,
|
|
82
|
+
options: { min: 0, max: 1, step: 0.01 }
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
onPropsChange: (e, a) => {
|
|
86
|
+
const t = a;
|
|
87
|
+
if (e.src && e.src !== (t.getSrc() || "")) {
|
|
88
|
+
t.setSrc(e.src, { crossOrigin: "anonymous" }).then(() => {
|
|
89
|
+
const c = t.getElement().width, l = t.getElement().height, n = t.canvas, g = n?.width || 800, r = n?.height || 600, b = g / c, m = r / l, s = Math.min(b, m, 1);
|
|
90
|
+
t.set({
|
|
91
|
+
left: e.left,
|
|
92
|
+
top: e.top,
|
|
93
|
+
width: c,
|
|
94
|
+
height: l,
|
|
95
|
+
scaleX: s,
|
|
96
|
+
scaleY: s,
|
|
97
|
+
angle: e.angle,
|
|
98
|
+
opacity: e.opacity,
|
|
99
|
+
visible: e.visible,
|
|
100
|
+
selectable: !e.locked,
|
|
101
|
+
evented: !e.locked
|
|
102
|
+
}), t.setCoords(), t.canvas?.renderAll(), t.canvas?.fire("object:modified", { target: t });
|
|
103
|
+
});
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (!e.src) {
|
|
107
|
+
t.setSrc("").then(() => {
|
|
108
|
+
t.set({
|
|
109
|
+
width: 200,
|
|
110
|
+
height: 200
|
|
111
|
+
}), t.setCoords(), t.canvas?.renderAll(), t.canvas?.fire("object:modified", { target: t });
|
|
112
|
+
});
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const i = t.width || 200, o = t.height || 200, h = e.width / i, d = e.height / o;
|
|
116
|
+
t.set({
|
|
117
|
+
left: e.left,
|
|
118
|
+
top: e.top,
|
|
119
|
+
scaleX: h,
|
|
120
|
+
scaleY: d,
|
|
121
|
+
angle: e.angle,
|
|
122
|
+
opacity: e.opacity,
|
|
123
|
+
visible: e.visible,
|
|
124
|
+
selectable: !e.locked,
|
|
125
|
+
evented: !e.locked
|
|
126
|
+
}), t.setCoords(), t.canvas?.renderAll(), t.canvas?.fire("object:modified", { target: t });
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
export {
|
|
130
|
+
y as default
|
|
131
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import s from "./circle.js";
|
|
2
|
+
import g from "./image.js";
|
|
3
|
+
import n from "./rect.js";
|
|
4
|
+
import m from "./text.js";
|
|
5
|
+
class o {
|
|
6
|
+
elements = /* @__PURE__ */ new Map();
|
|
7
|
+
// 注册元素
|
|
8
|
+
register(e) {
|
|
9
|
+
this.elements.set(e.type, e);
|
|
10
|
+
}
|
|
11
|
+
// 批量注册元素
|
|
12
|
+
registerAll(e) {
|
|
13
|
+
e.forEach((t) => this.register(t));
|
|
14
|
+
}
|
|
15
|
+
// 获取元素配置
|
|
16
|
+
get(e) {
|
|
17
|
+
return this.elements.get(e) || null;
|
|
18
|
+
}
|
|
19
|
+
// 获取所有元素配置
|
|
20
|
+
getAll() {
|
|
21
|
+
return Array.from(this.elements.values());
|
|
22
|
+
}
|
|
23
|
+
// 根据分类获取元素配置
|
|
24
|
+
getByCategory(e) {
|
|
25
|
+
return this.getAll().filter((t) => t.category === e);
|
|
26
|
+
}
|
|
27
|
+
// 获取所有分类
|
|
28
|
+
getCategories() {
|
|
29
|
+
const e = new Set(this.getAll().map((t) => t.category));
|
|
30
|
+
return Array.from(e);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const l = new o();
|
|
34
|
+
l.registerAll([
|
|
35
|
+
m,
|
|
36
|
+
n,
|
|
37
|
+
s,
|
|
38
|
+
g
|
|
39
|
+
]);
|
|
40
|
+
const f = l.getAll(), p = (r) => l.get(r), A = (r) => l.getByCategory(r);
|
|
41
|
+
export {
|
|
42
|
+
f as elementConfigs,
|
|
43
|
+
l as elementRegistry,
|
|
44
|
+
p as getElementConfig,
|
|
45
|
+
A as getElementsByCategory
|
|
46
|
+
};
|