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