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