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