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