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