@beeintel/batch-image 1.0.0 → 1.1.0

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 (56) hide show
  1. package/README.md +7 -3
  2. package/dist/chunks/{AdjustToolPanel-B6dtlFlj.js → AdjustToolPanel-DCNhkuE4.js} +21 -20
  3. package/dist/chunks/BackgroundToolPanel-D3TILm-m.js +43 -0
  4. package/dist/chunks/{BatchMaterials-DDoJTaS5.js → BatchMaterials-BPJeE3y9.js} +1 -1
  5. package/dist/chunks/BatchModeChoices-BuP83uOq.js +118 -0
  6. package/dist/chunks/{BatchOutputColorPicker-D7WIDS4_.js → BatchOutputColorPicker-CZoQzBII.js} +2 -2
  7. package/dist/chunks/BatchReferenceFields-B7SL__lu.js +308 -0
  8. package/dist/chunks/BeautifyToolPanel-DsTOjndh.js +220 -0
  9. package/dist/chunks/{BrandMarkToolPanel-vKobk_R3.js → BrandMarkToolPanel-Cob9bPYT.js} +319 -333
  10. package/dist/chunks/{ContentTrimControl-BKCJEst5.js → ContentTrimControl-CKNfHz_u.js} +2 -2
  11. package/dist/chunks/{CropToolPanel-C_sW5tWL.js → CropToolPanel-6MiynTP2.js} +60 -56
  12. package/dist/chunks/CutoutToolPanel-V-AUrbwz.js +78 -0
  13. package/dist/chunks/DisclosureToolPanel-DvouSIbA.js +72 -0
  14. package/dist/chunks/ExpandToolPanel-C98UZmBx.js +69 -0
  15. package/dist/chunks/{ImageEffectsToolPanel-CsDIBpT6.js → ImageEffectsToolPanel-hA0TlEix.js} +63 -52
  16. package/dist/chunks/{IpAuditToolPanel-CduDfFh-.js → IpAuditToolPanel-BCQ8Kewh.js} +15 -13
  17. package/dist/chunks/{ListingToolPanel-8pJ2_zvI.js → ListingToolPanel-DH-xpvLp.js} +170 -184
  18. package/dist/chunks/{MaterialSelectionPlate-CW7HaS6v.js → MaterialSelectionPlate-CQBIf6ZJ.js} +4 -4
  19. package/dist/chunks/MetadataToolPanel-z4RK3JCb.js +116 -0
  20. package/dist/chunks/{OrientToolPanel-C1AzQchm.js → OrientToolPanel-BwtT0xKI.js} +3 -3
  21. package/dist/chunks/PluginActionFooter.vue_vue_type_script_setup_true_lang-DIRuJ1De.js +122 -0
  22. package/dist/chunks/ResizeToolPanel-BVeZbKJl.js +1171 -0
  23. package/dist/chunks/RetouchToolPanel-CqSzWVOK.js +358 -0
  24. package/dist/chunks/ShadowToolPanel-BgsCgLay.js +258 -0
  25. package/dist/chunks/SvgExportToolPanel-CdCXYYHF.js +208 -0
  26. package/dist/chunks/TranslationToolPanel-D4ETI6sf.js +102 -0
  27. package/dist/chunks/{UpscaleToolPanel-BRIgpszs.js → UpscaleToolPanel-D_hmQLEi.js} +44 -39
  28. package/dist/chunks/arrow-up-C1vBvuff.js +18 -0
  29. package/dist/chunks/{entry-CboOSe2r.js → entry-DVV89YMR.js} +7614 -7498
  30. package/dist/chunks/{loader-circle-CylCgDqP.js → loader-circle-GPucRX_4.js} +1 -1
  31. package/dist/chunks/{motionFeatures-D67ghPG1.js → motionFeatures-_pQ-ZW4p.js} +1 -1
  32. package/dist/chunks/{search-BwsDnulU.js → search-CUAg5uDr.js} +1 -1
  33. package/dist/config.d.ts +6 -0
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.js +6 -5
  36. package/dist/node/cli.mjs +0 -0
  37. package/dist/resources.json +104 -94
  38. package/dist/slots.d.ts +2 -0
  39. package/dist/style.css +1 -1
  40. package/dist/tool-links.d.ts +10 -0
  41. package/dist/types/batch/public/config.d.ts +6 -0
  42. package/package.json +9 -8
  43. package/dist/chunks/BackgroundToolPanel-C3Rr9d4S.js +0 -41
  44. package/dist/chunks/BatchModeChoices-DeBARgvY.js +0 -111
  45. package/dist/chunks/BatchReferenceFields-Cr5WgFRJ.js +0 -316
  46. package/dist/chunks/BeautifyToolPanel-DDZXDQKM.js +0 -215
  47. package/dist/chunks/CutoutToolPanel-B7ObmiWd.js +0 -73
  48. package/dist/chunks/DisclosureToolPanel-F3ccFJIF.js +0 -76
  49. package/dist/chunks/ExpandToolPanel-BKjj5UJA.js +0 -67
  50. package/dist/chunks/MetadataToolPanel-C8XJOamN.js +0 -104
  51. package/dist/chunks/PluginActionFooter.vue_vue_type_script_setup_true_lang-BGe419qz.js +0 -102
  52. package/dist/chunks/ResizeToolPanel-DWikcj2G.js +0 -1178
  53. package/dist/chunks/RetouchToolPanel-B4eQKk2W.js +0 -350
  54. package/dist/chunks/ShadowToolPanel-Bbj76hQd.js +0 -254
  55. package/dist/chunks/SvgExportToolPanel-BRxpzd7q.js +0 -219
  56. package/dist/chunks/TranslationToolPanel-Bxv8U2WY.js +0 -125
