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