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