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