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