@webx-ui/module-blocks 0.1.1 → 0.2.0
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/BlocksField.d.ts +15 -0
- package/dist/BlocksPreview.d.ts +3 -0
- package/dist/index.js +191 -188
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as K, computed as C, openBlock as r, createElementBlock as V, createVNode as u, unref as e, createElementVNode as x, createTextVNode as $, toDisplayString as f, Fragment as j, createCommentVNode as E, renderList as Y, ref as U, onMounted as ye, watch as le, createBlock as W, withCtx as c, normalizeStyle as fe, reactive as Le, onBeforeUnmount as Re, resolveComponent as je, withDirectives as Wt, vModelText as At, isRef as it, normalizeClass as
|
|
1
|
+
import { defineComponent as K, computed as C, openBlock as r, createElementBlock as V, createVNode as u, unref as e, createElementVNode as x, createTextVNode as $, toDisplayString as f, Fragment as j, createCommentVNode as E, renderList as Y, ref as U, onMounted as ye, watch as le, createBlock as W, withCtx as c, normalizeStyle as fe, reactive as Le, onBeforeUnmount as Re, resolveComponent as je, withDirectives as Wt, vModelText as At, isRef as it, normalizeClass as me, withKeys as Ge, withModifiers as Me, provide as rt, inject as ze, useModel as zt, getCurrentInstance as Et, mergeModels as Ut } from "vue";
|
|
2
2
|
import { useRoute as It, useRouter as ut } from "vue-router";
|
|
3
|
-
import { useTranslate as Q, useAdmin as
|
|
4
|
-
import { WxIcon as ne, WxSkeleton as pe, WxText as R, WxBadge as G, WxButton as q, confirm as Oe, toast as F, useElementWidth as He, WxSegmented as ct, WxCard as ce, WxAlert as dt, WxTabs as Lt, WxTab as de, WxCodeEditor as We, WxFormItem as J, WxInput as
|
|
3
|
+
import { useTranslate as Q, useAdmin as we, adminKey as Nt } from "@webx-ui/module-admin";
|
|
4
|
+
import { WxIcon as ne, WxSkeleton as pe, WxText as R, WxBadge as G, WxButton as q, confirm as Oe, toast as F, useElementWidth as He, WxSegmented as ct, WxCard as ce, WxAlert as dt, WxTabs as Lt, WxTab as de, WxCodeEditor as We, WxFormItem as J, WxInput as ve, WxSelect as pt, WxTextarea as Mt, WxInputNumber as Ye, WxTagsInput as Qe, WxSwitch as Pt, useModal as ft, WxDialog as mt, WxEmpty as vt, WxSortableList as Dt, WxAction as Xe, createModal as ht, WxSpace as Ot, WxHeading as Rt, WxSkeletonItem as Ae } from "@webx-ui/core";
|
|
5
5
|
import { WxScreenRenderer as bt, coreTypes as Pe } from "@webx-ui/schema";
|
|
6
|
-
function
|
|
6
|
+
function he(t) {
|
|
7
7
|
const l = `${t.apiPath}/blocks`, a = (s) => s.data;
|
|
8
8
|
return {
|
|
9
9
|
list: () => t.http.get(l).then(a),
|
|
@@ -83,14 +83,14 @@ const jt = { class: "wx-block-checks" }, Ht = {
|
|
|
83
83
|
},
|
|
84
84
|
emits: ["restored"],
|
|
85
85
|
setup(t, { emit: l }) {
|
|
86
|
-
const a = t, s = l, o =
|
|
86
|
+
const a = t, s = l, o = we(), i = he(o), n = Q("webx-blocks"), h = U(null);
|
|
87
87
|
async function p() {
|
|
88
88
|
h.value = await i.versions(a.block.id);
|
|
89
89
|
}
|
|
90
90
|
function S(b) {
|
|
91
91
|
return a.block.draft?.number === b.number ? "draft" : a.block.published?.number === b.number ? "live" : "replaced";
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function _(b) {
|
|
94
94
|
return b.created_at ? new Date(b.created_at).toLocaleString(o.i18n.state.locale) : "";
|
|
95
95
|
}
|
|
96
96
|
async function k(b) {
|
|
@@ -133,7 +133,7 @@ const jt = { class: "wx-block-checks" }, Ht = {
|
|
|
133
133
|
tone: "muted"
|
|
134
134
|
}, {
|
|
135
135
|
default: c(() => [
|
|
136
|
-
$(f(
|
|
136
|
+
$(f(_(y)) + " · " + f(y.author ?? e(n)(`page.source-${y.source}`)) + " ", 1),
|
|
137
137
|
y.comment ? (r(), V(j, { key: 0 }, [
|
|
138
138
|
$(" · " + f(y.comment), 1)
|
|
139
139
|
], 64)) : E("", !0)
|
|
@@ -207,10 +207,10 @@ function Yt(t, l, a) {
|
|
|
207
207
|
}
|
|
208
208
|
const p = i.content, S = Array.from(p.childNodes);
|
|
209
209
|
o.insertBefore(p, n);
|
|
210
|
-
const
|
|
211
|
-
if (
|
|
210
|
+
const _ = t.defaultView?.webx;
|
|
211
|
+
if (_?.mount)
|
|
212
212
|
for (const k of S)
|
|
213
|
-
k.nodeType === 1 &&
|
|
213
|
+
k.nodeType === 1 && _.mount(k);
|
|
214
214
|
return !0;
|
|
215
215
|
}
|
|
216
216
|
function Qt(t, l) {
|
|
@@ -254,7 +254,7 @@ const el = { class: "wx-block-stage" }, tl = { class: "wx-block-stage__bar" }, l
|
|
|
254
254
|
{ value: 1280, label: a("page.width-desktop") },
|
|
255
255
|
{ value: 834, label: a("page.width-tablet") },
|
|
256
256
|
{ value: 390, label: a("page.width-phone") }
|
|
257
|
-
]), o = U(1280), i = U(null), n = U(null), h = He(i), p = U(360), S = C(() => h.value === 0 ? 1 : Math.min(1, h.value / o.value)),
|
|
257
|
+
]), o = U(1280), i = U(null), n = U(null), h = He(i), p = U(360), S = C(() => h.value === 0 ? 1 : Math.min(1, h.value / o.value)), _ = C(
|
|
258
258
|
() => kt({
|
|
259
259
|
html: l.html,
|
|
260
260
|
styles: l.styles,
|
|
@@ -283,7 +283,7 @@ const el = { class: "wx-block-stage" }, tl = { class: "wx-block-stage__bar" }, l
|
|
|
283
283
|
x("div", tl, [
|
|
284
284
|
u(e(ct), {
|
|
285
285
|
modelValue: o.value,
|
|
286
|
-
"onUpdate:modelValue": d[0] || (d[0] = (
|
|
286
|
+
"onUpdate:modelValue": d[0] || (d[0] = (w) => o.value = w),
|
|
287
287
|
options: s.value,
|
|
288
288
|
size: "sm"
|
|
289
289
|
}, null, 8, ["modelValue", "options"])
|
|
@@ -305,7 +305,7 @@ const el = { class: "wx-block-stage" }, tl = { class: "wx-block-stage__bar" }, l
|
|
|
305
305
|
ref_key: "frame",
|
|
306
306
|
ref: n,
|
|
307
307
|
class: "wx-block-stage__frame",
|
|
308
|
-
srcdoc:
|
|
308
|
+
srcdoc: _.value,
|
|
309
309
|
style: fe(m.value),
|
|
310
310
|
sandbox: "allow-same-origin allow-scripts",
|
|
311
311
|
title: e(a)("page.preview"),
|
|
@@ -322,22 +322,22 @@ function yt(t) {
|
|
|
322
322
|
function Fe(t) {
|
|
323
323
|
return Array.isArray(t) && t.length > 0 && t.every(yt);
|
|
324
324
|
}
|
|
325
|
-
function
|
|
325
|
+
function wt() {
|
|
326
326
|
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);
|
|
327
327
|
}
|
|
328
328
|
function sl(t, l = {}) {
|
|
329
|
-
return { key:
|
|
329
|
+
return { key: wt(), type: t, values: l };
|
|
330
330
|
}
|
|
331
331
|
function oe(t, l) {
|
|
332
|
-
return
|
|
332
|
+
return _t(t, l, null, null);
|
|
333
333
|
}
|
|
334
|
-
function
|
|
334
|
+
function _t(t, l, a, s) {
|
|
335
335
|
for (let o = 0; o < t.length; o++) {
|
|
336
336
|
const i = t[o];
|
|
337
337
|
if (i.key === l) return { node: i, parent: a, field: s, list: t, index: o };
|
|
338
338
|
for (const [n, h] of Object.entries(i.values ?? {}))
|
|
339
339
|
if (Fe(h)) {
|
|
340
|
-
const p =
|
|
340
|
+
const p = _t(h, l, i, n);
|
|
341
341
|
if (p) return p;
|
|
342
342
|
}
|
|
343
343
|
}
|
|
@@ -357,7 +357,7 @@ function ol(t, l) {
|
|
|
357
357
|
s.type === l && a++;
|
|
358
358
|
}), a;
|
|
359
359
|
}
|
|
360
|
-
function
|
|
360
|
+
function Fn(t) {
|
|
361
361
|
const l = [];
|
|
362
362
|
return qe(t, (a) => {
|
|
363
363
|
l.includes(a.type) || l.push(a.type);
|
|
@@ -373,7 +373,7 @@ function $t(t) {
|
|
|
373
373
|
const l = {};
|
|
374
374
|
for (const [a, s] of Object.entries(t.values ?? {}))
|
|
375
375
|
l[a] = Fe(s) ? s.map($t) : ae(s);
|
|
376
|
-
return { key:
|
|
376
|
+
return { key: wt(), type: t.type, values: l };
|
|
377
377
|
}
|
|
378
378
|
function il(t, l, a) {
|
|
379
379
|
if (l === null) return t;
|
|
@@ -542,9 +542,9 @@ const dl = {
|
|
|
542
542
|
"ok-variables": "Every variable of the template is a field of the schema."
|
|
543
543
|
}
|
|
544
544
|
}, at = /* @__PURE__ */ new WeakSet();
|
|
545
|
-
function
|
|
545
|
+
function _e() {
|
|
546
546
|
try {
|
|
547
|
-
const { i18n: t } =
|
|
547
|
+
const { i18n: t } = we();
|
|
548
548
|
at.has(t) || (t.defaults("webx-blocks", dl), at.add(t));
|
|
549
549
|
} catch {
|
|
550
550
|
}
|
|
@@ -559,12 +559,12 @@ function fl(t, l, a) {
|
|
|
559
559
|
code: "variables-missing",
|
|
560
560
|
line: null,
|
|
561
561
|
message: a("checks.variables-missing", {
|
|
562
|
-
variables: o.map((
|
|
562
|
+
variables: o.map((_) => `$${_}`).join(", ")
|
|
563
563
|
})
|
|
564
564
|
});
|
|
565
565
|
const i = [], n = [], h = `.b-${t}`;
|
|
566
|
-
for (const [
|
|
567
|
-
|
|
566
|
+
for (const [_, k] of vl(l.styles))
|
|
567
|
+
_.startsWith(h) || _.startsWith("&") || (/^[a-z][a-z0-9-]*/i.test(_) ? n.push([_, k]) : i.push([_, k]));
|
|
568
568
|
i.length > 0 && s.push({
|
|
569
569
|
file: "styles",
|
|
570
570
|
code: "stray-selectors",
|
|
@@ -637,7 +637,7 @@ function ke(t, l) {
|
|
|
637
637
|
const a = `groups.${t}`, s = l(a);
|
|
638
638
|
return s === a || s === `webx-blocks::${a}` ? t.charAt(0).toUpperCase() + t.slice(1) : s;
|
|
639
639
|
}
|
|
640
|
-
const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns" }, gl = { class: "wx-block-editor__head" }, kl = { class: "wx-block-editor__id" }, yl = ["aria-label", "disabled"],
|
|
640
|
+
const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns" }, gl = { class: "wx-block-editor__head" }, kl = { class: "wx-block-editor__id" }, yl = ["aria-label", "disabled"], wl = { class: "wx-block-editor__actions" }, _l = { class: "wx-block-editor__columns" }, xl = { class: "wx-block-editor__files" }, $l = { class: "wx-block-editor__pane" }, Vl = {
|
|
641
641
|
key: 0,
|
|
642
642
|
class: "wx-block-editor__pills"
|
|
643
643
|
}, Sl = ["disabled", "onClick", "textContent"], Tl = { class: "wx-block-editor__pane" }, Cl = { class: "wx-block-editor__pane" }, Bl = { class: "wx-block-editor__note" }, Wl = { class: "wx-block-editor__pane" }, Al = { class: "wx-block-editor__note" }, zl = { class: "wx-block-editor__settings" }, El = {
|
|
@@ -652,9 +652,9 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
652
652
|
base: { default: "/blocks" }
|
|
653
653
|
},
|
|
654
654
|
setup(t) {
|
|
655
|
-
const l = t, a =
|
|
656
|
-
|
|
657
|
-
const n = Q("webx-blocks"), h = C(() => Number(o.params.id)), p = U(null), S = U([]),
|
|
655
|
+
const l = t, a = we(), s = he(a), o = It(), i = ut();
|
|
656
|
+
_e();
|
|
657
|
+
const n = Q("webx-blocks"), h = C(() => Number(o.params.id)), p = U(null), S = U([]), _ = U(!0), k = U(!1), b = U(!1), m = U("template"), y = C(() => {
|
|
658
658
|
const T = a.state.manifest?.modules.find((v) => v.id === "blocks")?.meta;
|
|
659
659
|
return {
|
|
660
660
|
groups: T?.groups ?? [],
|
|
@@ -672,7 +672,7 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
672
672
|
allowed_in: [],
|
|
673
673
|
max_per_entity: null,
|
|
674
674
|
is_enabled: !0
|
|
675
|
-
}),
|
|
675
|
+
}), w = Le({
|
|
676
676
|
schema: [],
|
|
677
677
|
template: "",
|
|
678
678
|
styles: "",
|
|
@@ -684,15 +684,15 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
684
684
|
script: null,
|
|
685
685
|
runtime: null,
|
|
686
686
|
loading: !1
|
|
687
|
-
}), xe = C(() => JSON.stringify({ settings: d, content:
|
|
687
|
+
}), xe = C(() => JSON.stringify({ settings: d, content: w })), ie = C(() => N.value !== "" && xe.value !== N.value), $e = C(() => fl(d.slug, w, n)), Ue = C(() => {
|
|
688
688
|
const T = [...y.value.groups];
|
|
689
689
|
return T.includes(d.group) || T.push(d.group), T.map((v) => ({ value: v, label: ke(v, n) }));
|
|
690
|
-
}),
|
|
691
|
-
get: () =>
|
|
690
|
+
}), be = C({
|
|
691
|
+
get: () => w.sample,
|
|
692
692
|
set: (T) => {
|
|
693
|
-
|
|
693
|
+
w.sample = T;
|
|
694
694
|
}
|
|
695
|
-
}), Ve = C(() => re(
|
|
695
|
+
}), Ve = C(() => re(w.schema));
|
|
696
696
|
function re(T) {
|
|
697
697
|
const v = [];
|
|
698
698
|
for (const O of T)
|
|
@@ -719,16 +719,16 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
719
719
|
script: null,
|
|
720
720
|
sample: {}
|
|
721
721
|
};
|
|
722
|
-
Object.assign(
|
|
722
|
+
Object.assign(w, ae(v)), B.value = JSON.stringify(v.schema, null, 2), M.value = null, N.value = xe.value;
|
|
723
723
|
}
|
|
724
724
|
async function Se() {
|
|
725
|
-
|
|
725
|
+
_.value = !0;
|
|
726
726
|
try {
|
|
727
727
|
se(await s.get(h.value)), S.value = await s.usage(h.value);
|
|
728
728
|
} catch (T) {
|
|
729
729
|
F.danger(T.body?.message ?? String(T));
|
|
730
730
|
} finally {
|
|
731
|
-
|
|
731
|
+
_.value = !1;
|
|
732
732
|
}
|
|
733
733
|
}
|
|
734
734
|
function A(T) {
|
|
@@ -736,7 +736,7 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
736
736
|
try {
|
|
737
737
|
const v = JSON.parse(T);
|
|
738
738
|
if (!Array.isArray(v)) throw new Error("not a list");
|
|
739
|
-
|
|
739
|
+
w.schema = v, M.value = null;
|
|
740
740
|
} catch (v) {
|
|
741
741
|
M.value = n("page.schema-invalid", { error: v.message });
|
|
742
742
|
}
|
|
@@ -753,12 +753,12 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
753
753
|
H.loading = !0;
|
|
754
754
|
try {
|
|
755
755
|
const v = await s.render(p.value.id, {
|
|
756
|
-
values:
|
|
756
|
+
values: w.sample,
|
|
757
757
|
content: g.value ? {
|
|
758
|
-
template:
|
|
759
|
-
styles:
|
|
760
|
-
script:
|
|
761
|
-
schema:
|
|
758
|
+
template: w.template,
|
|
759
|
+
styles: w.styles,
|
|
760
|
+
script: w.script,
|
|
761
|
+
schema: w.schema
|
|
762
762
|
} : void 0
|
|
763
763
|
});
|
|
764
764
|
if (T !== D) return;
|
|
@@ -770,18 +770,18 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
770
770
|
}
|
|
771
771
|
}
|
|
772
772
|
le(
|
|
773
|
-
() => [
|
|
773
|
+
() => [w.template, w.styles, w.script, w.schema, w.sample],
|
|
774
774
|
X,
|
|
775
775
|
{ deep: !0 }
|
|
776
776
|
);
|
|
777
777
|
const Te = U(null);
|
|
778
|
-
function
|
|
778
|
+
function ge(T) {
|
|
779
779
|
return `{{ $${T} }}`;
|
|
780
780
|
}
|
|
781
781
|
function Ce(T) {
|
|
782
782
|
const O = Te.value?.view?.value;
|
|
783
783
|
if (!O) {
|
|
784
|
-
|
|
784
|
+
w.template += `{{ $${T} }}`;
|
|
785
785
|
return;
|
|
786
786
|
}
|
|
787
787
|
O.dispatch(O.state.replaceSelection(`{{ $${T} }}`)), O.focus();
|
|
@@ -797,7 +797,7 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
797
797
|
allowed_in: d.allowed_in.length ? d.allowed_in : null,
|
|
798
798
|
description: d.description || null,
|
|
799
799
|
icon: d.icon || null,
|
|
800
|
-
content: M.value ? { ...
|
|
800
|
+
content: M.value ? { ...w, schema: void 0 } : w
|
|
801
801
|
});
|
|
802
802
|
se(v), F.success(
|
|
803
803
|
v.draft && v.draft.number !== T ? n("page.saved", { number: v.draft.number }) : n("page.unchanged")
|
|
@@ -865,7 +865,7 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
865
865
|
}), (T, v) => {
|
|
866
866
|
const O = je("router-link");
|
|
867
867
|
return r(), V("div", hl, [
|
|
868
|
-
|
|
868
|
+
_.value || !p.value ? (r(), V(j, { key: 0 }, [
|
|
869
869
|
u(e(pe), {
|
|
870
870
|
class: "wx-block-editor__ghost-head",
|
|
871
871
|
title: "",
|
|
@@ -916,7 +916,7 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
916
916
|
_: 1
|
|
917
917
|
})
|
|
918
918
|
]),
|
|
919
|
-
x("div",
|
|
919
|
+
x("div", wl, [
|
|
920
920
|
ie.value ? (r(), W(e(G), {
|
|
921
921
|
key: 0,
|
|
922
922
|
type: "primary",
|
|
@@ -986,7 +986,7 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
986
986
|
variant: "soft",
|
|
987
987
|
description: e(n)("page.editing-off")
|
|
988
988
|
}, null, 8, ["description"])),
|
|
989
|
-
x("div",
|
|
989
|
+
x("div", _l, [
|
|
990
990
|
x("div", xl, [
|
|
991
991
|
u(e(Lt), {
|
|
992
992
|
modelValue: m.value,
|
|
@@ -1003,8 +1003,8 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1003
1003
|
u(e(We), {
|
|
1004
1004
|
ref_key: "templateEditor",
|
|
1005
1005
|
ref: Te,
|
|
1006
|
-
modelValue:
|
|
1007
|
-
"onUpdate:modelValue": v[1] || (v[1] = (z) =>
|
|
1006
|
+
modelValue: w.template,
|
|
1007
|
+
"onUpdate:modelValue": v[1] || (v[1] = (z) => w.template = z),
|
|
1008
1008
|
language: "php",
|
|
1009
1009
|
readonly: !g.value,
|
|
1010
1010
|
"min-height": "340px",
|
|
@@ -1026,8 +1026,8 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1026
1026
|
type: "button",
|
|
1027
1027
|
class: "wx-block-editor__pill",
|
|
1028
1028
|
disabled: !g.value,
|
|
1029
|
-
onClick: (
|
|
1030
|
-
textContent: f(
|
|
1029
|
+
onClick: (Pn) => Ce(z),
|
|
1030
|
+
textContent: f(ge(z))
|
|
1031
1031
|
}, null, 8, Sl))), 128))
|
|
1032
1032
|
])) : E("", !0),
|
|
1033
1033
|
u(et, {
|
|
@@ -1047,8 +1047,8 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1047
1047
|
default: c(() => [
|
|
1048
1048
|
x("div", Tl, [
|
|
1049
1049
|
u(e(We), {
|
|
1050
|
-
modelValue:
|
|
1051
|
-
"onUpdate:modelValue": v[2] || (v[2] = (z) =>
|
|
1050
|
+
modelValue: w.styles,
|
|
1051
|
+
"onUpdate:modelValue": v[2] || (v[2] = (z) => w.styles = z),
|
|
1052
1052
|
language: "css",
|
|
1053
1053
|
readonly: !g.value,
|
|
1054
1054
|
"min-height": "340px",
|
|
@@ -1070,12 +1070,12 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1070
1070
|
default: c(() => [
|
|
1071
1071
|
x("div", Cl, [
|
|
1072
1072
|
u(e(We), {
|
|
1073
|
-
"model-value":
|
|
1073
|
+
"model-value": w.script ?? "",
|
|
1074
1074
|
language: "javascript",
|
|
1075
1075
|
readonly: !g.value,
|
|
1076
1076
|
"min-height": "340px",
|
|
1077
1077
|
"max-height": "70vh",
|
|
1078
|
-
"onUpdate:modelValue": v[3] || (v[3] = (z) =>
|
|
1078
|
+
"onUpdate:modelValue": v[3] || (v[3] = (z) => w.script = z || null)
|
|
1079
1079
|
}, null, 8, ["model-value", "readonly"]),
|
|
1080
1080
|
x("div", Bl, [
|
|
1081
1081
|
u(e(R), {
|
|
@@ -1165,7 +1165,7 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1165
1165
|
disabled: !g.value
|
|
1166
1166
|
}, {
|
|
1167
1167
|
default: c(() => [
|
|
1168
|
-
u(e(
|
|
1168
|
+
u(e(ve), {
|
|
1169
1169
|
modelValue: d.slug,
|
|
1170
1170
|
"onUpdate:modelValue": v[4] || (v[4] = (z) => d.slug = z)
|
|
1171
1171
|
}, null, 8, ["modelValue"])
|
|
@@ -1209,7 +1209,7 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1209
1209
|
disabled: !g.value
|
|
1210
1210
|
}, {
|
|
1211
1211
|
default: c(() => [
|
|
1212
|
-
u(e(
|
|
1212
|
+
u(e(ve), {
|
|
1213
1213
|
"model-value": d.icon ?? "",
|
|
1214
1214
|
placeholder: "grid",
|
|
1215
1215
|
"onUpdate:modelValue": v[7] || (v[7] = (z) => d.icon = String(z ?? ""))
|
|
@@ -1357,11 +1357,11 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1357
1357
|
title: e(n)("page.sample")
|
|
1358
1358
|
}, {
|
|
1359
1359
|
default: c(() => [
|
|
1360
|
-
|
|
1360
|
+
w.schema.length ? (r(), W(e(bt), {
|
|
1361
1361
|
key: 0,
|
|
1362
|
-
modelValue:
|
|
1363
|
-
"onUpdate:modelValue": v[14] || (v[14] = (z) =>
|
|
1364
|
-
root: e(Je)(
|
|
1362
|
+
modelValue: be.value,
|
|
1363
|
+
"onUpdate:modelValue": v[14] || (v[14] = (z) => be.value = z),
|
|
1364
|
+
root: e(Je)(w.schema),
|
|
1365
1365
|
types: e(a).types,
|
|
1366
1366
|
translate: e(a).i18n.t,
|
|
1367
1367
|
can: e(a).can,
|
|
@@ -1482,7 +1482,7 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1482
1482
|
},
|
|
1483
1483
|
setup(t) {
|
|
1484
1484
|
const l = t, { resolve: a, dismiss: s, open: o } = ft();
|
|
1485
|
-
|
|
1485
|
+
_e();
|
|
1486
1486
|
const i = Q("webx-blocks"), n = U("");
|
|
1487
1487
|
function h(b) {
|
|
1488
1488
|
if (l.parent === null)
|
|
@@ -1500,7 +1500,7 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1500
1500
|
return b === "" ? p.value : p.value.filter(
|
|
1501
1501
|
({ type: m }) => m.title.toLowerCase().includes(b) || m.slug.includes(b) || (m.description ?? "").toLowerCase().includes(b)
|
|
1502
1502
|
);
|
|
1503
|
-
}),
|
|
1503
|
+
}), _ = C(() => {
|
|
1504
1504
|
const b = [...l.groups];
|
|
1505
1505
|
for (const { type: g } of S.value)
|
|
1506
1506
|
b.includes(g.group) || b.push(g.group);
|
|
@@ -1541,7 +1541,7 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1541
1541
|
]),
|
|
1542
1542
|
default: c(() => [
|
|
1543
1543
|
x("div", Ol, [
|
|
1544
|
-
p.value.length > 0 ? (r(), W(e(
|
|
1544
|
+
p.value.length > 0 ? (r(), W(e(ve), {
|
|
1545
1545
|
key: 0,
|
|
1546
1546
|
modelValue: n.value,
|
|
1547
1547
|
"onUpdate:modelValue": m[0] || (m[0] = (g) => n.value = g),
|
|
@@ -1568,7 +1568,7 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1568
1568
|
]),
|
|
1569
1569
|
_: 1
|
|
1570
1570
|
}, 8, ["title"])) : E("", !0),
|
|
1571
|
-
(r(!0), V(j, null, Y(
|
|
1571
|
+
(r(!0), V(j, null, Y(_.value, (g) => (r(), V("section", {
|
|
1572
1572
|
key: g.id,
|
|
1573
1573
|
class: "wx-block-picker__group"
|
|
1574
1574
|
}, [
|
|
@@ -1577,10 +1577,10 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1577
1577
|
(r(!0), V(j, null, Y(g.options, (d) => (r(), V("button", {
|
|
1578
1578
|
key: d.type.id,
|
|
1579
1579
|
type: "button",
|
|
1580
|
-
class:
|
|
1580
|
+
class: me(["wx-block-picker__card", { "is-disabled": d.reason !== null }]),
|
|
1581
1581
|
disabled: d.reason !== null,
|
|
1582
1582
|
title: d.reason ?? void 0,
|
|
1583
|
-
onClick: (
|
|
1583
|
+
onClick: (w) => e(a)(d.type)
|
|
1584
1584
|
}, [
|
|
1585
1585
|
u(Ct, {
|
|
1586
1586
|
thumbnail: d.type.thumbnail,
|
|
@@ -1623,10 +1623,11 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1623
1623
|
url: {},
|
|
1624
1624
|
selected: { default: null },
|
|
1625
1625
|
mode: { default: "wide" },
|
|
1626
|
-
reload: { default: 0 }
|
|
1626
|
+
reload: { default: 0 },
|
|
1627
|
+
fill: { type: Boolean, default: !1 }
|
|
1627
1628
|
},
|
|
1628
1629
|
setup(t, { expose: l }) {
|
|
1629
|
-
const a = t, s = Q("webx-blocks"), o = U(null), i = U(null), n = He(i), h = U(!1), p = U(1280), S = U(!1),
|
|
1630
|
+
const a = t, s = Q("webx-blocks"), o = U(null), i = U(null), n = He(i), h = U(!1), p = U(1280), S = U(!1), _ = C(() => [
|
|
1630
1631
|
{ value: 1280, label: s("field.width-desktop") },
|
|
1631
1632
|
{ value: 834, label: s("field.width-tablet") },
|
|
1632
1633
|
{ value: 390, label: s("field.width-phone") }
|
|
@@ -1655,7 +1656,7 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1655
1656
|
const N = g();
|
|
1656
1657
|
N && De(N, a.selected ?? null);
|
|
1657
1658
|
}
|
|
1658
|
-
function
|
|
1659
|
+
function w(N, I) {
|
|
1659
1660
|
const P = g();
|
|
1660
1661
|
if (!P || !S.value) return !1;
|
|
1661
1662
|
const H = Yt(P, N, I);
|
|
@@ -1676,8 +1677,8 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1676
1677
|
), le(() => a.reload, B), le(
|
|
1677
1678
|
() => a.url,
|
|
1678
1679
|
() => S.value = !1
|
|
1679
|
-
), ye(() => window.addEventListener("keydown", M)), Re(() => window.removeEventListener("keydown", M)), l({ replace:
|
|
1680
|
-
class:
|
|
1680
|
+
), ye(() => window.addEventListener("keydown", M)), Re(() => window.removeEventListener("keydown", M)), l({ replace: w, refresh: B, open: () => h.value = !0 }), (N, I) => (r(), V("div", {
|
|
1681
|
+
class: me(["wx-blocks-preview", { "is-fullscreen": h.value, "is-phone": t.mode === "phone", "is-fill": t.fill }])
|
|
1681
1682
|
}, [
|
|
1682
1683
|
x("div", Zl, [
|
|
1683
1684
|
u(e(R), {
|
|
@@ -1696,7 +1697,7 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1696
1697
|
key: 0,
|
|
1697
1698
|
modelValue: p.value,
|
|
1698
1699
|
"onUpdate:modelValue": I[0] || (I[0] = (P) => p.value = P),
|
|
1699
|
-
options:
|
|
1700
|
+
options: _.value,
|
|
1700
1701
|
size: "sm"
|
|
1701
1702
|
}, null, 8, ["modelValue", "options"])) : E("", !0),
|
|
1702
1703
|
t.url ? (r(), W(e(q), {
|
|
@@ -1747,7 +1748,7 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1747
1748
|
], 512)
|
|
1748
1749
|
], 2));
|
|
1749
1750
|
}
|
|
1750
|
-
}), Xl = /* @__PURE__ */ Z(Ql, [["__scopeId", "data-v-
|
|
1751
|
+
}), Xl = /* @__PURE__ */ Z(Ql, [["__scopeId", "data-v-2482da45"]]), en = { class: "wx-blocks-tree__node" }, tn = ["onClick", "onKeydown"], ln = { class: "wx-blocks-tree__icon" }, nn = { class: "wx-blocks-tree__name" }, an = ["title"], sn = ["title"], on = ["title"], rn = ["onClick"], un = /* @__PURE__ */ K({
|
|
1751
1752
|
__name: "BlocksTree",
|
|
1752
1753
|
props: {
|
|
1753
1754
|
nodes: {},
|
|
@@ -1761,24 +1762,24 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1761
1762
|
emits: ["select", "add", "remove", "duplicate", "reorder"],
|
|
1762
1763
|
setup(t, { emit: l }) {
|
|
1763
1764
|
const a = t, s = l, o = Q("webx-blocks");
|
|
1764
|
-
function i(
|
|
1765
|
-
return a.catalog.find((k) => k.slug ===
|
|
1765
|
+
function i(_) {
|
|
1766
|
+
return a.catalog.find((k) => k.slug === _.type) ?? null;
|
|
1766
1767
|
}
|
|
1767
|
-
function n(
|
|
1768
|
-
return i(
|
|
1768
|
+
function n(_) {
|
|
1769
|
+
return i(_)?.title ?? _.type;
|
|
1769
1770
|
}
|
|
1770
|
-
function h(
|
|
1771
|
-
const k = i(
|
|
1771
|
+
function h(_) {
|
|
1772
|
+
const k = i(_);
|
|
1772
1773
|
return k?.content ? xt(k.content.schema) : [];
|
|
1773
1774
|
}
|
|
1774
|
-
function p(
|
|
1775
|
-
const b =
|
|
1775
|
+
function p(_, k) {
|
|
1776
|
+
const b = _.values[k.id];
|
|
1776
1777
|
return Array.isArray(b) ? b : [];
|
|
1777
1778
|
}
|
|
1778
|
-
function S(
|
|
1779
|
-
return i(
|
|
1779
|
+
function S(_) {
|
|
1780
|
+
return i(_)?.icon ?? "grid";
|
|
1780
1781
|
}
|
|
1781
|
-
return (
|
|
1782
|
+
return (_, k) => {
|
|
1782
1783
|
const b = je("blocks-tree", !0);
|
|
1783
1784
|
return r(), W(e(Dt), {
|
|
1784
1785
|
"model-value": t.nodes,
|
|
@@ -1788,13 +1789,13 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1788
1789
|
plain: "",
|
|
1789
1790
|
size: "sm",
|
|
1790
1791
|
"empty-text": t.depth === 0 ? e(o)("field.empty") : "",
|
|
1791
|
-
class:
|
|
1792
|
+
class: me(["wx-blocks-tree", { "is-nested": t.depth > 0 }]),
|
|
1792
1793
|
"onUpdate:modelValue": k[6] || (k[6] = (m) => s("reorder", t.parentKey, t.field, m))
|
|
1793
1794
|
}, {
|
|
1794
1795
|
default: c(({ item: m }) => [
|
|
1795
1796
|
x("div", en, [
|
|
1796
1797
|
x("div", {
|
|
1797
|
-
class:
|
|
1798
|
+
class: me(["wx-blocks-tree__row", { "is-selected": t.selected === m.key }]),
|
|
1798
1799
|
role: "button",
|
|
1799
1800
|
tabindex: "0",
|
|
1800
1801
|
onClick: (y) => s("select", m.key),
|
|
@@ -1862,10 +1863,10 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1862
1863
|
disabled: t.disabled,
|
|
1863
1864
|
depth: t.depth + 1,
|
|
1864
1865
|
onSelect: k[1] || (k[1] = (g) => s("select", g)),
|
|
1865
|
-
onAdd: k[2] || (k[2] = (g, d,
|
|
1866
|
+
onAdd: k[2] || (k[2] = (g, d, w) => s("add", g, d, w)),
|
|
1866
1867
|
onRemove: k[3] || (k[3] = (g) => s("remove", g)),
|
|
1867
1868
|
onDuplicate: k[4] || (k[4] = (g) => s("duplicate", g)),
|
|
1868
|
-
onReorder: k[5] || (k[5] = (g, d,
|
|
1869
|
+
onReorder: k[5] || (k[5] = (g, d, w) => s("reorder", g, d, w))
|
|
1869
1870
|
}, null, 8, ["nodes", "catalog", "parent-key", "field", "selected", "disabled", "depth"]),
|
|
1870
1871
|
t.disabled ? E("", !0) : (r(), V("button", {
|
|
1871
1872
|
key: 0,
|
|
@@ -1886,22 +1887,19 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
|
|
|
1886
1887
|
};
|
|
1887
1888
|
}
|
|
1888
1889
|
}), cn = /* @__PURE__ */ Z(un, [["__scopeId", "data-v-5d559d85"]]), Ke = /* @__PURE__ */ Symbol("wx-blocks-preview");
|
|
1889
|
-
function
|
|
1890
|
+
function qn(t) {
|
|
1890
1891
|
rt(Ke, t);
|
|
1891
1892
|
}
|
|
1892
|
-
function
|
|
1893
|
+
function Jn() {
|
|
1893
1894
|
return ze(Ke, null);
|
|
1894
1895
|
}
|
|
1895
1896
|
const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
1896
1897
|
key: 0,
|
|
1897
1898
|
class: "wx-blocks-nested"
|
|
1898
|
-
}, pn = {
|
|
1899
|
-
key: 1,
|
|
1900
|
-
class: "wx-blocks-host"
|
|
1901
|
-
}, fn = { class: "wx-blocks__tree" }, mn = { class: "wx-blocks__panel-head" }, vn = { class: "wx-blocks__panel-title" }, hn = {
|
|
1899
|
+
}, pn = { class: "wx-blocks__tree" }, fn = { class: "wx-blocks__panel-head" }, mn = { class: "wx-blocks__panel-title" }, vn = {
|
|
1902
1900
|
key: 0,
|
|
1903
1901
|
class: "wx-blocks__fields"
|
|
1904
|
-
},
|
|
1902
|
+
}, hn = { class: "wx-blocks__panel-head" }, bn = { class: "wx-blocks__panel-title" }, gn = { class: "wx-blocks__panel-extra" }, kn = { class: "wx-blocks__form" }, yn = {
|
|
1905
1903
|
key: 1,
|
|
1906
1904
|
class: "wx-blocks__preview"
|
|
1907
1905
|
}, wn = /* @__PURE__ */ K({
|
|
@@ -1917,7 +1915,8 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
1917
1915
|
max: { default: null },
|
|
1918
1916
|
catalog: { default: null },
|
|
1919
1917
|
disabled: { type: Boolean, default: !1 },
|
|
1920
|
-
blocksPath: { default: "/blocks" }
|
|
1918
|
+
blocksPath: { default: "/blocks" },
|
|
1919
|
+
fill: { type: Boolean, default: !1 }
|
|
1921
1920
|
}, {
|
|
1922
1921
|
modelValue: { default: () => [] },
|
|
1923
1922
|
modelModifiers: {}
|
|
@@ -1925,22 +1924,22 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
1925
1924
|
emits: ["update:modelValue"],
|
|
1926
1925
|
setup(t) {
|
|
1927
1926
|
const l = t, a = zt(t, "modelValue"), s = ze(ot, !1);
|
|
1928
|
-
rt(ot, !0),
|
|
1927
|
+
rt(ot, !0), _e();
|
|
1929
1928
|
const o = Q("webx-blocks"), i = ze(Nt, null);
|
|
1930
1929
|
let n = null;
|
|
1931
|
-
const h = U([]), p = C(() => l.catalog ?? h.value), S = C(() => Array.isArray(a.value) ? a.value : []),
|
|
1930
|
+
const h = U([]), p = C(() => l.catalog ?? h.value), S = C(() => Array.isArray(a.value) ? a.value : []), _ = U(null), k = C(() => _.value ? oe(S.value, _.value) : null), b = C(
|
|
1932
1931
|
() => k.value ? p.value.find((A) => A.slug === k.value?.node.type) ?? null : null
|
|
1933
1932
|
), m = ze(Ke, null), y = U(null), g = C(
|
|
1934
1933
|
() => i?.state.manifest?.modules.find((A) => A.id === "blocks")?.meta?.groups ?? []
|
|
1935
|
-
), d = Et()?.type,
|
|
1934
|
+
), d = Et()?.type, w = C(() => l.context?.types ? l.context.types : i?.types ? { ...Pe, ...i.types } : d ? { ...Pe, "wx-blocks": { component: d, kind: "field", nested: !0 } } : Pe), B = C(
|
|
1936
1935
|
() => l.context?.translate ?? i?.i18n.t ?? ((A) => A)
|
|
1937
1936
|
), M = C(() => l.context?.can ?? i?.can ?? (() => !0)), N = ht(Kl);
|
|
1938
1937
|
function I(A) {
|
|
1939
1938
|
a.value = A;
|
|
1940
1939
|
}
|
|
1941
1940
|
async function P(A, L, D) {
|
|
1942
|
-
const X = A ? oe(S.value, A) : null, ee = X ? p.value.find((Ie) => Ie.slug === X.node.type) ?? null : null, Te = A === null ? l.allow : D?.props?.allow ?? null,
|
|
1943
|
-
if (
|
|
1941
|
+
const X = A ? oe(S.value, A) : null, ee = X ? p.value.find((Ie) => Ie.slug === X.node.type) ?? null : null, Te = A === null ? l.allow : D?.props?.allow ?? null, ge = A === null ? l.max : D?.props?.max ?? null, Ce = A === null ? S.value : X && L ? X.node.values[L] ?? [] : [];
|
|
1942
|
+
if (ge != null && Ce.length >= ge) return;
|
|
1944
1943
|
const ue = await N({
|
|
1945
1944
|
catalog: p.value,
|
|
1946
1945
|
parent: ee,
|
|
@@ -1951,7 +1950,7 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
1951
1950
|
});
|
|
1952
1951
|
if (!ue) return;
|
|
1953
1952
|
const Be = sl(ue.slug, H(ue));
|
|
1954
|
-
I(nt(S.value, A, L, Ce.length, Be)),
|
|
1953
|
+
I(nt(S.value, A, L, Ce.length, Be)), _.value = Be.key;
|
|
1955
1954
|
}
|
|
1956
1955
|
function H(A) {
|
|
1957
1956
|
const L = A.content?.sample ?? {}, D = {};
|
|
@@ -1960,32 +1959,32 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
1960
1959
|
return D;
|
|
1961
1960
|
}
|
|
1962
1961
|
function xe(A) {
|
|
1963
|
-
|
|
1962
|
+
_.value === A && (_.value = null), I(rl(S.value, A));
|
|
1964
1963
|
}
|
|
1965
1964
|
function ie(A) {
|
|
1966
1965
|
const L = oe(S.value, A);
|
|
1967
1966
|
if (!L) return;
|
|
1968
1967
|
const D = $t(L.node);
|
|
1969
|
-
I(nt(S.value, L.parent?.key ?? null, L.field, L.index + 1, D)),
|
|
1968
|
+
I(nt(S.value, L.parent?.key ?? null, L.field, L.index + 1, D)), _.value = D.key;
|
|
1970
1969
|
}
|
|
1971
1970
|
function $e(A, L, D) {
|
|
1972
1971
|
I(cl(S.value, A, L, D));
|
|
1973
1972
|
}
|
|
1974
1973
|
function Ue(A) {
|
|
1975
|
-
|
|
1974
|
+
_.value = _.value === A ? null : A;
|
|
1976
1975
|
}
|
|
1977
|
-
function
|
|
1978
|
-
|
|
1976
|
+
function be() {
|
|
1977
|
+
_.value = null;
|
|
1979
1978
|
}
|
|
1980
1979
|
function Ve(A) {
|
|
1981
|
-
|
|
1980
|
+
_.value && I(ul(S.value, _.value, A));
|
|
1982
1981
|
}
|
|
1983
1982
|
let re;
|
|
1984
1983
|
le(
|
|
1985
1984
|
() => k.value?.node.values,
|
|
1986
1985
|
(A, L) => {
|
|
1987
1986
|
if (!A || !L || !b.value || !n || !m) return;
|
|
1988
|
-
const D =
|
|
1987
|
+
const D = _.value, X = b.value.id;
|
|
1989
1988
|
clearTimeout(re), re = setTimeout(() => {
|
|
1990
1989
|
!D || !n || n.render(X, { values: A, key: D }).then((ee) => {
|
|
1991
1990
|
y.value?.replace(D, ee.html) || y.value?.refresh();
|
|
@@ -1996,17 +1995,17 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
1996
1995
|
{ deep: !0 }
|
|
1997
1996
|
);
|
|
1998
1997
|
function se(A) {
|
|
1999
|
-
A.key === "Escape" &&
|
|
1998
|
+
A.key === "Escape" && _.value && be();
|
|
2000
1999
|
}
|
|
2001
2000
|
ye(async () => {
|
|
2002
2001
|
if (window.addEventListener("keydown", se), l.catalog === null && i) {
|
|
2003
|
-
n =
|
|
2002
|
+
n = he(i);
|
|
2004
2003
|
try {
|
|
2005
2004
|
h.value = await n.catalog();
|
|
2006
2005
|
} catch (A) {
|
|
2007
2006
|
F.danger(A.body?.message ?? String(A));
|
|
2008
2007
|
}
|
|
2009
|
-
} else i && (n =
|
|
2008
|
+
} else i && (n = he(i));
|
|
2010
2009
|
}), Re(() => {
|
|
2011
2010
|
clearTimeout(re), window.removeEventListener("keydown", se);
|
|
2012
2011
|
});
|
|
@@ -2023,16 +2022,19 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2023
2022
|
]),
|
|
2024
2023
|
_: 1
|
|
2025
2024
|
})
|
|
2026
|
-
])) : (r(), V("div",
|
|
2025
|
+
])) : (r(), V("div", {
|
|
2026
|
+
key: 1,
|
|
2027
|
+
class: me(["wx-blocks-host", { "is-fill": t.fill }])
|
|
2028
|
+
}, [
|
|
2027
2029
|
x("div", {
|
|
2028
|
-
class:
|
|
2030
|
+
class: me(["wx-blocks", {
|
|
2029
2031
|
"is-editing": k.value !== null,
|
|
2030
2032
|
"has-preview": e(m) !== null && e(m).url.value !== null
|
|
2031
2033
|
}])
|
|
2032
2034
|
}, [
|
|
2033
|
-
x("div",
|
|
2034
|
-
x("div",
|
|
2035
|
-
x("span",
|
|
2035
|
+
x("div", pn, [
|
|
2036
|
+
x("div", fn, [
|
|
2037
|
+
x("span", mn, f(e(o)("field.blocks")), 1),
|
|
2036
2038
|
u(e(R), {
|
|
2037
2039
|
size: "sm",
|
|
2038
2040
|
tone: "muted"
|
|
@@ -2046,7 +2048,7 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2046
2048
|
u(cn, {
|
|
2047
2049
|
nodes: S.value,
|
|
2048
2050
|
catalog: p.value,
|
|
2049
|
-
selected:
|
|
2051
|
+
selected: _.value,
|
|
2050
2052
|
disabled: t.disabled,
|
|
2051
2053
|
onSelect: Ue,
|
|
2052
2054
|
onAdd: P,
|
|
@@ -2080,15 +2082,15 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2080
2082
|
_: 1
|
|
2081
2083
|
})) : E("", !0)
|
|
2082
2084
|
]),
|
|
2083
|
-
k.value ? (r(), V("div",
|
|
2084
|
-
x("div",
|
|
2085
|
-
x("span",
|
|
2086
|
-
x("span",
|
|
2085
|
+
k.value ? (r(), V("div", vn, [
|
|
2086
|
+
x("div", hn, [
|
|
2087
|
+
x("span", bn, f(b.value?.title ?? k.value.node.type), 1),
|
|
2088
|
+
x("span", gn, [
|
|
2087
2089
|
x("code", null, f(k.value.node.type), 1),
|
|
2088
2090
|
u(e(q), {
|
|
2089
2091
|
size: "sm",
|
|
2090
2092
|
variant: "outline",
|
|
2091
|
-
onClick:
|
|
2093
|
+
onClick: be
|
|
2092
2094
|
}, {
|
|
2093
2095
|
default: c(() => [
|
|
2094
2096
|
$(f(e(o)("field.done")) + " · Esc", 1)
|
|
@@ -2097,12 +2099,12 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2097
2099
|
})
|
|
2098
2100
|
])
|
|
2099
2101
|
]),
|
|
2100
|
-
x("div",
|
|
2102
|
+
x("div", kn, [
|
|
2101
2103
|
b.value?.content ? (r(), W(e(bt), {
|
|
2102
2104
|
key: k.value.node.key,
|
|
2103
2105
|
"model-value": k.value.node.values,
|
|
2104
2106
|
root: Se.value,
|
|
2105
|
-
types:
|
|
2107
|
+
types: w.value,
|
|
2106
2108
|
translate: B.value,
|
|
2107
2109
|
can: M.value,
|
|
2108
2110
|
disabled: t.disabled,
|
|
@@ -2119,20 +2121,21 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2119
2121
|
}))
|
|
2120
2122
|
])
|
|
2121
2123
|
])) : E("", !0),
|
|
2122
|
-
e(m) && e(m).url.value ? (r(), V("div",
|
|
2124
|
+
e(m) && e(m).url.value ? (r(), V("div", yn, [
|
|
2123
2125
|
u(Xl, {
|
|
2124
2126
|
ref_key: "previewEl",
|
|
2125
2127
|
ref: y,
|
|
2126
2128
|
url: e(m).url.value,
|
|
2127
|
-
selected:
|
|
2129
|
+
selected: _.value,
|
|
2128
2130
|
mode: k.value ? "phone" : "wide",
|
|
2129
|
-
reload: e(m).reload?.value ?? 0
|
|
2130
|
-
|
|
2131
|
+
reload: e(m).reload?.value ?? 0,
|
|
2132
|
+
fill: t.fill
|
|
2133
|
+
}, null, 8, ["url", "selected", "mode", "reload", "fill"])
|
|
2131
2134
|
])) : E("", !0)
|
|
2132
2135
|
], 2)
|
|
2133
|
-
]));
|
|
2136
|
+
], 2));
|
|
2134
2137
|
}
|
|
2135
|
-
}),
|
|
2138
|
+
}), _n = /* @__PURE__ */ Z(wn, [["__scopeId", "data-v-3f14c6c6"]]), xn = { class: "wx-block-card__body" }, $n = { class: "wx-block-card__title" }, Vn = { class: "wx-block-card__chips" }, Sn = /* @__PURE__ */ K({
|
|
2136
2139
|
__name: "BlockCard",
|
|
2137
2140
|
props: {
|
|
2138
2141
|
block: {}
|
|
@@ -2149,8 +2152,8 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2149
2152
|
thumbnail: t.block.thumbnail,
|
|
2150
2153
|
height: 120
|
|
2151
2154
|
}, null, 8, ["thumbnail"]),
|
|
2152
|
-
x("div",
|
|
2153
|
-
x("div",
|
|
2155
|
+
x("div", xn, [
|
|
2156
|
+
x("div", $n, f(t.block.title), 1),
|
|
2154
2157
|
u(e(R), {
|
|
2155
2158
|
size: "sm",
|
|
2156
2159
|
tone: "muted"
|
|
@@ -2161,7 +2164,7 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2161
2164
|
]),
|
|
2162
2165
|
_: 1
|
|
2163
2166
|
}),
|
|
2164
|
-
x("div",
|
|
2167
|
+
x("div", Vn, [
|
|
2165
2168
|
t.block.draft ? (r(), W(e(G), {
|
|
2166
2169
|
key: 0,
|
|
2167
2170
|
type: "warning",
|
|
@@ -2204,12 +2207,12 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2204
2207
|
])
|
|
2205
2208
|
]));
|
|
2206
2209
|
}
|
|
2207
|
-
}),
|
|
2210
|
+
}), Tn = /* @__PURE__ */ Z(Sn, [["__scopeId", "data-v-daa12de4"]]), Cn = { class: "wx-block-create" }, Bn = /* @__PURE__ */ K({
|
|
2208
2211
|
__name: "BlockCreateDialog",
|
|
2209
2212
|
setup(t) {
|
|
2210
|
-
const { resolve: l, dismiss: a, open: s } = ft(), o =
|
|
2211
|
-
|
|
2212
|
-
const n = Q("webx-blocks"), h = C(() => o.state.manifest?.modules.find((
|
|
2213
|
+
const { resolve: l, dismiss: a, open: s } = ft(), o = we(), i = he(o);
|
|
2214
|
+
_e();
|
|
2215
|
+
const n = Q("webx-blocks"), h = C(() => o.state.manifest?.modules.find((w) => w.id === "blocks")?.meta?.groups ?? ["content"]), p = U({ title: "", slug: "", group: h.value[0] ?? "content" }), S = U({}), _ = U(!1), k = U(!1), b = C(
|
|
2213
2216
|
() => h.value.map((d) => ({ value: d, label: ke(d, n) }))
|
|
2214
2217
|
);
|
|
2215
2218
|
function m(d) {
|
|
@@ -2225,19 +2228,19 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2225
2228
|
return S.value[d]?.[0];
|
|
2226
2229
|
}
|
|
2227
2230
|
async function g() {
|
|
2228
|
-
|
|
2231
|
+
_.value = !0, S.value = {};
|
|
2229
2232
|
try {
|
|
2230
2233
|
l(await i.create(p.value));
|
|
2231
2234
|
} catch (d) {
|
|
2232
|
-
const
|
|
2233
|
-
|
|
2235
|
+
const w = d.body;
|
|
2236
|
+
w?.errors ? S.value = w.errors : F.danger(w?.message ?? n("page.failed"));
|
|
2234
2237
|
} finally {
|
|
2235
|
-
|
|
2238
|
+
_.value = !1;
|
|
2236
2239
|
}
|
|
2237
2240
|
}
|
|
2238
|
-
return (d,
|
|
2241
|
+
return (d, w) => (r(), W(e(mt), {
|
|
2239
2242
|
open: e(s),
|
|
2240
|
-
"onUpdate:open":
|
|
2243
|
+
"onUpdate:open": w[5] || (w[5] = (B) => it(s) ? s.value = B : null),
|
|
2241
2244
|
title: e(n)("page.new"),
|
|
2242
2245
|
width: 520
|
|
2243
2246
|
}, {
|
|
@@ -2246,7 +2249,7 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2246
2249
|
default: c(() => [
|
|
2247
2250
|
u(e(q), {
|
|
2248
2251
|
variant: "outline",
|
|
2249
|
-
onClick:
|
|
2252
|
+
onClick: w[4] || (w[4] = (B) => e(a)())
|
|
2250
2253
|
}, {
|
|
2251
2254
|
default: c(() => [
|
|
2252
2255
|
$(f(e(n)("page.cancel")), 1)
|
|
@@ -2255,7 +2258,7 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2255
2258
|
}),
|
|
2256
2259
|
u(e(q), {
|
|
2257
2260
|
type: "primary",
|
|
2258
|
-
loading:
|
|
2261
|
+
loading: _.value,
|
|
2259
2262
|
onClick: g
|
|
2260
2263
|
}, {
|
|
2261
2264
|
default: c(() => [
|
|
@@ -2268,15 +2271,15 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2268
2271
|
})
|
|
2269
2272
|
]),
|
|
2270
2273
|
default: c(() => [
|
|
2271
|
-
x("div",
|
|
2274
|
+
x("div", Cn, [
|
|
2272
2275
|
u(e(J), {
|
|
2273
2276
|
label: e(n)("page.title"),
|
|
2274
2277
|
error: y("title")
|
|
2275
2278
|
}, {
|
|
2276
2279
|
default: c(() => [
|
|
2277
|
-
u(e(
|
|
2280
|
+
u(e(ve), {
|
|
2278
2281
|
modelValue: p.value.title,
|
|
2279
|
-
"onUpdate:modelValue":
|
|
2282
|
+
"onUpdate:modelValue": w[0] || (w[0] = (B) => p.value.title = B),
|
|
2280
2283
|
autofocus: ""
|
|
2281
2284
|
}, null, 8, ["modelValue"])
|
|
2282
2285
|
]),
|
|
@@ -2288,11 +2291,11 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2288
2291
|
error: y("slug")
|
|
2289
2292
|
}, {
|
|
2290
2293
|
default: c(() => [
|
|
2291
|
-
u(e(
|
|
2294
|
+
u(e(ve), {
|
|
2292
2295
|
modelValue: p.value.slug,
|
|
2293
|
-
"onUpdate:modelValue":
|
|
2296
|
+
"onUpdate:modelValue": w[1] || (w[1] = (B) => p.value.slug = B),
|
|
2294
2297
|
placeholder: "hero",
|
|
2295
|
-
onInput:
|
|
2298
|
+
onInput: w[2] || (w[2] = (B) => k.value = !0)
|
|
2296
2299
|
}, null, 8, ["modelValue"])
|
|
2297
2300
|
]),
|
|
2298
2301
|
_: 1
|
|
@@ -2305,7 +2308,7 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2305
2308
|
default: c(() => [
|
|
2306
2309
|
u(e(pt), {
|
|
2307
2310
|
modelValue: p.value.group,
|
|
2308
|
-
"onUpdate:modelValue":
|
|
2311
|
+
"onUpdate:modelValue": w[3] || (w[3] = (B) => p.value.group = B),
|
|
2309
2312
|
options: b.value
|
|
2310
2313
|
}, null, 8, ["modelValue", "options"])
|
|
2311
2314
|
]),
|
|
@@ -2316,25 +2319,25 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2316
2319
|
_: 1
|
|
2317
2320
|
}, 8, ["open", "title"]));
|
|
2318
2321
|
}
|
|
2319
|
-
}),
|
|
2322
|
+
}), Wn = /* @__PURE__ */ Z(Bn, [["__scopeId", "data-v-274bc88a"]]), An = { class: "wx-blocks-page" }, zn = { class: "wx-blocks-page__head" }, En = { class: "wx-blocks-page__cards" }, Un = { class: "wx-blocks-page__ghost-body" }, In = {
|
|
2320
2323
|
key: 0,
|
|
2321
2324
|
class: "wx-blocks-page__group-title"
|
|
2322
|
-
},
|
|
2325
|
+
}, Nn = { class: "wx-blocks-page__cards" }, Ln = /* @__PURE__ */ K({
|
|
2323
2326
|
__name: "BlocksPage",
|
|
2324
2327
|
props: {
|
|
2325
2328
|
base: { default: "/blocks" }
|
|
2326
2329
|
},
|
|
2327
2330
|
setup(t) {
|
|
2328
|
-
const l = t, a =
|
|
2329
|
-
|
|
2330
|
-
const i = Q("webx-blocks"), n = U([]), h = U(!0), p = U(""), S = ht(
|
|
2331
|
+
const l = t, a = we(), s = he(a), o = ut();
|
|
2332
|
+
_e();
|
|
2333
|
+
const i = Q("webx-blocks"), n = U([]), h = U(!0), p = U(""), S = ht(Wn), _ = C(() => {
|
|
2331
2334
|
const B = a.state.manifest?.modules.find((M) => M.id === "blocks")?.meta;
|
|
2332
2335
|
return {
|
|
2333
2336
|
groups: B?.groups ?? [],
|
|
2334
2337
|
editing: B?.editing ?? !0,
|
|
2335
2338
|
provides: B?.provides ?? []
|
|
2336
2339
|
};
|
|
2337
|
-
}), k = C(() => a.can("blocks.manage") &&
|
|
2340
|
+
}), k = C(() => a.can("blocks.manage") && _.value.editing), b = C(
|
|
2338
2341
|
() => a.state.manifest?.modules.find((B) => B.id === "blocks")?.title ?? i("module.title")
|
|
2339
2342
|
), m = C(() => {
|
|
2340
2343
|
const B = p.value.trim().toLowerCase();
|
|
@@ -2342,7 +2345,7 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2342
2345
|
(M) => M.title.toLowerCase().includes(B) || M.slug.includes(B) || (M.description ?? "").toLowerCase().includes(B)
|
|
2343
2346
|
);
|
|
2344
2347
|
}), y = C(() => {
|
|
2345
|
-
const B = [...
|
|
2348
|
+
const B = [..._.value.groups];
|
|
2346
2349
|
for (const I of m.value)
|
|
2347
2350
|
B.includes(I.group) || B.push(I.group);
|
|
2348
2351
|
const M = B.map((I) => ({
|
|
@@ -2365,12 +2368,12 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2365
2368
|
function d(B) {
|
|
2366
2369
|
o.push(`${l.base}/${B.id}`);
|
|
2367
2370
|
}
|
|
2368
|
-
async function
|
|
2371
|
+
async function w() {
|
|
2369
2372
|
const B = await S({});
|
|
2370
2373
|
B && d(B);
|
|
2371
2374
|
}
|
|
2372
|
-
return ye(g), (B, M) => (r(), V("div",
|
|
2373
|
-
x("div",
|
|
2375
|
+
return ye(g), (B, M) => (r(), V("div", An, [
|
|
2376
|
+
x("div", zn, [
|
|
2374
2377
|
u(e(Rt), { level: 2 }, {
|
|
2375
2378
|
default: c(() => [
|
|
2376
2379
|
$(f(b.value), 1)
|
|
@@ -2381,7 +2384,7 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2381
2384
|
key: 0,
|
|
2382
2385
|
type: "primary",
|
|
2383
2386
|
icon: "plus",
|
|
2384
|
-
onClick:
|
|
2387
|
+
onClick: w
|
|
2385
2388
|
}, {
|
|
2386
2389
|
default: c(() => [
|
|
2387
2390
|
$(f(e(i)("page.new")), 1)
|
|
@@ -2389,13 +2392,13 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2389
2392
|
_: 1
|
|
2390
2393
|
})) : E("", !0)
|
|
2391
2394
|
]),
|
|
2392
|
-
|
|
2395
|
+
_.value.editing ? E("", !0) : (r(), W(e(dt), {
|
|
2393
2396
|
key: 0,
|
|
2394
2397
|
type: "info",
|
|
2395
2398
|
variant: "soft",
|
|
2396
2399
|
description: e(i)("page.editing-off")
|
|
2397
2400
|
}, null, 8, ["description"])),
|
|
2398
|
-
h.value || n.value.length > 0 ? (r(), W(e(
|
|
2401
|
+
h.value || n.value.length > 0 ? (r(), W(e(ve), {
|
|
2399
2402
|
key: 1,
|
|
2400
2403
|
modelValue: p.value,
|
|
2401
2404
|
"onUpdate:modelValue": M[0] || (M[0] = (N) => p.value = N),
|
|
@@ -2405,7 +2408,7 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2405
2408
|
}, null, 8, ["modelValue", "placeholder"])) : E("", !0),
|
|
2406
2409
|
h.value ? (r(), W(e(pe), { key: 2 }, {
|
|
2407
2410
|
template: c(() => [
|
|
2408
|
-
x("div",
|
|
2411
|
+
x("div", En, [
|
|
2409
2412
|
(r(), V(j, null, Y(4, (N) => x("div", {
|
|
2410
2413
|
key: N,
|
|
2411
2414
|
class: "wx-blocks-page__ghost"
|
|
@@ -2415,7 +2418,7 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2415
2418
|
height: 120,
|
|
2416
2419
|
class: "wx-blocks-page__ghost-thumb"
|
|
2417
2420
|
}),
|
|
2418
|
-
x("div",
|
|
2421
|
+
x("div", Un, [
|
|
2419
2422
|
u(e(Ae), {
|
|
2420
2423
|
variant: "title",
|
|
2421
2424
|
width: "45%"
|
|
@@ -2443,9 +2446,9 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2443
2446
|
key: N.id,
|
|
2444
2447
|
class: "wx-blocks-page__group"
|
|
2445
2448
|
}, [
|
|
2446
|
-
N.label ? (r(), V("div",
|
|
2447
|
-
x("div",
|
|
2448
|
-
(r(!0), V(j, null, Y(N.blocks, (I) => (r(), W(
|
|
2449
|
+
N.label ? (r(), V("div", In, f(N.label), 1)) : E("", !0),
|
|
2450
|
+
x("div", Nn, [
|
|
2451
|
+
(r(!0), V(j, null, Y(N.blocks, (I) => (r(), W(Tn, {
|
|
2449
2452
|
key: I.id,
|
|
2450
2453
|
block: I,
|
|
2451
2454
|
onOpen: d
|
|
@@ -2454,14 +2457,14 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
|
|
|
2454
2457
|
]))), 128))
|
|
2455
2458
|
]));
|
|
2456
2459
|
}
|
|
2457
|
-
}),
|
|
2458
|
-
function
|
|
2460
|
+
}), Mn = /* @__PURE__ */ Z(Ln, [["__scopeId", "data-v-6e58b664"]]);
|
|
2461
|
+
function Kn(t = {}) {
|
|
2459
2462
|
const l = t.path ?? "/blocks";
|
|
2460
2463
|
return {
|
|
2461
2464
|
id: "blocks",
|
|
2462
2465
|
path: l,
|
|
2463
2466
|
routes: [
|
|
2464
|
-
{ path: l, name: "webx.blocks", component:
|
|
2467
|
+
{ path: l, name: "webx.blocks", component: Mn, props: { base: l } },
|
|
2465
2468
|
{
|
|
2466
2469
|
path: `${l}/:id(\\d+)`,
|
|
2467
2470
|
name: "webx.blocks.edit",
|
|
@@ -2474,7 +2477,7 @@ function Zn(t = {}) {
|
|
|
2474
2477
|
// draws its children through the renderer; it needs the node for `props.allow` alone.
|
|
2475
2478
|
types: {
|
|
2476
2479
|
"wx-blocks": {
|
|
2477
|
-
component:
|
|
2480
|
+
component: _n,
|
|
2478
2481
|
kind: "field",
|
|
2479
2482
|
nested: !0,
|
|
2480
2483
|
bind: () => ({ blocksPath: l })
|
|
@@ -2487,14 +2490,14 @@ export {
|
|
|
2487
2490
|
Kl as WxBlockPicker,
|
|
2488
2491
|
al as WxBlockStage,
|
|
2489
2492
|
Ct as WxBlockThumb,
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
+
_n as WxBlocks,
|
|
2494
|
+
Mn as WxBlocksPage,
|
|
2495
|
+
Kn as blocks,
|
|
2493
2496
|
dl as blocksMessages,
|
|
2494
2497
|
Ke as blocksPreviewKey,
|
|
2495
2498
|
$t as cloneNode,
|
|
2496
2499
|
ol as countType,
|
|
2497
|
-
|
|
2500
|
+
he as createBlocksApi,
|
|
2498
2501
|
gt as findRange,
|
|
2499
2502
|
Je as formSchema,
|
|
2500
2503
|
De as highlightBlock,
|
|
@@ -2504,16 +2507,16 @@ export {
|
|
|
2504
2507
|
fl as lintBlock,
|
|
2505
2508
|
oe as locate,
|
|
2506
2509
|
sl as makeNode,
|
|
2507
|
-
|
|
2508
|
-
|
|
2510
|
+
wt as newKey,
|
|
2511
|
+
qn as provideBlocksPreview,
|
|
2509
2512
|
rl as removeNode,
|
|
2510
2513
|
Yt as replaceBlock,
|
|
2511
2514
|
cl as replaceList,
|
|
2512
2515
|
kt as stageDocument,
|
|
2513
|
-
|
|
2516
|
+
Fn as typesIn,
|
|
2514
2517
|
ml as undeclared,
|
|
2515
2518
|
ul as updateValues,
|
|
2516
|
-
|
|
2519
|
+
Jn as useBlocksPreview,
|
|
2517
2520
|
qe as walk
|
|
2518
2521
|
};
|
|
2519
2522
|
//# sourceMappingURL=index.js.map
|