@webx-ui/module-blocks 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +880 -893
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as ae, computed as T, openBlock as i, createElementBlock as S, createVNode as u, unref as e, createElementVNode as
|
|
1
|
+
import { defineComponent as ae, computed as T, openBlock as i, createElementBlock as S, createVNode as u, unref as e, createElementVNode as E, createTextVNode as W, toDisplayString as _, Fragment as j, createCommentVNode as N, renderList as ee, ref as U, onMounted as Ue, watch as X, createBlock as I, withCtx as d, onBeforeUnmount as Ge, normalizeStyle as xe, reactive as Qe, normalizeClass as $e, withDirectives as Jt, vShow as Kt, resolveComponent as xt, isRef as $t, nextTick as Gt, withKeys as ut, withModifiers as ct, provide as St, inject as qe, useModel as Yt, getCurrentInstance as Zt, resolveDynamicComponent as Qt, mergeProps as Xt, mergeModels as el } from "vue";
|
|
2
2
|
import { useRoute as tl, useRouter as Tt } from "vue-router";
|
|
3
3
|
import { useTranslate as de, useAdmin as Me, useErrorText as De, WxDate as ll, WxScreenHead as nl, WxRenameButton as al, WxHelpButton as ol, WxRowMenu as sl, adminKey as il, WxListScreen as rl } from "@webx-ui/module-admin";
|
|
4
|
-
import { WxIcon as
|
|
5
|
-
import { WxScreenRenderer as zt, coreTypes as
|
|
4
|
+
import { WxIcon as be, WxSkeleton as We, WxText as F, WxBadge as ue, WxButton as ce, confirm as Ke, toast as G, useElementWidth as Ye, WxSegmented as Ct, WxCard as Be, WxPopover as ul, WxAlert as Vt, WxTabs as cl, WxTab as Le, WxCodeEditor as je, WxFormItem as ne, WxInput as Pe, WxSelect as Et, WxTextarea as dl, WxIconPicker as pl, WxInputNumber as dt, WxTagsInput as pt, WxSwitch as vl, WxActionBar as fl, useModal as Bt, WxDialog as Lt, WxEmpty as Wt, WxAction as Ie, WxSortableList as ml, createModal as At, WxDrawer as hl, WxSpace as bl, WxSkeletonItem as Fe } from "@webx-ui/core";
|
|
5
|
+
import { WxScreenRenderer as zt, coreTypes as Xe } from "@webx-ui/schema";
|
|
6
6
|
function Ae(t) {
|
|
7
7
|
const l = `${t.apiPath}/blocks`, o = (a) => a.data;
|
|
8
8
|
return {
|
|
@@ -38,35 +38,35 @@ const gl = { class: "wx-block-checks" }, kl = {
|
|
|
38
38
|
});
|
|
39
39
|
return (r, n) => (i(), S("div", gl, [
|
|
40
40
|
t.error ? (i(), S("div", kl, [
|
|
41
|
-
u(e(
|
|
42
|
-
|
|
41
|
+
u(e(be), { name: "close-circle" }),
|
|
42
|
+
E("span", null, [
|
|
43
43
|
W(_(t.error.message) + " ", 1),
|
|
44
|
-
t.error.line !== null ? (i(), S(
|
|
44
|
+
t.error.line !== null ? (i(), S(j, { key: 0 }, [
|
|
45
45
|
W(" · " + _(e(o)("page.line", { line: t.error.line })), 1)
|
|
46
|
-
], 64)) :
|
|
47
|
-
t.error.where ? (i(), S(
|
|
46
|
+
], 64)) : N("", !0),
|
|
47
|
+
t.error.where ? (i(), S(j, { key: 1 }, [
|
|
48
48
|
W(" · " + _(t.error.where), 1)
|
|
49
|
-
], 64)) :
|
|
49
|
+
], 64)) : N("", !0)
|
|
50
50
|
])
|
|
51
|
-
])) :
|
|
52
|
-
(i(!0), S(
|
|
51
|
+
])) : N("", !0),
|
|
52
|
+
(i(!0), S(j, null, ee(a.value, (b) => (i(), S("div", {
|
|
53
53
|
key: b.code,
|
|
54
54
|
class: "wx-block-checks__line is-warning"
|
|
55
55
|
}, [
|
|
56
|
-
u(e(
|
|
57
|
-
|
|
56
|
+
u(e(be), { name: "warning" }),
|
|
57
|
+
E("span", null, [
|
|
58
58
|
W(_(b.message) + " ", 1),
|
|
59
|
-
b.line !== null ? (i(), S(
|
|
59
|
+
b.line !== null ? (i(), S(j, { key: 0 }, [
|
|
60
60
|
W(" · " + _(e(o)("page.line", { line: b.line })), 1)
|
|
61
|
-
], 64)) :
|
|
61
|
+
], 64)) : N("", !0)
|
|
62
62
|
])
|
|
63
63
|
]))), 128)),
|
|
64
|
-
(i(!0), S(
|
|
64
|
+
(i(!0), S(j, null, ee(s.value, (b) => (i(), S("div", {
|
|
65
65
|
key: b,
|
|
66
66
|
class: "wx-block-checks__line is-ok"
|
|
67
67
|
}, [
|
|
68
|
-
u(e(
|
|
69
|
-
|
|
68
|
+
u(e(be), { name: "check" }),
|
|
69
|
+
E("span", null, _(b), 1)
|
|
70
70
|
]))), 128))
|
|
71
71
|
]));
|
|
72
72
|
}
|
|
@@ -83,96 +83,96 @@ const gl = { class: "wx-block-checks" }, kl = {
|
|
|
83
83
|
},
|
|
84
84
|
emits: ["restored"],
|
|
85
85
|
setup(t, { emit: l }) {
|
|
86
|
-
const o = t, a = l, s = Me(), r = Ae(s), n = de("webx-blocks"), b = De(),
|
|
87
|
-
async function
|
|
88
|
-
|
|
86
|
+
const o = t, a = l, s = Me(), r = Ae(s), n = de("webx-blocks"), b = De(), P = U(null);
|
|
87
|
+
async function v() {
|
|
88
|
+
P.value = await r.versions(o.block.id);
|
|
89
89
|
}
|
|
90
|
-
function
|
|
91
|
-
return o.block.draft?.number ===
|
|
90
|
+
function p(f) {
|
|
91
|
+
return o.block.draft?.number === f.number ? "draft" : o.block.published?.number === f.number ? "live" : "replaced";
|
|
92
92
|
}
|
|
93
|
-
async function
|
|
94
|
-
if (await
|
|
95
|
-
title: n("page.restore-title", { number:
|
|
93
|
+
async function g(f) {
|
|
94
|
+
if (await Ke({
|
|
95
|
+
title: n("page.restore-title", { number: f.number }),
|
|
96
96
|
message: n("page.restore-text"),
|
|
97
97
|
confirmText: n("page.restore"),
|
|
98
98
|
cancelText: n("page.cancel")
|
|
99
99
|
}))
|
|
100
100
|
try {
|
|
101
|
-
const C = await r.restore(o.block.id,
|
|
102
|
-
|
|
101
|
+
const C = await r.restore(o.block.id, f.number);
|
|
102
|
+
G.success(n("page.restored", { number: C.draft?.number ?? f.number })), a("restored", C), await v();
|
|
103
103
|
} catch (C) {
|
|
104
|
-
|
|
104
|
+
G.danger(b(C));
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
return Ue(
|
|
107
|
+
return Ue(v), X(
|
|
108
108
|
() => [o.block.draft?.number, o.block.published?.number],
|
|
109
109
|
() => {
|
|
110
|
-
|
|
110
|
+
v();
|
|
111
111
|
}
|
|
112
|
-
), (
|
|
113
|
-
|
|
112
|
+
), (f, k) => (i(), S("div", wl, [
|
|
113
|
+
P.value === null ? (i(), I(e(We), {
|
|
114
114
|
key: 0,
|
|
115
115
|
class: "wx-block-history__ghost",
|
|
116
116
|
rows: 3
|
|
117
|
-
})) : (i(!0), S(
|
|
117
|
+
})) : (i(!0), S(j, { key: 1 }, ee(P.value, (C) => (i(), S("div", {
|
|
118
118
|
key: C.number,
|
|
119
119
|
class: "wx-block-history__row"
|
|
120
120
|
}, [
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
u(e(
|
|
124
|
-
default:
|
|
125
|
-
W(_(e(n)(`page.version-${
|
|
121
|
+
E("code", _l, _(e(n)("page.version", { number: C.number })), 1),
|
|
122
|
+
E("div", xl, [
|
|
123
|
+
u(e(F), null, {
|
|
124
|
+
default: d(() => [
|
|
125
|
+
W(_(e(n)(`page.version-${p(C)}`)), 1)
|
|
126
126
|
]),
|
|
127
127
|
_: 2
|
|
128
128
|
}, 1024),
|
|
129
|
-
u(e(
|
|
129
|
+
u(e(F), {
|
|
130
130
|
size: "sm",
|
|
131
131
|
tone: "muted"
|
|
132
132
|
}, {
|
|
133
|
-
default:
|
|
134
|
-
C.created_at ? (i(),
|
|
133
|
+
default: d(() => [
|
|
134
|
+
C.created_at ? (i(), I(e(ll), {
|
|
135
135
|
key: 0,
|
|
136
136
|
value: C.created_at
|
|
137
|
-
}, null, 8, ["value"])) :
|
|
137
|
+
}, null, 8, ["value"])) : N("", !0),
|
|
138
138
|
W(" · " + _(C.author ?? e(n)(`page.source-${C.source}`)) + " ", 1),
|
|
139
|
-
C.comment ? (i(), S(
|
|
139
|
+
C.comment ? (i(), S(j, { key: 1 }, [
|
|
140
140
|
W(" · " + _(C.comment), 1)
|
|
141
|
-
], 64)) :
|
|
141
|
+
], 64)) : N("", !0)
|
|
142
142
|
]),
|
|
143
143
|
_: 2
|
|
144
144
|
}, 1024)
|
|
145
145
|
]),
|
|
146
|
-
|
|
146
|
+
p(C) === "draft" ? (i(), I(e(ue), {
|
|
147
147
|
key: 0,
|
|
148
148
|
type: "warning",
|
|
149
149
|
dot: ""
|
|
150
150
|
}, {
|
|
151
|
-
default:
|
|
151
|
+
default: d(() => [
|
|
152
152
|
W(_(e(n)("page.version-draft")), 1)
|
|
153
153
|
]),
|
|
154
154
|
_: 1
|
|
155
|
-
})) :
|
|
155
|
+
})) : p(C) === "live" ? (i(), I(e(ue), {
|
|
156
156
|
key: 1,
|
|
157
157
|
type: "success",
|
|
158
158
|
dot: ""
|
|
159
159
|
}, {
|
|
160
|
-
default:
|
|
160
|
+
default: d(() => [
|
|
161
161
|
W(_(e(n)("page.version-live")), 1)
|
|
162
162
|
]),
|
|
163
163
|
_: 1
|
|
164
|
-
})) :
|
|
165
|
-
t.canManage &&
|
|
164
|
+
})) : N("", !0),
|
|
165
|
+
t.canManage && p(C) === "replaced" ? (i(), I(e(ce), {
|
|
166
166
|
key: 2,
|
|
167
167
|
size: "sm",
|
|
168
168
|
variant: "outline",
|
|
169
|
-
onClick: (V) =>
|
|
169
|
+
onClick: (V) => g(C)
|
|
170
170
|
}, {
|
|
171
|
-
default:
|
|
171
|
+
default: d(() => [
|
|
172
172
|
W(_(e(n)("page.restore")), 1)
|
|
173
173
|
]),
|
|
174
174
|
_: 1
|
|
175
|
-
}, 8, ["onClick"])) :
|
|
175
|
+
}, 8, ["onClick"])) : N("", !0)
|
|
176
176
|
]))), 128))
|
|
177
177
|
]));
|
|
178
178
|
}
|
|
@@ -203,38 +203,38 @@ function Nt(t, l, o) {
|
|
|
203
203
|
const n = a.end.nextSibling;
|
|
204
204
|
let b = a.start;
|
|
205
205
|
for (; b; ) {
|
|
206
|
-
const
|
|
207
|
-
if (s.removeChild(b),
|
|
208
|
-
b =
|
|
206
|
+
const g = b.nextSibling, f = b === a.end;
|
|
207
|
+
if (s.removeChild(b), f) break;
|
|
208
|
+
b = g;
|
|
209
209
|
}
|
|
210
|
-
const
|
|
211
|
-
s.insertBefore(
|
|
212
|
-
const
|
|
213
|
-
if (
|
|
214
|
-
for (const
|
|
215
|
-
|
|
210
|
+
const P = r.content, v = Array.from(P.childNodes);
|
|
211
|
+
s.insertBefore(P, n);
|
|
212
|
+
const p = t.defaultView?.webx;
|
|
213
|
+
if (p?.mount)
|
|
214
|
+
for (const g of v)
|
|
215
|
+
g.nodeType === 1 && p.mount(g);
|
|
216
216
|
return !0;
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function at(t, l) {
|
|
219
219
|
const o = It(t, l);
|
|
220
220
|
if (!o) return null;
|
|
221
221
|
for (let a = o.start.nextSibling; a && a !== o.end; a = a.nextSibling)
|
|
222
222
|
if (a.nodeType === 1) return a;
|
|
223
223
|
return null;
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function et(t, l) {
|
|
226
226
|
ot(t);
|
|
227
227
|
for (const a of Array.from(t.querySelectorAll(`.${Ne}`)))
|
|
228
228
|
a.classList.remove(Ne);
|
|
229
229
|
if (l === null) return null;
|
|
230
|
-
const o =
|
|
230
|
+
const o = at(t, l);
|
|
231
231
|
return o?.classList.add(Ne), o;
|
|
232
232
|
}
|
|
233
233
|
function mt(t, l) {
|
|
234
234
|
ot(t);
|
|
235
235
|
for (const o of Array.from(t.querySelectorAll(`.${Je}`)))
|
|
236
236
|
o.classList.remove(Je);
|
|
237
|
-
l !== null &&
|
|
237
|
+
l !== null && at(t, l)?.classList.add(Je);
|
|
238
238
|
}
|
|
239
239
|
function ht(t) {
|
|
240
240
|
let l = t?.nodeType === 1 ? t : t?.parentElement ?? null;
|
|
@@ -258,7 +258,7 @@ function Tl(t, l) {
|
|
|
258
258
|
ot(t);
|
|
259
259
|
let o = null;
|
|
260
260
|
function a(n) {
|
|
261
|
-
|
|
261
|
+
he(n), l.select(ht(n.target));
|
|
262
262
|
}
|
|
263
263
|
function s(n) {
|
|
264
264
|
const b = ht(n.target);
|
|
@@ -267,30 +267,30 @@ function Tl(t, l) {
|
|
|
267
267
|
function r() {
|
|
268
268
|
o = null, mt(t, null);
|
|
269
269
|
}
|
|
270
|
-
return t.addEventListener("click", a, !0), t.addEventListener("auxclick",
|
|
270
|
+
return t.addEventListener("click", a, !0), t.addEventListener("auxclick", he, !0), t.addEventListener("submit", he, !0), t.addEventListener("dragstart", he, !0), t.addEventListener("mousemove", s, !0), t.addEventListener("mouseleave", r), {
|
|
271
271
|
release() {
|
|
272
|
-
t.removeEventListener("click", a, !0), t.removeEventListener("auxclick",
|
|
272
|
+
t.removeEventListener("click", a, !0), t.removeEventListener("auxclick", he, !0), t.removeEventListener("submit", he, !0), t.removeEventListener("dragstart", he, !0), t.removeEventListener("mousemove", s, !0), t.removeEventListener("mouseleave", r);
|
|
273
273
|
}
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function he(t) {
|
|
277
277
|
t.preventDefault(), t.stopPropagation();
|
|
278
278
|
}
|
|
279
279
|
function Cl(t) {
|
|
280
280
|
const l = ["click", "auxclick", "submit", "dragstart"];
|
|
281
|
-
for (const o of l) t.addEventListener(o,
|
|
281
|
+
for (const o of l) t.addEventListener(o, he, !0);
|
|
282
282
|
return {
|
|
283
283
|
release() {
|
|
284
|
-
for (const o of l) t.removeEventListener(o,
|
|
284
|
+
for (const o of l) t.removeEventListener(o, he, !0);
|
|
285
285
|
}
|
|
286
286
|
};
|
|
287
287
|
}
|
|
288
|
-
const
|
|
288
|
+
const tt = "sample", bt = "wx-stage-styles";
|
|
289
289
|
function Vl(t, l) {
|
|
290
290
|
let o = t.getElementById(bt);
|
|
291
291
|
o === null && (o = t.createElement("style"), o.id = bt, (t.head ?? t.documentElement).appendChild(o)), o.textContent = l.styles;
|
|
292
|
-
const a = `<!--wx:${
|
|
293
|
-
return Nt(t,
|
|
292
|
+
const a = `<!--wx:${tt}-->`, s = l.html.trimStart().startsWith(a) ? l.html : `${a}${l.html}<!--/wx:${tt}-->`;
|
|
293
|
+
return Nt(t, tt, s);
|
|
294
294
|
}
|
|
295
295
|
function El(t, l) {
|
|
296
296
|
const o = t.createElement("script");
|
|
@@ -323,16 +323,16 @@ const Bl = { class: "wx-block-stage" }, Ll = { class: "wx-block-stage__bar" }, W
|
|
|
323
323
|
{ value: 1280, icon: "monitor", ariaLabel: o("page.width-desktop") },
|
|
324
324
|
{ value: 834, icon: "tablet", ariaLabel: o("page.width-tablet") },
|
|
325
325
|
{ value: 390, icon: "smartphone", ariaLabel: o("page.width-phone") }
|
|
326
|
-
]), s =
|
|
326
|
+
]), s = U(1280), r = U(null), n = U(null), b = Ye(r), P = U(360), v = U(!1);
|
|
327
327
|
X([b, a], () => {
|
|
328
|
-
if (
|
|
329
|
-
const
|
|
330
|
-
s.value = (
|
|
328
|
+
if (v.value || b.value === 0) return;
|
|
329
|
+
const c = a.value.find((B) => b.value / B.value >= 0.45);
|
|
330
|
+
s.value = (c ?? a.value[a.value.length - 1]).value;
|
|
331
331
|
});
|
|
332
|
-
function
|
|
333
|
-
|
|
332
|
+
function p(c) {
|
|
333
|
+
v.value = !0, s.value = c;
|
|
334
334
|
}
|
|
335
|
-
const
|
|
335
|
+
const g = T(() => b.value === 0 ? 1 : Math.min(1, b.value / s.value)), f = T(
|
|
336
336
|
() => l.stage ? void 0 : Pt({
|
|
337
337
|
html: l.html,
|
|
338
338
|
styles: l.styles,
|
|
@@ -340,116 +340,103 @@ const Bl = { class: "wx-block-stage" }, Ll = { class: "wx-block-stage__bar" }, W
|
|
|
340
340
|
runtime: l.runtime,
|
|
341
341
|
base: typeof location > "u" ? null : location.origin + "/"
|
|
342
342
|
})
|
|
343
|
-
),
|
|
343
|
+
), k = U(0);
|
|
344
344
|
let C = null;
|
|
345
345
|
X(
|
|
346
346
|
() => l.script,
|
|
347
|
-
(
|
|
348
|
-
l.stage &&
|
|
347
|
+
(c) => {
|
|
348
|
+
l.stage && c !== C && (k.value += 1);
|
|
349
349
|
}
|
|
350
350
|
);
|
|
351
351
|
function V() {
|
|
352
|
-
const
|
|
353
|
-
if (!
|
|
354
|
-
const
|
|
355
|
-
|
|
352
|
+
const c = n.value?.contentDocument?.body;
|
|
353
|
+
if (!c) return;
|
|
354
|
+
const B = c.ownerDocument.defaultView, D = B && parseFloat(B.getComputedStyle(c).marginBottom) || 0, K = c.getBoundingClientRect().bottom + D + (B?.scrollY ?? 0);
|
|
355
|
+
P.value = Math.max(120, Math.ceil(Math.max(c.scrollHeight, K)));
|
|
356
356
|
}
|
|
357
|
-
let x = null,
|
|
357
|
+
let x = null, m = null;
|
|
358
358
|
function y() {
|
|
359
|
-
x?.release(), x = null,
|
|
360
|
-
}
|
|
361
|
-
function R(k) {
|
|
362
|
-
l.stage && (l.script && C !== l.script && (C = l.script, El(k, l.script)), Vl(k, { html: l.html, styles: l.styles }));
|
|
359
|
+
x?.release(), x = null, m?.disconnect(), m = null;
|
|
363
360
|
}
|
|
364
|
-
function
|
|
365
|
-
|
|
366
|
-
if (!A || !j) return;
|
|
367
|
-
const pe = A.getBoundingClientRect().top + (k.defaultView?.scrollY ?? 0);
|
|
368
|
-
j.scrollTop = Math.max(0, pe * m.value - 24);
|
|
361
|
+
function R(c) {
|
|
362
|
+
l.stage && (l.script && C !== l.script && (C = l.script, El(c, l.script)), Vl(c, { html: l.html, styles: l.styles }));
|
|
369
363
|
}
|
|
370
|
-
function
|
|
364
|
+
function q() {
|
|
371
365
|
y();
|
|
372
|
-
const
|
|
373
|
-
if (!
|
|
374
|
-
l.stage && (C = null, x = Cl(
|
|
375
|
-
const
|
|
376
|
-
|
|
366
|
+
const c = n.value?.contentDocument;
|
|
367
|
+
if (!c?.body) return;
|
|
368
|
+
l.stage && (C = null, x = Cl(c), R(c)), V();
|
|
369
|
+
const B = c.defaultView?.ResizeObserver;
|
|
370
|
+
B && (m = new B(() => V()), m.observe(c.body));
|
|
377
371
|
}
|
|
378
372
|
X(
|
|
379
373
|
() => [l.html, l.styles],
|
|
380
374
|
() => {
|
|
381
|
-
const
|
|
382
|
-
l.stage &&
|
|
375
|
+
const c = n.value?.contentDocument;
|
|
376
|
+
l.stage && c?.body && x !== null && R(c);
|
|
383
377
|
}
|
|
384
|
-
), X(b, (
|
|
385
|
-
|
|
386
|
-
}), X(
|
|
387
|
-
|
|
388
|
-
() => setTimeout(() => {
|
|
389
|
-
V();
|
|
390
|
-
const k = n.value?.contentDocument;
|
|
391
|
-
l.stage && k && requestAnimationFrame(() => J(k));
|
|
392
|
-
}, 50)
|
|
393
|
-
), Ge(y);
|
|
394
|
-
const Z = T(() => ({
|
|
378
|
+
), X(b, (c, B) => {
|
|
379
|
+
c > 0 && B === 0 && setTimeout(V, 50);
|
|
380
|
+
}), X(s, () => setTimeout(V, 50)), Ge(y);
|
|
381
|
+
const J = T(() => ({
|
|
395
382
|
width: `${s.value}px`,
|
|
396
|
-
height: `${
|
|
397
|
-
transform: `scale(${
|
|
398
|
-
})),
|
|
399
|
-
width: `${Math.round(s.value *
|
|
400
|
-
height: `${Math.round(
|
|
383
|
+
height: `${P.value}px`,
|
|
384
|
+
transform: `scale(${g.value})`
|
|
385
|
+
})), Z = T(() => ({
|
|
386
|
+
width: `${Math.round(s.value * g.value)}px`,
|
|
387
|
+
height: `${Math.round(P.value * g.value)}px`
|
|
401
388
|
}));
|
|
402
|
-
return (
|
|
403
|
-
|
|
389
|
+
return (c, B) => (i(), S("div", Bl, [
|
|
390
|
+
E("div", Ll, [
|
|
404
391
|
u(e(Ct), {
|
|
405
392
|
"model-value": s.value,
|
|
406
393
|
options: a.value,
|
|
407
394
|
size: "sm",
|
|
408
395
|
"aria-label": e(o)("page.width"),
|
|
409
|
-
"onUpdate:modelValue":
|
|
396
|
+
"onUpdate:modelValue": B[0] || (B[0] = (D) => p(Number(D)))
|
|
410
397
|
}, null, 8, ["model-value", "options", "aria-label"])
|
|
411
398
|
]),
|
|
412
|
-
|
|
399
|
+
E("div", {
|
|
413
400
|
ref_key: "box",
|
|
414
401
|
ref: r,
|
|
415
402
|
class: "wx-block-stage__ground"
|
|
416
403
|
}, [
|
|
417
|
-
t.loading && !t.html ? (i(),
|
|
404
|
+
t.loading && !t.html ? (i(), I(e(We), {
|
|
418
405
|
key: 0,
|
|
419
406
|
rows: 3
|
|
420
407
|
})) : (i(), S("div", {
|
|
421
408
|
key: 1,
|
|
422
409
|
class: "wx-block-stage__clip",
|
|
423
|
-
style:
|
|
410
|
+
style: xe(Z.value)
|
|
424
411
|
}, [
|
|
425
412
|
(i(), S("iframe", {
|
|
426
413
|
ref_key: "frame",
|
|
427
414
|
ref: n,
|
|
428
|
-
key:
|
|
415
|
+
key: k.value,
|
|
429
416
|
class: "wx-block-stage__frame",
|
|
430
417
|
src: t.stage ?? void 0,
|
|
431
|
-
srcdoc:
|
|
432
|
-
style:
|
|
418
|
+
srcdoc: f.value,
|
|
419
|
+
style: xe(J.value),
|
|
433
420
|
sandbox: "allow-same-origin allow-scripts",
|
|
434
421
|
title: e(o)("page.preview"),
|
|
435
|
-
onLoad:
|
|
422
|
+
onLoad: q
|
|
436
423
|
}, null, 44, Wl))
|
|
437
424
|
], 4))
|
|
438
425
|
], 512)
|
|
439
426
|
]));
|
|
440
427
|
}
|
|
441
|
-
}), zl = /* @__PURE__ */ oe(Al, [["__scopeId", "data-v-
|
|
428
|
+
}), zl = /* @__PURE__ */ oe(Al, [["__scopeId", "data-v-3185ee45"]]);
|
|
442
429
|
function Ut(t) {
|
|
443
430
|
return typeof t == "object" && t !== null && typeof t.type == "string" && t.type !== "";
|
|
444
431
|
}
|
|
445
|
-
function
|
|
432
|
+
function Ze(t) {
|
|
446
433
|
return Array.isArray(t) && t.length > 0 && t.every(Ut);
|
|
447
434
|
}
|
|
448
|
-
function
|
|
435
|
+
function lt() {
|
|
449
436
|
return (typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID().replace(/-/g, "") : Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2)).slice(0, 12);
|
|
450
437
|
}
|
|
451
438
|
function Il(t, l = {}) {
|
|
452
|
-
return { key:
|
|
439
|
+
return { key: lt(), type: t, values: l };
|
|
453
440
|
}
|
|
454
441
|
function re(t, l) {
|
|
455
442
|
return Mt(t, l, null, null);
|
|
@@ -459,9 +446,9 @@ function Mt(t, l, o, a) {
|
|
|
459
446
|
const r = t[s];
|
|
460
447
|
if (r.key === l) return { node: r, parent: o, field: a, list: t, index: s };
|
|
461
448
|
for (const [n, b] of Object.entries(r.values ?? {}))
|
|
462
|
-
if (
|
|
463
|
-
const
|
|
464
|
-
if (
|
|
449
|
+
if (Ze(b)) {
|
|
450
|
+
const P = Mt(b, l, r, n);
|
|
451
|
+
if (P) return P;
|
|
465
452
|
}
|
|
466
453
|
}
|
|
467
454
|
return null;
|
|
@@ -471,7 +458,7 @@ function Oe(t, l, o = 0, a = null) {
|
|
|
471
458
|
if (Ut(s)) {
|
|
472
459
|
l(s, o, a);
|
|
473
460
|
for (const r of Object.values(s.values ?? {}))
|
|
474
|
-
|
|
461
|
+
Ze(r) && Oe(r, l, o + 1, s);
|
|
475
462
|
}
|
|
476
463
|
}
|
|
477
464
|
function Nl(t, l) {
|
|
@@ -483,7 +470,7 @@ function Nl(t, l) {
|
|
|
483
470
|
function Pl(t) {
|
|
484
471
|
let l = 0;
|
|
485
472
|
for (const o of Object.values(t.values ?? {}))
|
|
486
|
-
|
|
473
|
+
Ze(o) && Oe(o, () => l++);
|
|
487
474
|
return l;
|
|
488
475
|
}
|
|
489
476
|
function wa(t) {
|
|
@@ -501,11 +488,11 @@ function Dt(t) {
|
|
|
501
488
|
function Ot(t) {
|
|
502
489
|
const l = {};
|
|
503
490
|
for (const [o, a] of Object.entries(t.values ?? {}))
|
|
504
|
-
l[o] =
|
|
505
|
-
return t.hidden === !0 ? { key:
|
|
491
|
+
l[o] = Ze(a) ? a.map(Ot) : ge(a);
|
|
492
|
+
return t.hidden === !0 ? { key: lt(), type: t.type, hidden: !0, values: l } : { key: lt(), type: t.type, values: l };
|
|
506
493
|
}
|
|
507
494
|
function Ul(t, l, o) {
|
|
508
|
-
const a =
|
|
495
|
+
const a = ge(t), s = re(a, l);
|
|
509
496
|
return s ? (o ? s.node.hidden = !0 : delete s.node.hidden, a) : t;
|
|
510
497
|
}
|
|
511
498
|
function Ml(t, l, o) {
|
|
@@ -516,23 +503,23 @@ function Ml(t, l, o) {
|
|
|
516
503
|
return Array.isArray(s) || (a.node.values[o] = []), a.node.values[o];
|
|
517
504
|
}
|
|
518
505
|
function kt(t, l, o, a, s) {
|
|
519
|
-
const r =
|
|
506
|
+
const r = ge(t), n = Ml(r, l, o);
|
|
520
507
|
return n ? (n.splice(Math.max(0, Math.min(a, n.length)), 0, s), r) : t;
|
|
521
508
|
}
|
|
522
509
|
function Dl(t, l) {
|
|
523
|
-
const o =
|
|
510
|
+
const o = ge(t), a = re(o, l);
|
|
524
511
|
return a ? (a.list.splice(a.index, 1), o) : t;
|
|
525
512
|
}
|
|
526
513
|
function Ol(t, l, o) {
|
|
527
|
-
const a =
|
|
514
|
+
const a = ge(t), s = re(a, l);
|
|
528
515
|
return s ? (s.node.values = o, a) : t;
|
|
529
516
|
}
|
|
530
517
|
function Rl(t, l, o, a) {
|
|
531
|
-
if (l === null) return
|
|
532
|
-
const s =
|
|
533
|
-
return !r || o === null ? t : (r.node.values[o] =
|
|
518
|
+
if (l === null) return ge(a);
|
|
519
|
+
const s = ge(t), r = re(s, l);
|
|
520
|
+
return !r || o === null ? t : (r.node.values[o] = ge(a), s);
|
|
534
521
|
}
|
|
535
|
-
function
|
|
522
|
+
function ge(t) {
|
|
536
523
|
return t === void 0 ? t : JSON.parse(JSON.stringify(t));
|
|
537
524
|
}
|
|
538
525
|
const Hl = {
|
|
@@ -699,8 +686,8 @@ function Re() {
|
|
|
699
686
|
} catch {
|
|
700
687
|
}
|
|
701
688
|
}
|
|
702
|
-
const
|
|
703
|
-
function
|
|
689
|
+
const jl = ["block", "entity", "loop", "__env", "errors", "app"];
|
|
690
|
+
function Fl(t, l, o) {
|
|
704
691
|
const a = [];
|
|
705
692
|
/data-wx-block\s*=/.test(l.template) || a.push({ file: "template", code: "no-marker", line: null, message: o("checks.no-marker") });
|
|
706
693
|
const s = ql(l.template, l.schema);
|
|
@@ -709,12 +696,12 @@ function jl(t, l, o) {
|
|
|
709
696
|
code: "variables-missing",
|
|
710
697
|
line: null,
|
|
711
698
|
message: o("checks.variables-missing", {
|
|
712
|
-
variables: s.map((
|
|
699
|
+
variables: s.map((p) => `$${p}`).join(", ")
|
|
713
700
|
})
|
|
714
701
|
});
|
|
715
702
|
const r = [], n = [], b = `.b-${t}`;
|
|
716
|
-
for (const [
|
|
717
|
-
|
|
703
|
+
for (const [p, g] of Jl(l.styles))
|
|
704
|
+
p.startsWith(b) || p.startsWith("&") || (/^[a-z][a-z0-9-]*/i.test(p) ? n.push([p, g]) : r.push([p, g]));
|
|
718
705
|
r.length > 0 && a.push({
|
|
719
706
|
file: "styles",
|
|
720
707
|
code: "stray-selectors",
|
|
@@ -726,11 +713,11 @@ function jl(t, l, o) {
|
|
|
726
713
|
line: n[0][1],
|
|
727
714
|
message: o("checks.bare-selectors", { selectors: wt(n) })
|
|
728
715
|
});
|
|
729
|
-
const
|
|
730
|
-
return
|
|
716
|
+
const P = Ht(l.styles), v = /@media\b/.exec(P);
|
|
717
|
+
return v && a.push({
|
|
731
718
|
file: "styles",
|
|
732
719
|
code: "media-query",
|
|
733
|
-
line:
|
|
720
|
+
line: jt(P, v.index),
|
|
734
721
|
message: o("checks.media-query")
|
|
735
722
|
}), a;
|
|
736
723
|
}
|
|
@@ -741,7 +728,7 @@ function Rt(t) {
|
|
|
741
728
|
return l;
|
|
742
729
|
}
|
|
743
730
|
function ql(t, l) {
|
|
744
|
-
const o = /* @__PURE__ */ new Set([...Rt(l), ...
|
|
731
|
+
const o = /* @__PURE__ */ new Set([...Rt(l), ...jl]);
|
|
745
732
|
for (const s of t.matchAll(/\bas\s+\$([a-zA-Z_]\w*)(?:\s*=>\s*\$([a-zA-Z_]\w*))?/g))
|
|
746
733
|
o.add(s[1]), s[2] && o.add(s[2]);
|
|
747
734
|
for (const s of t.matchAll(/\$([a-zA-Z_]\w*)\s*(?:=[^=]|\+\+|--|\.=|\+=|-=)/g))
|
|
@@ -760,7 +747,7 @@ function Jl(t) {
|
|
|
760
747
|
if (!(r === "" || r.startsWith("@")))
|
|
761
748
|
for (const n of s.split(",")) {
|
|
762
749
|
const b = n.trim();
|
|
763
|
-
b === "" || b === "from" || b === "to" || b.endsWith("%") || o.push([b,
|
|
750
|
+
b === "" || b === "from" || b === "to" || b.endsWith("%") || o.push([b, jt(l, a.index + s.indexOf(b))]);
|
|
764
751
|
}
|
|
765
752
|
}
|
|
766
753
|
return o;
|
|
@@ -768,7 +755,7 @@ function Jl(t) {
|
|
|
768
755
|
function Ht(t) {
|
|
769
756
|
return t.replace(/\/\*[\s\S]*?\*\//g, (l) => l.replace(/[^\n]/g, " "));
|
|
770
757
|
}
|
|
771
|
-
function
|
|
758
|
+
function jt(t, l) {
|
|
772
759
|
return t.slice(0, Math.max(0, l)).split(`
|
|
773
760
|
`).length;
|
|
774
761
|
}
|
|
@@ -783,14 +770,14 @@ function st(t) {
|
|
|
783
770
|
children: l.children ? st(l.children) : l.children
|
|
784
771
|
}));
|
|
785
772
|
}
|
|
786
|
-
function
|
|
773
|
+
function nt(t, l) {
|
|
787
774
|
return t === 0 ? l("page.not-used") : t === 1 ? l("page.on-page") : l("page.on-pages", { count: t });
|
|
788
775
|
}
|
|
789
776
|
function ze(t, l) {
|
|
790
777
|
const o = `groups.${t}`, a = l(o);
|
|
791
778
|
return a === o || a === `webx-blocks::${o}` ? t.charAt(0).toUpperCase() + t.slice(1) : a;
|
|
792
779
|
}
|
|
793
|
-
const Kl = { class: "wx-block-editor" },
|
|
780
|
+
const Kl = { class: "wx-block-editor" }, Gl = { class: "wx-block-editor__split" }, Yl = {
|
|
794
781
|
type: "button",
|
|
795
782
|
class: "wx-block-editor__uses"
|
|
796
783
|
}, Zl = { class: "wx-block-editor__usage" }, Ql = { class: "wx-block-editor__pane" }, Xl = {
|
|
@@ -807,14 +794,14 @@ const Kl = { class: "wx-block-editor" }, Yl = { class: "wx-block-editor__split"
|
|
|
807
794
|
setup(t) {
|
|
808
795
|
const l = t, o = Me(), a = Ae(o), s = tl(), r = Tt();
|
|
809
796
|
Re();
|
|
810
|
-
const n = de("webx-blocks"), b = De(),
|
|
811
|
-
const
|
|
797
|
+
const n = de("webx-blocks"), b = De(), P = T(() => Number(s.params.id)), v = U(null), p = U([]), g = U(!0), f = U(!1), k = U(!1), C = U("template"), V = T(() => {
|
|
798
|
+
const A = o.state.manifest?.modules.find((h) => h.id === "blocks")?.meta;
|
|
812
799
|
return {
|
|
813
|
-
groups:
|
|
814
|
-
editing:
|
|
815
|
-
provides:
|
|
800
|
+
groups: A?.groups ?? [],
|
|
801
|
+
editing: A?.editing ?? !0,
|
|
802
|
+
provides: A?.provides ?? []
|
|
816
803
|
};
|
|
817
|
-
}), x = T(() => o.can("blocks.manage") && V.value.editing),
|
|
804
|
+
}), x = T(() => o.can("blocks.manage") && V.value.editing), m = Qe({
|
|
818
805
|
slug: "",
|
|
819
806
|
title: "",
|
|
820
807
|
description: "",
|
|
@@ -825,88 +812,88 @@ const Kl = { class: "wx-block-editor" }, Yl = { class: "wx-block-editor__split"
|
|
|
825
812
|
allowed_in: [],
|
|
826
813
|
max_per_entity: null,
|
|
827
814
|
is_enabled: !0
|
|
828
|
-
}), y =
|
|
815
|
+
}), y = Qe({
|
|
829
816
|
schema: [],
|
|
830
817
|
template: "",
|
|
831
818
|
styles: "",
|
|
832
819
|
script: null,
|
|
833
820
|
sample: {}
|
|
834
|
-
}), R =
|
|
821
|
+
}), R = U("[]"), q = U(null), J = U(""), Z = U({}), c = U(null), B = Qe({
|
|
835
822
|
html: "",
|
|
836
823
|
styles: "",
|
|
837
824
|
script: null,
|
|
838
825
|
runtime: null,
|
|
839
826
|
stage: null,
|
|
840
827
|
loading: !1
|
|
841
|
-
}),
|
|
842
|
-
const
|
|
843
|
-
return
|
|
828
|
+
}), D = T(() => JSON.stringify({ settings: m, content: y })), K = T(() => J.value !== "" && D.value !== J.value), Se = T(() => Fl(m.slug, y, n)), pe = T(() => {
|
|
829
|
+
const A = [...V.value.groups];
|
|
830
|
+
return A.includes(m.group) || A.push(m.group), A.map((h) => ({ value: h, label: ze(h, n) }));
|
|
844
831
|
}), se = T({
|
|
845
832
|
get: () => y.sample,
|
|
846
|
-
set: (
|
|
847
|
-
y.sample =
|
|
833
|
+
set: (A) => {
|
|
834
|
+
y.sample = A;
|
|
848
835
|
}
|
|
849
|
-
}),
|
|
850
|
-
function Te(
|
|
836
|
+
}), _e = T(() => Te(y.schema));
|
|
837
|
+
function Te(A) {
|
|
851
838
|
const h = [];
|
|
852
|
-
for (const $ of
|
|
839
|
+
for (const $ of A)
|
|
853
840
|
$.type !== "wx-blocks" && !($.children?.length && !$.name) && h.push($.id), $.children && h.push(...Te($.children));
|
|
854
841
|
return h;
|
|
855
842
|
}
|
|
856
|
-
function
|
|
857
|
-
|
|
858
|
-
slug:
|
|
859
|
-
title:
|
|
860
|
-
description:
|
|
861
|
-
icon:
|
|
862
|
-
group:
|
|
863
|
-
sort:
|
|
864
|
-
allow:
|
|
865
|
-
allowed_in:
|
|
866
|
-
max_per_entity:
|
|
867
|
-
is_enabled:
|
|
843
|
+
function ke(A) {
|
|
844
|
+
v.value = A, Object.assign(m, {
|
|
845
|
+
slug: A.slug,
|
|
846
|
+
title: A.title,
|
|
847
|
+
description: A.description,
|
|
848
|
+
icon: A.icon,
|
|
849
|
+
group: A.group,
|
|
850
|
+
sort: A.sort,
|
|
851
|
+
allow: A.allow ?? [],
|
|
852
|
+
allowed_in: A.allowed_in ?? [],
|
|
853
|
+
max_per_entity: A.max_per_entity,
|
|
854
|
+
is_enabled: A.is_enabled
|
|
868
855
|
});
|
|
869
|
-
const h =
|
|
856
|
+
const h = A.content ?? {
|
|
870
857
|
schema: [],
|
|
871
858
|
template: "",
|
|
872
859
|
styles: "",
|
|
873
860
|
script: null,
|
|
874
861
|
sample: {}
|
|
875
862
|
};
|
|
876
|
-
Object.assign(y,
|
|
863
|
+
Object.assign(y, ge(h)), R.value = JSON.stringify(h.schema, null, 2), q.value = null, J.value = D.value;
|
|
877
864
|
}
|
|
878
865
|
async function te() {
|
|
879
|
-
|
|
866
|
+
g.value = !0;
|
|
880
867
|
try {
|
|
881
|
-
|
|
882
|
-
} catch (
|
|
883
|
-
|
|
868
|
+
ke(await a.get(P.value)), p.value = await a.usage(P.value);
|
|
869
|
+
} catch (A) {
|
|
870
|
+
G.danger(b(A));
|
|
884
871
|
} finally {
|
|
885
|
-
|
|
872
|
+
g.value = !1;
|
|
886
873
|
}
|
|
887
874
|
}
|
|
888
|
-
function Ce(
|
|
889
|
-
R.value =
|
|
875
|
+
function Ce(A) {
|
|
876
|
+
R.value = A;
|
|
890
877
|
try {
|
|
891
|
-
const h = JSON.parse(
|
|
878
|
+
const h = JSON.parse(A);
|
|
892
879
|
if (!Array.isArray(h)) throw new Error("not a list");
|
|
893
|
-
y.schema = h,
|
|
880
|
+
y.schema = h, q.value = null;
|
|
894
881
|
} catch (h) {
|
|
895
|
-
|
|
882
|
+
q.value = n("page.schema-invalid", { error: h.message });
|
|
896
883
|
}
|
|
897
884
|
}
|
|
898
|
-
let
|
|
899
|
-
function
|
|
900
|
-
clearTimeout(
|
|
885
|
+
let ye, fe = 0;
|
|
886
|
+
function z() {
|
|
887
|
+
clearTimeout(ye), ye = setTimeout(() => {
|
|
901
888
|
O();
|
|
902
889
|
}, 250);
|
|
903
890
|
}
|
|
904
891
|
async function O() {
|
|
905
|
-
if (!
|
|
906
|
-
const
|
|
907
|
-
|
|
892
|
+
if (!v.value) return;
|
|
893
|
+
const A = ++fe;
|
|
894
|
+
B.loading = !0;
|
|
908
895
|
try {
|
|
909
|
-
const h = await a.render(
|
|
896
|
+
const h = await a.render(v.value.id, {
|
|
910
897
|
values: y.sample,
|
|
911
898
|
content: x.value ? {
|
|
912
899
|
template: y.template,
|
|
@@ -915,92 +902,92 @@ const Kl = { class: "wx-block-editor" }, Yl = { class: "wx-block-editor__split"
|
|
|
915
902
|
schema: y.schema
|
|
916
903
|
} : void 0
|
|
917
904
|
});
|
|
918
|
-
if (
|
|
919
|
-
|
|
905
|
+
if (A !== fe) return;
|
|
906
|
+
B.html = h.html, B.styles = h.styles, B.script = h.script, B.runtime = h.runtime, B.stage = h.stage ?? null;
|
|
920
907
|
} catch (h) {
|
|
921
|
-
|
|
908
|
+
A === fe && G.danger(b(h));
|
|
922
909
|
} finally {
|
|
923
|
-
|
|
910
|
+
A === fe && (B.loading = !1);
|
|
924
911
|
}
|
|
925
912
|
}
|
|
926
913
|
X(
|
|
927
914
|
() => [y.template, y.styles, y.script, y.schema, y.sample],
|
|
928
|
-
|
|
915
|
+
z,
|
|
929
916
|
{ deep: !0 }
|
|
930
917
|
);
|
|
931
|
-
const H =
|
|
932
|
-
function
|
|
933
|
-
return `{{ $${
|
|
918
|
+
const H = U(null);
|
|
919
|
+
function Y(A) {
|
|
920
|
+
return `{{ $${A} }}`;
|
|
934
921
|
}
|
|
935
|
-
function
|
|
922
|
+
function ve(A) {
|
|
936
923
|
const $ = H.value?.view?.value;
|
|
937
924
|
if (!$) {
|
|
938
|
-
y.template += `{{ $${
|
|
925
|
+
y.template += `{{ $${A} }}`;
|
|
939
926
|
return;
|
|
940
927
|
}
|
|
941
|
-
$.dispatch($.state.replaceSelection(`{{ $${
|
|
928
|
+
$.dispatch($.state.replaceSelection(`{{ $${A} }}`)), $.focus();
|
|
942
929
|
}
|
|
943
|
-
async function
|
|
944
|
-
if (!
|
|
945
|
-
|
|
946
|
-
const
|
|
930
|
+
async function me() {
|
|
931
|
+
if (!v.value) return;
|
|
932
|
+
f.value = !0, Z.value = {}, c.value = null;
|
|
933
|
+
const A = v.value.draft?.number ?? null;
|
|
947
934
|
try {
|
|
948
|
-
const h = await a.update(
|
|
949
|
-
...
|
|
950
|
-
allow:
|
|
951
|
-
allowed_in:
|
|
952
|
-
description:
|
|
953
|
-
icon:
|
|
954
|
-
content:
|
|
935
|
+
const h = await a.update(v.value.id, {
|
|
936
|
+
...m,
|
|
937
|
+
allow: m.allow.length ? m.allow : null,
|
|
938
|
+
allowed_in: m.allowed_in.length ? m.allowed_in : null,
|
|
939
|
+
description: m.description || null,
|
|
940
|
+
icon: m.icon || null,
|
|
941
|
+
content: q.value ? { ...y, schema: void 0 } : y
|
|
955
942
|
});
|
|
956
|
-
|
|
957
|
-
h.draft && h.draft.number !==
|
|
943
|
+
ke(h), G.success(
|
|
944
|
+
h.draft && h.draft.number !== A ? n("page.saved", { number: h.draft.number }) : n("page.unchanged")
|
|
958
945
|
);
|
|
959
946
|
} catch (h) {
|
|
960
947
|
const $ = h.body;
|
|
961
|
-
$?.errors ? (Z.value = $.errors,
|
|
948
|
+
$?.errors ? (Z.value = $.errors, G.danger(n("page.failed"))) : G.danger(b(h, n("page.failed")));
|
|
962
949
|
} finally {
|
|
963
|
-
|
|
950
|
+
f.value = !1;
|
|
964
951
|
}
|
|
965
952
|
}
|
|
966
953
|
async function ie() {
|
|
967
|
-
if (!(!
|
|
968
|
-
title: n("page.publish-title", { number:
|
|
969
|
-
message: n("page.publish-text", { count:
|
|
954
|
+
if (!(!v.value?.draft || (K.value && await me(), !v.value.draft) || !await Ke({
|
|
955
|
+
title: n("page.publish-title", { number: v.value.draft.number }),
|
|
956
|
+
message: n("page.publish-text", { count: v.value.usage_count }),
|
|
970
957
|
confirmText: n("page.publish"),
|
|
971
958
|
cancelText: n("page.cancel")
|
|
972
959
|
}))) {
|
|
973
|
-
|
|
960
|
+
k.value = !0, c.value = null;
|
|
974
961
|
try {
|
|
975
|
-
|
|
962
|
+
ke(await a.publish(v.value.id)), G.success(n("page.published", { number: v.value.published?.number ?? 0 }));
|
|
976
963
|
} catch (h) {
|
|
977
964
|
const $ = h.body;
|
|
978
|
-
$?.errors ? (
|
|
965
|
+
$?.errors ? (c.value = $, C.value = "template", G.danger(n("page.publish-failed"))) : G.danger(b(h, n("page.publish-failed")));
|
|
979
966
|
} finally {
|
|
980
|
-
|
|
967
|
+
k.value = !1;
|
|
981
968
|
}
|
|
982
969
|
}
|
|
983
970
|
}
|
|
984
|
-
async function
|
|
985
|
-
if (!(!
|
|
986
|
-
title: n("page.delete-title", { title:
|
|
971
|
+
async function we() {
|
|
972
|
+
if (!(!v.value || !await Ke({
|
|
973
|
+
title: n("page.delete-title", { title: v.value.title }),
|
|
987
974
|
message: n("page.delete-text"),
|
|
988
975
|
confirmText: n("page.delete"),
|
|
989
976
|
cancelText: n("page.cancel"),
|
|
990
977
|
tone: "danger"
|
|
991
978
|
})))
|
|
992
979
|
try {
|
|
993
|
-
await a.remove(
|
|
980
|
+
await a.remove(v.value.id), G.success(n("page.deleted")), r.push(l.base);
|
|
994
981
|
} catch (h) {
|
|
995
|
-
|
|
982
|
+
G.danger(b(h));
|
|
996
983
|
}
|
|
997
984
|
}
|
|
998
985
|
const Ve = T(
|
|
999
|
-
() =>
|
|
1000
|
-
message:
|
|
1001
|
-
line:
|
|
1002
|
-
where:
|
|
1003
|
-
title:
|
|
986
|
+
() => c.value ? {
|
|
987
|
+
message: c.value.errors.template?.[0] ?? c.value.message,
|
|
988
|
+
line: c.value.line,
|
|
989
|
+
where: c.value.entity ? n("page.failed-on", {
|
|
990
|
+
title: c.value.entity.title ?? `#${c.value.entity.id}`
|
|
1004
991
|
}) : null
|
|
1005
992
|
} : null
|
|
1006
993
|
), Ee = T(() => C.value === "template" || C.value === "styles"), w = T(() => [
|
|
@@ -1026,182 +1013,182 @@ setInterval(() => el.classList.toggle('is-second'), seconds * 1000)`
|
|
|
1026
1013
|
|
|
1027
1014
|
new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
1028
1015
|
}
|
|
1029
|
-
]), L = T(() =>
|
|
1030
|
-
function
|
|
1031
|
-
return Z.value[
|
|
1016
|
+
]), L = T(() => p.value.slice(0, 5));
|
|
1017
|
+
function M(A) {
|
|
1018
|
+
return Z.value[A]?.[0];
|
|
1032
1019
|
}
|
|
1033
|
-
function Q(
|
|
1034
|
-
|
|
1020
|
+
function Q(A) {
|
|
1021
|
+
K.value && A.preventDefault();
|
|
1035
1022
|
}
|
|
1036
1023
|
Ue(() => {
|
|
1037
1024
|
te(), window.addEventListener("beforeunload", Q);
|
|
1038
1025
|
}), Ge(() => {
|
|
1039
|
-
clearTimeout(
|
|
1040
|
-
}), X(
|
|
1026
|
+
clearTimeout(ye), window.removeEventListener("beforeunload", Q);
|
|
1027
|
+
}), X(P, () => {
|
|
1041
1028
|
te();
|
|
1042
1029
|
});
|
|
1043
1030
|
const le = T(
|
|
1044
1031
|
() => x.value ? [
|
|
1045
|
-
{ key: "save", label: n("page.save"), loading:
|
|
1046
|
-
|
|
1032
|
+
{ key: "save", label: n("page.save"), loading: f.value, run: () => {
|
|
1033
|
+
me();
|
|
1047
1034
|
} },
|
|
1048
1035
|
{
|
|
1049
1036
|
key: "publish",
|
|
1050
1037
|
label: n("page.publish"),
|
|
1051
1038
|
primary: !0,
|
|
1052
|
-
loading:
|
|
1053
|
-
disabled: !
|
|
1039
|
+
loading: k.value,
|
|
1040
|
+
disabled: !v.value?.draft && !K.value,
|
|
1054
1041
|
run: () => {
|
|
1055
1042
|
ie();
|
|
1056
1043
|
}
|
|
1057
1044
|
}
|
|
1058
1045
|
] : []
|
|
1059
1046
|
);
|
|
1060
|
-
return (
|
|
1061
|
-
|
|
1047
|
+
return (A, h) => (i(), S("div", Kl, [
|
|
1048
|
+
g.value || !v.value ? (i(), S(j, { key: 0 }, [
|
|
1062
1049
|
u(e(We), {
|
|
1063
1050
|
class: "wx-block-editor__ghost-head",
|
|
1064
1051
|
title: "",
|
|
1065
1052
|
rows: 1
|
|
1066
1053
|
}),
|
|
1067
|
-
|
|
1054
|
+
E("div", Gl, [
|
|
1068
1055
|
u(e(Be), null, {
|
|
1069
|
-
default:
|
|
1056
|
+
default: d(() => [
|
|
1070
1057
|
u(e(We), { rows: 8 })
|
|
1071
1058
|
]),
|
|
1072
1059
|
_: 1
|
|
1073
1060
|
}),
|
|
1074
1061
|
u(e(Be), null, {
|
|
1075
|
-
default:
|
|
1062
|
+
default: d(() => [
|
|
1076
1063
|
u(e(We), { rows: 4 })
|
|
1077
1064
|
]),
|
|
1078
1065
|
_: 1
|
|
1079
1066
|
})
|
|
1080
1067
|
])
|
|
1081
|
-
], 64)) : (i(), S(
|
|
1068
|
+
], 64)) : (i(), S(j, { key: 1 }, [
|
|
1082
1069
|
u(e(nl), {
|
|
1083
|
-
title:
|
|
1070
|
+
title: m.title,
|
|
1084
1071
|
back: t.base,
|
|
1085
1072
|
"back-label": e(n)("page.back"),
|
|
1086
1073
|
actions: le.value
|
|
1087
1074
|
}, {
|
|
1088
|
-
"title-after":
|
|
1089
|
-
x.value ? (i(),
|
|
1075
|
+
"title-after": d(() => [
|
|
1076
|
+
x.value ? (i(), I(e(al), {
|
|
1090
1077
|
key: 0,
|
|
1091
|
-
name:
|
|
1078
|
+
name: m.title,
|
|
1092
1079
|
placeholder: e(n)("page.title"),
|
|
1093
|
-
onRename: h[0] || (h[0] = ($) =>
|
|
1094
|
-
}, null, 8, ["name", "placeholder"])) :
|
|
1095
|
-
|
|
1080
|
+
onRename: h[0] || (h[0] = ($) => m.title = $)
|
|
1081
|
+
}, null, 8, ["name", "placeholder"])) : N("", !0),
|
|
1082
|
+
K.value ? (i(), I(e(ue), {
|
|
1096
1083
|
key: 1,
|
|
1097
1084
|
type: "primary",
|
|
1098
1085
|
dot: ""
|
|
1099
1086
|
}, {
|
|
1100
|
-
default:
|
|
1087
|
+
default: d(() => [
|
|
1101
1088
|
W(_(e(n)("page.unsaved")), 1)
|
|
1102
1089
|
]),
|
|
1103
1090
|
_: 1
|
|
1104
|
-
})) :
|
|
1105
|
-
|
|
1091
|
+
})) : N("", !0),
|
|
1092
|
+
v.value.draft ? (i(), I(e(ue), {
|
|
1106
1093
|
key: 2,
|
|
1107
1094
|
type: "warning",
|
|
1108
1095
|
dot: ""
|
|
1109
1096
|
}, {
|
|
1110
|
-
default:
|
|
1111
|
-
W(_(e(n)("page.draft", { number:
|
|
1097
|
+
default: d(() => [
|
|
1098
|
+
W(_(e(n)("page.draft", { number: v.value.draft.number })), 1)
|
|
1112
1099
|
]),
|
|
1113
1100
|
_: 1
|
|
1114
|
-
})) :
|
|
1115
|
-
|
|
1101
|
+
})) : N("", !0),
|
|
1102
|
+
v.value.published ? (i(), I(e(ue), {
|
|
1116
1103
|
key: 3,
|
|
1117
1104
|
type: "success",
|
|
1118
1105
|
dot: ""
|
|
1119
1106
|
}, {
|
|
1120
|
-
default:
|
|
1121
|
-
W(_(e(n)("page.live", { number:
|
|
1107
|
+
default: d(() => [
|
|
1108
|
+
W(_(e(n)("page.live", { number: v.value.published.number })), 1)
|
|
1122
1109
|
]),
|
|
1123
1110
|
_: 1
|
|
1124
|
-
})) : (i(),
|
|
1111
|
+
})) : (i(), I(e(ue), {
|
|
1125
1112
|
key: 4,
|
|
1126
1113
|
type: "default"
|
|
1127
1114
|
}, {
|
|
1128
|
-
default:
|
|
1115
|
+
default: d(() => [
|
|
1129
1116
|
W(_(e(n)("page.never-published")), 1)
|
|
1130
1117
|
]),
|
|
1131
1118
|
_: 1
|
|
1132
1119
|
}))
|
|
1133
1120
|
]),
|
|
1134
|
-
subtitle:
|
|
1135
|
-
|
|
1136
|
-
W(" · " + _(e(ze)(
|
|
1137
|
-
|
|
1121
|
+
subtitle: d(() => [
|
|
1122
|
+
E("code", null, _(m.slug), 1),
|
|
1123
|
+
W(" · " + _(e(ze)(m.group, e(n))) + " · ", 1),
|
|
1124
|
+
v.value.usage_count > 0 ? (i(), I(e(ul), {
|
|
1138
1125
|
key: 0,
|
|
1139
1126
|
title: e(n)("page.usage"),
|
|
1140
1127
|
width: 260,
|
|
1141
1128
|
align: "start"
|
|
1142
1129
|
}, {
|
|
1143
|
-
trigger:
|
|
1144
|
-
|
|
1130
|
+
trigger: d(() => [
|
|
1131
|
+
E("button", Yl, _(e(nt)(v.value.usage_count, e(n))), 1)
|
|
1145
1132
|
]),
|
|
1146
|
-
default:
|
|
1147
|
-
|
|
1148
|
-
(i(!0), S(
|
|
1133
|
+
default: d(() => [
|
|
1134
|
+
E("div", Zl, [
|
|
1135
|
+
(i(!0), S(j, null, ee(L.value, ($) => (i(), S("div", {
|
|
1149
1136
|
key: `${$.model}:${$.id}`,
|
|
1150
1137
|
class: "wx-block-editor__use"
|
|
1151
1138
|
}, [
|
|
1152
|
-
|
|
1153
|
-
$.published ?
|
|
1139
|
+
E("span", null, _($.title ?? `#${$.id}`), 1),
|
|
1140
|
+
$.published ? N("", !0) : (i(), I(e(ue), {
|
|
1154
1141
|
key: 0,
|
|
1155
1142
|
type: "warning",
|
|
1156
1143
|
size: "sm"
|
|
1157
1144
|
}, {
|
|
1158
|
-
default:
|
|
1145
|
+
default: d(() => [
|
|
1159
1146
|
W(_(e(n)("page.unpublished-page")), 1)
|
|
1160
1147
|
]),
|
|
1161
1148
|
_: 1
|
|
1162
1149
|
}))
|
|
1163
1150
|
]))), 128)),
|
|
1164
|
-
|
|
1151
|
+
p.value.length > L.value.length ? (i(), I(e(F), {
|
|
1165
1152
|
key: 0,
|
|
1166
1153
|
size: "sm",
|
|
1167
1154
|
tone: "muted"
|
|
1168
1155
|
}, {
|
|
1169
|
-
default:
|
|
1170
|
-
W(_(e(n)("page.usage-more", { count:
|
|
1156
|
+
default: d(() => [
|
|
1157
|
+
W(_(e(n)("page.usage-more", { count: p.value.length - L.value.length })), 1)
|
|
1171
1158
|
]),
|
|
1172
1159
|
_: 1
|
|
1173
|
-
})) :
|
|
1160
|
+
})) : N("", !0)
|
|
1174
1161
|
])
|
|
1175
1162
|
]),
|
|
1176
1163
|
_: 1
|
|
1177
|
-
}, 8, ["title"])) : (i(), S(
|
|
1178
|
-
W(_(e(
|
|
1164
|
+
}, 8, ["title"])) : (i(), S(j, { key: 1 }, [
|
|
1165
|
+
W(_(e(nt)(v.value.usage_count, e(n))), 1)
|
|
1179
1166
|
], 64))
|
|
1180
1167
|
]),
|
|
1181
1168
|
_: 1
|
|
1182
1169
|
}, 8, ["title", "back", "back-label", "actions"]),
|
|
1183
|
-
V.value.editing ?
|
|
1170
|
+
V.value.editing ? N("", !0) : (i(), I(e(Vt), {
|
|
1184
1171
|
key: 0,
|
|
1185
1172
|
type: "info",
|
|
1186
1173
|
variant: "soft",
|
|
1187
1174
|
description: e(n)("page.editing-off")
|
|
1188
1175
|
}, null, 8, ["description"])),
|
|
1189
|
-
|
|
1190
|
-
class:
|
|
1176
|
+
E("div", {
|
|
1177
|
+
class: $e(["wx-block-editor__columns", { "is-alone": !Ee.value }])
|
|
1191
1178
|
}, [
|
|
1192
1179
|
u(e(cl), {
|
|
1193
1180
|
modelValue: C.value,
|
|
1194
1181
|
"onUpdate:modelValue": h[14] || (h[14] = ($) => C.value = $),
|
|
1195
1182
|
"keep-alive": ""
|
|
1196
1183
|
}, {
|
|
1197
|
-
default:
|
|
1184
|
+
default: d(() => [
|
|
1198
1185
|
u(e(Le), {
|
|
1199
1186
|
value: "template",
|
|
1200
1187
|
label: e(n)("page.tab-template")
|
|
1201
1188
|
}, {
|
|
1202
|
-
default:
|
|
1203
|
-
|
|
1204
|
-
u(e(
|
|
1189
|
+
default: d(() => [
|
|
1190
|
+
E("div", Ql, [
|
|
1191
|
+
u(e(je), {
|
|
1205
1192
|
ref_key: "templateEditor",
|
|
1206
1193
|
ref: H,
|
|
1207
1194
|
modelValue: y.template,
|
|
@@ -1212,29 +1199,29 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1212
1199
|
"max-height": "70vh",
|
|
1213
1200
|
"line-wrapping": ""
|
|
1214
1201
|
}, null, 8, ["modelValue", "readonly"]),
|
|
1215
|
-
|
|
1216
|
-
u(e(
|
|
1202
|
+
_e.value.length ? (i(), S("div", Xl, [
|
|
1203
|
+
u(e(F), {
|
|
1217
1204
|
size: "sm",
|
|
1218
1205
|
tone: "muted"
|
|
1219
1206
|
}, {
|
|
1220
|
-
default:
|
|
1207
|
+
default: d(() => [
|
|
1221
1208
|
W(_(e(n)("page.insert-field")), 1)
|
|
1222
1209
|
]),
|
|
1223
1210
|
_: 1
|
|
1224
1211
|
}),
|
|
1225
|
-
(i(!0), S(
|
|
1212
|
+
(i(!0), S(j, null, ee(_e.value, ($) => (i(), S("button", {
|
|
1226
1213
|
key: $,
|
|
1227
1214
|
type: "button",
|
|
1228
1215
|
class: "wx-block-editor__pill",
|
|
1229
1216
|
disabled: !x.value,
|
|
1230
|
-
onClick: (He) =>
|
|
1231
|
-
textContent: _(
|
|
1217
|
+
onClick: (He) => ve($),
|
|
1218
|
+
textContent: _(Y($))
|
|
1232
1219
|
}, null, 8, en))), 128))
|
|
1233
|
-
])) :
|
|
1220
|
+
])) : N("", !0),
|
|
1234
1221
|
u(vt, {
|
|
1235
1222
|
file: "template",
|
|
1236
|
-
lints:
|
|
1237
|
-
slug:
|
|
1223
|
+
lints: Se.value,
|
|
1224
|
+
slug: m.slug,
|
|
1238
1225
|
error: Ve.value
|
|
1239
1226
|
}, null, 8, ["lints", "slug", "error"])
|
|
1240
1227
|
])
|
|
@@ -1245,9 +1232,9 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1245
1232
|
value: "styles",
|
|
1246
1233
|
label: e(n)("page.tab-styles")
|
|
1247
1234
|
}, {
|
|
1248
|
-
default:
|
|
1249
|
-
|
|
1250
|
-
u(e(
|
|
1235
|
+
default: d(() => [
|
|
1236
|
+
E("div", tn, [
|
|
1237
|
+
u(e(je), {
|
|
1251
1238
|
modelValue: y.styles,
|
|
1252
1239
|
"onUpdate:modelValue": h[2] || (h[2] = ($) => y.styles = $),
|
|
1253
1240
|
language: "css",
|
|
@@ -1257,8 +1244,8 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1257
1244
|
}, null, 8, ["modelValue", "readonly"]),
|
|
1258
1245
|
u(vt, {
|
|
1259
1246
|
file: "styles",
|
|
1260
|
-
lints:
|
|
1261
|
-
slug:
|
|
1247
|
+
lints: Se.value,
|
|
1248
|
+
slug: m.slug
|
|
1262
1249
|
}, null, 8, ["lints", "slug"])
|
|
1263
1250
|
])
|
|
1264
1251
|
]),
|
|
@@ -1268,9 +1255,9 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1268
1255
|
value: "script",
|
|
1269
1256
|
label: e(n)("page.tab-script")
|
|
1270
1257
|
}, {
|
|
1271
|
-
default:
|
|
1272
|
-
|
|
1273
|
-
u(e(
|
|
1258
|
+
default: d(() => [
|
|
1259
|
+
E("div", ln, [
|
|
1260
|
+
u(e(je), {
|
|
1274
1261
|
"model-value": y.script ?? "",
|
|
1275
1262
|
language: "javascript",
|
|
1276
1263
|
readonly: !x.value,
|
|
@@ -1278,21 +1265,21 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1278
1265
|
"max-height": "70vh",
|
|
1279
1266
|
"onUpdate:modelValue": h[3] || (h[3] = ($) => y.script = $ || null)
|
|
1280
1267
|
}, null, 8, ["model-value", "readonly"]),
|
|
1281
|
-
|
|
1282
|
-
u(e(
|
|
1268
|
+
E("div", nn, [
|
|
1269
|
+
u(e(F), {
|
|
1283
1270
|
size: "sm",
|
|
1284
1271
|
tone: "muted"
|
|
1285
1272
|
}, {
|
|
1286
|
-
default:
|
|
1273
|
+
default: d(() => [
|
|
1287
1274
|
W(_(e(n)("page.script-help")), 1)
|
|
1288
1275
|
]),
|
|
1289
1276
|
_: 1
|
|
1290
1277
|
}),
|
|
1291
|
-
u(e(
|
|
1278
|
+
u(e(F), {
|
|
1292
1279
|
size: "sm",
|
|
1293
1280
|
tone: "muted"
|
|
1294
1281
|
}, {
|
|
1295
|
-
default:
|
|
1282
|
+
default: d(() => [
|
|
1296
1283
|
W(_(V.value.provides.length ? e(n)("page.provides", { names: V.value.provides.join(", ") }) : e(n)("page.provides-none")), 1)
|
|
1297
1284
|
]),
|
|
1298
1285
|
_: 1
|
|
@@ -1303,22 +1290,22 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1303
1290
|
class: "wx-block-editor__examples",
|
|
1304
1291
|
title: e(n)("page.examples")
|
|
1305
1292
|
}, {
|
|
1306
|
-
default:
|
|
1307
|
-
(i(!0), S(
|
|
1293
|
+
default: d(() => [
|
|
1294
|
+
(i(!0), S(j, null, ee(w.value, ($) => (i(), S("div", {
|
|
1308
1295
|
key: $.title,
|
|
1309
1296
|
class: "wx-block-editor__example"
|
|
1310
1297
|
}, [
|
|
1311
|
-
u(e(
|
|
1298
|
+
u(e(F), {
|
|
1312
1299
|
size: "sm",
|
|
1313
1300
|
tone: "muted"
|
|
1314
1301
|
}, {
|
|
1315
|
-
default:
|
|
1302
|
+
default: d(() => [
|
|
1316
1303
|
W(_($.title), 1)
|
|
1317
1304
|
]),
|
|
1318
1305
|
_: 2
|
|
1319
1306
|
}, 1024),
|
|
1320
|
-
|
|
1321
|
-
|
|
1307
|
+
E("pre", null, [
|
|
1308
|
+
E("code", null, _($.code), 1)
|
|
1322
1309
|
])
|
|
1323
1310
|
]))), 128))
|
|
1324
1311
|
]),
|
|
@@ -1331,10 +1318,10 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1331
1318
|
value: "fields",
|
|
1332
1319
|
label: e(n)("page.tab-fields")
|
|
1333
1320
|
}, {
|
|
1334
|
-
default:
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
u(e(
|
|
1321
|
+
default: d(() => [
|
|
1322
|
+
E("div", an, [
|
|
1323
|
+
E("div", on, [
|
|
1324
|
+
u(e(je), {
|
|
1338
1325
|
"model-value": R.value,
|
|
1339
1326
|
language: "json",
|
|
1340
1327
|
lint: "",
|
|
@@ -1343,31 +1330,31 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1343
1330
|
"max-height": "70vh",
|
|
1344
1331
|
"onUpdate:modelValue": Ce
|
|
1345
1332
|
}, null, 8, ["model-value", "readonly"]),
|
|
1346
|
-
|
|
1347
|
-
|
|
1333
|
+
E("div", sn, [
|
|
1334
|
+
q.value ? (i(), I(e(F), {
|
|
1348
1335
|
key: 0,
|
|
1349
1336
|
size: "sm",
|
|
1350
1337
|
tone: "danger"
|
|
1351
1338
|
}, {
|
|
1352
|
-
default:
|
|
1353
|
-
W(_(
|
|
1339
|
+
default: d(() => [
|
|
1340
|
+
W(_(q.value), 1)
|
|
1354
1341
|
]),
|
|
1355
1342
|
_: 1
|
|
1356
|
-
})) :
|
|
1343
|
+
})) : M("content.schema") ? (i(), I(e(F), {
|
|
1357
1344
|
key: 1,
|
|
1358
1345
|
size: "sm",
|
|
1359
1346
|
tone: "danger"
|
|
1360
1347
|
}, {
|
|
1361
|
-
default:
|
|
1362
|
-
W(_(
|
|
1348
|
+
default: d(() => [
|
|
1349
|
+
W(_(M("content.schema")), 1)
|
|
1363
1350
|
]),
|
|
1364
1351
|
_: 1
|
|
1365
|
-
})) : (i(),
|
|
1352
|
+
})) : (i(), I(e(F), {
|
|
1366
1353
|
key: 2,
|
|
1367
1354
|
size: "sm",
|
|
1368
1355
|
tone: "muted"
|
|
1369
1356
|
}, {
|
|
1370
|
-
default:
|
|
1357
|
+
default: d(() => [
|
|
1371
1358
|
W(_(e(n)("page.fields-help")), 1)
|
|
1372
1359
|
]),
|
|
1373
1360
|
_: 1
|
|
@@ -1382,8 +1369,8 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1382
1369
|
class: "wx-block-editor__sample",
|
|
1383
1370
|
title: e(n)("page.sample")
|
|
1384
1371
|
}, {
|
|
1385
|
-
default:
|
|
1386
|
-
y.schema.length ? (i(),
|
|
1372
|
+
default: d(() => [
|
|
1373
|
+
y.schema.length ? (i(), I(e(zt), {
|
|
1387
1374
|
key: 0,
|
|
1388
1375
|
modelValue: se.value,
|
|
1389
1376
|
"onUpdate:modelValue": h[4] || (h[4] = ($) => se.value = $),
|
|
@@ -1393,7 +1380,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1393
1380
|
can: e(o).can,
|
|
1394
1381
|
disabled: !x.value,
|
|
1395
1382
|
size: "sm"
|
|
1396
|
-
}, null, 8, ["modelValue", "root", "types", "translate", "can", "disabled"])) :
|
|
1383
|
+
}, null, 8, ["modelValue", "root", "types", "translate", "can", "disabled"])) : N("", !0)
|
|
1397
1384
|
]),
|
|
1398
1385
|
_: 1
|
|
1399
1386
|
}, 8, ["title"])
|
|
@@ -1405,20 +1392,20 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1405
1392
|
value: "settings",
|
|
1406
1393
|
label: e(n)("page.tab-settings")
|
|
1407
1394
|
}, {
|
|
1408
|
-
default:
|
|
1395
|
+
default: d(() => [
|
|
1409
1396
|
u(e(Be), { class: "wx-block-editor__sheet" }, {
|
|
1410
|
-
default:
|
|
1411
|
-
|
|
1397
|
+
default: d(() => [
|
|
1398
|
+
E("div", rn, [
|
|
1412
1399
|
u(e(ne), {
|
|
1413
1400
|
label: e(n)("page.identifier"),
|
|
1414
1401
|
help: e(n)("page.identifier-help"),
|
|
1415
|
-
error:
|
|
1402
|
+
error: M("slug"),
|
|
1416
1403
|
disabled: !x.value
|
|
1417
1404
|
}, {
|
|
1418
|
-
default:
|
|
1405
|
+
default: d(() => [
|
|
1419
1406
|
u(e(Pe), {
|
|
1420
|
-
modelValue:
|
|
1421
|
-
"onUpdate:modelValue": h[5] || (h[5] = ($) =>
|
|
1407
|
+
modelValue: m.slug,
|
|
1408
|
+
"onUpdate:modelValue": h[5] || (h[5] = ($) => m.slug = $)
|
|
1422
1409
|
}, null, 8, ["modelValue"])
|
|
1423
1410
|
]),
|
|
1424
1411
|
_: 1
|
|
@@ -1426,14 +1413,14 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1426
1413
|
u(e(ne), {
|
|
1427
1414
|
label: e(n)("page.group"),
|
|
1428
1415
|
help: e(n)("page.group-help"),
|
|
1429
|
-
error:
|
|
1416
|
+
error: M("group"),
|
|
1430
1417
|
disabled: !x.value
|
|
1431
1418
|
}, {
|
|
1432
|
-
default:
|
|
1419
|
+
default: d(() => [
|
|
1433
1420
|
u(e(Et), {
|
|
1434
|
-
modelValue:
|
|
1435
|
-
"onUpdate:modelValue": h[6] || (h[6] = ($) =>
|
|
1436
|
-
options:
|
|
1421
|
+
modelValue: m.group,
|
|
1422
|
+
"onUpdate:modelValue": h[6] || (h[6] = ($) => m.group = $),
|
|
1423
|
+
options: pe.value
|
|
1437
1424
|
}, null, 8, ["modelValue", "options"])
|
|
1438
1425
|
]),
|
|
1439
1426
|
_: 1
|
|
@@ -1442,32 +1429,32 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1442
1429
|
class: "is-wide",
|
|
1443
1430
|
label: e(n)("page.description"),
|
|
1444
1431
|
help: e(n)("page.description-help"),
|
|
1445
|
-
error:
|
|
1432
|
+
error: M("description"),
|
|
1446
1433
|
disabled: !x.value
|
|
1447
1434
|
}, {
|
|
1448
|
-
default:
|
|
1435
|
+
default: d(() => [
|
|
1449
1436
|
u(e(dl), {
|
|
1450
|
-
"model-value":
|
|
1437
|
+
"model-value": m.description ?? "",
|
|
1451
1438
|
rows: 2,
|
|
1452
|
-
"onUpdate:modelValue": h[7] || (h[7] = ($) =>
|
|
1439
|
+
"onUpdate:modelValue": h[7] || (h[7] = ($) => m.description = String($ ?? ""))
|
|
1453
1440
|
}, null, 8, ["model-value"])
|
|
1454
1441
|
]),
|
|
1455
1442
|
_: 1
|
|
1456
1443
|
}, 8, ["label", "help", "error", "disabled"]),
|
|
1457
1444
|
u(e(ne), {
|
|
1458
1445
|
label: e(n)("page.icon"),
|
|
1459
|
-
error:
|
|
1446
|
+
error: M("icon"),
|
|
1460
1447
|
disabled: !x.value
|
|
1461
1448
|
}, {
|
|
1462
|
-
default:
|
|
1449
|
+
default: d(() => [
|
|
1463
1450
|
u(e(pl), {
|
|
1464
|
-
"model-value":
|
|
1451
|
+
"model-value": m.icon,
|
|
1465
1452
|
clearable: "",
|
|
1466
1453
|
placeholder: e(n)("page.icon-search"),
|
|
1467
1454
|
"empty-text": e(n)("page.icon-none"),
|
|
1468
1455
|
"unknown-text": e(n)("page.icon-unknown"),
|
|
1469
1456
|
"clear-label": e(n)("page.icon-clear"),
|
|
1470
|
-
"onUpdate:modelValue": h[8] || (h[8] = ($) =>
|
|
1457
|
+
"onUpdate:modelValue": h[8] || (h[8] = ($) => m.icon = $)
|
|
1471
1458
|
}, null, 8, ["model-value", "placeholder", "empty-text", "unknown-text", "clear-label"])
|
|
1472
1459
|
]),
|
|
1473
1460
|
_: 1
|
|
@@ -1475,13 +1462,13 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1475
1462
|
u(e(ne), {
|
|
1476
1463
|
label: e(n)("page.sort"),
|
|
1477
1464
|
help: e(n)("page.sort-help"),
|
|
1478
|
-
error:
|
|
1465
|
+
error: M("sort"),
|
|
1479
1466
|
disabled: !x.value
|
|
1480
1467
|
}, {
|
|
1481
|
-
default:
|
|
1468
|
+
default: d(() => [
|
|
1482
1469
|
u(e(dt), {
|
|
1483
|
-
modelValue:
|
|
1484
|
-
"onUpdate:modelValue": h[9] || (h[9] = ($) =>
|
|
1470
|
+
modelValue: m.sort,
|
|
1471
|
+
"onUpdate:modelValue": h[9] || (h[9] = ($) => m.sort = $)
|
|
1485
1472
|
}, null, 8, ["modelValue"])
|
|
1486
1473
|
]),
|
|
1487
1474
|
_: 1
|
|
@@ -1489,13 +1476,13 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1489
1476
|
u(e(ne), {
|
|
1490
1477
|
label: e(n)("page.allow"),
|
|
1491
1478
|
help: e(n)("page.allow-help"),
|
|
1492
|
-
error:
|
|
1479
|
+
error: M("allow"),
|
|
1493
1480
|
disabled: !x.value
|
|
1494
1481
|
}, {
|
|
1495
|
-
default:
|
|
1482
|
+
default: d(() => [
|
|
1496
1483
|
u(e(pt), {
|
|
1497
|
-
modelValue:
|
|
1498
|
-
"onUpdate:modelValue": h[10] || (h[10] = ($) =>
|
|
1484
|
+
modelValue: m.allow,
|
|
1485
|
+
"onUpdate:modelValue": h[10] || (h[10] = ($) => m.allow = $),
|
|
1499
1486
|
"allow-create": ""
|
|
1500
1487
|
}, null, 8, ["modelValue"])
|
|
1501
1488
|
]),
|
|
@@ -1504,13 +1491,13 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1504
1491
|
u(e(ne), {
|
|
1505
1492
|
label: e(n)("page.allowed-in"),
|
|
1506
1493
|
help: e(n)("page.allowed-in-help"),
|
|
1507
|
-
error:
|
|
1494
|
+
error: M("allowed_in"),
|
|
1508
1495
|
disabled: !x.value
|
|
1509
1496
|
}, {
|
|
1510
|
-
default:
|
|
1497
|
+
default: d(() => [
|
|
1511
1498
|
u(e(pt), {
|
|
1512
|
-
modelValue:
|
|
1513
|
-
"onUpdate:modelValue": h[11] || (h[11] = ($) =>
|
|
1499
|
+
modelValue: m.allowed_in,
|
|
1500
|
+
"onUpdate:modelValue": h[11] || (h[11] = ($) => m.allowed_in = $),
|
|
1514
1501
|
"allow-create": "",
|
|
1515
1502
|
suggestions: ["root"]
|
|
1516
1503
|
}, null, 8, ["modelValue"])
|
|
@@ -1520,14 +1507,14 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1520
1507
|
u(e(ne), {
|
|
1521
1508
|
label: e(n)("page.max-per-entity"),
|
|
1522
1509
|
help: e(n)("page.max-per-entity-help"),
|
|
1523
|
-
error:
|
|
1510
|
+
error: M("max_per_entity"),
|
|
1524
1511
|
disabled: !x.value
|
|
1525
1512
|
}, {
|
|
1526
|
-
default:
|
|
1513
|
+
default: d(() => [
|
|
1527
1514
|
u(e(dt), {
|
|
1528
|
-
"model-value":
|
|
1515
|
+
"model-value": m.max_per_entity ?? void 0,
|
|
1529
1516
|
min: 1,
|
|
1530
|
-
"onUpdate:modelValue": h[12] || (h[12] = ($) =>
|
|
1517
|
+
"onUpdate:modelValue": h[12] || (h[12] = ($) => m.max_per_entity = $ ?? null)
|
|
1531
1518
|
}, null, 8, ["model-value"])
|
|
1532
1519
|
]),
|
|
1533
1520
|
_: 1
|
|
@@ -1537,10 +1524,10 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1537
1524
|
help: e(n)("page.enabled-help"),
|
|
1538
1525
|
disabled: !x.value
|
|
1539
1526
|
}, {
|
|
1540
|
-
default:
|
|
1527
|
+
default: d(() => [
|
|
1541
1528
|
u(e(vl), {
|
|
1542
|
-
modelValue:
|
|
1543
|
-
"onUpdate:modelValue": h[13] || (h[13] = ($) =>
|
|
1529
|
+
modelValue: m.is_enabled,
|
|
1530
|
+
"onUpdate:modelValue": h[13] || (h[13] = ($) => m.is_enabled = $)
|
|
1544
1531
|
}, null, 8, ["modelValue"])
|
|
1545
1532
|
]),
|
|
1546
1533
|
_: 1
|
|
@@ -1549,25 +1536,25 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1549
1536
|
u(e(ce), {
|
|
1550
1537
|
type: "danger",
|
|
1551
1538
|
variant: "outline",
|
|
1552
|
-
disabled:
|
|
1553
|
-
onClick:
|
|
1539
|
+
disabled: v.value.usage_count > 0,
|
|
1540
|
+
onClick: we
|
|
1554
1541
|
}, {
|
|
1555
|
-
default:
|
|
1542
|
+
default: d(() => [
|
|
1556
1543
|
W(_(e(n)("page.delete")), 1)
|
|
1557
1544
|
]),
|
|
1558
1545
|
_: 1
|
|
1559
1546
|
}, 8, ["disabled"]),
|
|
1560
|
-
|
|
1547
|
+
v.value.usage_count > 0 ? (i(), I(e(F), {
|
|
1561
1548
|
key: 0,
|
|
1562
1549
|
size: "sm",
|
|
1563
1550
|
tone: "muted"
|
|
1564
1551
|
}, {
|
|
1565
|
-
default:
|
|
1566
|
-
W(_(
|
|
1552
|
+
default: d(() => [
|
|
1553
|
+
W(_(v.value.usage_count === 1 ? e(n)("page.delete-used-one") : e(n)("page.delete-used", { count: v.value.usage_count })), 1)
|
|
1567
1554
|
]),
|
|
1568
1555
|
_: 1
|
|
1569
|
-
})) :
|
|
1570
|
-
])) :
|
|
1556
|
+
})) : N("", !0)
|
|
1557
|
+
])) : N("", !0)
|
|
1571
1558
|
])
|
|
1572
1559
|
]),
|
|
1573
1560
|
_: 1
|
|
@@ -1579,16 +1566,16 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1579
1566
|
value: "history",
|
|
1580
1567
|
label: e(n)("page.tab-history")
|
|
1581
1568
|
}, {
|
|
1582
|
-
default:
|
|
1569
|
+
default: d(() => [
|
|
1583
1570
|
u(e(Be), {
|
|
1584
1571
|
class: "wx-block-editor__sheet",
|
|
1585
1572
|
padding: "none"
|
|
1586
1573
|
}, {
|
|
1587
|
-
default:
|
|
1574
|
+
default: d(() => [
|
|
1588
1575
|
u(Sl, {
|
|
1589
|
-
block:
|
|
1576
|
+
block: v.value,
|
|
1590
1577
|
"can-manage": x.value,
|
|
1591
|
-
onRestored:
|
|
1578
|
+
onRestored: ke
|
|
1592
1579
|
}, null, 8, ["block", "can-manage"])
|
|
1593
1580
|
]),
|
|
1594
1581
|
_: 1
|
|
@@ -1601,42 +1588,42 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1601
1588
|
}, 8, ["modelValue"]),
|
|
1602
1589
|
Jt(u(zl, {
|
|
1603
1590
|
class: "wx-block-editor__stage",
|
|
1604
|
-
html:
|
|
1605
|
-
styles:
|
|
1606
|
-
script:
|
|
1607
|
-
runtime:
|
|
1608
|
-
stage:
|
|
1609
|
-
loading:
|
|
1591
|
+
html: B.html,
|
|
1592
|
+
styles: B.styles,
|
|
1593
|
+
script: B.script,
|
|
1594
|
+
runtime: B.runtime,
|
|
1595
|
+
stage: B.stage,
|
|
1596
|
+
loading: B.loading
|
|
1610
1597
|
}, null, 8, ["html", "styles", "script", "runtime", "stage", "loading"]), [
|
|
1611
1598
|
[Kt, Ee.value]
|
|
1612
1599
|
])
|
|
1613
1600
|
], 2),
|
|
1614
|
-
x.value ? (i(),
|
|
1615
|
-
default:
|
|
1601
|
+
x.value ? (i(), I(e(fl), { key: 1 }, {
|
|
1602
|
+
default: d(() => [
|
|
1616
1603
|
u(e(ce), {
|
|
1617
1604
|
variant: "outline",
|
|
1618
|
-
loading:
|
|
1619
|
-
onClick:
|
|
1605
|
+
loading: f.value,
|
|
1606
|
+
onClick: me
|
|
1620
1607
|
}, {
|
|
1621
|
-
default:
|
|
1608
|
+
default: d(() => [
|
|
1622
1609
|
W(_(e(n)("page.save")), 1)
|
|
1623
1610
|
]),
|
|
1624
1611
|
_: 1
|
|
1625
1612
|
}, 8, ["loading"]),
|
|
1626
1613
|
u(e(ce), {
|
|
1627
1614
|
type: "primary",
|
|
1628
|
-
loading:
|
|
1629
|
-
disabled: !
|
|
1615
|
+
loading: k.value,
|
|
1616
|
+
disabled: !v.value.draft && !K.value,
|
|
1630
1617
|
onClick: ie
|
|
1631
1618
|
}, {
|
|
1632
|
-
default:
|
|
1619
|
+
default: d(() => [
|
|
1633
1620
|
W(_(e(n)("page.publish")), 1)
|
|
1634
1621
|
]),
|
|
1635
1622
|
_: 1
|
|
1636
1623
|
}, 8, ["loading", "disabled"])
|
|
1637
1624
|
]),
|
|
1638
1625
|
_: 1
|
|
1639
|
-
})) :
|
|
1626
|
+
})) : N("", !0)
|
|
1640
1627
|
], 64))
|
|
1641
1628
|
]));
|
|
1642
1629
|
}
|
|
@@ -1651,33 +1638,33 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1651
1638
|
height: { default: 120 }
|
|
1652
1639
|
},
|
|
1653
1640
|
setup(t) {
|
|
1654
|
-
const l = t, o =
|
|
1641
|
+
const l = t, o = U(null), a = Ye(o), s = T(() => a.value > 0 ? a.value / l.width : 0.2), r = T(
|
|
1655
1642
|
() => l.thumbnail ? Pt({ html: l.thumbnail.html, styles: l.thumbnail.styles }) : ""
|
|
1656
1643
|
), n = T(() => ({
|
|
1657
1644
|
width: `${l.width}px`,
|
|
1658
1645
|
height: `${Math.round(l.height / s.value)}px`,
|
|
1659
1646
|
transform: `scale(${s.value})`
|
|
1660
1647
|
}));
|
|
1661
|
-
return (b,
|
|
1648
|
+
return (b, P) => (i(), S("div", {
|
|
1662
1649
|
ref_key: "box",
|
|
1663
1650
|
ref: o,
|
|
1664
1651
|
class: "wx-block-thumb",
|
|
1665
|
-
style:
|
|
1652
|
+
style: xe({ height: `${t.height}px` })
|
|
1666
1653
|
}, [
|
|
1667
1654
|
t.thumbnail ? (i(), S("iframe", {
|
|
1668
1655
|
key: 0,
|
|
1669
1656
|
class: "wx-block-thumb__frame",
|
|
1670
1657
|
srcdoc: r.value,
|
|
1671
|
-
style:
|
|
1658
|
+
style: xe(n.value),
|
|
1672
1659
|
sandbox: "allow-same-origin",
|
|
1673
1660
|
tabindex: "-1",
|
|
1674
1661
|
"aria-hidden": "true"
|
|
1675
1662
|
}, null, 12, pn)) : (i(), S("div", vn, [
|
|
1676
|
-
u(e(
|
|
1663
|
+
u(e(be), { name: "grid" })
|
|
1677
1664
|
]))
|
|
1678
1665
|
], 4));
|
|
1679
1666
|
}
|
|
1680
|
-
}),
|
|
1667
|
+
}), Ft = /* @__PURE__ */ oe(fn, [["__scopeId", "data-v-615b818a"]]), mn = { class: "wx-block-picker" }, hn = {
|
|
1681
1668
|
key: 0,
|
|
1682
1669
|
class: "wx-block-picker__group-title"
|
|
1683
1670
|
}, bn = { class: "wx-block-picker__cards" }, gn = ["disabled", "title", "onClick"], kn = { class: "wx-block-picker__body" }, yn = { class: "wx-block-picker__title" }, wn = /* @__PURE__ */ ae({
|
|
@@ -1693,130 +1680,130 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1693
1680
|
setup(t) {
|
|
1694
1681
|
const l = t, { resolve: o, dismiss: a, open: s } = Bt();
|
|
1695
1682
|
Re();
|
|
1696
|
-
const r = de("webx-blocks"), n =
|
|
1697
|
-
function b(
|
|
1683
|
+
const r = de("webx-blocks"), n = U("");
|
|
1684
|
+
function b(f) {
|
|
1698
1685
|
if (l.parent === null)
|
|
1699
|
-
return
|
|
1700
|
-
const
|
|
1701
|
-
return
|
|
1702
|
-
}
|
|
1703
|
-
const
|
|
1704
|
-
() => l.catalog.filter((
|
|
1705
|
-
const
|
|
1706
|
-
return { type:
|
|
1686
|
+
return f.allowed_in === null || f.allowed_in.includes("root");
|
|
1687
|
+
const k = l.allow ? l.allow.includes(f.slug) : l.parent.allow?.includes(f.slug) === !0, C = f.allowed_in === null || f.allowed_in.includes(l.parent.slug);
|
|
1688
|
+
return k && C;
|
|
1689
|
+
}
|
|
1690
|
+
const P = T(
|
|
1691
|
+
() => l.catalog.filter((f) => f.is_enabled && f.published !== null && b(f)).map((f) => {
|
|
1692
|
+
const k = Nl(l.tree, f.slug), C = f.max_per_entity !== null && k >= f.max_per_entity;
|
|
1693
|
+
return { type: f, reason: C ? r("field.limit-reached", { count: k }) : null };
|
|
1707
1694
|
})
|
|
1708
|
-
),
|
|
1709
|
-
const
|
|
1710
|
-
return
|
|
1711
|
-
({ type:
|
|
1695
|
+
), v = T(() => {
|
|
1696
|
+
const f = n.value.trim().toLowerCase();
|
|
1697
|
+
return f === "" ? P.value : P.value.filter(
|
|
1698
|
+
({ type: k }) => k.title.toLowerCase().includes(f) || k.slug.includes(f) || (k.description ?? "").toLowerCase().includes(f)
|
|
1712
1699
|
);
|
|
1713
|
-
}),
|
|
1714
|
-
const
|
|
1715
|
-
for (const { type: V } of
|
|
1716
|
-
|
|
1717
|
-
const
|
|
1700
|
+
}), p = T(() => {
|
|
1701
|
+
const f = [...l.groups];
|
|
1702
|
+
for (const { type: V } of v.value)
|
|
1703
|
+
f.includes(V.group) || f.push(V.group);
|
|
1704
|
+
const k = f.map((V) => ({
|
|
1718
1705
|
id: V,
|
|
1719
1706
|
label: ze(V, r),
|
|
1720
|
-
options:
|
|
1707
|
+
options: v.value.filter((x) => x.type.group === V)
|
|
1721
1708
|
})).filter((V) => V.options.length > 0);
|
|
1722
|
-
return
|
|
1723
|
-
}),
|
|
1709
|
+
return v.value.length <= 5 || n.value.trim() !== "" || k.length < 2 ? [{ id: "", label: "", options: v.value }] : k;
|
|
1710
|
+
}), g = T(() => {
|
|
1724
1711
|
if (l.catalog.length === 0) return r("field.pick-none");
|
|
1725
|
-
if (
|
|
1726
|
-
const
|
|
1727
|
-
(
|
|
1712
|
+
if (P.value.length === 0 && l.parent) {
|
|
1713
|
+
const f = (l.allow ?? l.parent.allow ?? []).filter(
|
|
1714
|
+
(k) => l.catalog.some((C) => C.slug === k)
|
|
1728
1715
|
);
|
|
1729
|
-
return
|
|
1716
|
+
return f.length === 0 ? r("field.pick-nothing-allowed", { parent: l.parent.title }) : r("field.pick-limited", { parent: l.parent.title, types: f.join(", ") });
|
|
1730
1717
|
}
|
|
1731
1718
|
return r("field.pick-empty");
|
|
1732
1719
|
});
|
|
1733
|
-
return (
|
|
1720
|
+
return (f, k) => {
|
|
1734
1721
|
const C = xt("router-link");
|
|
1735
|
-
return i(),
|
|
1722
|
+
return i(), I(e(Lt), {
|
|
1736
1723
|
open: e(s),
|
|
1737
|
-
"onUpdate:open":
|
|
1724
|
+
"onUpdate:open": k[2] || (k[2] = (V) => $t(s) ? s.value = V : null),
|
|
1738
1725
|
title: e(r)("field.pick"),
|
|
1739
1726
|
width: 860
|
|
1740
1727
|
}, {
|
|
1741
|
-
footer:
|
|
1728
|
+
footer: d(() => [
|
|
1742
1729
|
u(e(ce), {
|
|
1743
1730
|
variant: "outline",
|
|
1744
|
-
onClick:
|
|
1731
|
+
onClick: k[1] || (k[1] = (V) => e(a)())
|
|
1745
1732
|
}, {
|
|
1746
|
-
default:
|
|
1733
|
+
default: d(() => [
|
|
1747
1734
|
W(_(e(r)("field.close")), 1)
|
|
1748
1735
|
]),
|
|
1749
1736
|
_: 1
|
|
1750
1737
|
})
|
|
1751
1738
|
]),
|
|
1752
|
-
default:
|
|
1753
|
-
|
|
1754
|
-
|
|
1739
|
+
default: d(() => [
|
|
1740
|
+
E("div", mn, [
|
|
1741
|
+
P.value.length > 0 ? (i(), I(e(Pe), {
|
|
1755
1742
|
key: 0,
|
|
1756
1743
|
modelValue: n.value,
|
|
1757
|
-
"onUpdate:modelValue":
|
|
1744
|
+
"onUpdate:modelValue": k[0] || (k[0] = (V) => n.value = V),
|
|
1758
1745
|
placeholder: e(r)("field.search"),
|
|
1759
1746
|
clearable: "",
|
|
1760
1747
|
autofocus: ""
|
|
1761
|
-
}, null, 8, ["modelValue", "placeholder"])) :
|
|
1762
|
-
|
|
1748
|
+
}, null, 8, ["modelValue", "placeholder"])) : N("", !0),
|
|
1749
|
+
v.value.length === 0 ? (i(), I(e(Wt), {
|
|
1763
1750
|
key: 1,
|
|
1764
1751
|
icon: "grid",
|
|
1765
|
-
title:
|
|
1752
|
+
title: g.value,
|
|
1766
1753
|
size: "sm"
|
|
1767
1754
|
}, {
|
|
1768
|
-
default:
|
|
1769
|
-
t.catalog.length === 0 && t.blocksPath ? (i(),
|
|
1755
|
+
default: d(() => [
|
|
1756
|
+
t.catalog.length === 0 && t.blocksPath ? (i(), I(C, {
|
|
1770
1757
|
key: 0,
|
|
1771
1758
|
to: t.blocksPath
|
|
1772
1759
|
}, {
|
|
1773
|
-
default:
|
|
1760
|
+
default: d(() => [
|
|
1774
1761
|
W(_(e(r)("field.pick-none-link")), 1)
|
|
1775
1762
|
]),
|
|
1776
1763
|
_: 1
|
|
1777
|
-
}, 8, ["to"])) :
|
|
1764
|
+
}, 8, ["to"])) : N("", !0)
|
|
1778
1765
|
]),
|
|
1779
1766
|
_: 1
|
|
1780
|
-
}, 8, ["title"])) :
|
|
1781
|
-
(i(!0), S(
|
|
1767
|
+
}, 8, ["title"])) : N("", !0),
|
|
1768
|
+
(i(!0), S(j, null, ee(p.value, (V) => (i(), S("section", {
|
|
1782
1769
|
key: V.id,
|
|
1783
1770
|
class: "wx-block-picker__group"
|
|
1784
1771
|
}, [
|
|
1785
|
-
V.label ? (i(), S("div", hn, _(V.label), 1)) :
|
|
1786
|
-
|
|
1787
|
-
(i(!0), S(
|
|
1772
|
+
V.label ? (i(), S("div", hn, _(V.label), 1)) : N("", !0),
|
|
1773
|
+
E("div", bn, [
|
|
1774
|
+
(i(!0), S(j, null, ee(V.options, (x) => (i(), S("button", {
|
|
1788
1775
|
key: x.type.id,
|
|
1789
1776
|
type: "button",
|
|
1790
|
-
class:
|
|
1777
|
+
class: $e(["wx-block-picker__card", { "is-disabled": x.reason !== null }]),
|
|
1791
1778
|
disabled: x.reason !== null,
|
|
1792
1779
|
title: x.reason ?? void 0,
|
|
1793
|
-
onClick: (
|
|
1780
|
+
onClick: (m) => e(o)(x.type)
|
|
1794
1781
|
}, [
|
|
1795
|
-
u(
|
|
1782
|
+
u(Ft, {
|
|
1796
1783
|
thumbnail: x.type.thumbnail,
|
|
1797
1784
|
height: 96
|
|
1798
1785
|
}, null, 8, ["thumbnail"]),
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
x.reason ? (i(),
|
|
1786
|
+
E("div", kn, [
|
|
1787
|
+
E("div", yn, _(x.type.title), 1),
|
|
1788
|
+
x.reason ? (i(), I(e(F), {
|
|
1802
1789
|
key: 0,
|
|
1803
1790
|
size: "sm",
|
|
1804
1791
|
tone: "warning"
|
|
1805
1792
|
}, {
|
|
1806
|
-
default:
|
|
1793
|
+
default: d(() => [
|
|
1807
1794
|
W(_(x.reason), 1)
|
|
1808
1795
|
]),
|
|
1809
1796
|
_: 2
|
|
1810
|
-
}, 1024)) : x.type.description ? (i(),
|
|
1797
|
+
}, 1024)) : x.type.description ? (i(), I(e(F), {
|
|
1811
1798
|
key: 1,
|
|
1812
1799
|
size: "sm",
|
|
1813
1800
|
tone: "muted"
|
|
1814
1801
|
}, {
|
|
1815
|
-
default:
|
|
1802
|
+
default: d(() => [
|
|
1816
1803
|
W(_(x.type.description), 1)
|
|
1817
1804
|
]),
|
|
1818
1805
|
_: 2
|
|
1819
|
-
}, 1024)) :
|
|
1806
|
+
}, 1024)) : N("", !0)
|
|
1820
1807
|
])
|
|
1821
1808
|
], 10, gn))), 128))
|
|
1822
1809
|
])
|
|
@@ -1837,18 +1824,18 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1837
1824
|
},
|
|
1838
1825
|
emits: ["select", "edit"],
|
|
1839
1826
|
setup(t, { expose: l, emit: o }) {
|
|
1840
|
-
const a = t, s = o, r = de("webx-blocks"), n =
|
|
1827
|
+
const a = t, s = o, r = de("webx-blocks"), n = U(null), b = U(null), P = U(null), v = Ye(P), p = U(!1), g = U(!1), f = U(null), k = U(0), C = T(() => k.value > 0), V = T(() => [
|
|
1841
1828
|
{ value: 1280, icon: "monitor", ariaLabel: r("field.width-desktop") },
|
|
1842
1829
|
{ value: 834, icon: "tablet", ariaLabel: r("field.width-tablet") },
|
|
1843
1830
|
{ value: 390, icon: "smartphone", ariaLabel: r("field.width-phone") }
|
|
1844
|
-
]), x = T(() =>
|
|
1831
|
+
]), x = T(() => f.value !== null ? f.value : a.compact ? v.value > 0 && v.value < 560 ? 390 : 834 : 1280), m = T(() => v.value === 0 ? 1 : Math.min(1, v.value / x.value)), y = T(() => ({
|
|
1845
1832
|
width: `${x.value}px`,
|
|
1846
|
-
transform: `scale(${
|
|
1847
|
-
...C.value ? { height: `${
|
|
1833
|
+
transform: `scale(${m.value})`,
|
|
1834
|
+
...C.value ? { height: `${k.value}px` } : {}
|
|
1848
1835
|
})), R = T(() => ({
|
|
1849
|
-
width: `${Math.round(x.value *
|
|
1850
|
-
...C.value ? { height: `${Math.round(
|
|
1851
|
-
})),
|
|
1836
|
+
width: `${Math.round(x.value * m.value)}px`,
|
|
1837
|
+
...C.value ? { height: `${Math.round(k.value * m.value)}px` } : {}
|
|
1838
|
+
})), q = T(() => {
|
|
1852
1839
|
if (!a.url) return "";
|
|
1853
1840
|
try {
|
|
1854
1841
|
return `${new URL(a.url, location.origin).pathname} · ${x.value} px`;
|
|
@@ -1856,113 +1843,113 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1856
1843
|
return a.url;
|
|
1857
1844
|
}
|
|
1858
1845
|
});
|
|
1859
|
-
function
|
|
1846
|
+
function J() {
|
|
1860
1847
|
try {
|
|
1861
1848
|
return n.value?.contentDocument ?? null;
|
|
1862
1849
|
} catch {
|
|
1863
1850
|
return null;
|
|
1864
1851
|
}
|
|
1865
1852
|
}
|
|
1866
|
-
let Z = null,
|
|
1867
|
-
function
|
|
1868
|
-
|
|
1869
|
-
}
|
|
1870
|
-
function
|
|
1871
|
-
const
|
|
1872
|
-
if (!O || !
|
|
1873
|
-
|
|
1874
|
-
const H =
|
|
1875
|
-
|
|
1876
|
-
}
|
|
1877
|
-
function
|
|
1878
|
-
|
|
1879
|
-
const O =
|
|
1880
|
-
!O || !
|
|
1881
|
-
}
|
|
1882
|
-
function
|
|
1883
|
-
|
|
1884
|
-
const
|
|
1885
|
-
|
|
1853
|
+
let Z = null, c = null;
|
|
1854
|
+
function B(z) {
|
|
1855
|
+
z.documentElement.scrollTop !== 0 && (z.documentElement.scrollTop = 0);
|
|
1856
|
+
}
|
|
1857
|
+
function D() {
|
|
1858
|
+
const z = J(), O = z?.body;
|
|
1859
|
+
if (!O || !z?.defaultView) return;
|
|
1860
|
+
B(z);
|
|
1861
|
+
const H = z.defaultView.getComputedStyle(O), Y = (parseFloat(H.marginTop) || 0) + (parseFloat(H.marginBottom) || 0), ve = Math.ceil(O.scrollHeight + Y);
|
|
1862
|
+
ve !== k.value && (k.value = ve, pe !== null && Gt(() => requestAnimationFrame(te)));
|
|
1863
|
+
}
|
|
1864
|
+
function K(z) {
|
|
1865
|
+
c?.disconnect();
|
|
1866
|
+
const O = z.defaultView;
|
|
1867
|
+
!O || !z.body || (c = new O.ResizeObserver(D), c.observe(z.body), D());
|
|
1868
|
+
}
|
|
1869
|
+
function Se() {
|
|
1870
|
+
g.value = !0;
|
|
1871
|
+
const z = J();
|
|
1872
|
+
z && (K(z), Z?.release(), Z = Tl(z, {
|
|
1886
1873
|
/* No guard against answering a click with a scroll: `bring` moves nothing that is already
|
|
1887
1874
|
readable, and a block clicked at the very bottom of the window, half under the action
|
|
1888
1875
|
bar, is exactly the one worth moving. */
|
|
1889
1876
|
select: (O) => s("select", O)
|
|
1890
|
-
}),
|
|
1877
|
+
}), et(z, a.selected ?? null), _e(a.selected ?? null));
|
|
1891
1878
|
}
|
|
1892
|
-
let
|
|
1893
|
-
function
|
|
1894
|
-
|
|
1895
|
-
|
|
1879
|
+
let pe = null, se = null;
|
|
1880
|
+
function _e(z) {
|
|
1881
|
+
z !== null && (pe = z, se !== null && clearTimeout(se), se = window.setTimeout(() => {
|
|
1882
|
+
pe = null, se = null;
|
|
1896
1883
|
}, 400), te());
|
|
1897
1884
|
}
|
|
1898
|
-
function Te(
|
|
1885
|
+
function Te(z) {
|
|
1899
1886
|
const O = n.value?.getBoundingClientRect();
|
|
1900
1887
|
if (!O) return null;
|
|
1901
|
-
const H =
|
|
1902
|
-
return { top: O.top + H.top *
|
|
1903
|
-
}
|
|
1904
|
-
function
|
|
1905
|
-
let
|
|
1906
|
-
for (;
|
|
1907
|
-
const O = getComputedStyle(
|
|
1908
|
-
if ((O === "auto" || O === "scroll") &&
|
|
1909
|
-
return
|
|
1910
|
-
|
|
1888
|
+
const H = z.getBoundingClientRect();
|
|
1889
|
+
return { top: O.top + H.top * m.value, height: H.height * m.value };
|
|
1890
|
+
}
|
|
1891
|
+
function ke() {
|
|
1892
|
+
let z = n.value?.parentElement ?? null;
|
|
1893
|
+
for (; z; ) {
|
|
1894
|
+
const O = getComputedStyle(z).overflowY;
|
|
1895
|
+
if ((O === "auto" || O === "scroll") && z.scrollHeight > z.clientHeight)
|
|
1896
|
+
return z;
|
|
1897
|
+
z = z.parentElement;
|
|
1911
1898
|
}
|
|
1912
1899
|
return null;
|
|
1913
1900
|
}
|
|
1914
1901
|
function te() {
|
|
1915
|
-
const
|
|
1916
|
-
if (
|
|
1917
|
-
|
|
1918
|
-
const O =
|
|
1902
|
+
const z = J();
|
|
1903
|
+
if (pe === null || !z) return;
|
|
1904
|
+
B(z);
|
|
1905
|
+
const O = at(z, pe), H = O ? Te(O) : null;
|
|
1919
1906
|
if (!H) return;
|
|
1920
|
-
const
|
|
1921
|
-
top: (
|
|
1922
|
-
bottom: (
|
|
1923
|
-
},
|
|
1924
|
-
w !== 0 && (
|
|
1925
|
-
}
|
|
1926
|
-
function Ce(
|
|
1927
|
-
const H =
|
|
1928
|
-
if (!H || !
|
|
1929
|
-
const
|
|
1930
|
-
return
|
|
1907
|
+
const Y = ke(), ve = Y?.getBoundingClientRect(), me = b.value?.getBoundingClientRect().height ?? 0, ie = {
|
|
1908
|
+
top: (ve?.top ?? 0) + me,
|
|
1909
|
+
bottom: (ve ? ve.bottom : window.innerHeight) - me
|
|
1910
|
+
}, we = H.top + H.height, Ve = H.top < ie.top, Ee = H.height > ie.bottom - ie.top, w = Ve || Ee ? H.top - ie.top : we > ie.bottom ? we - ie.bottom : 0;
|
|
1911
|
+
w !== 0 && (Y ?? window).scrollBy({ top: w, behavior: "smooth" });
|
|
1912
|
+
}
|
|
1913
|
+
function Ce(z, O) {
|
|
1914
|
+
const H = J();
|
|
1915
|
+
if (!H || !g.value) return !1;
|
|
1916
|
+
const Y = Nt(H, z, O);
|
|
1917
|
+
return Y && et(H, a.selected ?? null), Y;
|
|
1931
1918
|
}
|
|
1932
|
-
function
|
|
1933
|
-
|
|
1919
|
+
function ye() {
|
|
1920
|
+
g.value = !1, c?.disconnect(), c = null, n.value && a.url && (n.value.src = a.url);
|
|
1934
1921
|
}
|
|
1935
|
-
function
|
|
1936
|
-
|
|
1922
|
+
function fe(z) {
|
|
1923
|
+
z.key === "Escape" && p.value && (p.value = !1, z.stopPropagation());
|
|
1937
1924
|
}
|
|
1938
1925
|
return X(
|
|
1939
1926
|
() => a.selected,
|
|
1940
|
-
(
|
|
1941
|
-
const O =
|
|
1942
|
-
!O || !
|
|
1927
|
+
(z) => {
|
|
1928
|
+
const O = J();
|
|
1929
|
+
!O || !g.value || (et(O, z ?? null), _e(z ?? null));
|
|
1943
1930
|
}
|
|
1944
|
-
), X(() => a.reload,
|
|
1931
|
+
), X(() => a.reload, ye), X(
|
|
1945
1932
|
() => a.url,
|
|
1946
|
-
() =>
|
|
1947
|
-
), Ue(() => window.addEventListener("keydown",
|
|
1948
|
-
window.removeEventListener("keydown",
|
|
1949
|
-
}), l({ replace: Ce, refresh:
|
|
1950
|
-
class:
|
|
1951
|
-
style:
|
|
1933
|
+
() => g.value = !1
|
|
1934
|
+
), Ue(() => window.addEventListener("keydown", fe)), Ge(() => {
|
|
1935
|
+
window.removeEventListener("keydown", fe), se !== null && clearTimeout(se), c?.disconnect(), Z?.release();
|
|
1936
|
+
}), l({ replace: Ce, refresh: ye, open: () => p.value = !0 }), (z, O) => (i(), S("div", {
|
|
1937
|
+
class: $e(["wx-blocks-preview", { "is-fullscreen": p.value, "is-grown": C.value, "is-compact": t.compact }]),
|
|
1938
|
+
style: xe({ "--wx-preview-scale": m.value })
|
|
1952
1939
|
}, [
|
|
1953
|
-
|
|
1940
|
+
E("div", {
|
|
1954
1941
|
ref_key: "bar",
|
|
1955
1942
|
ref: b,
|
|
1956
1943
|
class: "wx-blocks-preview__bar"
|
|
1957
1944
|
}, [
|
|
1958
|
-
u(e(
|
|
1945
|
+
u(e(F), {
|
|
1959
1946
|
size: "xs",
|
|
1960
1947
|
tone: "muted",
|
|
1961
1948
|
class: "wx-blocks-preview__label",
|
|
1962
1949
|
truncate: ""
|
|
1963
1950
|
}, {
|
|
1964
|
-
default:
|
|
1965
|
-
W(_(
|
|
1951
|
+
default: d(() => [
|
|
1952
|
+
W(_(q.value), 1)
|
|
1966
1953
|
]),
|
|
1967
1954
|
_: 1
|
|
1968
1955
|
}),
|
|
@@ -1972,18 +1959,18 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1972
1959
|
options: V.value,
|
|
1973
1960
|
size: "sm",
|
|
1974
1961
|
"aria-label": e(r)("field.width"),
|
|
1975
|
-
"onUpdate:modelValue": O[0] || (O[0] = (H) =>
|
|
1962
|
+
"onUpdate:modelValue": O[0] || (O[0] = (H) => f.value = Number(H))
|
|
1976
1963
|
}, null, 8, ["model-value", "options", "aria-label"]),
|
|
1977
|
-
|
|
1978
|
-
t.compact ? (i(),
|
|
1964
|
+
E("div", xn, [
|
|
1965
|
+
t.compact ? (i(), I(e(Ie), {
|
|
1979
1966
|
key: 0,
|
|
1980
1967
|
size: "sm",
|
|
1981
1968
|
tone: "primary",
|
|
1982
1969
|
icon: "edit",
|
|
1983
1970
|
title: e(r)("field.blocks"),
|
|
1984
1971
|
onClick: O[1] || (O[1] = (H) => s("edit"))
|
|
1985
|
-
}, null, 8, ["title"])) :
|
|
1986
|
-
t.url ? (i(),
|
|
1972
|
+
}, null, 8, ["title"])) : N("", !0),
|
|
1973
|
+
t.url ? (i(), I(e(Ie), {
|
|
1987
1974
|
key: 1,
|
|
1988
1975
|
size: "sm",
|
|
1989
1976
|
icon: "external-link",
|
|
@@ -1992,24 +1979,24 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1992
1979
|
href: t.url,
|
|
1993
1980
|
target: "_blank",
|
|
1994
1981
|
rel: "noopener"
|
|
1995
|
-
}, null, 8, ["title", "href"])) :
|
|
1982
|
+
}, null, 8, ["title", "href"])) : N("", !0),
|
|
1996
1983
|
u(e(Ie), {
|
|
1997
1984
|
size: "sm",
|
|
1998
|
-
icon:
|
|
1985
|
+
icon: p.value ? "minimize" : "maximize",
|
|
1999
1986
|
tone: "neutral",
|
|
2000
|
-
title:
|
|
2001
|
-
onClick: O[2] || (O[2] = (H) =>
|
|
1987
|
+
title: p.value ? e(r)("field.close") : e(r)("field.fullscreen"),
|
|
1988
|
+
onClick: O[2] || (O[2] = (H) => p.value = !p.value)
|
|
2002
1989
|
}, null, 8, ["icon", "title"])
|
|
2003
1990
|
])
|
|
2004
1991
|
], 512),
|
|
2005
|
-
|
|
1992
|
+
E("div", {
|
|
2006
1993
|
ref_key: "box",
|
|
2007
|
-
ref:
|
|
1994
|
+
ref: P,
|
|
2008
1995
|
class: "wx-blocks-preview__ground"
|
|
2009
1996
|
}, [
|
|
2010
|
-
|
|
1997
|
+
E("div", {
|
|
2011
1998
|
class: "wx-blocks-preview__clip",
|
|
2012
|
-
style:
|
|
1999
|
+
style: xe(R.value)
|
|
2013
2000
|
}, [
|
|
2014
2001
|
t.url ? (i(), S("iframe", {
|
|
2015
2002
|
key: 0,
|
|
@@ -2017,10 +2004,10 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2017
2004
|
ref: n,
|
|
2018
2005
|
class: "wx-blocks-preview__frame",
|
|
2019
2006
|
src: t.url,
|
|
2020
|
-
style:
|
|
2007
|
+
style: xe(y.value),
|
|
2021
2008
|
title: e(r)("field.preview"),
|
|
2022
|
-
onLoad:
|
|
2023
|
-
}, null, 44, $n)) :
|
|
2009
|
+
onLoad: Se
|
|
2010
|
+
}, null, 44, $n)) : N("", !0)
|
|
2024
2011
|
], 4)
|
|
2025
2012
|
], 512)
|
|
2026
2013
|
], 6));
|
|
@@ -2042,131 +2029,131 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2042
2029
|
emits: ["select", "add", "remove", "duplicate", "visibility", "reorder"],
|
|
2043
2030
|
setup(t, { emit: l }) {
|
|
2044
2031
|
const o = t, a = l, s = de("webx-blocks");
|
|
2045
|
-
function r(
|
|
2046
|
-
return o.catalog.find((
|
|
2032
|
+
function r(p) {
|
|
2033
|
+
return o.catalog.find((g) => g.slug === p.type) ?? null;
|
|
2047
2034
|
}
|
|
2048
|
-
function n(
|
|
2049
|
-
return r(
|
|
2035
|
+
function n(p) {
|
|
2036
|
+
return r(p)?.title ?? p.type;
|
|
2050
2037
|
}
|
|
2051
|
-
function b(
|
|
2052
|
-
const
|
|
2053
|
-
return
|
|
2038
|
+
function b(p) {
|
|
2039
|
+
const g = r(p);
|
|
2040
|
+
return g?.content ? Dt(g.content.schema) : [];
|
|
2054
2041
|
}
|
|
2055
|
-
function
|
|
2056
|
-
const
|
|
2057
|
-
return Array.isArray(
|
|
2042
|
+
function P(p, g) {
|
|
2043
|
+
const f = p.values[g.id];
|
|
2044
|
+
return Array.isArray(f) ? f : [];
|
|
2058
2045
|
}
|
|
2059
|
-
function p
|
|
2046
|
+
function v(p) {
|
|
2060
2047
|
return [
|
|
2061
2048
|
{
|
|
2062
2049
|
key: "visibility",
|
|
2063
|
-
icon:
|
|
2064
|
-
label:
|
|
2065
|
-
run: () => a("visibility",
|
|
2050
|
+
icon: p.hidden === !0 ? "eye" : "eye-off",
|
|
2051
|
+
label: p.hidden === !0 ? s("field.show") : s("field.hide"),
|
|
2052
|
+
run: () => a("visibility", p.key, p.hidden !== !0)
|
|
2066
2053
|
},
|
|
2067
2054
|
{
|
|
2068
2055
|
key: "duplicate",
|
|
2069
2056
|
icon: "copy",
|
|
2070
2057
|
label: s("field.duplicate"),
|
|
2071
|
-
run: () => a("duplicate",
|
|
2058
|
+
run: () => a("duplicate", p.key)
|
|
2072
2059
|
},
|
|
2073
2060
|
{
|
|
2074
2061
|
key: "remove",
|
|
2075
2062
|
icon: "trash",
|
|
2076
2063
|
label: s("field.remove"),
|
|
2077
2064
|
danger: !0,
|
|
2078
|
-
run: () => a("remove",
|
|
2065
|
+
run: () => a("remove", p.key)
|
|
2079
2066
|
}
|
|
2080
2067
|
];
|
|
2081
2068
|
}
|
|
2082
|
-
return (
|
|
2083
|
-
const
|
|
2084
|
-
return i(),
|
|
2069
|
+
return (p, g) => {
|
|
2070
|
+
const f = xt("blocks-tree", !0);
|
|
2071
|
+
return i(), I(e(ml), {
|
|
2085
2072
|
"model-value": t.nodes,
|
|
2086
2073
|
"item-key": "key",
|
|
2087
|
-
"item-label": (
|
|
2074
|
+
"item-label": (k) => n(k),
|
|
2088
2075
|
disabled: t.disabled,
|
|
2089
2076
|
plain: "",
|
|
2090
2077
|
size: "sm",
|
|
2091
2078
|
"empty-text": t.depth === 0 ? e(s)("field.empty") : "",
|
|
2092
|
-
class:
|
|
2093
|
-
"onUpdate:modelValue":
|
|
2079
|
+
class: $e(["wx-blocks-tree", { "is-nested": t.depth > 0 }]),
|
|
2080
|
+
"onUpdate:modelValue": g[6] || (g[6] = (k) => a("reorder", t.parentKey, t.field, k))
|
|
2094
2081
|
}, {
|
|
2095
|
-
default:
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
class:
|
|
2082
|
+
default: d(({ item: k }) => [
|
|
2083
|
+
E("div", Cn, [
|
|
2084
|
+
E("div", {
|
|
2085
|
+
class: $e(["wx-blocks-tree__row", { "is-selected": t.selected === k.key, "is-hidden": k.hidden === !0 }]),
|
|
2099
2086
|
role: "button",
|
|
2100
2087
|
tabindex: "0",
|
|
2101
|
-
onClick: (C) => a("select",
|
|
2088
|
+
onClick: (C) => a("select", k.key),
|
|
2102
2089
|
onKeydown: [
|
|
2103
|
-
ut(ct((C) => a("select",
|
|
2104
|
-
ut(ct((C) => a("select",
|
|
2090
|
+
ut(ct((C) => a("select", k.key), ["prevent"]), ["enter"]),
|
|
2091
|
+
ut(ct((C) => a("select", k.key), ["prevent"]), ["space"])
|
|
2105
2092
|
]
|
|
2106
2093
|
}, [
|
|
2107
|
-
|
|
2108
|
-
r(
|
|
2094
|
+
E("span", En, _(n(k)), 1),
|
|
2095
|
+
r(k) ? r(k)?.draft ? (i(), S("span", {
|
|
2109
2096
|
key: 1,
|
|
2110
2097
|
class: "wx-blocks-tree__flag is-warning",
|
|
2111
2098
|
title: e(s)("field.draft-type")
|
|
2112
2099
|
}, [
|
|
2113
|
-
u(e(
|
|
2114
|
-
], 8, Ln)) : r(
|
|
2100
|
+
u(e(be), { name: "warning" })
|
|
2101
|
+
], 8, Ln)) : r(k)?.is_enabled === !1 ? (i(), S("span", {
|
|
2115
2102
|
key: 2,
|
|
2116
2103
|
class: "wx-blocks-tree__flag",
|
|
2117
2104
|
title: e(s)("field.disabled-type")
|
|
2118
2105
|
}, [
|
|
2119
|
-
u(e(
|
|
2120
|
-
], 8, Wn)) :
|
|
2106
|
+
u(e(be), { name: "lock" })
|
|
2107
|
+
], 8, Wn)) : N("", !0) : (i(), S("span", {
|
|
2121
2108
|
key: 0,
|
|
2122
2109
|
class: "wx-blocks-tree__flag is-danger",
|
|
2123
|
-
title: e(s)("field.unknown-type", { type:
|
|
2110
|
+
title: e(s)("field.unknown-type", { type: k.type })
|
|
2124
2111
|
}, [
|
|
2125
|
-
u(e(
|
|
2112
|
+
u(e(be), { name: "close-circle" })
|
|
2126
2113
|
], 8, Bn)),
|
|
2127
|
-
|
|
2114
|
+
k.hidden === !0 ? (i(), S("span", {
|
|
2128
2115
|
key: 3,
|
|
2129
2116
|
class: "wx-blocks-tree__flag",
|
|
2130
2117
|
title: e(s)("field.hidden-note")
|
|
2131
2118
|
}, [
|
|
2132
|
-
u(e(
|
|
2133
|
-
], 8, An)) :
|
|
2134
|
-
t.disabled ?
|
|
2119
|
+
u(e(be), { name: "eye-off" })
|
|
2120
|
+
], 8, An)) : N("", !0),
|
|
2121
|
+
t.disabled ? N("", !0) : (i(), S("span", zn, [
|
|
2135
2122
|
u(e(sl), {
|
|
2136
|
-
actions:
|
|
2137
|
-
label: n(
|
|
2123
|
+
actions: v(k),
|
|
2124
|
+
label: n(k)
|
|
2138
2125
|
}, null, 8, ["actions", "label"])
|
|
2139
2126
|
]))
|
|
2140
2127
|
], 42, Vn),
|
|
2141
|
-
(i(!0), S(
|
|
2128
|
+
(i(!0), S(j, null, ee(b(k), (C) => (i(), S("div", {
|
|
2142
2129
|
key: C.id,
|
|
2143
2130
|
class: "wx-blocks-tree__kids"
|
|
2144
2131
|
}, [
|
|
2145
|
-
u(
|
|
2146
|
-
nodes:
|
|
2132
|
+
u(f, {
|
|
2133
|
+
nodes: P(k, C),
|
|
2147
2134
|
catalog: t.catalog,
|
|
2148
|
-
"parent-key":
|
|
2135
|
+
"parent-key": k.key,
|
|
2149
2136
|
field: C.id,
|
|
2150
2137
|
selected: t.selected,
|
|
2151
2138
|
disabled: t.disabled,
|
|
2152
2139
|
depth: t.depth + 1,
|
|
2153
|
-
onSelect:
|
|
2154
|
-
onAdd:
|
|
2155
|
-
onRemove:
|
|
2156
|
-
onDuplicate:
|
|
2157
|
-
onVisibility:
|
|
2158
|
-
onReorder:
|
|
2140
|
+
onSelect: g[0] || (g[0] = (V) => a("select", V)),
|
|
2141
|
+
onAdd: g[1] || (g[1] = (V, x, m) => a("add", V, x, m)),
|
|
2142
|
+
onRemove: g[2] || (g[2] = (V) => a("remove", V)),
|
|
2143
|
+
onDuplicate: g[3] || (g[3] = (V) => a("duplicate", V)),
|
|
2144
|
+
onVisibility: g[4] || (g[4] = (V, x) => a("visibility", V, x)),
|
|
2145
|
+
onReorder: g[5] || (g[5] = (V, x, m) => a("reorder", V, x, m))
|
|
2159
2146
|
}, null, 8, ["nodes", "catalog", "parent-key", "field", "selected", "disabled", "depth"]),
|
|
2160
|
-
t.disabled ?
|
|
2147
|
+
t.disabled ? N("", !0) : (i(), S("button", {
|
|
2161
2148
|
key: 0,
|
|
2162
2149
|
type: "button",
|
|
2163
2150
|
class: "wx-blocks-tree__add is-inner",
|
|
2164
|
-
onClick: (V) => a("add",
|
|
2151
|
+
onClick: (V) => a("add", k.key, C.id, C)
|
|
2165
2152
|
}, [
|
|
2166
2153
|
W(" + " + _(e(s)("field.add-inside")), 1),
|
|
2167
|
-
b(
|
|
2154
|
+
b(k).length > 1 ? (i(), S(j, { key: 0 }, [
|
|
2168
2155
|
W(" · " + _(C.label ?? C.id), 1)
|
|
2169
|
-
], 64)) :
|
|
2156
|
+
], 64)) : N("", !0)
|
|
2170
2157
|
], 8, In))
|
|
2171
2158
|
]))), 128))
|
|
2172
2159
|
])
|
|
@@ -2191,10 +2178,10 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
|
|
|
2191
2178
|
}, Dn = { class: "wx-blocks__panel-head" }, On = { class: "wx-blocks__panel-title" }, Rn = { class: "wx-blocks__tools" }, Hn = {
|
|
2192
2179
|
key: 1,
|
|
2193
2180
|
class: "wx-blocks__fields"
|
|
2194
|
-
},
|
|
2181
|
+
}, jn = { class: "wx-blocks__panel-head" }, Fn = { class: "wx-blocks__panel-title" }, qn = {
|
|
2195
2182
|
key: 0,
|
|
2196
2183
|
class: "wx-blocks__trail"
|
|
2197
|
-
}, Jn = ["onClick"], Kn = { class: "wx-blocks__panel-name" },
|
|
2184
|
+
}, Jn = ["onClick"], Kn = { class: "wx-blocks__panel-name" }, Gn = { class: "wx-blocks__panel-extra" }, Yn = { key: 0 }, Zn = { class: "wx-blocks__form" }, Qn = {
|
|
2198
2185
|
key: 0,
|
|
2199
2186
|
class: "wx-blocks__preview"
|
|
2200
2187
|
}, Xn = /* @__PURE__ */ ae({
|
|
@@ -2217,37 +2204,37 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
|
|
|
2217
2204
|
}),
|
|
2218
2205
|
emits: ["update:modelValue"],
|
|
2219
2206
|
setup(t) {
|
|
2220
|
-
const l = t, o =
|
|
2207
|
+
const l = t, o = Yt(t, "modelValue"), a = qe(_t, !1);
|
|
2221
2208
|
St(_t, !0), Re();
|
|
2222
2209
|
const s = de("webx-blocks"), r = De(), n = qe(il, null);
|
|
2223
2210
|
let b = null;
|
|
2224
|
-
const
|
|
2225
|
-
() =>
|
|
2211
|
+
const P = U([]), v = T(() => l.catalog ?? P.value), p = T(() => Array.isArray(o.value) ? o.value : []), g = U(null), f = T(() => g.value ? re(p.value, g.value) : null), k = T(
|
|
2212
|
+
() => f.value ? v.value.find((w) => w.slug === f.value?.node.type) ?? null : null
|
|
2226
2213
|
);
|
|
2227
2214
|
function C(w) {
|
|
2228
|
-
return
|
|
2215
|
+
return v.value.find((L) => L.slug === w.type)?.title ?? w.type;
|
|
2229
2216
|
}
|
|
2230
2217
|
const V = T(() => {
|
|
2231
2218
|
const w = [];
|
|
2232
|
-
return Oe(
|
|
2219
|
+
return Oe(p.value, (L) => w.push(L.key)), w;
|
|
2233
2220
|
}), x = T(() => {
|
|
2234
|
-
const w =
|
|
2221
|
+
const w = g.value ? V.value.indexOf(g.value) : -1;
|
|
2235
2222
|
return {
|
|
2236
2223
|
previous: w > 0 ? V.value[w - 1] : null,
|
|
2237
2224
|
next: w >= 0 && w < V.value.length - 1 ? V.value[w + 1] : null
|
|
2238
2225
|
};
|
|
2239
|
-
}),
|
|
2226
|
+
}), m = T(() => {
|
|
2240
2227
|
const w = [];
|
|
2241
|
-
let L =
|
|
2228
|
+
let L = f.value?.parent ?? null;
|
|
2242
2229
|
for (; L; )
|
|
2243
|
-
w.unshift({ key: L.key, title: C(L) }), L = re(
|
|
2230
|
+
w.unshift({ key: L.key, title: C(L) }), L = re(p.value, L.key)?.parent ?? null;
|
|
2244
2231
|
return w;
|
|
2245
|
-
}), y = qe(it, null), R =
|
|
2246
|
-
if (!
|
|
2247
|
-
const w =
|
|
2248
|
-
return [...
|
|
2249
|
-
}),
|
|
2250
|
-
() =>
|
|
2232
|
+
}), y = qe(it, null), R = U(null), q = U(null), J = Ye(q), Z = T(() => y !== null && y.url.value !== null), c = T(() => Z.value && J.value > 0 && J.value <= 900), B = U(!1), D = T(() => {
|
|
2233
|
+
if (!f.value) return;
|
|
2234
|
+
const w = k.value?.title ?? f.value.node.type;
|
|
2235
|
+
return [...m.value.map((L) => L.title), w].join(" / ");
|
|
2236
|
+
}), K = T(
|
|
2237
|
+
() => c.value ? {
|
|
2251
2238
|
/* Up from the bottom, and not all the way: the strip of page left above it is what
|
|
2252
2239
|
says the sheet is over the page rather than instead of it. No heading of its own —
|
|
2253
2240
|
the panels inside carry theirs, and the × is the one thing the sheet has to add. */
|
|
@@ -2264,86 +2251,86 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
|
|
|
2264
2251
|
the blocks it is inside spelled out in front of it, because the trail that says so
|
|
2265
2252
|
in the column is part of the heading this replaces. The tree keeps its own heading,
|
|
2266
2253
|
which already says what it is and how many. */
|
|
2267
|
-
title:
|
|
2268
|
-
open:
|
|
2269
|
-
"onUpdate:open": (w) =>
|
|
2254
|
+
title: D.value,
|
|
2255
|
+
open: B.value,
|
|
2256
|
+
"onUpdate:open": (w) => B.value = w
|
|
2270
2257
|
} : {}
|
|
2271
|
-
),
|
|
2258
|
+
), Se = T(
|
|
2272
2259
|
() => n?.state.manifest?.modules.find((w) => w.id === "blocks")?.meta?.groups ?? []
|
|
2273
|
-
),
|
|
2260
|
+
), pe = Zt()?.type, se = T(() => l.context?.types ? l.context.types : n?.types ? { ...Xe, ...n.types } : pe ? { ...Xe, "wx-blocks": { component: pe, kind: "field", nested: !0 } } : Xe), _e = T(
|
|
2274
2261
|
() => l.context?.translate ?? n?.i18n.t ?? ((w) => w)
|
|
2275
|
-
), Te = T(() => l.context?.can ?? n?.can ?? (() => !0)),
|
|
2262
|
+
), Te = T(() => l.context?.can ?? n?.can ?? (() => !0)), ke = At(_n);
|
|
2276
2263
|
function te(w) {
|
|
2277
2264
|
o.value = w;
|
|
2278
2265
|
}
|
|
2279
|
-
async function Ce(w, L,
|
|
2280
|
-
const Q = w ? re(
|
|
2266
|
+
async function Ce(w, L, M) {
|
|
2267
|
+
const Q = w ? re(p.value, w) : null, le = Q ? v.value.find((qt) => qt.slug === Q.node.type) ?? null : null, A = w === null ? l.allow : M?.props?.allow ?? null, h = w === null ? l.max : M?.props?.max ?? null, $ = w === null ? p.value : Q && L ? Q.node.values[L] ?? [] : [];
|
|
2281
2268
|
if (h != null && $.length >= h) return;
|
|
2282
|
-
const He = await
|
|
2283
|
-
catalog:
|
|
2269
|
+
const He = await ke({
|
|
2270
|
+
catalog: v.value,
|
|
2284
2271
|
parent: le,
|
|
2285
|
-
allow:
|
|
2286
|
-
tree:
|
|
2287
|
-
groups:
|
|
2272
|
+
allow: A,
|
|
2273
|
+
tree: p.value,
|
|
2274
|
+
groups: Se.value,
|
|
2288
2275
|
blocksPath: l.blocksPath
|
|
2289
2276
|
});
|
|
2290
2277
|
if (!He) return;
|
|
2291
|
-
const rt = Il(He.slug,
|
|
2292
|
-
te(kt(
|
|
2278
|
+
const rt = Il(He.slug, ye(He));
|
|
2279
|
+
te(kt(p.value, w, L, $.length, rt)), g.value = rt.key;
|
|
2293
2280
|
}
|
|
2294
|
-
function
|
|
2295
|
-
const L = w.content?.sample ?? {},
|
|
2281
|
+
function ye(w) {
|
|
2282
|
+
const L = w.content?.sample ?? {}, M = {};
|
|
2296
2283
|
for (const [Q, le] of Object.entries(L))
|
|
2297
|
-
(!Array.isArray(le) || le.length === 0 || typeof le[0] != "object") && (
|
|
2298
|
-
return
|
|
2284
|
+
(!Array.isArray(le) || le.length === 0 || typeof le[0] != "object") && (M[Q] = le);
|
|
2285
|
+
return M;
|
|
2299
2286
|
}
|
|
2300
|
-
async function
|
|
2301
|
-
const L = re(
|
|
2287
|
+
async function fe(w) {
|
|
2288
|
+
const L = re(p.value, w);
|
|
2302
2289
|
if (!L) return;
|
|
2303
|
-
const
|
|
2304
|
-
await
|
|
2290
|
+
const M = Pl(L.node);
|
|
2291
|
+
await Ke({
|
|
2305
2292
|
title: s("field.remove-title", {
|
|
2306
|
-
title:
|
|
2293
|
+
title: v.value.find((le) => le.slug === L.node.type)?.title ?? L.node.type
|
|
2307
2294
|
}),
|
|
2308
|
-
message:
|
|
2295
|
+
message: M > 0 ? s("field.remove-text", { count: M }) : s("field.remove-alone"),
|
|
2309
2296
|
confirmText: s("field.remove"),
|
|
2310
2297
|
cancelText: s("page.cancel"),
|
|
2311
2298
|
tone: "danger"
|
|
2312
|
-
}) && (
|
|
2299
|
+
}) && (g.value === w && (g.value = null), te(Dl(p.value, w)));
|
|
2313
2300
|
}
|
|
2314
|
-
function
|
|
2315
|
-
const L = re(
|
|
2301
|
+
function z(w) {
|
|
2302
|
+
const L = re(p.value, w);
|
|
2316
2303
|
if (!L) return;
|
|
2317
|
-
const
|
|
2318
|
-
te(kt(
|
|
2304
|
+
const M = Ot(L.node);
|
|
2305
|
+
te(kt(p.value, L.parent?.key ?? null, L.field, L.index + 1, M)), g.value = M.key;
|
|
2319
2306
|
}
|
|
2320
2307
|
function O(w, L) {
|
|
2321
|
-
te(Ul(
|
|
2308
|
+
te(Ul(p.value, w, L));
|
|
2322
2309
|
}
|
|
2323
|
-
function H(w, L,
|
|
2324
|
-
te(Rl(
|
|
2310
|
+
function H(w, L, M) {
|
|
2311
|
+
te(Rl(p.value, w, L, M));
|
|
2325
2312
|
}
|
|
2326
|
-
function
|
|
2327
|
-
|
|
2313
|
+
function Y(w) {
|
|
2314
|
+
g.value = g.value === w ? null : w;
|
|
2328
2315
|
}
|
|
2329
|
-
function
|
|
2330
|
-
w === null || !re(
|
|
2316
|
+
function ve(w) {
|
|
2317
|
+
w === null || !re(p.value, w) || (g.value = w, c.value && (B.value = !0));
|
|
2331
2318
|
}
|
|
2332
|
-
function
|
|
2333
|
-
|
|
2319
|
+
function me() {
|
|
2320
|
+
g.value = null;
|
|
2334
2321
|
}
|
|
2335
2322
|
function ie(w) {
|
|
2336
|
-
|
|
2323
|
+
g.value && te(Ol(p.value, g.value, w));
|
|
2337
2324
|
}
|
|
2338
|
-
let
|
|
2325
|
+
let we;
|
|
2339
2326
|
X(
|
|
2340
|
-
() =>
|
|
2327
|
+
() => f.value?.node.values,
|
|
2341
2328
|
(w, L) => {
|
|
2342
|
-
if (!w || !L || !
|
|
2343
|
-
const
|
|
2344
|
-
clearTimeout(
|
|
2345
|
-
!
|
|
2346
|
-
R.value?.replace(
|
|
2329
|
+
if (!w || !L || !k.value || !b || !y) return;
|
|
2330
|
+
const M = g.value, Q = k.value.id;
|
|
2331
|
+
clearTimeout(we), we = setTimeout(() => {
|
|
2332
|
+
!M || !b || b.render(Q, { values: w, key: M }).then((le) => {
|
|
2333
|
+
R.value?.replace(M, le.html) || R.value?.refresh();
|
|
2347
2334
|
}).catch(() => {
|
|
2348
2335
|
});
|
|
2349
2336
|
}, 300);
|
|
@@ -2351,29 +2338,29 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
|
|
|
2351
2338
|
{ deep: !0 }
|
|
2352
2339
|
);
|
|
2353
2340
|
function Ve(w) {
|
|
2354
|
-
w.key === "Escape" &&
|
|
2341
|
+
w.key === "Escape" && g.value && me();
|
|
2355
2342
|
}
|
|
2356
2343
|
Ue(async () => {
|
|
2357
2344
|
if (window.addEventListener("keydown", Ve), l.catalog === null && n) {
|
|
2358
2345
|
b = Ae(n);
|
|
2359
2346
|
try {
|
|
2360
|
-
|
|
2347
|
+
P.value = await b.catalog();
|
|
2361
2348
|
} catch (w) {
|
|
2362
|
-
|
|
2349
|
+
G.danger(r(w));
|
|
2363
2350
|
}
|
|
2364
2351
|
} else n && (b = Ae(n));
|
|
2365
2352
|
}), Ge(() => {
|
|
2366
|
-
clearTimeout(
|
|
2353
|
+
clearTimeout(we), window.removeEventListener("keydown", Ve);
|
|
2367
2354
|
});
|
|
2368
2355
|
const Ee = T(
|
|
2369
|
-
() =>
|
|
2356
|
+
() => k.value?.content ? st(k.value.content.schema) : []
|
|
2370
2357
|
);
|
|
2371
2358
|
return (w, L) => e(a) ? (i(), S("div", Un, [
|
|
2372
|
-
u(e(
|
|
2359
|
+
u(e(F), {
|
|
2373
2360
|
size: "sm",
|
|
2374
2361
|
tone: "muted"
|
|
2375
2362
|
}, {
|
|
2376
|
-
default:
|
|
2363
|
+
default: d(() => [
|
|
2377
2364
|
W(_(e(s)("field.nested-note")), 1)
|
|
2378
2365
|
]),
|
|
2379
2366
|
_: 1
|
|
@@ -2381,95 +2368,95 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
|
|
|
2381
2368
|
])) : (i(), S("div", {
|
|
2382
2369
|
key: 1,
|
|
2383
2370
|
ref_key: "host",
|
|
2384
|
-
ref:
|
|
2385
|
-
class:
|
|
2371
|
+
ref: q,
|
|
2372
|
+
class: $e(["wx-blocks-host", { "is-compact": c.value }])
|
|
2386
2373
|
}, [
|
|
2387
|
-
|
|
2388
|
-
class:
|
|
2389
|
-
"is-editing":
|
|
2374
|
+
E("div", {
|
|
2375
|
+
class: $e(["wx-blocks", {
|
|
2376
|
+
"is-editing": f.value !== null,
|
|
2390
2377
|
"has-preview": e(y) !== null && e(y).url.value !== null
|
|
2391
2378
|
}])
|
|
2392
2379
|
}, [
|
|
2393
|
-
(i(),
|
|
2394
|
-
default:
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
u(e(
|
|
2380
|
+
(i(), I(Qt(c.value ? e(hl) : "div"), Xt(K.value, { class: "wx-blocks__side" }), {
|
|
2381
|
+
default: d(() => [
|
|
2382
|
+
f.value ? N("", !0) : (i(), S("div", Mn, [
|
|
2383
|
+
E("div", Dn, [
|
|
2384
|
+
E("span", On, _(e(s)("field.blocks")), 1),
|
|
2385
|
+
u(e(F), {
|
|
2399
2386
|
size: "sm",
|
|
2400
2387
|
tone: "muted"
|
|
2401
2388
|
}, {
|
|
2402
|
-
default:
|
|
2403
|
-
W(_(
|
|
2389
|
+
default: d(() => [
|
|
2390
|
+
W(_(p.value.length), 1)
|
|
2404
2391
|
]),
|
|
2405
2392
|
_: 1
|
|
2406
2393
|
})
|
|
2407
2394
|
]),
|
|
2408
2395
|
u(Pn, {
|
|
2409
|
-
nodes:
|
|
2410
|
-
catalog:
|
|
2411
|
-
selected:
|
|
2396
|
+
nodes: p.value,
|
|
2397
|
+
catalog: v.value,
|
|
2398
|
+
selected: g.value,
|
|
2412
2399
|
disabled: t.disabled,
|
|
2413
|
-
onSelect:
|
|
2400
|
+
onSelect: Y,
|
|
2414
2401
|
onAdd: Ce,
|
|
2415
|
-
onRemove:
|
|
2416
|
-
onDuplicate:
|
|
2402
|
+
onRemove: fe,
|
|
2403
|
+
onDuplicate: z,
|
|
2417
2404
|
onVisibility: O,
|
|
2418
2405
|
onReorder: H
|
|
2419
2406
|
}, null, 8, ["nodes", "catalog", "selected", "disabled"]),
|
|
2420
|
-
|
|
2421
|
-
!t.disabled && (t.max === null ||
|
|
2407
|
+
E("div", Rn, [
|
|
2408
|
+
!t.disabled && (t.max === null || p.value.length < t.max) ? (i(), I(e(ce), {
|
|
2422
2409
|
key: 0,
|
|
2423
2410
|
variant: "outline",
|
|
2424
2411
|
icon: "plus",
|
|
2425
2412
|
class: "wx-blocks__add",
|
|
2426
|
-
onClick: L[0] || (L[0] = (
|
|
2413
|
+
onClick: L[0] || (L[0] = (M) => Ce(null, null, null))
|
|
2427
2414
|
}, {
|
|
2428
|
-
default:
|
|
2415
|
+
default: d(() => [
|
|
2429
2416
|
W(_(e(s)("field.add")), 1)
|
|
2430
2417
|
]),
|
|
2431
2418
|
_: 1
|
|
2432
|
-
})) :
|
|
2433
|
-
!
|
|
2419
|
+
})) : N("", !0),
|
|
2420
|
+
!c.value && e(y) && e(y).url.value ? (i(), I(e(ce), {
|
|
2434
2421
|
key: 1,
|
|
2435
2422
|
variant: "outline",
|
|
2436
2423
|
icon: "eye",
|
|
2437
2424
|
class: "wx-blocks__preview-button",
|
|
2438
|
-
onClick: L[1] || (L[1] = (
|
|
2425
|
+
onClick: L[1] || (L[1] = (M) => R.value?.open())
|
|
2439
2426
|
}, {
|
|
2440
|
-
default:
|
|
2427
|
+
default: d(() => [
|
|
2441
2428
|
W(_(e(s)("field.preview")), 1)
|
|
2442
2429
|
]),
|
|
2443
2430
|
_: 1
|
|
2444
|
-
})) :
|
|
2431
|
+
})) : N("", !0)
|
|
2445
2432
|
])
|
|
2446
2433
|
])),
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
(i(!0), S(
|
|
2452
|
-
key:
|
|
2434
|
+
f.value ? (i(), S("div", Hn, [
|
|
2435
|
+
E("div", jn, [
|
|
2436
|
+
E("span", Fn, [
|
|
2437
|
+
m.value.length ? (i(), S("span", qn, [
|
|
2438
|
+
(i(!0), S(j, null, ee(m.value, (M) => (i(), S(j, {
|
|
2439
|
+
key: M.key
|
|
2453
2440
|
}, [
|
|
2454
|
-
|
|
2441
|
+
E("button", {
|
|
2455
2442
|
type: "button",
|
|
2456
2443
|
class: "wx-blocks__trail-step",
|
|
2457
|
-
onClick: (Q) =>
|
|
2458
|
-
}, _(
|
|
2459
|
-
u(e(
|
|
2444
|
+
onClick: (Q) => Y(M.key)
|
|
2445
|
+
}, _(M.title), 9, Jn),
|
|
2446
|
+
u(e(be), { name: "chevron-right" })
|
|
2460
2447
|
], 64))), 128))
|
|
2461
|
-
])) :
|
|
2462
|
-
|
|
2448
|
+
])) : N("", !0),
|
|
2449
|
+
E("span", Kn, _(k.value?.title ?? f.value.node.type), 1)
|
|
2463
2450
|
]),
|
|
2464
|
-
|
|
2465
|
-
|
|
2451
|
+
E("span", Gn, [
|
|
2452
|
+
c.value ? N("", !0) : (i(), S("code", Yn, _(f.value.node.type), 1)),
|
|
2466
2453
|
u(e(Ie), {
|
|
2467
2454
|
size: "sm",
|
|
2468
2455
|
tone: "neutral",
|
|
2469
2456
|
icon: "chevron-up",
|
|
2470
2457
|
title: e(s)("field.previous"),
|
|
2471
2458
|
disabled: x.value.previous === null,
|
|
2472
|
-
onClick: L[2] || (L[2] = (
|
|
2459
|
+
onClick: L[2] || (L[2] = (M) => x.value.previous && Y(x.value.previous))
|
|
2473
2460
|
}, null, 8, ["title", "disabled"]),
|
|
2474
2461
|
u(e(Ie), {
|
|
2475
2462
|
size: "sm",
|
|
@@ -2477,51 +2464,51 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
|
|
|
2477
2464
|
icon: "chevron-down",
|
|
2478
2465
|
title: e(s)("field.next"),
|
|
2479
2466
|
disabled: x.value.next === null,
|
|
2480
|
-
onClick: L[3] || (L[3] = (
|
|
2467
|
+
onClick: L[3] || (L[3] = (M) => x.value.next && Y(x.value.next))
|
|
2481
2468
|
}, null, 8, ["title", "disabled"]),
|
|
2482
|
-
!
|
|
2469
|
+
!c.value && e(y) && e(y).url.value ? (i(), I(e(ce), {
|
|
2483
2470
|
key: 1,
|
|
2484
2471
|
size: "sm",
|
|
2485
2472
|
variant: "outline",
|
|
2486
2473
|
icon: "eye",
|
|
2487
2474
|
class: "wx-blocks__preview-button",
|
|
2488
2475
|
"aria-label": e(s)("field.preview"),
|
|
2489
|
-
onClick: L[4] || (L[4] = (
|
|
2490
|
-
}, null, 8, ["aria-label"])) :
|
|
2476
|
+
onClick: L[4] || (L[4] = (M) => R.value?.open())
|
|
2477
|
+
}, null, 8, ["aria-label"])) : N("", !0),
|
|
2491
2478
|
u(e(ce), {
|
|
2492
2479
|
size: "sm",
|
|
2493
2480
|
variant: "outline",
|
|
2494
|
-
onClick:
|
|
2481
|
+
onClick: me
|
|
2495
2482
|
}, {
|
|
2496
|
-
default:
|
|
2497
|
-
W(_(
|
|
2483
|
+
default: d(() => [
|
|
2484
|
+
W(_(c.value ? e(s)("field.done") : `${e(s)("field.done")} · Esc`), 1)
|
|
2498
2485
|
]),
|
|
2499
2486
|
_: 1
|
|
2500
2487
|
})
|
|
2501
2488
|
])
|
|
2502
2489
|
]),
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
key:
|
|
2506
|
-
"model-value":
|
|
2490
|
+
E("div", Zn, [
|
|
2491
|
+
k.value?.content ? (i(), I(e(zt), {
|
|
2492
|
+
key: f.value.node.key,
|
|
2493
|
+
"model-value": f.value.node.values,
|
|
2507
2494
|
root: Ee.value,
|
|
2508
2495
|
types: se.value,
|
|
2509
|
-
translate:
|
|
2496
|
+
translate: _e.value,
|
|
2510
2497
|
can: Te.value,
|
|
2511
2498
|
disabled: t.disabled,
|
|
2512
2499
|
"onUpdate:modelValue": ie
|
|
2513
|
-
}, null, 8, ["model-value", "root", "types", "translate", "can", "disabled"])) : (i(),
|
|
2500
|
+
}, null, 8, ["model-value", "root", "types", "translate", "can", "disabled"])) : (i(), I(e(F), {
|
|
2514
2501
|
key: 1,
|
|
2515
2502
|
size: "sm",
|
|
2516
2503
|
tone: "danger"
|
|
2517
2504
|
}, {
|
|
2518
|
-
default:
|
|
2519
|
-
W(_(e(s)("field.unknown-type", { type:
|
|
2505
|
+
default: d(() => [
|
|
2506
|
+
W(_(e(s)("field.unknown-type", { type: f.value.node.type })), 1)
|
|
2520
2507
|
]),
|
|
2521
2508
|
_: 1
|
|
2522
2509
|
}))
|
|
2523
2510
|
])
|
|
2524
|
-
])) :
|
|
2511
|
+
])) : N("", !0)
|
|
2525
2512
|
]),
|
|
2526
2513
|
_: 1
|
|
2527
2514
|
}, 16)),
|
|
@@ -2530,13 +2517,13 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
|
|
|
2530
2517
|
ref_key: "previewEl",
|
|
2531
2518
|
ref: R,
|
|
2532
2519
|
url: e(y).url.value,
|
|
2533
|
-
selected:
|
|
2520
|
+
selected: g.value,
|
|
2534
2521
|
reload: e(y).reload?.value ?? 0,
|
|
2535
|
-
compact:
|
|
2536
|
-
onSelect:
|
|
2537
|
-
onEdit: L[5] || (L[5] = (
|
|
2522
|
+
compact: c.value,
|
|
2523
|
+
onSelect: ve,
|
|
2524
|
+
onEdit: L[5] || (L[5] = (M) => B.value = !0)
|
|
2538
2525
|
}, null, 8, ["url", "selected", "reload", "compact"])
|
|
2539
|
-
])) :
|
|
2526
|
+
])) : N("", !0)
|
|
2540
2527
|
], 2)
|
|
2541
2528
|
], 2));
|
|
2542
2529
|
}
|
|
@@ -2553,57 +2540,57 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
|
|
|
2553
2540
|
class: "wx-block-card",
|
|
2554
2541
|
onClick: r[0] || (r[0] = (n) => o("open", t.block))
|
|
2555
2542
|
}, [
|
|
2556
|
-
u(
|
|
2543
|
+
u(Ft, {
|
|
2557
2544
|
thumbnail: t.block.thumbnail,
|
|
2558
2545
|
height: 120
|
|
2559
2546
|
}, null, 8, ["thumbnail"]),
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
u(e(
|
|
2547
|
+
E("div", ta, [
|
|
2548
|
+
E("div", la, _(t.block.title), 1),
|
|
2549
|
+
u(e(F), {
|
|
2563
2550
|
size: "sm",
|
|
2564
2551
|
tone: "muted"
|
|
2565
2552
|
}, {
|
|
2566
|
-
default:
|
|
2567
|
-
|
|
2568
|
-
W(" · " + _(e(
|
|
2553
|
+
default: d(() => [
|
|
2554
|
+
E("code", null, _(t.block.slug), 1),
|
|
2555
|
+
W(" · " + _(e(nt)(t.block.usage_count, e(a))), 1)
|
|
2569
2556
|
]),
|
|
2570
2557
|
_: 1
|
|
2571
2558
|
}),
|
|
2572
|
-
|
|
2573
|
-
t.block.draft ? (i(),
|
|
2559
|
+
E("div", na, [
|
|
2560
|
+
t.block.draft ? (i(), I(e(ue), {
|
|
2574
2561
|
key: 0,
|
|
2575
2562
|
type: "warning",
|
|
2576
2563
|
dot: ""
|
|
2577
2564
|
}, {
|
|
2578
|
-
default:
|
|
2565
|
+
default: d(() => [
|
|
2579
2566
|
W(_(e(a)("page.draft", { number: t.block.draft.number })), 1)
|
|
2580
2567
|
]),
|
|
2581
2568
|
_: 1
|
|
2582
|
-
})) :
|
|
2583
|
-
t.block.published ? (i(),
|
|
2569
|
+
})) : N("", !0),
|
|
2570
|
+
t.block.published ? (i(), I(e(ue), {
|
|
2584
2571
|
key: 1,
|
|
2585
2572
|
type: "success",
|
|
2586
2573
|
dot: ""
|
|
2587
2574
|
}, {
|
|
2588
|
-
default:
|
|
2575
|
+
default: d(() => [
|
|
2589
2576
|
W(_(e(a)("page.live", { number: t.block.published.number })), 1)
|
|
2590
2577
|
]),
|
|
2591
2578
|
_: 1
|
|
2592
|
-
})) : (i(),
|
|
2579
|
+
})) : (i(), I(e(ue), {
|
|
2593
2580
|
key: 2,
|
|
2594
2581
|
type: "default"
|
|
2595
2582
|
}, {
|
|
2596
|
-
default:
|
|
2583
|
+
default: d(() => [
|
|
2597
2584
|
W(_(e(a)("page.never-published")), 1)
|
|
2598
2585
|
]),
|
|
2599
2586
|
_: 1
|
|
2600
2587
|
})),
|
|
2601
|
-
t.block.is_enabled ?
|
|
2588
|
+
t.block.is_enabled ? N("", !0) : (i(), I(e(ue), {
|
|
2602
2589
|
key: 3,
|
|
2603
2590
|
type: "default",
|
|
2604
2591
|
variant: "outline"
|
|
2605
2592
|
}, {
|
|
2606
|
-
default:
|
|
2593
|
+
default: d(() => [
|
|
2607
2594
|
W(_(e(a)("page.hidden")), 1)
|
|
2608
2595
|
]),
|
|
2609
2596
|
_: 1
|
|
@@ -2617,56 +2604,56 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
|
|
|
2617
2604
|
setup(t) {
|
|
2618
2605
|
const { resolve: l, dismiss: o, open: a } = Bt(), s = Me(), r = Ae(s);
|
|
2619
2606
|
Re();
|
|
2620
|
-
const n = de("webx-blocks"), b = De(),
|
|
2621
|
-
() =>
|
|
2607
|
+
const n = de("webx-blocks"), b = De(), P = T(() => s.state.manifest?.modules.find((y) => y.id === "blocks")?.meta?.groups ?? ["content"]), v = U({ title: "", slug: "", group: P.value[0] ?? "content" }), p = U({}), g = U(!1), f = U(!1), k = T(
|
|
2608
|
+
() => P.value.map((m) => ({ value: m, label: ze(m, n) }))
|
|
2622
2609
|
);
|
|
2623
|
-
function C(
|
|
2624
|
-
return
|
|
2610
|
+
function C(m) {
|
|
2611
|
+
return m.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/^[^a-z]+/, "").slice(0, 64);
|
|
2625
2612
|
}
|
|
2626
2613
|
X(
|
|
2627
|
-
() =>
|
|
2628
|
-
(
|
|
2629
|
-
|
|
2614
|
+
() => v.value.title,
|
|
2615
|
+
(m) => {
|
|
2616
|
+
f.value || (v.value.slug = C(m));
|
|
2630
2617
|
}
|
|
2631
2618
|
);
|
|
2632
|
-
function V(
|
|
2633
|
-
return
|
|
2619
|
+
function V(m) {
|
|
2620
|
+
return p.value[m]?.[0];
|
|
2634
2621
|
}
|
|
2635
2622
|
async function x() {
|
|
2636
|
-
|
|
2623
|
+
g.value = !0, p.value = {};
|
|
2637
2624
|
try {
|
|
2638
|
-
l(await r.create(
|
|
2639
|
-
} catch (
|
|
2640
|
-
const y =
|
|
2641
|
-
y?.errors ?
|
|
2625
|
+
l(await r.create(v.value));
|
|
2626
|
+
} catch (m) {
|
|
2627
|
+
const y = m.body;
|
|
2628
|
+
y?.errors ? p.value = y.errors : G.danger(b(m, n("page.failed")));
|
|
2642
2629
|
} finally {
|
|
2643
|
-
|
|
2630
|
+
g.value = !1;
|
|
2644
2631
|
}
|
|
2645
2632
|
}
|
|
2646
|
-
return (
|
|
2633
|
+
return (m, y) => (i(), I(e(Lt), {
|
|
2647
2634
|
open: e(a),
|
|
2648
2635
|
"onUpdate:open": y[5] || (y[5] = (R) => $t(a) ? a.value = R : null),
|
|
2649
2636
|
title: e(n)("page.new"),
|
|
2650
2637
|
width: 520
|
|
2651
2638
|
}, {
|
|
2652
|
-
footer:
|
|
2639
|
+
footer: d(() => [
|
|
2653
2640
|
u(e(bl), { size: "sm" }, {
|
|
2654
|
-
default:
|
|
2641
|
+
default: d(() => [
|
|
2655
2642
|
u(e(ce), {
|
|
2656
2643
|
variant: "outline",
|
|
2657
2644
|
onClick: y[4] || (y[4] = (R) => e(o)())
|
|
2658
2645
|
}, {
|
|
2659
|
-
default:
|
|
2646
|
+
default: d(() => [
|
|
2660
2647
|
W(_(e(n)("page.cancel")), 1)
|
|
2661
2648
|
]),
|
|
2662
2649
|
_: 1
|
|
2663
2650
|
}),
|
|
2664
2651
|
u(e(ce), {
|
|
2665
2652
|
type: "primary",
|
|
2666
|
-
loading:
|
|
2653
|
+
loading: g.value,
|
|
2667
2654
|
onClick: x
|
|
2668
2655
|
}, {
|
|
2669
|
-
default:
|
|
2656
|
+
default: d(() => [
|
|
2670
2657
|
W(_(e(n)("page.create")), 1)
|
|
2671
2658
|
]),
|
|
2672
2659
|
_: 1
|
|
@@ -2675,16 +2662,16 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
|
|
|
2675
2662
|
_: 1
|
|
2676
2663
|
})
|
|
2677
2664
|
]),
|
|
2678
|
-
default:
|
|
2679
|
-
|
|
2665
|
+
default: d(() => [
|
|
2666
|
+
E("div", sa, [
|
|
2680
2667
|
u(e(ne), {
|
|
2681
2668
|
label: e(n)("page.title"),
|
|
2682
2669
|
error: V("title")
|
|
2683
2670
|
}, {
|
|
2684
|
-
default:
|
|
2671
|
+
default: d(() => [
|
|
2685
2672
|
u(e(Pe), {
|
|
2686
|
-
modelValue:
|
|
2687
|
-
"onUpdate:modelValue": y[0] || (y[0] = (R) =>
|
|
2673
|
+
modelValue: v.value.title,
|
|
2674
|
+
"onUpdate:modelValue": y[0] || (y[0] = (R) => v.value.title = R),
|
|
2688
2675
|
autofocus: ""
|
|
2689
2676
|
}, null, 8, ["modelValue"])
|
|
2690
2677
|
]),
|
|
@@ -2695,12 +2682,12 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
|
|
|
2695
2682
|
help: e(n)("page.identifier-help"),
|
|
2696
2683
|
error: V("slug")
|
|
2697
2684
|
}, {
|
|
2698
|
-
default:
|
|
2685
|
+
default: d(() => [
|
|
2699
2686
|
u(e(Pe), {
|
|
2700
|
-
modelValue:
|
|
2701
|
-
"onUpdate:modelValue": y[1] || (y[1] = (R) =>
|
|
2687
|
+
modelValue: v.value.slug,
|
|
2688
|
+
"onUpdate:modelValue": y[1] || (y[1] = (R) => v.value.slug = R),
|
|
2702
2689
|
placeholder: "hero",
|
|
2703
|
-
onInput: y[2] || (y[2] = (R) =>
|
|
2690
|
+
onInput: y[2] || (y[2] = (R) => f.value = !0)
|
|
2704
2691
|
}, null, 8, ["modelValue"])
|
|
2705
2692
|
]),
|
|
2706
2693
|
_: 1
|
|
@@ -2710,11 +2697,11 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
|
|
|
2710
2697
|
help: e(n)("page.group-help"),
|
|
2711
2698
|
error: V("group")
|
|
2712
2699
|
}, {
|
|
2713
|
-
default:
|
|
2700
|
+
default: d(() => [
|
|
2714
2701
|
u(e(Et), {
|
|
2715
|
-
modelValue:
|
|
2716
|
-
"onUpdate:modelValue": y[3] || (y[3] = (R) =>
|
|
2717
|
-
options:
|
|
2702
|
+
modelValue: v.value.group,
|
|
2703
|
+
"onUpdate:modelValue": y[3] || (y[3] = (R) => v.value.group = R),
|
|
2704
|
+
options: k.value
|
|
2718
2705
|
}, null, 8, ["modelValue", "options"])
|
|
2719
2706
|
]),
|
|
2720
2707
|
_: 1
|
|
@@ -2738,107 +2725,107 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
|
|
|
2738
2725
|
setup(t) {
|
|
2739
2726
|
const l = t, o = Me(), a = Ae(o), s = Tt();
|
|
2740
2727
|
Re();
|
|
2741
|
-
const r = de("webx-blocks"), n = De(), b =
|
|
2742
|
-
const
|
|
2728
|
+
const r = de("webx-blocks"), n = De(), b = U([]), P = U(!0), v = U(""), p = U(""), g = At(ra), f = T(() => {
|
|
2729
|
+
const c = o.state.manifest?.modules.find((B) => B.id === "blocks")?.meta;
|
|
2743
2730
|
return {
|
|
2744
|
-
groups:
|
|
2745
|
-
editing:
|
|
2746
|
-
provides:
|
|
2731
|
+
groups: c?.groups ?? [],
|
|
2732
|
+
editing: c?.editing ?? !0,
|
|
2733
|
+
provides: c?.provides ?? []
|
|
2747
2734
|
};
|
|
2748
|
-
}),
|
|
2749
|
-
() => o.state.manifest?.modules.find((
|
|
2735
|
+
}), k = T(() => o.can("blocks.manage") && f.value.editing), C = T(
|
|
2736
|
+
() => o.state.manifest?.modules.find((c) => c.id === "blocks")?.title ?? r("module.title")
|
|
2750
2737
|
), V = T(() => {
|
|
2751
|
-
const
|
|
2752
|
-
return
|
|
2753
|
-
(
|
|
2738
|
+
const c = v.value.trim().toLowerCase(), B = p.value === "" ? b.value : b.value.filter((D) => D.group === p.value);
|
|
2739
|
+
return c === "" ? B : B.filter(
|
|
2740
|
+
(D) => D.title.toLowerCase().includes(c) || D.slug.includes(c) || (D.description ?? "").toLowerCase().includes(c)
|
|
2754
2741
|
);
|
|
2755
2742
|
}), x = T(() => {
|
|
2756
|
-
const
|
|
2757
|
-
for (const
|
|
2758
|
-
|
|
2759
|
-
return
|
|
2760
|
-
}),
|
|
2743
|
+
const c = [...f.value.groups];
|
|
2744
|
+
for (const B of b.value)
|
|
2745
|
+
c.includes(B.group) || c.push(B.group);
|
|
2746
|
+
return c.filter((B) => b.value.some((D) => D.group === B));
|
|
2747
|
+
}), m = T(
|
|
2761
2748
|
() => x.value.length < 2 ? [] : [
|
|
2762
2749
|
{ value: "", label: r("page.all-groups") },
|
|
2763
|
-
...x.value.map((
|
|
2750
|
+
...x.value.map((c) => ({ value: c, label: ze(c, r) }))
|
|
2764
2751
|
]
|
|
2765
2752
|
), y = T(() => {
|
|
2766
|
-
const
|
|
2767
|
-
id:
|
|
2768
|
-
label: ze(
|
|
2769
|
-
blocks: V.value.filter((
|
|
2770
|
-
})).filter((
|
|
2771
|
-
return
|
|
2753
|
+
const c = x.value.map((D) => ({
|
|
2754
|
+
id: D,
|
|
2755
|
+
label: ze(D, r),
|
|
2756
|
+
blocks: V.value.filter((K) => K.group === D)
|
|
2757
|
+
})).filter((D) => D.blocks.length > 0);
|
|
2758
|
+
return p.value !== "" || V.value.length <= 5 || v.value.trim() !== "" || c.length < 2 ? [{ id: "", label: "", blocks: V.value }] : c;
|
|
2772
2759
|
});
|
|
2773
2760
|
async function R() {
|
|
2774
|
-
|
|
2761
|
+
P.value = !0;
|
|
2775
2762
|
try {
|
|
2776
2763
|
b.value = await a.list();
|
|
2777
|
-
} catch (
|
|
2778
|
-
|
|
2764
|
+
} catch (c) {
|
|
2765
|
+
G.danger(n(c));
|
|
2779
2766
|
} finally {
|
|
2780
|
-
|
|
2767
|
+
P.value = !1;
|
|
2781
2768
|
}
|
|
2782
2769
|
}
|
|
2783
|
-
function
|
|
2784
|
-
s.push(`${l.base}/${
|
|
2770
|
+
function q(c) {
|
|
2771
|
+
s.push(`${l.base}/${c.id}`);
|
|
2785
2772
|
}
|
|
2786
|
-
async function
|
|
2787
|
-
const
|
|
2788
|
-
|
|
2773
|
+
async function J() {
|
|
2774
|
+
const c = await g({});
|
|
2775
|
+
c && q(c);
|
|
2789
2776
|
}
|
|
2790
2777
|
Ue(R);
|
|
2791
2778
|
const Z = T(
|
|
2792
|
-
() =>
|
|
2793
|
-
|
|
2779
|
+
() => k.value ? [{ key: "new", label: r("page.new"), icon: "plus", primary: !0, run: () => {
|
|
2780
|
+
J();
|
|
2794
2781
|
} }] : []
|
|
2795
2782
|
);
|
|
2796
|
-
return (
|
|
2797
|
-
view:
|
|
2798
|
-
"onUpdate:view":
|
|
2783
|
+
return (c, B) => (i(), I(e(rl), {
|
|
2784
|
+
view: p.value,
|
|
2785
|
+
"onUpdate:view": B[1] || (B[1] = (D) => p.value = D),
|
|
2799
2786
|
class: "wx-blocks-page",
|
|
2800
2787
|
title: C.value,
|
|
2801
|
-
views:
|
|
2788
|
+
views: m.value,
|
|
2802
2789
|
actions: Z.value
|
|
2803
2790
|
}, {
|
|
2804
|
-
default:
|
|
2805
|
-
|
|
2791
|
+
default: d(() => [
|
|
2792
|
+
f.value.editing ? N("", !0) : (i(), I(e(Vt), {
|
|
2806
2793
|
key: 0,
|
|
2807
2794
|
type: "info",
|
|
2808
2795
|
variant: "soft",
|
|
2809
2796
|
description: e(r)("page.editing-off")
|
|
2810
2797
|
}, null, 8, ["description"])),
|
|
2811
|
-
|
|
2798
|
+
P.value || b.value.length > 0 ? (i(), S("div", ua, [
|
|
2812
2799
|
u(e(Pe), {
|
|
2813
|
-
modelValue:
|
|
2814
|
-
"onUpdate:modelValue":
|
|
2800
|
+
modelValue: v.value,
|
|
2801
|
+
"onUpdate:modelValue": B[0] || (B[0] = (D) => v.value = D),
|
|
2815
2802
|
class: "wx-blocks-page__search",
|
|
2816
2803
|
placeholder: e(r)("page.search"),
|
|
2817
2804
|
clearable: ""
|
|
2818
2805
|
}, null, 8, ["modelValue", "placeholder"])
|
|
2819
|
-
])) :
|
|
2820
|
-
|
|
2821
|
-
template:
|
|
2822
|
-
|
|
2823
|
-
(i(), S(
|
|
2824
|
-
key:
|
|
2806
|
+
])) : N("", !0),
|
|
2807
|
+
P.value ? (i(), I(e(We), { key: 2 }, {
|
|
2808
|
+
template: d(() => [
|
|
2809
|
+
E("div", ca, [
|
|
2810
|
+
(i(), S(j, null, ee(4, (D) => E("div", {
|
|
2811
|
+
key: D,
|
|
2825
2812
|
class: "wx-blocks-page__ghost"
|
|
2826
2813
|
}, [
|
|
2827
|
-
u(e(
|
|
2814
|
+
u(e(Fe), {
|
|
2828
2815
|
variant: "image",
|
|
2829
2816
|
height: 120,
|
|
2830
2817
|
class: "wx-blocks-page__ghost-thumb"
|
|
2831
2818
|
}),
|
|
2832
|
-
|
|
2833
|
-
u(e(
|
|
2819
|
+
E("div", da, [
|
|
2820
|
+
u(e(Fe), {
|
|
2834
2821
|
variant: "title",
|
|
2835
2822
|
width: "45%"
|
|
2836
2823
|
}),
|
|
2837
|
-
u(e(
|
|
2824
|
+
u(e(Fe), {
|
|
2838
2825
|
variant: "text",
|
|
2839
2826
|
width: "70%"
|
|
2840
2827
|
}),
|
|
2841
|
-
u(e(
|
|
2828
|
+
u(e(Fe), {
|
|
2842
2829
|
variant: "button",
|
|
2843
2830
|
width: "64px",
|
|
2844
2831
|
height: "22px"
|
|
@@ -2848,21 +2835,21 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
|
|
|
2848
2835
|
])
|
|
2849
2836
|
]),
|
|
2850
2837
|
_: 1
|
|
2851
|
-
})) : b.value.length === 0 ? (i(),
|
|
2838
|
+
})) : b.value.length === 0 ? (i(), I(e(Wt), {
|
|
2852
2839
|
key: 3,
|
|
2853
2840
|
icon: "grid",
|
|
2854
2841
|
title: e(r)("page.empty"),
|
|
2855
2842
|
description: e(r)("page.empty-help")
|
|
2856
|
-
}, null, 8, ["title", "description"])) : (i(!0), S(
|
|
2857
|
-
key:
|
|
2843
|
+
}, null, 8, ["title", "description"])) : (i(!0), S(j, { key: 4 }, ee(y.value, (D) => (i(), S("section", {
|
|
2844
|
+
key: D.id,
|
|
2858
2845
|
class: "wx-blocks-page__group"
|
|
2859
2846
|
}, [
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
(i(!0), S(
|
|
2863
|
-
key:
|
|
2864
|
-
block:
|
|
2865
|
-
onOpen:
|
|
2847
|
+
D.label ? (i(), S("div", pa, _(D.label), 1)) : N("", !0),
|
|
2848
|
+
E("div", va, [
|
|
2849
|
+
(i(!0), S(j, null, ee(D.blocks, (K) => (i(), I(oa, {
|
|
2850
|
+
key: K.id,
|
|
2851
|
+
block: K,
|
|
2852
|
+
onOpen: q
|
|
2866
2853
|
}, null, 8, ["block"]))), 128))
|
|
2867
2854
|
])
|
|
2868
2855
|
]))), 128))
|
|
@@ -2903,7 +2890,7 @@ export {
|
|
|
2903
2890
|
dn as WxBlockEditorPage,
|
|
2904
2891
|
_n as WxBlockPicker,
|
|
2905
2892
|
zl as WxBlockStage,
|
|
2906
|
-
|
|
2893
|
+
Ft as WxBlockThumb,
|
|
2907
2894
|
ea as WxBlocks,
|
|
2908
2895
|
ma as WxBlocksPage,
|
|
2909
2896
|
$a as blocks,
|
|
@@ -2914,14 +2901,14 @@ export {
|
|
|
2914
2901
|
Ae as createBlocksApi,
|
|
2915
2902
|
It as findRange,
|
|
2916
2903
|
st as formSchema,
|
|
2917
|
-
|
|
2904
|
+
et as highlightBlock,
|
|
2918
2905
|
kt as insertNode,
|
|
2919
2906
|
Ut as isNode,
|
|
2920
|
-
|
|
2921
|
-
|
|
2907
|
+
Ze as isNodeList,
|
|
2908
|
+
Fl as lintBlock,
|
|
2922
2909
|
re as locate,
|
|
2923
2910
|
Il as makeNode,
|
|
2924
|
-
|
|
2911
|
+
lt as newKey,
|
|
2925
2912
|
_a as provideBlocksPreview,
|
|
2926
2913
|
Dl as removeNode,
|
|
2927
2914
|
Nt as replaceBlock,
|