@webx-ui/module-blocks 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BlockDataField.d.ts +3 -1
- package/dist/index.js +229 -226
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WxCodeEditor as Ye, WxText as H, WxIcon as we, WxSkeleton as Pe, WxBadge as he, WxButton as ue, confirm as ct, toast as K, useElementWidth as dt, WxSegmented as Kt, WxCard as Ne, WxPopover as Vl, WxAlert as Yt, WxTabs as Al, WxTab as Ue, WxFormItem as ne, WxSelect as kt, WxInput as et, WxTextarea as Gt, WxIconPicker as Bl, WxInputNumber as Lt, WxTagsInput as Wt, WxSwitch as Ll, WxActionBar as Wl, useModal as Zt, WxDialog as Qt, WxEmpty as Xt, WxAction as Ge, WxSortableList as Nl, createModal as el, WxDrawer as zl, WxRadioGroup as Ml, WxRadio as Nt, WxSpace as Ol, WxSkeletonItem as at } from "@webx-ui/core";
|
|
2
|
-
import { defineComponent as se, ref as I, watch as oe, openBlock as c, createElementBlock as x, createVNode as h, unref as n, createBlock as O, withCtx as b, createTextVNode as L, toDisplayString as k, createCommentVNode as W, computed as $, createElementVNode as V, Fragment as P, renderList as Y, onMounted as tt, onBeforeUnmount as pt, normalizeStyle as Me, reactive as ht, resolveComponent as _t, normalizeClass as Oe, withDirectives as Dl, vShow as Il, inject as Ze, watchEffect as Ul, isRef as tl, nextTick as Pl, withKeys as zt, withModifiers as Mt, provide as ll, useModel as Rl, getCurrentInstance as jl, resolveDynamicComponent as Fl, mergeProps as Hl, mergeModels as
|
|
3
|
-
import { useAdmin as lt, useTranslate as ce, useErrorText as nt, WxDate as
|
|
2
|
+
import { defineComponent as se, ref as I, watch as oe, openBlock as c, createElementBlock as x, createVNode as h, unref as n, createBlock as O, withCtx as b, createTextVNode as L, toDisplayString as k, createCommentVNode as W, computed as $, createElementVNode as V, Fragment as P, renderList as Y, onMounted as tt, onBeforeUnmount as pt, normalizeStyle as Me, reactive as ht, resolveComponent as _t, normalizeClass as Oe, withDirectives as Dl, vShow as Il, inject as Ze, watchEffect as Ul, isRef as tl, nextTick as Pl, withKeys as zt, withModifiers as Mt, provide as ll, useModel as Rl, getCurrentInstance as jl, resolveDynamicComponent as Fl, mergeProps as Hl, mergeModels as ql } from "vue";
|
|
3
|
+
import { useAdmin as lt, useTranslate as ce, useErrorText as nt, WxDate as Jl, WxScreenHead as Kl, WxRenameButton as Yl, WxHelpButton as Gl, adminKey as nl, WxRowMenu as Zl, WxListScreen as Ql } from "@webx-ui/module-admin";
|
|
4
4
|
import { useRoute as Xl, useRouter as ol } from "vue-router";
|
|
5
5
|
import { WxScreenRenderer as sl, coreTypes as it } from "@webx-ui/schema";
|
|
6
6
|
import { autocompletion as en, pickedCompletion as Fe, snippetCompletion as ye, startCompletion as tn } from "@codemirror/autocomplete";
|
|
@@ -219,13 +219,16 @@ const on = { class: "wx-block-data" }, sn = /* @__PURE__ */ se({
|
|
|
219
219
|
const t = e, o = l;
|
|
220
220
|
De();
|
|
221
221
|
const a = ce("webx-blocks"), i = I(u(t.modelValue)), s = I(null);
|
|
222
|
-
function u(
|
|
223
|
-
return JSON.stringify(
|
|
222
|
+
function u(f) {
|
|
223
|
+
return f == null ? "" : JSON.stringify(f, null, 2);
|
|
224
224
|
}
|
|
225
|
-
function d(
|
|
226
|
-
|
|
225
|
+
function d(f) {
|
|
226
|
+
return f.trim() === "" ? null : JSON.parse(f);
|
|
227
|
+
}
|
|
228
|
+
function r(f) {
|
|
229
|
+
i.value = f;
|
|
227
230
|
try {
|
|
228
|
-
const p =
|
|
231
|
+
const p = d(f);
|
|
229
232
|
s.value = null, o("update:modelValue", p);
|
|
230
233
|
} catch (p) {
|
|
231
234
|
s.value = a("components.data-invalid", { error: p.message });
|
|
@@ -233,26 +236,26 @@ const on = { class: "wx-block-data" }, sn = /* @__PURE__ */ se({
|
|
|
233
236
|
}
|
|
234
237
|
return oe(
|
|
235
238
|
() => t.modelValue,
|
|
236
|
-
(
|
|
239
|
+
(f) => {
|
|
237
240
|
let p = !1;
|
|
238
241
|
try {
|
|
239
|
-
p = JSON.stringify(
|
|
242
|
+
p = JSON.stringify(d(i.value)) === JSON.stringify(f ?? null);
|
|
240
243
|
} catch {
|
|
241
244
|
p = !1;
|
|
242
245
|
}
|
|
243
|
-
p || (i.value = u(
|
|
246
|
+
p || (i.value = u(f), s.value = null);
|
|
244
247
|
},
|
|
245
248
|
{ deep: !0 }
|
|
246
|
-
), (
|
|
249
|
+
), (f, p) => (c(), x("div", on, [
|
|
247
250
|
h(n(Ye), {
|
|
248
251
|
"model-value": i.value,
|
|
249
252
|
language: "json",
|
|
250
|
-
lint: "",
|
|
253
|
+
lint: i.value.trim() !== "",
|
|
251
254
|
readonly: e.disabled,
|
|
252
255
|
"min-height": "120px",
|
|
253
256
|
"max-height": "320px",
|
|
254
|
-
"onUpdate:modelValue":
|
|
255
|
-
}, null, 8, ["model-value", "readonly"]),
|
|
257
|
+
"onUpdate:modelValue": r
|
|
258
|
+
}, null, 8, ["model-value", "lint", "readonly"]),
|
|
256
259
|
s.value ? (c(), O(n(H), {
|
|
257
260
|
key: 0,
|
|
258
261
|
size: "sm",
|
|
@@ -270,7 +273,7 @@ const on = { class: "wx-block-data" }, sn = /* @__PURE__ */ se({
|
|
|
270
273
|
for (const [o, a] of l)
|
|
271
274
|
t[o] = a;
|
|
272
275
|
return t;
|
|
273
|
-
}, an = /* @__PURE__ */ ae(sn, [["__scopeId", "data-v-
|
|
276
|
+
}, an = /* @__PURE__ */ ae(sn, [["__scopeId", "data-v-b994c835"]]);
|
|
274
277
|
function Re(e) {
|
|
275
278
|
const l = `${e.apiPath}/blocks`, t = (o) => o.data;
|
|
276
279
|
return {
|
|
@@ -354,10 +357,10 @@ const rn = { class: "wx-block-checks" }, un = {
|
|
|
354
357
|
async function r() {
|
|
355
358
|
d.value = await i.versions(t.block.id);
|
|
356
359
|
}
|
|
357
|
-
function
|
|
360
|
+
function f(m) {
|
|
358
361
|
return t.block.draft?.number === m.number ? "draft" : t.block.published?.number === m.number ? "live" : "replaced";
|
|
359
362
|
}
|
|
360
|
-
async function
|
|
363
|
+
async function p(m) {
|
|
361
364
|
if (await ct({
|
|
362
365
|
title: s("page.restore-title", { number: m.number }),
|
|
363
366
|
message: s("page.restore-text"),
|
|
@@ -389,7 +392,7 @@ const rn = { class: "wx-block-checks" }, un = {
|
|
|
389
392
|
V("div", fn, [
|
|
390
393
|
h(n(H), null, {
|
|
391
394
|
default: b(() => [
|
|
392
|
-
L(k(n(s)(`page.version-${
|
|
395
|
+
L(k(n(s)(`page.version-${f(S)}`)), 1)
|
|
393
396
|
]),
|
|
394
397
|
_: 2
|
|
395
398
|
}, 1024),
|
|
@@ -398,7 +401,7 @@ const rn = { class: "wx-block-checks" }, un = {
|
|
|
398
401
|
tone: "muted"
|
|
399
402
|
}, {
|
|
400
403
|
default: b(() => [
|
|
401
|
-
S.created_at ? (c(), O(n(
|
|
404
|
+
S.created_at ? (c(), O(n(Jl), {
|
|
402
405
|
key: 0,
|
|
403
406
|
value: S.created_at
|
|
404
407
|
}, null, 8, ["value"])) : W("", !0),
|
|
@@ -410,7 +413,7 @@ const rn = { class: "wx-block-checks" }, un = {
|
|
|
410
413
|
_: 2
|
|
411
414
|
}, 1024)
|
|
412
415
|
]),
|
|
413
|
-
|
|
416
|
+
f(S) === "draft" ? (c(), O(n(he), {
|
|
414
417
|
key: 0,
|
|
415
418
|
type: "warning",
|
|
416
419
|
dot: ""
|
|
@@ -419,7 +422,7 @@ const rn = { class: "wx-block-checks" }, un = {
|
|
|
419
422
|
L(k(n(s)("page.version-draft")), 1)
|
|
420
423
|
]),
|
|
421
424
|
_: 1
|
|
422
|
-
})) :
|
|
425
|
+
})) : f(S) === "live" ? (c(), O(n(he), {
|
|
423
426
|
key: 1,
|
|
424
427
|
type: "success",
|
|
425
428
|
dot: ""
|
|
@@ -429,11 +432,11 @@ const rn = { class: "wx-block-checks" }, un = {
|
|
|
429
432
|
]),
|
|
430
433
|
_: 1
|
|
431
434
|
})) : W("", !0),
|
|
432
|
-
e.canManage &&
|
|
435
|
+
e.canManage && f(S) === "replaced" ? (c(), O(n(ue), {
|
|
433
436
|
key: 2,
|
|
434
437
|
size: "sm",
|
|
435
438
|
variant: "outline",
|
|
436
|
-
onClick: (B) =>
|
|
439
|
+
onClick: (B) => p(S)
|
|
437
440
|
}, {
|
|
438
441
|
default: b(() => [
|
|
439
442
|
L(k(n(s)("page.restore")), 1)
|
|
@@ -470,16 +473,16 @@ function il(e, l, t) {
|
|
|
470
473
|
const s = o.end.nextSibling;
|
|
471
474
|
let u = o.start;
|
|
472
475
|
for (; u; ) {
|
|
473
|
-
const
|
|
476
|
+
const p = u.nextSibling, m = u === o.end;
|
|
474
477
|
if (a.removeChild(u), m) break;
|
|
475
|
-
u =
|
|
478
|
+
u = p;
|
|
476
479
|
}
|
|
477
480
|
const d = i.content, r = Array.from(d.childNodes);
|
|
478
481
|
a.insertBefore(d, s);
|
|
479
|
-
const
|
|
480
|
-
if (
|
|
481
|
-
for (const
|
|
482
|
-
|
|
482
|
+
const f = e.defaultView?.webx;
|
|
483
|
+
if (f?.mount)
|
|
484
|
+
for (const p of r)
|
|
485
|
+
p.nodeType === 1 && f.mount(p);
|
|
483
486
|
return !0;
|
|
484
487
|
}
|
|
485
488
|
function $t(e, l) {
|
|
@@ -588,10 +591,10 @@ function yn(e, l) {
|
|
|
588
591
|
if (o === null) return null;
|
|
589
592
|
const a = (r) => r === null ? null : new URL(r, new URL(l, location.href)).href, i = [];
|
|
590
593
|
for (const r of Array.from(t.head.children)) {
|
|
591
|
-
const
|
|
592
|
-
if (
|
|
594
|
+
const f = r.tagName.toLowerCase(), p = (r.getAttribute("rel") ?? "").toLowerCase().split(/\s+/);
|
|
595
|
+
if (f === "style" && r.id !== yt)
|
|
593
596
|
i.push(r.outerHTML);
|
|
594
|
-
else if (
|
|
597
|
+
else if (f === "link" && (p.includes("stylesheet") || p.includes("preload") && r.getAttribute("as") === "font")) {
|
|
595
598
|
const m = r.cloneNode(!1);
|
|
596
599
|
m.setAttribute("href", a(r.getAttribute("href")) ?? ""), i.push(m.outerHTML);
|
|
597
600
|
}
|
|
@@ -601,7 +604,7 @@ function yn(e, l) {
|
|
|
601
604
|
const r = u.cloneNode(!1);
|
|
602
605
|
r.innerHTML = s, s = r.outerHTML, u = u.parentElement;
|
|
603
606
|
}
|
|
604
|
-
const d = (r) => Array.from(r.attributes).map((
|
|
607
|
+
const d = (r) => Array.from(r.attributes).map((f) => ` ${f.name}="${wt(f.value)}"`).join("");
|
|
605
608
|
return `<!doctype html><html${d(t.documentElement)}><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">${i.join("")}</head><body${d(t.body)}>${s}</body></html>`;
|
|
606
609
|
}
|
|
607
610
|
function wn(e, l) {
|
|
@@ -637,10 +640,10 @@ const _n = { class: "wx-block-stage" }, $n = { class: "wx-block-stage__bar" }, S
|
|
|
637
640
|
const z = o.value.find((U) => u.value / U.value >= 0.45);
|
|
638
641
|
a.value = (z ?? o.value[o.value.length - 1]).value;
|
|
639
642
|
});
|
|
640
|
-
function
|
|
643
|
+
function f(z) {
|
|
641
644
|
r.value = !0, a.value = z;
|
|
642
645
|
}
|
|
643
|
-
const
|
|
646
|
+
const p = $(() => u.value === 0 ? 1 : Math.min(1, u.value / a.value)), m = $(
|
|
644
647
|
() => l.stage ? void 0 : rl({
|
|
645
648
|
html: l.html,
|
|
646
649
|
styles: l.styles,
|
|
@@ -689,10 +692,10 @@ const _n = { class: "wx-block-stage" }, $n = { class: "wx-block-stage__bar" }, S
|
|
|
689
692
|
const G = $(() => ({
|
|
690
693
|
width: `${a.value}px`,
|
|
691
694
|
height: `${d.value}px`,
|
|
692
|
-
transform: `scale(${
|
|
695
|
+
transform: `scale(${p.value})`
|
|
693
696
|
})), ie = $(() => ({
|
|
694
|
-
width: `${Math.round(a.value *
|
|
695
|
-
height: `${Math.round(d.value *
|
|
697
|
+
width: `${Math.round(a.value * p.value)}px`,
|
|
698
|
+
height: `${Math.round(d.value * p.value)}px`
|
|
696
699
|
}));
|
|
697
700
|
return (z, U) => (c(), x("div", _n, [
|
|
698
701
|
V("div", $n, [
|
|
@@ -701,7 +704,7 @@ const _n = { class: "wx-block-stage" }, $n = { class: "wx-block-stage__bar" }, S
|
|
|
701
704
|
options: o.value,
|
|
702
705
|
size: "sm",
|
|
703
706
|
"aria-label": n(t)("page.width"),
|
|
704
|
-
"onUpdate:modelValue": U[0] || (U[0] = (Q) =>
|
|
707
|
+
"onUpdate:modelValue": U[0] || (U[0] = (Q) => f(Number(Q)))
|
|
705
708
|
}, null, 8, ["model-value", "options", "aria-label"])
|
|
706
709
|
]),
|
|
707
710
|
V("div", {
|
|
@@ -890,10 +893,10 @@ function Fn({
|
|
|
890
893
|
options: Gn(e(), a.state.doc.toString()),
|
|
891
894
|
validFor: /^\$\w*$/
|
|
892
895
|
};
|
|
893
|
-
const
|
|
894
|
-
if (
|
|
895
|
-
const
|
|
896
|
-
if (
|
|
896
|
+
const f = /(\{\{|\{!!)(\s*)(\w*)$/.exec(i);
|
|
897
|
+
if (f) return Zn(a, f[1], f[2], f[3], e());
|
|
898
|
+
const p = qn(i);
|
|
899
|
+
if (p !== null) return Jn(a, p, t(), o);
|
|
897
900
|
const m = /<(x-[\w:-]*)$/.exec(i);
|
|
898
901
|
if (m) {
|
|
899
902
|
const B = a.state.sliceDoc(0, a.pos - m[0].length);
|
|
@@ -919,9 +922,9 @@ function Hn(e, l, t, o) {
|
|
|
919
922
|
type: "type",
|
|
920
923
|
boost: (a.kind === "component" ? 50 : 0) - i / 100,
|
|
921
924
|
apply: (s, u, d, r) => {
|
|
922
|
-
const
|
|
925
|
+
const f = /^[\w-]*/.exec(s.state.sliceDoc(r, r + 64))[0], p = r + f.length, m = s.state.sliceDoc(p, p + 1) === l, y = `${a.slug}${m ? "" : l}`;
|
|
923
926
|
s.dispatch({
|
|
924
|
-
changes: { from: d, to:
|
|
927
|
+
changes: { from: d, to: p, insert: y },
|
|
925
928
|
// Past the closing quote: the attributes come next.
|
|
926
929
|
selection: { anchor: d + y.length + (m ? 1 : 0) },
|
|
927
930
|
annotations: Fe.of(u),
|
|
@@ -932,7 +935,7 @@ function Hn(e, l, t, o) {
|
|
|
932
935
|
validFor: /^[\w-]*$/
|
|
933
936
|
};
|
|
934
937
|
}
|
|
935
|
-
function
|
|
938
|
+
function qn(e) {
|
|
936
939
|
const l = e.lastIndexOf("<x-webx-block");
|
|
937
940
|
if (l === -1) return null;
|
|
938
941
|
const t = e.slice(l + 13);
|
|
@@ -944,19 +947,19 @@ function Jn(e) {
|
|
|
944
947
|
const i = /\btype\s*=\s*["']([\w-]+)["']/.exec(t);
|
|
945
948
|
return { attributes: t, type: i?.[1] ?? null, bound: a[1] === ":", word: a[2] };
|
|
946
949
|
}
|
|
947
|
-
function
|
|
950
|
+
function Jn(e, l, t, o) {
|
|
948
951
|
const a = new Set([...l.attributes.matchAll(/:?([\w-]+)\s*=/g)].map((r) => r[1])), i = e.pos - l.word.length - (l.bound ? 1 : 0), s = () => {
|
|
949
952
|
const r = [];
|
|
950
953
|
if (a.has("type") || r.push(gt("type", !1, "reserved", null, 60)), !a.has("fallback") && l.type !== null) {
|
|
951
|
-
const
|
|
952
|
-
r.push(gt("fallback", !1, "reserved",
|
|
954
|
+
const f = t.find((p) => p.slug === l.type)?.fallback ?? null;
|
|
955
|
+
r.push(gt("fallback", !1, "reserved", f, -10, f));
|
|
953
956
|
}
|
|
954
957
|
return r;
|
|
955
958
|
}, u = (r) => {
|
|
956
|
-
const
|
|
959
|
+
const p = [...Ve(r ?? []).filter((m) => m.type !== "wx-slot" && m.type !== "wx-blocks").filter((m) => !a.has(m.id)).map(
|
|
957
960
|
(m, y) => gt(m.id, m.type === "wx-data" || l.bound, m.type, m.label, 40 - y)
|
|
958
961
|
), ...s()];
|
|
959
|
-
return
|
|
962
|
+
return p.length === 0 || !e.explicit && l.word === "" && !l.bound ? null : { from: i, options: p, validFor: /^:?[\w-]*$/ };
|
|
960
963
|
};
|
|
961
964
|
if (l.type === null) return u(null);
|
|
962
965
|
const d = o(l.type);
|
|
@@ -970,11 +973,11 @@ function gt(e, l, t, o, a, i = null) {
|
|
|
970
973
|
info: o ?? void 0,
|
|
971
974
|
type: "property",
|
|
972
975
|
boost: a,
|
|
973
|
-
apply: (u, d, r,
|
|
974
|
-
const
|
|
976
|
+
apply: (u, d, r, f) => {
|
|
977
|
+
const p = `${s}="${i ?? (l ? "$" : "")}"`;
|
|
975
978
|
u.dispatch({
|
|
976
|
-
changes: { from: r, to:
|
|
977
|
-
selection: { anchor: r +
|
|
979
|
+
changes: { from: r, to: f, insert: p },
|
|
980
|
+
selection: { anchor: r + p.length - 1 },
|
|
978
981
|
annotations: Fe.of(d),
|
|
979
982
|
userEvent: "input.complete"
|
|
980
983
|
});
|
|
@@ -990,19 +993,19 @@ function Kn(e, l, t, o) {
|
|
|
990
993
|
type: "keyword"
|
|
991
994
|
})
|
|
992
995
|
];
|
|
993
|
-
for (const r of Ve(u ?? []).filter((
|
|
996
|
+
for (const r of Ve(u ?? []).filter((f) => f.type === "wx-slot"))
|
|
994
997
|
d.push({
|
|
995
998
|
label: `x-slot:${r.id}`,
|
|
996
999
|
detail: "slot",
|
|
997
1000
|
info: r.label,
|
|
998
1001
|
type: "keyword",
|
|
999
1002
|
boost: 20,
|
|
1000
|
-
apply: (
|
|
1003
|
+
apply: (f, p, m, y) => {
|
|
1001
1004
|
const S = `x-slot:${r.id}>`;
|
|
1002
|
-
|
|
1005
|
+
f.dispatch({
|
|
1003
1006
|
changes: { from: m, to: y, insert: `${S}</x-slot:${r.id}>` },
|
|
1004
1007
|
selection: { anchor: m + S.length },
|
|
1005
|
-
annotations: Fe.of(
|
|
1008
|
+
annotations: Fe.of(p),
|
|
1006
1009
|
userEvent: "input.complete"
|
|
1007
1010
|
});
|
|
1008
1011
|
}
|
|
@@ -1048,13 +1051,13 @@ function Zn(e, l, t, o, a) {
|
|
|
1048
1051
|
info: u.label,
|
|
1049
1052
|
type: "variable",
|
|
1050
1053
|
boost: 50 - d,
|
|
1051
|
-
apply: (r,
|
|
1054
|
+
apply: (r, f, p, m) => {
|
|
1052
1055
|
const y = r.state.sliceDoc(m, m + 8), S = new RegExp(`^\\s*${uo(s)}`).exec(y), B = S ? /^\s/.test(y) ? "" : " " : ` ${s}`, E = `${t === "" ? " " : ""}$${u.id}${B}`;
|
|
1053
1056
|
r.dispatch({
|
|
1054
|
-
changes: { from:
|
|
1057
|
+
changes: { from: p, to: m, insert: E },
|
|
1055
1058
|
// Past the closing braces: the echo is finished, the next thing is the markup.
|
|
1056
|
-
selection: { anchor:
|
|
1057
|
-
annotations: Fe.of(
|
|
1059
|
+
selection: { anchor: p + E.length + (S ? S[0].length : 0) },
|
|
1060
|
+
annotations: Fe.of(f),
|
|
1058
1061
|
userEvent: "input.complete"
|
|
1059
1062
|
});
|
|
1060
1063
|
}
|
|
@@ -1084,8 +1087,8 @@ function Xn(e, l, t, o, a) {
|
|
|
1084
1087
|
label: s,
|
|
1085
1088
|
detail: u,
|
|
1086
1089
|
type: "property",
|
|
1087
|
-
apply: (d, r,
|
|
1088
|
-
const m = t ?
|
|
1090
|
+
apply: (d, r, f, p) => {
|
|
1091
|
+
const m = t ? f - 1 : f, y = d.state.sliceDoc(p, p + 2), S = t || "'", B = p + (y.startsWith(S) ? 1 : 0), E = d.state.sliceDoc(B, B + 1) === "]", w = `${S}${s}${S}${E ? "" : "]"}`;
|
|
1089
1092
|
d.dispatch({
|
|
1090
1093
|
changes: { from: m, to: B, insert: w },
|
|
1091
1094
|
selection: { anchor: m + w.length + (E ? 1 : 0) },
|
|
@@ -1105,7 +1108,7 @@ function eo(e, l, t) {
|
|
|
1105
1108
|
if (!u) return [];
|
|
1106
1109
|
if (u.type === "wx-collection") {
|
|
1107
1110
|
const d = typeof u.props?.source == "string" ? u.props.source : u.type, r = s === "items" ? jn[d] ?? [] : [];
|
|
1108
|
-
return [...Rn[s ?? ""] ?? [], ...r].map((
|
|
1111
|
+
return [...Rn[s ?? ""] ?? [], ...r].map((f) => [f, d]);
|
|
1109
1112
|
}
|
|
1110
1113
|
return Un.includes(u.type) ? Dn.map((d) => [d, u.type]) : u.type === "wx-repeater" ? Ve(u.children ?? []).map((d) => [d.id, d.type]) : [];
|
|
1111
1114
|
}
|
|
@@ -1163,16 +1166,16 @@ function no({ slug: e, template: l }) {
|
|
|
1163
1166
|
if (!a) return null;
|
|
1164
1167
|
const i = /[^{};]*$/.exec(o)[0];
|
|
1165
1168
|
if (/^\s*[\w-]+\s*:\s/.test(i)) return null;
|
|
1166
|
-
const s = `b-${e()}`, u = new Set(vl(t.state.doc.toString())), d = oo(l()), r = [s, ...d.filter((
|
|
1167
|
-
label: `.${
|
|
1169
|
+
const s = `b-${e()}`, u = new Set(vl(t.state.doc.toString())), d = oo(l()), r = [s, ...d.filter((p) => p !== s)], f = r.map((p, m) => ({
|
|
1170
|
+
label: `.${p}`,
|
|
1168
1171
|
// A class the template uses and nothing styles yet is the likeliest thing to write.
|
|
1169
|
-
detail: u.has(
|
|
1172
|
+
detail: u.has(p) ? "template" : "template · no rule yet",
|
|
1170
1173
|
type: "class",
|
|
1171
|
-
boost: (u.has(
|
|
1174
|
+
boost: (u.has(p) ? 0 : 20) + (p === s ? 30 : 0) - m / 100
|
|
1172
1175
|
}));
|
|
1173
|
-
for (const
|
|
1174
|
-
r.includes(
|
|
1175
|
-
return { from: t.pos - a[1].length - 1, options:
|
|
1176
|
+
for (const p of u)
|
|
1177
|
+
r.includes(p) || f.push({ label: `.${p}`, detail: "styles", type: "class" });
|
|
1178
|
+
return { from: t.pos - a[1].length - 1, options: f, validFor: /^\.[\w-]*$/ };
|
|
1176
1179
|
};
|
|
1177
1180
|
}
|
|
1178
1181
|
function vl(e) {
|
|
@@ -1219,12 +1222,12 @@ function ao({ types: e }) {
|
|
|
1219
1222
|
const a = l.pos - o.length, i = t.string !== null;
|
|
1220
1223
|
if (t.phase === "key") {
|
|
1221
1224
|
const s = so.filter(({ key: u }) => !t.keys.has(u) || u === o).map(
|
|
1222
|
-
({ key: u, value: d, info: r },
|
|
1225
|
+
({ key: u, value: d, info: r }, f) => ({
|
|
1223
1226
|
label: u,
|
|
1224
1227
|
info: r,
|
|
1225
1228
|
type: "property",
|
|
1226
|
-
boost: -
|
|
1227
|
-
apply: (
|
|
1229
|
+
boost: -f,
|
|
1230
|
+
apply: (p, m, y, S) => jt(p, m, y, S, i, `"${u}": ${d}`, d)
|
|
1228
1231
|
})
|
|
1229
1232
|
);
|
|
1230
1233
|
return { from: a, options: s, validFor: /^[\w-]*$/ };
|
|
@@ -1236,7 +1239,7 @@ function ao({ types: e }) {
|
|
|
1236
1239
|
type: "type",
|
|
1237
1240
|
// Fields first: a block's schema is mostly fields, the layout only groups them.
|
|
1238
1241
|
boost: d.kind === "field" ? 1 : 0,
|
|
1239
|
-
apply: (r,
|
|
1242
|
+
apply: (r, f, p, m) => jt(r, f, p, m, i, `"${u}"`, "")
|
|
1240
1243
|
}));
|
|
1241
1244
|
return { from: a, options: s, validFor: /^[\w-]*$/ };
|
|
1242
1245
|
}
|
|
@@ -1244,10 +1247,10 @@ function ao({ types: e }) {
|
|
|
1244
1247
|
};
|
|
1245
1248
|
}
|
|
1246
1249
|
function jt(e, l, t, o, a, i, s) {
|
|
1247
|
-
const u = a ? t - 1 : t, d = /^[\w-]*"?/.exec(e.state.sliceDoc(o, o + 60))[0], r = o + (a ? d.length : /^[\w-]*/.exec(d)[0].length),
|
|
1250
|
+
const u = a ? t - 1 : t, d = /^[\w-]*"?/.exec(e.state.sliceDoc(o, o + 60))[0], r = o + (a ? d.length : /^[\w-]*/.exec(d)[0].length), f = s === '""' || s === "{}" || s === "[]" ? 1 : 0;
|
|
1248
1251
|
e.dispatch({
|
|
1249
1252
|
changes: { from: u, to: r, insert: i },
|
|
1250
|
-
selection: { anchor: u + i.length -
|
|
1253
|
+
selection: { anchor: u + i.length - f },
|
|
1251
1254
|
annotations: Fe.of(l),
|
|
1252
1255
|
userEvent: "input.complete"
|
|
1253
1256
|
}), i.startsWith('"type"') && tn(e);
|
|
@@ -1313,12 +1316,12 @@ function po(e, l, t) {
|
|
|
1313
1316
|
code: "variables-missing",
|
|
1314
1317
|
line: null,
|
|
1315
1318
|
message: t("checks.variables-missing", {
|
|
1316
|
-
variables: a.map((
|
|
1319
|
+
variables: a.map((f) => `$${f}`).join(", ")
|
|
1317
1320
|
})
|
|
1318
1321
|
});
|
|
1319
1322
|
const i = [], s = [], u = `.b-${e}`;
|
|
1320
|
-
for (const [
|
|
1321
|
-
|
|
1323
|
+
for (const [f, p] of mo(l.styles))
|
|
1324
|
+
f.startsWith(u) || f.startsWith("&") || (/^[a-z][a-z0-9-]*/i.test(f) ? s.push([f, p]) : i.push([f, p]));
|
|
1322
1325
|
i.length > 0 && o.push({
|
|
1323
1326
|
file: "styles",
|
|
1324
1327
|
code: "stray-selectors",
|
|
@@ -1451,7 +1454,7 @@ const go = { class: "wx-block-editor" }, ko = { class: "wx-block-editor__split"
|
|
|
1451
1454
|
setup(e) {
|
|
1452
1455
|
const l = e, t = lt(), o = Re(t), a = Xl(), i = ol();
|
|
1453
1456
|
De();
|
|
1454
|
-
const s = ce("webx-blocks"), u = nt(), d = $(() => Number(a.params.id)), r = I(null),
|
|
1457
|
+
const s = ce("webx-blocks"), u = nt(), d = $(() => Number(a.params.id)), r = I(null), f = I([]), p = I(!0), m = I(!1), y = I(!1), S = I("template"), B = $(() => {
|
|
1455
1458
|
const C = t.state.manifest?.modules.find((g) => g.id === "blocks")?.meta;
|
|
1456
1459
|
return {
|
|
1457
1460
|
groups: C?.groups ?? [],
|
|
@@ -1516,7 +1519,7 @@ const go = { class: "wx-block-editor" }, ko = { class: "wx-block-editor__split"
|
|
|
1516
1519
|
() => null
|
|
1517
1520
|
), ve.set(C, F)), F;
|
|
1518
1521
|
}
|
|
1519
|
-
const
|
|
1522
|
+
const J = {
|
|
1520
1523
|
template: [
|
|
1521
1524
|
bt(
|
|
1522
1525
|
Fn({
|
|
@@ -1571,16 +1574,16 @@ const go = { class: "wx-block-editor" }, ko = { class: "wx-block-editor__split"
|
|
|
1571
1574
|
Object.assign(_, Se(g)), R.value = JSON.stringify(g.schema, null, 2), Z.value = null, G.value = Q.value;
|
|
1572
1575
|
}
|
|
1573
1576
|
async function M() {
|
|
1574
|
-
|
|
1577
|
+
p.value = !0;
|
|
1575
1578
|
try {
|
|
1576
|
-
T(await o.get(d.value)),
|
|
1579
|
+
T(await o.get(d.value)), f.value = await o.usage(d.value), Ce();
|
|
1577
1580
|
} catch (C) {
|
|
1578
1581
|
K.danger(u(C));
|
|
1579
1582
|
} finally {
|
|
1580
|
-
|
|
1583
|
+
p.value = !1;
|
|
1581
1584
|
}
|
|
1582
1585
|
}
|
|
1583
|
-
function
|
|
1586
|
+
function q(C) {
|
|
1584
1587
|
R.value = C;
|
|
1585
1588
|
try {
|
|
1586
1589
|
const g = JSON.parse(C);
|
|
@@ -1705,7 +1708,7 @@ const go = { class: "wx-block-editor" }, ko = { class: "wx-block-editor__split"
|
|
|
1705
1708
|
title: z.value.entity.title ?? `#${z.value.entity.id}`
|
|
1706
1709
|
}) : null
|
|
1707
1710
|
} : null
|
|
1708
|
-
), st = $(() => S.value === "template" || S.value === "styles"),
|
|
1711
|
+
), st = $(() => S.value === "template" || S.value === "styles"), qe = $(() => [
|
|
1709
1712
|
{
|
|
1710
1713
|
title: s("page.example-handler"),
|
|
1711
1714
|
code: `el.querySelector('.b-hero__button')?.addEventListener('click', (event) => {
|
|
@@ -1728,7 +1731,7 @@ setInterval(() => el.classList.toggle('is-second'), seconds * 1000)`
|
|
|
1728
1731
|
|
|
1729
1732
|
new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
1730
1733
|
}
|
|
1731
|
-
]), Ie = $(() =>
|
|
1734
|
+
]), Ie = $(() => f.value.slice(0, 5)), ee = $(() => w.kind === "component"), ke = $(() => r.value?.used_by ?? []), We = $(() => {
|
|
1732
1735
|
const C = r.value?.declared?.module;
|
|
1733
1736
|
return C ? t.state.manifest?.modules.find((g) => g.id === C)?.title ?? C.charAt(0).toUpperCase() + C.slice(1) : null;
|
|
1734
1737
|
}), Vt = $(
|
|
@@ -1794,7 +1797,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1794
1797
|
return (C, g) => {
|
|
1795
1798
|
const F = _t("router-link");
|
|
1796
1799
|
return c(), x("div", go, [
|
|
1797
|
-
|
|
1800
|
+
p.value || !r.value ? (c(), x(P, { key: 0 }, [
|
|
1798
1801
|
h(n(Pe), {
|
|
1799
1802
|
class: "wx-block-editor__ghost-head",
|
|
1800
1803
|
title: "",
|
|
@@ -1908,13 +1911,13 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1908
1911
|
_: 1
|
|
1909
1912
|
}))
|
|
1910
1913
|
]))), 128)),
|
|
1911
|
-
|
|
1914
|
+
f.value.length > Ie.value.length ? (c(), O(n(H), {
|
|
1912
1915
|
key: 1,
|
|
1913
1916
|
size: "sm",
|
|
1914
1917
|
tone: "muted"
|
|
1915
1918
|
}, {
|
|
1916
1919
|
default: b(() => [
|
|
1917
|
-
L(k(n(s)("page.usage-more", { count:
|
|
1920
|
+
L(k(n(s)("page.usage-more", { count: f.value.length - Ie.value.length })), 1)
|
|
1918
1921
|
]),
|
|
1919
1922
|
_: 1
|
|
1920
1923
|
})) : W("", !0)
|
|
@@ -1954,7 +1957,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1954
1957
|
modelValue: _.template,
|
|
1955
1958
|
"onUpdate:modelValue": g[1] || (g[1] = (N) => _.template = N),
|
|
1956
1959
|
language: "php",
|
|
1957
|
-
extensions:
|
|
1960
|
+
extensions: J.template,
|
|
1958
1961
|
readonly: !E.value,
|
|
1959
1962
|
"min-height": "340px",
|
|
1960
1963
|
"max-height": "70vh",
|
|
@@ -1975,7 +1978,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1975
1978
|
type: "button",
|
|
1976
1979
|
class: "wx-block-editor__pill",
|
|
1977
1980
|
disabled: !E.value,
|
|
1978
|
-
onClick: (
|
|
1981
|
+
onClick: (Je) => A(N),
|
|
1979
1982
|
textContent: k(He(N))
|
|
1980
1983
|
}, null, 8, So))), 128))
|
|
1981
1984
|
])) : W("", !0),
|
|
@@ -2031,14 +2034,14 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2031
2034
|
_: 2
|
|
2032
2035
|
}, 1024),
|
|
2033
2036
|
N.fields.length ? (c(), x("dl", Eo, [
|
|
2034
|
-
(c(!0), x(P, null, Y(N.fields, (
|
|
2035
|
-
key:
|
|
2037
|
+
(c(!0), x(P, null, Y(N.fields, (Je) => (c(), x(P, {
|
|
2038
|
+
key: Je.name
|
|
2036
2039
|
}, [
|
|
2037
2040
|
V("dt", null, [
|
|
2038
|
-
V("code", null, k(
|
|
2039
|
-
V("span", Vo, k(
|
|
2041
|
+
V("code", null, k(Je.name), 1),
|
|
2042
|
+
V("span", Vo, k(Je.type), 1)
|
|
2040
2043
|
]),
|
|
2041
|
-
V("dd", null, k(
|
|
2044
|
+
V("dd", null, k(Je.description), 1)
|
|
2042
2045
|
], 64))), 128))
|
|
2043
2046
|
])) : W("", !0)
|
|
2044
2047
|
]))), 128)),
|
|
@@ -2067,7 +2070,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2067
2070
|
modelValue: _.styles,
|
|
2068
2071
|
"onUpdate:modelValue": g[2] || (g[2] = (N) => _.styles = N),
|
|
2069
2072
|
language: "css",
|
|
2070
|
-
extensions:
|
|
2073
|
+
extensions: J.styles,
|
|
2071
2074
|
readonly: !E.value,
|
|
2072
2075
|
"min-height": "340px",
|
|
2073
2076
|
"max-height": "70vh"
|
|
@@ -2121,7 +2124,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2121
2124
|
title: n(s)("page.examples")
|
|
2122
2125
|
}, {
|
|
2123
2126
|
default: b(() => [
|
|
2124
|
-
(c(!0), x(P, null, Y(
|
|
2127
|
+
(c(!0), x(P, null, Y(qe.value, (N) => (c(), x("div", {
|
|
2125
2128
|
key: N.title,
|
|
2126
2129
|
class: "wx-block-editor__example"
|
|
2127
2130
|
}, [
|
|
@@ -2154,12 +2157,12 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2154
2157
|
h(n(Ye), {
|
|
2155
2158
|
"model-value": R.value,
|
|
2156
2159
|
language: "json",
|
|
2157
|
-
extensions:
|
|
2160
|
+
extensions: J.schema,
|
|
2158
2161
|
lint: "",
|
|
2159
2162
|
readonly: !E.value,
|
|
2160
2163
|
"min-height": "340px",
|
|
2161
2164
|
"max-height": "70vh",
|
|
2162
|
-
"onUpdate:modelValue":
|
|
2165
|
+
"onUpdate:modelValue": q
|
|
2163
2166
|
}, null, 8, ["model-value", "extensions", "readonly"]),
|
|
2164
2167
|
V("div", zo, [
|
|
2165
2168
|
Z.value ? (c(), O(n(H), {
|
|
@@ -2535,10 +2538,10 @@ const Ro = ["srcdoc"], jo = {
|
|
|
2535
2538
|
]))
|
|
2536
2539
|
], 4));
|
|
2537
2540
|
}
|
|
2538
|
-
}), _l = /* @__PURE__ */ ae(Fo, [["__scopeId", "data-v-5ca74656"]]), Ho = { class: "wx-block-picker" },
|
|
2541
|
+
}), _l = /* @__PURE__ */ ae(Fo, [["__scopeId", "data-v-5ca74656"]]), Ho = { class: "wx-block-picker" }, qo = {
|
|
2539
2542
|
key: 0,
|
|
2540
2543
|
class: "wx-block-picker__group-title"
|
|
2541
|
-
},
|
|
2544
|
+
}, Jo = { class: "wx-block-picker__cards" }, Ko = ["disabled", "title", "onClick"], Yo = { class: "wx-block-picker__body" }, Go = { class: "wx-block-picker__title" }, Zo = /* @__PURE__ */ se({
|
|
2542
2545
|
__name: "BlockPicker",
|
|
2543
2546
|
props: {
|
|
2544
2547
|
catalog: {},
|
|
@@ -2570,7 +2573,7 @@ const Ro = ["srcdoc"], jo = {
|
|
|
2570
2573
|
return m === "" ? d.value : d.value.filter(
|
|
2571
2574
|
({ type: y }) => y.title.toLowerCase().includes(m) || y.slug.includes(m) || (y.description ?? "").toLowerCase().includes(m)
|
|
2572
2575
|
);
|
|
2573
|
-
}),
|
|
2576
|
+
}), f = $(() => {
|
|
2574
2577
|
const m = [...l.groups];
|
|
2575
2578
|
for (const { type: B } of r.value)
|
|
2576
2579
|
m.includes(B.group) || m.push(B.group);
|
|
@@ -2580,7 +2583,7 @@ const Ro = ["srcdoc"], jo = {
|
|
|
2580
2583
|
options: r.value.filter((E) => E.type.group === B)
|
|
2581
2584
|
})).filter((B) => B.options.length > 0);
|
|
2582
2585
|
return r.value.length <= 5 || s.value.trim() !== "" || y.length < 2 ? [{ id: "", label: "", options: r.value }] : y;
|
|
2583
|
-
}),
|
|
2586
|
+
}), p = $(() => {
|
|
2584
2587
|
if (l.catalog.length === 0) return i("field.pick-none");
|
|
2585
2588
|
if (d.value.length === 0 && l.parent) {
|
|
2586
2589
|
const m = (l.allow ?? l.parent.allow ?? []).filter(
|
|
@@ -2622,7 +2625,7 @@ const Ro = ["srcdoc"], jo = {
|
|
|
2622
2625
|
r.value.length === 0 ? (c(), O(n(Xt), {
|
|
2623
2626
|
key: 1,
|
|
2624
2627
|
icon: "grid",
|
|
2625
|
-
title:
|
|
2628
|
+
title: p.value,
|
|
2626
2629
|
size: "sm"
|
|
2627
2630
|
}, {
|
|
2628
2631
|
default: b(() => [
|
|
@@ -2638,12 +2641,12 @@ const Ro = ["srcdoc"], jo = {
|
|
|
2638
2641
|
]),
|
|
2639
2642
|
_: 1
|
|
2640
2643
|
}, 8, ["title"])) : W("", !0),
|
|
2641
|
-
(c(!0), x(P, null, Y(
|
|
2644
|
+
(c(!0), x(P, null, Y(f.value, (B) => (c(), x("section", {
|
|
2642
2645
|
key: B.id,
|
|
2643
2646
|
class: "wx-block-picker__group"
|
|
2644
2647
|
}, [
|
|
2645
|
-
B.label ? (c(), x("div",
|
|
2646
|
-
V("div",
|
|
2648
|
+
B.label ? (c(), x("div", qo, k(B.label), 1)) : W("", !0),
|
|
2649
|
+
V("div", Jo, [
|
|
2647
2650
|
(c(!0), x(P, null, Y(B.options, (E) => (c(), x("button", {
|
|
2648
2651
|
key: E.type.id,
|
|
2649
2652
|
type: "button",
|
|
@@ -2697,7 +2700,7 @@ const Ro = ["srcdoc"], jo = {
|
|
|
2697
2700
|
},
|
|
2698
2701
|
emits: ["select", "edit"],
|
|
2699
2702
|
setup(e, { expose: l, emit: t }) {
|
|
2700
|
-
const o = e, a = t, i = ce("webx-blocks"), s = I(null), u = I(null), d = I(null), r = dt(d),
|
|
2703
|
+
const o = e, a = t, i = ce("webx-blocks"), s = I(null), u = I(null), d = I(null), r = dt(d), f = I(!1), p = I(!1), m = I(null), y = I(0), S = $(() => y.value > 0), B = $(() => [
|
|
2701
2704
|
{ value: 1280, icon: "monitor", ariaLabel: i("field.width-desktop") },
|
|
2702
2705
|
{ value: 834, icon: "tablet", ariaLabel: i("field.width-tablet") },
|
|
2703
2706
|
{ value: 390, icon: "smartphone", ariaLabel: i("field.width-phone") }
|
|
@@ -2731,8 +2734,8 @@ const Ro = ["srcdoc"], jo = {
|
|
|
2731
2734
|
const v = G(), T = v?.body;
|
|
2732
2735
|
if (!T || !v?.defaultView) return;
|
|
2733
2736
|
U(v);
|
|
2734
|
-
const M = v.defaultView.getComputedStyle(T),
|
|
2735
|
-
le !== y.value && (y.value = le, re !== null && Pl(() => requestAnimationFrame(
|
|
2737
|
+
const M = v.defaultView.getComputedStyle(T), q = (parseFloat(M.marginTop) || 0) + (parseFloat(M.marginBottom) || 0), le = Math.ceil(T.scrollHeight + q);
|
|
2738
|
+
le !== y.value && (y.value = le, re !== null && Pl(() => requestAnimationFrame(J)));
|
|
2736
2739
|
}
|
|
2737
2740
|
function X(v) {
|
|
2738
2741
|
z?.disconnect();
|
|
@@ -2740,7 +2743,7 @@ const Ro = ["srcdoc"], jo = {
|
|
|
2740
2743
|
!T || !v.body || (z = new T.ResizeObserver(Q), z.observe(v.body), Q());
|
|
2741
2744
|
}
|
|
2742
2745
|
function xe() {
|
|
2743
|
-
|
|
2746
|
+
p.value = !0;
|
|
2744
2747
|
const v = G();
|
|
2745
2748
|
v && (X(v), ie?.release(), ie = vn(v, {
|
|
2746
2749
|
/* No guard against answering a click with a scroll: `bring` moves nothing that is already
|
|
@@ -2753,7 +2756,7 @@ const Ro = ["srcdoc"], jo = {
|
|
|
2753
2756
|
function ve(v) {
|
|
2754
2757
|
v !== null && (re = v, te !== null && clearTimeout(te), te = window.setTimeout(() => {
|
|
2755
2758
|
re = null, te = null;
|
|
2756
|
-
}, 400),
|
|
2759
|
+
}, 400), J());
|
|
2757
2760
|
}
|
|
2758
2761
|
function Ce(v) {
|
|
2759
2762
|
const T = s.value?.getBoundingClientRect();
|
|
@@ -2771,43 +2774,43 @@ const Ro = ["srcdoc"], jo = {
|
|
|
2771
2774
|
}
|
|
2772
2775
|
return null;
|
|
2773
2776
|
}
|
|
2774
|
-
function
|
|
2777
|
+
function J() {
|
|
2775
2778
|
const v = G();
|
|
2776
2779
|
if (re === null || !v) return;
|
|
2777
2780
|
U(v);
|
|
2778
2781
|
const T = $t(v, re), M = T ? Ce(T) : null;
|
|
2779
2782
|
if (!M) return;
|
|
2780
|
-
const
|
|
2783
|
+
const q = Be(), le = q?.getBoundingClientRect(), be = u.value?.getBoundingClientRect().height ?? 0, ge = {
|
|
2781
2784
|
top: (le?.top ?? 0) + be,
|
|
2782
2785
|
bottom: (le ? le.bottom : window.innerHeight) - be
|
|
2783
2786
|
}, Ee = M.top + M.height, Le = M.top < ge.top, He = M.height > ge.bottom - ge.top, A = Le || He ? M.top - ge.top : Ee > ge.bottom ? Ee - ge.bottom : 0;
|
|
2784
|
-
A !== 0 && (
|
|
2787
|
+
A !== 0 && (q ?? window).scrollBy({ top: A, behavior: "smooth" });
|
|
2785
2788
|
}
|
|
2786
2789
|
function Te(v, T) {
|
|
2787
2790
|
const M = G();
|
|
2788
|
-
if (!M || !
|
|
2789
|
-
const
|
|
2790
|
-
return
|
|
2791
|
+
if (!M || !p.value) return !1;
|
|
2792
|
+
const q = il(M, v, T);
|
|
2793
|
+
return q && vt(M, o.selected ?? null), q;
|
|
2791
2794
|
}
|
|
2792
2795
|
function _e() {
|
|
2793
|
-
|
|
2796
|
+
p.value = !1, z?.disconnect(), z = null, s.value && o.url && (s.value.src = o.url);
|
|
2794
2797
|
}
|
|
2795
2798
|
function $e(v) {
|
|
2796
|
-
v.key === "Escape" &&
|
|
2799
|
+
v.key === "Escape" && f.value && (f.value = !1, v.stopPropagation());
|
|
2797
2800
|
}
|
|
2798
2801
|
return oe(
|
|
2799
2802
|
() => o.selected,
|
|
2800
2803
|
(v) => {
|
|
2801
2804
|
const T = G();
|
|
2802
|
-
!T || !
|
|
2805
|
+
!T || !p.value || (vt(T, v ?? null), ve(v ?? null));
|
|
2803
2806
|
}
|
|
2804
2807
|
), oe(() => o.reload, _e), oe(
|
|
2805
2808
|
() => o.url,
|
|
2806
|
-
() =>
|
|
2809
|
+
() => p.value = !1
|
|
2807
2810
|
), tt(() => window.addEventListener("keydown", $e)), pt(() => {
|
|
2808
2811
|
window.removeEventListener("keydown", $e), te !== null && clearTimeout(te), z?.disconnect(), ie?.release();
|
|
2809
|
-
}), l({ replace: Te, refresh: _e, open: () =>
|
|
2810
|
-
class: Oe(["wx-blocks-preview", { "is-fullscreen":
|
|
2812
|
+
}), l({ replace: Te, refresh: _e, open: () => f.value = !0 }), (v, T) => (c(), x("div", {
|
|
2813
|
+
class: Oe(["wx-blocks-preview", { "is-fullscreen": f.value, "is-grown": S.value, "is-compact": e.compact }]),
|
|
2811
2814
|
style: Me({ "--wx-preview-scale": w.value })
|
|
2812
2815
|
}, [
|
|
2813
2816
|
V("div", {
|
|
@@ -2855,10 +2858,10 @@ const Ro = ["srcdoc"], jo = {
|
|
|
2855
2858
|
}, null, 8, ["title", "href"])) : W("", !0),
|
|
2856
2859
|
h(n(Ge), {
|
|
2857
2860
|
size: "sm",
|
|
2858
|
-
icon:
|
|
2861
|
+
icon: f.value ? "minimize" : "maximize",
|
|
2859
2862
|
tone: "neutral",
|
|
2860
|
-
title:
|
|
2861
|
-
onClick: T[2] || (T[2] = (M) =>
|
|
2863
|
+
title: f.value ? n(i)("field.close") : n(i)("field.fullscreen"),
|
|
2864
|
+
onClick: T[2] || (T[2] = (M) => f.value = !f.value)
|
|
2862
2865
|
}, null, 8, ["icon", "title"])
|
|
2863
2866
|
])
|
|
2864
2867
|
], 512),
|
|
@@ -2902,44 +2905,44 @@ const Ro = ["srcdoc"], jo = {
|
|
|
2902
2905
|
emits: ["select", "add", "remove", "duplicate", "visibility", "reorder"],
|
|
2903
2906
|
setup(e, { emit: l }) {
|
|
2904
2907
|
const t = e, o = l, a = ce("webx-blocks");
|
|
2905
|
-
function i(
|
|
2906
|
-
return t.catalog.find((
|
|
2908
|
+
function i(f) {
|
|
2909
|
+
return t.catalog.find((p) => p.slug === f.type) ?? null;
|
|
2907
2910
|
}
|
|
2908
|
-
function s(
|
|
2909
|
-
return i(
|
|
2911
|
+
function s(f) {
|
|
2912
|
+
return i(f)?.title ?? f.type;
|
|
2910
2913
|
}
|
|
2911
|
-
function u(
|
|
2912
|
-
const
|
|
2913
|
-
return
|
|
2914
|
+
function u(f) {
|
|
2915
|
+
const p = i(f);
|
|
2916
|
+
return p?.content ? pl(p.content.schema) : [];
|
|
2914
2917
|
}
|
|
2915
|
-
function d(
|
|
2916
|
-
const m =
|
|
2918
|
+
function d(f, p) {
|
|
2919
|
+
const m = f.values[p.id];
|
|
2917
2920
|
return Array.isArray(m) ? m : [];
|
|
2918
2921
|
}
|
|
2919
|
-
function r(
|
|
2922
|
+
function r(f) {
|
|
2920
2923
|
return [
|
|
2921
2924
|
{
|
|
2922
2925
|
key: "visibility",
|
|
2923
|
-
icon:
|
|
2924
|
-
label:
|
|
2925
|
-
run: () => o("visibility",
|
|
2926
|
+
icon: f.hidden === !0 ? "eye" : "eye-off",
|
|
2927
|
+
label: f.hidden === !0 ? a("field.show") : a("field.hide"),
|
|
2928
|
+
run: () => o("visibility", f.key, f.hidden !== !0)
|
|
2926
2929
|
},
|
|
2927
2930
|
{
|
|
2928
2931
|
key: "duplicate",
|
|
2929
2932
|
icon: "copy",
|
|
2930
2933
|
label: a("field.duplicate"),
|
|
2931
|
-
run: () => o("duplicate",
|
|
2934
|
+
run: () => o("duplicate", f.key)
|
|
2932
2935
|
},
|
|
2933
2936
|
{
|
|
2934
2937
|
key: "remove",
|
|
2935
2938
|
icon: "trash",
|
|
2936
2939
|
label: a("field.remove"),
|
|
2937
2940
|
danger: !0,
|
|
2938
|
-
run: () => o("remove",
|
|
2941
|
+
run: () => o("remove", f.key)
|
|
2939
2942
|
}
|
|
2940
2943
|
];
|
|
2941
2944
|
}
|
|
2942
|
-
return (
|
|
2945
|
+
return (f, p) => {
|
|
2943
2946
|
const m = _t("blocks-tree", !0);
|
|
2944
2947
|
return c(), O(n(Nl), {
|
|
2945
2948
|
"model-value": e.nodes,
|
|
@@ -2950,7 +2953,7 @@ const Ro = ["srcdoc"], jo = {
|
|
|
2950
2953
|
size: "sm",
|
|
2951
2954
|
"empty-text": e.depth === 0 ? n(a)("field.empty") : "",
|
|
2952
2955
|
class: Oe(["wx-blocks-tree", { "is-nested": e.depth > 0 }]),
|
|
2953
|
-
"onUpdate:modelValue":
|
|
2956
|
+
"onUpdate:modelValue": p[6] || (p[6] = (y) => o("reorder", e.parentKey, e.field, y))
|
|
2954
2957
|
}, {
|
|
2955
2958
|
default: b(({ item: y }) => [
|
|
2956
2959
|
V("div", ns, [
|
|
@@ -3010,12 +3013,12 @@ const Ro = ["srcdoc"], jo = {
|
|
|
3010
3013
|
selected: e.selected,
|
|
3011
3014
|
disabled: e.disabled,
|
|
3012
3015
|
depth: e.depth + 1,
|
|
3013
|
-
onSelect:
|
|
3014
|
-
onAdd:
|
|
3015
|
-
onRemove:
|
|
3016
|
-
onDuplicate:
|
|
3017
|
-
onVisibility:
|
|
3018
|
-
onReorder:
|
|
3016
|
+
onSelect: p[0] || (p[0] = (B) => o("select", B)),
|
|
3017
|
+
onAdd: p[1] || (p[1] = (B, E, w) => o("add", B, E, w)),
|
|
3018
|
+
onRemove: p[2] || (p[2] = (B) => o("remove", B)),
|
|
3019
|
+
onDuplicate: p[3] || (p[3] = (B) => o("duplicate", B)),
|
|
3020
|
+
onVisibility: p[4] || (p[4] = (B, E) => o("visibility", B, E)),
|
|
3021
|
+
onReorder: p[5] || (p[5] = (B, E, w) => o("reorder", B, E, w))
|
|
3019
3022
|
}, null, 8, ["nodes", "catalog", "parent-key", "field", "selected", "disabled", "depth"]),
|
|
3020
3023
|
e.disabled ? W("", !0) : (c(), x("button", {
|
|
3021
3024
|
key: 0,
|
|
@@ -3042,7 +3045,7 @@ function ma(e) {
|
|
|
3042
3045
|
function ha() {
|
|
3043
3046
|
return Ze(Et, null);
|
|
3044
3047
|
}
|
|
3045
|
-
const
|
|
3048
|
+
const qt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
3046
3049
|
key: 0,
|
|
3047
3050
|
class: "wx-blocks-nested"
|
|
3048
3051
|
}, hs = {
|
|
@@ -3061,7 +3064,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3061
3064
|
name: "WxBlocks",
|
|
3062
3065
|
inheritAttrs: !1,
|
|
3063
3066
|
__name: "BlocksField",
|
|
3064
|
-
props: /* @__PURE__ */
|
|
3067
|
+
props: /* @__PURE__ */ ql({
|
|
3065
3068
|
node: { default: void 0 },
|
|
3066
3069
|
context: { default: void 0 },
|
|
3067
3070
|
name: { default: void 0 },
|
|
@@ -3077,11 +3080,11 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3077
3080
|
}),
|
|
3078
3081
|
emits: ["update:modelValue"],
|
|
3079
3082
|
setup(e) {
|
|
3080
|
-
const l = e, t = Rl(e, "modelValue"), o = Ze(
|
|
3081
|
-
ll(
|
|
3083
|
+
const l = e, t = Rl(e, "modelValue"), o = Ze(qt, !1);
|
|
3084
|
+
ll(qt, !0), De();
|
|
3082
3085
|
const a = ce("webx-blocks"), i = nt(), s = Ze(nl, null);
|
|
3083
3086
|
let u = null;
|
|
3084
|
-
const d = I([]), r = $(() => l.catalog ?? d.value),
|
|
3087
|
+
const d = I([]), r = $(() => l.catalog ?? d.value), f = $(() => Array.isArray(t.value) ? t.value : []), p = I(null), m = $(() => p.value ? me(f.value, p.value) : null), y = $(
|
|
3085
3088
|
() => m.value ? r.value.find((A) => A.slug === m.value?.node.type) ?? null : null
|
|
3086
3089
|
);
|
|
3087
3090
|
function S(A) {
|
|
@@ -3089,9 +3092,9 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3089
3092
|
}
|
|
3090
3093
|
const B = $(() => {
|
|
3091
3094
|
const A = [];
|
|
3092
|
-
return ot(
|
|
3095
|
+
return ot(f.value, (D) => A.push(D.key)), A;
|
|
3093
3096
|
}), E = $(() => {
|
|
3094
|
-
const A =
|
|
3097
|
+
const A = p.value ? B.value.indexOf(p.value) : -1;
|
|
3095
3098
|
return {
|
|
3096
3099
|
previous: A > 0 ? B.value[A - 1] : null,
|
|
3097
3100
|
next: A >= 0 && A < B.value.length - 1 ? B.value[A + 1] : null
|
|
@@ -3100,7 +3103,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3100
3103
|
const A = [];
|
|
3101
3104
|
let D = m.value?.parent ?? null;
|
|
3102
3105
|
for (; D; )
|
|
3103
|
-
A.unshift({ key: D.key, title: S(D) }), D = me(
|
|
3106
|
+
A.unshift({ key: D.key, title: S(D) }), D = me(f.value, D.key)?.parent ?? null;
|
|
3104
3107
|
return A;
|
|
3105
3108
|
}), _ = Ze(Et, null), R = I(null), Z = I(null), G = dt(Z), ie = $(() => _ !== null && _.url.value !== null), z = $(() => ie.value && G.value > 0 && G.value <= 900), U = I(!1), Q = $(() => {
|
|
3106
3109
|
if (!m.value) return;
|
|
@@ -3133,23 +3136,23 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3133
3136
|
), re = jl()?.type, te = $(() => l.context?.types ? l.context.types : s?.types ? { ...it, ...s.types } : re ? { ...it, "wx-blocks": { component: re, kind: "field", nested: !0 } } : it), ve = $(
|
|
3134
3137
|
() => l.context?.translate ?? s?.i18n.t ?? ((A) => A)
|
|
3135
3138
|
), Ce = $(() => l.context?.can ?? s?.can ?? (() => !0)), Be = el(Qo);
|
|
3136
|
-
function
|
|
3139
|
+
function J(A) {
|
|
3137
3140
|
t.value = A;
|
|
3138
3141
|
}
|
|
3139
3142
|
async function Te(A, D, j) {
|
|
3140
|
-
const de = A ? me(
|
|
3141
|
-
if (
|
|
3143
|
+
const de = A ? me(f.value, A) : null, pe = de ? r.value.find((We) => We.slug === de.node.type) ?? null : null, st = A === null ? l.allow : j?.props?.allow ?? null, qe = A === null ? l.max : j?.props?.max ?? null, Ie = A === null ? f.value : de && D ? de.node.values[D] ?? [] : [];
|
|
3144
|
+
if (qe != null && Ie.length >= qe) return;
|
|
3142
3145
|
const ee = await Be({
|
|
3143
3146
|
catalog: r.value,
|
|
3144
3147
|
parent: pe,
|
|
3145
3148
|
allow: st,
|
|
3146
|
-
tree:
|
|
3149
|
+
tree: f.value,
|
|
3147
3150
|
groups: xe.value,
|
|
3148
3151
|
blocksPath: l.blocksPath
|
|
3149
3152
|
});
|
|
3150
3153
|
if (!ee) return;
|
|
3151
3154
|
const ke = En(ee.slug, _e(ee));
|
|
3152
|
-
|
|
3155
|
+
J(Rt(f.value, A, D, Ie.length, ke)), p.value = ke.key;
|
|
3153
3156
|
}
|
|
3154
3157
|
function _e(A) {
|
|
3155
3158
|
const D = A.content?.sample ?? {}, j = {};
|
|
@@ -3158,7 +3161,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3158
3161
|
return j;
|
|
3159
3162
|
}
|
|
3160
3163
|
async function $e(A) {
|
|
3161
|
-
const D = me(
|
|
3164
|
+
const D = me(f.value, A);
|
|
3162
3165
|
if (!D) return;
|
|
3163
3166
|
const j = An(D.node);
|
|
3164
3167
|
await ct({
|
|
@@ -3169,38 +3172,38 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3169
3172
|
confirmText: a("field.remove"),
|
|
3170
3173
|
cancelText: a("page.cancel"),
|
|
3171
3174
|
tone: "danger"
|
|
3172
|
-
}) && (
|
|
3175
|
+
}) && (p.value === A && (p.value = null), J(Wn(f.value, A)));
|
|
3173
3176
|
}
|
|
3174
3177
|
function v(A) {
|
|
3175
|
-
const D = me(
|
|
3178
|
+
const D = me(f.value, A);
|
|
3176
3179
|
if (!D) return;
|
|
3177
3180
|
const j = fl(D.node);
|
|
3178
|
-
|
|
3181
|
+
J(Rt(f.value, D.parent?.key ?? null, D.field, D.index + 1, j)), p.value = j.key;
|
|
3179
3182
|
}
|
|
3180
3183
|
function T(A, D) {
|
|
3181
|
-
|
|
3184
|
+
J(Bn(f.value, A, D));
|
|
3182
3185
|
}
|
|
3183
3186
|
function M(A, D, j) {
|
|
3184
|
-
|
|
3187
|
+
J(zn(f.value, A, D, j));
|
|
3185
3188
|
}
|
|
3186
|
-
function
|
|
3187
|
-
|
|
3189
|
+
function q(A) {
|
|
3190
|
+
p.value = p.value === A ? null : A;
|
|
3188
3191
|
}
|
|
3189
3192
|
function le(A) {
|
|
3190
|
-
A === null || !me(
|
|
3193
|
+
A === null || !me(f.value, A) || (p.value = A, z.value && (U.value = !0));
|
|
3191
3194
|
}
|
|
3192
3195
|
function be() {
|
|
3193
|
-
|
|
3196
|
+
p.value = null;
|
|
3194
3197
|
}
|
|
3195
3198
|
function ge(A) {
|
|
3196
|
-
|
|
3199
|
+
p.value && J(Nn(f.value, p.value, A));
|
|
3197
3200
|
}
|
|
3198
3201
|
let Ee;
|
|
3199
3202
|
oe(
|
|
3200
3203
|
() => m.value?.node.values,
|
|
3201
3204
|
(A, D) => {
|
|
3202
3205
|
if (!A || !D || !y.value || !u || !_) return;
|
|
3203
|
-
const j =
|
|
3206
|
+
const j = p.value, de = y.value.id;
|
|
3204
3207
|
clearTimeout(Ee), Ee = setTimeout(() => {
|
|
3205
3208
|
!j || !u || u.render(de, { values: A, key: j }).then((pe) => {
|
|
3206
3209
|
R.value?.replace(j, pe.html) || R.value?.refresh();
|
|
@@ -3211,7 +3214,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3211
3214
|
{ deep: !0 }
|
|
3212
3215
|
);
|
|
3213
3216
|
function Le(A) {
|
|
3214
|
-
A.key === "Escape" &&
|
|
3217
|
+
A.key === "Escape" && p.value && be();
|
|
3215
3218
|
}
|
|
3216
3219
|
tt(async () => {
|
|
3217
3220
|
if (window.addEventListener("keydown", Le), l.catalog === null && s) {
|
|
@@ -3260,18 +3263,18 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3260
3263
|
tone: "muted"
|
|
3261
3264
|
}, {
|
|
3262
3265
|
default: b(() => [
|
|
3263
|
-
L(k(
|
|
3266
|
+
L(k(f.value.length), 1)
|
|
3264
3267
|
]),
|
|
3265
3268
|
_: 1
|
|
3266
3269
|
})
|
|
3267
3270
|
]),
|
|
3268
3271
|
V("div", gs, [
|
|
3269
3272
|
h(fs, {
|
|
3270
|
-
nodes:
|
|
3273
|
+
nodes: f.value,
|
|
3271
3274
|
catalog: r.value,
|
|
3272
|
-
selected:
|
|
3275
|
+
selected: p.value,
|
|
3273
3276
|
disabled: e.disabled,
|
|
3274
|
-
onSelect:
|
|
3277
|
+
onSelect: q,
|
|
3275
3278
|
onAdd: Te,
|
|
3276
3279
|
onRemove: $e,
|
|
3277
3280
|
onDuplicate: v,
|
|
@@ -3280,7 +3283,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3280
3283
|
}, null, 8, ["nodes", "catalog", "selected", "disabled"])
|
|
3281
3284
|
]),
|
|
3282
3285
|
V("div", ks, [
|
|
3283
|
-
!e.disabled && (e.max === null ||
|
|
3286
|
+
!e.disabled && (e.max === null || f.value.length < e.max) ? (c(), O(n(ue), {
|
|
3284
3287
|
key: 0,
|
|
3285
3288
|
variant: "outline",
|
|
3286
3289
|
icon: "plus",
|
|
@@ -3316,7 +3319,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3316
3319
|
V("button", {
|
|
3317
3320
|
type: "button",
|
|
3318
3321
|
class: "wx-blocks__trail-step",
|
|
3319
|
-
onClick: (de) =>
|
|
3322
|
+
onClick: (de) => q(j.key)
|
|
3320
3323
|
}, k(j.title), 9, $s),
|
|
3321
3324
|
h(n(we), { name: "chevron-right" })
|
|
3322
3325
|
], 64))), 128))
|
|
@@ -3331,7 +3334,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3331
3334
|
icon: "chevron-up",
|
|
3332
3335
|
title: n(a)("field.previous"),
|
|
3333
3336
|
disabled: E.value.previous === null,
|
|
3334
|
-
onClick: D[2] || (D[2] = (j) => E.value.previous &&
|
|
3337
|
+
onClick: D[2] || (D[2] = (j) => E.value.previous && q(E.value.previous))
|
|
3335
3338
|
}, null, 8, ["title", "disabled"]),
|
|
3336
3339
|
h(n(Ge), {
|
|
3337
3340
|
size: "sm",
|
|
@@ -3339,7 +3342,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3339
3342
|
icon: "chevron-down",
|
|
3340
3343
|
title: n(a)("field.next"),
|
|
3341
3344
|
disabled: E.value.next === null,
|
|
3342
|
-
onClick: D[3] || (D[3] = (j) => E.value.next &&
|
|
3345
|
+
onClick: D[3] || (D[3] = (j) => E.value.next && q(E.value.next))
|
|
3343
3346
|
}, null, 8, ["title", "disabled"]),
|
|
3344
3347
|
!z.value && n(_) && n(_).url.value ? (c(), O(n(ue), {
|
|
3345
3348
|
key: 1,
|
|
@@ -3392,7 +3395,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3392
3395
|
ref_key: "previewEl",
|
|
3393
3396
|
ref: R,
|
|
3394
3397
|
url: n(_).url.value,
|
|
3395
|
-
selected:
|
|
3398
|
+
selected: p.value,
|
|
3396
3399
|
reload: n(_).reload?.value ?? 0,
|
|
3397
3400
|
compact: z.value,
|
|
3398
3401
|
onSelect: le,
|
|
@@ -3484,7 +3487,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3484
3487
|
])
|
|
3485
3488
|
]));
|
|
3486
3489
|
}
|
|
3487
|
-
}),
|
|
3490
|
+
}), Jt = /* @__PURE__ */ ae(zs, [["__scopeId", "data-v-ed94ea94"]]), Ms = { class: "wx-block-create" }, Os = { class: "wx-block-create__kind" }, Ds = { class: "wx-block-create__kind-help" }, Is = { class: "wx-block-create__kind" }, Us = { class: "wx-block-create__kind-help" }, Ps = /* @__PURE__ */ se({
|
|
3488
3491
|
__name: "BlockCreateDialog",
|
|
3489
3492
|
setup(e) {
|
|
3490
3493
|
const { resolve: l, dismiss: t, open: o } = Zt(), a = lt(), i = Re(a);
|
|
@@ -3494,7 +3497,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3494
3497
|
title: "",
|
|
3495
3498
|
slug: "",
|
|
3496
3499
|
group: d.value[0] ?? "content"
|
|
3497
|
-
}),
|
|
3500
|
+
}), f = I({}), p = I(!1), m = I(!1), y = $(
|
|
3498
3501
|
() => d.value.map((w) => ({ value: w, label: je(w, s) }))
|
|
3499
3502
|
);
|
|
3500
3503
|
function S(w) {
|
|
@@ -3507,18 +3510,18 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3507
3510
|
}
|
|
3508
3511
|
);
|
|
3509
3512
|
function B(w) {
|
|
3510
|
-
return
|
|
3513
|
+
return f.value[w]?.[0];
|
|
3511
3514
|
}
|
|
3512
3515
|
async function E() {
|
|
3513
|
-
|
|
3516
|
+
p.value = !0, f.value = {};
|
|
3514
3517
|
try {
|
|
3515
3518
|
const { group: w, ..._ } = r.value;
|
|
3516
3519
|
l(await i.create(r.value.kind === "component" ? _ : { ..._, group: w }));
|
|
3517
3520
|
} catch (w) {
|
|
3518
3521
|
const _ = w.body;
|
|
3519
|
-
_?.errors ?
|
|
3522
|
+
_?.errors ? f.value = _.errors : K.danger(u(w, s("page.failed")));
|
|
3520
3523
|
} finally {
|
|
3521
|
-
|
|
3524
|
+
p.value = !1;
|
|
3522
3525
|
}
|
|
3523
3526
|
}
|
|
3524
3527
|
return (w, _) => (c(), O(n(Qt), {
|
|
@@ -3541,7 +3544,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3541
3544
|
}),
|
|
3542
3545
|
h(n(ue), {
|
|
3543
3546
|
type: "primary",
|
|
3544
|
-
loading:
|
|
3547
|
+
loading: p.value,
|
|
3545
3548
|
onClick: E
|
|
3546
3549
|
}, {
|
|
3547
3550
|
default: b(() => [
|
|
@@ -3637,7 +3640,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3637
3640
|
}), Rs = /* @__PURE__ */ ae(Ps, [["__scopeId", "data-v-585106f0"]]), js = { class: "wx-block-declared" }, Fs = {
|
|
3638
3641
|
class: "wx-block-declared__mark",
|
|
3639
3642
|
"aria-hidden": "true"
|
|
3640
|
-
}, Hs = { class: "wx-block-declared__body" },
|
|
3643
|
+
}, Hs = { class: "wx-block-declared__body" }, qs = { class: "wx-block-declared__title" }, Js = {
|
|
3641
3644
|
key: 1,
|
|
3642
3645
|
class: "wx-block-declared__actions"
|
|
3643
3646
|
}, Ks = /* @__PURE__ */ se({
|
|
@@ -3658,7 +3661,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3658
3661
|
h(n(we), { name: "sliders" })
|
|
3659
3662
|
]),
|
|
3660
3663
|
V("div", Hs, [
|
|
3661
|
-
V("div",
|
|
3664
|
+
V("div", qs, k(e.declared.title), 1),
|
|
3662
3665
|
h(n(H), {
|
|
3663
3666
|
size: "sm",
|
|
3664
3667
|
tone: "muted"
|
|
@@ -3689,7 +3692,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3689
3692
|
]),
|
|
3690
3693
|
_: 1
|
|
3691
3694
|
}),
|
|
3692
|
-
e.canManage ? (c(), x("div",
|
|
3695
|
+
e.canManage ? (c(), x("div", Js, [
|
|
3693
3696
|
h(n(ue), {
|
|
3694
3697
|
size: "sm",
|
|
3695
3698
|
loading: e.busy,
|
|
@@ -3724,7 +3727,7 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3724
3727
|
setup(e) {
|
|
3725
3728
|
const l = e, t = lt(), o = Re(t), a = ol();
|
|
3726
3729
|
De();
|
|
3727
|
-
const i = ce("webx-blocks"), s = nt(), u = I([]), d = I([]), r = I(!0),
|
|
3730
|
+
const i = ce("webx-blocks"), s = nt(), u = I([]), d = I([]), r = I(!0), f = I(""), p = I(""), m = I(null), y = el(Rs), S = $(() => {
|
|
3728
3731
|
const v = t.state.manifest?.modules.find((T) => T.id === "blocks")?.meta;
|
|
3729
3732
|
return {
|
|
3730
3733
|
groups: v?.groups ?? [],
|
|
@@ -3742,13 +3745,13 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3742
3745
|
return T ? G(T.module) : null;
|
|
3743
3746
|
}
|
|
3744
3747
|
function z(v) {
|
|
3745
|
-
const T =
|
|
3748
|
+
const T = f.value.trim().toLowerCase();
|
|
3746
3749
|
return T === "" || v.some((M) => (M ?? "").toLowerCase().includes(T));
|
|
3747
3750
|
}
|
|
3748
|
-
const U = $(() =>
|
|
3749
|
-
() =>
|
|
3751
|
+
const U = $(() => p.value === Ke ? [] : (p.value === "" ? w.value : w.value.filter((T) => T.group === p.value)).filter((T) => z([T.title, T.slug, T.description]))), Q = $(
|
|
3752
|
+
() => p.value === "" || p.value === Ke ? _.value.filter((v) => z([v.title, v.slug, v.description])) : []
|
|
3750
3753
|
), X = $(
|
|
3751
|
-
() =>
|
|
3754
|
+
() => p.value === "" || p.value === Ke ? R.value.filter((v) => z([v.title, v.slug, v.description])) : []
|
|
3752
3755
|
), xe = $(() => {
|
|
3753
3756
|
const v = [...S.value.groups];
|
|
3754
3757
|
for (const T of w.value)
|
|
@@ -3758,14 +3761,14 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3758
3761
|
const v = xe.value.map((M) => ({ value: M, label: je(M, i) })), T = Z.value ? [{ value: Ke, label: i("components.components") }] : [];
|
|
3759
3762
|
return v.length + T.length < 2 ? [] : [{ value: "", label: i("page.all-groups") }, ...v, ...T];
|
|
3760
3763
|
}), te = $(() => {
|
|
3761
|
-
const v = xe.value.map((
|
|
3762
|
-
id:
|
|
3763
|
-
label: je(
|
|
3764
|
-
blocks: U.value.filter((le) => le.group ===
|
|
3765
|
-
})).filter((
|
|
3766
|
-
return
|
|
3764
|
+
const v = xe.value.map((q) => ({
|
|
3765
|
+
id: q,
|
|
3766
|
+
label: je(q, i),
|
|
3767
|
+
blocks: U.value.filter((le) => le.group === q)
|
|
3768
|
+
})).filter((q) => q.blocks.length > 0);
|
|
3769
|
+
return p.value !== "" || U.value.length <= 5 || f.value.trim() !== "" || v.length < 2 ? U.value.length === 0 ? [] : [{ id: "", label: p.value === "" && Q.value.length + X.value.length > 0 ? i("components.blocks") : "", blocks: U.value }] : v;
|
|
3767
3770
|
}), ve = $(
|
|
3768
|
-
() =>
|
|
3771
|
+
() => p.value === Ke || U.value.length === 0 ? "" : i("components.components")
|
|
3769
3772
|
), Ce = $(() => u.value.length === 0 && R.value.length === 0);
|
|
3770
3773
|
async function Be() {
|
|
3771
3774
|
r.value = !0;
|
|
@@ -3778,22 +3781,22 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3778
3781
|
r.value = !1;
|
|
3779
3782
|
}
|
|
3780
3783
|
}
|
|
3781
|
-
function
|
|
3784
|
+
function J(v) {
|
|
3782
3785
|
a.push(`${l.base}/${v.id}`);
|
|
3783
3786
|
}
|
|
3784
3787
|
async function Te() {
|
|
3785
3788
|
const v = await y({});
|
|
3786
|
-
v &&
|
|
3789
|
+
v && J(v);
|
|
3787
3790
|
}
|
|
3788
3791
|
async function _e(v) {
|
|
3789
3792
|
m.value = v.slug;
|
|
3790
3793
|
try {
|
|
3791
3794
|
const T = await o.customise(v.slug);
|
|
3792
|
-
K.success(i("components.customised")),
|
|
3795
|
+
K.success(i("components.customised")), J(T);
|
|
3793
3796
|
} catch (T) {
|
|
3794
3797
|
const M = T.body;
|
|
3795
3798
|
if (T.status === 409 && typeof M?.id == "number") {
|
|
3796
|
-
|
|
3799
|
+
J({ id: M.id });
|
|
3797
3800
|
return;
|
|
3798
3801
|
}
|
|
3799
3802
|
K.danger(s(T, i("components.customise-failed")));
|
|
@@ -3808,8 +3811,8 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3808
3811
|
} }] : []
|
|
3809
3812
|
);
|
|
3810
3813
|
return (v, T) => (c(), O(n(Ql), {
|
|
3811
|
-
view:
|
|
3812
|
-
"onUpdate:view": T[1] || (T[1] = (M) =>
|
|
3814
|
+
view: p.value,
|
|
3815
|
+
"onUpdate:view": T[1] || (T[1] = (M) => p.value = M),
|
|
3813
3816
|
class: "wx-blocks-page",
|
|
3814
3817
|
title: E.value,
|
|
3815
3818
|
views: re.value,
|
|
@@ -3824,8 +3827,8 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3824
3827
|
}, null, 8, ["description"])),
|
|
3825
3828
|
r.value || !Ce.value ? (c(), x("div", Gs, [
|
|
3826
3829
|
h(n(et), {
|
|
3827
|
-
modelValue:
|
|
3828
|
-
"onUpdate:modelValue": T[0] || (T[0] = (M) =>
|
|
3830
|
+
modelValue: f.value,
|
|
3831
|
+
"onUpdate:modelValue": T[0] || (T[0] = (M) => f.value = M),
|
|
3829
3832
|
class: "wx-blocks-page__search",
|
|
3830
3833
|
placeholder: n(i)("page.search"),
|
|
3831
3834
|
clearable: ""
|
|
@@ -3874,21 +3877,21 @@ const Jt = /* @__PURE__ */ Symbol("wx-blocks-root"), ms = {
|
|
|
3874
3877
|
}, [
|
|
3875
3878
|
M.label ? (c(), x("div", Xs, k(M.label), 1)) : W("", !0),
|
|
3876
3879
|
V("div", ea, [
|
|
3877
|
-
(c(!0), x(P, null, Y(M.blocks, (
|
|
3878
|
-
key:
|
|
3879
|
-
block:
|
|
3880
|
-
onOpen:
|
|
3880
|
+
(c(!0), x(P, null, Y(M.blocks, (q) => (c(), O(Jt, {
|
|
3881
|
+
key: q.id,
|
|
3882
|
+
block: q,
|
|
3883
|
+
onOpen: J
|
|
3881
3884
|
}, null, 8, ["block"]))), 128))
|
|
3882
3885
|
])
|
|
3883
3886
|
]))), 128)),
|
|
3884
3887
|
Q.value.length > 0 || X.value.length > 0 ? (c(), x("section", ta, [
|
|
3885
3888
|
ve.value ? (c(), x("div", la, k(ve.value), 1)) : W("", !0),
|
|
3886
3889
|
V("div", na, [
|
|
3887
|
-
(c(!0), x(P, null, Y(Q.value, (M) => (c(), O(
|
|
3890
|
+
(c(!0), x(P, null, Y(Q.value, (M) => (c(), O(Jt, {
|
|
3888
3891
|
key: M.id,
|
|
3889
3892
|
block: M,
|
|
3890
3893
|
module: ie(M.slug),
|
|
3891
|
-
onOpen:
|
|
3894
|
+
onOpen: J
|
|
3892
3895
|
}, null, 8, ["block", "module"]))), 128)),
|
|
3893
3896
|
(c(!0), x(P, null, Y(X.value, (M) => (c(), O(Ys, {
|
|
3894
3897
|
key: M.slug,
|