@@ -1,350 +0,0 @@
1
- import { defineComponent as T, ref as k, useId as A, computed as P, watch as N, openBlock as a, createElementBlock as s, createElementVNode as u, unref as t, createVNode as S, toDisplayString as r, createCommentVNode as f, withCtx as M, Fragment as I, renderList as B, createTextVNode as _, normalizeStyle as U, createBlock as O, resolveDynamicComponent as H, withDirectives as L, vShow as K } from "vue";
2
- import { F as J, aA as w, aB as X, aC as j, aD as q, aE as Q, aF as W, aG as Y, aH as Z, aI as ee, _ as z, aJ as D, aK as te, G as oe } from "./entry-CboOSe2r.js";
3
- import { B as le } from "./BatchReferenceFields-Cr5WgFRJ.js";
4
- import { u as ae, a as ue, b as G, _ as se } from "./PluginActionFooter.vue_vue_type_script_setup_true_lang-BGe419qz.js";
5
- const re = { class: "edit-shortcuts" }, de = ["disabled", "aria-expanded", "aria-controls"], ie = {
6
- key: 0,
7
- class: "shortcut-receipt"
8
- }, ne = { "aria-live": "polite" }, ce = ["disabled"], he = { class: "shortcut-grid" }, me = ["disabled", "aria-label", "onClick"], fe = ["src"], ve = {
9
- key: 0,
10
- role: "alert",
11
- class: "shortcut-error"
12
- }, be = {
13
- key: 1,
14
- role: "alert",
15
- class: "shortcut-review"
16
- }, pe = ["disabled"], ye = /* @__PURE__ */ T({
17
- __name: "EditShortcuts",
18
- props: {
19
- modelValue: {},
20
- writer: { type: Boolean },
21
- busy: { type: Boolean }
22
- },
23
- emits: ["update:modelValue"],
24
- setup(e, { emit: F }) {
25
- const { ui: o, uiText: p } = J(), n = e, i = F, x = k(), c = k(!1), R = k(""), y = A(), v = P(() => !n.writer || n.busy), V = k(), $ = k(""), E = {
26
- lighting: w("tool-cards/ai-v2/polish.webp"),
27
- colors: w("tool-cards/ai-v2/recolor.webp"),
28
- model: w("tool-cards/shortcuts-v3/model.webp"),
29
- ghost: w("tool-cards/ai-v2/ghost.webp"),
30
- flatlay: w("tool-cards/ai-v2/flatlay.webp"),
31
- body: w("tool-cards/shortcuts-v3/body.webp"),
32
- white_product: w("tool-cards/ai-v2/polish.webp"),
33
- watermark: w("tool-cards/shortcuts-v3/watermark.webp"),
34
- text: w("tool-cards/shortcuts-v3/text.webp")
35
- };
36
- N(v, (m) => {
37
- m && (c.value = !1);
38
- }), N(
39
- () => n.modelValue.instructions,
40
- (m) => {
41
- V.value && m !== $.value && (V.value = void 0);
42
- },
43
- { flush: "sync" }
44
- );
45
- const b = P(() => X(n.modelValue));
46
- function h(m) {
47
- if (!(v.value || !c.value))
48
- try {
49
- const g = Y(n.modelValue, m, Z(m), "replace");
50
- V.value = JSON.parse(
51
- JSON.stringify({
52
- instructions: n.modelValue.instructions,
53
- finalPersonCheck: n.modelValue.finalPersonCheck,
54
- shortcuts: n.modelValue.shortcuts
55
- })
56
- ), $.value = g.instructions, i("update:modelValue", g), R.value = "", c.value = !1;
57
- } catch (g) {
58
- R.value = g.message;
59
- }
60
- }
61
- function d() {
62
- if (v.value || !V.value) return;
63
- const m = V.value;
64
- V.value = void 0, i("update:modelValue", {
65
- ...n.modelValue,
66
- instructions: m.instructions,
67
- finalPersonCheck: m.finalPersonCheck,
68
- shortcuts: m.shortcuts
69
- });
70
- }
71
- function l() {
72
- v.value || i("update:modelValue", {
73
- ...n.modelValue,
74
- shortcuts: {
75
- ...n.modelValue.shortcuts,
76
- appliedReferenceOrder: ee(n.modelValue.references)
77
- }
78
- });
79
- }
80
- return (m, g) => (a(), s("section", re, [
81
- u("button", {
82
- ref_key: "trigger",
83
- ref: x,
84
- type: "button",
85
- class: "shortcut-trigger",
86
- disabled: v.value,
87
- "aria-expanded": c.value,
88
- "aria-controls": t(y),
89
- onClick: g[0] || (g[0] = (C) => {
90
- c.value = !c.value, R.value = "";
91
- })
92
- }, [
93
- S(t(j), { size: 16 }),
94
- u("span", null, r(t(o)("tools.retouch.editShortcuts_aaaf8f24")), 1),
95
- S(t(q), { size: 16 })
96
- ], 8, de),
97
- V.value ? (a(), s("div", ie, [
98
- u("span", ne, r(t(o)("tools.retouch.editShortcuts_aec291ff")), 1),
99
- u("button", {
100
- type: "button",
101
- disabled: v.value,
102
- onClick: d
103
- }, r(t(o)("tools.retouch.editShortcuts_6b581989")), 9, ce)
104
- ])) : f("", !0),
105
- S(Q, {
106
- id: t(y),
107
- open: c.value,
108
- anchor: x.value,
109
- title: t(o)("tools.retouch.editShortcuts_aaaf8f24"),
110
- onClose: g[1] || (g[1] = (C) => c.value = !1)
111
- }, {
112
- default: M(() => [
113
- u("div", he, [
114
- (a(!0), s(I, null, B(t(W), (C) => (a(), s("button", {
115
- key: C.id,
116
- type: "button",
117
- class: "shortcut-card",
118
- disabled: v.value,
119
- "aria-label": t(o)("tools.retouch.editShortcuts_18fc4e7b", { p0: t(p)(C.label) }),
120
- onClick: (Je) => h(C.id)
121
- }, [
122
- u("img", {
123
- src: E[C.id],
124
- alt: ""
125
- }, null, 8, fe),
126
- u("span", null, r(t(p)(C.label)), 1)
127
- ], 8, me))), 128))
128
- ]),
129
- R.value ? (a(), s("p", ve, r(t(p)(R.value)), 1)) : f("", !0)
130
- ]),
131
- _: 1
132
- }, 8, ["id", "open", "anchor", "title"]),
133
- b.value ? (a(), s("div", be, [
134
- u("p", null, r(t(o)("tools.retouch.editShortcuts_6f8ae939")), 1),
135
- u("button", {
136
- type: "button",
137
- disabled: v.value,
138
- onClick: l
139
- }, r(t(o)("tools.retouch.editShortcuts_01373195")), 9, pe)
140
- ])) : f("", !0)
141
- ]));
142
- }
143
- }), Ve = /* @__PURE__ */ z(ye, [["__scopeId", "data-v-bd800860"]]), ge = { class: "retouch-fields tool-fields" }, we = { key: 0 }, xe = ["aria-label", "value", "disabled"], ke = ["value", "disabled"], Re = { class: "hint" }, Ce = {
144
- key: 1,
145
- class: "hint"
146
- }, Fe = { key: 2 }, $e = ["aria-label", "value", "disabled", "placeholder"], Se = {
147
- key: 3,
148
- class: "retouch-color"
149
- }, _e = ["aria-label", "value", "disabled"], Pe = ["aria-label", "value", "disabled"], Ie = {
150
- key: 4,
151
- class: "color-presets"
152
- }, Be = ["aria-label", "disabled", "onClick"], Me = { key: 0 }, Ee = ["aria-label", "disabled", "onClick"], Ne = { key: 0 }, Oe = ["aria-label", "value", "disabled", "placeholder"], Te = {
153
- key: 6,
154
- class: "hint"
155
- }, Ue = { class: "tool-note" }, De = /* @__PURE__ */ T({
156
- __name: "PromptRetouchFields",
157
- props: {
158
- modelValue: {},
159
- writer: { type: Boolean },
160
- candidates: { default: () => [] },
161
- available: { type: Boolean, default: !0 },
162
- retouchModes: { default: () => ["edit"] },
163
- fixedMode: {}
164
- },
165
- emits: ["update:modelValue", "ready"],
166
- setup(e, { emit: F }) {
167
- const { ui: o, uiText: p, uiNotice: n } = J(), i = e, x = F, c = k(!1), R = ["#ffffff", "#000000", "#d44a3a", "#3366cc", "#2e7d5b", "#f4c65d"], y = k([]);
168
- try {
169
- const h = JSON.parse(localStorage.getItem("beepop-batch-recent-colors") ?? "[]");
170
- Array.isArray(h) && (y.value = h.filter((d) => typeof d == "string" && /^#[\da-f]{6}$/i.test(d)).slice(0, 6));
171
- } catch {
172
- }
173
- function v() {
174
- if (/^#[\da-f]{6}$/i.test(i.modelValue.color)) {
175
- y.value = [
176
- i.modelValue.color.toLowerCase(),
177
- ...y.value.filter((h) => h !== i.modelValue.color.toLowerCase())
178
- ].slice(0, 6);
179
- try {
180
- localStorage.setItem("beepop-batch-recent-colors", JSON.stringify(y.value));
181
- } catch {
182
- }
183
- }
184
- }
185
- const V = P(
186
- () => D.find((h) => h.value === i.modelValue.mode)?.protection
187
- ), $ = P(() => {
188
- try {
189
- return te(i.modelValue, i.retouchModes), "";
190
- } catch (h) {
191
- return h.message;
192
- }
193
- }), E = P(
194
- () => i.writer && i.available && !c.value && !$.value && (i.modelValue.mode !== "edit" || !i.modelValue.referenceUploadNeedsReview)
195
- );
196
- N(E, (h) => x("ready", h), { immediate: !0 });
197
- function b(h) {
198
- i.writer && x("update:modelValue", { ...i.modelValue, ...h });
199
- }
200
- return (h, d) => (a(), s("div", ge, [
201
- e.fixedMode ? f("", !0) : (a(), s("label", we, [
202
- _(r(t(o)("tools.retouch.promptRetouchFields_fa55a4d4")), 1),
203
- u("select", {
204
- "aria-label": t(o)("tools.retouch.promptRetouchFields_fa55a4d4"),
205
- value: e.modelValue.mode,
206
- disabled: !e.writer,
207
- onChange: d[0] || (d[0] = (l) => b({ mode: l.target.value }))
208
- }, [
209
- (a(!0), s(I, null, B(t(D), (l) => (a(), s("option", {
210
- key: l.value,
211
- value: l.value,
212
- disabled: !e.retouchModes.includes(l.value)
213
- }, r(t(p)(l.label)) + r(e.retouchModes.includes(l.value) ? "" : t(o)("common.toolPanel_14a718cd")), 9, ke))), 128))
214
- ], 40, xe)
215
- ])),
216
- u("p", Re, r(t(p)(V.value)), 1),
217
- e.modelValue.mode !== "edit" ? (a(), s("p", Ce, r(t(o)("tools.retouch.promptRetouchFields_bfa4c81f")), 1)) : f("", !0),
218
- e.modelValue.mode !== "edit" ? (a(), s("label", Fe, [
219
- _(r(e.modelValue.mode === "recolor" ? t(o)("tools.retouch.promptRetouchFields_c401caf2") : t(o)("tools.retouch.promptRetouchFields_9fb527d5")) + " ", 1),
220
- u("textarea", {
221
- "aria-label": t(o)("tools.retouch.promptRetouchFields_62624132"),
222
- value: e.modelValue.target,
223
- disabled: !e.writer,
224
- maxlength: "500",
225
- rows: "2",
226
- placeholder: t(o)("tools.retouch.promptRetouchFields_877eff9a"),
227
- onInput: d[1] || (d[1] = (l) => b({ target: l.target.value }))
228
- }, null, 40, $e)
229
- ])) : f("", !0),
230
- e.modelValue.mode === "recolor" ? (a(), s("div", Se, [
231
- u("label", null, [
232
- _(r(t(o)("tools.retouch.promptRetouchFields_af0d5323")), 1),
233
- u("input", {
234
- type: "color",
235
- "aria-label": t(o)("tools.retouch.promptRetouchFields_3d8f2f39"),
236
- value: /^#[\da-f]{6}$/i.test(e.modelValue.color) ? e.modelValue.color : "#ffffff",
237
- disabled: !e.writer,
238
- onInput: d[2] || (d[2] = (l) => b({ color: l.target.value })),
239
- onChange: v
240
- }, null, 40, _e)
241
- ]),
242
- u("label", null, [
243
- d[6] || (d[6] = _("HEX", -1)),
244
- u("input", {
245
- "aria-label": t(o)("tools.retouch.promptRetouchFields_637e9335"),
246
- value: e.modelValue.color,
247
- disabled: !e.writer,
248
- maxlength: "7",
249
- placeholder: "#RRGGBB",
250
- onInput: d[3] || (d[3] = (l) => b({ color: l.target.value })),
251
- onChange: v
252
- }, null, 40, Pe)
253
- ])
254
- ])) : f("", !0),
255
- e.fixedMode === "recolor" ? (a(), s("div", Ie, [
256
- u("span", null, r(t(o)("tools.retouch.promptRetouchFields_cd5d1ca5")), 1),
257
- (a(), s(I, null, B(R, (l) => u("button", {
258
- key: l,
259
- type: "button",
260
- style: U({ background: l }),
261
- "aria-label": t(o)("tools.retouch.promptRetouchFields_89688793", { p0: l }),
262
- disabled: !e.writer,
263
- onClick: (m) => b({ color: l })
264
- }, null, 12, Be)), 64)),
265
- y.value.length ? (a(), s("span", Me, r(t(o)("tools.retouch.promptRetouchFields_6692f486")), 1)) : f("", !0),
266
- (a(!0), s(I, null, B(y.value, (l) => (a(), s("button", {
267
- key: `recent-${l}`,
268
- type: "button",
269
- style: U({ background: l }),
270
- "aria-label": t(o)("tools.retouch.promptRetouchFields_a651beb5", { p0: l }),
271
- disabled: !e.writer,
272
- onClick: (m) => b({ color: l })
273
- }, null, 12, Ee))), 128))
274
- ])) : f("", !0),
275
- e.modelValue.mode === "edit" ? (a(), O(Ve, {
276
- key: 5,
277
- "model-value": e.modelValue,
278
- writer: e.writer && e.available,
279
- busy: c.value,
280
- "onUpdate:modelValue": b
281
- }, null, 8, ["model-value", "writer", "busy"])) : f("", !0),
282
- (a(), O(H(e.fixedMode && e.fixedMode !== "edit" ? "details" : "div"), null, {
283
- default: M(() => [
284
- e.fixedMode && e.fixedMode !== "edit" ? (a(), s("summary", Ne, r(t(o)("common.toolPanel_40c2f529")), 1)) : f("", !0),
285
- u("label", null, [
286
- _(r(e.modelValue.mode === "edit" ? t(o)("tools.retouch.promptRetouchFields_28c29060") : t(o)("common.toolPanel_40c2f529")) + " ", 1),
287
- u("textarea", {
288
- "aria-label": t(o)("tools.retouch.promptRetouchFields_28c29060"),
289
- value: e.modelValue.instructions,
290
- disabled: !e.writer,
291
- maxlength: "8000",
292
- rows: "4",
293
- placeholder: e.modelValue.mode === "edit" ? t(o)("tools.retouch.promptRetouchFields_852bdbfa") : t(o)("tools.retouch.promptRetouchFields_319915db"),
294
- onInput: d[4] || (d[4] = (l) => b({ instructions: l.target.value }))
295
- }, null, 40, Oe)
296
- ])
297
- ]),
298
- _: 1
299
- })),
300
- L(S(le, {
301
- "model-value": e.modelValue,
302
- writer: e.writer,
303
- candidates: e.candidates,
304
- "onUpdate:modelValue": b,
305
- onBusy: d[5] || (d[5] = (l) => c.value = l)
306
- }, null, 8, ["model-value", "writer", "candidates"]), [
307
- [K, e.modelValue.mode === "edit"]
308
- ]),
309
- $.value && !c.value ? (a(), s("p", Te, r(t(n)($.value)), 1)) : f("", !0),
310
- u("p", Ue, r(t(o)("tools.retouch.promptRetouchFields_08c692fa", {
311
- p0: e.modelValue.mode === "edit" ? e.modelValue.finalPersonCheck ? t(o)("tools.retouch.nested_2823b8fb") : t(o)("tools.retouch.nested_acc6bb91") : t(o)("tools.retouch.nested_2f4af360")
312
- })), 1)
313
- ]));
314
- }
315
- }), Ge = /* @__PURE__ */ z(De, [["__scopeId", "data-v-2055fef8"]]), Ke = /* @__PURE__ */ T({
316
- __name: "RetouchToolPanel",
317
- props: {
318
- context: {}
319
- },
320
- setup(e) {
321
- const F = e, o = ae(() => F.context), p = k(!1), n = ue(() => F.context, "retouch");
322
- return (i, x) => (a(), O(oe, {
323
- context: e.context,
324
- layout: "contained"
325
- }, {
326
- actions: M(() => [
327
- S(se, {
328
- context: e.context,
329
- available: t(G)(e.context),
330
- ready: p.value
331
- }, null, 8, ["context", "available", "ready"])
332
- ]),
333
- default: M(() => [
334
- S(Ge, {
335
- "model-value": t(o).retouch,
336
- writer: !e.context.readonly,
337
- available: t(G)(e.context),
338
- "retouch-modes": e.context.view.retouchModes,
339
- "fixed-mode": e.context.entryId ? t(o).retouch.mode : void 0,
340
- "onUpdate:modelValue": t(n),
341
- onReady: x[0] || (x[0] = (c) => p.value = c)
342
- }, null, 8, ["model-value", "writer", "available", "retouch-modes", "fixed-mode", "onUpdate:modelValue"])
343
- ]),
344
- _: 1
345
- }, 8, ["context"]));
346
- }
347
- });
348
- export {
349
- Ke as default
350
- };
@@ -1,254 +0,0 @@
1
- import { defineComponent as N, openBlock as r, createElementBlock as h, unref as a, createElementVNode as o, toDisplayString as i, Fragment as g, renderList as C, normalizeStyle as $, createVNode as P, createTextVNode as I, createCommentVNode as _, computed as y, createBlock as U, withCtx as k } from "vue";
2
- import { F as S, R as B, _ as R, G as z } from "./entry-CboOSe2r.js";
3
- import { m as V } from "./hosted-resources-COzZ7nZY.js";
4
- import { u as L, c as E, a as M, _ as T, n as H } from "./PluginActionFooter.vue_vue_type_script_setup_true_lang-BGe419qz.js";
5
- const K = ["disabled", "aria-label"], G = { class: "shadow-hint" }, O = { class: "shadow-lock" }, W = ["aria-label", "checked", "disabled"], X = { class: "shadow-hint" }, Y = { class: "shadow-color-field" }, j = ["aria-label"], q = ["aria-label", "title", "aria-pressed", "disabled", "onClick"], J = ["title"], Q = ["aria-label", "disabled", "value"], Z = { class: "shadow-field-heading" }, ee = ["aria-label", "disabled", "min", "max", "step", "value", "onInput"], ae = ["aria-label", "aria-valuetext", "title", "disabled", "min", "max", "step", "value", "onInput"], te = { class: "shadow-field-tip" }, le = ["aria-label", "disabled"], oe = /* @__PURE__ */ N({
6
- __name: "ShadowPanel",
7
- props: {
8
- modelValue: {},
9
- disabled: { type: Boolean },
10
- hideReset: { type: Boolean }
11
- },
12
- emits: ["update:modelValue"],
13
- setup(t, { emit: u }) {
14
- const { ui: l, uiText: s } = S(), d = t, m = u, x = [
15
- { label: "黑色", value: "#000000" },
16
- { label: "白色", value: "#ffffff" },
17
- { label: "红色", value: "#ff0000" },
18
- { label: "青色", value: "#00ffff" },
19
- { label: "黄色", value: "#ffff00" },
20
- { label: "紫色", value: "#8000ff" }
21
- ], v = [
22
- {
23
- key: "offsetX",
24
- label: "横向偏移",
25
- min: -256,
26
- max: 256,
27
- step: 1,
28
- unit: "px",
29
- tip: "负值向左,正值向右"
30
- },
31
- {
32
- key: "offsetY",
33
- label: "纵向偏移",
34
- min: -256,
35
- max: 256,
36
- step: 1,
37
- unit: "px",
38
- tip: "负值向上,正值向下"
39
- },
40
- {
41
- key: "blur",
42
- label: "模糊",
43
- min: 0,
44
- max: 100,
45
- step: 1,
46
- unit: "px",
47
- tip: "数值越大,投影边缘越柔和"
48
- },
49
- {
50
- key: "opacity",
51
- label: "不透明度",
52
- min: 0,
53
- max: 100,
54
- step: 0.1,
55
- unit: "%",
56
- tip: "0% 不添加投影,100% 最浓"
57
- }
58
- ];
59
- function w(n) {
60
- return n.key === "opacity" ? Number((d.modelValue.opacity * 100).toFixed(1)) : d.modelValue[n.key];
61
- }
62
- function p(n, b) {
63
- if (d.disabled) return;
64
- const e = b.target.value;
65
- if (!e.trim() || !Number.isFinite(Number(e))) return;
66
- const c = Math.round(Math.min(n.max, Math.max(n.min, Number(e))) / n.step) * n.step;
67
- m("update:modelValue", {
68
- ...d.modelValue,
69
- [n.key]: n.key === "opacity" ? Number((c / 100).toFixed(3)) : c
70
- });
71
- }
72
- function f(n) {
73
- !d.disabled && /^#[0-9a-f]{6}$/i.test(n) && m("update:modelValue", {
74
- ...d.modelValue,
75
- color: n.toLowerCase()
76
- });
77
- }
78
- function D(n) {
79
- [
80
- "ArrowLeft",
81
- "ArrowRight",
82
- "ArrowUp",
83
- "ArrowDown",
84
- "Home",
85
- "End",
86
- "PageUp",
87
- "PageDown"
88
- ].includes(n.key) && n.stopPropagation();
89
- }
90
- function F() {
91
- d.disabled || m("update:modelValue", { ...V });
92
- }
93
- function A(n) {
94
- d.disabled || m("update:modelValue", {
95
- ...d.modelValue,
96
- lockSize: n.target.checked
97
- });
98
- }
99
- return (n, b) => (r(), h("fieldset", {
100
- class: "shadow-panel",
101
- disabled: t.disabled,
102
- "aria-label": a(l)("tools.shadow.shadowPanel_1b01b881")
103
- }, [
104
- o("p", G, i(a(l)("tools.shadow.shadowPanel_5778f51c")), 1),
105
- o("label", O, [
106
- o("input", {
107
- type: "checkbox",
108
- "aria-label": a(l)("tools.shadow.shadowPanel_208fc432"),
109
- checked: !!t.modelValue.lockSize,
110
- disabled: t.disabled,
111
- onChange: A
112
- }, null, 40, W),
113
- o("span", null, i(a(l)("tools.shadow.shadowPanel_208fc432")), 1)
114
- ]),
115
- o("p", X, i(t.modelValue.lockSize ? a(l)("tools.shadow.shadowPanel_12f52a89") : a(l)("tools.shadow.shadowPanel_5f85fdc3")), 1),
116
- o("div", Y, [
117
- o("span", null, i(a(l)("tools.shadow.shadowPanel_d6319362")), 1),
118
- o("div", {
119
- class: "shadow-colors",
120
- role: "group",
121
- "aria-label": a(l)("tools.shadow.shadowPanel_1ba46530")
122
- }, [
123
- (r(), h(g, null, C(x, (e) => o("button", {
124
- key: e.value,
125
- type: "button",
126
- "aria-label": a(l)("tools.shadow.shadowPanel_f5b7f132", { p0: a(s)(e.label) }),
127
- title: `${a(s)(e.label)} ${e.value}`,
128
- "aria-pressed": t.modelValue.color.toLowerCase() === e.value,
129
- disabled: t.disabled,
130
- style: $({ "--shadow-color": e.value }),
131
- onClick: (c) => f(e.value)
132
- }, [...b[1] || (b[1] = [
133
- o("span", null, null, -1)
134
- ])], 12, q)), 64)),
135
- o("label", {
136
- class: "shadow-custom-color",
137
- title: a(l)("tools.shadow.shadowPanel_3d4a10aa", { p0: t.modelValue.color })
138
- }, [
139
- o("span", {
140
- style: $({ backgroundColor: t.modelValue.color })
141
- }, null, 4),
142
- o("input", {
143
- type: "color",
144
- "aria-label": a(l)("tools.shadow.shadowPanel_784af391"),
145
- disabled: t.disabled,
146
- value: t.modelValue.color,
147
- onInput: b[0] || (b[0] = (e) => f(e.target.value))
148
- }, null, 40, Q)
149
- ], 8, J)
150
- ], 8, j)
151
- ]),
152
- (r(), h(g, null, C(v, (e) => o("div", {
153
- key: e.key,
154
- class: "shadow-field"
155
- }, [
156
- o("div", Z, [
157
- o("span", null, i(a(s)(e.label)), 1),
158
- o("label", null, [
159
- o("input", {
160
- type: "number",
161
- "aria-label": a(l)("tools.shadow.shadowPanel_9d931511", { p0: a(s)(e.label), p1: e.unit }),
162
- disabled: t.disabled,
163
- min: e.min,
164
- max: e.max,
165
- step: e.step,
166
- value: w(e),
167
- onInput: (c) => p(e, c)
168
- }, null, 40, ee),
169
- o("small", null, i(e.unit), 1)
170
- ])
171
- ]),
172
- o("input", {
173
- type: "range",
174
- "aria-label": a(s)(e.label),
175
- "aria-valuetext": `${w(e)} ${e.unit},${a(s)(e.tip)}`,
176
- title: a(s)(e.tip),
177
- disabled: t.disabled,
178
- min: e.min,
179
- max: e.max,
180
- step: e.step,
181
- value: w(e),
182
- onInput: (c) => p(e, c),
183
- onKeydown: D
184
- }, null, 40, ae),
185
- o("small", te, i(a(s)(e.tip)), 1)
186
- ])), 64)),
187
- t.hideReset ? _("", !0) : (r(), h("button", {
188
- key: 0,
189
- type: "button",
190
- class: "shadow-reset",
191
- "aria-label": a(l)("tools.shadow.shadowPanel_29de98dd"),
192
- disabled: t.disabled,
193
- onClick: F
194
- }, [
195
- P(a(B), { size: 14 }),
196
- I(i(a(l)("tools.shadow.shadowPanel_29de98dd")), 1)
197
- ], 8, le))
198
- ], 8, K));
199
- }
200
- }), ne = /* @__PURE__ */ R(oe, [["__scopeId", "data-v-9ed3f41c"]]), se = {
201
- key: 0,
202
- class: "hint"
203
- }, de = {
204
- key: 1,
205
- class: "hint"
206
- }, me = /* @__PURE__ */ N({
207
- __name: "ShadowToolPanel",
208
- props: {
209
- context: {}
210
- },
211
- setup(t) {
212
- const { ui: u } = S(), l = t, s = L(() => l.context), d = y(() => s.value.shadow.opacity === 0), m = y(
213
- () => E(s.value.shadow, V) || !!l.context.view.appliedCount
214
- ), x = y(
215
- () => l.context.view.waitingCount ? void 0 : u("common.historyDrawer_500cba39", {
216
- p0: l.context.view.appliedCount ? u("common.toolPanel_474c2513") : u("common.toolPanel_fab8cc8f"),
217
- p1: l.context.view.count
218
- })
219
- ), v = M(() => l.context, "shadow");
220
- return (w, p) => (r(), U(z, {
221
- context: t.context,
222
- layout: "contained",
223
- changed: m.value,
224
- onReset: p[0] || (p[0] = (f) => t.context.resetDraft({ shadow: { ...a(V) } }))
225
- }, {
226
- actions: k(() => [
227
- P(T, {
228
- context: t.context,
229
- available: a(H)(t.context),
230
- ready: !d.value,
231
- label: x.value
232
- }, {
233
- default: k(() => [
234
- t.context.view.appliedCount ? (r(), h("p", se, i(a(u)("common.toolPanel_32b1782c", { p0: t.context.view.appliedCount })), 1)) : _("", !0),
235
- d.value ? (r(), h("p", de, i(a(u)("common.toolPanel_508186e2")), 1)) : _("", !0)
236
- ]),
237
- _: 1
238
- }, 8, ["context", "available", "ready", "label"])
239
- ]),
240
- default: k(() => [
241
- P(ne, {
242
- "model-value": a(s).shadow,
243
- "hide-reset": !0,
244
- disabled: t.context.readonly,
245
- "onUpdate:modelValue": a(v)
246
- }, null, 8, ["model-value", "disabled", "onUpdate:modelValue"])
247
- ]),
248
- _: 1
249
- }, 8, ["context", "changed"]));
250
- }
251
- });
252
- export {
253
- me as default
254
- };