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