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