@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
@@ -0,0 +1,358 @@
1
+ import { defineComponent as T, ref as w, useId as A, computed as S, watch as O, openBlock as a, createElementBlock as d, createElementVNode as s, unref as t, createVNode as C, toDisplayString as i, createCommentVNode as h, withCtx as E, Fragment as I, renderList as B, createTextVNode as P, normalizeStyle as U, createBlock as M, resolveDynamicComponent as L, withDirectives as j, vShow as X } from "vue";
2
+ import { F as H, az as g, aA as q, aB as K, aC as Q, aD as W, aE as Y, aF as Z, aG as ee, aH as te, _ as J, aI as D, aJ as oe, P as z, G as le } from "./entry-DVV89YMR.js";
3
+ import { B as ae } from "./BatchReferenceFields-B7SL__lu.js";
4
+ import { u as ue, a as re, b as G, _ as de } from "./PluginActionFooter.vue_vue_type_script_setup_true_lang-DIRuJ1De.js";
5
+ const se = { class: "edit-shortcuts" }, ie = ["disabled", "aria-expanded", "aria-controls"], ne = {
6
+ key: 0,
7
+ class: "shortcut-receipt"
8
+ }, ce = { "aria-live": "polite" }, me = ["disabled"], he = { class: "shortcut-grid" }, fe = ["disabled", "aria-label", "onClick"], ve = ["src"], be = {
9
+ key: 0,
10
+ role: "alert",
11
+ class: "shortcut-error"
12
+ }, pe = {
13
+ key: 1,
14
+ role: "alert",
15
+ class: "shortcut-review"
16
+ }, ye = ["disabled"], Ve = /* @__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: l, uiText: p } = H(), n = e, u = F, x = w(), c = w(!1), k = w(""), y = A(), f = S(() => !n.writer || n.busy), V = w(), _ = w(""), $ = {
26
+ lighting: g("tool-cards/ai-v2/polish.webp"),
27
+ colors: g("tool-cards/ai-v2/recolor.webp"),
28
+ model: g("tool-cards/shortcuts-v3/model.webp"),
29
+ ghost: g("tool-cards/ai-v2/ghost.webp"),
30
+ flatlay: g("tool-cards/ai-v2/flatlay.webp"),
31
+ body: g("tool-cards/shortcuts-v3/body.webp"),
32
+ white_product: g("tool-cards/ai-v2/polish.webp"),
33
+ watermark: g("tool-cards/shortcuts-v3/watermark.webp"),
34
+ text: g("tool-cards/shortcuts-v3/text.webp")
35
+ };
36
+ O(f, (o) => {
37
+ o && (c.value = !1);
38
+ }), O(
39
+ () => n.modelValue.instructions,
40
+ (o) => {
41
+ V.value && o !== _.value && (V.value = void 0);
42
+ },
43
+ { flush: "sync" }
44
+ );
45
+ const N = S(() => q(n.modelValue));
46
+ function v(o) {
47
+ if (!(f.value || !c.value))
48
+ try {
49
+ const b = Z(n.modelValue, o, ee(o), "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 = b.instructions, u("update:modelValue", b), k.value = "", c.value = !1;
57
+ } catch (b) {
58
+ k.value = b.message;
59
+ }
60
+ }
61
+ function m() {
62
+ if (f.value || !V.value) return;
63
+ const o = V.value;
64
+ V.value = void 0, u("update:modelValue", {
65
+ ...n.modelValue,
66
+ instructions: o.instructions,
67
+ finalPersonCheck: o.finalPersonCheck,
68
+ shortcuts: o.shortcuts
69
+ });
70
+ }
71
+ function r() {
72
+ f.value || u("update:modelValue", {
73
+ ...n.modelValue,
74
+ shortcuts: {
75
+ ...n.modelValue.shortcuts,
76
+ appliedReferenceOrder: te(n.modelValue.references)
77
+ }
78
+ });
79
+ }
80
+ return (o, b) => (a(), d("section", se, [
81
+ s("button", {
82
+ ref_key: "trigger",
83
+ ref: x,
84
+ type: "button",
85
+ class: "shortcut-trigger",
86
+ disabled: f.value,
87
+ "aria-expanded": c.value,
88
+ "aria-controls": t(y),
89
+ onClick: b[0] || (b[0] = (R) => {
90
+ c.value = !c.value, k.value = "";
91
+ })
92
+ }, [
93
+ C(t(K), { size: 16 }),
94
+ s("span", null, i(t(l)("tools.retouch.editShortcuts_aaaf8f24")), 1),
95
+ C(t(Q), { size: 16 })
96
+ ], 8, ie),
97
+ V.value ? (a(), d("div", ne, [
98
+ s("span", ce, i(t(l)("tools.retouch.editShortcuts_aec291ff")), 1),
99
+ s("button", {
100
+ type: "button",
101
+ disabled: f.value,
102
+ onClick: m
103
+ }, i(t(l)("tools.retouch.editShortcuts_6b581989")), 9, me)
104
+ ])) : h("", !0),
105
+ C(W, {
106
+ id: t(y),
107
+ open: c.value,
108
+ anchor: x.value,
109
+ title: t(l)("tools.retouch.editShortcuts_aaaf8f24"),
110
+ onClose: b[1] || (b[1] = (R) => c.value = !1)
111
+ }, {
112
+ default: E(() => [
113
+ s("div", he, [
114
+ (a(!0), d(I, null, B(t(Y), (R) => (a(), d("button", {
115
+ key: R.id,
116
+ type: "button",
117
+ class: "shortcut-card",
118
+ disabled: f.value,
119
+ "aria-label": t(l)("tools.retouch.editShortcuts_18fc4e7b", { p0: t(p)(R.label) }),
120
+ onClick: (De) => v(R.id)
121
+ }, [
122
+ s("img", {
123
+ src: $[R.id],
124
+ alt: ""
125
+ }, null, 8, ve),
126
+ s("span", null, i(t(p)(R.label)), 1)
127
+ ], 8, fe))), 128))
128
+ ]),
129
+ k.value ? (a(), d("p", be, i(t(p)(k.value)), 1)) : h("", !0)
130
+ ]),
131
+ _: 1
132
+ }, 8, ["id", "open", "anchor", "title"]),
133
+ N.value ? (a(), d("div", pe, [
134
+ s("p", null, i(t(l)("tools.retouch.editShortcuts_6f8ae939")), 1),
135
+ s("button", {
136
+ type: "button",
137
+ disabled: f.value,
138
+ onClick: r
139
+ }, i(t(l)("tools.retouch.editShortcuts_01373195")), 9, ye)
140
+ ])) : h("", !0)
141
+ ]));
142
+ }
143
+ }), ge = /* @__PURE__ */ J(Ve, [["__scopeId", "data-v-bd800860"]]), xe = { class: "retouch-fields tool-fields" }, we = { key: 0 }, ke = ["aria-label", "value", "disabled"], Re = ["value", "disabled"], Ce = { key: 1 }, Fe = ["aria-label", "value", "disabled", "placeholder"], $e = {
144
+ key: 2,
145
+ class: "retouch-color"
146
+ }, Se = ["aria-label", "value", "disabled"], _e = ["aria-label", "value", "disabled"], Pe = {
147
+ key: 3,
148
+ class: "color-presets"
149
+ }, Ie = ["aria-label", "disabled", "onClick"], Be = { key: 0 }, Me = ["aria-label", "disabled", "onClick"], Ee = { key: 0 }, Ne = ["aria-label", "value", "disabled", "placeholder"], Oe = {
150
+ key: 5,
151
+ class: "hint"
152
+ }, Te = /* @__PURE__ */ T({
153
+ __name: "PromptRetouchFields",
154
+ props: {
155
+ modelValue: {},
156
+ writer: { type: Boolean },
157
+ candidates: { default: () => [] },
158
+ available: { type: Boolean, default: !0 },
159
+ retouchModes: { default: () => ["edit"] },
160
+ fixedMode: {}
161
+ },
162
+ emits: ["update:modelValue", "ready"],
163
+ setup(e, { emit: F }) {
164
+ const { ui: l, uiText: p, uiNotice: n } = H(), u = e, x = F, c = w(!1), k = ["#ffffff", "#000000", "#d44a3a", "#3366cc", "#2e7d5b", "#f4c65d"], y = w([]);
165
+ try {
166
+ const m = JSON.parse(localStorage.getItem("beepop-batch-recent-colors") ?? "[]");
167
+ Array.isArray(m) && (y.value = m.filter((r) => typeof r == "string" && /^#[\da-f]{6}$/i.test(r)).slice(0, 6));
168
+ } catch {
169
+ }
170
+ function f() {
171
+ if (/^#[\da-f]{6}$/i.test(u.modelValue.color)) {
172
+ y.value = [
173
+ u.modelValue.color.toLowerCase(),
174
+ ...y.value.filter((m) => m !== u.modelValue.color.toLowerCase())
175
+ ].slice(0, 6);
176
+ try {
177
+ localStorage.setItem("beepop-batch-recent-colors", JSON.stringify(y.value));
178
+ } catch {
179
+ }
180
+ }
181
+ }
182
+ const V = S(
183
+ () => D.find((m) => m.value === u.modelValue.mode)?.protection
184
+ ), _ = S(
185
+ () => [
186
+ p(V.value),
187
+ ...u.modelValue.mode === "edit" ? [] : [l("tools.retouch.promptRetouchFields_bfa4c81f")],
188
+ l("tools.retouch.promptRetouchFields_08c692fa", {
189
+ p0: u.modelValue.mode === "edit" ? l(
190
+ u.modelValue.finalPersonCheck ? "tools.retouch.nested_2823b8fb" : "tools.retouch.nested_acc6bb91"
191
+ ) : l("tools.retouch.nested_2f4af360")
192
+ })
193
+ ].join(`
194
+ `)
195
+ ), $ = S(() => {
196
+ try {
197
+ return oe(u.modelValue, u.retouchModes), "";
198
+ } catch (m) {
199
+ return m.message;
200
+ }
201
+ }), N = S(
202
+ () => u.writer && u.available && !c.value && !$.value && (u.modelValue.mode !== "edit" || !u.modelValue.referenceUploadNeedsReview)
203
+ );
204
+ O(N, (m) => x("ready", m), { immediate: !0 });
205
+ function v(m) {
206
+ u.writer && x("update:modelValue", { ...u.modelValue, ...m });
207
+ }
208
+ return (m, r) => (a(), d("div", xe, [
209
+ e.fixedMode ? h("", !0) : (a(), d("label", we, [
210
+ P(i(t(l)("tools.retouch.promptRetouchFields_fa55a4d4")), 1),
211
+ s("select", {
212
+ "aria-label": t(l)("tools.retouch.promptRetouchFields_fa55a4d4"),
213
+ value: e.modelValue.mode,
214
+ disabled: !e.writer,
215
+ onChange: r[0] || (r[0] = (o) => v({ mode: o.target.value }))
216
+ }, [
217
+ (a(!0), d(I, null, B(t(D), (o) => (a(), d("option", {
218
+ key: o.value,
219
+ value: o.value,
220
+ disabled: !e.retouchModes.includes(o.value)
221
+ }, i(t(p)(o.label)) + i(e.retouchModes.includes(o.value) ? "" : t(l)("common.toolPanel_14a718cd")), 9, Re))), 128))
222
+ ], 40, ke)
223
+ ])),
224
+ e.modelValue.mode !== "edit" ? (a(), d("label", Ce, [
225
+ P(i(e.modelValue.mode === "recolor" ? t(l)("tools.retouch.promptRetouchFields_c401caf2") : t(l)("tools.retouch.promptRetouchFields_9fb527d5")), 1),
226
+ C(z, { text: _.value }, null, 8, ["text"]),
227
+ s("textarea", {
228
+ "aria-label": t(l)("tools.retouch.promptRetouchFields_62624132"),
229
+ value: e.modelValue.target,
230
+ disabled: !e.writer,
231
+ maxlength: "500",
232
+ rows: "2",
233
+ placeholder: t(l)("tools.retouch.promptRetouchFields_877eff9a"),
234
+ onInput: r[1] || (r[1] = (o) => v({ target: o.target.value }))
235
+ }, null, 40, Fe)
236
+ ])) : h("", !0),
237
+ e.modelValue.mode === "recolor" ? (a(), d("div", $e, [
238
+ s("label", null, [
239
+ P(i(t(l)("tools.retouch.promptRetouchFields_af0d5323")), 1),
240
+ s("input", {
241
+ type: "color",
242
+ "aria-label": t(l)("tools.retouch.promptRetouchFields_3d8f2f39"),
243
+ value: /^#[\da-f]{6}$/i.test(e.modelValue.color) ? e.modelValue.color : "#ffffff",
244
+ disabled: !e.writer,
245
+ onInput: r[2] || (r[2] = (o) => v({ color: o.target.value })),
246
+ onChange: f
247
+ }, null, 40, Se)
248
+ ]),
249
+ s("label", null, [
250
+ r[6] || (r[6] = P("HEX", -1)),
251
+ s("input", {
252
+ "aria-label": t(l)("tools.retouch.promptRetouchFields_637e9335"),
253
+ value: e.modelValue.color,
254
+ disabled: !e.writer,
255
+ maxlength: "7",
256
+ placeholder: "#RRGGBB",
257
+ onInput: r[3] || (r[3] = (o) => v({ color: o.target.value })),
258
+ onChange: f
259
+ }, null, 40, _e)
260
+ ])
261
+ ])) : h("", !0),
262
+ e.fixedMode === "recolor" ? (a(), d("div", Pe, [
263
+ s("span", null, i(t(l)("tools.retouch.promptRetouchFields_cd5d1ca5")), 1),
264
+ (a(), d(I, null, B(k, (o) => s("button", {
265
+ key: o,
266
+ type: "button",
267
+ style: U({ background: o }),
268
+ "aria-label": t(l)("tools.retouch.promptRetouchFields_89688793", { p0: o }),
269
+ disabled: !e.writer,
270
+ onClick: (b) => v({ color: o })
271
+ }, null, 12, Ie)), 64)),
272
+ y.value.length ? (a(), d("span", Be, i(t(l)("tools.retouch.promptRetouchFields_6692f486")), 1)) : h("", !0),
273
+ (a(!0), d(I, null, B(y.value, (o) => (a(), d("button", {
274
+ key: `recent-${o}`,
275
+ type: "button",
276
+ style: U({ background: o }),
277
+ "aria-label": t(l)("tools.retouch.promptRetouchFields_a651beb5", { p0: o }),
278
+ disabled: !e.writer,
279
+ onClick: (b) => v({ color: o })
280
+ }, null, 12, Me))), 128))
281
+ ])) : h("", !0),
282
+ e.modelValue.mode === "edit" ? (a(), M(ge, {
283
+ key: 4,
284
+ "model-value": e.modelValue,
285
+ writer: e.writer && e.available,
286
+ busy: c.value,
287
+ "onUpdate:modelValue": v
288
+ }, null, 8, ["model-value", "writer", "busy"])) : h("", !0),
289
+ (a(), M(L(e.fixedMode && e.fixedMode !== "edit" ? "details" : "div"), null, {
290
+ default: E(() => [
291
+ e.fixedMode && e.fixedMode !== "edit" ? (a(), d("summary", Ee, i(t(l)("common.toolPanel_40c2f529")), 1)) : h("", !0),
292
+ s("label", null, [
293
+ P(i(e.modelValue.mode === "edit" ? t(l)("tools.retouch.promptRetouchFields_28c29060") : t(l)("common.toolPanel_40c2f529")), 1),
294
+ e.modelValue.mode === "edit" ? (a(), M(z, {
295
+ key: 0,
296
+ text: _.value
297
+ }, null, 8, ["text"])) : h("", !0),
298
+ s("textarea", {
299
+ "aria-label": t(l)("tools.retouch.promptRetouchFields_28c29060"),
300
+ value: e.modelValue.instructions,
301
+ disabled: !e.writer,
302
+ maxlength: "8000",
303
+ rows: "4",
304
+ placeholder: e.modelValue.mode === "edit" ? t(l)("tools.retouch.promptRetouchFields_852bdbfa") : t(l)("tools.retouch.promptRetouchFields_319915db"),
305
+ onInput: r[4] || (r[4] = (o) => v({ instructions: o.target.value }))
306
+ }, null, 40, Ne)
307
+ ])
308
+ ]),
309
+ _: 1
310
+ })),
311
+ j(C(ae, {
312
+ "model-value": e.modelValue,
313
+ writer: e.writer,
314
+ candidates: e.candidates,
315
+ "onUpdate:modelValue": v,
316
+ onBusy: r[5] || (r[5] = (o) => c.value = o)
317
+ }, null, 8, ["model-value", "writer", "candidates"]), [
318
+ [X, e.modelValue.mode === "edit"]
319
+ ]),
320
+ $.value && $.value !== "请填写修改要求" && !c.value ? (a(), d("p", Oe, i(t(n)($.value)), 1)) : h("", !0)
321
+ ]));
322
+ }
323
+ }), Ue = /* @__PURE__ */ J(Te, [["__scopeId", "data-v-2ad6b4d4"]]), Ae = /* @__PURE__ */ T({
324
+ __name: "RetouchToolPanel",
325
+ props: {
326
+ context: {}
327
+ },
328
+ setup(e) {
329
+ const F = e, l = ue(() => F.context), p = w(!1), n = re(() => F.context, "retouch");
330
+ return (u, x) => (a(), M(le, {
331
+ context: e.context,
332
+ layout: "contained"
333
+ }, {
334
+ actions: E(() => [
335
+ C(de, {
336
+ context: e.context,
337
+ available: t(G)(e.context),
338
+ ready: p.value
339
+ }, null, 8, ["context", "available", "ready"])
340
+ ]),
341
+ default: E(() => [
342
+ C(Ue, {
343
+ "model-value": t(l).retouch,
344
+ writer: !e.context.readonly,
345
+ available: t(G)(e.context),
346
+ "retouch-modes": e.context.view.retouchModes,
347
+ "fixed-mode": e.context.entryId ? t(l).retouch.mode : void 0,
348
+ "onUpdate:modelValue": t(n),
349
+ onReady: x[0] || (x[0] = (c) => p.value = c)
350
+ }, null, 8, ["model-value", "writer", "available", "retouch-modes", "fixed-mode", "onUpdate:modelValue"])
351
+ ]),
352
+ _: 1
353
+ }, 8, ["context"]));
354
+ }
355
+ });
356
+ export {
357
+ Ae as default
358
+ };
@@ -0,0 +1,258 @@
1
+ import { defineComponent as F, openBlock as c, createElementBlock as h, unref as a, createElementVNode as o, createTextVNode as f, toDisplayString as u, createVNode as w, Fragment as _, renderList as C, normalizeStyle as $, createCommentVNode as k, computed as N, createBlock as B, withCtx as y } from "vue";
2
+ import { F as A, P as S, R, _ as z, G as L } from "./entry-DVV89YMR.js";
3
+ import { m as P } from "./hosted-resources-COzZ7nZY.js";
4
+ import { u as E, c as M, a as T, _ as H, n as K } from "./PluginActionFooter.vue_vue_type_script_setup_true_lang-DIRuJ1De.js";
5
+ const G = ["disabled", "aria-label"], O = { class: "shadow-lock" }, W = ["aria-label", "checked", "disabled"], X = { class: "shadow-color-field" }, Y = ["aria-label"], j = ["aria-label", "title", "aria-pressed", "disabled", "onClick"], q = ["title"], J = ["aria-label", "disabled", "value"], Q = { class: "shadow-field-heading" }, Z = ["aria-label", "disabled", "min", "max", "step", "value", "onInput"], ee = ["aria-label", "aria-valuetext", "title", "disabled", "min", "max", "step", "value", "onInput"], ae = ["aria-label", "disabled"], le = /* @__PURE__ */ F({
6
+ __name: "ShadowPanel",
7
+ props: {
8
+ modelValue: {},
9
+ disabled: { type: Boolean },
10
+ hideReset: { type: Boolean }
11
+ },
12
+ emits: ["update:modelValue"],
13
+ setup(l, { emit: p }) {
14
+ const { ui: n, uiText: s } = A(), d = l, r = p, 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 m(t) {
60
+ return t.key === "opacity" ? Number((d.modelValue.opacity * 100).toFixed(1)) : d.modelValue[t.key];
61
+ }
62
+ function v(t, b) {
63
+ if (d.disabled) return;
64
+ const e = b.target.value;
65
+ if (!e.trim() || !Number.isFinite(Number(e))) return;
66
+ const i = Math.round(Math.min(t.max, Math.max(t.min, Number(e))) / t.step) * t.step;
67
+ r("update:modelValue", {
68
+ ...d.modelValue,
69
+ [t.key]: t.key === "opacity" ? Number((i / 100).toFixed(3)) : i
70
+ });
71
+ }
72
+ function g(t) {
73
+ !d.disabled && /^#[0-9a-f]{6}$/i.test(t) && r("update:modelValue", {
74
+ ...d.modelValue,
75
+ color: t.toLowerCase()
76
+ });
77
+ }
78
+ function D(t) {
79
+ [
80
+ "ArrowLeft",
81
+ "ArrowRight",
82
+ "ArrowUp",
83
+ "ArrowDown",
84
+ "Home",
85
+ "End",
86
+ "PageUp",
87
+ "PageDown"
88
+ ].includes(t.key) && t.stopPropagation();
89
+ }
90
+ function I() {
91
+ d.disabled || r("update:modelValue", { ...P });
92
+ }
93
+ function U(t) {
94
+ d.disabled || r("update:modelValue", {
95
+ ...d.modelValue,
96
+ lockSize: t.target.checked
97
+ });
98
+ }
99
+ return (t, b) => (c(), h("fieldset", {
100
+ class: "shadow-panel",
101
+ disabled: l.disabled,
102
+ "aria-label": a(n)("tools.shadow.shadowPanel_1b01b881")
103
+ }, [
104
+ o("label", O, [
105
+ o("input", {
106
+ type: "checkbox",
107
+ "aria-label": a(n)("tools.shadow.shadowPanel_208fc432"),
108
+ checked: !!l.modelValue.lockSize,
109
+ disabled: l.disabled,
110
+ onChange: U
111
+ }, null, 40, W),
112
+ o("span", null, [
113
+ f(u(a(n)("tools.shadow.shadowPanel_208fc432")), 1),
114
+ w(S, {
115
+ text: a(n)(
116
+ l.modelValue.lockSize ? "tools.shadow.shadowPanel_12f52a89" : "tools.shadow.shadowPanel_5f85fdc3"
117
+ )
118
+ }, null, 8, ["text"])
119
+ ])
120
+ ]),
121
+ o("div", X, [
122
+ o("span", null, u(a(n)("tools.shadow.shadowPanel_d6319362")), 1),
123
+ o("div", {
124
+ class: "shadow-colors",
125
+ role: "group",
126
+ "aria-label": a(n)("tools.shadow.shadowPanel_1ba46530")
127
+ }, [
128
+ (c(), h(_, null, C(x, (e) => o("button", {
129
+ key: e.value,
130
+ type: "button",
131
+ "aria-label": a(n)("tools.shadow.shadowPanel_f5b7f132", { p0: a(s)(e.label) }),
132
+ title: `${a(s)(e.label)} ${e.value}`,
133
+ "aria-pressed": l.modelValue.color.toLowerCase() === e.value,
134
+ disabled: l.disabled,
135
+ style: $({ "--shadow-color": e.value }),
136
+ onClick: (i) => g(e.value)
137
+ }, [...b[1] || (b[1] = [
138
+ o("span", null, null, -1)
139
+ ])], 12, j)), 64)),
140
+ o("label", {
141
+ class: "shadow-custom-color",
142
+ title: a(n)("tools.shadow.shadowPanel_3d4a10aa", { p0: l.modelValue.color })
143
+ }, [
144
+ o("span", {
145
+ style: $({ backgroundColor: l.modelValue.color })
146
+ }, null, 4),
147
+ o("input", {
148
+ type: "color",
149
+ "aria-label": a(n)("tools.shadow.shadowPanel_784af391"),
150
+ disabled: l.disabled,
151
+ value: l.modelValue.color,
152
+ onInput: b[0] || (b[0] = (e) => g(e.target.value))
153
+ }, null, 40, J)
154
+ ], 8, q)
155
+ ], 8, Y)
156
+ ]),
157
+ (c(), h(_, null, C(V, (e) => o("div", {
158
+ key: e.key,
159
+ class: "shadow-field"
160
+ }, [
161
+ o("div", Q, [
162
+ o("span", null, [
163
+ f(u(a(s)(e.label)), 1),
164
+ w(S, {
165
+ text: a(s)(e.tip)
166
+ }, null, 8, ["text"])
167
+ ]),
168
+ o("label", null, [
169
+ o("input", {
170
+ type: "number",
171
+ "aria-label": a(n)("tools.shadow.shadowPanel_9d931511", { p0: a(s)(e.label), p1: e.unit }),
172
+ disabled: l.disabled,
173
+ min: e.min,
174
+ max: e.max,
175
+ step: e.step,
176
+ value: m(e),
177
+ onInput: (i) => v(e, i)
178
+ }, null, 40, Z),
179
+ o("small", null, u(e.unit), 1)
180
+ ])
181
+ ]),
182
+ o("input", {
183
+ type: "range",
184
+ "aria-label": a(s)(e.label),
185
+ "aria-valuetext": `${m(e)} ${e.unit},${a(s)(e.tip)}`,
186
+ title: a(s)(e.tip),
187
+ disabled: l.disabled,
188
+ min: e.min,
189
+ max: e.max,
190
+ step: e.step,
191
+ value: m(e),
192
+ onInput: (i) => v(e, i),
193
+ onKeydown: D
194
+ }, null, 40, ee)
195
+ ])), 64)),
196
+ l.hideReset ? k("", !0) : (c(), h("button", {
197
+ key: 0,
198
+ type: "button",
199
+ class: "shadow-reset",
200
+ "aria-label": a(n)("tools.shadow.shadowPanel_29de98dd"),
201
+ disabled: l.disabled,
202
+ onClick: I
203
+ }, [
204
+ w(a(R), { size: 14 }),
205
+ f(u(a(n)("tools.shadow.shadowPanel_29de98dd")), 1)
206
+ ], 8, ae))
207
+ ], 8, G));
208
+ }
209
+ }), te = /* @__PURE__ */ z(le, [["__scopeId", "data-v-9624ea03"]]), oe = {
210
+ key: 0,
211
+ class: "hint"
212
+ }, ne = {
213
+ key: 1,
214
+ class: "hint"
215
+ }, ce = /* @__PURE__ */ F({
216
+ __name: "ShadowToolPanel",
217
+ props: {
218
+ context: {}
219
+ },
220
+ setup(l) {
221
+ const { ui: p } = A(), n = l, s = E(() => n.context), d = N(() => s.value.shadow.opacity === 0), r = N(
222
+ () => M(s.value.shadow, P) || !!n.context.view.appliedCount
223
+ ), x = T(() => n.context, "shadow");
224
+ return (V, m) => (c(), B(L, {
225
+ context: l.context,
226
+ layout: "contained",
227
+ help: a(p)("tools.shadow.shadowPanel_5778f51c"),
228
+ changed: r.value,
229
+ onReset: m[0] || (m[0] = (v) => l.context.resetDraft({ shadow: { ...a(P) } }))
230
+ }, {
231
+ actions: y(() => [
232
+ w(H, {
233
+ context: l.context,
234
+ available: a(K)(l.context),
235
+ ready: !d.value
236
+ }, {
237
+ default: y(() => [
238
+ l.context.view.appliedCount ? (c(), h("p", oe, u(a(p)("common.toolPanel_32b1782c", { p0: l.context.view.appliedCount })), 1)) : k("", !0),
239
+ d.value ? (c(), h("p", ne, u(a(p)("common.toolPanel_508186e2")), 1)) : k("", !0)
240
+ ]),
241
+ _: 1
242
+ }, 8, ["context", "available", "ready"])
243
+ ]),
244
+ default: y(() => [
245
+ w(te, {
246
+ "model-value": a(s).shadow,
247
+ "hide-reset": !0,
248
+ disabled: l.context.readonly,
249
+ "onUpdate:modelValue": a(x)
250
+ }, null, 8, ["model-value", "disabled", "onUpdate:modelValue"])
251
+ ]),
252
+ _: 1
253
+ }, 8, ["context", "help", "changed"]));
254
+ }
255
+ });
256
+ export {
257
+ ce as default
258
+ };