@webx-ui/module-blocks 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BlocksField.d.ts +15 -0
- package/dist/BlocksPreview.d.ts +3 -0
- package/dist/index.js +993 -932
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +4 -4
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 me, 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 we, 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 ve, 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 he(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 = we(), i = he(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 _(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(_(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(
|
|
208
|
+
const p = i.content, S = Array.from(p.childNodes);
|
|
209
|
+
o.insertBefore(p, n);
|
|
210
210
|
const _ = t.defaultView?.webx;
|
|
211
211
|
if (_?.mount)
|
|
212
|
-
for (const k of
|
|
212
|
+
for (const k of S)
|
|
213
213
|
k.nodeType === 1 && _.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)), _ = C(
|
|
258
|
+
() => kt({
|
|
259
259
|
html: l.html,
|
|
260
260
|
styles: l.styles,
|
|
261
261
|
script: l.script,
|
|
@@ -265,136 +265,136 @@ 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] = (w) => o.value = w),
|
|
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
308
|
srcdoc: _.value,
|
|
309
|
-
style:
|
|
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 wt() {
|
|
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: wt(), type: t, values: l };
|
|
330
330
|
}
|
|
331
331
|
function oe(t, l) {
|
|
332
|
-
return
|
|
332
|
+
return _t(t, l, null, null);
|
|
333
333
|
}
|
|
334
|
-
function
|
|
334
|
+
function _t(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 = _t(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 Fn(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: wt(), 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,19 +541,19 @@ 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 _e() {
|
|
546
546
|
try {
|
|
547
|
-
const { i18n: t } =
|
|
548
|
-
|
|
547
|
+
const { i18n: t } = we();
|
|
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",
|
|
@@ -562,36 +562,36 @@ function pl(t, l, a) {
|
|
|
562
562
|
variables: o.map((_) => `$${_}`).join(", ")
|
|
563
563
|
})
|
|
564
564
|
});
|
|
565
|
-
const i = [], n = [],
|
|
566
|
-
for (const [_, k] of
|
|
567
|
-
_.startsWith(
|
|
565
|
+
const i = [], n = [], h = `.b-${t}`;
|
|
566
|
+
for (const [_, k] of vl(l.styles))
|
|
567
|
+
_.startsWith(h) || _.startsWith("&") || (/^[a-z][a-z0-9-]*/i.test(_) ? n.push([_, k]) : i.push([_, 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"], wl = { class: "wx-block-editor__actions" }, _l = { 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 = we(), s = he(a), o = It(), i = ut();
|
|
656
|
+
_e();
|
|
657
|
+
const n = Q("webx-blocks"), h = C(() => Number(o.params.id)), p = U(null), S = U([]), _ = 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
|
-
}), w =
|
|
675
|
+
}), w = 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: w })), ie = C(() => N.value !== "" && xe.value !== N.value), $e = C(() => fl(d.slug, w, n)), Ue = C(() => {
|
|
688
688
|
const T = [...y.value.groups];
|
|
689
|
-
return T.includes(
|
|
690
|
-
}),
|
|
689
|
+
return T.includes(d.group) || T.push(d.group), T.map((v) => ({ value: v, label: ke(v, n) }));
|
|
690
|
+
}), be = C({
|
|
691
691
|
get: () => w.sample,
|
|
692
692
|
set: (T) => {
|
|
693
693
|
w.sample = T;
|
|
694
694
|
}
|
|
695
|
-
}),
|
|
695
|
+
}), Ve = C(() => re(w.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,19 +719,19 @@ const vl = { class: "wx-block-editor" }, hl = { class: "wx-block-editor__head" }
|
|
|
719
719
|
script: null,
|
|
720
720
|
sample: {}
|
|
721
721
|
};
|
|
722
|
-
Object.assign(w, ae(v)), B.value = JSON.stringify(v.schema, null, 2), M.value = null,
|
|
722
|
+
Object.assign(w, ae(v)), B.value = JSON.stringify(v.schema, null, 2), M.value = null, N.value = xe.value;
|
|
723
723
|
}
|
|
724
|
-
async function
|
|
724
|
+
async function Se() {
|
|
725
725
|
_.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
|
_.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);
|
|
@@ -742,17 +742,17 @@ const vl = { class: "wx-block-editor" }, hl = { class: "wx-block-editor__head" }
|
|
|
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(
|
|
755
|
+
const v = await s.render(p.value.id, {
|
|
756
756
|
values: w.sample,
|
|
757
757
|
content: g.value ? {
|
|
758
758
|
template: w.template,
|
|
@@ -771,15 +771,15 @@ const vl = { class: "wx-block-editor" }, hl = { class: "wx-block-editor__head" }
|
|
|
771
771
|
}
|
|
772
772
|
le(
|
|
773
773
|
() => [w.template, w.styles, w.script, w.schema, w.sample],
|
|
774
|
-
|
|
774
|
+
X,
|
|
775
775
|
{ deep: !0 }
|
|
776
776
|
);
|
|
777
|
-
const
|
|
778
|
-
function
|
|
777
|
+
const Te = U(null);
|
|
778
|
+
function ge(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
|
w.template += `{{ $${T} }}`;
|
|
785
785
|
return;
|
|
@@ -787,16 +787,16 @@ const vl = { class: "wx-block-editor" }, hl = { class: "wx-block-editor__head" }
|
|
|
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:
|
|
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
800
|
content: M.value ? { ...w, schema: void 0 } : w
|
|
801
801
|
});
|
|
802
802
|
se(v), F.success(
|
|
@@ -804,44 +804,44 @@ const vl = { class: "wx-block-editor" }, hl = { class: "wx-block-editor__head" }
|
|
|
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,143 +849,160 @@ 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
|
-
_.value || !
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
866
|
+
const O = je("router-link");
|
|
867
|
+
return r(), V("div", hl, [
|
|
868
|
+
_.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", wl, [
|
|
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", _l, [
|
|
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:
|
|
1005
|
+
ref: Te,
|
|
989
1006
|
modelValue: w.template,
|
|
990
1007
|
"onUpdate:modelValue": v[1] || (v[1] = (z) => w.template = z),
|
|
991
1008
|
language: "php",
|
|
@@ -994,42 +1011,42 @@ const vl = { class: "wx-block-editor" }, hl = { class: "wx-block-editor__head" }
|
|
|
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: (Pn) => Ce(z),
|
|
1030
|
+
textContent: f(ge(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(
|
|
1047
|
+
default: c(() => [
|
|
1048
|
+
x("div", Tl, [
|
|
1049
|
+
u(e(We), {
|
|
1033
1050
|
modelValue: w.styles,
|
|
1034
1051
|
"onUpdate:modelValue": v[2] || (v[2] = (z) => w.styles = z),
|
|
1035
1052
|
language: "css",
|
|
@@ -1037,22 +1054,22 @@ const vl = { class: "wx-block-editor" }, hl = { class: "wx-block-editor__head" }
|
|
|
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(
|
|
1070
|
+
default: c(() => [
|
|
1071
|
+
x("div", Cl, [
|
|
1072
|
+
u(e(We), {
|
|
1056
1073
|
"model-value": w.script ?? "",
|
|
1057
1074
|
language: "javascript",
|
|
1058
1075
|
readonly: !g.value,
|
|
@@ -1060,13 +1077,13 @@ const vl = { class: "wx-block-editor" }, hl = { class: "wx-block-editor__head" }
|
|
|
1060
1077
|
"max-height": "70vh",
|
|
1061
1078
|
"onUpdate:modelValue": v[3] || (v[3] = (z) => w.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(ve), {
|
|
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(ve), {
|
|
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
|
-
w.schema.length ? (r(),
|
|
1359
|
+
default: c(() => [
|
|
1360
|
+
w.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: be.value,
|
|
1363
|
+
"onUpdate:modelValue": v[14] || (v[14] = (z) => be.value = z),
|
|
1364
|
+
root: e(Je)(w.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
|
+
_e();
|
|
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
1503
|
}), _ = C(() => {
|
|
1474
|
-
const
|
|
1475
|
-
for (const { type: g } of
|
|
1476
|
-
|
|
1477
|
-
const m =
|
|
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(ve), {
|
|
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(_.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: (w) => e(a)(
|
|
1580
|
+
class: me(["wx-block-picker__card", { "is-disabled": d.reason !== null }]),
|
|
1581
|
+
disabled: d.reason !== null,
|
|
1582
|
+
title: d.reason ?? void 0,
|
|
1583
|
+
onClick: (w) => 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,24 +1617,25 @@ 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: {},
|
|
1594
1624
|
selected: { default: null },
|
|
1595
1625
|
mode: { default: "wide" },
|
|
1596
|
-
reload: { default: 0 }
|
|
1626
|
+
reload: { default: 0 },
|
|
1627
|
+
fill: { type: Boolean, default: !1 }
|
|
1597
1628
|
},
|
|
1598
1629
|
setup(t, { expose: l }) {
|
|
1599
|
-
const a = t, s =
|
|
1630
|
+
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), _ = C(() => [
|
|
1600
1631
|
{ value: 1280, label: s("field.width-desktop") },
|
|
1601
1632
|
{ value: 834, label: s("field.width-tablet") },
|
|
1602
1633
|
{ value: 390, label: s("field.width-phone") }
|
|
1603
1634
|
]), k = C(
|
|
1604
|
-
() =>
|
|
1605
|
-
),
|
|
1635
|
+
() => h.value ? p.value : a.mode === "phone" ? 390 : 1280
|
|
1636
|
+
), b = C(() => h.value || a.mode === "phone" || n.value === 0 ? 1 : Math.min(1, n.value / k.value)), m = C(() => ({
|
|
1606
1637
|
width: `${k.value}px`,
|
|
1607
|
-
transform: `scale(${
|
|
1638
|
+
transform: `scale(${b.value})`
|
|
1608
1639
|
})), y = C(() => {
|
|
1609
1640
|
if (!a.url) return "";
|
|
1610
1641
|
try {
|
|
@@ -1620,56 +1651,56 @@ const vl = { class: "wx-block-editor" }, hl = { class: "wx-block-editor__head" }
|
|
|
1620
1651
|
return null;
|
|
1621
1652
|
}
|
|
1622
1653
|
}
|
|
1623
|
-
function
|
|
1624
|
-
|
|
1625
|
-
const
|
|
1626
|
-
|
|
1654
|
+
function d() {
|
|
1655
|
+
S.value = !0;
|
|
1656
|
+
const N = g();
|
|
1657
|
+
N && De(N, a.selected ?? null);
|
|
1627
1658
|
}
|
|
1628
|
-
function w(
|
|
1659
|
+
function w(N, I) {
|
|
1629
1660
|
const P = g();
|
|
1630
|
-
if (!P ||
|
|
1631
|
-
const H =
|
|
1632
|
-
return H &&
|
|
1661
|
+
if (!P || !S.value) return !1;
|
|
1662
|
+
const H = Yt(P, N, I);
|
|
1663
|
+
return H && De(P, a.selected ?? null), H;
|
|
1633
1664
|
}
|
|
1634
1665
|
function B() {
|
|
1635
|
-
|
|
1666
|
+
S.value = !1, o.value && a.url && (o.value.src = a.url);
|
|
1636
1667
|
}
|
|
1637
|
-
function M(
|
|
1638
|
-
|
|
1668
|
+
function M(N) {
|
|
1669
|
+
N.key === "Escape" && h.value && (h.value = !1, N.stopPropagation());
|
|
1639
1670
|
}
|
|
1640
1671
|
return le(
|
|
1641
1672
|
() => a.selected,
|
|
1642
|
-
(
|
|
1643
|
-
const
|
|
1644
|
-
|
|
1673
|
+
(N) => {
|
|
1674
|
+
const I = g();
|
|
1675
|
+
I && S.value && De(I, N ?? null);
|
|
1645
1676
|
}
|
|
1646
1677
|
), le(() => a.reload, B), le(
|
|
1647
1678
|
() => a.url,
|
|
1648
|
-
() =>
|
|
1649
|
-
),
|
|
1650
|
-
class:
|
|
1679
|
+
() => S.value = !1
|
|
1680
|
+
), ye(() => window.addEventListener("keydown", M)), Re(() => window.removeEventListener("keydown", M)), l({ replace: w, refresh: B, open: () => h.value = !0 }), (N, I) => (r(), V("div", {
|
|
1681
|
+
class: me(["wx-blocks-preview", { "is-fullscreen": h.value, "is-phone": t.mode === "phone", "is-fill": t.fill }])
|
|
1651
1682
|
}, [
|
|
1652
|
-
|
|
1683
|
+
x("div", Zl, [
|
|
1653
1684
|
u(e(R), {
|
|
1654
1685
|
size: "xs",
|
|
1655
1686
|
tone: "muted",
|
|
1656
1687
|
class: "wx-blocks-preview__label",
|
|
1657
1688
|
truncate: ""
|
|
1658
1689
|
}, {
|
|
1659
|
-
default:
|
|
1660
|
-
|
|
1690
|
+
default: c(() => [
|
|
1691
|
+
$(f(y.value), 1)
|
|
1661
1692
|
]),
|
|
1662
1693
|
_: 1
|
|
1663
1694
|
}),
|
|
1664
|
-
|
|
1665
|
-
|
|
1695
|
+
x("div", Gl, [
|
|
1696
|
+
h.value ? (r(), W(e(ct), {
|
|
1666
1697
|
key: 0,
|
|
1667
|
-
modelValue:
|
|
1668
|
-
"onUpdate:modelValue":
|
|
1698
|
+
modelValue: p.value,
|
|
1699
|
+
"onUpdate:modelValue": I[0] || (I[0] = (P) => p.value = P),
|
|
1669
1700
|
options: _.value,
|
|
1670
1701
|
size: "sm"
|
|
1671
1702
|
}, null, 8, ["modelValue", "options"])) : E("", !0),
|
|
1672
|
-
t.url ? (r(),
|
|
1703
|
+
t.url ? (r(), W(e(q), {
|
|
1673
1704
|
key: 1,
|
|
1674
1705
|
size: "sm",
|
|
1675
1706
|
variant: "outline",
|
|
@@ -1677,47 +1708,47 @@ const vl = { class: "wx-block-editor" }, hl = { class: "wx-block-editor__head" }
|
|
|
1677
1708
|
target: "_blank",
|
|
1678
1709
|
rel: "noopener"
|
|
1679
1710
|
}, {
|
|
1680
|
-
default:
|
|
1681
|
-
|
|
1711
|
+
default: c(() => [
|
|
1712
|
+
$(f(e(s)("field.open-site")), 1)
|
|
1682
1713
|
]),
|
|
1683
1714
|
_: 1
|
|
1684
1715
|
}, 8, ["href"])) : E("", !0),
|
|
1685
1716
|
u(e(q), {
|
|
1686
1717
|
size: "sm",
|
|
1687
1718
|
variant: "outline",
|
|
1688
|
-
onClick:
|
|
1719
|
+
onClick: I[1] || (I[1] = (P) => h.value = !h.value)
|
|
1689
1720
|
}, {
|
|
1690
|
-
default:
|
|
1691
|
-
|
|
1721
|
+
default: c(() => [
|
|
1722
|
+
$(f(h.value ? e(s)("field.close") : e(s)("field.fullscreen")), 1)
|
|
1692
1723
|
]),
|
|
1693
1724
|
_: 1
|
|
1694
1725
|
})
|
|
1695
1726
|
])
|
|
1696
1727
|
]),
|
|
1697
|
-
|
|
1728
|
+
x("div", {
|
|
1698
1729
|
ref_key: "box",
|
|
1699
1730
|
ref: i,
|
|
1700
1731
|
class: "wx-blocks-preview__ground"
|
|
1701
1732
|
}, [
|
|
1702
|
-
|
|
1733
|
+
x("div", {
|
|
1703
1734
|
class: "wx-blocks-preview__clip",
|
|
1704
|
-
style:
|
|
1735
|
+
style: fe({ width: `${Math.round(k.value * b.value)}px` })
|
|
1705
1736
|
}, [
|
|
1706
|
-
t.url ? (r(),
|
|
1737
|
+
t.url ? (r(), V("iframe", {
|
|
1707
1738
|
key: 0,
|
|
1708
1739
|
ref_key: "frame",
|
|
1709
1740
|
ref: o,
|
|
1710
1741
|
class: "wx-blocks-preview__frame",
|
|
1711
1742
|
src: t.url,
|
|
1712
|
-
style:
|
|
1743
|
+
style: fe(m.value),
|
|
1713
1744
|
title: e(s)("field.preview"),
|
|
1714
|
-
onLoad:
|
|
1715
|
-
}, null, 44,
|
|
1745
|
+
onLoad: d
|
|
1746
|
+
}, null, 44, Yl)) : E("", !0)
|
|
1716
1747
|
], 4)
|
|
1717
1748
|
], 512)
|
|
1718
1749
|
], 2));
|
|
1719
1750
|
}
|
|
1720
|
-
}),
|
|
1751
|
+
}), Xl = /* @__PURE__ */ Z(Ql, [["__scopeId", "data-v-2482da45"]]), 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
1752
|
__name: "BlocksTree",
|
|
1722
1753
|
props: {
|
|
1723
1754
|
nodes: {},
|
|
@@ -1730,27 +1761,27 @@ const vl = { class: "wx-block-editor" }, hl = { class: "wx-block-editor__head" }
|
|
|
1730
1761
|
},
|
|
1731
1762
|
emits: ["select", "add", "remove", "duplicate", "reorder"],
|
|
1732
1763
|
setup(t, { emit: l }) {
|
|
1733
|
-
const a = t, s = l, o =
|
|
1764
|
+
const a = t, s = l, o = Q("webx-blocks");
|
|
1734
1765
|
function i(_) {
|
|
1735
1766
|
return a.catalog.find((k) => k.slug === _.type) ?? null;
|
|
1736
1767
|
}
|
|
1737
1768
|
function n(_) {
|
|
1738
1769
|
return i(_)?.title ?? _.type;
|
|
1739
1770
|
}
|
|
1740
|
-
function
|
|
1771
|
+
function h(_) {
|
|
1741
1772
|
const k = i(_);
|
|
1742
|
-
return k?.content ?
|
|
1773
|
+
return k?.content ? xt(k.content.schema) : [];
|
|
1743
1774
|
}
|
|
1744
|
-
function
|
|
1745
|
-
const
|
|
1746
|
-
return Array.isArray(
|
|
1775
|
+
function p(_, k) {
|
|
1776
|
+
const b = _.values[k.id];
|
|
1777
|
+
return Array.isArray(b) ? b : [];
|
|
1747
1778
|
}
|
|
1748
|
-
function
|
|
1779
|
+
function S(_) {
|
|
1749
1780
|
return i(_)?.icon ?? "grid";
|
|
1750
1781
|
}
|
|
1751
1782
|
return (_, k) => {
|
|
1752
|
-
const
|
|
1753
|
-
return r(),
|
|
1783
|
+
const b = je("blocks-tree", !0);
|
|
1784
|
+
return r(), W(e(Dt), {
|
|
1754
1785
|
"model-value": t.nodes,
|
|
1755
1786
|
"item-key": "key",
|
|
1756
1787
|
"item-label": (m) => n(m),
|
|
@@ -1758,59 +1789,59 @@ const vl = { class: "wx-block-editor" }, hl = { class: "wx-block-editor__head" }
|
|
|
1758
1789
|
plain: "",
|
|
1759
1790
|
size: "sm",
|
|
1760
1791
|
"empty-text": t.depth === 0 ? e(o)("field.empty") : "",
|
|
1761
|
-
class:
|
|
1792
|
+
class: me(["wx-blocks-tree", { "is-nested": t.depth > 0 }]),
|
|
1762
1793
|
"onUpdate:modelValue": k[6] || (k[6] = (m) => s("reorder", t.parentKey, t.field, m))
|
|
1763
1794
|
}, {
|
|
1764
|
-
default:
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
class:
|
|
1795
|
+
default: c(({ item: m }) => [
|
|
1796
|
+
x("div", en, [
|
|
1797
|
+
x("div", {
|
|
1798
|
+
class: me(["wx-blocks-tree__row", { "is-selected": t.selected === m.key }]),
|
|
1768
1799
|
role: "button",
|
|
1769
1800
|
tabindex: "0",
|
|
1770
1801
|
onClick: (y) => s("select", m.key),
|
|
1771
1802
|
onKeydown: [
|
|
1772
|
-
|
|
1773
|
-
|
|
1803
|
+
Ge(Me((y) => s("select", m.key), ["prevent"]), ["enter"]),
|
|
1804
|
+
Ge(Me((y) => s("select", m.key), ["prevent"]), ["space"])
|
|
1774
1805
|
]
|
|
1775
1806
|
}, [
|
|
1776
|
-
|
|
1807
|
+
x("span", ln, [
|
|
1777
1808
|
u(e(ne), {
|
|
1778
|
-
name:
|
|
1809
|
+
name: S(m)
|
|
1779
1810
|
}, null, 8, ["name"])
|
|
1780
1811
|
]),
|
|
1781
|
-
|
|
1782
|
-
i(m) ? i(m)?.draft ? (r(),
|
|
1812
|
+
x("span", nn, f(n(m)), 1),
|
|
1813
|
+
i(m) ? i(m)?.draft ? (r(), V("span", {
|
|
1783
1814
|
key: 1,
|
|
1784
1815
|
class: "wx-blocks-tree__flag is-warning",
|
|
1785
1816
|
title: e(o)("field.draft-type")
|
|
1786
1817
|
}, [
|
|
1787
1818
|
u(e(ne), { name: "warning" })
|
|
1788
|
-
], 8,
|
|
1819
|
+
], 8, sn)) : i(m)?.is_enabled === !1 ? (r(), V("span", {
|
|
1789
1820
|
key: 2,
|
|
1790
1821
|
class: "wx-blocks-tree__flag",
|
|
1791
1822
|
title: e(o)("field.disabled-type")
|
|
1792
1823
|
}, [
|
|
1793
1824
|
u(e(ne), { name: "eye-off" })
|
|
1794
|
-
], 8,
|
|
1825
|
+
], 8, on)) : E("", !0) : (r(), V("span", {
|
|
1795
1826
|
key: 0,
|
|
1796
1827
|
class: "wx-blocks-tree__flag is-danger",
|
|
1797
1828
|
title: e(o)("field.unknown-type", { type: m.type })
|
|
1798
1829
|
}, [
|
|
1799
1830
|
u(e(ne), { name: "close-circle" })
|
|
1800
|
-
], 8,
|
|
1801
|
-
t.disabled ? E("", !0) : (r(),
|
|
1831
|
+
], 8, an)),
|
|
1832
|
+
t.disabled ? E("", !0) : (r(), V("span", {
|
|
1802
1833
|
key: 3,
|
|
1803
1834
|
class: "wx-blocks-tree__actions",
|
|
1804
|
-
onClick: k[0] || (k[0] =
|
|
1835
|
+
onClick: k[0] || (k[0] = Me(() => {
|
|
1805
1836
|
}, ["stop"]))
|
|
1806
1837
|
}, [
|
|
1807
|
-
u(e(
|
|
1838
|
+
u(e(Xe), {
|
|
1808
1839
|
icon: "copy",
|
|
1809
1840
|
size: "sm",
|
|
1810
1841
|
title: e(o)("field.duplicate"),
|
|
1811
1842
|
onClick: (y) => s("duplicate", m.key)
|
|
1812
1843
|
}, null, 8, ["title", "onClick"]),
|
|
1813
|
-
u(e(
|
|
1844
|
+
u(e(Xe), {
|
|
1814
1845
|
icon: "trash",
|
|
1815
1846
|
size: "sm",
|
|
1816
1847
|
tone: "danger",
|
|
@@ -1818,13 +1849,13 @@ const vl = { class: "wx-block-editor" }, hl = { class: "wx-block-editor__head" }
|
|
|
1818
1849
|
onClick: (y) => s("remove", m.key)
|
|
1819
1850
|
}, null, 8, ["title", "onClick"])
|
|
1820
1851
|
]))
|
|
1821
|
-
], 42,
|
|
1822
|
-
(r(!0),
|
|
1852
|
+
], 42, tn),
|
|
1853
|
+
(r(!0), V(j, null, Y(h(m), (y) => (r(), V("div", {
|
|
1823
1854
|
key: y.id,
|
|
1824
1855
|
class: "wx-blocks-tree__kids"
|
|
1825
1856
|
}, [
|
|
1826
|
-
u(
|
|
1827
|
-
nodes:
|
|
1857
|
+
u(b, {
|
|
1858
|
+
nodes: p(m, y),
|
|
1828
1859
|
catalog: t.catalog,
|
|
1829
1860
|
"parent-key": m.key,
|
|
1830
1861
|
field: y.id,
|
|
@@ -1832,22 +1863,22 @@ const vl = { class: "wx-block-editor" }, hl = { class: "wx-block-editor__head" }
|
|
|
1832
1863
|
disabled: t.disabled,
|
|
1833
1864
|
depth: t.depth + 1,
|
|
1834
1865
|
onSelect: k[1] || (k[1] = (g) => s("select", g)),
|
|
1835
|
-
onAdd: k[2] || (k[2] = (g,
|
|
1866
|
+
onAdd: k[2] || (k[2] = (g, d, w) => s("add", g, d, w)),
|
|
1836
1867
|
onRemove: k[3] || (k[3] = (g) => s("remove", g)),
|
|
1837
1868
|
onDuplicate: k[4] || (k[4] = (g) => s("duplicate", g)),
|
|
1838
|
-
onReorder: k[5] || (k[5] = (g,
|
|
1869
|
+
onReorder: k[5] || (k[5] = (g, d, w) => s("reorder", g, d, w))
|
|
1839
1870
|
}, null, 8, ["nodes", "catalog", "parent-key", "field", "selected", "disabled", "depth"]),
|
|
1840
|
-
t.disabled ? E("", !0) : (r(),
|
|
1871
|
+
t.disabled ? E("", !0) : (r(), V("button", {
|
|
1841
1872
|
key: 0,
|
|
1842
1873
|
type: "button",
|
|
1843
1874
|
class: "wx-blocks-tree__add is-inner",
|
|
1844
1875
|
onClick: (g) => s("add", m.key, y.id, y)
|
|
1845
1876
|
}, [
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1877
|
+
$(" + " + f(e(o)("field.add-inside")), 1),
|
|
1878
|
+
h(m).length > 1 ? (r(), V(j, { key: 0 }, [
|
|
1879
|
+
$(" · " + f(y.label ?? y.id), 1)
|
|
1849
1880
|
], 64)) : E("", !0)
|
|
1850
|
-
], 8,
|
|
1881
|
+
], 8, rn))
|
|
1851
1882
|
]))), 128))
|
|
1852
1883
|
])
|
|
1853
1884
|
]),
|
|
@@ -1855,30 +1886,27 @@ const vl = { class: "wx-block-editor" }, hl = { class: "wx-block-editor__head" }
|
|
|
1855
1886
|
}, 8, ["model-value", "item-label", "disabled", "empty-text", "class"]);
|
|
1856
1887
|
};
|
|
1857
1888
|
}
|
|
1858
|
-
}),
|
|
1859
|
-
function
|
|
1860
|
-
|
|
1889
|
+
}), cn = /* @__PURE__ */ Z(un, [["__scopeId", "data-v-5d559d85"]]), Ke = /* @__PURE__ */ Symbol("wx-blocks-preview");
|
|
1890
|
+
function qn(t) {
|
|
1891
|
+
rt(Ke, t);
|
|
1861
1892
|
}
|
|
1862
|
-
function
|
|
1863
|
-
return
|
|
1893
|
+
function Jn() {
|
|
1894
|
+
return ze(Ke, null);
|
|
1864
1895
|
}
|
|
1865
|
-
const
|
|
1896
|
+
const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
1866
1897
|
key: 0,
|
|
1867
1898
|
class: "wx-blocks-nested"
|
|
1868
|
-
},
|
|
1869
|
-
key: 1,
|
|
1870
|
-
class: "wx-blocks-host"
|
|
1871
|
-
}, dn = { class: "wx-blocks__tree" }, pn = { class: "wx-blocks__panel-head" }, fn = { class: "wx-blocks__panel-title" }, mn = {
|
|
1899
|
+
}, pn = { class: "wx-blocks__tree" }, fn = { class: "wx-blocks__panel-head" }, mn = { class: "wx-blocks__panel-title" }, vn = {
|
|
1872
1900
|
key: 0,
|
|
1873
1901
|
class: "wx-blocks__fields"
|
|
1874
|
-
},
|
|
1902
|
+
}, hn = { class: "wx-blocks__panel-head" }, bn = { class: "wx-blocks__panel-title" }, gn = { class: "wx-blocks__panel-extra" }, kn = { class: "wx-blocks__form" }, yn = {
|
|
1875
1903
|
key: 1,
|
|
1876
1904
|
class: "wx-blocks__preview"
|
|
1877
|
-
},
|
|
1905
|
+
}, wn = /* @__PURE__ */ K({
|
|
1878
1906
|
name: "WxBlocks",
|
|
1879
1907
|
inheritAttrs: !1,
|
|
1880
1908
|
__name: "BlocksField",
|
|
1881
|
-
props: /* @__PURE__ */
|
|
1909
|
+
props: /* @__PURE__ */ Ut({
|
|
1882
1910
|
node: { default: void 0 },
|
|
1883
1911
|
context: { default: void 0 },
|
|
1884
1912
|
name: { default: void 0 },
|
|
@@ -1887,144 +1915,148 @@ const st = /* @__PURE__ */ Symbol("wx-blocks-root"), un = {
|
|
|
1887
1915
|
max: { default: null },
|
|
1888
1916
|
catalog: { default: null },
|
|
1889
1917
|
disabled: { type: Boolean, default: !1 },
|
|
1890
|
-
blocksPath: { default: "/blocks" }
|
|
1918
|
+
blocksPath: { default: "/blocks" },
|
|
1919
|
+
fill: { type: Boolean, default: !1 }
|
|
1891
1920
|
}, {
|
|
1892
1921
|
modelValue: { default: () => [] },
|
|
1893
1922
|
modelModifiers: {}
|
|
1894
1923
|
}),
|
|
1895
1924
|
emits: ["update:modelValue"],
|
|
1896
1925
|
setup(t) {
|
|
1897
|
-
const l = t, a =
|
|
1898
|
-
|
|
1899
|
-
const o =
|
|
1926
|
+
const l = t, a = zt(t, "modelValue"), s = ze(ot, !1);
|
|
1927
|
+
rt(ot, !0), _e();
|
|
1928
|
+
const o = Q("webx-blocks"), i = ze(Nt, null);
|
|
1900
1929
|
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 =
|
|
1930
|
+
const h = U([]), p = C(() => l.catalog ?? h.value), S = C(() => Array.isArray(a.value) ? a.value : []), _ = U(null), k = C(() => _.value ? oe(S.value, _.value) : null), b = C(
|
|
1931
|
+
() => k.value ? p.value.find((A) => A.slug === k.value?.node.type) ?? null : null
|
|
1932
|
+
), m = ze(Ke, null), y = U(null), g = C(
|
|
1933
|
+
() => i?.state.manifest?.modules.find((A) => A.id === "blocks")?.meta?.groups ?? []
|
|
1934
|
+
), d = Et()?.type, w = 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(
|
|
1935
|
+
() => l.context?.translate ?? i?.i18n.t ?? ((A) => A)
|
|
1936
|
+
), M = C(() => l.context?.can ?? i?.can ?? (() => !0)), N = ht(Kl);
|
|
1937
|
+
function I(A) {
|
|
1938
|
+
a.value = A;
|
|
1910
1939
|
}
|
|
1911
|
-
async function P(
|
|
1912
|
-
const
|
|
1913
|
-
if (
|
|
1914
|
-
const ue = await
|
|
1915
|
-
catalog:
|
|
1916
|
-
parent:
|
|
1917
|
-
allow:
|
|
1918
|
-
tree:
|
|
1940
|
+
async function P(A, L, D) {
|
|
1941
|
+
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, ge = A === null ? l.max : D?.props?.max ?? null, Ce = A === null ? S.value : X && L ? X.node.values[L] ?? [] : [];
|
|
1942
|
+
if (ge != null && Ce.length >= ge) return;
|
|
1943
|
+
const ue = await N({
|
|
1944
|
+
catalog: p.value,
|
|
1945
|
+
parent: ee,
|
|
1946
|
+
allow: Te,
|
|
1947
|
+
tree: S.value,
|
|
1919
1948
|
groups: g.value,
|
|
1920
1949
|
blocksPath: l.blocksPath
|
|
1921
1950
|
});
|
|
1922
1951
|
if (!ue) return;
|
|
1923
|
-
const
|
|
1924
|
-
|
|
1952
|
+
const Be = sl(ue.slug, H(ue));
|
|
1953
|
+
I(nt(S.value, A, L, Ce.length, Be)), _.value = Be.key;
|
|
1925
1954
|
}
|
|
1926
|
-
function H(
|
|
1927
|
-
const L =
|
|
1928
|
-
for (const [
|
|
1929
|
-
(!Array.isArray(
|
|
1955
|
+
function H(A) {
|
|
1956
|
+
const L = A.content?.sample ?? {}, D = {};
|
|
1957
|
+
for (const [X, ee] of Object.entries(L))
|
|
1958
|
+
(!Array.isArray(ee) || ee.length === 0 || typeof ee[0] != "object") && (D[X] = ee);
|
|
1930
1959
|
return D;
|
|
1931
1960
|
}
|
|
1932
|
-
function
|
|
1933
|
-
_.value ===
|
|
1961
|
+
function xe(A) {
|
|
1962
|
+
_.value === A && (_.value = null), I(rl(S.value, A));
|
|
1934
1963
|
}
|
|
1935
|
-
function ie(
|
|
1936
|
-
const L = oe(
|
|
1964
|
+
function ie(A) {
|
|
1965
|
+
const L = oe(S.value, A);
|
|
1937
1966
|
if (!L) return;
|
|
1938
|
-
const D =
|
|
1939
|
-
|
|
1967
|
+
const D = $t(L.node);
|
|
1968
|
+
I(nt(S.value, L.parent?.key ?? null, L.field, L.index + 1, D)), _.value = D.key;
|
|
1940
1969
|
}
|
|
1941
|
-
function
|
|
1942
|
-
|
|
1970
|
+
function $e(A, L, D) {
|
|
1971
|
+
I(cl(S.value, A, L, D));
|
|
1943
1972
|
}
|
|
1944
|
-
function
|
|
1945
|
-
_.value = _.value ===
|
|
1973
|
+
function Ue(A) {
|
|
1974
|
+
_.value = _.value === A ? null : A;
|
|
1946
1975
|
}
|
|
1947
|
-
function
|
|
1976
|
+
function be() {
|
|
1948
1977
|
_.value = null;
|
|
1949
1978
|
}
|
|
1950
|
-
function
|
|
1951
|
-
_.value &&
|
|
1979
|
+
function Ve(A) {
|
|
1980
|
+
_.value && I(ul(S.value, _.value, A));
|
|
1952
1981
|
}
|
|
1953
1982
|
let re;
|
|
1954
1983
|
le(
|
|
1955
1984
|
() => k.value?.node.values,
|
|
1956
|
-
(
|
|
1957
|
-
if (!
|
|
1958
|
-
const D = _.value,
|
|
1985
|
+
(A, L) => {
|
|
1986
|
+
if (!A || !L || !b.value || !n || !m) return;
|
|
1987
|
+
const D = _.value, X = b.value.id;
|
|
1959
1988
|
clearTimeout(re), re = setTimeout(() => {
|
|
1960
|
-
!D || !n || n.render(
|
|
1961
|
-
y.value?.replace(D,
|
|
1989
|
+
!D || !n || n.render(X, { values: A, key: D }).then((ee) => {
|
|
1990
|
+
y.value?.replace(D, ee.html) || y.value?.refresh();
|
|
1962
1991
|
}).catch(() => {
|
|
1963
1992
|
});
|
|
1964
1993
|
}, 300);
|
|
1965
1994
|
},
|
|
1966
1995
|
{ deep: !0 }
|
|
1967
1996
|
);
|
|
1968
|
-
function se(
|
|
1969
|
-
|
|
1997
|
+
function se(A) {
|
|
1998
|
+
A.key === "Escape" && _.value && be();
|
|
1970
1999
|
}
|
|
1971
|
-
|
|
2000
|
+
ye(async () => {
|
|
1972
2001
|
if (window.addEventListener("keydown", se), l.catalog === null && i) {
|
|
1973
|
-
n =
|
|
2002
|
+
n = he(i);
|
|
1974
2003
|
try {
|
|
1975
|
-
|
|
1976
|
-
} catch (
|
|
1977
|
-
F.danger(
|
|
2004
|
+
h.value = await n.catalog();
|
|
2005
|
+
} catch (A) {
|
|
2006
|
+
F.danger(A.body?.message ?? String(A));
|
|
1978
2007
|
}
|
|
1979
|
-
} else i && (n =
|
|
1980
|
-
}),
|
|
2008
|
+
} else i && (n = he(i));
|
|
2009
|
+
}), Re(() => {
|
|
1981
2010
|
clearTimeout(re), window.removeEventListener("keydown", se);
|
|
1982
2011
|
});
|
|
1983
|
-
const
|
|
1984
|
-
() =>
|
|
2012
|
+
const Se = C(
|
|
2013
|
+
() => b.value?.content ? Je(b.value.content.schema) : []
|
|
1985
2014
|
);
|
|
1986
|
-
return (
|
|
2015
|
+
return (A, L) => e(s) ? (r(), V("div", dn, [
|
|
1987
2016
|
u(e(R), {
|
|
1988
2017
|
size: "sm",
|
|
1989
2018
|
tone: "muted"
|
|
1990
2019
|
}, {
|
|
1991
|
-
default:
|
|
1992
|
-
|
|
2020
|
+
default: c(() => [
|
|
2021
|
+
$(f(e(o)("field.nested-note")), 1)
|
|
1993
2022
|
]),
|
|
1994
2023
|
_: 1
|
|
1995
2024
|
})
|
|
1996
|
-
])) : (r(),
|
|
1997
|
-
|
|
1998
|
-
|
|
2025
|
+
])) : (r(), V("div", {
|
|
2026
|
+
key: 1,
|
|
2027
|
+
class: me(["wx-blocks-host", { "is-fill": t.fill }])
|
|
2028
|
+
}, [
|
|
2029
|
+
x("div", {
|
|
2030
|
+
class: me(["wx-blocks", {
|
|
1999
2031
|
"is-editing": k.value !== null,
|
|
2000
2032
|
"has-preview": e(m) !== null && e(m).url.value !== null
|
|
2001
2033
|
}])
|
|
2002
2034
|
}, [
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2035
|
+
x("div", pn, [
|
|
2036
|
+
x("div", fn, [
|
|
2037
|
+
x("span", mn, f(e(o)("field.blocks")), 1),
|
|
2006
2038
|
u(e(R), {
|
|
2007
2039
|
size: "sm",
|
|
2008
2040
|
tone: "muted"
|
|
2009
2041
|
}, {
|
|
2010
|
-
default:
|
|
2011
|
-
|
|
2042
|
+
default: c(() => [
|
|
2043
|
+
$(f(S.value.length), 1)
|
|
2012
2044
|
]),
|
|
2013
2045
|
_: 1
|
|
2014
2046
|
})
|
|
2015
2047
|
]),
|
|
2016
|
-
u(
|
|
2017
|
-
nodes:
|
|
2018
|
-
catalog:
|
|
2048
|
+
u(cn, {
|
|
2049
|
+
nodes: S.value,
|
|
2050
|
+
catalog: p.value,
|
|
2019
2051
|
selected: _.value,
|
|
2020
2052
|
disabled: t.disabled,
|
|
2021
|
-
onSelect:
|
|
2053
|
+
onSelect: Ue,
|
|
2022
2054
|
onAdd: P,
|
|
2023
|
-
onRemove:
|
|
2055
|
+
onRemove: xe,
|
|
2024
2056
|
onDuplicate: ie,
|
|
2025
|
-
onReorder:
|
|
2057
|
+
onReorder: $e
|
|
2026
2058
|
}, null, 8, ["nodes", "catalog", "selected", "disabled"]),
|
|
2027
|
-
!t.disabled && (t.max === null ||
|
|
2059
|
+
!t.disabled && (t.max === null || S.value.length < t.max) ? (r(), W(e(q), {
|
|
2028
2060
|
key: 0,
|
|
2029
2061
|
variant: "outline",
|
|
2030
2062
|
block: "",
|
|
@@ -2032,141 +2064,142 @@ const st = /* @__PURE__ */ Symbol("wx-blocks-root"), un = {
|
|
|
2032
2064
|
class: "wx-blocks__add",
|
|
2033
2065
|
onClick: L[0] || (L[0] = (D) => P(null, null, null))
|
|
2034
2066
|
}, {
|
|
2035
|
-
default:
|
|
2036
|
-
|
|
2067
|
+
default: c(() => [
|
|
2068
|
+
$(f(e(o)("field.add")), 1)
|
|
2037
2069
|
]),
|
|
2038
2070
|
_: 1
|
|
2039
2071
|
})) : E("", !0),
|
|
2040
|
-
e(m) && e(m).url.value ? (r(),
|
|
2072
|
+
e(m) && e(m).url.value ? (r(), W(e(q), {
|
|
2041
2073
|
key: 1,
|
|
2042
2074
|
variant: "text",
|
|
2043
2075
|
block: "",
|
|
2044
2076
|
class: "wx-blocks__preview-button",
|
|
2045
2077
|
onClick: L[1] || (L[1] = (D) => y.value?.open())
|
|
2046
2078
|
}, {
|
|
2047
|
-
default:
|
|
2048
|
-
|
|
2079
|
+
default: c(() => [
|
|
2080
|
+
$(f(e(o)("field.preview")), 1)
|
|
2049
2081
|
]),
|
|
2050
2082
|
_: 1
|
|
2051
2083
|
})) : E("", !0)
|
|
2052
2084
|
]),
|
|
2053
|
-
k.value ? (r(),
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2085
|
+
k.value ? (r(), V("div", vn, [
|
|
2086
|
+
x("div", hn, [
|
|
2087
|
+
x("span", bn, f(b.value?.title ?? k.value.node.type), 1),
|
|
2088
|
+
x("span", gn, [
|
|
2089
|
+
x("code", null, f(k.value.node.type), 1),
|
|
2058
2090
|
u(e(q), {
|
|
2059
2091
|
size: "sm",
|
|
2060
2092
|
variant: "outline",
|
|
2061
|
-
onClick:
|
|
2093
|
+
onClick: be
|
|
2062
2094
|
}, {
|
|
2063
|
-
default:
|
|
2064
|
-
|
|
2095
|
+
default: c(() => [
|
|
2096
|
+
$(f(e(o)("field.done")) + " · Esc", 1)
|
|
2065
2097
|
]),
|
|
2066
2098
|
_: 1
|
|
2067
2099
|
})
|
|
2068
2100
|
])
|
|
2069
2101
|
]),
|
|
2070
|
-
|
|
2071
|
-
|
|
2102
|
+
x("div", kn, [
|
|
2103
|
+
b.value?.content ? (r(), W(e(bt), {
|
|
2072
2104
|
key: k.value.node.key,
|
|
2073
2105
|
"model-value": k.value.node.values,
|
|
2074
|
-
root:
|
|
2106
|
+
root: Se.value,
|
|
2075
2107
|
types: w.value,
|
|
2076
2108
|
translate: B.value,
|
|
2077
2109
|
can: M.value,
|
|
2078
2110
|
disabled: t.disabled,
|
|
2079
|
-
"onUpdate:modelValue":
|
|
2080
|
-
}, null, 8, ["model-value", "root", "types", "translate", "can", "disabled"])) : (r(),
|
|
2111
|
+
"onUpdate:modelValue": Ve
|
|
2112
|
+
}, null, 8, ["model-value", "root", "types", "translate", "can", "disabled"])) : (r(), W(e(R), {
|
|
2081
2113
|
key: 1,
|
|
2082
2114
|
size: "sm",
|
|
2083
2115
|
tone: "danger"
|
|
2084
2116
|
}, {
|
|
2085
|
-
default:
|
|
2086
|
-
|
|
2117
|
+
default: c(() => [
|
|
2118
|
+
$(f(e(o)("field.unknown-type", { type: k.value.node.type })), 1)
|
|
2087
2119
|
]),
|
|
2088
2120
|
_: 1
|
|
2089
2121
|
}))
|
|
2090
2122
|
])
|
|
2091
2123
|
])) : E("", !0),
|
|
2092
|
-
e(m) && e(m).url.value ? (r(),
|
|
2093
|
-
u(
|
|
2124
|
+
e(m) && e(m).url.value ? (r(), V("div", yn, [
|
|
2125
|
+
u(Xl, {
|
|
2094
2126
|
ref_key: "previewEl",
|
|
2095
2127
|
ref: y,
|
|
2096
2128
|
url: e(m).url.value,
|
|
2097
2129
|
selected: _.value,
|
|
2098
2130
|
mode: k.value ? "phone" : "wide",
|
|
2099
|
-
reload: e(m).reload?.value ?? 0
|
|
2100
|
-
|
|
2131
|
+
reload: e(m).reload?.value ?? 0,
|
|
2132
|
+
fill: t.fill
|
|
2133
|
+
}, null, 8, ["url", "selected", "mode", "reload", "fill"])
|
|
2101
2134
|
])) : E("", !0)
|
|
2102
2135
|
], 2)
|
|
2103
|
-
]));
|
|
2136
|
+
], 2));
|
|
2104
2137
|
}
|
|
2105
|
-
}),
|
|
2138
|
+
}), _n = /* @__PURE__ */ Z(wn, [["__scopeId", "data-v-3f14c6c6"]]), xn = { class: "wx-block-card__body" }, $n = { class: "wx-block-card__title" }, Vn = { class: "wx-block-card__chips" }, Sn = /* @__PURE__ */ K({
|
|
2106
2139
|
__name: "BlockCard",
|
|
2107
2140
|
props: {
|
|
2108
2141
|
block: {}
|
|
2109
2142
|
},
|
|
2110
2143
|
emits: ["open"],
|
|
2111
2144
|
setup(t, { emit: l }) {
|
|
2112
|
-
const a = l, s =
|
|
2113
|
-
return (o, i) => (r(),
|
|
2145
|
+
const a = l, s = Q("webx-blocks");
|
|
2146
|
+
return (o, i) => (r(), V("button", {
|
|
2114
2147
|
type: "button",
|
|
2115
2148
|
class: "wx-block-card",
|
|
2116
2149
|
onClick: i[0] || (i[0] = (n) => a("open", t.block))
|
|
2117
2150
|
}, [
|
|
2118
|
-
u(
|
|
2151
|
+
u(Ct, {
|
|
2119
2152
|
thumbnail: t.block.thumbnail,
|
|
2120
2153
|
height: 120
|
|
2121
2154
|
}, null, 8, ["thumbnail"]),
|
|
2122
|
-
|
|
2123
|
-
|
|
2155
|
+
x("div", xn, [
|
|
2156
|
+
x("div", $n, f(t.block.title), 1),
|
|
2124
2157
|
u(e(R), {
|
|
2125
2158
|
size: "sm",
|
|
2126
2159
|
tone: "muted"
|
|
2127
2160
|
}, {
|
|
2128
|
-
default:
|
|
2129
|
-
|
|
2130
|
-
|
|
2161
|
+
default: c(() => [
|
|
2162
|
+
x("code", null, f(t.block.slug), 1),
|
|
2163
|
+
$(" · " + f(t.block.usage_count > 0 ? e(s)("page.on-pages", { count: t.block.usage_count }) : e(s)("page.not-used")), 1)
|
|
2131
2164
|
]),
|
|
2132
2165
|
_: 1
|
|
2133
2166
|
}),
|
|
2134
|
-
|
|
2135
|
-
t.block.draft ? (r(),
|
|
2167
|
+
x("div", Vn, [
|
|
2168
|
+
t.block.draft ? (r(), W(e(G), {
|
|
2136
2169
|
key: 0,
|
|
2137
2170
|
type: "warning",
|
|
2138
2171
|
dot: ""
|
|
2139
2172
|
}, {
|
|
2140
|
-
default:
|
|
2141
|
-
|
|
2173
|
+
default: c(() => [
|
|
2174
|
+
$(f(e(s)("page.draft", { number: t.block.draft.number })), 1)
|
|
2142
2175
|
]),
|
|
2143
2176
|
_: 1
|
|
2144
2177
|
})) : E("", !0),
|
|
2145
|
-
t.block.published ? (r(),
|
|
2178
|
+
t.block.published ? (r(), W(e(G), {
|
|
2146
2179
|
key: 1,
|
|
2147
2180
|
type: "success",
|
|
2148
2181
|
dot: ""
|
|
2149
2182
|
}, {
|
|
2150
|
-
default:
|
|
2151
|
-
|
|
2183
|
+
default: c(() => [
|
|
2184
|
+
$(f(e(s)("page.live", { number: t.block.published.number })), 1)
|
|
2152
2185
|
]),
|
|
2153
2186
|
_: 1
|
|
2154
|
-
})) : (r(),
|
|
2187
|
+
})) : (r(), W(e(G), {
|
|
2155
2188
|
key: 2,
|
|
2156
2189
|
type: "default"
|
|
2157
2190
|
}, {
|
|
2158
|
-
default:
|
|
2159
|
-
|
|
2191
|
+
default: c(() => [
|
|
2192
|
+
$(f(e(s)("page.never-published")), 1)
|
|
2160
2193
|
]),
|
|
2161
2194
|
_: 1
|
|
2162
2195
|
})),
|
|
2163
|
-
t.block.is_enabled ? E("", !0) : (r(),
|
|
2196
|
+
t.block.is_enabled ? E("", !0) : (r(), W(e(G), {
|
|
2164
2197
|
key: 3,
|
|
2165
2198
|
type: "default",
|
|
2166
2199
|
variant: "outline"
|
|
2167
2200
|
}, {
|
|
2168
|
-
default:
|
|
2169
|
-
|
|
2201
|
+
default: c(() => [
|
|
2202
|
+
$(f(e(s)("page.hidden")), 1)
|
|
2170
2203
|
]),
|
|
2171
2204
|
_: 1
|
|
2172
2205
|
}))
|
|
@@ -2174,52 +2207,52 @@ const st = /* @__PURE__ */ Symbol("wx-blocks-root"), un = {
|
|
|
2174
2207
|
])
|
|
2175
2208
|
]));
|
|
2176
2209
|
}
|
|
2177
|
-
}),
|
|
2210
|
+
}), Tn = /* @__PURE__ */ Z(Sn, [["__scopeId", "data-v-daa12de4"]]), Cn = { class: "wx-block-create" }, Bn = /* @__PURE__ */ K({
|
|
2178
2211
|
__name: "BlockCreateDialog",
|
|
2179
2212
|
setup(t) {
|
|
2180
|
-
const { resolve: l, dismiss: a, open: s } =
|
|
2181
|
-
|
|
2182
|
-
const n =
|
|
2183
|
-
() =>
|
|
2213
|
+
const { resolve: l, dismiss: a, open: s } = ft(), o = we(), i = he(o);
|
|
2214
|
+
_e();
|
|
2215
|
+
const n = Q("webx-blocks"), h = C(() => o.state.manifest?.modules.find((w) => w.id === "blocks")?.meta?.groups ?? ["content"]), p = U({ title: "", slug: "", group: h.value[0] ?? "content" }), S = U({}), _ = U(!1), k = U(!1), b = C(
|
|
2216
|
+
() => h.value.map((d) => ({ value: d, label: ke(d, n) }))
|
|
2184
2217
|
);
|
|
2185
|
-
function m(
|
|
2186
|
-
return
|
|
2218
|
+
function m(d) {
|
|
2219
|
+
return d.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/^[^a-z]+/, "").slice(0, 64);
|
|
2187
2220
|
}
|
|
2188
2221
|
le(
|
|
2189
|
-
() =>
|
|
2190
|
-
(
|
|
2191
|
-
k.value || (
|
|
2222
|
+
() => p.value.title,
|
|
2223
|
+
(d) => {
|
|
2224
|
+
k.value || (p.value.slug = m(d));
|
|
2192
2225
|
}
|
|
2193
2226
|
);
|
|
2194
|
-
function y(
|
|
2195
|
-
return
|
|
2227
|
+
function y(d) {
|
|
2228
|
+
return S.value[d]?.[0];
|
|
2196
2229
|
}
|
|
2197
2230
|
async function g() {
|
|
2198
|
-
_.value = !0,
|
|
2231
|
+
_.value = !0, S.value = {};
|
|
2199
2232
|
try {
|
|
2200
|
-
l(await i.create(
|
|
2201
|
-
} catch (
|
|
2202
|
-
const w =
|
|
2203
|
-
w?.errors ?
|
|
2233
|
+
l(await i.create(p.value));
|
|
2234
|
+
} catch (d) {
|
|
2235
|
+
const w = d.body;
|
|
2236
|
+
w?.errors ? S.value = w.errors : F.danger(w?.message ?? n("page.failed"));
|
|
2204
2237
|
} finally {
|
|
2205
2238
|
_.value = !1;
|
|
2206
2239
|
}
|
|
2207
2240
|
}
|
|
2208
|
-
return (
|
|
2241
|
+
return (d, w) => (r(), W(e(mt), {
|
|
2209
2242
|
open: e(s),
|
|
2210
|
-
"onUpdate:open": w[5] || (w[5] = (B) =>
|
|
2243
|
+
"onUpdate:open": w[5] || (w[5] = (B) => it(s) ? s.value = B : null),
|
|
2211
2244
|
title: e(n)("page.new"),
|
|
2212
2245
|
width: 520
|
|
2213
2246
|
}, {
|
|
2214
|
-
footer:
|
|
2215
|
-
u(e(
|
|
2216
|
-
default:
|
|
2247
|
+
footer: c(() => [
|
|
2248
|
+
u(e(Ot), { size: "sm" }, {
|
|
2249
|
+
default: c(() => [
|
|
2217
2250
|
u(e(q), {
|
|
2218
2251
|
variant: "outline",
|
|
2219
2252
|
onClick: w[4] || (w[4] = (B) => e(a)())
|
|
2220
2253
|
}, {
|
|
2221
|
-
default:
|
|
2222
|
-
|
|
2254
|
+
default: c(() => [
|
|
2255
|
+
$(f(e(n)("page.cancel")), 1)
|
|
2223
2256
|
]),
|
|
2224
2257
|
_: 1
|
|
2225
2258
|
}),
|
|
@@ -2228,8 +2261,8 @@ const st = /* @__PURE__ */ Symbol("wx-blocks-root"), un = {
|
|
|
2228
2261
|
loading: _.value,
|
|
2229
2262
|
onClick: g
|
|
2230
2263
|
}, {
|
|
2231
|
-
default:
|
|
2232
|
-
|
|
2264
|
+
default: c(() => [
|
|
2265
|
+
$(f(e(n)("page.create")), 1)
|
|
2233
2266
|
]),
|
|
2234
2267
|
_: 1
|
|
2235
2268
|
}, 8, ["loading"])
|
|
@@ -2237,16 +2270,16 @@ const st = /* @__PURE__ */ Symbol("wx-blocks-root"), un = {
|
|
|
2237
2270
|
_: 1
|
|
2238
2271
|
})
|
|
2239
2272
|
]),
|
|
2240
|
-
default:
|
|
2241
|
-
|
|
2273
|
+
default: c(() => [
|
|
2274
|
+
x("div", Cn, [
|
|
2242
2275
|
u(e(J), {
|
|
2243
2276
|
label: e(n)("page.title"),
|
|
2244
2277
|
error: y("title")
|
|
2245
2278
|
}, {
|
|
2246
|
-
default:
|
|
2247
|
-
u(e(
|
|
2248
|
-
modelValue:
|
|
2249
|
-
"onUpdate:modelValue": w[0] || (w[0] = (B) =>
|
|
2279
|
+
default: c(() => [
|
|
2280
|
+
u(e(ve), {
|
|
2281
|
+
modelValue: p.value.title,
|
|
2282
|
+
"onUpdate:modelValue": w[0] || (w[0] = (B) => p.value.title = B),
|
|
2250
2283
|
autofocus: ""
|
|
2251
2284
|
}, null, 8, ["modelValue"])
|
|
2252
2285
|
]),
|
|
@@ -2257,10 +2290,10 @@ const st = /* @__PURE__ */ Symbol("wx-blocks-root"), un = {
|
|
|
2257
2290
|
help: e(n)("page.identifier-help"),
|
|
2258
2291
|
error: y("slug")
|
|
2259
2292
|
}, {
|
|
2260
|
-
default:
|
|
2261
|
-
u(e(
|
|
2262
|
-
modelValue:
|
|
2263
|
-
"onUpdate:modelValue": w[1] || (w[1] = (B) =>
|
|
2293
|
+
default: c(() => [
|
|
2294
|
+
u(e(ve), {
|
|
2295
|
+
modelValue: p.value.slug,
|
|
2296
|
+
"onUpdate:modelValue": w[1] || (w[1] = (B) => p.value.slug = B),
|
|
2264
2297
|
placeholder: "hero",
|
|
2265
2298
|
onInput: w[2] || (w[2] = (B) => k.value = !0)
|
|
2266
2299
|
}, null, 8, ["modelValue"])
|
|
@@ -2272,11 +2305,11 @@ const st = /* @__PURE__ */ Symbol("wx-blocks-root"), un = {
|
|
|
2272
2305
|
help: e(n)("page.group-help"),
|
|
2273
2306
|
error: y("group")
|
|
2274
2307
|
}, {
|
|
2275
|
-
default:
|
|
2276
|
-
u(e(
|
|
2277
|
-
modelValue:
|
|
2278
|
-
"onUpdate:modelValue": w[3] || (w[3] = (B) =>
|
|
2279
|
-
options:
|
|
2308
|
+
default: c(() => [
|
|
2309
|
+
u(e(pt), {
|
|
2310
|
+
modelValue: p.value.group,
|
|
2311
|
+
"onUpdate:modelValue": w[3] || (w[3] = (B) => p.value.group = B),
|
|
2312
|
+
options: b.value
|
|
2280
2313
|
}, null, 8, ["modelValue", "options"])
|
|
2281
2314
|
]),
|
|
2282
2315
|
_: 1
|
|
@@ -2286,128 +2319,156 @@ const st = /* @__PURE__ */ Symbol("wx-blocks-root"), un = {
|
|
|
2286
2319
|
_: 1
|
|
2287
2320
|
}, 8, ["open", "title"]));
|
|
2288
2321
|
}
|
|
2289
|
-
}),
|
|
2322
|
+
}), Wn = /* @__PURE__ */ Z(Bn, [["__scopeId", "data-v-274bc88a"]]), An = { class: "wx-blocks-page" }, zn = { class: "wx-blocks-page__head" }, En = { class: "wx-blocks-page__cards" }, Un = { class: "wx-blocks-page__ghost-body" }, In = {
|
|
2290
2323
|
key: 0,
|
|
2291
2324
|
class: "wx-blocks-page__group-title"
|
|
2292
|
-
},
|
|
2325
|
+
}, Nn = { class: "wx-blocks-page__cards" }, Ln = /* @__PURE__ */ K({
|
|
2293
2326
|
__name: "BlocksPage",
|
|
2294
2327
|
props: {
|
|
2295
2328
|
base: { default: "/blocks" }
|
|
2296
2329
|
},
|
|
2297
2330
|
setup(t) {
|
|
2298
|
-
const l = t, a =
|
|
2299
|
-
|
|
2300
|
-
const i =
|
|
2331
|
+
const l = t, a = we(), s = he(a), o = ut();
|
|
2332
|
+
_e();
|
|
2333
|
+
const i = Q("webx-blocks"), n = U([]), h = U(!0), p = U(""), S = ht(Wn), _ = C(() => {
|
|
2301
2334
|
const B = a.state.manifest?.modules.find((M) => M.id === "blocks")?.meta;
|
|
2302
2335
|
return {
|
|
2303
2336
|
groups: B?.groups ?? [],
|
|
2304
2337
|
editing: B?.editing ?? !0,
|
|
2305
2338
|
provides: B?.provides ?? []
|
|
2306
2339
|
};
|
|
2307
|
-
}), k = C(() => a.can("blocks.manage") && _.value.editing),
|
|
2340
|
+
}), k = C(() => a.can("blocks.manage") && _.value.editing), b = C(
|
|
2308
2341
|
() => a.state.manifest?.modules.find((B) => B.id === "blocks")?.title ?? i("module.title")
|
|
2309
2342
|
), m = C(() => {
|
|
2310
|
-
const B =
|
|
2343
|
+
const B = p.value.trim().toLowerCase();
|
|
2311
2344
|
return B === "" ? n.value : n.value.filter(
|
|
2312
2345
|
(M) => M.title.toLowerCase().includes(B) || M.slug.includes(B) || (M.description ?? "").toLowerCase().includes(B)
|
|
2313
2346
|
);
|
|
2314
2347
|
}), y = C(() => {
|
|
2315
2348
|
const B = [..._.value.groups];
|
|
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 ||
|
|
2349
|
+
for (const I of m.value)
|
|
2350
|
+
B.includes(I.group) || B.push(I.group);
|
|
2351
|
+
const M = B.map((I) => ({
|
|
2352
|
+
id: I,
|
|
2353
|
+
label: ke(I, i),
|
|
2354
|
+
blocks: m.value.filter((P) => P.group === I)
|
|
2355
|
+
})).filter((I) => I.blocks.length > 0);
|
|
2356
|
+
return m.value.length <= 5 || p.value.trim() !== "" || M.length < 2 ? [{ id: "", label: "", blocks: m.value }] : M;
|
|
2324
2357
|
});
|
|
2325
2358
|
async function g() {
|
|
2326
|
-
|
|
2359
|
+
h.value = !0;
|
|
2327
2360
|
try {
|
|
2328
2361
|
n.value = await s.list();
|
|
2329
2362
|
} catch (B) {
|
|
2330
2363
|
F.danger(B.body?.message ?? String(B));
|
|
2331
2364
|
} finally {
|
|
2332
|
-
|
|
2365
|
+
h.value = !1;
|
|
2333
2366
|
}
|
|
2334
2367
|
}
|
|
2335
|
-
function
|
|
2368
|
+
function d(B) {
|
|
2336
2369
|
o.push(`${l.base}/${B.id}`);
|
|
2337
2370
|
}
|
|
2338
2371
|
async function w() {
|
|
2339
|
-
const B = await
|
|
2340
|
-
B &&
|
|
2372
|
+
const B = await S({});
|
|
2373
|
+
B && d(B);
|
|
2341
2374
|
}
|
|
2342
|
-
return
|
|
2343
|
-
|
|
2344
|
-
u(e(
|
|
2345
|
-
default:
|
|
2346
|
-
|
|
2375
|
+
return ye(g), (B, M) => (r(), V("div", An, [
|
|
2376
|
+
x("div", zn, [
|
|
2377
|
+
u(e(Rt), { level: 2 }, {
|
|
2378
|
+
default: c(() => [
|
|
2379
|
+
$(f(b.value), 1)
|
|
2347
2380
|
]),
|
|
2348
2381
|
_: 1
|
|
2349
2382
|
}),
|
|
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
|
-
])
|
|
2383
|
+
k.value ? (r(), W(e(q), {
|
|
2384
|
+
key: 0,
|
|
2385
|
+
type: "primary",
|
|
2386
|
+
icon: "plus",
|
|
2387
|
+
onClick: w
|
|
2388
|
+
}, {
|
|
2389
|
+
default: c(() => [
|
|
2390
|
+
$(f(e(i)("page.new")), 1)
|
|
2391
|
+
]),
|
|
2392
|
+
_: 1
|
|
2393
|
+
})) : E("", !0)
|
|
2369
2394
|
]),
|
|
2370
|
-
_.value.editing ? E("", !0) : (r(),
|
|
2395
|
+
_.value.editing ? E("", !0) : (r(), W(e(dt), {
|
|
2371
2396
|
key: 0,
|
|
2372
2397
|
type: "info",
|
|
2373
2398
|
variant: "soft",
|
|
2374
2399
|
description: e(i)("page.editing-off")
|
|
2375
2400
|
}, null, 8, ["description"])),
|
|
2376
|
-
|
|
2401
|
+
h.value || n.value.length > 0 ? (r(), W(e(ve), {
|
|
2377
2402
|
key: 1,
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2403
|
+
modelValue: p.value,
|
|
2404
|
+
"onUpdate:modelValue": M[0] || (M[0] = (N) => p.value = N),
|
|
2405
|
+
class: "wx-blocks-page__search",
|
|
2406
|
+
placeholder: e(i)("page.search"),
|
|
2407
|
+
clearable: ""
|
|
2408
|
+
}, null, 8, ["modelValue", "placeholder"])) : E("", !0),
|
|
2409
|
+
h.value ? (r(), W(e(pe), { key: 2 }, {
|
|
2410
|
+
template: c(() => [
|
|
2411
|
+
x("div", En, [
|
|
2412
|
+
(r(), V(j, null, Y(4, (N) => x("div", {
|
|
2413
|
+
key: N,
|
|
2414
|
+
class: "wx-blocks-page__ghost"
|
|
2415
|
+
}, [
|
|
2416
|
+
u(e(Ae), {
|
|
2417
|
+
variant: "image",
|
|
2418
|
+
height: 120,
|
|
2419
|
+
class: "wx-blocks-page__ghost-thumb"
|
|
2420
|
+
}),
|
|
2421
|
+
x("div", Un, [
|
|
2422
|
+
u(e(Ae), {
|
|
2423
|
+
variant: "title",
|
|
2424
|
+
width: "45%"
|
|
2425
|
+
}),
|
|
2426
|
+
u(e(Ae), {
|
|
2427
|
+
variant: "text",
|
|
2428
|
+
width: "70%"
|
|
2429
|
+
}),
|
|
2430
|
+
u(e(Ae), {
|
|
2431
|
+
variant: "button",
|
|
2432
|
+
width: "64px",
|
|
2433
|
+
height: "22px"
|
|
2434
|
+
})
|
|
2435
|
+
])
|
|
2436
|
+
])), 64))
|
|
2437
|
+
])
|
|
2438
|
+
]),
|
|
2439
|
+
_: 1
|
|
2440
|
+
})) : n.value.length === 0 ? (r(), W(e(vt), {
|
|
2441
|
+
key: 3,
|
|
2381
2442
|
icon: "grid",
|
|
2382
2443
|
title: e(i)("page.empty"),
|
|
2383
2444
|
description: e(i)("page.empty-help")
|
|
2384
|
-
}, null, 8, ["title", "description"])) : (r(!0),
|
|
2385
|
-
key:
|
|
2445
|
+
}, null, 8, ["title", "description"])) : (r(!0), V(j, { key: 4 }, Y(y.value, (N) => (r(), V("section", {
|
|
2446
|
+
key: N.id,
|
|
2386
2447
|
class: "wx-blocks-page__group"
|
|
2387
2448
|
}, [
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
(r(!0),
|
|
2391
|
-
key:
|
|
2392
|
-
block:
|
|
2393
|
-
onOpen:
|
|
2449
|
+
N.label ? (r(), V("div", In, f(N.label), 1)) : E("", !0),
|
|
2450
|
+
x("div", Nn, [
|
|
2451
|
+
(r(!0), V(j, null, Y(N.blocks, (I) => (r(), W(Tn, {
|
|
2452
|
+
key: I.id,
|
|
2453
|
+
block: I,
|
|
2454
|
+
onOpen: d
|
|
2394
2455
|
}, null, 8, ["block"]))), 128))
|
|
2395
2456
|
])
|
|
2396
2457
|
]))), 128))
|
|
2397
2458
|
]));
|
|
2398
2459
|
}
|
|
2399
|
-
}),
|
|
2400
|
-
function
|
|
2460
|
+
}), Mn = /* @__PURE__ */ Z(Ln, [["__scopeId", "data-v-6e58b664"]]);
|
|
2461
|
+
function Kn(t = {}) {
|
|
2401
2462
|
const l = t.path ?? "/blocks";
|
|
2402
2463
|
return {
|
|
2403
2464
|
id: "blocks",
|
|
2404
2465
|
path: l,
|
|
2405
2466
|
routes: [
|
|
2406
|
-
{ path: l, name: "webx.blocks", component:
|
|
2467
|
+
{ path: l, name: "webx.blocks", component: Mn, props: { base: l } },
|
|
2407
2468
|
{
|
|
2408
2469
|
path: `${l}/:id(\\d+)`,
|
|
2409
2470
|
name: "webx.blocks.edit",
|
|
2410
|
-
component:
|
|
2471
|
+
component: Ll,
|
|
2411
2472
|
props: { base: l }
|
|
2412
2473
|
}
|
|
2413
2474
|
],
|
|
@@ -2416,7 +2477,7 @@ function qn(t = {}) {
|
|
|
2416
2477
|
// draws its children through the renderer; it needs the node for `props.allow` alone.
|
|
2417
2478
|
types: {
|
|
2418
2479
|
"wx-blocks": {
|
|
2419
|
-
component:
|
|
2480
|
+
component: _n,
|
|
2420
2481
|
kind: "field",
|
|
2421
2482
|
nested: !0,
|
|
2422
2483
|
bind: () => ({ blocksPath: l })
|
|
@@ -2425,37 +2486,37 @@ function qn(t = {}) {
|
|
|
2425
2486
|
};
|
|
2426
2487
|
}
|
|
2427
2488
|
export {
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2489
|
+
Ll as WxBlockEditorPage,
|
|
2490
|
+
Kl as WxBlockPicker,
|
|
2491
|
+
al as WxBlockStage,
|
|
2492
|
+
Ct as WxBlockThumb,
|
|
2493
|
+
_n as WxBlocks,
|
|
2494
|
+
Mn as WxBlocksPage,
|
|
2495
|
+
Kn as blocks,
|
|
2496
|
+
dl as blocksMessages,
|
|
2497
|
+
Ke as blocksPreviewKey,
|
|
2498
|
+
$t as cloneNode,
|
|
2499
|
+
ol as countType,
|
|
2500
|
+
he as createBlocksApi,
|
|
2501
|
+
gt as findRange,
|
|
2502
|
+
Je as formSchema,
|
|
2503
|
+
De as highlightBlock,
|
|
2504
|
+
nt as insertNode,
|
|
2505
|
+
yt as isNode,
|
|
2506
|
+
Fe as isNodeList,
|
|
2507
|
+
fl as lintBlock,
|
|
2447
2508
|
oe as locate,
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2509
|
+
sl as makeNode,
|
|
2510
|
+
wt as newKey,
|
|
2511
|
+
qn as provideBlocksPreview,
|
|
2512
|
+
rl as removeNode,
|
|
2513
|
+
Yt as replaceBlock,
|
|
2514
|
+
cl as replaceList,
|
|
2515
|
+
kt as stageDocument,
|
|
2516
|
+
Fn as typesIn,
|
|
2517
|
+
ml as undeclared,
|
|
2518
|
+
ul as updateValues,
|
|
2519
|
+
Jn as useBlocksPreview,
|
|
2520
|
+
qe as walk
|
|
2460
2521
|
};
|
|
2461
2522
|
//# sourceMappingURL=index.js.map
|