@webx-ui/module-blocks 0.8.6 → 0.8.8
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 +379 -363
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
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,47 @@ 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
|
+
]
|
|
744
758
|
};
|
|
745
|
-
function
|
|
759
|
+
function gn({ schema: e, styles: l }) {
|
|
746
760
|
return (t) => {
|
|
747
761
|
const s = t.state.sliceDoc(Math.max(0, t.pos - 200), t.pos), a = /\$block->(\w*)$/.exec(s);
|
|
748
|
-
if (a) return
|
|
762
|
+
if (a) return wn(t, a[1]);
|
|
749
763
|
const i = /\$(\w+)\[\s*(['"]?)(\w*)$/.exec(s);
|
|
750
|
-
if (i) return
|
|
764
|
+
if (i) return _n(t, i[1], i[2], i[3], e());
|
|
751
765
|
const o = /\$(\w*)$/.exec(s);
|
|
752
766
|
if (o)
|
|
753
767
|
return {
|
|
754
768
|
from: t.pos - o[0].length,
|
|
755
|
-
options:
|
|
769
|
+
options: yn(e(), t.state.doc.toString()),
|
|
756
770
|
validFor: /^\$\w*$/
|
|
757
771
|
};
|
|
758
772
|
const r = /(\{\{|\{!!)(\s*)(\w*)$/.exec(s);
|
|
759
|
-
if (r) return
|
|
760
|
-
const
|
|
761
|
-
if (
|
|
773
|
+
if (r) return kn(t, r[1], r[2], r[3], e());
|
|
774
|
+
const c = /\bclass\s*=\s*"([^"]*)$/.exec(s);
|
|
775
|
+
if (c) return $n(t, c[1], l());
|
|
762
776
|
const u = /(?:^|[\s>(])@(\w*)$/.exec(s);
|
|
763
777
|
return u ? {
|
|
764
778
|
from: t.pos - u[1].length - 1,
|
|
765
|
-
options:
|
|
779
|
+
options: Sn(e()),
|
|
766
780
|
validFor: /^@\w*$/
|
|
767
781
|
} : null;
|
|
768
782
|
};
|
|
769
783
|
}
|
|
770
|
-
function
|
|
784
|
+
function yn(e, l) {
|
|
771
785
|
const t = el(e).map((s, a) => ({
|
|
772
786
|
label: `$${s.id}`,
|
|
773
787
|
detail: s.type,
|
|
@@ -781,21 +795,21 @@ function gn(e, l) {
|
|
|
781
795
|
t.push({ label: `$${s}`, detail: "given", info: a, type: "variable", boost: -10 });
|
|
782
796
|
return t.push({ label: "$loop", detail: "given", info: "inside @foreach", boost: -20 }), t;
|
|
783
797
|
}
|
|
784
|
-
function
|
|
798
|
+
function kn(e, l, t, s, a) {
|
|
785
799
|
const i = el(a);
|
|
786
800
|
if (i.length === 0) return null;
|
|
787
801
|
const o = l === "{{" ? "}}" : "!!}";
|
|
788
802
|
return {
|
|
789
803
|
from: e.pos - s.length,
|
|
790
|
-
options: i.map((r,
|
|
804
|
+
options: i.map((r, c) => ({
|
|
791
805
|
label: r.id,
|
|
792
806
|
displayLabel: `$${r.id}`,
|
|
793
807
|
detail: r.type,
|
|
794
808
|
info: r.label,
|
|
795
809
|
type: "variable",
|
|
796
|
-
boost: 50 -
|
|
810
|
+
boost: 50 - c,
|
|
797
811
|
apply: (u, p, f, v) => {
|
|
798
|
-
const g = u.state.sliceDoc(v, v + 8), x = new RegExp(`^\\s*${
|
|
812
|
+
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
813
|
u.dispatch({
|
|
800
814
|
changes: { from: f, to: v, insert: w },
|
|
801
815
|
// Past the closing braces: the echo is finished, the next thing is the markup.
|
|
@@ -808,7 +822,7 @@ function yn(e, l, t, s, a) {
|
|
|
808
822
|
validFor: /^\w*$/
|
|
809
823
|
};
|
|
810
824
|
}
|
|
811
|
-
function
|
|
825
|
+
function wn(e, l) {
|
|
812
826
|
return {
|
|
813
827
|
from: e.pos - l.length,
|
|
814
828
|
options: [
|
|
@@ -822,17 +836,17 @@ function kn(e, l) {
|
|
|
822
836
|
validFor: /^\w*$/
|
|
823
837
|
};
|
|
824
838
|
}
|
|
825
|
-
function
|
|
826
|
-
const i =
|
|
839
|
+
function _n(e, l, t, s, a) {
|
|
840
|
+
const i = xn(l, a, e.state.doc.toString());
|
|
827
841
|
return i.length === 0 ? null : {
|
|
828
842
|
from: e.pos - s.length,
|
|
829
843
|
options: i.map(([o, r]) => ({
|
|
830
844
|
label: o,
|
|
831
845
|
detail: r,
|
|
832
846
|
type: "property",
|
|
833
|
-
apply: (
|
|
834
|
-
const v = t ? p - 1 : p, g =
|
|
835
|
-
|
|
847
|
+
apply: (c, u, p, f) => {
|
|
848
|
+
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 ? "" : "]"}`;
|
|
849
|
+
c.dispatch({
|
|
836
850
|
changes: { from: v, to: T, insert: y },
|
|
837
851
|
selection: { anchor: v + y.length + (w ? 1 : 0) },
|
|
838
852
|
annotations: dt.of(u),
|
|
@@ -843,17 +857,17 @@ function wn(e, l, t, s, a) {
|
|
|
843
857
|
validFor: /^\w*$/
|
|
844
858
|
};
|
|
845
859
|
}
|
|
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((
|
|
860
|
+
function xn(e, l, t) {
|
|
861
|
+
const s = We(l).find((c) => c.id === e);
|
|
862
|
+
if (s && fn.includes(s.type)) return Zt.map((c) => [c, s.type]);
|
|
863
|
+
if (s?.type === "wx-collection") return vn.map((c) => [c, s.type]);
|
|
864
|
+
const a = Qt(t).get(e), [i, o] = a?.split(".") ?? [], r = i ? We(l).find((c) => c.id === i) : void 0;
|
|
851
865
|
if (!r) return [];
|
|
852
866
|
if (r.type === "wx-collection") {
|
|
853
|
-
const
|
|
854
|
-
return
|
|
867
|
+
const c = typeof r.props?.source == "string" ? r.props.source : r.type, u = o === "items" ? bn[c] ?? [] : [];
|
|
868
|
+
return [...hn[o ?? ""] ?? [], ...u].map((p) => [p, c]);
|
|
855
869
|
}
|
|
856
|
-
return mn.includes(r.type) ? pn.map((
|
|
870
|
+
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
871
|
}
|
|
858
872
|
function Qt(e) {
|
|
859
873
|
const l = /* @__PURE__ */ new Map();
|
|
@@ -863,7 +877,7 @@ function Qt(e) {
|
|
|
863
877
|
l.set(t[4] ?? t[3], t[2] ? `${t[1]}.${t[2]}` : t[1]);
|
|
864
878
|
return l;
|
|
865
879
|
}
|
|
866
|
-
function
|
|
880
|
+
function $n(e, l, t) {
|
|
867
881
|
const s = /[\w-]*$/.exec(l)[0], a = new Set(l.split(/\s+/));
|
|
868
882
|
return {
|
|
869
883
|
from: e.pos - s.length,
|
|
@@ -871,7 +885,7 @@ function xn(e, l, t) {
|
|
|
871
885
|
validFor: /^[\w-]*$/
|
|
872
886
|
};
|
|
873
887
|
}
|
|
874
|
-
function
|
|
888
|
+
function Sn(e) {
|
|
875
889
|
const l = We(e).filter((t) => t.type === "wx-blocks");
|
|
876
890
|
return [
|
|
877
891
|
ve("@if (${condition})\n ${}\n@endif", { label: "@if", type: "keyword" }),
|
|
@@ -903,13 +917,13 @@ function $n(e) {
|
|
|
903
917
|
)
|
|
904
918
|
];
|
|
905
919
|
}
|
|
906
|
-
function
|
|
920
|
+
function En({ slug: e, template: l }) {
|
|
907
921
|
return (t) => {
|
|
908
922
|
const s = t.state.sliceDoc(Math.max(0, t.pos - 200), t.pos), a = /(?:^|[\s,>+~(}{])\.([\w-]*)$/.exec(s);
|
|
909
923
|
if (!a) return null;
|
|
910
924
|
const i = /[^{};]*$/.exec(s)[0];
|
|
911
925
|
if (/^\s*[\w-]+\s*:\s/.test(i)) return null;
|
|
912
|
-
const o = `b-${e()}`, r = new Set(Xt(t.state.doc.toString())),
|
|
926
|
+
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
927
|
label: `.${f}`,
|
|
914
928
|
// A class the template uses and nothing styles yet is the likeliest thing to write.
|
|
915
929
|
detail: r.has(f) ? "template" : "template · no rule yet",
|
|
@@ -926,16 +940,16 @@ function Xt(e) {
|
|
|
926
940
|
let a = "";
|
|
927
941
|
for (const i of l)
|
|
928
942
|
if (i === "{") {
|
|
929
|
-
const o = s.at(-1) ?? [""], r = a.split(",").map((
|
|
930
|
-
(
|
|
943
|
+
const o = s.at(-1) ?? [""], r = a.split(",").map((c) => c.trim()).filter((c) => c !== "" && !c.startsWith("@")).flatMap(
|
|
944
|
+
(c) => c.includes("&") ? o.map((u) => c.replaceAll("&", u)) : o.map((u) => u ? `${u} ${c}` : c)
|
|
931
945
|
);
|
|
932
|
-
for (const
|
|
933
|
-
for (const u of
|
|
946
|
+
for (const c of r)
|
|
947
|
+
for (const u of c.matchAll(/\.(-?[a-zA-Z_][\w-]*)/g)) t.add(u[1]);
|
|
934
948
|
s.push(a.trim().startsWith("@") ? o : r.length ? r : o), a = "";
|
|
935
949
|
} else i === "}" ? (s.pop(), a = "") : i === ";" ? a = "" : a += i;
|
|
936
950
|
return [...t];
|
|
937
951
|
}
|
|
938
|
-
function
|
|
952
|
+
function Tn(e) {
|
|
939
953
|
const l = /* @__PURE__ */ new Set();
|
|
940
954
|
for (const t of e.matchAll(/\bclass\s*=\s*"([^"]*)"/g)) {
|
|
941
955
|
const s = t[1].replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}|@\w+(\([^)]*\))?/g, " ");
|
|
@@ -944,7 +958,7 @@ function En(e) {
|
|
|
944
958
|
}
|
|
945
959
|
return [...l];
|
|
946
960
|
}
|
|
947
|
-
const
|
|
961
|
+
const Cn = [
|
|
948
962
|
{ key: "id", value: '""', info: "The variable the template gets, in snake_case." },
|
|
949
963
|
{ key: "type", value: '""', info: "A type from the registry." },
|
|
950
964
|
{ key: "label", value: '""', info: "What the editor sees above the field." },
|
|
@@ -956,32 +970,32 @@ const Tn = [
|
|
|
956
970
|
{ key: "slot", value: '""', info: "The parent's named slot to land in." },
|
|
957
971
|
{ key: "can", value: '""', info: "The permission the node needs." }
|
|
958
972
|
];
|
|
959
|
-
function
|
|
973
|
+
function Ln({ types: e }) {
|
|
960
974
|
return (l) => {
|
|
961
|
-
const t =
|
|
975
|
+
const t = An(l.state.doc.toString(), l.pos);
|
|
962
976
|
if (!t || !t.node) return null;
|
|
963
977
|
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
978
|
if (!t.string && s === "" && !l.explicit) return null;
|
|
965
979
|
const a = l.pos - s.length, i = t.string !== null;
|
|
966
980
|
if (t.phase === "key") {
|
|
967
|
-
const o =
|
|
968
|
-
({ key: r, value:
|
|
981
|
+
const o = Cn.filter(({ key: r }) => !t.keys.has(r) || r === s).map(
|
|
982
|
+
({ key: r, value: c, info: u }, p) => ({
|
|
969
983
|
label: r,
|
|
970
984
|
info: u,
|
|
971
985
|
type: "property",
|
|
972
986
|
boost: -p,
|
|
973
|
-
apply: (f, v, g, x) => Et(f, v, g, x, i, `"${r}": ${
|
|
987
|
+
apply: (f, v, g, x) => Et(f, v, g, x, i, `"${r}": ${c}`, c)
|
|
974
988
|
})
|
|
975
989
|
);
|
|
976
990
|
return { from: a, options: o, validFor: /^[\w-]*$/ };
|
|
977
991
|
}
|
|
978
992
|
if (t.phase === "value" && t.key === "type") {
|
|
979
|
-
const o = Object.entries(e()).map(([r,
|
|
993
|
+
const o = Object.entries(e()).map(([r, c]) => ({
|
|
980
994
|
label: r,
|
|
981
|
-
detail:
|
|
995
|
+
detail: c.kind,
|
|
982
996
|
type: "type",
|
|
983
997
|
// Fields first: a block's schema is mostly fields, the layout only groups them.
|
|
984
|
-
boost:
|
|
998
|
+
boost: c.kind === "field" ? 1 : 0,
|
|
985
999
|
apply: (u, p, f, v) => Et(u, p, f, v, i, `"${r}"`, "")
|
|
986
1000
|
}));
|
|
987
1001
|
return { from: a, options: o, validFor: /^[\w-]*$/ };
|
|
@@ -990,7 +1004,7 @@ function Cn({ types: e }) {
|
|
|
990
1004
|
};
|
|
991
1005
|
}
|
|
992
1006
|
function Et(e, l, t, s, a, i, o) {
|
|
993
|
-
const r = a ? t - 1 : t,
|
|
1007
|
+
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
1008
|
e.dispatch({
|
|
995
1009
|
changes: { from: r, to: u, insert: i },
|
|
996
1010
|
selection: { anchor: r + i.length - p },
|
|
@@ -998,7 +1012,7 @@ function Et(e, l, t, s, a, i, o) {
|
|
|
998
1012
|
userEvent: "input.complete"
|
|
999
1013
|
}), i.startsWith('"type"') && Bl(e);
|
|
1000
1014
|
}
|
|
1001
|
-
function
|
|
1015
|
+
function An(e, l) {
|
|
1002
1016
|
let t = null, s = null, a = null, i = !1;
|
|
1003
1017
|
const o = (r) => r?.kind === "object" && r.parent?.kind === "array" && (r.parent.parent === null || r.parent.under === "children");
|
|
1004
1018
|
for (let r = 0; r <= e.length && (r === l && (s = t?.kind === "object" ? {
|
|
@@ -1008,23 +1022,23 @@ function Ln(e, l) {
|
|
|
1008
1022
|
keys: t.keys,
|
|
1009
1023
|
string: a ? a.start + 1 : null
|
|
1010
1024
|
} : null), r !== e.length); r++) {
|
|
1011
|
-
const
|
|
1025
|
+
const c = e[r];
|
|
1012
1026
|
if (a) {
|
|
1013
1027
|
if (i) i = !1;
|
|
1014
|
-
else if (
|
|
1015
|
-
else if (
|
|
1028
|
+
else if (c === "\\") i = !0;
|
|
1029
|
+
else if (c === '"' || c === `
|
|
1016
1030
|
`) {
|
|
1017
1031
|
const u = e.slice(a.start + 1, r);
|
|
1018
1032
|
t?.kind === "object" && (a.key ? (t.keys.add(u), t.key = u, t.phase = "colon") : t.phase === "value" && (t.phase = "after")), a = null;
|
|
1019
1033
|
}
|
|
1020
1034
|
continue;
|
|
1021
1035
|
}
|
|
1022
|
-
if (!/\s/.test(
|
|
1023
|
-
if (
|
|
1036
|
+
if (!/\s/.test(c))
|
|
1037
|
+
if (c === '"')
|
|
1024
1038
|
a = { start: r, key: t?.kind === "object" && t.phase === "key" };
|
|
1025
|
-
else if (
|
|
1039
|
+
else if (c === "{" || c === "[") {
|
|
1026
1040
|
const u = {
|
|
1027
|
-
kind:
|
|
1041
|
+
kind: c === "{" ? "object" : "array",
|
|
1028
1042
|
parent: t,
|
|
1029
1043
|
under: t?.kind === "object" ? t.key : null,
|
|
1030
1044
|
keys: /* @__PURE__ */ new Set(),
|
|
@@ -1032,28 +1046,28 @@ function Ln(e, l) {
|
|
|
1032
1046
|
key: null
|
|
1033
1047
|
};
|
|
1034
1048
|
t?.kind === "object" && (t.phase = "after"), t = u;
|
|
1035
|
-
} else
|
|
1049
|
+
} 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
1050
|
}
|
|
1037
1051
|
return s;
|
|
1038
1052
|
}
|
|
1039
1053
|
function We(e) {
|
|
1040
1054
|
const l = [];
|
|
1041
1055
|
for (const t of e)
|
|
1042
|
-
!t || typeof t != "object" || (
|
|
1056
|
+
!t || typeof t != "object" || (Vn.has(t.type) ? l.push(...We(t.children ?? [])) : typeof t.id == "string" && t.id !== "" && l.push(t));
|
|
1043
1057
|
return l;
|
|
1044
1058
|
}
|
|
1045
1059
|
function el(e) {
|
|
1046
1060
|
return We(e).filter((l) => l.type !== "wx-blocks");
|
|
1047
1061
|
}
|
|
1048
|
-
const
|
|
1049
|
-
function
|
|
1062
|
+
const Vn = /* @__PURE__ */ new Set(["wx-card", "wx-tabs", "wx-tab", "wx-row", "wx-col", "wx-divider"]);
|
|
1063
|
+
function Bn(e) {
|
|
1050
1064
|
return e.replace(/[.*+?^${}()|[\]\\!]/g, "\\$&");
|
|
1051
1065
|
}
|
|
1052
|
-
const
|
|
1053
|
-
function
|
|
1066
|
+
const Wn = ["block", "entity", "loop", "__env", "errors", "app"];
|
|
1067
|
+
function Mn(e, l, t) {
|
|
1054
1068
|
const s = [];
|
|
1055
1069
|
/data-wx-block\s*=/.test(l.template) || s.push({ file: "template", code: "no-marker", line: null, message: t("checks.no-marker") });
|
|
1056
|
-
const a =
|
|
1070
|
+
const a = Nn(l.template, l.schema);
|
|
1057
1071
|
a.length > 0 && s.push({
|
|
1058
1072
|
file: "template",
|
|
1059
1073
|
code: "variables-missing",
|
|
@@ -1063,7 +1077,7 @@ function Wn(e, l, t) {
|
|
|
1063
1077
|
})
|
|
1064
1078
|
});
|
|
1065
1079
|
const i = [], o = [], r = `.b-${e}`;
|
|
1066
|
-
for (const [p, f] of
|
|
1080
|
+
for (const [p, f] of zn(l.styles))
|
|
1067
1081
|
p.startsWith(r) || p.startsWith("&") || (/^[a-z][a-z0-9-]*/i.test(p) ? o.push([p, f]) : i.push([p, f]));
|
|
1068
1082
|
i.length > 0 && s.push({
|
|
1069
1083
|
file: "styles",
|
|
@@ -1076,11 +1090,11 @@ function Wn(e, l, t) {
|
|
|
1076
1090
|
line: o[0][1],
|
|
1077
1091
|
message: t("checks.bare-selectors", { selectors: Tt(o) })
|
|
1078
1092
|
});
|
|
1079
|
-
const
|
|
1093
|
+
const c = ll(l.styles), u = /@media\b/.exec(c);
|
|
1080
1094
|
return u && s.push({
|
|
1081
1095
|
file: "styles",
|
|
1082
1096
|
code: "media-query",
|
|
1083
|
-
line: nl(
|
|
1097
|
+
line: nl(c, u.index),
|
|
1084
1098
|
message: t("checks.media-query")
|
|
1085
1099
|
}), s;
|
|
1086
1100
|
}
|
|
@@ -1090,8 +1104,8 @@ function tl(e) {
|
|
|
1090
1104
|
t.id && l.push(t.id), t.children && l.push(...tl(t.children));
|
|
1091
1105
|
return l;
|
|
1092
1106
|
}
|
|
1093
|
-
function
|
|
1094
|
-
const t = /* @__PURE__ */ new Set([...tl(l), ...
|
|
1107
|
+
function Nn(e, l) {
|
|
1108
|
+
const t = /* @__PURE__ */ new Set([...tl(l), ...Wn]);
|
|
1095
1109
|
for (const a of e.matchAll(/\bas\s+\$([a-zA-Z_]\w*)(?:\s*=>\s*\$([a-zA-Z_]\w*))?/g))
|
|
1096
1110
|
t.add(a[1]), a[2] && t.add(a[2]);
|
|
1097
1111
|
for (const a of e.matchAll(/\$([a-zA-Z_]\w*)\s*(?:=[^=]|\+\+|--|\.=|\+=|-=)/g))
|
|
@@ -1103,7 +1117,7 @@ function Mn(e, l) {
|
|
|
1103
1117
|
}
|
|
1104
1118
|
return s;
|
|
1105
1119
|
}
|
|
1106
|
-
function
|
|
1120
|
+
function zn(e) {
|
|
1107
1121
|
const l = ll(e), t = [];
|
|
1108
1122
|
for (const s of l.matchAll(/([^{};]+)\{/g)) {
|
|
1109
1123
|
const a = s[1], i = a.trim();
|
|
@@ -1140,24 +1154,24 @@ function Ne(e, l) {
|
|
|
1140
1154
|
const t = `groups.${e}`, s = l(t);
|
|
1141
1155
|
return s === t || s === `webx-blocks::${t}` ? e.charAt(0).toUpperCase() + e.slice(1) : s;
|
|
1142
1156
|
}
|
|
1143
|
-
const
|
|
1157
|
+
const Dn = { class: "wx-block-editor" }, In = { class: "wx-block-editor__split" }, On = {
|
|
1144
1158
|
type: "button",
|
|
1145
1159
|
class: "wx-block-editor__uses"
|
|
1146
|
-
},
|
|
1160
|
+
}, Pn = { class: "wx-block-editor__usage" }, Un = { class: "wx-block-editor__pane" }, Rn = {
|
|
1147
1161
|
key: 0,
|
|
1148
1162
|
class: "wx-block-editor__pills"
|
|
1149
|
-
},
|
|
1163
|
+
}, 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
1164
|
key: 0,
|
|
1151
1165
|
class: "is-wide wx-block-editor__danger"
|
|
1152
|
-
},
|
|
1166
|
+
}, Qn = /* @__PURE__ */ ae({
|
|
1153
1167
|
__name: "BlockEditorPage",
|
|
1154
1168
|
props: {
|
|
1155
1169
|
base: { default: "/blocks" }
|
|
1156
1170
|
},
|
|
1157
1171
|
setup(e) {
|
|
1158
1172
|
const l = e, t = je(), s = Me(t), a = vl(), i = Wt();
|
|
1159
|
-
|
|
1160
|
-
const o = de("webx-blocks"), r = Fe(),
|
|
1173
|
+
qe();
|
|
1174
|
+
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
1175
|
const B = t.state.manifest?.modules.find((k) => k.id === "blocks")?.meta;
|
|
1162
1176
|
return {
|
|
1163
1177
|
groups: B?.groups ?? [],
|
|
@@ -1181,24 +1195,24 @@ const zn = { class: "wx-block-editor" }, Dn = { class: "wx-block-editor__split"
|
|
|
1181
1195
|
styles: "",
|
|
1182
1196
|
script: null,
|
|
1183
1197
|
sample: {}
|
|
1184
|
-
}), R = I("[]"),
|
|
1198
|
+
}), R = I("[]"), K = I(null), Y = I(""), X = I({}), h = I(null), V = st({
|
|
1185
1199
|
html: "",
|
|
1186
1200
|
styles: "",
|
|
1187
1201
|
script: null,
|
|
1188
1202
|
runtime: null,
|
|
1189
1203
|
stage: null,
|
|
1190
1204
|
loading: !1
|
|
1191
|
-
}), O = L(() => JSON.stringify({ settings: y, content: _ })), J = L(() =>
|
|
1205
|
+
}), O = L(() => JSON.stringify({ settings: y, content: _ })), J = L(() => Y.value !== "" && O.value !== Y.value), Se = L(() => Mn(y.slug, _, o)), ne = {
|
|
1192
1206
|
template: [
|
|
1193
1207
|
at(
|
|
1194
|
-
|
|
1208
|
+
gn({ schema: () => _.schema, styles: () => _.styles })
|
|
1195
1209
|
)
|
|
1196
1210
|
],
|
|
1197
1211
|
styles: [
|
|
1198
|
-
at(
|
|
1212
|
+
at(En({ slug: () => y.slug, template: () => _.template }))
|
|
1199
1213
|
],
|
|
1200
1214
|
// The renderer's own types under the panel's, the same merge the sample form is drawn with.
|
|
1201
|
-
schema: [at(
|
|
1215
|
+
schema: [at(Ln({ types: () => ({ ...Je, ...t.types }) }))]
|
|
1202
1216
|
}, pe = L(() => {
|
|
1203
1217
|
const B = [...T.value.groups];
|
|
1204
1218
|
return B.includes(y.group) || B.push(y.group), B.map((k) => ({ value: k, label: Ne(k, o) }));
|
|
@@ -1234,12 +1248,12 @@ const zn = { class: "wx-block-editor" }, Dn = { class: "wx-block-editor__split"
|
|
|
1234
1248
|
script: null,
|
|
1235
1249
|
sample: {}
|
|
1236
1250
|
};
|
|
1237
|
-
Object.assign(_, be(k)), R.value = JSON.stringify(k.schema, null, 2),
|
|
1251
|
+
Object.assign(_, be(k)), R.value = JSON.stringify(k.schema, null, 2), K.value = null, Y.value = O.value;
|
|
1238
1252
|
}
|
|
1239
1253
|
async function ke() {
|
|
1240
1254
|
f.value = !0;
|
|
1241
1255
|
try {
|
|
1242
|
-
Q(await s.get(
|
|
1256
|
+
Q(await s.get(c.value)), p.value = await s.usage(c.value);
|
|
1243
1257
|
} catch (B) {
|
|
1244
1258
|
Z.danger(r(B));
|
|
1245
1259
|
} finally {
|
|
@@ -1251,9 +1265,9 @@ const zn = { class: "wx-block-editor" }, Dn = { class: "wx-block-editor__split"
|
|
|
1251
1265
|
try {
|
|
1252
1266
|
const k = JSON.parse(B);
|
|
1253
1267
|
if (!Array.isArray(k)) throw new Error("not a list");
|
|
1254
|
-
_.schema = k,
|
|
1268
|
+
_.schema = k, K.value = null;
|
|
1255
1269
|
} catch (k) {
|
|
1256
|
-
|
|
1270
|
+
K.value = o("page.schema-invalid", { error: k.message });
|
|
1257
1271
|
}
|
|
1258
1272
|
}
|
|
1259
1273
|
let ge, W = 0;
|
|
@@ -1312,7 +1326,7 @@ const zn = { class: "wx-block-editor" }, Dn = { class: "wx-block-editor__split"
|
|
|
1312
1326
|
allowed_in: y.allowed_in.length ? y.allowed_in : null,
|
|
1313
1327
|
description: y.description || null,
|
|
1314
1328
|
icon: y.icon || null,
|
|
1315
|
-
content:
|
|
1329
|
+
content: K.value ? { ..._, schema: void 0 } : _
|
|
1316
1330
|
});
|
|
1317
1331
|
Q(k), Z.success(
|
|
1318
1332
|
k.draft && k.draft.number !== B ? o("page.saved", { number: k.draft.number }) : o("page.unchanged")
|
|
@@ -1398,7 +1412,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1398
1412
|
ke(), window.addEventListener("beforeunload", ee);
|
|
1399
1413
|
}), Xe(() => {
|
|
1400
1414
|
clearTimeout(ge), window.removeEventListener("beforeunload", ee);
|
|
1401
|
-
}), te(
|
|
1415
|
+
}), te(c, () => {
|
|
1402
1416
|
ke();
|
|
1403
1417
|
});
|
|
1404
1418
|
const lt = L(
|
|
@@ -1418,14 +1432,14 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1418
1432
|
}
|
|
1419
1433
|
] : []
|
|
1420
1434
|
);
|
|
1421
|
-
return (B, k) => (
|
|
1422
|
-
f.value || !u.value ? (
|
|
1435
|
+
return (B, k) => (d(), C("div", Dn, [
|
|
1436
|
+
f.value || !u.value ? (d(), C(F, { key: 0 }, [
|
|
1423
1437
|
m(n(Be), {
|
|
1424
1438
|
class: "wx-block-editor__ghost-head",
|
|
1425
1439
|
title: "",
|
|
1426
1440
|
rows: 1
|
|
1427
1441
|
}),
|
|
1428
|
-
A("div",
|
|
1442
|
+
A("div", In, [
|
|
1429
1443
|
m(n(Ae), null, {
|
|
1430
1444
|
default: b(() => [
|
|
1431
1445
|
m(n(Be), { rows: 8 })
|
|
@@ -1439,7 +1453,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1439
1453
|
_: 1
|
|
1440
1454
|
})
|
|
1441
1455
|
])
|
|
1442
|
-
], 64)) : (
|
|
1456
|
+
], 64)) : (d(), C(F, { key: 1 }, [
|
|
1443
1457
|
m(n(bl), {
|
|
1444
1458
|
title: y.title,
|
|
1445
1459
|
back: e.base,
|
|
@@ -1447,13 +1461,13 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1447
1461
|
actions: lt.value
|
|
1448
1462
|
}, {
|
|
1449
1463
|
"title-after": b(() => [
|
|
1450
|
-
w.value ? (
|
|
1464
|
+
w.value ? (d(), z(n(gl), {
|
|
1451
1465
|
key: 0,
|
|
1452
1466
|
name: y.title,
|
|
1453
1467
|
placeholder: n(o)("page.title"),
|
|
1454
1468
|
onRename: k[0] || (k[0] = (E) => y.title = E)
|
|
1455
1469
|
}, null, 8, ["name", "placeholder"])) : D("", !0),
|
|
1456
|
-
J.value ? (
|
|
1470
|
+
J.value ? (d(), z(n(ue), {
|
|
1457
1471
|
key: 1,
|
|
1458
1472
|
type: "primary",
|
|
1459
1473
|
dot: ""
|
|
@@ -1463,7 +1477,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1463
1477
|
]),
|
|
1464
1478
|
_: 1
|
|
1465
1479
|
})) : D("", !0),
|
|
1466
|
-
u.value.draft ? (
|
|
1480
|
+
u.value.draft ? (d(), z(n(ue), {
|
|
1467
1481
|
key: 2,
|
|
1468
1482
|
type: "warning",
|
|
1469
1483
|
dot: ""
|
|
@@ -1473,7 +1487,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1473
1487
|
]),
|
|
1474
1488
|
_: 1
|
|
1475
1489
|
})) : D("", !0),
|
|
1476
|
-
u.value.published ? (
|
|
1490
|
+
u.value.published ? (d(), z(n(ue), {
|
|
1477
1491
|
key: 3,
|
|
1478
1492
|
type: "success",
|
|
1479
1493
|
dot: ""
|
|
@@ -1482,7 +1496,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1482
1496
|
M(S(n(o)("page.live", { number: u.value.published.number })), 1)
|
|
1483
1497
|
]),
|
|
1484
1498
|
_: 1
|
|
1485
|
-
})) : (
|
|
1499
|
+
})) : (d(), z(n(ue), {
|
|
1486
1500
|
key: 4,
|
|
1487
1501
|
type: "default"
|
|
1488
1502
|
}, {
|
|
@@ -1495,23 +1509,23 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1495
1509
|
subtitle: b(() => [
|
|
1496
1510
|
A("code", null, S(y.slug), 1),
|
|
1497
1511
|
M(" · " + S(n(Ne)(y.group, n(o))) + " · ", 1),
|
|
1498
|
-
u.value.usage_count > 0 ? (
|
|
1512
|
+
u.value.usage_count > 0 ? (d(), z(n(_l), {
|
|
1499
1513
|
key: 0,
|
|
1500
1514
|
title: n(o)("page.usage"),
|
|
1501
1515
|
width: 260,
|
|
1502
1516
|
align: "start"
|
|
1503
1517
|
}, {
|
|
1504
1518
|
trigger: b(() => [
|
|
1505
|
-
A("button",
|
|
1519
|
+
A("button", On, S(n(ct)(u.value.usage_count, n(o))), 1)
|
|
1506
1520
|
]),
|
|
1507
1521
|
default: b(() => [
|
|
1508
|
-
A("div",
|
|
1509
|
-
(
|
|
1522
|
+
A("div", Pn, [
|
|
1523
|
+
(d(!0), C(F, null, le(U.value, (E) => (d(), C("div", {
|
|
1510
1524
|
key: `${E.model}:${E.id}`,
|
|
1511
1525
|
class: "wx-block-editor__use"
|
|
1512
1526
|
}, [
|
|
1513
1527
|
A("span", null, S(E.title ?? `#${E.id}`), 1),
|
|
1514
|
-
E.published ? D("", !0) : (
|
|
1528
|
+
E.published ? D("", !0) : (d(), z(n(ue), {
|
|
1515
1529
|
key: 0,
|
|
1516
1530
|
type: "warning",
|
|
1517
1531
|
size: "sm"
|
|
@@ -1522,7 +1536,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1522
1536
|
_: 1
|
|
1523
1537
|
}))
|
|
1524
1538
|
]))), 128)),
|
|
1525
|
-
p.value.length > U.value.length ? (
|
|
1539
|
+
p.value.length > U.value.length ? (d(), z(n(q), {
|
|
1526
1540
|
key: 0,
|
|
1527
1541
|
size: "sm",
|
|
1528
1542
|
tone: "muted"
|
|
@@ -1535,13 +1549,13 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1535
1549
|
])
|
|
1536
1550
|
]),
|
|
1537
1551
|
_: 1
|
|
1538
|
-
}, 8, ["title"])) : (
|
|
1552
|
+
}, 8, ["title"])) : (d(), C(F, { key: 1 }, [
|
|
1539
1553
|
M(S(n(ct)(u.value.usage_count, n(o))), 1)
|
|
1540
1554
|
], 64))
|
|
1541
1555
|
]),
|
|
1542
1556
|
_: 1
|
|
1543
1557
|
}, 8, ["title", "back", "back-label", "actions"]),
|
|
1544
|
-
T.value.editing ? D("", !0) : (
|
|
1558
|
+
T.value.editing ? D("", !0) : (d(), z(n(zt), {
|
|
1545
1559
|
key: 0,
|
|
1546
1560
|
type: "info",
|
|
1547
1561
|
variant: "soft",
|
|
@@ -1561,8 +1575,8 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1561
1575
|
label: n(o)("page.tab-template")
|
|
1562
1576
|
}, {
|
|
1563
1577
|
default: b(() => [
|
|
1564
|
-
A("div",
|
|
1565
|
-
m(n(
|
|
1578
|
+
A("div", Un, [
|
|
1579
|
+
m(n(Ke), {
|
|
1566
1580
|
ref_key: "templateEditor",
|
|
1567
1581
|
ref: G,
|
|
1568
1582
|
modelValue: _.template,
|
|
@@ -1574,8 +1588,8 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1574
1588
|
"max-height": "70vh",
|
|
1575
1589
|
"line-wrapping": ""
|
|
1576
1590
|
}, null, 8, ["modelValue", "extensions", "readonly"]),
|
|
1577
|
-
Ee.value.length ? (
|
|
1578
|
-
m(n(
|
|
1591
|
+
Ee.value.length ? (d(), C("div", Rn, [
|
|
1592
|
+
m(n(q), {
|
|
1579
1593
|
size: "sm",
|
|
1580
1594
|
tone: "muted"
|
|
1581
1595
|
}, {
|
|
@@ -1584,14 +1598,14 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1584
1598
|
]),
|
|
1585
1599
|
_: 1
|
|
1586
1600
|
}),
|
|
1587
|
-
(
|
|
1601
|
+
(d(!0), C(F, null, le(Ee.value, (E) => (d(), C("button", {
|
|
1588
1602
|
key: E,
|
|
1589
1603
|
type: "button",
|
|
1590
1604
|
class: "wx-block-editor__pill",
|
|
1591
1605
|
disabled: !w.value,
|
|
1592
1606
|
onClick: (nt) => we(E),
|
|
1593
1607
|
textContent: S(fe(E))
|
|
1594
|
-
}, null, 8,
|
|
1608
|
+
}, null, 8, jn))), 128))
|
|
1595
1609
|
])) : D("", !0),
|
|
1596
1610
|
m(kt, {
|
|
1597
1611
|
file: "template",
|
|
@@ -1608,8 +1622,8 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1608
1622
|
label: n(o)("page.tab-styles")
|
|
1609
1623
|
}, {
|
|
1610
1624
|
default: b(() => [
|
|
1611
|
-
A("div",
|
|
1612
|
-
m(n(
|
|
1625
|
+
A("div", Fn, [
|
|
1626
|
+
m(n(Ke), {
|
|
1613
1627
|
modelValue: _.styles,
|
|
1614
1628
|
"onUpdate:modelValue": k[2] || (k[2] = (E) => _.styles = E),
|
|
1615
1629
|
language: "css",
|
|
@@ -1632,8 +1646,8 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1632
1646
|
label: n(o)("page.tab-script")
|
|
1633
1647
|
}, {
|
|
1634
1648
|
default: b(() => [
|
|
1635
|
-
A("div",
|
|
1636
|
-
m(n(
|
|
1649
|
+
A("div", Hn, [
|
|
1650
|
+
m(n(Ke), {
|
|
1637
1651
|
"model-value": _.script ?? "",
|
|
1638
1652
|
language: "javascript",
|
|
1639
1653
|
readonly: !w.value,
|
|
@@ -1641,8 +1655,8 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1641
1655
|
"max-height": "70vh",
|
|
1642
1656
|
"onUpdate:modelValue": k[3] || (k[3] = (E) => _.script = E || null)
|
|
1643
1657
|
}, null, 8, ["model-value", "readonly"]),
|
|
1644
|
-
A("div",
|
|
1645
|
-
m(n(
|
|
1658
|
+
A("div", qn, [
|
|
1659
|
+
m(n(q), {
|
|
1646
1660
|
size: "sm",
|
|
1647
1661
|
tone: "muted"
|
|
1648
1662
|
}, {
|
|
@@ -1651,7 +1665,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1651
1665
|
]),
|
|
1652
1666
|
_: 1
|
|
1653
1667
|
}),
|
|
1654
|
-
m(n(
|
|
1668
|
+
m(n(q), {
|
|
1655
1669
|
size: "sm",
|
|
1656
1670
|
tone: "muted"
|
|
1657
1671
|
}, {
|
|
@@ -1667,11 +1681,11 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1667
1681
|
title: n(o)("page.examples")
|
|
1668
1682
|
}, {
|
|
1669
1683
|
default: b(() => [
|
|
1670
|
-
(
|
|
1684
|
+
(d(!0), C(F, null, le(N.value, (E) => (d(), C("div", {
|
|
1671
1685
|
key: E.title,
|
|
1672
1686
|
class: "wx-block-editor__example"
|
|
1673
1687
|
}, [
|
|
1674
|
-
m(n(
|
|
1688
|
+
m(n(q), {
|
|
1675
1689
|
size: "sm",
|
|
1676
1690
|
tone: "muted"
|
|
1677
1691
|
}, {
|
|
@@ -1697,7 +1711,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1697
1711
|
default: b(() => [
|
|
1698
1712
|
A("div", Kn, [
|
|
1699
1713
|
A("div", Yn, [
|
|
1700
|
-
m(n(
|
|
1714
|
+
m(n(Ke), {
|
|
1701
1715
|
"model-value": R.value,
|
|
1702
1716
|
language: "json",
|
|
1703
1717
|
extensions: ne.schema,
|
|
@@ -1707,17 +1721,17 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1707
1721
|
"max-height": "70vh",
|
|
1708
1722
|
"onUpdate:modelValue": Ce
|
|
1709
1723
|
}, null, 8, ["model-value", "extensions", "readonly"]),
|
|
1710
|
-
A("div",
|
|
1711
|
-
|
|
1724
|
+
A("div", Jn, [
|
|
1725
|
+
K.value ? (d(), z(n(q), {
|
|
1712
1726
|
key: 0,
|
|
1713
1727
|
size: "sm",
|
|
1714
1728
|
tone: "danger"
|
|
1715
1729
|
}, {
|
|
1716
1730
|
default: b(() => [
|
|
1717
|
-
M(S(
|
|
1731
|
+
M(S(K.value), 1)
|
|
1718
1732
|
]),
|
|
1719
1733
|
_: 1
|
|
1720
|
-
})) : H("content.schema") ? (
|
|
1734
|
+
})) : H("content.schema") ? (d(), z(n(q), {
|
|
1721
1735
|
key: 1,
|
|
1722
1736
|
size: "sm",
|
|
1723
1737
|
tone: "danger"
|
|
@@ -1726,7 +1740,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1726
1740
|
M(S(H("content.schema")), 1)
|
|
1727
1741
|
]),
|
|
1728
1742
|
_: 1
|
|
1729
|
-
})) : (
|
|
1743
|
+
})) : (d(), z(n(q), {
|
|
1730
1744
|
key: 2,
|
|
1731
1745
|
size: "sm",
|
|
1732
1746
|
tone: "muted"
|
|
@@ -1747,7 +1761,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1747
1761
|
title: n(o)("page.sample")
|
|
1748
1762
|
}, {
|
|
1749
1763
|
default: b(() => [
|
|
1750
|
-
_.schema.length ? (
|
|
1764
|
+
_.schema.length ? (d(), z(n(Rt), {
|
|
1751
1765
|
key: 0,
|
|
1752
1766
|
modelValue: ye.value,
|
|
1753
1767
|
"onUpdate:modelValue": k[4] || (k[4] = (E) => ye.value = E),
|
|
@@ -1772,7 +1786,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1772
1786
|
default: b(() => [
|
|
1773
1787
|
m(n(Ae), { class: "wx-block-editor__sheet" }, {
|
|
1774
1788
|
default: b(() => [
|
|
1775
|
-
A("div",
|
|
1789
|
+
A("div", Gn, [
|
|
1776
1790
|
m(n(oe), {
|
|
1777
1791
|
label: n(o)("page.identifier"),
|
|
1778
1792
|
help: n(o)("page.identifier-help"),
|
|
@@ -1909,7 +1923,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1909
1923
|
]),
|
|
1910
1924
|
_: 1
|
|
1911
1925
|
}, 8, ["label", "help", "disabled"]),
|
|
1912
|
-
w.value ? (
|
|
1926
|
+
w.value ? (d(), C("div", Zn, [
|
|
1913
1927
|
m(n(ce), {
|
|
1914
1928
|
type: "danger",
|
|
1915
1929
|
variant: "outline",
|
|
@@ -1921,7 +1935,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1921
1935
|
]),
|
|
1922
1936
|
_: 1
|
|
1923
1937
|
}, 8, ["disabled"]),
|
|
1924
|
-
u.value.usage_count > 0 ? (
|
|
1938
|
+
u.value.usage_count > 0 ? (d(), z(n(q), {
|
|
1925
1939
|
key: 0,
|
|
1926
1940
|
size: "sm",
|
|
1927
1941
|
tone: "muted"
|
|
@@ -1975,7 +1989,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
1975
1989
|
[il, $.value]
|
|
1976
1990
|
])
|
|
1977
1991
|
], 2),
|
|
1978
|
-
w.value ? (
|
|
1992
|
+
w.value ? (d(), z(n(Tl), { key: 1 }, {
|
|
1979
1993
|
default: b(() => [
|
|
1980
1994
|
m(n(ce), {
|
|
1981
1995
|
variant: "outline",
|
|
@@ -2004,27 +2018,27 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
|
|
|
2004
2018
|
], 64))
|
|
2005
2019
|
]));
|
|
2006
2020
|
}
|
|
2007
|
-
}),
|
|
2008
|
-
function
|
|
2021
|
+
}), Xn = /* @__PURE__ */ ie(Qn, [["__scopeId", "data-v-22e5f784"]]), Ct = /* @__PURE__ */ new Map();
|
|
2022
|
+
function es(e) {
|
|
2009
2023
|
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 :
|
|
2024
|
+
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
2025
|
}
|
|
2012
|
-
function
|
|
2026
|
+
function ts() {
|
|
2013
2027
|
const e = De(Mt, null), l = I(null), t = L(() => {
|
|
2014
2028
|
const a = e?.state.manifest?.modules.find((i) => i.id === "blocks")?.meta?.stage;
|
|
2015
2029
|
return typeof a == "string" && a !== "" ? a : null;
|
|
2016
2030
|
});
|
|
2017
2031
|
return rl(() => {
|
|
2018
2032
|
const s = t.value;
|
|
2019
|
-
s !== null &&
|
|
2033
|
+
s !== null && es(s).then((a) => {
|
|
2020
2034
|
t.value === s && (l.value = a);
|
|
2021
2035
|
});
|
|
2022
2036
|
}), l;
|
|
2023
2037
|
}
|
|
2024
|
-
const
|
|
2038
|
+
const ls = ["srcdoc"], ns = {
|
|
2025
2039
|
key: 1,
|
|
2026
2040
|
class: "wx-block-thumb__empty"
|
|
2027
|
-
},
|
|
2041
|
+
}, ss = /* @__PURE__ */ ae({
|
|
2028
2042
|
__name: "BlockThumb",
|
|
2029
2043
|
props: {
|
|
2030
2044
|
thumbnail: {},
|
|
@@ -2032,22 +2046,22 @@ const ts = ["srcdoc"], ls = {
|
|
|
2032
2046
|
height: { default: 120 }
|
|
2033
2047
|
},
|
|
2034
2048
|
setup(e) {
|
|
2035
|
-
const l = e, t = I(null), s = et(t), a = L(() => s.value > 0 ? s.value / l.width : 0.2), i =
|
|
2049
|
+
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
2050
|
if (!l.thumbnail) return "";
|
|
2037
|
-
const
|
|
2038
|
-
return i.value ?
|
|
2051
|
+
const c = { html: l.thumbnail.html, styles: l.thumbnail.styles };
|
|
2052
|
+
return i.value ? Kl(i.value, c) : Ht(c);
|
|
2039
2053
|
}), r = L(() => ({
|
|
2040
2054
|
width: `${l.width}px`,
|
|
2041
2055
|
height: `${Math.round(l.height / a.value)}px`,
|
|
2042
2056
|
transform: `scale(${a.value})`
|
|
2043
2057
|
}));
|
|
2044
|
-
return (
|
|
2058
|
+
return (c, u) => (d(), C("div", {
|
|
2045
2059
|
ref_key: "box",
|
|
2046
2060
|
ref: t,
|
|
2047
2061
|
class: "wx-block-thumb",
|
|
2048
2062
|
style: xe({ height: `${e.height}px` })
|
|
2049
2063
|
}, [
|
|
2050
|
-
e.thumbnail ? (
|
|
2064
|
+
e.thumbnail ? (d(), C("iframe", {
|
|
2051
2065
|
key: 0,
|
|
2052
2066
|
class: "wx-block-thumb__frame",
|
|
2053
2067
|
srcdoc: o.value,
|
|
@@ -2055,15 +2069,15 @@ const ts = ["srcdoc"], ls = {
|
|
|
2055
2069
|
sandbox: "allow-same-origin",
|
|
2056
2070
|
tabindex: "-1",
|
|
2057
2071
|
"aria-hidden": "true"
|
|
2058
|
-
}, null, 12,
|
|
2072
|
+
}, null, 12, ls)) : (d(), C("div", ns, [
|
|
2059
2073
|
m(n(he), { name: "grid" })
|
|
2060
2074
|
]))
|
|
2061
2075
|
], 4));
|
|
2062
2076
|
}
|
|
2063
|
-
}), sl = /* @__PURE__ */ ie(
|
|
2077
|
+
}), sl = /* @__PURE__ */ ie(ss, [["__scopeId", "data-v-5ca74656"]]), os = { class: "wx-block-picker" }, as = {
|
|
2064
2078
|
key: 0,
|
|
2065
2079
|
class: "wx-block-picker__group-title"
|
|
2066
|
-
},
|
|
2080
|
+
}, 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
2081
|
__name: "BlockPicker",
|
|
2068
2082
|
props: {
|
|
2069
2083
|
catalog: {},
|
|
@@ -2075,7 +2089,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2075
2089
|
},
|
|
2076
2090
|
setup(e) {
|
|
2077
2091
|
const l = e, { resolve: t, dismiss: s, open: a } = It();
|
|
2078
|
-
|
|
2092
|
+
qe();
|
|
2079
2093
|
const i = de("webx-blocks"), o = I("");
|
|
2080
2094
|
function r(v) {
|
|
2081
2095
|
if (l.parent === null)
|
|
@@ -2083,14 +2097,14 @@ const ts = ["srcdoc"], ls = {
|
|
|
2083
2097
|
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
2098
|
return g && x;
|
|
2085
2099
|
}
|
|
2086
|
-
const
|
|
2100
|
+
const c = L(
|
|
2087
2101
|
() => l.catalog.filter((v) => v.is_enabled && v.published !== null && r(v)).map((v) => {
|
|
2088
2102
|
const g = tn(l.tree, v.slug), x = v.max_per_entity !== null && g >= v.max_per_entity;
|
|
2089
2103
|
return { type: v, reason: x ? i("field.limit-reached", { count: g }) : null };
|
|
2090
2104
|
})
|
|
2091
2105
|
), u = L(() => {
|
|
2092
2106
|
const v = o.value.trim().toLowerCase();
|
|
2093
|
-
return v === "" ?
|
|
2107
|
+
return v === "" ? c.value : c.value.filter(
|
|
2094
2108
|
({ type: g }) => g.title.toLowerCase().includes(v) || g.slug.includes(v) || (g.description ?? "").toLowerCase().includes(v)
|
|
2095
2109
|
);
|
|
2096
2110
|
}), p = L(() => {
|
|
@@ -2105,7 +2119,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2105
2119
|
return u.value.length <= 5 || o.value.trim() !== "" || g.length < 2 ? [{ id: "", label: "", options: u.value }] : g;
|
|
2106
2120
|
}), f = L(() => {
|
|
2107
2121
|
if (l.catalog.length === 0) return i("field.pick-none");
|
|
2108
|
-
if (
|
|
2122
|
+
if (c.value.length === 0 && l.parent) {
|
|
2109
2123
|
const v = (l.allow ?? l.parent.allow ?? []).filter(
|
|
2110
2124
|
(g) => l.catalog.some((x) => x.slug === g)
|
|
2111
2125
|
);
|
|
@@ -2115,7 +2129,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2115
2129
|
});
|
|
2116
2130
|
return (v, g) => {
|
|
2117
2131
|
const x = At("router-link");
|
|
2118
|
-
return
|
|
2132
|
+
return d(), z(n(Ot), {
|
|
2119
2133
|
open: n(a),
|
|
2120
2134
|
"onUpdate:open": g[2] || (g[2] = (T) => Vt(a) ? a.value = T : null),
|
|
2121
2135
|
title: n(i)("field.pick"),
|
|
@@ -2133,8 +2147,8 @@ const ts = ["srcdoc"], ls = {
|
|
|
2133
2147
|
})
|
|
2134
2148
|
]),
|
|
2135
2149
|
default: b(() => [
|
|
2136
|
-
A("div",
|
|
2137
|
-
|
|
2150
|
+
A("div", os, [
|
|
2151
|
+
c.value.length > 0 ? (d(), z(n(Ue), {
|
|
2138
2152
|
key: 0,
|
|
2139
2153
|
modelValue: o.value,
|
|
2140
2154
|
"onUpdate:modelValue": g[0] || (g[0] = (T) => o.value = T),
|
|
@@ -2142,14 +2156,14 @@ const ts = ["srcdoc"], ls = {
|
|
|
2142
2156
|
clearable: "",
|
|
2143
2157
|
autofocus: ""
|
|
2144
2158
|
}, null, 8, ["modelValue", "placeholder"])) : D("", !0),
|
|
2145
|
-
u.value.length === 0 ? (
|
|
2159
|
+
u.value.length === 0 ? (d(), z(n(Pt), {
|
|
2146
2160
|
key: 1,
|
|
2147
2161
|
icon: "grid",
|
|
2148
2162
|
title: f.value,
|
|
2149
2163
|
size: "sm"
|
|
2150
2164
|
}, {
|
|
2151
2165
|
default: b(() => [
|
|
2152
|
-
e.catalog.length === 0 && e.blocksPath ? (
|
|
2166
|
+
e.catalog.length === 0 && e.blocksPath ? (d(), z(x, {
|
|
2153
2167
|
key: 0,
|
|
2154
2168
|
to: e.blocksPath
|
|
2155
2169
|
}, {
|
|
@@ -2161,13 +2175,13 @@ const ts = ["srcdoc"], ls = {
|
|
|
2161
2175
|
]),
|
|
2162
2176
|
_: 1
|
|
2163
2177
|
}, 8, ["title"])) : D("", !0),
|
|
2164
|
-
(
|
|
2178
|
+
(d(!0), C(F, null, le(p.value, (T) => (d(), C("section", {
|
|
2165
2179
|
key: T.id,
|
|
2166
2180
|
class: "wx-block-picker__group"
|
|
2167
2181
|
}, [
|
|
2168
|
-
T.label ? (
|
|
2169
|
-
A("div",
|
|
2170
|
-
(
|
|
2182
|
+
T.label ? (d(), C("div", as, S(T.label), 1)) : D("", !0),
|
|
2183
|
+
A("div", is, [
|
|
2184
|
+
(d(!0), C(F, null, le(T.options, (w) => (d(), C("button", {
|
|
2171
2185
|
key: w.type.id,
|
|
2172
2186
|
type: "button",
|
|
2173
2187
|
class: $e(["wx-block-picker__card", { "is-disabled": w.reason !== null }]),
|
|
@@ -2179,9 +2193,9 @@ const ts = ["srcdoc"], ls = {
|
|
|
2179
2193
|
thumbnail: w.type.thumbnail,
|
|
2180
2194
|
height: 96
|
|
2181
2195
|
}, null, 8, ["thumbnail"]),
|
|
2182
|
-
A("div",
|
|
2183
|
-
A("div",
|
|
2184
|
-
w.reason ? (
|
|
2196
|
+
A("div", us, [
|
|
2197
|
+
A("div", cs, S(w.type.title), 1),
|
|
2198
|
+
w.reason ? (d(), z(n(q), {
|
|
2185
2199
|
key: 0,
|
|
2186
2200
|
size: "sm",
|
|
2187
2201
|
tone: "warning"
|
|
@@ -2190,7 +2204,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2190
2204
|
M(S(w.reason), 1)
|
|
2191
2205
|
]),
|
|
2192
2206
|
_: 2
|
|
2193
|
-
}, 1024)) : w.type.description ? (
|
|
2207
|
+
}, 1024)) : w.type.description ? (d(), z(n(q), {
|
|
2194
2208
|
key: 1,
|
|
2195
2209
|
size: "sm",
|
|
2196
2210
|
tone: "muted"
|
|
@@ -2201,7 +2215,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2201
2215
|
_: 2
|
|
2202
2216
|
}, 1024)) : D("", !0)
|
|
2203
2217
|
])
|
|
2204
|
-
], 10,
|
|
2218
|
+
], 10, rs))), 128))
|
|
2205
2219
|
])
|
|
2206
2220
|
]))), 128))
|
|
2207
2221
|
])
|
|
@@ -2210,7 +2224,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2210
2224
|
}, 8, ["open", "title"]);
|
|
2211
2225
|
};
|
|
2212
2226
|
}
|
|
2213
|
-
}),
|
|
2227
|
+
}), ps = /* @__PURE__ */ ie(ds, [["__scopeId", "data-v-99f4090e"]]), fs = { class: "wx-blocks-preview__tools" }, ms = ["src", "title"], vs = /* @__PURE__ */ ae({
|
|
2214
2228
|
__name: "BlocksPreview",
|
|
2215
2229
|
props: {
|
|
2216
2230
|
url: {},
|
|
@@ -2220,7 +2234,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2220
2234
|
},
|
|
2221
2235
|
emits: ["select", "edit"],
|
|
2222
2236
|
setup(e, { expose: l, emit: t }) {
|
|
2223
|
-
const s = e, a = t, i = de("webx-blocks"), o = I(null), r = I(null),
|
|
2237
|
+
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
2238
|
{ value: 1280, icon: "monitor", ariaLabel: i("field.width-desktop") },
|
|
2225
2239
|
{ value: 834, icon: "tablet", ariaLabel: i("field.width-tablet") },
|
|
2226
2240
|
{ value: 390, icon: "smartphone", ariaLabel: i("field.width-phone") }
|
|
@@ -2231,7 +2245,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2231
2245
|
})), R = L(() => ({
|
|
2232
2246
|
width: `${Math.round(w.value * y.value)}px`,
|
|
2233
2247
|
...x.value ? { height: `${Math.round(g.value * y.value)}px` } : {}
|
|
2234
|
-
})),
|
|
2248
|
+
})), K = L(() => {
|
|
2235
2249
|
if (!s.url) return "";
|
|
2236
2250
|
try {
|
|
2237
2251
|
return `${new URL(s.url, location.origin).pathname} · ${w.value} px`;
|
|
@@ -2239,7 +2253,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2239
2253
|
return s.url;
|
|
2240
2254
|
}
|
|
2241
2255
|
});
|
|
2242
|
-
function
|
|
2256
|
+
function Y() {
|
|
2243
2257
|
try {
|
|
2244
2258
|
return o.value?.contentDocument ?? null;
|
|
2245
2259
|
} catch {
|
|
@@ -2251,7 +2265,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2251
2265
|
W.documentElement.scrollTop !== 0 && (W.documentElement.scrollTop = 0);
|
|
2252
2266
|
}
|
|
2253
2267
|
function O() {
|
|
2254
|
-
const W =
|
|
2268
|
+
const W = Y(), P = W?.body;
|
|
2255
2269
|
if (!P || !W?.defaultView) return;
|
|
2256
2270
|
V(W);
|
|
2257
2271
|
const j = W.defaultView.getComputedStyle(P), G = (parseFloat(j.marginTop) || 0) + (parseFloat(j.marginBottom) || 0), fe = Math.ceil(P.scrollHeight + G);
|
|
@@ -2264,7 +2278,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2264
2278
|
}
|
|
2265
2279
|
function Se() {
|
|
2266
2280
|
f.value = !0;
|
|
2267
|
-
const W =
|
|
2281
|
+
const W = Y();
|
|
2268
2282
|
W && (J(W), X?.release(), X = Rl(W, {
|
|
2269
2283
|
/* No guard against answering a click with a scroll: `bring` moves nothing that is already
|
|
2270
2284
|
readable, and a block clicked at the very bottom of the window, half under the action
|
|
@@ -2295,7 +2309,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2295
2309
|
return null;
|
|
2296
2310
|
}
|
|
2297
2311
|
function Q() {
|
|
2298
|
-
const W =
|
|
2312
|
+
const W = Y();
|
|
2299
2313
|
if (ne === null || !W) return;
|
|
2300
2314
|
V(W);
|
|
2301
2315
|
const P = pt(W, ne), j = P ? Ee(P) : null;
|
|
@@ -2307,7 +2321,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2307
2321
|
$ !== 0 && (G ?? window).scrollBy({ top: $, behavior: "smooth" });
|
|
2308
2322
|
}
|
|
2309
2323
|
function ke(W, P) {
|
|
2310
|
-
const j =
|
|
2324
|
+
const j = Y();
|
|
2311
2325
|
if (!j || !f.value) return !1;
|
|
2312
2326
|
const G = Ft(j, W, P);
|
|
2313
2327
|
return G && ot(j, s.selected ?? null), G;
|
|
@@ -2321,7 +2335,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2321
2335
|
return te(
|
|
2322
2336
|
() => s.selected,
|
|
2323
2337
|
(W) => {
|
|
2324
|
-
const P =
|
|
2338
|
+
const P = Y();
|
|
2325
2339
|
!P || !f.value || (ot(P, W ?? null), ye(W ?? null));
|
|
2326
2340
|
}
|
|
2327
2341
|
), te(() => s.reload, Ce), te(
|
|
@@ -2329,7 +2343,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2329
2343
|
() => f.value = !1
|
|
2330
2344
|
), Re(() => window.addEventListener("keydown", ge)), Xe(() => {
|
|
2331
2345
|
window.removeEventListener("keydown", ge), pe !== null && clearTimeout(pe), h?.disconnect(), X?.release();
|
|
2332
|
-
}), l({ replace: ke, refresh: Ce, open: () => p.value = !0 }), (W, P) => (
|
|
2346
|
+
}), l({ replace: ke, refresh: Ce, open: () => p.value = !0 }), (W, P) => (d(), C("div", {
|
|
2333
2347
|
class: $e(["wx-blocks-preview", { "is-fullscreen": p.value, "is-grown": x.value, "is-compact": e.compact }]),
|
|
2334
2348
|
style: xe({ "--wx-preview-scale": y.value })
|
|
2335
2349
|
}, [
|
|
@@ -2338,14 +2352,14 @@ const ts = ["srcdoc"], ls = {
|
|
|
2338
2352
|
ref: r,
|
|
2339
2353
|
class: "wx-blocks-preview__bar"
|
|
2340
2354
|
}, [
|
|
2341
|
-
m(n(
|
|
2355
|
+
m(n(q), {
|
|
2342
2356
|
size: "xs",
|
|
2343
2357
|
tone: "muted",
|
|
2344
2358
|
class: "wx-blocks-preview__label",
|
|
2345
2359
|
truncate: ""
|
|
2346
2360
|
}, {
|
|
2347
2361
|
default: b(() => [
|
|
2348
|
-
M(S(
|
|
2362
|
+
M(S(K.value), 1)
|
|
2349
2363
|
]),
|
|
2350
2364
|
_: 1
|
|
2351
2365
|
}),
|
|
@@ -2357,8 +2371,8 @@ const ts = ["srcdoc"], ls = {
|
|
|
2357
2371
|
"aria-label": n(i)("field.width"),
|
|
2358
2372
|
"onUpdate:modelValue": P[0] || (P[0] = (j) => v.value = Number(j))
|
|
2359
2373
|
}, null, 8, ["model-value", "options", "aria-label"]),
|
|
2360
|
-
A("div",
|
|
2361
|
-
e.compact ? (
|
|
2374
|
+
A("div", fs, [
|
|
2375
|
+
e.compact ? (d(), z(n(Ie), {
|
|
2362
2376
|
key: 0,
|
|
2363
2377
|
size: "sm",
|
|
2364
2378
|
tone: "primary",
|
|
@@ -2366,7 +2380,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2366
2380
|
title: n(i)("field.blocks"),
|
|
2367
2381
|
onClick: P[1] || (P[1] = (j) => a("edit"))
|
|
2368
2382
|
}, null, 8, ["title"])) : D("", !0),
|
|
2369
|
-
e.url ? (
|
|
2383
|
+
e.url ? (d(), z(n(Ie), {
|
|
2370
2384
|
key: 1,
|
|
2371
2385
|
size: "sm",
|
|
2372
2386
|
icon: "external-link",
|
|
@@ -2387,14 +2401,14 @@ const ts = ["srcdoc"], ls = {
|
|
|
2387
2401
|
], 512),
|
|
2388
2402
|
A("div", {
|
|
2389
2403
|
ref_key: "box",
|
|
2390
|
-
ref:
|
|
2404
|
+
ref: c,
|
|
2391
2405
|
class: "wx-blocks-preview__ground"
|
|
2392
2406
|
}, [
|
|
2393
2407
|
A("div", {
|
|
2394
2408
|
class: "wx-blocks-preview__clip",
|
|
2395
2409
|
style: xe(R.value)
|
|
2396
2410
|
}, [
|
|
2397
|
-
e.url ? (
|
|
2411
|
+
e.url ? (d(), C("iframe", {
|
|
2398
2412
|
key: 0,
|
|
2399
2413
|
ref_key: "frame",
|
|
2400
2414
|
ref: o,
|
|
@@ -2403,15 +2417,15 @@ const ts = ["srcdoc"], ls = {
|
|
|
2403
2417
|
style: xe(_.value),
|
|
2404
2418
|
title: n(i)("field.preview"),
|
|
2405
2419
|
onLoad: Se
|
|
2406
|
-
}, null, 44,
|
|
2420
|
+
}, null, 44, ms)) : D("", !0)
|
|
2407
2421
|
], 4)
|
|
2408
2422
|
], 512)
|
|
2409
2423
|
], 6));
|
|
2410
2424
|
}
|
|
2411
|
-
}),
|
|
2425
|
+
}), 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
2426
|
key: 4,
|
|
2413
2427
|
class: "wx-blocks-tree__actions"
|
|
2414
|
-
},
|
|
2428
|
+
}, Ss = ["onClick"], Es = /* @__PURE__ */ ae({
|
|
2415
2429
|
__name: "BlocksTree",
|
|
2416
2430
|
props: {
|
|
2417
2431
|
nodes: {},
|
|
@@ -2435,7 +2449,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2435
2449
|
const f = i(p);
|
|
2436
2450
|
return f?.content ? Jt(f.content.schema) : [];
|
|
2437
2451
|
}
|
|
2438
|
-
function
|
|
2452
|
+
function c(p, f) {
|
|
2439
2453
|
const v = p.values[f.id];
|
|
2440
2454
|
return Array.isArray(v) ? v : [];
|
|
2441
2455
|
}
|
|
@@ -2464,7 +2478,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2464
2478
|
}
|
|
2465
2479
|
return (p, f) => {
|
|
2466
2480
|
const v = At("blocks-tree", !0);
|
|
2467
|
-
return
|
|
2481
|
+
return d(), z(n(Cl), {
|
|
2468
2482
|
"model-value": e.nodes,
|
|
2469
2483
|
"item-key": "key",
|
|
2470
2484
|
"item-label": (g) => o(g),
|
|
@@ -2476,7 +2490,7 @@ const ts = ["srcdoc"], ls = {
|
|
|
2476
2490
|
"onUpdate:modelValue": f[6] || (f[6] = (g) => s("reorder", e.parentKey, e.field, g))
|
|
2477
2491
|
}, {
|
|
2478
2492
|
default: b(({ item: g }) => [
|
|
2479
|
-
A("div",
|
|
2493
|
+
A("div", bs, [
|
|
2480
2494
|
A("div", {
|
|
2481
2495
|
class: $e(["wx-blocks-tree__row", { "is-selected": e.selected === g.key, "is-hidden": g.hidden === !0 }]),
|
|
2482
2496
|
role: "button",
|
|
@@ -2487,46 +2501,46 @@ const ts = ["srcdoc"], ls = {
|
|
|
2487
2501
|
ht(bt((x) => s("select", g.key), ["prevent"]), ["space"])
|
|
2488
2502
|
]
|
|
2489
2503
|
}, [
|
|
2490
|
-
A("span",
|
|
2491
|
-
i(g) ? i(g)?.draft ? (
|
|
2504
|
+
A("span", ys, S(o(g)), 1),
|
|
2505
|
+
i(g) ? i(g)?.draft ? (d(), C("span", {
|
|
2492
2506
|
key: 1,
|
|
2493
2507
|
class: "wx-blocks-tree__flag is-warning",
|
|
2494
2508
|
title: n(a)("field.draft-type")
|
|
2495
2509
|
}, [
|
|
2496
2510
|
m(n(he), { name: "warning" })
|
|
2497
|
-
], 8,
|
|
2511
|
+
], 8, ws)) : i(g)?.is_enabled === !1 ? (d(), C("span", {
|
|
2498
2512
|
key: 2,
|
|
2499
2513
|
class: "wx-blocks-tree__flag",
|
|
2500
2514
|
title: n(a)("field.disabled-type")
|
|
2501
2515
|
}, [
|
|
2502
2516
|
m(n(he), { name: "lock" })
|
|
2503
|
-
], 8,
|
|
2517
|
+
], 8, _s)) : D("", !0) : (d(), C("span", {
|
|
2504
2518
|
key: 0,
|
|
2505
2519
|
class: "wx-blocks-tree__flag is-danger",
|
|
2506
2520
|
title: n(a)("field.unknown-type", { type: g.type })
|
|
2507
2521
|
}, [
|
|
2508
2522
|
m(n(he), { name: "close-circle" })
|
|
2509
|
-
], 8,
|
|
2510
|
-
g.hidden === !0 ? (
|
|
2523
|
+
], 8, ks)),
|
|
2524
|
+
g.hidden === !0 ? (d(), C("span", {
|
|
2511
2525
|
key: 3,
|
|
2512
2526
|
class: "wx-blocks-tree__flag",
|
|
2513
2527
|
title: n(a)("field.hidden-note")
|
|
2514
2528
|
}, [
|
|
2515
2529
|
m(n(he), { name: "eye-off" })
|
|
2516
|
-
], 8,
|
|
2517
|
-
e.disabled ? D("", !0) : (
|
|
2530
|
+
], 8, xs)) : D("", !0),
|
|
2531
|
+
e.disabled ? D("", !0) : (d(), C("span", $s, [
|
|
2518
2532
|
m(n(kl), {
|
|
2519
2533
|
actions: u(g),
|
|
2520
2534
|
label: o(g)
|
|
2521
2535
|
}, null, 8, ["actions", "label"])
|
|
2522
2536
|
]))
|
|
2523
|
-
], 42,
|
|
2524
|
-
(
|
|
2537
|
+
], 42, gs),
|
|
2538
|
+
(d(!0), C(F, null, le(r(g), (x) => (d(), C("div", {
|
|
2525
2539
|
key: x.id,
|
|
2526
2540
|
class: "wx-blocks-tree__kids"
|
|
2527
2541
|
}, [
|
|
2528
2542
|
m(v, {
|
|
2529
|
-
nodes:
|
|
2543
|
+
nodes: c(g, x),
|
|
2530
2544
|
catalog: e.catalog,
|
|
2531
2545
|
"parent-key": g.key,
|
|
2532
2546
|
field: x.id,
|
|
@@ -2540,17 +2554,17 @@ const ts = ["srcdoc"], ls = {
|
|
|
2540
2554
|
onVisibility: f[4] || (f[4] = (T, w) => s("visibility", T, w)),
|
|
2541
2555
|
onReorder: f[5] || (f[5] = (T, w, y) => s("reorder", T, w, y))
|
|
2542
2556
|
}, null, 8, ["nodes", "catalog", "parent-key", "field", "selected", "disabled", "depth"]),
|
|
2543
|
-
e.disabled ? D("", !0) : (
|
|
2557
|
+
e.disabled ? D("", !0) : (d(), C("button", {
|
|
2544
2558
|
key: 0,
|
|
2545
2559
|
type: "button",
|
|
2546
2560
|
class: "wx-blocks-tree__add is-inner",
|
|
2547
2561
|
onClick: (T) => s("add", g.key, x.id, x)
|
|
2548
2562
|
}, [
|
|
2549
2563
|
M(" + " + S(n(a)("field.add-inside")), 1),
|
|
2550
|
-
r(g).length > 1 ? (
|
|
2564
|
+
r(g).length > 1 ? (d(), C(F, { key: 0 }, [
|
|
2551
2565
|
M(" · " + S(x.label ?? x.id), 1)
|
|
2552
2566
|
], 64)) : D("", !0)
|
|
2553
|
-
], 8,
|
|
2567
|
+
], 8, Ss))
|
|
2554
2568
|
]))), 128))
|
|
2555
2569
|
])
|
|
2556
2570
|
]),
|
|
@@ -2558,29 +2572,29 @@ const ts = ["srcdoc"], ls = {
|
|
|
2558
2572
|
}, 8, ["model-value", "item-label", "disabled", "empty-text", "class"]);
|
|
2559
2573
|
};
|
|
2560
2574
|
}
|
|
2561
|
-
}),
|
|
2562
|
-
function
|
|
2575
|
+
}), Ts = /* @__PURE__ */ ie(Es, [["__scopeId", "data-v-590fa1d6"]]), vt = /* @__PURE__ */ Symbol("wx-blocks-preview");
|
|
2576
|
+
function ho(e) {
|
|
2563
2577
|
Bt(vt, e);
|
|
2564
2578
|
}
|
|
2565
|
-
function
|
|
2579
|
+
function bo() {
|
|
2566
2580
|
return De(vt, null);
|
|
2567
2581
|
}
|
|
2568
|
-
const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"),
|
|
2582
|
+
const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Cs = {
|
|
2569
2583
|
key: 0,
|
|
2570
2584
|
class: "wx-blocks-nested"
|
|
2571
|
-
},
|
|
2585
|
+
}, Ls = {
|
|
2572
2586
|
key: 0,
|
|
2573
2587
|
class: "wx-blocks__tree"
|
|
2574
|
-
},
|
|
2588
|
+
}, As = { class: "wx-blocks__panel-head" }, Vs = { class: "wx-blocks__panel-title" }, Bs = { class: "wx-blocks__list" }, Ws = { class: "wx-blocks__tools" }, Ms = {
|
|
2575
2589
|
key: 1,
|
|
2576
2590
|
class: "wx-blocks__fields"
|
|
2577
|
-
},
|
|
2591
|
+
}, Ns = { class: "wx-blocks__panel-head" }, zs = { class: "wx-blocks__panel-title" }, Ds = {
|
|
2578
2592
|
key: 0,
|
|
2579
2593
|
class: "wx-blocks__trail"
|
|
2580
|
-
},
|
|
2594
|
+
}, Is = ["onClick"], Os = { class: "wx-blocks__panel-name" }, Ps = { class: "wx-blocks__panel-extra" }, Us = { key: 0 }, Rs = { class: "wx-blocks__form" }, js = {
|
|
2581
2595
|
key: 0,
|
|
2582
2596
|
class: "wx-blocks__preview"
|
|
2583
|
-
},
|
|
2597
|
+
}, Fs = /* @__PURE__ */ ae({
|
|
2584
2598
|
name: "WxBlocks",
|
|
2585
2599
|
inheritAttrs: !1,
|
|
2586
2600
|
__name: "BlocksField",
|
|
@@ -2601,10 +2615,10 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2601
2615
|
emits: ["update:modelValue"],
|
|
2602
2616
|
setup(e) {
|
|
2603
2617
|
const l = e, t = cl(e, "modelValue"), s = De(Lt, !1);
|
|
2604
|
-
Bt(Lt, !0),
|
|
2618
|
+
Bt(Lt, !0), qe();
|
|
2605
2619
|
const a = de("webx-blocks"), i = Fe(), o = De(Mt, null);
|
|
2606
2620
|
let r = null;
|
|
2607
|
-
const
|
|
2621
|
+
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
2622
|
() => v.value ? u.value.find(($) => $.slug === v.value?.node.type) ?? null : null
|
|
2609
2623
|
);
|
|
2610
2624
|
function x($) {
|
|
@@ -2625,7 +2639,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2625
2639
|
for (; N; )
|
|
2626
2640
|
$.unshift({ key: N.key, title: x(N) }), N = re(p.value, N.key)?.parent ?? null;
|
|
2627
2641
|
return $;
|
|
2628
|
-
}), _ = De(vt, null), R = I(null),
|
|
2642
|
+
}), _ = 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
2643
|
if (!v.value) return;
|
|
2630
2644
|
const $ = g.value?.title ?? v.value.node.type;
|
|
2631
2645
|
return [...y.value.map((N) => N.title), $].join(" / ");
|
|
@@ -2655,7 +2669,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2655
2669
|
() => o?.state.manifest?.modules.find(($) => $.id === "blocks")?.meta?.groups ?? []
|
|
2656
2670
|
), 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
2671
|
() => l.context?.translate ?? o?.i18n.t ?? (($) => $)
|
|
2658
|
-
), Ee = L(() => l.context?.can ?? o?.can ?? (() => !0)), Te = Ut(
|
|
2672
|
+
), Ee = L(() => l.context?.can ?? o?.can ?? (() => !0)), Te = Ut(ps);
|
|
2659
2673
|
function Q($) {
|
|
2660
2674
|
t.value = $;
|
|
2661
2675
|
}
|
|
@@ -2740,7 +2754,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2740
2754
|
if (window.addEventListener("keydown", Le), l.catalog === null && o) {
|
|
2741
2755
|
r = Me(o);
|
|
2742
2756
|
try {
|
|
2743
|
-
|
|
2757
|
+
c.value = await r.catalog();
|
|
2744
2758
|
} catch ($) {
|
|
2745
2759
|
Z.danger(i($));
|
|
2746
2760
|
}
|
|
@@ -2751,8 +2765,8 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2751
2765
|
const ze = L(
|
|
2752
2766
|
() => g.value?.content ? mt(g.value.content.schema) : []
|
|
2753
2767
|
);
|
|
2754
|
-
return ($, N) => n(s) ? (
|
|
2755
|
-
m(n(
|
|
2768
|
+
return ($, N) => n(s) ? (d(), C("div", Cs, [
|
|
2769
|
+
m(n(q), {
|
|
2756
2770
|
size: "sm",
|
|
2757
2771
|
tone: "muted"
|
|
2758
2772
|
}, {
|
|
@@ -2761,10 +2775,10 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2761
2775
|
]),
|
|
2762
2776
|
_: 1
|
|
2763
2777
|
})
|
|
2764
|
-
])) : (
|
|
2778
|
+
])) : (d(), C("div", {
|
|
2765
2779
|
key: 1,
|
|
2766
2780
|
ref_key: "host",
|
|
2767
|
-
ref:
|
|
2781
|
+
ref: K,
|
|
2768
2782
|
class: $e(["wx-blocks-host", { "is-compact": h.value }])
|
|
2769
2783
|
}, [
|
|
2770
2784
|
A("div", {
|
|
@@ -2773,12 +2787,12 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2773
2787
|
"has-preview": n(_) !== null && n(_).url.value !== null
|
|
2774
2788
|
}])
|
|
2775
2789
|
}, [
|
|
2776
|
-
(
|
|
2790
|
+
(d(), z(pl(h.value ? n(Ll) : "div"), fl(J.value, { class: "wx-blocks__side" }), {
|
|
2777
2791
|
default: b(() => [
|
|
2778
|
-
v.value ? D("", !0) : (
|
|
2779
|
-
A("div",
|
|
2780
|
-
A("span",
|
|
2781
|
-
m(n(
|
|
2792
|
+
v.value ? D("", !0) : (d(), C("div", Ls, [
|
|
2793
|
+
A("div", As, [
|
|
2794
|
+
A("span", Vs, S(n(a)("field.blocks")), 1),
|
|
2795
|
+
m(n(q), {
|
|
2782
2796
|
size: "sm",
|
|
2783
2797
|
tone: "muted"
|
|
2784
2798
|
}, {
|
|
@@ -2788,20 +2802,22 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2788
2802
|
_: 1
|
|
2789
2803
|
})
|
|
2790
2804
|
]),
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
+
A("div", Bs, [
|
|
2806
|
+
m(Ts, {
|
|
2807
|
+
nodes: p.value,
|
|
2808
|
+
catalog: u.value,
|
|
2809
|
+
selected: f.value,
|
|
2810
|
+
disabled: e.disabled,
|
|
2811
|
+
onSelect: G,
|
|
2812
|
+
onAdd: ke,
|
|
2813
|
+
onRemove: ge,
|
|
2814
|
+
onDuplicate: W,
|
|
2815
|
+
onVisibility: P,
|
|
2816
|
+
onReorder: j
|
|
2817
|
+
}, null, 8, ["nodes", "catalog", "selected", "disabled"])
|
|
2818
|
+
]),
|
|
2819
|
+
A("div", Ws, [
|
|
2820
|
+
!e.disabled && (e.max === null || p.value.length < e.max) ? (d(), z(n(ce), {
|
|
2805
2821
|
key: 0,
|
|
2806
2822
|
variant: "outline",
|
|
2807
2823
|
icon: "plus",
|
|
@@ -2813,7 +2829,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2813
2829
|
]),
|
|
2814
2830
|
_: 1
|
|
2815
2831
|
})) : D("", !0),
|
|
2816
|
-
!h.value && n(_) && n(_).url.value ? (
|
|
2832
|
+
!h.value && n(_) && n(_).url.value ? (d(), z(n(ce), {
|
|
2817
2833
|
key: 1,
|
|
2818
2834
|
variant: "outline",
|
|
2819
2835
|
icon: "eye",
|
|
@@ -2827,25 +2843,25 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2827
2843
|
})) : D("", !0)
|
|
2828
2844
|
])
|
|
2829
2845
|
])),
|
|
2830
|
-
v.value ? (
|
|
2831
|
-
A("div",
|
|
2832
|
-
A("span",
|
|
2833
|
-
y.value.length ? (
|
|
2834
|
-
(
|
|
2846
|
+
v.value ? (d(), C("div", Ms, [
|
|
2847
|
+
A("div", Ns, [
|
|
2848
|
+
A("span", zs, [
|
|
2849
|
+
y.value.length ? (d(), C("span", Ds, [
|
|
2850
|
+
(d(!0), C(F, null, le(y.value, (U) => (d(), C(F, {
|
|
2835
2851
|
key: U.key
|
|
2836
2852
|
}, [
|
|
2837
2853
|
A("button", {
|
|
2838
2854
|
type: "button",
|
|
2839
2855
|
class: "wx-blocks__trail-step",
|
|
2840
2856
|
onClick: (H) => G(U.key)
|
|
2841
|
-
}, S(U.title), 9,
|
|
2857
|
+
}, S(U.title), 9, Is),
|
|
2842
2858
|
m(n(he), { name: "chevron-right" })
|
|
2843
2859
|
], 64))), 128))
|
|
2844
2860
|
])) : D("", !0),
|
|
2845
|
-
A("span",
|
|
2861
|
+
A("span", Os, S(g.value?.title ?? v.value.node.type), 1)
|
|
2846
2862
|
]),
|
|
2847
|
-
A("span",
|
|
2848
|
-
h.value ? D("", !0) : (
|
|
2863
|
+
A("span", Ps, [
|
|
2864
|
+
h.value ? D("", !0) : (d(), C("code", Us, S(v.value.node.type), 1)),
|
|
2849
2865
|
m(n(Ie), {
|
|
2850
2866
|
size: "sm",
|
|
2851
2867
|
tone: "neutral",
|
|
@@ -2862,7 +2878,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2862
2878
|
disabled: w.value.next === null,
|
|
2863
2879
|
onClick: N[3] || (N[3] = (U) => w.value.next && G(w.value.next))
|
|
2864
2880
|
}, null, 8, ["title", "disabled"]),
|
|
2865
|
-
!h.value && n(_) && n(_).url.value ? (
|
|
2881
|
+
!h.value && n(_) && n(_).url.value ? (d(), z(n(ce), {
|
|
2866
2882
|
key: 1,
|
|
2867
2883
|
size: "sm",
|
|
2868
2884
|
variant: "outline",
|
|
@@ -2883,8 +2899,8 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2883
2899
|
})
|
|
2884
2900
|
])
|
|
2885
2901
|
]),
|
|
2886
|
-
A("div",
|
|
2887
|
-
g.value?.content ? (
|
|
2902
|
+
A("div", Rs, [
|
|
2903
|
+
g.value?.content ? (d(), z(n(Rt), {
|
|
2888
2904
|
key: v.value.node.key,
|
|
2889
2905
|
"model-value": v.value.node.values,
|
|
2890
2906
|
root: ze.value,
|
|
@@ -2893,7 +2909,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2893
2909
|
can: Ee.value,
|
|
2894
2910
|
disabled: e.disabled,
|
|
2895
2911
|
"onUpdate:modelValue": se
|
|
2896
|
-
}, null, 8, ["model-value", "root", "types", "translate", "can", "disabled"])) : (
|
|
2912
|
+
}, null, 8, ["model-value", "root", "types", "translate", "can", "disabled"])) : (d(), z(n(q), {
|
|
2897
2913
|
key: 1,
|
|
2898
2914
|
size: "sm",
|
|
2899
2915
|
tone: "danger"
|
|
@@ -2908,8 +2924,8 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2908
2924
|
]),
|
|
2909
2925
|
_: 1
|
|
2910
2926
|
}, 16)),
|
|
2911
|
-
n(_) && n(_).url.value ? (
|
|
2912
|
-
m(
|
|
2927
|
+
n(_) && n(_).url.value ? (d(), C("div", js, [
|
|
2928
|
+
m(hs, {
|
|
2913
2929
|
ref_key: "previewEl",
|
|
2914
2930
|
ref: R,
|
|
2915
2931
|
url: n(_).url.value,
|
|
@@ -2923,7 +2939,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2923
2939
|
], 2)
|
|
2924
2940
|
], 2));
|
|
2925
2941
|
}
|
|
2926
|
-
}),
|
|
2942
|
+
}), 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({
|
|
2927
2943
|
__name: "BlockCard",
|
|
2928
2944
|
props: {
|
|
2929
2945
|
block: {}
|
|
@@ -2931,7 +2947,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2931
2947
|
emits: ["open"],
|
|
2932
2948
|
setup(e, { emit: l }) {
|
|
2933
2949
|
const t = l, s = de("webx-blocks");
|
|
2934
|
-
return (a, i) => (
|
|
2950
|
+
return (a, i) => (d(), C("button", {
|
|
2935
2951
|
type: "button",
|
|
2936
2952
|
class: "wx-block-card",
|
|
2937
2953
|
onClick: i[0] || (i[0] = (o) => t("open", e.block))
|
|
@@ -2940,9 +2956,9 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2940
2956
|
thumbnail: e.block.thumbnail,
|
|
2941
2957
|
height: 120
|
|
2942
2958
|
}, null, 8, ["thumbnail"]),
|
|
2943
|
-
A("div",
|
|
2944
|
-
A("div",
|
|
2945
|
-
m(n(
|
|
2959
|
+
A("div", qs, [
|
|
2960
|
+
A("div", Ks, S(e.block.title), 1),
|
|
2961
|
+
m(n(q), {
|
|
2946
2962
|
size: "sm",
|
|
2947
2963
|
tone: "muted"
|
|
2948
2964
|
}, {
|
|
@@ -2952,8 +2968,8 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2952
2968
|
]),
|
|
2953
2969
|
_: 1
|
|
2954
2970
|
}),
|
|
2955
|
-
A("div",
|
|
2956
|
-
e.block.draft ? (
|
|
2971
|
+
A("div", Ys, [
|
|
2972
|
+
e.block.draft ? (d(), z(n(ue), {
|
|
2957
2973
|
key: 0,
|
|
2958
2974
|
type: "warning",
|
|
2959
2975
|
dot: ""
|
|
@@ -2963,7 +2979,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2963
2979
|
]),
|
|
2964
2980
|
_: 1
|
|
2965
2981
|
})) : D("", !0),
|
|
2966
|
-
e.block.published ? (
|
|
2982
|
+
e.block.published ? (d(), z(n(ue), {
|
|
2967
2983
|
key: 1,
|
|
2968
2984
|
type: "success",
|
|
2969
2985
|
dot: ""
|
|
@@ -2972,7 +2988,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2972
2988
|
M(S(n(s)("page.live", { number: e.block.published.number })), 1)
|
|
2973
2989
|
]),
|
|
2974
2990
|
_: 1
|
|
2975
|
-
})) : (
|
|
2991
|
+
})) : (d(), z(n(ue), {
|
|
2976
2992
|
key: 2,
|
|
2977
2993
|
type: "default"
|
|
2978
2994
|
}, {
|
|
@@ -2981,7 +2997,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2981
2997
|
]),
|
|
2982
2998
|
_: 1
|
|
2983
2999
|
})),
|
|
2984
|
-
e.block.is_enabled ? D("", !0) : (
|
|
3000
|
+
e.block.is_enabled ? D("", !0) : (d(), z(n(ue), {
|
|
2985
3001
|
key: 3,
|
|
2986
3002
|
type: "default",
|
|
2987
3003
|
variant: "outline"
|
|
@@ -2995,13 +3011,13 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
2995
3011
|
])
|
|
2996
3012
|
]));
|
|
2997
3013
|
}
|
|
2998
|
-
}),
|
|
3014
|
+
}), Gs = /* @__PURE__ */ ie(Js, [["__scopeId", "data-v-3d94f339"]]), Zs = { class: "wx-block-create" }, Qs = /* @__PURE__ */ ae({
|
|
2999
3015
|
__name: "BlockCreateDialog",
|
|
3000
3016
|
setup(e) {
|
|
3001
3017
|
const { resolve: l, dismiss: t, open: s } = It(), a = je(), i = Me(a);
|
|
3002
|
-
|
|
3003
|
-
const o = de("webx-blocks"), r = Fe(),
|
|
3004
|
-
() =>
|
|
3018
|
+
qe();
|
|
3019
|
+
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(
|
|
3020
|
+
() => c.value.map((y) => ({ value: y, label: Ne(y, o) }))
|
|
3005
3021
|
);
|
|
3006
3022
|
function x(y) {
|
|
3007
3023
|
return y.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/^[^a-z]+/, "").slice(0, 64);
|
|
@@ -3026,7 +3042,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
3026
3042
|
f.value = !1;
|
|
3027
3043
|
}
|
|
3028
3044
|
}
|
|
3029
|
-
return (y, _) => (
|
|
3045
|
+
return (y, _) => (d(), z(n(Ot), {
|
|
3030
3046
|
open: n(s),
|
|
3031
3047
|
"onUpdate:open": _[5] || (_[5] = (R) => Vt(s) ? s.value = R : null),
|
|
3032
3048
|
title: n(o)("page.new"),
|
|
@@ -3059,7 +3075,7 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
3059
3075
|
})
|
|
3060
3076
|
]),
|
|
3061
3077
|
default: b(() => [
|
|
3062
|
-
A("div",
|
|
3078
|
+
A("div", Zs, [
|
|
3063
3079
|
m(n(oe), {
|
|
3064
3080
|
label: n(o)("page.title"),
|
|
3065
3081
|
error: T("title")
|
|
@@ -3107,21 +3123,21 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
3107
3123
|
_: 1
|
|
3108
3124
|
}, 8, ["open", "title"]));
|
|
3109
3125
|
}
|
|
3110
|
-
}),
|
|
3126
|
+
}), Xs = /* @__PURE__ */ ie(Qs, [["__scopeId", "data-v-a4c0d44c"]]), eo = {
|
|
3111
3127
|
key: 1,
|
|
3112
3128
|
class: "wx-blocks-page__toolbar"
|
|
3113
|
-
},
|
|
3129
|
+
}, to = { class: "wx-blocks-page__cards" }, lo = { class: "wx-blocks-page__ghost-body" }, no = {
|
|
3114
3130
|
key: 0,
|
|
3115
3131
|
class: "wx-blocks-page__group-title"
|
|
3116
|
-
},
|
|
3132
|
+
}, so = { class: "wx-blocks-page__cards" }, oo = /* @__PURE__ */ ae({
|
|
3117
3133
|
__name: "BlocksPage",
|
|
3118
3134
|
props: {
|
|
3119
3135
|
base: { default: "/blocks" }
|
|
3120
3136
|
},
|
|
3121
3137
|
setup(e) {
|
|
3122
3138
|
const l = e, t = je(), s = Me(t), a = Wt();
|
|
3123
|
-
|
|
3124
|
-
const i = de("webx-blocks"), o = Fe(), r = I([]),
|
|
3139
|
+
qe();
|
|
3140
|
+
const i = de("webx-blocks"), o = Fe(), r = I([]), c = I(!0), u = I(""), p = I(""), f = Ut(Xs), v = L(() => {
|
|
3125
3141
|
const h = t.state.manifest?.modules.find((V) => V.id === "blocks")?.meta;
|
|
3126
3142
|
return {
|
|
3127
3143
|
groups: h?.groups ?? [],
|
|
@@ -3154,29 +3170,29 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
3154
3170
|
return p.value !== "" || T.value.length <= 5 || u.value.trim() !== "" || h.length < 2 ? [{ id: "", label: "", blocks: T.value }] : h;
|
|
3155
3171
|
});
|
|
3156
3172
|
async function R() {
|
|
3157
|
-
|
|
3173
|
+
c.value = !0;
|
|
3158
3174
|
try {
|
|
3159
3175
|
r.value = await s.list();
|
|
3160
3176
|
} catch (h) {
|
|
3161
3177
|
Z.danger(o(h));
|
|
3162
3178
|
} finally {
|
|
3163
|
-
|
|
3179
|
+
c.value = !1;
|
|
3164
3180
|
}
|
|
3165
3181
|
}
|
|
3166
|
-
function
|
|
3182
|
+
function K(h) {
|
|
3167
3183
|
a.push(`${l.base}/${h.id}`);
|
|
3168
3184
|
}
|
|
3169
|
-
async function
|
|
3185
|
+
async function Y() {
|
|
3170
3186
|
const h = await f({});
|
|
3171
|
-
h &&
|
|
3187
|
+
h && K(h);
|
|
3172
3188
|
}
|
|
3173
3189
|
Re(R);
|
|
3174
3190
|
const X = L(
|
|
3175
3191
|
() => g.value ? [{ key: "new", label: i("page.new"), icon: "plus", primary: !0, run: () => {
|
|
3176
|
-
|
|
3192
|
+
Y();
|
|
3177
3193
|
} }] : []
|
|
3178
3194
|
);
|
|
3179
|
-
return (h, V) => (
|
|
3195
|
+
return (h, V) => (d(), z(n(wl), {
|
|
3180
3196
|
view: p.value,
|
|
3181
3197
|
"onUpdate:view": V[1] || (V[1] = (O) => p.value = O),
|
|
3182
3198
|
class: "wx-blocks-page",
|
|
@@ -3185,13 +3201,13 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
3185
3201
|
actions: X.value
|
|
3186
3202
|
}, {
|
|
3187
3203
|
default: b(() => [
|
|
3188
|
-
v.value.editing ? D("", !0) : (
|
|
3204
|
+
v.value.editing ? D("", !0) : (d(), z(n(zt), {
|
|
3189
3205
|
key: 0,
|
|
3190
3206
|
type: "info",
|
|
3191
3207
|
variant: "soft",
|
|
3192
3208
|
description: n(i)("page.editing-off")
|
|
3193
3209
|
}, null, 8, ["description"])),
|
|
3194
|
-
|
|
3210
|
+
c.value || r.value.length > 0 ? (d(), C("div", eo, [
|
|
3195
3211
|
m(n(Ue), {
|
|
3196
3212
|
modelValue: u.value,
|
|
3197
3213
|
"onUpdate:modelValue": V[0] || (V[0] = (O) => u.value = O),
|
|
@@ -3200,28 +3216,28 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
3200
3216
|
clearable: ""
|
|
3201
3217
|
}, null, 8, ["modelValue", "placeholder"])
|
|
3202
3218
|
])) : D("", !0),
|
|
3203
|
-
|
|
3219
|
+
c.value ? (d(), z(n(Be), { key: 2 }, {
|
|
3204
3220
|
template: b(() => [
|
|
3205
|
-
A("div",
|
|
3206
|
-
(
|
|
3221
|
+
A("div", to, [
|
|
3222
|
+
(d(), C(F, null, le(4, (O) => A("div", {
|
|
3207
3223
|
key: O,
|
|
3208
3224
|
class: "wx-blocks-page__ghost"
|
|
3209
3225
|
}, [
|
|
3210
|
-
m(n(
|
|
3226
|
+
m(n(Ye), {
|
|
3211
3227
|
variant: "image",
|
|
3212
3228
|
height: 120,
|
|
3213
3229
|
class: "wx-blocks-page__ghost-thumb"
|
|
3214
3230
|
}),
|
|
3215
|
-
A("div",
|
|
3216
|
-
m(n(
|
|
3231
|
+
A("div", lo, [
|
|
3232
|
+
m(n(Ye), {
|
|
3217
3233
|
variant: "title",
|
|
3218
3234
|
width: "45%"
|
|
3219
3235
|
}),
|
|
3220
|
-
m(n(
|
|
3236
|
+
m(n(Ye), {
|
|
3221
3237
|
variant: "text",
|
|
3222
3238
|
width: "70%"
|
|
3223
3239
|
}),
|
|
3224
|
-
m(n(
|
|
3240
|
+
m(n(Ye), {
|
|
3225
3241
|
variant: "button",
|
|
3226
3242
|
width: "64px",
|
|
3227
3243
|
height: "22px"
|
|
@@ -3231,21 +3247,21 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
3231
3247
|
])
|
|
3232
3248
|
]),
|
|
3233
3249
|
_: 1
|
|
3234
|
-
})) : r.value.length === 0 ? (
|
|
3250
|
+
})) : r.value.length === 0 ? (d(), z(n(Pt), {
|
|
3235
3251
|
key: 3,
|
|
3236
3252
|
icon: "grid",
|
|
3237
3253
|
title: n(i)("page.empty"),
|
|
3238
3254
|
description: n(i)("page.empty-help")
|
|
3239
|
-
}, null, 8, ["title", "description"])) : (
|
|
3255
|
+
}, null, 8, ["title", "description"])) : (d(!0), C(F, { key: 4 }, le(_.value, (O) => (d(), C("section", {
|
|
3240
3256
|
key: O.id,
|
|
3241
3257
|
class: "wx-blocks-page__group"
|
|
3242
3258
|
}, [
|
|
3243
|
-
O.label ? (
|
|
3244
|
-
A("div",
|
|
3245
|
-
(
|
|
3259
|
+
O.label ? (d(), C("div", no, S(O.label), 1)) : D("", !0),
|
|
3260
|
+
A("div", so, [
|
|
3261
|
+
(d(!0), C(F, null, le(O.blocks, (J) => (d(), z(Gs, {
|
|
3246
3262
|
key: J.id,
|
|
3247
3263
|
block: J,
|
|
3248
|
-
onOpen:
|
|
3264
|
+
onOpen: K
|
|
3249
3265
|
}, null, 8, ["block"]))), 128))
|
|
3250
3266
|
])
|
|
3251
3267
|
]))), 128))
|
|
@@ -3253,18 +3269,18 @@ const Lt = /* @__PURE__ */ Symbol("wx-blocks-root"), Ts = {
|
|
|
3253
3269
|
_: 1
|
|
3254
3270
|
}, 8, ["view", "title", "views", "actions"]));
|
|
3255
3271
|
}
|
|
3256
|
-
}),
|
|
3257
|
-
function
|
|
3272
|
+
}), ao = /* @__PURE__ */ ie(oo, [["__scopeId", "data-v-553b680f"]]);
|
|
3273
|
+
function go(e = {}) {
|
|
3258
3274
|
const l = e.path ?? "/blocks";
|
|
3259
3275
|
return {
|
|
3260
3276
|
id: "blocks",
|
|
3261
3277
|
path: l,
|
|
3262
3278
|
routes: [
|
|
3263
|
-
{ path: l, name: "webx.blocks", component:
|
|
3279
|
+
{ path: l, name: "webx.blocks", component: ao, props: { base: l } },
|
|
3264
3280
|
{
|
|
3265
3281
|
path: `${l}/:id(\\d+)`,
|
|
3266
3282
|
name: "webx.blocks.edit",
|
|
3267
|
-
component:
|
|
3283
|
+
component: Xn,
|
|
3268
3284
|
props: { base: l }
|
|
3269
3285
|
}
|
|
3270
3286
|
],
|
|
@@ -3273,7 +3289,7 @@ function ho(e = {}) {
|
|
|
3273
3289
|
// draws its children through the renderer; it needs the node for `props.allow` alone.
|
|
3274
3290
|
types: {
|
|
3275
3291
|
"wx-blocks": {
|
|
3276
|
-
component:
|
|
3292
|
+
component: Hs,
|
|
3277
3293
|
kind: "field",
|
|
3278
3294
|
nested: !0,
|
|
3279
3295
|
wide: !0,
|
|
@@ -3283,13 +3299,13 @@ function ho(e = {}) {
|
|
|
3283
3299
|
};
|
|
3284
3300
|
}
|
|
3285
3301
|
export {
|
|
3286
|
-
|
|
3287
|
-
|
|
3302
|
+
Xn as WxBlockEditorPage,
|
|
3303
|
+
ps as WxBlockPicker,
|
|
3288
3304
|
Xl as WxBlockStage,
|
|
3289
3305
|
sl as WxBlockThumb,
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3306
|
+
Hs as WxBlocks,
|
|
3307
|
+
ao as WxBlocksPage,
|
|
3308
|
+
go as blocks,
|
|
3293
3309
|
un as blocksMessages,
|
|
3294
3310
|
vt as blocksPreviewKey,
|
|
3295
3311
|
Gt as cloneNode,
|
|
@@ -3299,21 +3315,21 @@ export {
|
|
|
3299
3315
|
mt as formSchema,
|
|
3300
3316
|
ot as highlightBlock,
|
|
3301
3317
|
$t as insertNode,
|
|
3302
|
-
|
|
3318
|
+
Kt as isNode,
|
|
3303
3319
|
tt as isNodeList,
|
|
3304
|
-
|
|
3320
|
+
Mn as lintBlock,
|
|
3305
3321
|
re as locate,
|
|
3306
3322
|
en as makeNode,
|
|
3307
3323
|
ut as newKey,
|
|
3308
|
-
|
|
3324
|
+
ho as provideBlocksPreview,
|
|
3309
3325
|
on as removeNode,
|
|
3310
3326
|
Ft as replaceBlock,
|
|
3311
3327
|
rn as replaceList,
|
|
3312
3328
|
Ht as stageDocument,
|
|
3313
|
-
|
|
3314
|
-
|
|
3329
|
+
vo as typesIn,
|
|
3330
|
+
Nn as undeclared,
|
|
3315
3331
|
an as updateValues,
|
|
3316
|
-
|
|
3332
|
+
bo as useBlocksPreview,
|
|
3317
3333
|
He as walk
|
|
3318
3334
|
};
|
|
3319
3335
|
//# sourceMappingURL=index.js.map
|