@webx-ui/module-blocks 0.8.7 → 0.8.9
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 +376 -351
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as ae, computed as L, openBlock as
|
|
1
|
+
import { defineComponent as ae, computed as L, openBlock as d, createElementBlock as C, createVNode as m, unref as n, createElementVNode as A, createTextVNode as M, toDisplayString as S, Fragment as F, createCommentVNode as D, renderList as le, ref as I, onMounted as Re, watch as te, createBlock as z, withCtx as b, onBeforeUnmount as Xe, normalizeStyle as xe, reactive as st, normalizeClass as $e, withDirectives as al, vShow as il, inject as De, watchEffect as rl, resolveComponent as At, isRef as Vt, nextTick as ul, withKeys as ht, withModifiers as bt, provide as Bt, useModel as cl, getCurrentInstance as dl, resolveDynamicComponent as pl, mergeProps as fl, mergeModels as ml } from "vue";
|
|
2
2
|
import { useRoute as vl, useRouter as Wt } from "vue-router";
|
|
3
3
|
import { useTranslate as de, useAdmin as je, useErrorText as Fe, WxDate as hl, WxScreenHead as bl, WxRenameButton as gl, WxHelpButton as yl, adminKey as Mt, WxRowMenu as kl, WxListScreen as wl } from "@webx-ui/module-admin";
|
|
4
|
-
import { WxIcon as he, WxSkeleton as Be, WxText as
|
|
4
|
+
import { WxIcon as he, WxSkeleton as Be, WxText as q, WxBadge as ue, WxButton as ce, confirm as Qe, toast as Z, useElementWidth as et, WxSegmented as Nt, WxCard as Ae, WxPopover as _l, WxAlert as zt, WxTabs as xl, WxTab as Ve, WxCodeEditor as Ke, WxFormItem as oe, WxInput as Ue, WxSelect as Dt, WxTextarea as $l, WxIconPicker as Sl, WxInputNumber as gt, WxTagsInput as yt, WxSwitch as El, WxActionBar as Tl, useModal as It, WxDialog as Ot, WxEmpty as Pt, WxAction as Ie, WxSortableList as Cl, createModal as Ut, WxDrawer as Ll, WxSpace as Al, WxSkeletonItem as Ye } from "@webx-ui/core";
|
|
5
5
|
import { WxScreenRenderer as Rt, coreTypes as Je } from "@webx-ui/schema";
|
|
6
6
|
import { autocompletion as Vl, snippetCompletion as ve, pickedCompletion as dt, startCompletion as Bl } from "@codemirror/autocomplete";
|
|
7
7
|
import { EditorState as Wl } from "@codemirror/state";
|
|
@@ -38,32 +38,32 @@ const Ml = { class: "wx-block-checks" }, Nl = {
|
|
|
38
38
|
const i = new Set(s.value.map((r) => r.code)), o = [];
|
|
39
39
|
return l.file === "template" && (i.has("no-marker") || o.push(t("checks.ok-marker")), i.has("variables-missing") || o.push(t("checks.ok-variables"))), l.file === "styles" && (i.has("stray-selectors") || o.push(t("checks.ok-prefix", { slug: l.slug })), i.has("bare-selectors") || o.push(t("checks.ok-bare")), i.has("media-query") || o.push(t("checks.ok-container"))), o;
|
|
40
40
|
});
|
|
41
|
-
return (i, o) => (
|
|
42
|
-
e.error ? (
|
|
41
|
+
return (i, o) => (d(), C("div", Ml, [
|
|
42
|
+
e.error ? (d(), C("div", Nl, [
|
|
43
43
|
m(n(he), { name: "close-circle" }),
|
|
44
44
|
A("span", null, [
|
|
45
45
|
M(S(e.error.message) + " ", 1),
|
|
46
|
-
e.error.line !== null ? (
|
|
46
|
+
e.error.line !== null ? (d(), C(F, { key: 0 }, [
|
|
47
47
|
M(" · " + S(n(t)("page.line", { line: e.error.line })), 1)
|
|
48
48
|
], 64)) : D("", !0),
|
|
49
|
-
e.error.where ? (
|
|
49
|
+
e.error.where ? (d(), C(F, { key: 1 }, [
|
|
50
50
|
M(" · " + S(e.error.where), 1)
|
|
51
51
|
], 64)) : D("", !0)
|
|
52
52
|
])
|
|
53
53
|
])) : D("", !0),
|
|
54
|
-
(
|
|
54
|
+
(d(!0), C(F, null, le(s.value, (r) => (d(), C("div", {
|
|
55
55
|
key: r.code,
|
|
56
56
|
class: "wx-block-checks__line is-warning"
|
|
57
57
|
}, [
|
|
58
58
|
m(n(he), { name: "warning" }),
|
|
59
59
|
A("span", null, [
|
|
60
60
|
M(S(r.message) + " ", 1),
|
|
61
|
-
r.line !== null ? (
|
|
61
|
+
r.line !== null ? (d(), C(F, { key: 0 }, [
|
|
62
62
|
M(" · " + S(n(t)("page.line", { line: r.line })), 1)
|
|
63
63
|
], 64)) : D("", !0)
|
|
64
64
|
])
|
|
65
65
|
]))), 128)),
|
|
66
|
-
(
|
|
66
|
+
(d(!0), C(F, null, le(a.value, (r) => (d(), C("div", {
|
|
67
67
|
key: r,
|
|
68
68
|
class: "wx-block-checks__line is-ok"
|
|
69
69
|
}, [
|
|
@@ -85,9 +85,9 @@ const Ml = { class: "wx-block-checks" }, Nl = {
|
|
|
85
85
|
},
|
|
86
86
|
emits: ["restored"],
|
|
87
87
|
setup(e, { emit: l }) {
|
|
88
|
-
const t = e, s = l, a = je(), i = Me(a), o = de("webx-blocks"), r = Fe(),
|
|
88
|
+
const t = e, s = l, a = je(), i = Me(a), o = de("webx-blocks"), r = Fe(), c = I(null);
|
|
89
89
|
async function u() {
|
|
90
|
-
|
|
90
|
+
c.value = await i.versions(t.block.id);
|
|
91
91
|
}
|
|
92
92
|
function p(v) {
|
|
93
93
|
return t.block.draft?.number === v.number ? "draft" : t.block.published?.number === v.number ? "live" : "replaced";
|
|
@@ -111,41 +111,41 @@ const Ml = { class: "wx-block-checks" }, Nl = {
|
|
|
111
111
|
() => {
|
|
112
112
|
u();
|
|
113
113
|
}
|
|
114
|
-
), (v, g) => (
|
|
115
|
-
|
|
114
|
+
), (v, g) => (d(), C("div", Dl, [
|
|
115
|
+
c.value === null ? (d(), z(n(Be), {
|
|
116
116
|
key: 0,
|
|
117
117
|
class: "wx-block-history__ghost",
|
|
118
118
|
rows: 3
|
|
119
|
-
})) : (
|
|
119
|
+
})) : (d(!0), C(F, { key: 1 }, le(c.value, (x) => (d(), C("div", {
|
|
120
120
|
key: x.number,
|
|
121
121
|
class: "wx-block-history__row"
|
|
122
122
|
}, [
|
|
123
123
|
A("code", Il, S(n(o)("page.version", { number: x.number })), 1),
|
|
124
124
|
A("div", Ol, [
|
|
125
|
-
m(n(
|
|
125
|
+
m(n(q), null, {
|
|
126
126
|
default: b(() => [
|
|
127
127
|
M(S(n(o)(`page.version-${p(x)}`)), 1)
|
|
128
128
|
]),
|
|
129
129
|
_: 2
|
|
130
130
|
}, 1024),
|
|
131
|
-
m(n(
|
|
131
|
+
m(n(q), {
|
|
132
132
|
size: "sm",
|
|
133
133
|
tone: "muted"
|
|
134
134
|
}, {
|
|
135
135
|
default: b(() => [
|
|
136
|
-
x.created_at ? (
|
|
136
|
+
x.created_at ? (d(), z(n(hl), {
|
|
137
137
|
key: 0,
|
|
138
138
|
value: x.created_at
|
|
139
139
|
}, null, 8, ["value"])) : D("", !0),
|
|
140
140
|
M(" · " + S(x.author ?? n(o)(`page.source-${x.source}`)) + " ", 1),
|
|
141
|
-
x.comment ? (
|
|
141
|
+
x.comment ? (d(), C(F, { key: 1 }, [
|
|
142
142
|
M(" · " + S(x.comment), 1)
|
|
143
143
|
], 64)) : D("", !0)
|
|
144
144
|
]),
|
|
145
145
|
_: 2
|
|
146
146
|
}, 1024)
|
|
147
147
|
]),
|
|
148
|
-
p(x) === "draft" ? (
|
|
148
|
+
p(x) === "draft" ? (d(), z(n(ue), {
|
|
149
149
|
key: 0,
|
|
150
150
|
type: "warning",
|
|
151
151
|
dot: ""
|
|
@@ -154,7 +154,7 @@ const Ml = { class: "wx-block-checks" }, Nl = {
|
|
|
154
154
|
M(S(n(o)("page.version-draft")), 1)
|
|
155
155
|
]),
|
|
156
156
|
_: 1
|
|
157
|
-
})) : p(x) === "live" ? (
|
|
157
|
+
})) : p(x) === "live" ? (d(), z(n(ue), {
|
|
158
158
|
key: 1,
|
|
159
159
|
type: "success",
|
|
160
160
|
dot: ""
|
|
@@ -164,7 +164,7 @@ const Ml = { class: "wx-block-checks" }, Nl = {
|
|
|
164
164
|
]),
|
|
165
165
|
_: 1
|
|
166
166
|
})) : D("", !0),
|
|
167
|
-
e.canManage && p(x) === "replaced" ? (
|
|
167
|
+
e.canManage && p(x) === "replaced" ? (d(), z(n(ce), {
|
|
168
168
|
key: 2,
|
|
169
169
|
size: "sm",
|
|
170
170
|
variant: "outline",
|
|
@@ -209,8 +209,8 @@ function Ft(e, l, t) {
|
|
|
209
209
|
if (a.removeChild(r), v) break;
|
|
210
210
|
r = f;
|
|
211
211
|
}
|
|
212
|
-
const
|
|
213
|
-
a.insertBefore(
|
|
212
|
+
const c = i.content, u = Array.from(c.childNodes);
|
|
213
|
+
a.insertBefore(c, o);
|
|
214
214
|
const p = e.defaultView?.webx;
|
|
215
215
|
if (p?.mount)
|
|
216
216
|
for (const f of u)
|
|
@@ -317,9 +317,9 @@ function Ht(e) {
|
|
|
317
317
|
const l = e.base ? `<base href="${rt(e.base)}">` : "", t = e.frame ? `<style>${e.frame}</style>` : "", s = e.script && e.runtime ? `<script src="${rt(e.runtime)}"><\/script><script>${e.script}<\/script>` : "";
|
|
318
318
|
return `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">${l}<style>html,body{margin:0}body{container-type:inline-size}</style>${t}<style>${e.styles}</style></head><body>${e.html}${s}</body></html>`;
|
|
319
319
|
}
|
|
320
|
-
const
|
|
321
|
-
function
|
|
322
|
-
const t = new DOMParser().parseFromString(e, "text/html"), s =
|
|
320
|
+
const qt = "<!--wx-thumb-->";
|
|
321
|
+
function ql(e, l) {
|
|
322
|
+
const t = new DOMParser().parseFromString(e, "text/html"), s = Yl(t, `wx:${Ze}`);
|
|
323
323
|
if (s === null) return null;
|
|
324
324
|
const a = (u) => u === null ? null : new URL(u, new URL(l, location.href)).href, i = [];
|
|
325
325
|
for (const u of Array.from(t.head.children)) {
|
|
@@ -331,18 +331,18 @@ function Kl(e, l) {
|
|
|
331
331
|
v.setAttribute("href", a(u.getAttribute("href")) ?? ""), i.push(v.outerHTML);
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
|
-
let o =
|
|
334
|
+
let o = qt, r = s.parentElement;
|
|
335
335
|
for (; r !== null && r !== t.body && r !== t.documentElement; ) {
|
|
336
336
|
const u = r.cloneNode(!1);
|
|
337
337
|
u.innerHTML = o, o = u.outerHTML, r = r.parentElement;
|
|
338
338
|
}
|
|
339
|
-
const
|
|
340
|
-
return `<!doctype html><html${
|
|
339
|
+
const c = (u) => Array.from(u.attributes).map((p) => ` ${p.name}="${rt(p.value)}"`).join("");
|
|
340
|
+
return `<!doctype html><html${c(t.documentElement)}><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">${i.join("")}</head><body${c(t.body)}>${o}</body></html>`;
|
|
341
341
|
}
|
|
342
|
-
function
|
|
343
|
-
return e.replace("</head>", () => `<style>${l.styles}</style></head>`).replace(
|
|
342
|
+
function Kl(e, l) {
|
|
343
|
+
return e.replace("</head>", () => `<style>${l.styles}</style></head>`).replace(qt, () => l.html);
|
|
344
344
|
}
|
|
345
|
-
function
|
|
345
|
+
function Yl(e, l) {
|
|
346
346
|
const t = e.createTreeWalker(e.body ?? e.documentElement, NodeFilter.SHOW_COMMENT);
|
|
347
347
|
for (let s = t.nextNode(); s !== null; s = t.nextNode())
|
|
348
348
|
if (s.data.trim() === l) return s;
|
|
@@ -366,7 +366,7 @@ const Jl = { class: "wx-block-stage" }, Gl = { class: "wx-block-stage__bar" }, Z
|
|
|
366
366
|
{ value: 1280, icon: "monitor", ariaLabel: t("page.width-desktop") },
|
|
367
367
|
{ value: 834, icon: "tablet", ariaLabel: t("page.width-tablet") },
|
|
368
368
|
{ value: 390, icon: "smartphone", ariaLabel: t("page.width-phone") }
|
|
369
|
-
]), a = I(1280), i = I(null), o = I(null), r = et(i),
|
|
369
|
+
]), a = I(1280), i = I(null), o = I(null), r = et(i), c = I(360), u = I(!1);
|
|
370
370
|
te([r, s], () => {
|
|
371
371
|
if (u.value || r.value === 0) return;
|
|
372
372
|
const h = s.value.find((V) => r.value / V.value >= 0.45);
|
|
@@ -395,7 +395,7 @@ const Jl = { class: "wx-block-stage" }, Gl = { class: "wx-block-stage__bar" }, Z
|
|
|
395
395
|
const h = o.value?.contentDocument?.body;
|
|
396
396
|
if (!h) return;
|
|
397
397
|
const V = h.ownerDocument.defaultView, O = V && parseFloat(V.getComputedStyle(h).marginBottom) || 0, J = h.getBoundingClientRect().bottom + O + (V?.scrollY ?? 0);
|
|
398
|
-
|
|
398
|
+
c.value = Math.max(120, Math.ceil(Math.max(h.scrollHeight, J)));
|
|
399
399
|
}
|
|
400
400
|
let w = null, y = null;
|
|
401
401
|
function _() {
|
|
@@ -404,7 +404,7 @@ const Jl = { class: "wx-block-stage" }, Gl = { class: "wx-block-stage__bar" }, Z
|
|
|
404
404
|
function R(h) {
|
|
405
405
|
l.stage && (l.script && x !== l.script && (x = l.script, Hl(h, l.script)), Fl(h, { html: l.html, styles: l.styles }));
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function K() {
|
|
408
408
|
_();
|
|
409
409
|
const h = o.value?.contentDocument;
|
|
410
410
|
if (!h?.body) return;
|
|
@@ -421,15 +421,15 @@ const Jl = { class: "wx-block-stage" }, Gl = { class: "wx-block-stage__bar" }, Z
|
|
|
421
421
|
), te(r, (h, V) => {
|
|
422
422
|
h > 0 && V === 0 && setTimeout(T, 50);
|
|
423
423
|
}), te(a, () => setTimeout(T, 50)), Xe(_);
|
|
424
|
-
const
|
|
424
|
+
const Y = L(() => ({
|
|
425
425
|
width: `${a.value}px`,
|
|
426
|
-
height: `${
|
|
426
|
+
height: `${c.value}px`,
|
|
427
427
|
transform: `scale(${f.value})`
|
|
428
428
|
})), X = L(() => ({
|
|
429
429
|
width: `${Math.round(a.value * f.value)}px`,
|
|
430
|
-
height: `${Math.round(
|
|
430
|
+
height: `${Math.round(c.value * f.value)}px`
|
|
431
431
|
}));
|
|
432
|
-
return (h, V) => (
|
|
432
|
+
return (h, V) => (d(), C("div", Jl, [
|
|
433
433
|
A("div", Gl, [
|
|
434
434
|
m(n(Nt), {
|
|
435
435
|
"model-value": a.value,
|
|
@@ -444,36 +444,36 @@ const Jl = { class: "wx-block-stage" }, Gl = { class: "wx-block-stage__bar" }, Z
|
|
|
444
444
|
ref: i,
|
|
445
445
|
class: "wx-block-stage__ground"
|
|
446
446
|
}, [
|
|
447
|
-
e.loading && !e.html ? (
|
|
447
|
+
e.loading && !e.html ? (d(), z(n(Be), {
|
|
448
448
|
key: 0,
|
|
449
449
|
rows: 3
|
|
450
|
-
})) : (
|
|
450
|
+
})) : (d(), C("div", {
|
|
451
451
|
key: 1,
|
|
452
452
|
class: "wx-block-stage__clip",
|
|
453
453
|
style: xe(X.value)
|
|
454
454
|
}, [
|
|
455
|
-
(
|
|
455
|
+
(d(), C("iframe", {
|
|
456
456
|
ref_key: "frame",
|
|
457
457
|
ref: o,
|
|
458
458
|
key: g.value,
|
|
459
459
|
class: "wx-block-stage__frame",
|
|
460
460
|
src: e.stage ?? void 0,
|
|
461
461
|
srcdoc: v.value,
|
|
462
|
-
style: xe(
|
|
462
|
+
style: xe(Y.value),
|
|
463
463
|
sandbox: "allow-same-origin allow-scripts",
|
|
464
464
|
title: n(t)("page.preview"),
|
|
465
|
-
onLoad:
|
|
465
|
+
onLoad: K
|
|
466
466
|
}, null, 44, Zl))
|
|
467
467
|
], 4))
|
|
468
468
|
], 512)
|
|
469
469
|
]));
|
|
470
470
|
}
|
|
471
471
|
}), Xl = /* @__PURE__ */ ie(Ql, [["__scopeId", "data-v-3185ee45"]]);
|
|
472
|
-
function
|
|
472
|
+
function Kt(e) {
|
|
473
473
|
return typeof e == "object" && e !== null && typeof e.type == "string" && e.type !== "";
|
|
474
474
|
}
|
|
475
475
|
function tt(e) {
|
|
476
|
-
return Array.isArray(e) && e.length > 0 && e.every(
|
|
476
|
+
return Array.isArray(e) && e.length > 0 && e.every(Kt);
|
|
477
477
|
}
|
|
478
478
|
function ut() {
|
|
479
479
|
return (typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID().replace(/-/g, "") : Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2)).slice(0, 12);
|
|
@@ -482,23 +482,23 @@ function en(e, l = {}) {
|
|
|
482
482
|
return { key: ut(), type: e, values: l };
|
|
483
483
|
}
|
|
484
484
|
function re(e, l) {
|
|
485
|
-
return
|
|
485
|
+
return Yt(e, l, null, null);
|
|
486
486
|
}
|
|
487
|
-
function
|
|
487
|
+
function Yt(e, l, t, s) {
|
|
488
488
|
for (let a = 0; a < e.length; a++) {
|
|
489
489
|
const i = e[a];
|
|
490
490
|
if (i.key === l) return { node: i, parent: t, field: s, list: e, index: a };
|
|
491
491
|
for (const [o, r] of Object.entries(i.values ?? {}))
|
|
492
492
|
if (tt(r)) {
|
|
493
|
-
const
|
|
494
|
-
if (
|
|
493
|
+
const c = Yt(r, l, i, o);
|
|
494
|
+
if (c) return c;
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
497
|
return null;
|
|
498
498
|
}
|
|
499
499
|
function He(e, l, t = 0, s = null) {
|
|
500
500
|
for (const a of e)
|
|
501
|
-
if (
|
|
501
|
+
if (Kt(a)) {
|
|
502
502
|
l(a, t, s);
|
|
503
503
|
for (const i of Object.values(a.values ?? {}))
|
|
504
504
|
tt(i) && He(i, l, t + 1, a);
|
|
@@ -516,7 +516,7 @@ function ln(e) {
|
|
|
516
516
|
tt(t) && He(t, () => l++);
|
|
517
517
|
return l;
|
|
518
518
|
}
|
|
519
|
-
function
|
|
519
|
+
function vo(e) {
|
|
520
520
|
const l = [];
|
|
521
521
|
return He(e, (t) => {
|
|
522
522
|
l.includes(t.type) || l.push(t.type);
|
|
@@ -722,7 +722,7 @@ const un = {
|
|
|
722
722
|
"ok-variables": "Every variable of the template is a field of the schema."
|
|
723
723
|
}
|
|
724
724
|
}, St = /* @__PURE__ */ new WeakSet();
|
|
725
|
-
function
|
|
725
|
+
function qe() {
|
|
726
726
|
try {
|
|
727
727
|
const { i18n: e } = je();
|
|
728
728
|
St.has(e) || (e.defaults("webx-blocks", un), St.add(e));
|
|
@@ -741,33 +741,58 @@ const cn = [
|
|
|
741
741
|
], dn = ["key", "type", "version", "depth"], Zt = ["url", "alt", "title", "path"], pn = [...Zt, "thumb", "name", "extension", "mime", "size", "width", "height"], fn = ["wx-media"], mn = ["wx-gallery", "wx-files"], vn = ["items", "groups", "filter"], hn = {
|
|
742
742
|
items: ["id", "anchor", "categories"],
|
|
743
743
|
groups: ["id", "title", "items"]
|
|
744
|
+
}, bn = {
|
|
745
|
+
faq: ["question", "answer"],
|
|
746
|
+
services: ["title", "url", "lead", "cover", "fields"],
|
|
747
|
+
reviews: [
|
|
748
|
+
"name",
|
|
749
|
+
"initials",
|
|
750
|
+
"job_title",
|
|
751
|
+
"text",
|
|
752
|
+
"rating",
|
|
753
|
+
"date",
|
|
754
|
+
"profile",
|
|
755
|
+
"photo",
|
|
756
|
+
"fields"
|
|
757
|
+
],
|
|
758
|
+
recipes: [
|
|
759
|
+
"title",
|
|
760
|
+
"url",
|
|
761
|
+
"lead",
|
|
762
|
+
"cover",
|
|
763
|
+
"gallery",
|
|
764
|
+
"minutes",
|
|
765
|
+
"servings",
|
|
766
|
+
"nutrients",
|
|
767
|
+
"fields"
|
|
768
|
+
]
|
|
744
769
|
};
|
|
745
|
-
function
|
|
770
|
+
function gn({ schema: e, styles: l }) {
|
|
746
771
|
return (t) => {
|
|
747
772
|
const s = t.state.sliceDoc(Math.max(0, t.pos - 200), t.pos), a = /\$block->(\w*)$/.exec(s);
|
|
748
|
-
if (a) return
|
|
773
|
+
if (a) return wn(t, a[1]);
|
|
749
774
|
const i = /\$(\w+)\[\s*(['"]?)(\w*)$/.exec(s);
|
|
750
|
-
if (i) return
|
|
775
|
+
if (i) return _n(t, i[1], i[2], i[3], e());
|
|
751
776
|
const o = /\$(\w*)$/.exec(s);
|
|
752
777
|
if (o)
|
|
753
778
|
return {
|
|
754
779
|
from: t.pos - o[0].length,
|
|
755
|
-
options:
|
|
780
|
+
options: yn(e(), t.state.doc.toString()),
|
|
756
781
|
validFor: /^\$\w*$/
|
|
757
782
|
};
|
|
758
783
|
const r = /(\{\{|\{!!)(\s*)(\w*)$/.exec(s);
|
|
759
|
-
if (r) return
|
|
760
|
-
const
|
|
761
|
-
if (
|
|
784
|
+
if (r) return kn(t, r[1], r[2], r[3], e());
|
|
785
|
+
const c = /\bclass\s*=\s*"([^"]*)$/.exec(s);
|
|
786
|
+
if (c) return $n(t, c[1], l());
|
|
762
787
|
const u = /(?:^|[\s>(])@(\w*)$/.exec(s);
|
|
763
788
|
return u ? {
|
|
764
789
|
from: t.pos - u[1].length - 1,
|
|
765
|
-
options:
|
|
790
|
+
options: Sn(e()),
|
|
766
791
|
validFor: /^@\w*$/
|
|
767
792
|
} : null;
|
|
768
793
|
};
|
|
769
794
|
}
|
|
770
|
-
function
|
|
795
|
+
function yn(e, l) {
|
|
771
796
|
const t = el(e).map((s, a) => ({
|
|
772
797
|
label: `$${s.id}`,
|
|
773
798
|
detail: s.type,
|
|
@@ -781,21 +806,21 @@ function gn(e, l) {
|
|
|
781
806
|
t.push({ label: `$${s}`, detail: "given", info: a, type: "variable", boost: -10 });
|
|
782
807
|
return t.push({ label: "$loop", detail: "given", info: "inside @foreach", boost: -20 }), t;
|
|
783
808
|
}
|
|
784
|
-
function
|
|
809
|
+
function kn(e, l, t, s, a) {
|
|
785
810
|
const i = el(a);
|
|
786
811
|
if (i.length === 0) return null;
|
|
787
812
|
const o = l === "{{" ? "}}" : "!!}";
|
|
788
813
|
return {
|
|
789
814
|
from: e.pos - s.length,
|
|
790
|
-
options: i.map((r,
|
|
815
|
+
options: i.map((r, c) => ({
|
|
791
816
|
label: r.id,
|
|
792
817
|
displayLabel: `$${r.id}`,
|
|
793
818
|
detail: r.type,
|
|
794
819
|
info: r.label,
|
|
795
820
|
type: "variable",
|
|
796
|
-
boost: 50 -
|
|
821
|
+
boost: 50 - c,
|
|
797
822
|
apply: (u, p, f, v) => {
|
|
798
|
-
const g = u.state.sliceDoc(v, v + 8), x = new RegExp(`^\\s*${
|
|
823
|
+
const g = u.state.sliceDoc(v, v + 8), x = new RegExp(`^\\s*${Bn(o)}`).exec(g), T = x ? /^\s/.test(g) ? "" : " " : ` ${o}`, w = `${t === "" ? " " : ""}$${r.id}${T}`;
|
|
799
824
|
u.dispatch({
|
|
800
825
|
changes: { from: f, to: v, insert: w },
|
|
801
826
|
// Past the closing braces: the echo is finished, the next thing is the markup.
|
|
@@ -808,7 +833,7 @@ function yn(e, l, t, s, a) {
|
|
|
808
833
|
validFor: /^\w*$/
|
|
809
834
|
};
|
|
810
835
|
}
|
|
811
|
-
function
|
|
836
|
+
function wn(e, l) {
|
|
812
837
|
return {
|
|
813
838
|
from: e.pos - l.length,
|
|
814
839
|
options: [
|
|
@@ -822,17 +847,17 @@ function kn(e, l) {
|
|
|
822
847
|
validFor: /^\w*$/
|
|
823
848
|
};
|
|
824
849
|
}
|
|
825
|
-
function
|
|
826
|
-
const i =
|
|
850
|
+
function _n(e, l, t, s, a) {
|
|
851
|
+
const i = xn(l, a, e.state.doc.toString());
|
|
827
852
|
return i.length === 0 ? null : {
|
|
828
853
|
from: e.pos - s.length,
|
|
829
854
|
options: i.map(([o, r]) => ({
|
|
830
855
|
label: o,
|
|
831
856
|
detail: r,
|
|
832
857
|
type: "property",
|
|
833
|
-
apply: (
|
|
834
|
-
const v = t ? p - 1 : p, g =
|
|
835
|
-
|
|
858
|
+
apply: (c, u, p, f) => {
|
|
859
|
+
const v = t ? p - 1 : p, g = c.state.sliceDoc(f, f + 2), x = t || "'", T = f + (g.startsWith(x) ? 1 : 0), w = c.state.sliceDoc(T, T + 1) === "]", y = `${x}${o}${x}${w ? "" : "]"}`;
|
|
860
|
+
c.dispatch({
|
|
836
861
|
changes: { from: v, to: T, insert: y },
|
|
837
862
|
selection: { anchor: v + y.length + (w ? 1 : 0) },
|
|
838
863
|
annotations: dt.of(u),
|
|
@@ -843,17 +868,17 @@ function wn(e, l, t, s, a) {
|
|
|
843
868
|
validFor: /^\w*$/
|
|
844
869
|
};
|
|
845
870
|
}
|
|
846
|
-
function
|
|
847
|
-
const s = We(l).find((
|
|
848
|
-
if (s && fn.includes(s.type)) return Zt.map((
|
|
849
|
-
if (s?.type === "wx-collection") return vn.map((
|
|
850
|
-
const a = Qt(t).get(e), [i, o] = a?.split(".") ?? [], r = i ? We(l).find((
|
|
871
|
+
function xn(e, l, t) {
|
|
872
|
+
const s = We(l).find((c) => c.id === e);
|
|
873
|
+
if (s && fn.includes(s.type)) return Zt.map((c) => [c, s.type]);
|
|
874
|
+
if (s?.type === "wx-collection") return vn.map((c) => [c, s.type]);
|
|
875
|
+
const a = Qt(t).get(e), [i, o] = a?.split(".") ?? [], r = i ? We(l).find((c) => c.id === i) : void 0;
|
|
851
876
|
if (!r) return [];
|
|
852
877
|
if (r.type === "wx-collection") {
|
|
853
|
-
const
|
|
854
|
-
return
|
|
878
|
+
const c = typeof r.props?.source == "string" ? r.props.source : r.type, u = o === "items" ? bn[c] ?? [] : [];
|
|
879
|
+
return [...hn[o ?? ""] ?? [], ...u].map((p) => [p, c]);
|
|
855
880
|
}
|
|
856
|
-
return mn.includes(r.type) ? pn.map((
|
|
881
|
+
return mn.includes(r.type) ? pn.map((c) => [c, r.type]) : r.type === "wx-repeater" ? We(r.children ?? []).map((c) => [c.id, c.type]) : [];
|
|
857
882
|
}
|
|
858
883
|
function Qt(e) {
|
|
859
884
|
const l = /* @__PURE__ */ new Map();
|
|
@@ -863,7 +888,7 @@ function Qt(e) {
|
|
|
863
888
|
l.set(t[4] ?? t[3], t[2] ? `${t[1]}.${t[2]}` : t[1]);
|
|
864
889
|
return l;
|
|
865
890
|
}
|
|
866
|
-
function
|
|
891
|
+
function $n(e, l, t) {
|
|
867
892
|
const s = /[\w-]*$/.exec(l)[0], a = new Set(l.split(/\s+/));
|
|
868
893
|
return {
|
|
869
894
|
from: e.pos - s.length,
|
|
@@ -871,7 +896,7 @@ function xn(e, l, t) {
|
|
|
871
896
|
validFor: /^[\w-]*$/
|
|
872
897
|
};
|
|
873
898
|
}
|
|
874
|
-
function
|
|
899
|
+
function Sn(e) {
|
|
875
900
|
const l = We(e).filter((t) => t.type === "wx-blocks");
|
|
876
901
|
return [
|
|
877
902
|
ve("@if (${condition})\n ${}\n@endif", { label: "@if", type: "keyword" }),
|
|
@@ -903,13 +928,13 @@ function $n(e) {
|
|
|
903
928
|
)
|
|
904
929
|
];
|
|
905
930
|
}
|
|
906
|
-
function
|
|
931
|
+
function En({ slug: e, template: l }) {
|
|
907
932
|
return (t) => {
|
|
908
933
|
const s = t.state.sliceDoc(Math.max(0, t.pos - 200), t.pos), a = /(?:^|[\s,>+~(}{])\.([\w-]*)$/.exec(s);
|
|
909
934
|
if (!a) return null;
|
|
910
935
|
const i = /[^{};]*$/.exec(s)[0];
|
|
911
936
|
if (/^\s*[\w-]+\s*:\s/.test(i)) return null;
|
|
912
|
-
const o = `b-${e()}`, r = new Set(Xt(t.state.doc.toString())),
|
|
937
|
+
const o = `b-${e()}`, r = new Set(Xt(t.state.doc.toString())), c = Tn(l()), u = [o, ...c.filter((f) => f !== o)], p = u.map((f, v) => ({
|
|
913
938
|
label: `.${f}`,
|
|
914
939
|
// A class the template uses and nothing styles yet is the likeliest thing to write.
|
|
915
940
|
detail: r.has(f) ? "template" : "template · no rule yet",
|
|
@@ -926,16 +951,16 @@ function Xt(e) {
|
|
|
926
951
|
let a = "";
|
|
927
952
|
for (const i of l)
|
|
928
953
|
if (i === "{") {
|
|
929
|
-
const o = s.at(-1) ?? [""], r = a.split(",").map((
|
|
930
|
-
(
|
|
954
|
+
const o = s.at(-1) ?? [""], r = a.split(",").map((c) => c.trim()).filter((c) => c !== "" && !c.startsWith("@")).flatMap(
|
|
955
|
+
(c) => c.includes("&") ? o.map((u) => c.replaceAll("&", u)) : o.map((u) => u ? `${u} ${c}` : c)
|
|
931
956
|
);
|
|
932
|
-
for (const
|
|
933
|
-
for (const u of
|
|
957
|
+
for (const c of r)
|
|
958
|
+
for (const u of c.matchAll(/\.(-?[a-zA-Z_][\w-]*)/g)) t.add(u[1]);
|
|
934
959
|
s.push(a.trim().startsWith("@") ? o : r.length ? r : o), a = "";
|
|
935
960
|
} else i === "}" ? (s.pop(), a = "") : i === ";" ? a = "" : a += i;
|
|
936
961
|
return [...t];
|
|
937
962
|
}
|
|
938
|
-
function
|
|
963
|
+
function Tn(e) {
|
|
939
964
|
const l = /* @__PURE__ */ new Set();
|
|
940
965
|
for (const t of e.matchAll(/\bclass\s*=\s*"([^"]*)"/g)) {
|
|
941
966
|
const s = t[1].replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}|@\w+(\([^)]*\))?/g, " ");
|
|
@@ -944,7 +969,7 @@ function En(e) {
|
|
|
944
969
|
}
|
|
945
970
|
return [...l];
|
|
946
971
|
}
|
|
947
|
-
const
|
|
972
|
+
const Cn = [
|
|
948
973
|
{ key: "id", value: '""', info: "The variable the template gets, in snake_case." },
|
|
949
974
|
{ key: "type", value: '""', info: "A type from the registry." },
|
|
950
975
|
{ key: "label", value: '""', info: "What the editor sees above the field." },
|
|
@@ -956,32 +981,32 @@ const Tn = [
|
|
|
956
981
|
{ key: "slot", value: '""', info: "The parent's named slot to land in." },
|
|
957
982
|
{ key: "can", value: '""', info: "The permission the node needs." }
|
|
958
983
|
];
|
|
959
|
-
function
|
|
984
|
+
function Ln({ types: e }) {
|
|
960
985
|
return (l) => {
|
|
961
|
-
const t =
|
|
986
|
+
const t = An(l.state.doc.toString(), l.pos);
|
|
962
987
|
if (!t || !t.node) return null;
|
|
963
988
|
const s = t.string ? l.state.sliceDoc(t.string, l.pos) : /[\w-]*$/.exec(l.state.sliceDoc(Math.max(0, l.pos - 60), l.pos))[0];
|
|
964
989
|
if (!t.string && s === "" && !l.explicit) return null;
|
|
965
990
|
const a = l.pos - s.length, i = t.string !== null;
|
|
966
991
|
if (t.phase === "key") {
|
|
967
|
-
const o =
|
|
968
|
-
({ key: r, value:
|
|
992
|
+
const o = Cn.filter(({ key: r }) => !t.keys.has(r) || r === s).map(
|
|
993
|
+
({ key: r, value: c, info: u }, p) => ({
|
|
969
994
|
label: r,
|
|
970
995
|
info: u,
|
|
971
996
|
type: "property",
|
|
972
997
|
boost: -p,
|
|
973
|
-
apply: (f, v, g, x) => Et(f, v, g, x, i, `"${r}": ${
|
|
998
|
+
apply: (f, v, g, x) => Et(f, v, g, x, i, `"${r}": ${c}`, c)
|
|
974
999
|
})
|
|
975
1000
|
);
|
|
976
1001
|
return { from: a, options: o, validFor: /^[\w-]*$/ };
|
|
977
1002
|
}
|
|
978
1003
|
if (t.phase === "value" && t.key === "type") {
|
|
979
|
-
const o = Object.entries(e()).map(([r,
|
|
1004
|
+
const o = Object.entries(e()).map(([r, c]) => ({
|
|
980
1005
|
label: r,
|
|
981
|
-
detail:
|
|
1006
|
+
detail: c.kind,
|
|
982
1007
|
type: "type",
|
|
983
1008
|
// Fields first: a block's schema is mostly fields, the layout only groups them.
|
|
984
|
-
boost:
|
|
1009
|
+
boost: c.kind === "field" ? 1 : 0,
|
|
985
1010
|
apply: (u, p, f, v) => Et(u, p, f, v, i, `"${r}"`, "")
|
|
986
1011
|
}));
|
|
987
1012
|
return { from: a, options: o, validFor: /^[\w-]*$/ };
|
|
@@ -990,7 +1015,7 @@ function Cn({ types: e }) {
|
|
|
990
1015
|
};
|
|
991
1016
|
}
|
|
992
1017
|
function Et(e, l, t, s, a, i, o) {
|
|
993
|
-
const r = a ? t - 1 : t,
|
|
1018
|
+
const r = a ? t - 1 : t, c = /^[\w-]*"?/.exec(e.state.sliceDoc(s, s + 60))[0], u = s + (a ? c.length : /^[\w-]*/.exec(c)[0].length), p = o === '""' || o === "{}" || o === "[]" ? 1 : 0;
|
|
994
1019
|
e.dispatch({
|
|
995
1020
|
changes: { from: r, to: u, insert: i },
|
|
996
1021
|
selection: { anchor: r + i.length - p },
|
|
@@ -998,7 +1023,7 @@ function Et(e, l, t, s, a, i, o) {
|
|
|
998
1023
|
userEvent: "input.complete"
|
|
999
1024
|
}), i.startsWith('"type"') && Bl(e);
|
|
1000
1025
|
}
|
|
1001
|
-
function
|
|
1026
|
+
function An(e, l) {
|
|
1002
1027
|
let t = null, s = null, a = null, i = !1;
|
|
1003
1028
|
const o = (r) => r?.kind === "object" && r.parent?.kind === "array" && (r.parent.parent === null || r.parent.under === "children");
|
|
1004
1029
|
for (let r = 0; r <= e.length && (r === l && (s = t?.kind === "object" ? {
|
|
@@ -1008,23 +1033,23 @@ function Ln(e, l) {
|
|
|
1008
1033
|
keys: t.keys,
|
|
1009
1034
|
string: a ? a.start + 1 : null
|
|
1010
1035
|
} : null), r !== e.length); r++) {
|
|
1011
|
-
const
|
|
1036
|
+
const c = e[r];
|
|
1012
1037
|
if (a) {
|
|
1013
1038
|
if (i) i = !1;
|
|
1014
|
-
else if (
|
|
1015
|
-
else if (
|
|
1039
|
+
else if (c === "\\") i = !0;
|
|
1040
|
+
else if (c === '"' || c === `
|
|
1016
1041
|
`) {
|
|
1017
1042
|
const u = e.slice(a.start + 1, r);
|
|
1018
1043
|
t?.kind === "object" && (a.key ? (t.keys.add(u), t.key = u, t.phase = "colon") : t.phase === "value" && (t.phase = "after")), a = null;
|
|
1019
1044
|
}
|
|
1020
1045
|
continue;
|
|
1021
1046
|
}
|
|
1022
|
-
if (!/\s/.test(
|
|
1023
|
-
if (
|
|
1047
|
+
if (!/\s/.test(c))
|
|
1048
|
+
if (c === '"')
|
|
1024
1049
|
a = { start: r, key: t?.kind === "object" && t.phase === "key" };
|
|
1025
|
-
else if (
|
|
1050
|
+
else if (c === "{" || c === "[") {
|
|
1026
1051
|
const u = {
|
|
1027
|
-
kind:
|
|
1052
|
+
kind: c === "{" ? "object" : "array",
|
|
1028
1053
|
parent: t,
|
|
1029
1054
|
under: t?.kind === "object" ? t.key : null,
|
|
1030
1055
|
keys: /* @__PURE__ */ new Set(),
|
|
@@ -1032,28 +1057,28 @@ function Ln(e, l) {
|
|
|
1032
1057
|
key: null
|
|
1033
1058
|
};
|
|
1034
1059
|
t?.kind === "object" && (t.phase = "after"), t = u;
|
|
1035
|
-
} else
|
|
1060
|
+
} else c === "}" || c === "]" ? t = t?.parent ?? null : c === ":" ? t?.kind === "object" && (t.phase = "value") : c === "," && t?.kind === "object" && (t.phase = "key", t.key = null);
|
|
1036
1061
|
}
|
|
1037
1062
|
return s;
|
|
1038
1063
|
}
|
|
1039
1064
|
function We(e) {
|
|
1040
1065
|
const l = [];
|
|
1041
1066
|
for (const t of e)
|
|
1042
|
-
!t || typeof t != "object" || (
|
|
1067
|
+
!t || typeof t != "object" || (Vn.has(t.type) ? l.push(...We(t.children ?? [])) : typeof t.id == "string" && t.id !== "" && l.push(t));
|
|
1043
1068
|
return l;
|
|
1044
1069
|
}
|
|
1045
1070
|
function el(e) {
|
|
1046
1071
|
return We(e).filter((l) => l.type !== "wx-blocks");
|
|
1047
1072
|
}
|
|
1048
|
-
const
|
|
1049
|
-
function
|
|
1073
|
+
const Vn = /* @__PURE__ */ new Set(["wx-card", "wx-tabs", "wx-tab", "wx-row", "wx-col", "wx-divider"]);
|
|
1074
|
+
function Bn(e) {
|
|
1050
1075
|
return e.replace(/[.*+?^${}()|[\]\\!]/g, "\\$&");
|
|
1051
1076
|
}
|
|
1052
|
-
const
|
|
1053
|
-
function
|
|
1077
|
+
const Wn = ["block", "entity", "loop", "__env", "errors", "app"];
|
|
1078
|
+
function Mn(e, l, t) {
|
|
1054
1079
|
const s = [];
|
|
1055
1080
|
/data-wx-block\s*=/.test(l.template) || s.push({ file: "template", code: "no-marker", line: null, message: t("checks.no-marker") });
|
|
1056
|
-
const a =
|
|
1081
|
+
const a = Nn(l.template, l.schema);
|
|
1057
1082
|
a.length > 0 && s.push({
|
|
1058
1083
|
file: "template",
|
|
1059
1084
|
code: "variables-missing",
|
|
@@ -1063,7 +1088,7 @@ function Wn(e, l, t) {
|
|
|
1063
1088
|
})
|
|
1064
1089
|
});
|
|
1065
1090
|
const i = [], o = [], r = `.b-${e}`;
|
|
1066
|
-
for (const [p, f] of
|
|
1091
|
+
for (const [p, f] of zn(l.styles))
|
|
1067
1092
|
p.startsWith(r) || p.startsWith("&") || (/^[a-z][a-z0-9-]*/i.test(p) ? o.push([p, f]) : i.push([p, f]));
|
|
1068
1093
|
i.length > 0 && s.push({
|
|
1069
1094
|
file: "styles",
|
|
@@ -1076,11 +1101,11 @@ function Wn(e, l, t) {
|
|
|
1076
1101
|
line: o[0][1],
|
|
1077
1102
|
message: t("checks.bare-selectors", { selectors: Tt(o) })
|
|
1078
1103
|
});
|
|
1079
|
-
const
|
|
1104
|
+
const c = ll(l.styles), u = /@media\b/.exec(c);
|
|
1080
1105
|
return u && s.push({
|
|
1081
1106
|
file: "styles",
|
|
1082
1107
|
code: "media-query",
|
|
1083
|
-
line: nl(
|
|
1108
|
+
line: nl(c, u.index),
|
|
1084
1109
|
message: t("checks.media-query")
|
|
1085
1110
|
}), s;
|
|
1086
1111
|
}
|
|
@@ -1090,8 +1115,8 @@ function tl(e) {
|
|
|
1090
1115
|
t.id && l.push(t.id), t.children && l.push(...tl(t.children));
|
|
1091
1116
|
return l;
|
|
1092
1117
|
}
|
|
1093
|
-
function
|
|
1094
|
-
const t = /* @__PURE__ */ new Set([...tl(l), ...
|
|
1118
|
+
function Nn(e, l) {
|
|
1119
|
+
const t = /* @__PURE__ */ new Set([...tl(l), ...Wn]);
|
|
1095
1120
|
for (const a of e.matchAll(/\bas\s+\$([a-zA-Z_]\w*)(?:\s*=>\s*\$([a-zA-Z_]\w*))?/g))
|
|
1096
1121
|
t.add(a[1]), a[2] && t.add(a[2]);
|
|
1097
1122
|
for (const a of e.matchAll(/\$([a-zA-Z_]\w*)\s*(?:=[^=]|\+\+|--|\.=|\+=|-=)/g))
|
|
@@ -1103,7 +1128,7 @@ function Mn(e, l) {
|
|
|
1103
1128
|
}
|
|
1104
1129
|
return s;
|
|
1105
1130
|
}
|
|
1106
|
-
function
|
|
1131
|
+
function zn(e) {
|
|
1107
1132
|
const l = ll(e), t = [];
|
|
1108
1133
|
for (const s of l.matchAll(/([^{};]+)\{/g)) {
|
|
1109
1134
|
const a = s[1], i = a.trim();
|
|
@@ -1140,24 +1165,24 @@ function Ne(e, l) {
|
|
|
1140
1165
|
const t = `groups.${e}`, s = l(t);
|
|
1141
1166
|
return s === t || s === `webx-blocks::${t}` ? e.charAt(0).toUpperCase() + e.slice(1) : s;
|
|
1142
1167
|
}
|
|
1143
|
-
const
|
|
1168
|
+
const Dn = { class: "wx-block-editor" }, In = { class: "wx-block-editor__split" }, On = {
|
|
1144
1169
|
type: "button",
|
|
1145
1170
|
class: "wx-block-editor__uses"
|
|
1146
|
-
},
|
|
1171
|
+
}, Pn = { class: "wx-block-editor__usage" }, Un = { class: "wx-block-editor__pane" }, Rn = {
|
|
1147
1172
|
key: 0,
|
|
1148
1173
|
class: "wx-block-editor__pills"
|
|
1149
|
-
},
|
|
1174
|
+
}, jn = ["disabled", "onClick", "textContent"], Fn = { class: "wx-block-editor__pane" }, Hn = { class: "wx-block-editor__pane" }, qn = { class: "wx-block-editor__note" }, Kn = { class: "wx-block-editor__split" }, Yn = { class: "wx-block-editor__pane" }, Jn = { class: "wx-block-editor__note" }, Gn = { class: "wx-block-editor__settings" }, Zn = {
|
|
1150
1175
|
key: 0,
|
|
1151
1176
|
class: "is-wide wx-block-editor__danger"
|
|
1152
|
-
},
|
|
1177
|
+
}, Qn = /* @__PURE__ */ ae({
|
|
1153
1178
|
__name: "BlockEditorPage",
|
|
1154
1179
|
props: {
|
|
1155
1180
|
base: { default: "/blocks" }
|
|
1156
1181
|
},
|
|
1157
1182
|
setup(e) {
|
|
1158
1183
|
const l = e, t = je(), s = Me(t), a = vl(), i = Wt();
|
|
1159
|
-
|
|
1160
|
-
const o = de("webx-blocks"), r = Fe(),
|
|
1184
|
+
qe();
|
|
1185
|
+
const o = de("webx-blocks"), r = Fe(), c = L(() => Number(a.params.id)), u = I(null), p = I([]), f = I(!0), v = I(!1), g = I(!1), x = I("template"), T = L(() => {
|
|
1161
1186
|
const B = t.state.manifest?.modules.find((k) => k.id === "blocks")?.meta;
|
|
1162
1187
|
return {
|
|
1163
1188
|
groups: B?.groups ?? [],
|
|
@@ -1181,24 +1206,24 @@ const zn = { class: "wx-block-editor" }, Dn = { class: "wx-block-editor__split"
|
|
|
1181
1206
|
styles: "",
|
|
1182
1207
|
script: null,
|
|
1183
1208
|
sample: {}
|
|
1184
|
-
}), R = I("[]"),
|
|
1209
|
+
}), R = I("[]"), K = I(null), Y = I(""), X = I({}), h = I(null), V = st({
|
|
1185
1210
|
html: "",
|
|
1186
1211
|
styles: "",
|
|
1187
1212
|
script: null,
|
|
1188
1213
|
runtime: null,
|
|
1189
1214
|
stage: null,
|
|
1190
1215
|
loading: !1
|
|
1191
|
-
}), O = L(() => JSON.stringify({ settings: y, content: _ })), J = L(() =>
|
|
1216
|
+
}), O = L(() => JSON.stringify({ settings: y, content: _ })), J = L(() => Y.value !== "" && O.value !== Y.value), Se = L(() => Mn(y.slug, _, o)), ne = {
|
|
1192
1217
|
template: [
|
|
1193
1218
|
at(
|
|
1194
|
-
|
|
1219
|
+
gn({ schema: () => _.schema, styles: () => _.styles })
|
|
1195
1220
|
)
|
|
1196
1221
|
],
|
|
1197
1222
|
styles: [
|
|
1198
|
-
at(
|
|
1223
|
+
at(En({ slug: () => y.slug, template: () => _.template }))
|
|
1199
1224
|
],
|
|
1200
1225
|
// The renderer's own types under the panel's, the same merge the sample form is drawn with.
|
|
1201
|
-
schema: [at(
|
|
1226
|
+
schema: [at(Ln({ types: () => ({ ...Je, ...t.types }) }))]
|
|
1202
1227
|
}, pe = L(() => {
|
|
1203
1228
|
const B = [...T.value.groups];
|
|
1204
1229
|
return B.includes(y.group) || B.push(y.group), B.map((k) => ({ value: k, label: Ne(k, o) }));
|
|
@@ -1234,12 +1259,12 @@ const zn = { class: "wx-block-editor" }, Dn = { class: "wx-block-editor__split"
|
|
|
1234
1259
|
script: null,
|
|
1235
1260
|
sample: {}
|
|
1236
1261
|
};
|
|
1237
|
-
Object.assign(_, be(k)), R.value = JSON.stringify(k.schema, null, 2),
|
|
1262
|
+
Object.assign(_, be(k)), R.value = JSON.stringify(k.schema, null, 2), K.value = null, Y.value = O.value;
|
|
1238
1263
|
}
|
|
1239
1264
|
async function ke() {
|
|
1240
1265
|
f.value = !0;
|
|
1241
1266
|
try {
|
|
1242
|
-
Q(await s.get(
|
|
1267
|
+
Q(await s.get(c.value)), p.value = await s.usage(c.value);
|
|
1243
1268
|
} catch (B) {
|
|
1244
1269
|
Z.danger(r(B));
|
|
1245
1270
|
} finally {
|
|
@@ -1251,9 +1276,9 @@ const zn = { class: "wx-block-editor" }, Dn = { class: "wx-block-editor__split"
|
|
|
1251
1276
|
try {
|
|
1252
1277
|
const k = JSON.parse(B);
|
|
1253
1278
|
if (!Array.isArray(k)) throw new Error("not a list");
|
|
1254
|
-
_.schema = k,
|
|
1279
|
+
_.schema = k, K.value = null;
|
|
1255
1280
|
} catch (k) {
|
|
1256
|
-
|
|
1281
|
+
K.value = o("page.schema-invalid", { error: k.message });
|
|
1257
1282
|
}
|
|
1258
1283
|
}
|
|
1259
1284
|
let ge, W = 0;
|
|
@@ -1312,7 +1337,7 @@ const zn = { class: "wx-block-editor" }, Dn = { class: "wx-block-editor__split"
|
|
|
1312
1337
|
allowed_in: y.allowed_in.length ? y.allowed_in : null,
|
|
1313
1338
|
description: y.description || null,
|
|
1314
1339
|
icon: y.icon || null,
|
|
1315
|
-
content:
|
|
1340
|
+
content: K.value ? { ..._, schema: void 0 } : _
|
|
1316
1341
|
});
|
|
1317
1342
|
Q(k), Z.success(
|
|
1318
1343
|
k.draft && k.draft.number !== B ? o("page.saved", { number: k.draft.number }) : o("page.unchanged")
|
|
@@ -1398,7 +1423,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1398
1423
|
ke(), window.addEventListener("beforeunload", ee);
|
|
1399
1424
|
}), Xe(() => {
|
|
1400
1425
|
clearTimeout(ge), window.removeEventListener("beforeunload", ee);
|
|
1401
|
-
}), te(
|
|
1426
|
+
}), te(c, () => {
|
|
1402
1427
|
ke();
|
|
1403
1428
|
});
|
|
1404
1429
|
const lt = L(
|
|
@@ -1418,14 +1443,14 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1418
1443
|
}
|
|
1419
1444
|
] : []
|
|
1420
1445
|
);
|
|
1421
|
-
return (B, k) => (
|
|
1422
|
-
f.value || !u.value ? (
|
|
1446
|
+
return (B, k) => (d(), C("div", Dn, [
|
|
1447
|
+
f.value || !u.value ? (d(), C(F, { key: 0 }, [
|
|
1423
1448
|
m(n(Be), {
|
|
1424
1449
|
class: "wx-block-editor__ghost-head",
|
|
1425
1450
|
title: "",
|
|
1426
1451
|
rows: 1
|
|
1427
1452
|
}),
|
|
1428
|
-
A("div",
|
|
1453
|
+
A("div", In, [
|
|
1429
1454
|
m(n(Ae), null, {
|
|
1430
1455
|
default: b(() => [
|
|
1431
1456
|
m(n(Be), { rows: 8 })
|
|
@@ -1439,7 +1464,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1439
1464
|
_: 1
|
|
1440
1465
|
})
|
|
1441
1466
|
])
|
|
1442
|
-
], 64)) : (
|
|
1467
|
+
], 64)) : (d(), C(F, { key: 1 }, [
|
|
1443
1468
|
m(n(bl), {
|
|
1444
1469
|
title: y.title,
|
|
1445
1470
|
back: e.base,
|
|
@@ -1447,13 +1472,13 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1447
1472
|
actions: lt.value
|
|
1448
1473
|
}, {
|
|
1449
1474
|
"title-after": b(() => [
|
|
1450
|
-
w.value ? (
|
|
1475
|
+
w.value ? (d(), z(n(gl), {
|
|
1451
1476
|
key: 0,
|
|
1452
1477
|
name: y.title,
|
|
1453
1478
|
placeholder: n(o)("page.title"),
|
|
1454
1479
|
onRename: k[0] || (k[0] = (E) => y.title = E)
|
|
1455
1480
|
}, null, 8, ["name", "placeholder"])) : D("", !0),
|
|
1456
|
-
J.value ? (
|
|
1481
|
+
J.value ? (d(), z(n(ue), {
|
|
1457
1482
|
key: 1,
|
|
1458
1483
|
type: "primary",
|
|
1459
1484
|
dot: ""
|
|
@@ -1463,7 +1488,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1463
1488
|
]),
|
|
1464
1489
|
_: 1
|
|
1465
1490
|
})) : D("", !0),
|
|
1466
|
-
u.value.draft ? (
|
|
1491
|
+
u.value.draft ? (d(), z(n(ue), {
|
|
1467
1492
|
key: 2,
|
|
1468
1493
|
type: "warning",
|
|
1469
1494
|
dot: ""
|
|
@@ -1473,7 +1498,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1473
1498
|
]),
|
|
1474
1499
|
_: 1
|
|
1475
1500
|
})) : D("", !0),
|
|
1476
|
-
u.value.published ? (
|
|
1501
|
+
u.value.published ? (d(), z(n(ue), {
|
|
1477
1502
|
key: 3,
|
|
1478
1503
|
type: "success",
|
|
1479
1504
|
dot: ""
|
|
@@ -1482,7 +1507,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1482
1507
|
M(S(n(o)("page.live", { number: u.value.published.number })), 1)
|
|
1483
1508
|
]),
|
|
1484
1509
|
_: 1
|
|
1485
|
-
})) : (
|
|
1510
|
+
})) : (d(), z(n(ue), {
|
|
1486
1511
|
key: 4,
|
|
1487
1512
|
type: "default"
|
|
1488
1513
|
}, {
|
|
@@ -1495,23 +1520,23 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1495
1520
|
subtitle: b(() => [
|
|
1496
1521
|
A("code", null, S(y.slug), 1),
|
|
1497
1522
|
M(" · " + S(n(Ne)(y.group, n(o))) + " · ", 1),
|
|
1498
|
-
u.value.usage_count > 0 ? (
|
|
1523
|
+
u.value.usage_count > 0 ? (d(), z(n(_l), {
|
|
1499
1524
|
key: 0,
|
|
1500
1525
|
title: n(o)("page.usage"),
|
|
1501
1526
|
width: 260,
|
|
1502
1527
|
align: "start"
|
|
1503
1528
|
}, {
|
|
1504
1529
|
trigger: b(() => [
|
|
1505
|
-
A("button",
|
|
1530
|
+
A("button", On, S(n(ct)(u.value.usage_count, n(o))), 1)
|
|
1506
1531
|
]),
|
|
1507
1532
|
default: b(() => [
|
|
1508
|
-
A("div",
|
|
1509
|
-
(
|
|
1533
|
+
A("div", Pn, [
|
|
1534
|
+
(d(!0), C(F, null, le(U.value, (E) => (d(), C("div", {
|
|
1510
1535
|
key: `${E.model}:${E.id}`,
|
|
1511
1536
|
class: "wx-block-editor__use"
|
|
1512
1537
|
}, [
|
|
1513
1538
|
A("span", null, S(E.title ?? `#${E.id}`), 1),
|
|
1514
|
-
E.published ? D("", !0) : (
|
|
1539
|
+
E.published ? D("", !0) : (d(), z(n(ue), {
|
|
1515
1540
|
key: 0,
|
|
1516
1541
|
type: "warning",
|
|
1517
1542
|
size: "sm"
|
|
@@ -1522,7 +1547,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1522
1547
|
_: 1
|
|
1523
1548
|
}))
|
|
1524
1549
|
]))), 128)),
|
|
1525
|
-
p.value.length > U.value.length ? (
|
|
1550
|
+
p.value.length > U.value.length ? (d(), z(n(q), {
|
|
1526
1551
|
key: 0,
|
|
1527
1552
|
size: "sm",
|
|
1528
1553
|
tone: "muted"
|
|
@@ -1535,13 +1560,13 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1535
1560
|
])
|
|
1536
1561
|
]),
|
|
1537
1562
|
_: 1
|
|
1538
|
-
}, 8, ["title"])) : (
|
|
1563
|
+
}, 8, ["title"])) : (d(), C(F, { key: 1 }, [
|
|
1539
1564
|
M(S(n(ct)(u.value.usage_count, n(o))), 1)
|
|
1540
1565
|
], 64))
|
|
1541
1566
|
]),
|
|
1542
1567
|
_: 1
|
|
1543
1568
|
}, 8, ["title", "back", "back-label", "actions"]),
|
|
1544
|
-
T.value.editing ? D("", !0) : (
|
|
1569
|
+
T.value.editing ? D("", !0) : (d(), z(n(zt), {
|
|
1545
1570
|
key: 0,
|
|
1546
1571
|
type: "info",
|
|
1547
1572
|
variant: "soft",
|
|
@@ -1561,8 +1586,8 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1561
1586
|
label: n(o)("page.tab-template")
|
|
1562
1587
|
}, {
|
|
1563
1588
|
default: b(() => [
|
|
1564
|
-
A("div",
|
|
1565
|
-
m(n(
|
|
1589
|
+
A("div", Un, [
|
|
1590
|
+
m(n(Ke), {
|
|
1566
1591
|
ref_key: "templateEditor",
|
|
1567
1592
|
ref: G,
|
|
1568
1593
|
modelValue: _.template,
|
|
@@ -1574,8 +1599,8 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1574
1599
|
"max-height": "70vh",
|
|
1575
1600
|
"line-wrapping": ""
|
|
1576
1601
|
}, null, 8, ["modelValue", "extensions", "readonly"]),
|
|
1577
|
-
Ee.value.length ? (
|
|
1578
|
-
m(n(
|
|
1602
|
+
Ee.value.length ? (d(), C("div", Rn, [
|
|
1603
|
+
m(n(q), {
|
|
1579
1604
|
size: "sm",
|
|
1580
1605
|
tone: "muted"
|
|
1581
1606
|
}, {
|
|
@@ -1584,14 +1609,14 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1584
1609
|
]),
|
|
1585
1610
|
_: 1
|
|
1586
1611
|
}),
|
|
1587
|
-
(
|
|
1612
|
+
(d(!0), C(F, null, le(Ee.value, (E) => (d(), C("button", {
|
|
1588
1613
|
key: E,
|
|
1589
1614
|
type: "button",
|
|
1590
1615
|
class: "wx-block-editor__pill",
|
|
1591
1616
|
disabled: !w.value,
|
|
1592
1617
|
onClick: (nt) => we(E),
|
|
1593
1618
|
textContent: S(fe(E))
|
|
1594
|
-
}, null, 8,
|
|
1619
|
+
}, null, 8, jn))), 128))
|
|
1595
1620
|
])) : D("", !0),
|
|
1596
1621
|
m(kt, {
|
|
1597
1622
|
file: "template",
|
|
@@ -1608,8 +1633,8 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1608
1633
|
label: n(o)("page.tab-styles")
|
|
1609
1634
|
}, {
|
|
1610
1635
|
default: b(() => [
|
|
1611
|
-
A("div",
|
|
1612
|
-
m(n(
|
|
1636
|
+
A("div", Fn, [
|
|
1637
|
+
m(n(Ke), {
|
|
1613
1638
|
modelValue: _.styles,
|
|
1614
1639
|
"onUpdate:modelValue": k[2] || (k[2] = (E) => _.styles = E),
|
|
1615
1640
|
language: "css",
|
|
@@ -1632,8 +1657,8 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1632
1657
|
label: n(o)("page.tab-script")
|
|
1633
1658
|
}, {
|
|
1634
1659
|
default: b(() => [
|
|
1635
|
-
A("div",
|
|
1636
|
-
m(n(
|
|
1660
|
+
A("div", Hn, [
|
|
1661
|
+
m(n(Ke), {
|
|
1637
1662
|
"model-value": _.script ?? "",
|
|
1638
1663
|
language: "javascript",
|
|
1639
1664
|
readonly: !w.value,
|
|
@@ -1641,8 +1666,8 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1641
1666
|
"max-height": "70vh",
|
|
1642
1667
|
"onUpdate:modelValue": k[3] || (k[3] = (E) => _.script = E || null)
|
|
1643
1668
|
}, null, 8, ["model-value", "readonly"]),
|
|
1644
|
-
A("div",
|
|
1645
|
-
m(n(
|
|
1669
|
+
A("div", qn, [
|
|
1670
|
+
m(n(q), {
|
|
1646
1671
|
size: "sm",
|
|
1647
1672
|
tone: "muted"
|
|
1648
1673
|
}, {
|
|
@@ -1651,7 +1676,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1651
1676
|
]),
|
|
1652
1677
|
_: 1
|
|
1653
1678
|
}),
|
|
1654
|
-
m(n(
|
|
1679
|
+
m(n(q), {
|
|
1655
1680
|
size: "sm",
|
|
1656
1681
|
tone: "muted"
|
|
1657
1682
|
}, {
|
|
@@ -1667,11 +1692,11 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1667
1692
|
title: n(o)("page.examples")
|
|
1668
1693
|
}, {
|
|
1669
1694
|
default: b(() => [
|
|
1670
|
-
(
|
|
1695
|
+
(d(!0), C(F, null, le(N.value, (E) => (d(), C("div", {
|
|
1671
1696
|
key: E.title,
|
|
1672
1697
|
class: "wx-block-editor__example"
|
|
1673
1698
|
}, [
|
|
1674
|
-
m(n(
|
|
1699
|
+
m(n(q), {
|
|
1675
1700
|
size: "sm",
|
|
1676
1701
|
tone: "muted"
|
|
1677
1702
|
}, {
|
|
@@ -1697,7 +1722,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1697
1722
|
default: b(() => [
|
|
1698
1723
|
A("div", Kn, [
|
|
1699
1724
|
A("div", Yn, [
|
|
1700
|
-
m(n(
|
|
1725
|
+
m(n(Ke), {
|
|
1701
1726
|
"model-value": R.value,
|
|
1702
1727
|
language: "json",
|
|
1703
1728
|
extensions: ne.schema,
|
|
@@ -1707,17 +1732,17 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1707
1732
|
"max-height": "70vh",
|
|
1708
1733
|
"onUpdate:modelValue": Ce
|
|
1709
1734
|
}, null, 8, ["model-value", "extensions", "readonly"]),
|
|
1710
|
-
A("div",
|
|
1711
|
-
|
|
1735
|
+
A("div", Jn, [
|
|
1736
|
+
K.value ? (d(), z(n(q), {
|
|
1712
1737
|
key: 0,
|
|
1713
1738
|
size: "sm",
|
|
1714
1739
|
tone: "danger"
|
|
1715
1740
|
}, {
|
|
1716
1741
|
default: b(() => [
|
|
1717
|
-
M(S(
|
|
1742
|
+
M(S(K.value), 1)
|
|
1718
1743
|
]),
|
|
1719
1744
|
_: 1
|
|
1720
|
-
})) : H("content.schema") ? (
|
|
1745
|
+
})) : H("content.schema") ? (d(), z(n(q), {
|
|
1721
1746
|
key: 1,
|
|
1722
1747
|
size: "sm",
|
|
1723
1748
|
tone: "danger"
|
|
@@ -1726,7 +1751,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1726
1751
|
M(S(H("content.schema")), 1)
|
|
1727
1752
|
]),
|
|
1728
1753
|
_: 1
|
|
1729
|
-
})) : (
|
|
1754
|
+
})) : (d(), z(n(q), {
|
|
1730
1755
|
key: 2,
|
|
1731
1756
|
size: "sm",
|
|
1732
1757
|
tone: "muted"
|
|
@@ -1747,7 +1772,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1747
1772
|
title: n(o)("page.sample")
|
|
1748
1773
|
}, {
|
|
1749
1774
|
default: b(() => [
|
|
1750
|
-
_.schema.length ? (
|
|
1775
|
+
_.schema.length ? (d(), z(n(Rt), {
|
|
1751
1776
|
key: 0,
|
|
1752
1777
|
modelValue: ye.value,
|
|
1753
1778
|
"onUpdate:modelValue": k[4] || (k[4] = (E) => ye.value = E),
|
|
@@ -1772,7 +1797,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1772
1797
|
default: b(() => [
|
|
1773
1798
|
m(n(Ae), { class: "wx-block-editor__sheet" }, {
|
|
1774
1799
|
default: b(() => [
|
|
1775
|
-
A("div",
|
|
1800
|
+
A("div", Gn, [
|
|
1776
1801
|
m(n(oe), {
|
|
1777
1802
|
label: n(o)("page.identifier"),
|
|
1778
1803
|
help: n(o)("page.identifier-help"),
|
|
@@ -1909,7 +1934,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1909
1934
|
]),
|
|
1910
1935
|
_: 1
|
|
1911
1936
|
}, 8, ["label", "help", "disabled"]),
|
|
1912
|
-
w.value ? (
|
|
1937
|
+
w.value ? (d(), C("div", Zn, [
|
|
1913
1938
|
m(n(ce), {
|
|
1914
1939
|
type: "danger",
|
|
1915
1940
|
variant: "outline",
|
|
@@ -1921,7 +1946,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1921
1946
|
]),
|
|
1922
1947
|
_: 1
|
|
1923
1948
|
}, 8, ["disabled"]),
|
|
1924
|
-
u.value.usage_count > 0 ? (
|
|
1949
|
+
u.value.usage_count > 0 ? (d(), z(n(q), {
|
|
1925
1950
|
key: 0,
|
|
1926
1951
|
size: "sm",
|
|
1927
1952
|
tone: "muted"
|
|
@@ -1975,7 +2000,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1975
2000
|
[il, $.value]
|
|
1976
2001
|
])
|
|
1977
2002
|
], 2),
|
|
1978
|
-
w.value ? (
|
|
2003
|
+
w.value ? (d(), z(n(Tl), { key: 1 }, {
|
|
1979
2004
|
default: b(() => [
|
|
1980
2005
|
m(n(ce), {
|
|
1981
2006
|
variant: "outline",
|
|
@@ -2004,27 +2029,27 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2004
2029
|
], 64))
|
|
2005
2030
|
]));
|
|
2006
2031
|
}
|
|
2007
|
-
}),
|
|
2008
|
-
function
|
|
2032
|
+
}), Xn = /* @__PURE__ */ ie(Qn, [["__scopeId", "data-v-22e5f784"]]), Ct = /* @__PURE__ */ new Map();
|
|
2033
|
+
function es(e) {
|
|
2009
2034
|
let l = Ct.get(e);
|
|
2010
|
-
return l === void 0 && (l = fetch(e, { credentials: "same-origin", headers: { Accept: "text/html" } }).then((t) => t.ok ? t.text() : null).then((t) => t === null ? null :
|
|
2035
|
+
return l === void 0 && (l = fetch(e, { credentials: "same-origin", headers: { Accept: "text/html" } }).then((t) => t.ok ? t.text() : null).then((t) => t === null ? null : ql(t, e)).catch(() => null), Ct.set(e, l)), l;
|
|
2011
2036
|
}
|
|
2012
|
-
function
|
|
2037
|
+
function ts() {
|
|
2013
2038
|
const e = De(Mt, null), l = I(null), t = L(() => {
|
|
2014
2039
|
const a = e?.state.manifest?.modules.find((i) => i.id === "blocks")?.meta?.stage;
|
|
2015
2040
|
return typeof a == "string" && a !== "" ? a : null;
|
|
2016
2041
|
});
|
|
2017
2042
|
return rl(() => {
|
|
2018
2043
|
const s = t.value;
|
|
2019
|
-
s !== null &&
|
|
2044
|
+
s !== null && es(s).then((a) => {
|
|
2020
2045
|
t.value === s && (l.value = a);
|
|
2021
2046
|
});
|
|
2022
2047
|
}), l;
|
|
2023
2048
|
}
|
|
2024
|
-
const
|
|
2049
|
+
const ls = ["srcdoc"], ns = {
|
|
2025
2050
|
key: 1,
|
|
2026
2051
|
class: "wx-block-thumb__empty"
|
|
2027
|
-
},
|
|
2052
|
+
}, ss = /* @__PURE__ */ ae({
|
|
2028
2053
|
__name: "BlockThumb",
|
|
2029
2054
|
props: {
|
|
2030
2055
|
thumbnail: {},
|
|
@@ -2032,22 +2057,22 @@ const ts = ["srcdoc"], ls = {
|
|
|
2032
2057
|
height: { default: 120 }
|
|
2033
2058
|
},
|
|
2034
2059
|
setup(e) {
|
|
2035
|
-
const l = e, t = I(null), s = et(t), a = L(() => s.value > 0 ? s.value / l.width : 0.2), i =
|
|
2060
|
+
const l = e, t = I(null), s = et(t), a = L(() => s.value > 0 ? s.value / l.width : 0.2), i = ts(), o = L(() => {
|
|
2036
2061
|
if (!l.thumbnail) return "";
|
|
2037
|
-
const
|
|
2038
|
-
return i.value ?
|
|
2062
|
+
const c = { html: l.thumbnail.html, styles: l.thumbnail.styles };
|
|
2063
|
+
return i.value ? Kl(i.value, c) : Ht(c);
|
|
2039
2064
|
}), r = L(() => ({
|
|
2040
2065
|
width: `${l.width}px`,
|
|
2041
2066
|
height: `${Math.round(l.height / a.value)}px`,
|
|
2042
2067
|
transform: `scale(${a.value})`
|
|
2043
2068
|
}));
|
|
2044
|
-
return (
|
|
2069
|
+
return (c, u) => (d(), C("div", {
|
|
2045
2070
|
ref_key: "box",
|
|
2046
2071
|
ref: t,
|
|
2047
2072
|
class: "wx-block-thumb",
|
|
2048
2073
|
style: xe({ height: `${e.height}px` })
|
|
2049
2074
|
}, [
|
|
2050
|
-
e.thumbnail ? (
|
|
2075
|
+
e.thumbnail ? (d(), C("iframe", {
|
|
2051
2076
|
key: 0,
|
|
2052
2077
|
class: "wx-block-thumb__frame",
|
|
2053
2078
|
srcdoc: o.value,
|
|
@@ -2055,15 +2080,15 @@ const ts = ["srcdoc"], ls = {
|
|
|
2055
2080
|
sandbox: "allow-same-origin",
|
|
2056
2081
|
tabindex: "-1",
|
|
2057
2082
|
"aria-hidden": "true"
|
|
2058
|
-
}, null, 12,
|
|
2083
|
+
}, null, 12, ls)) : (d(), C("div", ns, [
|
|
2059
2084
|
m(n(he), { name: "grid" })
|
|
2060
2085
|
]))
|
|
2061
2086
|
], 4));
|
|
2062
2087
|
}
|
|
2063
|
-
}), sl = /* @__PURE__ */ ie(
|
|
2088
|
+
}), sl = /* @__PURE__ */ ie(ss, [["__scopeId", "data-v-5ca74656"]]), os = { class: "wx-block-picker" }, as = {
|
|
2064
2089
|
key: 0,
|
|
2065
2090
|
class: "wx-block-picker__group-title"
|
|
2066
|
-
},
|
|
2091
|
+
}, is = { class: "wx-block-picker__cards" }, rs = ["disabled", "title", "onClick"], us = { class: "wx-block-picker__body" }, cs = { class: "wx-block-picker__title" }, ds = /* @__PURE__ */ ae({
|
|
2067
2092
|
__name: "BlockPicker",
|
|
2068
2093
|
props: {
|
|
2069
2094
|
catalog: {},
|
|
@@ -2075,7 +2100,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2075
2100
|
},
|
|
2076
2101
|
setup(e) {
|
|
2077
2102
|
const l = e, { resolve: t, dismiss: s, open: a } = It();
|
|
2078
|
-
|
|
2103
|
+
qe();
|
|
2079
2104
|
const i = de("webx-blocks"), o = I("");
|
|
2080
2105
|
function r(v) {
|
|
2081
2106
|
if (l.parent === null)
|
|
@@ -2083,14 +2108,14 @@ const ts = ["srcdoc"], ls = {
|
|
|
2083
2108
|
const g = l.allow ? l.allow.includes(v.slug) : l.parent.allow?.includes(v.slug) === !0, x = v.allowed_in === null || v.allowed_in.includes(l.parent.slug);
|
|
2084
2109
|
return g && x;
|
|
2085
2110
|
}
|
|
2086
|
-
const
|
|
2111
|
+
const c = L(
|
|
2087
2112
|
() => l.catalog.filter((v) => v.is_enabled && v.published !== null && r(v)).map((v) => {
|
|
2088
2113
|
const g = tn(l.tree, v.slug), x = v.max_per_entity !== null && g >= v.max_per_entity;
|
|
2089
2114
|
return { type: v, reason: x ? i("field.limit-reached", { count: g }) : null };
|
|
2090
2115
|
})
|
|
2091
2116
|
), u = L(() => {
|
|
2092
2117
|
const v = o.value.trim().toLowerCase();
|
|
2093
|
-
return v === "" ?
|
|
2118
|
+
return v === "" ? c.value : c.value.filter(
|
|
2094
2119
|
({ type: g }) => g.title.toLowerCase().includes(v) || g.slug.includes(v) || (g.description ?? "").toLowerCase().includes(v)
|
|
2095
2120
|
);
|
|
2096
2121
|
}), p = L(() => {
|
|
@@ -2105,7 +2130,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2105
2130
|
return u.value.length <= 5 || o.value.trim() !== "" || g.length < 2 ? [{ id: "", label: "", options: u.value }] : g;
|
|
2106
2131
|
}), f = L(() => {
|
|
2107
2132
|
if (l.catalog.length === 0) return i("field.pick-none");
|
|
2108
|
-
if (
|
|
2133
|
+
if (c.value.length === 0 && l.parent) {
|
|
2109
2134
|
const v = (l.allow ?? l.parent.allow ?? []).filter(
|
|
2110
2135
|
(g) => l.catalog.some((x) => x.slug === g)
|
|
2111
2136
|
);
|
|
@@ -2115,7 +2140,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2115
2140
|
});
|
|
2116
2141
|
return (v, g) => {
|
|
2117
2142
|
const x = At("router-link");
|
|
2118
|
-
return
|
|
2143
|
+
return d(), z(n(Ot), {
|
|
2119
2144
|
open: n(a),
|
|
2120
2145
|
"onUpdate:open": g[2] || (g[2] = (T) => Vt(a) ? a.value = T : null),
|
|
2121
2146
|
title: n(i)("field.pick"),
|
|
@@ -2133,8 +2158,8 @@ const ts = ["srcdoc"], ls = {
|
|
|
2133
2158
|
})
|
|
2134
2159
|
]),
|
|
2135
2160
|
default: b(() => [
|
|
2136
|
-
A("div",
|
|
2137
|
-
|
|
2161
|
+
A("div", os, [
|
|
2162
|
+
c.value.length > 0 ? (d(), z(n(Ue), {
|
|
2138
2163
|
key: 0,
|
|
2139
2164
|
modelValue: o.value,
|
|
2140
2165
|
"onUpdate:modelValue": g[0] || (g[0] = (T) => o.value = T),
|
|
@@ -2142,14 +2167,14 @@ const ts = ["srcdoc"], ls = {
|
|
|
2142
2167
|
clearable: "",
|
|
2143
2168
|
autofocus: ""
|
|
2144
2169
|
}, null, 8, ["modelValue", "placeholder"])) : D("", !0),
|
|
2145
|
-
u.value.length === 0 ? (
|
|
2170
|
+
u.value.length === 0 ? (d(), z(n(Pt), {
|
|
2146
2171
|
key: 1,
|
|
2147
2172
|
icon: "grid",
|
|
2148
2173
|
title: f.value,
|
|
2149
2174
|
size: "sm"
|
|
2150
2175
|
}, {
|
|
2151
2176
|
default: b(() => [
|
|
2152
|
-
e.catalog.length === 0 && e.blocksPath ? (
|
|
2177
|
+
e.catalog.length === 0 && e.blocksPath ? (d(), z(x, {
|
|
2153
2178
|
key: 0,
|
|
2154
2179
|
to: e.blocksPath
|
|
2155
2180
|
}, {
|
|
@@ -2161,13 +2186,13 @@ const ts = ["srcdoc"], ls = {
|
|
|
2161
2186
|
]),
|
|
2162
2187
|
_: 1
|
|
2163
2188
|
}, 8, ["title"])) : D("", !0),
|
|
2164
|
-
(
|
|
2189
|
+
(d(!0), C(F, null, le(p.value, (T) => (d(), C("section", {
|
|
2165
2190
|
key: T.id,
|
|
2166
2191
|
class: "wx-block-picker__group"
|
|
2167
2192
|
}, [
|
|
2168
|
-
T.label ? (
|
|
2169
|
-
A("div",
|
|
2170
|
-
(
|
|
2193
|
+
T.label ? (d(), C("div", as, S(T.label), 1)) : D("", !0),
|
|
2194
|
+
A("div", is, [
|
|
2195
|
+
(d(!0), C(F, null, le(T.options, (w) => (d(), C("button", {
|
|
2171
2196
|
key: w.type.id,
|
|
2172
2197
|
type: "button",
|
|
2173
2198
|
class: $e(["wx-block-picker__card", { "is-disabled": w.reason !== null }]),
|
|
@@ -2179,9 +2204,9 @@ const ts = ["srcdoc"], ls = {
|
|
|
2179
2204
|
thumbnail: w.type.thumbnail,
|
|
2180
2205
|
height: 96
|
|
2181
2206
|
}, null, 8, ["thumbnail"]),
|
|
2182
|
-
A("div",
|
|
2183
|
-
A("div",
|
|
2184
|
-
w.reason ? (
|
|
2207
|
+
A("div", us, [
|
|
2208
|
+
A("div", cs, S(w.type.title), 1),
|
|
2209
|
+
w.reason ? (d(), z(n(q), {
|
|
2185
2210
|
key: 0,
|
|
2186
2211
|
size: "sm",
|
|
2187
2212
|
tone: "warning"
|
|
@@ -2190,7 +2215,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2190
2215
|
M(S(w.reason), 1)
|
|
2191
2216
|
]),
|
|
2192
2217
|
_: 2
|
|
2193
|
-
}, 1024)) : w.type.description ? (
|
|
2218
|
+
}, 1024)) : w.type.description ? (d(), z(n(q), {
|
|
2194
2219
|
key: 1,
|
|
2195
2220
|
size: "sm",
|
|
2196
2221
|
tone: "muted"
|
|
@@ -2201,7 +2226,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2201
2226
|
_: 2
|
|
2202
2227
|
}, 1024)) : D("", !0)
|
|
2203
2228
|
])
|
|
2204
|
-
], 10,
|
|
2229
|
+
], 10, rs))), 128))
|
|
2205
2230
|
])
|
|
2206
2231
|
]))), 128))
|
|
2207
2232
|
])
|
|
@@ -2210,7 +2235,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2210
2235
|
}, 8, ["open", "title"]);
|
|
2211
2236
|
};
|
|
2212
2237
|
}
|
|
2213
|
-
}),
|
|
2238
|
+
}), ps = /* @__PURE__ */ ie(ds, [["__scopeId", "data-v-99f4090e"]]), fs = { class: "wx-blocks-preview__tools" }, ms = ["src", "title"], vs = /* @__PURE__ */ ae({
|
|
2214
2239
|
__name: "BlocksPreview",
|
|
2215
2240
|
props: {
|
|
2216
2241
|
url: {},
|
|
@@ -2220,7 +2245,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2220
2245
|
},
|
|
2221
2246
|
emits: ["select", "edit"],
|
|
2222
2247
|
setup(e, { expose: l, emit: t }) {
|
|
2223
|
-
const s = e, a = t, i = de("webx-blocks"), o = I(null), r = I(null),
|
|
2248
|
+
const s = e, a = t, i = de("webx-blocks"), o = I(null), r = I(null), c = I(null), u = et(c), p = I(!1), f = I(!1), v = I(null), g = I(0), x = L(() => g.value > 0), T = L(() => [
|
|
2224
2249
|
{ value: 1280, icon: "monitor", ariaLabel: i("field.width-desktop") },
|
|
2225
2250
|
{ value: 834, icon: "tablet", ariaLabel: i("field.width-tablet") },
|
|
2226
2251
|
{ value: 390, icon: "smartphone", ariaLabel: i("field.width-phone") }
|
|
@@ -2231,7 +2256,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2231
2256
|
})), R = L(() => ({
|
|
2232
2257
|
width: `${Math.round(w.value * y.value)}px`,
|
|
2233
2258
|
...x.value ? { height: `${Math.round(g.value * y.value)}px` } : {}
|
|
2234
|
-
})),
|
|
2259
|
+
})), K = L(() => {
|
|
2235
2260
|
if (!s.url) return "";
|
|
2236
2261
|
try {
|
|
2237
2262
|
return `${new URL(s.url, location.origin).pathname} · ${w.value} px`;
|
|
@@ -2239,7 +2264,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2239
2264
|
return s.url;
|
|
2240
2265
|
}
|
|
2241
2266
|
});
|
|
2242
|
-
function
|
|
2267
|
+
function Y() {
|
|
2243
2268
|
try {
|
|
2244
2269
|
return o.value?.contentDocument ?? null;
|
|
2245
2270
|
} catch {
|
|
@@ -2251,7 +2276,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2251
2276
|
W.documentElement.scrollTop !== 0 && (W.documentElement.scrollTop = 0);
|
|
2252
2277
|
}
|
|
2253
2278
|
function O() {
|
|
2254
|
-
const W =
|
|
2279
|
+
const W = Y(), P = W?.body;
|
|
2255
2280
|
if (!P || !W?.defaultView) return;
|
|
2256
2281
|
V(W);
|
|
2257
2282
|
const j = W.defaultView.getComputedStyle(P), G = (parseFloat(j.marginTop) || 0) + (parseFloat(j.marginBottom) || 0), fe = Math.ceil(P.scrollHeight + G);
|
|
@@ -2264,7 +2289,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2264
2289
|
}
|
|
2265
2290
|
function Se() {
|
|
2266
2291
|
f.value = !0;
|
|
2267
|
-
const W =
|
|
2292
|
+
const W = Y();
|
|
2268
2293
|
W && (J(W), X?.release(), X = Rl(W, {
|
|
2269
2294
|
/* No guard against answering a click with a scroll: `bring` moves nothing that is already
|
|
2270
2295
|
readable, and a block clicked at the very bottom of the window, half under the action
|
|
@@ -2295,7 +2320,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2295
2320
|
return null;
|
|
2296
2321
|
}
|
|
2297
2322
|
function Q() {
|
|
2298
|
-
const W =
|
|
2323
|
+
const W = Y();
|
|
2299
2324
|
if (ne === null || !W) return;
|
|
2300
2325
|
V(W);
|
|
2301
2326
|
const P = pt(W, ne), j = P ? Ee(P) : null;
|
|
@@ -2307,7 +2332,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2307
2332
|
$ !== 0 && (G ?? window).scrollBy({ top: $, behavior: "smooth" });
|
|
2308
2333
|
}
|
|
2309
2334
|
function ke(W, P) {
|
|
2310
|
-
const j =
|
|
2335
|
+
const j = Y();
|
|
2311
2336
|
if (!j || !f.value) return !1;
|
|
2312
2337
|
const G = Ft(j, W, P);
|
|
2313
2338
|
return G && ot(j, s.selected ?? null), G;
|
|
@@ -2321,7 +2346,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2321
2346
|
return te(
|
|
2322
2347
|
() => s.selected,
|
|
2323
2348
|
(W) => {
|
|
2324
|
-
const P =
|
|
2349
|
+
const P = Y();
|
|
2325
2350
|
!P || !f.value || (ot(P, W ?? null), ye(W ?? null));
|
|
2326
2351
|
}
|
|
2327
2352
|
), te(() => s.reload, Ce), te(
|
|
@@ -2329,7 +2354,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2329
2354
|
() => f.value = !1
|
|
2330
2355
|
), Re(() => window.addEventListener("keydown", ge)), Xe(() => {
|
|
2331
2356
|
window.removeEventListener("keydown", ge), pe !== null && clearTimeout(pe), h?.disconnect(), X?.release();
|
|
2332
|
-
}), l({ replace: ke, refresh: Ce, open: () => p.value = !0 }), (W, P) => (
|
|
2357
|
+
}), l({ replace: ke, refresh: Ce, open: () => p.value = !0 }), (W, P) => (d(), C("div", {
|
|
2333
2358
|
class: $e(["wx-blocks-preview", { "is-fullscreen": p.value, "is-grown": x.value, "is-compact": e.compact }]),
|
|
2334
2359
|
style: xe({ "--wx-preview-scale": y.value })
|
|
2335
2360
|
}, [
|
|
@@ -2338,14 +2363,14 @@ const ts = ["srcdoc"], ls = {
|
|
|
2338
2363
|
ref: r,
|
|
2339
2364
|
class: "wx-blocks-preview__bar"
|
|
2340
2365
|
}, [
|
|
2341
|
-
m(n(
|
|
2366
|
+
m(n(q), {
|
|
2342
2367
|
size: "xs",
|
|
2343
2368
|
tone: "muted",
|
|
2344
2369
|
class: "wx-blocks-preview__label",
|
|
2345
2370
|
truncate: ""
|
|
2346
2371
|
}, {
|
|
2347
2372
|
default: b(() => [
|
|
2348
|
-
M(S(
|
|
2373
|
+
M(S(K.value), 1)
|
|
2349
2374
|
]),
|
|
2350
2375
|
_: 1
|
|
2351
2376
|
}),
|
|
@@ -2357,8 +2382,8 @@ const ts = ["srcdoc"], ls = {
|
|
|
2357
2382
|
"aria-label": n(i)("field.width"),
|
|
2358
2383
|
"onUpdate:modelValue": P[0] || (P[0] = (j) => v.value = Number(j))
|
|
2359
2384
|
}, null, 8, ["model-value", "options", "aria-label"]),
|
|
2360
|
-
A("div",
|
|
2361
|
-
e.compact ? (
|
|
2385
|
+
A("div", fs, [
|
|
2386
|
+
e.compact ? (d(), z(n(Ie), {
|
|
2362
2387
|
key: 0,
|
|
2363
2388
|
size: "sm",
|
|
2364
2389
|
tone: "primary",
|
|
@@ -2366,7 +2391,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2366
2391
|
title: n(i)("field.blocks"),
|
|
2367
2392
|
onClick: P[1] || (P[1] = (j) => a("edit"))
|
|
2368
2393
|
}, null, 8, ["title"])) : D("", !0),
|
|
2369
|
-
e.url ? (
|
|
2394
|
+
e.url ? (d(), z(n(Ie), {
|
|
2370
2395
|
key: 1,
|
|
2371
2396
|
size: "sm",
|
|
2372
2397
|
icon: "external-link",
|
|
@@ -2387,14 +2412,14 @@ const ts = ["srcdoc"], ls = {
|
|
|
2387
2412
|
], 512),
|
|
2388
2413
|
A("div", {
|
|
2389
2414
|
ref_key: "box",
|
|
2390
|
-
ref:
|
|
2415
|
+
ref: c,
|
|
2391
2416
|
class: "wx-blocks-preview__ground"
|
|
2392
2417
|
}, [
|
|
2393
2418
|
A("div", {
|
|
2394
2419
|
class: "wx-blocks-preview__clip",
|
|
2395
2420
|
style: xe(R.value)
|
|
2396
2421
|
}, [
|
|
2397
|
-
e.url ? (
|
|
2422
|
+
e.url ? (d(), C("iframe", {
|
|
2398
2423
|
key: 0,
|
|
2399
2424
|
ref_key: "frame",
|
|
2400
2425
|
ref: o,
|
|
@@ -2403,15 +2428,15 @@ const ts = ["srcdoc"], ls = {
|
|
|
2403
2428
|
style: xe(_.value),
|
|
2404
2429
|
title: n(i)("field.preview"),
|
|
2405
2430
|
onLoad: Se
|
|
2406
|
-
}, null, 44,
|
|
2431
|
+
}, null, 44, ms)) : D("", !0)
|
|
2407
2432
|
], 4)
|
|
2408
2433
|
], 512)
|
|
2409
2434
|
], 6));
|
|
2410
2435
|
}
|
|
2411
|
-
}),
|
|
2436
|
+
}), hs = /* @__PURE__ */ ie(vs, [["__scopeId", "data-v-398e4cef"]]), bs = { class: "wx-blocks-tree__node" }, gs = ["onClick", "onKeydown"], ys = { class: "wx-blocks-tree__name" }, ks = ["title"], ws = ["title"], _s = ["title"], xs = ["title"], $s = {
|
|
2412
2437
|
key: 4,
|
|
2413
2438
|
class: "wx-blocks-tree__actions"
|
|
2414
|
-
},
|
|
2439
|
+
}, Ss = ["onClick"], Es = /* @__PURE__ */ ae({
|
|
2415
2440
|
__name: "BlocksTree",
|
|
2416
2441
|
props: {
|
|
2417
2442
|
nodes: {},
|
|
@@ -2435,7 +2460,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2435
2460
|
const f = i(p);
|
|
2436
2461
|
return f?.content ? Jt(f.content.schema) : [];
|
|
2437
2462
|
}
|
|
2438
|
-
function
|
|
2463
|
+
function c(p, f) {
|
|
2439
2464
|
const v = p.values[f.id];
|
|
2440
2465
|
return Array.isArray(v) ? v : [];
|
|
2441
2466
|
}
|
|
@@ -2464,7 +2489,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2464
2489
|
}
|
|
2465
2490
|
return (p, f) => {
|
|
2466
2491
|
const v = At("blocks-tree", !0);
|
|
2467
|
-
return
|
|
2492
|
+
return d(), z(n(Cl), {
|
|
2468
2493
|
"model-value": e.nodes,
|
|
2469
2494
|
"item-key": "key",
|
|
2470
2495
|
"item-label": (g) => o(g),
|
|
@@ -2476,7 +2501,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2476
2501
|
"onUpdate:modelValue": f[6] || (f[6] = (g) => s("reorder", e.parentKey, e.field, g))
|
|
2477
2502
|
}, {
|
|
2478
2503
|
default: b(({ item: g }) => [
|
|
2479
|
-
A("div",
|
|
2504
|
+
A("div", bs, [
|
|
2480
2505
|
A("div", {
|
|
2481
2506
|
class: $e(["wx-blocks-tree__row", { "is-selected": e.selected === g.key, "is-hidden": g.hidden === !0 }]),
|
|
2482
2507
|
role: "button",
|
|
@@ -2487,46 +2512,46 @@ const ts = ["srcdoc"], ls = {
|
|
|
2487
2512
|
ht(bt((x) => s("select", g.key), ["prevent"]), ["space"])
|
|
2488
2513
|
]
|
|
2489
2514
|
}, [
|
|
2490
|
-
A("span",
|
|
2491
|
-
i(g) ? i(g)?.draft ? (
|
|
2515
|
+
A("span", ys, S(o(g)), 1),
|
|
2516
|
+
i(g) ? i(g)?.draft ? (d(), C("span", {
|
|
2492
2517
|
key: 1,
|
|
2493
2518
|
class: "wx-blocks-tree__flag is-warning",
|
|
2494
2519
|
title: n(a)("field.draft-type")
|
|
2495
2520
|
}, [
|
|
2496
2521
|
m(n(he), { name: "warning" })
|
|
2497
|
-
], 8,
|
|
2522
|
+
], 8, ws)) : i(g)?.is_enabled === !1 ? (d(), C("span", {
|
|
2498
2523
|
key: 2,
|
|
2499
2524
|
class: "wx-blocks-tree__flag",
|
|
2500
2525
|
title: n(a)("field.disabled-type")
|
|
2501
2526
|
}, [
|
|
2502
2527
|
m(n(he), { name: "lock" })
|
|
2503
|
-
], 8,
|
|
2528
|
+
], 8, _s)) : D("", !0) : (d(), C("span", {
|
|
2504
2529
|
key: 0,
|
|
2505
2530
|
class: "wx-blocks-tree__flag is-danger",
|
|
2506
2531
|
title: n(a)("field.unknown-type", { type: g.type })
|
|
2507
2532
|
}, [
|
|
2508
2533
|
m(n(he), { name: "close-circle" })
|
|
2509
|
-
], 8,
|
|
2510
|
-
g.hidden === !0 ? (
|
|
2534
|
+
], 8, ks)),
|
|
2535
|
+
g.hidden === !0 ? (d(), C("span", {
|
|
2511
2536
|
key: 3,
|
|
2512
2537
|
class: "wx-blocks-tree__flag",
|
|
2513
2538
|
title: n(a)("field.hidden-note")
|
|
2514
2539
|
}, [
|
|
2515
2540
|
m(n(he), { name: "eye-off" })
|
|
2516
|
-
], 8,
|
|
2517
|
-
e.disabled ? D("", !0) : (
|
|
2541
|
+
], 8, xs)) : D("", !0),
|
|
2542
|
+
e.disabled ? D("", !0) : (d(), C("span", $s, [
|
|
2518
2543
|
m(n(kl), {
|
|
2519
2544
|
actions: u(g),
|
|
2520
2545
|
label: o(g)
|
|
2521
2546
|
}, null, 8, ["actions", "label"])
|
|
2522
2547
|
]))
|
|
2523
|
-
], 42,
|
|
2524
|
-
(
|
|
2548
|
+
], 42, gs),
|
|
2549
|
+
(d(!0), C(F, null, le(r(g), (x) => (d(), C("div", {
|
|
2525
2550
|
key: x.id,
|
|
2526
2551
|
class: "wx-blocks-tree__kids"
|
|
2527
2552
|
}, [
|
|
2528
2553
|
m(v, {
|
|
2529
|
-
nodes:
|
|
2554
|
+
nodes: c(g, x),
|
|
2530
2555
|
catalog: e.catalog,
|
|
2531
2556
|
"parent-key": g.key,
|
|
2532
2557
|
field: x.id,
|
|
@@ -2540,17 +2565,17 @@ const ts = ["srcdoc"], ls = {
|
|
|
2540
2565
|
onVisibility: f[4] || (f[4] = (T, w) => s("visibility", T, w)),
|
|
2541
2566
|
onReorder: f[5] || (f[5] = (T, w, y) => s("reorder", T, w, y))
|
|
2542
2567
|
}, null, 8, ["nodes", "catalog", "parent-key", "field", "selected", "disabled", "depth"]),
|
|
2543
|
-
e.disabled ? D("", !0) : (
|
|
2568
|
+
e.disabled ? D("", !0) : (d(), C("button", {
|
|
2544
2569
|
key: 0,
|
|
2545
2570
|
type: "button",
|
|
2546
2571
|
class: "wx-blocks-tree__add is-inner",
|
|
2547
2572
|
onClick: (T) => s("add", g.key, x.id, x)
|
|
2548
2573
|
}, [
|
|
2549
2574
|
M(" + " + S(n(a)("field.add-inside")), 1),
|
|
2550
|
-
r(g).length > 1 ? (
|
|
2575
|
+
r(g).length > 1 ? (d(), C(F, { key: 0 }, [
|
|
2551
2576
|
M(" · " + S(x.label ?? x.id), 1)
|
|
2552
2577
|
], 64)) : D("", !0)
|
|
2553
|
-
], 8,
|
|
2578
|
+
], 8, Ss))
|
|
2554
2579
|
]))), 128))
|
|
2555
2580
|
])
|
|
2556
2581
|
]),
|
|
@@ -2558,29 +2583,29 @@ const ts = ["srcdoc"], ls = {
|
|
|
2558
2583
|
}, 8, ["model-value", "item-label", "disabled", "empty-text", "class"]);
|
|
2559
2584
|
};
|
|
2560
2585
|
}
|
|
2561
|
-
}),
|
|
2562
|
-
function
|
|
2586
|
+
}), Ts = /* @__PURE__ */ ie(Es, [["__scopeId", "data-v-590fa1d6"]]), vt = /* @__PURE__ */ Symbol("wx-blocks-preview");
|
|
2587
|
+
function ho(e) {
|
|
2563
2588
|
Bt(vt, e);
|
|
2564
2589
|
}
|
|
2565
|
-
function
|
|
2590
|
+
function bo() {
|
|
2566
2591
|
return De(vt, null);
|
|
2567
2592
|
}
|
|
2568
|
-
const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"),
|
|
2593
|
+
const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Cs = {
|
|
2569
2594
|
key: 0,
|
|
2570
2595
|
class: "wx-blocks-nested"
|
|
2571
|
-
},
|
|
2596
|
+
}, Ls = {
|
|
2572
2597
|
key: 0,
|
|
2573
2598
|
class: "wx-blocks__tree"
|
|
2574
|
-
},
|
|
2599
|
+
}, As = { class: "wx-blocks__panel-head" }, Vs = { class: "wx-blocks__panel-title" }, Bs = { class: "wx-blocks__list" }, Ws = { class: "wx-blocks__tools" }, Ms = {
|
|
2575
2600
|
key: 1,
|
|
2576
2601
|
class: "wx-blocks__fields"
|
|
2577
|
-
},
|
|
2602
|
+
}, Ns = { class: "wx-blocks__panel-head" }, zs = { class: "wx-blocks__panel-title" }, Ds = {
|
|
2578
2603
|
key: 0,
|
|
2579
2604
|
class: "wx-blocks__trail"
|
|
2580
|
-
},
|
|
2605
|
+
}, Is = ["onClick"], Os = { class: "wx-blocks__panel-name" }, Ps = { class: "wx-blocks__panel-extra" }, Us = { key: 0 }, Rs = { class: "wx-blocks__form" }, js = {
|
|
2581
2606
|
key: 0,
|
|
2582
2607
|
class: "wx-blocks__preview"
|
|
2583
|
-
},
|
|
2608
|
+
}, Fs = /* @__PURE__ */ ae({
|
|
2584
2609
|
name: "WxBlocks",
|
|
2585
2610
|
inheritAttrs: !1,
|
|
2586
2611
|
__name: "BlocksField",
|
|
@@ -2601,10 +2626,10 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2601
2626
|
emits: ["update:modelValue"],
|
|
2602
2627
|
setup(e) {
|
|
2603
2628
|
const l = e, t = cl(e, "modelValue"), s = De(Lt, !1);
|
|
2604
|
-
Bt(Lt, !0),
|
|
2629
|
+
Bt(Lt, !0), qe();
|
|
2605
2630
|
const a = de("webx-blocks"), i = Fe(), o = De(Mt, null);
|
|
2606
2631
|
let r = null;
|
|
2607
|
-
const
|
|
2632
|
+
const c = I([]), u = L(() => l.catalog ?? c.value), p = L(() => Array.isArray(t.value) ? t.value : []), f = I(null), v = L(() => f.value ? re(p.value, f.value) : null), g = L(
|
|
2608
2633
|
() => v.value ? u.value.find(($) => $.slug === v.value?.node.type) ?? null : null
|
|
2609
2634
|
);
|
|
2610
2635
|
function x($) {
|
|
@@ -2625,7 +2650,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2625
2650
|
for (; N; )
|
|
2626
2651
|
$.unshift({ key: N.key, title: x(N) }), N = re(p.value, N.key)?.parent ?? null;
|
|
2627
2652
|
return $;
|
|
2628
|
-
}), _ = De(vt, null), R = I(null),
|
|
2653
|
+
}), _ = De(vt, null), R = I(null), K = I(null), Y = et(K), X = L(() => _ !== null && _.url.value !== null), h = L(() => X.value && Y.value > 0 && Y.value <= 900), V = I(!1), O = L(() => {
|
|
2629
2654
|
if (!v.value) return;
|
|
2630
2655
|
const $ = g.value?.title ?? v.value.node.type;
|
|
2631
2656
|
return [...y.value.map((N) => N.title), $].join(" / ");
|
|
@@ -2655,7 +2680,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2655
2680
|
() => o?.state.manifest?.modules.find(($) => $.id === "blocks")?.meta?.groups ?? []
|
|
2656
2681
|
), ne = dl()?.type, pe = L(() => l.context?.types ? l.context.types : o?.types ? { ...Je, ...o.types } : ne ? { ...Je, "wx-blocks": { component: ne, kind: "field", nested: !0 } } : Je), ye = L(
|
|
2657
2682
|
() => l.context?.translate ?? o?.i18n.t ?? (($) => $)
|
|
2658
|
-
), Ee = L(() => l.context?.can ?? o?.can ?? (() => !0)), Te = Ut(
|
|
2683
|
+
), Ee = L(() => l.context?.can ?? o?.can ?? (() => !0)), Te = Ut(ps);
|
|
2659
2684
|
function Q($) {
|
|
2660
2685
|
t.value = $;
|
|
2661
2686
|
}
|
|
@@ -2740,7 +2765,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2740
2765
|
if (window.addEventListener("keydown", Le), l.catalog === null && o) {
|
|
2741
2766
|
r = Me(o);
|
|
2742
2767
|
try {
|
|
2743
|
-
|
|
2768
|
+
c.value = await r.catalog();
|
|
2744
2769
|
} catch ($) {
|
|
2745
2770
|
Z.danger(i($));
|
|
2746
2771
|
}
|
|
@@ -2751,8 +2776,8 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2751
2776
|
const ze = L(
|
|
2752
2777
|
() => g.value?.content ? mt(g.value.content.schema) : []
|
|
2753
2778
|
);
|
|
2754
|
-
return ($, N) => n(s) ? (
|
|
2755
|
-
m(n(
|
|
2779
|
+
return ($, N) => n(s) ? (d(), C("div", Cs, [
|
|
2780
|
+
m(n(q), {
|
|
2756
2781
|
size: "sm",
|
|
2757
2782
|
tone: "muted"
|
|
2758
2783
|
}, {
|
|
@@ -2761,10 +2786,10 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2761
2786
|
]),
|
|
2762
2787
|
_: 1
|
|
2763
2788
|
})
|
|
2764
|
-
])) : (
|
|
2789
|
+
])) : (d(), C("div", {
|
|
2765
2790
|
key: 1,
|
|
2766
2791
|
ref_key: "host",
|
|
2767
|
-
ref:
|
|
2792
|
+
ref: K,
|
|
2768
2793
|
class: $e(["wx-blocks-host", { "is-compact": h.value }])
|
|
2769
2794
|
}, [
|
|
2770
2795
|
A("div", {
|
|
@@ -2773,12 +2798,12 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2773
2798
|
"has-preview": n(_) !== null && n(_).url.value !== null
|
|
2774
2799
|
}])
|
|
2775
2800
|
}, [
|
|
2776
|
-
(
|
|
2801
|
+
(d(), z(pl(h.value ? n(Ll) : "div"), fl(J.value, { class: "wx-blocks__side" }), {
|
|
2777
2802
|
default: b(() => [
|
|
2778
|
-
v.value ? D("", !0) : (
|
|
2779
|
-
A("div",
|
|
2780
|
-
A("span",
|
|
2781
|
-
m(n(
|
|
2803
|
+
v.value ? D("", !0) : (d(), C("div", Ls, [
|
|
2804
|
+
A("div", As, [
|
|
2805
|
+
A("span", Vs, S(n(a)("field.blocks")), 1),
|
|
2806
|
+
m(n(q), {
|
|
2782
2807
|
size: "sm",
|
|
2783
2808
|
tone: "muted"
|
|
2784
2809
|
}, {
|
|
@@ -2788,8 +2813,8 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2788
2813
|
_: 1
|
|
2789
2814
|
})
|
|
2790
2815
|
]),
|
|
2791
|
-
A("div",
|
|
2792
|
-
m(
|
|
2816
|
+
A("div", Bs, [
|
|
2817
|
+
m(Ts, {
|
|
2793
2818
|
nodes: p.value,
|
|
2794
2819
|
catalog: u.value,
|
|
2795
2820
|
selected: f.value,
|
|
@@ -2802,8 +2827,8 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2802
2827
|
onReorder: j
|
|
2803
2828
|
}, null, 8, ["nodes", "catalog", "selected", "disabled"])
|
|
2804
2829
|
]),
|
|
2805
|
-
A("div",
|
|
2806
|
-
!e.disabled && (e.max === null || p.value.length < e.max) ? (
|
|
2830
|
+
A("div", Ws, [
|
|
2831
|
+
!e.disabled && (e.max === null || p.value.length < e.max) ? (d(), z(n(ce), {
|
|
2807
2832
|
key: 0,
|
|
2808
2833
|
variant: "outline",
|
|
2809
2834
|
icon: "plus",
|
|
@@ -2815,7 +2840,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2815
2840
|
]),
|
|
2816
2841
|
_: 1
|
|
2817
2842
|
})) : D("", !0),
|
|
2818
|
-
!h.value && n(_) && n(_).url.value ? (
|
|
2843
|
+
!h.value && n(_) && n(_).url.value ? (d(), z(n(ce), {
|
|
2819
2844
|
key: 1,
|
|
2820
2845
|
variant: "outline",
|
|
2821
2846
|
icon: "eye",
|
|
@@ -2829,25 +2854,25 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2829
2854
|
})) : D("", !0)
|
|
2830
2855
|
])
|
|
2831
2856
|
])),
|
|
2832
|
-
v.value ? (
|
|
2833
|
-
A("div",
|
|
2834
|
-
A("span",
|
|
2835
|
-
y.value.length ? (
|
|
2836
|
-
(
|
|
2857
|
+
v.value ? (d(), C("div", Ms, [
|
|
2858
|
+
A("div", Ns, [
|
|
2859
|
+
A("span", zs, [
|
|
2860
|
+
y.value.length ? (d(), C("span", Ds, [
|
|
2861
|
+
(d(!0), C(F, null, le(y.value, (U) => (d(), C(F, {
|
|
2837
2862
|
key: U.key
|
|
2838
2863
|
}, [
|
|
2839
2864
|
A("button", {
|
|
2840
2865
|
type: "button",
|
|
2841
2866
|
class: "wx-blocks__trail-step",
|
|
2842
2867
|
onClick: (H) => G(U.key)
|
|
2843
|
-
}, S(U.title), 9,
|
|
2868
|
+
}, S(U.title), 9, Is),
|
|
2844
2869
|
m(n(he), { name: "chevron-right" })
|
|
2845
2870
|
], 64))), 128))
|
|
2846
2871
|
])) : D("", !0),
|
|
2847
|
-
A("span",
|
|
2872
|
+
A("span", Os, S(g.value?.title ?? v.value.node.type), 1)
|
|
2848
2873
|
]),
|
|
2849
|
-
A("span",
|
|
2850
|
-
h.value ? D("", !0) : (
|
|
2874
|
+
A("span", Ps, [
|
|
2875
|
+
h.value ? D("", !0) : (d(), C("code", Us, S(v.value.node.type), 1)),
|
|
2851
2876
|
m(n(Ie), {
|
|
2852
2877
|
size: "sm",
|
|
2853
2878
|
tone: "neutral",
|
|
@@ -2864,7 +2889,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2864
2889
|
disabled: w.value.next === null,
|
|
2865
2890
|
onClick: N[3] || (N[3] = (U) => w.value.next && G(w.value.next))
|
|
2866
2891
|
}, null, 8, ["title", "disabled"]),
|
|
2867
|
-
!h.value && n(_) && n(_).url.value ? (
|
|
2892
|
+
!h.value && n(_) && n(_).url.value ? (d(), z(n(ce), {
|
|
2868
2893
|
key: 1,
|
|
2869
2894
|
size: "sm",
|
|
2870
2895
|
variant: "outline",
|
|
@@ -2885,8 +2910,8 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2885
2910
|
})
|
|
2886
2911
|
])
|
|
2887
2912
|
]),
|
|
2888
|
-
A("div",
|
|
2889
|
-
g.value?.content ? (
|
|
2913
|
+
A("div", Rs, [
|
|
2914
|
+
g.value?.content ? (d(), z(n(Rt), {
|
|
2890
2915
|
key: v.value.node.key,
|
|
2891
2916
|
"model-value": v.value.node.values,
|
|
2892
2917
|
root: ze.value,
|
|
@@ -2895,7 +2920,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2895
2920
|
can: Ee.value,
|
|
2896
2921
|
disabled: e.disabled,
|
|
2897
2922
|
"onUpdate:modelValue": se
|
|
2898
|
-
}, null, 8, ["model-value", "root", "types", "translate", "can", "disabled"])) : (
|
|
2923
|
+
}, null, 8, ["model-value", "root", "types", "translate", "can", "disabled"])) : (d(), z(n(q), {
|
|
2899
2924
|
key: 1,
|
|
2900
2925
|
size: "sm",
|
|
2901
2926
|
tone: "danger"
|
|
@@ -2910,8 +2935,8 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2910
2935
|
]),
|
|
2911
2936
|
_: 1
|
|
2912
2937
|
}, 16)),
|
|
2913
|
-
n(_) && n(_).url.value ? (
|
|
2914
|
-
m(
|
|
2938
|
+
n(_) && n(_).url.value ? (d(), C("div", js, [
|
|
2939
|
+
m(hs, {
|
|
2915
2940
|
ref_key: "previewEl",
|
|
2916
2941
|
ref: R,
|
|
2917
2942
|
url: n(_).url.value,
|
|
@@ -2925,7 +2950,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2925
2950
|
], 2)
|
|
2926
2951
|
], 2));
|
|
2927
2952
|
}
|
|
2928
|
-
}),
|
|
2953
|
+
}), Hs = /* @__PURE__ */ ie(Fs, [["__scopeId", "data-v-3952ee19"]]), qs = { class: "wx-block-card__body" }, Ks = { class: "wx-block-card__title" }, Ys = { class: "wx-block-card__chips" }, Js = /* @__PURE__ */ ae({
|
|
2929
2954
|
__name: "BlockCard",
|
|
2930
2955
|
props: {
|
|
2931
2956
|
block: {}
|
|
@@ -2933,7 +2958,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2933
2958
|
emits: ["open"],
|
|
2934
2959
|
setup(e, { emit: l }) {
|
|
2935
2960
|
const t = l, s = de("webx-blocks");
|
|
2936
|
-
return (a, i) => (
|
|
2961
|
+
return (a, i) => (d(), C("button", {
|
|
2937
2962
|
type: "button",
|
|
2938
2963
|
class: "wx-block-card",
|
|
2939
2964
|
onClick: i[0] || (i[0] = (o) => t("open", e.block))
|
|
@@ -2942,9 +2967,9 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2942
2967
|
thumbnail: e.block.thumbnail,
|
|
2943
2968
|
height: 120
|
|
2944
2969
|
}, null, 8, ["thumbnail"]),
|
|
2945
|
-
A("div",
|
|
2970
|
+
A("div", qs, [
|
|
2946
2971
|
A("div", Ks, S(e.block.title), 1),
|
|
2947
|
-
m(n(
|
|
2972
|
+
m(n(q), {
|
|
2948
2973
|
size: "sm",
|
|
2949
2974
|
tone: "muted"
|
|
2950
2975
|
}, {
|
|
@@ -2955,7 +2980,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2955
2980
|
_: 1
|
|
2956
2981
|
}),
|
|
2957
2982
|
A("div", Ys, [
|
|
2958
|
-
e.block.draft ? (
|
|
2983
|
+
e.block.draft ? (d(), z(n(ue), {
|
|
2959
2984
|
key: 0,
|
|
2960
2985
|
type: "warning",
|
|
2961
2986
|
dot: ""
|
|
@@ -2965,7 +2990,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2965
2990
|
]),
|
|
2966
2991
|
_: 1
|
|
2967
2992
|
})) : D("", !0),
|
|
2968
|
-
e.block.published ? (
|
|
2993
|
+
e.block.published ? (d(), z(n(ue), {
|
|
2969
2994
|
key: 1,
|
|
2970
2995
|
type: "success",
|
|
2971
2996
|
dot: ""
|
|
@@ -2974,7 +2999,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2974
2999
|
M(S(n(s)("page.live", { number: e.block.published.number })), 1)
|
|
2975
3000
|
]),
|
|
2976
3001
|
_: 1
|
|
2977
|
-
})) : (
|
|
3002
|
+
})) : (d(), z(n(ue), {
|
|
2978
3003
|
key: 2,
|
|
2979
3004
|
type: "default"
|
|
2980
3005
|
}, {
|
|
@@ -2983,7 +3008,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2983
3008
|
]),
|
|
2984
3009
|
_: 1
|
|
2985
3010
|
})),
|
|
2986
|
-
e.block.is_enabled ? D("", !0) : (
|
|
3011
|
+
e.block.is_enabled ? D("", !0) : (d(), z(n(ue), {
|
|
2987
3012
|
key: 3,
|
|
2988
3013
|
type: "default",
|
|
2989
3014
|
variant: "outline"
|
|
@@ -2997,13 +3022,13 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2997
3022
|
])
|
|
2998
3023
|
]));
|
|
2999
3024
|
}
|
|
3000
|
-
}),
|
|
3025
|
+
}), Gs = /* @__PURE__ */ ie(Js, [["__scopeId", "data-v-3d94f339"]]), Zs = { class: "wx-block-create" }, Qs = /* @__PURE__ */ ae({
|
|
3001
3026
|
__name: "BlockCreateDialog",
|
|
3002
3027
|
setup(e) {
|
|
3003
3028
|
const { resolve: l, dismiss: t, open: s } = It(), a = je(), i = Me(a);
|
|
3004
|
-
|
|
3005
|
-
const o = de("webx-blocks"), r = Fe(),
|
|
3006
|
-
() =>
|
|
3029
|
+
qe();
|
|
3030
|
+
const o = de("webx-blocks"), r = Fe(), c = L(() => a.state.manifest?.modules.find((_) => _.id === "blocks")?.meta?.groups ?? ["content"]), u = I({ title: "", slug: "", group: c.value[0] ?? "content" }), p = I({}), f = I(!1), v = I(!1), g = L(
|
|
3031
|
+
() => c.value.map((y) => ({ value: y, label: Ne(y, o) }))
|
|
3007
3032
|
);
|
|
3008
3033
|
function x(y) {
|
|
3009
3034
|
return y.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/^[^a-z]+/, "").slice(0, 64);
|
|
@@ -3028,7 +3053,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
3028
3053
|
f.value = !1;
|
|
3029
3054
|
}
|
|
3030
3055
|
}
|
|
3031
|
-
return (y, _) => (
|
|
3056
|
+
return (y, _) => (d(), z(n(Ot), {
|
|
3032
3057
|
open: n(s),
|
|
3033
3058
|
"onUpdate:open": _[5] || (_[5] = (R) => Vt(s) ? s.value = R : null),
|
|
3034
3059
|
title: n(o)("page.new"),
|
|
@@ -3061,7 +3086,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
3061
3086
|
})
|
|
3062
3087
|
]),
|
|
3063
3088
|
default: b(() => [
|
|
3064
|
-
A("div",
|
|
3089
|
+
A("div", Zs, [
|
|
3065
3090
|
m(n(oe), {
|
|
3066
3091
|
label: n(o)("page.title"),
|
|
3067
3092
|
error: T("title")
|
|
@@ -3109,21 +3134,21 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
3109
3134
|
_: 1
|
|
3110
3135
|
}, 8, ["open", "title"]));
|
|
3111
3136
|
}
|
|
3112
|
-
}),
|
|
3137
|
+
}), Xs = /* @__PURE__ */ ie(Qs, [["__scopeId", "data-v-a4c0d44c"]]), eo = {
|
|
3113
3138
|
key: 1,
|
|
3114
3139
|
class: "wx-blocks-page__toolbar"
|
|
3115
|
-
},
|
|
3140
|
+
}, to = { class: "wx-blocks-page__cards" }, lo = { class: "wx-blocks-page__ghost-body" }, no = {
|
|
3116
3141
|
key: 0,
|
|
3117
3142
|
class: "wx-blocks-page__group-title"
|
|
3118
|
-
},
|
|
3143
|
+
}, so = { class: "wx-blocks-page__cards" }, oo = /* @__PURE__ */ ae({
|
|
3119
3144
|
__name: "BlocksPage",
|
|
3120
3145
|
props: {
|
|
3121
3146
|
base: { default: "/blocks" }
|
|
3122
3147
|
},
|
|
3123
3148
|
setup(e) {
|
|
3124
3149
|
const l = e, t = je(), s = Me(t), a = Wt();
|
|
3125
|
-
|
|
3126
|
-
const i = de("webx-blocks"), o = Fe(), r = I([]),
|
|
3150
|
+
qe();
|
|
3151
|
+
const i = de("webx-blocks"), o = Fe(), r = I([]), c = I(!0), u = I(""), p = I(""), f = Ut(Xs), v = L(() => {
|
|
3127
3152
|
const h = t.state.manifest?.modules.find((V) => V.id === "blocks")?.meta;
|
|
3128
3153
|
return {
|
|
3129
3154
|
groups: h?.groups ?? [],
|
|
@@ -3156,29 +3181,29 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
3156
3181
|
return p.value !== "" || T.value.length <= 5 || u.value.trim() !== "" || h.length < 2 ? [{ id: "", label: "", blocks: T.value }] : h;
|
|
3157
3182
|
});
|
|
3158
3183
|
async function R() {
|
|
3159
|
-
|
|
3184
|
+
c.value = !0;
|
|
3160
3185
|
try {
|
|
3161
3186
|
r.value = await s.list();
|
|
3162
3187
|
} catch (h) {
|
|
3163
3188
|
Z.danger(o(h));
|
|
3164
3189
|
} finally {
|
|
3165
|
-
|
|
3190
|
+
c.value = !1;
|
|
3166
3191
|
}
|
|
3167
3192
|
}
|
|
3168
|
-
function
|
|
3193
|
+
function K(h) {
|
|
3169
3194
|
a.push(`${l.base}/${h.id}`);
|
|
3170
3195
|
}
|
|
3171
|
-
async function
|
|
3196
|
+
async function Y() {
|
|
3172
3197
|
const h = await f({});
|
|
3173
|
-
h &&
|
|
3198
|
+
h && K(h);
|
|
3174
3199
|
}
|
|
3175
3200
|
Re(R);
|
|
3176
3201
|
const X = L(
|
|
3177
3202
|
() => g.value ? [{ key: "new", label: i("page.new"), icon: "plus", primary: !0, run: () => {
|
|
3178
|
-
|
|
3203
|
+
Y();
|
|
3179
3204
|
} }] : []
|
|
3180
3205
|
);
|
|
3181
|
-
return (h, V) => (
|
|
3206
|
+
return (h, V) => (d(), z(n(wl), {
|
|
3182
3207
|
view: p.value,
|
|
3183
3208
|
"onUpdate:view": V[1] || (V[1] = (O) => p.value = O),
|
|
3184
3209
|
class: "wx-blocks-page",
|
|
@@ -3187,13 +3212,13 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
3187
3212
|
actions: X.value
|
|
3188
3213
|
}, {
|
|
3189
3214
|
default: b(() => [
|
|
3190
|
-
v.value.editing ? D("", !0) : (
|
|
3215
|
+
v.value.editing ? D("", !0) : (d(), z(n(zt), {
|
|
3191
3216
|
key: 0,
|
|
3192
3217
|
type: "info",
|
|
3193
3218
|
variant: "soft",
|
|
3194
3219
|
description: n(i)("page.editing-off")
|
|
3195
3220
|
}, null, 8, ["description"])),
|
|
3196
|
-
|
|
3221
|
+
c.value || r.value.length > 0 ? (d(), C("div", eo, [
|
|
3197
3222
|
m(n(Ue), {
|
|
3198
3223
|
modelValue: u.value,
|
|
3199
3224
|
"onUpdate:modelValue": V[0] || (V[0] = (O) => u.value = O),
|
|
@@ -3202,28 +3227,28 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
3202
3227
|
clearable: ""
|
|
3203
3228
|
}, null, 8, ["modelValue", "placeholder"])
|
|
3204
3229
|
])) : D("", !0),
|
|
3205
|
-
|
|
3230
|
+
c.value ? (d(), z(n(Be), { key: 2 }, {
|
|
3206
3231
|
template: b(() => [
|
|
3207
|
-
A("div",
|
|
3208
|
-
(
|
|
3232
|
+
A("div", to, [
|
|
3233
|
+
(d(), C(F, null, le(4, (O) => A("div", {
|
|
3209
3234
|
key: O,
|
|
3210
3235
|
class: "wx-blocks-page__ghost"
|
|
3211
3236
|
}, [
|
|
3212
|
-
m(n(
|
|
3237
|
+
m(n(Ye), {
|
|
3213
3238
|
variant: "image",
|
|
3214
3239
|
height: 120,
|
|
3215
3240
|
class: "wx-blocks-page__ghost-thumb"
|
|
3216
3241
|
}),
|
|
3217
|
-
A("div",
|
|
3218
|
-
m(n(
|
|
3242
|
+
A("div", lo, [
|
|
3243
|
+
m(n(Ye), {
|
|
3219
3244
|
variant: "title",
|
|
3220
3245
|
width: "45%"
|
|
3221
3246
|
}),
|
|
3222
|
-
m(n(
|
|
3247
|
+
m(n(Ye), {
|
|
3223
3248
|
variant: "text",
|
|
3224
3249
|
width: "70%"
|
|
3225
3250
|
}),
|
|
3226
|
-
m(n(
|
|
3251
|
+
m(n(Ye), {
|
|
3227
3252
|
variant: "button",
|
|
3228
3253
|
width: "64px",
|
|
3229
3254
|
height: "22px"
|
|
@@ -3233,21 +3258,21 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
3233
3258
|
])
|
|
3234
3259
|
]),
|
|
3235
3260
|
_: 1
|
|
3236
|
-
})) : r.value.length === 0 ? (
|
|
3261
|
+
})) : r.value.length === 0 ? (d(), z(n(Pt), {
|
|
3237
3262
|
key: 3,
|
|
3238
3263
|
icon: "grid",
|
|
3239
3264
|
title: n(i)("page.empty"),
|
|
3240
3265
|
description: n(i)("page.empty-help")
|
|
3241
|
-
}, null, 8, ["title", "description"])) : (
|
|
3266
|
+
}, null, 8, ["title", "description"])) : (d(!0), C(F, { key: 4 }, le(_.value, (O) => (d(), C("section", {
|
|
3242
3267
|
key: O.id,
|
|
3243
3268
|
class: "wx-blocks-page__group"
|
|
3244
3269
|
}, [
|
|
3245
|
-
O.label ? (
|
|
3246
|
-
A("div",
|
|
3247
|
-
(
|
|
3270
|
+
O.label ? (d(), C("div", no, S(O.label), 1)) : D("", !0),
|
|
3271
|
+
A("div", so, [
|
|
3272
|
+
(d(!0), C(F, null, le(O.blocks, (J) => (d(), z(Gs, {
|
|
3248
3273
|
key: J.id,
|
|
3249
3274
|
block: J,
|
|
3250
|
-
onOpen:
|
|
3275
|
+
onOpen: K
|
|
3251
3276
|
}, null, 8, ["block"]))), 128))
|
|
3252
3277
|
])
|
|
3253
3278
|
]))), 128))
|
|
@@ -3255,18 +3280,18 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
3255
3280
|
_: 1
|
|
3256
3281
|
}, 8, ["view", "title", "views", "actions"]));
|
|
3257
3282
|
}
|
|
3258
|
-
}),
|
|
3259
|
-
function
|
|
3283
|
+
}), ao = /* @__PURE__ */ ie(oo, [["__scopeId", "data-v-553b680f"]]);
|
|
3284
|
+
function go(e = {}) {
|
|
3260
3285
|
const l = e.path ?? "/blocks";
|
|
3261
3286
|
return {
|
|
3262
3287
|
id: "blocks",
|
|
3263
3288
|
path: l,
|
|
3264
3289
|
routes: [
|
|
3265
|
-
{ path: l, name: "webx.blocks", component:
|
|
3290
|
+
{ path: l, name: "webx.blocks", component: ao, props: { base: l } },
|
|
3266
3291
|
{
|
|
3267
3292
|
path: `${l}/:id(\\d+)`,
|
|
3268
3293
|
name: "webx.blocks.edit",
|
|
3269
|
-
component:
|
|
3294
|
+
component: Xn,
|
|
3270
3295
|
props: { base: l }
|
|
3271
3296
|
}
|
|
3272
3297
|
],
|
|
@@ -3275,7 +3300,7 @@ function bo(e = {}) {
|
|
|
3275
3300
|
// draws its children through the renderer; it needs the node for `props.allow` alone.
|
|
3276
3301
|
types: {
|
|
3277
3302
|
"wx-blocks": {
|
|
3278
|
-
component:
|
|
3303
|
+
component: Hs,
|
|
3279
3304
|
kind: "field",
|
|
3280
3305
|
nested: !0,
|
|
3281
3306
|
wide: !0,
|
|
@@ -3285,13 +3310,13 @@ function bo(e = {}) {
|
|
|
3285
3310
|
};
|
|
3286
3311
|
}
|
|
3287
3312
|
export {
|
|
3288
|
-
|
|
3289
|
-
|
|
3313
|
+
Xn as WxBlockEditorPage,
|
|
3314
|
+
ps as WxBlockPicker,
|
|
3290
3315
|
Xl as WxBlockStage,
|
|
3291
3316
|
sl as WxBlockThumb,
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3317
|
+
Hs as WxBlocks,
|
|
3318
|
+
ao as WxBlocksPage,
|
|
3319
|
+
go as blocks,
|
|
3295
3320
|
un as blocksMessages,
|
|
3296
3321
|
vt as blocksPreviewKey,
|
|
3297
3322
|
Gt as cloneNode,
|
|
@@ -3301,21 +3326,21 @@ export {
|
|
|
3301
3326
|
mt as formSchema,
|
|
3302
3327
|
ot as highlightBlock,
|
|
3303
3328
|
$t as insertNode,
|
|
3304
|
-
|
|
3329
|
+
Kt as isNode,
|
|
3305
3330
|
tt as isNodeList,
|
|
3306
|
-
|
|
3331
|
+
Mn as lintBlock,
|
|
3307
3332
|
re as locate,
|
|
3308
3333
|
en as makeNode,
|
|
3309
3334
|
ut as newKey,
|
|
3310
|
-
|
|
3335
|
+
ho as provideBlocksPreview,
|
|
3311
3336
|
on as removeNode,
|
|
3312
3337
|
Ft as replaceBlock,
|
|
3313
3338
|
rn as replaceList,
|
|
3314
3339
|
Ht as stageDocument,
|
|
3315
|
-
|
|
3316
|
-
|
|
3340
|
+
vo as typesIn,
|
|
3341
|
+
Nn as undeclared,
|
|
3317
3342
|
an as updateValues,
|
|
3318
|
-
|
|
3343
|
+
bo as useBlocksPreview,
|
|
3319
3344
|
He as walk
|
|
3320
3345
|
};
|
|
3321
3346
|
//# sourceMappingURL=index.js.map
|