@webx-ui/module-banners 0.2.3 → 0.3.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.
package/dist/index.js CHANGED
@@ -1,2487 +1,31 @@
1
- import { provide as qt, inject as Kt, defineComponent as Ve, computed as y, ref as A, watch as $e, onMounted as nt, onBeforeUnmount as Vt, openBlock as m, createElementBlock as B, Fragment as ne, createVNode as i, unref as e, withCtx as d, createSlots as zt, createTextVNode as F, toDisplayString as N, createBlock as E, createCommentVNode as H, useTemplateRef as Jt, nextTick as jt, isRef as ye, createElementVNode as P, withKeys as ft, normalizeClass as oe, resolveDynamicComponent as St, renderList as ve, normalizeStyle as Oe, reactive as Ht, withModifiers as Ye } from "vue";
2
- import { useRoute as st, useRouter as ot, onBeforeRouteLeave as Gt } from "vue-router";
3
- import { useLocales as Je, localizedValue as Zt, confirm as Fe, WxSkeleton as qe, WxCard as Qe, WxBadge as et, WxFormItem as G, WxSelect as fe, WxActionBar as Xt, WxButton as Q, toast as Z, useModal as Yt, WxDialog as Qt, WxInput as Ke, WxSpace as ea, WxTooltip as tt, WxIcon as le, WxSegmented as it, WxEmpty as at, WxSortableList as Ct, WxAlert as ta, createModal as aa, WxListDetail as la, WxText as re, WxIndicator as na, WxTextarea as sa, WxInputNumber as Le, WxSwitch as Me, WxColorPicker as oa } from "@webx-ui/core";
4
- import { useAdmin as ze, useTranslate as Se, useErrorText as rt, useBodyKeys as ia, WxScreenHead as Bt, WxScreen as ra, WxSaveState as ua, WxRowMenu as Pt, WxListScreen as da, WxLinkField as ca } from "@webx-ui/module-admin";
5
- import { WxMediaField as ba, createMediaApi as va } from "@webx-ui/module-media";
6
- function Ue(t) {
7
- const c = `${t.apiPath}/banners`, o = (s) => `${c}/places/${encodeURIComponent(s)}`, f = (s) => s.data;
8
- return {
9
- places: () => t.http.get(`${c}/places`).then(f),
10
- createPlace: (s) => t.http.post(`${c}/places`, s).then(f),
11
- renamePlace: (s, $) => t.http.put(o(s), { title: $ }).then(f),
12
- removePlace: (s) => t.http.delete(o(s)).then(() => {
13
- }),
14
- list: (s, $ = !1) => t.http.get(`${o(s)}/banners${$ ? "?trashed=1" : ""}`).then(f),
15
- get: (s) => t.http.get(`${c}/${s}`).then(f),
16
- create: (s, $) => t.http.post(`${o(s)}/banners`, { values: $ }).then(f),
17
- save: (s, $, _) => t.http.put(
18
- `${c}/${s}`,
19
- _ === void 0 ? { values: $ } : { values: $, place: _ }
20
- ).then(f),
21
- remove: (s) => t.http.delete(`${c}/${s}`).then(() => {
22
- }),
23
- // The resource of the list line, and not the form's pair: a restored banner stays closed.
24
- restore: (s) => t.http.post(`${c}/${s}/restore`, {}).then(f),
25
- reorder: (s, $) => t.http.post(`${o(s)}/reorder`, { ids: $ }).then(() => {
26
- }),
27
- theme: () => t.http.get(`${c}/theme`).then(f)
28
- };
29
- }
30
- const Wt = /* @__PURE__ */ Symbol("wx-banner-editor");
31
- function ma(t) {
32
- qt(Wt, t);
33
- }
34
- function pa() {
35
- return Kt(Wt, null);
36
- }
37
- const Ne = {
38
- x: [-50, 150, 5],
39
- y: [-50, 150, 5],
40
- w: [1, 150, 40],
41
- size: [0.3, 20, 3],
42
- pad: [0, 10, 0],
43
- radius: [0, 50, 0],
44
- tracking: [-0.2, 1, 0],
45
- rotate: [-180, 180, 0],
46
- gap: [0, 10, 1]
47
- }, ya = ["tl", "t", "tr", "l", "c", "r", "bl", "b", "br"], fa = {
48
- tl: [0, 0],
49
- t: [-50, 0],
50
- tr: [-100, 0],
51
- l: [0, -50],
52
- c: [-50, -50],
53
- r: [-100, -50],
54
- bl: [0, -100],
55
- b: [-50, -100],
56
- br: [-100, -100]
57
- }, ht = ["fade", "rise", "slide-start", "slide-end", "zoom"], wt = ["spin", "float"], ha = ["title", "text"];
58
- function he(t = {}) {
59
- return {
60
- x: 5,
61
- y: 5,
62
- w: 40,
63
- size: 3,
64
- pad: 0,
65
- radius: 0,
66
- tracking: 0,
67
- rotate: 0,
68
- gap: 1,
69
- origin: "tl",
70
- hidden: !1,
71
- ...t
72
- };
73
- }
74
- function Ae(t = {}) {
75
- return {
76
- font: null,
77
- weight: 400,
78
- italic: !1,
79
- uppercase: !1,
80
- align: "start",
81
- line_height: 1.2,
82
- color: null,
83
- background: null,
84
- opacity: 1,
85
- shadow: !1,
86
- ...t
87
- };
88
- }
89
- function Re(t = {}) {
90
- return { in: null, loop: null, delay: 0, duration: 600, ...t };
91
- }
92
- function lt(t) {
93
- return JSON.parse(JSON.stringify(t));
94
- }
95
- function Lt(t = []) {
96
- const c = new Set(t);
97
- let o = "";
98
- do
99
- o = Math.random().toString(36).slice(2, 8).padEnd(6, "0");
100
- while (c.has(o) || !/^[a-z0-9]{4,12}$/.test(o));
101
- return o;
102
- }
103
- function gt(t, c, o) {
104
- const f = { id: Lt(c), type: t, style: Ae(), motion: Re() };
105
- switch (t) {
106
- case "text":
107
- return {
108
- ...f,
109
- text: { [o]: "Text" },
110
- tag: "p",
111
- frames: { desktop: he({ x: 10, y: 10, size: 2.4 }), mobile: null }
112
- };
113
- case "image":
114
- return {
115
- ...f,
116
- image: null,
117
- frames: { desktop: he({ x: 60, y: 10, w: 20 }), mobile: null }
118
- };
119
- case "button":
120
- return {
121
- ...f,
122
- text: { [o]: "Button" },
123
- link: null,
124
- variant: null,
125
- frames: { desktop: he({ x: 10, y: 25, w: 30, size: 1.2 }), mobile: null }
126
- };
127
- case "buttons":
128
- return {
129
- ...f,
130
- frames: { desktop: he({ x: 6, y: 27, w: 50, size: 1.2 }), mobile: null }
131
- };
132
- }
133
- }
134
- function wa(t) {
135
- const c = [], o = (f) => {
136
- const s = { ...f, id: Lt(c) };
137
- return c.push(s.id), s;
138
- };
139
- return [
140
- o({
141
- type: "text",
142
- text: { [t]: "{title}" },
143
- tag: "h2",
144
- style: Ae({ weight: 700, line_height: 1.05, color: "#ffffff", shadow: !0 }),
145
- frames: { desktop: he({ x: 6, y: 6, w: 45, size: 4.2 }), mobile: null },
146
- motion: Re({ in: "rise" })
147
- }),
148
- o({
149
- type: "text",
150
- text: { [t]: "{text}" },
151
- tag: "p",
152
- style: Ae({ line_height: 1.4, color: "#ffffff", shadow: !0 }),
153
- frames: { desktop: he({ x: 6, y: 18, w: 40, size: 1.4 }), mobile: null },
154
- motion: Re({ in: "rise", delay: 150 })
155
- }),
156
- o({
157
- type: "buttons",
158
- style: Ae(),
159
- frames: { desktop: he({ x: 6, y: 28, w: 50, size: 1.2 }), mobile: null },
160
- motion: Re({ in: "rise", delay: 300 })
161
- })
162
- ];
163
- }
164
- function ga(t, c, o, f) {
165
- const s = t ?? {};
166
- return ([.../* @__PURE__ */ new Set([c, ...o, ...Object.keys(s)])].map((h) => s[h]).find((h) => (h ?? "").trim() !== "") ?? "").replaceAll("{title}", f.title ?? "").replaceAll("{text}", f.text ?? "").trim();
167
- }
168
- function xa(t) {
169
- return [...t.matchAll(/\{([a-z_.]+)\}/g)].map((c) => c[1] ?? "").filter((c) => !ha.includes(c));
170
- }
171
- function xt(t) {
172
- if (typeof t != "string") return null;
173
- if (/^#[0-9a-f]{6}([0-9a-f]{2})?$/.test(t)) return t;
174
- const c = /^token:([a-z][a-z0-9-]{0,40})$/.exec(t);
175
- return c ? `var(--site-color-${c[1]})` : null;
176
- }
177
- const Ot = (t) => Math.round(t * 100) / 100;
178
- function ka(t, c) {
179
- const o = {}, f = t.frames.desktop, s = t.frames.mobile ?? f;
180
- for (const [h, b] of [
181
- ["", f],
182
- ["m-", s]
183
- ]) {
184
- for (const g of Object.keys(Ne))
185
- o[`--${h}${g}`] = String(Ot(b[g]));
186
- const [v, w] = fa[b.origin] ?? [0, 0];
187
- o[`--${h}ox`] = `${v}%`, o[`--${h}oy`] = `${w}%`, o[`--${h}display`] = b.hidden ? "none" : "block";
188
- }
189
- o["--weight"] = String(t.style.weight), o["--leading"] = String(t.style.line_height), o["--opacity"] = String(t.style.opacity), o["--align"] = t.style.align;
190
- const $ = xt(t.style.color), _ = xt(t.style.background);
191
- return $ && (o["--color"] = $), _ && (o["--background"] = _), t.style.font && (o["--font"] = `var(--site-font-${t.style.font})`), o["z-index"] = String(c), o;
192
- }
193
- function _a(t) {
194
- const c = ["webx-banner__layer", `webx-banner__layer--${t.type}`];
195
- return t.style.italic && c.push("is-italic"), t.style.uppercase && c.push("is-uppercase"), t.style.shadow && c.push("is-shadow"), t.style.background && c.push("has-background"), c;
196
- }
197
- function kt(t, c) {
198
- if (typeof t == "number") return t > 0 ? t : c;
199
- const o = /^\s*(\d+(?:\.\d+)?)\s*(?:\/\s*(\d+(?:\.\d+)?))?\s*$/.exec(t ?? "");
200
- if (!o) return c;
201
- const f = Number(o[1]) / Number(o[2] ?? 1);
202
- return Number.isFinite(f) && f > 0 ? f : c;
203
- }
204
- function $a(t, c) {
205
- if (t > c) {
206
- const f = c / t * 100;
207
- return { left: (100 - f) / 2, top: 0, width: f, height: 100 };
208
- }
209
- const o = t / c * 100;
210
- return { left: 0, top: (100 - o) / 2, width: 100, height: o };
211
- }
212
- function Va(t) {
213
- const c = { ...t };
214
- for (const o of Object.keys(Ne)) {
215
- const [f, s] = Ne[o];
216
- c[o] = Ot(Math.min(s, Math.max(f, Number(c[o]) || 0)));
217
- }
218
- return c;
219
- }
220
- const za = {
221
- module: {
222
- banners: "Banners"
223
- },
224
- places: {
225
- hero: "Home page slider",
226
- promo: "Promo strip",
227
- notice: "Announcement bar",
228
- list: "Places",
229
- new: "New place",
230
- title: "Name",
231
- key: "Key",
232
- "key-help": "What the site’s template asks for: lowercase Latin letters, digits and dashes, starting with a letter. It cannot be changed later.",
233
- declared: "Declared in the configuration",
234
- "in-template": "In a template: banners(':key')",
235
- count: "Banners",
236
- rename: "Rename",
237
- delete: "Delete",
238
- "delete-confirm": "Delete the place “:title”?",
239
- "delete-not-empty": "Only an empty place can be deleted — the bin counts too.",
240
- empty: "No places yet",
241
- choose: "Choose a place on the left",
242
- create: "Create",
243
- save: "Save",
244
- cancel: "Cancel",
245
- created: "Place created",
246
- renamed: "Place renamed",
247
- deleted: "Place deleted",
248
- places: "Places",
249
- "new-title": "New place",
250
- "rename-title": "Rename the place",
251
- "delete-title": "Delete the place “:place”?",
252
- "delete-text": "There is nothing in it. A template that still asks for it gets an empty list, not an error.",
253
- "delete-empty-first": "Delete: empty it first",
254
- "delete-blocked": "Banners in this place, the bin included: :count. Take them out first.",
255
- "field-title": "Name",
256
- "field-key": "Key",
257
- "declared-help": "Cannot be renamed or deleted here: a template asks for it by its key.",
258
- usage: "In a template:",
259
- "layout-single": "One banner",
260
- "layout-random": "A random one",
261
- "layout-slider": "Slider",
262
- "empty-help": "The site’s config declares the places its templates ask for.",
263
- "choose-help": "Its banners open beside the list."
264
- },
265
- banner: {
266
- new: "New banner",
267
- trash: "Bin",
268
- "to-trash": "Move to the bin",
269
- restore: "Restore",
270
- open: "Open",
271
- enable: "Turn on",
272
- disable: "Turn off",
273
- disabled: "Off",
274
- video: "Video",
275
- empty: "No banners in this place yet",
276
- "trash-empty": "The bin is empty",
277
- place: "Place",
278
- "place-help": "Moving the banner puts it at the end of the new place.",
279
- back: "Back to the place",
280
- save: "Save",
281
- saved: "Banner saved",
282
- trashed: "Bin",
283
- restored: "Banner restored",
284
- "leave-title": "Leave without saving?",
285
- "leave-text": "The changes to this banner will be lost.",
286
- leave: "Leave",
287
- stay: "Stay",
288
- reorder: "Reorder",
289
- untitled: "Untitled banner",
290
- all: "Banners",
291
- "empty-help": "The site shows them wherever a template asks for this place.",
292
- "empty-bin": "The bin is empty.",
293
- "no-picture": "No picture",
294
- order: "Drag to change the order on the site.",
295
- "switched-on": "Switched on.",
296
- "switched-off": "Switched off.",
297
- delete: "Delete",
298
- "delete-title": "Delete “:name”?",
299
- "delete-text": "It goes to the bin and leaves the site. Restored, it comes back to its place.",
300
- deleted: "Moved to the bin.",
301
- "reorder-failed": "The new order was not saved.",
302
- "save-failed": "Not saved.",
303
- cancel: "Cancel",
304
- previous: "Previous banner",
305
- next: "Next banner"
306
- },
307
- screen: {
308
- media: "Pictures and video",
309
- image: "Picture",
310
- "image-help": "Required. Shown on wide screens, and as the poster of the video.",
311
- "image-mobile": "Picture for phones",
312
- "image-mobile-help": "Optional. Narrow screens show it instead of the picture above.",
313
- video: "Video",
314
- "video-help": "Optional. Plays silently over the picture; the picture becomes its poster and what is seen without it.",
315
- words: "Words",
316
- title: "Title",
317
- "title-help": "A banner with words is shown only in the languages they are written in; one without words is shown everywhere.",
318
- text: "Text",
319
- "text-help": "Plain text; line breaks are kept.",
320
- buttons: "Buttons",
321
- "buttons-help": "Up to three. A button without a label in a language is not shown in it.",
322
- "buttons-add": "Add a button",
323
- "buttons-empty": "No buttons",
324
- label: "Label",
325
- link: "Link",
326
- variant: "Look",
327
- "variant-placeholder": "The first one",
328
- settings: "Settings",
329
- enabled: "On",
330
- "enabled-help": "Only a banner that is on is shown on the site. A new one starts off.",
331
- layers: "Layers",
332
- "layers-help": "Texts, pictures and buttons placed on the picture. Every size is a percent of the picture’s width, so the banner scales as a whole."
333
- },
334
- layers: {
335
- text: "Text",
336
- image: "Picture",
337
- button: "Button",
338
- "title-layer": "Banner title",
339
- "text-layer": "Banner text",
340
- "buttons-layer": "Banner buttons",
341
- desktop: "Computer",
342
- mobile: "Phone",
343
- layout: "Layout",
344
- undo: "Undo (Ctrl+Z)",
345
- redo: "Redo (Ctrl+Shift+Z)",
346
- "not-here": "This place does not print layers: they are kept, but the site does not show them.",
347
- canvas: "Banner canvas",
348
- "no-picture": "Choose a picture above",
349
- hint: "Click to select, drag to move, the handles resize. Arrows move by 0.05 (with Shift by 0.5), Delete removes, Ctrl+D duplicates, Ctrl+Z undoes. Alt while dragging: no snapping. The shade is what the frame of the place crops away.",
350
- empty: "No layers yet",
351
- list: "Layers",
352
- outside: "Outside the frame: not seen on the site",
353
- show: "Show on this layout",
354
- hide: "Hide on this layout",
355
- delete: "Delete",
356
- choose: "Select a layer on the picture or in the list.",
357
- name: "Name in the list",
358
- label: "Label",
359
- words: "Words",
360
- "falls-back": "Empty here: the site shows the words in :code.",
361
- "words-help": "Empty in a language — the default language is shown. {title} and {text} put in the banner’s fields.",
362
- "unknown-field": "Not a field of the banner: :fields. Fields are {title} and {text}.",
363
- tag: "Tag",
364
- link: "Link",
365
- variant: "Look",
366
- "buttons-help": "The buttons of the banner, in a row. Edit them in “Buttons” below.",
367
- "geometry-desktop": "Position on a computer",
368
- "geometry-mobile-own": "Position on a phone",
369
- "geometry-mobile-same": "Position on a phone — as on a computer",
370
- "same-as-desktop": "As on a computer",
371
- unit: "In percent of the picture’s width.",
372
- x: "x (from the left)",
373
- y: "y (from the top)",
374
- w: "Width",
375
- size: "Font size",
376
- pad: "Padding",
377
- radius: "Rounding",
378
- tracking: "Letter spacing, em",
379
- rotate: "Rotation, °",
380
- gap: "Gap",
381
- origin: "Anchor",
382
- "origin-help": "Which point of the layer stands at x and y: longer words grow away from it.",
383
- "hidden-here": "Hidden on this layout",
384
- look: "Look",
385
- font: "Font",
386
- "font-site": "As on the site",
387
- "font-heading": "Headings",
388
- "font-body": "Body text",
389
- weight: "Weight",
390
- "line-height": "Line height",
391
- opacity: "Opacity",
392
- align: "Alignment",
393
- "align-start": "Start",
394
- "align-center": "Centre",
395
- "align-end": "End",
396
- italic: "Italic",
397
- uppercase: "Capitals",
398
- shadow: "Shadow",
399
- color: "Colour",
400
- background: "Background",
401
- motion: "Motion",
402
- entrance: "Entrance",
403
- loop: "Loop",
404
- delay: "Delay, ms",
405
- duration: "Duration, ms",
406
- "motion-none": "None",
407
- "in-fade": "Fade in",
408
- "in-rise": "Rise",
409
- "in-slide-start": "From the start",
410
- "in-slide-end": "From the end",
411
- "in-zoom": "Zoom",
412
- "loop-spin": "Spin",
413
- "loop-float": "Float"
414
- }
415
- }, _t = /* @__PURE__ */ new WeakSet();
416
- function Te() {
417
- try {
418
- const { i18n: t } = ze();
419
- _t.has(t) || (t.defaults("webx-banners", za), _t.add(t));
420
- } catch {
421
- }
422
- }
423
- const Sa = /* @__PURE__ */ Ve({
424
- name: "WxBannerEditorPage",
425
- __name: "BannerEditorPage",
426
- props: {
427
- base: { default: "/banners" }
428
- },
429
- setup(t) {
430
- const c = t, o = ze(), f = Ue(o), s = st(), $ = ot(), _ = Je();
431
- Te();
432
- const h = Se("webx-banners"), b = rt(), v = y(() => {
433
- const a = s.params.id;
434
- return typeof a == "string" && a !== "" ? Number(a) : null;
435
- }), w = A(null), g = A({}), T = A(""), V = A(null), W = A(null), K = A([]), J = A(!0), U = A(!1), C = A({}), L = y(() => o.can("banners.manage")), R = y(() => JSON.stringify(g.value)), X = y(
436
- () => T.value !== "" && (R.value !== T.value || V.value !== W.value)
437
- ), ee = y(() => U.value ? "saving" : X.value || v.value === null ? "unsaved" : "saved"), se = y(() => {
438
- const a = g.value.title, n = v.value === null ? h("banner.new") : w.value?.title ?? "";
439
- return Zt(a, _.active.value, n) || h("banner.untitled");
440
- }), k = y(() => {
441
- const a = W.value ?? V.value;
442
- return a === null ? c.base : `${c.base}?place=${encodeURIComponent(a)}`;
443
- }), q = y(
444
- () => o.state.manifest?.modules.find((a) => a.id === "banners")?.title ?? h("module.banners")
445
- ), z = y(() => K.value.find((a) => a.key === V.value) ?? null);
446
- ma({ values: g, place: z });
447
- const S = y(
448
- () => z.value?.layers ? [] : [{ op: "remove", target: "layers-card" }]
449
- );
450
- function M(a) {
451
- return !z.value?.layers || a.layers !== null && a.layers !== void 0 ? a : { ...a, layers: wa(_.list.value[0]?.code ?? _.active.value) };
452
- }
453
- const D = y(
454
- () => K.value.map((a) => ({ value: a.key, label: `${a.title} · ${a.key}` }))
455
- ), we = y({
456
- get: () => V.value,
457
- set: (a) => {
458
- V.value = a == null ? null : String(a);
459
- }
460
- });
461
- function Ce() {
462
- return {
463
- image: null,
464
- image_mobile: null,
465
- video: null,
466
- title: {},
467
- text: {},
468
- buttons: [],
469
- layers: null,
470
- enabled: !1
471
- };
472
- }
473
- function ge(a) {
474
- w.value = a.banner, V.value = a.banner.place, W.value = a.banner.place;
475
- const n = M(a.values);
476
- g.value = n, T.value = JSON.stringify(n);
477
- }
478
- async function me() {
479
- J.value = !0;
480
- try {
481
- const [a, n] = await Promise.all([
482
- f.places(),
483
- v.value === null ? Promise.resolve(null) : f.get(v.value)
484
- ]);
485
- if (K.value = a, n !== null)
486
- ge(n);
487
- else {
488
- const I = s.query.place, ue = typeof I == "string" && a.some((je) => je.key === I) ? I : null;
489
- w.value = null, V.value = ue ?? a[0]?.key ?? null, W.value = V.value;
490
- const De = M(Ce());
491
- g.value = De, T.value = JSON.stringify(De);
492
- }
493
- } catch (a) {
494
- Z.danger(b(a)), $.push(c.base);
495
- } finally {
496
- J.value = !1;
497
- }
498
- }
499
- async function ie() {
500
- if (!(U.value || !L.value || V.value === null)) {
501
- U.value = !0, C.value = {};
502
- try {
503
- const a = v.value === null, n = a ? await f.create(V.value, g.value) : await f.save(
504
- v.value,
505
- g.value,
506
- V.value !== W.value ? V.value : void 0
507
- );
508
- ge(n), Z.success(h("banner.saved")), a && $.replace(`${c.base}/${n.banner.id}`);
509
- } catch (a) {
510
- const n = a.body;
511
- n?.errors ? (C.value = n.errors, Z.danger(h("banner.save-failed"))) : Z.danger(b(a));
512
- } finally {
513
- U.value = !1;
514
- }
515
- }
516
- }
517
- async function de() {
518
- const a = w.value;
519
- if (!(!a || !await Fe({
520
- title: h("banner.delete-title", { name: a.title }),
521
- message: h("banner.delete-text"),
522
- confirmText: h("banner.delete"),
523
- cancelText: h("banner.cancel"),
524
- tone: "danger"
525
- })))
526
- try {
527
- await f.remove(a.id), Z.success(h("banner.deleted")), T.value = R.value, V.value = W.value, $.push(k.value);
528
- } catch (I) {
529
- Z.danger(b(I));
530
- }
531
- }
532
- function xe(a) {
533
- X.value && a.preventDefault();
534
- }
535
- function ce(a) {
536
- (a.ctrlKey || a.metaKey) && a.key.toLowerCase() === "s" && (a.preventDefault(), (X.value || v.value === null) && ie());
537
- }
538
- ia(ce), $e(V, () => {
539
- J.value || (g.value = M(g.value));
540
- }), $e(v, (a) => {
541
- a !== null && w.value?.id === a || me();
542
- }), nt(() => {
543
- me(), window.addEventListener("beforeunload", xe);
544
- }), Vt(() => {
545
- window.removeEventListener("beforeunload", xe);
546
- }), Gt(async () => !X.value || !L.value ? !0 : await Fe({
547
- title: h("banner.leave-title"),
548
- message: h("banner.leave-text"),
549
- confirmText: h("banner.leave"),
550
- cancelText: h("banner.cancel"),
551
- tone: "danger"
552
- }));
553
- const p = y(
554
- () => L.value && w.value !== null ? [
555
- {
556
- key: "delete",
557
- label: h("banner.delete"),
558
- icon: "trash",
559
- danger: !0,
560
- menu: !0,
561
- run: () => {
562
- de();
563
- }
564
- }
565
- ] : []
566
- );
567
- return (a, n) => (m(), B("div", {
568
- class: "wx-banner-editor",
569
- onKeydown: ce
570
- }, [
571
- J.value ? (m(), B(ne, { key: 0 }, [
572
- i(e(qe), {
573
- class: "wx-banner-editor__ghost",
574
- title: "",
575
- rows: 1
576
- }),
577
- i(e(Qe), null, {
578
- default: d(() => [
579
- i(e(qe), { rows: 6 })
580
- ]),
581
- _: 1
582
- })
583
- ], 64)) : (m(), B(ne, { key: 1 }, [
584
- i(e(Bt), {
585
- divider: "",
586
- back: k.value,
587
- "back-label": q.value,
588
- title: se.value,
589
- actions: p.value
590
- }, zt({ _: 2 }, [
591
- w.value && !w.value.enabled ? {
592
- name: "title-after",
593
- fn: d(() => [
594
- i(e(et), { dot: "" }, {
595
- default: d(() => [
596
- F(N(e(h)("banner.disabled")), 1)
597
- ]),
598
- _: 1
599
- })
600
- ]),
601
- key: "0"
602
- } : void 0
603
- ]), 1032, ["back", "back-label", "title", "actions"]),
604
- i(e(Qe), { class: "wx-banner-editor__place" }, {
605
- default: d(() => [
606
- i(e(G), {
607
- label: e(h)("banner.place"),
608
- help: v.value === null ? void 0 : e(h)("banner.place-help"),
609
- error: C.value.place?.[0],
610
- required: ""
611
- }, {
612
- default: d(() => [
613
- i(e(fe), {
614
- modelValue: we.value,
615
- "onUpdate:modelValue": n[0] || (n[0] = (I) => we.value = I),
616
- options: D.value,
617
- disabled: !L.value || U.value,
618
- "aria-label": e(h)("banner.place")
619
- }, null, 8, ["modelValue", "options", "disabled", "aria-label"])
620
- ]),
621
- _: 1
622
- }, 8, ["label", "help", "error"])
623
- ]),
624
- _: 1
625
- }),
626
- i(e(ra), {
627
- modelValue: g.value,
628
- "onUpdate:modelValue": n[1] || (n[1] = (I) => g.value = I),
629
- name: "banners.form",
630
- patch: S.value,
631
- errors: C.value,
632
- disabled: !L.value || U.value
633
- }, null, 8, ["modelValue", "patch", "errors", "disabled"]),
634
- L.value ? (m(), E(e(Xt), { key: 0 }, {
635
- state: d(() => [
636
- i(e(ua), { state: ee.value }, null, 8, ["state"])
637
- ]),
638
- default: d(() => [
639
- i(e(Q), {
640
- type: "primary",
641
- loading: U.value,
642
- disabled: !X.value && v.value !== null || V.value === null,
643
- onClick: ie
644
- }, {
645
- default: d(() => [
646
- F(N(e(h)("banner.save")), 1)
647
- ]),
648
- _: 1
649
- }, 8, ["loading", "disabled"])
650
- ]),
651
- _: 1
652
- })) : H("", !0)
653
- ], 64))
654
- ], 32));
655
- }
656
- }), Ie = (t, c) => {
657
- const o = t.__vccOpts || t;
658
- for (const [f, s] of c)
659
- o[f] = s;
660
- return o;
661
- }, $t = /* @__PURE__ */ Ie(Sa, [["__scopeId", "data-v-b6bd4d3f"]]), Ca = /* @__PURE__ */ Ve({
662
- name: "WxBannerPlaceDialog",
663
- __name: "PlaceDialog",
664
- props: {
665
- place: { default: null }
666
- },
667
- setup(t) {
668
- const c = t, { open: o, resolve: f, dismiss: s } = Yt(), $ = Ue(ze()), _ = Je();
669
- Te();
670
- const h = Se("webx-banners"), b = c.place !== null;
671
- function v() {
672
- if (c.place === null) return {};
673
- if (c.place.titles) return { ...c.place.titles };
674
- const C = _.list.value[0]?.code;
675
- return C === void 0 ? {} : { [C]: c.place.title };
676
- }
677
- const w = A(c.place?.key ?? ""), g = A(v()), T = A(!1), V = A({}), W = Jt("field");
678
- nt(async () => {
679
- await jt(), W.value?.querySelector("input")?.focus();
680
- });
681
- function K() {
682
- return Object.values(g.value).some((C) => C.trim() !== "");
683
- }
684
- function J(C) {
685
- const L = Object.keys(V.value).find((R) => R === C || R.startsWith(`${C}.`));
686
- return L === void 0 ? void 0 : V.value[L]?.[0];
687
- }
688
- async function U() {
689
- if (!(!K() || T.value)) {
690
- T.value = !0, V.value = {};
691
- try {
692
- f(
693
- b && c.place !== null ? await $.renamePlace(c.place.key, g.value) : await $.createPlace({ key: w.value.trim(), title: g.value })
694
- );
695
- } catch (C) {
696
- V.value = C.body?.errors ?? {};
697
- } finally {
698
- T.value = !1;
699
- }
700
- }
701
- }
702
- return (C, L) => (m(), E(e(Qt), {
703
- open: e(o),
704
- "onUpdate:open": L[3] || (L[3] = (R) => ye(o) ? o.value = R : null),
705
- title: b ? e(h)("places.rename-title") : e(h)("places.new-title"),
706
- width: 440
707
- }, {
708
- footer: d(() => [
709
- i(e(ea), { size: "sm" }, {
710
- default: d(() => [
711
- i(e(Q), {
712
- variant: "outline",
713
- onClick: L[2] || (L[2] = (R) => e(s)())
714
- }, {
715
- default: d(() => [
716
- F(N(e(h)("places.cancel")), 1)
717
- ]),
718
- _: 1
719
- }),
720
- i(e(Q), {
721
- type: "primary",
722
- loading: T.value,
723
- disabled: !K() || w.value.trim() === "",
724
- onClick: U
725
- }, {
726
- default: d(() => [
727
- F(N(b ? e(h)("places.save") : e(h)("places.create")), 1)
728
- ]),
729
- _: 1
730
- }, 8, ["loading", "disabled"])
731
- ]),
732
- _: 1
733
- })
734
- ]),
735
- default: d(() => [
736
- i(e(G), {
737
- label: e(h)("places.field-title"),
738
- error: J("title"),
739
- required: ""
740
- }, {
741
- default: d(() => [
742
- P("div", {
743
- ref_key: "field",
744
- ref: W
745
- }, [
746
- i(e(Ke), {
747
- modelValue: g.value,
748
- "onUpdate:modelValue": L[0] || (L[0] = (R) => g.value = R),
749
- localized: "",
750
- "aria-label": e(h)("places.field-title"),
751
- onKeyup: ft(U, ["enter"])
752
- }, null, 8, ["modelValue", "aria-label"])
753
- ], 512)
754
- ]),
755
- _: 1
756
- }, 8, ["label", "error"]),
757
- i(e(G), {
758
- label: e(h)("places.field-key"),
759
- error: J("key"),
760
- help: b ? void 0 : e(h)("places.key-help"),
761
- required: ""
762
- }, {
763
- default: d(() => [
764
- i(e(Ke), {
765
- modelValue: w.value,
766
- "onUpdate:modelValue": L[1] || (L[1] = (R) => w.value = R),
767
- disabled: b,
768
- "aria-label": e(h)("places.field-key"),
769
- autocomplete: "off",
770
- onKeyup: ft(U, ["enter"])
771
- }, null, 8, ["modelValue", "aria-label"])
772
- ]),
773
- _: 1
774
- }, 8, ["label", "error", "help"])
775
- ]),
776
- _: 1
777
- }, 8, ["open", "title"]));
778
- }
779
- }), Ba = { class: "wx-banner-place" }, Pa = ["aria-label"], Wa = { class: "wx-banner-place__usage" }, La = {
780
- key: 0,
781
- class: "wx-banner-place__layout"
782
- }, Oa = { class: "wx-banner-row__thumb" }, Na = ["src"], Ua = { class: "wx-banner-row__body" }, Ta = { class: "wx-banner-row__title" }, Ia = {
783
- key: 0,
784
- class: "wx-banner-row__facts"
785
- }, Da = /* @__PURE__ */ Ve({
786
- name: "WxBannerPlacePane",
787
- __name: "PlacePane",
788
- props: {
789
- place: {},
790
- base: {},
791
- inline: { type: Boolean, default: !0 }
792
- },
793
- emits: ["back", "changed"],
794
- setup(t, { emit: c }) {
795
- const o = t, f = c, s = ze(), $ = Ue(s), _ = st(), h = ot();
796
- Te();
797
- const b = Se("webx-banners"), v = rt(), w = A([]), g = A(!0), T = y(() => s.can("banners.manage")), V = y({
798
- get: () => _.query.view === "trashed" ? "trashed" : "live",
799
- set: (S) => {
800
- h.replace({
801
- query: { ..._.query, view: S === "trashed" ? "trashed" : void 0 }
802
- });
803
- }
804
- }), W = y(() => V.value === "trashed"), K = y(() => [
805
- { value: "live", label: b("banner.all") },
806
- { value: "trashed", label: b("banner.trashed"), icon: "trash" }
807
- ]), J = y(() => T.value && !W.value && w.value.length > 1), U = y(() => ["single", "random", "slider"].includes(o.place.layout) ? b(`places.layout-${o.place.layout}`) : "");
808
- async function C() {
809
- g.value = !0;
810
- try {
811
- w.value = await $.list(o.place.key, W.value);
812
- } catch (S) {
813
- Z.danger(v(S));
814
- } finally {
815
- g.value = !1;
816
- }
817
- }
818
- $e(W, () => {
819
- C();
820
- }), C();
821
- function L(S) {
822
- return `${o.base}/${S.id}`;
823
- }
824
- function R() {
825
- h.push({ path: `${o.base}/new`, query: { place: o.place.key } });
826
- }
827
- async function X() {
828
- try {
829
- await $.reorder(
830
- o.place.key,
831
- w.value.map((S) => S.id)
832
- );
833
- } catch (S) {
834
- Z.danger(v(S, b("banner.reorder-failed"))), await C();
835
- }
836
- }
837
- async function ee(S) {
838
- try {
839
- const M = await $.get(S.id);
840
- await $.save(S.id, { ...M.values, enabled: !S.enabled }), Z.success(S.enabled ? b("banner.switched-off") : b("banner.switched-on"));
841
- } catch (M) {
842
- Z.danger(v(M));
843
- } finally {
844
- await C();
845
- }
846
- }
847
- async function se(S) {
848
- if (await Fe({
849
- title: b("banner.delete-title", { name: S.title }),
850
- message: b("banner.delete-text"),
851
- confirmText: b("banner.delete"),
852
- cancelText: b("banner.cancel"),
853
- tone: "danger"
854
- }))
855
- try {
856
- await $.remove(S.id), Z.success(b("banner.deleted")), f("changed");
857
- } catch (D) {
858
- Z.danger(v(D));
859
- } finally {
860
- await C();
861
- }
862
- }
863
- async function k(S) {
864
- try {
865
- await $.restore(S.id), Z.success(b("banner.restored")), f("changed");
866
- } catch (M) {
867
- Z.danger(v(M));
868
- } finally {
869
- await C();
870
- }
871
- }
872
- function q(S) {
873
- if (W.value)
874
- return T.value ? [
875
- {
876
- key: "restore",
877
- icon: "refresh",
878
- label: b("banner.restore"),
879
- run: () => {
880
- k(S);
881
- }
882
- }
883
- ] : [];
884
- const M = {
885
- key: "open",
886
- icon: "edit",
887
- label: b("banner.open"),
888
- run: () => {
889
- h.push(L(S));
890
- }
891
- };
892
- return T.value ? [
893
- M,
894
- {
895
- key: "toggle",
896
- icon: S.enabled ? "eye-off" : "eye",
897
- label: S.enabled ? b("banner.disable") : b("banner.enable"),
898
- run: () => {
899
- ee(S);
900
- }
901
- },
902
- {
903
- key: "delete",
904
- icon: "trash",
905
- label: b("banner.delete"),
906
- danger: !0,
907
- run: () => {
908
- se(S);
909
- }
910
- }
911
- ] : [M];
912
- }
913
- const z = y(
914
- () => T.value && !W.value ? [{ key: "new", label: b("banner.new"), icon: "plus", primary: !0, run: R }] : []
915
- );
916
- return (S, M) => (m(), B("div", Ba, [
917
- i(e(Bt), {
918
- level: 3,
919
- back: !o.inline,
920
- "back-label": e(b)("places.places"),
921
- title: t.place.title,
922
- actions: z.value,
923
- "collapse-below": 420,
924
- onBack: M[0] || (M[0] = (D) => f("back"))
925
- }, zt({ _: 2 }, [
926
- t.place.declared ? {
927
- name: "title-after",
928
- fn: d(() => [
929
- i(e(tt), {
930
- content: e(b)("places.declared-help")
931
- }, {
932
- default: d(() => [
933
- P("span", {
934
- class: "wx-banner-place__lock",
935
- tabindex: "0",
936
- "aria-label": e(b)("places.declared")
937
- }, [
938
- i(e(le), {
939
- name: "lock",
940
- size: "sm"
941
- })
942
- ], 8, Pa)
943
- ]),
944
- _: 1
945
- }, 8, ["content"])
946
- ]),
947
- key: "0"
948
- } : void 0
949
- ]), 1032, ["back", "back-label", "title", "actions"]),
950
- P("p", Wa, [
951
- P("span", null, N(e(b)("places.usage")), 1),
952
- P("code", null, "banners('" + N(t.place.key) + "')", 1),
953
- U.value ? (m(), B("span", La, "· " + N(U.value), 1)) : H("", !0)
954
- ]),
955
- i(e(it), {
956
- modelValue: V.value,
957
- "onUpdate:modelValue": M[1] || (M[1] = (D) => V.value = D),
958
- class: "wx-banner-place__views",
959
- size: "sm",
960
- options: K.value,
961
- "aria-label": e(b)("banner.all")
962
- }, null, 8, ["modelValue", "options", "aria-label"]),
963
- g.value && w.value.length === 0 ? (m(), E(e(qe), {
964
- key: 0,
965
- rows: 4
966
- })) : w.value.length === 0 ? (m(), E(e(at), {
967
- key: 1,
968
- title: W.value ? e(b)("banner.empty-bin") : e(b)("banner.empty"),
969
- description: W.value ? void 0 : e(b)("banner.empty-help")
970
- }, null, 8, ["title", "description"])) : (m(), B(ne, { key: 2 }, [
971
- i(e(Ct), {
972
- modelValue: w.value,
973
- "onUpdate:modelValue": M[2] || (M[2] = (D) => w.value = D),
974
- class: oe(["wx-banner-place__list", { "is-loading": g.value }]),
975
- hoverable: "",
976
- plain: "",
977
- "item-key": "id",
978
- handle: J.value ? "grip" : "row",
979
- "item-label": (D) => D.title,
980
- disabled: !J.value,
981
- onMove: X
982
- }, {
983
- default: d(({ item: D }) => [
984
- (m(), E(St(W.value ? "div" : "router-link"), {
985
- to: W.value ? void 0 : L(D),
986
- class: oe(["wx-banner-row", { "is-off": !D.enabled && !W.value }])
987
- }, {
988
- default: d(() => [
989
- P("span", Oa, [
990
- D.thumb ? (m(), B("img", {
991
- key: 0,
992
- src: D.thumb,
993
- alt: "",
994
- loading: "lazy"
995
- }, null, 8, Na)) : (m(), E(e(le), {
996
- key: 1,
997
- name: "image",
998
- size: "sm",
999
- "aria-label": e(b)("banner.no-picture")
1000
- }, null, 8, ["aria-label"]))
1001
- ]),
1002
- P("span", Ua, [
1003
- P("span", Ta, N(D.title), 1),
1004
- D.video || !D.enabled && !W.value ? (m(), B("span", Ia, [
1005
- D.video ? (m(), E(e(et), {
1006
- key: 0,
1007
- size: "sm",
1008
- type: "info"
1009
- }, {
1010
- default: d(() => [
1011
- F(N(e(b)("banner.video")), 1)
1012
- ]),
1013
- _: 1
1014
- })) : H("", !0),
1015
- !D.enabled && !W.value ? (m(), E(e(et), {
1016
- key: 1,
1017
- dot: "",
1018
- size: "sm"
1019
- }, {
1020
- default: d(() => [
1021
- F(N(e(b)("banner.disabled")), 1)
1022
- ]),
1023
- _: 1
1024
- })) : H("", !0)
1025
- ])) : H("", !0)
1026
- ])
1027
- ]),
1028
- _: 2
1029
- }, 1032, ["to", "class"]))
1030
- ]),
1031
- actions: d(({ item: D }) => [
1032
- i(e(Pt), {
1033
- actions: q(D),
1034
- label: D.title
1035
- }, null, 8, ["actions", "label"])
1036
- ]),
1037
- _: 1
1038
- }, 8, ["modelValue", "class", "handle", "item-label", "disabled"]),
1039
- J.value ? (m(), E(e(ta), {
1040
- key: 0,
1041
- class: "wx-banner-place__note",
1042
- type: "info",
1043
- description: e(b)("banner.order")
1044
- }, null, 8, ["description"])) : H("", !0)
1045
- ], 64))
1046
- ]));
1047
- }
1048
- }), Ea = /* @__PURE__ */ Ie(Da, [["__scopeId", "data-v-48d645bf"]]), Ma = {
1049
- key: 2,
1050
- class: "wx-banners__list"
1051
- }, Aa = ["onClick"], Ra = { class: "wx-banners__name" }, Fa = /* @__PURE__ */ Ve({
1052
- __name: "BannersPage",
1053
- props: {
1054
- base: { default: "/banners" }
1055
- },
1056
- setup(t) {
1057
- const c = t, o = ze(), f = Ue(o), s = st(), $ = ot();
1058
- Te();
1059
- const _ = Se("webx-banners"), h = rt(), b = A([]), v = A(!0), w = A(!1), g = A(!0), T = y(() => o.can("banners.manage")), V = aa(Ca), W = y(
1060
- () => o.state.manifest?.modules.find((k) => k.id === "banners")?.title ?? _("module.banners")
1061
- ), K = y(() => {
1062
- const k = s.query.place;
1063
- return typeof k == "string" && k !== "" ? k : null;
1064
- }), J = y(() => b.value.find((k) => k.key === K.value) ?? null);
1065
- async function U() {
1066
- v.value = !0;
1067
- try {
1068
- b.value = await f.places();
1069
- } catch (k) {
1070
- Z.danger(h(k));
1071
- } finally {
1072
- v.value = !1;
1073
- }
1074
- }
1075
- U(), $e([b, J, g], () => {
1076
- !g.value || b.value.length === 0 || J.value !== null || $.replace({ query: { ...s.query, place: b.value[0].key } });
1077
- }), $e(J, (k) => {
1078
- k !== null && g.value && (w.value = !0);
1079
- }), K.value !== null && (w.value = !0);
1080
- function C(k) {
1081
- const q = { ...s.query, place: k.key };
1082
- delete q.view, $.replace({ query: q }), w.value = !0;
1083
- }
1084
- async function L() {
1085
- const k = await V({ place: null });
1086
- k && (Z.success(_("places.created")), await U(), C(k));
1087
- }
1088
- async function R(k) {
1089
- await V({ place: k }) && (Z.success(_("places.renamed")), await U());
1090
- }
1091
- async function X(k) {
1092
- if (await Fe({
1093
- title: _("places.delete-title", { place: k.title }),
1094
- message: _("places.delete-text"),
1095
- confirmText: _("places.delete"),
1096
- cancelText: _("places.cancel"),
1097
- tone: "danger"
1098
- }))
1099
- try {
1100
- if (await f.removePlace(k.key), Z.success(_("places.deleted")), K.value === k.key) {
1101
- const z = { ...s.query };
1102
- delete z.place, delete z.view, $.replace({ query: z }), w.value = !1;
1103
- }
1104
- } catch (z) {
1105
- Z.danger(h(z));
1106
- } finally {
1107
- await U();
1108
- }
1109
- }
1110
- function ee(k) {
1111
- return !T.value || k.declared ? [] : [
1112
- { key: "rename", icon: "edit", label: _("places.rename"), run: () => {
1113
- R(k);
1114
- } },
1115
- {
1116
- key: "delete",
1117
- icon: "trash",
1118
- // Said in the line itself, since a switched-off line cannot carry a tooltip: an empty
1119
- // place is the only kind that goes (decision 1).
1120
- label: k.count > 0 ? _("places.delete-empty-first") : _("places.delete"),
1121
- danger: !0,
1122
- disabled: k.count > 0,
1123
- run: () => {
1124
- X(k);
1125
- }
1126
- }
1127
- ];
1128
- }
1129
- const se = y(
1130
- () => T.value ? [{ key: "new-place", label: _("places.new"), icon: "plus", run: () => {
1131
- L();
1132
- } }] : []
1133
- );
1134
- return (k, q) => (m(), E(e(da), {
1135
- title: W.value,
1136
- actions: se.value,
1137
- card: !1
1138
- }, {
1139
- default: d(() => [
1140
- i(e(Qe), {
1141
- class: "wx-banners",
1142
- padding: "none"
1143
- }, {
1144
- default: d(() => [
1145
- i(e(la), {
1146
- open: w.value,
1147
- "onUpdate:open": q[0] || (q[0] = (z) => w.value = z),
1148
- class: "wx-banners__panes",
1149
- "list-width": 300,
1150
- "detail-min": 440,
1151
- "detail-label": e(_)("places.places"),
1152
- onDetailInline: q[1] || (q[1] = (z) => g.value = z)
1153
- }, {
1154
- list: d(() => [
1155
- v.value && b.value.length === 0 ? (m(), E(e(qe), {
1156
- key: 0,
1157
- class: "wx-banners__loading",
1158
- rows: 3
1159
- })) : b.value.length === 0 ? (m(), E(e(at), {
1160
- key: 1,
1161
- title: e(_)("places.empty"),
1162
- description: e(_)("places.empty-help")
1163
- }, null, 8, ["title", "description"])) : (m(), B("ul", Ma, [
1164
- (m(!0), B(ne, null, ve(b.value, (z) => (m(), B("li", {
1165
- key: z.key,
1166
- class: "wx-banners__row"
1167
- }, [
1168
- P("button", {
1169
- type: "button",
1170
- class: oe(["wx-banners__open", { "is-current": z.key === K.value }]),
1171
- onClick: (S) => C(z)
1172
- }, [
1173
- P("span", Ra, [
1174
- i(e(re), {
1175
- truncate: "",
1176
- weight: "medium"
1177
- }, {
1178
- default: d(() => [
1179
- F(N(z.title), 1)
1180
- ]),
1181
- _: 2
1182
- }, 1024),
1183
- z.declared ? (m(), E(e(le), {
1184
- key: 0,
1185
- class: "wx-banners__lock",
1186
- name: "lock",
1187
- size: "sm",
1188
- "aria-label": e(_)("places.declared")
1189
- }, null, 8, ["aria-label"])) : H("", !0),
1190
- i(e(na), {
1191
- class: "wx-banners__count",
1192
- type: "neutral",
1193
- value: z.count,
1194
- label: e(_)("places.count")
1195
- }, null, 8, ["value", "label"])
1196
- ]),
1197
- i(e(re), {
1198
- size: "sm",
1199
- tone: "muted",
1200
- mono: "",
1201
- truncate: ""
1202
- }, {
1203
- default: d(() => [
1204
- F("banners('" + N(z.key) + "')", 1)
1205
- ]),
1206
- _: 2
1207
- }, 1024)
1208
- ], 10, Aa),
1209
- ee(z).length > 0 ? (m(), E(e(Pt), {
1210
- key: 0,
1211
- actions: ee(z),
1212
- label: z.title
1213
- }, null, 8, ["actions", "label"])) : H("", !0)
1214
- ]))), 128))
1215
- ]))
1216
- ]),
1217
- detail: d(({ inline: z, back: S }) => [
1218
- J.value ? (m(), E(Ea, {
1219
- key: J.value.key,
1220
- place: J.value,
1221
- base: c.base,
1222
- inline: z,
1223
- onBack: S,
1224
- onChanged: U
1225
- }, null, 8, ["place", "base", "inline", "onBack"])) : H("", !0)
1226
- ]),
1227
- empty: d(() => [
1228
- i(e(at), {
1229
- title: e(_)("places.choose"),
1230
- description: e(_)("places.choose-help")
1231
- }, null, 8, ["title", "description"])
1232
- ]),
1233
- _: 1
1234
- }, 8, ["open", "detail-label"])
1235
- ]),
1236
- _: 1
1237
- })
1238
- ]),
1239
- _: 1
1240
- }, 8, ["title", "actions"]));
1241
- }
1242
- }), qa = /* @__PURE__ */ Ie(Fa, [["__scopeId", "data-v-615232f0"]]), Ka = { class: "wx-banner-layer-inspector" }, Ja = { class: "wx-banner-layer-inspector__head" }, ja = { class: "wx-banner-layer-inspector__fields" }, Ha = { class: "wx-banner-layer-inspector__group" }, Ga = { class: "wx-banner-layer-inspector__title" }, Za = { class: "wx-banner-layer-inspector__grid" }, Xa = ["aria-label"], Ya = ["aria-checked", "aria-label", "disabled", "onClick"], Qa = {
1243
- key: 5,
1244
- class: "wx-banner-layer-inspector__group"
1245
- }, el = { class: "wx-banner-layer-inspector__grid" }, tl = { class: "wx-banner-layer-inspector__switches" }, al = { class: "wx-banner-layer-inspector__color" }, ll = ["title", "aria-label", "disabled", "onClick"], nl = { class: "wx-banner-layer-inspector__group" }, sl = { class: "wx-banner-layer-inspector__grid" }, ol = /* @__PURE__ */ Ve({
1246
- name: "WxBannerLayerInspector",
1247
- __name: "LayerInspector",
1248
- props: {
1249
- layer: {},
1250
- view: {},
1251
- tags: {},
1252
- variants: {},
1253
- palette: {},
1254
- disabled: { type: Boolean }
1255
- },
1256
- emits: ["update", "frame", "same-as-desktop", "delete"],
1257
- setup(t, { emit: c }) {
1258
- const o = t, f = c, s = Se("webx-banners"), $ = Je(), _ = y(
1259
- () => o.view === "mobile" ? o.layer.frames.mobile ?? o.layer.frames.desktop : o.layer.frames.desktop
1260
- ), h = y(() => o.view === "mobile" && o.layer.frames.mobile !== null);
1261
- function b(p) {
1262
- const a = lt(o.layer);
1263
- p(a), f("update", a);
1264
- }
1265
- function v(p, a) {
1266
- b((n) => {
1267
- n.style[p] = a;
1268
- });
1269
- }
1270
- const w = y(() => o.layer.type === "text" || o.layer.type === "button"), g = y({
1271
- get: () => o.layer.text ?? {},
1272
- set: (p) => b((a) => {
1273
- a.text = p;
1274
- })
1275
- }), T = y({
1276
- get: () => o.layer.name ?? "",
1277
- set: (p) => b((a) => {
1278
- a.name = p;
1279
- })
1280
- }), V = y(() => xa(g.value[$.active.value] ?? "")), W = y(() => V.value.map((p) => `{${p}}`).join(", ")), K = y(() => {
1281
- const p = g.value, a = $.active.value;
1282
- return (p[a] ?? "").trim() !== "" ? null : [...$.list.value.map((n) => n.code), ...Object.keys(p)].find(
1283
- (n) => (p[n] ?? "").trim() !== ""
1284
- ) ?? null;
1285
- });
1286
- function J(p) {
1287
- const a = $.active.value, n = g.value[a] ?? "";
1288
- g.value = { ...g.value, [a]: `${n}${n === "" ? "" : " "}{${p}}` };
1289
- }
1290
- const U = y({
1291
- get: () => o.layer.image ?? null,
1292
- set: (p) => b((a) => {
1293
- a.image = p;
1294
- })
1295
- }), C = y({
1296
- get: () => o.layer.link ?? null,
1297
- set: (p) => b((a) => {
1298
- a.link = p;
1299
- })
1300
- }), L = (p, a) => y({
1301
- get: () => p(),
1302
- set: (n) => a(n)
1303
- }), R = L(
1304
- () => o.layer.tag ?? "p",
1305
- (p) => b((a) => {
1306
- a.tag = p;
1307
- })
1308
- ), X = L(
1309
- () => o.layer.variant ?? o.variants[0]?.value ?? null,
1310
- (p) => b((a) => {
1311
- a.variant = p;
1312
- })
1313
- ), ee = L(
1314
- () => o.layer.style.font ?? "site",
1315
- (p) => v("font", p === "heading" || p === "body" ? p : null)
1316
- ), se = L(
1317
- () => o.layer.style.weight,
1318
- (p) => v("weight", Number(p))
1319
- ), k = y({
1320
- get: () => o.layer.style.align,
1321
- set: (p) => v("align", p)
1322
- }), q = L(
1323
- () => o.layer.motion.in ?? "none",
1324
- (p) => b((a) => {
1325
- a.motion.in = ht.includes(p) ? p : null;
1326
- })
1327
- ), z = L(
1328
- () => o.layer.motion.loop ?? "none",
1329
- (p) => b((a) => {
1330
- a.motion.loop = wt.includes(p) ? p : null;
1331
- })
1332
- ), S = y(() => {
1333
- switch (o.layer.type) {
1334
- case "image":
1335
- return ["x", "y", "w", "radius", "rotate"];
1336
- case "buttons":
1337
- return ["x", "y", "w", "size", "gap", "rotate"];
1338
- default:
1339
- return ["x", "y", "w", "size", "pad", "radius", "tracking", "rotate"];
1340
- }
1341
- }), M = {
1342
- x: 0.05,
1343
- y: 0.05,
1344
- w: 0.5,
1345
- size: 0.05,
1346
- pad: 0.05,
1347
- radius: 0.1,
1348
- tracking: 0.01,
1349
- rotate: 1,
1350
- gap: 0.1
1351
- };
1352
- function D(p, a) {
1353
- a === null || Number.isNaN(a) || f("frame", { [p]: a });
1354
- }
1355
- function we(p) {
1356
- f("frame", { origin: p });
1357
- }
1358
- const Ce = y(() => [
1359
- { value: "site", label: s("layers.font-site") },
1360
- { value: "heading", label: s("layers.font-heading") },
1361
- { value: "body", label: s("layers.font-body") }
1362
- ]), ge = [100, 200, 300, 400, 500, 600, 700, 800, 900].map((p) => ({
1363
- value: p,
1364
- label: String(p)
1365
- })), me = y(() => [
1366
- { value: "start", label: s("layers.align-start") },
1367
- { value: "center", label: s("layers.align-center") },
1368
- { value: "end", label: s("layers.align-end") }
1369
- ]), ie = y(() => [
1370
- { value: "none", label: s("layers.motion-none") },
1371
- ...ht.map((p) => ({ value: p, label: s(`layers.in-${p}`) }))
1372
- ]), de = y(() => [
1373
- { value: "none", label: s("layers.motion-none") },
1374
- ...wt.map((p) => ({ value: p, label: s(`layers.loop-${p}`) }))
1375
- ]);
1376
- function xe(p) {
1377
- const a = o.layer.style[p];
1378
- return a === null ? null : a.startsWith("token:") ? o.palette.find((n) => `token:${n.key}` === a)?.value ?? null : a;
1379
- }
1380
- function ce(p, a) {
1381
- const n = typeof a == "string" && /^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(a) ? a.toLowerCase() : null;
1382
- v(p, n);
1383
- }
1384
- return (p, a) => (m(), B("div", Ka, [
1385
- P("div", Ja, [
1386
- i(e(Ke), {
1387
- modelValue: T.value,
1388
- "onUpdate:modelValue": a[0] || (a[0] = (n) => T.value = n),
1389
- size: "sm",
1390
- placeholder: e(s)("layers.name"),
1391
- "aria-label": e(s)("layers.name"),
1392
- disabled: t.disabled
1393
- }, null, 8, ["modelValue", "placeholder", "aria-label", "disabled"]),
1394
- i(e(Q), {
1395
- size: "sm",
1396
- variant: "outline",
1397
- danger: "",
1398
- disabled: t.disabled,
1399
- onClick: a[1] || (a[1] = (n) => f("delete"))
1400
- }, {
1401
- icon: d(() => [
1402
- i(e(le), { name: "trash" })
1403
- ]),
1404
- default: d(() => [
1405
- F(" " + N(e(s)("layers.delete")), 1)
1406
- ]),
1407
- _: 1
1408
- }, 8, ["disabled"])
1409
- ]),
1410
- w.value ? (m(), B(ne, { key: 0 }, [
1411
- i(e(G), {
1412
- label: t.layer.type === "button" ? e(s)("layers.label") : e(s)("layers.words"),
1413
- help: K.value ? e(s)("layers.falls-back", { code: K.value.toUpperCase() }) : e(s)("layers.words-help")
1414
- }, {
1415
- default: d(() => [
1416
- t.layer.type === "text" ? (m(), E(e(sa), {
1417
- key: 0,
1418
- modelValue: g.value,
1419
- "onUpdate:modelValue": a[2] || (a[2] = (n) => g.value = n),
1420
- localized: "",
1421
- rows: 2,
1422
- disabled: t.disabled
1423
- }, null, 8, ["modelValue", "disabled"])) : (m(), E(e(Ke), {
1424
- key: 1,
1425
- modelValue: g.value,
1426
- "onUpdate:modelValue": a[3] || (a[3] = (n) => g.value = n),
1427
- localized: "",
1428
- disabled: t.disabled
1429
- }, null, 8, ["modelValue", "disabled"]))
1430
- ]),
1431
- _: 1
1432
- }, 8, ["label", "help"]),
1433
- P("div", ja, [
1434
- i(e(Q), {
1435
- size: "sm",
1436
- variant: "text",
1437
- disabled: t.disabled,
1438
- onClick: a[4] || (a[4] = (n) => J("title"))
1439
- }, {
1440
- default: d(() => [...a[24] || (a[24] = [
1441
- F("+ {title}", -1)
1442
- ])]),
1443
- _: 1
1444
- }, 8, ["disabled"]),
1445
- i(e(Q), {
1446
- size: "sm",
1447
- variant: "text",
1448
- disabled: t.disabled,
1449
- onClick: a[5] || (a[5] = (n) => J("text"))
1450
- }, {
1451
- default: d(() => [...a[25] || (a[25] = [
1452
- F("+ {text}", -1)
1453
- ])]),
1454
- _: 1
1455
- }, 8, ["disabled"])
1456
- ]),
1457
- V.value.length > 0 ? (m(), E(e(re), {
1458
- key: 0,
1459
- size: "sm",
1460
- tone: "warning"
1461
- }, {
1462
- default: d(() => [
1463
- F(N(e(s)("layers.unknown-field", { fields: W.value })), 1)
1464
- ]),
1465
- _: 1
1466
- })) : H("", !0)
1467
- ], 64)) : H("", !0),
1468
- t.layer.type === "text" ? (m(), E(e(G), {
1469
- key: 1,
1470
- label: e(s)("layers.tag")
1471
- }, {
1472
- default: d(() => [
1473
- i(e(fe), {
1474
- modelValue: e(R),
1475
- "onUpdate:modelValue": a[6] || (a[6] = (n) => ye(R) ? R.value = n : null),
1476
- options: t.tags,
1477
- size: "sm",
1478
- disabled: t.disabled
1479
- }, null, 8, ["modelValue", "options", "disabled"])
1480
- ]),
1481
- _: 1
1482
- }, 8, ["label"])) : H("", !0),
1483
- t.layer.type === "image" ? (m(), E(e(G), {
1484
- key: 2,
1485
- label: e(s)("layers.image")
1486
- }, {
1487
- default: d(() => [
1488
- i(e(ba), {
1489
- modelValue: U.value,
1490
- "onUpdate:modelValue": a[7] || (a[7] = (n) => U.value = n),
1491
- accept: "image",
1492
- aspect: null,
1493
- height: 120,
1494
- disabled: t.disabled
1495
- }, null, 8, ["modelValue", "disabled"])
1496
- ]),
1497
- _: 1
1498
- }, 8, ["label"])) : H("", !0),
1499
- t.layer.type === "button" ? (m(), B(ne, { key: 3 }, [
1500
- i(e(G), {
1501
- label: e(s)("layers.link")
1502
- }, {
1503
- default: d(() => [
1504
- i(e(ca), {
1505
- modelValue: C.value,
1506
- "onUpdate:modelValue": a[8] || (a[8] = (n) => C.value = n),
1507
- "allow-none": !1,
1508
- disabled: t.disabled
1509
- }, null, 8, ["modelValue", "disabled"])
1510
- ]),
1511
- _: 1
1512
- }, 8, ["label"]),
1513
- i(e(G), {
1514
- label: e(s)("layers.variant")
1515
- }, {
1516
- default: d(() => [
1517
- i(e(fe), {
1518
- modelValue: e(X),
1519
- "onUpdate:modelValue": a[9] || (a[9] = (n) => ye(X) ? X.value = n : null),
1520
- options: t.variants,
1521
- size: "sm",
1522
- disabled: t.disabled
1523
- }, null, 8, ["modelValue", "options", "disabled"])
1524
- ]),
1525
- _: 1
1526
- }, 8, ["label"])
1527
- ], 64)) : H("", !0),
1528
- t.layer.type === "buttons" ? (m(), E(e(re), {
1529
- key: 4,
1530
- size: "sm",
1531
- tone: "muted"
1532
- }, {
1533
- default: d(() => [
1534
- F(N(e(s)("layers.buttons-help")), 1)
1535
- ]),
1536
- _: 1
1537
- })) : H("", !0),
1538
- P("section", Ha, [
1539
- P("div", Ga, [
1540
- i(e(re), {
1541
- size: "sm",
1542
- strong: ""
1543
- }, {
1544
- default: d(() => [
1545
- F(N(t.view === "mobile" ? h.value ? e(s)("layers.geometry-mobile-own") : e(s)("layers.geometry-mobile-same") : e(s)("layers.geometry-desktop")), 1)
1546
- ]),
1547
- _: 1
1548
- }),
1549
- h.value ? (m(), E(e(Q), {
1550
- key: 0,
1551
- size: "sm",
1552
- variant: "text",
1553
- disabled: t.disabled,
1554
- onClick: a[10] || (a[10] = (n) => f("same-as-desktop"))
1555
- }, {
1556
- default: d(() => [
1557
- F(N(e(s)("layers.same-as-desktop")), 1)
1558
- ]),
1559
- _: 1
1560
- }, 8, ["disabled"])) : H("", !0)
1561
- ]),
1562
- i(e(re), {
1563
- size: "sm",
1564
- tone: "muted"
1565
- }, {
1566
- default: d(() => [
1567
- F(N(e(s)("layers.unit")), 1)
1568
- ]),
1569
- _: 1
1570
- }),
1571
- P("div", Za, [
1572
- (m(!0), B(ne, null, ve(S.value, (n) => (m(), E(e(G), {
1573
- key: n,
1574
- label: e(s)(`layers.${n}`)
1575
- }, {
1576
- default: d(() => [
1577
- i(e(Le), {
1578
- "model-value": _.value[n],
1579
- min: e(Ne)[n][0],
1580
- max: e(Ne)[n][1],
1581
- step: M[n],
1582
- precision: 2,
1583
- size: "sm",
1584
- disabled: t.disabled,
1585
- "onUpdate:modelValue": (I) => D(n, I ?? null)
1586
- }, null, 8, ["model-value", "min", "max", "step", "disabled", "onUpdate:modelValue"])
1587
- ]),
1588
- _: 2
1589
- }, 1032, ["label"]))), 128))
1590
- ]),
1591
- i(e(G), {
1592
- label: e(s)("layers.origin"),
1593
- help: e(s)("layers.origin-help")
1594
- }, {
1595
- default: d(() => [
1596
- P("div", {
1597
- class: "wx-banner-layer-inspector__origins",
1598
- role: "radiogroup",
1599
- "aria-label": e(s)("layers.origin")
1600
- }, [
1601
- (m(!0), B(ne, null, ve(e(ya), (n) => (m(), B("button", {
1602
- key: n,
1603
- type: "button",
1604
- role: "radio",
1605
- "aria-checked": _.value.origin === n,
1606
- "aria-label": n,
1607
- disabled: t.disabled,
1608
- class: oe([
1609
- "wx-banner-layer-inspector__origin",
1610
- { "is-active": _.value.origin === n }
1611
- ]),
1612
- onClick: (I) => we(n)
1613
- }, null, 10, Ya))), 128))
1614
- ], 8, Xa)
1615
- ]),
1616
- _: 1
1617
- }, 8, ["label", "help"]),
1618
- i(e(Me), {
1619
- "model-value": _.value.hidden,
1620
- label: e(s)("layers.hidden-here"),
1621
- disabled: t.disabled,
1622
- "onUpdate:modelValue": a[11] || (a[11] = (n) => f("frame", { hidden: n === !0 }))
1623
- }, null, 8, ["model-value", "label", "disabled"])
1624
- ]),
1625
- t.layer.type !== "image" ? (m(), B("section", Qa, [
1626
- i(e(re), {
1627
- size: "sm",
1628
- strong: ""
1629
- }, {
1630
- default: d(() => [
1631
- F(N(e(s)("layers.look")), 1)
1632
- ]),
1633
- _: 1
1634
- }),
1635
- P("div", el, [
1636
- i(e(G), {
1637
- label: e(s)("layers.font")
1638
- }, {
1639
- default: d(() => [
1640
- i(e(fe), {
1641
- modelValue: e(ee),
1642
- "onUpdate:modelValue": a[12] || (a[12] = (n) => ye(ee) ? ee.value = n : null),
1643
- options: Ce.value,
1644
- size: "sm",
1645
- disabled: t.disabled
1646
- }, null, 8, ["modelValue", "options", "disabled"])
1647
- ]),
1648
- _: 1
1649
- }, 8, ["label"]),
1650
- i(e(G), {
1651
- label: e(s)("layers.weight")
1652
- }, {
1653
- default: d(() => [
1654
- i(e(fe), {
1655
- modelValue: e(se),
1656
- "onUpdate:modelValue": a[13] || (a[13] = (n) => ye(se) ? se.value = n : null),
1657
- options: e(ge),
1658
- size: "sm",
1659
- disabled: t.disabled
1660
- }, null, 8, ["modelValue", "options", "disabled"])
1661
- ]),
1662
- _: 1
1663
- }, 8, ["label"]),
1664
- i(e(G), {
1665
- label: e(s)("layers.line-height")
1666
- }, {
1667
- default: d(() => [
1668
- i(e(Le), {
1669
- "model-value": t.layer.style.line_height,
1670
- min: 0.8,
1671
- max: 3,
1672
- step: 0.05,
1673
- precision: 2,
1674
- size: "sm",
1675
- disabled: t.disabled,
1676
- "onUpdate:modelValue": a[14] || (a[14] = (n) => n != null && v("line_height", n))
1677
- }, null, 8, ["model-value", "disabled"])
1678
- ]),
1679
- _: 1
1680
- }, 8, ["label"]),
1681
- i(e(G), {
1682
- label: e(s)("layers.opacity")
1683
- }, {
1684
- default: d(() => [
1685
- i(e(Le), {
1686
- "model-value": t.layer.style.opacity,
1687
- min: 0,
1688
- max: 1,
1689
- step: 0.05,
1690
- precision: 2,
1691
- size: "sm",
1692
- disabled: t.disabled,
1693
- "onUpdate:modelValue": a[15] || (a[15] = (n) => n != null && v("opacity", n))
1694
- }, null, 8, ["model-value", "disabled"])
1695
- ]),
1696
- _: 1
1697
- }, 8, ["label"])
1698
- ]),
1699
- i(e(G), {
1700
- label: e(s)("layers.align")
1701
- }, {
1702
- default: d(() => [
1703
- i(e(it), {
1704
- modelValue: k.value,
1705
- "onUpdate:modelValue": a[16] || (a[16] = (n) => k.value = n),
1706
- options: me.value,
1707
- size: "sm",
1708
- disabled: t.disabled
1709
- }, null, 8, ["modelValue", "options", "disabled"])
1710
- ]),
1711
- _: 1
1712
- }, 8, ["label"]),
1713
- P("div", tl, [
1714
- i(e(Me), {
1715
- "model-value": t.layer.style.italic,
1716
- label: e(s)("layers.italic"),
1717
- disabled: t.disabled,
1718
- "onUpdate:modelValue": a[17] || (a[17] = (n) => v("italic", n === !0))
1719
- }, null, 8, ["model-value", "label", "disabled"]),
1720
- i(e(Me), {
1721
- "model-value": t.layer.style.uppercase,
1722
- label: e(s)("layers.uppercase"),
1723
- disabled: t.disabled,
1724
- "onUpdate:modelValue": a[18] || (a[18] = (n) => v("uppercase", n === !0))
1725
- }, null, 8, ["model-value", "label", "disabled"]),
1726
- i(e(Me), {
1727
- "model-value": t.layer.style.shadow,
1728
- label: e(s)("layers.shadow"),
1729
- disabled: t.disabled,
1730
- "onUpdate:modelValue": a[19] || (a[19] = (n) => v("shadow", n === !0))
1731
- }, null, 8, ["model-value", "label", "disabled"])
1732
- ]),
1733
- (m(), B(ne, null, ve(["color", "background"], (n) => i(e(G), {
1734
- key: n,
1735
- label: e(s)(`layers.${n}`)
1736
- }, {
1737
- default: d(() => [
1738
- P("div", al, [
1739
- (m(!0), B(ne, null, ve(t.palette, (I) => (m(), B("button", {
1740
- key: I.key,
1741
- type: "button",
1742
- title: I.key,
1743
- "aria-label": I.key,
1744
- disabled: t.disabled,
1745
- class: oe([
1746
- "wx-banner-layer-inspector__swatch",
1747
- { "is-active": t.layer.style[n] === `token:${I.key}` }
1748
- ]),
1749
- style: Oe({ background: I.value }),
1750
- onClick: (ue) => v(n, `token:${I.key}`)
1751
- }, null, 14, ll))), 128)),
1752
- i(e(oa), {
1753
- "model-value": xe(n),
1754
- clearable: "",
1755
- size: "sm",
1756
- disabled: t.disabled,
1757
- "onUpdate:modelValue": (I) => ce(n, I)
1758
- }, null, 8, ["model-value", "disabled", "onUpdate:modelValue"])
1759
- ])
1760
- ]),
1761
- _: 2
1762
- }, 1032, ["label"])), 64))
1763
- ])) : H("", !0),
1764
- P("section", nl, [
1765
- i(e(re), {
1766
- size: "sm",
1767
- strong: ""
1768
- }, {
1769
- default: d(() => [
1770
- F(N(e(s)("layers.motion")), 1)
1771
- ]),
1772
- _: 1
1773
- }),
1774
- P("div", sl, [
1775
- i(e(G), {
1776
- label: e(s)("layers.entrance")
1777
- }, {
1778
- default: d(() => [
1779
- i(e(fe), {
1780
- modelValue: e(q),
1781
- "onUpdate:modelValue": a[20] || (a[20] = (n) => ye(q) ? q.value = n : null),
1782
- options: ie.value,
1783
- size: "sm",
1784
- disabled: t.disabled
1785
- }, null, 8, ["modelValue", "options", "disabled"])
1786
- ]),
1787
- _: 1
1788
- }, 8, ["label"]),
1789
- i(e(G), {
1790
- label: e(s)("layers.loop")
1791
- }, {
1792
- default: d(() => [
1793
- i(e(fe), {
1794
- modelValue: e(z),
1795
- "onUpdate:modelValue": a[21] || (a[21] = (n) => ye(z) ? z.value = n : null),
1796
- options: de.value,
1797
- size: "sm",
1798
- disabled: t.disabled
1799
- }, null, 8, ["modelValue", "options", "disabled"])
1800
- ]),
1801
- _: 1
1802
- }, 8, ["label"]),
1803
- i(e(G), {
1804
- label: e(s)("layers.delay")
1805
- }, {
1806
- default: d(() => [
1807
- i(e(Le), {
1808
- "model-value": t.layer.motion.delay,
1809
- min: 0,
1810
- max: 1e4,
1811
- step: 50,
1812
- size: "sm",
1813
- disabled: t.disabled || t.layer.motion.in === null,
1814
- "onUpdate:modelValue": a[22] || (a[22] = (n) => n != null && b((I) => I.motion.delay = n))
1815
- }, null, 8, ["model-value", "disabled"])
1816
- ]),
1817
- _: 1
1818
- }, 8, ["label"]),
1819
- i(e(G), {
1820
- label: e(s)("layers.duration")
1821
- }, {
1822
- default: d(() => [
1823
- i(e(Le), {
1824
- "model-value": t.layer.motion.duration,
1825
- min: 100,
1826
- max: 5e3,
1827
- step: 50,
1828
- size: "sm",
1829
- disabled: t.disabled || t.layer.motion.in === null,
1830
- "onUpdate:modelValue": a[23] || (a[23] = (n) => n != null && b((I) => I.motion.duration = n))
1831
- }, null, 8, ["model-value", "disabled"])
1832
- ]),
1833
- _: 1
1834
- }, 8, ["label"])
1835
- ])
1836
- ])
1837
- ]));
1838
- }
1839
- }), il = /* @__PURE__ */ Ie(ol, [["__scopeId", "data-v-32ff51cd"]]), rl = { class: "wx-banner-layers__bar" }, ul = { class: "wx-banner-layers__tools" }, dl = { class: "wx-banner-layers__body" }, cl = { class: "wx-banner-layers__main" }, bl = ["aria-label"], vl = { class: "webx-banner__picture" }, ml = ["src"], pl = {
1840
- key: 1,
1841
- class: "wx-banner-layers__empty"
1842
- }, yl = {
1843
- key: 0,
1844
- class: "webx-banner__inner wx-banner-layers__words"
1845
- }, fl = ["src"], hl = {
1846
- key: 2,
1847
- class: "webx-banner__inner webx-banner__buttons"
1848
- }, wl = {
1849
- key: 3,
1850
- class: "webx-banner__inner webx-banner__buttons"
1851
- }, gl = {
1852
- key: 0,
1853
- class: "webx-banner__button"
1854
- }, xl = ["onPointerdown"], kl = ["onPointerdown"], _l = ["onClick"], $l = { class: "wx-banner-layers__name" }, Vl = 3, zl = 6, Sl = /* @__PURE__ */ Ve({
1855
- name: "WxBannerLayers",
1856
- __name: "LayersField",
1857
- props: {
1858
- modelValue: {},
1859
- disabled: { type: Boolean }
1860
- },
1861
- emits: ["update:modelValue"],
1862
- setup(t, { emit: c }) {
1863
- const o = t, f = c, s = ze(), $ = pa(), _ = Je(), h = va(s), b = Ue(s);
1864
- Te();
1865
- const v = Se("webx-banners"), w = y(() => o.modelValue ?? []), g = y(() => $?.place.value?.layers ?? null), T = A("desktop"), V = A(null), W = y(() => w.value.find((l) => l.id === V.value) ?? null), K = y(() => {
1866
- const l = _.active.value;
1867
- return _.list.value.some((r) => r.code === l) ? l : _.list.value[0]?.code ?? "en";
1868
- }), J = y(() => _.list.value.map((l) => l.code)), U = A([]), C = A([]);
1869
- function L() {
1870
- U.value = [...U.value.slice(-99), JSON.stringify(w.value)], C.value = [];
1871
- }
1872
- function R(l, r = !0) {
1873
- r && L(), f("update:modelValue", l);
1874
- }
1875
- function X() {
1876
- const l = U.value.at(-1);
1877
- l !== void 0 && (C.value = [...C.value, JSON.stringify(w.value)], U.value = U.value.slice(0, -1), f("update:modelValue", JSON.parse(l)));
1878
- }
1879
- function ee() {
1880
- const l = C.value.at(-1);
1881
- l !== void 0 && (U.value = [...U.value, JSON.stringify(w.value)], C.value = C.value.slice(0, -1), f("update:modelValue", JSON.parse(l)));
1882
- }
1883
- function se(l, r, u = !0) {
1884
- R(
1885
- w.value.map((x) => x.id === l ? r(lt(x)) : x),
1886
- u
1887
- );
1888
- }
1889
- function k(l, r = T.value) {
1890
- return r === "mobile" ? l.frames.mobile ?? l.frames.desktop : l.frames.desktop;
1891
- }
1892
- function q(l, r, u = !0) {
1893
- se(
1894
- l,
1895
- (x) => {
1896
- const O = Va({ ...k(x), ...r });
1897
- return T.value === "mobile" ? x.frames.mobile = O : x.frames.desktop = O, x;
1898
- },
1899
- u
1900
- );
1901
- }
1902
- let z = { id: "", at: 0 };
1903
- function S(l) {
1904
- const r = Date.now(), u = z.id === l.id && r - z.at < 800;
1905
- z = { id: l.id, at: r }, se(l.id, () => l, !u);
1906
- }
1907
- function M(l) {
1908
- const r = gt(
1909
- l,
1910
- w.value.map((u) => u.id),
1911
- K.value
1912
- );
1913
- R([r, ...w.value]), V.value = r.id;
1914
- }
1915
- function D(l) {
1916
- R(w.value.filter((r) => r.id !== l)), V.value === l && (V.value = null);
1917
- }
1918
- function we(l) {
1919
- const r = w.value.findIndex((te) => te.id === l), u = w.value[r];
1920
- if (!u || u.type === "buttons") return;
1921
- const x = lt(u);
1922
- x.id = gt(
1923
- "text",
1924
- w.value.map((te) => te.id),
1925
- K.value
1926
- ).id, x.frames.desktop = {
1927
- ...x.frames.desktop,
1928
- x: x.frames.desktop.x + 2,
1929
- y: x.frames.desktop.y + 2
1930
- };
1931
- const O = [...w.value];
1932
- O.splice(r, 0, x), R(O), V.value = x.id;
1933
- }
1934
- function Ce(l) {
1935
- q(l.id, { hidden: !k(l).hidden });
1936
- }
1937
- const ge = y(() => w.value.some((l) => l.type === "buttons")), me = y({
1938
- get: () => w.value,
1939
- set: (l) => R(l)
1940
- }), ie = Ht({});
1941
- function de(l) {
1942
- const r = l?.path;
1943
- return typeof r == "string" && r !== "" ? r : null;
1944
- }
1945
- async function xe(l) {
1946
- if (!(l === null || l in ie)) {
1947
- ie[l] = null;
1948
- try {
1949
- const r = await h.fileByPath(l);
1950
- ie[l] = r ? { url: r.url, ratio: r.width && r.height ? r.width / r.height : null } : null;
1951
- } catch {
1952
- ie[l] = null;
1953
- }
1954
- }
1955
- }
1956
- const ce = y(() => de($?.values.value.image)), p = y(() => de($?.values.value.image_mobile));
1957
- $e(
1958
- () => [ce.value, p.value, ...w.value.map((l) => de(l.image))],
1959
- (l) => l.forEach((r) => {
1960
- xe(r);
1961
- }),
1962
- { immediate: !0 }
1963
- );
1964
- const a = y(
1965
- () => T.value === "mobile" ? kt(g.value?.ratio_mobile, 0.8) : kt(g.value?.ratio, 16 / 6)
1966
- ), n = y(() => {
1967
- const l = p.value === null ? null : ie[p.value] ?? null, r = ce.value === null ? null : ie[ce.value] ?? null;
1968
- return T.value === "mobile" ? l ?? r : r;
1969
- }), I = y(() => n.value?.ratio ?? a.value), ue = y(() => $a(I.value, a.value)), De = y(() => {
1970
- const l = String(I.value);
1971
- return { "--ratio": l, "--ratio-mobile": l, "--img": l, "--img-m": l };
1972
- }), je = y(() => {
1973
- const l = (r) => ($?.values.value[r]?.[K.value] ?? "").trim();
1974
- return { title: l("title"), text: l("text") };
1975
- });
1976
- function ut(l) {
1977
- return ga(l.text, K.value, J.value, je.value);
1978
- }
1979
- const dt = y(
1980
- () => ($?.values.value.buttons ?? []).map((l) => ({
1981
- label: (l.label?.[K.value] ?? "").trim(),
1982
- variant: l.variant ?? g.value?.variants[0]?.value ?? "primary"
1983
- })).filter((l) => l.label !== "")
1984
- );
1985
- function Nt(l) {
1986
- return l.type === "text" && /^(p|span|h[1-6])$/.test(l.tag ?? "") ? l.tag : "div";
1987
- }
1988
- function Ut(l) {
1989
- if (l.name) return l.name;
1990
- const r = l.text?.[K.value] ?? Object.values(l.text ?? {})[0] ?? "";
1991
- return r.trim() === "{title}" ? v("layers.title-layer") : r.trim() === "{text}" ? v("layers.text-layer") : l.type === "buttons" ? v("layers.buttons-layer") : l.type === "image" ? v("layers.image") : r.trim() || v(`layers.${l.type}`);
1992
- }
1993
- const Tt = {
1994
- text: "file-text",
1995
- image: "image",
1996
- button: "link",
1997
- buttons: "grid"
1998
- };
1999
- function ct(l) {
2000
- const r = k(l), u = 100 / I.value, x = ue.value, O = x.left, te = x.left + x.width, Y = x.top / 100 * u, ae = (x.top + x.height) / 100 * u, j = r.x + Ze(r.origin)[0] / 100 * r.w;
2001
- return j > te || j + r.w < O || r.y > ae || r.y < Y - 50;
2002
- }
2003
- const He = A(null), bt = A(null), Be = A([]);
2004
- function It(l, r) {
2005
- const u = 100 / I.value, x = ue.value, O = l === "x" ? [0, 50, 100, x.left, x.left + x.width] : [0, u / 2, u, x.top / 100 * u, (x.top + x.height) / 100 * u];
2006
- for (const te of w.value) {
2007
- if (te.id === r) continue;
2008
- const Y = k(te);
2009
- l === "x" ? O.push(Y.x, Y.x + Y.w) : O.push(Y.y);
2010
- }
2011
- return O;
2012
- }
2013
- function vt(l, r, u, x, O, te) {
2014
- if (te) return r;
2015
- const Y = [0, u / 2, u];
2016
- let ae = null;
2017
- for (const j of It(l, O))
2018
- for (const be of Y) {
2019
- const ke = j - (r + be);
2020
- Math.abs(ke) * x <= zl && (ae === null || Math.abs(ke) < Math.abs(ae.delta)) && (ae = { delta: ke, at: j });
2021
- }
2022
- return ae === null ? r : (Be.value = [...Be.value.filter((j) => j.axis !== l), { axis: l, at: ae.at }], r + ae.delta);
2023
- }
2024
- function mt(l) {
2025
- V.value = l.id, bt.value?.focus({ preventScroll: !0 });
2026
- }
2027
- function Ge(l, r, u) {
2028
- if (mt(r), o.disabled || l.button !== 0 || !He.value) return;
2029
- l.preventDefault();
2030
- const O = He.value.getBoundingClientRect().width / 100, Y = l.target.closest(".webx-banner__layer")?.getBoundingClientRect(), ae = Y ? Y.height / O : 0, j = { ...k(r) }, be = { x: l.clientX, y: l.clientY };
2031
- let ke = !1;
2032
- const yt = (_e) => {
2033
- const Xe = (_e.clientX - be.x) / O, At = (_e.clientY - be.y) / O;
2034
- if (!ke) {
2035
- if (Math.hypot(_e.clientX - be.x, _e.clientY - be.y) < Vl) return;
2036
- ke = !0, L();
2037
- }
2038
- if (Be.value = [], u === "move") {
2039
- const pe = {
2040
- x: Ze(j.origin)[0] / 100 * j.w,
2041
- y: Ze(j.origin)[1] / 100 * ae
2042
- }, Rt = vt("x", j.x + Xe + pe.x, j.w, O, r.id, _e.altKey), Ft = vt("y", j.y + At + pe.y, ae, O, r.id, _e.altKey);
2043
- q(r.id, { x: Rt - pe.x, y: Ft - pe.y }, !1);
2044
- } else if (u === "width")
2045
- q(r.id, { w: Math.max(1, j.w + Xe) }, !1);
2046
- else {
2047
- const pe = Math.max(0.05, (j.w + Xe) / j.w);
2048
- q(r.id, { w: j.w * pe, size: j.size * pe }, !1);
2049
- }
2050
- }, Ee = () => {
2051
- window.removeEventListener("pointermove", yt), window.removeEventListener("pointerup", Ee), window.removeEventListener("pointercancel", Ee), Be.value = [];
2052
- };
2053
- window.addEventListener("pointermove", yt), window.addEventListener("pointerup", Ee), window.addEventListener("pointercancel", Ee);
2054
- }
2055
- function Ze(l) {
2056
- const r = l.endsWith("r") ? -100 : l === "t" || l === "c" || l === "b" ? -50 : 0, u = l.startsWith("b") ? -100 : l === "l" || l === "c" || l === "r" ? -50 : 0;
2057
- return [r, u];
2058
- }
2059
- function Dt(l) {
2060
- l.target.closest(".webx-banner__layer") || (V.value = null);
2061
- }
2062
- function Et(l) {
2063
- const r = l.ctrlKey || l.metaKey, u = l.key.toLowerCase();
2064
- if (r && u === "z") {
2065
- l.preventDefault(), l.shiftKey ? ee() : X();
2066
- return;
2067
- }
2068
- if (r && u === "y") {
2069
- l.preventDefault(), ee();
2070
- return;
2071
- }
2072
- const x = W.value;
2073
- if (!x || o.disabled) return;
2074
- if (r && u === "d") {
2075
- l.preventDefault(), we(x.id);
2076
- return;
2077
- }
2078
- if (u === "delete" || u === "backspace") {
2079
- l.preventDefault(), D(x.id);
2080
- return;
2081
- }
2082
- if (u === "escape") {
2083
- V.value = null;
2084
- return;
2085
- }
2086
- const O = l.shiftKey ? 0.5 : 0.05, Y = {
2087
- arrowleft: [-O, 0],
2088
- arrowright: [O, 0],
2089
- arrowup: [0, -O],
2090
- arrowdown: [0, O]
2091
- }[u];
2092
- if (!Y) return;
2093
- l.preventDefault();
2094
- const ae = k(x), j = Date.now(), be = z.id === `arrows:${x.id}` && j - z.at < 800;
2095
- z = { id: `arrows:${x.id}`, at: j }, q(x.id, { x: ae.x + Y[0], y: ae.y + Y[1] }, !be);
2096
- }
2097
- const Pe = A(null);
2098
- let We = null;
2099
- nt(async () => {
2100
- try {
2101
- Pe.value = await b.theme();
2102
- } catch {
2103
- Pe.value = null;
2104
- }
2105
- const l = `${Pe.value?.tokens_css ?? ""}
2106
- ${Pe.value?.fonts_css ?? ""}`.trim();
2107
- l !== "" && !document.getElementById("wx-banners-theme") && (We = document.createElement("style"), We.id = "wx-banners-theme", We.textContent = l, document.head.append(We));
2108
- }), Vt(() => {
2109
- We?.remove();
2110
- });
2111
- const Mt = y(() => [
2112
- { value: "desktop", label: v("layers.desktop"), icon: "monitor" },
2113
- { value: "mobile", label: v("layers.mobile"), icon: "smartphone" }
2114
- ]), pt = y({
2115
- get: () => T.value,
2116
- set: (l) => {
2117
- T.value = l === "mobile" ? "mobile" : "desktop";
2118
- }
2119
- });
2120
- return (l, r) => (m(), B("div", {
2121
- class: oe(["wx-banner-layers", { "is-disabled": t.disabled }])
2122
- }, [
2123
- P("div", rl, [
2124
- i(e(it), {
2125
- modelValue: pt.value,
2126
- "onUpdate:modelValue": r[0] || (r[0] = (u) => pt.value = u),
2127
- options: Mt.value,
2128
- size: "sm",
2129
- "aria-label": e(v)("layers.layout")
2130
- }, null, 8, ["modelValue", "options", "aria-label"]),
2131
- P("div", ul, [
2132
- i(e(tt), {
2133
- content: e(v)("layers.undo")
2134
- }, {
2135
- default: d(() => [
2136
- i(e(Q), {
2137
- size: "sm",
2138
- variant: "text",
2139
- disabled: t.disabled || U.value.length === 0,
2140
- "aria-label": e(v)("layers.undo"),
2141
- onClick: X
2142
- }, {
2143
- icon: d(() => [
2144
- i(e(le), { name: "rotate-left" })
2145
- ]),
2146
- _: 1
2147
- }, 8, ["disabled", "aria-label"])
2148
- ]),
2149
- _: 1
2150
- }, 8, ["content"]),
2151
- i(e(tt), {
2152
- content: e(v)("layers.redo")
2153
- }, {
2154
- default: d(() => [
2155
- i(e(Q), {
2156
- size: "sm",
2157
- variant: "text",
2158
- disabled: t.disabled || C.value.length === 0,
2159
- "aria-label": e(v)("layers.redo"),
2160
- onClick: ee
2161
- }, {
2162
- icon: d(() => [
2163
- i(e(le), { name: "rotate-right" })
2164
- ]),
2165
- _: 1
2166
- }, 8, ["disabled", "aria-label"])
2167
- ]),
2168
- _: 1
2169
- }, 8, ["content"]),
2170
- i(e(Q), {
2171
- size: "sm",
2172
- variant: "outline",
2173
- disabled: t.disabled,
2174
- onClick: r[1] || (r[1] = (u) => M("text"))
2175
- }, {
2176
- icon: d(() => [
2177
- i(e(le), { name: "plus" })
2178
- ]),
2179
- default: d(() => [
2180
- F(" " + N(e(v)("layers.text")), 1)
2181
- ]),
2182
- _: 1
2183
- }, 8, ["disabled"]),
2184
- i(e(Q), {
2185
- size: "sm",
2186
- variant: "outline",
2187
- disabled: t.disabled,
2188
- onClick: r[2] || (r[2] = (u) => M("image"))
2189
- }, {
2190
- icon: d(() => [
2191
- i(e(le), { name: "plus" })
2192
- ]),
2193
- default: d(() => [
2194
- F(" " + N(e(v)("layers.image")), 1)
2195
- ]),
2196
- _: 1
2197
- }, 8, ["disabled"]),
2198
- i(e(Q), {
2199
- size: "sm",
2200
- variant: "outline",
2201
- disabled: t.disabled,
2202
- onClick: r[3] || (r[3] = (u) => M("button"))
2203
- }, {
2204
- icon: d(() => [
2205
- i(e(le), { name: "plus" })
2206
- ]),
2207
- default: d(() => [
2208
- F(" " + N(e(v)("layers.button")), 1)
2209
- ]),
2210
- _: 1
2211
- }, 8, ["disabled"]),
2212
- ge.value ? H("", !0) : (m(), E(e(Q), {
2213
- key: 0,
2214
- size: "sm",
2215
- variant: "outline",
2216
- disabled: t.disabled,
2217
- onClick: r[4] || (r[4] = (u) => M("buttons"))
2218
- }, {
2219
- icon: d(() => [
2220
- i(e(le), { name: "plus" })
2221
- ]),
2222
- default: d(() => [
2223
- F(" " + N(e(v)("layers.buttons-layer")), 1)
2224
- ]),
2225
- _: 1
2226
- }, 8, ["disabled"]))
2227
- ])
2228
- ]),
2229
- g.value ? H("", !0) : (m(), E(e(re), {
2230
- key: 0,
2231
- size: "sm",
2232
- tone: "muted"
2233
- }, {
2234
- default: d(() => [
2235
- F(N(e(v)("layers.not-here")), 1)
2236
- ]),
2237
- _: 1
2238
- })),
2239
- P("div", dl, [
2240
- P("div", cl, [
2241
- P("div", {
2242
- ref_key: "canvas",
2243
- ref: bt,
2244
- class: oe(["wx-banner-layers__canvas", { "is-overflow": g.value?.overflow }]),
2245
- tabindex: "0",
2246
- "aria-label": e(v)("layers.canvas"),
2247
- onPointerdown: Dt,
2248
- onKeydown: Et
2249
- }, [
2250
- P("div", {
2251
- class: oe(["webx-banner wx-banner-layers__frame", { "is-mobile": T.value === "mobile" }]),
2252
- style: Oe(De.value)
2253
- }, [
2254
- P("div", vl, [
2255
- n.value ? (m(), B("img", {
2256
- key: 0,
2257
- class: "webx-banner__image",
2258
- src: n.value.url,
2259
- alt: ""
2260
- }, null, 8, ml)) : (m(), B("div", pl, N(e(v)("layers.no-picture")), 1))
2261
- ]),
2262
- P("div", {
2263
- ref_key: "stage",
2264
- ref: He,
2265
- class: "webx-banner__stage"
2266
- }, [
2267
- (m(!0), B(ne, null, ve(w.value, (u, x) => (m(), E(St(Nt(u)), {
2268
- key: u.id,
2269
- class: oe([
2270
- ...e(_a)(u),
2271
- { "is-selected": u.id === V.value, "is-outside": ct(u) }
2272
- ]),
2273
- style: Oe(e(ka)(u, w.value.length - x)),
2274
- onPointerdown: Ye((O) => Ge(O, u, "move"), ["stop"])
2275
- }, {
2276
- default: d(() => [
2277
- u.type === "text" ? (m(), B("span", yl, N(ut(u) || "…"), 1)) : u.type === "image" ? (m(), B("img", {
2278
- key: 1,
2279
- class: "webx-banner__inner",
2280
- src: ie[de(u.image) ?? ""]?.url ?? "",
2281
- alt: "",
2282
- draggable: "false"
2283
- }, null, 8, fl)) : u.type === "button" ? (m(), B("span", hl, [
2284
- P("span", {
2285
- class: oe([
2286
- "webx-banner__button",
2287
- `webx-banner__button--${u.variant ?? g.value?.variants[0]?.value ?? "primary"}`
2288
- ])
2289
- }, N(ut(u) || "…"), 3)
2290
- ])) : (m(), B("span", wl, [
2291
- (m(!0), B(ne, null, ve(dt.value, (O, te) => (m(), B("span", {
2292
- key: te,
2293
- class: oe(["webx-banner__button", `webx-banner__button--${O.variant}`])
2294
- }, N(O.label), 3))), 128)),
2295
- dt.value.length === 0 ? (m(), B("span", gl, N(e(v)("layers.buttons-layer")), 1)) : H("", !0)
2296
- ])),
2297
- u.id === V.value && !t.disabled ? (m(), B(ne, { key: 4 }, [
2298
- P("span", {
2299
- class: "wx-banner-layers__handle wx-banner-layers__handle--width",
2300
- onPointerdown: Ye((O) => Ge(O, u, "width"), ["stop"])
2301
- }, null, 40, xl),
2302
- P("span", {
2303
- class: "wx-banner-layers__handle wx-banner-layers__handle--scale",
2304
- onPointerdown: Ye((O) => Ge(O, u, "scale"), ["stop"])
2305
- }, null, 40, kl)
2306
- ], 64)) : H("", !0)
2307
- ]),
2308
- _: 2
2309
- }, 1064, ["class", "style", "onPointerdown"]))), 128))
2310
- ], 512),
2311
- P("div", {
2312
- class: "wx-banner-layers__crop",
2313
- style: Oe({
2314
- left: `${ue.value.left}%`,
2315
- top: `${ue.value.top}%`,
2316
- width: `${ue.value.width}%`,
2317
- height: `${ue.value.height}%`
2318
- })
2319
- }, null, 4),
2320
- (m(!0), B(ne, null, ve(Be.value, (u) => (m(), B("div", {
2321
- key: u.axis,
2322
- class: oe(["wx-banner-layers__guide", `wx-banner-layers__guide--${u.axis}`]),
2323
- style: Oe(
2324
- u.axis === "x" ? { left: `${u.at}%` } : { top: `calc(${u.at} * 1cqw)` }
2325
- )
2326
- }, null, 6))), 128))
2327
- ], 6)
2328
- ], 42, bl),
2329
- i(e(re), {
2330
- size: "sm",
2331
- tone: "muted"
2332
- }, {
2333
- default: d(() => [
2334
- F(N(e(v)("layers.hint")), 1)
2335
- ]),
2336
- _: 1
2337
- }),
2338
- i(e(Ct), {
2339
- modelValue: me.value,
2340
- "onUpdate:modelValue": r[5] || (r[5] = (u) => me.value = u),
2341
- class: "wx-banner-layers__list",
2342
- "item-key": "id",
2343
- size: "sm",
2344
- disabled: t.disabled,
2345
- "empty-text": e(v)("layers.empty"),
2346
- "aria-label": e(v)("layers.list")
2347
- }, {
2348
- default: d(({ item: u }) => [
2349
- P("button", {
2350
- type: "button",
2351
- class: oe(["wx-banner-layers__row", { "is-selected": u.id === V.value }]),
2352
- onClick: (x) => mt(u)
2353
- }, [
2354
- i(e(le), {
2355
- name: Tt[u.type]
2356
- }, null, 8, ["name"]),
2357
- P("span", $l, N(Ut(u)), 1),
2358
- ct(u) ? (m(), E(e(le), {
2359
- key: 0,
2360
- name: "warning",
2361
- class: "wx-banner-layers__warn",
2362
- "aria-label": e(v)("layers.outside")
2363
- }, null, 8, ["aria-label"])) : H("", !0)
2364
- ], 10, _l)
2365
- ]),
2366
- actions: d(({ item: u }) => [
2367
- i(e(Q), {
2368
- size: "sm",
2369
- variant: "text",
2370
- disabled: t.disabled,
2371
- "aria-label": k(u).hidden ? e(v)("layers.show") : e(v)("layers.hide"),
2372
- onClick: (x) => Ce(u)
2373
- }, {
2374
- icon: d(() => [
2375
- i(e(le), {
2376
- name: k(u).hidden ? "eye-off" : "eye"
2377
- }, null, 8, ["name"])
2378
- ]),
2379
- _: 2
2380
- }, 1032, ["disabled", "aria-label", "onClick"]),
2381
- i(e(Q), {
2382
- size: "sm",
2383
- variant: "text",
2384
- disabled: t.disabled,
2385
- "aria-label": e(v)("layers.delete"),
2386
- onClick: (x) => D(u.id)
2387
- }, {
2388
- icon: d(() => [
2389
- i(e(le), { name: "trash" })
2390
- ]),
2391
- _: 1
2392
- }, 8, ["disabled", "aria-label", "onClick"])
2393
- ]),
2394
- _: 1
2395
- }, 8, ["modelValue", "disabled", "empty-text", "aria-label"])
2396
- ]),
2397
- W.value ? (m(), E(il, {
2398
- key: 0,
2399
- class: "wx-banner-layers__inspector",
2400
- layer: W.value,
2401
- view: T.value,
2402
- tags: g.value?.tags ?? [],
2403
- variants: g.value?.variants ?? [],
2404
- palette: Pe.value?.palette ?? [],
2405
- disabled: t.disabled,
2406
- onUpdate: S,
2407
- onFrame: r[6] || (r[6] = (u) => q(W.value.id, u)),
2408
- onSameAsDesktop: r[7] || (r[7] = (u) => se(W.value.id, (x) => ({
2409
- ...x,
2410
- frames: { ...x.frames, mobile: null }
2411
- }))),
2412
- onDelete: r[8] || (r[8] = (u) => D(W.value.id))
2413
- }, null, 8, ["layer", "view", "tags", "variants", "palette", "disabled"])) : (m(), E(e(re), {
2414
- key: 1,
2415
- class: "wx-banner-layers__inspector",
2416
- size: "sm",
2417
- tone: "muted"
2418
- }, {
2419
- default: d(() => [
2420
- F(N(e(v)("layers.choose")), 1)
2421
- ]),
2422
- _: 1
2423
- }))
2424
- ])
2425
- ], 2));
2426
- }
2427
- }), Cl = /* @__PURE__ */ Ie(Sl, [["__scopeId", "data-v-540c304c"]]);
2428
- function Nl(t = {}) {
2429
- const c = t.path ?? "/banners";
2430
- return {
2431
- id: "banners",
2432
- path: c,
2433
- routes: [
2434
- // The open place is in the address (`?place=`), so a link to it is a link to its banners.
2435
- { path: c, name: "webx.banners", component: qa, props: { base: c } },
2436
- // A banner not written yet: the place it goes to rides in the query (`?place=hero`).
2437
- {
2438
- path: `${c}/new`,
2439
- name: "webx.banners.new",
2440
- component: $t,
2441
- props: { base: c }
2442
- },
2443
- {
2444
- path: `${c}/:id(\\d+)`,
2445
- name: "webx.banners.edit",
2446
- component: $t,
2447
- props: { base: c }
2448
- }
2449
- ],
2450
- /*
2451
- * The one node of `banners.form` only this module can draw: the layers, on the banner's
2452
- * picture. A field like any other — its value is the list of layers.
2453
- */
2454
- types: {
2455
- "wx-banner-layers": { component: Cl, kind: "field", wide: !0 }
2456
- }
2457
- };
2458
- }
1
+ import "vue";
2
+ import { E as r, F as n, a as o, L as l, O as t, W as y, b as i, e as m, f as L, g as c, h as d, i as E, c as I, j as f, k as p, d as x, l as B, m as F, n as O, o as S, q as W, r as g, s as b, t as w, v as A, w as C } from "./index-3RALKrkh.js";
2459
3
  export {
2460
- ht as ENTRANCES,
2461
- ha as FIELDS,
2462
- Ne as FRAME_LIMITS,
2463
- wt as LOOPS,
2464
- ya as ORIGINS,
2465
- $t as WxBannerEditorPage,
2466
- Cl as WxBannerLayers,
2467
- qa as WxBannersPage,
2468
- Nl as banners,
2469
- za as bannersMessages,
2470
- Va as clampFrame,
2471
- lt as clone,
2472
- Ue as createBannersApi,
2473
- $a as cropBox,
2474
- xt as cssColor,
2475
- wa as defaultLayers,
2476
- he as frame,
2477
- _a as layerClasses,
2478
- Lt as layerId,
2479
- ka as layerVars,
2480
- ga as layerWords,
2481
- Re as motion,
2482
- gt as newLayer,
2483
- kt as ratioOf,
2484
- Ae as style,
2485
- xa as unknownFields
4
+ r as ENTRANCES,
5
+ n as FIELDS,
6
+ o as FRAME_LIMITS,
7
+ l as LOOPS,
8
+ t as ORIGINS,
9
+ y as WxBannerEditorPage,
10
+ i as WxBannerLayers,
11
+ m as WxBannersPage,
12
+ L as banners,
13
+ c as bannersMessages,
14
+ d as clampFrame,
15
+ E as clone,
16
+ I as createBannersApi,
17
+ f as cropBox,
18
+ p as cssColor,
19
+ x as defaultLayers,
20
+ B as frame,
21
+ F as layerClasses,
22
+ O as layerId,
23
+ S as layerVars,
24
+ W as layerWords,
25
+ g as motion,
26
+ b as newLayer,
27
+ w as ratioOf,
28
+ A as style,
29
+ C as unknownFields
2486
30
  };
2487
31
  //# sourceMappingURL=index.js.map