@webx-ui/module-blocks 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BlocksTree.d.ts +8 -2
- package/dist/index.js +1342 -1324
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { WxCodeEditor as
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useAdmin as
|
|
1
|
+
import { WxCodeEditor as Je, WxText as H, WxIcon as we, WxSkeleton as Ue, WxBadge as he, WxButton as ce, confirm as dt, toast as J, useElementWidth as pt, WxSegmented as Yt, WxCard as ze, WxPopover as Al, WxAlert as Gt, WxTabs as Bl, WxTab as Pe, WxFormItem as oe, WxSelect as wt, WxInput as Xe, WxTextarea as Zt, WxIconPicker as Ll, WxInputNumber as Wt, WxTagsInput as Nt, WxSwitch as Wl, WxActionBar as Nl, useModal as Qt, WxDialog as Xt, WxEmpty as el, WxAction as Ye, WxSortableList as zl, createModal as tl, WxDrawer as Ml, WxRadioGroup as Ol, WxRadio as zt, WxSpace as Dl, WxSkeletonItem as it } from "@webx-ui/core";
|
|
2
|
+
import { defineComponent as ae, ref as I, watch as se, openBlock as c, createElementBlock as _, createVNode as v, unref as n, createBlock as O, withCtx as g, createTextVNode as L, toDisplayString as w, createCommentVNode as W, computed as S, createElementVNode as V, Fragment as R, renderList as Y, onMounted as et, onBeforeUnmount as tt, normalizeStyle as Oe, reactive as vt, resolveComponent as St, normalizeClass as De, withDirectives as Il, vShow as Pl, inject as Ge, watchEffect as Ul, isRef as ll, nextTick as Rl, withKeys as Mt, withModifiers as Ot, provide as nl, useModel as jl, getCurrentInstance as Fl, resolveDynamicComponent as Hl, mergeProps as ql, mergeModels as Kl } from "vue";
|
|
3
|
+
import { useAdmin as lt, useTranslate as de, useErrorText as nt, WxDate as Jl, WxScreenHead as Yl, WxRenameButton as Gl, WxHelpButton as Zl, adminKey as ol, WxRowMenu as Ql, WxListScreen as Xl } from "@webx-ui/module-admin";
|
|
4
4
|
import { useRoute as en, useRouter as sl } from "vue-router";
|
|
5
5
|
import { WxScreenRenderer as al, coreTypes as rt } from "@webx-ui/schema";
|
|
6
|
-
import { autocompletion as tn, pickedCompletion as Fe, snippetCompletion as
|
|
6
|
+
import { autocompletion as tn, pickedCompletion as Fe, snippetCompletion as ke, startCompletion as ln } from "@codemirror/autocomplete";
|
|
7
7
|
import { EditorState as nn } from "@codemirror/state";
|
|
8
8
|
const on = {
|
|
9
9
|
module: {
|
|
@@ -111,6 +111,7 @@ const on = {
|
|
|
111
111
|
blocks: "Blocks",
|
|
112
112
|
add: "Add a block",
|
|
113
113
|
"add-inside": "Add inside",
|
|
114
|
+
"add-after": "Add after",
|
|
114
115
|
done: "Done",
|
|
115
116
|
remove: "Remove",
|
|
116
117
|
"remove-title": 'Remove ":title"?',
|
|
@@ -200,14 +201,14 @@ const on = {
|
|
|
200
201
|
"ok-variables": "Every variable of the template is a field of the schema."
|
|
201
202
|
}
|
|
202
203
|
}, Dt = /* @__PURE__ */ new WeakSet();
|
|
203
|
-
function
|
|
204
|
+
function Ie() {
|
|
204
205
|
try {
|
|
205
|
-
const { i18n: e } =
|
|
206
|
+
const { i18n: e } = lt();
|
|
206
207
|
Dt.has(e) || (e.defaults("webx-blocks", on), Dt.add(e));
|
|
207
208
|
} catch {
|
|
208
209
|
}
|
|
209
210
|
}
|
|
210
|
-
const sn = { class: "wx-block-data" }, an = /* @__PURE__ */
|
|
211
|
+
const sn = { class: "wx-block-data" }, an = /* @__PURE__ */ ae({
|
|
211
212
|
__name: "BlockDataField",
|
|
212
213
|
props: {
|
|
213
214
|
modelValue: { default: void 0 },
|
|
@@ -215,39 +216,39 @@ const sn = { class: "wx-block-data" }, an = /* @__PURE__ */ se({
|
|
|
215
216
|
shape: { default: void 0 }
|
|
216
217
|
},
|
|
217
218
|
emits: ["update:modelValue"],
|
|
218
|
-
setup(e, { emit:
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
const a =
|
|
222
|
-
function u(
|
|
223
|
-
return
|
|
219
|
+
setup(e, { emit: l }) {
|
|
220
|
+
const t = e, o = l;
|
|
221
|
+
Ie();
|
|
222
|
+
const a = de("webx-blocks"), i = I(u(t.modelValue)), s = I(null);
|
|
223
|
+
function u(m) {
|
|
224
|
+
return m == null ? "" : JSON.stringify(m, null, 2);
|
|
224
225
|
}
|
|
225
|
-
function
|
|
226
|
-
return
|
|
226
|
+
function f(m) {
|
|
227
|
+
return m.trim() === "" ? null : JSON.parse(m);
|
|
227
228
|
}
|
|
228
|
-
function r(
|
|
229
|
-
i.value =
|
|
229
|
+
function r(m) {
|
|
230
|
+
i.value = m;
|
|
230
231
|
try {
|
|
231
|
-
const
|
|
232
|
-
s.value = null, o("update:modelValue",
|
|
233
|
-
} catch (
|
|
234
|
-
s.value = a("components.data-invalid", { error:
|
|
232
|
+
const d = f(m);
|
|
233
|
+
s.value = null, o("update:modelValue", d);
|
|
234
|
+
} catch (d) {
|
|
235
|
+
s.value = a("components.data-invalid", { error: d.message });
|
|
235
236
|
}
|
|
236
237
|
}
|
|
237
|
-
return
|
|
238
|
-
() =>
|
|
239
|
-
(
|
|
240
|
-
let
|
|
238
|
+
return se(
|
|
239
|
+
() => t.modelValue,
|
|
240
|
+
(m) => {
|
|
241
|
+
let d = !1;
|
|
241
242
|
try {
|
|
242
|
-
|
|
243
|
+
d = JSON.stringify(f(i.value)) === JSON.stringify(m ?? null);
|
|
243
244
|
} catch {
|
|
244
|
-
|
|
245
|
+
d = !1;
|
|
245
246
|
}
|
|
246
|
-
|
|
247
|
+
d || (i.value = u(m), s.value = null);
|
|
247
248
|
},
|
|
248
249
|
{ deep: !0 }
|
|
249
|
-
), (
|
|
250
|
-
v(n(
|
|
250
|
+
), (m, d) => (c(), _("div", sn, [
|
|
251
|
+
v(n(Je), {
|
|
251
252
|
"model-value": i.value,
|
|
252
253
|
language: "json",
|
|
253
254
|
lint: i.value.trim() !== "",
|
|
@@ -262,43 +263,43 @@ const sn = { class: "wx-block-data" }, an = /* @__PURE__ */ se({
|
|
|
262
263
|
tone: "danger"
|
|
263
264
|
}, {
|
|
264
265
|
default: g(() => [
|
|
265
|
-
L(
|
|
266
|
+
L(w(s.value), 1)
|
|
266
267
|
]),
|
|
267
268
|
_: 1
|
|
268
269
|
})) : W("", !0)
|
|
269
270
|
]));
|
|
270
271
|
}
|
|
271
|
-
}),
|
|
272
|
-
const
|
|
273
|
-
for (const [o, a] of
|
|
274
|
-
|
|
275
|
-
return
|
|
276
|
-
}, rn = /* @__PURE__ */
|
|
272
|
+
}), ie = (e, l) => {
|
|
273
|
+
const t = e.__vccOpts || e;
|
|
274
|
+
for (const [o, a] of l)
|
|
275
|
+
t[o] = a;
|
|
276
|
+
return t;
|
|
277
|
+
}, rn = /* @__PURE__ */ ie(an, [["__scopeId", "data-v-b994c835"]]);
|
|
277
278
|
function Re(e) {
|
|
278
|
-
const
|
|
279
|
+
const l = `${e.apiPath}/blocks`, t = (o) => o.data;
|
|
279
280
|
return {
|
|
280
|
-
list: () => e.http.get(
|
|
281
|
+
list: () => e.http.get(l).then(t),
|
|
281
282
|
// `declared` stands beside `data` rather than in it: it is not a type, and a list of types
|
|
282
283
|
// with something else mixed in is a list every other reader would have to filter.
|
|
283
|
-
index: () => e.http.get(
|
|
284
|
-
catalog: () => e.http.get(`${
|
|
285
|
-
get: (o) => e.http.get(`${
|
|
286
|
-
create: (o) => e.http.post(
|
|
287
|
-
update: (o, a) => e.http.put(`${
|
|
288
|
-
remove: (o) => e.http.delete(`${
|
|
289
|
-
customise: (o) => e.http.post(`${
|
|
290
|
-
publish: (o) => e.http.post(`${
|
|
291
|
-
render: (o, a = {}) => e.http.post(`${
|
|
292
|
-
usage: (o) => e.http.get(`${
|
|
293
|
-
versions: (o) => e.http.get(`${
|
|
294
|
-
version: (o, a) => e.http.get(`${
|
|
295
|
-
restore: (o, a) => e.http.post(`${
|
|
284
|
+
index: () => e.http.get(l).then((o) => ({ blocks: o.data, declared: o.declared ?? [] })),
|
|
285
|
+
catalog: () => e.http.get(`${l}/catalog`).then(t),
|
|
286
|
+
get: (o) => e.http.get(`${l}/${o}`).then(t),
|
|
287
|
+
create: (o) => e.http.post(l, o).then(t),
|
|
288
|
+
update: (o, a) => e.http.put(`${l}/${o}`, a).then(t),
|
|
289
|
+
remove: (o) => e.http.delete(`${l}/${o}`),
|
|
290
|
+
customise: (o) => e.http.post(`${l}/components/${encodeURIComponent(o)}/customise`, {}).then(t),
|
|
291
|
+
publish: (o) => e.http.post(`${l}/${o}/publish`, {}).then(t),
|
|
292
|
+
render: (o, a = {}) => e.http.post(`${l}/${o}/render`, a).then(t),
|
|
293
|
+
usage: (o) => e.http.get(`${l}/${o}/usage`).then(t),
|
|
294
|
+
versions: (o) => e.http.get(`${l}/${o}/versions`).then(t),
|
|
295
|
+
version: (o, a) => e.http.get(`${l}/${o}/versions/${a}`).then(t),
|
|
296
|
+
restore: (o, a) => e.http.post(`${l}/${o}/versions/${a}/restore`, {}).then(t)
|
|
296
297
|
};
|
|
297
298
|
}
|
|
298
299
|
const un = { class: "wx-block-checks" }, cn = {
|
|
299
300
|
key: 0,
|
|
300
301
|
class: "wx-block-checks__line is-error"
|
|
301
|
-
}, dn = /* @__PURE__ */
|
|
302
|
+
}, dn = /* @__PURE__ */ ae({
|
|
302
303
|
__name: "BlockChecks",
|
|
303
304
|
props: {
|
|
304
305
|
file: {},
|
|
@@ -307,92 +308,92 @@ const un = { class: "wx-block-checks" }, cn = {
|
|
|
307
308
|
error: {}
|
|
308
309
|
},
|
|
309
310
|
setup(e) {
|
|
310
|
-
const
|
|
311
|
+
const l = e, t = de("webx-blocks"), o = S(() => l.lints.filter((i) => i.file === l.file)), a = S(() => {
|
|
311
312
|
const i = new Set(o.value.map((u) => u.code)), s = [];
|
|
312
|
-
return
|
|
313
|
+
return l.file === "template" && (i.has("no-marker") || s.push(t("checks.ok-marker")), i.has("variables-missing") || s.push(t("checks.ok-variables"))), l.file === "styles" && (i.has("stray-selectors") || s.push(t("checks.ok-prefix", { slug: l.slug })), i.has("bare-selectors") || s.push(t("checks.ok-bare")), i.has("media-query") || s.push(t("checks.ok-container"))), s;
|
|
313
314
|
});
|
|
314
315
|
return (i, s) => (c(), _("div", un, [
|
|
315
316
|
e.error ? (c(), _("div", cn, [
|
|
316
|
-
v(n(
|
|
317
|
-
|
|
318
|
-
L(
|
|
319
|
-
e.error.line !== null ? (c(), _(
|
|
320
|
-
L(" · " +
|
|
317
|
+
v(n(we), { name: "close-circle" }),
|
|
318
|
+
V("span", null, [
|
|
319
|
+
L(w(e.error.message) + " ", 1),
|
|
320
|
+
e.error.line !== null ? (c(), _(R, { key: 0 }, [
|
|
321
|
+
L(" · " + w(n(t)("page.line", { line: e.error.line })), 1)
|
|
321
322
|
], 64)) : W("", !0),
|
|
322
|
-
e.error.where ? (c(), _(
|
|
323
|
-
L(" · " +
|
|
323
|
+
e.error.where ? (c(), _(R, { key: 1 }, [
|
|
324
|
+
L(" · " + w(e.error.where), 1)
|
|
324
325
|
], 64)) : W("", !0)
|
|
325
326
|
])
|
|
326
327
|
])) : W("", !0),
|
|
327
|
-
(c(!0), _(
|
|
328
|
+
(c(!0), _(R, null, Y(o.value, (u) => (c(), _("div", {
|
|
328
329
|
key: u.code,
|
|
329
330
|
class: "wx-block-checks__line is-warning"
|
|
330
331
|
}, [
|
|
331
|
-
v(n(
|
|
332
|
-
|
|
333
|
-
L(
|
|
334
|
-
u.line !== null ? (c(), _(
|
|
335
|
-
L(" · " +
|
|
332
|
+
v(n(we), { name: "warning" }),
|
|
333
|
+
V("span", null, [
|
|
334
|
+
L(w(u.message) + " ", 1),
|
|
335
|
+
u.line !== null ? (c(), _(R, { key: 0 }, [
|
|
336
|
+
L(" · " + w(n(t)("page.line", { line: u.line })), 1)
|
|
336
337
|
], 64)) : W("", !0)
|
|
337
338
|
])
|
|
338
339
|
]))), 128)),
|
|
339
|
-
(c(!0), _(
|
|
340
|
+
(c(!0), _(R, null, Y(a.value, (u) => (c(), _("div", {
|
|
340
341
|
key: u,
|
|
341
342
|
class: "wx-block-checks__line is-ok"
|
|
342
343
|
}, [
|
|
343
|
-
v(n(
|
|
344
|
-
|
|
344
|
+
v(n(we), { name: "check" }),
|
|
345
|
+
V("span", null, w(u), 1)
|
|
345
346
|
]))), 128))
|
|
346
347
|
]));
|
|
347
348
|
}
|
|
348
|
-
}), It = /* @__PURE__ */
|
|
349
|
+
}), It = /* @__PURE__ */ ie(dn, [["__scopeId", "data-v-e56947a8"]]), pn = { class: "wx-block-history" }, fn = { class: "wx-block-history__number" }, mn = { class: "wx-block-history__who" }, hn = /* @__PURE__ */ ae({
|
|
349
350
|
__name: "BlockHistory",
|
|
350
351
|
props: {
|
|
351
352
|
block: {},
|
|
352
353
|
canManage: { type: Boolean }
|
|
353
354
|
},
|
|
354
355
|
emits: ["restored"],
|
|
355
|
-
setup(e, { emit:
|
|
356
|
-
const
|
|
356
|
+
setup(e, { emit: l }) {
|
|
357
|
+
const t = e, o = l, a = lt(), i = Re(a), s = de("webx-blocks"), u = nt(), f = I(null);
|
|
357
358
|
async function r() {
|
|
358
|
-
|
|
359
|
+
f.value = await i.versions(t.block.id);
|
|
359
360
|
}
|
|
360
|
-
function p
|
|
361
|
-
return
|
|
361
|
+
function m(p) {
|
|
362
|
+
return t.block.draft?.number === p.number ? "draft" : t.block.published?.number === p.number ? "live" : "replaced";
|
|
362
363
|
}
|
|
363
|
-
async function
|
|
364
|
+
async function d(p) {
|
|
364
365
|
if (await dt({
|
|
365
|
-
title: s("page.restore-title", { number:
|
|
366
|
+
title: s("page.restore-title", { number: p.number }),
|
|
366
367
|
message: s("page.restore-text"),
|
|
367
368
|
confirmText: s("page.restore"),
|
|
368
369
|
cancelText: s("page.cancel")
|
|
369
370
|
}))
|
|
370
371
|
try {
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
} catch (
|
|
374
|
-
|
|
372
|
+
const E = await i.restore(t.block.id, p.number);
|
|
373
|
+
J.success(s("page.restored", { number: E.draft?.number ?? p.number })), o("restored", E), await r();
|
|
374
|
+
} catch (E) {
|
|
375
|
+
J.danger(u(E));
|
|
375
376
|
}
|
|
376
377
|
}
|
|
377
|
-
return
|
|
378
|
-
() => [
|
|
378
|
+
return et(r), se(
|
|
379
|
+
() => [t.block.draft?.number, t.block.published?.number],
|
|
379
380
|
() => {
|
|
380
381
|
r();
|
|
381
382
|
}
|
|
382
|
-
), (
|
|
383
|
-
|
|
383
|
+
), (p, h) => (c(), _("div", pn, [
|
|
384
|
+
f.value === null ? (c(), O(n(Ue), {
|
|
384
385
|
key: 0,
|
|
385
386
|
class: "wx-block-history__ghost",
|
|
386
387
|
rows: 3
|
|
387
|
-
})) : (c(!0), _(
|
|
388
|
-
key:
|
|
388
|
+
})) : (c(!0), _(R, { key: 1 }, Y(f.value, (E) => (c(), _("div", {
|
|
389
|
+
key: E.number,
|
|
389
390
|
class: "wx-block-history__row"
|
|
390
391
|
}, [
|
|
391
|
-
|
|
392
|
-
|
|
392
|
+
V("code", fn, w(n(s)("page.version", { number: E.number })), 1),
|
|
393
|
+
V("div", mn, [
|
|
393
394
|
v(n(H), null, {
|
|
394
395
|
default: g(() => [
|
|
395
|
-
L(
|
|
396
|
+
L(w(n(s)(`page.version-${m(E)}`)), 1)
|
|
396
397
|
]),
|
|
397
398
|
_: 2
|
|
398
399
|
}, 1024),
|
|
@@ -401,53 +402,53 @@ const un = { class: "wx-block-checks" }, cn = {
|
|
|
401
402
|
tone: "muted"
|
|
402
403
|
}, {
|
|
403
404
|
default: g(() => [
|
|
404
|
-
|
|
405
|
+
E.created_at ? (c(), O(n(Jl), {
|
|
405
406
|
key: 0,
|
|
406
|
-
value:
|
|
407
|
+
value: E.created_at
|
|
407
408
|
}, null, 8, ["value"])) : W("", !0),
|
|
408
|
-
L(" · " +
|
|
409
|
-
|
|
410
|
-
L(" · " +
|
|
409
|
+
L(" · " + w(E.author ?? n(s)(`page.source-${E.source}`)) + " ", 1),
|
|
410
|
+
E.comment ? (c(), _(R, { key: 1 }, [
|
|
411
|
+
L(" · " + w(E.comment), 1)
|
|
411
412
|
], 64)) : W("", !0)
|
|
412
413
|
]),
|
|
413
414
|
_: 2
|
|
414
415
|
}, 1024)
|
|
415
416
|
]),
|
|
416
|
-
|
|
417
|
+
m(E) === "draft" ? (c(), O(n(he), {
|
|
417
418
|
key: 0,
|
|
418
419
|
type: "warning",
|
|
419
420
|
dot: ""
|
|
420
421
|
}, {
|
|
421
422
|
default: g(() => [
|
|
422
|
-
L(
|
|
423
|
+
L(w(n(s)("page.version-draft")), 1)
|
|
423
424
|
]),
|
|
424
425
|
_: 1
|
|
425
|
-
})) :
|
|
426
|
+
})) : m(E) === "live" ? (c(), O(n(he), {
|
|
426
427
|
key: 1,
|
|
427
428
|
type: "success",
|
|
428
429
|
dot: ""
|
|
429
430
|
}, {
|
|
430
431
|
default: g(() => [
|
|
431
|
-
L(
|
|
432
|
+
L(w(n(s)("page.version-live")), 1)
|
|
432
433
|
]),
|
|
433
434
|
_: 1
|
|
434
435
|
})) : W("", !0),
|
|
435
|
-
e.canManage &&
|
|
436
|
+
e.canManage && m(E) === "replaced" ? (c(), O(n(ce), {
|
|
436
437
|
key: 2,
|
|
437
438
|
size: "sm",
|
|
438
439
|
variant: "outline",
|
|
439
|
-
onClick: (
|
|
440
|
+
onClick: (A) => d(E)
|
|
440
441
|
}, {
|
|
441
442
|
default: g(() => [
|
|
442
|
-
L(
|
|
443
|
+
L(w(n(s)("page.restore")), 1)
|
|
443
444
|
]),
|
|
444
445
|
_: 1
|
|
445
446
|
}, 8, ["onClick"])) : W("", !0)
|
|
446
447
|
]))), 128))
|
|
447
448
|
]));
|
|
448
449
|
}
|
|
449
|
-
}), vn = /* @__PURE__ */
|
|
450
|
-
function il(e,
|
|
450
|
+
}), vn = /* @__PURE__ */ ie(hn, [["__scopeId", "data-v-42c6b7ad"]]), Ze = "wx-preview-selected", ut = "wx-preview-hover", Pt = "wx-preview-style";
|
|
451
|
+
function il(e, l) {
|
|
451
452
|
const o = (e.ownerDocument ?? e).createTreeWalker(
|
|
452
453
|
e,
|
|
453
454
|
128
|
|
@@ -456,170 +457,170 @@ function il(e, t) {
|
|
|
456
457
|
let a = null;
|
|
457
458
|
for (let i = o.nextNode(); i; i = o.nextNode()) {
|
|
458
459
|
const s = i.data.trim();
|
|
459
|
-
if (a === null && s === `wx:${
|
|
460
|
+
if (a === null && s === `wx:${l}`)
|
|
460
461
|
a = i;
|
|
461
|
-
else if (a !== null && s === `/wx:${
|
|
462
|
+
else if (a !== null && s === `/wx:${l}`)
|
|
462
463
|
return { start: a, end: i };
|
|
463
464
|
}
|
|
464
465
|
return null;
|
|
465
466
|
}
|
|
466
|
-
function rl(e,
|
|
467
|
-
const o = il(e,
|
|
467
|
+
function rl(e, l, t) {
|
|
468
|
+
const o = il(e, l);
|
|
468
469
|
if (!o) return !1;
|
|
469
470
|
const a = o.start.parentNode;
|
|
470
471
|
if (!a) return !1;
|
|
471
472
|
const i = e.createElement("template");
|
|
472
|
-
i.innerHTML =
|
|
473
|
+
i.innerHTML = t;
|
|
473
474
|
const s = o.end.nextSibling;
|
|
474
475
|
let u = o.start;
|
|
475
476
|
for (; u; ) {
|
|
476
|
-
const
|
|
477
|
-
if (a.removeChild(u),
|
|
478
|
-
u =
|
|
477
|
+
const d = u.nextSibling, p = u === o.end;
|
|
478
|
+
if (a.removeChild(u), p) break;
|
|
479
|
+
u = d;
|
|
479
480
|
}
|
|
480
|
-
const
|
|
481
|
-
a.insertBefore(
|
|
482
|
-
const
|
|
483
|
-
if (
|
|
484
|
-
for (const
|
|
485
|
-
|
|
481
|
+
const f = i.content, r = Array.from(f.childNodes);
|
|
482
|
+
a.insertBefore(f, s);
|
|
483
|
+
const m = e.defaultView?.webx;
|
|
484
|
+
if (m?.mount)
|
|
485
|
+
for (const d of r)
|
|
486
|
+
d.nodeType === 1 && m.mount(d);
|
|
486
487
|
return !0;
|
|
487
488
|
}
|
|
488
|
-
function
|
|
489
|
-
const
|
|
490
|
-
if (!
|
|
491
|
-
for (let o =
|
|
489
|
+
function Ct(e, l) {
|
|
490
|
+
const t = il(e, l);
|
|
491
|
+
if (!t) return null;
|
|
492
|
+
for (let o = t.start.nextSibling; o && o !== t.end; o = o.nextSibling)
|
|
492
493
|
if (o.nodeType === 1) return o;
|
|
493
494
|
return null;
|
|
494
495
|
}
|
|
495
|
-
function
|
|
496
|
-
|
|
497
|
-
for (const o of Array.from(e.querySelectorAll(`.${
|
|
498
|
-
o.classList.remove(
|
|
499
|
-
if (
|
|
500
|
-
const
|
|
501
|
-
return
|
|
496
|
+
function bt(e, l) {
|
|
497
|
+
Tt(e);
|
|
498
|
+
for (const o of Array.from(e.querySelectorAll(`.${Ze}`)))
|
|
499
|
+
o.classList.remove(Ze);
|
|
500
|
+
if (l === null) return null;
|
|
501
|
+
const t = Ct(e, l);
|
|
502
|
+
return t?.classList.add(Ze), t;
|
|
502
503
|
}
|
|
503
|
-
function Ut(e,
|
|
504
|
-
|
|
505
|
-
for (const
|
|
506
|
-
|
|
507
|
-
|
|
504
|
+
function Ut(e, l) {
|
|
505
|
+
Tt(e);
|
|
506
|
+
for (const t of Array.from(e.querySelectorAll(`.${ut}`)))
|
|
507
|
+
t.classList.remove(ut);
|
|
508
|
+
l !== null && Ct(e, l)?.classList.add(ut);
|
|
508
509
|
}
|
|
509
510
|
function Rt(e) {
|
|
510
|
-
let
|
|
511
|
-
for (;
|
|
512
|
-
let
|
|
513
|
-
for (let o =
|
|
511
|
+
let l = e?.nodeType === 1 ? e : e?.parentElement ?? null;
|
|
512
|
+
for (; l; ) {
|
|
513
|
+
let t = 0;
|
|
514
|
+
for (let o = l.previousSibling; o; o = o.previousSibling) {
|
|
514
515
|
if (o.nodeType !== 8) continue;
|
|
515
516
|
const a = o.data.trim();
|
|
516
517
|
if (a.startsWith("/wx:"))
|
|
517
|
-
|
|
518
|
+
t += 1;
|
|
518
519
|
else if (a.startsWith("wx:")) {
|
|
519
|
-
if (
|
|
520
|
-
|
|
520
|
+
if (t === 0) return a.slice(3);
|
|
521
|
+
t -= 1;
|
|
521
522
|
}
|
|
522
523
|
}
|
|
523
|
-
|
|
524
|
+
l = l.parentElement;
|
|
524
525
|
}
|
|
525
526
|
return null;
|
|
526
527
|
}
|
|
527
|
-
function bn(e,
|
|
528
|
-
|
|
529
|
-
let
|
|
528
|
+
function bn(e, l) {
|
|
529
|
+
Tt(e);
|
|
530
|
+
let t = null;
|
|
530
531
|
function o(s) {
|
|
531
532
|
const u = Rt(s.target);
|
|
532
|
-
u === null ?
|
|
533
|
+
u === null ? Qe(s) : Me(s), l.select(u);
|
|
533
534
|
}
|
|
534
535
|
function a(s) {
|
|
535
536
|
const u = Rt(s.target);
|
|
536
|
-
u !==
|
|
537
|
+
u !== t && (t = u, Ut(e, u));
|
|
537
538
|
}
|
|
538
539
|
function i() {
|
|
539
|
-
|
|
540
|
+
t = null, Ut(e, null);
|
|
540
541
|
}
|
|
541
|
-
return e.addEventListener("click", o, !0), e.addEventListener("auxclick",
|
|
542
|
+
return e.addEventListener("click", o, !0), e.addEventListener("auxclick", Qe, !0), e.addEventListener("submit", Me, !0), e.addEventListener("dragstart", Me, !0), e.addEventListener("mousemove", a, !0), e.addEventListener("mouseleave", i), {
|
|
542
543
|
release() {
|
|
543
|
-
e.removeEventListener("click", o, !0), e.removeEventListener("auxclick",
|
|
544
|
+
e.removeEventListener("click", o, !0), e.removeEventListener("auxclick", Qe, !0), e.removeEventListener("submit", Me, !0), e.removeEventListener("dragstart", Me, !0), e.removeEventListener("mousemove", a, !0), e.removeEventListener("mouseleave", i);
|
|
544
545
|
}
|
|
545
546
|
};
|
|
546
547
|
}
|
|
547
|
-
function
|
|
548
|
+
function Me(e) {
|
|
548
549
|
e.preventDefault(), e.stopPropagation();
|
|
549
550
|
}
|
|
550
|
-
function
|
|
551
|
-
const
|
|
552
|
-
(
|
|
551
|
+
function Qe(e) {
|
|
552
|
+
const l = e.target;
|
|
553
|
+
(l?.nodeType === Node.ELEMENT_NODE ? l : l?.parentElement ?? null)?.closest("a[href], area[href]") && e.preventDefault();
|
|
553
554
|
}
|
|
554
555
|
function gn(e) {
|
|
555
|
-
const
|
|
556
|
-
["click",
|
|
557
|
-
["auxclick",
|
|
558
|
-
["submit",
|
|
559
|
-
["dragstart",
|
|
556
|
+
const l = [
|
|
557
|
+
["click", Qe],
|
|
558
|
+
["auxclick", Qe],
|
|
559
|
+
["submit", Me],
|
|
560
|
+
["dragstart", Me]
|
|
560
561
|
];
|
|
561
|
-
for (const [
|
|
562
|
+
for (const [t, o] of l) e.addEventListener(t, o, !0);
|
|
562
563
|
return {
|
|
563
564
|
release() {
|
|
564
|
-
for (const [
|
|
565
|
+
for (const [t, o] of l) e.removeEventListener(t, o, !0);
|
|
565
566
|
}
|
|
566
567
|
};
|
|
567
568
|
}
|
|
568
|
-
const ct = "sample",
|
|
569
|
-
function kn(e,
|
|
570
|
-
let
|
|
571
|
-
|
|
572
|
-
const o = `<!--wx:${ct}-->`, a =
|
|
569
|
+
const ct = "sample", xt = "wx-stage-styles";
|
|
570
|
+
function kn(e, l) {
|
|
571
|
+
let t = e.getElementById(xt);
|
|
572
|
+
t === null && (t = e.createElement("style"), t.id = xt, (e.head ?? e.documentElement).appendChild(t)), t.textContent = l.styles;
|
|
573
|
+
const o = `<!--wx:${ct}-->`, a = l.html.trimStart().startsWith(o) ? l.html : `${o}${l.html}<!--/wx:${ct}-->`;
|
|
573
574
|
return rl(e, ct, a);
|
|
574
575
|
}
|
|
575
|
-
function yn(e,
|
|
576
|
-
const
|
|
577
|
-
|
|
576
|
+
function yn(e, l) {
|
|
577
|
+
const t = e.createElement("script");
|
|
578
|
+
t.textContent = l, e.body.appendChild(t);
|
|
578
579
|
}
|
|
579
|
-
function
|
|
580
|
+
function Tt(e) {
|
|
580
581
|
if (e.getElementById(Pt)) return;
|
|
581
|
-
const
|
|
582
|
-
|
|
582
|
+
const l = e.createElement("style");
|
|
583
|
+
l.id = Pt, l.textContent = `.${Ze}{outline:2px solid #427edd;outline-offset:-2px;}.${ut}:not(.${Ze}){outline:1px solid #427edd;outline-offset:-1px;cursor:pointer;}`, (e.head ?? e.documentElement).appendChild(l);
|
|
583
584
|
}
|
|
584
585
|
function ul(e) {
|
|
585
|
-
const
|
|
586
|
-
return `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">${
|
|
586
|
+
const l = e.base ? `<base href="${_t(e.base)}">` : "", t = e.frame ? `<style>${e.frame}</style>` : "", o = e.script && e.runtime ? `<script src="${_t(e.runtime)}"><\/script><script>${e.script}<\/script>` : "";
|
|
587
|
+
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}${o}</body></html>`;
|
|
587
588
|
}
|
|
588
589
|
const cl = "<!--wx-thumb-->";
|
|
589
|
-
function wn(e,
|
|
590
|
-
const
|
|
590
|
+
function wn(e, l) {
|
|
591
|
+
const t = new DOMParser().parseFromString(e, "text/html"), o = _n(t, `wx:${ct}`);
|
|
591
592
|
if (o === null) return null;
|
|
592
|
-
const a = (r) => r === null ? null : new URL(r, new URL(
|
|
593
|
-
for (const r of Array.from(
|
|
594
|
-
const
|
|
595
|
-
if (
|
|
593
|
+
const a = (r) => r === null ? null : new URL(r, new URL(l, location.href)).href, i = [];
|
|
594
|
+
for (const r of Array.from(t.head.children)) {
|
|
595
|
+
const m = r.tagName.toLowerCase(), d = (r.getAttribute("rel") ?? "").toLowerCase().split(/\s+/);
|
|
596
|
+
if (m === "style" && r.id !== xt)
|
|
596
597
|
i.push(r.outerHTML);
|
|
597
|
-
else if (
|
|
598
|
-
const
|
|
599
|
-
|
|
598
|
+
else if (m === "link" && (d.includes("stylesheet") || d.includes("preload") && r.getAttribute("as") === "font")) {
|
|
599
|
+
const p = r.cloneNode(!1);
|
|
600
|
+
p.setAttribute("href", a(r.getAttribute("href")) ?? ""), i.push(p.outerHTML);
|
|
600
601
|
}
|
|
601
602
|
}
|
|
602
603
|
let s = cl, u = o.parentElement;
|
|
603
|
-
for (; u !== null && u !==
|
|
604
|
+
for (; u !== null && u !== t.body && u !== t.documentElement; ) {
|
|
604
605
|
const r = u.cloneNode(!1);
|
|
605
606
|
r.innerHTML = s, s = r.outerHTML, u = u.parentElement;
|
|
606
607
|
}
|
|
607
|
-
const
|
|
608
|
-
return `<!doctype html><html${
|
|
608
|
+
const f = (r) => Array.from(r.attributes).map((m) => ` ${m.name}="${_t(m.value)}"`).join("");
|
|
609
|
+
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)}>${s}</body></html>`;
|
|
609
610
|
}
|
|
610
|
-
function xn(e,
|
|
611
|
-
return e.replace("</head>", () => `<style>${
|
|
611
|
+
function xn(e, l) {
|
|
612
|
+
return e.replace("</head>", () => `<style>${l.styles}</style></head>`).replace(cl, () => l.html);
|
|
612
613
|
}
|
|
613
|
-
function _n(e,
|
|
614
|
-
const
|
|
615
|
-
for (let o =
|
|
616
|
-
if (o.data.trim() ===
|
|
614
|
+
function _n(e, l) {
|
|
615
|
+
const t = e.createTreeWalker(e.body ?? e.documentElement, NodeFilter.SHOW_COMMENT);
|
|
616
|
+
for (let o = t.nextNode(); o !== null; o = t.nextNode())
|
|
617
|
+
if (o.data.trim() === l) return o;
|
|
617
618
|
return null;
|
|
618
619
|
}
|
|
619
|
-
function
|
|
620
|
+
function _t(e) {
|
|
620
621
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<");
|
|
621
622
|
}
|
|
622
|
-
const $n = { class: "wx-block-stage" }, Sn = { class: "wx-block-stage__bar" }, Cn = ["src", "srcdoc", "title"], Tn = /* @__PURE__ */
|
|
623
|
+
const $n = { class: "wx-block-stage" }, Sn = { class: "wx-block-stage__bar" }, Cn = ["src", "srcdoc", "title"], Tn = /* @__PURE__ */ ae({
|
|
623
624
|
__name: "BlockStage",
|
|
624
625
|
props: {
|
|
625
626
|
html: {},
|
|
@@ -630,84 +631,84 @@ const $n = { class: "wx-block-stage" }, Sn = { class: "wx-block-stage__bar" }, C
|
|
|
630
631
|
loading: { type: Boolean, default: !1 }
|
|
631
632
|
},
|
|
632
633
|
setup(e) {
|
|
633
|
-
const
|
|
634
|
-
{ value: 1280, icon: "monitor", ariaLabel:
|
|
635
|
-
{ value: 834, icon: "tablet", ariaLabel:
|
|
636
|
-
{ value: 390, icon: "smartphone", ariaLabel:
|
|
637
|
-
]), a = I(1280), i = I(null), s = I(null), u = pt(i),
|
|
638
|
-
|
|
634
|
+
const l = e, t = de("webx-blocks"), o = S(() => [
|
|
635
|
+
{ value: 1280, icon: "monitor", ariaLabel: t("page.width-desktop") },
|
|
636
|
+
{ value: 834, icon: "tablet", ariaLabel: t("page.width-tablet") },
|
|
637
|
+
{ value: 390, icon: "smartphone", ariaLabel: t("page.width-phone") }
|
|
638
|
+
]), a = I(1280), i = I(null), s = I(null), u = pt(i), f = I(360), r = I(!1);
|
|
639
|
+
se([u, o], () => {
|
|
639
640
|
if (r.value || u.value === 0) return;
|
|
640
641
|
const z = o.value.find((P) => u.value / P.value >= 0.45);
|
|
641
642
|
a.value = (z ?? o.value[o.value.length - 1]).value;
|
|
642
643
|
});
|
|
643
|
-
function
|
|
644
|
+
function m(z) {
|
|
644
645
|
r.value = !0, a.value = z;
|
|
645
646
|
}
|
|
646
|
-
const
|
|
647
|
-
() =>
|
|
648
|
-
html:
|
|
649
|
-
styles:
|
|
650
|
-
script:
|
|
651
|
-
runtime:
|
|
647
|
+
const d = S(() => u.value === 0 ? 1 : Math.min(1, u.value / a.value)), p = S(
|
|
648
|
+
() => l.stage ? void 0 : ul({
|
|
649
|
+
html: l.html,
|
|
650
|
+
styles: l.styles,
|
|
651
|
+
script: l.script,
|
|
652
|
+
runtime: l.runtime,
|
|
652
653
|
base: typeof location > "u" ? null : location.origin + "/"
|
|
653
654
|
})
|
|
654
655
|
), h = I(0);
|
|
655
|
-
let
|
|
656
|
-
|
|
657
|
-
() =>
|
|
656
|
+
let E = null;
|
|
657
|
+
se(
|
|
658
|
+
() => l.script,
|
|
658
659
|
(z) => {
|
|
659
|
-
|
|
660
|
+
l.stage && z !== E && (h.value += 1);
|
|
660
661
|
}
|
|
661
662
|
);
|
|
662
|
-
function
|
|
663
|
+
function A() {
|
|
663
664
|
const z = s.value?.contentDocument?.body;
|
|
664
665
|
if (!z) return;
|
|
665
666
|
const P = z.ownerDocument.defaultView, Q = P && parseFloat(P.getComputedStyle(z).marginBottom) || 0, X = z.getBoundingClientRect().bottom + Q + (P?.scrollY ?? 0);
|
|
666
|
-
|
|
667
|
+
f.value = Math.max(120, Math.ceil(Math.max(z.scrollHeight, X)));
|
|
667
668
|
}
|
|
668
|
-
let
|
|
669
|
+
let $ = null, y = null;
|
|
669
670
|
function x() {
|
|
670
|
-
|
|
671
|
+
$?.release(), $ = null, y?.disconnect(), y = null;
|
|
671
672
|
}
|
|
672
|
-
function
|
|
673
|
-
|
|
673
|
+
function U(z) {
|
|
674
|
+
l.stage && (l.script && E !== l.script && (E = l.script, yn(z, l.script)), kn(z, { html: l.html, styles: l.styles }));
|
|
674
675
|
}
|
|
675
676
|
function Z() {
|
|
676
677
|
x();
|
|
677
678
|
const z = s.value?.contentDocument;
|
|
678
679
|
if (!z?.body) return;
|
|
679
|
-
|
|
680
|
+
l.stage && (E = null, $ = gn(z), U(z)), A();
|
|
680
681
|
const P = z.defaultView?.ResizeObserver;
|
|
681
|
-
P && (
|
|
682
|
+
P && (y = new P(() => A()), y.observe(z.body));
|
|
682
683
|
}
|
|
683
|
-
|
|
684
|
-
() => [
|
|
684
|
+
se(
|
|
685
|
+
() => [l.html, l.styles],
|
|
685
686
|
() => {
|
|
686
687
|
const z = s.value?.contentDocument;
|
|
687
|
-
|
|
688
|
+
l.stage && z?.body && $ !== null && U(z);
|
|
688
689
|
}
|
|
689
|
-
),
|
|
690
|
-
z > 0 && P === 0 && setTimeout(
|
|
691
|
-
}),
|
|
690
|
+
), se(u, (z, P) => {
|
|
691
|
+
z > 0 && P === 0 && setTimeout(A, 50);
|
|
692
|
+
}), se(a, () => setTimeout(A, 50)), tt(x);
|
|
692
693
|
const G = S(() => ({
|
|
693
694
|
width: `${a.value}px`,
|
|
694
|
-
height: `${
|
|
695
|
-
transform: `scale(${
|
|
696
|
-
})),
|
|
697
|
-
width: `${Math.round(a.value *
|
|
698
|
-
height: `${Math.round(
|
|
695
|
+
height: `${f.value}px`,
|
|
696
|
+
transform: `scale(${d.value})`
|
|
697
|
+
})), re = S(() => ({
|
|
698
|
+
width: `${Math.round(a.value * d.value)}px`,
|
|
699
|
+
height: `${Math.round(f.value * d.value)}px`
|
|
699
700
|
}));
|
|
700
701
|
return (z, P) => (c(), _("div", $n, [
|
|
701
|
-
|
|
702
|
+
V("div", Sn, [
|
|
702
703
|
v(n(Yt), {
|
|
703
704
|
"model-value": a.value,
|
|
704
705
|
options: o.value,
|
|
705
706
|
size: "sm",
|
|
706
|
-
"aria-label": n(
|
|
707
|
-
"onUpdate:modelValue": P[0] || (P[0] = (Q) =>
|
|
707
|
+
"aria-label": n(t)("page.width"),
|
|
708
|
+
"onUpdate:modelValue": P[0] || (P[0] = (Q) => m(Number(Q)))
|
|
708
709
|
}, null, 8, ["model-value", "options", "aria-label"])
|
|
709
710
|
]),
|
|
710
|
-
|
|
711
|
+
V("div", {
|
|
711
712
|
ref_key: "box",
|
|
712
713
|
ref: i,
|
|
713
714
|
class: "wx-block-stage__ground"
|
|
@@ -718,7 +719,7 @@ const $n = { class: "wx-block-stage" }, Sn = { class: "wx-block-stage__bar" }, C
|
|
|
718
719
|
})) : (c(), _("div", {
|
|
719
720
|
key: 1,
|
|
720
721
|
class: "wx-block-stage__clip",
|
|
721
|
-
style:
|
|
722
|
+
style: Oe(re.value)
|
|
722
723
|
}, [
|
|
723
724
|
(c(), _("iframe", {
|
|
724
725
|
ref_key: "frame",
|
|
@@ -726,114 +727,114 @@ const $n = { class: "wx-block-stage" }, Sn = { class: "wx-block-stage__bar" }, C
|
|
|
726
727
|
key: h.value,
|
|
727
728
|
class: "wx-block-stage__frame",
|
|
728
729
|
src: e.stage ?? void 0,
|
|
729
|
-
srcdoc:
|
|
730
|
-
style:
|
|
730
|
+
srcdoc: p.value,
|
|
731
|
+
style: Oe(G.value),
|
|
731
732
|
sandbox: "allow-same-origin allow-scripts",
|
|
732
|
-
title: n(
|
|
733
|
+
title: n(t)("page.preview"),
|
|
733
734
|
onLoad: Z
|
|
734
735
|
}, null, 44, Cn))
|
|
735
736
|
], 4))
|
|
736
737
|
], 512)
|
|
737
738
|
]));
|
|
738
739
|
}
|
|
739
|
-
}), En = /* @__PURE__ */
|
|
740
|
+
}), En = /* @__PURE__ */ ie(Tn, [["__scopeId", "data-v-3185ee45"]]);
|
|
740
741
|
function dl(e) {
|
|
741
742
|
return typeof e == "object" && e !== null && typeof e.type == "string" && e.type !== "";
|
|
742
743
|
}
|
|
743
744
|
function ft(e) {
|
|
744
745
|
return Array.isArray(e) && e.length > 0 && e.every(dl);
|
|
745
746
|
}
|
|
746
|
-
function
|
|
747
|
+
function $t() {
|
|
747
748
|
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);
|
|
748
749
|
}
|
|
749
|
-
function Vn(e,
|
|
750
|
-
return { key:
|
|
750
|
+
function Vn(e, l = {}) {
|
|
751
|
+
return { key: $t(), type: e, values: l };
|
|
751
752
|
}
|
|
752
|
-
function me(e,
|
|
753
|
-
return pl(e,
|
|
753
|
+
function me(e, l) {
|
|
754
|
+
return pl(e, l, null, null);
|
|
754
755
|
}
|
|
755
|
-
function pl(e,
|
|
756
|
+
function pl(e, l, t, o) {
|
|
756
757
|
for (let a = 0; a < e.length; a++) {
|
|
757
758
|
const i = e[a];
|
|
758
|
-
if (i.key ===
|
|
759
|
+
if (i.key === l) return { node: i, parent: t, field: o, list: e, index: a };
|
|
759
760
|
for (const [s, u] of Object.entries(i.values ?? {}))
|
|
760
761
|
if (ft(u)) {
|
|
761
|
-
const
|
|
762
|
-
if (
|
|
762
|
+
const f = pl(u, l, i, s);
|
|
763
|
+
if (f) return f;
|
|
763
764
|
}
|
|
764
765
|
}
|
|
765
766
|
return null;
|
|
766
767
|
}
|
|
767
|
-
function
|
|
768
|
+
function ot(e, l, t = 0, o = null) {
|
|
768
769
|
for (const a of e)
|
|
769
770
|
if (dl(a)) {
|
|
770
|
-
|
|
771
|
+
l(a, t, o);
|
|
771
772
|
for (const i of Object.values(a.values ?? {}))
|
|
772
|
-
ft(i) &&
|
|
773
|
+
ft(i) && ot(i, l, t + 1, a);
|
|
773
774
|
}
|
|
774
775
|
}
|
|
775
|
-
function An(e,
|
|
776
|
-
let
|
|
777
|
-
return
|
|
778
|
-
o.type ===
|
|
779
|
-
}),
|
|
776
|
+
function An(e, l) {
|
|
777
|
+
let t = 0;
|
|
778
|
+
return ot(e, (o) => {
|
|
779
|
+
o.type === l && t++;
|
|
780
|
+
}), t;
|
|
780
781
|
}
|
|
781
782
|
function Bn(e) {
|
|
782
|
-
let
|
|
783
|
-
for (const
|
|
784
|
-
ft(
|
|
785
|
-
return
|
|
783
|
+
let l = 0;
|
|
784
|
+
for (const t of Object.values(e.values ?? {}))
|
|
785
|
+
ft(t) && ot(t, () => l++);
|
|
786
|
+
return l;
|
|
786
787
|
}
|
|
787
788
|
function ma(e) {
|
|
788
|
-
const
|
|
789
|
-
return
|
|
790
|
-
|
|
791
|
-
}),
|
|
789
|
+
const l = [];
|
|
790
|
+
return ot(e, (t) => {
|
|
791
|
+
l.includes(t.type) || l.push(t.type);
|
|
792
|
+
}), l;
|
|
792
793
|
}
|
|
793
794
|
function fl(e) {
|
|
794
|
-
const
|
|
795
|
-
for (const
|
|
796
|
-
|
|
797
|
-
return
|
|
795
|
+
const l = [];
|
|
796
|
+
for (const t of e)
|
|
797
|
+
t.type === "wx-blocks" && l.push(t), t.children && l.push(...fl(t.children));
|
|
798
|
+
return l;
|
|
798
799
|
}
|
|
799
800
|
function ml(e) {
|
|
800
|
-
const
|
|
801
|
-
for (const [
|
|
802
|
-
t
|
|
803
|
-
return e.hidden === !0 ? { key:
|
|
804
|
-
}
|
|
805
|
-
function Ln(e,
|
|
806
|
-
const o = Ce(e), a = me(o,
|
|
807
|
-
return a ? (
|
|
808
|
-
}
|
|
809
|
-
function Wn(e,
|
|
810
|
-
if (
|
|
811
|
-
const o = me(e,
|
|
812
|
-
if (!o ||
|
|
813
|
-
const a = o.node.values[
|
|
814
|
-
return Array.isArray(a) || (o.node.values[
|
|
815
|
-
}
|
|
816
|
-
function jt(e,
|
|
817
|
-
const i = Ce(e), s = Wn(i,
|
|
801
|
+
const l = {};
|
|
802
|
+
for (const [t, o] of Object.entries(e.values ?? {}))
|
|
803
|
+
l[t] = ft(o) ? o.map(ml) : Ce(o);
|
|
804
|
+
return e.hidden === !0 ? { key: $t(), type: e.type, hidden: !0, values: l } : { key: $t(), type: e.type, values: l };
|
|
805
|
+
}
|
|
806
|
+
function Ln(e, l, t) {
|
|
807
|
+
const o = Ce(e), a = me(o, l);
|
|
808
|
+
return a ? (t ? a.node.hidden = !0 : delete a.node.hidden, o) : e;
|
|
809
|
+
}
|
|
810
|
+
function Wn(e, l, t) {
|
|
811
|
+
if (l === null) return e;
|
|
812
|
+
const o = me(e, l);
|
|
813
|
+
if (!o || t === null) return null;
|
|
814
|
+
const a = o.node.values[t];
|
|
815
|
+
return Array.isArray(a) || (o.node.values[t] = []), o.node.values[t];
|
|
816
|
+
}
|
|
817
|
+
function jt(e, l, t, o, a) {
|
|
818
|
+
const i = Ce(e), s = Wn(i, l, t);
|
|
818
819
|
return s ? (s.splice(Math.max(0, Math.min(o, s.length)), 0, a), i) : e;
|
|
819
820
|
}
|
|
820
|
-
function Nn(e,
|
|
821
|
-
const
|
|
822
|
-
return o ? (o.list.splice(o.index, 1),
|
|
821
|
+
function Nn(e, l) {
|
|
822
|
+
const t = Ce(e), o = me(t, l);
|
|
823
|
+
return o ? (o.list.splice(o.index, 1), t) : e;
|
|
823
824
|
}
|
|
824
|
-
function zn(e,
|
|
825
|
-
const o = Ce(e), a = me(o,
|
|
826
|
-
return a ? (a.node.values =
|
|
825
|
+
function zn(e, l, t) {
|
|
826
|
+
const o = Ce(e), a = me(o, l);
|
|
827
|
+
return a ? (a.node.values = t, o) : e;
|
|
827
828
|
}
|
|
828
|
-
function Mn(e,
|
|
829
|
-
if (
|
|
830
|
-
const a = Ce(e), i = me(a,
|
|
831
|
-
return !i ||
|
|
829
|
+
function Mn(e, l, t, o) {
|
|
830
|
+
if (l === null) return Ce(o);
|
|
831
|
+
const a = Ce(e), i = me(a, l);
|
|
832
|
+
return !i || t === null ? e : (i.node.values[t] = Ce(o), a);
|
|
832
833
|
}
|
|
833
834
|
function Ce(e) {
|
|
834
835
|
return e === void 0 ? e : JSON.parse(JSON.stringify(e));
|
|
835
836
|
}
|
|
836
|
-
function
|
|
837
|
+
function gt(e) {
|
|
837
838
|
return [
|
|
838
839
|
tn({ icons: !1 }),
|
|
839
840
|
nn.languageData.of(() => [{ autocomplete: e }])
|
|
@@ -875,17 +876,17 @@ const On = [
|
|
|
875
876
|
};
|
|
876
877
|
function Hn({
|
|
877
878
|
schema: e,
|
|
878
|
-
styles:
|
|
879
|
-
types:
|
|
879
|
+
styles: l,
|
|
880
|
+
types: t = () => [],
|
|
880
881
|
schemaOf: o = () => null
|
|
881
882
|
}) {
|
|
882
883
|
return (a) => {
|
|
883
884
|
const i = a.state.sliceDoc(Math.max(0, a.pos - 200), a.pos), s = /<x-webx-block\b[^<>]*?\btype\s*=\s*(["'])([\w-]*)$/.exec(i);
|
|
884
|
-
if (s) return qn(a, s[1], s[2],
|
|
885
|
+
if (s) return qn(a, s[1], s[2], t());
|
|
885
886
|
const u = /\$block->(\w*)$/.exec(i);
|
|
886
887
|
if (u) return Xn(a, u[1]);
|
|
887
|
-
const
|
|
888
|
-
if (
|
|
888
|
+
const f = /\$(\w+)\[\s*(['"]?)(\w*)$/.exec(i);
|
|
889
|
+
if (f) return eo(a, f[1], f[2], f[3], e());
|
|
889
890
|
const r = /\$(\w*)$/.exec(i);
|
|
890
891
|
if (r)
|
|
891
892
|
return {
|
|
@@ -893,40 +894,40 @@ function Hn({
|
|
|
893
894
|
options: Zn(e(), a.state.doc.toString()),
|
|
894
895
|
validFor: /^\$\w*$/
|
|
895
896
|
};
|
|
896
|
-
const
|
|
897
|
-
if (
|
|
898
|
-
const
|
|
899
|
-
if (
|
|
900
|
-
const
|
|
901
|
-
if (
|
|
902
|
-
const
|
|
903
|
-
return Yn(a,
|
|
897
|
+
const m = /(\{\{|\{!!)(\s*)(\w*)$/.exec(i);
|
|
898
|
+
if (m) return Qn(a, m[1], m[2], m[3], e());
|
|
899
|
+
const d = Kn(i);
|
|
900
|
+
if (d !== null) return Jn(a, d, t(), o);
|
|
901
|
+
const p = /<(x-[\w:-]*)$/.exec(i);
|
|
902
|
+
if (p) {
|
|
903
|
+
const A = a.state.sliceDoc(0, a.pos - p[0].length);
|
|
904
|
+
return Yn(a, p[1], Gn(A), o);
|
|
904
905
|
}
|
|
905
906
|
const h = /\bclass\s*=\s*"([^"]*)$/.exec(i);
|
|
906
|
-
if (h) return lo(a, h[1],
|
|
907
|
-
const
|
|
908
|
-
return
|
|
909
|
-
from: a.pos -
|
|
907
|
+
if (h) return lo(a, h[1], l());
|
|
908
|
+
const E = /(?:^|[\s>(])@(\w*)$/.exec(i);
|
|
909
|
+
return E ? {
|
|
910
|
+
from: a.pos - E[1].length - 1,
|
|
910
911
|
options: no(e()),
|
|
911
912
|
validFor: /^@\w*$/
|
|
912
913
|
} : null;
|
|
913
914
|
};
|
|
914
915
|
}
|
|
915
|
-
function qn(e,
|
|
916
|
+
function qn(e, l, t, o) {
|
|
916
917
|
return o.length === 0 ? null : {
|
|
917
|
-
from: e.pos -
|
|
918
|
+
from: e.pos - t.length,
|
|
918
919
|
options: o.map((a, i) => ({
|
|
919
920
|
label: a.slug,
|
|
920
921
|
detail: a.kind,
|
|
921
922
|
info: a.title,
|
|
922
923
|
type: "type",
|
|
923
924
|
boost: (a.kind === "component" ? 50 : 0) - i / 100,
|
|
924
|
-
apply: (s, u,
|
|
925
|
-
const
|
|
925
|
+
apply: (s, u, f, r) => {
|
|
926
|
+
const m = /^[\w-]*/.exec(s.state.sliceDoc(r, r + 64))[0], d = r + m.length, p = s.state.sliceDoc(d, d + 1) === l, h = `${a.slug}${p ? "" : l}`;
|
|
926
927
|
s.dispatch({
|
|
927
|
-
changes: { from:
|
|
928
|
+
changes: { from: f, to: d, insert: h },
|
|
928
929
|
// Past the closing quote: the attributes come next.
|
|
929
|
-
selection: { anchor:
|
|
930
|
+
selection: { anchor: f + h.length + (p ? 1 : 0) },
|
|
930
931
|
annotations: Fe.of(u),
|
|
931
932
|
userEvent: "input.complete"
|
|
932
933
|
});
|
|
@@ -935,129 +936,129 @@ function qn(e, t, l, o) {
|
|
|
935
936
|
validFor: /^[\w-]*$/
|
|
936
937
|
};
|
|
937
938
|
}
|
|
938
|
-
function
|
|
939
|
-
const
|
|
940
|
-
if (
|
|
941
|
-
const
|
|
942
|
-
if (
|
|
943
|
-
const o = (s) => (
|
|
939
|
+
function Kn(e) {
|
|
940
|
+
const l = e.lastIndexOf("<x-webx-block");
|
|
941
|
+
if (l === -1) return null;
|
|
942
|
+
const t = e.slice(l + 13);
|
|
943
|
+
if (t.includes(">") || !/^\s/.test(t)) return null;
|
|
944
|
+
const o = (s) => (t.split(s).length - 1) % 2 === 1;
|
|
944
945
|
if (o('"') || o("'")) return null;
|
|
945
|
-
const a = /\s(:?)([\w-]*)$/.exec(
|
|
946
|
+
const a = /\s(:?)([\w-]*)$/.exec(t);
|
|
946
947
|
if (!a) return null;
|
|
947
|
-
const i = /\btype\s*=\s*["']([\w-]+)["']/.exec(
|
|
948
|
-
return { attributes:
|
|
948
|
+
const i = /\btype\s*=\s*["']([\w-]+)["']/.exec(t);
|
|
949
|
+
return { attributes: t, type: i?.[1] ?? null, bound: a[1] === ":", word: a[2] };
|
|
949
950
|
}
|
|
950
|
-
function
|
|
951
|
-
const a = new Set([...
|
|
951
|
+
function Jn(e, l, t, o) {
|
|
952
|
+
const a = new Set([...l.attributes.matchAll(/:?([\w-]+)\s*=/g)].map((r) => r[1])), i = e.pos - l.word.length - (l.bound ? 1 : 0), s = () => {
|
|
952
953
|
const r = [];
|
|
953
|
-
if (a.has("type") || r.push(
|
|
954
|
-
const
|
|
955
|
-
r.push(
|
|
954
|
+
if (a.has("type") || r.push(kt("type", !1, "reserved", null, 60)), !a.has("fallback") && l.type !== null) {
|
|
955
|
+
const m = t.find((d) => d.slug === l.type)?.fallback ?? null;
|
|
956
|
+
r.push(kt("fallback", !1, "reserved", m, -10, m));
|
|
956
957
|
}
|
|
957
958
|
return r;
|
|
958
959
|
}, u = (r) => {
|
|
959
|
-
const
|
|
960
|
-
(
|
|
960
|
+
const d = [...Be(r ?? []).filter((p) => p.type !== "wx-slot" && p.type !== "wx-blocks").filter((p) => !a.has(p.id)).map(
|
|
961
|
+
(p, h) => kt(p.id, p.type === "wx-data" || l.bound, p.type, p.label, 40 - h)
|
|
961
962
|
), ...s()];
|
|
962
|
-
return
|
|
963
|
+
return d.length === 0 || !e.explicit && l.word === "" && !l.bound ? null : { from: i, options: d, validFor: /^:?[\w-]*$/ };
|
|
963
964
|
};
|
|
964
|
-
if (
|
|
965
|
-
const
|
|
966
|
-
return
|
|
965
|
+
if (l.type === null) return u(null);
|
|
966
|
+
const f = o(l.type);
|
|
967
|
+
return f instanceof Promise ? f.then(u, () => u(null)) : u(f);
|
|
967
968
|
}
|
|
968
|
-
function
|
|
969
|
-
const s = `${
|
|
969
|
+
function kt(e, l, t, o, a, i = null) {
|
|
970
|
+
const s = `${l ? ":" : ""}${e}`;
|
|
970
971
|
return {
|
|
971
972
|
label: s,
|
|
972
|
-
detail:
|
|
973
|
+
detail: t,
|
|
973
974
|
info: o ?? void 0,
|
|
974
975
|
type: "property",
|
|
975
976
|
boost: a,
|
|
976
|
-
apply: (u,
|
|
977
|
-
const
|
|
977
|
+
apply: (u, f, r, m) => {
|
|
978
|
+
const d = `${s}="${i ?? (l ? "$" : "")}"`;
|
|
978
979
|
u.dispatch({
|
|
979
|
-
changes: { from: r, to:
|
|
980
|
-
selection: { anchor: r +
|
|
981
|
-
annotations: Fe.of(
|
|
980
|
+
changes: { from: r, to: m, insert: d },
|
|
981
|
+
selection: { anchor: r + d.length - 1 },
|
|
982
|
+
annotations: Fe.of(f),
|
|
982
983
|
userEvent: "input.complete"
|
|
983
984
|
});
|
|
984
985
|
}
|
|
985
986
|
};
|
|
986
987
|
}
|
|
987
|
-
function Yn(e,
|
|
988
|
-
const a = e.pos -
|
|
989
|
-
const
|
|
990
|
-
|
|
988
|
+
function Yn(e, l, t, o) {
|
|
989
|
+
const a = e.pos - l.length, i = (u) => {
|
|
990
|
+
const f = [
|
|
991
|
+
ke('x-webx-block type="${type}" />', {
|
|
991
992
|
label: "x-webx-block",
|
|
992
993
|
detail: "call a block",
|
|
993
994
|
type: "keyword"
|
|
994
995
|
})
|
|
995
996
|
];
|
|
996
|
-
for (const r of
|
|
997
|
-
|
|
997
|
+
for (const r of Be(u ?? []).filter((m) => m.type === "wx-slot"))
|
|
998
|
+
f.push({
|
|
998
999
|
label: `x-slot:${r.id}`,
|
|
999
1000
|
detail: "slot",
|
|
1000
1001
|
info: r.label,
|
|
1001
1002
|
type: "keyword",
|
|
1002
1003
|
boost: 20,
|
|
1003
|
-
apply: (
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1006
|
-
changes: { from:
|
|
1007
|
-
selection: { anchor:
|
|
1008
|
-
annotations: Fe.of(
|
|
1004
|
+
apply: (m, d, p, h) => {
|
|
1005
|
+
const E = `x-slot:${r.id}>`;
|
|
1006
|
+
m.dispatch({
|
|
1007
|
+
changes: { from: p, to: h, insert: `${E}</x-slot:${r.id}>` },
|
|
1008
|
+
selection: { anchor: p + E.length },
|
|
1009
|
+
annotations: Fe.of(d),
|
|
1009
1010
|
userEvent: "input.complete"
|
|
1010
1011
|
});
|
|
1011
1012
|
}
|
|
1012
1013
|
});
|
|
1013
|
-
return { from: a, options:
|
|
1014
|
+
return { from: a, options: f, validFor: /^x-[\w:-]*$/ };
|
|
1014
1015
|
};
|
|
1015
|
-
if (
|
|
1016
|
-
const s = o(
|
|
1016
|
+
if (t === null) return i(null);
|
|
1017
|
+
const s = o(t);
|
|
1017
1018
|
return s instanceof Promise ? s.then(i, () => i(null)) : i(s);
|
|
1018
1019
|
}
|
|
1019
1020
|
function Gn(e) {
|
|
1020
|
-
const
|
|
1021
|
-
for (const
|
|
1021
|
+
const l = [];
|
|
1022
|
+
for (const t of e.matchAll(
|
|
1022
1023
|
/<x-webx-block\b((?:[^>"']|"[^"]*"|'[^']*')*?)(\/?)>|<\/x-webx-block\s*>/g
|
|
1023
1024
|
))
|
|
1024
|
-
|
|
1025
|
-
return
|
|
1025
|
+
t[0].startsWith("</") ? l.pop() : t[2] !== "/" && l.push(/\btype\s*=\s*["']([\w-]+)["']/.exec(t[1] ?? "")?.[1] ?? null);
|
|
1026
|
+
return l.at(-1) ?? null;
|
|
1026
1027
|
}
|
|
1027
|
-
function Zn(e,
|
|
1028
|
-
const
|
|
1028
|
+
function Zn(e, l) {
|
|
1029
|
+
const t = gl(e).map((o, a) => ({
|
|
1029
1030
|
label: `$${o.id}`,
|
|
1030
1031
|
detail: o.type,
|
|
1031
1032
|
info: o.label,
|
|
1032
1033
|
type: "variable",
|
|
1033
1034
|
boost: 50 - a
|
|
1034
1035
|
}));
|
|
1035
|
-
for (const o of vl(
|
|
1036
|
-
|
|
1036
|
+
for (const o of vl(l).keys())
|
|
1037
|
+
t.push({ label: `$${o}`, detail: "loop", type: "variable" });
|
|
1037
1038
|
for (const [o, a] of On)
|
|
1038
|
-
|
|
1039
|
-
return
|
|
1039
|
+
t.push({ label: `$${o}`, detail: "given", info: a, type: "variable", boost: -10 });
|
|
1040
|
+
return t.push({ label: "$slot", detail: "given", info: "what the calling tag held", boost: -15 }), t.push({ label: "$loop", detail: "given", info: "inside @foreach", boost: -20 }), t;
|
|
1040
1041
|
}
|
|
1041
|
-
function Qn(e,
|
|
1042
|
+
function Qn(e, l, t, o, a) {
|
|
1042
1043
|
const i = gl(a);
|
|
1043
1044
|
if (i.length === 0) return null;
|
|
1044
|
-
const s =
|
|
1045
|
+
const s = l === "{{" ? "}}" : "!!}";
|
|
1045
1046
|
return {
|
|
1046
1047
|
from: e.pos - o.length,
|
|
1047
|
-
options: i.map((u,
|
|
1048
|
+
options: i.map((u, f) => ({
|
|
1048
1049
|
label: u.id,
|
|
1049
1050
|
displayLabel: `$${u.id}`,
|
|
1050
1051
|
detail: u.type,
|
|
1051
1052
|
info: u.label,
|
|
1052
1053
|
type: "variable",
|
|
1053
|
-
boost: 50 -
|
|
1054
|
-
apply: (r,
|
|
1055
|
-
const h = r.state.sliceDoc(
|
|
1054
|
+
boost: 50 - f,
|
|
1055
|
+
apply: (r, m, d, p) => {
|
|
1056
|
+
const h = r.state.sliceDoc(p, p + 8), E = new RegExp(`^\\s*${co(s)}`).exec(h), A = E ? /^\s/.test(h) ? "" : " " : ` ${s}`, $ = `${t === "" ? " " : ""}$${u.id}${A}`;
|
|
1056
1057
|
r.dispatch({
|
|
1057
|
-
changes: { from:
|
|
1058
|
+
changes: { from: d, to: p, insert: $ },
|
|
1058
1059
|
// Past the closing braces: the echo is finished, the next thing is the markup.
|
|
1059
|
-
selection: { anchor:
|
|
1060
|
-
annotations: Fe.of(
|
|
1060
|
+
selection: { anchor: d + $.length + (E ? E[0].length : 0) },
|
|
1061
|
+
annotations: Fe.of(m),
|
|
1061
1062
|
userEvent: "input.complete"
|
|
1062
1063
|
});
|
|
1063
1064
|
}
|
|
@@ -1065,12 +1066,12 @@ function Qn(e, t, l, o, a) {
|
|
|
1065
1066
|
validFor: /^\w*$/
|
|
1066
1067
|
};
|
|
1067
1068
|
}
|
|
1068
|
-
function Xn(e,
|
|
1069
|
+
function Xn(e, l) {
|
|
1069
1070
|
return {
|
|
1070
|
-
from: e.pos -
|
|
1071
|
+
from: e.pos - l.length,
|
|
1071
1072
|
options: [
|
|
1072
|
-
...Dn.map((
|
|
1073
|
-
|
|
1073
|
+
...Dn.map((t) => ({ label: t, type: "property" })),
|
|
1074
|
+
ke("value('${name}', ${default})", {
|
|
1074
1075
|
label: "value",
|
|
1075
1076
|
detail: "('name', default)",
|
|
1076
1077
|
type: "method"
|
|
@@ -1079,19 +1080,19 @@ function Xn(e, t) {
|
|
|
1079
1080
|
validFor: /^\w*$/
|
|
1080
1081
|
};
|
|
1081
1082
|
}
|
|
1082
|
-
function eo(e,
|
|
1083
|
-
const i = to(
|
|
1083
|
+
function eo(e, l, t, o, a) {
|
|
1084
|
+
const i = to(l, a, e.state.doc.toString());
|
|
1084
1085
|
return i.length === 0 ? null : {
|
|
1085
1086
|
from: e.pos - o.length,
|
|
1086
1087
|
options: i.map(([s, u]) => ({
|
|
1087
1088
|
label: s,
|
|
1088
1089
|
detail: u,
|
|
1089
1090
|
type: "property",
|
|
1090
|
-
apply: (
|
|
1091
|
-
const
|
|
1092
|
-
|
|
1093
|
-
changes: { from:
|
|
1094
|
-
selection: { anchor:
|
|
1091
|
+
apply: (f, r, m, d) => {
|
|
1092
|
+
const p = t ? m - 1 : m, h = f.state.sliceDoc(d, d + 2), E = t || "'", A = d + (h.startsWith(E) ? 1 : 0), $ = f.state.sliceDoc(A, A + 1) === "]", y = `${E}${s}${E}${$ ? "" : "]"}`;
|
|
1093
|
+
f.dispatch({
|
|
1094
|
+
changes: { from: p, to: A, insert: y },
|
|
1095
|
+
selection: { anchor: p + y.length + ($ ? 1 : 0) },
|
|
1095
1096
|
annotations: Fe.of(r),
|
|
1096
1097
|
userEvent: "input.complete"
|
|
1097
1098
|
});
|
|
@@ -1100,106 +1101,106 @@ function eo(e, t, l, o, a) {
|
|
|
1100
1101
|
validFor: /^\w*$/
|
|
1101
1102
|
};
|
|
1102
1103
|
}
|
|
1103
|
-
function to(e,
|
|
1104
|
-
const o =
|
|
1105
|
-
if (o && Pn.includes(o.type)) return hl.map((
|
|
1106
|
-
if (o?.type === "wx-collection") return Rn.map((
|
|
1107
|
-
const a = vl(
|
|
1104
|
+
function to(e, l, t) {
|
|
1105
|
+
const o = Be(l).find((f) => f.id === e);
|
|
1106
|
+
if (o && Pn.includes(o.type)) return hl.map((f) => [f, o.type]);
|
|
1107
|
+
if (o?.type === "wx-collection") return Rn.map((f) => [f, o.type]);
|
|
1108
|
+
const a = vl(t).get(e), [i, s] = a?.split(".") ?? [], u = i ? Be(l).find((f) => f.id === i) : void 0;
|
|
1108
1109
|
if (!u) return [];
|
|
1109
1110
|
if (u.type === "wx-collection") {
|
|
1110
|
-
const
|
|
1111
|
-
return [...jn[s ?? ""] ?? [], ...r].map((
|
|
1111
|
+
const f = typeof u.props?.source == "string" ? u.props.source : u.type, r = s === "items" ? Fn[f] ?? [] : [];
|
|
1112
|
+
return [...jn[s ?? ""] ?? [], ...r].map((m) => [m, f]);
|
|
1112
1113
|
}
|
|
1113
|
-
return Un.includes(u.type) ? In.map((
|
|
1114
|
+
return Un.includes(u.type) ? In.map((f) => [f, u.type]) : u.type === "wx-repeater" ? Be(u.children ?? []).map((f) => [f.id, f.type]) : [];
|
|
1114
1115
|
}
|
|
1115
1116
|
function vl(e) {
|
|
1116
|
-
const
|
|
1117
|
-
for (const
|
|
1117
|
+
const l = /* @__PURE__ */ new Map();
|
|
1118
|
+
for (const t of e.matchAll(
|
|
1118
1119
|
/\$(\w+)(?:\[\s*['"](\w+)['"]\s*\])?\s+as\s+\$(\w+)(?:\s*=>\s*\$(\w+))?/g
|
|
1119
1120
|
))
|
|
1120
|
-
|
|
1121
|
-
return
|
|
1121
|
+
l.set(t[4] ?? t[3], t[2] ? `${t[1]}.${t[2]}` : t[1]);
|
|
1122
|
+
return l;
|
|
1122
1123
|
}
|
|
1123
|
-
function lo(e,
|
|
1124
|
-
const o = /[\w-]*$/.exec(
|
|
1124
|
+
function lo(e, l, t) {
|
|
1125
|
+
const o = /[\w-]*$/.exec(l)[0], a = new Set(l.split(/\s+/));
|
|
1125
1126
|
return {
|
|
1126
1127
|
from: e.pos - o.length,
|
|
1127
|
-
options: bl(
|
|
1128
|
+
options: bl(t).filter((i) => !a.has(i) || i === o).map((i) => ({ label: i, detail: "styles", type: "class" })),
|
|
1128
1129
|
validFor: /^[\w-]*$/
|
|
1129
1130
|
};
|
|
1130
1131
|
}
|
|
1131
1132
|
function no(e) {
|
|
1132
|
-
const
|
|
1133
|
+
const l = Be(e).filter((t) => t.type === "wx-blocks");
|
|
1133
1134
|
return [
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1135
|
+
ke("@if (${condition})\n ${}\n@endif", { label: "@if", type: "keyword" }),
|
|
1136
|
+
ke("@isset(${value})\n ${}\n@endisset", { label: "@isset", type: "keyword" }),
|
|
1137
|
+
ke("@foreach (${items} as ${item})\n ${}\n@endforeach", {
|
|
1137
1138
|
label: "@foreach",
|
|
1138
1139
|
type: "keyword"
|
|
1139
1140
|
}),
|
|
1140
|
-
|
|
1141
|
+
ke("@forelse (${items} as ${item})\n ${}\n@empty\n ${}\n@endforelse", {
|
|
1141
1142
|
label: "@forelse",
|
|
1142
1143
|
type: "keyword"
|
|
1143
1144
|
}),
|
|
1144
|
-
|
|
1145
|
+
ke("@unless (${condition})\n ${}\n@endunless", {
|
|
1145
1146
|
label: "@unless",
|
|
1146
1147
|
type: "keyword"
|
|
1147
1148
|
}),
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
...
|
|
1151
|
-
(
|
|
1149
|
+
ke("@class([${}])", { label: "@class", type: "keyword" }),
|
|
1150
|
+
ke("@style([${}])", { label: "@style", type: "keyword" }),
|
|
1151
|
+
...l.map(
|
|
1152
|
+
(t) => ke(`@blocks('${t.id}')`, {
|
|
1152
1153
|
label: "@blocks",
|
|
1153
|
-
detail: `('${
|
|
1154
|
+
detail: `('${t.id}')`,
|
|
1154
1155
|
type: "keyword",
|
|
1155
1156
|
boost: 10
|
|
1156
1157
|
})
|
|
1157
1158
|
),
|
|
1158
1159
|
...["@elseif", "@else", "@endif", "@endforeach", "@endisset", "@empty", "@endforelse"].map(
|
|
1159
|
-
(
|
|
1160
|
+
(t) => ({ label: t, type: "keyword", boost: -10 })
|
|
1160
1161
|
)
|
|
1161
1162
|
];
|
|
1162
1163
|
}
|
|
1163
|
-
function oo({ slug: e, template:
|
|
1164
|
-
return (
|
|
1165
|
-
const o =
|
|
1164
|
+
function oo({ slug: e, template: l }) {
|
|
1165
|
+
return (t) => {
|
|
1166
|
+
const o = t.state.sliceDoc(Math.max(0, t.pos - 200), t.pos), a = /(?:^|[\s,>+~(}{])\.([\w-]*)$/.exec(o);
|
|
1166
1167
|
if (!a) return null;
|
|
1167
1168
|
const i = /[^{};]*$/.exec(o)[0];
|
|
1168
1169
|
if (/^\s*[\w-]+\s*:\s/.test(i)) return null;
|
|
1169
|
-
const s = `b-${e()}`, u = new Set(bl(
|
|
1170
|
-
label: `.${
|
|
1170
|
+
const s = `b-${e()}`, u = new Set(bl(t.state.doc.toString())), f = so(l()), r = [s, ...f.filter((d) => d !== s)], m = r.map((d, p) => ({
|
|
1171
|
+
label: `.${d}`,
|
|
1171
1172
|
// A class the template uses and nothing styles yet is the likeliest thing to write.
|
|
1172
|
-
detail: u.has(
|
|
1173
|
+
detail: u.has(d) ? "template" : "template · no rule yet",
|
|
1173
1174
|
type: "class",
|
|
1174
|
-
boost: (u.has(
|
|
1175
|
+
boost: (u.has(d) ? 0 : 20) + (d === s ? 30 : 0) - p / 100
|
|
1175
1176
|
}));
|
|
1176
|
-
for (const
|
|
1177
|
-
r.includes(
|
|
1178
|
-
return { from:
|
|
1177
|
+
for (const d of u)
|
|
1178
|
+
r.includes(d) || m.push({ label: `.${d}`, detail: "styles", type: "class" });
|
|
1179
|
+
return { from: t.pos - a[1].length - 1, options: m, validFor: /^\.[\w-]*$/ };
|
|
1179
1180
|
};
|
|
1180
1181
|
}
|
|
1181
1182
|
function bl(e) {
|
|
1182
|
-
const
|
|
1183
|
+
const l = e.replace(/\/\*[\s\S]*?\*\//g, ""), t = /* @__PURE__ */ new Set(), o = [];
|
|
1183
1184
|
let a = "";
|
|
1184
|
-
for (const i of
|
|
1185
|
+
for (const i of l)
|
|
1185
1186
|
if (i === "{") {
|
|
1186
|
-
const s = o.at(-1) ?? [""], u = a.split(",").map((
|
|
1187
|
-
(
|
|
1187
|
+
const s = o.at(-1) ?? [""], u = a.split(",").map((f) => f.trim()).filter((f) => f !== "" && !f.startsWith("@")).flatMap(
|
|
1188
|
+
(f) => f.includes("&") ? s.map((r) => f.replaceAll("&", r)) : s.map((r) => r ? `${r} ${f}` : f)
|
|
1188
1189
|
);
|
|
1189
|
-
for (const
|
|
1190
|
-
for (const r of
|
|
1190
|
+
for (const f of u)
|
|
1191
|
+
for (const r of f.matchAll(/\.(-?[a-zA-Z_][\w-]*)/g)) t.add(r[1]);
|
|
1191
1192
|
o.push(a.trim().startsWith("@") ? s : u.length ? u : s), a = "";
|
|
1192
1193
|
} else i === "}" ? (o.pop(), a = "") : i === ";" ? a = "" : a += i;
|
|
1193
|
-
return [...
|
|
1194
|
+
return [...t];
|
|
1194
1195
|
}
|
|
1195
1196
|
function so(e) {
|
|
1196
|
-
const
|
|
1197
|
-
for (const
|
|
1198
|
-
const o =
|
|
1197
|
+
const l = /* @__PURE__ */ new Set();
|
|
1198
|
+
for (const t of e.matchAll(/\bclass\s*=\s*"([^"]*)"/g)) {
|
|
1199
|
+
const o = t[1].replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}|@\w+(\([^)]*\))?/g, " ");
|
|
1199
1200
|
for (const a of o.split(/\s+/))
|
|
1200
|
-
/^-?[a-zA-Z_][\w-]*$/.test(a) &&
|
|
1201
|
+
/^-?[a-zA-Z_][\w-]*$/.test(a) && l.add(a);
|
|
1201
1202
|
}
|
|
1202
|
-
return [...
|
|
1203
|
+
return [...l];
|
|
1203
1204
|
}
|
|
1204
1205
|
const ao = [
|
|
1205
1206
|
{ key: "id", value: '""', info: "The variable the template gets, in snake_case." },
|
|
@@ -1214,222 +1215,222 @@ const ao = [
|
|
|
1214
1215
|
{ key: "can", value: '""', info: "The permission the node needs." }
|
|
1215
1216
|
];
|
|
1216
1217
|
function io({ types: e }) {
|
|
1217
|
-
return (
|
|
1218
|
-
const
|
|
1219
|
-
if (!
|
|
1220
|
-
const o =
|
|
1221
|
-
if (!
|
|
1222
|
-
const a =
|
|
1223
|
-
if (
|
|
1224
|
-
const s = ao.filter(({ key: u }) => !
|
|
1225
|
-
({ key: u, value:
|
|
1218
|
+
return (l) => {
|
|
1219
|
+
const t = ro(l.state.doc.toString(), l.pos);
|
|
1220
|
+
if (!t || !t.node) return null;
|
|
1221
|
+
const o = t.string ? l.state.sliceDoc(t.string, l.pos) : /[\w-]*$/.exec(l.state.sliceDoc(Math.max(0, l.pos - 60), l.pos))[0];
|
|
1222
|
+
if (!t.string && o === "" && !l.explicit) return null;
|
|
1223
|
+
const a = l.pos - o.length, i = t.string !== null;
|
|
1224
|
+
if (t.phase === "key") {
|
|
1225
|
+
const s = ao.filter(({ key: u }) => !t.keys.has(u) || u === o).map(
|
|
1226
|
+
({ key: u, value: f, info: r }, m) => ({
|
|
1226
1227
|
label: u,
|
|
1227
1228
|
info: r,
|
|
1228
1229
|
type: "property",
|
|
1229
|
-
boost: -
|
|
1230
|
-
apply: (
|
|
1230
|
+
boost: -m,
|
|
1231
|
+
apply: (d, p, h, E) => Ft(d, p, h, E, i, `"${u}": ${f}`, f)
|
|
1231
1232
|
})
|
|
1232
1233
|
);
|
|
1233
1234
|
return { from: a, options: s, validFor: /^[\w-]*$/ };
|
|
1234
1235
|
}
|
|
1235
|
-
if (
|
|
1236
|
-
const s = Object.entries(e()).map(([u,
|
|
1236
|
+
if (t.phase === "value" && t.key === "type") {
|
|
1237
|
+
const s = Object.entries(e()).map(([u, f]) => ({
|
|
1237
1238
|
label: u,
|
|
1238
|
-
detail:
|
|
1239
|
+
detail: f.kind,
|
|
1239
1240
|
type: "type",
|
|
1240
1241
|
// Fields first: a block's schema is mostly fields, the layout only groups them.
|
|
1241
|
-
boost:
|
|
1242
|
-
apply: (r,
|
|
1242
|
+
boost: f.kind === "field" ? 1 : 0,
|
|
1243
|
+
apply: (r, m, d, p) => Ft(r, m, d, p, i, `"${u}"`, "")
|
|
1243
1244
|
}));
|
|
1244
1245
|
return { from: a, options: s, validFor: /^[\w-]*$/ };
|
|
1245
1246
|
}
|
|
1246
1247
|
return null;
|
|
1247
1248
|
};
|
|
1248
1249
|
}
|
|
1249
|
-
function Ft(e,
|
|
1250
|
-
const u = a ?
|
|
1250
|
+
function Ft(e, l, t, o, a, i, s) {
|
|
1251
|
+
const u = a ? t - 1 : t, f = /^[\w-]*"?/.exec(e.state.sliceDoc(o, o + 60))[0], r = o + (a ? f.length : /^[\w-]*/.exec(f)[0].length), m = s === '""' || s === "{}" || s === "[]" ? 1 : 0;
|
|
1251
1252
|
e.dispatch({
|
|
1252
1253
|
changes: { from: u, to: r, insert: i },
|
|
1253
|
-
selection: { anchor: u + i.length -
|
|
1254
|
-
annotations: Fe.of(
|
|
1254
|
+
selection: { anchor: u + i.length - m },
|
|
1255
|
+
annotations: Fe.of(l),
|
|
1255
1256
|
userEvent: "input.complete"
|
|
1256
1257
|
}), i.startsWith('"type"') && ln(e);
|
|
1257
1258
|
}
|
|
1258
|
-
function ro(e,
|
|
1259
|
-
let
|
|
1259
|
+
function ro(e, l) {
|
|
1260
|
+
let t = null, o = null, a = null, i = !1;
|
|
1260
1261
|
const s = (u) => u?.kind === "object" && u.parent?.kind === "array" && (u.parent.parent === null || u.parent.under === "children");
|
|
1261
|
-
for (let u = 0; u <= e.length && (u ===
|
|
1262
|
-
node: s(
|
|
1263
|
-
phase: a?.key ? "key" :
|
|
1264
|
-
key:
|
|
1265
|
-
keys:
|
|
1262
|
+
for (let u = 0; u <= e.length && (u === l && (o = t?.kind === "object" ? {
|
|
1263
|
+
node: s(t),
|
|
1264
|
+
phase: a?.key ? "key" : t.phase,
|
|
1265
|
+
key: t.key,
|
|
1266
|
+
keys: t.keys,
|
|
1266
1267
|
string: a ? a.start + 1 : null
|
|
1267
1268
|
} : null), u !== e.length); u++) {
|
|
1268
|
-
const
|
|
1269
|
+
const f = e[u];
|
|
1269
1270
|
if (a) {
|
|
1270
1271
|
if (i) i = !1;
|
|
1271
|
-
else if (
|
|
1272
|
-
else if (
|
|
1272
|
+
else if (f === "\\") i = !0;
|
|
1273
|
+
else if (f === '"' || f === `
|
|
1273
1274
|
`) {
|
|
1274
1275
|
const r = e.slice(a.start + 1, u);
|
|
1275
|
-
|
|
1276
|
+
t?.kind === "object" && (a.key ? (t.keys.add(r), t.key = r, t.phase = "colon") : t.phase === "value" && (t.phase = "after")), a = null;
|
|
1276
1277
|
}
|
|
1277
1278
|
continue;
|
|
1278
1279
|
}
|
|
1279
|
-
if (!/\s/.test(
|
|
1280
|
-
if (
|
|
1281
|
-
a = { start: u, key:
|
|
1282
|
-
else if (
|
|
1280
|
+
if (!/\s/.test(f))
|
|
1281
|
+
if (f === '"')
|
|
1282
|
+
a = { start: u, key: t?.kind === "object" && t.phase === "key" };
|
|
1283
|
+
else if (f === "{" || f === "[") {
|
|
1283
1284
|
const r = {
|
|
1284
|
-
kind:
|
|
1285
|
-
parent:
|
|
1286
|
-
under:
|
|
1285
|
+
kind: f === "{" ? "object" : "array",
|
|
1286
|
+
parent: t,
|
|
1287
|
+
under: t?.kind === "object" ? t.key : null,
|
|
1287
1288
|
keys: /* @__PURE__ */ new Set(),
|
|
1288
1289
|
phase: "key",
|
|
1289
1290
|
key: null
|
|
1290
1291
|
};
|
|
1291
|
-
|
|
1292
|
-
} else
|
|
1292
|
+
t?.kind === "object" && (t.phase = "after"), t = r;
|
|
1293
|
+
} else f === "}" || f === "]" ? t = t?.parent ?? null : f === ":" ? t?.kind === "object" && (t.phase = "value") : f === "," && t?.kind === "object" && (t.phase = "key", t.key = null);
|
|
1293
1294
|
}
|
|
1294
1295
|
return o;
|
|
1295
1296
|
}
|
|
1296
|
-
function
|
|
1297
|
-
const
|
|
1298
|
-
for (const
|
|
1299
|
-
!
|
|
1300
|
-
return
|
|
1297
|
+
function Be(e) {
|
|
1298
|
+
const l = [];
|
|
1299
|
+
for (const t of e)
|
|
1300
|
+
!t || typeof t != "object" || (uo.has(t.type) ? l.push(...Be(t.children ?? [])) : typeof t.id == "string" && t.id !== "" && l.push(t));
|
|
1301
|
+
return l;
|
|
1301
1302
|
}
|
|
1302
1303
|
function gl(e) {
|
|
1303
|
-
return
|
|
1304
|
+
return Be(e).filter((l) => l.type !== "wx-blocks");
|
|
1304
1305
|
}
|
|
1305
1306
|
const uo = /* @__PURE__ */ new Set(["wx-card", "wx-tabs", "wx-tab", "wx-row", "wx-col", "wx-divider"]);
|
|
1306
1307
|
function co(e) {
|
|
1307
1308
|
return e.replace(/[.*+?^${}()|[\]\\!]/g, "\\$&");
|
|
1308
1309
|
}
|
|
1309
1310
|
const po = ["block", "entity", "loop", "slot", "__env", "errors", "app"];
|
|
1310
|
-
function fo(e,
|
|
1311
|
+
function fo(e, l, t) {
|
|
1311
1312
|
const o = [];
|
|
1312
|
-
/data-wx-block\s*=/.test(
|
|
1313
|
-
const a = mo(
|
|
1313
|
+
/data-wx-block\s*=/.test(l.template) || o.push({ file: "template", code: "no-marker", line: null, message: t("checks.no-marker") });
|
|
1314
|
+
const a = mo(l.template, l.schema);
|
|
1314
1315
|
a.length > 0 && o.push({
|
|
1315
1316
|
file: "template",
|
|
1316
1317
|
code: "variables-missing",
|
|
1317
1318
|
line: null,
|
|
1318
|
-
message:
|
|
1319
|
-
variables: a.map((
|
|
1319
|
+
message: t("checks.variables-missing", {
|
|
1320
|
+
variables: a.map((m) => `$${m}`).join(", ")
|
|
1320
1321
|
})
|
|
1321
1322
|
});
|
|
1322
1323
|
const i = [], s = [], u = `.b-${e}`;
|
|
1323
|
-
for (const [
|
|
1324
|
-
|
|
1324
|
+
for (const [m, d] of ho(l.styles))
|
|
1325
|
+
m.startsWith(u) || m.startsWith("&") || (/^[a-z][a-z0-9-]*/i.test(m) ? s.push([m, d]) : i.push([m, d]));
|
|
1325
1326
|
i.length > 0 && o.push({
|
|
1326
1327
|
file: "styles",
|
|
1327
1328
|
code: "stray-selectors",
|
|
1328
1329
|
line: i[0][1],
|
|
1329
|
-
message:
|
|
1330
|
+
message: t("checks.stray-selectors", { slug: e, selectors: Ht(i) })
|
|
1330
1331
|
}), s.length > 0 && o.push({
|
|
1331
1332
|
file: "styles",
|
|
1332
1333
|
code: "bare-selectors",
|
|
1333
1334
|
line: s[0][1],
|
|
1334
|
-
message:
|
|
1335
|
+
message: t("checks.bare-selectors", { selectors: Ht(s) })
|
|
1335
1336
|
});
|
|
1336
|
-
const
|
|
1337
|
+
const f = yl(l.styles), r = /@media\b/.exec(f);
|
|
1337
1338
|
return r && o.push({
|
|
1338
1339
|
file: "styles",
|
|
1339
1340
|
code: "media-query",
|
|
1340
|
-
line: wl(
|
|
1341
|
-
message:
|
|
1341
|
+
line: wl(f, r.index),
|
|
1342
|
+
message: t("checks.media-query")
|
|
1342
1343
|
}), o;
|
|
1343
1344
|
}
|
|
1344
1345
|
function kl(e) {
|
|
1345
|
-
const
|
|
1346
|
-
for (const
|
|
1347
|
-
|
|
1348
|
-
return
|
|
1346
|
+
const l = [];
|
|
1347
|
+
for (const t of e)
|
|
1348
|
+
t.id && l.push(t.id), t.children && l.push(...kl(t.children));
|
|
1349
|
+
return l;
|
|
1349
1350
|
}
|
|
1350
|
-
function mo(e,
|
|
1351
|
-
const
|
|
1351
|
+
function mo(e, l) {
|
|
1352
|
+
const t = /* @__PURE__ */ new Set([...kl(l), ...po]);
|
|
1352
1353
|
for (const a of e.matchAll(/\bas\s+\$([a-zA-Z_]\w*)(?:\s*=>\s*\$([a-zA-Z_]\w*))?/g))
|
|
1353
|
-
|
|
1354
|
+
t.add(a[1]), a[2] && t.add(a[2]);
|
|
1354
1355
|
for (const a of e.matchAll(/\$([a-zA-Z_]\w*)\s*(?:=[^=]|\+\+|--|\.=|\+=|-=)/g))
|
|
1355
|
-
|
|
1356
|
+
t.add(a[1]);
|
|
1356
1357
|
const o = [];
|
|
1357
1358
|
for (const a of e.matchAll(/\$([a-zA-Z_]\w*)/g)) {
|
|
1358
1359
|
const i = a[1];
|
|
1359
|
-
!
|
|
1360
|
+
!t.has(i) && !o.includes(i) && o.push(i);
|
|
1360
1361
|
}
|
|
1361
1362
|
return o;
|
|
1362
1363
|
}
|
|
1363
1364
|
function ho(e) {
|
|
1364
|
-
const
|
|
1365
|
-
for (const o of
|
|
1365
|
+
const l = yl(e), t = [];
|
|
1366
|
+
for (const o of l.matchAll(/([^{};]+)\{/g)) {
|
|
1366
1367
|
const a = o[1], i = a.trim();
|
|
1367
1368
|
if (!(i === "" || i.startsWith("@")))
|
|
1368
1369
|
for (const s of a.split(",")) {
|
|
1369
1370
|
const u = s.trim();
|
|
1370
|
-
u === "" || u === "from" || u === "to" || u.endsWith("%") ||
|
|
1371
|
+
u === "" || u === "from" || u === "to" || u.endsWith("%") || t.push([u, wl(l, o.index + a.indexOf(u))]);
|
|
1371
1372
|
}
|
|
1372
1373
|
}
|
|
1373
|
-
return
|
|
1374
|
+
return t;
|
|
1374
1375
|
}
|
|
1375
1376
|
function yl(e) {
|
|
1376
|
-
return e.replace(/\/\*[\s\S]*?\*\//g, (
|
|
1377
|
+
return e.replace(/\/\*[\s\S]*?\*\//g, (l) => l.replace(/[^\n]/g, " "));
|
|
1377
1378
|
}
|
|
1378
|
-
function wl(e,
|
|
1379
|
-
return e.slice(0, Math.max(0,
|
|
1379
|
+
function wl(e, l) {
|
|
1380
|
+
return e.slice(0, Math.max(0, l)).split(`
|
|
1380
1381
|
`).length;
|
|
1381
1382
|
}
|
|
1382
1383
|
function Ht(e) {
|
|
1383
|
-
const
|
|
1384
|
-
return
|
|
1384
|
+
const l = [...new Set(e.map(([t]) => t))];
|
|
1385
|
+
return l.slice(0, 3).join(", ") + (l.length > 3 ? ", …" : "");
|
|
1385
1386
|
}
|
|
1386
|
-
function
|
|
1387
|
-
return e.map((
|
|
1388
|
-
...
|
|
1389
|
-
name:
|
|
1390
|
-
children:
|
|
1387
|
+
function Et(e) {
|
|
1388
|
+
return e.map((l) => ({
|
|
1389
|
+
...l,
|
|
1390
|
+
name: l.name ?? l.id,
|
|
1391
|
+
children: l.children ? Et(l.children) : l.children
|
|
1391
1392
|
}));
|
|
1392
1393
|
}
|
|
1393
|
-
function xl(e,
|
|
1394
|
-
return e === 0 ?
|
|
1394
|
+
function xl(e, l) {
|
|
1395
|
+
return e === 0 ? l("page.not-used") : e === 1 ? l("page.on-page") : l("page.on-pages", { count: e });
|
|
1395
1396
|
}
|
|
1396
|
-
function je(e,
|
|
1397
|
-
const
|
|
1398
|
-
return o ===
|
|
1397
|
+
function je(e, l) {
|
|
1398
|
+
const t = `groups.${e}`, o = l(t);
|
|
1399
|
+
return o === t || o === `webx-blocks::${t}` ? e.charAt(0).toUpperCase() + e.slice(1) : o;
|
|
1399
1400
|
}
|
|
1400
|
-
function
|
|
1401
|
+
function ye(e) {
|
|
1401
1402
|
return e.kind ?? "block";
|
|
1402
1403
|
}
|
|
1403
|
-
function _l(e,
|
|
1404
|
-
return e === 0 ?
|
|
1404
|
+
function _l(e, l) {
|
|
1405
|
+
return e === 0 ? l("components.not-called") : e === 1 ? l("components.in-block") : l("components.in-blocks", { count: e });
|
|
1405
1406
|
}
|
|
1406
1407
|
const vo = /* @__PURE__ */ new Set(["wx-card", "wx-tabs", "wx-tab", "wx-row", "wx-col", "wx-divider"]);
|
|
1407
|
-
function
|
|
1408
|
-
const
|
|
1409
|
-
for (const
|
|
1410
|
-
!
|
|
1411
|
-
return
|
|
1408
|
+
function Vt(e) {
|
|
1409
|
+
const l = [];
|
|
1410
|
+
for (const t of e)
|
|
1411
|
+
!t || typeof t != "object" || (vo.has(t.type) ? l.push(...Vt(t.children ?? [])) : typeof t.id == "string" && t.id !== "" && l.push(t));
|
|
1412
|
+
return l;
|
|
1412
1413
|
}
|
|
1413
|
-
function bo(e,
|
|
1414
|
-
const a =
|
|
1415
|
-
for (const
|
|
1416
|
-
if (
|
|
1417
|
-
const r =
|
|
1414
|
+
function bo(e, l, t = {}, o = null) {
|
|
1415
|
+
const a = Vt(l), i = [`type="${e}"`];
|
|
1416
|
+
for (const f of a) {
|
|
1417
|
+
if (f.type === "wx-slot" || f.type === "wx-blocks") continue;
|
|
1418
|
+
const r = t[f.id];
|
|
1418
1419
|
i.push(
|
|
1419
|
-
|
|
1420
|
+
f.type !== "wx-data" && (typeof r == "string" || typeof r == "number") ? `${f.id}="${String(r).replace(/"/g, """)}"` : `:${f.id}="$${go(f.id)}"`
|
|
1420
1421
|
);
|
|
1421
1422
|
}
|
|
1422
1423
|
o && i.push(`fallback="${o}"`);
|
|
1423
|
-
const s = a.filter((
|
|
1424
|
+
const s = a.filter((f) => f.type === "wx-slot"), u = `<x-webx-block ${i.join(" ")}`;
|
|
1424
1425
|
return s.length === 0 ? `${u} />` : [
|
|
1425
1426
|
`${u}>`,
|
|
1426
|
-
...s.map((
|
|
1427
|
+
...s.map((f) => ` <x-slot:${f.id}>…</x-slot:${f.id}>`),
|
|
1427
1428
|
"</x-webx-block>"
|
|
1428
1429
|
].join(`
|
|
1429
1430
|
`);
|
|
1430
1431
|
}
|
|
1431
1432
|
function go(e) {
|
|
1432
|
-
return e.replace(/-(\w)/g, (
|
|
1433
|
+
return e.replace(/-(\w)/g, (l, t) => t.toUpperCase());
|
|
1433
1434
|
}
|
|
1434
1435
|
const ko = { class: "wx-block-editor" }, yo = { class: "wx-block-editor__split" }, wo = {
|
|
1435
1436
|
type: "button",
|
|
@@ -1446,22 +1447,22 @@ const ko = { class: "wx-block-editor" }, yo = { class: "wx-block-editor__split"
|
|
|
1446
1447
|
}, Ao = { class: "wx-block-editor__shape-type" }, Bo = { class: "wx-block-editor__pane" }, Lo = { class: "wx-block-editor__pane" }, Wo = { class: "wx-block-editor__note" }, No = { class: "wx-block-editor__split" }, zo = { class: "wx-block-editor__pane" }, Mo = { class: "wx-block-editor__note" }, Oo = { class: "wx-block-editor__settings" }, Do = {
|
|
1447
1448
|
key: 5,
|
|
1448
1449
|
class: "is-wide wx-block-editor__danger"
|
|
1449
|
-
}, Io = /* @__PURE__ */
|
|
1450
|
+
}, Io = /* @__PURE__ */ ae({
|
|
1450
1451
|
__name: "BlockEditorPage",
|
|
1451
1452
|
props: {
|
|
1452
1453
|
base: { default: "/blocks" }
|
|
1453
1454
|
},
|
|
1454
1455
|
setup(e) {
|
|
1455
|
-
const
|
|
1456
|
-
|
|
1457
|
-
const s =
|
|
1458
|
-
const C =
|
|
1456
|
+
const l = e, t = lt(), o = Re(t), a = en(), i = sl();
|
|
1457
|
+
Ie();
|
|
1458
|
+
const s = de("webx-blocks"), u = nt(), f = S(() => Number(a.params.id)), r = I(null), m = I([]), d = I(!0), p = I(!1), h = I(!1), E = I("template"), A = S(() => {
|
|
1459
|
+
const C = t.state.manifest?.modules.find((k) => k.id === "blocks")?.meta;
|
|
1459
1460
|
return {
|
|
1460
1461
|
groups: C?.groups ?? [],
|
|
1461
1462
|
editing: C?.editing ?? !0,
|
|
1462
1463
|
provides: C?.provides ?? []
|
|
1463
1464
|
};
|
|
1464
|
-
}),
|
|
1465
|
+
}), $ = S(() => t.can("blocks.manage") && A.value.editing), y = vt({
|
|
1465
1466
|
kind: "block",
|
|
1466
1467
|
slug: "",
|
|
1467
1468
|
title: "",
|
|
@@ -1473,30 +1474,30 @@ const ko = { class: "wx-block-editor" }, yo = { class: "wx-block-editor__split"
|
|
|
1473
1474
|
allowed_in: [],
|
|
1474
1475
|
max_per_entity: null,
|
|
1475
1476
|
is_enabled: !0
|
|
1476
|
-
}), x =
|
|
1477
|
+
}), x = vt({
|
|
1477
1478
|
schema: [],
|
|
1478
1479
|
template: "",
|
|
1479
1480
|
styles: "",
|
|
1480
1481
|
script: null,
|
|
1481
1482
|
sample: {}
|
|
1482
|
-
}),
|
|
1483
|
+
}), U = I("[]"), Z = I(null), G = I(""), re = I({}), z = I(null), P = vt({
|
|
1483
1484
|
html: "",
|
|
1484
1485
|
styles: "",
|
|
1485
1486
|
script: null,
|
|
1486
1487
|
runtime: null,
|
|
1487
1488
|
stage: null,
|
|
1488
1489
|
loading: !1
|
|
1489
|
-
}), Q = S(() => JSON.stringify({ settings:
|
|
1490
|
+
}), Q = S(() => JSON.stringify({ settings: y, content: x })), X = S(() => G.value !== "" && Q.value !== G.value), xe = S(() => fo(y.slug, x, s)), ue = I([]), te = /* @__PURE__ */ new Map(), ve = /* @__PURE__ */ new Map();
|
|
1490
1491
|
async function Te() {
|
|
1491
1492
|
try {
|
|
1492
1493
|
const C = await o.index();
|
|
1493
1494
|
te.clear();
|
|
1494
1495
|
for (const k of C.blocks) te.set(k.slug, k.id);
|
|
1495
|
-
|
|
1496
|
+
ue.value = [
|
|
1496
1497
|
...C.blocks.map((k) => ({
|
|
1497
1498
|
slug: k.slug,
|
|
1498
1499
|
title: k.title,
|
|
1499
|
-
kind:
|
|
1500
|
+
kind: ye(k),
|
|
1500
1501
|
fallback: C.declared.find((F) => F.slug === k.slug)?.fallback ?? null
|
|
1501
1502
|
})),
|
|
1502
1503
|
...C.declared.filter((k) => !k.customised).map((k) => ({
|
|
@@ -1509,8 +1510,8 @@ const ko = { class: "wx-block-editor" }, yo = { class: "wx-block-editor__split"
|
|
|
1509
1510
|
} catch {
|
|
1510
1511
|
}
|
|
1511
1512
|
}
|
|
1512
|
-
function
|
|
1513
|
-
if (C ===
|
|
1513
|
+
function Le(C) {
|
|
1514
|
+
if (C === y.slug) return x.schema;
|
|
1514
1515
|
const k = te.get(C);
|
|
1515
1516
|
if (k === void 0) return null;
|
|
1516
1517
|
let F = ve.get(C);
|
|
@@ -1519,40 +1520,40 @@ const ko = { class: "wx-block-editor" }, yo = { class: "wx-block-editor__split"
|
|
|
1519
1520
|
() => null
|
|
1520
1521
|
), ve.set(C, F)), F;
|
|
1521
1522
|
}
|
|
1522
|
-
const
|
|
1523
|
+
const K = {
|
|
1523
1524
|
template: [
|
|
1524
|
-
|
|
1525
|
+
gt(
|
|
1525
1526
|
Hn({
|
|
1526
1527
|
schema: () => x.schema,
|
|
1527
1528
|
styles: () => x.styles,
|
|
1528
|
-
types: () =>
|
|
1529
|
-
schemaOf:
|
|
1529
|
+
types: () => ue.value,
|
|
1530
|
+
schemaOf: Le
|
|
1530
1531
|
})
|
|
1531
1532
|
)
|
|
1532
1533
|
],
|
|
1533
1534
|
styles: [
|
|
1534
|
-
|
|
1535
|
+
gt(oo({ slug: () => y.slug, template: () => x.template }))
|
|
1535
1536
|
],
|
|
1536
1537
|
// The renderer's own types under the panel's, the same merge the sample form is drawn with.
|
|
1537
|
-
schema: [
|
|
1538
|
+
schema: [gt(io({ types: () => ({ ...rt, ...t.types }) }))]
|
|
1538
1539
|
}, Ee = S(() => {
|
|
1539
|
-
const C = [...
|
|
1540
|
-
return C.includes(
|
|
1541
|
-
}),
|
|
1540
|
+
const C = [...A.value.groups];
|
|
1541
|
+
return C.includes(y.group) || C.push(y.group), C.map((k) => ({ value: k, label: je(k, s) }));
|
|
1542
|
+
}), _e = S({
|
|
1542
1543
|
get: () => x.sample,
|
|
1543
1544
|
set: (C) => {
|
|
1544
1545
|
x.sample = C;
|
|
1545
1546
|
}
|
|
1546
|
-
}),
|
|
1547
|
+
}), $e = S(() => b(x.schema));
|
|
1547
1548
|
function b(C) {
|
|
1548
1549
|
const k = [];
|
|
1549
1550
|
for (const F of C)
|
|
1550
1551
|
F.type !== "wx-blocks" && !(F.children?.length && !F.name) && k.push(F.id), F.children && k.push(...b(F.children));
|
|
1551
1552
|
return k;
|
|
1552
1553
|
}
|
|
1553
|
-
function
|
|
1554
|
-
r.value = C, Object.assign(
|
|
1555
|
-
kind:
|
|
1554
|
+
function T(C) {
|
|
1555
|
+
r.value = C, Object.assign(y, {
|
|
1556
|
+
kind: ye(C),
|
|
1556
1557
|
slug: C.slug,
|
|
1557
1558
|
title: C.title,
|
|
1558
1559
|
description: C.description,
|
|
@@ -1571,20 +1572,20 @@ const ko = { class: "wx-block-editor" }, yo = { class: "wx-block-editor__split"
|
|
|
1571
1572
|
script: null,
|
|
1572
1573
|
sample: {}
|
|
1573
1574
|
};
|
|
1574
|
-
Object.assign(x, Ce(k)),
|
|
1575
|
+
Object.assign(x, Ce(k)), U.value = JSON.stringify(k.schema, null, 2), Z.value = null, G.value = Q.value;
|
|
1575
1576
|
}
|
|
1576
1577
|
async function M() {
|
|
1577
|
-
|
|
1578
|
+
d.value = !0;
|
|
1578
1579
|
try {
|
|
1579
|
-
|
|
1580
|
+
T(await o.get(f.value)), m.value = await o.usage(f.value), Te();
|
|
1580
1581
|
} catch (C) {
|
|
1581
|
-
|
|
1582
|
+
J.danger(u(C));
|
|
1582
1583
|
} finally {
|
|
1583
|
-
|
|
1584
|
+
d.value = !1;
|
|
1584
1585
|
}
|
|
1585
1586
|
}
|
|
1586
1587
|
function q(C) {
|
|
1587
|
-
|
|
1588
|
+
U.value = C;
|
|
1588
1589
|
try {
|
|
1589
1590
|
const k = JSON.parse(C);
|
|
1590
1591
|
if (!Array.isArray(k)) throw new Error("not a list");
|
|
@@ -1606,7 +1607,7 @@ const ko = { class: "wx-block-editor" }, yo = { class: "wx-block-editor__split"
|
|
|
1606
1607
|
try {
|
|
1607
1608
|
const k = await o.render(r.value.id, {
|
|
1608
1609
|
values: x.sample,
|
|
1609
|
-
content:
|
|
1610
|
+
content: $.value ? {
|
|
1610
1611
|
template: x.template,
|
|
1611
1612
|
styles: x.styles,
|
|
1612
1613
|
script: x.script,
|
|
@@ -1616,22 +1617,22 @@ const ko = { class: "wx-block-editor" }, yo = { class: "wx-block-editor__split"
|
|
|
1616
1617
|
if (C !== be) return;
|
|
1617
1618
|
P.html = k.html, P.styles = k.styles, P.script = k.script, P.runtime = k.runtime, P.stage = k.stage ?? null;
|
|
1618
1619
|
} catch (k) {
|
|
1619
|
-
C === be &&
|
|
1620
|
+
C === be && J.danger(u(k));
|
|
1620
1621
|
} finally {
|
|
1621
1622
|
C === be && (P.loading = !1);
|
|
1622
1623
|
}
|
|
1623
1624
|
}
|
|
1624
|
-
|
|
1625
|
+
se(
|
|
1625
1626
|
() => [x.template, x.styles, x.script, x.schema, x.sample],
|
|
1626
1627
|
ge,
|
|
1627
1628
|
{ deep: !0 }
|
|
1628
1629
|
);
|
|
1629
|
-
const
|
|
1630
|
+
const We = I(null);
|
|
1630
1631
|
function He(C) {
|
|
1631
1632
|
return `{{ $${C} }}`;
|
|
1632
1633
|
}
|
|
1633
1634
|
function B(C) {
|
|
1634
|
-
const F =
|
|
1635
|
+
const F = We.value?.view?.value;
|
|
1635
1636
|
if (!F) {
|
|
1636
1637
|
x.template += `{{ $${C} }}`;
|
|
1637
1638
|
return;
|
|
@@ -1640,25 +1641,25 @@ const ko = { class: "wx-block-editor" }, yo = { class: "wx-block-editor__split"
|
|
|
1640
1641
|
}
|
|
1641
1642
|
async function D() {
|
|
1642
1643
|
if (!r.value) return;
|
|
1643
|
-
|
|
1644
|
+
p.value = !0, re.value = {}, z.value = null;
|
|
1644
1645
|
const C = r.value.draft?.number ?? null;
|
|
1645
1646
|
try {
|
|
1646
1647
|
const k = await o.update(r.value.id, {
|
|
1647
|
-
...
|
|
1648
|
-
allow:
|
|
1649
|
-
allowed_in:
|
|
1650
|
-
description:
|
|
1651
|
-
icon:
|
|
1648
|
+
...y,
|
|
1649
|
+
allow: y.allow.length ? y.allow : null,
|
|
1650
|
+
allowed_in: y.allowed_in.length ? y.allowed_in : null,
|
|
1651
|
+
description: y.description || null,
|
|
1652
|
+
icon: y.icon || null,
|
|
1652
1653
|
content: Z.value ? { ...x, schema: void 0 } : x
|
|
1653
1654
|
});
|
|
1654
|
-
|
|
1655
|
+
T(k), J.success(
|
|
1655
1656
|
k.draft && k.draft.number !== C ? s("page.saved", { number: k.draft.number }) : s("page.unchanged")
|
|
1656
1657
|
);
|
|
1657
1658
|
} catch (k) {
|
|
1658
1659
|
const F = k.body;
|
|
1659
|
-
F?.errors ? (
|
|
1660
|
+
F?.errors ? (re.value = F.errors, J.danger(s("page.failed"))) : J.danger(u(k, s("page.failed")));
|
|
1660
1661
|
} finally {
|
|
1661
|
-
|
|
1662
|
+
p.value = !1;
|
|
1662
1663
|
}
|
|
1663
1664
|
}
|
|
1664
1665
|
async function j() {
|
|
@@ -1666,25 +1667,25 @@ const ko = { class: "wx-block-editor" }, yo = { class: "wx-block-editor__split"
|
|
|
1666
1667
|
title: s("page.publish-title", { number: r.value.draft.number }),
|
|
1667
1668
|
// A component stands on no page itself; what a new version reaches is the blocks calling it.
|
|
1668
1669
|
// A declared place is also printed by the module's views, which the count does not see.
|
|
1669
|
-
message:
|
|
1670
|
-
module:
|
|
1671
|
-
count:
|
|
1672
|
-
}) :
|
|
1670
|
+
message: Ae.value ? s("components.publish-declared", {
|
|
1671
|
+
module: Ae.value,
|
|
1672
|
+
count: pe.value.length
|
|
1673
|
+
}) : ne.value ? s("components.publish-text", { count: pe.value.length }) : s("page.publish-text", { count: r.value.usage_count }),
|
|
1673
1674
|
confirmText: s("page.publish"),
|
|
1674
1675
|
cancelText: s("page.cancel")
|
|
1675
1676
|
}))) {
|
|
1676
1677
|
h.value = !0, z.value = null;
|
|
1677
1678
|
try {
|
|
1678
|
-
|
|
1679
|
+
T(await o.publish(r.value.id)), J.success(s("page.published", { number: r.value.published?.number ?? 0 }));
|
|
1679
1680
|
} catch (k) {
|
|
1680
1681
|
const F = k.body;
|
|
1681
|
-
F?.errors ? (z.value = F,
|
|
1682
|
+
F?.errors ? (z.value = F, E.value = "template", J.danger(s("page.publish-failed"))) : J.danger(u(k, s("page.publish-failed")));
|
|
1682
1683
|
} finally {
|
|
1683
1684
|
h.value = !1;
|
|
1684
1685
|
}
|
|
1685
1686
|
}
|
|
1686
1687
|
}
|
|
1687
|
-
async function
|
|
1688
|
+
async function Se() {
|
|
1688
1689
|
if (!r.value) return;
|
|
1689
1690
|
const C = r.value.declared != null;
|
|
1690
1691
|
if (await dt({
|
|
@@ -1695,12 +1696,12 @@ const ko = { class: "wx-block-editor" }, yo = { class: "wx-block-editor__split"
|
|
|
1695
1696
|
tone: "danger"
|
|
1696
1697
|
}))
|
|
1697
1698
|
try {
|
|
1698
|
-
await o.remove(r.value.id),
|
|
1699
|
+
await o.remove(r.value.id), J.success(s("page.deleted")), i.push(l.base);
|
|
1699
1700
|
} catch (F) {
|
|
1700
|
-
|
|
1701
|
+
J.danger(u(F));
|
|
1701
1702
|
}
|
|
1702
1703
|
}
|
|
1703
|
-
const
|
|
1704
|
+
const ee = S(
|
|
1704
1705
|
() => z.value ? {
|
|
1705
1706
|
message: z.value.errors.template?.[0] ?? z.value.message,
|
|
1706
1707
|
line: z.value.line,
|
|
@@ -1708,7 +1709,7 @@ const ko = { class: "wx-block-editor" }, yo = { class: "wx-block-editor__split"
|
|
|
1708
1709
|
title: z.value.entity.title ?? `#${z.value.entity.id}`
|
|
1709
1710
|
}) : null
|
|
1710
1711
|
} : null
|
|
1711
|
-
),
|
|
1712
|
+
), st = S(() => E.value === "template" || E.value === "styles"), mt = S(() => [
|
|
1712
1713
|
{
|
|
1713
1714
|
title: s("page.example-handler"),
|
|
1714
1715
|
code: `el.querySelector('.b-hero__button')?.addEventListener('click', (event) => {
|
|
@@ -1731,22 +1732,22 @@ setInterval(() => el.classList.toggle('is-second'), seconds * 1000)`
|
|
|
1731
1732
|
|
|
1732
1733
|
new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
1733
1734
|
}
|
|
1734
|
-
]),
|
|
1735
|
+
]), Ne = S(() => m.value.slice(0, 5)), ne = S(() => y.kind === "component"), pe = S(() => r.value?.used_by ?? []), Ae = S(() => {
|
|
1735
1736
|
const C = r.value?.declared?.module;
|
|
1736
|
-
return C ?
|
|
1737
|
-
}),
|
|
1738
|
-
() =>
|
|
1737
|
+
return C ? t.state.manifest?.modules.find((k) => k.id === C)?.title ?? C.charAt(0).toUpperCase() + C.slice(1) : null;
|
|
1738
|
+
}), at = S(
|
|
1739
|
+
() => ne.value ? _l(pe.value.length, s) : xl(r.value?.usage_count ?? 0, s)
|
|
1739
1740
|
), Sl = S(
|
|
1740
|
-
() => (r.value?.usage_count ?? 0) > 0 ||
|
|
1741
|
-
),
|
|
1741
|
+
() => (r.value?.usage_count ?? 0) > 0 || pe.value.length > 0 || Ae.value !== null
|
|
1742
|
+
), ht = S(() => {
|
|
1742
1743
|
const C = r.value?.usage_count ?? 0;
|
|
1743
|
-
return C > 0 ? C === 1 ? s("page.delete-used-one") : s("page.delete-used", { count: C }) :
|
|
1744
|
-
titles:
|
|
1744
|
+
return C > 0 ? C === 1 ? s("page.delete-used-one") : s("page.delete-used", { count: C }) : pe.value.length > 0 ? s("components.delete-called", {
|
|
1745
|
+
titles: pe.value.map((k) => `"${k.title}"`).join(", ")
|
|
1745
1746
|
}) : null;
|
|
1746
1747
|
}), Bt = S(
|
|
1747
|
-
() => bo(
|
|
1748
|
+
() => bo(y.slug, x.schema, x.sample, r.value?.declared?.fallback ?? null)
|
|
1748
1749
|
), Cl = S(
|
|
1749
|
-
() =>
|
|
1750
|
+
() => Vt(x.schema).filter((C) => C.type === "wx-data").map((C) => {
|
|
1750
1751
|
const k = typeof C.props?.shape == "string" ? C.props.shape : null;
|
|
1751
1752
|
return {
|
|
1752
1753
|
id: C.id,
|
|
@@ -1757,29 +1758,29 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1757
1758
|
);
|
|
1758
1759
|
async function Tl() {
|
|
1759
1760
|
try {
|
|
1760
|
-
await navigator.clipboard.writeText(Bt.value),
|
|
1761
|
+
await navigator.clipboard.writeText(Bt.value), J.success(s("components.copied"));
|
|
1761
1762
|
} catch {
|
|
1762
1763
|
}
|
|
1763
1764
|
}
|
|
1764
1765
|
function fe(C) {
|
|
1765
|
-
return
|
|
1766
|
+
return re.value[C]?.[0];
|
|
1766
1767
|
}
|
|
1767
1768
|
function Lt(C) {
|
|
1768
1769
|
X.value && C.preventDefault();
|
|
1769
1770
|
}
|
|
1770
|
-
|
|
1771
|
+
et(() => {
|
|
1771
1772
|
M(), window.addEventListener("beforeunload", Lt);
|
|
1772
|
-
}),
|
|
1773
|
+
}), tt(() => {
|
|
1773
1774
|
clearTimeout(le), window.removeEventListener("beforeunload", Lt);
|
|
1774
|
-
}),
|
|
1775
|
+
}), se(f, () => {
|
|
1775
1776
|
M();
|
|
1776
1777
|
});
|
|
1777
1778
|
const El = S(() => [
|
|
1778
1779
|
{ value: "block", label: s("components.kind-block") },
|
|
1779
1780
|
{ value: "component", label: s("components.kind-component") }
|
|
1780
1781
|
]), Vl = S(
|
|
1781
|
-
() =>
|
|
1782
|
-
{ key: "save", label: s("page.save"), loading:
|
|
1782
|
+
() => $.value ? [
|
|
1783
|
+
{ key: "save", label: s("page.save"), loading: p.value, run: () => {
|
|
1783
1784
|
D();
|
|
1784
1785
|
} },
|
|
1785
1786
|
{
|
|
@@ -1795,41 +1796,41 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1795
1796
|
] : []
|
|
1796
1797
|
);
|
|
1797
1798
|
return (C, k) => {
|
|
1798
|
-
const F =
|
|
1799
|
+
const F = St("router-link");
|
|
1799
1800
|
return c(), _("div", ko, [
|
|
1800
|
-
|
|
1801
|
+
d.value || !r.value ? (c(), _(R, { key: 0 }, [
|
|
1801
1802
|
v(n(Ue), {
|
|
1802
1803
|
class: "wx-block-editor__ghost-head",
|
|
1803
1804
|
title: "",
|
|
1804
1805
|
rows: 1
|
|
1805
1806
|
}),
|
|
1806
|
-
|
|
1807
|
-
v(n(
|
|
1807
|
+
V("div", yo, [
|
|
1808
|
+
v(n(ze), null, {
|
|
1808
1809
|
default: g(() => [
|
|
1809
1810
|
v(n(Ue), { rows: 8 })
|
|
1810
1811
|
]),
|
|
1811
1812
|
_: 1
|
|
1812
1813
|
}),
|
|
1813
|
-
v(n(
|
|
1814
|
+
v(n(ze), null, {
|
|
1814
1815
|
default: g(() => [
|
|
1815
1816
|
v(n(Ue), { rows: 4 })
|
|
1816
1817
|
]),
|
|
1817
1818
|
_: 1
|
|
1818
1819
|
})
|
|
1819
1820
|
])
|
|
1820
|
-
], 64)) : (c(), _(
|
|
1821
|
+
], 64)) : (c(), _(R, { key: 1 }, [
|
|
1821
1822
|
v(n(Yl), {
|
|
1822
|
-
title:
|
|
1823
|
+
title: y.title,
|
|
1823
1824
|
back: e.base,
|
|
1824
1825
|
"back-label": n(s)("page.back"),
|
|
1825
1826
|
actions: Vl.value
|
|
1826
1827
|
}, {
|
|
1827
1828
|
"title-after": g(() => [
|
|
1828
|
-
|
|
1829
|
+
$.value ? (c(), O(n(Gl), {
|
|
1829
1830
|
key: 0,
|
|
1830
|
-
name:
|
|
1831
|
+
name: y.title,
|
|
1831
1832
|
placeholder: n(s)("page.title"),
|
|
1832
|
-
onRename: k[0] || (k[0] = (N) =>
|
|
1833
|
+
onRename: k[0] || (k[0] = (N) => y.title = N)
|
|
1833
1834
|
}, null, 8, ["name", "placeholder"])) : W("", !0),
|
|
1834
1835
|
X.value ? (c(), O(n(he), {
|
|
1835
1836
|
key: 1,
|
|
@@ -1837,7 +1838,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1837
1838
|
dot: ""
|
|
1838
1839
|
}, {
|
|
1839
1840
|
default: g(() => [
|
|
1840
|
-
L(
|
|
1841
|
+
L(w(n(s)("page.unsaved")), 1)
|
|
1841
1842
|
]),
|
|
1842
1843
|
_: 1
|
|
1843
1844
|
})) : W("", !0),
|
|
@@ -1847,7 +1848,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1847
1848
|
dot: ""
|
|
1848
1849
|
}, {
|
|
1849
1850
|
default: g(() => [
|
|
1850
|
-
L(
|
|
1851
|
+
L(w(n(s)("page.draft", { number: r.value.draft.number })), 1)
|
|
1851
1852
|
]),
|
|
1852
1853
|
_: 1
|
|
1853
1854
|
})) : W("", !0),
|
|
@@ -1857,7 +1858,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1857
1858
|
dot: ""
|
|
1858
1859
|
}, {
|
|
1859
1860
|
default: g(() => [
|
|
1860
|
-
L(
|
|
1861
|
+
L(w(n(s)("page.live", { number: r.value.published.number })), 1)
|
|
1861
1862
|
]),
|
|
1862
1863
|
_: 1
|
|
1863
1864
|
})) : (c(), O(n(he), {
|
|
@@ -1865,14 +1866,14 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1865
1866
|
type: "default"
|
|
1866
1867
|
}, {
|
|
1867
1868
|
default: g(() => [
|
|
1868
|
-
L(
|
|
1869
|
+
L(w(n(s)("page.never-published")), 1)
|
|
1869
1870
|
]),
|
|
1870
1871
|
_: 1
|
|
1871
1872
|
}))
|
|
1872
1873
|
]),
|
|
1873
1874
|
subtitle: g(() => [
|
|
1874
|
-
|
|
1875
|
-
L(" · " +
|
|
1875
|
+
V("code", null, w(y.slug), 1),
|
|
1876
|
+
L(" · " + w(ne.value ? n(s)("components.kind-component") : n(je)(y.group, n(s))) + " · ", 1),
|
|
1876
1877
|
Sl.value ? (c(), O(n(Al), {
|
|
1877
1878
|
key: 0,
|
|
1878
1879
|
title: n(s)("page.usage"),
|
|
@@ -1880,68 +1881,68 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1880
1881
|
align: "start"
|
|
1881
1882
|
}, {
|
|
1882
1883
|
trigger: g(() => [
|
|
1883
|
-
|
|
1884
|
+
V("button", wo, w(at.value), 1)
|
|
1884
1885
|
]),
|
|
1885
1886
|
default: g(() => [
|
|
1886
|
-
|
|
1887
|
-
(c(!0), _(
|
|
1887
|
+
V("div", xo, [
|
|
1888
|
+
(c(!0), _(R, null, Y(pe.value, (N) => (c(), O(F, {
|
|
1888
1889
|
key: `type:${N.id}`,
|
|
1889
1890
|
to: `${e.base}/${N.id}`,
|
|
1890
1891
|
class: "wx-block-editor__use"
|
|
1891
1892
|
}, {
|
|
1892
1893
|
default: g(() => [
|
|
1893
|
-
L(
|
|
1894
|
+
L(w(n(s)("components.called-by", { title: N.title })), 1)
|
|
1894
1895
|
]),
|
|
1895
1896
|
_: 2
|
|
1896
1897
|
}, 1032, ["to"]))), 128)),
|
|
1897
|
-
|
|
1898
|
-
(c(!0), _(
|
|
1898
|
+
Ae.value ? (c(), _("div", _o, w(n(s)("components.module-views", { module: Ae.value })), 1)) : W("", !0),
|
|
1899
|
+
(c(!0), _(R, null, Y(Ne.value, (N) => (c(), _("div", {
|
|
1899
1900
|
key: `${N.model}:${N.id}`,
|
|
1900
1901
|
class: "wx-block-editor__use"
|
|
1901
1902
|
}, [
|
|
1902
|
-
|
|
1903
|
+
V("span", null, w(N.title ?? `#${N.id}`), 1),
|
|
1903
1904
|
N.published ? W("", !0) : (c(), O(n(he), {
|
|
1904
1905
|
key: 0,
|
|
1905
1906
|
type: "warning",
|
|
1906
1907
|
size: "sm"
|
|
1907
1908
|
}, {
|
|
1908
1909
|
default: g(() => [
|
|
1909
|
-
L(
|
|
1910
|
+
L(w(n(s)("page.unpublished-page")), 1)
|
|
1910
1911
|
]),
|
|
1911
1912
|
_: 1
|
|
1912
1913
|
}))
|
|
1913
1914
|
]))), 128)),
|
|
1914
|
-
|
|
1915
|
+
m.value.length > Ne.value.length ? (c(), O(n(H), {
|
|
1915
1916
|
key: 1,
|
|
1916
1917
|
size: "sm",
|
|
1917
1918
|
tone: "muted"
|
|
1918
1919
|
}, {
|
|
1919
1920
|
default: g(() => [
|
|
1920
|
-
L(
|
|
1921
|
+
L(w(n(s)("page.usage-more", { count: m.value.length - Ne.value.length })), 1)
|
|
1921
1922
|
]),
|
|
1922
1923
|
_: 1
|
|
1923
1924
|
})) : W("", !0)
|
|
1924
1925
|
])
|
|
1925
1926
|
]),
|
|
1926
1927
|
_: 1
|
|
1927
|
-
}, 8, ["title"])) : (c(), _(
|
|
1928
|
-
L(
|
|
1928
|
+
}, 8, ["title"])) : (c(), _(R, { key: 1 }, [
|
|
1929
|
+
L(w(at.value), 1)
|
|
1929
1930
|
], 64))
|
|
1930
1931
|
]),
|
|
1931
1932
|
_: 1
|
|
1932
1933
|
}, 8, ["title", "back", "back-label", "actions"]),
|
|
1933
|
-
|
|
1934
|
+
A.value.editing ? W("", !0) : (c(), O(n(Gt), {
|
|
1934
1935
|
key: 0,
|
|
1935
1936
|
type: "info",
|
|
1936
1937
|
variant: "soft",
|
|
1937
1938
|
description: n(s)("page.editing-off")
|
|
1938
1939
|
}, null, 8, ["description"])),
|
|
1939
|
-
|
|
1940
|
-
class:
|
|
1940
|
+
V("div", {
|
|
1941
|
+
class: De(["wx-block-editor__columns", { "is-alone": !st.value }])
|
|
1941
1942
|
}, [
|
|
1942
1943
|
v(n(Bl), {
|
|
1943
|
-
modelValue:
|
|
1944
|
-
"onUpdate:modelValue": k[15] || (k[15] = (N) =>
|
|
1944
|
+
modelValue: E.value,
|
|
1945
|
+
"onUpdate:modelValue": k[15] || (k[15] = (N) => E.value = N),
|
|
1945
1946
|
"keep-alive": ""
|
|
1946
1947
|
}, {
|
|
1947
1948
|
default: g(() => [
|
|
@@ -1950,46 +1951,46 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1950
1951
|
label: n(s)("page.tab-template")
|
|
1951
1952
|
}, {
|
|
1952
1953
|
default: g(() => [
|
|
1953
|
-
|
|
1954
|
-
v(n(
|
|
1954
|
+
V("div", $o, [
|
|
1955
|
+
v(n(Je), {
|
|
1955
1956
|
ref_key: "templateEditor",
|
|
1956
|
-
ref:
|
|
1957
|
+
ref: We,
|
|
1957
1958
|
modelValue: x.template,
|
|
1958
1959
|
"onUpdate:modelValue": k[1] || (k[1] = (N) => x.template = N),
|
|
1959
1960
|
language: "php",
|
|
1960
|
-
extensions:
|
|
1961
|
-
readonly:
|
|
1961
|
+
extensions: K.template,
|
|
1962
|
+
readonly: !$.value,
|
|
1962
1963
|
"min-height": "340px",
|
|
1963
1964
|
"max-height": "70vh",
|
|
1964
1965
|
"line-wrapping": ""
|
|
1965
1966
|
}, null, 8, ["modelValue", "extensions", "readonly"]),
|
|
1966
|
-
|
|
1967
|
+
$e.value.length ? (c(), _("div", So, [
|
|
1967
1968
|
v(n(H), {
|
|
1968
1969
|
size: "sm",
|
|
1969
1970
|
tone: "muted"
|
|
1970
1971
|
}, {
|
|
1971
1972
|
default: g(() => [
|
|
1972
|
-
L(
|
|
1973
|
+
L(w(n(s)("page.insert-field")), 1)
|
|
1973
1974
|
]),
|
|
1974
1975
|
_: 1
|
|
1975
1976
|
}),
|
|
1976
|
-
(c(!0), _(
|
|
1977
|
+
(c(!0), _(R, null, Y($e.value, (N) => (c(), _("button", {
|
|
1977
1978
|
key: N,
|
|
1978
1979
|
type: "button",
|
|
1979
1980
|
class: "wx-block-editor__pill",
|
|
1980
|
-
disabled:
|
|
1981
|
-
onClick: (
|
|
1982
|
-
textContent:
|
|
1981
|
+
disabled: !$.value,
|
|
1982
|
+
onClick: (qe) => B(N),
|
|
1983
|
+
textContent: w(He(N))
|
|
1983
1984
|
}, null, 8, Co))), 128))
|
|
1984
1985
|
])) : W("", !0),
|
|
1985
1986
|
v(It, {
|
|
1986
1987
|
file: "template",
|
|
1987
|
-
lints:
|
|
1988
|
-
slug:
|
|
1989
|
-
error:
|
|
1988
|
+
lints: xe.value,
|
|
1989
|
+
slug: y.slug,
|
|
1990
|
+
error: ee.value
|
|
1990
1991
|
}, null, 8, ["lints", "slug", "error"])
|
|
1991
1992
|
]),
|
|
1992
|
-
|
|
1993
|
+
ne.value ? (c(), O(n(ze), {
|
|
1993
1994
|
key: 0,
|
|
1994
1995
|
class: "wx-block-editor__call",
|
|
1995
1996
|
title: n(s)("components.call")
|
|
@@ -2000,26 +2001,26 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2000
2001
|
tone: "muted"
|
|
2001
2002
|
}, {
|
|
2002
2003
|
default: g(() => [
|
|
2003
|
-
L(
|
|
2004
|
+
L(w(n(s)("components.call-help")), 1)
|
|
2004
2005
|
]),
|
|
2005
2006
|
_: 1
|
|
2006
2007
|
}),
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2008
|
+
V("div", To, [
|
|
2009
|
+
V("pre", null, [
|
|
2010
|
+
V("code", null, w(Bt.value), 1)
|
|
2010
2011
|
]),
|
|
2011
|
-
v(n(
|
|
2012
|
+
v(n(ce), {
|
|
2012
2013
|
size: "sm",
|
|
2013
2014
|
variant: "outline",
|
|
2014
2015
|
onClick: Tl
|
|
2015
2016
|
}, {
|
|
2016
2017
|
default: g(() => [
|
|
2017
|
-
L(
|
|
2018
|
+
L(w(n(s)("components.copy")), 1)
|
|
2018
2019
|
]),
|
|
2019
2020
|
_: 1
|
|
2020
2021
|
})
|
|
2021
2022
|
]),
|
|
2022
|
-
(c(!0), _(
|
|
2023
|
+
(c(!0), _(R, null, Y(Cl.value, (N) => (c(), _("div", {
|
|
2023
2024
|
key: N.id,
|
|
2024
2025
|
class: "wx-block-editor__shape"
|
|
2025
2026
|
}, [
|
|
@@ -2028,20 +2029,20 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2028
2029
|
tone: "muted"
|
|
2029
2030
|
}, {
|
|
2030
2031
|
default: g(() => [
|
|
2031
|
-
L(
|
|
2032
|
-
N.shape ? (c(), _("code", Eo,
|
|
2032
|
+
L(w(N.fields.length ? n(s)("components.shape", { name: N.id }) : n(s)("components.shape-free", { name: N.id })) + " ", 1),
|
|
2033
|
+
N.shape ? (c(), _("code", Eo, w(N.shape), 1)) : W("", !0)
|
|
2033
2034
|
]),
|
|
2034
2035
|
_: 2
|
|
2035
2036
|
}, 1024),
|
|
2036
2037
|
N.fields.length ? (c(), _("dl", Vo, [
|
|
2037
|
-
(c(!0), _(
|
|
2038
|
-
key:
|
|
2038
|
+
(c(!0), _(R, null, Y(N.fields, (qe) => (c(), _(R, {
|
|
2039
|
+
key: qe.name
|
|
2039
2040
|
}, [
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2041
|
+
V("dt", null, [
|
|
2042
|
+
V("code", null, w(qe.name), 1),
|
|
2043
|
+
V("span", Ao, w(qe.type), 1)
|
|
2043
2044
|
]),
|
|
2044
|
-
|
|
2045
|
+
V("dd", null, w(qe.description), 1)
|
|
2045
2046
|
], 64))), 128))
|
|
2046
2047
|
])) : W("", !0)
|
|
2047
2048
|
]))), 128)),
|
|
@@ -2050,7 +2051,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2050
2051
|
tone: "muted"
|
|
2051
2052
|
}, {
|
|
2052
2053
|
default: g(() => [
|
|
2053
|
-
L(
|
|
2054
|
+
L(w(n(s)("components.site-views")), 1)
|
|
2054
2055
|
]),
|
|
2055
2056
|
_: 1
|
|
2056
2057
|
})
|
|
@@ -2065,20 +2066,20 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2065
2066
|
label: n(s)("page.tab-styles")
|
|
2066
2067
|
}, {
|
|
2067
2068
|
default: g(() => [
|
|
2068
|
-
|
|
2069
|
-
v(n(
|
|
2069
|
+
V("div", Bo, [
|
|
2070
|
+
v(n(Je), {
|
|
2070
2071
|
modelValue: x.styles,
|
|
2071
2072
|
"onUpdate:modelValue": k[2] || (k[2] = (N) => x.styles = N),
|
|
2072
2073
|
language: "css",
|
|
2073
|
-
extensions:
|
|
2074
|
-
readonly:
|
|
2074
|
+
extensions: K.styles,
|
|
2075
|
+
readonly: !$.value,
|
|
2075
2076
|
"min-height": "340px",
|
|
2076
2077
|
"max-height": "70vh"
|
|
2077
2078
|
}, null, 8, ["modelValue", "extensions", "readonly"]),
|
|
2078
2079
|
v(It, {
|
|
2079
2080
|
file: "styles",
|
|
2080
|
-
lints:
|
|
2081
|
-
slug:
|
|
2081
|
+
lints: xe.value,
|
|
2082
|
+
slug: y.slug
|
|
2082
2083
|
}, null, 8, ["lints", "slug"])
|
|
2083
2084
|
])
|
|
2084
2085
|
]),
|
|
@@ -2089,22 +2090,22 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2089
2090
|
label: n(s)("page.tab-script")
|
|
2090
2091
|
}, {
|
|
2091
2092
|
default: g(() => [
|
|
2092
|
-
|
|
2093
|
-
v(n(
|
|
2093
|
+
V("div", Lo, [
|
|
2094
|
+
v(n(Je), {
|
|
2094
2095
|
"model-value": x.script ?? "",
|
|
2095
2096
|
language: "javascript",
|
|
2096
|
-
readonly:
|
|
2097
|
+
readonly: !$.value,
|
|
2097
2098
|
"min-height": "340px",
|
|
2098
2099
|
"max-height": "70vh",
|
|
2099
2100
|
"onUpdate:modelValue": k[3] || (k[3] = (N) => x.script = N || null)
|
|
2100
2101
|
}, null, 8, ["model-value", "readonly"]),
|
|
2101
|
-
|
|
2102
|
+
V("div", Wo, [
|
|
2102
2103
|
v(n(H), {
|
|
2103
2104
|
size: "sm",
|
|
2104
2105
|
tone: "muted"
|
|
2105
2106
|
}, {
|
|
2106
2107
|
default: g(() => [
|
|
2107
|
-
L(
|
|
2108
|
+
L(w(n(s)("page.script-help")), 1)
|
|
2108
2109
|
]),
|
|
2109
2110
|
_: 1
|
|
2110
2111
|
}),
|
|
@@ -2113,18 +2114,18 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2113
2114
|
tone: "muted"
|
|
2114
2115
|
}, {
|
|
2115
2116
|
default: g(() => [
|
|
2116
|
-
L(
|
|
2117
|
+
L(w(A.value.provides.length ? n(s)("page.provides", { names: A.value.provides.join(", ") }) : n(s)("page.provides-none")), 1)
|
|
2117
2118
|
]),
|
|
2118
2119
|
_: 1
|
|
2119
2120
|
})
|
|
2120
2121
|
])
|
|
2121
2122
|
]),
|
|
2122
|
-
v(n(
|
|
2123
|
+
v(n(ze), {
|
|
2123
2124
|
class: "wx-block-editor__examples",
|
|
2124
2125
|
title: n(s)("page.examples")
|
|
2125
2126
|
}, {
|
|
2126
2127
|
default: g(() => [
|
|
2127
|
-
(c(!0), _(
|
|
2128
|
+
(c(!0), _(R, null, Y(mt.value, (N) => (c(), _("div", {
|
|
2128
2129
|
key: N.title,
|
|
2129
2130
|
class: "wx-block-editor__example"
|
|
2130
2131
|
}, [
|
|
@@ -2133,12 +2134,12 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2133
2134
|
tone: "muted"
|
|
2134
2135
|
}, {
|
|
2135
2136
|
default: g(() => [
|
|
2136
|
-
L(
|
|
2137
|
+
L(w(N.title), 1)
|
|
2137
2138
|
]),
|
|
2138
2139
|
_: 2
|
|
2139
2140
|
}, 1024),
|
|
2140
|
-
|
|
2141
|
-
|
|
2141
|
+
V("pre", null, [
|
|
2142
|
+
V("code", null, w(N.code), 1)
|
|
2142
2143
|
])
|
|
2143
2144
|
]))), 128))
|
|
2144
2145
|
]),
|
|
@@ -2149,29 +2150,29 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2149
2150
|
}, 8, ["label"]),
|
|
2150
2151
|
v(n(Pe), {
|
|
2151
2152
|
value: "fields",
|
|
2152
|
-
label:
|
|
2153
|
+
label: ne.value ? n(s)("components.tab-inputs") : n(s)("page.tab-fields")
|
|
2153
2154
|
}, {
|
|
2154
2155
|
default: g(() => [
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
v(n(
|
|
2158
|
-
"model-value":
|
|
2156
|
+
V("div", No, [
|
|
2157
|
+
V("div", zo, [
|
|
2158
|
+
v(n(Je), {
|
|
2159
|
+
"model-value": U.value,
|
|
2159
2160
|
language: "json",
|
|
2160
|
-
extensions:
|
|
2161
|
+
extensions: K.schema,
|
|
2161
2162
|
lint: "",
|
|
2162
|
-
readonly:
|
|
2163
|
+
readonly: !$.value,
|
|
2163
2164
|
"min-height": "340px",
|
|
2164
2165
|
"max-height": "70vh",
|
|
2165
2166
|
"onUpdate:modelValue": q
|
|
2166
2167
|
}, null, 8, ["model-value", "extensions", "readonly"]),
|
|
2167
|
-
|
|
2168
|
+
V("div", Mo, [
|
|
2168
2169
|
Z.value ? (c(), O(n(H), {
|
|
2169
2170
|
key: 0,
|
|
2170
2171
|
size: "sm",
|
|
2171
2172
|
tone: "danger"
|
|
2172
2173
|
}, {
|
|
2173
2174
|
default: g(() => [
|
|
2174
|
-
L(
|
|
2175
|
+
L(w(Z.value), 1)
|
|
2175
2176
|
]),
|
|
2176
2177
|
_: 1
|
|
2177
2178
|
})) : fe("content.schema") ? (c(), O(n(H), {
|
|
@@ -2180,7 +2181,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2180
2181
|
tone: "danger"
|
|
2181
2182
|
}, {
|
|
2182
2183
|
default: g(() => [
|
|
2183
|
-
L(
|
|
2184
|
+
L(w(fe("content.schema")), 1)
|
|
2184
2185
|
]),
|
|
2185
2186
|
_: 1
|
|
2186
2187
|
})) : (c(), O(n(H), {
|
|
@@ -2189,7 +2190,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2189
2190
|
tone: "muted"
|
|
2190
2191
|
}, {
|
|
2191
2192
|
default: g(() => [
|
|
2192
|
-
L(
|
|
2193
|
+
L(w(ne.value ? n(s)("components.inputs-help") : n(s)("page.fields-help")), 1)
|
|
2193
2194
|
]),
|
|
2194
2195
|
_: 1
|
|
2195
2196
|
})),
|
|
@@ -2199,20 +2200,20 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2199
2200
|
}, null, 8, ["title", "body"])
|
|
2200
2201
|
])
|
|
2201
2202
|
]),
|
|
2202
|
-
v(n(
|
|
2203
|
+
v(n(ze), {
|
|
2203
2204
|
class: "wx-block-editor__sample",
|
|
2204
2205
|
title: n(s)("page.sample")
|
|
2205
2206
|
}, {
|
|
2206
2207
|
default: g(() => [
|
|
2207
2208
|
x.schema.length ? (c(), O(n(al), {
|
|
2208
2209
|
key: 0,
|
|
2209
|
-
modelValue:
|
|
2210
|
-
"onUpdate:modelValue": k[4] || (k[4] = (N) =>
|
|
2211
|
-
root: n(
|
|
2212
|
-
types: n(
|
|
2213
|
-
translate: n(
|
|
2214
|
-
can: n(
|
|
2215
|
-
disabled:
|
|
2210
|
+
modelValue: _e.value,
|
|
2211
|
+
"onUpdate:modelValue": k[4] || (k[4] = (N) => _e.value = N),
|
|
2212
|
+
root: n(Et)(x.schema),
|
|
2213
|
+
types: n(t).types,
|
|
2214
|
+
translate: n(t).i18n.t,
|
|
2215
|
+
can: n(t).can,
|
|
2216
|
+
disabled: !$.value,
|
|
2216
2217
|
size: "sm"
|
|
2217
2218
|
}, null, 8, ["modelValue", "root", "types", "translate", "can", "disabled"])) : W("", !0)
|
|
2218
2219
|
]),
|
|
@@ -2227,184 +2228,184 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2227
2228
|
label: n(s)("page.tab-settings")
|
|
2228
2229
|
}, {
|
|
2229
2230
|
default: g(() => [
|
|
2230
|
-
v(n(
|
|
2231
|
+
v(n(ze), { class: "wx-block-editor__sheet" }, {
|
|
2231
2232
|
default: g(() => [
|
|
2232
|
-
|
|
2233
|
-
v(n(
|
|
2233
|
+
V("div", Oo, [
|
|
2234
|
+
v(n(oe), {
|
|
2234
2235
|
label: n(s)("components.kind"),
|
|
2235
2236
|
help: n(s)("components.kind-help"),
|
|
2236
2237
|
error: fe("kind"),
|
|
2237
|
-
disabled:
|
|
2238
|
+
disabled: !$.value
|
|
2238
2239
|
}, {
|
|
2239
2240
|
default: g(() => [
|
|
2240
|
-
v(n(
|
|
2241
|
-
modelValue:
|
|
2242
|
-
"onUpdate:modelValue": k[5] || (k[5] = (N) =>
|
|
2241
|
+
v(n(wt), {
|
|
2242
|
+
modelValue: y.kind,
|
|
2243
|
+
"onUpdate:modelValue": k[5] || (k[5] = (N) => y.kind = N),
|
|
2243
2244
|
options: El.value
|
|
2244
2245
|
}, null, 8, ["modelValue", "options"])
|
|
2245
2246
|
]),
|
|
2246
2247
|
_: 1
|
|
2247
2248
|
}, 8, ["label", "help", "error", "disabled"]),
|
|
2248
|
-
v(n(
|
|
2249
|
+
v(n(oe), {
|
|
2249
2250
|
label: n(s)("page.identifier"),
|
|
2250
2251
|
help: n(s)("page.identifier-help"),
|
|
2251
2252
|
error: fe("slug"),
|
|
2252
|
-
disabled:
|
|
2253
|
+
disabled: !$.value
|
|
2253
2254
|
}, {
|
|
2254
2255
|
default: g(() => [
|
|
2255
|
-
v(n(
|
|
2256
|
-
modelValue:
|
|
2257
|
-
"onUpdate:modelValue": k[6] || (k[6] = (N) =>
|
|
2256
|
+
v(n(Xe), {
|
|
2257
|
+
modelValue: y.slug,
|
|
2258
|
+
"onUpdate:modelValue": k[6] || (k[6] = (N) => y.slug = N)
|
|
2258
2259
|
}, null, 8, ["modelValue"])
|
|
2259
2260
|
]),
|
|
2260
2261
|
_: 1
|
|
2261
2262
|
}, 8, ["label", "help", "error", "disabled"]),
|
|
2262
|
-
|
|
2263
|
+
ne.value ? W("", !0) : (c(), O(n(oe), {
|
|
2263
2264
|
key: 0,
|
|
2264
2265
|
label: n(s)("page.group"),
|
|
2265
2266
|
help: n(s)("page.group-help"),
|
|
2266
2267
|
error: fe("group"),
|
|
2267
|
-
disabled:
|
|
2268
|
+
disabled: !$.value
|
|
2268
2269
|
}, {
|
|
2269
2270
|
default: g(() => [
|
|
2270
|
-
v(n(
|
|
2271
|
-
modelValue:
|
|
2272
|
-
"onUpdate:modelValue": k[7] || (k[7] = (N) =>
|
|
2271
|
+
v(n(wt), {
|
|
2272
|
+
modelValue: y.group,
|
|
2273
|
+
"onUpdate:modelValue": k[7] || (k[7] = (N) => y.group = N),
|
|
2273
2274
|
options: Ee.value
|
|
2274
2275
|
}, null, 8, ["modelValue", "options"])
|
|
2275
2276
|
]),
|
|
2276
2277
|
_: 1
|
|
2277
2278
|
}, 8, ["label", "help", "error", "disabled"])),
|
|
2278
|
-
v(n(
|
|
2279
|
+
v(n(oe), {
|
|
2279
2280
|
class: "is-wide",
|
|
2280
2281
|
label: n(s)("page.description"),
|
|
2281
2282
|
help: n(s)("page.description-help"),
|
|
2282
2283
|
error: fe("description"),
|
|
2283
|
-
disabled:
|
|
2284
|
+
disabled: !$.value
|
|
2284
2285
|
}, {
|
|
2285
2286
|
default: g(() => [
|
|
2286
2287
|
v(n(Zt), {
|
|
2287
|
-
"model-value":
|
|
2288
|
+
"model-value": y.description ?? "",
|
|
2288
2289
|
rows: 2,
|
|
2289
|
-
"onUpdate:modelValue": k[8] || (k[8] = (N) =>
|
|
2290
|
+
"onUpdate:modelValue": k[8] || (k[8] = (N) => y.description = String(N ?? ""))
|
|
2290
2291
|
}, null, 8, ["model-value"])
|
|
2291
2292
|
]),
|
|
2292
2293
|
_: 1
|
|
2293
2294
|
}, 8, ["label", "help", "error", "disabled"]),
|
|
2294
|
-
v(n(
|
|
2295
|
+
v(n(oe), {
|
|
2295
2296
|
label: n(s)("page.icon"),
|
|
2296
2297
|
error: fe("icon"),
|
|
2297
|
-
disabled:
|
|
2298
|
+
disabled: !$.value
|
|
2298
2299
|
}, {
|
|
2299
2300
|
default: g(() => [
|
|
2300
2301
|
v(n(Ll), {
|
|
2301
|
-
"model-value":
|
|
2302
|
+
"model-value": y.icon,
|
|
2302
2303
|
clearable: "",
|
|
2303
2304
|
placeholder: n(s)("page.icon-search"),
|
|
2304
2305
|
"empty-text": n(s)("page.icon-none"),
|
|
2305
2306
|
"unknown-text": n(s)("page.icon-unknown"),
|
|
2306
2307
|
"clear-label": n(s)("page.icon-clear"),
|
|
2307
|
-
"onUpdate:modelValue": k[9] || (k[9] = (N) =>
|
|
2308
|
+
"onUpdate:modelValue": k[9] || (k[9] = (N) => y.icon = N)
|
|
2308
2309
|
}, null, 8, ["model-value", "placeholder", "empty-text", "unknown-text", "clear-label"])
|
|
2309
2310
|
]),
|
|
2310
2311
|
_: 1
|
|
2311
2312
|
}, 8, ["label", "error", "disabled"]),
|
|
2312
|
-
v(n(
|
|
2313
|
+
v(n(oe), {
|
|
2313
2314
|
label: n(s)("page.sort"),
|
|
2314
2315
|
help: n(s)("page.sort-help"),
|
|
2315
2316
|
error: fe("sort"),
|
|
2316
|
-
disabled:
|
|
2317
|
+
disabled: !$.value
|
|
2317
2318
|
}, {
|
|
2318
2319
|
default: g(() => [
|
|
2319
2320
|
v(n(Wt), {
|
|
2320
|
-
modelValue:
|
|
2321
|
-
"onUpdate:modelValue": k[10] || (k[10] = (N) =>
|
|
2321
|
+
modelValue: y.sort,
|
|
2322
|
+
"onUpdate:modelValue": k[10] || (k[10] = (N) => y.sort = N)
|
|
2322
2323
|
}, null, 8, ["modelValue"])
|
|
2323
2324
|
]),
|
|
2324
2325
|
_: 1
|
|
2325
2326
|
}, 8, ["label", "help", "error", "disabled"]),
|
|
2326
|
-
|
|
2327
|
+
ne.value ? W("", !0) : (c(), O(n(oe), {
|
|
2327
2328
|
key: 1,
|
|
2328
2329
|
label: n(s)("page.allow"),
|
|
2329
2330
|
help: n(s)("page.allow-help"),
|
|
2330
2331
|
error: fe("allow"),
|
|
2331
|
-
disabled:
|
|
2332
|
+
disabled: !$.value
|
|
2332
2333
|
}, {
|
|
2333
2334
|
default: g(() => [
|
|
2334
2335
|
v(n(Nt), {
|
|
2335
|
-
modelValue:
|
|
2336
|
-
"onUpdate:modelValue": k[11] || (k[11] = (N) =>
|
|
2336
|
+
modelValue: y.allow,
|
|
2337
|
+
"onUpdate:modelValue": k[11] || (k[11] = (N) => y.allow = N),
|
|
2337
2338
|
"allow-create": ""
|
|
2338
2339
|
}, null, 8, ["modelValue"])
|
|
2339
2340
|
]),
|
|
2340
2341
|
_: 1
|
|
2341
2342
|
}, 8, ["label", "help", "error", "disabled"])),
|
|
2342
|
-
|
|
2343
|
+
ne.value ? W("", !0) : (c(), O(n(oe), {
|
|
2343
2344
|
key: 2,
|
|
2344
2345
|
label: n(s)("page.allowed-in"),
|
|
2345
2346
|
help: n(s)("page.allowed-in-help"),
|
|
2346
2347
|
error: fe("allowed_in"),
|
|
2347
|
-
disabled:
|
|
2348
|
+
disabled: !$.value
|
|
2348
2349
|
}, {
|
|
2349
2350
|
default: g(() => [
|
|
2350
2351
|
v(n(Nt), {
|
|
2351
|
-
modelValue:
|
|
2352
|
-
"onUpdate:modelValue": k[12] || (k[12] = (N) =>
|
|
2352
|
+
modelValue: y.allowed_in,
|
|
2353
|
+
"onUpdate:modelValue": k[12] || (k[12] = (N) => y.allowed_in = N),
|
|
2353
2354
|
"allow-create": "",
|
|
2354
2355
|
suggestions: ["root"]
|
|
2355
2356
|
}, null, 8, ["modelValue"])
|
|
2356
2357
|
]),
|
|
2357
2358
|
_: 1
|
|
2358
2359
|
}, 8, ["label", "help", "error", "disabled"])),
|
|
2359
|
-
|
|
2360
|
+
ne.value ? W("", !0) : (c(), O(n(oe), {
|
|
2360
2361
|
key: 3,
|
|
2361
2362
|
label: n(s)("page.max-per-entity"),
|
|
2362
2363
|
help: n(s)("page.max-per-entity-help"),
|
|
2363
2364
|
error: fe("max_per_entity"),
|
|
2364
|
-
disabled:
|
|
2365
|
+
disabled: !$.value
|
|
2365
2366
|
}, {
|
|
2366
2367
|
default: g(() => [
|
|
2367
2368
|
v(n(Wt), {
|
|
2368
|
-
"model-value":
|
|
2369
|
+
"model-value": y.max_per_entity ?? void 0,
|
|
2369
2370
|
min: 1,
|
|
2370
|
-
"onUpdate:modelValue": k[13] || (k[13] = (N) =>
|
|
2371
|
+
"onUpdate:modelValue": k[13] || (k[13] = (N) => y.max_per_entity = N ?? null)
|
|
2371
2372
|
}, null, 8, ["model-value"])
|
|
2372
2373
|
]),
|
|
2373
2374
|
_: 1
|
|
2374
2375
|
}, 8, ["label", "help", "error", "disabled"])),
|
|
2375
|
-
|
|
2376
|
+
ne.value ? W("", !0) : (c(), O(n(oe), {
|
|
2376
2377
|
key: 4,
|
|
2377
2378
|
label: n(s)("page.enabled"),
|
|
2378
2379
|
help: n(s)("page.enabled-help"),
|
|
2379
|
-
disabled:
|
|
2380
|
+
disabled: !$.value
|
|
2380
2381
|
}, {
|
|
2381
2382
|
default: g(() => [
|
|
2382
2383
|
v(n(Wl), {
|
|
2383
|
-
modelValue:
|
|
2384
|
-
"onUpdate:modelValue": k[14] || (k[14] = (N) =>
|
|
2384
|
+
modelValue: y.is_enabled,
|
|
2385
|
+
"onUpdate:modelValue": k[14] || (k[14] = (N) => y.is_enabled = N)
|
|
2385
2386
|
}, null, 8, ["modelValue"])
|
|
2386
2387
|
]),
|
|
2387
2388
|
_: 1
|
|
2388
2389
|
}, 8, ["label", "help", "disabled"])),
|
|
2389
|
-
|
|
2390
|
-
v(n(
|
|
2390
|
+
$.value ? (c(), _("div", Do, [
|
|
2391
|
+
v(n(ce), {
|
|
2391
2392
|
type: "danger",
|
|
2392
2393
|
variant: "outline",
|
|
2393
|
-
disabled:
|
|
2394
|
-
onClick:
|
|
2394
|
+
disabled: ht.value !== null,
|
|
2395
|
+
onClick: Se
|
|
2395
2396
|
}, {
|
|
2396
2397
|
default: g(() => [
|
|
2397
|
-
L(
|
|
2398
|
+
L(w(r.value.declared ? n(s)("components.delete-declared") : n(s)("page.delete")), 1)
|
|
2398
2399
|
]),
|
|
2399
2400
|
_: 1
|
|
2400
2401
|
}, 8, ["disabled"]),
|
|
2401
|
-
|
|
2402
|
+
ht.value ? (c(), O(n(H), {
|
|
2402
2403
|
key: 0,
|
|
2403
2404
|
size: "sm",
|
|
2404
2405
|
tone: "muted"
|
|
2405
2406
|
}, {
|
|
2406
2407
|
default: g(() => [
|
|
2407
|
-
L(
|
|
2408
|
+
L(w(ht.value), 1)
|
|
2408
2409
|
]),
|
|
2409
2410
|
_: 1
|
|
2410
2411
|
})) : W("", !0)
|
|
@@ -2421,15 +2422,15 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2421
2422
|
label: n(s)("page.tab-history")
|
|
2422
2423
|
}, {
|
|
2423
2424
|
default: g(() => [
|
|
2424
|
-
v(n(
|
|
2425
|
+
v(n(ze), {
|
|
2425
2426
|
class: "wx-block-editor__sheet",
|
|
2426
2427
|
padding: "none"
|
|
2427
2428
|
}, {
|
|
2428
2429
|
default: g(() => [
|
|
2429
2430
|
v(vn, {
|
|
2430
2431
|
block: r.value,
|
|
2431
|
-
"can-manage":
|
|
2432
|
-
onRestored:
|
|
2432
|
+
"can-manage": $.value,
|
|
2433
|
+
onRestored: T
|
|
2433
2434
|
}, null, 8, ["block", "can-manage"])
|
|
2434
2435
|
]),
|
|
2435
2436
|
_: 1
|
|
@@ -2449,29 +2450,29 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2449
2450
|
stage: P.stage,
|
|
2450
2451
|
loading: P.loading
|
|
2451
2452
|
}, null, 8, ["html", "styles", "script", "runtime", "stage", "loading"]), [
|
|
2452
|
-
[Pl,
|
|
2453
|
+
[Pl, st.value]
|
|
2453
2454
|
])
|
|
2454
2455
|
], 2),
|
|
2455
|
-
|
|
2456
|
+
$.value ? (c(), O(n(Nl), { key: 1 }, {
|
|
2456
2457
|
default: g(() => [
|
|
2457
|
-
v(n(
|
|
2458
|
+
v(n(ce), {
|
|
2458
2459
|
variant: "outline",
|
|
2459
|
-
loading:
|
|
2460
|
+
loading: p.value,
|
|
2460
2461
|
onClick: D
|
|
2461
2462
|
}, {
|
|
2462
2463
|
default: g(() => [
|
|
2463
|
-
L(
|
|
2464
|
+
L(w(n(s)("page.save")), 1)
|
|
2464
2465
|
]),
|
|
2465
2466
|
_: 1
|
|
2466
2467
|
}, 8, ["loading"]),
|
|
2467
|
-
v(n(
|
|
2468
|
+
v(n(ce), {
|
|
2468
2469
|
type: "primary",
|
|
2469
2470
|
loading: h.value,
|
|
2470
2471
|
disabled: !r.value.draft && !X.value,
|
|
2471
2472
|
onClick: j
|
|
2472
2473
|
}, {
|
|
2473
2474
|
default: g(() => [
|
|
2474
|
-
L(
|
|
2475
|
+
L(w(n(s)("page.publish")), 1)
|
|
2475
2476
|
]),
|
|
2476
2477
|
_: 1
|
|
2477
2478
|
}, 8, ["loading", "disabled"])
|
|
@@ -2482,27 +2483,27 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2482
2483
|
]);
|
|
2483
2484
|
};
|
|
2484
2485
|
}
|
|
2485
|
-
}), Po = /* @__PURE__ */
|
|
2486
|
+
}), Po = /* @__PURE__ */ ie(Io, [["__scopeId", "data-v-68672c91"]]), qt = /* @__PURE__ */ new Map();
|
|
2486
2487
|
function Uo(e) {
|
|
2487
|
-
let
|
|
2488
|
-
return
|
|
2488
|
+
let l = qt.get(e);
|
|
2489
|
+
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 : wn(t, e)).catch(() => null), qt.set(e, l)), l;
|
|
2489
2490
|
}
|
|
2490
2491
|
function Ro() {
|
|
2491
|
-
const e =
|
|
2492
|
+
const e = Ge(ol, null), l = I(null), t = S(() => {
|
|
2492
2493
|
const a = e?.state.manifest?.modules.find((i) => i.id === "blocks")?.meta?.stage;
|
|
2493
2494
|
return typeof a == "string" && a !== "" ? a : null;
|
|
2494
2495
|
});
|
|
2495
2496
|
return Ul(() => {
|
|
2496
|
-
const o =
|
|
2497
|
+
const o = t.value;
|
|
2497
2498
|
o !== null && Uo(o).then((a) => {
|
|
2498
|
-
|
|
2499
|
+
t.value === o && (l.value = a);
|
|
2499
2500
|
});
|
|
2500
|
-
}),
|
|
2501
|
+
}), l;
|
|
2501
2502
|
}
|
|
2502
2503
|
const jo = ["srcdoc"], Fo = {
|
|
2503
2504
|
key: 1,
|
|
2504
2505
|
class: "wx-block-thumb__empty"
|
|
2505
|
-
},
|
|
2506
|
+
}, yt = 1600, Ho = /* @__PURE__ */ ae({
|
|
2506
2507
|
__name: "BlockThumb",
|
|
2507
2508
|
props: {
|
|
2508
2509
|
thumbnail: {},
|
|
@@ -2511,74 +2512,74 @@ const jo = ["srcdoc"], Fo = {
|
|
|
2511
2512
|
fit: { type: Boolean, default: !1 }
|
|
2512
2513
|
},
|
|
2513
2514
|
setup(e) {
|
|
2514
|
-
const
|
|
2515
|
-
const
|
|
2516
|
-
if (!
|
|
2515
|
+
const l = e, t = I(null), o = pt(t), a = I(null), i = S(() => o.value > 0 ? o.value / l.width : 0.2), s = S(() => {
|
|
2516
|
+
const p = a.value;
|
|
2517
|
+
if (!l.fit || !p || p.width <= 0 || p.height <= 0 || o.value <= 0)
|
|
2517
2518
|
return null;
|
|
2518
|
-
const h = Math.min(i.value, o.value /
|
|
2519
|
+
const h = Math.min(i.value, o.value / p.width, l.height / p.height);
|
|
2519
2520
|
return {
|
|
2520
2521
|
scale: h,
|
|
2521
|
-
x: (o.value -
|
|
2522
|
-
y: (
|
|
2522
|
+
x: (o.value - p.width * h) / 2 - p.left * h,
|
|
2523
|
+
y: (l.height - p.height * h) / 2 - p.top * h
|
|
2523
2524
|
};
|
|
2524
|
-
}), u = Ro(),
|
|
2525
|
-
if (!
|
|
2526
|
-
const
|
|
2527
|
-
return u.value ? xn(u.value,
|
|
2525
|
+
}), u = Ro(), f = S(() => {
|
|
2526
|
+
if (!l.thumbnail) return "";
|
|
2527
|
+
const p = { html: l.thumbnail.html, styles: l.thumbnail.styles };
|
|
2528
|
+
return u.value ? xn(u.value, p) : ul(p);
|
|
2528
2529
|
}), r = S(() => {
|
|
2529
|
-
const
|
|
2530
|
-
return
|
|
2531
|
-
width: `${
|
|
2532
|
-
height: `${
|
|
2533
|
-
transform: `translate(${
|
|
2530
|
+
const p = s.value, h = a.value;
|
|
2531
|
+
return p && h ? {
|
|
2532
|
+
width: `${l.width}px`,
|
|
2533
|
+
height: `${yt}px`,
|
|
2534
|
+
transform: `translate(${p.x}px, ${p.y}px) scale(${p.scale})`,
|
|
2534
2535
|
// The component alone: the rest of the frame is a white page around it, and moved off
|
|
2535
2536
|
// the corner it shows as a white slab beside a small badge.
|
|
2536
|
-
clipPath: `inset(${h.top}px ${
|
|
2537
|
+
clipPath: `inset(${h.top}px ${l.width - h.left - h.width}px ${yt - h.top - h.height}px ${h.left}px)`
|
|
2537
2538
|
} : {
|
|
2538
|
-
width: `${
|
|
2539
|
-
height:
|
|
2539
|
+
width: `${l.width}px`,
|
|
2540
|
+
height: l.fit ? `${yt}px` : `${Math.round(l.height / i.value)}px`,
|
|
2540
2541
|
transform: `scale(${i.value})`,
|
|
2541
2542
|
// Until it is measured, a fitted frame would flash its top at the wrong scale; measured and
|
|
2542
2543
|
// found to have no size (a root with `display: contents`), it is drawn the ordinary way.
|
|
2543
|
-
visibility:
|
|
2544
|
+
visibility: l.fit && a.value === null ? "hidden" : void 0
|
|
2544
2545
|
};
|
|
2545
2546
|
});
|
|
2546
|
-
let
|
|
2547
|
-
function
|
|
2548
|
-
if (!
|
|
2549
|
-
|
|
2550
|
-
const h =
|
|
2551
|
-
if (
|
|
2552
|
-
const
|
|
2553
|
-
const x =
|
|
2547
|
+
let m = null;
|
|
2548
|
+
function d(p) {
|
|
2549
|
+
if (!l.fit) return;
|
|
2550
|
+
m?.disconnect();
|
|
2551
|
+
const h = p.target, E = h.contentWindow, A = h.contentDocument;
|
|
2552
|
+
if (!E || !A?.body) return;
|
|
2553
|
+
const $ = A.querySelector("[data-wx-block]") ?? A.body, y = () => {
|
|
2554
|
+
const x = $.getBoundingClientRect();
|
|
2554
2555
|
a.value = { left: x.left, top: x.top, width: x.width, height: x.height };
|
|
2555
2556
|
};
|
|
2556
|
-
|
|
2557
|
+
y(), m = new E.ResizeObserver(y), m.observe($);
|
|
2557
2558
|
}
|
|
2558
|
-
return
|
|
2559
|
+
return tt(() => m?.disconnect()), (p, h) => (c(), _("div", {
|
|
2559
2560
|
ref_key: "box",
|
|
2560
|
-
ref:
|
|
2561
|
+
ref: t,
|
|
2561
2562
|
class: "wx-block-thumb",
|
|
2562
|
-
style:
|
|
2563
|
+
style: Oe({ height: `${e.height}px` })
|
|
2563
2564
|
}, [
|
|
2564
2565
|
e.thumbnail ? (c(), _("iframe", {
|
|
2565
2566
|
key: 0,
|
|
2566
2567
|
class: "wx-block-thumb__frame",
|
|
2567
|
-
srcdoc:
|
|
2568
|
-
style:
|
|
2568
|
+
srcdoc: f.value,
|
|
2569
|
+
style: Oe(r.value),
|
|
2569
2570
|
sandbox: "allow-same-origin",
|
|
2570
2571
|
tabindex: "-1",
|
|
2571
2572
|
"aria-hidden": "true",
|
|
2572
|
-
onLoad:
|
|
2573
|
+
onLoad: d
|
|
2573
2574
|
}, null, 44, jo)) : (c(), _("div", Fo, [
|
|
2574
|
-
v(n(
|
|
2575
|
+
v(n(we), { name: "grid" })
|
|
2575
2576
|
]))
|
|
2576
2577
|
], 4));
|
|
2577
2578
|
}
|
|
2578
|
-
}), $l = /* @__PURE__ */
|
|
2579
|
+
}), $l = /* @__PURE__ */ ie(Ho, [["__scopeId", "data-v-7421ce33"]]), qo = { class: "wx-block-picker" }, Ko = {
|
|
2579
2580
|
key: 0,
|
|
2580
2581
|
class: "wx-block-picker__group-title"
|
|
2581
|
-
},
|
|
2582
|
+
}, Jo = { class: "wx-block-picker__cards" }, Yo = ["disabled", "title", "onClick"], Go = { class: "wx-block-picker__body" }, Zo = { class: "wx-block-picker__title" }, Qo = /* @__PURE__ */ ae({
|
|
2582
2583
|
__name: "BlockPicker",
|
|
2583
2584
|
props: {
|
|
2584
2585
|
catalog: {},
|
|
@@ -2589,72 +2590,72 @@ const jo = ["srcdoc"], Fo = {
|
|
|
2589
2590
|
blocksPath: { default: null }
|
|
2590
2591
|
},
|
|
2591
2592
|
setup(e) {
|
|
2592
|
-
const
|
|
2593
|
-
|
|
2594
|
-
const i =
|
|
2595
|
-
function u(
|
|
2596
|
-
if (
|
|
2597
|
-
return
|
|
2598
|
-
const h =
|
|
2599
|
-
return h &&
|
|
2600
|
-
}
|
|
2601
|
-
const
|
|
2602
|
-
() =>
|
|
2603
|
-
(
|
|
2604
|
-
).map((
|
|
2605
|
-
const h = An(
|
|
2606
|
-
return { type:
|
|
2593
|
+
const l = e, { resolve: t, dismiss: o, open: a } = Qt();
|
|
2594
|
+
Ie();
|
|
2595
|
+
const i = de("webx-blocks"), s = I("");
|
|
2596
|
+
function u(p) {
|
|
2597
|
+
if (l.parent === null)
|
|
2598
|
+
return p.allowed_in === null || p.allowed_in.includes("root");
|
|
2599
|
+
const h = l.allow ? l.allow.includes(p.slug) : l.parent.allow?.includes(p.slug) === !0, E = p.allowed_in === null || p.allowed_in.includes(l.parent.slug);
|
|
2600
|
+
return h && E;
|
|
2601
|
+
}
|
|
2602
|
+
const f = S(
|
|
2603
|
+
() => l.catalog.filter(
|
|
2604
|
+
(p) => ye(p) !== "component" && p.is_enabled && p.published !== null && u(p)
|
|
2605
|
+
).map((p) => {
|
|
2606
|
+
const h = An(l.tree, p.slug), E = p.max_per_entity !== null && h >= p.max_per_entity;
|
|
2607
|
+
return { type: p, reason: E ? i("field.limit-reached", { count: h }) : null };
|
|
2607
2608
|
})
|
|
2608
2609
|
), r = S(() => {
|
|
2609
|
-
const
|
|
2610
|
-
return
|
|
2611
|
-
({ type: h }) => h.title.toLowerCase().includes(
|
|
2610
|
+
const p = s.value.trim().toLowerCase();
|
|
2611
|
+
return p === "" ? f.value : f.value.filter(
|
|
2612
|
+
({ type: h }) => h.title.toLowerCase().includes(p) || h.slug.includes(p) || (h.description ?? "").toLowerCase().includes(p)
|
|
2612
2613
|
);
|
|
2613
|
-
}),
|
|
2614
|
-
const
|
|
2615
|
-
for (const { type:
|
|
2616
|
-
|
|
2617
|
-
const h =
|
|
2618
|
-
id:
|
|
2619
|
-
label: je(
|
|
2620
|
-
options: r.value.filter((
|
|
2621
|
-
})).filter((
|
|
2614
|
+
}), m = S(() => {
|
|
2615
|
+
const p = [...l.groups];
|
|
2616
|
+
for (const { type: A } of r.value)
|
|
2617
|
+
p.includes(A.group) || p.push(A.group);
|
|
2618
|
+
const h = p.map((A) => ({
|
|
2619
|
+
id: A,
|
|
2620
|
+
label: je(A, i),
|
|
2621
|
+
options: r.value.filter(($) => $.type.group === A)
|
|
2622
|
+
})).filter((A) => A.options.length > 0);
|
|
2622
2623
|
return r.value.length <= 5 || s.value.trim() !== "" || h.length < 2 ? [{ id: "", label: "", options: r.value }] : h;
|
|
2623
|
-
}),
|
|
2624
|
-
if (
|
|
2625
|
-
if (
|
|
2626
|
-
const
|
|
2627
|
-
(h) =>
|
|
2624
|
+
}), d = S(() => {
|
|
2625
|
+
if (l.catalog.length === 0) return i("field.pick-none");
|
|
2626
|
+
if (f.value.length === 0 && l.parent) {
|
|
2627
|
+
const p = (l.allow ?? l.parent.allow ?? []).filter(
|
|
2628
|
+
(h) => l.catalog.some((E) => E.slug === h)
|
|
2628
2629
|
);
|
|
2629
|
-
return
|
|
2630
|
+
return p.length === 0 ? i("field.pick-nothing-allowed", { parent: l.parent.title }) : i("field.pick-limited", { parent: l.parent.title, types: p.join(", ") });
|
|
2630
2631
|
}
|
|
2631
2632
|
return i("field.pick-empty");
|
|
2632
2633
|
});
|
|
2633
|
-
return (
|
|
2634
|
-
const
|
|
2634
|
+
return (p, h) => {
|
|
2635
|
+
const E = St("router-link");
|
|
2635
2636
|
return c(), O(n(Xt), {
|
|
2636
2637
|
open: n(a),
|
|
2637
|
-
"onUpdate:open": h[2] || (h[2] = (
|
|
2638
|
+
"onUpdate:open": h[2] || (h[2] = (A) => ll(a) ? a.value = A : null),
|
|
2638
2639
|
title: n(i)("field.pick"),
|
|
2639
2640
|
width: 860
|
|
2640
2641
|
}, {
|
|
2641
2642
|
footer: g(() => [
|
|
2642
|
-
v(n(
|
|
2643
|
+
v(n(ce), {
|
|
2643
2644
|
variant: "outline",
|
|
2644
|
-
onClick: h[1] || (h[1] = (
|
|
2645
|
+
onClick: h[1] || (h[1] = (A) => n(o)())
|
|
2645
2646
|
}, {
|
|
2646
2647
|
default: g(() => [
|
|
2647
|
-
L(
|
|
2648
|
+
L(w(n(i)("field.close")), 1)
|
|
2648
2649
|
]),
|
|
2649
2650
|
_: 1
|
|
2650
2651
|
})
|
|
2651
2652
|
]),
|
|
2652
2653
|
default: g(() => [
|
|
2653
|
-
|
|
2654
|
-
|
|
2654
|
+
V("div", qo, [
|
|
2655
|
+
f.value.length > 0 ? (c(), O(n(Xe), {
|
|
2655
2656
|
key: 0,
|
|
2656
2657
|
modelValue: s.value,
|
|
2657
|
-
"onUpdate:modelValue": h[0] || (h[0] = (
|
|
2658
|
+
"onUpdate:modelValue": h[0] || (h[0] = (A) => s.value = A),
|
|
2658
2659
|
placeholder: n(i)("field.search"),
|
|
2659
2660
|
clearable: "",
|
|
2660
2661
|
autofocus: ""
|
|
@@ -2662,58 +2663,58 @@ const jo = ["srcdoc"], Fo = {
|
|
|
2662
2663
|
r.value.length === 0 ? (c(), O(n(el), {
|
|
2663
2664
|
key: 1,
|
|
2664
2665
|
icon: "grid",
|
|
2665
|
-
title:
|
|
2666
|
+
title: d.value,
|
|
2666
2667
|
size: "sm"
|
|
2667
2668
|
}, {
|
|
2668
2669
|
default: g(() => [
|
|
2669
|
-
e.catalog.length === 0 && e.blocksPath ? (c(), O(
|
|
2670
|
+
e.catalog.length === 0 && e.blocksPath ? (c(), O(E, {
|
|
2670
2671
|
key: 0,
|
|
2671
2672
|
to: e.blocksPath
|
|
2672
2673
|
}, {
|
|
2673
2674
|
default: g(() => [
|
|
2674
|
-
L(
|
|
2675
|
+
L(w(n(i)("field.pick-none-link")), 1)
|
|
2675
2676
|
]),
|
|
2676
2677
|
_: 1
|
|
2677
2678
|
}, 8, ["to"])) : W("", !0)
|
|
2678
2679
|
]),
|
|
2679
2680
|
_: 1
|
|
2680
2681
|
}, 8, ["title"])) : W("", !0),
|
|
2681
|
-
(c(!0), _(
|
|
2682
|
-
key:
|
|
2682
|
+
(c(!0), _(R, null, Y(m.value, (A) => (c(), _("section", {
|
|
2683
|
+
key: A.id,
|
|
2683
2684
|
class: "wx-block-picker__group"
|
|
2684
2685
|
}, [
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
(c(!0), _(
|
|
2688
|
-
key:
|
|
2686
|
+
A.label ? (c(), _("div", Ko, w(A.label), 1)) : W("", !0),
|
|
2687
|
+
V("div", Jo, [
|
|
2688
|
+
(c(!0), _(R, null, Y(A.options, ($) => (c(), _("button", {
|
|
2689
|
+
key: $.type.id,
|
|
2689
2690
|
type: "button",
|
|
2690
|
-
class:
|
|
2691
|
-
disabled:
|
|
2692
|
-
title:
|
|
2693
|
-
onClick: (
|
|
2691
|
+
class: De(["wx-block-picker__card", { "is-disabled": $.reason !== null }]),
|
|
2692
|
+
disabled: $.reason !== null,
|
|
2693
|
+
title: $.reason ?? void 0,
|
|
2694
|
+
onClick: (y) => n(t)($.type)
|
|
2694
2695
|
}, [
|
|
2695
2696
|
v($l, {
|
|
2696
|
-
thumbnail:
|
|
2697
|
+
thumbnail: $.type.thumbnail,
|
|
2697
2698
|
height: 96
|
|
2698
2699
|
}, null, 8, ["thumbnail"]),
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2700
|
+
V("div", Go, [
|
|
2701
|
+
V("div", Zo, w($.type.title), 1),
|
|
2702
|
+
$.reason ? (c(), O(n(H), {
|
|
2702
2703
|
key: 0,
|
|
2703
2704
|
size: "sm",
|
|
2704
2705
|
tone: "warning"
|
|
2705
2706
|
}, {
|
|
2706
2707
|
default: g(() => [
|
|
2707
|
-
L(
|
|
2708
|
+
L(w($.reason), 1)
|
|
2708
2709
|
]),
|
|
2709
2710
|
_: 2
|
|
2710
|
-
}, 1024)) :
|
|
2711
|
+
}, 1024)) : $.type.description ? (c(), O(n(H), {
|
|
2711
2712
|
key: 1,
|
|
2712
2713
|
size: "sm",
|
|
2713
2714
|
tone: "muted"
|
|
2714
2715
|
}, {
|
|
2715
2716
|
default: g(() => [
|
|
2716
|
-
L(
|
|
2717
|
+
L(w($.type.description), 1)
|
|
2717
2718
|
]),
|
|
2718
2719
|
_: 2
|
|
2719
2720
|
}, 1024)) : W("", !0)
|
|
@@ -2727,7 +2728,7 @@ const jo = ["srcdoc"], Fo = {
|
|
|
2727
2728
|
}, 8, ["open", "title"]);
|
|
2728
2729
|
};
|
|
2729
2730
|
}
|
|
2730
|
-
}), Xo = /* @__PURE__ */
|
|
2731
|
+
}), Xo = /* @__PURE__ */ ie(Qo, [["__scopeId", "data-v-f175b634"]]), es = { class: "wx-blocks-preview__tools" }, ts = ["src", "title"], ls = /* @__PURE__ */ ae({
|
|
2731
2732
|
__name: "BlocksPreview",
|
|
2732
2733
|
props: {
|
|
2733
2734
|
url: {},
|
|
@@ -2736,22 +2737,22 @@ const jo = ["srcdoc"], Fo = {
|
|
|
2736
2737
|
compact: { type: Boolean, default: !1 }
|
|
2737
2738
|
},
|
|
2738
2739
|
emits: ["select", "edit"],
|
|
2739
|
-
setup(e, { expose:
|
|
2740
|
-
const o = e, a =
|
|
2740
|
+
setup(e, { expose: l, emit: t }) {
|
|
2741
|
+
const o = e, a = t, i = de("webx-blocks"), s = I(null), u = I(null), f = I(null), r = pt(f), m = I(!1), d = I(!1), p = I(null), h = I(0), E = S(() => h.value > 0), A = S(() => [
|
|
2741
2742
|
{ value: 1280, icon: "monitor", ariaLabel: i("field.width-desktop") },
|
|
2742
2743
|
{ value: 834, icon: "tablet", ariaLabel: i("field.width-tablet") },
|
|
2743
2744
|
{ value: 390, icon: "smartphone", ariaLabel: i("field.width-phone") }
|
|
2744
|
-
]),
|
|
2745
|
-
width: `${
|
|
2746
|
-
transform: `scale(${
|
|
2747
|
-
|
|
2748
|
-
})),
|
|
2749
|
-
width: `${Math.round(
|
|
2750
|
-
|
|
2745
|
+
]), $ = S(() => p.value !== null ? p.value : o.compact ? r.value > 0 && r.value < 560 ? 390 : 834 : 1280), y = S(() => r.value === 0 ? 1 : Math.min(1, r.value / $.value)), x = S(() => ({
|
|
2746
|
+
width: `${$.value}px`,
|
|
2747
|
+
transform: `scale(${y.value})`,
|
|
2748
|
+
...E.value ? { height: `${h.value}px` } : {}
|
|
2749
|
+
})), U = S(() => ({
|
|
2750
|
+
width: `${Math.round($.value * y.value)}px`,
|
|
2751
|
+
...E.value ? { height: `${Math.round(h.value * y.value)}px` } : {}
|
|
2751
2752
|
})), Z = S(() => {
|
|
2752
2753
|
if (!o.url) return "";
|
|
2753
2754
|
try {
|
|
2754
|
-
return `${new URL(o.url, location.origin).pathname} · ${
|
|
2755
|
+
return `${new URL(o.url, location.origin).pathname} · ${$.value} px`;
|
|
2755
2756
|
} catch {
|
|
2756
2757
|
return o.url;
|
|
2757
2758
|
}
|
|
@@ -2763,94 +2764,94 @@ const jo = ["srcdoc"], Fo = {
|
|
|
2763
2764
|
return null;
|
|
2764
2765
|
}
|
|
2765
2766
|
}
|
|
2766
|
-
let
|
|
2767
|
+
let re = null, z = null;
|
|
2767
2768
|
function P(b) {
|
|
2768
2769
|
b.documentElement.scrollTop !== 0 && (b.documentElement.scrollTop = 0);
|
|
2769
2770
|
}
|
|
2770
2771
|
function Q() {
|
|
2771
|
-
const b = G(),
|
|
2772
|
-
if (!
|
|
2772
|
+
const b = G(), T = b?.body;
|
|
2773
|
+
if (!T || !b?.defaultView) return;
|
|
2773
2774
|
P(b);
|
|
2774
|
-
const M = b.defaultView.getComputedStyle(
|
|
2775
|
-
le !== h.value && (h.value = le,
|
|
2775
|
+
const M = b.defaultView.getComputedStyle(T), q = (parseFloat(M.marginTop) || 0) + (parseFloat(M.marginBottom) || 0), le = Math.ceil(T.scrollHeight + q);
|
|
2776
|
+
le !== h.value && (h.value = le, ue !== null && Rl(() => requestAnimationFrame(K)));
|
|
2776
2777
|
}
|
|
2777
2778
|
function X(b) {
|
|
2778
2779
|
z?.disconnect();
|
|
2779
|
-
const
|
|
2780
|
-
!
|
|
2780
|
+
const T = b.defaultView;
|
|
2781
|
+
!T || !b.body || (z = new T.ResizeObserver(Q), z.observe(b.body), Q());
|
|
2781
2782
|
}
|
|
2782
|
-
function
|
|
2783
|
-
|
|
2783
|
+
function xe() {
|
|
2784
|
+
d.value = !0;
|
|
2784
2785
|
const b = G();
|
|
2785
|
-
b && (X(b),
|
|
2786
|
+
b && (X(b), re?.release(), re = bn(b, {
|
|
2786
2787
|
/* No guard against answering a click with a scroll: `bring` moves nothing that is already
|
|
2787
2788
|
readable, and a block clicked at the very bottom of the window, half under the action
|
|
2788
2789
|
bar, is exactly the one worth moving. */
|
|
2789
|
-
select: (
|
|
2790
|
-
}),
|
|
2790
|
+
select: (T) => a("select", T)
|
|
2791
|
+
}), bt(b, o.selected ?? null), ve(o.selected ?? null));
|
|
2791
2792
|
}
|
|
2792
|
-
let
|
|
2793
|
+
let ue = null, te = null;
|
|
2793
2794
|
function ve(b) {
|
|
2794
|
-
b !== null && (
|
|
2795
|
-
|
|
2796
|
-
}, 400),
|
|
2795
|
+
b !== null && (ue = b, te !== null && clearTimeout(te), te = window.setTimeout(() => {
|
|
2796
|
+
ue = null, te = null;
|
|
2797
|
+
}, 400), K());
|
|
2797
2798
|
}
|
|
2798
2799
|
function Te(b) {
|
|
2799
|
-
const
|
|
2800
|
-
if (!
|
|
2800
|
+
const T = s.value?.getBoundingClientRect();
|
|
2801
|
+
if (!T) return null;
|
|
2801
2802
|
const M = b.getBoundingClientRect();
|
|
2802
|
-
return { top:
|
|
2803
|
+
return { top: T.top + M.top * y.value, height: M.height * y.value };
|
|
2803
2804
|
}
|
|
2804
|
-
function
|
|
2805
|
+
function Le() {
|
|
2805
2806
|
let b = s.value?.parentElement ?? null;
|
|
2806
2807
|
for (; b; ) {
|
|
2807
|
-
const
|
|
2808
|
-
if ((
|
|
2808
|
+
const T = getComputedStyle(b).overflowY;
|
|
2809
|
+
if ((T === "auto" || T === "scroll") && b.scrollHeight > b.clientHeight)
|
|
2809
2810
|
return b;
|
|
2810
2811
|
b = b.parentElement;
|
|
2811
2812
|
}
|
|
2812
2813
|
return null;
|
|
2813
2814
|
}
|
|
2814
|
-
function
|
|
2815
|
+
function K() {
|
|
2815
2816
|
const b = G();
|
|
2816
|
-
if (
|
|
2817
|
+
if (ue === null || !b) return;
|
|
2817
2818
|
P(b);
|
|
2818
|
-
const
|
|
2819
|
+
const T = Ct(b, ue), M = T ? Te(T) : null;
|
|
2819
2820
|
if (!M) return;
|
|
2820
|
-
const q =
|
|
2821
|
+
const q = Le(), le = q?.getBoundingClientRect(), be = u.value?.getBoundingClientRect().height ?? 0, ge = {
|
|
2821
2822
|
top: (le?.top ?? 0) + be,
|
|
2822
2823
|
bottom: (le ? le.bottom : window.innerHeight) - be
|
|
2823
|
-
}, Ve = M.top + M.height,
|
|
2824
|
+
}, Ve = M.top + M.height, We = M.top < ge.top, He = M.height > ge.bottom - ge.top, B = We || He ? M.top - ge.top : Ve > ge.bottom ? Ve - ge.bottom : 0;
|
|
2824
2825
|
B !== 0 && (q ?? window).scrollBy({ top: B, behavior: "smooth" });
|
|
2825
2826
|
}
|
|
2826
|
-
function Ee(b,
|
|
2827
|
+
function Ee(b, T) {
|
|
2827
2828
|
const M = G();
|
|
2828
|
-
if (!M || !
|
|
2829
|
-
const q = rl(M, b,
|
|
2830
|
-
return q &&
|
|
2829
|
+
if (!M || !d.value) return !1;
|
|
2830
|
+
const q = rl(M, b, T);
|
|
2831
|
+
return q && bt(M, o.selected ?? null), q;
|
|
2831
2832
|
}
|
|
2832
|
-
function
|
|
2833
|
-
|
|
2833
|
+
function _e() {
|
|
2834
|
+
d.value = !1, z?.disconnect(), z = null, s.value && o.url && (s.value.src = o.url);
|
|
2834
2835
|
}
|
|
2835
|
-
function
|
|
2836
|
-
b.key === "Escape" &&
|
|
2836
|
+
function $e(b) {
|
|
2837
|
+
b.key === "Escape" && m.value && (m.value = !1, b.stopPropagation());
|
|
2837
2838
|
}
|
|
2838
|
-
return
|
|
2839
|
+
return se(
|
|
2839
2840
|
() => o.selected,
|
|
2840
2841
|
(b) => {
|
|
2841
|
-
const
|
|
2842
|
-
!
|
|
2842
|
+
const T = G();
|
|
2843
|
+
!T || !d.value || (bt(T, b ?? null), ve(b ?? null));
|
|
2843
2844
|
}
|
|
2844
|
-
),
|
|
2845
|
+
), se(() => o.reload, _e), se(
|
|
2845
2846
|
() => o.url,
|
|
2846
|
-
() =>
|
|
2847
|
-
),
|
|
2848
|
-
window.removeEventListener("keydown",
|
|
2849
|
-
}),
|
|
2850
|
-
class:
|
|
2851
|
-
style:
|
|
2847
|
+
() => d.value = !1
|
|
2848
|
+
), et(() => window.addEventListener("keydown", $e)), tt(() => {
|
|
2849
|
+
window.removeEventListener("keydown", $e), te !== null && clearTimeout(te), z?.disconnect(), re?.release();
|
|
2850
|
+
}), l({ replace: Ee, refresh: _e, open: () => m.value = !0 }), (b, T) => (c(), _("div", {
|
|
2851
|
+
class: De(["wx-blocks-preview", { "is-fullscreen": m.value, "is-grown": E.value, "is-compact": e.compact }]),
|
|
2852
|
+
style: Oe({ "--wx-preview-scale": y.value })
|
|
2852
2853
|
}, [
|
|
2853
|
-
|
|
2854
|
+
V("div", {
|
|
2854
2855
|
ref_key: "bar",
|
|
2855
2856
|
ref: u,
|
|
2856
2857
|
class: "wx-blocks-preview__bar"
|
|
@@ -2862,28 +2863,28 @@ const jo = ["srcdoc"], Fo = {
|
|
|
2862
2863
|
truncate: ""
|
|
2863
2864
|
}, {
|
|
2864
2865
|
default: g(() => [
|
|
2865
|
-
L(
|
|
2866
|
+
L(w(Z.value), 1)
|
|
2866
2867
|
]),
|
|
2867
2868
|
_: 1
|
|
2868
2869
|
}),
|
|
2869
2870
|
v(n(Yt), {
|
|
2870
2871
|
class: "wx-blocks-preview__widths",
|
|
2871
|
-
"model-value":
|
|
2872
|
-
options:
|
|
2872
|
+
"model-value": $.value,
|
|
2873
|
+
options: A.value,
|
|
2873
2874
|
size: "sm",
|
|
2874
2875
|
"aria-label": n(i)("field.width"),
|
|
2875
|
-
"onUpdate:modelValue":
|
|
2876
|
+
"onUpdate:modelValue": T[0] || (T[0] = (M) => p.value = Number(M))
|
|
2876
2877
|
}, null, 8, ["model-value", "options", "aria-label"]),
|
|
2877
|
-
|
|
2878
|
-
e.compact ? (c(), O(n(
|
|
2878
|
+
V("div", es, [
|
|
2879
|
+
e.compact ? (c(), O(n(Ye), {
|
|
2879
2880
|
key: 0,
|
|
2880
2881
|
size: "sm",
|
|
2881
2882
|
tone: "primary",
|
|
2882
2883
|
icon: "edit",
|
|
2883
2884
|
title: n(i)("field.blocks"),
|
|
2884
|
-
onClick:
|
|
2885
|
+
onClick: T[1] || (T[1] = (M) => a("edit"))
|
|
2885
2886
|
}, null, 8, ["title"])) : W("", !0),
|
|
2886
|
-
e.url ? (c(), O(n(
|
|
2887
|
+
e.url ? (c(), O(n(Ye), {
|
|
2887
2888
|
key: 1,
|
|
2888
2889
|
size: "sm",
|
|
2889
2890
|
icon: "external-link",
|
|
@@ -2893,23 +2894,23 @@ const jo = ["srcdoc"], Fo = {
|
|
|
2893
2894
|
target: "_blank",
|
|
2894
2895
|
rel: "noopener"
|
|
2895
2896
|
}, null, 8, ["title", "href"])) : W("", !0),
|
|
2896
|
-
v(n(
|
|
2897
|
+
v(n(Ye), {
|
|
2897
2898
|
size: "sm",
|
|
2898
|
-
icon:
|
|
2899
|
+
icon: m.value ? "minimize" : "maximize",
|
|
2899
2900
|
tone: "neutral",
|
|
2900
|
-
title:
|
|
2901
|
-
onClick:
|
|
2901
|
+
title: m.value ? n(i)("field.close") : n(i)("field.fullscreen"),
|
|
2902
|
+
onClick: T[2] || (T[2] = (M) => m.value = !m.value)
|
|
2902
2903
|
}, null, 8, ["icon", "title"])
|
|
2903
2904
|
])
|
|
2904
2905
|
], 512),
|
|
2905
|
-
|
|
2906
|
+
V("div", {
|
|
2906
2907
|
ref_key: "box",
|
|
2907
|
-
ref:
|
|
2908
|
+
ref: f,
|
|
2908
2909
|
class: "wx-blocks-preview__ground"
|
|
2909
2910
|
}, [
|
|
2910
|
-
|
|
2911
|
+
V("div", {
|
|
2911
2912
|
class: "wx-blocks-preview__clip",
|
|
2912
|
-
style:
|
|
2913
|
+
style: Oe(U.value)
|
|
2913
2914
|
}, [
|
|
2914
2915
|
e.url ? (c(), _("iframe", {
|
|
2915
2916
|
key: 0,
|
|
@@ -2917,70 +2918,85 @@ const jo = ["srcdoc"], Fo = {
|
|
|
2917
2918
|
ref: s,
|
|
2918
2919
|
class: "wx-blocks-preview__frame",
|
|
2919
2920
|
src: e.url,
|
|
2920
|
-
style:
|
|
2921
|
+
style: Oe(x.value),
|
|
2921
2922
|
title: n(i)("field.preview"),
|
|
2922
|
-
onLoad:
|
|
2923
|
+
onLoad: xe
|
|
2923
2924
|
}, null, 44, ts)) : W("", !0)
|
|
2924
2925
|
], 4)
|
|
2925
2926
|
], 512)
|
|
2926
2927
|
], 6));
|
|
2927
2928
|
}
|
|
2928
|
-
}), ns = /* @__PURE__ */
|
|
2929
|
+
}), ns = /* @__PURE__ */ ie(ls, [["__scopeId", "data-v-398e4cef"]]), os = { class: "wx-blocks-tree__node" }, ss = ["onClick", "onKeydown"], as = { class: "wx-blocks-tree__name" }, is = ["title"], rs = ["title"], us = ["title"], cs = ["title"], ds = {
|
|
2929
2930
|
key: 4,
|
|
2930
2931
|
class: "wx-blocks-tree__actions"
|
|
2931
|
-
}, ps = ["onClick"], fs = /* @__PURE__ */
|
|
2932
|
+
}, ps = ["onClick"], fs = /* @__PURE__ */ ae({
|
|
2932
2933
|
__name: "BlocksTree",
|
|
2933
2934
|
props: {
|
|
2934
2935
|
nodes: {},
|
|
2935
2936
|
catalog: {},
|
|
2936
2937
|
parentKey: { default: null },
|
|
2937
2938
|
field: { default: null },
|
|
2939
|
+
fieldNode: { default: null },
|
|
2940
|
+
max: { default: null },
|
|
2938
2941
|
selected: { default: null },
|
|
2939
2942
|
disabled: { type: Boolean, default: !1 },
|
|
2940
2943
|
depth: { default: 0 }
|
|
2941
2944
|
},
|
|
2942
2945
|
emits: ["select", "add", "remove", "duplicate", "visibility", "reorder"],
|
|
2943
|
-
setup(e, { emit:
|
|
2944
|
-
const
|
|
2945
|
-
function i(
|
|
2946
|
-
return
|
|
2946
|
+
setup(e, { emit: l }) {
|
|
2947
|
+
const t = e, o = l, a = de("webx-blocks");
|
|
2948
|
+
function i(m) {
|
|
2949
|
+
return t.catalog.find((d) => d.slug === m.type) ?? null;
|
|
2947
2950
|
}
|
|
2948
|
-
function s(
|
|
2949
|
-
return i(
|
|
2951
|
+
function s(m) {
|
|
2952
|
+
return i(m)?.title ?? m.type;
|
|
2950
2953
|
}
|
|
2951
|
-
function u(
|
|
2952
|
-
const
|
|
2953
|
-
return
|
|
2954
|
+
function u(m) {
|
|
2955
|
+
const d = i(m);
|
|
2956
|
+
return d?.content ? fl(d.content.schema) : [];
|
|
2954
2957
|
}
|
|
2955
|
-
function
|
|
2956
|
-
const
|
|
2957
|
-
return Array.isArray(
|
|
2958
|
+
function f(m, d) {
|
|
2959
|
+
const p = m.values[d.id];
|
|
2960
|
+
return Array.isArray(p) ? p : [];
|
|
2958
2961
|
}
|
|
2959
|
-
function r(
|
|
2962
|
+
function r(m, d) {
|
|
2963
|
+
const p = t.fieldNode ? t.fieldNode.props?.max ?? null : t.max;
|
|
2960
2964
|
return [
|
|
2965
|
+
/*
|
|
2966
|
+
* The button under the list only appends, so a block meant for the middle of a long page
|
|
2967
|
+
* was a trip to the bottom and a drag all the way back up. This one puts it where the
|
|
2968
|
+
* editor already is. Not "add before": after the row above is the same place.
|
|
2969
|
+
*/
|
|
2970
|
+
{
|
|
2971
|
+
key: "add-after",
|
|
2972
|
+
icon: "plus",
|
|
2973
|
+
label: a("field.add-after"),
|
|
2974
|
+
disabled: p !== null && t.nodes.length >= p,
|
|
2975
|
+
run: () => o("add", t.parentKey, t.field, t.fieldNode, d + 1)
|
|
2976
|
+
},
|
|
2961
2977
|
{
|
|
2962
2978
|
key: "visibility",
|
|
2963
|
-
icon:
|
|
2964
|
-
label:
|
|
2965
|
-
run: () => o("visibility",
|
|
2979
|
+
icon: m.hidden === !0 ? "eye" : "eye-off",
|
|
2980
|
+
label: m.hidden === !0 ? a("field.show") : a("field.hide"),
|
|
2981
|
+
run: () => o("visibility", m.key, m.hidden !== !0)
|
|
2966
2982
|
},
|
|
2967
2983
|
{
|
|
2968
2984
|
key: "duplicate",
|
|
2969
2985
|
icon: "copy",
|
|
2970
2986
|
label: a("field.duplicate"),
|
|
2971
|
-
run: () => o("duplicate",
|
|
2987
|
+
run: () => o("duplicate", m.key)
|
|
2972
2988
|
},
|
|
2973
2989
|
{
|
|
2974
2990
|
key: "remove",
|
|
2975
2991
|
icon: "trash",
|
|
2976
2992
|
label: a("field.remove"),
|
|
2977
2993
|
danger: !0,
|
|
2978
|
-
run: () => o("remove",
|
|
2994
|
+
run: () => o("remove", m.key)
|
|
2979
2995
|
}
|
|
2980
2996
|
];
|
|
2981
2997
|
}
|
|
2982
|
-
return (
|
|
2983
|
-
const
|
|
2998
|
+
return (m, d) => {
|
|
2999
|
+
const p = St("blocks-tree", !0);
|
|
2984
3000
|
return c(), O(n(zl), {
|
|
2985
3001
|
"model-value": e.nodes,
|
|
2986
3002
|
"item-key": "key",
|
|
@@ -2989,83 +3005,84 @@ const jo = ["srcdoc"], Fo = {
|
|
|
2989
3005
|
plain: "",
|
|
2990
3006
|
size: "sm",
|
|
2991
3007
|
"empty-text": e.depth === 0 ? n(a)("field.empty") : "",
|
|
2992
|
-
class:
|
|
2993
|
-
"onUpdate:modelValue":
|
|
3008
|
+
class: De(["wx-blocks-tree", { "is-nested": e.depth > 0 }]),
|
|
3009
|
+
"onUpdate:modelValue": d[6] || (d[6] = (h) => o("reorder", e.parentKey, e.field, h))
|
|
2994
3010
|
}, {
|
|
2995
|
-
default: g(({ item: h }) => [
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
class:
|
|
3011
|
+
default: g(({ item: h, index: E }) => [
|
|
3012
|
+
V("div", os, [
|
|
3013
|
+
V("div", {
|
|
3014
|
+
class: De(["wx-blocks-tree__row", { "is-selected": e.selected === h.key, "is-hidden": h.hidden === !0 }]),
|
|
2999
3015
|
role: "button",
|
|
3000
3016
|
tabindex: "0",
|
|
3001
|
-
onClick: (
|
|
3017
|
+
onClick: (A) => o("select", h.key),
|
|
3002
3018
|
onKeydown: [
|
|
3003
|
-
Mt(Ot((
|
|
3004
|
-
Mt(Ot((
|
|
3019
|
+
Mt(Ot((A) => o("select", h.key), ["prevent"]), ["enter"]),
|
|
3020
|
+
Mt(Ot((A) => o("select", h.key), ["prevent"]), ["space"])
|
|
3005
3021
|
]
|
|
3006
3022
|
}, [
|
|
3007
|
-
|
|
3023
|
+
V("span", as, w(s(h)), 1),
|
|
3008
3024
|
i(h) ? i(h)?.draft ? (c(), _("span", {
|
|
3009
3025
|
key: 1,
|
|
3010
3026
|
class: "wx-blocks-tree__flag is-warning",
|
|
3011
3027
|
title: n(a)("field.draft-type")
|
|
3012
3028
|
}, [
|
|
3013
|
-
v(n(
|
|
3029
|
+
v(n(we), { name: "warning" })
|
|
3014
3030
|
], 8, rs)) : i(h)?.is_enabled === !1 ? (c(), _("span", {
|
|
3015
3031
|
key: 2,
|
|
3016
3032
|
class: "wx-blocks-tree__flag",
|
|
3017
3033
|
title: n(a)("field.disabled-type")
|
|
3018
3034
|
}, [
|
|
3019
|
-
v(n(
|
|
3035
|
+
v(n(we), { name: "lock" })
|
|
3020
3036
|
], 8, us)) : W("", !0) : (c(), _("span", {
|
|
3021
3037
|
key: 0,
|
|
3022
3038
|
class: "wx-blocks-tree__flag is-danger",
|
|
3023
3039
|
title: n(a)("field.unknown-type", { type: h.type })
|
|
3024
3040
|
}, [
|
|
3025
|
-
v(n(
|
|
3041
|
+
v(n(we), { name: "close-circle" })
|
|
3026
3042
|
], 8, is)),
|
|
3027
3043
|
h.hidden === !0 ? (c(), _("span", {
|
|
3028
3044
|
key: 3,
|
|
3029
3045
|
class: "wx-blocks-tree__flag",
|
|
3030
3046
|
title: n(a)("field.hidden-note")
|
|
3031
3047
|
}, [
|
|
3032
|
-
v(n(
|
|
3048
|
+
v(n(we), { name: "eye-off" })
|
|
3033
3049
|
], 8, cs)) : W("", !0),
|
|
3034
3050
|
e.disabled ? W("", !0) : (c(), _("span", ds, [
|
|
3035
3051
|
v(n(Ql), {
|
|
3036
|
-
actions: r(h),
|
|
3052
|
+
actions: r(h, E),
|
|
3037
3053
|
label: s(h)
|
|
3038
3054
|
}, null, 8, ["actions", "label"])
|
|
3039
3055
|
]))
|
|
3040
3056
|
], 42, ss),
|
|
3041
|
-
(c(!0), _(
|
|
3042
|
-
key:
|
|
3057
|
+
(c(!0), _(R, null, Y(u(h), (A) => (c(), _("div", {
|
|
3058
|
+
key: A.id,
|
|
3043
3059
|
class: "wx-blocks-tree__kids"
|
|
3044
3060
|
}, [
|
|
3045
|
-
v(
|
|
3046
|
-
nodes:
|
|
3061
|
+
v(p, {
|
|
3062
|
+
nodes: f(h, A),
|
|
3047
3063
|
catalog: e.catalog,
|
|
3048
3064
|
"parent-key": h.key,
|
|
3049
|
-
field:
|
|
3065
|
+
field: A.id,
|
|
3066
|
+
"field-node": A,
|
|
3050
3067
|
selected: e.selected,
|
|
3051
3068
|
disabled: e.disabled,
|
|
3052
3069
|
depth: e.depth + 1,
|
|
3053
|
-
onSelect:
|
|
3054
|
-
onAdd:
|
|
3055
|
-
onRemove:
|
|
3056
|
-
onDuplicate:
|
|
3057
|
-
onVisibility:
|
|
3058
|
-
onReorder:
|
|
3059
|
-
}, null, 8, ["nodes", "catalog", "parent-key", "field", "selected", "disabled", "depth"]),
|
|
3070
|
+
onSelect: d[0] || (d[0] = ($) => o("select", $)),
|
|
3071
|
+
onAdd: d[1] || (d[1] = ($, y, x, U) => o("add", $, y, x, U)),
|
|
3072
|
+
onRemove: d[2] || (d[2] = ($) => o("remove", $)),
|
|
3073
|
+
onDuplicate: d[3] || (d[3] = ($) => o("duplicate", $)),
|
|
3074
|
+
onVisibility: d[4] || (d[4] = ($, y) => o("visibility", $, y)),
|
|
3075
|
+
onReorder: d[5] || (d[5] = ($, y, x) => o("reorder", $, y, x))
|
|
3076
|
+
}, null, 8, ["nodes", "catalog", "parent-key", "field", "field-node", "selected", "disabled", "depth"]),
|
|
3060
3077
|
e.disabled ? W("", !0) : (c(), _("button", {
|
|
3061
3078
|
key: 0,
|
|
3062
3079
|
type: "button",
|
|
3063
3080
|
class: "wx-blocks-tree__add is-inner",
|
|
3064
|
-
onClick: (
|
|
3081
|
+
onClick: ($) => o("add", h.key, A.id, A)
|
|
3065
3082
|
}, [
|
|
3066
|
-
L(" + " +
|
|
3067
|
-
u(h).length > 1 ? (c(), _(
|
|
3068
|
-
L(" · " +
|
|
3083
|
+
L(" + " + w(n(a)("field.add-inside")), 1),
|
|
3084
|
+
u(h).length > 1 ? (c(), _(R, { key: 0 }, [
|
|
3085
|
+
L(" · " + w(A.label ?? A.id), 1)
|
|
3069
3086
|
], 64)) : W("", !0)
|
|
3070
3087
|
], 8, ps))
|
|
3071
3088
|
]))), 128))
|
|
@@ -3075,14 +3092,14 @@ const jo = ["srcdoc"], Fo = {
|
|
|
3075
3092
|
}, 8, ["model-value", "item-label", "disabled", "empty-text", "class"]);
|
|
3076
3093
|
};
|
|
3077
3094
|
}
|
|
3078
|
-
}), ms = /* @__PURE__ */
|
|
3095
|
+
}), ms = /* @__PURE__ */ ie(fs, [["__scopeId", "data-v-d7901f05"]]), At = /* @__PURE__ */ Symbol("wx-blocks-preview");
|
|
3079
3096
|
function ha(e) {
|
|
3080
|
-
nl(
|
|
3097
|
+
nl(At, e);
|
|
3081
3098
|
}
|
|
3082
3099
|
function va() {
|
|
3083
|
-
return
|
|
3100
|
+
return Ge(At, null);
|
|
3084
3101
|
}
|
|
3085
|
-
const
|
|
3102
|
+
const Kt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
3086
3103
|
key: 0,
|
|
3087
3104
|
class: "wx-blocks-nested"
|
|
3088
3105
|
}, vs = {
|
|
@@ -3097,11 +3114,11 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3097
3114
|
}, Ss = ["onClick"], Cs = { class: "wx-blocks__panel-name" }, Ts = { class: "wx-blocks__panel-extra" }, Es = { key: 0 }, Vs = { class: "wx-blocks__form" }, As = {
|
|
3098
3115
|
key: 0,
|
|
3099
3116
|
class: "wx-blocks__preview"
|
|
3100
|
-
}, Bs = /* @__PURE__ */
|
|
3117
|
+
}, Bs = /* @__PURE__ */ ae({
|
|
3101
3118
|
name: "WxBlocks",
|
|
3102
3119
|
inheritAttrs: !1,
|
|
3103
3120
|
__name: "BlocksField",
|
|
3104
|
-
props: /* @__PURE__ */
|
|
3121
|
+
props: /* @__PURE__ */ Kl({
|
|
3105
3122
|
node: { default: void 0 },
|
|
3106
3123
|
context: { default: void 0 },
|
|
3107
3124
|
name: { default: void 0 },
|
|
@@ -3117,35 +3134,35 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3117
3134
|
}),
|
|
3118
3135
|
emits: ["update:modelValue"],
|
|
3119
3136
|
setup(e) {
|
|
3120
|
-
const
|
|
3121
|
-
nl(
|
|
3122
|
-
const a =
|
|
3137
|
+
const l = e, t = jl(e, "modelValue"), o = Ge(Kt, !1);
|
|
3138
|
+
nl(Kt, !0), Ie();
|
|
3139
|
+
const a = de("webx-blocks"), i = nt(), s = Ge(ol, null);
|
|
3123
3140
|
let u = null;
|
|
3124
|
-
const
|
|
3125
|
-
() =>
|
|
3141
|
+
const f = I([]), r = S(() => l.catalog ?? f.value), m = S(() => Array.isArray(t.value) ? t.value : []), d = I(null), p = S(() => d.value ? me(m.value, d.value) : null), h = S(
|
|
3142
|
+
() => p.value ? r.value.find((B) => B.slug === p.value?.node.type) ?? null : null
|
|
3126
3143
|
);
|
|
3127
|
-
function
|
|
3144
|
+
function E(B) {
|
|
3128
3145
|
return r.value.find((D) => D.slug === B.type)?.title ?? B.type;
|
|
3129
3146
|
}
|
|
3130
|
-
const
|
|
3147
|
+
const A = S(() => {
|
|
3131
3148
|
const B = [];
|
|
3132
|
-
return
|
|
3133
|
-
}),
|
|
3134
|
-
const B =
|
|
3149
|
+
return ot(m.value, (D) => B.push(D.key)), B;
|
|
3150
|
+
}), $ = S(() => {
|
|
3151
|
+
const B = d.value ? A.value.indexOf(d.value) : -1;
|
|
3135
3152
|
return {
|
|
3136
|
-
previous: B > 0 ?
|
|
3137
|
-
next: B >= 0 && B <
|
|
3153
|
+
previous: B > 0 ? A.value[B - 1] : null,
|
|
3154
|
+
next: B >= 0 && B < A.value.length - 1 ? A.value[B + 1] : null
|
|
3138
3155
|
};
|
|
3139
|
-
}),
|
|
3156
|
+
}), y = S(() => {
|
|
3140
3157
|
const B = [];
|
|
3141
|
-
let D =
|
|
3158
|
+
let D = p.value?.parent ?? null;
|
|
3142
3159
|
for (; D; )
|
|
3143
|
-
B.unshift({ key: D.key, title:
|
|
3160
|
+
B.unshift({ key: D.key, title: E(D) }), D = me(m.value, D.key)?.parent ?? null;
|
|
3144
3161
|
return B;
|
|
3145
|
-
}), x =
|
|
3146
|
-
if (!
|
|
3147
|
-
const B = h.value?.title ??
|
|
3148
|
-
return [...
|
|
3162
|
+
}), x = Ge(At, null), U = I(null), Z = I(null), G = pt(Z), re = S(() => x !== null && x.url.value !== null), z = S(() => re.value && G.value > 0 && G.value <= 900), P = I(!1), Q = S(() => {
|
|
3163
|
+
if (!p.value) return;
|
|
3164
|
+
const B = h.value?.title ?? p.value.node.type;
|
|
3165
|
+
return [...y.value.map((D) => D.title), B].join(" / ");
|
|
3149
3166
|
}), X = S(
|
|
3150
3167
|
() => z.value ? {
|
|
3151
3168
|
/* Up from the bottom, and not all the way: the strip of page left above it is what
|
|
@@ -3168,105 +3185,105 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3168
3185
|
open: P.value,
|
|
3169
3186
|
"onUpdate:open": (B) => P.value = B
|
|
3170
3187
|
} : {}
|
|
3171
|
-
),
|
|
3188
|
+
), xe = S(
|
|
3172
3189
|
() => s?.state.manifest?.modules.find((B) => B.id === "blocks")?.meta?.groups ?? []
|
|
3173
|
-
),
|
|
3174
|
-
() =>
|
|
3175
|
-
), Te = S(() =>
|
|
3176
|
-
function
|
|
3177
|
-
|
|
3178
|
-
}
|
|
3179
|
-
async function Ee(B, D, j) {
|
|
3180
|
-
const
|
|
3181
|
-
if (
|
|
3182
|
-
const
|
|
3190
|
+
), ue = Fl()?.type, te = S(() => l.context?.types ? l.context.types : s?.types ? { ...rt, ...s.types } : ue ? { ...rt, "wx-blocks": { component: ue, kind: "field", nested: !0 } } : rt), ve = S(
|
|
3191
|
+
() => l.context?.translate ?? s?.i18n.t ?? ((B) => B)
|
|
3192
|
+
), Te = S(() => l.context?.can ?? s?.can ?? (() => !0)), Le = tl(Xo);
|
|
3193
|
+
function K(B) {
|
|
3194
|
+
t.value = B;
|
|
3195
|
+
}
|
|
3196
|
+
async function Ee(B, D, j, Se) {
|
|
3197
|
+
const ee = B ? me(m.value, B) : null, st = ee ? r.value.find((at) => at.slug === ee.node.type) ?? null : null, mt = B === null ? l.allow : j?.props?.allow ?? null, Ne = B === null ? l.max : j?.props?.max ?? null, ne = B === null ? m.value : ee && D ? ee.node.values[D] ?? [] : [];
|
|
3198
|
+
if (Ne != null && ne.length >= Ne) return;
|
|
3199
|
+
const pe = await Le({
|
|
3183
3200
|
catalog: r.value,
|
|
3184
|
-
parent:
|
|
3185
|
-
allow:
|
|
3186
|
-
tree:
|
|
3187
|
-
groups:
|
|
3188
|
-
blocksPath:
|
|
3201
|
+
parent: st,
|
|
3202
|
+
allow: mt,
|
|
3203
|
+
tree: m.value,
|
|
3204
|
+
groups: xe.value,
|
|
3205
|
+
blocksPath: l.blocksPath
|
|
3189
3206
|
});
|
|
3190
|
-
if (!
|
|
3191
|
-
const
|
|
3192
|
-
|
|
3207
|
+
if (!pe) return;
|
|
3208
|
+
const Ae = Vn(pe.slug, _e(pe));
|
|
3209
|
+
K(jt(m.value, B, D, Se ?? ne.length, Ae)), d.value = Ae.key;
|
|
3193
3210
|
}
|
|
3194
|
-
function
|
|
3211
|
+
function _e(B) {
|
|
3195
3212
|
const D = B.content?.sample ?? {}, j = {};
|
|
3196
|
-
for (const [
|
|
3197
|
-
(!Array.isArray(
|
|
3213
|
+
for (const [Se, ee] of Object.entries(D))
|
|
3214
|
+
(!Array.isArray(ee) || ee.length === 0 || typeof ee[0] != "object") && (j[Se] = ee);
|
|
3198
3215
|
return j;
|
|
3199
3216
|
}
|
|
3200
|
-
async function
|
|
3201
|
-
const D = me(
|
|
3217
|
+
async function $e(B) {
|
|
3218
|
+
const D = me(m.value, B);
|
|
3202
3219
|
if (!D) return;
|
|
3203
3220
|
const j = Bn(D.node);
|
|
3204
3221
|
await dt({
|
|
3205
3222
|
title: a("field.remove-title", {
|
|
3206
|
-
title: r.value.find((
|
|
3223
|
+
title: r.value.find((ee) => ee.slug === D.node.type)?.title ?? D.node.type
|
|
3207
3224
|
}),
|
|
3208
3225
|
message: j > 0 ? a("field.remove-text", { count: j }) : a("field.remove-alone"),
|
|
3209
3226
|
confirmText: a("field.remove"),
|
|
3210
3227
|
cancelText: a("page.cancel"),
|
|
3211
3228
|
tone: "danger"
|
|
3212
|
-
}) && (
|
|
3229
|
+
}) && (d.value === B && (d.value = null), K(Nn(m.value, B)));
|
|
3213
3230
|
}
|
|
3214
3231
|
function b(B) {
|
|
3215
|
-
const D = me(
|
|
3232
|
+
const D = me(m.value, B);
|
|
3216
3233
|
if (!D) return;
|
|
3217
3234
|
const j = ml(D.node);
|
|
3218
|
-
|
|
3235
|
+
K(jt(m.value, D.parent?.key ?? null, D.field, D.index + 1, j)), d.value = j.key;
|
|
3219
3236
|
}
|
|
3220
|
-
function
|
|
3221
|
-
|
|
3237
|
+
function T(B, D) {
|
|
3238
|
+
K(Ln(m.value, B, D));
|
|
3222
3239
|
}
|
|
3223
3240
|
function M(B, D, j) {
|
|
3224
|
-
|
|
3241
|
+
K(Mn(m.value, B, D, j));
|
|
3225
3242
|
}
|
|
3226
3243
|
function q(B) {
|
|
3227
|
-
|
|
3244
|
+
d.value = d.value === B ? null : B;
|
|
3228
3245
|
}
|
|
3229
3246
|
function le(B) {
|
|
3230
|
-
B === null || !me(
|
|
3247
|
+
B === null || !me(m.value, B) || (d.value = B, z.value && (P.value = !0));
|
|
3231
3248
|
}
|
|
3232
3249
|
function be() {
|
|
3233
|
-
|
|
3250
|
+
d.value = null;
|
|
3234
3251
|
}
|
|
3235
3252
|
function ge(B) {
|
|
3236
|
-
|
|
3253
|
+
d.value && K(zn(m.value, d.value, B));
|
|
3237
3254
|
}
|
|
3238
3255
|
let Ve;
|
|
3239
|
-
|
|
3240
|
-
() =>
|
|
3256
|
+
se(
|
|
3257
|
+
() => p.value?.node.values,
|
|
3241
3258
|
(B, D) => {
|
|
3242
3259
|
if (!B || !D || !h.value || !u || !x) return;
|
|
3243
|
-
const j =
|
|
3260
|
+
const j = d.value, Se = h.value.id;
|
|
3244
3261
|
clearTimeout(Ve), Ve = setTimeout(() => {
|
|
3245
|
-
!j || !u || u.render(
|
|
3246
|
-
|
|
3262
|
+
!j || !u || u.render(Se, { values: B, key: j }).then((ee) => {
|
|
3263
|
+
U.value?.replace(j, ee.html) || U.value?.refresh();
|
|
3247
3264
|
}).catch(() => {
|
|
3248
3265
|
});
|
|
3249
3266
|
}, 300);
|
|
3250
3267
|
},
|
|
3251
3268
|
{ deep: !0 }
|
|
3252
3269
|
);
|
|
3253
|
-
function
|
|
3254
|
-
B.key === "Escape" &&
|
|
3270
|
+
function We(B) {
|
|
3271
|
+
B.key === "Escape" && d.value && be();
|
|
3255
3272
|
}
|
|
3256
|
-
|
|
3257
|
-
if (window.addEventListener("keydown",
|
|
3273
|
+
et(async () => {
|
|
3274
|
+
if (window.addEventListener("keydown", We), l.catalog === null && s) {
|
|
3258
3275
|
u = Re(s);
|
|
3259
3276
|
try {
|
|
3260
|
-
|
|
3277
|
+
f.value = await u.catalog();
|
|
3261
3278
|
} catch (B) {
|
|
3262
|
-
|
|
3279
|
+
J.danger(i(B));
|
|
3263
3280
|
}
|
|
3264
3281
|
} else s && (u = Re(s));
|
|
3265
|
-
}),
|
|
3266
|
-
clearTimeout(Ve), window.removeEventListener("keydown",
|
|
3282
|
+
}), tt(() => {
|
|
3283
|
+
clearTimeout(Ve), window.removeEventListener("keydown", We);
|
|
3267
3284
|
});
|
|
3268
3285
|
const He = S(
|
|
3269
|
-
() => h.value?.content ?
|
|
3286
|
+
() => h.value?.content ? Et(h.value.content.schema) : []
|
|
3270
3287
|
);
|
|
3271
3288
|
return (B, D) => n(o) ? (c(), _("div", hs, [
|
|
3272
3289
|
v(n(H), {
|
|
@@ -3274,7 +3291,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3274
3291
|
tone: "muted"
|
|
3275
3292
|
}, {
|
|
3276
3293
|
default: g(() => [
|
|
3277
|
-
L(
|
|
3294
|
+
L(w(n(a)("field.nested-note")), 1)
|
|
3278
3295
|
]),
|
|
3279
3296
|
_: 1
|
|
3280
3297
|
})
|
|
@@ -3282,45 +3299,46 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3282
3299
|
key: 1,
|
|
3283
3300
|
ref_key: "host",
|
|
3284
3301
|
ref: Z,
|
|
3285
|
-
class:
|
|
3302
|
+
class: De(["wx-blocks-host", { "is-compact": z.value }])
|
|
3286
3303
|
}, [
|
|
3287
|
-
|
|
3288
|
-
class:
|
|
3289
|
-
"is-editing":
|
|
3304
|
+
V("div", {
|
|
3305
|
+
class: De(["wx-blocks", {
|
|
3306
|
+
"is-editing": p.value !== null,
|
|
3290
3307
|
"has-preview": n(x) !== null && n(x).url.value !== null
|
|
3291
3308
|
}])
|
|
3292
3309
|
}, [
|
|
3293
3310
|
(c(), O(Hl(z.value ? n(Ml) : "div"), ql(X.value, { class: "wx-blocks__side" }), {
|
|
3294
3311
|
default: g(() => [
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3312
|
+
p.value ? W("", !0) : (c(), _("div", vs, [
|
|
3313
|
+
V("div", bs, [
|
|
3314
|
+
V("span", gs, w(n(a)("field.blocks")), 1),
|
|
3298
3315
|
v(n(H), {
|
|
3299
3316
|
size: "sm",
|
|
3300
3317
|
tone: "muted"
|
|
3301
3318
|
}, {
|
|
3302
3319
|
default: g(() => [
|
|
3303
|
-
L(
|
|
3320
|
+
L(w(m.value.length), 1)
|
|
3304
3321
|
]),
|
|
3305
3322
|
_: 1
|
|
3306
3323
|
})
|
|
3307
3324
|
]),
|
|
3308
|
-
|
|
3325
|
+
V("div", ks, [
|
|
3309
3326
|
v(ms, {
|
|
3310
|
-
nodes:
|
|
3327
|
+
nodes: m.value,
|
|
3311
3328
|
catalog: r.value,
|
|
3312
|
-
|
|
3329
|
+
max: e.max,
|
|
3330
|
+
selected: d.value,
|
|
3313
3331
|
disabled: e.disabled,
|
|
3314
3332
|
onSelect: q,
|
|
3315
3333
|
onAdd: Ee,
|
|
3316
|
-
onRemove:
|
|
3334
|
+
onRemove: $e,
|
|
3317
3335
|
onDuplicate: b,
|
|
3318
|
-
onVisibility:
|
|
3336
|
+
onVisibility: T,
|
|
3319
3337
|
onReorder: M
|
|
3320
|
-
}, null, 8, ["nodes", "catalog", "selected", "disabled"])
|
|
3338
|
+
}, null, 8, ["nodes", "catalog", "max", "selected", "disabled"])
|
|
3321
3339
|
]),
|
|
3322
|
-
|
|
3323
|
-
!e.disabled && (e.max === null ||
|
|
3340
|
+
V("div", ys, [
|
|
3341
|
+
!e.disabled && (e.max === null || m.value.length < e.max) ? (c(), O(n(ce), {
|
|
3324
3342
|
key: 0,
|
|
3325
3343
|
variant: "outline",
|
|
3326
3344
|
icon: "plus",
|
|
@@ -3328,84 +3346,84 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3328
3346
|
onClick: D[0] || (D[0] = (j) => Ee(null, null, null))
|
|
3329
3347
|
}, {
|
|
3330
3348
|
default: g(() => [
|
|
3331
|
-
L(
|
|
3349
|
+
L(w(n(a)("field.add")), 1)
|
|
3332
3350
|
]),
|
|
3333
3351
|
_: 1
|
|
3334
3352
|
})) : W("", !0),
|
|
3335
|
-
!z.value && n(x) && n(x).url.value ? (c(), O(n(
|
|
3353
|
+
!z.value && n(x) && n(x).url.value ? (c(), O(n(ce), {
|
|
3336
3354
|
key: 1,
|
|
3337
3355
|
variant: "outline",
|
|
3338
3356
|
icon: "eye",
|
|
3339
3357
|
class: "wx-blocks__preview-button",
|
|
3340
|
-
onClick: D[1] || (D[1] = (j) =>
|
|
3358
|
+
onClick: D[1] || (D[1] = (j) => U.value?.open())
|
|
3341
3359
|
}, {
|
|
3342
3360
|
default: g(() => [
|
|
3343
|
-
L(
|
|
3361
|
+
L(w(n(a)("field.preview")), 1)
|
|
3344
3362
|
]),
|
|
3345
3363
|
_: 1
|
|
3346
3364
|
})) : W("", !0)
|
|
3347
3365
|
])
|
|
3348
3366
|
])),
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
(c(!0), _(
|
|
3367
|
+
p.value ? (c(), _("div", ws, [
|
|
3368
|
+
V("div", xs, [
|
|
3369
|
+
V("span", _s, [
|
|
3370
|
+
y.value.length ? (c(), _("span", $s, [
|
|
3371
|
+
(c(!0), _(R, null, Y(y.value, (j) => (c(), _(R, {
|
|
3354
3372
|
key: j.key
|
|
3355
3373
|
}, [
|
|
3356
|
-
|
|
3374
|
+
V("button", {
|
|
3357
3375
|
type: "button",
|
|
3358
3376
|
class: "wx-blocks__trail-step",
|
|
3359
|
-
onClick: (
|
|
3360
|
-
},
|
|
3361
|
-
v(n(
|
|
3377
|
+
onClick: (Se) => q(j.key)
|
|
3378
|
+
}, w(j.title), 9, Ss),
|
|
3379
|
+
v(n(we), { name: "chevron-right" })
|
|
3362
3380
|
], 64))), 128))
|
|
3363
3381
|
])) : W("", !0),
|
|
3364
|
-
|
|
3382
|
+
V("span", Cs, w(h.value?.title ?? p.value.node.type), 1)
|
|
3365
3383
|
]),
|
|
3366
|
-
|
|
3367
|
-
z.value ? W("", !0) : (c(), _("code", Es,
|
|
3368
|
-
v(n(
|
|
3384
|
+
V("span", Ts, [
|
|
3385
|
+
z.value ? W("", !0) : (c(), _("code", Es, w(p.value.node.type), 1)),
|
|
3386
|
+
v(n(Ye), {
|
|
3369
3387
|
size: "sm",
|
|
3370
3388
|
tone: "neutral",
|
|
3371
3389
|
icon: "chevron-up",
|
|
3372
3390
|
title: n(a)("field.previous"),
|
|
3373
|
-
disabled:
|
|
3374
|
-
onClick: D[2] || (D[2] = (j) =>
|
|
3391
|
+
disabled: $.value.previous === null,
|
|
3392
|
+
onClick: D[2] || (D[2] = (j) => $.value.previous && q($.value.previous))
|
|
3375
3393
|
}, null, 8, ["title", "disabled"]),
|
|
3376
|
-
v(n(
|
|
3394
|
+
v(n(Ye), {
|
|
3377
3395
|
size: "sm",
|
|
3378
3396
|
tone: "neutral",
|
|
3379
3397
|
icon: "chevron-down",
|
|
3380
3398
|
title: n(a)("field.next"),
|
|
3381
|
-
disabled:
|
|
3382
|
-
onClick: D[3] || (D[3] = (j) =>
|
|
3399
|
+
disabled: $.value.next === null,
|
|
3400
|
+
onClick: D[3] || (D[3] = (j) => $.value.next && q($.value.next))
|
|
3383
3401
|
}, null, 8, ["title", "disabled"]),
|
|
3384
|
-
!z.value && n(x) && n(x).url.value ? (c(), O(n(
|
|
3402
|
+
!z.value && n(x) && n(x).url.value ? (c(), O(n(ce), {
|
|
3385
3403
|
key: 1,
|
|
3386
3404
|
size: "sm",
|
|
3387
3405
|
variant: "outline",
|
|
3388
3406
|
icon: "eye",
|
|
3389
3407
|
class: "wx-blocks__preview-button",
|
|
3390
3408
|
"aria-label": n(a)("field.preview"),
|
|
3391
|
-
onClick: D[4] || (D[4] = (j) =>
|
|
3409
|
+
onClick: D[4] || (D[4] = (j) => U.value?.open())
|
|
3392
3410
|
}, null, 8, ["aria-label"])) : W("", !0),
|
|
3393
|
-
v(n(
|
|
3411
|
+
v(n(ce), {
|
|
3394
3412
|
size: "sm",
|
|
3395
3413
|
variant: "outline",
|
|
3396
3414
|
onClick: be
|
|
3397
3415
|
}, {
|
|
3398
3416
|
default: g(() => [
|
|
3399
|
-
L(
|
|
3417
|
+
L(w(z.value ? n(a)("field.done") : `${n(a)("field.done")} · Esc`), 1)
|
|
3400
3418
|
]),
|
|
3401
3419
|
_: 1
|
|
3402
3420
|
})
|
|
3403
3421
|
])
|
|
3404
3422
|
]),
|
|
3405
|
-
|
|
3423
|
+
V("div", Vs, [
|
|
3406
3424
|
h.value?.content ? (c(), O(n(al), {
|
|
3407
|
-
key:
|
|
3408
|
-
"model-value":
|
|
3425
|
+
key: p.value.node.key,
|
|
3426
|
+
"model-value": p.value.node.values,
|
|
3409
3427
|
root: He.value,
|
|
3410
3428
|
types: te.value,
|
|
3411
3429
|
translate: ve.value,
|
|
@@ -3418,7 +3436,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3418
3436
|
tone: "danger"
|
|
3419
3437
|
}, {
|
|
3420
3438
|
default: g(() => [
|
|
3421
|
-
L(
|
|
3439
|
+
L(w(n(a)("field.unknown-type", { type: p.value.node.type })), 1)
|
|
3422
3440
|
]),
|
|
3423
3441
|
_: 1
|
|
3424
3442
|
}))
|
|
@@ -3430,9 +3448,9 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3430
3448
|
n(x) && n(x).url.value ? (c(), _("div", As, [
|
|
3431
3449
|
v(ns, {
|
|
3432
3450
|
ref_key: "previewEl",
|
|
3433
|
-
ref:
|
|
3451
|
+
ref: U,
|
|
3434
3452
|
url: n(x).url.value,
|
|
3435
|
-
selected:
|
|
3453
|
+
selected: d.value,
|
|
3436
3454
|
reload: n(x).reload?.value ?? 0,
|
|
3437
3455
|
compact: z.value,
|
|
3438
3456
|
onSelect: le,
|
|
@@ -3442,54 +3460,54 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3442
3460
|
], 2)
|
|
3443
3461
|
], 2));
|
|
3444
3462
|
}
|
|
3445
|
-
}), Ls = /* @__PURE__ */
|
|
3463
|
+
}), Ls = /* @__PURE__ */ ie(Bs, [["__scopeId", "data-v-67dd92e8"]]), Ws = { class: "wx-block-card__body" }, Ns = { class: "wx-block-card__title" }, zs = { class: "wx-block-card__chips" }, Ms = /* @__PURE__ */ ae({
|
|
3446
3464
|
__name: "BlockCard",
|
|
3447
3465
|
props: {
|
|
3448
3466
|
block: {},
|
|
3449
3467
|
module: { default: null }
|
|
3450
3468
|
},
|
|
3451
3469
|
emits: ["open"],
|
|
3452
|
-
setup(e, { emit:
|
|
3453
|
-
const
|
|
3470
|
+
setup(e, { emit: l }) {
|
|
3471
|
+
const t = l, o = de("webx-blocks");
|
|
3454
3472
|
return (a, i) => (c(), _("button", {
|
|
3455
3473
|
type: "button",
|
|
3456
3474
|
class: "wx-block-card",
|
|
3457
|
-
onClick: i[0] || (i[0] = (s) =>
|
|
3475
|
+
onClick: i[0] || (i[0] = (s) => t("open", e.block))
|
|
3458
3476
|
}, [
|
|
3459
3477
|
v($l, {
|
|
3460
3478
|
thumbnail: e.block.thumbnail,
|
|
3461
|
-
height: n(
|
|
3462
|
-
width: n(
|
|
3463
|
-
fit: n(
|
|
3479
|
+
height: n(ye)(e.block) === "component" ? 180 : 120,
|
|
3480
|
+
width: n(ye)(e.block) === "component" ? 360 : void 0,
|
|
3481
|
+
fit: n(ye)(e.block) === "component"
|
|
3464
3482
|
}, null, 8, ["thumbnail", "height", "width", "fit"]),
|
|
3465
|
-
|
|
3466
|
-
|
|
3483
|
+
V("div", Ws, [
|
|
3484
|
+
V("div", Ns, w(e.block.title), 1),
|
|
3467
3485
|
v(n(H), {
|
|
3468
3486
|
size: "sm",
|
|
3469
3487
|
tone: "muted"
|
|
3470
3488
|
}, {
|
|
3471
3489
|
default: g(() => [
|
|
3472
|
-
|
|
3490
|
+
V("code", null, w(e.block.slug), 1),
|
|
3473
3491
|
i[1] || (i[1] = L(" · ", -1)),
|
|
3474
|
-
n(
|
|
3475
|
-
L(
|
|
3476
|
-
e.module ? (c(), _(
|
|
3477
|
-
L("· " +
|
|
3492
|
+
n(ye)(e.block) === "component" ? (c(), _(R, { key: 0 }, [
|
|
3493
|
+
L(w(n(_l)(e.block.used_by?.length ?? 0, n(o))) + " ", 1),
|
|
3494
|
+
e.module ? (c(), _(R, { key: 0 }, [
|
|
3495
|
+
L("· " + w(n(o)("components.module", { module: e.module })), 1)
|
|
3478
3496
|
], 64)) : W("", !0)
|
|
3479
|
-
], 64)) : (c(), _(
|
|
3480
|
-
L(
|
|
3497
|
+
], 64)) : (c(), _(R, { key: 1 }, [
|
|
3498
|
+
L(w(n(xl)(e.block.usage_count, n(o))), 1)
|
|
3481
3499
|
], 64))
|
|
3482
3500
|
]),
|
|
3483
3501
|
_: 1
|
|
3484
3502
|
}),
|
|
3485
|
-
|
|
3503
|
+
V("div", zs, [
|
|
3486
3504
|
e.block.draft ? (c(), O(n(he), {
|
|
3487
3505
|
key: 0,
|
|
3488
3506
|
type: "warning",
|
|
3489
3507
|
dot: ""
|
|
3490
3508
|
}, {
|
|
3491
3509
|
default: g(() => [
|
|
3492
|
-
L(
|
|
3510
|
+
L(w(n(o)("page.draft", { number: e.block.draft.number })), 1)
|
|
3493
3511
|
]),
|
|
3494
3512
|
_: 1
|
|
3495
3513
|
})) : W("", !0),
|
|
@@ -3499,7 +3517,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3499
3517
|
dot: ""
|
|
3500
3518
|
}, {
|
|
3501
3519
|
default: g(() => [
|
|
3502
|
-
L(
|
|
3520
|
+
L(w(n(o)("page.live", { number: e.block.published.number })), 1)
|
|
3503
3521
|
]),
|
|
3504
3522
|
_: 1
|
|
3505
3523
|
})) : (c(), O(n(he), {
|
|
@@ -3507,17 +3525,17 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3507
3525
|
type: "default"
|
|
3508
3526
|
}, {
|
|
3509
3527
|
default: g(() => [
|
|
3510
|
-
L(
|
|
3528
|
+
L(w(n(o)("page.never-published")), 1)
|
|
3511
3529
|
]),
|
|
3512
3530
|
_: 1
|
|
3513
3531
|
})),
|
|
3514
|
-
!e.block.is_enabled && n(
|
|
3532
|
+
!e.block.is_enabled && n(ye)(e.block) !== "component" ? (c(), O(n(he), {
|
|
3515
3533
|
key: 3,
|
|
3516
3534
|
type: "default",
|
|
3517
3535
|
variant: "outline"
|
|
3518
3536
|
}, {
|
|
3519
3537
|
default: g(() => [
|
|
3520
|
-
L(
|
|
3538
|
+
L(w(n(o)("page.hidden")), 1)
|
|
3521
3539
|
]),
|
|
3522
3540
|
_: 1
|
|
3523
3541
|
})) : W("", !0)
|
|
@@ -3525,68 +3543,68 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3525
3543
|
])
|
|
3526
3544
|
]));
|
|
3527
3545
|
}
|
|
3528
|
-
}),
|
|
3546
|
+
}), Jt = /* @__PURE__ */ ie(Ms, [["__scopeId", "data-v-1d29dfee"]]), Os = { class: "wx-block-create" }, Ds = { class: "wx-block-create__kind" }, Is = { class: "wx-block-create__kind-help" }, Ps = { class: "wx-block-create__kind" }, Us = { class: "wx-block-create__kind-help" }, Rs = /* @__PURE__ */ ae({
|
|
3529
3547
|
__name: "BlockCreateDialog",
|
|
3530
3548
|
setup(e) {
|
|
3531
|
-
const { resolve:
|
|
3532
|
-
|
|
3533
|
-
const s =
|
|
3549
|
+
const { resolve: l, dismiss: t, open: o } = Qt(), a = lt(), i = Re(a);
|
|
3550
|
+
Ie();
|
|
3551
|
+
const s = de("webx-blocks"), u = nt(), f = S(() => a.state.manifest?.modules.find((x) => x.id === "blocks")?.meta?.groups ?? ["content"]), r = I({
|
|
3534
3552
|
kind: "block",
|
|
3535
3553
|
title: "",
|
|
3536
3554
|
slug: "",
|
|
3537
|
-
group:
|
|
3538
|
-
}),
|
|
3539
|
-
() =>
|
|
3555
|
+
group: f.value[0] ?? "content"
|
|
3556
|
+
}), m = I({}), d = I(!1), p = I(!1), h = S(
|
|
3557
|
+
() => f.value.map((y) => ({ value: y, label: je(y, s) }))
|
|
3540
3558
|
);
|
|
3541
|
-
function
|
|
3542
|
-
return
|
|
3559
|
+
function E(y) {
|
|
3560
|
+
return y.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/^[^a-z]+/, "").slice(0, 64);
|
|
3543
3561
|
}
|
|
3544
|
-
|
|
3562
|
+
se(
|
|
3545
3563
|
() => r.value.title,
|
|
3546
|
-
(
|
|
3547
|
-
|
|
3564
|
+
(y) => {
|
|
3565
|
+
p.value || (r.value.slug = E(y));
|
|
3548
3566
|
}
|
|
3549
3567
|
);
|
|
3550
|
-
function
|
|
3551
|
-
return
|
|
3568
|
+
function A(y) {
|
|
3569
|
+
return m.value[y]?.[0];
|
|
3552
3570
|
}
|
|
3553
|
-
async function
|
|
3554
|
-
|
|
3571
|
+
async function $() {
|
|
3572
|
+
d.value = !0, m.value = {};
|
|
3555
3573
|
try {
|
|
3556
|
-
const { group:
|
|
3557
|
-
|
|
3558
|
-
} catch (
|
|
3559
|
-
const x =
|
|
3560
|
-
x?.errors ?
|
|
3574
|
+
const { group: y, ...x } = r.value;
|
|
3575
|
+
l(await i.create(r.value.kind === "component" ? x : { ...x, group: y }));
|
|
3576
|
+
} catch (y) {
|
|
3577
|
+
const x = y.body;
|
|
3578
|
+
x?.errors ? m.value = x.errors : J.danger(u(y, s("page.failed")));
|
|
3561
3579
|
} finally {
|
|
3562
|
-
|
|
3580
|
+
d.value = !1;
|
|
3563
3581
|
}
|
|
3564
3582
|
}
|
|
3565
|
-
return (
|
|
3583
|
+
return (y, x) => (c(), O(n(Xt), {
|
|
3566
3584
|
open: n(o),
|
|
3567
|
-
"onUpdate:open": x[6] || (x[6] = (
|
|
3585
|
+
"onUpdate:open": x[6] || (x[6] = (U) => ll(o) ? o.value = U : null),
|
|
3568
3586
|
title: n(s)("page.new"),
|
|
3569
3587
|
width: 520
|
|
3570
3588
|
}, {
|
|
3571
3589
|
footer: g(() => [
|
|
3572
3590
|
v(n(Dl), { size: "sm" }, {
|
|
3573
3591
|
default: g(() => [
|
|
3574
|
-
v(n(
|
|
3592
|
+
v(n(ce), {
|
|
3575
3593
|
variant: "outline",
|
|
3576
|
-
onClick: x[5] || (x[5] = (
|
|
3594
|
+
onClick: x[5] || (x[5] = (U) => n(t)())
|
|
3577
3595
|
}, {
|
|
3578
3596
|
default: g(() => [
|
|
3579
|
-
L(
|
|
3597
|
+
L(w(n(s)("page.cancel")), 1)
|
|
3580
3598
|
]),
|
|
3581
3599
|
_: 1
|
|
3582
3600
|
}),
|
|
3583
|
-
v(n(
|
|
3601
|
+
v(n(ce), {
|
|
3584
3602
|
type: "primary",
|
|
3585
|
-
loading:
|
|
3586
|
-
onClick:
|
|
3603
|
+
loading: d.value,
|
|
3604
|
+
onClick: $
|
|
3587
3605
|
}, {
|
|
3588
3606
|
default: g(() => [
|
|
3589
|
-
L(
|
|
3607
|
+
L(w(n(s)("page.create")), 1)
|
|
3590
3608
|
]),
|
|
3591
3609
|
_: 1
|
|
3592
3610
|
}, 8, ["loading"])
|
|
@@ -3595,29 +3613,29 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3595
3613
|
})
|
|
3596
3614
|
]),
|
|
3597
3615
|
default: g(() => [
|
|
3598
|
-
|
|
3599
|
-
v(n(
|
|
3616
|
+
V("div", Os, [
|
|
3617
|
+
v(n(oe), {
|
|
3600
3618
|
label: n(s)("components.kind"),
|
|
3601
|
-
error:
|
|
3619
|
+
error: A("kind")
|
|
3602
3620
|
}, {
|
|
3603
3621
|
default: g(() => [
|
|
3604
3622
|
v(n(Ol), {
|
|
3605
3623
|
modelValue: r.value.kind,
|
|
3606
|
-
"onUpdate:modelValue": x[0] || (x[0] = (
|
|
3624
|
+
"onUpdate:modelValue": x[0] || (x[0] = (U) => r.value.kind = U),
|
|
3607
3625
|
class: "wx-block-create__kinds"
|
|
3608
3626
|
}, {
|
|
3609
3627
|
default: g(() => [
|
|
3610
3628
|
v(n(zt), { value: "block" }, {
|
|
3611
3629
|
default: g(() => [
|
|
3612
|
-
|
|
3613
|
-
|
|
3630
|
+
V("span", Ds, w(n(s)("components.kind-block")), 1),
|
|
3631
|
+
V("span", Is, w(n(s)("components.kind-block-help")), 1)
|
|
3614
3632
|
]),
|
|
3615
3633
|
_: 1
|
|
3616
3634
|
}),
|
|
3617
3635
|
v(n(zt), { value: "component" }, {
|
|
3618
3636
|
default: g(() => [
|
|
3619
|
-
|
|
3620
|
-
|
|
3637
|
+
V("span", Ps, w(n(s)("components.kind-component")), 1),
|
|
3638
|
+
V("span", Us, w(n(s)("components.kind-component-help")), 1)
|
|
3621
3639
|
]),
|
|
3622
3640
|
_: 1
|
|
3623
3641
|
})
|
|
@@ -3627,44 +3645,44 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3627
3645
|
]),
|
|
3628
3646
|
_: 1
|
|
3629
3647
|
}, 8, ["label", "error"]),
|
|
3630
|
-
v(n(
|
|
3648
|
+
v(n(oe), {
|
|
3631
3649
|
label: n(s)("page.title"),
|
|
3632
|
-
error:
|
|
3650
|
+
error: A("title")
|
|
3633
3651
|
}, {
|
|
3634
3652
|
default: g(() => [
|
|
3635
|
-
v(n(
|
|
3653
|
+
v(n(Xe), {
|
|
3636
3654
|
modelValue: r.value.title,
|
|
3637
|
-
"onUpdate:modelValue": x[1] || (x[1] = (
|
|
3655
|
+
"onUpdate:modelValue": x[1] || (x[1] = (U) => r.value.title = U),
|
|
3638
3656
|
autofocus: ""
|
|
3639
3657
|
}, null, 8, ["modelValue"])
|
|
3640
3658
|
]),
|
|
3641
3659
|
_: 1
|
|
3642
3660
|
}, 8, ["label", "error"]),
|
|
3643
|
-
v(n(
|
|
3661
|
+
v(n(oe), {
|
|
3644
3662
|
label: n(s)("page.identifier"),
|
|
3645
3663
|
help: n(s)("page.identifier-help"),
|
|
3646
|
-
error:
|
|
3664
|
+
error: A("slug")
|
|
3647
3665
|
}, {
|
|
3648
3666
|
default: g(() => [
|
|
3649
|
-
v(n(
|
|
3667
|
+
v(n(Xe), {
|
|
3650
3668
|
modelValue: r.value.slug,
|
|
3651
|
-
"onUpdate:modelValue": x[2] || (x[2] = (
|
|
3669
|
+
"onUpdate:modelValue": x[2] || (x[2] = (U) => r.value.slug = U),
|
|
3652
3670
|
placeholder: "hero",
|
|
3653
|
-
onInput: x[3] || (x[3] = (
|
|
3671
|
+
onInput: x[3] || (x[3] = (U) => p.value = !0)
|
|
3654
3672
|
}, null, 8, ["modelValue"])
|
|
3655
3673
|
]),
|
|
3656
3674
|
_: 1
|
|
3657
3675
|
}, 8, ["label", "help", "error"]),
|
|
3658
|
-
r.value.kind === "block" ? (c(), O(n(
|
|
3676
|
+
r.value.kind === "block" ? (c(), O(n(oe), {
|
|
3659
3677
|
key: 0,
|
|
3660
3678
|
label: n(s)("page.group"),
|
|
3661
3679
|
help: n(s)("page.group-help"),
|
|
3662
|
-
error:
|
|
3680
|
+
error: A("group")
|
|
3663
3681
|
}, {
|
|
3664
3682
|
default: g(() => [
|
|
3665
|
-
v(n(
|
|
3683
|
+
v(n(wt), {
|
|
3666
3684
|
modelValue: r.value.group,
|
|
3667
|
-
"onUpdate:modelValue": x[4] || (x[4] = (
|
|
3685
|
+
"onUpdate:modelValue": x[4] || (x[4] = (U) => r.value.group = U),
|
|
3668
3686
|
options: h.value
|
|
3669
3687
|
}, null, 8, ["modelValue", "options"])
|
|
3670
3688
|
]),
|
|
@@ -3675,13 +3693,13 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3675
3693
|
_: 1
|
|
3676
3694
|
}, 8, ["open", "title"]));
|
|
3677
3695
|
}
|
|
3678
|
-
}), js = /* @__PURE__ */
|
|
3696
|
+
}), js = /* @__PURE__ */ ie(Rs, [["__scopeId", "data-v-585106f0"]]), Fs = { class: "wx-block-declared" }, Hs = {
|
|
3679
3697
|
class: "wx-block-declared__mark",
|
|
3680
3698
|
"aria-hidden": "true"
|
|
3681
|
-
}, qs = { class: "wx-block-declared__body" },
|
|
3699
|
+
}, qs = { class: "wx-block-declared__body" }, Ks = { class: "wx-block-declared__title" }, Js = {
|
|
3682
3700
|
key: 1,
|
|
3683
3701
|
class: "wx-block-declared__actions"
|
|
3684
|
-
}, Ys = /* @__PURE__ */
|
|
3702
|
+
}, Ys = /* @__PURE__ */ ae({
|
|
3685
3703
|
__name: "BlockDeclaredCard",
|
|
3686
3704
|
props: {
|
|
3687
3705
|
declared: {},
|
|
@@ -3690,23 +3708,23 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3690
3708
|
busy: { type: Boolean, default: !1 }
|
|
3691
3709
|
},
|
|
3692
3710
|
emits: ["customise"],
|
|
3693
|
-
setup(e, { emit:
|
|
3694
|
-
const
|
|
3695
|
-
|
|
3696
|
-
const o =
|
|
3711
|
+
setup(e, { emit: l }) {
|
|
3712
|
+
const t = l;
|
|
3713
|
+
Ie();
|
|
3714
|
+
const o = de("webx-blocks");
|
|
3697
3715
|
return (a, i) => (c(), _("div", Fs, [
|
|
3698
|
-
|
|
3699
|
-
v(n(
|
|
3716
|
+
V("div", Hs, [
|
|
3717
|
+
v(n(we), { name: "sliders" })
|
|
3700
3718
|
]),
|
|
3701
|
-
|
|
3702
|
-
|
|
3719
|
+
V("div", qs, [
|
|
3720
|
+
V("div", Ks, w(e.declared.title), 1),
|
|
3703
3721
|
v(n(H), {
|
|
3704
3722
|
size: "sm",
|
|
3705
3723
|
tone: "muted"
|
|
3706
3724
|
}, {
|
|
3707
3725
|
default: g(() => [
|
|
3708
|
-
|
|
3709
|
-
L(" · " +
|
|
3726
|
+
V("code", null, w(e.declared.slug), 1),
|
|
3727
|
+
L(" · " + w(n(o)("components.standard", { module: e.module })), 1)
|
|
3710
3728
|
]),
|
|
3711
3729
|
_: 1
|
|
3712
3730
|
}),
|
|
@@ -3716,7 +3734,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3716
3734
|
tone: "muted"
|
|
3717
3735
|
}, {
|
|
3718
3736
|
default: g(() => [
|
|
3719
|
-
L(
|
|
3737
|
+
L(w(e.declared.description), 1)
|
|
3720
3738
|
]),
|
|
3721
3739
|
_: 1
|
|
3722
3740
|
})) : W("", !0),
|
|
@@ -3726,18 +3744,18 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3726
3744
|
class: "wx-block-declared__help"
|
|
3727
3745
|
}, {
|
|
3728
3746
|
default: g(() => [
|
|
3729
|
-
L(
|
|
3747
|
+
L(w(n(o)("components.standard-help")), 1)
|
|
3730
3748
|
]),
|
|
3731
3749
|
_: 1
|
|
3732
3750
|
}),
|
|
3733
|
-
e.canManage ? (c(), _("div",
|
|
3734
|
-
v(n(
|
|
3751
|
+
e.canManage ? (c(), _("div", Js, [
|
|
3752
|
+
v(n(ce), {
|
|
3735
3753
|
size: "sm",
|
|
3736
3754
|
loading: e.busy,
|
|
3737
|
-
onClick: i[0] || (i[0] = (s) =>
|
|
3755
|
+
onClick: i[0] || (i[0] = (s) => t("customise", e.declared))
|
|
3738
3756
|
}, {
|
|
3739
3757
|
default: g(() => [
|
|
3740
|
-
L(
|
|
3758
|
+
L(w(n(o)("components.customise")), 1)
|
|
3741
3759
|
]),
|
|
3742
3760
|
_: 1
|
|
3743
3761
|
}, 8, ["loading"])
|
|
@@ -3745,7 +3763,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3745
3763
|
])
|
|
3746
3764
|
]));
|
|
3747
3765
|
}
|
|
3748
|
-
}), Gs = /* @__PURE__ */
|
|
3766
|
+
}), Gs = /* @__PURE__ */ ie(Ys, [["__scopeId", "data-v-3c4079a4"]]), Zs = {
|
|
3749
3767
|
key: 1,
|
|
3750
3768
|
class: "wx-blocks-page__toolbar"
|
|
3751
3769
|
}, Qs = { class: "wx-blocks-page__cards" }, Xs = { class: "wx-blocks-page__ghost-body" }, ea = {
|
|
@@ -3757,116 +3775,116 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3757
3775
|
}, na = {
|
|
3758
3776
|
key: 0,
|
|
3759
3777
|
class: "wx-blocks-page__group-title"
|
|
3760
|
-
}, oa = { class: "wx-blocks-page__cards" }, Ke = "@components", sa = /* @__PURE__ */
|
|
3778
|
+
}, oa = { class: "wx-blocks-page__cards" }, Ke = "@components", sa = /* @__PURE__ */ ae({
|
|
3761
3779
|
__name: "BlocksPage",
|
|
3762
3780
|
props: {
|
|
3763
3781
|
base: { default: "/blocks" }
|
|
3764
3782
|
},
|
|
3765
3783
|
setup(e) {
|
|
3766
|
-
const
|
|
3767
|
-
|
|
3768
|
-
const i =
|
|
3769
|
-
const b =
|
|
3784
|
+
const l = e, t = lt(), o = Re(t), a = sl();
|
|
3785
|
+
Ie();
|
|
3786
|
+
const i = de("webx-blocks"), s = nt(), u = I([]), f = I([]), r = I(!0), m = I(""), d = I(""), p = I(null), h = tl(js), E = S(() => {
|
|
3787
|
+
const b = t.state.manifest?.modules.find((T) => T.id === "blocks")?.meta;
|
|
3770
3788
|
return {
|
|
3771
3789
|
groups: b?.groups ?? [],
|
|
3772
3790
|
editing: b?.editing ?? !0,
|
|
3773
3791
|
provides: b?.provides ?? []
|
|
3774
3792
|
};
|
|
3775
|
-
}),
|
|
3776
|
-
() =>
|
|
3777
|
-
),
|
|
3793
|
+
}), A = S(() => t.can("blocks.manage") && E.value.editing), $ = S(
|
|
3794
|
+
() => t.state.manifest?.modules.find((b) => b.id === "blocks")?.title ?? i("module.title")
|
|
3795
|
+
), y = S(() => u.value.filter((b) => ye(b) === "block")), x = S(() => u.value.filter((b) => ye(b) === "component")), U = S(() => f.value.filter((b) => !b.customised)), Z = S(() => x.value.length > 0 || U.value.length > 0);
|
|
3778
3796
|
function G(b) {
|
|
3779
|
-
return
|
|
3797
|
+
return t.state.manifest?.modules.find((T) => T.id === b)?.title ?? b.charAt(0).toUpperCase() + b.slice(1);
|
|
3780
3798
|
}
|
|
3781
|
-
function
|
|
3782
|
-
const
|
|
3783
|
-
return
|
|
3799
|
+
function re(b) {
|
|
3800
|
+
const T = f.value.find((M) => M.slug === b);
|
|
3801
|
+
return T ? G(T.module) : null;
|
|
3784
3802
|
}
|
|
3785
3803
|
function z(b) {
|
|
3786
|
-
const
|
|
3787
|
-
return
|
|
3804
|
+
const T = m.value.trim().toLowerCase();
|
|
3805
|
+
return T === "" || b.some((M) => (M ?? "").toLowerCase().includes(T));
|
|
3788
3806
|
}
|
|
3789
|
-
const P = S(() =>
|
|
3790
|
-
() =>
|
|
3807
|
+
const P = S(() => d.value === Ke ? [] : (d.value === "" ? y.value : y.value.filter((T) => T.group === d.value)).filter((T) => z([T.title, T.slug, T.description]))), Q = S(
|
|
3808
|
+
() => d.value === "" || d.value === Ke ? x.value.filter((b) => z([b.title, b.slug, b.description])) : []
|
|
3791
3809
|
), X = S(
|
|
3792
|
-
() =>
|
|
3793
|
-
),
|
|
3794
|
-
const b = [
|
|
3795
|
-
for (const
|
|
3796
|
-
b.includes(
|
|
3797
|
-
return b.filter((
|
|
3798
|
-
}),
|
|
3799
|
-
const b =
|
|
3800
|
-
return b.length +
|
|
3810
|
+
() => d.value === "" || d.value === Ke ? U.value.filter((b) => z([b.title, b.slug, b.description])) : []
|
|
3811
|
+
), xe = S(() => {
|
|
3812
|
+
const b = [...E.value.groups];
|
|
3813
|
+
for (const T of y.value)
|
|
3814
|
+
b.includes(T.group) || b.push(T.group);
|
|
3815
|
+
return b.filter((T) => y.value.some((M) => M.group === T));
|
|
3816
|
+
}), ue = S(() => {
|
|
3817
|
+
const b = xe.value.map((M) => ({ value: M, label: je(M, i) })), T = Z.value ? [{ value: Ke, label: i("components.components") }] : [];
|
|
3818
|
+
return b.length + T.length < 2 ? [] : [{ value: "", label: i("page.all-groups") }, ...b, ...T];
|
|
3801
3819
|
}), te = S(() => {
|
|
3802
|
-
const b =
|
|
3820
|
+
const b = xe.value.map((q) => ({
|
|
3803
3821
|
id: q,
|
|
3804
3822
|
label: je(q, i),
|
|
3805
3823
|
blocks: P.value.filter((le) => le.group === q)
|
|
3806
3824
|
})).filter((q) => q.blocks.length > 0);
|
|
3807
|
-
return
|
|
3825
|
+
return d.value !== "" || P.value.length <= 5 || m.value.trim() !== "" || b.length < 2 ? P.value.length === 0 ? [] : [{ id: "", label: d.value === "" && Q.value.length + X.value.length > 0 ? i("components.blocks") : "", blocks: P.value }] : b;
|
|
3808
3826
|
}), ve = S(
|
|
3809
|
-
() =>
|
|
3810
|
-
), Te = S(() => u.value.length === 0 &&
|
|
3811
|
-
async function
|
|
3827
|
+
() => d.value === Ke || P.value.length === 0 ? "" : i("components.components")
|
|
3828
|
+
), Te = S(() => u.value.length === 0 && U.value.length === 0);
|
|
3829
|
+
async function Le() {
|
|
3812
3830
|
r.value = !0;
|
|
3813
3831
|
try {
|
|
3814
3832
|
const b = await o.index();
|
|
3815
|
-
u.value = b.blocks,
|
|
3833
|
+
u.value = b.blocks, f.value = b.declared;
|
|
3816
3834
|
} catch (b) {
|
|
3817
|
-
|
|
3835
|
+
J.danger(s(b));
|
|
3818
3836
|
} finally {
|
|
3819
3837
|
r.value = !1;
|
|
3820
3838
|
}
|
|
3821
3839
|
}
|
|
3822
|
-
function
|
|
3823
|
-
a.push(`${
|
|
3840
|
+
function K(b) {
|
|
3841
|
+
a.push(`${l.base}/${b.id}`);
|
|
3824
3842
|
}
|
|
3825
3843
|
async function Ee() {
|
|
3826
3844
|
const b = await h({});
|
|
3827
|
-
b &&
|
|
3845
|
+
b && K(b);
|
|
3828
3846
|
}
|
|
3829
|
-
async function
|
|
3830
|
-
|
|
3847
|
+
async function _e(b) {
|
|
3848
|
+
p.value = b.slug;
|
|
3831
3849
|
try {
|
|
3832
|
-
const
|
|
3833
|
-
|
|
3834
|
-
} catch (
|
|
3835
|
-
const M =
|
|
3836
|
-
if (
|
|
3837
|
-
|
|
3850
|
+
const T = await o.customise(b.slug);
|
|
3851
|
+
J.success(i("components.customised")), K(T);
|
|
3852
|
+
} catch (T) {
|
|
3853
|
+
const M = T.body;
|
|
3854
|
+
if (T.status === 409 && typeof M?.id == "number") {
|
|
3855
|
+
K({ id: M.id });
|
|
3838
3856
|
return;
|
|
3839
3857
|
}
|
|
3840
|
-
|
|
3858
|
+
J.danger(s(T, i("components.customise-failed")));
|
|
3841
3859
|
} finally {
|
|
3842
|
-
|
|
3860
|
+
p.value = null;
|
|
3843
3861
|
}
|
|
3844
3862
|
}
|
|
3845
|
-
|
|
3846
|
-
const
|
|
3847
|
-
() =>
|
|
3863
|
+
et(Le);
|
|
3864
|
+
const $e = S(
|
|
3865
|
+
() => A.value ? [{ key: "new", label: i("page.new"), icon: "plus", primary: !0, run: () => {
|
|
3848
3866
|
Ee();
|
|
3849
3867
|
} }] : []
|
|
3850
3868
|
);
|
|
3851
|
-
return (b,
|
|
3852
|
-
view:
|
|
3853
|
-
"onUpdate:view":
|
|
3869
|
+
return (b, T) => (c(), O(n(Xl), {
|
|
3870
|
+
view: d.value,
|
|
3871
|
+
"onUpdate:view": T[1] || (T[1] = (M) => d.value = M),
|
|
3854
3872
|
class: "wx-blocks-page",
|
|
3855
|
-
title:
|
|
3856
|
-
views:
|
|
3857
|
-
actions:
|
|
3873
|
+
title: $.value,
|
|
3874
|
+
views: ue.value,
|
|
3875
|
+
actions: $e.value
|
|
3858
3876
|
}, {
|
|
3859
3877
|
default: g(() => [
|
|
3860
|
-
|
|
3878
|
+
E.value.editing ? W("", !0) : (c(), O(n(Gt), {
|
|
3861
3879
|
key: 0,
|
|
3862
3880
|
type: "info",
|
|
3863
3881
|
variant: "soft",
|
|
3864
3882
|
description: n(i)("page.editing-off")
|
|
3865
3883
|
}, null, 8, ["description"])),
|
|
3866
3884
|
r.value || !Te.value ? (c(), _("div", Zs, [
|
|
3867
|
-
v(n(
|
|
3868
|
-
modelValue:
|
|
3869
|
-
"onUpdate:modelValue":
|
|
3885
|
+
v(n(Xe), {
|
|
3886
|
+
modelValue: m.value,
|
|
3887
|
+
"onUpdate:modelValue": T[0] || (T[0] = (M) => m.value = M),
|
|
3870
3888
|
class: "wx-blocks-page__search",
|
|
3871
3889
|
placeholder: n(i)("page.search"),
|
|
3872
3890
|
clearable: ""
|
|
@@ -3874,8 +3892,8 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3874
3892
|
])) : W("", !0),
|
|
3875
3893
|
r.value ? (c(), O(n(Ue), { key: 2 }, {
|
|
3876
3894
|
template: g(() => [
|
|
3877
|
-
|
|
3878
|
-
(c(), _(
|
|
3895
|
+
V("div", Qs, [
|
|
3896
|
+
(c(), _(R, null, Y(4, (M) => V("div", {
|
|
3879
3897
|
key: M,
|
|
3880
3898
|
class: "wx-blocks-page__ghost"
|
|
3881
3899
|
}, [
|
|
@@ -3884,7 +3902,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3884
3902
|
height: 120,
|
|
3885
3903
|
class: "wx-blocks-page__ghost-thumb"
|
|
3886
3904
|
}),
|
|
3887
|
-
|
|
3905
|
+
V("div", Xs, [
|
|
3888
3906
|
v(n(it), {
|
|
3889
3907
|
variant: "title",
|
|
3890
3908
|
width: "45%"
|
|
@@ -3908,36 +3926,36 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3908
3926
|
icon: "grid",
|
|
3909
3927
|
title: n(i)("page.empty"),
|
|
3910
3928
|
description: n(i)("page.empty-help")
|
|
3911
|
-
}, null, 8, ["title", "description"])) : (c(), _(
|
|
3912
|
-
(c(!0), _(
|
|
3929
|
+
}, null, 8, ["title", "description"])) : (c(), _(R, { key: 4 }, [
|
|
3930
|
+
(c(!0), _(R, null, Y(te.value, (M) => (c(), _("section", {
|
|
3913
3931
|
key: M.id,
|
|
3914
3932
|
class: "wx-blocks-page__group"
|
|
3915
3933
|
}, [
|
|
3916
|
-
M.label ? (c(), _("div", ea,
|
|
3917
|
-
|
|
3918
|
-
(c(!0), _(
|
|
3934
|
+
M.label ? (c(), _("div", ea, w(M.label), 1)) : W("", !0),
|
|
3935
|
+
V("div", ta, [
|
|
3936
|
+
(c(!0), _(R, null, Y(M.blocks, (q) => (c(), O(Jt, {
|
|
3919
3937
|
key: q.id,
|
|
3920
3938
|
block: q,
|
|
3921
|
-
onOpen:
|
|
3939
|
+
onOpen: K
|
|
3922
3940
|
}, null, 8, ["block"]))), 128))
|
|
3923
3941
|
])
|
|
3924
3942
|
]))), 128)),
|
|
3925
3943
|
Q.value.length > 0 || X.value.length > 0 ? (c(), _("section", la, [
|
|
3926
|
-
ve.value ? (c(), _("div", na,
|
|
3927
|
-
|
|
3928
|
-
(c(!0), _(
|
|
3944
|
+
ve.value ? (c(), _("div", na, w(ve.value), 1)) : W("", !0),
|
|
3945
|
+
V("div", oa, [
|
|
3946
|
+
(c(!0), _(R, null, Y(Q.value, (M) => (c(), O(Jt, {
|
|
3929
3947
|
key: M.id,
|
|
3930
3948
|
block: M,
|
|
3931
|
-
module:
|
|
3932
|
-
onOpen:
|
|
3949
|
+
module: re(M.slug),
|
|
3950
|
+
onOpen: K
|
|
3933
3951
|
}, null, 8, ["block", "module"]))), 128)),
|
|
3934
|
-
(c(!0), _(
|
|
3952
|
+
(c(!0), _(R, null, Y(X.value, (M) => (c(), O(Gs, {
|
|
3935
3953
|
key: M.slug,
|
|
3936
3954
|
declared: M,
|
|
3937
3955
|
module: G(M.module),
|
|
3938
|
-
"can-manage":
|
|
3939
|
-
busy:
|
|
3940
|
-
onCustomise:
|
|
3956
|
+
"can-manage": A.value,
|
|
3957
|
+
busy: p.value === M.slug,
|
|
3958
|
+
onCustomise: _e
|
|
3941
3959
|
}, null, 8, ["declared", "module", "can-manage", "busy"]))), 128))
|
|
3942
3960
|
])
|
|
3943
3961
|
])) : W("", !0)
|
|
@@ -3946,19 +3964,19 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
|
|
|
3946
3964
|
_: 1
|
|
3947
3965
|
}, 8, ["view", "title", "views", "actions"]));
|
|
3948
3966
|
}
|
|
3949
|
-
}), aa = /* @__PURE__ */
|
|
3967
|
+
}), aa = /* @__PURE__ */ ie(sa, [["__scopeId", "data-v-02ee019d"]]);
|
|
3950
3968
|
function ba(e = {}) {
|
|
3951
|
-
const
|
|
3969
|
+
const l = e.path ?? "/blocks";
|
|
3952
3970
|
return {
|
|
3953
3971
|
id: "blocks",
|
|
3954
|
-
path:
|
|
3972
|
+
path: l,
|
|
3955
3973
|
routes: [
|
|
3956
|
-
{ path:
|
|
3974
|
+
{ path: l, name: "webx.blocks", component: aa, props: { base: l } },
|
|
3957
3975
|
{
|
|
3958
|
-
path: `${
|
|
3976
|
+
path: `${l}/:id(\\d+)`,
|
|
3959
3977
|
name: "webx.blocks.edit",
|
|
3960
3978
|
component: Po,
|
|
3961
|
-
props: { base:
|
|
3979
|
+
props: { base: l }
|
|
3962
3980
|
}
|
|
3963
3981
|
],
|
|
3964
3982
|
// What a screen means by `wx-blocks`: the content of an entity as a tree of blocks. A
|
|
@@ -3970,7 +3988,7 @@ function ba(e = {}) {
|
|
|
3970
3988
|
kind: "field",
|
|
3971
3989
|
nested: !0,
|
|
3972
3990
|
wide: !0,
|
|
3973
|
-
bind: () => ({ blocksPath:
|
|
3991
|
+
bind: () => ({ blocksPath: l })
|
|
3974
3992
|
},
|
|
3975
3993
|
// The two inputs only a component's schema has (§3.3): a structure passed from code,
|
|
3976
3994
|
// edited in the sample form as the JSON it is, and a piece of markup the caller puts
|
|
@@ -3993,22 +4011,22 @@ export {
|
|
|
3993
4011
|
aa as WxBlocksPage,
|
|
3994
4012
|
ba as blocks,
|
|
3995
4013
|
on as blocksMessages,
|
|
3996
|
-
|
|
4014
|
+
At as blocksPreviewKey,
|
|
3997
4015
|
bo as callTag,
|
|
3998
4016
|
ml as cloneNode,
|
|
3999
4017
|
An as countType,
|
|
4000
4018
|
Re as createBlocksApi,
|
|
4001
4019
|
il as findRange,
|
|
4002
|
-
|
|
4003
|
-
|
|
4020
|
+
Et as formSchema,
|
|
4021
|
+
bt as highlightBlock,
|
|
4004
4022
|
jt as insertNode,
|
|
4005
4023
|
dl as isNode,
|
|
4006
4024
|
ft as isNodeList,
|
|
4007
|
-
|
|
4025
|
+
ye as kindOf,
|
|
4008
4026
|
fo as lintBlock,
|
|
4009
4027
|
me as locate,
|
|
4010
4028
|
Vn as makeNode,
|
|
4011
|
-
|
|
4029
|
+
$t as newKey,
|
|
4012
4030
|
ha as provideBlocksPreview,
|
|
4013
4031
|
Nn as removeNode,
|
|
4014
4032
|
rl as replaceBlock,
|
|
@@ -4018,6 +4036,6 @@ export {
|
|
|
4018
4036
|
mo as undeclared,
|
|
4019
4037
|
zn as updateValues,
|
|
4020
4038
|
va as useBlocksPreview,
|
|
4021
|
-
|
|
4039
|
+
ot as walk
|
|
4022
4040
|
};
|
|
4023
4041
|
//# sourceMappingURL=index.js.map
|