@8wave/ai-elements 0.125.0-beta.39 → 0.125.0-beta.40
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/_chunks/{PkChatbotFilePreview-Dt0ygdJM.js → PkChatbotFilePreview-o0zIuCgN.js} +2 -2
- package/dist/_chunks/{PkChatbotFilePreview-Dt0ygdJM.js.map → PkChatbotFilePreview-o0zIuCgN.js.map} +1 -1
- package/dist/_chunks/{PkFilePreview-CT3_vRcU.js → PkFilePreview-D_1ZgiiA.js} +438 -438
- package/dist/_chunks/{PkFilePreview-CT3_vRcU.js.map → PkFilePreview-D_1ZgiiA.js.map} +1 -1
- package/dist/_chunks/{PkFilePreviewDialog-BOKJCapN.js → PkFilePreviewDialog-CI22huzK.js} +2 -2
- package/dist/_chunks/{PkFilePreviewDialog-BOKJCapN.js.map → PkFilePreviewDialog-CI22huzK.js.map} +1 -1
- package/dist/_chunks/{PkImageEditorDialog-D-ikpGo8.js → PkImageEditorDialog-CAEninFi.js} +152 -130
- package/dist/_chunks/PkImageEditorDialog-CAEninFi.js.map +1 -0
- package/dist/_chunks/{PkSelectionActions-CXQTnSXQ.js → PkSelectionActions-BriGyWCi.js} +2 -2
- package/dist/_chunks/{PkSelectionActions-CXQTnSXQ.js.map → PkSelectionActions-BriGyWCi.js.map} +1 -1
- package/dist/_chunks/{PkStreamingMarkdown-5fgxYt_s.js → PkStreamingMarkdown--9i0feuM.js} +3 -3
- package/dist/_chunks/{PkStreamingMarkdown-5fgxYt_s.js.map → PkStreamingMarkdown--9i0feuM.js.map} +1 -1
- package/dist/_chunks/{PkToolChatFile-Cbmu6I0S.js → PkToolChatFile-BKGUnWrj.js} +3 -3
- package/dist/_chunks/{PkToolChatFile-Cbmu6I0S.js.map → PkToolChatFile-BKGUnWrj.js.map} +1 -1
- package/dist/_chunks/{PkToolShareDocument-Bxm1pSpj.js → PkToolShareDocument-BUg-uDTO.js} +2 -2
- package/dist/_chunks/{PkToolShareDocument-Bxm1pSpj.js.map → PkToolShareDocument-BUg-uDTO.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-CGUmoTfN.js → PkToolShowArtifact-BfLpz2-W.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-CGUmoTfN.js.map → PkToolShowArtifact-BfLpz2-W.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-DZ-kgXa6.js → PkToolShowContactForm-BsF6DFzV.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-DZ-kgXa6.js.map → PkToolShowContactForm-BsF6DFzV.js.map} +1 -1
- package/dist/_chunks/{PkToolShowDiagram-CwINVecL.js → PkToolShowDiagram-CcRJNDHo.js} +2 -2
- package/dist/_chunks/{PkToolShowDiagram-CwINVecL.js.map → PkToolShowDiagram-CcRJNDHo.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-BrxNGFCH.js → PkToolShowForm-w6RvbKEB.js} +3 -3
- package/dist/_chunks/{PkToolShowForm-BrxNGFCH.js.map → PkToolShowForm-w6RvbKEB.js.map} +1 -1
- package/dist/_chunks/{PkToolShowImageGallery-BGTncXxq.js → PkToolShowImageGallery-BEddh4He.js} +2 -2
- package/dist/_chunks/{PkToolShowImageGallery-BGTncXxq.js.map → PkToolShowImageGallery-BEddh4He.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-B3RSUWP7.js → PkToolShowSources-CGESvGrm.js} +2 -2
- package/dist/_chunks/{PkToolShowSources-B3RSUWP7.js.map → PkToolShowSources-CGESvGrm.js.map} +1 -1
- package/dist/_chunks/{useLightbox-C54BCSbU.js → useLightbox-TagJmiah.js} +38 -37
- package/dist/_chunks/useLightbox-TagJmiah.js.map +1 -0
- package/dist/_chunks/{utils-Do6urHUh.js → utils-zkq8kMz-.js} +7 -4
- package/{dist-vue/_chunks/utils-Do3JWPJe.js.map → dist/_chunks/utils-zkq8kMz-.js.map} +1 -1
- package/dist/ai-elements.es.js +2711 -2711
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotEmptyState.js +1 -1
- package/dist-vue/PkChatbotFilePreview.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotStepPayload.js +1 -1
- package/dist-vue/PkChatbotStepToolDetail.js +1 -1
- package/dist-vue/PkChatbotSteps.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewConversations.js +1 -1
- package/dist-vue/_chunks/{PkChart-BsF3OtnS.js → PkChart-DyyBXkd3.js} +2 -2
- package/dist-vue/_chunks/{PkChart-BsF3OtnS.js.map → PkChart-DyyBXkd3.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbot-BIQh81cA.js → PkChatbot-wsqj3EpU.js} +5 -5
- package/dist-vue/_chunks/{PkChatbot-BIQh81cA.js.map → PkChatbot-wsqj3EpU.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotEmptyState-pAeFPPQc.js → PkChatbotEmptyState-DcgIfNkX.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-pAeFPPQc.js.map → PkChatbotEmptyState-DcgIfNkX.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotFilePreview-BIta8Yg-.js → PkChatbotFilePreview-BDU2vY0F.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotFilePreview-BIta8Yg-.js.map → PkChatbotFilePreview-BDU2vY0F.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotInput-CN4rmNgu.js +520 -0
- package/dist-vue/_chunks/PkChatbotInput-CN4rmNgu.js.map +1 -0
- package/dist-vue/_chunks/PkChatbotMessages-BlF4Xp0_.js +1054 -0
- package/dist-vue/_chunks/{PkChatbotMessages-CZu8feEz.js.map → PkChatbotMessages-BlF4Xp0_.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepPayload-r25JHO7_.js → PkChatbotStepPayload-q9uXE5mr.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-r25JHO7_.js.map → PkChatbotStepPayload-q9uXE5mr.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-C897BpRX.js → PkChatbotStepToolDetail-BJz6Qwh3.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-C897BpRX.js.map → PkChatbotStepToolDetail-BJz6Qwh3.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-CRtIVwJV.js → PkChatbotSteps-DvJYNl_k.js} +5 -5
- package/dist-vue/_chunks/{PkChatbotSteps-CRtIVwJV.js.map → PkChatbotSteps-DvJYNl_k.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-BBCxj4Qz.js → PkChatbotViewChat-tmHyxxT3.js} +23 -23
- package/dist-vue/_chunks/{PkChatbotViewChat-BBCxj4Qz.js.map → PkChatbotViewChat-tmHyxxT3.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewConversations-rXGl7NKA.js → PkChatbotViewConversations-DOzUh_A7.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewConversations-rXGl7NKA.js.map → PkChatbotViewConversations-DOzUh_A7.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreview-1ZNyDAo5.js → PkFilePreview-Bp5-Pl54.js} +227 -227
- package/dist-vue/_chunks/{PkFilePreview-1ZNyDAo5.js.map → PkFilePreview-Bp5-Pl54.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreviewDialog-DnbUHGG2.js → PkFilePreviewDialog-CS885vBR.js} +2 -2
- package/dist-vue/_chunks/{PkFilePreviewDialog-DnbUHGG2.js.map → PkFilePreviewDialog-CS885vBR.js.map} +1 -1
- package/dist-vue/_chunks/{PkImageEditorDialog-Dn3HV_ny.js → PkImageEditorDialog-BhfdnsmX.js} +300 -278
- package/dist-vue/_chunks/PkImageEditorDialog-BhfdnsmX.js.map +1 -0
- package/dist-vue/_chunks/{PkStreamingMarkdown-COQLmP8b.js → PkStreamingMarkdown-NgrJUZPI.js} +3 -3
- package/dist-vue/_chunks/{PkStreamingMarkdown-COQLmP8b.js.map → PkStreamingMarkdown-NgrJUZPI.js.map} +1 -1
- package/dist-vue/_chunks/{PkSvgViewer-vkd5Dluw.js → PkSvgViewer-CRNwb6Yn.js} +2 -2
- package/dist-vue/_chunks/{PkSvgViewer-vkd5Dluw.js.map → PkSvgViewer-CRNwb6Yn.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolChatFile-e-7a0k7l.js → PkToolChatFile-DnmiNGF4.js} +3 -3
- package/dist-vue/_chunks/{PkToolChatFile-e-7a0k7l.js.map → PkToolChatFile-DnmiNGF4.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShareDocument-CspvFwRR.js → PkToolShareDocument-Bf7OE8XA.js} +2 -2
- package/dist-vue/_chunks/{PkToolShareDocument-CspvFwRR.js.map → PkToolShareDocument-Bf7OE8XA.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-CUP3VaC9.js → PkToolShowArtifact-C8ueuIGQ.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-CUP3VaC9.js.map → PkToolShowArtifact-C8ueuIGQ.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowChart-X6JZDAWD.js → PkToolShowChart-BWO6Hzlq.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowChart-X6JZDAWD.js.map → PkToolShowChart-BWO6Hzlq.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-BM8d9M5a.js → PkToolShowContactForm-BBcDsLEO.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-BM8d9M5a.js.map → PkToolShowContactForm-BBcDsLEO.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-DOdzpndK.js → PkToolShowDiagram-BzUcxOKy.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowDiagram-DOdzpndK.js.map → PkToolShowDiagram-BzUcxOKy.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-TYBf8q6g.js → PkToolShowForm-B6uhHzJ8.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowForm-TYBf8q6g.js.map → PkToolShowForm-B6uhHzJ8.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowImageGallery-BvwuoyF6.js → PkToolShowImageGallery-C39nlJrJ.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowImageGallery-BvwuoyF6.js.map → PkToolShowImageGallery-C39nlJrJ.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowLocation-WdRqG8Wi.js → PkToolShowLocation-Nhh_LwmN.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowLocation-WdRqG8Wi.js.map → PkToolShowLocation-Nhh_LwmN.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-_MHBAgNI.js → PkToolShowProductList-FLLkRCnm.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-_MHBAgNI.js.map → PkToolShowProductList-FLLkRCnm.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-CHw7qZtw.js → PkToolShowSources-Cb7r5jrX.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSources-CHw7qZtw.js.map → PkToolShowSources-Cb7r5jrX.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowVideo-D7oiBe4p.js → PkToolShowVideo-QDLhVlau.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowVideo-D7oiBe4p.js.map → PkToolShowVideo-QDLhVlau.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-CRq9Jhmw.js → PkToolShowWebPages-P6PdJTEE.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-CRq9Jhmw.js.map → PkToolShowWebPages-P6PdJTEE.js.map} +1 -1
- package/dist-vue/_chunks/{useLightbox-Ctl9zaMX.js → useLightbox-DmtNa8bJ.js} +38 -37
- package/dist-vue/_chunks/useLightbox-DmtNa8bJ.js.map +1 -0
- package/dist-vue/_chunks/{utils-Do3JWPJe.js → utils-D4B1FVGF.js} +6 -3
- package/dist-vue/_chunks/utils-D4B1FVGF.js.map +1 -0
- package/dist-vue/composables.js +1 -1
- package/dist-vue/index.js +61 -61
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/packages/components/src/chat/imageEdits.d.ts +3 -1
- package/dist-vue/packages/components/src/chat/utils.d.ts +6 -0
- package/dist-vue/packages/components/src/composables/useLightbox.d.ts +6 -0
- package/package.json +1 -1
- package/dist/_chunks/PkImageEditorDialog-D-ikpGo8.js.map +0 -1
- package/dist/_chunks/useLightbox-C54BCSbU.js.map +0 -1
- package/dist/_chunks/utils-Do6urHUh.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotInput-DSyIo0xB.js +0 -520
- package/dist-vue/_chunks/PkChatbotInput-DSyIo0xB.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotMessages-CZu8feEz.js +0 -1054
- package/dist-vue/_chunks/PkImageEditorDialog-Dn3HV_ny.js.map +0 -1
- package/dist-vue/_chunks/useLightbox-Ctl9zaMX.js.map +0 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Et as e, F as t, I as n, J as r, L as i, N as a, Ot as o, Q as s, S as c, Tt as l, V as u, X as d, _ as f, b as p, c as m, d as h, f as g, g as _, gt as v, h as y, k as b, kt as x, nt as S, ot as C, q as ee, r as w, tt as T, u as te, v as E, vt as ne, w as D, wt as O, y as k, z as A } from "./vue.runtime.esm-bundler-C2U5uTqB.js";
|
|
2
2
|
import { r as re } from "./vue-i18n-POtLvOl1.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { A as ie } from "./utils-zkq8kMz-.js";
|
|
4
|
+
import { h as ae, y as oe } from "./dist-D6oUr4J_.js";
|
|
5
|
+
import { a as j, d as se, m as M, r as ce } from "./index.es-DIHz5I8K.js";
|
|
6
|
+
import { t as le } from "./VvButtonLocalized-C8S7XJGv.js";
|
|
6
7
|
import { t as N } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
|
|
7
8
|
import { t as P } from "./PkEditorRadioButtons-Br4c42KS.js";
|
|
8
9
|
// ../../packages/components/src/chat/imageEdits.ts
|
|
9
|
-
var
|
|
10
|
+
var ue = {
|
|
10
11
|
red: {
|
|
11
12
|
fill: "#ff3b30",
|
|
12
13
|
edge: "#ffffff"
|
|
@@ -31,7 +32,7 @@ var le = {
|
|
|
31
32
|
fill: "#000000",
|
|
32
33
|
edge: "#ffffff"
|
|
33
34
|
}
|
|
34
|
-
},
|
|
35
|
+
}, de = "system-ui, -apple-system, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif", F = 16777216, fe = .92, pe = 12, me = 32, he = 3, ge = 160, _e = 16, ve = 28, I = 12, ye = 1.2, L = 4, be = 2.2, xe = .6, Se = {
|
|
35
36
|
"image/jpeg": "jpg",
|
|
36
37
|
"image/png": "png",
|
|
37
38
|
"image/webp": "webp"
|
|
@@ -48,7 +49,7 @@ function R(e, t = F) {
|
|
|
48
49
|
height: Math.max(1, Math.floor(e.height * r))
|
|
49
50
|
};
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
+
function Ce(e, t) {
|
|
52
53
|
let { width: n, height: r } = e;
|
|
53
54
|
for (let e of t) e.kind === "rotate" ? [n, r] = [r, n] : e.kind === "crop" && ({width: n, height: r} = e.rect);
|
|
54
55
|
return {
|
|
@@ -57,37 +58,41 @@ function Se(e, t) {
|
|
|
57
58
|
};
|
|
58
59
|
}
|
|
59
60
|
function z(e) {
|
|
60
|
-
return Math.max(
|
|
61
|
-
}
|
|
62
|
-
function Ce(e) {
|
|
63
|
-
return Math.max(me, Math.round(Math.min(e.width, e.height) / he));
|
|
61
|
+
return Math.max(pe, Math.round(Math.min(e.width, e.height) / me));
|
|
64
62
|
}
|
|
65
63
|
function we(e) {
|
|
66
|
-
return Math.max(
|
|
64
|
+
return Math.max(he, Math.round(Math.min(e.width, e.height) / ge));
|
|
65
|
+
}
|
|
66
|
+
function Te(e) {
|
|
67
|
+
return Math.max(_e, Math.round(Math.min(e.width, e.height) / ve));
|
|
67
68
|
}
|
|
68
69
|
function B(e) {
|
|
69
70
|
return Math.max(1, Math.round(e / 3));
|
|
70
71
|
}
|
|
71
|
-
function
|
|
72
|
-
let r = []
|
|
73
|
-
for (let
|
|
74
|
-
let e =
|
|
75
|
-
|
|
76
|
-
i = e;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
let
|
|
83
|
-
for (;
|
|
84
|
-
|
|
72
|
+
function Ee(e, t, n) {
|
|
73
|
+
let r = [];
|
|
74
|
+
for (let i of e.split("\n")) {
|
|
75
|
+
let e = "";
|
|
76
|
+
for (let a of i.split(/[ \t]+/).filter(Boolean)) {
|
|
77
|
+
let i = e ? `${e} ${a}` : a;
|
|
78
|
+
if (n(i) <= t) {
|
|
79
|
+
e = i;
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
e && r.push(e);
|
|
83
|
+
let o = a;
|
|
84
|
+
for (; o.length > 1 && n(o) > t;) {
|
|
85
|
+
let e = o.length - 1;
|
|
86
|
+
for (; e > 1 && n(o.slice(0, e)) > t;) e--;
|
|
87
|
+
r.push(o.slice(0, e)), o = o.slice(e);
|
|
88
|
+
}
|
|
89
|
+
e = o;
|
|
85
90
|
}
|
|
86
|
-
|
|
91
|
+
r.push(e);
|
|
87
92
|
}
|
|
88
|
-
return
|
|
93
|
+
return r;
|
|
89
94
|
}
|
|
90
|
-
function
|
|
95
|
+
function De(e, t, n) {
|
|
91
96
|
let r = t.x - e.x, i = t.y - e.y, a = Math.hypot(r, i);
|
|
92
97
|
if (!a) return {
|
|
93
98
|
lineEnd: t,
|
|
@@ -97,7 +102,7 @@ function Ee(e, t, n) {
|
|
|
97
102
|
t
|
|
98
103
|
]
|
|
99
104
|
};
|
|
100
|
-
let o = r / a, s = i / a, c = Math.min(n * L, a *
|
|
105
|
+
let o = r / a, s = i / a, c = Math.min(n * L, a * xe), l = c * be / L, u = {
|
|
101
106
|
x: t.x - o * c,
|
|
102
107
|
y: t.y - s * c
|
|
103
108
|
};
|
|
@@ -119,7 +124,7 @@ function Ee(e, t, n) {
|
|
|
119
124
|
]
|
|
120
125
|
};
|
|
121
126
|
}
|
|
122
|
-
function
|
|
127
|
+
function Oe(e, t, n, r) {
|
|
123
128
|
let i = Y(e.x, 0, n.width), a = Y(e.y, 0, n.height), o = t.x - i, s = t.y - a, c = o < 0 ? i : n.width - i, l = s < 0 ? a : n.height - a, u = Math.min(Math.abs(o), c), d = Math.min(Math.abs(s), l);
|
|
124
129
|
if (r) {
|
|
125
130
|
let e = Math.max(Math.abs(o), Math.abs(s) * r);
|
|
@@ -159,12 +164,12 @@ function V(e, t, n, r) {
|
|
|
159
164
|
}
|
|
160
165
|
}
|
|
161
166
|
function H(e, t, n) {
|
|
162
|
-
let r =
|
|
167
|
+
let r = Se[n];
|
|
163
168
|
if (n === t || !r) return e;
|
|
164
169
|
let i = e.lastIndexOf(".");
|
|
165
170
|
return `${i > 0 ? e.slice(0, i) : e}.${r}`;
|
|
166
171
|
}
|
|
167
|
-
async function
|
|
172
|
+
async function ke(e) {
|
|
168
173
|
let t = await createImageBitmap(e, { imageOrientation: "from-image" });
|
|
169
174
|
try {
|
|
170
175
|
let e = {
|
|
@@ -179,16 +184,16 @@ async function Oe(e) {
|
|
|
179
184
|
t.close();
|
|
180
185
|
}
|
|
181
186
|
}
|
|
182
|
-
function
|
|
187
|
+
function Ae(e, t) {
|
|
183
188
|
let n = G(e);
|
|
184
189
|
K(n).drawImage(e, 0, 0);
|
|
185
190
|
for (let e of t) {
|
|
186
191
|
if (e.kind === "cover") {
|
|
187
|
-
|
|
192
|
+
Me(n, e.rect, e.style);
|
|
188
193
|
continue;
|
|
189
194
|
}
|
|
190
195
|
if (e.kind !== "rotate" && e.kind !== "crop") {
|
|
191
|
-
|
|
196
|
+
je(K(n), e);
|
|
192
197
|
continue;
|
|
193
198
|
}
|
|
194
199
|
let t = e.kind === "rotate" ? q(n, e.turn) : J(n, e.rect);
|
|
@@ -196,12 +201,12 @@ function ke(e, t) {
|
|
|
196
201
|
}
|
|
197
202
|
return n;
|
|
198
203
|
}
|
|
199
|
-
function
|
|
200
|
-
let { fill: n, edge: r } =
|
|
204
|
+
function je(e, t) {
|
|
205
|
+
let { fill: n, edge: r } = ue[t.color];
|
|
201
206
|
if (e.save(), e.lineCap = "round", e.lineJoin = "round", t.kind === "text") {
|
|
202
207
|
let { at: i, size: a } = t;
|
|
203
|
-
e.font = `700 ${a}px ${
|
|
204
|
-
let o =
|
|
208
|
+
e.font = `700 ${a}px ${de}`, e.textBaseline = "top", e.lineWidth = Math.max(1, Math.round(a / I)) * 2, e.strokeStyle = r, e.fillStyle = n;
|
|
209
|
+
let o = Ee(t.text, t.maxWidth, (t) => e.measureText(t).width), s = (e) => i.y + a * (e * ye + .19999999999999996 / 2);
|
|
205
210
|
o.forEach((t, n) => e.strokeText(t, i.x, s(n))), o.forEach((t, n) => e.fillText(t, i.x, s(n))), e.restore();
|
|
206
211
|
return;
|
|
207
212
|
}
|
|
@@ -209,16 +214,16 @@ function Ae(e, t) {
|
|
|
209
214
|
for (let [a, o] of [[r, i * 2], [n, 0]]) if (e.strokeStyle = a, e.fillStyle = a, e.lineWidth = t.width + o, t.kind === "rect") {
|
|
210
215
|
let { x: n, y: r, width: i, height: a } = t.rect;
|
|
211
216
|
e.strokeRect(n, r, i, a);
|
|
212
|
-
} else if (t.kind === "path")
|
|
217
|
+
} else if (t.kind === "path") Ne(e, t.points), e.stroke();
|
|
213
218
|
else {
|
|
214
|
-
let { lineEnd: n, head: r } =
|
|
219
|
+
let { lineEnd: n, head: r } = De(t.from, t.to, t.width);
|
|
215
220
|
e.beginPath(), e.moveTo(t.from.x, t.from.y), e.lineTo(n.x, n.y), e.stroke(), e.beginPath(), e.moveTo(r[0].x, r[0].y), e.lineTo(r[1].x, r[1].y), e.lineTo(r[2].x, r[2].y), e.closePath(), e.fill(), o && (e.lineWidth = o, e.stroke());
|
|
216
221
|
}
|
|
217
222
|
e.restore();
|
|
218
223
|
}
|
|
219
224
|
function U(e, t) {
|
|
220
225
|
return new Promise((n, r) => {
|
|
221
|
-
e.toBlob((e) => e ? n(e) : r(/* @__PURE__ */ Error("The image could not be written")), t,
|
|
226
|
+
e.toBlob((e) => e ? n(e) : r(/* @__PURE__ */ Error("The image could not be written")), t, fe);
|
|
222
227
|
});
|
|
223
228
|
}
|
|
224
229
|
function W(e) {
|
|
@@ -244,7 +249,7 @@ function J(e, t) {
|
|
|
244
249
|
let n = G(t);
|
|
245
250
|
return K(n).drawImage(e, t.x, t.y, t.width, t.height, 0, 0, t.width, t.height), n;
|
|
246
251
|
}
|
|
247
|
-
function
|
|
252
|
+
function Me(e, t, n) {
|
|
248
253
|
let r = K(e);
|
|
249
254
|
if (n === "solid") {
|
|
250
255
|
r.fillStyle = "#000000", r.fillRect(t.x, t.y, t.width, t.height);
|
|
@@ -253,7 +258,7 @@ function je(e, t, n) {
|
|
|
253
258
|
let i = r.getImageData(t.x, t.y, t.width, t.height);
|
|
254
259
|
V(i.data, t.width, t.height, z(e)), r.putImageData(i, t.x, t.y);
|
|
255
260
|
}
|
|
256
|
-
function
|
|
261
|
+
function Ne(e, t) {
|
|
257
262
|
let [n, ...r] = t, i = r[r.length - 1];
|
|
258
263
|
if (e.beginPath(), !n) return;
|
|
259
264
|
e.moveTo(n.x, n.y);
|
|
@@ -264,7 +269,7 @@ function Me(e, t) {
|
|
|
264
269
|
let a = i ?? n;
|
|
265
270
|
e.lineTo(a.x, a.y);
|
|
266
271
|
}
|
|
267
|
-
function
|
|
272
|
+
function Pe(e, t) {
|
|
268
273
|
return {
|
|
269
274
|
x: Y(e.x, 0, t.width),
|
|
270
275
|
y: Y(e.y, 0, t.height)
|
|
@@ -275,7 +280,7 @@ function Y(e, t, n) {
|
|
|
275
280
|
}
|
|
276
281
|
// ../../packages/components/src/chat/PkImageEditor.vue?vue&type=script&setup=true&lang.ts
|
|
277
282
|
b(), C(), l(), w();
|
|
278
|
-
var
|
|
283
|
+
var Fe = { class: "pk-image-editor" }, Ie = { class: "pk-image-editor__toolbar" }, Le = ["title"], Re = { class: "pk-image-editor__tool-label" }, ze = ["id"], Be = { class: "pk-image-editor__hint" }, Ve = { class: "pk-image-editor__hint" }, He = ["id"], Ue = ["title"], We = { class: "u-visually-hidden" }, Ge = { class: "pk-image-editor__hint" }, Ke = ["aria-label"], qe = 6, Je = 2, Ye = 200, Xe = /*#__PURE__*/ N(/* @__PURE__ */ D({
|
|
279
284
|
__name: "PkImageEditor",
|
|
280
285
|
props: /*@__PURE__*/ a({
|
|
281
286
|
image: { type: null },
|
|
@@ -286,12 +291,12 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
286
291
|
}),
|
|
287
292
|
emits: /*@__PURE__*/ a(["error"], ["update:edits"]),
|
|
288
293
|
setup(a, { expose: l, emit: f }) {
|
|
289
|
-
let b = a, C = f, w = r(a, "edits"), { t: D } = re({ useScope: "global" }),
|
|
294
|
+
let b = a, C = f, w = r(a, "edits"), { t: D } = re({ useScope: "global" }), ae = {
|
|
290
295
|
free: void 0,
|
|
291
296
|
"1:1": 1,
|
|
292
297
|
"4:3": 4 / 3,
|
|
293
298
|
"16:9": 16 / 9
|
|
294
|
-
}, j = v(b.initialTool ?? "crop"), M = v("free"), N = v("solid"), F = v("red"),
|
|
299
|
+
}, j = v(b.initialTool ?? "crop"), M = v("free"), N = v("solid"), F = v("red"), fe = y(() => [
|
|
295
300
|
{
|
|
296
301
|
value: "crop",
|
|
297
302
|
label: D("imageEditor.crop"),
|
|
@@ -322,7 +327,7 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
322
327
|
label: D("imageEditor.text"),
|
|
323
328
|
icon: "ri:text"
|
|
324
329
|
}
|
|
325
|
-
]),
|
|
330
|
+
]), pe = y(() => [
|
|
326
331
|
{
|
|
327
332
|
value: "free",
|
|
328
333
|
label: D("imageEditor.aspectFree")
|
|
@@ -339,13 +344,13 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
339
344
|
value: "16:9",
|
|
340
345
|
label: "16:9"
|
|
341
346
|
}
|
|
342
|
-
]),
|
|
347
|
+
]), me = y(() => [{
|
|
343
348
|
value: "solid",
|
|
344
349
|
label: D("imageEditor.coverSolid")
|
|
345
350
|
}, {
|
|
346
351
|
value: "pixelate",
|
|
347
352
|
label: D("imageEditor.coverPixelate")
|
|
348
|
-
}]),
|
|
353
|
+
}]), he = y(() => [
|
|
349
354
|
{
|
|
350
355
|
value: "red",
|
|
351
356
|
label: D("imageEditor.colorRed")
|
|
@@ -370,96 +375,96 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
370
375
|
value: "black",
|
|
371
376
|
label: D("imageEditor.colorBlack")
|
|
372
377
|
}
|
|
373
|
-
]),
|
|
378
|
+
]), ge = y(() => {
|
|
374
379
|
switch (j.value) {
|
|
375
380
|
case "arrow": return D("imageEditor.arrowHint");
|
|
376
381
|
case "rect": return D("imageEditor.rectHint");
|
|
377
382
|
case "path": return D("imageEditor.pathHint");
|
|
378
383
|
default: return D("imageEditor.textHint");
|
|
379
384
|
}
|
|
380
|
-
}),
|
|
385
|
+
}), _e = ee(), ve = ee(), I = v([]);
|
|
381
386
|
function L(e) {
|
|
382
387
|
w.value = [...w.value, e], I.value = [];
|
|
383
388
|
}
|
|
384
|
-
function
|
|
389
|
+
function be() {
|
|
385
390
|
G.value = void 0;
|
|
386
391
|
let e = w.value[w.value.length - 1];
|
|
387
392
|
e && (w.value = w.value.slice(0, -1), I.value = [...I.value, e]);
|
|
388
393
|
}
|
|
389
|
-
function
|
|
394
|
+
function xe() {
|
|
390
395
|
G.value = void 0;
|
|
391
396
|
let e = I.value[I.value.length - 1];
|
|
392
397
|
e && (w.value = [...w.value, e], I.value = I.value.slice(0, -1));
|
|
393
398
|
}
|
|
394
|
-
function
|
|
399
|
+
function Se(e) {
|
|
395
400
|
G.value = void 0, L({
|
|
396
401
|
kind: "rotate",
|
|
397
402
|
turn: e
|
|
398
403
|
});
|
|
399
404
|
}
|
|
400
|
-
let R = y(() =>
|
|
401
|
-
function
|
|
405
|
+
let R = y(() => Ce(b.image, w.value)), z = d("stageEl"), B;
|
|
406
|
+
function Ee() {
|
|
402
407
|
if (!z.value) return;
|
|
403
408
|
let e;
|
|
404
409
|
try {
|
|
405
|
-
e =
|
|
410
|
+
e = Ae(b.image, w.value);
|
|
406
411
|
} catch {
|
|
407
412
|
C("error");
|
|
408
413
|
return;
|
|
409
414
|
}
|
|
410
415
|
e.setAttribute("role", "img"), e.setAttribute("aria-label", D("imageEditor.canvasLabel")), z.value.replaceChildren(e), B && W(B), B = e;
|
|
411
416
|
}
|
|
412
|
-
i(
|
|
417
|
+
i(Ee), s([() => b.image, w], Ee, { flush: "post" }), n(() => {
|
|
413
418
|
B && W(B), Z.value && W(Z.value);
|
|
414
419
|
});
|
|
415
|
-
let
|
|
420
|
+
let De = d("areaEl"), V = v({
|
|
416
421
|
width: 0,
|
|
417
422
|
height: 0
|
|
418
423
|
});
|
|
419
|
-
|
|
424
|
+
oe(De, ([e]) => {
|
|
420
425
|
e && (V.value = {
|
|
421
426
|
width: e.contentRect.width,
|
|
422
427
|
height: e.contentRect.height
|
|
423
428
|
});
|
|
424
429
|
});
|
|
425
|
-
let H = y(() => Math.min(1, V.value.width / R.value.width, V.value.height / R.value.height)),
|
|
430
|
+
let H = y(() => Math.min(1, V.value.width / R.value.width, V.value.height / R.value.height)), ke = y(() => ({
|
|
426
431
|
width: `${Math.max(1, Math.floor(R.value.width * H.value))}px`,
|
|
427
432
|
height: `${Math.max(1, Math.floor(R.value.height * H.value))}px`
|
|
428
433
|
})), U = d("frameEl"), G = v(), K = v(), q = ne(), J;
|
|
429
|
-
function
|
|
434
|
+
function Me(e) {
|
|
430
435
|
let t = U.value?.getBoundingClientRect();
|
|
431
436
|
return !t?.width || !t.height ? {
|
|
432
437
|
x: 0,
|
|
433
438
|
y: 0
|
|
434
|
-
} :
|
|
439
|
+
} : Pe({
|
|
435
440
|
x: (e.clientX - t.left) / t.width * R.value.width,
|
|
436
441
|
y: (e.clientY - t.top) / t.height * R.value.height
|
|
437
442
|
}, R.value);
|
|
438
443
|
}
|
|
439
|
-
function
|
|
444
|
+
function Ne(e) {
|
|
440
445
|
if (e.button !== 0 || J !== void 0) return;
|
|
441
|
-
|
|
442
|
-
let t =
|
|
446
|
+
U.value?.setPointerCapture(e.pointerId), J = e.pointerId;
|
|
447
|
+
let t = Me(e);
|
|
443
448
|
K.value = t, G.value = void 0, j.value === "path" && (q.value = {
|
|
444
449
|
kind: "path",
|
|
445
450
|
points: [t],
|
|
446
451
|
color: F.value,
|
|
447
|
-
width:
|
|
452
|
+
width: we(R.value)
|
|
448
453
|
});
|
|
449
454
|
}
|
|
450
455
|
function Y(e) {
|
|
451
456
|
let t = K.value;
|
|
452
457
|
if (!t || e.pointerId !== J) return;
|
|
453
|
-
let n =
|
|
458
|
+
let n = Me(e), r = we(R.value);
|
|
454
459
|
switch (j.value) {
|
|
455
460
|
case "crop":
|
|
456
461
|
case "cover":
|
|
457
|
-
G.value =
|
|
462
|
+
G.value = Oe(t, n, R.value, j.value === "crop" ? ae[M.value] : void 0);
|
|
458
463
|
break;
|
|
459
464
|
case "rect":
|
|
460
465
|
q.value = {
|
|
461
466
|
kind: "rect",
|
|
462
|
-
rect:
|
|
467
|
+
rect: Oe(t, n, R.value),
|
|
463
468
|
color: F.value,
|
|
464
469
|
width: r
|
|
465
470
|
};
|
|
@@ -475,7 +480,7 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
475
480
|
break;
|
|
476
481
|
case "path": {
|
|
477
482
|
let e = q.value, t = e?.kind === "path" ? e.points[e.points.length - 1] : void 0;
|
|
478
|
-
e?.kind === "path" && t &&
|
|
483
|
+
e?.kind === "path" && t && mt(t, n) * H.value >= Je && (q.value = {
|
|
479
484
|
...e,
|
|
480
485
|
points: [...e.points, n]
|
|
481
486
|
});
|
|
@@ -514,7 +519,7 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
514
519
|
}
|
|
515
520
|
function Qe(e) {
|
|
516
521
|
switch (e.kind) {
|
|
517
|
-
case "arrow": return X(
|
|
522
|
+
case "arrow": return X(mt(e.from, e.to));
|
|
518
523
|
case "rect": return X(e.rect.width) && X(e.rect.height);
|
|
519
524
|
case "path": return e.points.length > 1;
|
|
520
525
|
default: return !0;
|
|
@@ -529,12 +534,13 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
529
534
|
W(e);
|
|
530
535
|
return;
|
|
531
536
|
}
|
|
532
|
-
let r = window.devicePixelRatio || 1;
|
|
533
|
-
e.width
|
|
534
|
-
let
|
|
535
|
-
if (!
|
|
536
|
-
|
|
537
|
-
|
|
537
|
+
let r = window.devicePixelRatio || 1, i = Math.round(t.clientWidth * r), a = Math.round(t.clientHeight * r);
|
|
538
|
+
(e.width !== i || e.height !== a) && (e.width = i, e.height = a);
|
|
539
|
+
let o = e.getContext("2d");
|
|
540
|
+
if (!o) return;
|
|
541
|
+
o.setTransform(1, 0, 0, 1, 0, 0), o.clearRect(0, 0, i, a);
|
|
542
|
+
let s = i / R.value.width;
|
|
543
|
+
o.setTransform(s, 0, 0, s, 0, 0), je(o, n);
|
|
538
544
|
}
|
|
539
545
|
s(q, $e, { flush: "post" });
|
|
540
546
|
let et = y(() => j.value === "crop" && !K.value && !!G.value);
|
|
@@ -547,10 +553,10 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
547
553
|
}
|
|
548
554
|
s(M, (e) => {
|
|
549
555
|
let t = G.value;
|
|
550
|
-
t && j.value === "crop" && (G.value =
|
|
556
|
+
t && j.value === "crop" && (G.value = Oe(t, {
|
|
551
557
|
x: t.x + t.width,
|
|
552
558
|
y: t.y + t.height
|
|
553
|
-
}, R.value,
|
|
559
|
+
}, R.value, ae[e]));
|
|
554
560
|
});
|
|
555
561
|
let nt = y(() => {
|
|
556
562
|
let e = G.value;
|
|
@@ -565,7 +571,7 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
565
571
|
$(), Q.value = {
|
|
566
572
|
at: e,
|
|
567
573
|
text: ""
|
|
568
|
-
}, await t(),
|
|
574
|
+
}, await t(), dt(), rt.value?.focus();
|
|
569
575
|
}
|
|
570
576
|
function $() {
|
|
571
577
|
let e = Q.value;
|
|
@@ -576,31 +582,40 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
576
582
|
at: e.at,
|
|
577
583
|
text: t,
|
|
578
584
|
color: F.value,
|
|
579
|
-
size:
|
|
585
|
+
size: Te(R.value),
|
|
580
586
|
maxWidth: R.value.width - e.at.x
|
|
581
587
|
});
|
|
582
588
|
}
|
|
583
|
-
let at = (
|
|
589
|
+
let at = d("optionsEl");
|
|
584
590
|
function ot(e) {
|
|
585
|
-
|
|
591
|
+
document.hasFocus() && (e.relatedTarget instanceof Node && at.value?.contains(e.relatedTarget) || $());
|
|
586
592
|
}
|
|
587
593
|
function st(e) {
|
|
588
|
-
|
|
594
|
+
Q.value && e.preventDefault();
|
|
595
|
+
}
|
|
596
|
+
function ct(e) {
|
|
597
|
+
e.detail && Q.value && rt.value?.focus();
|
|
598
|
+
}
|
|
599
|
+
function lt(e) {
|
|
600
|
+
ie(e) || (e.preventDefault(), $());
|
|
589
601
|
}
|
|
590
|
-
function
|
|
602
|
+
function ut(e) {
|
|
603
|
+
ie(e) || (e.preventDefault(), Q.value = void 0);
|
|
604
|
+
}
|
|
605
|
+
function dt() {
|
|
591
606
|
let e = rt.value;
|
|
592
607
|
e && (e.style.height = "auto", e.style.height = `${e.scrollHeight}px`);
|
|
593
608
|
}
|
|
594
|
-
let
|
|
609
|
+
let ft = y(() => !!Q.value?.text.trim()), pt = y(() => {
|
|
595
610
|
let e = Q.value;
|
|
596
611
|
if (!e) return;
|
|
597
|
-
let { fill: t, edge: n } =
|
|
612
|
+
let { fill: t, edge: n } = ue[F.value];
|
|
598
613
|
return {
|
|
599
614
|
left: `${e.at.x / R.value.width * 100}%`,
|
|
600
615
|
top: `${e.at.y / R.value.height * 100}%`,
|
|
601
|
-
fontFamily:
|
|
602
|
-
fontSize: `${
|
|
603
|
-
lineHeight: String(
|
|
616
|
+
fontFamily: de,
|
|
617
|
+
fontSize: `${Te(R.value) * H.value}px`,
|
|
618
|
+
lineHeight: String(ye),
|
|
604
619
|
color: t,
|
|
605
620
|
"--pk-image-editor-text-edge": n
|
|
606
621
|
};
|
|
@@ -608,19 +623,19 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
608
623
|
s(j, () => {
|
|
609
624
|
G.value = void 0, q.value = void 0, $();
|
|
610
625
|
}), l({
|
|
611
|
-
pending: y(() => et.value ||
|
|
626
|
+
pending: y(() => et.value || ft.value),
|
|
612
627
|
applyPending: () => {
|
|
613
628
|
tt(), $();
|
|
614
629
|
},
|
|
615
630
|
shownCanvas: () => B
|
|
616
631
|
});
|
|
617
|
-
function
|
|
632
|
+
function mt(e, t) {
|
|
618
633
|
return Math.hypot(t.x - e.x, t.y - e.y);
|
|
619
634
|
}
|
|
620
635
|
return (t, n) => {
|
|
621
|
-
let r =
|
|
622
|
-
return A(), k("div",
|
|
623
|
-
_("div",
|
|
636
|
+
let r = ce, i = le, a = se;
|
|
637
|
+
return A(), k("div", Fe, [
|
|
638
|
+
_("div", Ie, [
|
|
624
639
|
c(P, {
|
|
625
640
|
modelValue: j.value,
|
|
626
641
|
"onUpdate:modelValue": n[0] ||= (e) => j.value = e,
|
|
@@ -628,8 +643,8 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
628
643
|
segmented: "",
|
|
629
644
|
class: "mb-0",
|
|
630
645
|
"aria-label": O(D)("imageEditor.tool"),
|
|
631
|
-
options:
|
|
632
|
-
}, p({ _: 2 }, [u(
|
|
646
|
+
options: fe.value
|
|
647
|
+
}, p({ _: 2 }, [u(fe.value, (e) => ({
|
|
633
648
|
name: e.value,
|
|
634
649
|
fn: T(() => [_("span", {
|
|
635
650
|
class: "pk-image-editor__tool",
|
|
@@ -637,7 +652,7 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
637
652
|
}, [c(r, {
|
|
638
653
|
name: e.icon,
|
|
639
654
|
class: "w-16 h-16"
|
|
640
|
-
}, null, 8, ["name"]), _("span",
|
|
655
|
+
}, null, 8, ["name"]), _("span", Re, x(e.label), 1)], 8, Le)])
|
|
641
656
|
}))]), 1032, [
|
|
642
657
|
"modelValue",
|
|
643
658
|
"aria-label",
|
|
@@ -649,13 +664,13 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
649
664
|
icon: "ri:anticlockwise-line",
|
|
650
665
|
title: O(D)("imageEditor.rotateLeft"),
|
|
651
666
|
"aria-label": O(D)("imageEditor.rotateLeft"),
|
|
652
|
-
onClick: n[1] ||= (e) =>
|
|
667
|
+
onClick: n[1] ||= (e) => Se(-1)
|
|
653
668
|
}, null, 8, ["title", "aria-label"]), c(i, {
|
|
654
669
|
modifiers: "action-quiet",
|
|
655
670
|
icon: "ri:clockwise-line",
|
|
656
671
|
title: O(D)("imageEditor.rotateRight"),
|
|
657
672
|
"aria-label": O(D)("imageEditor.rotateRight"),
|
|
658
|
-
onClick: n[2] ||= (e) =>
|
|
673
|
+
onClick: n[2] ||= (e) => Se(1)
|
|
659
674
|
}, null, 8, ["title", "aria-label"])]),
|
|
660
675
|
_: 1
|
|
661
676
|
}),
|
|
@@ -669,7 +684,7 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
669
684
|
title: O(D)("imageEditor.undo"),
|
|
670
685
|
"aria-label": O(D)("imageEditor.undo"),
|
|
671
686
|
disabled: !w.value.length,
|
|
672
|
-
onClick:
|
|
687
|
+
onClick: be
|
|
673
688
|
}, null, 8, [
|
|
674
689
|
"title",
|
|
675
690
|
"aria-label",
|
|
@@ -680,7 +695,7 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
680
695
|
title: O(D)("imageEditor.redo"),
|
|
681
696
|
"aria-label": O(D)("imageEditor.redo"),
|
|
682
697
|
disabled: !I.value.length,
|
|
683
|
-
onClick:
|
|
698
|
+
onClick: xe
|
|
684
699
|
}, null, 8, [
|
|
685
700
|
"title",
|
|
686
701
|
"aria-label",
|
|
@@ -689,9 +704,15 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
689
704
|
_: 1
|
|
690
705
|
})
|
|
691
706
|
]),
|
|
692
|
-
_("div",
|
|
707
|
+
_("div", {
|
|
708
|
+
ref_key: "optionsEl",
|
|
709
|
+
ref: at,
|
|
710
|
+
class: "pk-image-editor__options",
|
|
711
|
+
onMousedown: st,
|
|
712
|
+
onClick: ct
|
|
713
|
+
}, [j.value === "crop" ? (A(), k(g, { key: 0 }, [
|
|
693
714
|
_("span", {
|
|
694
|
-
id: O(
|
|
715
|
+
id: O(_e),
|
|
695
716
|
class: "pk-image-editor__label"
|
|
696
717
|
}, x(O(D)("imageEditor.aspect")), 9, ze),
|
|
697
718
|
c(P, {
|
|
@@ -700,8 +721,8 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
700
721
|
name: "pk-image-editor-aspect",
|
|
701
722
|
segmented: "",
|
|
702
723
|
class: "mb-0",
|
|
703
|
-
"aria-labelledby": O(
|
|
704
|
-
options:
|
|
724
|
+
"aria-labelledby": O(_e),
|
|
725
|
+
options: pe.value
|
|
705
726
|
}, null, 8, [
|
|
706
727
|
"modelValue",
|
|
707
728
|
"aria-labelledby",
|
|
@@ -722,14 +743,14 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
722
743
|
segmented: "",
|
|
723
744
|
class: "mb-0",
|
|
724
745
|
"aria-label": O(D)("imageEditor.coverStyle"),
|
|
725
|
-
options:
|
|
746
|
+
options: me.value
|
|
726
747
|
}, null, 8, [
|
|
727
748
|
"modelValue",
|
|
728
749
|
"aria-label",
|
|
729
750
|
"options"
|
|
730
751
|
]), _("span", Ve, x(O(D)("imageEditor.coverHint")), 1)], 64)) : (A(), k(g, { key: 2 }, [
|
|
731
752
|
_("span", {
|
|
732
|
-
id: O(
|
|
753
|
+
id: O(ve),
|
|
733
754
|
class: "pk-image-editor__label"
|
|
734
755
|
}, x(O(D)("imageEditor.color")), 9, He),
|
|
735
756
|
c(P, {
|
|
@@ -738,37 +759,38 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
738
759
|
name: "pk-image-editor-color",
|
|
739
760
|
segmented: "",
|
|
740
761
|
class: "mb-0",
|
|
741
|
-
"aria-labelledby": O(
|
|
742
|
-
options:
|
|
743
|
-
}, p({ _: 2 }, [u(
|
|
762
|
+
"aria-labelledby": O(ve),
|
|
763
|
+
options: he.value
|
|
764
|
+
}, p({ _: 2 }, [u(he.value, (e) => ({
|
|
744
765
|
name: e.value,
|
|
745
766
|
fn: T(() => [_("span", {
|
|
746
767
|
class: "pk-image-editor__color",
|
|
747
768
|
title: e.label
|
|
748
769
|
}, [_("span", {
|
|
749
770
|
class: "pk-image-editor__swatch",
|
|
750
|
-
style: o({ backgroundColor: O(
|
|
771
|
+
style: o({ backgroundColor: O(ue)[e.value].fill })
|
|
751
772
|
}, null, 4), _("span", We, x(e.label), 1)], 8, Ue)])
|
|
752
773
|
}))]), 1032, [
|
|
753
774
|
"modelValue",
|
|
754
775
|
"aria-labelledby",
|
|
755
776
|
"options"
|
|
756
777
|
]),
|
|
757
|
-
_("span", Ge, x(
|
|
758
|
-
], 64))]),
|
|
778
|
+
_("span", Ge, x(ge.value), 1)
|
|
779
|
+
], 64))], 544),
|
|
759
780
|
_("div", {
|
|
760
781
|
ref_key: "areaEl",
|
|
761
|
-
ref:
|
|
782
|
+
ref: De,
|
|
762
783
|
class: "pk-image-editor__area"
|
|
763
784
|
}, [_("div", {
|
|
764
785
|
ref_key: "frameEl",
|
|
765
786
|
ref: U,
|
|
766
787
|
class: e(["pk-image-editor__frame", { "pk-image-editor__frame--text": j.value === "text" }]),
|
|
767
|
-
style: o(
|
|
768
|
-
onPointerdown:
|
|
788
|
+
style: o(ke.value),
|
|
789
|
+
onPointerdown: Ne,
|
|
769
790
|
onPointermove: Y,
|
|
770
791
|
onPointerup: Xe,
|
|
771
|
-
onPointercancel: Ze
|
|
792
|
+
onPointercancel: Ze,
|
|
793
|
+
onLostpointercapture: Ze
|
|
772
794
|
}, [
|
|
773
795
|
_("div", {
|
|
774
796
|
ref_key: "stageEl",
|
|
@@ -797,11 +819,11 @@ var Pe = { class: "pk-image-editor" }, Fe = { class: "pk-image-editor__toolbar"
|
|
|
797
819
|
rows: "1",
|
|
798
820
|
maxlength: Ye,
|
|
799
821
|
"aria-label": O(D)("imageEditor.textLabel"),
|
|
800
|
-
style: o(
|
|
822
|
+
style: o(pt.value),
|
|
801
823
|
onPointerdown: n[7] ||= h(() => {}, ["stop"]),
|
|
802
|
-
onInput:
|
|
803
|
-
onKeydown: [te(
|
|
804
|
-
onBlur:
|
|
824
|
+
onInput: dt,
|
|
825
|
+
onKeydown: [te(lt, ["enter"]), te(ut, ["esc"])],
|
|
826
|
+
onBlur: ot
|
|
805
827
|
}, null, 44, Ke)), [[m, Q.value.text]]) : E("", !0)
|
|
806
828
|
], 38)], 512)
|
|
807
829
|
]);
|
|
@@ -821,10 +843,10 @@ var Ze = ["aria-label"], X = {
|
|
|
821
843
|
},
|
|
822
844
|
emits: ["close", "apply"],
|
|
823
845
|
setup(e, { emit: r }) {
|
|
824
|
-
let a = e, o = r, { t: s } = re({ useScope: "global" }), l =
|
|
846
|
+
let a = e, o = r, { t: s } = re({ useScope: "global" }), l = ae("(max-width: 575.98px)"), u = ne(), p = ne(), m = v(), h = v([]), g = v(!1), _ = d("editorEl"), b = !1;
|
|
825
847
|
i(async () => {
|
|
826
848
|
try {
|
|
827
|
-
let e = await a.file, t = await
|
|
849
|
+
let e = await a.file, t = await ke(e);
|
|
828
850
|
if (b) {
|
|
829
851
|
W(t.image);
|
|
830
852
|
return;
|
|
@@ -836,7 +858,7 @@ var Ze = ["aria-label"], X = {
|
|
|
836
858
|
}), n(() => {
|
|
837
859
|
b = !0, p.value && W(p.value.image);
|
|
838
860
|
});
|
|
839
|
-
let S = y(() => p.value &&
|
|
861
|
+
let S = y(() => p.value && Ce(p.value.image, h.value)), C = y(() => !!p.value && p.value.image.width < p.value.original.width), ee = y(() => h.value.length > 0 || !!_.value?.pending);
|
|
840
862
|
async function w() {
|
|
841
863
|
let e = _.value, n = u.value;
|
|
842
864
|
if (e && n) {
|
|
@@ -869,7 +891,7 @@ var Ze = ["aria-label"], X = {
|
|
|
869
891
|
}
|
|
870
892
|
});
|
|
871
893
|
return (t, n) => {
|
|
872
|
-
let r = j, i =
|
|
894
|
+
let r = j, i = ce, a = le, u = se, d = M;
|
|
873
895
|
return A(), f(d, {
|
|
874
896
|
"model-value": !0,
|
|
875
897
|
title: O(s)("imageEditor.title"),
|
|
@@ -936,4 +958,4 @@ var Ze = ["aria-label"], X = {
|
|
|
936
958
|
}), [["styles", [".pk-image-editor-dialog:not(.vv-dialog--fullscreen)>article{width:min(64rem,94dvw);height:min(48rem,92dvh)}.pk-image-editor-dialog.vv-dialog--fullscreen>article{max-height:none}.pk-image-editor-dialog .vv-dialog__content{flex-direction:column;flex:1;min-height:0;padding:0;display:flex}.pk-image-editor-dialog__loading{color:var(--color-word-3);font-size:var(--text-24);flex:1;justify-content:center;align-items:center;display:flex}.pk-image-editor-dialog__size{padding:var(--spacing-8) var(--spacing-md);border-top:1px solid var(--color-surface-3);color:var(--color-word-3);font-size:var(--text-12);font-variant-numeric:tabular-nums;margin:0}"]]]);
|
|
937
959
|
export { Qe as default };
|
|
938
960
|
|
|
939
|
-
//# sourceMappingURL=PkImageEditorDialog-
|
|
961
|
+
//# sourceMappingURL=PkImageEditorDialog-CAEninFi.js.map
|