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