@webx-ui/module-blocks 0.10.0 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +668 -663
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { WxCodeEditor as Qe, WxText as J, WxIcon as
|
|
2
|
-
import { defineComponent as oe, ref as U, watch as
|
|
3
|
-
import { useAdmin as at, useTranslate as
|
|
1
|
+
import { WxCodeEditor as Qe, WxText as J, WxIcon as ye, WxSkeleton as He, WxBadge as ke, WxButton as ce, confirm as vt, toast as X, useElementWidth as bt, WxSegmented as sl, WxCard as De, WxPopover as Wl, WxAlert as al, WxTabs as Ml, WxTab as Re, WxFormItem as re, WxSelect as $t, WxInput as nt, WxTextarea as il, WxIconPicker as Nl, WxInputNumber as jt, WxTagsInput as Ft, WxSwitch as zl, WxActionBar as Dl, useModal as At, WxDialog as Bt, WxEmpty as Lt, WxAction as et, WxSortableList as Ol, createModal as St, WxDrawer as Il, WxRadioGroup as Ul, WxRadio as Ht, WxSpace as Pl, WxSkeletonItem as pt } from "@webx-ui/core";
|
|
2
|
+
import { defineComponent as oe, ref as U, watch as ue, openBlock as c, createElementBlock as w, createVNode as v, unref as n, createBlock as W, withCtx as g, createTextVNode as B, toDisplayString as k, createCommentVNode as L, computed as S, createElementVNode as E, Fragment as F, renderList as Z, onMounted as ot, onBeforeUnmount as st, normalizeStyle as Ie, provide as Wt, inject as Fe, reactive as gt, resolveComponent as Mt, normalizeClass as Me, withDirectives as Rl, vShow as jl, isRef as Nt, watchEffect as Fl, nextTick as Hl, withKeys as Kt, withModifiers as qt, useModel as Kl, getCurrentInstance as ql, resolveDynamicComponent as Jl, mergeProps as Yl, mergeModels as Gl } from "vue";
|
|
3
|
+
import { useAdmin as at, useTranslate as de, useErrorText as it, WxDate as Zl, WxScreenHead as Xl, WxRenameButton as Ql, WxHelpButton as en, adminKey as rl, WxRowMenu as tn, WxListScreen as ln } from "@webx-ui/module-admin";
|
|
4
4
|
import { useRoute as nn, useRouter as ul } from "vue-router";
|
|
5
5
|
import { WxScreenRenderer as cl, coreTypes as ft } from "@webx-ui/schema";
|
|
6
|
-
import { autocompletion as on, pickedCompletion as Je, snippetCompletion as
|
|
6
|
+
import { autocompletion as on, pickedCompletion as Je, snippetCompletion as _e, startCompletion as sn } from "@codemirror/autocomplete";
|
|
7
7
|
import { EditorState as an } from "@codemirror/state";
|
|
8
8
|
import { VueDraggable as rn } from "vue-draggable-plus";
|
|
9
9
|
const un = {
|
|
@@ -207,7 +207,7 @@ const un = {
|
|
|
207
207
|
"ok-variables": "Every variable of the template is a field of the schema."
|
|
208
208
|
}
|
|
209
209
|
}, Jt = /* @__PURE__ */ new WeakSet();
|
|
210
|
-
function
|
|
210
|
+
function Ne() {
|
|
211
211
|
try {
|
|
212
212
|
const { i18n: e } = at();
|
|
213
213
|
Jt.has(e) || (e.defaults("webx-blocks", un), Jt.add(e));
|
|
@@ -224,8 +224,8 @@ const cn = { class: "wx-block-data" }, dn = /* @__PURE__ */ oe({
|
|
|
224
224
|
emits: ["update:modelValue"],
|
|
225
225
|
setup(e, { emit: l }) {
|
|
226
226
|
const t = e, o = l;
|
|
227
|
-
|
|
228
|
-
const a =
|
|
227
|
+
Ne();
|
|
228
|
+
const a = de("webx-blocks"), i = U(r(t.modelValue)), s = U(null);
|
|
229
229
|
function r(m) {
|
|
230
230
|
return m == null ? "" : JSON.stringify(m, null, 2);
|
|
231
231
|
}
|
|
@@ -241,7 +241,7 @@ const cn = { class: "wx-block-data" }, dn = /* @__PURE__ */ oe({
|
|
|
241
241
|
s.value = a("components.data-invalid", { error: d.message });
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
return
|
|
244
|
+
return ue(
|
|
245
245
|
() => t.modelValue,
|
|
246
246
|
(m) => {
|
|
247
247
|
let d = !1;
|
|
@@ -316,14 +316,14 @@ const fn = { class: "wx-block-checks" }, mn = {
|
|
|
316
316
|
error: {}
|
|
317
317
|
},
|
|
318
318
|
setup(e) {
|
|
319
|
-
const l = e, t =
|
|
319
|
+
const l = e, t = de("webx-blocks"), o = S(() => l.lints.filter((i) => i.file === l.file)), a = S(() => {
|
|
320
320
|
const i = new Set(o.value.map((r) => r.code)), s = [];
|
|
321
321
|
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;
|
|
322
322
|
});
|
|
323
323
|
return (i, s) => (c(), w("div", fn, [
|
|
324
324
|
e.error ? (c(), w("div", mn, [
|
|
325
|
-
v(n(
|
|
326
|
-
|
|
325
|
+
v(n(ye), { name: "close-circle" }),
|
|
326
|
+
E("span", null, [
|
|
327
327
|
B(k(e.error.message) + " ", 1),
|
|
328
328
|
e.error.line !== null ? (c(), w(F, { key: 0 }, [
|
|
329
329
|
B(" · " + k(n(t)("page.line", { line: e.error.line })), 1)
|
|
@@ -333,24 +333,24 @@ const fn = { class: "wx-block-checks" }, mn = {
|
|
|
333
333
|
], 64)) : L("", !0)
|
|
334
334
|
])
|
|
335
335
|
])) : L("", !0),
|
|
336
|
-
(c(!0), w(F, null,
|
|
336
|
+
(c(!0), w(F, null, Z(o.value, (r) => (c(), w("div", {
|
|
337
337
|
key: r.code,
|
|
338
338
|
class: "wx-block-checks__line is-warning"
|
|
339
339
|
}, [
|
|
340
|
-
v(n(
|
|
341
|
-
|
|
340
|
+
v(n(ye), { name: "warning" }),
|
|
341
|
+
E("span", null, [
|
|
342
342
|
B(k(r.message) + " ", 1),
|
|
343
343
|
r.line !== null ? (c(), w(F, { key: 0 }, [
|
|
344
344
|
B(" · " + k(n(t)("page.line", { line: r.line })), 1)
|
|
345
345
|
], 64)) : L("", !0)
|
|
346
346
|
])
|
|
347
347
|
]))), 128)),
|
|
348
|
-
(c(!0), w(F, null,
|
|
348
|
+
(c(!0), w(F, null, Z(a.value, (r) => (c(), w("div", {
|
|
349
349
|
key: r,
|
|
350
350
|
class: "wx-block-checks__line is-ok"
|
|
351
351
|
}, [
|
|
352
|
-
v(n(
|
|
353
|
-
|
|
352
|
+
v(n(ye), { name: "check" }),
|
|
353
|
+
E("span", null, k(r), 1)
|
|
354
354
|
]))), 128))
|
|
355
355
|
]));
|
|
356
356
|
}
|
|
@@ -362,7 +362,7 @@ const fn = { class: "wx-block-checks" }, mn = {
|
|
|
362
362
|
},
|
|
363
363
|
emits: ["restored"],
|
|
364
364
|
setup(e, { emit: l }) {
|
|
365
|
-
const t = e, o = l, a = at(), i = Ke(a), s =
|
|
365
|
+
const t = e, o = l, a = at(), i = Ke(a), s = de("webx-blocks"), r = it(), p = U(null);
|
|
366
366
|
async function u() {
|
|
367
367
|
p.value = await i.versions(t.block.id);
|
|
368
368
|
}
|
|
@@ -378,12 +378,12 @@ const fn = { class: "wx-block-checks" }, mn = {
|
|
|
378
378
|
}))
|
|
379
379
|
try {
|
|
380
380
|
const x = await i.restore(t.block.id, f.number);
|
|
381
|
-
|
|
381
|
+
X.success(s("page.restored", { number: x.draft?.number ?? f.number })), o("restored", x), await u();
|
|
382
382
|
} catch (x) {
|
|
383
|
-
|
|
383
|
+
X.danger(r(x));
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
return ot(u),
|
|
386
|
+
return ot(u), ue(
|
|
387
387
|
() => [t.block.draft?.number, t.block.published?.number],
|
|
388
388
|
() => {
|
|
389
389
|
u();
|
|
@@ -393,12 +393,12 @@ const fn = { class: "wx-block-checks" }, mn = {
|
|
|
393
393
|
key: 0,
|
|
394
394
|
class: "wx-block-history__ghost",
|
|
395
395
|
rows: 3
|
|
396
|
-
})) : (c(!0), w(F, { key: 1 },
|
|
396
|
+
})) : (c(!0), w(F, { key: 1 }, Z(p.value, (x) => (c(), w("div", {
|
|
397
397
|
key: x.number,
|
|
398
398
|
class: "wx-block-history__row"
|
|
399
399
|
}, [
|
|
400
|
-
|
|
401
|
-
|
|
400
|
+
E("code", bn, k(n(s)("page.version", { number: x.number })), 1),
|
|
401
|
+
E("div", gn, [
|
|
402
402
|
v(n(J), null, {
|
|
403
403
|
default: g(() => [
|
|
404
404
|
B(k(n(s)(`page.version-${m(x)}`)), 1)
|
|
@@ -422,7 +422,7 @@ const fn = { class: "wx-block-checks" }, mn = {
|
|
|
422
422
|
_: 2
|
|
423
423
|
}, 1024)
|
|
424
424
|
]),
|
|
425
|
-
m(x) === "draft" ? (c(), W(n(
|
|
425
|
+
m(x) === "draft" ? (c(), W(n(ke), {
|
|
426
426
|
key: 0,
|
|
427
427
|
type: "warning",
|
|
428
428
|
dot: ""
|
|
@@ -431,7 +431,7 @@ const fn = { class: "wx-block-checks" }, mn = {
|
|
|
431
431
|
B(k(n(s)("page.version-draft")), 1)
|
|
432
432
|
]),
|
|
433
433
|
_: 1
|
|
434
|
-
})) : m(x) === "live" ? (c(), W(n(
|
|
434
|
+
})) : m(x) === "live" ? (c(), W(n(ke), {
|
|
435
435
|
key: 1,
|
|
436
436
|
type: "success",
|
|
437
437
|
dot: ""
|
|
@@ -441,11 +441,11 @@ const fn = { class: "wx-block-checks" }, mn = {
|
|
|
441
441
|
]),
|
|
442
442
|
_: 1
|
|
443
443
|
})) : L("", !0),
|
|
444
|
-
e.canManage && m(x) === "replaced" ? (c(), W(n(
|
|
444
|
+
e.canManage && m(x) === "replaced" ? (c(), W(n(ce), {
|
|
445
445
|
key: 2,
|
|
446
446
|
size: "sm",
|
|
447
447
|
variant: "outline",
|
|
448
|
-
onClick: (
|
|
448
|
+
onClick: (T) => d(x)
|
|
449
449
|
}, {
|
|
450
450
|
default: g(() => [
|
|
451
451
|
B(k(n(s)("page.restore")), 1)
|
|
@@ -538,7 +538,7 @@ function wn(e, l) {
|
|
|
538
538
|
let t = null;
|
|
539
539
|
function o(s) {
|
|
540
540
|
const r = Xt(s.target);
|
|
541
|
-
r === null ? lt(s) :
|
|
541
|
+
r === null ? lt(s) : Oe(s), l.select(r);
|
|
542
542
|
}
|
|
543
543
|
function a(s) {
|
|
544
544
|
const r = Xt(s.target);
|
|
@@ -547,13 +547,13 @@ function wn(e, l) {
|
|
|
547
547
|
function i() {
|
|
548
548
|
t = null, Zt(e, null);
|
|
549
549
|
}
|
|
550
|
-
return e.addEventListener("click", o, !0), e.addEventListener("auxclick", lt, !0), e.addEventListener("submit",
|
|
550
|
+
return e.addEventListener("click", o, !0), e.addEventListener("auxclick", lt, !0), e.addEventListener("submit", Oe, !0), e.addEventListener("dragstart", Oe, !0), e.addEventListener("mousemove", a, !0), e.addEventListener("mouseleave", i), {
|
|
551
551
|
release() {
|
|
552
|
-
e.removeEventListener("click", o, !0), e.removeEventListener("auxclick", lt, !0), e.removeEventListener("submit",
|
|
552
|
+
e.removeEventListener("click", o, !0), e.removeEventListener("auxclick", lt, !0), e.removeEventListener("submit", Oe, !0), e.removeEventListener("dragstart", Oe, !0), e.removeEventListener("mousemove", a, !0), e.removeEventListener("mouseleave", i);
|
|
553
553
|
}
|
|
554
554
|
};
|
|
555
555
|
}
|
|
556
|
-
function
|
|
556
|
+
function Oe(e) {
|
|
557
557
|
e.preventDefault(), e.stopPropagation();
|
|
558
558
|
}
|
|
559
559
|
function lt(e) {
|
|
@@ -564,8 +564,8 @@ function xn(e) {
|
|
|
564
564
|
const l = [
|
|
565
565
|
["click", lt],
|
|
566
566
|
["auxclick", lt],
|
|
567
|
-
["submit",
|
|
568
|
-
["dragstart",
|
|
567
|
+
["submit", Oe],
|
|
568
|
+
["dragstart", Oe]
|
|
569
569
|
];
|
|
570
570
|
for (const [t, o] of l) e.addEventListener(t, o, !0);
|
|
571
571
|
return {
|
|
@@ -639,12 +639,12 @@ const En = { class: "wx-block-stage" }, Vn = { class: "wx-block-stage__bar" }, A
|
|
|
639
639
|
loading: { type: Boolean, default: !1 }
|
|
640
640
|
},
|
|
641
641
|
setup(e) {
|
|
642
|
-
const l = e, t =
|
|
642
|
+
const l = e, t = de("webx-blocks"), o = S(() => [
|
|
643
643
|
{ value: 1280, icon: "monitor", ariaLabel: t("page.width-desktop") },
|
|
644
644
|
{ value: 834, icon: "tablet", ariaLabel: t("page.width-tablet") },
|
|
645
645
|
{ value: 390, icon: "smartphone", ariaLabel: t("page.width-phone") }
|
|
646
646
|
]), a = U(1280), i = U(null), s = U(null), r = bt(i), p = U(360), u = U(!1);
|
|
647
|
-
|
|
647
|
+
ue([r, o], () => {
|
|
648
648
|
if (u.value || r.value === 0) return;
|
|
649
649
|
const D = o.value.find((P) => r.value / P.value >= 0.45);
|
|
650
650
|
a.value = (D ?? o.value[o.value.length - 1]).value;
|
|
@@ -662,17 +662,17 @@ const En = { class: "wx-block-stage" }, Vn = { class: "wx-block-stage__bar" }, A
|
|
|
662
662
|
})
|
|
663
663
|
), h = U(0);
|
|
664
664
|
let x = null;
|
|
665
|
-
|
|
665
|
+
ue(
|
|
666
666
|
() => l.script,
|
|
667
667
|
(D) => {
|
|
668
668
|
l.stage && D !== x && (h.value += 1);
|
|
669
669
|
}
|
|
670
670
|
);
|
|
671
|
-
function
|
|
671
|
+
function T() {
|
|
672
672
|
const D = s.value?.contentDocument?.body;
|
|
673
673
|
if (!D) return;
|
|
674
|
-
const P = D.ownerDocument.defaultView,
|
|
675
|
-
p.value = Math.max(120, Math.ceil(Math.max(D.scrollHeight,
|
|
674
|
+
const P = D.ownerDocument.defaultView, Q = P && parseFloat(P.getComputedStyle(D).marginBottom) || 0, le = D.getBoundingClientRect().bottom + Q + (P?.scrollY ?? 0);
|
|
675
|
+
p.value = Math.max(120, Math.ceil(Math.max(D.scrollHeight, le)));
|
|
676
676
|
}
|
|
677
677
|
let _ = null, b = null;
|
|
678
678
|
function $() {
|
|
@@ -681,24 +681,24 @@ const En = { class: "wx-block-stage" }, Vn = { class: "wx-block-stage__bar" }, A
|
|
|
681
681
|
function R(D) {
|
|
682
682
|
l.stage && (l.script && x !== l.script && (x = l.script, $n(D, l.script)), _n(D, { html: l.html, styles: l.styles }));
|
|
683
683
|
}
|
|
684
|
-
function
|
|
684
|
+
function G() {
|
|
685
685
|
$();
|
|
686
686
|
const D = s.value?.contentDocument;
|
|
687
687
|
if (!D?.body) return;
|
|
688
|
-
l.stage && (x = null, _ = xn(D), R(D)),
|
|
688
|
+
l.stage && (x = null, _ = xn(D), R(D)), T();
|
|
689
689
|
const P = D.defaultView?.ResizeObserver;
|
|
690
|
-
P && (b = new P(() =>
|
|
690
|
+
P && (b = new P(() => T()), b.observe(D.body));
|
|
691
691
|
}
|
|
692
|
-
|
|
692
|
+
ue(
|
|
693
693
|
() => [l.html, l.styles],
|
|
694
694
|
() => {
|
|
695
695
|
const D = s.value?.contentDocument;
|
|
696
696
|
l.stage && D?.body && _ !== null && R(D);
|
|
697
697
|
}
|
|
698
|
-
),
|
|
699
|
-
D > 0 && P === 0 && setTimeout(
|
|
700
|
-
}),
|
|
701
|
-
const
|
|
698
|
+
), ue(r, (D, P) => {
|
|
699
|
+
D > 0 && P === 0 && setTimeout(T, 50);
|
|
700
|
+
}), ue(a, () => setTimeout(T, 50)), st($);
|
|
701
|
+
const ee = S(() => ({
|
|
702
702
|
width: `${a.value}px`,
|
|
703
703
|
height: `${p.value}px`,
|
|
704
704
|
transform: `scale(${d.value})`
|
|
@@ -707,16 +707,16 @@ const En = { class: "wx-block-stage" }, Vn = { class: "wx-block-stage__bar" }, A
|
|
|
707
707
|
height: `${Math.round(p.value * d.value)}px`
|
|
708
708
|
}));
|
|
709
709
|
return (D, P) => (c(), w("div", En, [
|
|
710
|
-
|
|
710
|
+
E("div", Vn, [
|
|
711
711
|
v(n(sl), {
|
|
712
712
|
"model-value": a.value,
|
|
713
713
|
options: o.value,
|
|
714
714
|
size: "sm",
|
|
715
715
|
"aria-label": n(t)("page.width"),
|
|
716
|
-
"onUpdate:modelValue": P[0] || (P[0] = (
|
|
716
|
+
"onUpdate:modelValue": P[0] || (P[0] = (Q) => m(Number(Q)))
|
|
717
717
|
}, null, 8, ["model-value", "options", "aria-label"])
|
|
718
718
|
]),
|
|
719
|
-
|
|
719
|
+
E("div", {
|
|
720
720
|
ref_key: "box",
|
|
721
721
|
ref: i,
|
|
722
722
|
class: "wx-block-stage__ground"
|
|
@@ -727,7 +727,7 @@ const En = { class: "wx-block-stage" }, Vn = { class: "wx-block-stage__bar" }, A
|
|
|
727
727
|
})) : (c(), w("div", {
|
|
728
728
|
key: 1,
|
|
729
729
|
class: "wx-block-stage__clip",
|
|
730
|
-
style:
|
|
730
|
+
style: Ie(ae.value)
|
|
731
731
|
}, [
|
|
732
732
|
(c(), w("iframe", {
|
|
733
733
|
ref_key: "frame",
|
|
@@ -736,10 +736,10 @@ const En = { class: "wx-block-stage" }, Vn = { class: "wx-block-stage__bar" }, A
|
|
|
736
736
|
class: "wx-block-stage__frame",
|
|
737
737
|
src: e.stage ?? void 0,
|
|
738
738
|
srcdoc: f.value,
|
|
739
|
-
style:
|
|
739
|
+
style: Ie(ee.value),
|
|
740
740
|
sandbox: "allow-same-origin allow-scripts",
|
|
741
741
|
title: n(t)("page.preview"),
|
|
742
|
-
onLoad:
|
|
742
|
+
onLoad: G
|
|
743
743
|
}, null, 44, An))
|
|
744
744
|
], 4))
|
|
745
745
|
], 512)
|
|
@@ -808,11 +808,11 @@ function Ot(e) {
|
|
|
808
808
|
function bl(e) {
|
|
809
809
|
const l = {};
|
|
810
810
|
for (const [t, o] of Object.entries(e.values ?? {}))
|
|
811
|
-
l[t] = rt(o) ? o.map(bl) :
|
|
811
|
+
l[t] = rt(o) ? o.map(bl) : Ae(o);
|
|
812
812
|
return e.hidden === !0 ? { key: Et(), type: e.type, hidden: !0, values: l } : { key: Et(), type: e.type, values: l };
|
|
813
813
|
}
|
|
814
814
|
function zn(e, l, t) {
|
|
815
|
-
const o =
|
|
815
|
+
const o = Ae(e), a = me(o, l);
|
|
816
816
|
return a ? (t ? a.node.hidden = !0 : delete a.node.hidden, o) : e;
|
|
817
817
|
}
|
|
818
818
|
function Dn(e, l, t) {
|
|
@@ -823,23 +823,23 @@ function Dn(e, l, t) {
|
|
|
823
823
|
return Array.isArray(a) || (o.node.values[t] = []), o.node.values[t];
|
|
824
824
|
}
|
|
825
825
|
function yt(e, l, t, o, a) {
|
|
826
|
-
const i =
|
|
826
|
+
const i = Ae(e), s = Dn(i, l, t);
|
|
827
827
|
return s ? (s.splice(Math.max(0, Math.min(o, s.length)), 0, a), i) : e;
|
|
828
828
|
}
|
|
829
829
|
function Qt(e, l) {
|
|
830
|
-
const t =
|
|
830
|
+
const t = Ae(e), o = me(t, l);
|
|
831
831
|
return o ? (o.list.splice(o.index, 1), t) : e;
|
|
832
832
|
}
|
|
833
833
|
function On(e, l, t) {
|
|
834
|
-
const o =
|
|
834
|
+
const o = Ae(e), a = me(o, l);
|
|
835
835
|
return a ? (a.node.values = t, o) : e;
|
|
836
836
|
}
|
|
837
837
|
function In(e, l, t, o) {
|
|
838
|
-
if (l === null) return
|
|
839
|
-
const a =
|
|
840
|
-
return !i || t === null ? e : (i.node.values[t] =
|
|
838
|
+
if (l === null) return Ae(o);
|
|
839
|
+
const a = Ae(e), i = me(a, l);
|
|
840
|
+
return !i || t === null ? e : (i.node.values[t] = Ae(o), a);
|
|
841
841
|
}
|
|
842
|
-
function
|
|
842
|
+
function Ae(e) {
|
|
843
843
|
return e === void 0 ? e : JSON.parse(JSON.stringify(e));
|
|
844
844
|
}
|
|
845
845
|
function wt(e) {
|
|
@@ -908,8 +908,8 @@ function Jn({
|
|
|
908
908
|
if (d !== null) return Zn(a, d, t(), o);
|
|
909
909
|
const f = /<(x-[\w:-]*)$/.exec(i);
|
|
910
910
|
if (f) {
|
|
911
|
-
const
|
|
912
|
-
return Xn(a, f[1], Qn(
|
|
911
|
+
const T = a.state.sliceDoc(0, a.pos - f[0].length);
|
|
912
|
+
return Xn(a, f[1], Qn(T), o);
|
|
913
913
|
}
|
|
914
914
|
const h = /\bclass\s*=\s*"([^"]*)$/.exec(i);
|
|
915
915
|
if (h) return so(a, h[1], l());
|
|
@@ -965,7 +965,7 @@ function Zn(e, l, t, o) {
|
|
|
965
965
|
}
|
|
966
966
|
return u;
|
|
967
967
|
}, r = (u) => {
|
|
968
|
-
const d = [...
|
|
968
|
+
const d = [...We(u ?? []).filter((f) => f.type !== "wx-slot" && f.type !== "wx-blocks").filter((f) => !a.has(f.id)).map(
|
|
969
969
|
(f, h) => xt(f.id, f.type === "wx-data" || l.bound, f.type, f.label, 40 - h)
|
|
970
970
|
), ...s()];
|
|
971
971
|
return d.length === 0 || !e.explicit && l.word === "" && !l.bound ? null : { from: i, options: d, validFor: /^:?[\w-]*$/ };
|
|
@@ -996,13 +996,13 @@ function xt(e, l, t, o, a, i = null) {
|
|
|
996
996
|
function Xn(e, l, t, o) {
|
|
997
997
|
const a = e.pos - l.length, i = (r) => {
|
|
998
998
|
const p = [
|
|
999
|
-
|
|
999
|
+
_e('x-webx-block type="${type}" />', {
|
|
1000
1000
|
label: "x-webx-block",
|
|
1001
1001
|
detail: "call a block",
|
|
1002
1002
|
type: "keyword"
|
|
1003
1003
|
})
|
|
1004
1004
|
];
|
|
1005
|
-
for (const u of
|
|
1005
|
+
for (const u of We(r ?? []).filter((m) => m.type === "wx-slot"))
|
|
1006
1006
|
p.push({
|
|
1007
1007
|
label: `x-slot:${u.id}`,
|
|
1008
1008
|
detail: "slot",
|
|
@@ -1061,7 +1061,7 @@ function to(e, l, t, o, a) {
|
|
|
1061
1061
|
type: "variable",
|
|
1062
1062
|
boost: 50 - p,
|
|
1063
1063
|
apply: (u, m, d, f) => {
|
|
1064
|
-
const h = u.state.sliceDoc(f, f + 8), x = new RegExp(`^\\s*${mo(s)}`).exec(h),
|
|
1064
|
+
const h = u.state.sliceDoc(f, f + 8), x = new RegExp(`^\\s*${mo(s)}`).exec(h), T = x ? /^\s/.test(h) ? "" : " " : ` ${s}`, _ = `${t === "" ? " " : ""}$${r.id}${T}`;
|
|
1065
1065
|
u.dispatch({
|
|
1066
1066
|
changes: { from: d, to: f, insert: _ },
|
|
1067
1067
|
// Past the closing braces: the echo is finished, the next thing is the markup.
|
|
@@ -1079,7 +1079,7 @@ function lo(e, l) {
|
|
|
1079
1079
|
from: e.pos - l.length,
|
|
1080
1080
|
options: [
|
|
1081
1081
|
...Pn.map((t) => ({ label: t, type: "property" })),
|
|
1082
|
-
|
|
1082
|
+
_e("value('${name}', ${default})", {
|
|
1083
1083
|
label: "value",
|
|
1084
1084
|
detail: "('name', default)",
|
|
1085
1085
|
type: "method"
|
|
@@ -1097,9 +1097,9 @@ function no(e, l, t, o, a) {
|
|
|
1097
1097
|
detail: r,
|
|
1098
1098
|
type: "property",
|
|
1099
1099
|
apply: (p, u, m, d) => {
|
|
1100
|
-
const f = t ? m - 1 : m, h = p.state.sliceDoc(d, d + 2), x = t || "'",
|
|
1100
|
+
const f = t ? m - 1 : m, h = p.state.sliceDoc(d, d + 2), x = t || "'", T = d + (h.startsWith(x) ? 1 : 0), _ = p.state.sliceDoc(T, T + 1) === "]", b = `${x}${s}${x}${_ ? "" : "]"}`;
|
|
1101
1101
|
p.dispatch({
|
|
1102
|
-
changes: { from: f, to:
|
|
1102
|
+
changes: { from: f, to: T, insert: b },
|
|
1103
1103
|
selection: { anchor: f + b.length + (_ ? 1 : 0) },
|
|
1104
1104
|
annotations: Je.of(u),
|
|
1105
1105
|
userEvent: "input.complete"
|
|
@@ -1110,16 +1110,16 @@ function no(e, l, t, o, a) {
|
|
|
1110
1110
|
};
|
|
1111
1111
|
}
|
|
1112
1112
|
function oo(e, l, t) {
|
|
1113
|
-
const o =
|
|
1113
|
+
const o = We(l).find((p) => p.id === e);
|
|
1114
1114
|
if (o && jn.includes(o.type)) return gl.map((p) => [p, o.type]);
|
|
1115
1115
|
if (o?.type === "wx-collection") return Hn.map((p) => [p, o.type]);
|
|
1116
|
-
const a = kl(t).get(e), [i, s] = a?.split(".") ?? [], r = i ?
|
|
1116
|
+
const a = kl(t).get(e), [i, s] = a?.split(".") ?? [], r = i ? We(l).find((p) => p.id === i) : void 0;
|
|
1117
1117
|
if (!r) return [];
|
|
1118
1118
|
if (r.type === "wx-collection") {
|
|
1119
1119
|
const p = typeof r.props?.source == "string" ? r.props.source : r.type, u = s === "items" ? qn[p] ?? [] : [];
|
|
1120
1120
|
return [...Kn[s ?? ""] ?? [], ...u].map((m) => [m, p]);
|
|
1121
1121
|
}
|
|
1122
|
-
return Fn.includes(r.type) ? Rn.map((p) => [p, r.type]) : r.type === "wx-repeater" ?
|
|
1122
|
+
return Fn.includes(r.type) ? Rn.map((p) => [p, r.type]) : r.type === "wx-repeater" ? We(r.children ?? []).map((p) => [p.id, p.type]) : [];
|
|
1123
1123
|
}
|
|
1124
1124
|
function kl(e) {
|
|
1125
1125
|
const l = /* @__PURE__ */ new Map();
|
|
@@ -1138,26 +1138,26 @@ function so(e, l, t) {
|
|
|
1138
1138
|
};
|
|
1139
1139
|
}
|
|
1140
1140
|
function ao(e) {
|
|
1141
|
-
const l =
|
|
1141
|
+
const l = We(e).filter((t) => t.type === "wx-blocks");
|
|
1142
1142
|
return [
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1143
|
+
_e("@if (${condition})\n ${}\n@endif", { label: "@if", type: "keyword" }),
|
|
1144
|
+
_e("@isset(${value})\n ${}\n@endisset", { label: "@isset", type: "keyword" }),
|
|
1145
|
+
_e("@foreach (${items} as ${item})\n ${}\n@endforeach", {
|
|
1146
1146
|
label: "@foreach",
|
|
1147
1147
|
type: "keyword"
|
|
1148
1148
|
}),
|
|
1149
|
-
|
|
1149
|
+
_e("@forelse (${items} as ${item})\n ${}\n@empty\n ${}\n@endforelse", {
|
|
1150
1150
|
label: "@forelse",
|
|
1151
1151
|
type: "keyword"
|
|
1152
1152
|
}),
|
|
1153
|
-
|
|
1153
|
+
_e("@unless (${condition})\n ${}\n@endunless", {
|
|
1154
1154
|
label: "@unless",
|
|
1155
1155
|
type: "keyword"
|
|
1156
1156
|
}),
|
|
1157
|
-
|
|
1158
|
-
|
|
1157
|
+
_e("@class([${}])", { label: "@class", type: "keyword" }),
|
|
1158
|
+
_e("@style([${}])", { label: "@style", type: "keyword" }),
|
|
1159
1159
|
...l.map(
|
|
1160
|
-
(t) =>
|
|
1160
|
+
(t) => _e(`@blocks('${t.id}')`, {
|
|
1161
1161
|
label: "@blocks",
|
|
1162
1162
|
detail: `('${t.id}')`,
|
|
1163
1163
|
type: "keyword",
|
|
@@ -1302,14 +1302,14 @@ function po(e, l) {
|
|
|
1302
1302
|
}
|
|
1303
1303
|
return o;
|
|
1304
1304
|
}
|
|
1305
|
-
function
|
|
1305
|
+
function We(e) {
|
|
1306
1306
|
const l = [];
|
|
1307
1307
|
for (const t of e)
|
|
1308
|
-
!t || typeof t != "object" || (fo.has(t.type) ? l.push(...
|
|
1308
|
+
!t || typeof t != "object" || (fo.has(t.type) ? l.push(...We(t.children ?? [])) : typeof t.id == "string" && t.id !== "" && l.push(t));
|
|
1309
1309
|
return l;
|
|
1310
1310
|
}
|
|
1311
1311
|
function wl(e) {
|
|
1312
|
-
return
|
|
1312
|
+
return We(e).filter((l) => l.type !== "wx-blocks");
|
|
1313
1313
|
}
|
|
1314
1314
|
const fo = /* @__PURE__ */ new Set(["wx-card", "wx-tabs", "wx-tab", "wx-row", "wx-col", "wx-divider"]);
|
|
1315
1315
|
function mo(e) {
|
|
@@ -1414,7 +1414,7 @@ function qe(e, l) {
|
|
|
1414
1414
|
const t = `groups.${e}`, o = l(t);
|
|
1415
1415
|
return o === t || o === `webx-blocks::${t}` ? e.charAt(0).toUpperCase() + e.slice(1) : o;
|
|
1416
1416
|
}
|
|
1417
|
-
function
|
|
1417
|
+
function $e(e) {
|
|
1418
1418
|
return e.kind ?? "block";
|
|
1419
1419
|
}
|
|
1420
1420
|
function Tl(e, l) {
|
|
@@ -1470,15 +1470,15 @@ const xo = { class: "wx-block-editor" }, _o = { class: "wx-block-editor__split"
|
|
|
1470
1470
|
},
|
|
1471
1471
|
setup(e) {
|
|
1472
1472
|
const l = e, t = at(), o = Ke(t), a = nn(), i = ul();
|
|
1473
|
-
|
|
1474
|
-
const s =
|
|
1475
|
-
const
|
|
1473
|
+
Ne();
|
|
1474
|
+
const s = de("webx-blocks"), r = it(), p = S(() => Number(a.params.id)), u = U(null), m = U([]), d = U(!0), f = U(!1), h = U(!1), x = U("template"), T = S(() => {
|
|
1475
|
+
const C = t.state.manifest?.modules.find((y) => y.id === "blocks")?.meta;
|
|
1476
1476
|
return {
|
|
1477
|
-
groups:
|
|
1478
|
-
editing:
|
|
1479
|
-
provides:
|
|
1477
|
+
groups: C?.groups ?? [],
|
|
1478
|
+
editing: C?.editing ?? !0,
|
|
1479
|
+
provides: C?.provides ?? []
|
|
1480
1480
|
};
|
|
1481
|
-
}), _ = S(() => t.can("blocks.manage") &&
|
|
1481
|
+
}), _ = S(() => t.can("blocks.manage") && T.value.editing), b = gt({
|
|
1482
1482
|
kind: "block",
|
|
1483
1483
|
slug: "",
|
|
1484
1484
|
title: "",
|
|
@@ -1508,27 +1508,27 @@ const xo = { class: "wx-block-editor" }, _o = { class: "wx-block-editor__split"
|
|
|
1508
1508
|
styles: "",
|
|
1509
1509
|
script: null,
|
|
1510
1510
|
sample: {}
|
|
1511
|
-
}), R = U("[]"),
|
|
1511
|
+
}), R = U("[]"), G = U(null), ee = U(""), ae = U({}), D = U(null), P = gt({
|
|
1512
1512
|
html: "",
|
|
1513
1513
|
styles: "",
|
|
1514
1514
|
script: null,
|
|
1515
1515
|
runtime: null,
|
|
1516
1516
|
stage: null,
|
|
1517
1517
|
loading: !1
|
|
1518
|
-
}),
|
|
1519
|
-
async function
|
|
1518
|
+
}), Q = S(() => JSON.stringify({ settings: b, content: $ })), le = S(() => ee.value !== "" && Q.value !== ee.value), Se = S(() => vo(b.slug, $, s)), he = U([]), ne = /* @__PURE__ */ new Map(), we = /* @__PURE__ */ new Map();
|
|
1519
|
+
async function Be() {
|
|
1520
1520
|
try {
|
|
1521
|
-
const
|
|
1522
|
-
|
|
1523
|
-
for (const y of
|
|
1521
|
+
const C = await o.index();
|
|
1522
|
+
ne.clear();
|
|
1523
|
+
for (const y of C.blocks) ne.set(y.slug, y.id);
|
|
1524
1524
|
he.value = [
|
|
1525
|
-
...
|
|
1525
|
+
...C.blocks.map((y) => ({
|
|
1526
1526
|
slug: y.slug,
|
|
1527
1527
|
title: y.title,
|
|
1528
|
-
kind:
|
|
1529
|
-
fallback:
|
|
1528
|
+
kind: $e(y),
|
|
1529
|
+
fallback: C.declared.find((K) => K.slug === y.slug)?.fallback ?? null
|
|
1530
1530
|
})),
|
|
1531
|
-
...
|
|
1531
|
+
...C.declared.filter((y) => !y.customised).map((y) => ({
|
|
1532
1532
|
slug: y.slug,
|
|
1533
1533
|
title: y.title,
|
|
1534
1534
|
kind: "component",
|
|
@@ -1538,24 +1538,24 @@ const xo = { class: "wx-block-editor" }, _o = { class: "wx-block-editor__split"
|
|
|
1538
1538
|
} catch {
|
|
1539
1539
|
}
|
|
1540
1540
|
}
|
|
1541
|
-
function
|
|
1542
|
-
if (
|
|
1543
|
-
const y =
|
|
1541
|
+
function ze(C) {
|
|
1542
|
+
if (C === b.slug) return $.schema;
|
|
1543
|
+
const y = ne.get(C);
|
|
1544
1544
|
if (y === void 0) return null;
|
|
1545
|
-
let K =
|
|
1545
|
+
let K = we.get(C);
|
|
1546
1546
|
return K === void 0 && (K = o.get(y).then(
|
|
1547
1547
|
(M) => M.content?.schema ?? null,
|
|
1548
1548
|
() => null
|
|
1549
|
-
),
|
|
1549
|
+
), we.set(C, K)), K;
|
|
1550
1550
|
}
|
|
1551
|
-
const
|
|
1551
|
+
const xe = {
|
|
1552
1552
|
template: [
|
|
1553
1553
|
wt(
|
|
1554
1554
|
Jn({
|
|
1555
1555
|
schema: () => $.schema,
|
|
1556
1556
|
styles: () => $.styles,
|
|
1557
1557
|
types: () => he.value,
|
|
1558
|
-
schemaOf:
|
|
1558
|
+
schemaOf: ze
|
|
1559
1559
|
})
|
|
1560
1560
|
)
|
|
1561
1561
|
],
|
|
@@ -1565,72 +1565,72 @@ const xo = { class: "wx-block-editor" }, _o = { class: "wx-block-editor__split"
|
|
|
1565
1565
|
// The renderer's own types under the panel's, the same merge the sample form is drawn with.
|
|
1566
1566
|
schema: [wt(co({ types: () => ({ ...ft, ...t.types }) }))]
|
|
1567
1567
|
}, ie = S(() => {
|
|
1568
|
-
const
|
|
1569
|
-
return
|
|
1570
|
-
}),
|
|
1568
|
+
const C = [...T.value.groups];
|
|
1569
|
+
return C.includes(b.group) || C.push(b.group), C.map((y) => ({ value: y, label: qe(y, s) }));
|
|
1570
|
+
}), ve = S({
|
|
1571
1571
|
get: () => $.sample,
|
|
1572
|
-
set: (
|
|
1573
|
-
$.sample =
|
|
1572
|
+
set: (C) => {
|
|
1573
|
+
$.sample = C;
|
|
1574
1574
|
}
|
|
1575
|
-
}),
|
|
1576
|
-
function
|
|
1575
|
+
}), Ce = S(() => N($.schema));
|
|
1576
|
+
function N(C) {
|
|
1577
1577
|
const y = [];
|
|
1578
|
-
for (const K of
|
|
1579
|
-
K.type !== "wx-blocks" && !(K.children?.length && !K.name) && y.push(K.id), K.children && y.push(...
|
|
1578
|
+
for (const K of C)
|
|
1579
|
+
K.type !== "wx-blocks" && !(K.children?.length && !K.name) && y.push(K.id), K.children && y.push(...N(K.children));
|
|
1580
1580
|
return y;
|
|
1581
1581
|
}
|
|
1582
|
-
function j(
|
|
1583
|
-
u.value =
|
|
1584
|
-
kind:
|
|
1585
|
-
slug:
|
|
1586
|
-
title:
|
|
1587
|
-
description:
|
|
1588
|
-
icon:
|
|
1589
|
-
group:
|
|
1590
|
-
sort:
|
|
1591
|
-
allow:
|
|
1592
|
-
allowed_in:
|
|
1593
|
-
max_per_entity:
|
|
1594
|
-
is_enabled:
|
|
1582
|
+
function j(C) {
|
|
1583
|
+
u.value = C, Object.assign(b, {
|
|
1584
|
+
kind: $e(C),
|
|
1585
|
+
slug: C.slug,
|
|
1586
|
+
title: C.title,
|
|
1587
|
+
description: C.description,
|
|
1588
|
+
icon: C.icon,
|
|
1589
|
+
group: C.group,
|
|
1590
|
+
sort: C.sort,
|
|
1591
|
+
allow: C.allow ?? [],
|
|
1592
|
+
allowed_in: C.allowed_in ?? [],
|
|
1593
|
+
max_per_entity: C.max_per_entity,
|
|
1594
|
+
is_enabled: C.is_enabled
|
|
1595
1595
|
});
|
|
1596
|
-
const y =
|
|
1596
|
+
const y = C.content ?? {
|
|
1597
1597
|
schema: [],
|
|
1598
1598
|
template: "",
|
|
1599
1599
|
styles: "",
|
|
1600
1600
|
script: null,
|
|
1601
1601
|
sample: {}
|
|
1602
1602
|
};
|
|
1603
|
-
Object.assign($,
|
|
1603
|
+
Object.assign($, Ae(y)), R.value = JSON.stringify(y.schema, null, 2), G.value = null, ee.value = Q.value;
|
|
1604
1604
|
}
|
|
1605
|
-
async function
|
|
1605
|
+
async function q() {
|
|
1606
1606
|
d.value = !0;
|
|
1607
1607
|
try {
|
|
1608
|
-
j(await o.get(p.value)), m.value = await o.usage(p.value),
|
|
1609
|
-
} catch (
|
|
1610
|
-
|
|
1608
|
+
j(await o.get(p.value)), m.value = await o.usage(p.value), Be();
|
|
1609
|
+
} catch (C) {
|
|
1610
|
+
X.danger(r(C));
|
|
1611
1611
|
} finally {
|
|
1612
1612
|
d.value = !1;
|
|
1613
1613
|
}
|
|
1614
1614
|
}
|
|
1615
|
-
function
|
|
1616
|
-
R.value =
|
|
1615
|
+
function pe(C) {
|
|
1616
|
+
R.value = C;
|
|
1617
1617
|
try {
|
|
1618
|
-
const y = JSON.parse(
|
|
1618
|
+
const y = JSON.parse(C);
|
|
1619
1619
|
if (!Array.isArray(y)) throw new Error("not a list");
|
|
1620
|
-
$.schema = y,
|
|
1620
|
+
$.schema = y, G.value = null;
|
|
1621
1621
|
} catch (y) {
|
|
1622
|
-
|
|
1622
|
+
G.value = s("page.schema-invalid", { error: y.message });
|
|
1623
1623
|
}
|
|
1624
1624
|
}
|
|
1625
|
-
let
|
|
1626
|
-
function
|
|
1627
|
-
clearTimeout(
|
|
1628
|
-
|
|
1625
|
+
let V, O = 0;
|
|
1626
|
+
function I() {
|
|
1627
|
+
clearTimeout(V), V = setTimeout(() => {
|
|
1628
|
+
Y();
|
|
1629
1629
|
}, 250);
|
|
1630
1630
|
}
|
|
1631
|
-
async function
|
|
1631
|
+
async function Y() {
|
|
1632
1632
|
if (!u.value) return;
|
|
1633
|
-
const
|
|
1633
|
+
const C = ++O;
|
|
1634
1634
|
P.loading = !0;
|
|
1635
1635
|
try {
|
|
1636
1636
|
const y = await o.render(u.value.id, {
|
|
@@ -1642,35 +1642,35 @@ const xo = { class: "wx-block-editor" }, _o = { class: "wx-block-editor__split"
|
|
|
1642
1642
|
schema: $.schema
|
|
1643
1643
|
} : void 0
|
|
1644
1644
|
});
|
|
1645
|
-
if (
|
|
1645
|
+
if (C !== O) return;
|
|
1646
1646
|
P.html = y.html, P.styles = y.styles, P.script = y.script, P.runtime = y.runtime, P.stage = y.stage ?? null;
|
|
1647
1647
|
} catch (y) {
|
|
1648
|
-
|
|
1648
|
+
C === O && X.danger(r(y));
|
|
1649
1649
|
} finally {
|
|
1650
|
-
|
|
1650
|
+
C === O && (P.loading = !1);
|
|
1651
1651
|
}
|
|
1652
1652
|
}
|
|
1653
|
-
|
|
1653
|
+
ue(
|
|
1654
1654
|
() => [$.template, $.styles, $.script, $.schema, $.sample],
|
|
1655
|
-
|
|
1655
|
+
I,
|
|
1656
1656
|
{ deep: !0 }
|
|
1657
1657
|
);
|
|
1658
|
-
const
|
|
1659
|
-
function Ye(
|
|
1660
|
-
return `{{ $${
|
|
1658
|
+
const Te = U(null);
|
|
1659
|
+
function Ye(C) {
|
|
1660
|
+
return `{{ $${C} }}`;
|
|
1661
1661
|
}
|
|
1662
|
-
function
|
|
1663
|
-
const K =
|
|
1662
|
+
function Le(C) {
|
|
1663
|
+
const K = Te.value?.view?.value;
|
|
1664
1664
|
if (!K) {
|
|
1665
|
-
$.template += `{{ $${
|
|
1665
|
+
$.template += `{{ $${C} }}`;
|
|
1666
1666
|
return;
|
|
1667
1667
|
}
|
|
1668
|
-
K.dispatch(K.state.replaceSelection(`{{ $${
|
|
1668
|
+
K.dispatch(K.state.replaceSelection(`{{ $${C} }}`)), K.focus();
|
|
1669
1669
|
}
|
|
1670
1670
|
async function Ue() {
|
|
1671
1671
|
if (!u.value) return;
|
|
1672
1672
|
f.value = !0, ae.value = {}, D.value = null;
|
|
1673
|
-
const
|
|
1673
|
+
const C = u.value.draft?.number ?? null;
|
|
1674
1674
|
try {
|
|
1675
1675
|
const y = await o.update(u.value.id, {
|
|
1676
1676
|
...b,
|
|
@@ -1678,36 +1678,36 @@ const xo = { class: "wx-block-editor" }, _o = { class: "wx-block-editor__split"
|
|
|
1678
1678
|
allowed_in: b.allowed_in.length ? b.allowed_in : null,
|
|
1679
1679
|
description: b.description || null,
|
|
1680
1680
|
icon: b.icon || null,
|
|
1681
|
-
content:
|
|
1681
|
+
content: G.value ? { ...$, schema: void 0 } : $
|
|
1682
1682
|
});
|
|
1683
|
-
j(y),
|
|
1684
|
-
y.draft && y.draft.number !==
|
|
1683
|
+
j(y), X.success(
|
|
1684
|
+
y.draft && y.draft.number !== C ? s("page.saved", { number: y.draft.number }) : s("page.unchanged")
|
|
1685
1685
|
);
|
|
1686
1686
|
} catch (y) {
|
|
1687
1687
|
const K = y.body;
|
|
1688
|
-
K?.errors ? (ae.value = K.errors,
|
|
1688
|
+
K?.errors ? (ae.value = K.errors, X.danger(s("page.failed"))) : X.danger(r(y, s("page.failed")));
|
|
1689
1689
|
} finally {
|
|
1690
1690
|
f.value = !1;
|
|
1691
1691
|
}
|
|
1692
1692
|
}
|
|
1693
1693
|
async function ct() {
|
|
1694
|
-
if (!(!u.value?.draft || (
|
|
1694
|
+
if (!(!u.value?.draft || (le.value && await Ue(), !u.value.draft) || !await vt({
|
|
1695
1695
|
title: s("page.publish-title", { number: u.value.draft.number }),
|
|
1696
1696
|
// A component stands on no page itself; what a new version reaches is the blocks calling it.
|
|
1697
1697
|
// A declared place is also printed by the module's views, which the count does not see.
|
|
1698
|
-
message:
|
|
1699
|
-
module:
|
|
1700
|
-
count:
|
|
1701
|
-
}) : fe.value ? s("components.publish-text", { count:
|
|
1698
|
+
message: Ve.value ? s("components.publish-declared", {
|
|
1699
|
+
module: Ve.value,
|
|
1700
|
+
count: Ee.value.length
|
|
1701
|
+
}) : fe.value ? s("components.publish-text", { count: Ee.value.length }) : s("page.publish-text", { count: u.value.usage_count }),
|
|
1702
1702
|
confirmText: s("page.publish"),
|
|
1703
1703
|
cancelText: s("page.cancel")
|
|
1704
1704
|
}))) {
|
|
1705
1705
|
h.value = !0, D.value = null;
|
|
1706
1706
|
try {
|
|
1707
|
-
j(await o.publish(u.value.id)),
|
|
1707
|
+
j(await o.publish(u.value.id)), X.success(s("page.published", { number: u.value.published?.number ?? 0 }));
|
|
1708
1708
|
} catch (y) {
|
|
1709
1709
|
const K = y.body;
|
|
1710
|
-
K?.errors ? (D.value = K, x.value = "template",
|
|
1710
|
+
K?.errors ? (D.value = K, x.value = "template", X.danger(s("page.publish-failed"))) : X.danger(r(y, s("page.publish-failed")));
|
|
1711
1711
|
} finally {
|
|
1712
1712
|
h.value = !1;
|
|
1713
1713
|
}
|
|
@@ -1715,21 +1715,21 @@ const xo = { class: "wx-block-editor" }, _o = { class: "wx-block-editor__split"
|
|
|
1715
1715
|
}
|
|
1716
1716
|
async function A() {
|
|
1717
1717
|
if (!u.value) return;
|
|
1718
|
-
const
|
|
1718
|
+
const C = u.value.declared != null;
|
|
1719
1719
|
if (await vt({
|
|
1720
|
-
title:
|
|
1721
|
-
message: s(
|
|
1722
|
-
confirmText: s(
|
|
1720
|
+
title: C ? s("components.delete-declared-title", { title: u.value.title }) : s("page.delete-title", { title: u.value.title }),
|
|
1721
|
+
message: s(C ? "components.delete-declared-text" : "page.delete-text"),
|
|
1722
|
+
confirmText: s(C ? "components.delete-declared" : "page.delete"),
|
|
1723
1723
|
cancelText: s("page.cancel"),
|
|
1724
1724
|
tone: "danger"
|
|
1725
1725
|
}))
|
|
1726
1726
|
try {
|
|
1727
|
-
await o.remove(u.value.id),
|
|
1727
|
+
await o.remove(u.value.id), X.success(s("page.deleted")), i.push(l.base);
|
|
1728
1728
|
} catch (K) {
|
|
1729
|
-
|
|
1729
|
+
X.danger(r(K));
|
|
1730
1730
|
}
|
|
1731
1731
|
}
|
|
1732
|
-
const
|
|
1732
|
+
const z = S(
|
|
1733
1733
|
() => D.value ? {
|
|
1734
1734
|
message: D.value.errors.template?.[0] ?? D.value.message,
|
|
1735
1735
|
line: D.value.line,
|
|
@@ -1737,7 +1737,7 @@ const xo = { class: "wx-block-editor" }, _o = { class: "wx-block-editor__split"
|
|
|
1737
1737
|
title: D.value.entity.title ?? `#${D.value.entity.id}`
|
|
1738
1738
|
}) : null
|
|
1739
1739
|
} : null
|
|
1740
|
-
), H = S(() => x.value === "template" || x.value === "styles"),
|
|
1740
|
+
), H = S(() => x.value === "template" || x.value === "styles"), be = S(() => [
|
|
1741
1741
|
{
|
|
1742
1742
|
title: s("page.example-handler"),
|
|
1743
1743
|
code: `el.querySelector('.b-hero__button')?.addEventListener('click', (event) => {
|
|
@@ -1760,25 +1760,25 @@ setInterval(() => el.classList.toggle('is-second'), seconds * 1000)`
|
|
|
1760
1760
|
|
|
1761
1761
|
new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
1762
1762
|
}
|
|
1763
|
-
]),
|
|
1764
|
-
const
|
|
1765
|
-
return
|
|
1763
|
+
]), te = S(() => m.value.slice(0, 5)), fe = S(() => b.kind === "component"), Ee = S(() => u.value?.used_by ?? []), Ve = S(() => {
|
|
1764
|
+
const C = u.value?.declared?.module;
|
|
1765
|
+
return C ? t.state.manifest?.modules.find((y) => y.id === C)?.title ?? C.charAt(0).toUpperCase() + C.slice(1) : null;
|
|
1766
1766
|
}), Ge = S(
|
|
1767
|
-
() => fe.value ? Tl(
|
|
1767
|
+
() => fe.value ? Tl(Ee.value.length, s) : Cl(u.value?.usage_count ?? 0, s)
|
|
1768
1768
|
), Ze = S(
|
|
1769
|
-
() => (u.value?.usage_count ?? 0) > 0 ||
|
|
1769
|
+
() => (u.value?.usage_count ?? 0) > 0 || Ee.value.length > 0 || Ve.value !== null
|
|
1770
1770
|
), Pe = S(() => {
|
|
1771
|
-
const
|
|
1772
|
-
return
|
|
1773
|
-
titles:
|
|
1771
|
+
const C = u.value?.usage_count ?? 0;
|
|
1772
|
+
return C > 0 ? C === 1 ? s("page.delete-used-one") : s("page.delete-used", { count: C }) : Ee.value.length > 0 ? s("components.delete-called", {
|
|
1773
|
+
titles: Ee.value.map((y) => `"${y.title}"`).join(", ")
|
|
1774
1774
|
}) : null;
|
|
1775
1775
|
}), dt = S(
|
|
1776
1776
|
() => yo(b.slug, $.schema, $.sample, u.value?.declared?.fallback ?? null)
|
|
1777
1777
|
), Vl = S(
|
|
1778
|
-
() => Pt($.schema).filter((
|
|
1779
|
-
const y = typeof
|
|
1778
|
+
() => Pt($.schema).filter((C) => C.type === "wx-data").map((C) => {
|
|
1779
|
+
const y = typeof C.props?.shape == "string" ? C.props.shape : null;
|
|
1780
1780
|
return {
|
|
1781
|
-
id:
|
|
1781
|
+
id: C.id,
|
|
1782
1782
|
shape: y,
|
|
1783
1783
|
fields: y ? u.value?.shape?.[y]?.fields ?? [] : []
|
|
1784
1784
|
};
|
|
@@ -1786,22 +1786,22 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1786
1786
|
);
|
|
1787
1787
|
async function Al() {
|
|
1788
1788
|
try {
|
|
1789
|
-
await navigator.clipboard.writeText(dt.value),
|
|
1789
|
+
await navigator.clipboard.writeText(dt.value), X.success(s("components.copied"));
|
|
1790
1790
|
} catch {
|
|
1791
1791
|
}
|
|
1792
1792
|
}
|
|
1793
|
-
function
|
|
1794
|
-
return ae.value[
|
|
1793
|
+
function ge(C) {
|
|
1794
|
+
return ae.value[C]?.[0];
|
|
1795
1795
|
}
|
|
1796
|
-
function Rt(
|
|
1797
|
-
|
|
1796
|
+
function Rt(C) {
|
|
1797
|
+
le.value && C.preventDefault();
|
|
1798
1798
|
}
|
|
1799
1799
|
ot(() => {
|
|
1800
|
-
|
|
1800
|
+
q(), window.addEventListener("beforeunload", Rt);
|
|
1801
1801
|
}), st(() => {
|
|
1802
|
-
clearTimeout(
|
|
1803
|
-
}),
|
|
1804
|
-
|
|
1802
|
+
clearTimeout(V), window.removeEventListener("beforeunload", Rt);
|
|
1803
|
+
}), ue(p, () => {
|
|
1804
|
+
q();
|
|
1805
1805
|
});
|
|
1806
1806
|
const Bl = S(() => [
|
|
1807
1807
|
{ value: "block", label: s("components.kind-block") },
|
|
@@ -1816,14 +1816,14 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1816
1816
|
label: s("page.publish"),
|
|
1817
1817
|
primary: !0,
|
|
1818
1818
|
loading: h.value,
|
|
1819
|
-
disabled: !u.value?.draft && !
|
|
1819
|
+
disabled: !u.value?.draft && !le.value,
|
|
1820
1820
|
run: () => {
|
|
1821
1821
|
ct();
|
|
1822
1822
|
}
|
|
1823
1823
|
}
|
|
1824
1824
|
] : []
|
|
1825
1825
|
);
|
|
1826
|
-
return (
|
|
1826
|
+
return (C, y) => {
|
|
1827
1827
|
const K = Mt("router-link");
|
|
1828
1828
|
return c(), w("div", xo, [
|
|
1829
1829
|
d.value || !u.value ? (c(), w(F, { key: 0 }, [
|
|
@@ -1832,14 +1832,14 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1832
1832
|
title: "",
|
|
1833
1833
|
rows: 1
|
|
1834
1834
|
}),
|
|
1835
|
-
|
|
1836
|
-
v(n(
|
|
1835
|
+
E("div", _o, [
|
|
1836
|
+
v(n(De), null, {
|
|
1837
1837
|
default: g(() => [
|
|
1838
1838
|
v(n(He), { rows: 8 })
|
|
1839
1839
|
]),
|
|
1840
1840
|
_: 1
|
|
1841
1841
|
}),
|
|
1842
|
-
v(n(
|
|
1842
|
+
v(n(De), null, {
|
|
1843
1843
|
default: g(() => [
|
|
1844
1844
|
v(n(He), { rows: 4 })
|
|
1845
1845
|
]),
|
|
@@ -1860,7 +1860,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1860
1860
|
placeholder: n(s)("page.title"),
|
|
1861
1861
|
onRename: y[0] || (y[0] = (M) => b.title = M)
|
|
1862
1862
|
}, null, 8, ["name", "placeholder"])) : L("", !0),
|
|
1863
|
-
|
|
1863
|
+
le.value ? (c(), W(n(ke), {
|
|
1864
1864
|
key: 1,
|
|
1865
1865
|
type: "primary",
|
|
1866
1866
|
dot: ""
|
|
@@ -1870,7 +1870,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1870
1870
|
]),
|
|
1871
1871
|
_: 1
|
|
1872
1872
|
})) : L("", !0),
|
|
1873
|
-
u.value.draft ? (c(), W(n(
|
|
1873
|
+
u.value.draft ? (c(), W(n(ke), {
|
|
1874
1874
|
key: 2,
|
|
1875
1875
|
type: "warning",
|
|
1876
1876
|
dot: ""
|
|
@@ -1880,7 +1880,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1880
1880
|
]),
|
|
1881
1881
|
_: 1
|
|
1882
1882
|
})) : L("", !0),
|
|
1883
|
-
u.value.published ? (c(), W(n(
|
|
1883
|
+
u.value.published ? (c(), W(n(ke), {
|
|
1884
1884
|
key: 3,
|
|
1885
1885
|
type: "success",
|
|
1886
1886
|
dot: ""
|
|
@@ -1889,7 +1889,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1889
1889
|
B(k(n(s)("page.live", { number: u.value.published.number })), 1)
|
|
1890
1890
|
]),
|
|
1891
1891
|
_: 1
|
|
1892
|
-
})) : (c(), W(n(
|
|
1892
|
+
})) : (c(), W(n(ke), {
|
|
1893
1893
|
key: 4,
|
|
1894
1894
|
type: "default"
|
|
1895
1895
|
}, {
|
|
@@ -1900,7 +1900,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1900
1900
|
}))
|
|
1901
1901
|
]),
|
|
1902
1902
|
subtitle: g(() => [
|
|
1903
|
-
|
|
1903
|
+
E("code", null, k(b.slug), 1),
|
|
1904
1904
|
B(" · " + k(fe.value ? n(s)("components.kind-component") : n(qe)(b.group, n(s))) + " · ", 1),
|
|
1905
1905
|
Ze.value ? (c(), W(n(Wl), {
|
|
1906
1906
|
key: 0,
|
|
@@ -1909,11 +1909,11 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1909
1909
|
align: "start"
|
|
1910
1910
|
}, {
|
|
1911
1911
|
trigger: g(() => [
|
|
1912
|
-
|
|
1912
|
+
E("button", $o, k(Ge.value), 1)
|
|
1913
1913
|
]),
|
|
1914
1914
|
default: g(() => [
|
|
1915
|
-
|
|
1916
|
-
(c(!0), w(F, null,
|
|
1915
|
+
E("div", So, [
|
|
1916
|
+
(c(!0), w(F, null, Z(Ee.value, (M) => (c(), W(K, {
|
|
1917
1917
|
key: `type:${M.id}`,
|
|
1918
1918
|
to: `${e.base}/${M.id}`,
|
|
1919
1919
|
class: "wx-block-editor__use"
|
|
@@ -1923,13 +1923,13 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1923
1923
|
]),
|
|
1924
1924
|
_: 2
|
|
1925
1925
|
}, 1032, ["to"]))), 128)),
|
|
1926
|
-
|
|
1927
|
-
(c(!0), w(F, null,
|
|
1926
|
+
Ve.value ? (c(), w("div", Co, k(n(s)("components.module-views", { module: Ve.value })), 1)) : L("", !0),
|
|
1927
|
+
(c(!0), w(F, null, Z(te.value, (M) => (c(), w("div", {
|
|
1928
1928
|
key: `${M.model}:${M.id}`,
|
|
1929
1929
|
class: "wx-block-editor__use"
|
|
1930
1930
|
}, [
|
|
1931
|
-
|
|
1932
|
-
M.published ? L("", !0) : (c(), W(n(
|
|
1931
|
+
E("span", null, k(M.title ?? `#${M.id}`), 1),
|
|
1932
|
+
M.published ? L("", !0) : (c(), W(n(ke), {
|
|
1933
1933
|
key: 0,
|
|
1934
1934
|
type: "warning",
|
|
1935
1935
|
size: "sm"
|
|
@@ -1940,13 +1940,13 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1940
1940
|
_: 1
|
|
1941
1941
|
}))
|
|
1942
1942
|
]))), 128)),
|
|
1943
|
-
m.value.length >
|
|
1943
|
+
m.value.length > te.value.length ? (c(), W(n(J), {
|
|
1944
1944
|
key: 1,
|
|
1945
1945
|
size: "sm",
|
|
1946
1946
|
tone: "muted"
|
|
1947
1947
|
}, {
|
|
1948
1948
|
default: g(() => [
|
|
1949
|
-
B(k(n(s)("page.usage-more", { count: m.value.length -
|
|
1949
|
+
B(k(n(s)("page.usage-more", { count: m.value.length - te.value.length })), 1)
|
|
1950
1950
|
]),
|
|
1951
1951
|
_: 1
|
|
1952
1952
|
})) : L("", !0)
|
|
@@ -1959,14 +1959,14 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1959
1959
|
]),
|
|
1960
1960
|
_: 1
|
|
1961
1961
|
}, 8, ["title", "back", "back-label", "actions"]),
|
|
1962
|
-
|
|
1962
|
+
T.value.editing ? L("", !0) : (c(), W(n(al), {
|
|
1963
1963
|
key: 0,
|
|
1964
1964
|
type: "info",
|
|
1965
1965
|
variant: "soft",
|
|
1966
1966
|
description: n(s)("page.editing-off")
|
|
1967
1967
|
}, null, 8, ["description"])),
|
|
1968
|
-
|
|
1969
|
-
class:
|
|
1968
|
+
E("div", {
|
|
1969
|
+
class: Me(["wx-block-editor__columns", { "is-alone": !H.value }])
|
|
1970
1970
|
}, [
|
|
1971
1971
|
v(n(Ml), {
|
|
1972
1972
|
modelValue: x.value,
|
|
@@ -1979,20 +1979,20 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1979
1979
|
label: n(s)("page.tab-template")
|
|
1980
1980
|
}, {
|
|
1981
1981
|
default: g(() => [
|
|
1982
|
-
|
|
1982
|
+
E("div", To, [
|
|
1983
1983
|
v(n(Qe), {
|
|
1984
1984
|
ref_key: "templateEditor",
|
|
1985
|
-
ref:
|
|
1985
|
+
ref: Te,
|
|
1986
1986
|
modelValue: $.template,
|
|
1987
1987
|
"onUpdate:modelValue": y[1] || (y[1] = (M) => $.template = M),
|
|
1988
1988
|
language: "php",
|
|
1989
|
-
extensions:
|
|
1989
|
+
extensions: xe.template,
|
|
1990
1990
|
readonly: !_.value,
|
|
1991
1991
|
"min-height": "340px",
|
|
1992
1992
|
"max-height": "70vh",
|
|
1993
1993
|
"line-wrapping": ""
|
|
1994
1994
|
}, null, 8, ["modelValue", "extensions", "readonly"]),
|
|
1995
|
-
|
|
1995
|
+
Ce.value.length ? (c(), w("div", Eo, [
|
|
1996
1996
|
v(n(J), {
|
|
1997
1997
|
size: "sm",
|
|
1998
1998
|
tone: "muted"
|
|
@@ -2002,23 +2002,23 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2002
2002
|
]),
|
|
2003
2003
|
_: 1
|
|
2004
2004
|
}),
|
|
2005
|
-
(c(!0), w(F, null,
|
|
2005
|
+
(c(!0), w(F, null, Z(Ce.value, (M) => (c(), w("button", {
|
|
2006
2006
|
key: M,
|
|
2007
2007
|
type: "button",
|
|
2008
2008
|
class: "wx-block-editor__pill",
|
|
2009
2009
|
disabled: !_.value,
|
|
2010
|
-
onClick: (Xe) =>
|
|
2010
|
+
onClick: (Xe) => Le(M),
|
|
2011
2011
|
textContent: k(Ye(M))
|
|
2012
2012
|
}, null, 8, Vo))), 128))
|
|
2013
2013
|
])) : L("", !0),
|
|
2014
2014
|
v(Yt, {
|
|
2015
2015
|
file: "template",
|
|
2016
|
-
lints:
|
|
2016
|
+
lints: Se.value,
|
|
2017
2017
|
slug: b.slug,
|
|
2018
|
-
error:
|
|
2018
|
+
error: z.value
|
|
2019
2019
|
}, null, 8, ["lints", "slug", "error"])
|
|
2020
2020
|
]),
|
|
2021
|
-
fe.value ? (c(), W(n(
|
|
2021
|
+
fe.value ? (c(), W(n(De), {
|
|
2022
2022
|
key: 0,
|
|
2023
2023
|
class: "wx-block-editor__call",
|
|
2024
2024
|
title: n(s)("components.call")
|
|
@@ -2033,11 +2033,11 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2033
2033
|
]),
|
|
2034
2034
|
_: 1
|
|
2035
2035
|
}),
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2036
|
+
E("div", Ao, [
|
|
2037
|
+
E("pre", null, [
|
|
2038
|
+
E("code", null, k(dt.value), 1)
|
|
2039
2039
|
]),
|
|
2040
|
-
v(n(
|
|
2040
|
+
v(n(ce), {
|
|
2041
2041
|
size: "sm",
|
|
2042
2042
|
variant: "outline",
|
|
2043
2043
|
onClick: Al
|
|
@@ -2048,7 +2048,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2048
2048
|
_: 1
|
|
2049
2049
|
})
|
|
2050
2050
|
]),
|
|
2051
|
-
(c(!0), w(F, null,
|
|
2051
|
+
(c(!0), w(F, null, Z(Vl.value, (M) => (c(), w("div", {
|
|
2052
2052
|
key: M.id,
|
|
2053
2053
|
class: "wx-block-editor__shape"
|
|
2054
2054
|
}, [
|
|
@@ -2063,14 +2063,14 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2063
2063
|
_: 2
|
|
2064
2064
|
}, 1024),
|
|
2065
2065
|
M.fields.length ? (c(), w("dl", Lo, [
|
|
2066
|
-
(c(!0), w(F, null,
|
|
2066
|
+
(c(!0), w(F, null, Z(M.fields, (Xe) => (c(), w(F, {
|
|
2067
2067
|
key: Xe.name
|
|
2068
2068
|
}, [
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2069
|
+
E("dt", null, [
|
|
2070
|
+
E("code", null, k(Xe.name), 1),
|
|
2071
|
+
E("span", Wo, k(Xe.type), 1)
|
|
2072
2072
|
]),
|
|
2073
|
-
|
|
2073
|
+
E("dd", null, k(Xe.description), 1)
|
|
2074
2074
|
], 64))), 128))
|
|
2075
2075
|
])) : L("", !0)
|
|
2076
2076
|
]))), 128)),
|
|
@@ -2094,19 +2094,19 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2094
2094
|
label: n(s)("page.tab-styles")
|
|
2095
2095
|
}, {
|
|
2096
2096
|
default: g(() => [
|
|
2097
|
-
|
|
2097
|
+
E("div", Mo, [
|
|
2098
2098
|
v(n(Qe), {
|
|
2099
2099
|
modelValue: $.styles,
|
|
2100
2100
|
"onUpdate:modelValue": y[2] || (y[2] = (M) => $.styles = M),
|
|
2101
2101
|
language: "css",
|
|
2102
|
-
extensions:
|
|
2102
|
+
extensions: xe.styles,
|
|
2103
2103
|
readonly: !_.value,
|
|
2104
2104
|
"min-height": "340px",
|
|
2105
2105
|
"max-height": "70vh"
|
|
2106
2106
|
}, null, 8, ["modelValue", "extensions", "readonly"]),
|
|
2107
2107
|
v(Yt, {
|
|
2108
2108
|
file: "styles",
|
|
2109
|
-
lints:
|
|
2109
|
+
lints: Se.value,
|
|
2110
2110
|
slug: b.slug
|
|
2111
2111
|
}, null, 8, ["lints", "slug"])
|
|
2112
2112
|
])
|
|
@@ -2118,7 +2118,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2118
2118
|
label: n(s)("page.tab-script")
|
|
2119
2119
|
}, {
|
|
2120
2120
|
default: g(() => [
|
|
2121
|
-
|
|
2121
|
+
E("div", No, [
|
|
2122
2122
|
v(n(Qe), {
|
|
2123
2123
|
"model-value": $.script ?? "",
|
|
2124
2124
|
language: "javascript",
|
|
@@ -2127,7 +2127,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2127
2127
|
"max-height": "70vh",
|
|
2128
2128
|
"onUpdate:modelValue": y[3] || (y[3] = (M) => $.script = M || null)
|
|
2129
2129
|
}, null, 8, ["model-value", "readonly"]),
|
|
2130
|
-
|
|
2130
|
+
E("div", zo, [
|
|
2131
2131
|
v(n(J), {
|
|
2132
2132
|
size: "sm",
|
|
2133
2133
|
tone: "muted"
|
|
@@ -2142,18 +2142,18 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2142
2142
|
tone: "muted"
|
|
2143
2143
|
}, {
|
|
2144
2144
|
default: g(() => [
|
|
2145
|
-
B(k(
|
|
2145
|
+
B(k(T.value.provides.length ? n(s)("page.provides", { names: T.value.provides.join(", ") }) : n(s)("page.provides-none")), 1)
|
|
2146
2146
|
]),
|
|
2147
2147
|
_: 1
|
|
2148
2148
|
})
|
|
2149
2149
|
])
|
|
2150
2150
|
]),
|
|
2151
|
-
v(n(
|
|
2151
|
+
v(n(De), {
|
|
2152
2152
|
class: "wx-block-editor__examples",
|
|
2153
2153
|
title: n(s)("page.examples")
|
|
2154
2154
|
}, {
|
|
2155
2155
|
default: g(() => [
|
|
2156
|
-
(c(!0), w(F, null,
|
|
2156
|
+
(c(!0), w(F, null, Z(be.value, (M) => (c(), w("div", {
|
|
2157
2157
|
key: M.title,
|
|
2158
2158
|
class: "wx-block-editor__example"
|
|
2159
2159
|
}, [
|
|
@@ -2166,8 +2166,8 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2166
2166
|
]),
|
|
2167
2167
|
_: 2
|
|
2168
2168
|
}, 1024),
|
|
2169
|
-
|
|
2170
|
-
|
|
2169
|
+
E("pre", null, [
|
|
2170
|
+
E("code", null, k(M.code), 1)
|
|
2171
2171
|
])
|
|
2172
2172
|
]))), 128))
|
|
2173
2173
|
]),
|
|
@@ -2181,35 +2181,35 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2181
2181
|
label: fe.value ? n(s)("components.tab-inputs") : n(s)("page.tab-fields")
|
|
2182
2182
|
}, {
|
|
2183
2183
|
default: g(() => [
|
|
2184
|
-
|
|
2185
|
-
|
|
2184
|
+
E("div", Do, [
|
|
2185
|
+
E("div", Oo, [
|
|
2186
2186
|
v(n(Qe), {
|
|
2187
2187
|
"model-value": R.value,
|
|
2188
2188
|
language: "json",
|
|
2189
|
-
extensions:
|
|
2189
|
+
extensions: xe.schema,
|
|
2190
2190
|
lint: "",
|
|
2191
2191
|
readonly: !_.value,
|
|
2192
2192
|
"min-height": "340px",
|
|
2193
2193
|
"max-height": "70vh",
|
|
2194
|
-
"onUpdate:modelValue":
|
|
2194
|
+
"onUpdate:modelValue": pe
|
|
2195
2195
|
}, null, 8, ["model-value", "extensions", "readonly"]),
|
|
2196
|
-
|
|
2197
|
-
|
|
2196
|
+
E("div", Io, [
|
|
2197
|
+
G.value ? (c(), W(n(J), {
|
|
2198
2198
|
key: 0,
|
|
2199
2199
|
size: "sm",
|
|
2200
2200
|
tone: "danger"
|
|
2201
2201
|
}, {
|
|
2202
2202
|
default: g(() => [
|
|
2203
|
-
B(k(
|
|
2203
|
+
B(k(G.value), 1)
|
|
2204
2204
|
]),
|
|
2205
2205
|
_: 1
|
|
2206
|
-
})) :
|
|
2206
|
+
})) : ge("content.schema") ? (c(), W(n(J), {
|
|
2207
2207
|
key: 1,
|
|
2208
2208
|
size: "sm",
|
|
2209
2209
|
tone: "danger"
|
|
2210
2210
|
}, {
|
|
2211
2211
|
default: g(() => [
|
|
2212
|
-
B(k(
|
|
2212
|
+
B(k(ge("content.schema")), 1)
|
|
2213
2213
|
]),
|
|
2214
2214
|
_: 1
|
|
2215
2215
|
})) : (c(), W(n(J), {
|
|
@@ -2228,15 +2228,15 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2228
2228
|
}, null, 8, ["title", "body"])
|
|
2229
2229
|
])
|
|
2230
2230
|
]),
|
|
2231
|
-
v(n(
|
|
2231
|
+
v(n(De), {
|
|
2232
2232
|
class: "wx-block-editor__sample",
|
|
2233
2233
|
title: n(s)("page.sample")
|
|
2234
2234
|
}, {
|
|
2235
2235
|
default: g(() => [
|
|
2236
2236
|
$.schema.length ? (c(), W(n(cl), {
|
|
2237
2237
|
key: 0,
|
|
2238
|
-
modelValue:
|
|
2239
|
-
"onUpdate:modelValue": y[4] || (y[4] = (M) =>
|
|
2238
|
+
modelValue: ve.value,
|
|
2239
|
+
"onUpdate:modelValue": y[4] || (y[4] = (M) => ve.value = M),
|
|
2240
2240
|
root: n(Ut)($.schema),
|
|
2241
2241
|
types: n(t).types,
|
|
2242
2242
|
translate: n(t).i18n.t,
|
|
@@ -2256,13 +2256,13 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2256
2256
|
label: n(s)("page.tab-settings")
|
|
2257
2257
|
}, {
|
|
2258
2258
|
default: g(() => [
|
|
2259
|
-
v(n(
|
|
2259
|
+
v(n(De), { class: "wx-block-editor__sheet" }, {
|
|
2260
2260
|
default: g(() => [
|
|
2261
|
-
|
|
2262
|
-
v(n(
|
|
2261
|
+
E("div", Uo, [
|
|
2262
|
+
v(n(re), {
|
|
2263
2263
|
label: n(s)("components.kind"),
|
|
2264
2264
|
help: n(s)("components.kind-help"),
|
|
2265
|
-
error:
|
|
2265
|
+
error: ge("kind"),
|
|
2266
2266
|
disabled: !_.value
|
|
2267
2267
|
}, {
|
|
2268
2268
|
default: g(() => [
|
|
@@ -2274,10 +2274,10 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2274
2274
|
]),
|
|
2275
2275
|
_: 1
|
|
2276
2276
|
}, 8, ["label", "help", "error", "disabled"]),
|
|
2277
|
-
v(n(
|
|
2277
|
+
v(n(re), {
|
|
2278
2278
|
label: n(s)("page.identifier"),
|
|
2279
2279
|
help: n(s)("page.identifier-help"),
|
|
2280
|
-
error:
|
|
2280
|
+
error: ge("slug"),
|
|
2281
2281
|
disabled: !_.value
|
|
2282
2282
|
}, {
|
|
2283
2283
|
default: g(() => [
|
|
@@ -2288,11 +2288,11 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2288
2288
|
]),
|
|
2289
2289
|
_: 1
|
|
2290
2290
|
}, 8, ["label", "help", "error", "disabled"]),
|
|
2291
|
-
fe.value ? L("", !0) : (c(), W(n(
|
|
2291
|
+
fe.value ? L("", !0) : (c(), W(n(re), {
|
|
2292
2292
|
key: 0,
|
|
2293
2293
|
label: n(s)("page.group"),
|
|
2294
2294
|
help: n(s)("page.group-help"),
|
|
2295
|
-
error:
|
|
2295
|
+
error: ge("group"),
|
|
2296
2296
|
disabled: !_.value
|
|
2297
2297
|
}, {
|
|
2298
2298
|
default: g(() => [
|
|
@@ -2304,11 +2304,11 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2304
2304
|
]),
|
|
2305
2305
|
_: 1
|
|
2306
2306
|
}, 8, ["label", "help", "error", "disabled"])),
|
|
2307
|
-
v(n(
|
|
2307
|
+
v(n(re), {
|
|
2308
2308
|
class: "is-wide",
|
|
2309
2309
|
label: n(s)("page.description"),
|
|
2310
2310
|
help: n(s)("page.description-help"),
|
|
2311
|
-
error:
|
|
2311
|
+
error: ge("description"),
|
|
2312
2312
|
disabled: !_.value
|
|
2313
2313
|
}, {
|
|
2314
2314
|
default: g(() => [
|
|
@@ -2320,9 +2320,9 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2320
2320
|
]),
|
|
2321
2321
|
_: 1
|
|
2322
2322
|
}, 8, ["label", "help", "error", "disabled"]),
|
|
2323
|
-
v(n(
|
|
2323
|
+
v(n(re), {
|
|
2324
2324
|
label: n(s)("page.icon"),
|
|
2325
|
-
error:
|
|
2325
|
+
error: ge("icon"),
|
|
2326
2326
|
disabled: !_.value
|
|
2327
2327
|
}, {
|
|
2328
2328
|
default: g(() => [
|
|
@@ -2338,10 +2338,10 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2338
2338
|
]),
|
|
2339
2339
|
_: 1
|
|
2340
2340
|
}, 8, ["label", "error", "disabled"]),
|
|
2341
|
-
v(n(
|
|
2341
|
+
v(n(re), {
|
|
2342
2342
|
label: n(s)("page.sort"),
|
|
2343
2343
|
help: n(s)("page.sort-help"),
|
|
2344
|
-
error:
|
|
2344
|
+
error: ge("sort"),
|
|
2345
2345
|
disabled: !_.value
|
|
2346
2346
|
}, {
|
|
2347
2347
|
default: g(() => [
|
|
@@ -2352,11 +2352,11 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2352
2352
|
]),
|
|
2353
2353
|
_: 1
|
|
2354
2354
|
}, 8, ["label", "help", "error", "disabled"]),
|
|
2355
|
-
fe.value ? L("", !0) : (c(), W(n(
|
|
2355
|
+
fe.value ? L("", !0) : (c(), W(n(re), {
|
|
2356
2356
|
key: 1,
|
|
2357
2357
|
label: n(s)("page.allow"),
|
|
2358
2358
|
help: n(s)("page.allow-help"),
|
|
2359
|
-
error:
|
|
2359
|
+
error: ge("allow"),
|
|
2360
2360
|
disabled: !_.value
|
|
2361
2361
|
}, {
|
|
2362
2362
|
default: g(() => [
|
|
@@ -2368,11 +2368,11 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2368
2368
|
]),
|
|
2369
2369
|
_: 1
|
|
2370
2370
|
}, 8, ["label", "help", "error", "disabled"])),
|
|
2371
|
-
fe.value ? L("", !0) : (c(), W(n(
|
|
2371
|
+
fe.value ? L("", !0) : (c(), W(n(re), {
|
|
2372
2372
|
key: 2,
|
|
2373
2373
|
label: n(s)("page.allowed-in"),
|
|
2374
2374
|
help: n(s)("page.allowed-in-help"),
|
|
2375
|
-
error:
|
|
2375
|
+
error: ge("allowed_in"),
|
|
2376
2376
|
disabled: !_.value
|
|
2377
2377
|
}, {
|
|
2378
2378
|
default: g(() => [
|
|
@@ -2385,11 +2385,11 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2385
2385
|
]),
|
|
2386
2386
|
_: 1
|
|
2387
2387
|
}, 8, ["label", "help", "error", "disabled"])),
|
|
2388
|
-
fe.value ? L("", !0) : (c(), W(n(
|
|
2388
|
+
fe.value ? L("", !0) : (c(), W(n(re), {
|
|
2389
2389
|
key: 3,
|
|
2390
2390
|
label: n(s)("page.max-per-entity"),
|
|
2391
2391
|
help: n(s)("page.max-per-entity-help"),
|
|
2392
|
-
error:
|
|
2392
|
+
error: ge("max_per_entity"),
|
|
2393
2393
|
disabled: !_.value
|
|
2394
2394
|
}, {
|
|
2395
2395
|
default: g(() => [
|
|
@@ -2401,7 +2401,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2401
2401
|
]),
|
|
2402
2402
|
_: 1
|
|
2403
2403
|
}, 8, ["label", "help", "error", "disabled"])),
|
|
2404
|
-
fe.value ? L("", !0) : (c(), W(n(
|
|
2404
|
+
fe.value ? L("", !0) : (c(), W(n(re), {
|
|
2405
2405
|
key: 4,
|
|
2406
2406
|
label: n(s)("page.enabled"),
|
|
2407
2407
|
help: n(s)("page.enabled-help"),
|
|
@@ -2416,7 +2416,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2416
2416
|
_: 1
|
|
2417
2417
|
}, 8, ["label", "help", "disabled"])),
|
|
2418
2418
|
_.value ? (c(), w("div", Po, [
|
|
2419
|
-
v(n(
|
|
2419
|
+
v(n(ce), {
|
|
2420
2420
|
type: "danger",
|
|
2421
2421
|
variant: "outline",
|
|
2422
2422
|
disabled: Pe.value !== null,
|
|
@@ -2450,7 +2450,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2450
2450
|
label: n(s)("page.tab-history")
|
|
2451
2451
|
}, {
|
|
2452
2452
|
default: g(() => [
|
|
2453
|
-
v(n(
|
|
2453
|
+
v(n(De), {
|
|
2454
2454
|
class: "wx-block-editor__sheet",
|
|
2455
2455
|
padding: "none"
|
|
2456
2456
|
}, {
|
|
@@ -2483,7 +2483,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2483
2483
|
], 2),
|
|
2484
2484
|
_.value ? (c(), W(n(Dl), { key: 1 }, {
|
|
2485
2485
|
default: g(() => [
|
|
2486
|
-
v(n(
|
|
2486
|
+
v(n(ce), {
|
|
2487
2487
|
variant: "outline",
|
|
2488
2488
|
loading: f.value,
|
|
2489
2489
|
onClick: Ue
|
|
@@ -2493,10 +2493,10 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2493
2493
|
]),
|
|
2494
2494
|
_: 1
|
|
2495
2495
|
}, 8, ["loading"]),
|
|
2496
|
-
v(n(
|
|
2496
|
+
v(n(ce), {
|
|
2497
2497
|
type: "primary",
|
|
2498
2498
|
loading: h.value,
|
|
2499
|
-
disabled: !u.value.draft && !
|
|
2499
|
+
disabled: !u.value.draft && !le.value,
|
|
2500
2500
|
onClick: ct
|
|
2501
2501
|
}, {
|
|
2502
2502
|
default: g(() => [
|
|
@@ -2526,8 +2526,8 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2526
2526
|
},
|
|
2527
2527
|
setup(e) {
|
|
2528
2528
|
const { resolve: l, dismiss: t, open: o } = At();
|
|
2529
|
-
|
|
2530
|
-
const a =
|
|
2529
|
+
Ne();
|
|
2530
|
+
const a = de("webx-blocks");
|
|
2531
2531
|
return (i, s) => (c(), W(n(Bt), {
|
|
2532
2532
|
open: n(o),
|
|
2533
2533
|
"onUpdate:open": s[1] || (s[1] = (r) => Nt(o) ? o.value = r : null),
|
|
@@ -2535,7 +2535,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2535
2535
|
width: 520
|
|
2536
2536
|
}, {
|
|
2537
2537
|
footer: g(() => [
|
|
2538
|
-
v(n(
|
|
2538
|
+
v(n(ce), {
|
|
2539
2539
|
variant: "outline",
|
|
2540
2540
|
onClick: s[0] || (s[0] = (r) => n(t)())
|
|
2541
2541
|
}, {
|
|
@@ -2552,23 +2552,23 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2552
2552
|
title: n(a)("field.move-none"),
|
|
2553
2553
|
size: "sm"
|
|
2554
2554
|
}, null, 8, ["title"])) : (c(), w("div", Fo, [
|
|
2555
|
-
(c(!0), w(F, null,
|
|
2555
|
+
(c(!0), w(F, null, Z(e.destinations, (r) => (c(), w("button", {
|
|
2556
2556
|
key: `${r.parentKey}:${r.field}`,
|
|
2557
2557
|
type: "button",
|
|
2558
2558
|
class: "wx-block-move__place",
|
|
2559
2559
|
disabled: r.full,
|
|
2560
2560
|
onClick: (p) => n(l)(r)
|
|
2561
2561
|
}, [
|
|
2562
|
-
v(n(
|
|
2562
|
+
v(n(ye), {
|
|
2563
2563
|
name: r.parentKey === null ? "file" : "folder"
|
|
2564
2564
|
}, null, 8, ["name"]),
|
|
2565
|
-
|
|
2565
|
+
E("span", Ko, [
|
|
2566
2566
|
r.trail.length === 0 ? (c(), w(F, { key: 0 }, [
|
|
2567
2567
|
B(k(e.topLabel), 1)
|
|
2568
|
-
], 64)) : (c(!0), w(F, { key: 1 },
|
|
2568
|
+
], 64)) : (c(!0), w(F, { key: 1 }, Z(r.trail, (p, u) => (c(), w(F, { key: u }, [
|
|
2569
2569
|
u > 0 ? (c(), w("span", qo, "/")) : L("", !0),
|
|
2570
|
-
|
|
2571
|
-
class:
|
|
2570
|
+
E("span", {
|
|
2571
|
+
class: Me({ "is-last": u === r.trail.length - 1 })
|
|
2572
2572
|
}, k(p), 3)
|
|
2573
2573
|
], 64))), 128))
|
|
2574
2574
|
]),
|
|
@@ -2653,9 +2653,9 @@ const Xo = ["srcdoc"], Qo = {
|
|
|
2653
2653
|
function d(f) {
|
|
2654
2654
|
if (!l.fit) return;
|
|
2655
2655
|
m?.disconnect();
|
|
2656
|
-
const h = f.target, x = h.contentWindow,
|
|
2657
|
-
if (!x || !
|
|
2658
|
-
const _ =
|
|
2656
|
+
const h = f.target, x = h.contentWindow, T = h.contentDocument;
|
|
2657
|
+
if (!x || !T?.body) return;
|
|
2658
|
+
const _ = T.querySelector("[data-wx-block]") ?? T.body, b = () => {
|
|
2659
2659
|
const $ = _.getBoundingClientRect();
|
|
2660
2660
|
a.value = { left: $.left, top: $.top, width: $.width, height: $.height };
|
|
2661
2661
|
};
|
|
@@ -2665,19 +2665,19 @@ const Xo = ["srcdoc"], Qo = {
|
|
|
2665
2665
|
ref_key: "box",
|
|
2666
2666
|
ref: t,
|
|
2667
2667
|
class: "wx-block-thumb",
|
|
2668
|
-
style:
|
|
2668
|
+
style: Ie({ height: `${e.height}px` })
|
|
2669
2669
|
}, [
|
|
2670
2670
|
e.thumbnail ? (c(), w("iframe", {
|
|
2671
2671
|
key: 0,
|
|
2672
2672
|
class: "wx-block-thumb__frame",
|
|
2673
2673
|
srcdoc: p.value,
|
|
2674
|
-
style:
|
|
2674
|
+
style: Ie(u.value),
|
|
2675
2675
|
sandbox: "allow-same-origin",
|
|
2676
2676
|
tabindex: "-1",
|
|
2677
2677
|
"aria-hidden": "true",
|
|
2678
2678
|
onLoad: d
|
|
2679
2679
|
}, null, 44, Xo)) : (c(), w("div", Qo, [
|
|
2680
|
-
v(n(
|
|
2680
|
+
v(n(ye), { name: "grid" })
|
|
2681
2681
|
]))
|
|
2682
2682
|
], 4));
|
|
2683
2683
|
}
|
|
@@ -2703,8 +2703,8 @@ function ts(e, l, t, o) {
|
|
|
2703
2703
|
if (d.key === l) continue;
|
|
2704
2704
|
const f = t.find((x) => x.slug === d.type), h = f?.content ? Ot(f.content.schema) : [];
|
|
2705
2705
|
for (const x of h) {
|
|
2706
|
-
const
|
|
2707
|
-
!r(d.key, x.id) && Vt(i, f,
|
|
2706
|
+
const T = f.title, _ = h.length > 1 ? `${T} · ${x.label ?? x.id}` : T, b = d.values[x.id], $ = rt(b) ? b : [], R = x.props?.max ?? null, G = x.props?.allow ?? null;
|
|
2707
|
+
!r(d.key, x.id) && Vt(i, f, G) && s.push({
|
|
2708
2708
|
parentKey: d.key,
|
|
2709
2709
|
field: x.id,
|
|
2710
2710
|
trail: [...m, _],
|
|
@@ -2730,14 +2730,14 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
2730
2730
|
},
|
|
2731
2731
|
setup(e) {
|
|
2732
2732
|
const l = e, { resolve: t, dismiss: o, open: a } = At();
|
|
2733
|
-
|
|
2734
|
-
const i =
|
|
2733
|
+
Ne();
|
|
2734
|
+
const i = de("webx-blocks"), s = U("");
|
|
2735
2735
|
function r(f) {
|
|
2736
2736
|
return Vt(f, l.parent, l.allow);
|
|
2737
2737
|
}
|
|
2738
2738
|
const p = S(
|
|
2739
2739
|
() => l.catalog.filter(
|
|
2740
|
-
(f) =>
|
|
2740
|
+
(f) => $e(f) !== "component" && f.is_enabled && f.published !== null && r(f)
|
|
2741
2741
|
).map((f) => {
|
|
2742
2742
|
const h = Mn(l.tree, f.slug), x = f.max_per_entity !== null && h >= f.max_per_entity;
|
|
2743
2743
|
return { type: f, reason: x ? i("field.limit-reached", { count: h }) : null };
|
|
@@ -2749,13 +2749,13 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
2749
2749
|
);
|
|
2750
2750
|
}), m = S(() => {
|
|
2751
2751
|
const f = [...l.groups];
|
|
2752
|
-
for (const { type:
|
|
2753
|
-
f.includes(
|
|
2754
|
-
const h = f.map((
|
|
2755
|
-
id:
|
|
2756
|
-
label: qe(
|
|
2757
|
-
options: u.value.filter((_) => _.type.group ===
|
|
2758
|
-
})).filter((
|
|
2752
|
+
for (const { type: T } of u.value)
|
|
2753
|
+
f.includes(T.group) || f.push(T.group);
|
|
2754
|
+
const h = f.map((T) => ({
|
|
2755
|
+
id: T,
|
|
2756
|
+
label: qe(T, i),
|
|
2757
|
+
options: u.value.filter((_) => _.type.group === T)
|
|
2758
|
+
})).filter((T) => T.options.length > 0);
|
|
2759
2759
|
return u.value.length <= 5 || s.value.trim() !== "" || h.length < 2 ? [{ id: "", label: "", options: u.value }] : h;
|
|
2760
2760
|
}), d = S(() => {
|
|
2761
2761
|
if (l.catalog.length === 0) return i("field.pick-none");
|
|
@@ -2771,14 +2771,14 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
2771
2771
|
const x = Mt("router-link");
|
|
2772
2772
|
return c(), W(n(Bt), {
|
|
2773
2773
|
open: n(a),
|
|
2774
|
-
"onUpdate:open": h[2] || (h[2] = (
|
|
2774
|
+
"onUpdate:open": h[2] || (h[2] = (T) => Nt(a) ? a.value = T : null),
|
|
2775
2775
|
title: n(i)("field.pick"),
|
|
2776
2776
|
width: 860
|
|
2777
2777
|
}, {
|
|
2778
2778
|
footer: g(() => [
|
|
2779
|
-
v(n(
|
|
2779
|
+
v(n(ce), {
|
|
2780
2780
|
variant: "outline",
|
|
2781
|
-
onClick: h[1] || (h[1] = (
|
|
2781
|
+
onClick: h[1] || (h[1] = (T) => n(o)())
|
|
2782
2782
|
}, {
|
|
2783
2783
|
default: g(() => [
|
|
2784
2784
|
B(k(n(i)("field.close")), 1)
|
|
@@ -2787,11 +2787,11 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
2787
2787
|
})
|
|
2788
2788
|
]),
|
|
2789
2789
|
default: g(() => [
|
|
2790
|
-
|
|
2790
|
+
E("div", ls, [
|
|
2791
2791
|
p.value.length > 0 ? (c(), W(n(nt), {
|
|
2792
2792
|
key: 0,
|
|
2793
2793
|
modelValue: s.value,
|
|
2794
|
-
"onUpdate:modelValue": h[0] || (h[0] = (
|
|
2794
|
+
"onUpdate:modelValue": h[0] || (h[0] = (T) => s.value = T),
|
|
2795
2795
|
placeholder: n(i)("field.search"),
|
|
2796
2796
|
clearable: "",
|
|
2797
2797
|
autofocus: ""
|
|
@@ -2815,16 +2815,16 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
2815
2815
|
]),
|
|
2816
2816
|
_: 1
|
|
2817
2817
|
}, 8, ["title"])) : L("", !0),
|
|
2818
|
-
(c(!0), w(F, null,
|
|
2819
|
-
key:
|
|
2818
|
+
(c(!0), w(F, null, Z(m.value, (T) => (c(), w("section", {
|
|
2819
|
+
key: T.id,
|
|
2820
2820
|
class: "wx-block-picker__group"
|
|
2821
2821
|
}, [
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
(c(!0), w(F, null,
|
|
2822
|
+
T.label ? (c(), w("div", ns, k(T.label), 1)) : L("", !0),
|
|
2823
|
+
E("div", os, [
|
|
2824
|
+
(c(!0), w(F, null, Z(T.options, (_) => (c(), w("button", {
|
|
2825
2825
|
key: _.type.id,
|
|
2826
2826
|
type: "button",
|
|
2827
|
-
class:
|
|
2827
|
+
class: Me(["wx-block-picker__card", { "is-disabled": _.reason !== null }]),
|
|
2828
2828
|
disabled: _.reason !== null,
|
|
2829
2829
|
title: _.reason ?? void 0,
|
|
2830
2830
|
onClick: (b) => n(t)(_.type)
|
|
@@ -2833,8 +2833,8 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
2833
2833
|
thumbnail: _.type.thumbnail,
|
|
2834
2834
|
height: 96
|
|
2835
2835
|
}, null, 8, ["thumbnail"]),
|
|
2836
|
-
|
|
2837
|
-
|
|
2836
|
+
E("div", as, [
|
|
2837
|
+
E("div", is, k(_.type.title), 1),
|
|
2838
2838
|
_.reason ? (c(), W(n(J), {
|
|
2839
2839
|
key: 0,
|
|
2840
2840
|
size: "sm",
|
|
@@ -2874,7 +2874,7 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
2874
2874
|
},
|
|
2875
2875
|
emits: ["select", "edit"],
|
|
2876
2876
|
setup(e, { expose: l, emit: t }) {
|
|
2877
|
-
const o = e, a = t, i =
|
|
2877
|
+
const o = e, a = t, i = de("webx-blocks"), s = U(null), r = U(null), p = U(null), u = bt(p), m = U(!1), d = U(!1), f = U(null), h = U(0), x = S(() => h.value > 0), T = S(() => [
|
|
2878
2878
|
{ value: 1280, icon: "monitor", ariaLabel: i("field.width-desktop") },
|
|
2879
2879
|
{ value: 834, icon: "tablet", ariaLabel: i("field.width-tablet") },
|
|
2880
2880
|
{ value: 390, icon: "smartphone", ariaLabel: i("field.width-phone") }
|
|
@@ -2885,7 +2885,7 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
2885
2885
|
})), R = S(() => ({
|
|
2886
2886
|
width: `${Math.round(_.value * b.value)}px`,
|
|
2887
2887
|
...x.value ? { height: `${Math.round(h.value * b.value)}px` } : {}
|
|
2888
|
-
})),
|
|
2888
|
+
})), G = S(() => {
|
|
2889
2889
|
if (!o.url) return "";
|
|
2890
2890
|
try {
|
|
2891
2891
|
return `${new URL(o.url, location.origin).pathname} · ${_.value} px`;
|
|
@@ -2893,7 +2893,7 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
2893
2893
|
return o.url;
|
|
2894
2894
|
}
|
|
2895
2895
|
});
|
|
2896
|
-
function
|
|
2896
|
+
function ee() {
|
|
2897
2897
|
try {
|
|
2898
2898
|
return s.value?.contentDocument ?? null;
|
|
2899
2899
|
} catch {
|
|
@@ -2901,93 +2901,93 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
2901
2901
|
}
|
|
2902
2902
|
}
|
|
2903
2903
|
let ae = null, D = null;
|
|
2904
|
-
function P(
|
|
2905
|
-
|
|
2904
|
+
function P(N) {
|
|
2905
|
+
N.documentElement.scrollTop !== 0 && (N.documentElement.scrollTop = 0);
|
|
2906
2906
|
}
|
|
2907
|
-
function
|
|
2908
|
-
const
|
|
2909
|
-
if (!j || !
|
|
2910
|
-
P(
|
|
2911
|
-
const
|
|
2912
|
-
|
|
2907
|
+
function Q() {
|
|
2908
|
+
const N = ee(), j = N?.body;
|
|
2909
|
+
if (!j || !N?.defaultView) return;
|
|
2910
|
+
P(N);
|
|
2911
|
+
const q = N.defaultView.getComputedStyle(j), pe = (parseFloat(q.marginTop) || 0) + (parseFloat(q.marginBottom) || 0), V = Math.ceil(j.scrollHeight + pe);
|
|
2912
|
+
V !== h.value && (h.value = V, he !== null && Hl(() => requestAnimationFrame(xe)));
|
|
2913
2913
|
}
|
|
2914
|
-
function
|
|
2914
|
+
function le(N) {
|
|
2915
2915
|
D?.disconnect();
|
|
2916
|
-
const j =
|
|
2917
|
-
!j || !
|
|
2916
|
+
const j = N.defaultView;
|
|
2917
|
+
!j || !N.body || (D = new j.ResizeObserver(Q), D.observe(N.body), Q());
|
|
2918
2918
|
}
|
|
2919
|
-
function
|
|
2919
|
+
function Se() {
|
|
2920
2920
|
d.value = !0;
|
|
2921
|
-
const
|
|
2922
|
-
|
|
2921
|
+
const N = ee();
|
|
2922
|
+
N && (le(N), ae?.release(), ae = wn(N, {
|
|
2923
2923
|
/* No guard against answering a click with a scroll: `bring` moves nothing that is already
|
|
2924
2924
|
readable, and a block clicked at the very bottom of the window, half under the action
|
|
2925
2925
|
bar, is exactly the one worth moving. */
|
|
2926
2926
|
select: (j) => a("select", j)
|
|
2927
|
-
}), kt(
|
|
2927
|
+
}), kt(N, o.selected ?? null), we(o.selected ?? null));
|
|
2928
2928
|
}
|
|
2929
|
-
let he = null,
|
|
2930
|
-
function
|
|
2931
|
-
|
|
2932
|
-
he = null,
|
|
2933
|
-
}, 400),
|
|
2929
|
+
let he = null, ne = null;
|
|
2930
|
+
function we(N) {
|
|
2931
|
+
N !== null && (he = N, ne !== null && clearTimeout(ne), ne = window.setTimeout(() => {
|
|
2932
|
+
he = null, ne = null;
|
|
2933
|
+
}, 400), xe());
|
|
2934
2934
|
}
|
|
2935
|
-
function
|
|
2935
|
+
function Be(N) {
|
|
2936
2936
|
const j = s.value?.getBoundingClientRect();
|
|
2937
2937
|
if (!j) return null;
|
|
2938
|
-
const
|
|
2939
|
-
return { top: j.top +
|
|
2938
|
+
const q = N.getBoundingClientRect();
|
|
2939
|
+
return { top: j.top + q.top * b.value, height: q.height * b.value };
|
|
2940
2940
|
}
|
|
2941
|
-
function
|
|
2942
|
-
let
|
|
2943
|
-
for (;
|
|
2944
|
-
const j = getComputedStyle(
|
|
2945
|
-
if ((j === "auto" || j === "scroll") &&
|
|
2946
|
-
return
|
|
2947
|
-
|
|
2941
|
+
function ze() {
|
|
2942
|
+
let N = s.value?.parentElement ?? null;
|
|
2943
|
+
for (; N; ) {
|
|
2944
|
+
const j = getComputedStyle(N).overflowY;
|
|
2945
|
+
if ((j === "auto" || j === "scroll") && N.scrollHeight > N.clientHeight)
|
|
2946
|
+
return N;
|
|
2947
|
+
N = N.parentElement;
|
|
2948
2948
|
}
|
|
2949
2949
|
return null;
|
|
2950
2950
|
}
|
|
2951
|
-
function
|
|
2952
|
-
const
|
|
2953
|
-
if (he === null || !
|
|
2954
|
-
P(
|
|
2955
|
-
const j = zt(
|
|
2956
|
-
if (!
|
|
2957
|
-
const
|
|
2958
|
-
top: (
|
|
2959
|
-
bottom: (
|
|
2960
|
-
},
|
|
2961
|
-
|
|
2951
|
+
function xe() {
|
|
2952
|
+
const N = ee();
|
|
2953
|
+
if (he === null || !N) return;
|
|
2954
|
+
P(N);
|
|
2955
|
+
const j = zt(N, he), q = j ? Be(j) : null;
|
|
2956
|
+
if (!q) return;
|
|
2957
|
+
const pe = ze(), V = pe?.getBoundingClientRect(), O = r.value?.getBoundingClientRect().height ?? 0, I = {
|
|
2958
|
+
top: (V?.top ?? 0) + O,
|
|
2959
|
+
bottom: (V ? V.bottom : window.innerHeight) - O
|
|
2960
|
+
}, Y = q.top + q.height, Te = q.top < I.top, Ye = q.height > I.bottom - I.top, Le = Te || Ye ? q.top - I.top : Y > I.bottom ? Y - I.bottom : 0;
|
|
2961
|
+
Le !== 0 && (pe ?? window).scrollBy({ top: Le, behavior: "smooth" });
|
|
2962
2962
|
}
|
|
2963
|
-
function ie(
|
|
2964
|
-
const
|
|
2965
|
-
if (!
|
|
2966
|
-
const
|
|
2967
|
-
return
|
|
2963
|
+
function ie(N, j) {
|
|
2964
|
+
const q = ee();
|
|
2965
|
+
if (!q || !d.value) return !1;
|
|
2966
|
+
const pe = pl(q, N, j);
|
|
2967
|
+
return pe && kt(q, o.selected ?? null), pe;
|
|
2968
2968
|
}
|
|
2969
|
-
function
|
|
2969
|
+
function ve() {
|
|
2970
2970
|
d.value = !1, D?.disconnect(), D = null, s.value && o.url && (s.value.src = o.url);
|
|
2971
2971
|
}
|
|
2972
|
-
function
|
|
2973
|
-
|
|
2972
|
+
function Ce(N) {
|
|
2973
|
+
N.key === "Escape" && m.value && (m.value = !1, N.stopPropagation());
|
|
2974
2974
|
}
|
|
2975
|
-
return
|
|
2975
|
+
return ue(
|
|
2976
2976
|
() => o.selected,
|
|
2977
|
-
(
|
|
2978
|
-
const j =
|
|
2979
|
-
!j || !d.value || (kt(j,
|
|
2977
|
+
(N) => {
|
|
2978
|
+
const j = ee();
|
|
2979
|
+
!j || !d.value || (kt(j, N ?? null), we(N ?? null));
|
|
2980
2980
|
}
|
|
2981
|
-
),
|
|
2981
|
+
), ue(() => o.reload, ve), ue(
|
|
2982
2982
|
() => o.url,
|
|
2983
2983
|
() => d.value = !1
|
|
2984
|
-
), ot(() => window.addEventListener("keydown",
|
|
2985
|
-
window.removeEventListener("keydown",
|
|
2986
|
-
}), l({ replace: ie, refresh:
|
|
2987
|
-
class:
|
|
2988
|
-
style:
|
|
2984
|
+
), ot(() => window.addEventListener("keydown", Ce)), st(() => {
|
|
2985
|
+
window.removeEventListener("keydown", Ce), ne !== null && clearTimeout(ne), D?.disconnect(), ae?.release();
|
|
2986
|
+
}), l({ replace: ie, refresh: ve, open: () => m.value = !0 }), (N, j) => (c(), w("div", {
|
|
2987
|
+
class: Me(["wx-blocks-preview", { "is-fullscreen": m.value, "is-grown": x.value, "is-compact": e.compact }]),
|
|
2988
|
+
style: Ie({ "--wx-preview-scale": b.value })
|
|
2989
2989
|
}, [
|
|
2990
|
-
|
|
2990
|
+
E("div", {
|
|
2991
2991
|
ref_key: "bar",
|
|
2992
2992
|
ref: r,
|
|
2993
2993
|
class: "wx-blocks-preview__bar"
|
|
@@ -2999,26 +2999,26 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
2999
2999
|
truncate: ""
|
|
3000
3000
|
}, {
|
|
3001
3001
|
default: g(() => [
|
|
3002
|
-
B(k(
|
|
3002
|
+
B(k(G.value), 1)
|
|
3003
3003
|
]),
|
|
3004
3004
|
_: 1
|
|
3005
3005
|
}),
|
|
3006
3006
|
v(n(sl), {
|
|
3007
3007
|
class: "wx-blocks-preview__widths",
|
|
3008
3008
|
"model-value": _.value,
|
|
3009
|
-
options:
|
|
3009
|
+
options: T.value,
|
|
3010
3010
|
size: "sm",
|
|
3011
3011
|
"aria-label": n(i)("field.width"),
|
|
3012
|
-
"onUpdate:modelValue": j[0] || (j[0] = (
|
|
3012
|
+
"onUpdate:modelValue": j[0] || (j[0] = (q) => f.value = Number(q))
|
|
3013
3013
|
}, null, 8, ["model-value", "options", "aria-label"]),
|
|
3014
|
-
|
|
3014
|
+
E("div", cs, [
|
|
3015
3015
|
e.compact ? (c(), W(n(et), {
|
|
3016
3016
|
key: 0,
|
|
3017
3017
|
size: "sm",
|
|
3018
3018
|
tone: "primary",
|
|
3019
3019
|
icon: "edit",
|
|
3020
3020
|
title: n(i)("field.blocks"),
|
|
3021
|
-
onClick: j[1] || (j[1] = (
|
|
3021
|
+
onClick: j[1] || (j[1] = (q) => a("edit"))
|
|
3022
3022
|
}, null, 8, ["title"])) : L("", !0),
|
|
3023
3023
|
e.url ? (c(), W(n(et), {
|
|
3024
3024
|
key: 1,
|
|
@@ -3035,18 +3035,18 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3035
3035
|
icon: m.value ? "minimize" : "maximize",
|
|
3036
3036
|
tone: "neutral",
|
|
3037
3037
|
title: m.value ? n(i)("field.close") : n(i)("field.fullscreen"),
|
|
3038
|
-
onClick: j[2] || (j[2] = (
|
|
3038
|
+
onClick: j[2] || (j[2] = (q) => m.value = !m.value)
|
|
3039
3039
|
}, null, 8, ["icon", "title"])
|
|
3040
3040
|
])
|
|
3041
3041
|
], 512),
|
|
3042
|
-
|
|
3042
|
+
E("div", {
|
|
3043
3043
|
ref_key: "box",
|
|
3044
3044
|
ref: p,
|
|
3045
3045
|
class: "wx-blocks-preview__ground"
|
|
3046
3046
|
}, [
|
|
3047
|
-
|
|
3047
|
+
E("div", {
|
|
3048
3048
|
class: "wx-blocks-preview__clip",
|
|
3049
|
-
style:
|
|
3049
|
+
style: Ie(R.value)
|
|
3050
3050
|
}, [
|
|
3051
3051
|
e.url ? (c(), w("iframe", {
|
|
3052
3052
|
key: 0,
|
|
@@ -3054,9 +3054,9 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3054
3054
|
ref: s,
|
|
3055
3055
|
class: "wx-blocks-preview__frame",
|
|
3056
3056
|
src: e.url,
|
|
3057
|
-
style:
|
|
3057
|
+
style: Ie($.value),
|
|
3058
3058
|
title: n(i)("field.preview"),
|
|
3059
|
-
onLoad:
|
|
3059
|
+
onLoad: Se
|
|
3060
3060
|
}, null, 44, ds)) : L("", !0)
|
|
3061
3061
|
], 4)
|
|
3062
3062
|
], 512)
|
|
@@ -3080,7 +3080,7 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3080
3080
|
},
|
|
3081
3081
|
emits: ["select", "add", "remove", "duplicate", "move", "visibility", "reorder"],
|
|
3082
3082
|
setup(e, { emit: l }) {
|
|
3083
|
-
const t = e, o = l, a =
|
|
3083
|
+
const t = e, o = l, a = de("webx-blocks");
|
|
3084
3084
|
function i(m) {
|
|
3085
3085
|
return t.catalog.find((d) => d.slug === m.type) ?? null;
|
|
3086
3086
|
}
|
|
@@ -3147,47 +3147,47 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3147
3147
|
plain: "",
|
|
3148
3148
|
size: "sm",
|
|
3149
3149
|
"empty-text": e.depth === 0 ? n(a)("field.empty") : "",
|
|
3150
|
-
class:
|
|
3150
|
+
class: Me(["wx-blocks-tree", { "is-nested": e.depth > 0 }]),
|
|
3151
3151
|
"onUpdate:modelValue": d[7] || (d[7] = (h) => o("reorder", e.parentKey, e.field, h))
|
|
3152
3152
|
}, {
|
|
3153
3153
|
default: g(({ item: h, index: x }) => [
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
class:
|
|
3154
|
+
E("div", ms, [
|
|
3155
|
+
E("div", {
|
|
3156
|
+
class: Me(["wx-blocks-tree__row", { "is-selected": e.selected === h.key, "is-hidden": h.hidden === !0 }]),
|
|
3157
3157
|
role: "button",
|
|
3158
3158
|
tabindex: "0",
|
|
3159
|
-
onClick: (
|
|
3159
|
+
onClick: (T) => o("select", h.key),
|
|
3160
3160
|
onKeydown: [
|
|
3161
|
-
Kt(qt((
|
|
3162
|
-
Kt(qt((
|
|
3161
|
+
Kt(qt((T) => o("select", h.key), ["prevent"]), ["enter"]),
|
|
3162
|
+
Kt(qt((T) => o("select", h.key), ["prevent"]), ["space"])
|
|
3163
3163
|
]
|
|
3164
3164
|
}, [
|
|
3165
|
-
|
|
3165
|
+
E("span", vs, k(s(h)), 1),
|
|
3166
3166
|
i(h) ? i(h)?.draft ? (c(), w("span", {
|
|
3167
3167
|
key: 1,
|
|
3168
3168
|
class: "wx-blocks-tree__flag is-warning",
|
|
3169
3169
|
title: n(a)("field.draft-type")
|
|
3170
3170
|
}, [
|
|
3171
|
-
v(n(
|
|
3171
|
+
v(n(ye), { name: "warning" })
|
|
3172
3172
|
], 8, gs)) : i(h)?.is_enabled === !1 ? (c(), w("span", {
|
|
3173
3173
|
key: 2,
|
|
3174
3174
|
class: "wx-blocks-tree__flag",
|
|
3175
3175
|
title: n(a)("field.disabled-type")
|
|
3176
3176
|
}, [
|
|
3177
|
-
v(n(
|
|
3177
|
+
v(n(ye), { name: "lock" })
|
|
3178
3178
|
], 8, ks)) : L("", !0) : (c(), w("span", {
|
|
3179
3179
|
key: 0,
|
|
3180
3180
|
class: "wx-blocks-tree__flag is-danger",
|
|
3181
3181
|
title: n(a)("field.unknown-type", { type: h.type })
|
|
3182
3182
|
}, [
|
|
3183
|
-
v(n(
|
|
3183
|
+
v(n(ye), { name: "close-circle" })
|
|
3184
3184
|
], 8, bs)),
|
|
3185
3185
|
h.hidden === !0 ? (c(), w("span", {
|
|
3186
3186
|
key: 3,
|
|
3187
3187
|
class: "wx-blocks-tree__flag",
|
|
3188
3188
|
title: n(a)("field.hidden-note")
|
|
3189
3189
|
}, [
|
|
3190
|
-
v(n(
|
|
3190
|
+
v(n(ye), { name: "eye-off" })
|
|
3191
3191
|
], 8, ys)) : L("", !0),
|
|
3192
3192
|
e.disabled ? L("", !0) : (c(), w("span", ws, [
|
|
3193
3193
|
v(n(tn), {
|
|
@@ -3196,16 +3196,16 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3196
3196
|
}, null, 8, ["actions", "label"])
|
|
3197
3197
|
]))
|
|
3198
3198
|
], 42, hs),
|
|
3199
|
-
(c(!0), w(F, null,
|
|
3200
|
-
key:
|
|
3199
|
+
(c(!0), w(F, null, Z(r(h), (T) => (c(), w("div", {
|
|
3200
|
+
key: T.id,
|
|
3201
3201
|
class: "wx-blocks-tree__kids"
|
|
3202
3202
|
}, [
|
|
3203
3203
|
v(f, {
|
|
3204
|
-
nodes: p(h,
|
|
3204
|
+
nodes: p(h, T),
|
|
3205
3205
|
catalog: e.catalog,
|
|
3206
3206
|
"parent-key": h.key,
|
|
3207
|
-
field:
|
|
3208
|
-
"field-node":
|
|
3207
|
+
field: T.id,
|
|
3208
|
+
"field-node": T,
|
|
3209
3209
|
selected: e.selected,
|
|
3210
3210
|
disabled: e.disabled,
|
|
3211
3211
|
depth: e.depth + 1,
|
|
@@ -3221,11 +3221,11 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3221
3221
|
key: 0,
|
|
3222
3222
|
type: "button",
|
|
3223
3223
|
class: "wx-blocks-tree__add is-inner",
|
|
3224
|
-
onClick: (_) => o("add", h.key,
|
|
3224
|
+
onClick: (_) => o("add", h.key, T.id, T)
|
|
3225
3225
|
}, [
|
|
3226
3226
|
B(" + " + k(n(a)("field.add-inside")), 1),
|
|
3227
3227
|
r(h).length > 1 ? (c(), w(F, { key: 0 }, [
|
|
3228
|
-
B(" · " + k(
|
|
3228
|
+
B(" · " + k(T.label ?? T.id), 1)
|
|
3229
3229
|
], 64)) : L("", !0)
|
|
3230
3230
|
], 8, xs))
|
|
3231
3231
|
]))), 128))
|
|
@@ -3271,18 +3271,18 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3271
3271
|
emits: ["update:modelValue"],
|
|
3272
3272
|
setup(e) {
|
|
3273
3273
|
const l = e, t = Kl(e, "modelValue"), o = Fe(ll, !1), a = Fe(Sl, null);
|
|
3274
|
-
Wt(ll, !0),
|
|
3275
|
-
const i =
|
|
3274
|
+
Wt(ll, !0), Ne();
|
|
3275
|
+
const i = de("webx-blocks"), s = it(), r = Fe(rl, null);
|
|
3276
3276
|
let p = null;
|
|
3277
3277
|
const u = U([]), m = S(() => l.catalog ?? u.value), d = S(() => Array.isArray(t.value) ? t.value : []), f = U(null), h = S(() => f.value ? me(d.value, f.value) : null), x = S(
|
|
3278
3278
|
() => h.value ? m.value.find((A) => A.slug === h.value?.node.type) ?? null : null
|
|
3279
3279
|
);
|
|
3280
|
-
function
|
|
3281
|
-
return m.value.find((
|
|
3280
|
+
function T(A) {
|
|
3281
|
+
return m.value.find((z) => z.slug === A.type)?.title ?? A.type;
|
|
3282
3282
|
}
|
|
3283
3283
|
const _ = S(() => {
|
|
3284
3284
|
const A = [];
|
|
3285
|
-
return ut(d.value, (
|
|
3285
|
+
return ut(d.value, (z) => A.push(z.key)), A;
|
|
3286
3286
|
}), b = S(() => {
|
|
3287
3287
|
const A = f.value ? _.value.indexOf(f.value) : -1;
|
|
3288
3288
|
return {
|
|
@@ -3291,15 +3291,15 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3291
3291
|
};
|
|
3292
3292
|
}), $ = S(() => {
|
|
3293
3293
|
const A = [];
|
|
3294
|
-
let
|
|
3295
|
-
for (;
|
|
3296
|
-
A.unshift({ key:
|
|
3294
|
+
let z = h.value?.parent ?? null;
|
|
3295
|
+
for (; z; )
|
|
3296
|
+
A.unshift({ key: z.key, title: T(z) }), z = me(d.value, z.key)?.parent ?? null;
|
|
3297
3297
|
return A;
|
|
3298
|
-
}), R = Fe(It, null),
|
|
3298
|
+
}), R = Fe(It, null), G = U(null), ee = U(null), ae = bt(ee), D = S(() => R !== null && R.url.value !== null), P = S(() => D.value && ae.value > 0 && ae.value <= 900), Q = U(!1), le = S(() => {
|
|
3299
3299
|
if (!h.value) return;
|
|
3300
3300
|
const A = x.value?.title ?? h.value.node.type;
|
|
3301
|
-
return [...$.value.map((
|
|
3302
|
-
}),
|
|
3301
|
+
return [...$.value.map((z) => z.title), A].join(" / ");
|
|
3302
|
+
}), Se = S(
|
|
3303
3303
|
() => P.value ? {
|
|
3304
3304
|
/* Up from the bottom, and not all the way: the strip of page left above it is what
|
|
3305
3305
|
says the sheet is over the page rather than instead of it. No heading of its own —
|
|
@@ -3317,46 +3317,46 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3317
3317
|
the blocks it is inside spelled out in front of it, because the trail that says so
|
|
3318
3318
|
in the column is part of the heading this replaces. The tree keeps its own heading,
|
|
3319
3319
|
which already says what it is and how many. */
|
|
3320
|
-
title:
|
|
3321
|
-
open:
|
|
3322
|
-
"onUpdate:open": (A) =>
|
|
3320
|
+
title: le.value,
|
|
3321
|
+
open: Q.value,
|
|
3322
|
+
"onUpdate:open": (A) => Q.value = A
|
|
3323
3323
|
} : {}
|
|
3324
3324
|
), he = S(
|
|
3325
3325
|
() => r?.state.manifest?.modules.find((A) => A.id === "blocks")?.meta?.groups ?? []
|
|
3326
|
-
),
|
|
3326
|
+
), ne = ql()?.type, we = S(() => l.context?.types ? l.context.types : r?.types ? { ...ft, ...r.types } : ne ? { ...ft, "wx-blocks": { component: ne, kind: "field", nested: !0 } } : ft), Be = S(
|
|
3327
3327
|
() => l.context?.translate ?? r?.i18n.t ?? ((A) => A)
|
|
3328
|
-
),
|
|
3328
|
+
), ze = S(() => l.context?.can ?? r?.can ?? (() => !0)), xe = St(us);
|
|
3329
3329
|
function ie(A) {
|
|
3330
3330
|
t.value = A;
|
|
3331
3331
|
}
|
|
3332
|
-
async function
|
|
3333
|
-
const
|
|
3334
|
-
if (
|
|
3335
|
-
const Ze = await
|
|
3332
|
+
async function ve(A, z, H, be) {
|
|
3333
|
+
const te = A ? me(d.value, A) : null, fe = te ? m.value.find((dt) => dt.slug === te.node.type) ?? null : a?.value ?? null, Ee = A === null ? l.allow : H?.props?.allow ?? null, Ve = A === null ? l.max : H?.props?.max ?? null, Ge = A === null ? d.value : te && z ? te.node.values[z] ?? [] : [];
|
|
3334
|
+
if (Ve != null && Ge.length >= Ve) return;
|
|
3335
|
+
const Ze = await xe({
|
|
3336
3336
|
catalog: m.value,
|
|
3337
3337
|
parent: fe,
|
|
3338
|
-
allow:
|
|
3338
|
+
allow: Ee,
|
|
3339
3339
|
tree: d.value,
|
|
3340
3340
|
groups: he.value,
|
|
3341
3341
|
blocksPath: l.blocksPath
|
|
3342
3342
|
});
|
|
3343
3343
|
if (!Ze) return;
|
|
3344
|
-
const Pe = Wn(Ze.slug,
|
|
3345
|
-
ie(yt(d.value, A,
|
|
3344
|
+
const Pe = Wn(Ze.slug, Ce(Ze));
|
|
3345
|
+
ie(yt(d.value, A, z, be ?? Ge.length, Pe)), f.value = Pe.key;
|
|
3346
3346
|
}
|
|
3347
|
-
function
|
|
3348
|
-
const
|
|
3349
|
-
for (const [
|
|
3350
|
-
(!Array.isArray(
|
|
3347
|
+
function Ce(A) {
|
|
3348
|
+
const z = A.content?.sample ?? {}, H = {};
|
|
3349
|
+
for (const [be, te] of Object.entries(z))
|
|
3350
|
+
(!Array.isArray(te) || te.length === 0 || typeof te[0] != "object") && (H[be] = te);
|
|
3351
3351
|
return H;
|
|
3352
3352
|
}
|
|
3353
|
-
async function
|
|
3354
|
-
const
|
|
3355
|
-
if (!
|
|
3356
|
-
const H = Nn(
|
|
3353
|
+
async function N(A) {
|
|
3354
|
+
const z = me(d.value, A);
|
|
3355
|
+
if (!z) return;
|
|
3356
|
+
const H = Nn(z.node);
|
|
3357
3357
|
await vt({
|
|
3358
3358
|
title: i("field.remove-title", {
|
|
3359
|
-
title: m.value.find((
|
|
3359
|
+
title: m.value.find((te) => te.slug === z.node.type)?.title ?? z.node.type
|
|
3360
3360
|
}),
|
|
3361
3361
|
message: H > 0 ? i("field.remove-text", { count: H }) : i("field.remove-alone"),
|
|
3362
3362
|
confirmText: i("field.remove"),
|
|
@@ -3365,17 +3365,17 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3365
3365
|
}) && (f.value === A && (f.value = null), ie(Qt(d.value, A)));
|
|
3366
3366
|
}
|
|
3367
3367
|
function j(A) {
|
|
3368
|
-
const
|
|
3369
|
-
if (!
|
|
3370
|
-
const H = bl(
|
|
3371
|
-
ie(yt(d.value,
|
|
3368
|
+
const z = me(d.value, A);
|
|
3369
|
+
if (!z) return;
|
|
3370
|
+
const H = bl(z.node);
|
|
3371
|
+
ie(yt(d.value, z.parent?.key ?? null, z.field, z.index + 1, H)), f.value = H.key;
|
|
3372
3372
|
}
|
|
3373
|
-
const
|
|
3374
|
-
async function
|
|
3375
|
-
const
|
|
3376
|
-
if (!
|
|
3377
|
-
const H = await
|
|
3378
|
-
title:
|
|
3373
|
+
const q = St(Yo);
|
|
3374
|
+
async function pe(A) {
|
|
3375
|
+
const z = me(d.value, A);
|
|
3376
|
+
if (!z) return;
|
|
3377
|
+
const H = await q({
|
|
3378
|
+
title: T(z.node),
|
|
3379
3379
|
destinations: ts(d.value, A, m.value, {
|
|
3380
3380
|
owner: a?.value ?? null,
|
|
3381
3381
|
allow: l.allow,
|
|
@@ -3384,36 +3384,36 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3384
3384
|
topLabel: a?.value?.title ?? i("field.move-page")
|
|
3385
3385
|
});
|
|
3386
3386
|
if (!H) return;
|
|
3387
|
-
const
|
|
3388
|
-
ie(yt(
|
|
3387
|
+
const be = Qt(d.value, A);
|
|
3388
|
+
ie(yt(be, H.parentKey, H.field, Number.MAX_SAFE_INTEGER, z.node));
|
|
3389
3389
|
}
|
|
3390
|
-
function
|
|
3391
|
-
ie(zn(d.value, A,
|
|
3390
|
+
function V(A, z) {
|
|
3391
|
+
ie(zn(d.value, A, z));
|
|
3392
3392
|
}
|
|
3393
|
-
function
|
|
3394
|
-
ie(In(d.value, A,
|
|
3393
|
+
function O(A, z, H) {
|
|
3394
|
+
ie(In(d.value, A, z, H));
|
|
3395
3395
|
}
|
|
3396
|
-
function
|
|
3396
|
+
function I(A) {
|
|
3397
3397
|
f.value = f.value === A ? null : A;
|
|
3398
3398
|
}
|
|
3399
|
-
function
|
|
3400
|
-
A === null || !me(d.value, A) || (f.value = A, P.value && (
|
|
3399
|
+
function Y(A) {
|
|
3400
|
+
A === null || !me(d.value, A) || (f.value = A, P.value && (Q.value = !0));
|
|
3401
3401
|
}
|
|
3402
|
-
function
|
|
3402
|
+
function Te() {
|
|
3403
3403
|
f.value = null;
|
|
3404
3404
|
}
|
|
3405
3405
|
function Ye(A) {
|
|
3406
3406
|
f.value && ie(On(d.value, f.value, A));
|
|
3407
3407
|
}
|
|
3408
|
-
let
|
|
3409
|
-
|
|
3408
|
+
let Le;
|
|
3409
|
+
ue(
|
|
3410
3410
|
() => h.value?.node.values,
|
|
3411
|
-
(A,
|
|
3412
|
-
if (!A || !
|
|
3413
|
-
const H = f.value,
|
|
3414
|
-
clearTimeout(
|
|
3415
|
-
!H || !p || p.render(
|
|
3416
|
-
|
|
3411
|
+
(A, z) => {
|
|
3412
|
+
if (!A || !z || !x.value || !p || !R) return;
|
|
3413
|
+
const H = f.value, be = x.value.id;
|
|
3414
|
+
clearTimeout(Le), Le = setTimeout(() => {
|
|
3415
|
+
!H || !p || p.render(be, { values: A, key: H }).then((te) => {
|
|
3416
|
+
G.value?.replace(H, te.html) || G.value?.refresh();
|
|
3417
3417
|
}).catch(() => {
|
|
3418
3418
|
});
|
|
3419
3419
|
}, 300);
|
|
@@ -3421,7 +3421,7 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3421
3421
|
{ deep: !0 }
|
|
3422
3422
|
);
|
|
3423
3423
|
function Ue(A) {
|
|
3424
|
-
A.key === "Escape" && f.value &&
|
|
3424
|
+
A.key === "Escape" && f.value && Te();
|
|
3425
3425
|
}
|
|
3426
3426
|
ot(async () => {
|
|
3427
3427
|
if (window.addEventListener("keydown", Ue), l.catalog === null && r) {
|
|
@@ -3429,16 +3429,16 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3429
3429
|
try {
|
|
3430
3430
|
u.value = await p.catalog();
|
|
3431
3431
|
} catch (A) {
|
|
3432
|
-
|
|
3432
|
+
X.danger(s(A));
|
|
3433
3433
|
}
|
|
3434
3434
|
} else r && (p = Ke(r));
|
|
3435
3435
|
}), st(() => {
|
|
3436
|
-
clearTimeout(
|
|
3436
|
+
clearTimeout(Le), window.removeEventListener("keydown", Ue);
|
|
3437
3437
|
});
|
|
3438
3438
|
const ct = S(
|
|
3439
3439
|
() => x.value?.content ? Ut(x.value.content.schema) : []
|
|
3440
3440
|
);
|
|
3441
|
-
return (A,
|
|
3441
|
+
return (A, z) => n(o) ? (c(), w("div", Ss, [
|
|
3442
3442
|
v(n(J), {
|
|
3443
3443
|
size: "sm",
|
|
3444
3444
|
tone: "muted"
|
|
@@ -3451,20 +3451,20 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3451
3451
|
])) : (c(), w("div", {
|
|
3452
3452
|
key: 1,
|
|
3453
3453
|
ref_key: "host",
|
|
3454
|
-
ref:
|
|
3455
|
-
class:
|
|
3454
|
+
ref: ee,
|
|
3455
|
+
class: Me(["wx-blocks-host", { "is-compact": P.value }])
|
|
3456
3456
|
}, [
|
|
3457
|
-
|
|
3458
|
-
class:
|
|
3457
|
+
E("div", {
|
|
3458
|
+
class: Me(["wx-blocks", {
|
|
3459
3459
|
"is-editing": h.value !== null,
|
|
3460
3460
|
"has-preview": n(R) !== null && n(R).url.value !== null
|
|
3461
3461
|
}])
|
|
3462
3462
|
}, [
|
|
3463
|
-
(c(), W(Jl(P.value ? n(Il) : "div"), Yl(
|
|
3463
|
+
(c(), W(Jl(P.value ? n(Il) : "div"), Yl(Se.value, { class: "wx-blocks__side" }), {
|
|
3464
3464
|
default: g(() => [
|
|
3465
3465
|
h.value ? L("", !0) : (c(), w("div", Cs, [
|
|
3466
|
-
|
|
3467
|
-
|
|
3466
|
+
E("div", Ts, [
|
|
3467
|
+
E("span", Es, k(n(i)("field.blocks")), 1),
|
|
3468
3468
|
v(n(J), {
|
|
3469
3469
|
size: "sm",
|
|
3470
3470
|
tone: "muted"
|
|
@@ -3475,41 +3475,41 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3475
3475
|
_: 1
|
|
3476
3476
|
})
|
|
3477
3477
|
]),
|
|
3478
|
-
|
|
3478
|
+
E("div", Vs, [
|
|
3479
3479
|
v($s, {
|
|
3480
3480
|
nodes: d.value,
|
|
3481
3481
|
catalog: m.value,
|
|
3482
3482
|
max: e.max,
|
|
3483
3483
|
selected: f.value,
|
|
3484
3484
|
disabled: e.disabled,
|
|
3485
|
-
onSelect:
|
|
3486
|
-
onAdd:
|
|
3487
|
-
onRemove:
|
|
3485
|
+
onSelect: I,
|
|
3486
|
+
onAdd: ve,
|
|
3487
|
+
onRemove: N,
|
|
3488
3488
|
onDuplicate: j,
|
|
3489
|
-
onMove:
|
|
3490
|
-
onVisibility:
|
|
3491
|
-
onReorder:
|
|
3489
|
+
onMove: pe,
|
|
3490
|
+
onVisibility: V,
|
|
3491
|
+
onReorder: O
|
|
3492
3492
|
}, null, 8, ["nodes", "catalog", "max", "selected", "disabled"])
|
|
3493
3493
|
]),
|
|
3494
|
-
|
|
3495
|
-
!e.disabled && (e.max === null || d.value.length < e.max) ? (c(), W(n(
|
|
3494
|
+
E("div", As, [
|
|
3495
|
+
!e.disabled && (e.max === null || d.value.length < e.max) ? (c(), W(n(ce), {
|
|
3496
3496
|
key: 0,
|
|
3497
3497
|
variant: "outline",
|
|
3498
3498
|
icon: "plus",
|
|
3499
3499
|
class: "wx-blocks__add",
|
|
3500
|
-
onClick:
|
|
3500
|
+
onClick: z[0] || (z[0] = (H) => ve(null, null, null))
|
|
3501
3501
|
}, {
|
|
3502
3502
|
default: g(() => [
|
|
3503
3503
|
B(k(n(i)("field.add")), 1)
|
|
3504
3504
|
]),
|
|
3505
3505
|
_: 1
|
|
3506
3506
|
})) : L("", !0),
|
|
3507
|
-
!P.value && n(R) && n(R).url.value ? (c(), W(n(
|
|
3507
|
+
!P.value && n(R) && n(R).url.value ? (c(), W(n(ce), {
|
|
3508
3508
|
key: 1,
|
|
3509
3509
|
variant: "outline",
|
|
3510
3510
|
icon: "eye",
|
|
3511
3511
|
class: "wx-blocks__preview-button",
|
|
3512
|
-
onClick:
|
|
3512
|
+
onClick: z[1] || (z[1] = (H) => G.value?.open())
|
|
3513
3513
|
}, {
|
|
3514
3514
|
default: g(() => [
|
|
3515
3515
|
B(k(n(i)("field.preview")), 1)
|
|
@@ -3519,23 +3519,23 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3519
3519
|
])
|
|
3520
3520
|
])),
|
|
3521
3521
|
h.value ? (c(), w("div", Bs, [
|
|
3522
|
-
|
|
3523
|
-
|
|
3522
|
+
E("div", Ls, [
|
|
3523
|
+
E("span", Ws, [
|
|
3524
3524
|
$.value.length ? (c(), w("span", Ms, [
|
|
3525
|
-
(c(!0), w(F, null,
|
|
3525
|
+
(c(!0), w(F, null, Z($.value, (H) => (c(), w(F, {
|
|
3526
3526
|
key: H.key
|
|
3527
3527
|
}, [
|
|
3528
|
-
|
|
3528
|
+
E("button", {
|
|
3529
3529
|
type: "button",
|
|
3530
3530
|
class: "wx-blocks__trail-step",
|
|
3531
|
-
onClick: (
|
|
3531
|
+
onClick: (be) => I(H.key)
|
|
3532
3532
|
}, k(H.title), 9, Ns),
|
|
3533
|
-
v(n(
|
|
3533
|
+
v(n(ye), { name: "chevron-right" })
|
|
3534
3534
|
], 64))), 128))
|
|
3535
3535
|
])) : L("", !0),
|
|
3536
|
-
|
|
3536
|
+
E("span", zs, k(x.value?.title ?? h.value.node.type), 1)
|
|
3537
3537
|
]),
|
|
3538
|
-
|
|
3538
|
+
E("span", Ds, [
|
|
3539
3539
|
P.value ? L("", !0) : (c(), w("code", Os, k(h.value.node.type), 1)),
|
|
3540
3540
|
v(n(et), {
|
|
3541
3541
|
size: "sm",
|
|
@@ -3543,7 +3543,7 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3543
3543
|
icon: "chevron-up",
|
|
3544
3544
|
title: n(i)("field.previous"),
|
|
3545
3545
|
disabled: b.value.previous === null,
|
|
3546
|
-
onClick:
|
|
3546
|
+
onClick: z[2] || (z[2] = (H) => b.value.previous && I(b.value.previous))
|
|
3547
3547
|
}, null, 8, ["title", "disabled"]),
|
|
3548
3548
|
v(n(et), {
|
|
3549
3549
|
size: "sm",
|
|
@@ -3551,21 +3551,21 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3551
3551
|
icon: "chevron-down",
|
|
3552
3552
|
title: n(i)("field.next"),
|
|
3553
3553
|
disabled: b.value.next === null,
|
|
3554
|
-
onClick:
|
|
3554
|
+
onClick: z[3] || (z[3] = (H) => b.value.next && I(b.value.next))
|
|
3555
3555
|
}, null, 8, ["title", "disabled"]),
|
|
3556
|
-
!P.value && n(R) && n(R).url.value ? (c(), W(n(
|
|
3556
|
+
!P.value && n(R) && n(R).url.value ? (c(), W(n(ce), {
|
|
3557
3557
|
key: 1,
|
|
3558
3558
|
size: "sm",
|
|
3559
3559
|
variant: "outline",
|
|
3560
3560
|
icon: "eye",
|
|
3561
3561
|
class: "wx-blocks__preview-button",
|
|
3562
3562
|
"aria-label": n(i)("field.preview"),
|
|
3563
|
-
onClick:
|
|
3563
|
+
onClick: z[4] || (z[4] = (H) => G.value?.open())
|
|
3564
3564
|
}, null, 8, ["aria-label"])) : L("", !0),
|
|
3565
|
-
v(n(
|
|
3565
|
+
v(n(ce), {
|
|
3566
3566
|
size: "sm",
|
|
3567
3567
|
variant: "outline",
|
|
3568
|
-
onClick:
|
|
3568
|
+
onClick: Te
|
|
3569
3569
|
}, {
|
|
3570
3570
|
default: g(() => [
|
|
3571
3571
|
B(k(P.value ? n(i)("field.done") : `${n(i)("field.done")} · Esc`), 1)
|
|
@@ -3574,14 +3574,14 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3574
3574
|
})
|
|
3575
3575
|
])
|
|
3576
3576
|
]),
|
|
3577
|
-
|
|
3577
|
+
E("div", Is, [
|
|
3578
3578
|
x.value?.content ? (c(), W(n(cl), {
|
|
3579
3579
|
key: h.value.node.key,
|
|
3580
3580
|
"model-value": h.value.node.values,
|
|
3581
3581
|
root: ct.value,
|
|
3582
|
-
types:
|
|
3583
|
-
translate:
|
|
3584
|
-
can:
|
|
3582
|
+
types: we.value,
|
|
3583
|
+
translate: Be.value,
|
|
3584
|
+
can: ze.value,
|
|
3585
3585
|
disabled: e.disabled,
|
|
3586
3586
|
"onUpdate:modelValue": Ye
|
|
3587
3587
|
}, null, 8, ["model-value", "root", "types", "translate", "can", "disabled"])) : (c(), W(n(J), {
|
|
@@ -3602,13 +3602,13 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3602
3602
|
n(R) && n(R).url.value ? (c(), w("div", Us, [
|
|
3603
3603
|
v(fs, {
|
|
3604
3604
|
ref_key: "previewEl",
|
|
3605
|
-
ref:
|
|
3605
|
+
ref: G,
|
|
3606
3606
|
url: n(R).url.value,
|
|
3607
3607
|
selected: f.value,
|
|
3608
3608
|
reload: n(R).reload?.value ?? 0,
|
|
3609
3609
|
compact: P.value,
|
|
3610
|
-
onSelect:
|
|
3611
|
-
onEdit:
|
|
3610
|
+
onSelect: Y,
|
|
3611
|
+
onEdit: z[5] || (z[5] = (H) => Q.value = !0)
|
|
3612
3612
|
}, null, 8, ["url", "selected", "reload", "compact"])
|
|
3613
3613
|
])) : L("", !0)
|
|
3614
3614
|
], 2)
|
|
@@ -3622,7 +3622,7 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3622
3622
|
},
|
|
3623
3623
|
emits: ["open"],
|
|
3624
3624
|
setup(e, { emit: l }) {
|
|
3625
|
-
const t = l, o =
|
|
3625
|
+
const t = l, o = de("webx-blocks");
|
|
3626
3626
|
return (a, i) => (c(), w("button", {
|
|
3627
3627
|
type: "button",
|
|
3628
3628
|
class: "wx-block-card",
|
|
@@ -3630,20 +3630,20 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3630
3630
|
}, [
|
|
3631
3631
|
v(El, {
|
|
3632
3632
|
thumbnail: e.block.thumbnail,
|
|
3633
|
-
height: n(
|
|
3634
|
-
width: n(
|
|
3635
|
-
fit: n(
|
|
3633
|
+
height: n($e)(e.block) === "component" ? 180 : 120,
|
|
3634
|
+
width: n($e)(e.block) === "component" ? 360 : void 0,
|
|
3635
|
+
fit: n($e)(e.block) === "component"
|
|
3636
3636
|
}, null, 8, ["thumbnail", "height", "width", "fit"]),
|
|
3637
|
-
|
|
3638
|
-
|
|
3637
|
+
E("div", js, [
|
|
3638
|
+
E("div", Fs, k(e.block.title), 1),
|
|
3639
3639
|
v(n(J), {
|
|
3640
3640
|
size: "sm",
|
|
3641
3641
|
tone: "muted"
|
|
3642
3642
|
}, {
|
|
3643
3643
|
default: g(() => [
|
|
3644
|
-
|
|
3644
|
+
E("code", null, k(e.block.slug), 1),
|
|
3645
3645
|
i[1] || (i[1] = B(" · ", -1)),
|
|
3646
|
-
n(
|
|
3646
|
+
n($e)(e.block) === "component" ? (c(), w(F, { key: 0 }, [
|
|
3647
3647
|
B(k(n(Tl)(e.block.used_by?.length ?? 0, n(o))) + " ", 1),
|
|
3648
3648
|
e.module ? (c(), w(F, { key: 0 }, [
|
|
3649
3649
|
B("· " + k(n(o)("components.module", { module: e.module })), 1)
|
|
@@ -3654,8 +3654,8 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3654
3654
|
]),
|
|
3655
3655
|
_: 1
|
|
3656
3656
|
}),
|
|
3657
|
-
|
|
3658
|
-
e.block.draft ? (c(), W(n(
|
|
3657
|
+
E("div", Hs, [
|
|
3658
|
+
e.block.draft ? (c(), W(n(ke), {
|
|
3659
3659
|
key: 0,
|
|
3660
3660
|
type: "warning",
|
|
3661
3661
|
dot: ""
|
|
@@ -3665,7 +3665,7 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3665
3665
|
]),
|
|
3666
3666
|
_: 1
|
|
3667
3667
|
})) : L("", !0),
|
|
3668
|
-
e.block.published ? (c(), W(n(
|
|
3668
|
+
e.block.published ? (c(), W(n(ke), {
|
|
3669
3669
|
key: 1,
|
|
3670
3670
|
type: "success",
|
|
3671
3671
|
dot: ""
|
|
@@ -3674,7 +3674,7 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3674
3674
|
B(k(n(o)("page.live", { number: e.block.published.number })), 1)
|
|
3675
3675
|
]),
|
|
3676
3676
|
_: 1
|
|
3677
|
-
})) : (c(), W(n(
|
|
3677
|
+
})) : (c(), W(n(ke), {
|
|
3678
3678
|
key: 2,
|
|
3679
3679
|
type: "default"
|
|
3680
3680
|
}, {
|
|
@@ -3683,7 +3683,7 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3683
3683
|
]),
|
|
3684
3684
|
_: 1
|
|
3685
3685
|
})),
|
|
3686
|
-
!e.block.is_enabled && n(
|
|
3686
|
+
!e.block.is_enabled && n($e)(e.block) !== "component" ? (c(), W(n(ke), {
|
|
3687
3687
|
key: 3,
|
|
3688
3688
|
type: "default",
|
|
3689
3689
|
variant: "outline"
|
|
@@ -3701,8 +3701,8 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3701
3701
|
__name: "BlockCreateDialog",
|
|
3702
3702
|
setup(e) {
|
|
3703
3703
|
const { resolve: l, dismiss: t, open: o } = At(), a = at(), i = Ke(a);
|
|
3704
|
-
|
|
3705
|
-
const s =
|
|
3704
|
+
Ne();
|
|
3705
|
+
const s = de("webx-blocks"), r = it(), p = S(() => a.state.manifest?.modules.find(($) => $.id === "blocks")?.meta?.groups ?? ["content"]), u = U({
|
|
3706
3706
|
kind: "block",
|
|
3707
3707
|
title: "",
|
|
3708
3708
|
slug: "",
|
|
@@ -3713,13 +3713,13 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3713
3713
|
function x(b) {
|
|
3714
3714
|
return b.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/^[^a-z]+/, "").slice(0, 64);
|
|
3715
3715
|
}
|
|
3716
|
-
|
|
3716
|
+
ue(
|
|
3717
3717
|
() => u.value.title,
|
|
3718
3718
|
(b) => {
|
|
3719
3719
|
f.value || (u.value.slug = x(b));
|
|
3720
3720
|
}
|
|
3721
3721
|
);
|
|
3722
|
-
function
|
|
3722
|
+
function T(b) {
|
|
3723
3723
|
return m.value[b]?.[0];
|
|
3724
3724
|
}
|
|
3725
3725
|
async function _() {
|
|
@@ -3729,7 +3729,7 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3729
3729
|
l(await i.create(u.value.kind === "component" ? $ : { ...$, group: b }));
|
|
3730
3730
|
} catch (b) {
|
|
3731
3731
|
const $ = b.body;
|
|
3732
|
-
$?.errors ? m.value = $.errors :
|
|
3732
|
+
$?.errors ? m.value = $.errors : X.danger(r(b, s("page.failed")));
|
|
3733
3733
|
} finally {
|
|
3734
3734
|
d.value = !1;
|
|
3735
3735
|
}
|
|
@@ -3743,7 +3743,7 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3743
3743
|
footer: g(() => [
|
|
3744
3744
|
v(n(Pl), { size: "sm" }, {
|
|
3745
3745
|
default: g(() => [
|
|
3746
|
-
v(n(
|
|
3746
|
+
v(n(ce), {
|
|
3747
3747
|
variant: "outline",
|
|
3748
3748
|
onClick: $[5] || ($[5] = (R) => n(t)())
|
|
3749
3749
|
}, {
|
|
@@ -3752,7 +3752,7 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3752
3752
|
]),
|
|
3753
3753
|
_: 1
|
|
3754
3754
|
}),
|
|
3755
|
-
v(n(
|
|
3755
|
+
v(n(ce), {
|
|
3756
3756
|
type: "primary",
|
|
3757
3757
|
loading: d.value,
|
|
3758
3758
|
onClick: _
|
|
@@ -3767,10 +3767,10 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3767
3767
|
})
|
|
3768
3768
|
]),
|
|
3769
3769
|
default: g(() => [
|
|
3770
|
-
|
|
3771
|
-
v(n(
|
|
3770
|
+
E("div", qs, [
|
|
3771
|
+
v(n(re), {
|
|
3772
3772
|
label: n(s)("components.kind"),
|
|
3773
|
-
error:
|
|
3773
|
+
error: T("kind")
|
|
3774
3774
|
}, {
|
|
3775
3775
|
default: g(() => [
|
|
3776
3776
|
v(n(Ul), {
|
|
@@ -3781,15 +3781,15 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3781
3781
|
default: g(() => [
|
|
3782
3782
|
v(n(Ht), { value: "block" }, {
|
|
3783
3783
|
default: g(() => [
|
|
3784
|
-
|
|
3785
|
-
|
|
3784
|
+
E("span", Js, k(n(s)("components.kind-block")), 1),
|
|
3785
|
+
E("span", Ys, k(n(s)("components.kind-block-help")), 1)
|
|
3786
3786
|
]),
|
|
3787
3787
|
_: 1
|
|
3788
3788
|
}),
|
|
3789
3789
|
v(n(Ht), { value: "component" }, {
|
|
3790
3790
|
default: g(() => [
|
|
3791
|
-
|
|
3792
|
-
|
|
3791
|
+
E("span", Gs, k(n(s)("components.kind-component")), 1),
|
|
3792
|
+
E("span", Zs, k(n(s)("components.kind-component-help")), 1)
|
|
3793
3793
|
]),
|
|
3794
3794
|
_: 1
|
|
3795
3795
|
})
|
|
@@ -3799,9 +3799,9 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3799
3799
|
]),
|
|
3800
3800
|
_: 1
|
|
3801
3801
|
}, 8, ["label", "error"]),
|
|
3802
|
-
v(n(
|
|
3802
|
+
v(n(re), {
|
|
3803
3803
|
label: n(s)("page.title"),
|
|
3804
|
-
error:
|
|
3804
|
+
error: T("title")
|
|
3805
3805
|
}, {
|
|
3806
3806
|
default: g(() => [
|
|
3807
3807
|
v(n(nt), {
|
|
@@ -3812,10 +3812,10 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3812
3812
|
]),
|
|
3813
3813
|
_: 1
|
|
3814
3814
|
}, 8, ["label", "error"]),
|
|
3815
|
-
v(n(
|
|
3815
|
+
v(n(re), {
|
|
3816
3816
|
label: n(s)("page.identifier"),
|
|
3817
3817
|
help: n(s)("page.identifier-help"),
|
|
3818
|
-
error:
|
|
3818
|
+
error: T("slug")
|
|
3819
3819
|
}, {
|
|
3820
3820
|
default: g(() => [
|
|
3821
3821
|
v(n(nt), {
|
|
@@ -3827,11 +3827,11 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3827
3827
|
]),
|
|
3828
3828
|
_: 1
|
|
3829
3829
|
}, 8, ["label", "help", "error"]),
|
|
3830
|
-
u.value.kind === "block" ? (c(), W(n(
|
|
3830
|
+
u.value.kind === "block" ? (c(), W(n(re), {
|
|
3831
3831
|
key: 0,
|
|
3832
3832
|
label: n(s)("page.group"),
|
|
3833
3833
|
help: n(s)("page.group-help"),
|
|
3834
|
-
error:
|
|
3834
|
+
error: T("group")
|
|
3835
3835
|
}, {
|
|
3836
3836
|
default: g(() => [
|
|
3837
3837
|
v(n($t), {
|
|
@@ -3864,20 +3864,20 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3864
3864
|
emits: ["customise"],
|
|
3865
3865
|
setup(e, { emit: l }) {
|
|
3866
3866
|
const t = l;
|
|
3867
|
-
|
|
3868
|
-
const o =
|
|
3867
|
+
Ne();
|
|
3868
|
+
const o = de("webx-blocks");
|
|
3869
3869
|
return (a, i) => (c(), w("div", ea, [
|
|
3870
|
-
|
|
3871
|
-
v(n(
|
|
3870
|
+
E("div", ta, [
|
|
3871
|
+
v(n(ye), { name: "sliders" })
|
|
3872
3872
|
]),
|
|
3873
|
-
|
|
3874
|
-
|
|
3873
|
+
E("div", la, [
|
|
3874
|
+
E("div", na, k(e.declared.title), 1),
|
|
3875
3875
|
v(n(J), {
|
|
3876
3876
|
size: "sm",
|
|
3877
3877
|
tone: "muted"
|
|
3878
3878
|
}, {
|
|
3879
3879
|
default: g(() => [
|
|
3880
|
-
|
|
3880
|
+
E("code", null, k(e.declared.slug), 1),
|
|
3881
3881
|
B(" · " + k(n(o)("components.standard", { module: e.module })), 1)
|
|
3882
3882
|
]),
|
|
3883
3883
|
_: 1
|
|
@@ -3903,7 +3903,7 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3903
3903
|
_: 1
|
|
3904
3904
|
}),
|
|
3905
3905
|
e.canManage ? (c(), w("div", oa, [
|
|
3906
|
-
v(n(
|
|
3906
|
+
v(n(ce), {
|
|
3907
3907
|
size: "sm",
|
|
3908
3908
|
loading: e.busy,
|
|
3909
3909
|
onClick: i[0] || (i[0] = (s) => t("customise", e.declared))
|
|
@@ -3936,108 +3936,112 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
3936
3936
|
},
|
|
3937
3937
|
setup(e) {
|
|
3938
3938
|
const l = e, t = at(), o = Ke(t), a = ul();
|
|
3939
|
-
|
|
3940
|
-
const i =
|
|
3941
|
-
const
|
|
3939
|
+
Ne();
|
|
3940
|
+
const i = de("webx-blocks"), s = it(), r = U([]), p = U([]), u = U(!0), m = U(""), d = U(""), f = U(null), h = St(Qs), x = S(() => {
|
|
3941
|
+
const V = t.state.manifest?.modules.find((O) => O.id === "blocks")?.meta;
|
|
3942
3942
|
return {
|
|
3943
|
-
groups:
|
|
3944
|
-
editing:
|
|
3945
|
-
provides:
|
|
3943
|
+
groups: V?.groups ?? [],
|
|
3944
|
+
editing: V?.editing ?? !0,
|
|
3945
|
+
provides: V?.provides ?? []
|
|
3946
3946
|
};
|
|
3947
|
-
}),
|
|
3948
|
-
() => t.state.manifest?.modules.find((
|
|
3949
|
-
), b = S(() => r.value.filter((
|
|
3950
|
-
function
|
|
3951
|
-
return t.state.manifest?.modules.find((
|
|
3947
|
+
}), T = S(() => t.can("blocks.manage") && x.value.editing), _ = S(
|
|
3948
|
+
() => t.state.manifest?.modules.find((V) => V.id === "blocks")?.title ?? i("module.title")
|
|
3949
|
+
), b = S(() => r.value.filter((V) => $e(V) === "block")), $ = S(() => r.value.filter((V) => $e(V) === "component")), R = S(() => p.value.filter((V) => !V.customised)), G = S(() => $.value.length > 0 || R.value.length > 0);
|
|
3950
|
+
function ee(V) {
|
|
3951
|
+
return t.state.manifest?.modules.find((O) => O.id === V)?.title ?? V.charAt(0).toUpperCase() + V.slice(1);
|
|
3952
3952
|
}
|
|
3953
|
-
function ae(
|
|
3954
|
-
const
|
|
3955
|
-
return
|
|
3953
|
+
function ae(V) {
|
|
3954
|
+
const O = p.value.find((I) => I.slug === V);
|
|
3955
|
+
return O ? ee(O.module) : null;
|
|
3956
3956
|
}
|
|
3957
|
-
function D(
|
|
3958
|
-
const
|
|
3959
|
-
return
|
|
3957
|
+
function D(V) {
|
|
3958
|
+
const O = m.value.trim().toLowerCase();
|
|
3959
|
+
return O === "" || V.some((I) => (I ?? "").toLowerCase().includes(O));
|
|
3960
3960
|
}
|
|
3961
|
-
const P = S(() => d.value === je ? [] : (d.value === "" ? b.value : b.value.filter((
|
|
3962
|
-
() => d.value === "" || d.value === je ? $.value.filter((
|
|
3963
|
-
),
|
|
3964
|
-
() => d.value === "" || d.value === je ? R.value.filter((
|
|
3965
|
-
),
|
|
3966
|
-
const
|
|
3967
|
-
for (const
|
|
3968
|
-
|
|
3969
|
-
return
|
|
3961
|
+
const P = S(() => d.value === je ? [] : (d.value === "" ? b.value : b.value.filter((O) => O.group === d.value)).filter((O) => D([O.title, O.slug, O.description]))), Q = S(
|
|
3962
|
+
() => d.value === "" || d.value === je ? $.value.filter((V) => D([V.title, V.slug, V.description])) : []
|
|
3963
|
+
), le = S(
|
|
3964
|
+
() => d.value === "" || d.value === je ? R.value.filter((V) => D([V.title, V.slug, V.description])) : []
|
|
3965
|
+
), Se = S(() => {
|
|
3966
|
+
const V = [...x.value.groups];
|
|
3967
|
+
for (const O of b.value)
|
|
3968
|
+
V.includes(O.group) || V.push(O.group);
|
|
3969
|
+
return V.filter((O) => b.value.some((I) => I.group === O));
|
|
3970
3970
|
}), he = S(() => {
|
|
3971
|
-
const
|
|
3972
|
-
return
|
|
3973
|
-
}),
|
|
3974
|
-
const
|
|
3975
|
-
id:
|
|
3976
|
-
label: qe(
|
|
3977
|
-
blocks: P.value.filter((
|
|
3978
|
-
})).filter((
|
|
3979
|
-
return d.value !== "" || P.value.length <= 5 || m.value.trim() !== "" ||
|
|
3980
|
-
}),
|
|
3971
|
+
const V = Se.value.map((I) => ({ value: I, label: qe(I, i) })), O = G.value ? [{ value: je, label: i("components.components") }] : [];
|
|
3972
|
+
return V.length + O.length < 2 ? [] : [{ value: "", label: i("page.all-groups") }, ...V, ...O];
|
|
3973
|
+
}), ne = S(() => {
|
|
3974
|
+
const V = Se.value.map((Y) => ({
|
|
3975
|
+
id: Y,
|
|
3976
|
+
label: qe(Y, i),
|
|
3977
|
+
blocks: P.value.filter((Te) => Te.group === Y)
|
|
3978
|
+
})).filter((Y) => Y.blocks.length > 0);
|
|
3979
|
+
return d.value !== "" || P.value.length <= 5 || m.value.trim() !== "" || V.length < 2 ? P.value.length === 0 ? [] : [{ id: "", label: d.value === "" && Q.value.length + le.value.length > 0 ? i("components.blocks") : "", blocks: P.value }] : V;
|
|
3980
|
+
}), we = S(
|
|
3981
3981
|
() => d.value === je || P.value.length === 0 ? "" : i("components.components")
|
|
3982
|
-
),
|
|
3983
|
-
() =>
|
|
3982
|
+
), Be = S(() => r.value.length === 0 && R.value.length === 0), ze = S(
|
|
3983
|
+
() => T.value && d.value !== je && m.value.trim() === ""
|
|
3984
3984
|
);
|
|
3985
|
-
async function
|
|
3986
|
-
const
|
|
3987
|
-
r.value = r.value.map((
|
|
3985
|
+
async function xe(V) {
|
|
3986
|
+
const O = V.map((Y) => Y.id), I = [...V];
|
|
3987
|
+
r.value = r.value.map((Y) => O.includes(Y.id) ? I.shift() : Y);
|
|
3988
3988
|
try {
|
|
3989
|
-
await o.reorder(
|
|
3990
|
-
} catch (
|
|
3991
|
-
|
|
3989
|
+
await o.reorder(O);
|
|
3990
|
+
} catch (Y) {
|
|
3991
|
+
X.danger(s(Y)), await ie();
|
|
3992
3992
|
}
|
|
3993
3993
|
}
|
|
3994
3994
|
async function ie() {
|
|
3995
3995
|
u.value = !0;
|
|
3996
3996
|
try {
|
|
3997
|
-
const
|
|
3998
|
-
r.value =
|
|
3999
|
-
} catch (
|
|
4000
|
-
|
|
3997
|
+
const V = await o.index();
|
|
3998
|
+
r.value = V.blocks, p.value = V.declared;
|
|
3999
|
+
} catch (V) {
|
|
4000
|
+
X.danger(s(V));
|
|
4001
4001
|
} finally {
|
|
4002
4002
|
u.value = !1;
|
|
4003
4003
|
}
|
|
4004
4004
|
}
|
|
4005
|
-
|
|
4006
|
-
|
|
4005
|
+
let ve = 0;
|
|
4006
|
+
function Ce() {
|
|
4007
|
+
ve = Date.now();
|
|
4008
|
+
}
|
|
4009
|
+
function N(V) {
|
|
4010
|
+
Date.now() - ve < 400 || a.push(`${l.base}/${V.id}`);
|
|
4007
4011
|
}
|
|
4008
|
-
async function
|
|
4009
|
-
const
|
|
4010
|
-
|
|
4012
|
+
async function j() {
|
|
4013
|
+
const V = await h({});
|
|
4014
|
+
V && N(V);
|
|
4011
4015
|
}
|
|
4012
|
-
async function
|
|
4013
|
-
f.value =
|
|
4016
|
+
async function q(V) {
|
|
4017
|
+
f.value = V.slug;
|
|
4014
4018
|
try {
|
|
4015
|
-
const
|
|
4016
|
-
|
|
4017
|
-
} catch (
|
|
4018
|
-
const I =
|
|
4019
|
-
if (
|
|
4020
|
-
|
|
4019
|
+
const O = await o.customise(V.slug);
|
|
4020
|
+
X.success(i("components.customised")), N(O);
|
|
4021
|
+
} catch (O) {
|
|
4022
|
+
const I = O.body;
|
|
4023
|
+
if (O.status === 409 && typeof I?.id == "number") {
|
|
4024
|
+
N({ id: I.id });
|
|
4021
4025
|
return;
|
|
4022
4026
|
}
|
|
4023
|
-
|
|
4027
|
+
X.danger(s(O, i("components.customise-failed")));
|
|
4024
4028
|
} finally {
|
|
4025
4029
|
f.value = null;
|
|
4026
4030
|
}
|
|
4027
4031
|
}
|
|
4028
4032
|
ot(ie);
|
|
4029
|
-
const
|
|
4030
|
-
() =>
|
|
4031
|
-
|
|
4033
|
+
const pe = S(
|
|
4034
|
+
() => T.value ? [{ key: "new", label: i("page.new"), icon: "plus", primary: !0, run: () => {
|
|
4035
|
+
j();
|
|
4032
4036
|
} }] : []
|
|
4033
4037
|
);
|
|
4034
|
-
return (
|
|
4038
|
+
return (V, O) => (c(), W(n(ln), {
|
|
4035
4039
|
view: d.value,
|
|
4036
|
-
"onUpdate:view":
|
|
4040
|
+
"onUpdate:view": O[2] || (O[2] = (I) => d.value = I),
|
|
4037
4041
|
class: "wx-blocks-page",
|
|
4038
4042
|
title: _.value,
|
|
4039
4043
|
views: he.value,
|
|
4040
|
-
actions:
|
|
4044
|
+
actions: pe.value
|
|
4041
4045
|
}, {
|
|
4042
4046
|
default: g(() => [
|
|
4043
4047
|
x.value.editing ? L("", !0) : (c(), W(n(al), {
|
|
@@ -4046,10 +4050,10 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
4046
4050
|
variant: "soft",
|
|
4047
4051
|
description: n(i)("page.editing-off")
|
|
4048
4052
|
}, null, 8, ["description"])),
|
|
4049
|
-
u.value || !
|
|
4053
|
+
u.value || !Be.value ? (c(), w("div", ia, [
|
|
4050
4054
|
v(n(nt), {
|
|
4051
4055
|
modelValue: m.value,
|
|
4052
|
-
"onUpdate:modelValue":
|
|
4056
|
+
"onUpdate:modelValue": O[0] || (O[0] = (I) => m.value = I),
|
|
4053
4057
|
class: "wx-blocks-page__search",
|
|
4054
4058
|
placeholder: n(i)("page.search"),
|
|
4055
4059
|
clearable: ""
|
|
@@ -4057,8 +4061,8 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
4057
4061
|
])) : L("", !0),
|
|
4058
4062
|
u.value ? (c(), W(n(He), { key: 2 }, {
|
|
4059
4063
|
template: g(() => [
|
|
4060
|
-
|
|
4061
|
-
(c(), w(F, null,
|
|
4064
|
+
E("div", ra, [
|
|
4065
|
+
(c(), w(F, null, Z(4, (I) => E("div", {
|
|
4062
4066
|
key: I,
|
|
4063
4067
|
class: "wx-blocks-page__ghost"
|
|
4064
4068
|
}, [
|
|
@@ -4067,7 +4071,7 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
4067
4071
|
height: 120,
|
|
4068
4072
|
class: "wx-blocks-page__ghost-thumb"
|
|
4069
4073
|
}),
|
|
4070
|
-
|
|
4074
|
+
E("div", ua, [
|
|
4071
4075
|
v(n(pt), {
|
|
4072
4076
|
variant: "title",
|
|
4073
4077
|
width: "45%"
|
|
@@ -4086,13 +4090,13 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
4086
4090
|
])
|
|
4087
4091
|
]),
|
|
4088
4092
|
_: 1
|
|
4089
|
-
})) :
|
|
4093
|
+
})) : Be.value ? (c(), W(n(Lt), {
|
|
4090
4094
|
key: 3,
|
|
4091
4095
|
icon: "grid",
|
|
4092
4096
|
title: n(i)("page.empty"),
|
|
4093
4097
|
description: n(i)("page.empty-help")
|
|
4094
4098
|
}, null, 8, ["title", "description"])) : (c(), w(F, { key: 4 }, [
|
|
4095
|
-
(c(!0), w(F, null,
|
|
4099
|
+
(c(!0), w(F, null, Z(ne.value, (I) => (c(), w("section", {
|
|
4096
4100
|
key: I.id,
|
|
4097
4101
|
class: "wx-blocks-page__group"
|
|
4098
4102
|
}, [
|
|
@@ -4100,40 +4104,41 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
4100
4104
|
v(n(rn), {
|
|
4101
4105
|
"model-value": I.blocks,
|
|
4102
4106
|
class: "wx-blocks-page__cards",
|
|
4103
|
-
disabled: !
|
|
4107
|
+
disabled: !ze.value,
|
|
4104
4108
|
animation: 160,
|
|
4105
4109
|
delay: 200,
|
|
4106
4110
|
"delay-on-touch-only": !0,
|
|
4107
4111
|
"force-fallback": !0,
|
|
4108
4112
|
"ghost-class": "is-ghost",
|
|
4109
|
-
|
|
4113
|
+
onEnd: Ce,
|
|
4114
|
+
"onUpdate:modelValue": O[1] || (O[1] = (Y) => xe(Y))
|
|
4110
4115
|
}, {
|
|
4111
4116
|
default: g(() => [
|
|
4112
|
-
(c(!0), w(F, null,
|
|
4113
|
-
key:
|
|
4114
|
-
block:
|
|
4115
|
-
onOpen:
|
|
4117
|
+
(c(!0), w(F, null, Z(I.blocks, (Y) => (c(), W(ol, {
|
|
4118
|
+
key: Y.id,
|
|
4119
|
+
block: Y,
|
|
4120
|
+
onOpen: N
|
|
4116
4121
|
}, null, 8, ["block"]))), 128))
|
|
4117
4122
|
]),
|
|
4118
4123
|
_: 2
|
|
4119
4124
|
}, 1032, ["model-value", "disabled"])
|
|
4120
4125
|
]))), 128)),
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
(c(!0), w(F, null,
|
|
4126
|
+
Q.value.length > 0 || le.value.length > 0 ? (c(), w("section", da, [
|
|
4127
|
+
we.value ? (c(), w("div", pa, k(we.value), 1)) : L("", !0),
|
|
4128
|
+
E("div", fa, [
|
|
4129
|
+
(c(!0), w(F, null, Z(Q.value, (I) => (c(), W(ol, {
|
|
4125
4130
|
key: I.id,
|
|
4126
4131
|
block: I,
|
|
4127
4132
|
module: ae(I.slug),
|
|
4128
|
-
onOpen:
|
|
4133
|
+
onOpen: N
|
|
4129
4134
|
}, null, 8, ["block", "module"]))), 128)),
|
|
4130
|
-
(c(!0), w(F, null,
|
|
4135
|
+
(c(!0), w(F, null, Z(le.value, (I) => (c(), W(aa, {
|
|
4131
4136
|
key: I.slug,
|
|
4132
4137
|
declared: I,
|
|
4133
|
-
module:
|
|
4134
|
-
"can-manage":
|
|
4138
|
+
module: ee(I.module),
|
|
4139
|
+
"can-manage": T.value,
|
|
4135
4140
|
busy: f.value === I.slug,
|
|
4136
|
-
onCustomise:
|
|
4141
|
+
onCustomise: q
|
|
4137
4142
|
}, null, 8, ["declared", "module", "can-manage", "busy"]))), 128))
|
|
4138
4143
|
])
|
|
4139
4144
|
])) : L("", !0)
|
|
@@ -4142,7 +4147,7 @@ const ls = { class: "wx-block-picker" }, ns = {
|
|
|
4142
4147
|
_: 1
|
|
4143
4148
|
}, 8, ["view", "title", "views", "actions"]));
|
|
4144
4149
|
}
|
|
4145
|
-
}), ha = /* @__PURE__ */ se(ma, [["__scopeId", "data-v-
|
|
4150
|
+
}), ha = /* @__PURE__ */ se(ma, [["__scopeId", "data-v-14d130be"]]);
|
|
4146
4151
|
function Ta(e = {}) {
|
|
4147
4152
|
const l = e.path ?? "/blocks";
|
|
4148
4153
|
return {
|
|
@@ -4200,7 +4205,7 @@ export {
|
|
|
4200
4205
|
yt as insertNode,
|
|
4201
4206
|
hl as isNode,
|
|
4202
4207
|
rt as isNodeList,
|
|
4203
|
-
|
|
4208
|
+
$e as kindOf,
|
|
4204
4209
|
vo as lintBlock,
|
|
4205
4210
|
me as locate,
|
|
4206
4211
|
Wn as makeNode,
|