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