@webx-ui/module-blocks 0.7.1 → 0.8.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/index.js CHANGED
@@ -1,29 +1,31 @@
1
- import { defineComponent as ae, computed as T, openBlock as i, createElementBlock as S, createVNode as u, unref as e, createElementVNode as E, createTextVNode as W, toDisplayString as _, Fragment as j, createCommentVNode as N, renderList as ee, ref as U, onMounted as Ue, watch as X, createBlock as I, withCtx as d, onBeforeUnmount as Ge, normalizeStyle as xe, reactive as Qe, normalizeClass as $e, withDirectives as Jt, vShow as Kt, resolveComponent as xt, isRef as $t, nextTick as Gt, withKeys as ut, withModifiers as ct, provide as St, inject as qe, useModel as Yt, getCurrentInstance as Zt, resolveDynamicComponent as Qt, mergeProps as Xt, mergeModels as el } from "vue";
2
- import { useRoute as tl, useRouter as Tt } from "vue-router";
3
- import { useTranslate as de, useAdmin as Me, useErrorText as De, WxDate as ll, WxScreenHead as nl, WxRenameButton as al, WxHelpButton as ol, WxRowMenu as sl, adminKey as il, WxListScreen as rl } from "@webx-ui/module-admin";
4
- import { WxIcon as be, WxSkeleton as We, WxText as F, WxBadge as ue, WxButton as ce, confirm as Ke, toast as G, useElementWidth as Ye, WxSegmented as Ct, WxCard as Be, WxPopover as ul, WxAlert as Vt, WxTabs as cl, WxTab as Le, WxCodeEditor as je, WxFormItem as ne, WxInput as Pe, WxSelect as Et, WxTextarea as dl, WxIconPicker as pl, WxInputNumber as dt, WxTagsInput as pt, WxSwitch as vl, WxActionBar as fl, useModal as Bt, WxDialog as Lt, WxEmpty as Wt, WxAction as Ie, WxSortableList as ml, createModal as At, WxDrawer as hl, WxSpace as bl, WxSkeletonItem as Fe } from "@webx-ui/core";
5
- import { WxScreenRenderer as zt, coreTypes as Xe } from "@webx-ui/schema";
6
- function Ae(t) {
7
- const l = `${t.apiPath}/blocks`, o = (a) => a.data;
1
+ import { defineComponent as ae, computed as V, openBlock as u, createElementBlock as C, createVNode as f, unref as l, createElementVNode as B, createTextVNode as z, toDisplayString as S, Fragment as F, createCommentVNode as I, renderList as le, ref as N, onMounted as Ue, watch as te, createBlock as D, withCtx as b, onBeforeUnmount as Ze, normalizeStyle as xe, reactive as lt, normalizeClass as $e, withDirectives as ll, vShow as nl, resolveComponent as Ct, isRef as Vt, nextTick as sl, withKeys as ft, withModifiers as vt, provide as Bt, inject as Ke, useModel as ol, getCurrentInstance as al, resolveDynamicComponent as il, mergeProps as rl, mergeModels as ul } from "vue";
2
+ import { useRoute as cl, useRouter as At } from "vue-router";
3
+ import { useTranslate as de, useAdmin as Oe, useErrorText as Re, WxDate as dl, WxScreenHead as pl, WxRenameButton as fl, WxHelpButton as vl, WxRowMenu as ml, adminKey as hl, WxListScreen as bl } from "@webx-ui/module-admin";
4
+ import { WxIcon as be, WxSkeleton as We, WxText as q, WxBadge as ue, WxButton as ce, confirm as Ge, toast as Z, useElementWidth as Qe, WxSegmented as Wt, WxCard as Be, WxPopover as gl, WxAlert as Lt, WxTabs as yl, WxTab as Ae, WxCodeEditor as He, WxFormItem as oe, WxInput as Pe, WxSelect as zt, WxTextarea as kl, WxIconPicker as wl, WxInputNumber as mt, WxTagsInput as ht, WxSwitch as _l, WxActionBar as xl, useModal as Mt, WxDialog as Dt, WxEmpty as It, WxAction as Ie, WxSortableList as $l, createModal as Nt, WxDrawer as Sl, WxSpace as El, WxSkeletonItem as qe } from "@webx-ui/core";
5
+ import { WxScreenRenderer as Pt, coreTypes as Ye } from "@webx-ui/schema";
6
+ import { autocompletion as Tl, snippetCompletion as me, pickedCompletion as rt, startCompletion as Cl } from "@codemirror/autocomplete";
7
+ import { EditorState as Vl } from "@codemirror/state";
8
+ function ze(e) {
9
+ const n = `${e.apiPath}/blocks`, t = (s) => s.data;
8
10
  return {
9
- list: () => t.http.get(l).then(o),
10
- catalog: () => t.http.get(`${l}/catalog`).then(o),
11
- get: (a) => t.http.get(`${l}/${a}`).then(o),
12
- create: (a) => t.http.post(l, a).then(o),
13
- update: (a, s) => t.http.put(`${l}/${a}`, s).then(o),
14
- remove: (a) => t.http.delete(`${l}/${a}`),
15
- publish: (a) => t.http.post(`${l}/${a}/publish`, {}).then(o),
16
- render: (a, s = {}) => t.http.post(`${l}/${a}/render`, s).then(o),
17
- usage: (a) => t.http.get(`${l}/${a}/usage`).then(o),
18
- versions: (a) => t.http.get(`${l}/${a}/versions`).then(o),
19
- version: (a, s) => t.http.get(`${l}/${a}/versions/${s}`).then(o),
20
- restore: (a, s) => t.http.post(`${l}/${a}/versions/${s}/restore`, {}).then(o)
11
+ list: () => e.http.get(n).then(t),
12
+ catalog: () => e.http.get(`${n}/catalog`).then(t),
13
+ get: (s) => e.http.get(`${n}/${s}`).then(t),
14
+ create: (s) => e.http.post(n, s).then(t),
15
+ update: (s, a) => e.http.put(`${n}/${s}`, a).then(t),
16
+ remove: (s) => e.http.delete(`${n}/${s}`),
17
+ publish: (s) => e.http.post(`${n}/${s}/publish`, {}).then(t),
18
+ render: (s, a = {}) => e.http.post(`${n}/${s}/render`, a).then(t),
19
+ usage: (s) => e.http.get(`${n}/${s}/usage`).then(t),
20
+ versions: (s) => e.http.get(`${n}/${s}/versions`).then(t),
21
+ version: (s, a) => e.http.get(`${n}/${s}/versions/${a}`).then(t),
22
+ restore: (s, a) => e.http.post(`${n}/${s}/versions/${a}/restore`, {}).then(t)
21
23
  };
22
24
  }
23
- const gl = { class: "wx-block-checks" }, kl = {
25
+ const Bl = { class: "wx-block-checks" }, Al = {
24
26
  key: 0,
25
27
  class: "wx-block-checks__line is-error"
26
- }, yl = /* @__PURE__ */ ae({
28
+ }, Wl = /* @__PURE__ */ ae({
27
29
  __name: "BlockChecks",
28
30
  props: {
29
31
  file: {},
@@ -31,284 +33,284 @@ const gl = { class: "wx-block-checks" }, kl = {
31
33
  slug: {},
32
34
  error: {}
33
35
  },
34
- setup(t) {
35
- const l = t, o = de("webx-blocks"), a = T(() => l.lints.filter((r) => r.file === l.file)), s = T(() => {
36
- const r = new Set(a.value.map((b) => b.code)), n = [];
37
- return l.file === "template" && (r.has("no-marker") || n.push(o("checks.ok-marker")), r.has("variables-missing") || n.push(o("checks.ok-variables"))), l.file === "styles" && (r.has("stray-selectors") || n.push(o("checks.ok-prefix", { slug: l.slug })), r.has("bare-selectors") || n.push(o("checks.ok-bare")), r.has("media-query") || n.push(o("checks.ok-container"))), n;
36
+ setup(e) {
37
+ const n = e, t = de("webx-blocks"), s = V(() => n.lints.filter((i) => i.file === n.file)), a = V(() => {
38
+ const i = new Set(s.value.map((r) => r.code)), o = [];
39
+ return n.file === "template" && (i.has("no-marker") || o.push(t("checks.ok-marker")), i.has("variables-missing") || o.push(t("checks.ok-variables"))), n.file === "styles" && (i.has("stray-selectors") || o.push(t("checks.ok-prefix", { slug: n.slug })), i.has("bare-selectors") || o.push(t("checks.ok-bare")), i.has("media-query") || o.push(t("checks.ok-container"))), o;
38
40
  });
39
- return (r, n) => (i(), S("div", gl, [
40
- t.error ? (i(), S("div", kl, [
41
- u(e(be), { name: "close-circle" }),
42
- E("span", null, [
43
- W(_(t.error.message) + " ", 1),
44
- t.error.line !== null ? (i(), S(j, { key: 0 }, [
45
- W(" · " + _(e(o)("page.line", { line: t.error.line })), 1)
46
- ], 64)) : N("", !0),
47
- t.error.where ? (i(), S(j, { key: 1 }, [
48
- W(" · " + _(t.error.where), 1)
49
- ], 64)) : N("", !0)
41
+ return (i, o) => (u(), C("div", Bl, [
42
+ e.error ? (u(), C("div", Al, [
43
+ f(l(be), { name: "close-circle" }),
44
+ B("span", null, [
45
+ z(S(e.error.message) + " ", 1),
46
+ e.error.line !== null ? (u(), C(F, { key: 0 }, [
47
+ z(" · " + S(l(t)("page.line", { line: e.error.line })), 1)
48
+ ], 64)) : I("", !0),
49
+ e.error.where ? (u(), C(F, { key: 1 }, [
50
+ z(" · " + S(e.error.where), 1)
51
+ ], 64)) : I("", !0)
50
52
  ])
51
- ])) : N("", !0),
52
- (i(!0), S(j, null, ee(a.value, (b) => (i(), S("div", {
53
- key: b.code,
53
+ ])) : I("", !0),
54
+ (u(!0), C(F, null, le(s.value, (r) => (u(), C("div", {
55
+ key: r.code,
54
56
  class: "wx-block-checks__line is-warning"
55
57
  }, [
56
- u(e(be), { name: "warning" }),
57
- E("span", null, [
58
- W(_(b.message) + " ", 1),
59
- b.line !== null ? (i(), S(j, { key: 0 }, [
60
- W(" · " + _(e(o)("page.line", { line: b.line })), 1)
61
- ], 64)) : N("", !0)
58
+ f(l(be), { name: "warning" }),
59
+ B("span", null, [
60
+ z(S(r.message) + " ", 1),
61
+ r.line !== null ? (u(), C(F, { key: 0 }, [
62
+ z(" · " + S(l(t)("page.line", { line: r.line })), 1)
63
+ ], 64)) : I("", !0)
62
64
  ])
63
65
  ]))), 128)),
64
- (i(!0), S(j, null, ee(s.value, (b) => (i(), S("div", {
65
- key: b,
66
+ (u(!0), C(F, null, le(a.value, (r) => (u(), C("div", {
67
+ key: r,
66
68
  class: "wx-block-checks__line is-ok"
67
69
  }, [
68
- u(e(be), { name: "check" }),
69
- E("span", null, _(b), 1)
70
+ f(l(be), { name: "check" }),
71
+ B("span", null, S(r), 1)
70
72
  ]))), 128))
71
73
  ]));
72
74
  }
73
- }), oe = (t, l) => {
74
- const o = t.__vccOpts || t;
75
- for (const [a, s] of l)
76
- o[a] = s;
77
- return o;
78
- }, vt = /* @__PURE__ */ oe(yl, [["__scopeId", "data-v-e56947a8"]]), wl = { class: "wx-block-history" }, _l = { class: "wx-block-history__number" }, xl = { class: "wx-block-history__who" }, $l = /* @__PURE__ */ ae({
75
+ }), ie = (e, n) => {
76
+ const t = e.__vccOpts || e;
77
+ for (const [s, a] of n)
78
+ t[s] = a;
79
+ return t;
80
+ }, bt = /* @__PURE__ */ ie(Wl, [["__scopeId", "data-v-e56947a8"]]), Ll = { class: "wx-block-history" }, zl = { class: "wx-block-history__number" }, Ml = { class: "wx-block-history__who" }, Dl = /* @__PURE__ */ ae({
79
81
  __name: "BlockHistory",
80
82
  props: {
81
83
  block: {},
82
84
  canManage: { type: Boolean }
83
85
  },
84
86
  emits: ["restored"],
85
- setup(t, { emit: l }) {
86
- const o = t, a = l, s = Me(), r = Ae(s), n = de("webx-blocks"), b = De(), P = U(null);
87
- async function v() {
88
- P.value = await r.versions(o.block.id);
89
- }
90
- function p(f) {
91
- return o.block.draft?.number === f.number ? "draft" : o.block.published?.number === f.number ? "live" : "replaced";
92
- }
93
- async function g(f) {
94
- if (await Ke({
95
- title: n("page.restore-title", { number: f.number }),
96
- message: n("page.restore-text"),
97
- confirmText: n("page.restore"),
98
- cancelText: n("page.cancel")
87
+ setup(e, { emit: n }) {
88
+ const t = e, s = n, a = Oe(), i = ze(a), o = de("webx-blocks"), r = Re(), m = N(null);
89
+ async function c() {
90
+ m.value = await i.versions(t.block.id);
91
+ }
92
+ function d(v) {
93
+ return t.block.draft?.number === v.number ? "draft" : t.block.published?.number === v.number ? "live" : "replaced";
94
+ }
95
+ async function p(v) {
96
+ if (await Ge({
97
+ title: o("page.restore-title", { number: v.number }),
98
+ message: o("page.restore-text"),
99
+ confirmText: o("page.restore"),
100
+ cancelText: o("page.cancel")
99
101
  }))
100
102
  try {
101
- const C = await r.restore(o.block.id, f.number);
102
- G.success(n("page.restored", { number: C.draft?.number ?? f.number })), a("restored", C), await v();
103
- } catch (C) {
104
- G.danger(b(C));
103
+ const x = await i.restore(t.block.id, v.number);
104
+ Z.success(o("page.restored", { number: x.draft?.number ?? v.number })), s("restored", x), await c();
105
+ } catch (x) {
106
+ Z.danger(r(x));
105
107
  }
106
108
  }
107
- return Ue(v), X(
108
- () => [o.block.draft?.number, o.block.published?.number],
109
+ return Ue(c), te(
110
+ () => [t.block.draft?.number, t.block.published?.number],
109
111
  () => {
110
- v();
112
+ c();
111
113
  }
112
- ), (f, k) => (i(), S("div", wl, [
113
- P.value === null ? (i(), I(e(We), {
114
+ ), (v, g) => (u(), C("div", Ll, [
115
+ m.value === null ? (u(), D(l(We), {
114
116
  key: 0,
115
117
  class: "wx-block-history__ghost",
116
118
  rows: 3
117
- })) : (i(!0), S(j, { key: 1 }, ee(P.value, (C) => (i(), S("div", {
118
- key: C.number,
119
+ })) : (u(!0), C(F, { key: 1 }, le(m.value, (x) => (u(), C("div", {
120
+ key: x.number,
119
121
  class: "wx-block-history__row"
120
122
  }, [
121
- E("code", _l, _(e(n)("page.version", { number: C.number })), 1),
122
- E("div", xl, [
123
- u(e(F), null, {
124
- default: d(() => [
125
- W(_(e(n)(`page.version-${p(C)}`)), 1)
123
+ B("code", zl, S(l(o)("page.version", { number: x.number })), 1),
124
+ B("div", Ml, [
125
+ f(l(q), null, {
126
+ default: b(() => [
127
+ z(S(l(o)(`page.version-${d(x)}`)), 1)
126
128
  ]),
127
129
  _: 2
128
130
  }, 1024),
129
- u(e(F), {
131
+ f(l(q), {
130
132
  size: "sm",
131
133
  tone: "muted"
132
134
  }, {
133
- default: d(() => [
134
- C.created_at ? (i(), I(e(ll), {
135
+ default: b(() => [
136
+ x.created_at ? (u(), D(l(dl), {
135
137
  key: 0,
136
- value: C.created_at
137
- }, null, 8, ["value"])) : N("", !0),
138
- W(" · " + _(C.author ?? e(n)(`page.source-${C.source}`)) + " ", 1),
139
- C.comment ? (i(), S(j, { key: 1 }, [
140
- W(" · " + _(C.comment), 1)
141
- ], 64)) : N("", !0)
138
+ value: x.created_at
139
+ }, null, 8, ["value"])) : I("", !0),
140
+ z(" · " + S(x.author ?? l(o)(`page.source-${x.source}`)) + " ", 1),
141
+ x.comment ? (u(), C(F, { key: 1 }, [
142
+ z(" · " + S(x.comment), 1)
143
+ ], 64)) : I("", !0)
142
144
  ]),
143
145
  _: 2
144
146
  }, 1024)
145
147
  ]),
146
- p(C) === "draft" ? (i(), I(e(ue), {
148
+ d(x) === "draft" ? (u(), D(l(ue), {
147
149
  key: 0,
148
150
  type: "warning",
149
151
  dot: ""
150
152
  }, {
151
- default: d(() => [
152
- W(_(e(n)("page.version-draft")), 1)
153
+ default: b(() => [
154
+ z(S(l(o)("page.version-draft")), 1)
153
155
  ]),
154
156
  _: 1
155
- })) : p(C) === "live" ? (i(), I(e(ue), {
157
+ })) : d(x) === "live" ? (u(), D(l(ue), {
156
158
  key: 1,
157
159
  type: "success",
158
160
  dot: ""
159
161
  }, {
160
- default: d(() => [
161
- W(_(e(n)("page.version-live")), 1)
162
+ default: b(() => [
163
+ z(S(l(o)("page.version-live")), 1)
162
164
  ]),
163
165
  _: 1
164
- })) : N("", !0),
165
- t.canManage && p(C) === "replaced" ? (i(), I(e(ce), {
166
+ })) : I("", !0),
167
+ e.canManage && d(x) === "replaced" ? (u(), D(l(ce), {
166
168
  key: 2,
167
169
  size: "sm",
168
170
  variant: "outline",
169
- onClick: (V) => g(C)
171
+ onClick: (T) => p(x)
170
172
  }, {
171
- default: d(() => [
172
- W(_(e(n)("page.restore")), 1)
173
+ default: b(() => [
174
+ z(S(l(o)("page.restore")), 1)
173
175
  ]),
174
176
  _: 1
175
- }, 8, ["onClick"])) : N("", !0)
177
+ }, 8, ["onClick"])) : I("", !0)
176
178
  ]))), 128))
177
179
  ]));
178
180
  }
179
- }), Sl = /* @__PURE__ */ oe($l, [["__scopeId", "data-v-42c6b7ad"]]), Ne = "wx-preview-selected", Je = "wx-preview-hover", ft = "wx-preview-style";
180
- function It(t, l) {
181
- const a = (t.ownerDocument ?? t).createTreeWalker(
182
- t,
181
+ }), Il = /* @__PURE__ */ ie(Dl, [["__scopeId", "data-v-42c6b7ad"]]), Ne = "wx-preview-selected", Je = "wx-preview-hover", gt = "wx-preview-style";
182
+ function Ut(e, n) {
183
+ const s = (e.ownerDocument ?? e).createTreeWalker(
184
+ e,
183
185
  128
184
186
  /* NodeFilter.SHOW_COMMENT */
185
187
  );
186
- let s = null;
187
- for (let r = a.nextNode(); r; r = a.nextNode()) {
188
- const n = r.data.trim();
189
- if (s === null && n === `wx:${l}`)
190
- s = r;
191
- else if (s !== null && n === `/wx:${l}`)
192
- return { start: s, end: r };
188
+ let a = null;
189
+ for (let i = s.nextNode(); i; i = s.nextNode()) {
190
+ const o = i.data.trim();
191
+ if (a === null && o === `wx:${n}`)
192
+ a = i;
193
+ else if (a !== null && o === `/wx:${n}`)
194
+ return { start: a, end: i };
193
195
  }
194
196
  return null;
195
197
  }
196
- function Nt(t, l, o) {
197
- const a = It(t, l);
198
- if (!a) return !1;
199
- const s = a.start.parentNode;
198
+ function Ot(e, n, t) {
199
+ const s = Ut(e, n);
200
200
  if (!s) return !1;
201
- const r = t.createElement("template");
202
- r.innerHTML = o;
203
- const n = a.end.nextSibling;
204
- let b = a.start;
205
- for (; b; ) {
206
- const g = b.nextSibling, f = b === a.end;
207
- if (s.removeChild(b), f) break;
208
- b = g;
201
+ const a = s.start.parentNode;
202
+ if (!a) return !1;
203
+ const i = e.createElement("template");
204
+ i.innerHTML = t;
205
+ const o = s.end.nextSibling;
206
+ let r = s.start;
207
+ for (; r; ) {
208
+ const p = r.nextSibling, v = r === s.end;
209
+ if (a.removeChild(r), v) break;
210
+ r = p;
209
211
  }
210
- const P = r.content, v = Array.from(P.childNodes);
211
- s.insertBefore(P, n);
212
- const p = t.defaultView?.webx;
213
- if (p?.mount)
214
- for (const g of v)
215
- g.nodeType === 1 && p.mount(g);
212
+ const m = i.content, c = Array.from(m.childNodes);
213
+ a.insertBefore(m, o);
214
+ const d = e.defaultView?.webx;
215
+ if (d?.mount)
216
+ for (const p of c)
217
+ p.nodeType === 1 && d.mount(p);
216
218
  return !0;
217
219
  }
218
- function at(t, l) {
219
- const o = It(t, l);
220
- if (!o) return null;
221
- for (let a = o.start.nextSibling; a && a !== o.end; a = a.nextSibling)
222
- if (a.nodeType === 1) return a;
220
+ function ut(e, n) {
221
+ const t = Ut(e, n);
222
+ if (!t) return null;
223
+ for (let s = t.start.nextSibling; s && s !== t.end; s = s.nextSibling)
224
+ if (s.nodeType === 1) return s;
223
225
  return null;
224
226
  }
225
- function et(t, l) {
226
- ot(t);
227
- for (const a of Array.from(t.querySelectorAll(`.${Ne}`)))
228
- a.classList.remove(Ne);
229
- if (l === null) return null;
230
- const o = at(t, l);
231
- return o?.classList.add(Ne), o;
232
- }
233
- function mt(t, l) {
234
- ot(t);
235
- for (const o of Array.from(t.querySelectorAll(`.${Je}`)))
236
- o.classList.remove(Je);
237
- l !== null && at(t, l)?.classList.add(Je);
238
- }
239
- function ht(t) {
240
- let l = t?.nodeType === 1 ? t : t?.parentElement ?? null;
241
- for (; l; ) {
242
- let o = 0;
243
- for (let a = l.previousSibling; a; a = a.previousSibling) {
244
- if (a.nodeType !== 8) continue;
245
- const s = a.data.trim();
246
- if (s.startsWith("/wx:"))
247
- o += 1;
248
- else if (s.startsWith("wx:")) {
249
- if (o === 0) return s.slice(3);
250
- o -= 1;
227
+ function nt(e, n) {
228
+ ct(e);
229
+ for (const s of Array.from(e.querySelectorAll(`.${Ne}`)))
230
+ s.classList.remove(Ne);
231
+ if (n === null) return null;
232
+ const t = ut(e, n);
233
+ return t?.classList.add(Ne), t;
234
+ }
235
+ function yt(e, n) {
236
+ ct(e);
237
+ for (const t of Array.from(e.querySelectorAll(`.${Je}`)))
238
+ t.classList.remove(Je);
239
+ n !== null && ut(e, n)?.classList.add(Je);
240
+ }
241
+ function kt(e) {
242
+ let n = e?.nodeType === 1 ? e : e?.parentElement ?? null;
243
+ for (; n; ) {
244
+ let t = 0;
245
+ for (let s = n.previousSibling; s; s = s.previousSibling) {
246
+ if (s.nodeType !== 8) continue;
247
+ const a = s.data.trim();
248
+ if (a.startsWith("/wx:"))
249
+ t += 1;
250
+ else if (a.startsWith("wx:")) {
251
+ if (t === 0) return a.slice(3);
252
+ t -= 1;
251
253
  }
252
254
  }
253
- l = l.parentElement;
255
+ n = n.parentElement;
254
256
  }
255
257
  return null;
256
258
  }
257
- function Tl(t, l) {
258
- ot(t);
259
- let o = null;
260
- function a(n) {
261
- he(n), l.select(ht(n.target));
259
+ function Nl(e, n) {
260
+ ct(e);
261
+ let t = null;
262
+ function s(o) {
263
+ he(o), n.select(kt(o.target));
262
264
  }
263
- function s(n) {
264
- const b = ht(n.target);
265
- b !== o && (o = b, mt(t, b));
265
+ function a(o) {
266
+ const r = kt(o.target);
267
+ r !== t && (t = r, yt(e, r));
266
268
  }
267
- function r() {
268
- o = null, mt(t, null);
269
+ function i() {
270
+ t = null, yt(e, null);
269
271
  }
270
- return t.addEventListener("click", a, !0), t.addEventListener("auxclick", he, !0), t.addEventListener("submit", he, !0), t.addEventListener("dragstart", he, !0), t.addEventListener("mousemove", s, !0), t.addEventListener("mouseleave", r), {
272
+ return e.addEventListener("click", s, !0), e.addEventListener("auxclick", he, !0), e.addEventListener("submit", he, !0), e.addEventListener("dragstart", he, !0), e.addEventListener("mousemove", a, !0), e.addEventListener("mouseleave", i), {
271
273
  release() {
272
- t.removeEventListener("click", a, !0), t.removeEventListener("auxclick", he, !0), t.removeEventListener("submit", he, !0), t.removeEventListener("dragstart", he, !0), t.removeEventListener("mousemove", s, !0), t.removeEventListener("mouseleave", r);
274
+ e.removeEventListener("click", s, !0), e.removeEventListener("auxclick", he, !0), e.removeEventListener("submit", he, !0), e.removeEventListener("dragstart", he, !0), e.removeEventListener("mousemove", a, !0), e.removeEventListener("mouseleave", i);
273
275
  }
274
276
  };
275
277
  }
276
- function he(t) {
277
- t.preventDefault(), t.stopPropagation();
278
+ function he(e) {
279
+ e.preventDefault(), e.stopPropagation();
278
280
  }
279
- function Cl(t) {
280
- const l = ["click", "auxclick", "submit", "dragstart"];
281
- for (const o of l) t.addEventListener(o, he, !0);
281
+ function Pl(e) {
282
+ const n = ["click", "auxclick", "submit", "dragstart"];
283
+ for (const t of n) e.addEventListener(t, he, !0);
282
284
  return {
283
285
  release() {
284
- for (const o of l) t.removeEventListener(o, he, !0);
286
+ for (const t of n) e.removeEventListener(t, he, !0);
285
287
  }
286
288
  };
287
289
  }
288
- const tt = "sample", bt = "wx-stage-styles";
289
- function Vl(t, l) {
290
- let o = t.getElementById(bt);
291
- o === null && (o = t.createElement("style"), o.id = bt, (t.head ?? t.documentElement).appendChild(o)), o.textContent = l.styles;
292
- const a = `<!--wx:${tt}-->`, s = l.html.trimStart().startsWith(a) ? l.html : `${a}${l.html}<!--/wx:${tt}-->`;
293
- return Nt(t, tt, s);
290
+ const st = "sample", wt = "wx-stage-styles";
291
+ function Ul(e, n) {
292
+ let t = e.getElementById(wt);
293
+ t === null && (t = e.createElement("style"), t.id = wt, (e.head ?? e.documentElement).appendChild(t)), t.textContent = n.styles;
294
+ const s = `<!--wx:${st}-->`, a = n.html.trimStart().startsWith(s) ? n.html : `${s}${n.html}<!--/wx:${st}-->`;
295
+ return Ot(e, st, a);
294
296
  }
295
- function El(t, l) {
296
- const o = t.createElement("script");
297
- o.textContent = l, t.body.appendChild(o);
297
+ function Ol(e, n) {
298
+ const t = e.createElement("script");
299
+ t.textContent = n, e.body.appendChild(t);
298
300
  }
299
- function ot(t) {
300
- if (t.getElementById(ft)) return;
301
- const l = t.createElement("style");
302
- l.id = ft, l.textContent = `.${Ne}{outline:2px solid #427edd;outline-offset:-2px;}.${Je}:not(.${Ne}){outline:1px solid #427edd;outline-offset:-1px;cursor:pointer;}`, (t.head ?? t.documentElement).appendChild(l);
301
+ function ct(e) {
302
+ if (e.getElementById(gt)) return;
303
+ const n = e.createElement("style");
304
+ n.id = gt, n.textContent = `.${Ne}{outline:2px solid #427edd;outline-offset:-2px;}.${Je}:not(.${Ne}){outline:1px solid #427edd;outline-offset:-1px;cursor:pointer;}`, (e.head ?? e.documentElement).appendChild(n);
303
305
  }
304
- function Pt(t) {
305
- const l = t.base ? `<base href="${gt(t.base)}">` : "", o = t.frame ? `<style>${t.frame}</style>` : "", a = t.script && t.runtime ? `<script src="${gt(t.runtime)}"><\/script><script>${t.script}<\/script>` : "";
306
- 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>${o}<style>${t.styles}</style></head><body>${t.html}${a}</body></html>`;
306
+ function Rt(e) {
307
+ const n = e.base ? `<base href="${_t(e.base)}">` : "", t = e.frame ? `<style>${e.frame}</style>` : "", s = e.script && e.runtime ? `<script src="${_t(e.runtime)}"><\/script><script>${e.script}<\/script>` : "";
308
+ return `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">${n}<style>html,body{margin:0}body{container-type:inline-size}</style>${t}<style>${e.styles}</style></head><body>${e.html}${s}</body></html>`;
307
309
  }
308
- function gt(t) {
309
- return t.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
310
+ function _t(e) {
311
+ return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
310
312
  }
311
- const Bl = { class: "wx-block-stage" }, Ll = { class: "wx-block-stage__bar" }, Wl = ["src", "srcdoc", "title"], Al = /* @__PURE__ */ ae({
313
+ const Rl = { class: "wx-block-stage" }, jl = { class: "wx-block-stage__bar" }, Fl = ["src", "srcdoc", "title"], Hl = /* @__PURE__ */ ae({
312
314
  __name: "BlockStage",
313
315
  props: {
314
316
  html: {},
@@ -318,211 +320,211 @@ const Bl = { class: "wx-block-stage" }, Ll = { class: "wx-block-stage__bar" }, W
318
320
  stage: { default: null },
319
321
  loading: { type: Boolean, default: !1 }
320
322
  },
321
- setup(t) {
322
- const l = t, o = de("webx-blocks"), a = T(() => [
323
- { value: 1280, icon: "monitor", ariaLabel: o("page.width-desktop") },
324
- { value: 834, icon: "tablet", ariaLabel: o("page.width-tablet") },
325
- { value: 390, icon: "smartphone", ariaLabel: o("page.width-phone") }
326
- ]), s = U(1280), r = U(null), n = U(null), b = Ye(r), P = U(360), v = U(!1);
327
- X([b, a], () => {
328
- if (v.value || b.value === 0) return;
329
- const c = a.value.find((B) => b.value / B.value >= 0.45);
330
- s.value = (c ?? a.value[a.value.length - 1]).value;
323
+ setup(e) {
324
+ const n = e, t = de("webx-blocks"), s = V(() => [
325
+ { value: 1280, icon: "monitor", ariaLabel: t("page.width-desktop") },
326
+ { value: 834, icon: "tablet", ariaLabel: t("page.width-tablet") },
327
+ { value: 390, icon: "smartphone", ariaLabel: t("page.width-phone") }
328
+ ]), a = N(1280), i = N(null), o = N(null), r = Qe(i), m = N(360), c = N(!1);
329
+ te([r, s], () => {
330
+ if (c.value || r.value === 0) return;
331
+ const h = s.value.find((A) => r.value / A.value >= 0.45);
332
+ a.value = (h ?? s.value[s.value.length - 1]).value;
331
333
  });
332
- function p(c) {
333
- v.value = !0, s.value = c;
334
- }
335
- const g = T(() => b.value === 0 ? 1 : Math.min(1, b.value / s.value)), f = T(
336
- () => l.stage ? void 0 : Pt({
337
- html: l.html,
338
- styles: l.styles,
339
- script: l.script,
340
- runtime: l.runtime,
334
+ function d(h) {
335
+ c.value = !0, a.value = h;
336
+ }
337
+ const p = V(() => r.value === 0 ? 1 : Math.min(1, r.value / a.value)), v = V(
338
+ () => n.stage ? void 0 : Rt({
339
+ html: n.html,
340
+ styles: n.styles,
341
+ script: n.script,
342
+ runtime: n.runtime,
341
343
  base: typeof location > "u" ? null : location.origin + "/"
342
344
  })
343
- ), k = U(0);
344
- let C = null;
345
- X(
346
- () => l.script,
347
- (c) => {
348
- l.stage && c !== C && (k.value += 1);
345
+ ), g = N(0);
346
+ let x = null;
347
+ te(
348
+ () => n.script,
349
+ (h) => {
350
+ n.stage && h !== x && (g.value += 1);
349
351
  }
350
352
  );
351
- function V() {
352
- const c = n.value?.contentDocument?.body;
353
- if (!c) return;
354
- const B = c.ownerDocument.defaultView, D = B && parseFloat(B.getComputedStyle(c).marginBottom) || 0, K = c.getBoundingClientRect().bottom + D + (B?.scrollY ?? 0);
355
- P.value = Math.max(120, Math.ceil(Math.max(c.scrollHeight, K)));
356
- }
357
- let x = null, m = null;
358
- function y() {
359
- x?.release(), x = null, m?.disconnect(), m = null;
360
- }
361
- function R(c) {
362
- l.stage && (l.script && C !== l.script && (C = l.script, El(c, l.script)), Vl(c, { html: l.html, styles: l.styles }));
363
- }
364
- function q() {
365
- y();
366
- const c = n.value?.contentDocument;
367
- if (!c?.body) return;
368
- l.stage && (C = null, x = Cl(c), R(c)), V();
369
- const B = c.defaultView?.ResizeObserver;
370
- B && (m = new B(() => V()), m.observe(c.body));
371
- }
372
- X(
373
- () => [l.html, l.styles],
353
+ function T() {
354
+ const h = o.value?.contentDocument?.body;
355
+ if (!h) return;
356
+ const A = h.ownerDocument.defaultView, P = A && parseFloat(A.getComputedStyle(h).marginBottom) || 0, J = h.getBoundingClientRect().bottom + P + (A?.scrollY ?? 0);
357
+ m.value = Math.max(120, Math.ceil(Math.max(h.scrollHeight, J)));
358
+ }
359
+ let w = null, y = null;
360
+ function _() {
361
+ w?.release(), w = null, y?.disconnect(), y = null;
362
+ }
363
+ function R(h) {
364
+ n.stage && (n.script && x !== n.script && (x = n.script, Ol(h, n.script)), Ul(h, { html: n.html, styles: n.styles }));
365
+ }
366
+ function K() {
367
+ _();
368
+ const h = o.value?.contentDocument;
369
+ if (!h?.body) return;
370
+ n.stage && (x = null, w = Pl(h), R(h)), T();
371
+ const A = h.defaultView?.ResizeObserver;
372
+ A && (y = new A(() => T()), y.observe(h.body));
373
+ }
374
+ te(
375
+ () => [n.html, n.styles],
374
376
  () => {
375
- const c = n.value?.contentDocument;
376
- l.stage && c?.body && x !== null && R(c);
377
+ const h = o.value?.contentDocument;
378
+ n.stage && h?.body && w !== null && R(h);
377
379
  }
378
- ), X(b, (c, B) => {
379
- c > 0 && B === 0 && setTimeout(V, 50);
380
- }), X(s, () => setTimeout(V, 50)), Ge(y);
381
- const J = T(() => ({
382
- width: `${s.value}px`,
383
- height: `${P.value}px`,
384
- transform: `scale(${g.value})`
385
- })), Z = T(() => ({
386
- width: `${Math.round(s.value * g.value)}px`,
387
- height: `${Math.round(P.value * g.value)}px`
380
+ ), te(r, (h, A) => {
381
+ h > 0 && A === 0 && setTimeout(T, 50);
382
+ }), te(a, () => setTimeout(T, 50)), Ze(_);
383
+ const Y = V(() => ({
384
+ width: `${a.value}px`,
385
+ height: `${m.value}px`,
386
+ transform: `scale(${p.value})`
387
+ })), X = V(() => ({
388
+ width: `${Math.round(a.value * p.value)}px`,
389
+ height: `${Math.round(m.value * p.value)}px`
388
390
  }));
389
- return (c, B) => (i(), S("div", Bl, [
390
- E("div", Ll, [
391
- u(e(Ct), {
392
- "model-value": s.value,
393
- options: a.value,
391
+ return (h, A) => (u(), C("div", Rl, [
392
+ B("div", jl, [
393
+ f(l(Wt), {
394
+ "model-value": a.value,
395
+ options: s.value,
394
396
  size: "sm",
395
- "aria-label": e(o)("page.width"),
396
- "onUpdate:modelValue": B[0] || (B[0] = (D) => p(Number(D)))
397
+ "aria-label": l(t)("page.width"),
398
+ "onUpdate:modelValue": A[0] || (A[0] = (P) => d(Number(P)))
397
399
  }, null, 8, ["model-value", "options", "aria-label"])
398
400
  ]),
399
- E("div", {
401
+ B("div", {
400
402
  ref_key: "box",
401
- ref: r,
403
+ ref: i,
402
404
  class: "wx-block-stage__ground"
403
405
  }, [
404
- t.loading && !t.html ? (i(), I(e(We), {
406
+ e.loading && !e.html ? (u(), D(l(We), {
405
407
  key: 0,
406
408
  rows: 3
407
- })) : (i(), S("div", {
409
+ })) : (u(), C("div", {
408
410
  key: 1,
409
411
  class: "wx-block-stage__clip",
410
- style: xe(Z.value)
412
+ style: xe(X.value)
411
413
  }, [
412
- (i(), S("iframe", {
414
+ (u(), C("iframe", {
413
415
  ref_key: "frame",
414
- ref: n,
415
- key: k.value,
416
+ ref: o,
417
+ key: g.value,
416
418
  class: "wx-block-stage__frame",
417
- src: t.stage ?? void 0,
418
- srcdoc: f.value,
419
- style: xe(J.value),
419
+ src: e.stage ?? void 0,
420
+ srcdoc: v.value,
421
+ style: xe(Y.value),
420
422
  sandbox: "allow-same-origin allow-scripts",
421
- title: e(o)("page.preview"),
422
- onLoad: q
423
- }, null, 44, Wl))
423
+ title: l(t)("page.preview"),
424
+ onLoad: K
425
+ }, null, 44, Fl))
424
426
  ], 4))
425
427
  ], 512)
426
428
  ]));
427
429
  }
428
- }), zl = /* @__PURE__ */ oe(Al, [["__scopeId", "data-v-3185ee45"]]);
429
- function Ut(t) {
430
- return typeof t == "object" && t !== null && typeof t.type == "string" && t.type !== "";
430
+ }), ql = /* @__PURE__ */ ie(Hl, [["__scopeId", "data-v-3185ee45"]]);
431
+ function jt(e) {
432
+ return typeof e == "object" && e !== null && typeof e.type == "string" && e.type !== "";
431
433
  }
432
- function Ze(t) {
433
- return Array.isArray(t) && t.length > 0 && t.every(Ut);
434
+ function Xe(e) {
435
+ return Array.isArray(e) && e.length > 0 && e.every(jt);
434
436
  }
435
- function lt() {
437
+ function at() {
436
438
  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);
437
439
  }
438
- function Il(t, l = {}) {
439
- return { key: lt(), type: t, values: l };
440
+ function Kl(e, n = {}) {
441
+ return { key: at(), type: e, values: n };
440
442
  }
441
- function re(t, l) {
442
- return Mt(t, l, null, null);
443
+ function re(e, n) {
444
+ return Ft(e, n, null, null);
443
445
  }
444
- function Mt(t, l, o, a) {
445
- for (let s = 0; s < t.length; s++) {
446
- const r = t[s];
447
- if (r.key === l) return { node: r, parent: o, field: a, list: t, index: s };
448
- for (const [n, b] of Object.entries(r.values ?? {}))
449
- if (Ze(b)) {
450
- const P = Mt(b, l, r, n);
451
- if (P) return P;
446
+ function Ft(e, n, t, s) {
447
+ for (let a = 0; a < e.length; a++) {
448
+ const i = e[a];
449
+ if (i.key === n) return { node: i, parent: t, field: s, list: e, index: a };
450
+ for (const [o, r] of Object.entries(i.values ?? {}))
451
+ if (Xe(r)) {
452
+ const m = Ft(r, n, i, o);
453
+ if (m) return m;
452
454
  }
453
455
  }
454
456
  return null;
455
457
  }
456
- function Oe(t, l, o = 0, a = null) {
457
- for (const s of t)
458
- if (Ut(s)) {
459
- l(s, o, a);
460
- for (const r of Object.values(s.values ?? {}))
461
- Ze(r) && Oe(r, l, o + 1, s);
462
- }
463
- }
464
- function Nl(t, l) {
465
- let o = 0;
466
- return Oe(t, (a) => {
467
- a.type === l && o++;
468
- }), o;
469
- }
470
- function Pl(t) {
471
- let l = 0;
472
- for (const o of Object.values(t.values ?? {}))
473
- Ze(o) && Oe(o, () => l++);
474
- return l;
475
- }
476
- function wa(t) {
477
- const l = [];
478
- return Oe(t, (o) => {
479
- l.includes(o.type) || l.push(o.type);
480
- }), l;
481
- }
482
- function Dt(t) {
483
- const l = [];
484
- for (const o of t)
485
- o.type === "wx-blocks" && l.push(o), o.children && l.push(...Dt(o.children));
486
- return l;
487
- }
488
- function Ot(t) {
489
- const l = {};
490
- for (const [o, a] of Object.entries(t.values ?? {}))
491
- l[o] = Ze(a) ? a.map(Ot) : ge(a);
492
- return t.hidden === !0 ? { key: lt(), type: t.type, hidden: !0, values: l } : { key: lt(), type: t.type, values: l };
493
- }
494
- function Ul(t, l, o) {
495
- const a = ge(t), s = re(a, l);
496
- return s ? (o ? s.node.hidden = !0 : delete s.node.hidden, a) : t;
497
- }
498
- function Ml(t, l, o) {
499
- if (l === null) return t;
500
- const a = re(t, l);
501
- if (!a || o === null) return null;
502
- const s = a.node.values[o];
503
- return Array.isArray(s) || (a.node.values[o] = []), a.node.values[o];
504
- }
505
- function kt(t, l, o, a, s) {
506
- const r = ge(t), n = Ml(r, l, o);
507
- return n ? (n.splice(Math.max(0, Math.min(a, n.length)), 0, s), r) : t;
508
- }
509
- function Dl(t, l) {
510
- const o = ge(t), a = re(o, l);
511
- return a ? (a.list.splice(a.index, 1), o) : t;
512
- }
513
- function Ol(t, l, o) {
514
- const a = ge(t), s = re(a, l);
515
- return s ? (s.node.values = o, a) : t;
516
- }
517
- function Rl(t, l, o, a) {
518
- if (l === null) return ge(a);
519
- const s = ge(t), r = re(s, l);
520
- return !r || o === null ? t : (r.node.values[o] = ge(a), s);
521
- }
522
- function ge(t) {
523
- return t === void 0 ? t : JSON.parse(JSON.stringify(t));
524
- }
525
- const Hl = {
458
+ function je(e, n, t = 0, s = null) {
459
+ for (const a of e)
460
+ if (jt(a)) {
461
+ n(a, t, s);
462
+ for (const i of Object.values(a.values ?? {}))
463
+ Xe(i) && je(i, n, t + 1, a);
464
+ }
465
+ }
466
+ function Yl(e, n) {
467
+ let t = 0;
468
+ return je(e, (s) => {
469
+ s.type === n && t++;
470
+ }), t;
471
+ }
472
+ function Jl(e) {
473
+ let n = 0;
474
+ for (const t of Object.values(e.values ?? {}))
475
+ Xe(t) && je(t, () => n++);
476
+ return n;
477
+ }
478
+ function to(e) {
479
+ const n = [];
480
+ return je(e, (t) => {
481
+ n.includes(t.type) || n.push(t.type);
482
+ }), n;
483
+ }
484
+ function Ht(e) {
485
+ const n = [];
486
+ for (const t of e)
487
+ t.type === "wx-blocks" && n.push(t), t.children && n.push(...Ht(t.children));
488
+ return n;
489
+ }
490
+ function qt(e) {
491
+ const n = {};
492
+ for (const [t, s] of Object.entries(e.values ?? {}))
493
+ n[t] = Xe(s) ? s.map(qt) : ge(s);
494
+ return e.hidden === !0 ? { key: at(), type: e.type, hidden: !0, values: n } : { key: at(), type: e.type, values: n };
495
+ }
496
+ function Gl(e, n, t) {
497
+ const s = ge(e), a = re(s, n);
498
+ return a ? (t ? a.node.hidden = !0 : delete a.node.hidden, s) : e;
499
+ }
500
+ function Zl(e, n, t) {
501
+ if (n === null) return e;
502
+ const s = re(e, n);
503
+ if (!s || t === null) return null;
504
+ const a = s.node.values[t];
505
+ return Array.isArray(a) || (s.node.values[t] = []), s.node.values[t];
506
+ }
507
+ function xt(e, n, t, s, a) {
508
+ const i = ge(e), o = Zl(i, n, t);
509
+ return o ? (o.splice(Math.max(0, Math.min(s, o.length)), 0, a), i) : e;
510
+ }
511
+ function Ql(e, n) {
512
+ const t = ge(e), s = re(t, n);
513
+ return s ? (s.list.splice(s.index, 1), t) : e;
514
+ }
515
+ function Xl(e, n, t) {
516
+ const s = ge(e), a = re(s, n);
517
+ return a ? (a.node.values = t, s) : e;
518
+ }
519
+ function en(e, n, t, s) {
520
+ if (n === null) return ge(s);
521
+ const a = ge(e), i = re(a, n);
522
+ return !i || t === null ? e : (i.node.values[t] = ge(s), a);
523
+ }
524
+ function ge(e) {
525
+ return e === void 0 ? e : JSON.parse(JSON.stringify(e));
526
+ }
527
+ const tn = {
526
528
  module: {
527
529
  title: "Blocks"
528
530
  },
@@ -678,130 +680,439 @@ const Hl = {
678
680
  "ok-container": "Width is decided by container queries.",
679
681
  "ok-variables": "Every variable of the template is a field of the schema."
680
682
  }
681
- }, yt = /* @__PURE__ */ new WeakSet();
682
- function Re() {
683
+ }, $t = /* @__PURE__ */ new WeakSet();
684
+ function Fe() {
683
685
  try {
684
- const { i18n: t } = Me();
685
- yt.has(t) || (t.defaults("webx-blocks", Hl), yt.add(t));
686
+ const { i18n: e } = Oe();
687
+ $t.has(e) || (e.defaults("webx-blocks", tn), $t.add(e));
686
688
  } catch {
687
689
  }
688
690
  }
689
- const jl = ["block", "entity", "loop", "__env", "errors", "app"];
690
- function Fl(t, l, o) {
691
- const a = [];
692
- /data-wx-block\s*=/.test(l.template) || a.push({ file: "template", code: "no-marker", line: null, message: o("checks.no-marker") });
693
- const s = ql(l.template, l.schema);
694
- s.length > 0 && a.push({
691
+ function ot(e) {
692
+ return [
693
+ Tl({ icons: !1 }),
694
+ Vl.languageData.of(() => [{ autocomplete: e }])
695
+ ];
696
+ }
697
+ const ln = [
698
+ ["block", "key, type, version, depth, value()"],
699
+ ["entity", "the page or article the block stands on"]
700
+ ], nn = ["key", "type", "version", "depth"], Kt = ["url", "alt", "title", "path"], sn = [...Kt, "thumb", "name", "extension", "mime", "size", "width", "height"], on = ["wx-media"], an = ["wx-gallery", "wx-files"];
701
+ function rn({ schema: e, styles: n }) {
702
+ return (t) => {
703
+ const s = t.state.sliceDoc(Math.max(0, t.pos - 200), t.pos), a = /\$block->(\w*)$/.exec(s);
704
+ if (a) return dn(t, a[1]);
705
+ const i = /\$(\w+)\[\s*(['"]?)(\w*)$/.exec(s);
706
+ if (i) return pn(t, i[1], i[2], i[3], e());
707
+ const o = /\$(\w*)$/.exec(s);
708
+ if (o)
709
+ return {
710
+ from: t.pos - o[0].length,
711
+ options: un(e(), t.state.doc.toString()),
712
+ validFor: /^\$\w*$/
713
+ };
714
+ const r = /(\{\{|\{!!)(\s*)(\w*)$/.exec(s);
715
+ if (r) return cn(t, r[1], r[2], r[3], e());
716
+ const m = /\bclass\s*=\s*"([^"]*)$/.exec(s);
717
+ if (m) return vn(t, m[1], n());
718
+ const c = /(?:^|[\s>(])@(\w*)$/.exec(s);
719
+ return c ? {
720
+ from: t.pos - c[1].length - 1,
721
+ options: mn(e()),
722
+ validFor: /^@\w*$/
723
+ } : null;
724
+ };
725
+ }
726
+ function un(e, n) {
727
+ const t = Gt(e).map((s, a) => ({
728
+ label: `$${s.id}`,
729
+ detail: s.type,
730
+ info: s.label,
731
+ type: "variable",
732
+ boost: 50 - a
733
+ }));
734
+ for (const s of Yt(n).keys())
735
+ t.push({ label: `$${s}`, detail: "loop", type: "variable" });
736
+ for (const [s, a] of ln)
737
+ t.push({ label: `$${s}`, detail: "given", info: a, type: "variable", boost: -10 });
738
+ return t.push({ label: "$loop", detail: "given", info: "inside @foreach", boost: -20 }), t;
739
+ }
740
+ function cn(e, n, t, s, a) {
741
+ const i = Gt(a);
742
+ if (i.length === 0) return null;
743
+ const o = n === "{{" ? "}}" : "!!}";
744
+ return {
745
+ from: e.pos - s.length,
746
+ options: i.map((r, m) => ({
747
+ label: r.id,
748
+ displayLabel: `$${r.id}`,
749
+ detail: r.type,
750
+ info: r.label,
751
+ type: "variable",
752
+ boost: 50 - m,
753
+ apply: (c, d, p, v) => {
754
+ const g = c.state.sliceDoc(v, v + 8), x = new RegExp(`^\\s*${_n(o)}`).exec(g), T = x ? /^\s/.test(g) ? "" : " " : ` ${o}`, w = `${t === "" ? " " : ""}$${r.id}${T}`;
755
+ c.dispatch({
756
+ changes: { from: p, to: v, insert: w },
757
+ // Past the closing braces: the echo is finished, the next thing is the markup.
758
+ selection: { anchor: p + w.length + (x ? x[0].length : 0) },
759
+ annotations: rt.of(d),
760
+ userEvent: "input.complete"
761
+ });
762
+ }
763
+ })),
764
+ validFor: /^\w*$/
765
+ };
766
+ }
767
+ function dn(e, n) {
768
+ return {
769
+ from: e.pos - n.length,
770
+ options: [
771
+ ...nn.map((t) => ({ label: t, type: "property" })),
772
+ me("value('${name}', ${default})", {
773
+ label: "value",
774
+ detail: "('name', default)",
775
+ type: "method"
776
+ })
777
+ ],
778
+ validFor: /^\w*$/
779
+ };
780
+ }
781
+ function pn(e, n, t, s, a) {
782
+ const i = fn(n, a, e.state.doc.toString());
783
+ return i.length === 0 ? null : {
784
+ from: e.pos - s.length,
785
+ options: i.map(([o, r]) => ({
786
+ label: o,
787
+ detail: r,
788
+ type: "property",
789
+ apply: (m, c, d, p) => {
790
+ const v = t ? d - 1 : d, g = m.state.sliceDoc(p, p + 2), x = t || "'", T = p + (g.startsWith(x) ? 1 : 0), w = m.state.sliceDoc(T, T + 1) === "]", y = `${x}${o}${x}${w ? "" : "]"}`;
791
+ m.dispatch({
792
+ changes: { from: v, to: T, insert: y },
793
+ selection: { anchor: v + y.length + (w ? 1 : 0) },
794
+ annotations: rt.of(c),
795
+ userEvent: "input.complete"
796
+ });
797
+ }
798
+ })),
799
+ validFor: /^\w*$/
800
+ };
801
+ }
802
+ function fn(e, n, t) {
803
+ const s = Le(n).find((o) => o.id === e);
804
+ if (s && on.includes(s.type)) return Kt.map((o) => [o, s.type]);
805
+ const a = Yt(t).get(e), i = a ? Le(n).find((o) => o.id === a) : void 0;
806
+ return i ? an.includes(i.type) ? sn.map((o) => [o, i.type]) : i.type === "wx-repeater" ? Le(i.children ?? []).map((o) => [o.id, o.type]) : [] : [];
807
+ }
808
+ function Yt(e) {
809
+ const n = /* @__PURE__ */ new Map();
810
+ for (const t of e.matchAll(/\$(\w+)\s+as\s+\$(\w+)(?:\s*=>\s*\$(\w+))?/g))
811
+ n.set(t[3] ?? t[2], t[1]);
812
+ return n;
813
+ }
814
+ function vn(e, n, t) {
815
+ const s = /[\w-]*$/.exec(n)[0], a = new Set(n.split(/\s+/));
816
+ return {
817
+ from: e.pos - s.length,
818
+ options: Jt(t).filter((i) => !a.has(i) || i === s).map((i) => ({ label: i, detail: "styles", type: "class" })),
819
+ validFor: /^[\w-]*$/
820
+ };
821
+ }
822
+ function mn(e) {
823
+ const n = Le(e).filter((t) => t.type === "wx-blocks");
824
+ return [
825
+ me("@if (${condition})\n ${}\n@endif", { label: "@if", type: "keyword" }),
826
+ me("@isset(${value})\n ${}\n@endisset", { label: "@isset", type: "keyword" }),
827
+ me("@foreach (${items} as ${item})\n ${}\n@endforeach", {
828
+ label: "@foreach",
829
+ type: "keyword"
830
+ }),
831
+ me("@forelse (${items} as ${item})\n ${}\n@empty\n ${}\n@endforelse", {
832
+ label: "@forelse",
833
+ type: "keyword"
834
+ }),
835
+ me("@unless (${condition})\n ${}\n@endunless", {
836
+ label: "@unless",
837
+ type: "keyword"
838
+ }),
839
+ me("@class([${}])", { label: "@class", type: "keyword" }),
840
+ me("@style([${}])", { label: "@style", type: "keyword" }),
841
+ ...n.map(
842
+ (t) => me(`@blocks('${t.id}')`, {
843
+ label: "@blocks",
844
+ detail: `('${t.id}')`,
845
+ type: "keyword",
846
+ boost: 10
847
+ })
848
+ ),
849
+ ...["@elseif", "@else", "@endif", "@endforeach", "@endisset", "@empty", "@endforelse"].map(
850
+ (t) => ({ label: t, type: "keyword", boost: -10 })
851
+ )
852
+ ];
853
+ }
854
+ function hn({ slug: e, template: n }) {
855
+ return (t) => {
856
+ const s = t.state.sliceDoc(Math.max(0, t.pos - 200), t.pos), a = /(?:^|[\s,>+~(}{])\.([\w-]*)$/.exec(s);
857
+ if (!a) return null;
858
+ const i = /[^{};]*$/.exec(s)[0];
859
+ if (/^\s*[\w-]+\s*:\s/.test(i)) return null;
860
+ const o = `b-${e()}`, r = new Set(Jt(t.state.doc.toString())), m = bn(n()), c = [o, ...m.filter((p) => p !== o)], d = c.map((p, v) => ({
861
+ label: `.${p}`,
862
+ // A class the template uses and nothing styles yet is the likeliest thing to write.
863
+ detail: r.has(p) ? "template" : "template · no rule yet",
864
+ type: "class",
865
+ boost: (r.has(p) ? 0 : 20) + (p === o ? 30 : 0) - v / 100
866
+ }));
867
+ for (const p of r)
868
+ c.includes(p) || d.push({ label: `.${p}`, detail: "styles", type: "class" });
869
+ return { from: t.pos - a[1].length - 1, options: d, validFor: /^\.[\w-]*$/ };
870
+ };
871
+ }
872
+ function Jt(e) {
873
+ const n = e.replace(/\/\*[\s\S]*?\*\//g, ""), t = /* @__PURE__ */ new Set(), s = [];
874
+ let a = "";
875
+ for (const i of n)
876
+ if (i === "{") {
877
+ const o = s.at(-1) ?? [""], r = a.split(",").map((m) => m.trim()).filter((m) => m !== "" && !m.startsWith("@")).flatMap(
878
+ (m) => m.includes("&") ? o.map((c) => m.replaceAll("&", c)) : o.map((c) => c ? `${c} ${m}` : m)
879
+ );
880
+ for (const m of r)
881
+ for (const c of m.matchAll(/\.(-?[a-zA-Z_][\w-]*)/g)) t.add(c[1]);
882
+ s.push(a.trim().startsWith("@") ? o : r.length ? r : o), a = "";
883
+ } else i === "}" ? (s.pop(), a = "") : i === ";" ? a = "" : a += i;
884
+ return [...t];
885
+ }
886
+ function bn(e) {
887
+ const n = /* @__PURE__ */ new Set();
888
+ for (const t of e.matchAll(/\bclass\s*=\s*"([^"]*)"/g)) {
889
+ const s = t[1].replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}|@\w+(\([^)]*\))?/g, " ");
890
+ for (const a of s.split(/\s+/))
891
+ /^-?[a-zA-Z_][\w-]*$/.test(a) && n.add(a);
892
+ }
893
+ return [...n];
894
+ }
895
+ const gn = [
896
+ { key: "id", value: '""', info: "The variable the template gets, in snake_case." },
897
+ { key: "type", value: '""', info: "A type from the registry." },
898
+ { key: "label", value: '""', info: "What the editor sees above the field." },
899
+ { key: "help", value: '""', info: "A hint under the field." },
900
+ { key: "localized", value: "true", info: "Edited per content language." },
901
+ { key: "props", value: "{}", info: "Passed to the component as they are." },
902
+ { key: "children", value: "[]", info: "Nodes inside a layout node or a repeater." },
903
+ { key: "visible", value: "", info: "`false`, or a condition on another field." },
904
+ { key: "slot", value: '""', info: "The parent's named slot to land in." },
905
+ { key: "can", value: '""', info: "The permission the node needs." }
906
+ ];
907
+ function yn({ types: e }) {
908
+ return (n) => {
909
+ const t = kn(n.state.doc.toString(), n.pos);
910
+ if (!t || !t.node) return null;
911
+ const s = t.string ? n.state.sliceDoc(t.string, n.pos) : /[\w-]*$/.exec(n.state.sliceDoc(Math.max(0, n.pos - 60), n.pos))[0];
912
+ if (!t.string && s === "" && !n.explicit) return null;
913
+ const a = n.pos - s.length, i = t.string !== null;
914
+ if (t.phase === "key") {
915
+ const o = gn.filter(({ key: r }) => !t.keys.has(r) || r === s).map(
916
+ ({ key: r, value: m, info: c }, d) => ({
917
+ label: r,
918
+ info: c,
919
+ type: "property",
920
+ boost: -d,
921
+ apply: (p, v, g, x) => St(p, v, g, x, i, `"${r}": ${m}`, m)
922
+ })
923
+ );
924
+ return { from: a, options: o, validFor: /^[\w-]*$/ };
925
+ }
926
+ if (t.phase === "value" && t.key === "type") {
927
+ const o = Object.entries(e()).map(([r, m]) => ({
928
+ label: r,
929
+ detail: m.kind,
930
+ type: "type",
931
+ // Fields first: a block's schema is mostly fields, the layout only groups them.
932
+ boost: m.kind === "field" ? 1 : 0,
933
+ apply: (c, d, p, v) => St(c, d, p, v, i, `"${r}"`, "")
934
+ }));
935
+ return { from: a, options: o, validFor: /^[\w-]*$/ };
936
+ }
937
+ return null;
938
+ };
939
+ }
940
+ function St(e, n, t, s, a, i, o) {
941
+ const r = a ? t - 1 : t, m = /^[\w-]*"?/.exec(e.state.sliceDoc(s, s + 60))[0], c = s + (a ? m.length : /^[\w-]*/.exec(m)[0].length), d = o === '""' || o === "{}" || o === "[]" ? 1 : 0;
942
+ e.dispatch({
943
+ changes: { from: r, to: c, insert: i },
944
+ selection: { anchor: r + i.length - d },
945
+ annotations: rt.of(n),
946
+ userEvent: "input.complete"
947
+ }), i.startsWith('"type"') && Cl(e);
948
+ }
949
+ function kn(e, n) {
950
+ let t = null, s = null, a = null, i = !1;
951
+ const o = (r) => r?.kind === "object" && r.parent?.kind === "array" && (r.parent.parent === null || r.parent.under === "children");
952
+ for (let r = 0; r <= e.length && (r === n && (s = t?.kind === "object" ? {
953
+ node: o(t),
954
+ phase: a?.key ? "key" : t.phase,
955
+ key: t.key,
956
+ keys: t.keys,
957
+ string: a ? a.start + 1 : null
958
+ } : null), r !== e.length); r++) {
959
+ const m = e[r];
960
+ if (a) {
961
+ if (i) i = !1;
962
+ else if (m === "\\") i = !0;
963
+ else if (m === '"' || m === `
964
+ `) {
965
+ const c = e.slice(a.start + 1, r);
966
+ t?.kind === "object" && (a.key ? (t.keys.add(c), t.key = c, t.phase = "colon") : t.phase === "value" && (t.phase = "after")), a = null;
967
+ }
968
+ continue;
969
+ }
970
+ if (!/\s/.test(m))
971
+ if (m === '"')
972
+ a = { start: r, key: t?.kind === "object" && t.phase === "key" };
973
+ else if (m === "{" || m === "[") {
974
+ const c = {
975
+ kind: m === "{" ? "object" : "array",
976
+ parent: t,
977
+ under: t?.kind === "object" ? t.key : null,
978
+ keys: /* @__PURE__ */ new Set(),
979
+ phase: "key",
980
+ key: null
981
+ };
982
+ t?.kind === "object" && (t.phase = "after"), t = c;
983
+ } else m === "}" || m === "]" ? t = t?.parent ?? null : m === ":" ? t?.kind === "object" && (t.phase = "value") : m === "," && t?.kind === "object" && (t.phase = "key", t.key = null);
984
+ }
985
+ return s;
986
+ }
987
+ function Le(e) {
988
+ const n = [];
989
+ for (const t of e)
990
+ !t || typeof t != "object" || (wn.has(t.type) ? n.push(...Le(t.children ?? [])) : typeof t.id == "string" && t.id !== "" && n.push(t));
991
+ return n;
992
+ }
993
+ function Gt(e) {
994
+ return Le(e).filter((n) => n.type !== "wx-blocks");
995
+ }
996
+ const wn = /* @__PURE__ */ new Set(["wx-card", "wx-tabs", "wx-tab", "wx-row", "wx-col", "wx-divider"]);
997
+ function _n(e) {
998
+ return e.replace(/[.*+?^${}()|[\]\\!]/g, "\\$&");
999
+ }
1000
+ const xn = ["block", "entity", "loop", "__env", "errors", "app"];
1001
+ function $n(e, n, t) {
1002
+ const s = [];
1003
+ /data-wx-block\s*=/.test(n.template) || s.push({ file: "template", code: "no-marker", line: null, message: t("checks.no-marker") });
1004
+ const a = Sn(n.template, n.schema);
1005
+ a.length > 0 && s.push({
695
1006
  file: "template",
696
1007
  code: "variables-missing",
697
1008
  line: null,
698
- message: o("checks.variables-missing", {
699
- variables: s.map((p) => `$${p}`).join(", ")
1009
+ message: t("checks.variables-missing", {
1010
+ variables: a.map((d) => `$${d}`).join(", ")
700
1011
  })
701
1012
  });
702
- const r = [], n = [], b = `.b-${t}`;
703
- for (const [p, g] of Jl(l.styles))
704
- p.startsWith(b) || p.startsWith("&") || (/^[a-z][a-z0-9-]*/i.test(p) ? n.push([p, g]) : r.push([p, g]));
705
- r.length > 0 && a.push({
1013
+ const i = [], o = [], r = `.b-${e}`;
1014
+ for (const [d, p] of En(n.styles))
1015
+ d.startsWith(r) || d.startsWith("&") || (/^[a-z][a-z0-9-]*/i.test(d) ? o.push([d, p]) : i.push([d, p]));
1016
+ i.length > 0 && s.push({
706
1017
  file: "styles",
707
1018
  code: "stray-selectors",
708
- line: r[0][1],
709
- message: o("checks.stray-selectors", { slug: t, selectors: wt(r) })
710
- }), n.length > 0 && a.push({
1019
+ line: i[0][1],
1020
+ message: t("checks.stray-selectors", { slug: e, selectors: Et(i) })
1021
+ }), o.length > 0 && s.push({
711
1022
  file: "styles",
712
1023
  code: "bare-selectors",
713
- line: n[0][1],
714
- message: o("checks.bare-selectors", { selectors: wt(n) })
1024
+ line: o[0][1],
1025
+ message: t("checks.bare-selectors", { selectors: Et(o) })
715
1026
  });
716
- const P = Ht(l.styles), v = /@media\b/.exec(P);
717
- return v && a.push({
1027
+ const m = Qt(n.styles), c = /@media\b/.exec(m);
1028
+ return c && s.push({
718
1029
  file: "styles",
719
1030
  code: "media-query",
720
- line: jt(P, v.index),
721
- message: o("checks.media-query")
722
- }), a;
723
- }
724
- function Rt(t) {
725
- const l = [];
726
- for (const o of t)
727
- o.id && l.push(o.id), o.children && l.push(...Rt(o.children));
728
- return l;
729
- }
730
- function ql(t, l) {
731
- const o = /* @__PURE__ */ new Set([...Rt(l), ...jl]);
732
- for (const s of t.matchAll(/\bas\s+\$([a-zA-Z_]\w*)(?:\s*=>\s*\$([a-zA-Z_]\w*))?/g))
733
- o.add(s[1]), s[2] && o.add(s[2]);
734
- for (const s of t.matchAll(/\$([a-zA-Z_]\w*)\s*(?:=[^=]|\+\+|--|\.=|\+=|-=)/g))
735
- o.add(s[1]);
736
- const a = [];
737
- for (const s of t.matchAll(/\$([a-zA-Z_]\w*)/g)) {
738
- const r = s[1];
739
- !o.has(r) && !a.includes(r) && a.push(r);
1031
+ line: Xt(m, c.index),
1032
+ message: t("checks.media-query")
1033
+ }), s;
1034
+ }
1035
+ function Zt(e) {
1036
+ const n = [];
1037
+ for (const t of e)
1038
+ t.id && n.push(t.id), t.children && n.push(...Zt(t.children));
1039
+ return n;
1040
+ }
1041
+ function Sn(e, n) {
1042
+ const t = /* @__PURE__ */ new Set([...Zt(n), ...xn]);
1043
+ for (const a of e.matchAll(/\bas\s+\$([a-zA-Z_]\w*)(?:\s*=>\s*\$([a-zA-Z_]\w*))?/g))
1044
+ t.add(a[1]), a[2] && t.add(a[2]);
1045
+ for (const a of e.matchAll(/\$([a-zA-Z_]\w*)\s*(?:=[^=]|\+\+|--|\.=|\+=|-=)/g))
1046
+ t.add(a[1]);
1047
+ const s = [];
1048
+ for (const a of e.matchAll(/\$([a-zA-Z_]\w*)/g)) {
1049
+ const i = a[1];
1050
+ !t.has(i) && !s.includes(i) && s.push(i);
740
1051
  }
741
- return a;
742
- }
743
- function Jl(t) {
744
- const l = Ht(t), o = [];
745
- for (const a of l.matchAll(/([^{};]+)\{/g)) {
746
- const s = a[1], r = s.trim();
747
- if (!(r === "" || r.startsWith("@")))
748
- for (const n of s.split(",")) {
749
- const b = n.trim();
750
- b === "" || b === "from" || b === "to" || b.endsWith("%") || o.push([b, jt(l, a.index + s.indexOf(b))]);
1052
+ return s;
1053
+ }
1054
+ function En(e) {
1055
+ const n = Qt(e), t = [];
1056
+ for (const s of n.matchAll(/([^{};]+)\{/g)) {
1057
+ const a = s[1], i = a.trim();
1058
+ if (!(i === "" || i.startsWith("@")))
1059
+ for (const o of a.split(",")) {
1060
+ const r = o.trim();
1061
+ r === "" || r === "from" || r === "to" || r.endsWith("%") || t.push([r, Xt(n, s.index + a.indexOf(r))]);
751
1062
  }
752
1063
  }
753
- return o;
1064
+ return t;
754
1065
  }
755
- function Ht(t) {
756
- return t.replace(/\/\*[\s\S]*?\*\//g, (l) => l.replace(/[^\n]/g, " "));
1066
+ function Qt(e) {
1067
+ return e.replace(/\/\*[\s\S]*?\*\//g, (n) => n.replace(/[^\n]/g, " "));
757
1068
  }
758
- function jt(t, l) {
759
- return t.slice(0, Math.max(0, l)).split(`
1069
+ function Xt(e, n) {
1070
+ return e.slice(0, Math.max(0, n)).split(`
760
1071
  `).length;
761
1072
  }
762
- function wt(t) {
763
- const l = [...new Set(t.map(([o]) => o))];
764
- return l.slice(0, 3).join(", ") + (l.length > 3 ? ", …" : "");
1073
+ function Et(e) {
1074
+ const n = [...new Set(e.map(([t]) => t))];
1075
+ return n.slice(0, 3).join(", ") + (n.length > 3 ? ", …" : "");
765
1076
  }
766
- function st(t) {
767
- return t.map((l) => ({
768
- ...l,
769
- name: l.name ?? l.id,
770
- children: l.children ? st(l.children) : l.children
1077
+ function dt(e) {
1078
+ return e.map((n) => ({
1079
+ ...n,
1080
+ name: n.name ?? n.id,
1081
+ children: n.children ? dt(n.children) : n.children
771
1082
  }));
772
1083
  }
773
- function nt(t, l) {
774
- return t === 0 ? l("page.not-used") : t === 1 ? l("page.on-page") : l("page.on-pages", { count: t });
1084
+ function it(e, n) {
1085
+ return e === 0 ? n("page.not-used") : e === 1 ? n("page.on-page") : n("page.on-pages", { count: e });
775
1086
  }
776
- function ze(t, l) {
777
- const o = `groups.${t}`, a = l(o);
778
- return a === o || a === `webx-blocks::${o}` ? t.charAt(0).toUpperCase() + t.slice(1) : a;
1087
+ function Me(e, n) {
1088
+ const t = `groups.${e}`, s = n(t);
1089
+ return s === t || s === `webx-blocks::${t}` ? e.charAt(0).toUpperCase() + e.slice(1) : s;
779
1090
  }
780
- const Kl = { class: "wx-block-editor" }, Gl = { class: "wx-block-editor__split" }, Yl = {
1091
+ const Tn = { class: "wx-block-editor" }, Cn = { class: "wx-block-editor__split" }, Vn = {
781
1092
  type: "button",
782
1093
  class: "wx-block-editor__uses"
783
- }, Zl = { class: "wx-block-editor__usage" }, Ql = { class: "wx-block-editor__pane" }, Xl = {
1094
+ }, Bn = { class: "wx-block-editor__usage" }, An = { class: "wx-block-editor__pane" }, Wn = {
784
1095
  key: 0,
785
1096
  class: "wx-block-editor__pills"
786
- }, en = ["disabled", "onClick", "textContent"], tn = { class: "wx-block-editor__pane" }, ln = { class: "wx-block-editor__pane" }, nn = { class: "wx-block-editor__note" }, an = { class: "wx-block-editor__split" }, on = { class: "wx-block-editor__pane" }, sn = { class: "wx-block-editor__note" }, rn = { class: "wx-block-editor__settings" }, un = {
1097
+ }, Ln = ["disabled", "onClick", "textContent"], zn = { class: "wx-block-editor__pane" }, Mn = { class: "wx-block-editor__pane" }, Dn = { class: "wx-block-editor__note" }, In = { class: "wx-block-editor__split" }, Nn = { class: "wx-block-editor__pane" }, Pn = { class: "wx-block-editor__note" }, Un = { class: "wx-block-editor__settings" }, On = {
787
1098
  key: 0,
788
1099
  class: "is-wide wx-block-editor__danger"
789
- }, cn = /* @__PURE__ */ ae({
1100
+ }, Rn = /* @__PURE__ */ ae({
790
1101
  __name: "BlockEditorPage",
791
1102
  props: {
792
1103
  base: { default: "/blocks" }
793
1104
  },
794
- setup(t) {
795
- const l = t, o = Me(), a = Ae(o), s = tl(), r = Tt();
796
- Re();
797
- const n = de("webx-blocks"), b = De(), P = T(() => Number(s.params.id)), v = U(null), p = U([]), g = U(!0), f = U(!1), k = U(!1), C = U("template"), V = T(() => {
798
- const A = o.state.manifest?.modules.find((h) => h.id === "blocks")?.meta;
1105
+ setup(e) {
1106
+ const n = e, t = Oe(), s = ze(t), a = cl(), i = At();
1107
+ Fe();
1108
+ const o = de("webx-blocks"), r = Re(), m = V(() => Number(a.params.id)), c = N(null), d = N([]), p = N(!0), v = N(!1), g = N(!1), x = N("template"), T = V(() => {
1109
+ const W = t.state.manifest?.modules.find((k) => k.id === "blocks")?.meta;
799
1110
  return {
800
- groups: A?.groups ?? [],
801
- editing: A?.editing ?? !0,
802
- provides: A?.provides ?? []
1111
+ groups: W?.groups ?? [],
1112
+ editing: W?.editing ?? !0,
1113
+ provides: W?.provides ?? []
803
1114
  };
804
- }), x = T(() => o.can("blocks.manage") && V.value.editing), m = Qe({
1115
+ }), w = V(() => t.can("blocks.manage") && T.value.editing), y = lt({
805
1116
  slug: "",
806
1117
  title: "",
807
1118
  description: "",
@@ -812,194 +1123,205 @@ const Kl = { class: "wx-block-editor" }, Gl = { class: "wx-block-editor__split"
812
1123
  allowed_in: [],
813
1124
  max_per_entity: null,
814
1125
  is_enabled: !0
815
- }), y = Qe({
1126
+ }), _ = lt({
816
1127
  schema: [],
817
1128
  template: "",
818
1129
  styles: "",
819
1130
  script: null,
820
1131
  sample: {}
821
- }), R = U("[]"), q = U(null), J = U(""), Z = U({}), c = U(null), B = Qe({
1132
+ }), R = N("[]"), K = N(null), Y = N(""), X = N({}), h = N(null), A = lt({
822
1133
  html: "",
823
1134
  styles: "",
824
1135
  script: null,
825
1136
  runtime: null,
826
1137
  stage: null,
827
1138
  loading: !1
828
- }), D = T(() => JSON.stringify({ settings: m, content: y })), K = T(() => J.value !== "" && D.value !== J.value), Se = T(() => Fl(m.slug, y, n)), pe = T(() => {
829
- const A = [...V.value.groups];
830
- return A.includes(m.group) || A.push(m.group), A.map((h) => ({ value: h, label: ze(h, n) }));
831
- }), se = T({
832
- get: () => y.sample,
833
- set: (A) => {
834
- y.sample = A;
1139
+ }), P = V(() => JSON.stringify({ settings: y, content: _ })), J = V(() => Y.value !== "" && P.value !== Y.value), Se = V(() => $n(y.slug, _, o)), ne = {
1140
+ template: [
1141
+ ot(
1142
+ rn({ schema: () => _.schema, styles: () => _.styles })
1143
+ )
1144
+ ],
1145
+ styles: [
1146
+ ot(hn({ slug: () => y.slug, template: () => _.template }))
1147
+ ],
1148
+ // The renderer's own types under the panel's, the same merge the sample form is drawn with.
1149
+ schema: [ot(yn({ types: () => ({ ...Ye, ...t.types }) }))]
1150
+ }, pe = V(() => {
1151
+ const W = [...T.value.groups];
1152
+ return W.includes(y.group) || W.push(y.group), W.map((k) => ({ value: k, label: Me(k, o) }));
1153
+ }), ke = V({
1154
+ get: () => _.sample,
1155
+ set: (W) => {
1156
+ _.sample = W;
835
1157
  }
836
- }), _e = T(() => Te(y.schema));
837
- function Te(A) {
838
- const h = [];
839
- for (const $ of A)
840
- $.type !== "wx-blocks" && !($.children?.length && !$.name) && h.push($.id), $.children && h.push(...Te($.children));
841
- return h;
842
- }
843
- function ke(A) {
844
- v.value = A, Object.assign(m, {
845
- slug: A.slug,
846
- title: A.title,
847
- description: A.description,
848
- icon: A.icon,
849
- group: A.group,
850
- sort: A.sort,
851
- allow: A.allow ?? [],
852
- allowed_in: A.allowed_in ?? [],
853
- max_per_entity: A.max_per_entity,
854
- is_enabled: A.is_enabled
1158
+ }), Ee = V(() => Te(_.schema));
1159
+ function Te(W) {
1160
+ const k = [];
1161
+ for (const E of W)
1162
+ E.type !== "wx-blocks" && !(E.children?.length && !E.name) && k.push(E.id), E.children && k.push(...Te(E.children));
1163
+ return k;
1164
+ }
1165
+ function Q(W) {
1166
+ c.value = W, Object.assign(y, {
1167
+ slug: W.slug,
1168
+ title: W.title,
1169
+ description: W.description,
1170
+ icon: W.icon,
1171
+ group: W.group,
1172
+ sort: W.sort,
1173
+ allow: W.allow ?? [],
1174
+ allowed_in: W.allowed_in ?? [],
1175
+ max_per_entity: W.max_per_entity,
1176
+ is_enabled: W.is_enabled
855
1177
  });
856
- const h = A.content ?? {
1178
+ const k = W.content ?? {
857
1179
  schema: [],
858
1180
  template: "",
859
1181
  styles: "",
860
1182
  script: null,
861
1183
  sample: {}
862
1184
  };
863
- Object.assign(y, ge(h)), R.value = JSON.stringify(h.schema, null, 2), q.value = null, J.value = D.value;
1185
+ Object.assign(_, ge(k)), R.value = JSON.stringify(k.schema, null, 2), K.value = null, Y.value = P.value;
864
1186
  }
865
- async function te() {
866
- g.value = !0;
1187
+ async function we() {
1188
+ p.value = !0;
867
1189
  try {
868
- ke(await a.get(P.value)), p.value = await a.usage(P.value);
869
- } catch (A) {
870
- G.danger(b(A));
1190
+ Q(await s.get(m.value)), d.value = await s.usage(m.value);
1191
+ } catch (W) {
1192
+ Z.danger(r(W));
871
1193
  } finally {
872
- g.value = !1;
1194
+ p.value = !1;
873
1195
  }
874
1196
  }
875
- function Ce(A) {
876
- R.value = A;
1197
+ function Ce(W) {
1198
+ R.value = W;
877
1199
  try {
878
- const h = JSON.parse(A);
879
- if (!Array.isArray(h)) throw new Error("not a list");
880
- y.schema = h, q.value = null;
881
- } catch (h) {
882
- q.value = n("page.schema-invalid", { error: h.message });
1200
+ const k = JSON.parse(W);
1201
+ if (!Array.isArray(k)) throw new Error("not a list");
1202
+ _.schema = k, K.value = null;
1203
+ } catch (k) {
1204
+ K.value = o("page.schema-invalid", { error: k.message });
883
1205
  }
884
1206
  }
885
- let ye, fe = 0;
886
- function z() {
1207
+ let ye, L = 0;
1208
+ function U() {
887
1209
  clearTimeout(ye), ye = setTimeout(() => {
888
- O();
1210
+ j();
889
1211
  }, 250);
890
1212
  }
891
- async function O() {
892
- if (!v.value) return;
893
- const A = ++fe;
894
- B.loading = !0;
1213
+ async function j() {
1214
+ if (!c.value) return;
1215
+ const W = ++L;
1216
+ A.loading = !0;
895
1217
  try {
896
- const h = await a.render(v.value.id, {
897
- values: y.sample,
898
- content: x.value ? {
899
- template: y.template,
900
- styles: y.styles,
901
- script: y.script,
902
- schema: y.schema
1218
+ const k = await s.render(c.value.id, {
1219
+ values: _.sample,
1220
+ content: w.value ? {
1221
+ template: _.template,
1222
+ styles: _.styles,
1223
+ script: _.script,
1224
+ schema: _.schema
903
1225
  } : void 0
904
1226
  });
905
- if (A !== fe) return;
906
- B.html = h.html, B.styles = h.styles, B.script = h.script, B.runtime = h.runtime, B.stage = h.stage ?? null;
907
- } catch (h) {
908
- A === fe && G.danger(b(h));
1227
+ if (W !== L) return;
1228
+ A.html = k.html, A.styles = k.styles, A.script = k.script, A.runtime = k.runtime, A.stage = k.stage ?? null;
1229
+ } catch (k) {
1230
+ W === L && Z.danger(r(k));
909
1231
  } finally {
910
- A === fe && (B.loading = !1);
1232
+ W === L && (A.loading = !1);
911
1233
  }
912
1234
  }
913
- X(
914
- () => [y.template, y.styles, y.script, y.schema, y.sample],
915
- z,
1235
+ te(
1236
+ () => [_.template, _.styles, _.script, _.schema, _.sample],
1237
+ U,
916
1238
  { deep: !0 }
917
1239
  );
918
- const H = U(null);
919
- function Y(A) {
920
- return `{{ $${A} }}`;
921
- }
922
- function ve(A) {
923
- const $ = H.value?.view?.value;
924
- if (!$) {
925
- y.template += `{{ $${A} }}`;
1240
+ const G = N(null);
1241
+ function fe(W) {
1242
+ return `{{ $${W} }}`;
1243
+ }
1244
+ function _e(W) {
1245
+ const E = G.value?.view?.value;
1246
+ if (!E) {
1247
+ _.template += `{{ $${W} }}`;
926
1248
  return;
927
1249
  }
928
- $.dispatch($.state.replaceSelection(`{{ $${A} }}`)), $.focus();
1250
+ E.dispatch(E.state.replaceSelection(`{{ $${W} }}`)), E.focus();
929
1251
  }
930
- async function me() {
931
- if (!v.value) return;
932
- f.value = !0, Z.value = {}, c.value = null;
933
- const A = v.value.draft?.number ?? null;
1252
+ async function se() {
1253
+ if (!c.value) return;
1254
+ v.value = !0, X.value = {}, h.value = null;
1255
+ const W = c.value.draft?.number ?? null;
934
1256
  try {
935
- const h = await a.update(v.value.id, {
936
- ...m,
937
- allow: m.allow.length ? m.allow : null,
938
- allowed_in: m.allowed_in.length ? m.allowed_in : null,
939
- description: m.description || null,
940
- icon: m.icon || null,
941
- content: q.value ? { ...y, schema: void 0 } : y
1257
+ const k = await s.update(c.value.id, {
1258
+ ...y,
1259
+ allow: y.allow.length ? y.allow : null,
1260
+ allowed_in: y.allowed_in.length ? y.allowed_in : null,
1261
+ description: y.description || null,
1262
+ icon: y.icon || null,
1263
+ content: K.value ? { ..._, schema: void 0 } : _
942
1264
  });
943
- ke(h), G.success(
944
- h.draft && h.draft.number !== A ? n("page.saved", { number: h.draft.number }) : n("page.unchanged")
1265
+ Q(k), Z.success(
1266
+ k.draft && k.draft.number !== W ? o("page.saved", { number: k.draft.number }) : o("page.unchanged")
945
1267
  );
946
- } catch (h) {
947
- const $ = h.body;
948
- $?.errors ? (Z.value = $.errors, G.danger(n("page.failed"))) : G.danger(b(h, n("page.failed")));
1268
+ } catch (k) {
1269
+ const E = k.body;
1270
+ E?.errors ? (X.value = E.errors, Z.danger(o("page.failed"))) : Z.danger(r(k, o("page.failed")));
949
1271
  } finally {
950
- f.value = !1;
1272
+ v.value = !1;
951
1273
  }
952
1274
  }
953
- async function ie() {
954
- if (!(!v.value?.draft || (K.value && await me(), !v.value.draft) || !await Ke({
955
- title: n("page.publish-title", { number: v.value.draft.number }),
956
- message: n("page.publish-text", { count: v.value.usage_count }),
957
- confirmText: n("page.publish"),
958
- cancelText: n("page.cancel")
1275
+ async function ve() {
1276
+ if (!(!c.value?.draft || (J.value && await se(), !c.value.draft) || !await Ge({
1277
+ title: o("page.publish-title", { number: c.value.draft.number }),
1278
+ message: o("page.publish-text", { count: c.value.usage_count }),
1279
+ confirmText: o("page.publish"),
1280
+ cancelText: o("page.cancel")
959
1281
  }))) {
960
- k.value = !0, c.value = null;
1282
+ g.value = !0, h.value = null;
961
1283
  try {
962
- ke(await a.publish(v.value.id)), G.success(n("page.published", { number: v.value.published?.number ?? 0 }));
963
- } catch (h) {
964
- const $ = h.body;
965
- $?.errors ? (c.value = $, C.value = "template", G.danger(n("page.publish-failed"))) : G.danger(b(h, n("page.publish-failed")));
1284
+ Q(await s.publish(c.value.id)), Z.success(o("page.published", { number: c.value.published?.number ?? 0 }));
1285
+ } catch (k) {
1286
+ const E = k.body;
1287
+ E?.errors ? (h.value = E, x.value = "template", Z.danger(o("page.publish-failed"))) : Z.danger(r(k, o("page.publish-failed")));
966
1288
  } finally {
967
- k.value = !1;
1289
+ g.value = !1;
968
1290
  }
969
1291
  }
970
1292
  }
971
- async function we() {
972
- if (!(!v.value || !await Ke({
973
- title: n("page.delete-title", { title: v.value.title }),
974
- message: n("page.delete-text"),
975
- confirmText: n("page.delete"),
976
- cancelText: n("page.cancel"),
1293
+ async function Ve() {
1294
+ if (!(!c.value || !await Ge({
1295
+ title: o("page.delete-title", { title: c.value.title }),
1296
+ message: o("page.delete-text"),
1297
+ confirmText: o("page.delete"),
1298
+ cancelText: o("page.cancel"),
977
1299
  tone: "danger"
978
1300
  })))
979
1301
  try {
980
- await a.remove(v.value.id), G.success(n("page.deleted")), r.push(l.base);
981
- } catch (h) {
982
- G.danger(b(h));
1302
+ await s.remove(c.value.id), Z.success(o("page.deleted")), i.push(n.base);
1303
+ } catch (k) {
1304
+ Z.danger(r(k));
983
1305
  }
984
1306
  }
985
- const Ve = T(
986
- () => c.value ? {
987
- message: c.value.errors.template?.[0] ?? c.value.message,
988
- line: c.value.line,
989
- where: c.value.entity ? n("page.failed-on", {
990
- title: c.value.entity.title ?? `#${c.value.entity.id}`
1307
+ const De = V(
1308
+ () => h.value ? {
1309
+ message: h.value.errors.template?.[0] ?? h.value.message,
1310
+ line: h.value.line,
1311
+ where: h.value.entity ? o("page.failed-on", {
1312
+ title: h.value.entity.title ?? `#${h.value.entity.id}`
991
1313
  }) : null
992
1314
  } : null
993
- ), Ee = T(() => C.value === "template" || C.value === "styles"), w = T(() => [
1315
+ ), $ = V(() => x.value === "template" || x.value === "styles"), M = V(() => [
994
1316
  {
995
- title: n("page.example-handler"),
1317
+ title: o("page.example-handler"),
996
1318
  code: `el.querySelector('.b-hero__button')?.addEventListener('click', (event) => {
997
1319
  event.preventDefault()
998
1320
  el.classList.toggle('is-open')
999
1321
  })`
1000
1322
  },
1001
1323
  {
1002
- title: n("page.example-values"),
1324
+ title: o("page.example-values"),
1003
1325
  /* The one thing the sentence above the examples does not say: values reach the script
1004
1326
  only through the attribute, and a template that never prints it hands over `{}`. */
1005
1327
  code: `// <section data-wx-values="{{ json_encode($block->values) }}">
@@ -1008,304 +1330,306 @@ const seconds = Number(values.delay ?? 5)
1008
1330
  setInterval(() => el.classList.toggle('is-second'), seconds * 1000)`
1009
1331
  },
1010
1332
  {
1011
- title: n("page.example-provided"),
1333
+ title: o("page.example-provided"),
1012
1334
  code: `const Swiper = await webx.use('swiper')
1013
1335
 
1014
1336
  new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
1015
1337
  }
1016
- ]), L = T(() => p.value.slice(0, 5));
1017
- function M(A) {
1018
- return Z.value[A]?.[0];
1338
+ ]), O = V(() => d.value.slice(0, 5));
1339
+ function H(W) {
1340
+ return X.value[W]?.[0];
1019
1341
  }
1020
- function Q(A) {
1021
- K.value && A.preventDefault();
1342
+ function ee(W) {
1343
+ J.value && W.preventDefault();
1022
1344
  }
1023
1345
  Ue(() => {
1024
- te(), window.addEventListener("beforeunload", Q);
1025
- }), Ge(() => {
1026
- clearTimeout(ye), window.removeEventListener("beforeunload", Q);
1027
- }), X(P, () => {
1028
- te();
1346
+ we(), window.addEventListener("beforeunload", ee);
1347
+ }), Ze(() => {
1348
+ clearTimeout(ye), window.removeEventListener("beforeunload", ee);
1349
+ }), te(m, () => {
1350
+ we();
1029
1351
  });
1030
- const le = T(
1031
- () => x.value ? [
1032
- { key: "save", label: n("page.save"), loading: f.value, run: () => {
1033
- me();
1352
+ const et = V(
1353
+ () => w.value ? [
1354
+ { key: "save", label: o("page.save"), loading: v.value, run: () => {
1355
+ se();
1034
1356
  } },
1035
1357
  {
1036
1358
  key: "publish",
1037
- label: n("page.publish"),
1359
+ label: o("page.publish"),
1038
1360
  primary: !0,
1039
- loading: k.value,
1040
- disabled: !v.value?.draft && !K.value,
1361
+ loading: g.value,
1362
+ disabled: !c.value?.draft && !J.value,
1041
1363
  run: () => {
1042
- ie();
1364
+ ve();
1043
1365
  }
1044
1366
  }
1045
1367
  ] : []
1046
1368
  );
1047
- return (A, h) => (i(), S("div", Kl, [
1048
- g.value || !v.value ? (i(), S(j, { key: 0 }, [
1049
- u(e(We), {
1369
+ return (W, k) => (u(), C("div", Tn, [
1370
+ p.value || !c.value ? (u(), C(F, { key: 0 }, [
1371
+ f(l(We), {
1050
1372
  class: "wx-block-editor__ghost-head",
1051
1373
  title: "",
1052
1374
  rows: 1
1053
1375
  }),
1054
- E("div", Gl, [
1055
- u(e(Be), null, {
1056
- default: d(() => [
1057
- u(e(We), { rows: 8 })
1376
+ B("div", Cn, [
1377
+ f(l(Be), null, {
1378
+ default: b(() => [
1379
+ f(l(We), { rows: 8 })
1058
1380
  ]),
1059
1381
  _: 1
1060
1382
  }),
1061
- u(e(Be), null, {
1062
- default: d(() => [
1063
- u(e(We), { rows: 4 })
1383
+ f(l(Be), null, {
1384
+ default: b(() => [
1385
+ f(l(We), { rows: 4 })
1064
1386
  ]),
1065
1387
  _: 1
1066
1388
  })
1067
1389
  ])
1068
- ], 64)) : (i(), S(j, { key: 1 }, [
1069
- u(e(nl), {
1070
- title: m.title,
1071
- back: t.base,
1072
- "back-label": e(n)("page.back"),
1073
- actions: le.value
1390
+ ], 64)) : (u(), C(F, { key: 1 }, [
1391
+ f(l(pl), {
1392
+ title: y.title,
1393
+ back: e.base,
1394
+ "back-label": l(o)("page.back"),
1395
+ actions: et.value
1074
1396
  }, {
1075
- "title-after": d(() => [
1076
- x.value ? (i(), I(e(al), {
1397
+ "title-after": b(() => [
1398
+ w.value ? (u(), D(l(fl), {
1077
1399
  key: 0,
1078
- name: m.title,
1079
- placeholder: e(n)("page.title"),
1080
- onRename: h[0] || (h[0] = ($) => m.title = $)
1081
- }, null, 8, ["name", "placeholder"])) : N("", !0),
1082
- K.value ? (i(), I(e(ue), {
1400
+ name: y.title,
1401
+ placeholder: l(o)("page.title"),
1402
+ onRename: k[0] || (k[0] = (E) => y.title = E)
1403
+ }, null, 8, ["name", "placeholder"])) : I("", !0),
1404
+ J.value ? (u(), D(l(ue), {
1083
1405
  key: 1,
1084
1406
  type: "primary",
1085
1407
  dot: ""
1086
1408
  }, {
1087
- default: d(() => [
1088
- W(_(e(n)("page.unsaved")), 1)
1409
+ default: b(() => [
1410
+ z(S(l(o)("page.unsaved")), 1)
1089
1411
  ]),
1090
1412
  _: 1
1091
- })) : N("", !0),
1092
- v.value.draft ? (i(), I(e(ue), {
1413
+ })) : I("", !0),
1414
+ c.value.draft ? (u(), D(l(ue), {
1093
1415
  key: 2,
1094
1416
  type: "warning",
1095
1417
  dot: ""
1096
1418
  }, {
1097
- default: d(() => [
1098
- W(_(e(n)("page.draft", { number: v.value.draft.number })), 1)
1419
+ default: b(() => [
1420
+ z(S(l(o)("page.draft", { number: c.value.draft.number })), 1)
1099
1421
  ]),
1100
1422
  _: 1
1101
- })) : N("", !0),
1102
- v.value.published ? (i(), I(e(ue), {
1423
+ })) : I("", !0),
1424
+ c.value.published ? (u(), D(l(ue), {
1103
1425
  key: 3,
1104
1426
  type: "success",
1105
1427
  dot: ""
1106
1428
  }, {
1107
- default: d(() => [
1108
- W(_(e(n)("page.live", { number: v.value.published.number })), 1)
1429
+ default: b(() => [
1430
+ z(S(l(o)("page.live", { number: c.value.published.number })), 1)
1109
1431
  ]),
1110
1432
  _: 1
1111
- })) : (i(), I(e(ue), {
1433
+ })) : (u(), D(l(ue), {
1112
1434
  key: 4,
1113
1435
  type: "default"
1114
1436
  }, {
1115
- default: d(() => [
1116
- W(_(e(n)("page.never-published")), 1)
1437
+ default: b(() => [
1438
+ z(S(l(o)("page.never-published")), 1)
1117
1439
  ]),
1118
1440
  _: 1
1119
1441
  }))
1120
1442
  ]),
1121
- subtitle: d(() => [
1122
- E("code", null, _(m.slug), 1),
1123
- W(" · " + _(e(ze)(m.group, e(n))) + " · ", 1),
1124
- v.value.usage_count > 0 ? (i(), I(e(ul), {
1443
+ subtitle: b(() => [
1444
+ B("code", null, S(y.slug), 1),
1445
+ z(" · " + S(l(Me)(y.group, l(o))) + " · ", 1),
1446
+ c.value.usage_count > 0 ? (u(), D(l(gl), {
1125
1447
  key: 0,
1126
- title: e(n)("page.usage"),
1448
+ title: l(o)("page.usage"),
1127
1449
  width: 260,
1128
1450
  align: "start"
1129
1451
  }, {
1130
- trigger: d(() => [
1131
- E("button", Yl, _(e(nt)(v.value.usage_count, e(n))), 1)
1452
+ trigger: b(() => [
1453
+ B("button", Vn, S(l(it)(c.value.usage_count, l(o))), 1)
1132
1454
  ]),
1133
- default: d(() => [
1134
- E("div", Zl, [
1135
- (i(!0), S(j, null, ee(L.value, ($) => (i(), S("div", {
1136
- key: `${$.model}:${$.id}`,
1455
+ default: b(() => [
1456
+ B("div", Bn, [
1457
+ (u(!0), C(F, null, le(O.value, (E) => (u(), C("div", {
1458
+ key: `${E.model}:${E.id}`,
1137
1459
  class: "wx-block-editor__use"
1138
1460
  }, [
1139
- E("span", null, _($.title ?? `#${$.id}`), 1),
1140
- $.published ? N("", !0) : (i(), I(e(ue), {
1461
+ B("span", null, S(E.title ?? `#${E.id}`), 1),
1462
+ E.published ? I("", !0) : (u(), D(l(ue), {
1141
1463
  key: 0,
1142
1464
  type: "warning",
1143
1465
  size: "sm"
1144
1466
  }, {
1145
- default: d(() => [
1146
- W(_(e(n)("page.unpublished-page")), 1)
1467
+ default: b(() => [
1468
+ z(S(l(o)("page.unpublished-page")), 1)
1147
1469
  ]),
1148
1470
  _: 1
1149
1471
  }))
1150
1472
  ]))), 128)),
1151
- p.value.length > L.value.length ? (i(), I(e(F), {
1473
+ d.value.length > O.value.length ? (u(), D(l(q), {
1152
1474
  key: 0,
1153
1475
  size: "sm",
1154
1476
  tone: "muted"
1155
1477
  }, {
1156
- default: d(() => [
1157
- W(_(e(n)("page.usage-more", { count: p.value.length - L.value.length })), 1)
1478
+ default: b(() => [
1479
+ z(S(l(o)("page.usage-more", { count: d.value.length - O.value.length })), 1)
1158
1480
  ]),
1159
1481
  _: 1
1160
- })) : N("", !0)
1482
+ })) : I("", !0)
1161
1483
  ])
1162
1484
  ]),
1163
1485
  _: 1
1164
- }, 8, ["title"])) : (i(), S(j, { key: 1 }, [
1165
- W(_(e(nt)(v.value.usage_count, e(n))), 1)
1486
+ }, 8, ["title"])) : (u(), C(F, { key: 1 }, [
1487
+ z(S(l(it)(c.value.usage_count, l(o))), 1)
1166
1488
  ], 64))
1167
1489
  ]),
1168
1490
  _: 1
1169
1491
  }, 8, ["title", "back", "back-label", "actions"]),
1170
- V.value.editing ? N("", !0) : (i(), I(e(Vt), {
1492
+ T.value.editing ? I("", !0) : (u(), D(l(Lt), {
1171
1493
  key: 0,
1172
1494
  type: "info",
1173
1495
  variant: "soft",
1174
- description: e(n)("page.editing-off")
1496
+ description: l(o)("page.editing-off")
1175
1497
  }, null, 8, ["description"])),
1176
- E("div", {
1177
- class: $e(["wx-block-editor__columns", { "is-alone": !Ee.value }])
1498
+ B("div", {
1499
+ class: $e(["wx-block-editor__columns", { "is-alone": !$.value }])
1178
1500
  }, [
1179
- u(e(cl), {
1180
- modelValue: C.value,
1181
- "onUpdate:modelValue": h[14] || (h[14] = ($) => C.value = $),
1501
+ f(l(yl), {
1502
+ modelValue: x.value,
1503
+ "onUpdate:modelValue": k[14] || (k[14] = (E) => x.value = E),
1182
1504
  "keep-alive": ""
1183
1505
  }, {
1184
- default: d(() => [
1185
- u(e(Le), {
1506
+ default: b(() => [
1507
+ f(l(Ae), {
1186
1508
  value: "template",
1187
- label: e(n)("page.tab-template")
1509
+ label: l(o)("page.tab-template")
1188
1510
  }, {
1189
- default: d(() => [
1190
- E("div", Ql, [
1191
- u(e(je), {
1511
+ default: b(() => [
1512
+ B("div", An, [
1513
+ f(l(He), {
1192
1514
  ref_key: "templateEditor",
1193
- ref: H,
1194
- modelValue: y.template,
1195
- "onUpdate:modelValue": h[1] || (h[1] = ($) => y.template = $),
1515
+ ref: G,
1516
+ modelValue: _.template,
1517
+ "onUpdate:modelValue": k[1] || (k[1] = (E) => _.template = E),
1196
1518
  language: "php",
1197
- readonly: !x.value,
1519
+ extensions: ne.template,
1520
+ readonly: !w.value,
1198
1521
  "min-height": "340px",
1199
1522
  "max-height": "70vh",
1200
1523
  "line-wrapping": ""
1201
- }, null, 8, ["modelValue", "readonly"]),
1202
- _e.value.length ? (i(), S("div", Xl, [
1203
- u(e(F), {
1524
+ }, null, 8, ["modelValue", "extensions", "readonly"]),
1525
+ Ee.value.length ? (u(), C("div", Wn, [
1526
+ f(l(q), {
1204
1527
  size: "sm",
1205
1528
  tone: "muted"
1206
1529
  }, {
1207
- default: d(() => [
1208
- W(_(e(n)("page.insert-field")), 1)
1530
+ default: b(() => [
1531
+ z(S(l(o)("page.insert-field")), 1)
1209
1532
  ]),
1210
1533
  _: 1
1211
1534
  }),
1212
- (i(!0), S(j, null, ee(_e.value, ($) => (i(), S("button", {
1213
- key: $,
1535
+ (u(!0), C(F, null, le(Ee.value, (E) => (u(), C("button", {
1536
+ key: E,
1214
1537
  type: "button",
1215
1538
  class: "wx-block-editor__pill",
1216
- disabled: !x.value,
1217
- onClick: (He) => ve($),
1218
- textContent: _(Y($))
1219
- }, null, 8, en))), 128))
1220
- ])) : N("", !0),
1221
- u(vt, {
1539
+ disabled: !w.value,
1540
+ onClick: (tt) => _e(E),
1541
+ textContent: S(fe(E))
1542
+ }, null, 8, Ln))), 128))
1543
+ ])) : I("", !0),
1544
+ f(bt, {
1222
1545
  file: "template",
1223
1546
  lints: Se.value,
1224
- slug: m.slug,
1225
- error: Ve.value
1547
+ slug: y.slug,
1548
+ error: De.value
1226
1549
  }, null, 8, ["lints", "slug", "error"])
1227
1550
  ])
1228
1551
  ]),
1229
1552
  _: 1
1230
1553
  }, 8, ["label"]),
1231
- u(e(Le), {
1554
+ f(l(Ae), {
1232
1555
  value: "styles",
1233
- label: e(n)("page.tab-styles")
1556
+ label: l(o)("page.tab-styles")
1234
1557
  }, {
1235
- default: d(() => [
1236
- E("div", tn, [
1237
- u(e(je), {
1238
- modelValue: y.styles,
1239
- "onUpdate:modelValue": h[2] || (h[2] = ($) => y.styles = $),
1558
+ default: b(() => [
1559
+ B("div", zn, [
1560
+ f(l(He), {
1561
+ modelValue: _.styles,
1562
+ "onUpdate:modelValue": k[2] || (k[2] = (E) => _.styles = E),
1240
1563
  language: "css",
1241
- readonly: !x.value,
1564
+ extensions: ne.styles,
1565
+ readonly: !w.value,
1242
1566
  "min-height": "340px",
1243
1567
  "max-height": "70vh"
1244
- }, null, 8, ["modelValue", "readonly"]),
1245
- u(vt, {
1568
+ }, null, 8, ["modelValue", "extensions", "readonly"]),
1569
+ f(bt, {
1246
1570
  file: "styles",
1247
1571
  lints: Se.value,
1248
- slug: m.slug
1572
+ slug: y.slug
1249
1573
  }, null, 8, ["lints", "slug"])
1250
1574
  ])
1251
1575
  ]),
1252
1576
  _: 1
1253
1577
  }, 8, ["label"]),
1254
- u(e(Le), {
1578
+ f(l(Ae), {
1255
1579
  value: "script",
1256
- label: e(n)("page.tab-script")
1580
+ label: l(o)("page.tab-script")
1257
1581
  }, {
1258
- default: d(() => [
1259
- E("div", ln, [
1260
- u(e(je), {
1261
- "model-value": y.script ?? "",
1582
+ default: b(() => [
1583
+ B("div", Mn, [
1584
+ f(l(He), {
1585
+ "model-value": _.script ?? "",
1262
1586
  language: "javascript",
1263
- readonly: !x.value,
1587
+ readonly: !w.value,
1264
1588
  "min-height": "340px",
1265
1589
  "max-height": "70vh",
1266
- "onUpdate:modelValue": h[3] || (h[3] = ($) => y.script = $ || null)
1590
+ "onUpdate:modelValue": k[3] || (k[3] = (E) => _.script = E || null)
1267
1591
  }, null, 8, ["model-value", "readonly"]),
1268
- E("div", nn, [
1269
- u(e(F), {
1592
+ B("div", Dn, [
1593
+ f(l(q), {
1270
1594
  size: "sm",
1271
1595
  tone: "muted"
1272
1596
  }, {
1273
- default: d(() => [
1274
- W(_(e(n)("page.script-help")), 1)
1597
+ default: b(() => [
1598
+ z(S(l(o)("page.script-help")), 1)
1275
1599
  ]),
1276
1600
  _: 1
1277
1601
  }),
1278
- u(e(F), {
1602
+ f(l(q), {
1279
1603
  size: "sm",
1280
1604
  tone: "muted"
1281
1605
  }, {
1282
- default: d(() => [
1283
- W(_(V.value.provides.length ? e(n)("page.provides", { names: V.value.provides.join(", ") }) : e(n)("page.provides-none")), 1)
1606
+ default: b(() => [
1607
+ z(S(T.value.provides.length ? l(o)("page.provides", { names: T.value.provides.join(", ") }) : l(o)("page.provides-none")), 1)
1284
1608
  ]),
1285
1609
  _: 1
1286
1610
  })
1287
1611
  ])
1288
1612
  ]),
1289
- u(e(Be), {
1613
+ f(l(Be), {
1290
1614
  class: "wx-block-editor__examples",
1291
- title: e(n)("page.examples")
1615
+ title: l(o)("page.examples")
1292
1616
  }, {
1293
- default: d(() => [
1294
- (i(!0), S(j, null, ee(w.value, ($) => (i(), S("div", {
1295
- key: $.title,
1617
+ default: b(() => [
1618
+ (u(!0), C(F, null, le(M.value, (E) => (u(), C("div", {
1619
+ key: E.title,
1296
1620
  class: "wx-block-editor__example"
1297
1621
  }, [
1298
- u(e(F), {
1622
+ f(l(q), {
1299
1623
  size: "sm",
1300
1624
  tone: "muted"
1301
1625
  }, {
1302
- default: d(() => [
1303
- W(_($.title), 1)
1626
+ default: b(() => [
1627
+ z(S(E.title), 1)
1304
1628
  ]),
1305
1629
  _: 2
1306
1630
  }, 1024),
1307
- E("pre", null, [
1308
- E("code", null, _($.code), 1)
1631
+ B("pre", null, [
1632
+ B("code", null, S(E.code), 1)
1309
1633
  ])
1310
1634
  ]))), 128))
1311
1635
  ]),
@@ -1314,73 +1638,74 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
1314
1638
  ]),
1315
1639
  _: 1
1316
1640
  }, 8, ["label"]),
1317
- u(e(Le), {
1641
+ f(l(Ae), {
1318
1642
  value: "fields",
1319
- label: e(n)("page.tab-fields")
1643
+ label: l(o)("page.tab-fields")
1320
1644
  }, {
1321
- default: d(() => [
1322
- E("div", an, [
1323
- E("div", on, [
1324
- u(e(je), {
1645
+ default: b(() => [
1646
+ B("div", In, [
1647
+ B("div", Nn, [
1648
+ f(l(He), {
1325
1649
  "model-value": R.value,
1326
1650
  language: "json",
1651
+ extensions: ne.schema,
1327
1652
  lint: "",
1328
- readonly: !x.value,
1653
+ readonly: !w.value,
1329
1654
  "min-height": "340px",
1330
1655
  "max-height": "70vh",
1331
1656
  "onUpdate:modelValue": Ce
1332
- }, null, 8, ["model-value", "readonly"]),
1333
- E("div", sn, [
1334
- q.value ? (i(), I(e(F), {
1657
+ }, null, 8, ["model-value", "extensions", "readonly"]),
1658
+ B("div", Pn, [
1659
+ K.value ? (u(), D(l(q), {
1335
1660
  key: 0,
1336
1661
  size: "sm",
1337
1662
  tone: "danger"
1338
1663
  }, {
1339
- default: d(() => [
1340
- W(_(q.value), 1)
1664
+ default: b(() => [
1665
+ z(S(K.value), 1)
1341
1666
  ]),
1342
1667
  _: 1
1343
- })) : M("content.schema") ? (i(), I(e(F), {
1668
+ })) : H("content.schema") ? (u(), D(l(q), {
1344
1669
  key: 1,
1345
1670
  size: "sm",
1346
1671
  tone: "danger"
1347
1672
  }, {
1348
- default: d(() => [
1349
- W(_(M("content.schema")), 1)
1673
+ default: b(() => [
1674
+ z(S(H("content.schema")), 1)
1350
1675
  ]),
1351
1676
  _: 1
1352
- })) : (i(), I(e(F), {
1677
+ })) : (u(), D(l(q), {
1353
1678
  key: 2,
1354
1679
  size: "sm",
1355
1680
  tone: "muted"
1356
1681
  }, {
1357
- default: d(() => [
1358
- W(_(e(n)("page.fields-help")), 1)
1682
+ default: b(() => [
1683
+ z(S(l(o)("page.fields-help")), 1)
1359
1684
  ]),
1360
1685
  _: 1
1361
1686
  })),
1362
- u(e(ol), {
1363
- title: e(n)("help.schema-title"),
1364
- body: e(n)("help.schema")
1687
+ f(l(vl), {
1688
+ title: l(o)("help.schema-title"),
1689
+ body: l(o)("help.schema")
1365
1690
  }, null, 8, ["title", "body"])
1366
1691
  ])
1367
1692
  ]),
1368
- u(e(Be), {
1693
+ f(l(Be), {
1369
1694
  class: "wx-block-editor__sample",
1370
- title: e(n)("page.sample")
1695
+ title: l(o)("page.sample")
1371
1696
  }, {
1372
- default: d(() => [
1373
- y.schema.length ? (i(), I(e(zt), {
1697
+ default: b(() => [
1698
+ _.schema.length ? (u(), D(l(Pt), {
1374
1699
  key: 0,
1375
- modelValue: se.value,
1376
- "onUpdate:modelValue": h[4] || (h[4] = ($) => se.value = $),
1377
- root: e(st)(y.schema),
1378
- types: e(o).types,
1379
- translate: e(o).i18n.t,
1380
- can: e(o).can,
1381
- disabled: !x.value,
1700
+ modelValue: ke.value,
1701
+ "onUpdate:modelValue": k[4] || (k[4] = (E) => ke.value = E),
1702
+ root: l(dt)(_.schema),
1703
+ types: l(t).types,
1704
+ translate: l(t).i18n.t,
1705
+ can: l(t).can,
1706
+ disabled: !w.value,
1382
1707
  size: "sm"
1383
- }, null, 8, ["modelValue", "root", "types", "translate", "can", "disabled"])) : N("", !0)
1708
+ }, null, 8, ["modelValue", "root", "types", "translate", "can", "disabled"])) : I("", !0)
1384
1709
  ]),
1385
1710
  _: 1
1386
1711
  }, 8, ["title"])
@@ -1388,173 +1713,173 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
1388
1713
  ]),
1389
1714
  _: 1
1390
1715
  }, 8, ["label"]),
1391
- u(e(Le), {
1716
+ f(l(Ae), {
1392
1717
  value: "settings",
1393
- label: e(n)("page.tab-settings")
1718
+ label: l(o)("page.tab-settings")
1394
1719
  }, {
1395
- default: d(() => [
1396
- u(e(Be), { class: "wx-block-editor__sheet" }, {
1397
- default: d(() => [
1398
- E("div", rn, [
1399
- u(e(ne), {
1400
- label: e(n)("page.identifier"),
1401
- help: e(n)("page.identifier-help"),
1402
- error: M("slug"),
1403
- disabled: !x.value
1720
+ default: b(() => [
1721
+ f(l(Be), { class: "wx-block-editor__sheet" }, {
1722
+ default: b(() => [
1723
+ B("div", Un, [
1724
+ f(l(oe), {
1725
+ label: l(o)("page.identifier"),
1726
+ help: l(o)("page.identifier-help"),
1727
+ error: H("slug"),
1728
+ disabled: !w.value
1404
1729
  }, {
1405
- default: d(() => [
1406
- u(e(Pe), {
1407
- modelValue: m.slug,
1408
- "onUpdate:modelValue": h[5] || (h[5] = ($) => m.slug = $)
1730
+ default: b(() => [
1731
+ f(l(Pe), {
1732
+ modelValue: y.slug,
1733
+ "onUpdate:modelValue": k[5] || (k[5] = (E) => y.slug = E)
1409
1734
  }, null, 8, ["modelValue"])
1410
1735
  ]),
1411
1736
  _: 1
1412
1737
  }, 8, ["label", "help", "error", "disabled"]),
1413
- u(e(ne), {
1414
- label: e(n)("page.group"),
1415
- help: e(n)("page.group-help"),
1416
- error: M("group"),
1417
- disabled: !x.value
1738
+ f(l(oe), {
1739
+ label: l(o)("page.group"),
1740
+ help: l(o)("page.group-help"),
1741
+ error: H("group"),
1742
+ disabled: !w.value
1418
1743
  }, {
1419
- default: d(() => [
1420
- u(e(Et), {
1421
- modelValue: m.group,
1422
- "onUpdate:modelValue": h[6] || (h[6] = ($) => m.group = $),
1744
+ default: b(() => [
1745
+ f(l(zt), {
1746
+ modelValue: y.group,
1747
+ "onUpdate:modelValue": k[6] || (k[6] = (E) => y.group = E),
1423
1748
  options: pe.value
1424
1749
  }, null, 8, ["modelValue", "options"])
1425
1750
  ]),
1426
1751
  _: 1
1427
1752
  }, 8, ["label", "help", "error", "disabled"]),
1428
- u(e(ne), {
1753
+ f(l(oe), {
1429
1754
  class: "is-wide",
1430
- label: e(n)("page.description"),
1431
- help: e(n)("page.description-help"),
1432
- error: M("description"),
1433
- disabled: !x.value
1755
+ label: l(o)("page.description"),
1756
+ help: l(o)("page.description-help"),
1757
+ error: H("description"),
1758
+ disabled: !w.value
1434
1759
  }, {
1435
- default: d(() => [
1436
- u(e(dl), {
1437
- "model-value": m.description ?? "",
1760
+ default: b(() => [
1761
+ f(l(kl), {
1762
+ "model-value": y.description ?? "",
1438
1763
  rows: 2,
1439
- "onUpdate:modelValue": h[7] || (h[7] = ($) => m.description = String($ ?? ""))
1764
+ "onUpdate:modelValue": k[7] || (k[7] = (E) => y.description = String(E ?? ""))
1440
1765
  }, null, 8, ["model-value"])
1441
1766
  ]),
1442
1767
  _: 1
1443
1768
  }, 8, ["label", "help", "error", "disabled"]),
1444
- u(e(ne), {
1445
- label: e(n)("page.icon"),
1446
- error: M("icon"),
1447
- disabled: !x.value
1769
+ f(l(oe), {
1770
+ label: l(o)("page.icon"),
1771
+ error: H("icon"),
1772
+ disabled: !w.value
1448
1773
  }, {
1449
- default: d(() => [
1450
- u(e(pl), {
1451
- "model-value": m.icon,
1774
+ default: b(() => [
1775
+ f(l(wl), {
1776
+ "model-value": y.icon,
1452
1777
  clearable: "",
1453
- placeholder: e(n)("page.icon-search"),
1454
- "empty-text": e(n)("page.icon-none"),
1455
- "unknown-text": e(n)("page.icon-unknown"),
1456
- "clear-label": e(n)("page.icon-clear"),
1457
- "onUpdate:modelValue": h[8] || (h[8] = ($) => m.icon = $)
1778
+ placeholder: l(o)("page.icon-search"),
1779
+ "empty-text": l(o)("page.icon-none"),
1780
+ "unknown-text": l(o)("page.icon-unknown"),
1781
+ "clear-label": l(o)("page.icon-clear"),
1782
+ "onUpdate:modelValue": k[8] || (k[8] = (E) => y.icon = E)
1458
1783
  }, null, 8, ["model-value", "placeholder", "empty-text", "unknown-text", "clear-label"])
1459
1784
  ]),
1460
1785
  _: 1
1461
1786
  }, 8, ["label", "error", "disabled"]),
1462
- u(e(ne), {
1463
- label: e(n)("page.sort"),
1464
- help: e(n)("page.sort-help"),
1465
- error: M("sort"),
1466
- disabled: !x.value
1787
+ f(l(oe), {
1788
+ label: l(o)("page.sort"),
1789
+ help: l(o)("page.sort-help"),
1790
+ error: H("sort"),
1791
+ disabled: !w.value
1467
1792
  }, {
1468
- default: d(() => [
1469
- u(e(dt), {
1470
- modelValue: m.sort,
1471
- "onUpdate:modelValue": h[9] || (h[9] = ($) => m.sort = $)
1793
+ default: b(() => [
1794
+ f(l(mt), {
1795
+ modelValue: y.sort,
1796
+ "onUpdate:modelValue": k[9] || (k[9] = (E) => y.sort = E)
1472
1797
  }, null, 8, ["modelValue"])
1473
1798
  ]),
1474
1799
  _: 1
1475
1800
  }, 8, ["label", "help", "error", "disabled"]),
1476
- u(e(ne), {
1477
- label: e(n)("page.allow"),
1478
- help: e(n)("page.allow-help"),
1479
- error: M("allow"),
1480
- disabled: !x.value
1801
+ f(l(oe), {
1802
+ label: l(o)("page.allow"),
1803
+ help: l(o)("page.allow-help"),
1804
+ error: H("allow"),
1805
+ disabled: !w.value
1481
1806
  }, {
1482
- default: d(() => [
1483
- u(e(pt), {
1484
- modelValue: m.allow,
1485
- "onUpdate:modelValue": h[10] || (h[10] = ($) => m.allow = $),
1807
+ default: b(() => [
1808
+ f(l(ht), {
1809
+ modelValue: y.allow,
1810
+ "onUpdate:modelValue": k[10] || (k[10] = (E) => y.allow = E),
1486
1811
  "allow-create": ""
1487
1812
  }, null, 8, ["modelValue"])
1488
1813
  ]),
1489
1814
  _: 1
1490
1815
  }, 8, ["label", "help", "error", "disabled"]),
1491
- u(e(ne), {
1492
- label: e(n)("page.allowed-in"),
1493
- help: e(n)("page.allowed-in-help"),
1494
- error: M("allowed_in"),
1495
- disabled: !x.value
1816
+ f(l(oe), {
1817
+ label: l(o)("page.allowed-in"),
1818
+ help: l(o)("page.allowed-in-help"),
1819
+ error: H("allowed_in"),
1820
+ disabled: !w.value
1496
1821
  }, {
1497
- default: d(() => [
1498
- u(e(pt), {
1499
- modelValue: m.allowed_in,
1500
- "onUpdate:modelValue": h[11] || (h[11] = ($) => m.allowed_in = $),
1822
+ default: b(() => [
1823
+ f(l(ht), {
1824
+ modelValue: y.allowed_in,
1825
+ "onUpdate:modelValue": k[11] || (k[11] = (E) => y.allowed_in = E),
1501
1826
  "allow-create": "",
1502
1827
  suggestions: ["root"]
1503
1828
  }, null, 8, ["modelValue"])
1504
1829
  ]),
1505
1830
  _: 1
1506
1831
  }, 8, ["label", "help", "error", "disabled"]),
1507
- u(e(ne), {
1508
- label: e(n)("page.max-per-entity"),
1509
- help: e(n)("page.max-per-entity-help"),
1510
- error: M("max_per_entity"),
1511
- disabled: !x.value
1832
+ f(l(oe), {
1833
+ label: l(o)("page.max-per-entity"),
1834
+ help: l(o)("page.max-per-entity-help"),
1835
+ error: H("max_per_entity"),
1836
+ disabled: !w.value
1512
1837
  }, {
1513
- default: d(() => [
1514
- u(e(dt), {
1515
- "model-value": m.max_per_entity ?? void 0,
1838
+ default: b(() => [
1839
+ f(l(mt), {
1840
+ "model-value": y.max_per_entity ?? void 0,
1516
1841
  min: 1,
1517
- "onUpdate:modelValue": h[12] || (h[12] = ($) => m.max_per_entity = $ ?? null)
1842
+ "onUpdate:modelValue": k[12] || (k[12] = (E) => y.max_per_entity = E ?? null)
1518
1843
  }, null, 8, ["model-value"])
1519
1844
  ]),
1520
1845
  _: 1
1521
1846
  }, 8, ["label", "help", "error", "disabled"]),
1522
- u(e(ne), {
1523
- label: e(n)("page.enabled"),
1524
- help: e(n)("page.enabled-help"),
1525
- disabled: !x.value
1847
+ f(l(oe), {
1848
+ label: l(o)("page.enabled"),
1849
+ help: l(o)("page.enabled-help"),
1850
+ disabled: !w.value
1526
1851
  }, {
1527
- default: d(() => [
1528
- u(e(vl), {
1529
- modelValue: m.is_enabled,
1530
- "onUpdate:modelValue": h[13] || (h[13] = ($) => m.is_enabled = $)
1852
+ default: b(() => [
1853
+ f(l(_l), {
1854
+ modelValue: y.is_enabled,
1855
+ "onUpdate:modelValue": k[13] || (k[13] = (E) => y.is_enabled = E)
1531
1856
  }, null, 8, ["modelValue"])
1532
1857
  ]),
1533
1858
  _: 1
1534
1859
  }, 8, ["label", "help", "disabled"]),
1535
- x.value ? (i(), S("div", un, [
1536
- u(e(ce), {
1860
+ w.value ? (u(), C("div", On, [
1861
+ f(l(ce), {
1537
1862
  type: "danger",
1538
1863
  variant: "outline",
1539
- disabled: v.value.usage_count > 0,
1540
- onClick: we
1864
+ disabled: c.value.usage_count > 0,
1865
+ onClick: Ve
1541
1866
  }, {
1542
- default: d(() => [
1543
- W(_(e(n)("page.delete")), 1)
1867
+ default: b(() => [
1868
+ z(S(l(o)("page.delete")), 1)
1544
1869
  ]),
1545
1870
  _: 1
1546
1871
  }, 8, ["disabled"]),
1547
- v.value.usage_count > 0 ? (i(), I(e(F), {
1872
+ c.value.usage_count > 0 ? (u(), D(l(q), {
1548
1873
  key: 0,
1549
1874
  size: "sm",
1550
1875
  tone: "muted"
1551
1876
  }, {
1552
- default: d(() => [
1553
- W(_(v.value.usage_count === 1 ? e(n)("page.delete-used-one") : e(n)("page.delete-used", { count: v.value.usage_count })), 1)
1877
+ default: b(() => [
1878
+ z(S(c.value.usage_count === 1 ? l(o)("page.delete-used-one") : l(o)("page.delete-used", { count: c.value.usage_count })), 1)
1554
1879
  ]),
1555
1880
  _: 1
1556
- })) : N("", !0)
1557
- ])) : N("", !0)
1881
+ })) : I("", !0)
1882
+ ])) : I("", !0)
1558
1883
  ])
1559
1884
  ]),
1560
1885
  _: 1
@@ -1562,20 +1887,20 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
1562
1887
  ]),
1563
1888
  _: 1
1564
1889
  }, 8, ["label"]),
1565
- u(e(Le), {
1890
+ f(l(Ae), {
1566
1891
  value: "history",
1567
- label: e(n)("page.tab-history")
1892
+ label: l(o)("page.tab-history")
1568
1893
  }, {
1569
- default: d(() => [
1570
- u(e(Be), {
1894
+ default: b(() => [
1895
+ f(l(Be), {
1571
1896
  class: "wx-block-editor__sheet",
1572
1897
  padding: "none"
1573
1898
  }, {
1574
- default: d(() => [
1575
- u(Sl, {
1576
- block: v.value,
1577
- "can-manage": x.value,
1578
- onRestored: ke
1899
+ default: b(() => [
1900
+ f(Il, {
1901
+ block: c.value,
1902
+ "can-manage": w.value,
1903
+ onRestored: Q
1579
1904
  }, null, 8, ["block", "can-manage"])
1580
1905
  ]),
1581
1906
  _: 1
@@ -1586,88 +1911,88 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
1586
1911
  ]),
1587
1912
  _: 1
1588
1913
  }, 8, ["modelValue"]),
1589
- Jt(u(zl, {
1914
+ ll(f(ql, {
1590
1915
  class: "wx-block-editor__stage",
1591
- html: B.html,
1592
- styles: B.styles,
1593
- script: B.script,
1594
- runtime: B.runtime,
1595
- stage: B.stage,
1596
- loading: B.loading
1916
+ html: A.html,
1917
+ styles: A.styles,
1918
+ script: A.script,
1919
+ runtime: A.runtime,
1920
+ stage: A.stage,
1921
+ loading: A.loading
1597
1922
  }, null, 8, ["html", "styles", "script", "runtime", "stage", "loading"]), [
1598
- [Kt, Ee.value]
1923
+ [nl, $.value]
1599
1924
  ])
1600
1925
  ], 2),
1601
- x.value ? (i(), I(e(fl), { key: 1 }, {
1602
- default: d(() => [
1603
- u(e(ce), {
1926
+ w.value ? (u(), D(l(xl), { key: 1 }, {
1927
+ default: b(() => [
1928
+ f(l(ce), {
1604
1929
  variant: "outline",
1605
- loading: f.value,
1606
- onClick: me
1930
+ loading: v.value,
1931
+ onClick: se
1607
1932
  }, {
1608
- default: d(() => [
1609
- W(_(e(n)("page.save")), 1)
1933
+ default: b(() => [
1934
+ z(S(l(o)("page.save")), 1)
1610
1935
  ]),
1611
1936
  _: 1
1612
1937
  }, 8, ["loading"]),
1613
- u(e(ce), {
1938
+ f(l(ce), {
1614
1939
  type: "primary",
1615
- loading: k.value,
1616
- disabled: !v.value.draft && !K.value,
1617
- onClick: ie
1940
+ loading: g.value,
1941
+ disabled: !c.value.draft && !J.value,
1942
+ onClick: ve
1618
1943
  }, {
1619
- default: d(() => [
1620
- W(_(e(n)("page.publish")), 1)
1944
+ default: b(() => [
1945
+ z(S(l(o)("page.publish")), 1)
1621
1946
  ]),
1622
1947
  _: 1
1623
1948
  }, 8, ["loading", "disabled"])
1624
1949
  ]),
1625
1950
  _: 1
1626
- })) : N("", !0)
1951
+ })) : I("", !0)
1627
1952
  ], 64))
1628
1953
  ]));
1629
1954
  }
1630
- }), dn = /* @__PURE__ */ oe(cn, [["__scopeId", "data-v-86e412ef"]]), pn = ["srcdoc"], vn = {
1955
+ }), jn = /* @__PURE__ */ ie(Rn, [["__scopeId", "data-v-22e5f784"]]), Fn = ["srcdoc"], Hn = {
1631
1956
  key: 1,
1632
1957
  class: "wx-block-thumb__empty"
1633
- }, fn = /* @__PURE__ */ ae({
1958
+ }, qn = /* @__PURE__ */ ae({
1634
1959
  __name: "BlockThumb",
1635
1960
  props: {
1636
1961
  thumbnail: {},
1637
1962
  width: { default: 1280 },
1638
1963
  height: { default: 120 }
1639
1964
  },
1640
- setup(t) {
1641
- const l = t, o = U(null), a = Ye(o), s = T(() => a.value > 0 ? a.value / l.width : 0.2), r = T(
1642
- () => l.thumbnail ? Pt({ html: l.thumbnail.html, styles: l.thumbnail.styles }) : ""
1643
- ), n = T(() => ({
1644
- width: `${l.width}px`,
1645
- height: `${Math.round(l.height / s.value)}px`,
1646
- transform: `scale(${s.value})`
1965
+ setup(e) {
1966
+ const n = e, t = N(null), s = Qe(t), a = V(() => s.value > 0 ? s.value / n.width : 0.2), i = V(
1967
+ () => n.thumbnail ? Rt({ html: n.thumbnail.html, styles: n.thumbnail.styles }) : ""
1968
+ ), o = V(() => ({
1969
+ width: `${n.width}px`,
1970
+ height: `${Math.round(n.height / a.value)}px`,
1971
+ transform: `scale(${a.value})`
1647
1972
  }));
1648
- return (b, P) => (i(), S("div", {
1973
+ return (r, m) => (u(), C("div", {
1649
1974
  ref_key: "box",
1650
- ref: o,
1975
+ ref: t,
1651
1976
  class: "wx-block-thumb",
1652
- style: xe({ height: `${t.height}px` })
1977
+ style: xe({ height: `${e.height}px` })
1653
1978
  }, [
1654
- t.thumbnail ? (i(), S("iframe", {
1979
+ e.thumbnail ? (u(), C("iframe", {
1655
1980
  key: 0,
1656
1981
  class: "wx-block-thumb__frame",
1657
- srcdoc: r.value,
1658
- style: xe(n.value),
1982
+ srcdoc: i.value,
1983
+ style: xe(o.value),
1659
1984
  sandbox: "allow-same-origin",
1660
1985
  tabindex: "-1",
1661
1986
  "aria-hidden": "true"
1662
- }, null, 12, pn)) : (i(), S("div", vn, [
1663
- u(e(be), { name: "grid" })
1987
+ }, null, 12, Fn)) : (u(), C("div", Hn, [
1988
+ f(l(be), { name: "grid" })
1664
1989
  ]))
1665
1990
  ], 4));
1666
1991
  }
1667
- }), Ft = /* @__PURE__ */ oe(fn, [["__scopeId", "data-v-615b818a"]]), mn = { class: "wx-block-picker" }, hn = {
1992
+ }), el = /* @__PURE__ */ ie(qn, [["__scopeId", "data-v-615b818a"]]), Kn = { class: "wx-block-picker" }, Yn = {
1668
1993
  key: 0,
1669
1994
  class: "wx-block-picker__group-title"
1670
- }, bn = { class: "wx-block-picker__cards" }, gn = ["disabled", "title", "onClick"], kn = { class: "wx-block-picker__body" }, yn = { class: "wx-block-picker__title" }, wn = /* @__PURE__ */ ae({
1995
+ }, Jn = { class: "wx-block-picker__cards" }, Gn = ["disabled", "title", "onClick"], Zn = { class: "wx-block-picker__body" }, Qn = { class: "wx-block-picker__title" }, Xn = /* @__PURE__ */ ae({
1671
1996
  __name: "BlockPicker",
1672
1997
  props: {
1673
1998
  catalog: {},
@@ -1677,135 +2002,135 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
1677
2002
  groups: { default: () => [] },
1678
2003
  blocksPath: { default: null }
1679
2004
  },
1680
- setup(t) {
1681
- const l = t, { resolve: o, dismiss: a, open: s } = Bt();
1682
- Re();
1683
- const r = de("webx-blocks"), n = U("");
1684
- function b(f) {
1685
- if (l.parent === null)
1686
- return f.allowed_in === null || f.allowed_in.includes("root");
1687
- const k = l.allow ? l.allow.includes(f.slug) : l.parent.allow?.includes(f.slug) === !0, C = f.allowed_in === null || f.allowed_in.includes(l.parent.slug);
1688
- return k && C;
1689
- }
1690
- const P = T(
1691
- () => l.catalog.filter((f) => f.is_enabled && f.published !== null && b(f)).map((f) => {
1692
- const k = Nl(l.tree, f.slug), C = f.max_per_entity !== null && k >= f.max_per_entity;
1693
- return { type: f, reason: C ? r("field.limit-reached", { count: k }) : null };
2005
+ setup(e) {
2006
+ const n = e, { resolve: t, dismiss: s, open: a } = Mt();
2007
+ Fe();
2008
+ const i = de("webx-blocks"), o = N("");
2009
+ function r(v) {
2010
+ if (n.parent === null)
2011
+ return v.allowed_in === null || v.allowed_in.includes("root");
2012
+ const g = n.allow ? n.allow.includes(v.slug) : n.parent.allow?.includes(v.slug) === !0, x = v.allowed_in === null || v.allowed_in.includes(n.parent.slug);
2013
+ return g && x;
2014
+ }
2015
+ const m = V(
2016
+ () => n.catalog.filter((v) => v.is_enabled && v.published !== null && r(v)).map((v) => {
2017
+ const g = Yl(n.tree, v.slug), x = v.max_per_entity !== null && g >= v.max_per_entity;
2018
+ return { type: v, reason: x ? i("field.limit-reached", { count: g }) : null };
1694
2019
  })
1695
- ), v = T(() => {
1696
- const f = n.value.trim().toLowerCase();
1697
- return f === "" ? P.value : P.value.filter(
1698
- ({ type: k }) => k.title.toLowerCase().includes(f) || k.slug.includes(f) || (k.description ?? "").toLowerCase().includes(f)
2020
+ ), c = V(() => {
2021
+ const v = o.value.trim().toLowerCase();
2022
+ return v === "" ? m.value : m.value.filter(
2023
+ ({ type: g }) => g.title.toLowerCase().includes(v) || g.slug.includes(v) || (g.description ?? "").toLowerCase().includes(v)
1699
2024
  );
1700
- }), p = T(() => {
1701
- const f = [...l.groups];
1702
- for (const { type: V } of v.value)
1703
- f.includes(V.group) || f.push(V.group);
1704
- const k = f.map((V) => ({
1705
- id: V,
1706
- label: ze(V, r),
1707
- options: v.value.filter((x) => x.type.group === V)
1708
- })).filter((V) => V.options.length > 0);
1709
- return v.value.length <= 5 || n.value.trim() !== "" || k.length < 2 ? [{ id: "", label: "", options: v.value }] : k;
1710
- }), g = T(() => {
1711
- if (l.catalog.length === 0) return r("field.pick-none");
1712
- if (P.value.length === 0 && l.parent) {
1713
- const f = (l.allow ?? l.parent.allow ?? []).filter(
1714
- (k) => l.catalog.some((C) => C.slug === k)
2025
+ }), d = V(() => {
2026
+ const v = [...n.groups];
2027
+ for (const { type: T } of c.value)
2028
+ v.includes(T.group) || v.push(T.group);
2029
+ const g = v.map((T) => ({
2030
+ id: T,
2031
+ label: Me(T, i),
2032
+ options: c.value.filter((w) => w.type.group === T)
2033
+ })).filter((T) => T.options.length > 0);
2034
+ return c.value.length <= 5 || o.value.trim() !== "" || g.length < 2 ? [{ id: "", label: "", options: c.value }] : g;
2035
+ }), p = V(() => {
2036
+ if (n.catalog.length === 0) return i("field.pick-none");
2037
+ if (m.value.length === 0 && n.parent) {
2038
+ const v = (n.allow ?? n.parent.allow ?? []).filter(
2039
+ (g) => n.catalog.some((x) => x.slug === g)
1715
2040
  );
1716
- return f.length === 0 ? r("field.pick-nothing-allowed", { parent: l.parent.title }) : r("field.pick-limited", { parent: l.parent.title, types: f.join(", ") });
2041
+ return v.length === 0 ? i("field.pick-nothing-allowed", { parent: n.parent.title }) : i("field.pick-limited", { parent: n.parent.title, types: v.join(", ") });
1717
2042
  }
1718
- return r("field.pick-empty");
2043
+ return i("field.pick-empty");
1719
2044
  });
1720
- return (f, k) => {
1721
- const C = xt("router-link");
1722
- return i(), I(e(Lt), {
1723
- open: e(s),
1724
- "onUpdate:open": k[2] || (k[2] = (V) => $t(s) ? s.value = V : null),
1725
- title: e(r)("field.pick"),
2045
+ return (v, g) => {
2046
+ const x = Ct("router-link");
2047
+ return u(), D(l(Dt), {
2048
+ open: l(a),
2049
+ "onUpdate:open": g[2] || (g[2] = (T) => Vt(a) ? a.value = T : null),
2050
+ title: l(i)("field.pick"),
1726
2051
  width: 860
1727
2052
  }, {
1728
- footer: d(() => [
1729
- u(e(ce), {
2053
+ footer: b(() => [
2054
+ f(l(ce), {
1730
2055
  variant: "outline",
1731
- onClick: k[1] || (k[1] = (V) => e(a)())
2056
+ onClick: g[1] || (g[1] = (T) => l(s)())
1732
2057
  }, {
1733
- default: d(() => [
1734
- W(_(e(r)("field.close")), 1)
2058
+ default: b(() => [
2059
+ z(S(l(i)("field.close")), 1)
1735
2060
  ]),
1736
2061
  _: 1
1737
2062
  })
1738
2063
  ]),
1739
- default: d(() => [
1740
- E("div", mn, [
1741
- P.value.length > 0 ? (i(), I(e(Pe), {
2064
+ default: b(() => [
2065
+ B("div", Kn, [
2066
+ m.value.length > 0 ? (u(), D(l(Pe), {
1742
2067
  key: 0,
1743
- modelValue: n.value,
1744
- "onUpdate:modelValue": k[0] || (k[0] = (V) => n.value = V),
1745
- placeholder: e(r)("field.search"),
2068
+ modelValue: o.value,
2069
+ "onUpdate:modelValue": g[0] || (g[0] = (T) => o.value = T),
2070
+ placeholder: l(i)("field.search"),
1746
2071
  clearable: "",
1747
2072
  autofocus: ""
1748
- }, null, 8, ["modelValue", "placeholder"])) : N("", !0),
1749
- v.value.length === 0 ? (i(), I(e(Wt), {
2073
+ }, null, 8, ["modelValue", "placeholder"])) : I("", !0),
2074
+ c.value.length === 0 ? (u(), D(l(It), {
1750
2075
  key: 1,
1751
2076
  icon: "grid",
1752
- title: g.value,
2077
+ title: p.value,
1753
2078
  size: "sm"
1754
2079
  }, {
1755
- default: d(() => [
1756
- t.catalog.length === 0 && t.blocksPath ? (i(), I(C, {
2080
+ default: b(() => [
2081
+ e.catalog.length === 0 && e.blocksPath ? (u(), D(x, {
1757
2082
  key: 0,
1758
- to: t.blocksPath
2083
+ to: e.blocksPath
1759
2084
  }, {
1760
- default: d(() => [
1761
- W(_(e(r)("field.pick-none-link")), 1)
2085
+ default: b(() => [
2086
+ z(S(l(i)("field.pick-none-link")), 1)
1762
2087
  ]),
1763
2088
  _: 1
1764
- }, 8, ["to"])) : N("", !0)
2089
+ }, 8, ["to"])) : I("", !0)
1765
2090
  ]),
1766
2091
  _: 1
1767
- }, 8, ["title"])) : N("", !0),
1768
- (i(!0), S(j, null, ee(p.value, (V) => (i(), S("section", {
1769
- key: V.id,
2092
+ }, 8, ["title"])) : I("", !0),
2093
+ (u(!0), C(F, null, le(d.value, (T) => (u(), C("section", {
2094
+ key: T.id,
1770
2095
  class: "wx-block-picker__group"
1771
2096
  }, [
1772
- V.label ? (i(), S("div", hn, _(V.label), 1)) : N("", !0),
1773
- E("div", bn, [
1774
- (i(!0), S(j, null, ee(V.options, (x) => (i(), S("button", {
1775
- key: x.type.id,
2097
+ T.label ? (u(), C("div", Yn, S(T.label), 1)) : I("", !0),
2098
+ B("div", Jn, [
2099
+ (u(!0), C(F, null, le(T.options, (w) => (u(), C("button", {
2100
+ key: w.type.id,
1776
2101
  type: "button",
1777
- class: $e(["wx-block-picker__card", { "is-disabled": x.reason !== null }]),
1778
- disabled: x.reason !== null,
1779
- title: x.reason ?? void 0,
1780
- onClick: (m) => e(o)(x.type)
2102
+ class: $e(["wx-block-picker__card", { "is-disabled": w.reason !== null }]),
2103
+ disabled: w.reason !== null,
2104
+ title: w.reason ?? void 0,
2105
+ onClick: (y) => l(t)(w.type)
1781
2106
  }, [
1782
- u(Ft, {
1783
- thumbnail: x.type.thumbnail,
2107
+ f(el, {
2108
+ thumbnail: w.type.thumbnail,
1784
2109
  height: 96
1785
2110
  }, null, 8, ["thumbnail"]),
1786
- E("div", kn, [
1787
- E("div", yn, _(x.type.title), 1),
1788
- x.reason ? (i(), I(e(F), {
2111
+ B("div", Zn, [
2112
+ B("div", Qn, S(w.type.title), 1),
2113
+ w.reason ? (u(), D(l(q), {
1789
2114
  key: 0,
1790
2115
  size: "sm",
1791
2116
  tone: "warning"
1792
2117
  }, {
1793
- default: d(() => [
1794
- W(_(x.reason), 1)
2118
+ default: b(() => [
2119
+ z(S(w.reason), 1)
1795
2120
  ]),
1796
2121
  _: 2
1797
- }, 1024)) : x.type.description ? (i(), I(e(F), {
2122
+ }, 1024)) : w.type.description ? (u(), D(l(q), {
1798
2123
  key: 1,
1799
2124
  size: "sm",
1800
2125
  tone: "muted"
1801
2126
  }, {
1802
- default: d(() => [
1803
- W(_(x.type.description), 1)
2127
+ default: b(() => [
2128
+ z(S(w.type.description), 1)
1804
2129
  ]),
1805
2130
  _: 2
1806
- }, 1024)) : N("", !0)
2131
+ }, 1024)) : I("", !0)
1807
2132
  ])
1808
- ], 10, gn))), 128))
2133
+ ], 10, Gn))), 128))
1809
2134
  ])
1810
2135
  ]))), 128))
1811
2136
  ])
@@ -1814,7 +2139,7 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
1814
2139
  }, 8, ["open", "title"]);
1815
2140
  };
1816
2141
  }
1817
- }), _n = /* @__PURE__ */ oe(wn, [["__scopeId", "data-v-99f4090e"]]), xn = { class: "wx-blocks-preview__tools" }, $n = ["src", "title"], Sn = /* @__PURE__ */ ae({
2142
+ }), es = /* @__PURE__ */ ie(Xn, [["__scopeId", "data-v-99f4090e"]]), ts = { class: "wx-blocks-preview__tools" }, ls = ["src", "title"], ns = /* @__PURE__ */ ae({
1818
2143
  __name: "BlocksPreview",
1819
2144
  props: {
1820
2145
  url: {},
@@ -1823,199 +2148,199 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
1823
2148
  compact: { type: Boolean, default: !1 }
1824
2149
  },
1825
2150
  emits: ["select", "edit"],
1826
- setup(t, { expose: l, emit: o }) {
1827
- const a = t, s = o, r = de("webx-blocks"), n = U(null), b = U(null), P = U(null), v = Ye(P), p = U(!1), g = U(!1), f = U(null), k = U(0), C = T(() => k.value > 0), V = T(() => [
1828
- { value: 1280, icon: "monitor", ariaLabel: r("field.width-desktop") },
1829
- { value: 834, icon: "tablet", ariaLabel: r("field.width-tablet") },
1830
- { value: 390, icon: "smartphone", ariaLabel: r("field.width-phone") }
1831
- ]), x = T(() => f.value !== null ? f.value : a.compact ? v.value > 0 && v.value < 560 ? 390 : 834 : 1280), m = T(() => v.value === 0 ? 1 : Math.min(1, v.value / x.value)), y = T(() => ({
1832
- width: `${x.value}px`,
1833
- transform: `scale(${m.value})`,
1834
- ...C.value ? { height: `${k.value}px` } : {}
1835
- })), R = T(() => ({
1836
- width: `${Math.round(x.value * m.value)}px`,
1837
- ...C.value ? { height: `${Math.round(k.value * m.value)}px` } : {}
1838
- })), q = T(() => {
1839
- if (!a.url) return "";
2151
+ setup(e, { expose: n, emit: t }) {
2152
+ const s = e, a = t, i = de("webx-blocks"), o = N(null), r = N(null), m = N(null), c = Qe(m), d = N(!1), p = N(!1), v = N(null), g = N(0), x = V(() => g.value > 0), T = V(() => [
2153
+ { value: 1280, icon: "monitor", ariaLabel: i("field.width-desktop") },
2154
+ { value: 834, icon: "tablet", ariaLabel: i("field.width-tablet") },
2155
+ { value: 390, icon: "smartphone", ariaLabel: i("field.width-phone") }
2156
+ ]), w = V(() => v.value !== null ? v.value : s.compact ? c.value > 0 && c.value < 560 ? 390 : 834 : 1280), y = V(() => c.value === 0 ? 1 : Math.min(1, c.value / w.value)), _ = V(() => ({
2157
+ width: `${w.value}px`,
2158
+ transform: `scale(${y.value})`,
2159
+ ...x.value ? { height: `${g.value}px` } : {}
2160
+ })), R = V(() => ({
2161
+ width: `${Math.round(w.value * y.value)}px`,
2162
+ ...x.value ? { height: `${Math.round(g.value * y.value)}px` } : {}
2163
+ })), K = V(() => {
2164
+ if (!s.url) return "";
1840
2165
  try {
1841
- return `${new URL(a.url, location.origin).pathname} · ${x.value} px`;
2166
+ return `${new URL(s.url, location.origin).pathname} · ${w.value} px`;
1842
2167
  } catch {
1843
- return a.url;
2168
+ return s.url;
1844
2169
  }
1845
2170
  });
1846
- function J() {
2171
+ function Y() {
1847
2172
  try {
1848
- return n.value?.contentDocument ?? null;
2173
+ return o.value?.contentDocument ?? null;
1849
2174
  } catch {
1850
2175
  return null;
1851
2176
  }
1852
2177
  }
1853
- let Z = null, c = null;
1854
- function B(z) {
1855
- z.documentElement.scrollTop !== 0 && (z.documentElement.scrollTop = 0);
2178
+ let X = null, h = null;
2179
+ function A(L) {
2180
+ L.documentElement.scrollTop !== 0 && (L.documentElement.scrollTop = 0);
1856
2181
  }
1857
- function D() {
1858
- const z = J(), O = z?.body;
1859
- if (!O || !z?.defaultView) return;
1860
- B(z);
1861
- const H = z.defaultView.getComputedStyle(O), Y = (parseFloat(H.marginTop) || 0) + (parseFloat(H.marginBottom) || 0), ve = Math.ceil(O.scrollHeight + Y);
1862
- ve !== k.value && (k.value = ve, pe !== null && Gt(() => requestAnimationFrame(te)));
2182
+ function P() {
2183
+ const L = Y(), U = L?.body;
2184
+ if (!U || !L?.defaultView) return;
2185
+ A(L);
2186
+ const j = L.defaultView.getComputedStyle(U), G = (parseFloat(j.marginTop) || 0) + (parseFloat(j.marginBottom) || 0), fe = Math.ceil(U.scrollHeight + G);
2187
+ fe !== g.value && (g.value = fe, ne !== null && sl(() => requestAnimationFrame(Q)));
1863
2188
  }
1864
- function K(z) {
1865
- c?.disconnect();
1866
- const O = z.defaultView;
1867
- !O || !z.body || (c = new O.ResizeObserver(D), c.observe(z.body), D());
2189
+ function J(L) {
2190
+ h?.disconnect();
2191
+ const U = L.defaultView;
2192
+ !U || !L.body || (h = new U.ResizeObserver(P), h.observe(L.body), P());
1868
2193
  }
1869
2194
  function Se() {
1870
- g.value = !0;
1871
- const z = J();
1872
- z && (K(z), Z?.release(), Z = Tl(z, {
2195
+ p.value = !0;
2196
+ const L = Y();
2197
+ L && (J(L), X?.release(), X = Nl(L, {
1873
2198
  /* No guard against answering a click with a scroll: `bring` moves nothing that is already
1874
2199
  readable, and a block clicked at the very bottom of the window, half under the action
1875
2200
  bar, is exactly the one worth moving. */
1876
- select: (O) => s("select", O)
1877
- }), et(z, a.selected ?? null), _e(a.selected ?? null));
1878
- }
1879
- let pe = null, se = null;
1880
- function _e(z) {
1881
- z !== null && (pe = z, se !== null && clearTimeout(se), se = window.setTimeout(() => {
1882
- pe = null, se = null;
1883
- }, 400), te());
1884
- }
1885
- function Te(z) {
1886
- const O = n.value?.getBoundingClientRect();
1887
- if (!O) return null;
1888
- const H = z.getBoundingClientRect();
1889
- return { top: O.top + H.top * m.value, height: H.height * m.value };
1890
- }
1891
- function ke() {
1892
- let z = n.value?.parentElement ?? null;
1893
- for (; z; ) {
1894
- const O = getComputedStyle(z).overflowY;
1895
- if ((O === "auto" || O === "scroll") && z.scrollHeight > z.clientHeight)
1896
- return z;
1897
- z = z.parentElement;
2201
+ select: (U) => a("select", U)
2202
+ }), nt(L, s.selected ?? null), ke(s.selected ?? null));
2203
+ }
2204
+ let ne = null, pe = null;
2205
+ function ke(L) {
2206
+ L !== null && (ne = L, pe !== null && clearTimeout(pe), pe = window.setTimeout(() => {
2207
+ ne = null, pe = null;
2208
+ }, 400), Q());
2209
+ }
2210
+ function Ee(L) {
2211
+ const U = o.value?.getBoundingClientRect();
2212
+ if (!U) return null;
2213
+ const j = L.getBoundingClientRect();
2214
+ return { top: U.top + j.top * y.value, height: j.height * y.value };
2215
+ }
2216
+ function Te() {
2217
+ let L = o.value?.parentElement ?? null;
2218
+ for (; L; ) {
2219
+ const U = getComputedStyle(L).overflowY;
2220
+ if ((U === "auto" || U === "scroll") && L.scrollHeight > L.clientHeight)
2221
+ return L;
2222
+ L = L.parentElement;
1898
2223
  }
1899
2224
  return null;
1900
2225
  }
1901
- function te() {
1902
- const z = J();
1903
- if (pe === null || !z) return;
1904
- B(z);
1905
- const O = at(z, pe), H = O ? Te(O) : null;
1906
- if (!H) return;
1907
- const Y = ke(), ve = Y?.getBoundingClientRect(), me = b.value?.getBoundingClientRect().height ?? 0, ie = {
1908
- top: (ve?.top ?? 0) + me,
1909
- bottom: (ve ? ve.bottom : window.innerHeight) - me
1910
- }, we = H.top + H.height, Ve = H.top < ie.top, Ee = H.height > ie.bottom - ie.top, w = Ve || Ee ? H.top - ie.top : we > ie.bottom ? we - ie.bottom : 0;
1911
- w !== 0 && (Y ?? window).scrollBy({ top: w, behavior: "smooth" });
1912
- }
1913
- function Ce(z, O) {
1914
- const H = J();
1915
- if (!H || !g.value) return !1;
1916
- const Y = Nt(H, z, O);
1917
- return Y && et(H, a.selected ?? null), Y;
1918
- }
1919
- function ye() {
1920
- g.value = !1, c?.disconnect(), c = null, n.value && a.url && (n.value.src = a.url);
1921
- }
1922
- function fe(z) {
1923
- z.key === "Escape" && p.value && (p.value = !1, z.stopPropagation());
1924
- }
1925
- return X(
1926
- () => a.selected,
1927
- (z) => {
1928
- const O = J();
1929
- !O || !g.value || (et(O, z ?? null), _e(z ?? null));
2226
+ function Q() {
2227
+ const L = Y();
2228
+ if (ne === null || !L) return;
2229
+ A(L);
2230
+ const U = ut(L, ne), j = U ? Ee(U) : null;
2231
+ if (!j) return;
2232
+ const G = Te(), fe = G?.getBoundingClientRect(), _e = r.value?.getBoundingClientRect().height ?? 0, se = {
2233
+ top: (fe?.top ?? 0) + _e,
2234
+ bottom: (fe ? fe.bottom : window.innerHeight) - _e
2235
+ }, ve = j.top + j.height, Ve = j.top < se.top, De = j.height > se.bottom - se.top, $ = Ve || De ? j.top - se.top : ve > se.bottom ? ve - se.bottom : 0;
2236
+ $ !== 0 && (G ?? window).scrollBy({ top: $, behavior: "smooth" });
2237
+ }
2238
+ function we(L, U) {
2239
+ const j = Y();
2240
+ if (!j || !p.value) return !1;
2241
+ const G = Ot(j, L, U);
2242
+ return G && nt(j, s.selected ?? null), G;
2243
+ }
2244
+ function Ce() {
2245
+ p.value = !1, h?.disconnect(), h = null, o.value && s.url && (o.value.src = s.url);
2246
+ }
2247
+ function ye(L) {
2248
+ L.key === "Escape" && d.value && (d.value = !1, L.stopPropagation());
2249
+ }
2250
+ return te(
2251
+ () => s.selected,
2252
+ (L) => {
2253
+ const U = Y();
2254
+ !U || !p.value || (nt(U, L ?? null), ke(L ?? null));
1930
2255
  }
1931
- ), X(() => a.reload, ye), X(
1932
- () => a.url,
1933
- () => g.value = !1
1934
- ), Ue(() => window.addEventListener("keydown", fe)), Ge(() => {
1935
- window.removeEventListener("keydown", fe), se !== null && clearTimeout(se), c?.disconnect(), Z?.release();
1936
- }), l({ replace: Ce, refresh: ye, open: () => p.value = !0 }), (z, O) => (i(), S("div", {
1937
- class: $e(["wx-blocks-preview", { "is-fullscreen": p.value, "is-grown": C.value, "is-compact": t.compact }]),
1938
- style: xe({ "--wx-preview-scale": m.value })
2256
+ ), te(() => s.reload, Ce), te(
2257
+ () => s.url,
2258
+ () => p.value = !1
2259
+ ), Ue(() => window.addEventListener("keydown", ye)), Ze(() => {
2260
+ window.removeEventListener("keydown", ye), pe !== null && clearTimeout(pe), h?.disconnect(), X?.release();
2261
+ }), n({ replace: we, refresh: Ce, open: () => d.value = !0 }), (L, U) => (u(), C("div", {
2262
+ class: $e(["wx-blocks-preview", { "is-fullscreen": d.value, "is-grown": x.value, "is-compact": e.compact }]),
2263
+ style: xe({ "--wx-preview-scale": y.value })
1939
2264
  }, [
1940
- E("div", {
2265
+ B("div", {
1941
2266
  ref_key: "bar",
1942
- ref: b,
2267
+ ref: r,
1943
2268
  class: "wx-blocks-preview__bar"
1944
2269
  }, [
1945
- u(e(F), {
2270
+ f(l(q), {
1946
2271
  size: "xs",
1947
2272
  tone: "muted",
1948
2273
  class: "wx-blocks-preview__label",
1949
2274
  truncate: ""
1950
2275
  }, {
1951
- default: d(() => [
1952
- W(_(q.value), 1)
2276
+ default: b(() => [
2277
+ z(S(K.value), 1)
1953
2278
  ]),
1954
2279
  _: 1
1955
2280
  }),
1956
- u(e(Ct), {
2281
+ f(l(Wt), {
1957
2282
  class: "wx-blocks-preview__widths",
1958
- "model-value": x.value,
1959
- options: V.value,
2283
+ "model-value": w.value,
2284
+ options: T.value,
1960
2285
  size: "sm",
1961
- "aria-label": e(r)("field.width"),
1962
- "onUpdate:modelValue": O[0] || (O[0] = (H) => f.value = Number(H))
2286
+ "aria-label": l(i)("field.width"),
2287
+ "onUpdate:modelValue": U[0] || (U[0] = (j) => v.value = Number(j))
1963
2288
  }, null, 8, ["model-value", "options", "aria-label"]),
1964
- E("div", xn, [
1965
- t.compact ? (i(), I(e(Ie), {
2289
+ B("div", ts, [
2290
+ e.compact ? (u(), D(l(Ie), {
1966
2291
  key: 0,
1967
2292
  size: "sm",
1968
2293
  tone: "primary",
1969
2294
  icon: "edit",
1970
- title: e(r)("field.blocks"),
1971
- onClick: O[1] || (O[1] = (H) => s("edit"))
1972
- }, null, 8, ["title"])) : N("", !0),
1973
- t.url ? (i(), I(e(Ie), {
2295
+ title: l(i)("field.blocks"),
2296
+ onClick: U[1] || (U[1] = (j) => a("edit"))
2297
+ }, null, 8, ["title"])) : I("", !0),
2298
+ e.url ? (u(), D(l(Ie), {
1974
2299
  key: 1,
1975
2300
  size: "sm",
1976
2301
  icon: "external-link",
1977
2302
  tone: "neutral",
1978
- title: e(r)("field.open-site"),
1979
- href: t.url,
2303
+ title: l(i)("field.open-site"),
2304
+ href: e.url,
1980
2305
  target: "_blank",
1981
2306
  rel: "noopener"
1982
- }, null, 8, ["title", "href"])) : N("", !0),
1983
- u(e(Ie), {
2307
+ }, null, 8, ["title", "href"])) : I("", !0),
2308
+ f(l(Ie), {
1984
2309
  size: "sm",
1985
- icon: p.value ? "minimize" : "maximize",
2310
+ icon: d.value ? "minimize" : "maximize",
1986
2311
  tone: "neutral",
1987
- title: p.value ? e(r)("field.close") : e(r)("field.fullscreen"),
1988
- onClick: O[2] || (O[2] = (H) => p.value = !p.value)
2312
+ title: d.value ? l(i)("field.close") : l(i)("field.fullscreen"),
2313
+ onClick: U[2] || (U[2] = (j) => d.value = !d.value)
1989
2314
  }, null, 8, ["icon", "title"])
1990
2315
  ])
1991
2316
  ], 512),
1992
- E("div", {
2317
+ B("div", {
1993
2318
  ref_key: "box",
1994
- ref: P,
2319
+ ref: m,
1995
2320
  class: "wx-blocks-preview__ground"
1996
2321
  }, [
1997
- E("div", {
2322
+ B("div", {
1998
2323
  class: "wx-blocks-preview__clip",
1999
2324
  style: xe(R.value)
2000
2325
  }, [
2001
- t.url ? (i(), S("iframe", {
2326
+ e.url ? (u(), C("iframe", {
2002
2327
  key: 0,
2003
2328
  ref_key: "frame",
2004
- ref: n,
2329
+ ref: o,
2005
2330
  class: "wx-blocks-preview__frame",
2006
- src: t.url,
2007
- style: xe(y.value),
2008
- title: e(r)("field.preview"),
2331
+ src: e.url,
2332
+ style: xe(_.value),
2333
+ title: l(i)("field.preview"),
2009
2334
  onLoad: Se
2010
- }, null, 44, $n)) : N("", !0)
2335
+ }, null, 44, ls)) : I("", !0)
2011
2336
  ], 4)
2012
2337
  ], 512)
2013
2338
  ], 6));
2014
2339
  }
2015
- }), Tn = /* @__PURE__ */ oe(Sn, [["__scopeId", "data-v-398e4cef"]]), Cn = { class: "wx-blocks-tree__node" }, Vn = ["onClick", "onKeydown"], En = { class: "wx-blocks-tree__name" }, Bn = ["title"], Ln = ["title"], Wn = ["title"], An = ["title"], zn = {
2340
+ }), ss = /* @__PURE__ */ ie(ns, [["__scopeId", "data-v-398e4cef"]]), os = { class: "wx-blocks-tree__node" }, as = ["onClick", "onKeydown"], is = { class: "wx-blocks-tree__name" }, rs = ["title"], us = ["title"], cs = ["title"], ds = ["title"], ps = {
2016
2341
  key: 4,
2017
2342
  class: "wx-blocks-tree__actions"
2018
- }, In = ["onClick"], Nn = /* @__PURE__ */ ae({
2343
+ }, fs = ["onClick"], vs = /* @__PURE__ */ ae({
2019
2344
  __name: "BlocksTree",
2020
2345
  props: {
2021
2346
  nodes: {},
@@ -2027,134 +2352,134 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
2027
2352
  depth: { default: 0 }
2028
2353
  },
2029
2354
  emits: ["select", "add", "remove", "duplicate", "visibility", "reorder"],
2030
- setup(t, { emit: l }) {
2031
- const o = t, a = l, s = de("webx-blocks");
2032
- function r(p) {
2033
- return o.catalog.find((g) => g.slug === p.type) ?? null;
2355
+ setup(e, { emit: n }) {
2356
+ const t = e, s = n, a = de("webx-blocks");
2357
+ function i(d) {
2358
+ return t.catalog.find((p) => p.slug === d.type) ?? null;
2034
2359
  }
2035
- function n(p) {
2036
- return r(p)?.title ?? p.type;
2360
+ function o(d) {
2361
+ return i(d)?.title ?? d.type;
2037
2362
  }
2038
- function b(p) {
2039
- const g = r(p);
2040
- return g?.content ? Dt(g.content.schema) : [];
2363
+ function r(d) {
2364
+ const p = i(d);
2365
+ return p?.content ? Ht(p.content.schema) : [];
2041
2366
  }
2042
- function P(p, g) {
2043
- const f = p.values[g.id];
2044
- return Array.isArray(f) ? f : [];
2367
+ function m(d, p) {
2368
+ const v = d.values[p.id];
2369
+ return Array.isArray(v) ? v : [];
2045
2370
  }
2046
- function v(p) {
2371
+ function c(d) {
2047
2372
  return [
2048
2373
  {
2049
2374
  key: "visibility",
2050
- icon: p.hidden === !0 ? "eye" : "eye-off",
2051
- label: p.hidden === !0 ? s("field.show") : s("field.hide"),
2052
- run: () => a("visibility", p.key, p.hidden !== !0)
2375
+ icon: d.hidden === !0 ? "eye" : "eye-off",
2376
+ label: d.hidden === !0 ? a("field.show") : a("field.hide"),
2377
+ run: () => s("visibility", d.key, d.hidden !== !0)
2053
2378
  },
2054
2379
  {
2055
2380
  key: "duplicate",
2056
2381
  icon: "copy",
2057
- label: s("field.duplicate"),
2058
- run: () => a("duplicate", p.key)
2382
+ label: a("field.duplicate"),
2383
+ run: () => s("duplicate", d.key)
2059
2384
  },
2060
2385
  {
2061
2386
  key: "remove",
2062
2387
  icon: "trash",
2063
- label: s("field.remove"),
2388
+ label: a("field.remove"),
2064
2389
  danger: !0,
2065
- run: () => a("remove", p.key)
2390
+ run: () => s("remove", d.key)
2066
2391
  }
2067
2392
  ];
2068
2393
  }
2069
- return (p, g) => {
2070
- const f = xt("blocks-tree", !0);
2071
- return i(), I(e(ml), {
2072
- "model-value": t.nodes,
2394
+ return (d, p) => {
2395
+ const v = Ct("blocks-tree", !0);
2396
+ return u(), D(l($l), {
2397
+ "model-value": e.nodes,
2073
2398
  "item-key": "key",
2074
- "item-label": (k) => n(k),
2075
- disabled: t.disabled,
2399
+ "item-label": (g) => o(g),
2400
+ disabled: e.disabled,
2076
2401
  plain: "",
2077
2402
  size: "sm",
2078
- "empty-text": t.depth === 0 ? e(s)("field.empty") : "",
2079
- class: $e(["wx-blocks-tree", { "is-nested": t.depth > 0 }]),
2080
- "onUpdate:modelValue": g[6] || (g[6] = (k) => a("reorder", t.parentKey, t.field, k))
2403
+ "empty-text": e.depth === 0 ? l(a)("field.empty") : "",
2404
+ class: $e(["wx-blocks-tree", { "is-nested": e.depth > 0 }]),
2405
+ "onUpdate:modelValue": p[6] || (p[6] = (g) => s("reorder", e.parentKey, e.field, g))
2081
2406
  }, {
2082
- default: d(({ item: k }) => [
2083
- E("div", Cn, [
2084
- E("div", {
2085
- class: $e(["wx-blocks-tree__row", { "is-selected": t.selected === k.key, "is-hidden": k.hidden === !0 }]),
2407
+ default: b(({ item: g }) => [
2408
+ B("div", os, [
2409
+ B("div", {
2410
+ class: $e(["wx-blocks-tree__row", { "is-selected": e.selected === g.key, "is-hidden": g.hidden === !0 }]),
2086
2411
  role: "button",
2087
2412
  tabindex: "0",
2088
- onClick: (C) => a("select", k.key),
2413
+ onClick: (x) => s("select", g.key),
2089
2414
  onKeydown: [
2090
- ut(ct((C) => a("select", k.key), ["prevent"]), ["enter"]),
2091
- ut(ct((C) => a("select", k.key), ["prevent"]), ["space"])
2415
+ ft(vt((x) => s("select", g.key), ["prevent"]), ["enter"]),
2416
+ ft(vt((x) => s("select", g.key), ["prevent"]), ["space"])
2092
2417
  ]
2093
2418
  }, [
2094
- E("span", En, _(n(k)), 1),
2095
- r(k) ? r(k)?.draft ? (i(), S("span", {
2419
+ B("span", is, S(o(g)), 1),
2420
+ i(g) ? i(g)?.draft ? (u(), C("span", {
2096
2421
  key: 1,
2097
2422
  class: "wx-blocks-tree__flag is-warning",
2098
- title: e(s)("field.draft-type")
2423
+ title: l(a)("field.draft-type")
2099
2424
  }, [
2100
- u(e(be), { name: "warning" })
2101
- ], 8, Ln)) : r(k)?.is_enabled === !1 ? (i(), S("span", {
2425
+ f(l(be), { name: "warning" })
2426
+ ], 8, us)) : i(g)?.is_enabled === !1 ? (u(), C("span", {
2102
2427
  key: 2,
2103
2428
  class: "wx-blocks-tree__flag",
2104
- title: e(s)("field.disabled-type")
2429
+ title: l(a)("field.disabled-type")
2105
2430
  }, [
2106
- u(e(be), { name: "lock" })
2107
- ], 8, Wn)) : N("", !0) : (i(), S("span", {
2431
+ f(l(be), { name: "lock" })
2432
+ ], 8, cs)) : I("", !0) : (u(), C("span", {
2108
2433
  key: 0,
2109
2434
  class: "wx-blocks-tree__flag is-danger",
2110
- title: e(s)("field.unknown-type", { type: k.type })
2435
+ title: l(a)("field.unknown-type", { type: g.type })
2111
2436
  }, [
2112
- u(e(be), { name: "close-circle" })
2113
- ], 8, Bn)),
2114
- k.hidden === !0 ? (i(), S("span", {
2437
+ f(l(be), { name: "close-circle" })
2438
+ ], 8, rs)),
2439
+ g.hidden === !0 ? (u(), C("span", {
2115
2440
  key: 3,
2116
2441
  class: "wx-blocks-tree__flag",
2117
- title: e(s)("field.hidden-note")
2442
+ title: l(a)("field.hidden-note")
2118
2443
  }, [
2119
- u(e(be), { name: "eye-off" })
2120
- ], 8, An)) : N("", !0),
2121
- t.disabled ? N("", !0) : (i(), S("span", zn, [
2122
- u(e(sl), {
2123
- actions: v(k),
2124
- label: n(k)
2444
+ f(l(be), { name: "eye-off" })
2445
+ ], 8, ds)) : I("", !0),
2446
+ e.disabled ? I("", !0) : (u(), C("span", ps, [
2447
+ f(l(ml), {
2448
+ actions: c(g),
2449
+ label: o(g)
2125
2450
  }, null, 8, ["actions", "label"])
2126
2451
  ]))
2127
- ], 42, Vn),
2128
- (i(!0), S(j, null, ee(b(k), (C) => (i(), S("div", {
2129
- key: C.id,
2452
+ ], 42, as),
2453
+ (u(!0), C(F, null, le(r(g), (x) => (u(), C("div", {
2454
+ key: x.id,
2130
2455
  class: "wx-blocks-tree__kids"
2131
2456
  }, [
2132
- u(f, {
2133
- nodes: P(k, C),
2134
- catalog: t.catalog,
2135
- "parent-key": k.key,
2136
- field: C.id,
2137
- selected: t.selected,
2138
- disabled: t.disabled,
2139
- depth: t.depth + 1,
2140
- onSelect: g[0] || (g[0] = (V) => a("select", V)),
2141
- onAdd: g[1] || (g[1] = (V, x, m) => a("add", V, x, m)),
2142
- onRemove: g[2] || (g[2] = (V) => a("remove", V)),
2143
- onDuplicate: g[3] || (g[3] = (V) => a("duplicate", V)),
2144
- onVisibility: g[4] || (g[4] = (V, x) => a("visibility", V, x)),
2145
- onReorder: g[5] || (g[5] = (V, x, m) => a("reorder", V, x, m))
2457
+ f(v, {
2458
+ nodes: m(g, x),
2459
+ catalog: e.catalog,
2460
+ "parent-key": g.key,
2461
+ field: x.id,
2462
+ selected: e.selected,
2463
+ disabled: e.disabled,
2464
+ depth: e.depth + 1,
2465
+ onSelect: p[0] || (p[0] = (T) => s("select", T)),
2466
+ onAdd: p[1] || (p[1] = (T, w, y) => s("add", T, w, y)),
2467
+ onRemove: p[2] || (p[2] = (T) => s("remove", T)),
2468
+ onDuplicate: p[3] || (p[3] = (T) => s("duplicate", T)),
2469
+ onVisibility: p[4] || (p[4] = (T, w) => s("visibility", T, w)),
2470
+ onReorder: p[5] || (p[5] = (T, w, y) => s("reorder", T, w, y))
2146
2471
  }, null, 8, ["nodes", "catalog", "parent-key", "field", "selected", "disabled", "depth"]),
2147
- t.disabled ? N("", !0) : (i(), S("button", {
2472
+ e.disabled ? I("", !0) : (u(), C("button", {
2148
2473
  key: 0,
2149
2474
  type: "button",
2150
2475
  class: "wx-blocks-tree__add is-inner",
2151
- onClick: (V) => a("add", k.key, C.id, C)
2476
+ onClick: (T) => s("add", g.key, x.id, x)
2152
2477
  }, [
2153
- W(" + " + _(e(s)("field.add-inside")), 1),
2154
- b(k).length > 1 ? (i(), S(j, { key: 0 }, [
2155
- W(" · " + _(C.label ?? C.id), 1)
2156
- ], 64)) : N("", !0)
2157
- ], 8, In))
2478
+ z(" + " + S(l(a)("field.add-inside")), 1),
2479
+ r(g).length > 1 ? (u(), C(F, { key: 0 }, [
2480
+ z(" · " + S(x.label ?? x.id), 1)
2481
+ ], 64)) : I("", !0)
2482
+ ], 8, fs))
2158
2483
  ]))), 128))
2159
2484
  ])
2160
2485
  ]),
@@ -2162,33 +2487,33 @@ new Swiper(el.querySelector('.b-slider__viewport'), { loop: true })`
2162
2487
  }, 8, ["model-value", "item-label", "disabled", "empty-text", "class"]);
2163
2488
  };
2164
2489
  }
2165
- }), Pn = /* @__PURE__ */ oe(Nn, [["__scopeId", "data-v-590fa1d6"]]), it = /* @__PURE__ */ Symbol("wx-blocks-preview");
2166
- function _a(t) {
2167
- St(it, t);
2490
+ }), ms = /* @__PURE__ */ ie(vs, [["__scopeId", "data-v-590fa1d6"]]), pt = /* @__PURE__ */ Symbol("wx-blocks-preview");
2491
+ function lo(e) {
2492
+ Bt(pt, e);
2168
2493
  }
2169
- function xa() {
2170
- return qe(it, null);
2494
+ function no() {
2495
+ return Ke(pt, null);
2171
2496
  }
2172
- const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
2497
+ const Tt = /* @__PURE__ */ Symbol("wx-blocks-root"), hs = {
2173
2498
  key: 0,
2174
2499
  class: "wx-blocks-nested"
2175
- }, Mn = {
2500
+ }, bs = {
2176
2501
  key: 0,
2177
2502
  class: "wx-blocks__tree"
2178
- }, Dn = { class: "wx-blocks__panel-head" }, On = { class: "wx-blocks__panel-title" }, Rn = { class: "wx-blocks__tools" }, Hn = {
2503
+ }, gs = { class: "wx-blocks__panel-head" }, ys = { class: "wx-blocks__panel-title" }, ks = { class: "wx-blocks__tools" }, ws = {
2179
2504
  key: 1,
2180
2505
  class: "wx-blocks__fields"
2181
- }, jn = { class: "wx-blocks__panel-head" }, Fn = { class: "wx-blocks__panel-title" }, qn = {
2506
+ }, _s = { class: "wx-blocks__panel-head" }, xs = { class: "wx-blocks__panel-title" }, $s = {
2182
2507
  key: 0,
2183
2508
  class: "wx-blocks__trail"
2184
- }, Jn = ["onClick"], Kn = { class: "wx-blocks__panel-name" }, Gn = { class: "wx-blocks__panel-extra" }, Yn = { key: 0 }, Zn = { class: "wx-blocks__form" }, Qn = {
2509
+ }, Ss = ["onClick"], Es = { class: "wx-blocks__panel-name" }, Ts = { class: "wx-blocks__panel-extra" }, Cs = { key: 0 }, Vs = { class: "wx-blocks__form" }, Bs = {
2185
2510
  key: 0,
2186
2511
  class: "wx-blocks__preview"
2187
- }, Xn = /* @__PURE__ */ ae({
2512
+ }, As = /* @__PURE__ */ ae({
2188
2513
  name: "WxBlocks",
2189
2514
  inheritAttrs: !1,
2190
2515
  __name: "BlocksField",
2191
- props: /* @__PURE__ */ el({
2516
+ props: /* @__PURE__ */ ul({
2192
2517
  node: { default: void 0 },
2193
2518
  context: { default: void 0 },
2194
2519
  name: { default: void 0 },
@@ -2203,38 +2528,38 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
2203
2528
  modelModifiers: {}
2204
2529
  }),
2205
2530
  emits: ["update:modelValue"],
2206
- setup(t) {
2207
- const l = t, o = Yt(t, "modelValue"), a = qe(_t, !1);
2208
- St(_t, !0), Re();
2209
- const s = de("webx-blocks"), r = De(), n = qe(il, null);
2210
- let b = null;
2211
- const P = U([]), v = T(() => l.catalog ?? P.value), p = T(() => Array.isArray(o.value) ? o.value : []), g = U(null), f = T(() => g.value ? re(p.value, g.value) : null), k = T(
2212
- () => f.value ? v.value.find((w) => w.slug === f.value?.node.type) ?? null : null
2531
+ setup(e) {
2532
+ const n = e, t = ol(e, "modelValue"), s = Ke(Tt, !1);
2533
+ Bt(Tt, !0), Fe();
2534
+ const a = de("webx-blocks"), i = Re(), o = Ke(hl, null);
2535
+ let r = null;
2536
+ const m = N([]), c = V(() => n.catalog ?? m.value), d = V(() => Array.isArray(t.value) ? t.value : []), p = N(null), v = V(() => p.value ? re(d.value, p.value) : null), g = V(
2537
+ () => v.value ? c.value.find(($) => $.slug === v.value?.node.type) ?? null : null
2213
2538
  );
2214
- function C(w) {
2215
- return v.value.find((L) => L.slug === w.type)?.title ?? w.type;
2216
- }
2217
- const V = T(() => {
2218
- const w = [];
2219
- return Oe(p.value, (L) => w.push(L.key)), w;
2220
- }), x = T(() => {
2221
- const w = g.value ? V.value.indexOf(g.value) : -1;
2539
+ function x($) {
2540
+ return c.value.find((M) => M.slug === $.type)?.title ?? $.type;
2541
+ }
2542
+ const T = V(() => {
2543
+ const $ = [];
2544
+ return je(d.value, (M) => $.push(M.key)), $;
2545
+ }), w = V(() => {
2546
+ const $ = p.value ? T.value.indexOf(p.value) : -1;
2222
2547
  return {
2223
- previous: w > 0 ? V.value[w - 1] : null,
2224
- next: w >= 0 && w < V.value.length - 1 ? V.value[w + 1] : null
2548
+ previous: $ > 0 ? T.value[$ - 1] : null,
2549
+ next: $ >= 0 && $ < T.value.length - 1 ? T.value[$ + 1] : null
2225
2550
  };
2226
- }), m = T(() => {
2227
- const w = [];
2228
- let L = f.value?.parent ?? null;
2229
- for (; L; )
2230
- w.unshift({ key: L.key, title: C(L) }), L = re(p.value, L.key)?.parent ?? null;
2231
- return w;
2232
- }), y = qe(it, null), R = U(null), q = U(null), J = Ye(q), Z = T(() => y !== null && y.url.value !== null), c = T(() => Z.value && J.value > 0 && J.value <= 900), B = U(!1), D = T(() => {
2233
- if (!f.value) return;
2234
- const w = k.value?.title ?? f.value.node.type;
2235
- return [...m.value.map((L) => L.title), w].join(" / ");
2236
- }), K = T(
2237
- () => c.value ? {
2551
+ }), y = V(() => {
2552
+ const $ = [];
2553
+ let M = v.value?.parent ?? null;
2554
+ for (; M; )
2555
+ $.unshift({ key: M.key, title: x(M) }), M = re(d.value, M.key)?.parent ?? null;
2556
+ return $;
2557
+ }), _ = Ke(pt, null), R = N(null), K = N(null), Y = Qe(K), X = V(() => _ !== null && _.url.value !== null), h = V(() => X.value && Y.value > 0 && Y.value <= 900), A = N(!1), P = V(() => {
2558
+ if (!v.value) return;
2559
+ const $ = g.value?.title ?? v.value.node.type;
2560
+ return [...y.value.map((M) => M.title), $].join(" / ");
2561
+ }), J = V(
2562
+ () => h.value ? {
2238
2563
  /* Up from the bottom, and not all the way: the strip of page left above it is what
2239
2564
  says the sheet is over the page rather than instead of it. No heading of its own —
2240
2565
  the panels inside carry theirs, and the × is the one thing the sheet has to add. */
@@ -2244,354 +2569,354 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
2244
2569
  takes a narrow screen whole unless it is told not to. */
2245
2570
  fullScreen: !1,
2246
2571
  closable: !0,
2247
- closeLabel: s("field.close"),
2248
- ariaLabel: s("field.blocks"),
2572
+ closeLabel: a("field.close"),
2573
+ ariaLabel: a("field.blocks"),
2249
2574
  /* The open block's name goes in the sheet's own head, where there is a whole line for
2250
2575
  it: in the form's head it shared a row with four controls and wrapped onto two. With
2251
2576
  the blocks it is inside spelled out in front of it, because the trail that says so
2252
2577
  in the column is part of the heading this replaces. The tree keeps its own heading,
2253
2578
  which already says what it is and how many. */
2254
- title: D.value,
2255
- open: B.value,
2256
- "onUpdate:open": (w) => B.value = w
2579
+ title: P.value,
2580
+ open: A.value,
2581
+ "onUpdate:open": ($) => A.value = $
2257
2582
  } : {}
2258
- ), Se = T(
2259
- () => n?.state.manifest?.modules.find((w) => w.id === "blocks")?.meta?.groups ?? []
2260
- ), pe = Zt()?.type, se = T(() => l.context?.types ? l.context.types : n?.types ? { ...Xe, ...n.types } : pe ? { ...Xe, "wx-blocks": { component: pe, kind: "field", nested: !0 } } : Xe), _e = T(
2261
- () => l.context?.translate ?? n?.i18n.t ?? ((w) => w)
2262
- ), Te = T(() => l.context?.can ?? n?.can ?? (() => !0)), ke = At(_n);
2263
- function te(w) {
2264
- o.value = w;
2265
- }
2266
- async function Ce(w, L, M) {
2267
- const Q = w ? re(p.value, w) : null, le = Q ? v.value.find((qt) => qt.slug === Q.node.type) ?? null : null, A = w === null ? l.allow : M?.props?.allow ?? null, h = w === null ? l.max : M?.props?.max ?? null, $ = w === null ? p.value : Q && L ? Q.node.values[L] ?? [] : [];
2268
- if (h != null && $.length >= h) return;
2269
- const He = await ke({
2270
- catalog: v.value,
2271
- parent: le,
2272
- allow: A,
2273
- tree: p.value,
2583
+ ), Se = V(
2584
+ () => o?.state.manifest?.modules.find(($) => $.id === "blocks")?.meta?.groups ?? []
2585
+ ), ne = al()?.type, pe = V(() => n.context?.types ? n.context.types : o?.types ? { ...Ye, ...o.types } : ne ? { ...Ye, "wx-blocks": { component: ne, kind: "field", nested: !0 } } : Ye), ke = V(
2586
+ () => n.context?.translate ?? o?.i18n.t ?? (($) => $)
2587
+ ), Ee = V(() => n.context?.can ?? o?.can ?? (() => !0)), Te = Nt(es);
2588
+ function Q($) {
2589
+ t.value = $;
2590
+ }
2591
+ async function we($, M, O) {
2592
+ const H = $ ? re(d.value, $) : null, ee = H ? c.value.find((tl) => tl.slug === H.node.type) ?? null : null, et = $ === null ? n.allow : O?.props?.allow ?? null, W = $ === null ? n.max : O?.props?.max ?? null, k = $ === null ? d.value : H && M ? H.node.values[M] ?? [] : [];
2593
+ if (W != null && k.length >= W) return;
2594
+ const E = await Te({
2595
+ catalog: c.value,
2596
+ parent: ee,
2597
+ allow: et,
2598
+ tree: d.value,
2274
2599
  groups: Se.value,
2275
- blocksPath: l.blocksPath
2600
+ blocksPath: n.blocksPath
2276
2601
  });
2277
- if (!He) return;
2278
- const rt = Il(He.slug, ye(He));
2279
- te(kt(p.value, w, L, $.length, rt)), g.value = rt.key;
2280
- }
2281
- function ye(w) {
2282
- const L = w.content?.sample ?? {}, M = {};
2283
- for (const [Q, le] of Object.entries(L))
2284
- (!Array.isArray(le) || le.length === 0 || typeof le[0] != "object") && (M[Q] = le);
2285
- return M;
2286
- }
2287
- async function fe(w) {
2288
- const L = re(p.value, w);
2289
- if (!L) return;
2290
- const M = Pl(L.node);
2291
- await Ke({
2292
- title: s("field.remove-title", {
2293
- title: v.value.find((le) => le.slug === L.node.type)?.title ?? L.node.type
2602
+ if (!E) return;
2603
+ const tt = Kl(E.slug, Ce(E));
2604
+ Q(xt(d.value, $, M, k.length, tt)), p.value = tt.key;
2605
+ }
2606
+ function Ce($) {
2607
+ const M = $.content?.sample ?? {}, O = {};
2608
+ for (const [H, ee] of Object.entries(M))
2609
+ (!Array.isArray(ee) || ee.length === 0 || typeof ee[0] != "object") && (O[H] = ee);
2610
+ return O;
2611
+ }
2612
+ async function ye($) {
2613
+ const M = re(d.value, $);
2614
+ if (!M) return;
2615
+ const O = Jl(M.node);
2616
+ await Ge({
2617
+ title: a("field.remove-title", {
2618
+ title: c.value.find((ee) => ee.slug === M.node.type)?.title ?? M.node.type
2294
2619
  }),
2295
- message: M > 0 ? s("field.remove-text", { count: M }) : s("field.remove-alone"),
2296
- confirmText: s("field.remove"),
2297
- cancelText: s("page.cancel"),
2620
+ message: O > 0 ? a("field.remove-text", { count: O }) : a("field.remove-alone"),
2621
+ confirmText: a("field.remove"),
2622
+ cancelText: a("page.cancel"),
2298
2623
  tone: "danger"
2299
- }) && (g.value === w && (g.value = null), te(Dl(p.value, w)));
2624
+ }) && (p.value === $ && (p.value = null), Q(Ql(d.value, $)));
2300
2625
  }
2301
- function z(w) {
2302
- const L = re(p.value, w);
2303
- if (!L) return;
2304
- const M = Ot(L.node);
2305
- te(kt(p.value, L.parent?.key ?? null, L.field, L.index + 1, M)), g.value = M.key;
2626
+ function L($) {
2627
+ const M = re(d.value, $);
2628
+ if (!M) return;
2629
+ const O = qt(M.node);
2630
+ Q(xt(d.value, M.parent?.key ?? null, M.field, M.index + 1, O)), p.value = O.key;
2306
2631
  }
2307
- function O(w, L) {
2308
- te(Ul(p.value, w, L));
2632
+ function U($, M) {
2633
+ Q(Gl(d.value, $, M));
2309
2634
  }
2310
- function H(w, L, M) {
2311
- te(Rl(p.value, w, L, M));
2635
+ function j($, M, O) {
2636
+ Q(en(d.value, $, M, O));
2312
2637
  }
2313
- function Y(w) {
2314
- g.value = g.value === w ? null : w;
2638
+ function G($) {
2639
+ p.value = p.value === $ ? null : $;
2315
2640
  }
2316
- function ve(w) {
2317
- w === null || !re(p.value, w) || (g.value = w, c.value && (B.value = !0));
2641
+ function fe($) {
2642
+ $ === null || !re(d.value, $) || (p.value = $, h.value && (A.value = !0));
2318
2643
  }
2319
- function me() {
2320
- g.value = null;
2644
+ function _e() {
2645
+ p.value = null;
2321
2646
  }
2322
- function ie(w) {
2323
- g.value && te(Ol(p.value, g.value, w));
2647
+ function se($) {
2648
+ p.value && Q(Xl(d.value, p.value, $));
2324
2649
  }
2325
- let we;
2326
- X(
2327
- () => f.value?.node.values,
2328
- (w, L) => {
2329
- if (!w || !L || !k.value || !b || !y) return;
2330
- const M = g.value, Q = k.value.id;
2331
- clearTimeout(we), we = setTimeout(() => {
2332
- !M || !b || b.render(Q, { values: w, key: M }).then((le) => {
2333
- R.value?.replace(M, le.html) || R.value?.refresh();
2650
+ let ve;
2651
+ te(
2652
+ () => v.value?.node.values,
2653
+ ($, M) => {
2654
+ if (!$ || !M || !g.value || !r || !_) return;
2655
+ const O = p.value, H = g.value.id;
2656
+ clearTimeout(ve), ve = setTimeout(() => {
2657
+ !O || !r || r.render(H, { values: $, key: O }).then((ee) => {
2658
+ R.value?.replace(O, ee.html) || R.value?.refresh();
2334
2659
  }).catch(() => {
2335
2660
  });
2336
2661
  }, 300);
2337
2662
  },
2338
2663
  { deep: !0 }
2339
2664
  );
2340
- function Ve(w) {
2341
- w.key === "Escape" && g.value && me();
2665
+ function Ve($) {
2666
+ $.key === "Escape" && p.value && _e();
2342
2667
  }
2343
2668
  Ue(async () => {
2344
- if (window.addEventListener("keydown", Ve), l.catalog === null && n) {
2345
- b = Ae(n);
2669
+ if (window.addEventListener("keydown", Ve), n.catalog === null && o) {
2670
+ r = ze(o);
2346
2671
  try {
2347
- P.value = await b.catalog();
2348
- } catch (w) {
2349
- G.danger(r(w));
2672
+ m.value = await r.catalog();
2673
+ } catch ($) {
2674
+ Z.danger(i($));
2350
2675
  }
2351
- } else n && (b = Ae(n));
2352
- }), Ge(() => {
2353
- clearTimeout(we), window.removeEventListener("keydown", Ve);
2676
+ } else o && (r = ze(o));
2677
+ }), Ze(() => {
2678
+ clearTimeout(ve), window.removeEventListener("keydown", Ve);
2354
2679
  });
2355
- const Ee = T(
2356
- () => k.value?.content ? st(k.value.content.schema) : []
2680
+ const De = V(
2681
+ () => g.value?.content ? dt(g.value.content.schema) : []
2357
2682
  );
2358
- return (w, L) => e(a) ? (i(), S("div", Un, [
2359
- u(e(F), {
2683
+ return ($, M) => l(s) ? (u(), C("div", hs, [
2684
+ f(l(q), {
2360
2685
  size: "sm",
2361
2686
  tone: "muted"
2362
2687
  }, {
2363
- default: d(() => [
2364
- W(_(e(s)("field.nested-note")), 1)
2688
+ default: b(() => [
2689
+ z(S(l(a)("field.nested-note")), 1)
2365
2690
  ]),
2366
2691
  _: 1
2367
2692
  })
2368
- ])) : (i(), S("div", {
2693
+ ])) : (u(), C("div", {
2369
2694
  key: 1,
2370
2695
  ref_key: "host",
2371
- ref: q,
2372
- class: $e(["wx-blocks-host", { "is-compact": c.value }])
2696
+ ref: K,
2697
+ class: $e(["wx-blocks-host", { "is-compact": h.value }])
2373
2698
  }, [
2374
- E("div", {
2699
+ B("div", {
2375
2700
  class: $e(["wx-blocks", {
2376
- "is-editing": f.value !== null,
2377
- "has-preview": e(y) !== null && e(y).url.value !== null
2701
+ "is-editing": v.value !== null,
2702
+ "has-preview": l(_) !== null && l(_).url.value !== null
2378
2703
  }])
2379
2704
  }, [
2380
- (i(), I(Qt(c.value ? e(hl) : "div"), Xt(K.value, { class: "wx-blocks__side" }), {
2381
- default: d(() => [
2382
- f.value ? N("", !0) : (i(), S("div", Mn, [
2383
- E("div", Dn, [
2384
- E("span", On, _(e(s)("field.blocks")), 1),
2385
- u(e(F), {
2705
+ (u(), D(il(h.value ? l(Sl) : "div"), rl(J.value, { class: "wx-blocks__side" }), {
2706
+ default: b(() => [
2707
+ v.value ? I("", !0) : (u(), C("div", bs, [
2708
+ B("div", gs, [
2709
+ B("span", ys, S(l(a)("field.blocks")), 1),
2710
+ f(l(q), {
2386
2711
  size: "sm",
2387
2712
  tone: "muted"
2388
2713
  }, {
2389
- default: d(() => [
2390
- W(_(p.value.length), 1)
2714
+ default: b(() => [
2715
+ z(S(d.value.length), 1)
2391
2716
  ]),
2392
2717
  _: 1
2393
2718
  })
2394
2719
  ]),
2395
- u(Pn, {
2396
- nodes: p.value,
2397
- catalog: v.value,
2398
- selected: g.value,
2399
- disabled: t.disabled,
2400
- onSelect: Y,
2401
- onAdd: Ce,
2402
- onRemove: fe,
2403
- onDuplicate: z,
2404
- onVisibility: O,
2405
- onReorder: H
2720
+ f(ms, {
2721
+ nodes: d.value,
2722
+ catalog: c.value,
2723
+ selected: p.value,
2724
+ disabled: e.disabled,
2725
+ onSelect: G,
2726
+ onAdd: we,
2727
+ onRemove: ye,
2728
+ onDuplicate: L,
2729
+ onVisibility: U,
2730
+ onReorder: j
2406
2731
  }, null, 8, ["nodes", "catalog", "selected", "disabled"]),
2407
- E("div", Rn, [
2408
- !t.disabled && (t.max === null || p.value.length < t.max) ? (i(), I(e(ce), {
2732
+ B("div", ks, [
2733
+ !e.disabled && (e.max === null || d.value.length < e.max) ? (u(), D(l(ce), {
2409
2734
  key: 0,
2410
2735
  variant: "outline",
2411
2736
  icon: "plus",
2412
2737
  class: "wx-blocks__add",
2413
- onClick: L[0] || (L[0] = (M) => Ce(null, null, null))
2738
+ onClick: M[0] || (M[0] = (O) => we(null, null, null))
2414
2739
  }, {
2415
- default: d(() => [
2416
- W(_(e(s)("field.add")), 1)
2740
+ default: b(() => [
2741
+ z(S(l(a)("field.add")), 1)
2417
2742
  ]),
2418
2743
  _: 1
2419
- })) : N("", !0),
2420
- !c.value && e(y) && e(y).url.value ? (i(), I(e(ce), {
2744
+ })) : I("", !0),
2745
+ !h.value && l(_) && l(_).url.value ? (u(), D(l(ce), {
2421
2746
  key: 1,
2422
2747
  variant: "outline",
2423
2748
  icon: "eye",
2424
2749
  class: "wx-blocks__preview-button",
2425
- onClick: L[1] || (L[1] = (M) => R.value?.open())
2750
+ onClick: M[1] || (M[1] = (O) => R.value?.open())
2426
2751
  }, {
2427
- default: d(() => [
2428
- W(_(e(s)("field.preview")), 1)
2752
+ default: b(() => [
2753
+ z(S(l(a)("field.preview")), 1)
2429
2754
  ]),
2430
2755
  _: 1
2431
- })) : N("", !0)
2756
+ })) : I("", !0)
2432
2757
  ])
2433
2758
  ])),
2434
- f.value ? (i(), S("div", Hn, [
2435
- E("div", jn, [
2436
- E("span", Fn, [
2437
- m.value.length ? (i(), S("span", qn, [
2438
- (i(!0), S(j, null, ee(m.value, (M) => (i(), S(j, {
2439
- key: M.key
2759
+ v.value ? (u(), C("div", ws, [
2760
+ B("div", _s, [
2761
+ B("span", xs, [
2762
+ y.value.length ? (u(), C("span", $s, [
2763
+ (u(!0), C(F, null, le(y.value, (O) => (u(), C(F, {
2764
+ key: O.key
2440
2765
  }, [
2441
- E("button", {
2766
+ B("button", {
2442
2767
  type: "button",
2443
2768
  class: "wx-blocks__trail-step",
2444
- onClick: (Q) => Y(M.key)
2445
- }, _(M.title), 9, Jn),
2446
- u(e(be), { name: "chevron-right" })
2769
+ onClick: (H) => G(O.key)
2770
+ }, S(O.title), 9, Ss),
2771
+ f(l(be), { name: "chevron-right" })
2447
2772
  ], 64))), 128))
2448
- ])) : N("", !0),
2449
- E("span", Kn, _(k.value?.title ?? f.value.node.type), 1)
2773
+ ])) : I("", !0),
2774
+ B("span", Es, S(g.value?.title ?? v.value.node.type), 1)
2450
2775
  ]),
2451
- E("span", Gn, [
2452
- c.value ? N("", !0) : (i(), S("code", Yn, _(f.value.node.type), 1)),
2453
- u(e(Ie), {
2776
+ B("span", Ts, [
2777
+ h.value ? I("", !0) : (u(), C("code", Cs, S(v.value.node.type), 1)),
2778
+ f(l(Ie), {
2454
2779
  size: "sm",
2455
2780
  tone: "neutral",
2456
2781
  icon: "chevron-up",
2457
- title: e(s)("field.previous"),
2458
- disabled: x.value.previous === null,
2459
- onClick: L[2] || (L[2] = (M) => x.value.previous && Y(x.value.previous))
2782
+ title: l(a)("field.previous"),
2783
+ disabled: w.value.previous === null,
2784
+ onClick: M[2] || (M[2] = (O) => w.value.previous && G(w.value.previous))
2460
2785
  }, null, 8, ["title", "disabled"]),
2461
- u(e(Ie), {
2786
+ f(l(Ie), {
2462
2787
  size: "sm",
2463
2788
  tone: "neutral",
2464
2789
  icon: "chevron-down",
2465
- title: e(s)("field.next"),
2466
- disabled: x.value.next === null,
2467
- onClick: L[3] || (L[3] = (M) => x.value.next && Y(x.value.next))
2790
+ title: l(a)("field.next"),
2791
+ disabled: w.value.next === null,
2792
+ onClick: M[3] || (M[3] = (O) => w.value.next && G(w.value.next))
2468
2793
  }, null, 8, ["title", "disabled"]),
2469
- !c.value && e(y) && e(y).url.value ? (i(), I(e(ce), {
2794
+ !h.value && l(_) && l(_).url.value ? (u(), D(l(ce), {
2470
2795
  key: 1,
2471
2796
  size: "sm",
2472
2797
  variant: "outline",
2473
2798
  icon: "eye",
2474
2799
  class: "wx-blocks__preview-button",
2475
- "aria-label": e(s)("field.preview"),
2476
- onClick: L[4] || (L[4] = (M) => R.value?.open())
2477
- }, null, 8, ["aria-label"])) : N("", !0),
2478
- u(e(ce), {
2800
+ "aria-label": l(a)("field.preview"),
2801
+ onClick: M[4] || (M[4] = (O) => R.value?.open())
2802
+ }, null, 8, ["aria-label"])) : I("", !0),
2803
+ f(l(ce), {
2479
2804
  size: "sm",
2480
2805
  variant: "outline",
2481
- onClick: me
2806
+ onClick: _e
2482
2807
  }, {
2483
- default: d(() => [
2484
- W(_(c.value ? e(s)("field.done") : `${e(s)("field.done")} · Esc`), 1)
2808
+ default: b(() => [
2809
+ z(S(h.value ? l(a)("field.done") : `${l(a)("field.done")} · Esc`), 1)
2485
2810
  ]),
2486
2811
  _: 1
2487
2812
  })
2488
2813
  ])
2489
2814
  ]),
2490
- E("div", Zn, [
2491
- k.value?.content ? (i(), I(e(zt), {
2492
- key: f.value.node.key,
2493
- "model-value": f.value.node.values,
2494
- root: Ee.value,
2495
- types: se.value,
2496
- translate: _e.value,
2497
- can: Te.value,
2498
- disabled: t.disabled,
2499
- "onUpdate:modelValue": ie
2500
- }, null, 8, ["model-value", "root", "types", "translate", "can", "disabled"])) : (i(), I(e(F), {
2815
+ B("div", Vs, [
2816
+ g.value?.content ? (u(), D(l(Pt), {
2817
+ key: v.value.node.key,
2818
+ "model-value": v.value.node.values,
2819
+ root: De.value,
2820
+ types: pe.value,
2821
+ translate: ke.value,
2822
+ can: Ee.value,
2823
+ disabled: e.disabled,
2824
+ "onUpdate:modelValue": se
2825
+ }, null, 8, ["model-value", "root", "types", "translate", "can", "disabled"])) : (u(), D(l(q), {
2501
2826
  key: 1,
2502
2827
  size: "sm",
2503
2828
  tone: "danger"
2504
2829
  }, {
2505
- default: d(() => [
2506
- W(_(e(s)("field.unknown-type", { type: f.value.node.type })), 1)
2830
+ default: b(() => [
2831
+ z(S(l(a)("field.unknown-type", { type: v.value.node.type })), 1)
2507
2832
  ]),
2508
2833
  _: 1
2509
2834
  }))
2510
2835
  ])
2511
- ])) : N("", !0)
2836
+ ])) : I("", !0)
2512
2837
  ]),
2513
2838
  _: 1
2514
2839
  }, 16)),
2515
- e(y) && e(y).url.value ? (i(), S("div", Qn, [
2516
- u(Tn, {
2840
+ l(_) && l(_).url.value ? (u(), C("div", Bs, [
2841
+ f(ss, {
2517
2842
  ref_key: "previewEl",
2518
2843
  ref: R,
2519
- url: e(y).url.value,
2520
- selected: g.value,
2521
- reload: e(y).reload?.value ?? 0,
2522
- compact: c.value,
2523
- onSelect: ve,
2524
- onEdit: L[5] || (L[5] = (M) => B.value = !0)
2844
+ url: l(_).url.value,
2845
+ selected: p.value,
2846
+ reload: l(_).reload?.value ?? 0,
2847
+ compact: h.value,
2848
+ onSelect: fe,
2849
+ onEdit: M[5] || (M[5] = (O) => A.value = !0)
2525
2850
  }, null, 8, ["url", "selected", "reload", "compact"])
2526
- ])) : N("", !0)
2851
+ ])) : I("", !0)
2527
2852
  ], 2)
2528
2853
  ], 2));
2529
2854
  }
2530
- }), ea = /* @__PURE__ */ oe(Xn, [["__scopeId", "data-v-613ad857"]]), ta = { class: "wx-block-card__body" }, la = { class: "wx-block-card__title" }, na = { class: "wx-block-card__chips" }, aa = /* @__PURE__ */ ae({
2855
+ }), Ws = /* @__PURE__ */ ie(As, [["__scopeId", "data-v-613ad857"]]), Ls = { class: "wx-block-card__body" }, zs = { class: "wx-block-card__title" }, Ms = { class: "wx-block-card__chips" }, Ds = /* @__PURE__ */ ae({
2531
2856
  __name: "BlockCard",
2532
2857
  props: {
2533
2858
  block: {}
2534
2859
  },
2535
2860
  emits: ["open"],
2536
- setup(t, { emit: l }) {
2537
- const o = l, a = de("webx-blocks");
2538
- return (s, r) => (i(), S("button", {
2861
+ setup(e, { emit: n }) {
2862
+ const t = n, s = de("webx-blocks");
2863
+ return (a, i) => (u(), C("button", {
2539
2864
  type: "button",
2540
2865
  class: "wx-block-card",
2541
- onClick: r[0] || (r[0] = (n) => o("open", t.block))
2866
+ onClick: i[0] || (i[0] = (o) => t("open", e.block))
2542
2867
  }, [
2543
- u(Ft, {
2544
- thumbnail: t.block.thumbnail,
2868
+ f(el, {
2869
+ thumbnail: e.block.thumbnail,
2545
2870
  height: 120
2546
2871
  }, null, 8, ["thumbnail"]),
2547
- E("div", ta, [
2548
- E("div", la, _(t.block.title), 1),
2549
- u(e(F), {
2872
+ B("div", Ls, [
2873
+ B("div", zs, S(e.block.title), 1),
2874
+ f(l(q), {
2550
2875
  size: "sm",
2551
2876
  tone: "muted"
2552
2877
  }, {
2553
- default: d(() => [
2554
- E("code", null, _(t.block.slug), 1),
2555
- W(" · " + _(e(nt)(t.block.usage_count, e(a))), 1)
2878
+ default: b(() => [
2879
+ B("code", null, S(e.block.slug), 1),
2880
+ z(" · " + S(l(it)(e.block.usage_count, l(s))), 1)
2556
2881
  ]),
2557
2882
  _: 1
2558
2883
  }),
2559
- E("div", na, [
2560
- t.block.draft ? (i(), I(e(ue), {
2884
+ B("div", Ms, [
2885
+ e.block.draft ? (u(), D(l(ue), {
2561
2886
  key: 0,
2562
2887
  type: "warning",
2563
2888
  dot: ""
2564
2889
  }, {
2565
- default: d(() => [
2566
- W(_(e(a)("page.draft", { number: t.block.draft.number })), 1)
2890
+ default: b(() => [
2891
+ z(S(l(s)("page.draft", { number: e.block.draft.number })), 1)
2567
2892
  ]),
2568
2893
  _: 1
2569
- })) : N("", !0),
2570
- t.block.published ? (i(), I(e(ue), {
2894
+ })) : I("", !0),
2895
+ e.block.published ? (u(), D(l(ue), {
2571
2896
  key: 1,
2572
2897
  type: "success",
2573
2898
  dot: ""
2574
2899
  }, {
2575
- default: d(() => [
2576
- W(_(e(a)("page.live", { number: t.block.published.number })), 1)
2900
+ default: b(() => [
2901
+ z(S(l(s)("page.live", { number: e.block.published.number })), 1)
2577
2902
  ]),
2578
2903
  _: 1
2579
- })) : (i(), I(e(ue), {
2904
+ })) : (u(), D(l(ue), {
2580
2905
  key: 2,
2581
2906
  type: "default"
2582
2907
  }, {
2583
- default: d(() => [
2584
- W(_(e(a)("page.never-published")), 1)
2908
+ default: b(() => [
2909
+ z(S(l(s)("page.never-published")), 1)
2585
2910
  ]),
2586
2911
  _: 1
2587
2912
  })),
2588
- t.block.is_enabled ? N("", !0) : (i(), I(e(ue), {
2913
+ e.block.is_enabled ? I("", !0) : (u(), D(l(ue), {
2589
2914
  key: 3,
2590
2915
  type: "default",
2591
2916
  variant: "outline"
2592
2917
  }, {
2593
- default: d(() => [
2594
- W(_(e(a)("page.hidden")), 1)
2918
+ default: b(() => [
2919
+ z(S(l(s)("page.hidden")), 1)
2595
2920
  ]),
2596
2921
  _: 1
2597
2922
  }))
@@ -2599,62 +2924,62 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
2599
2924
  ])
2600
2925
  ]));
2601
2926
  }
2602
- }), oa = /* @__PURE__ */ oe(aa, [["__scopeId", "data-v-3d94f339"]]), sa = { class: "wx-block-create" }, ia = /* @__PURE__ */ ae({
2927
+ }), Is = /* @__PURE__ */ ie(Ds, [["__scopeId", "data-v-3d94f339"]]), Ns = { class: "wx-block-create" }, Ps = /* @__PURE__ */ ae({
2603
2928
  __name: "BlockCreateDialog",
2604
- setup(t) {
2605
- const { resolve: l, dismiss: o, open: a } = Bt(), s = Me(), r = Ae(s);
2606
- Re();
2607
- const n = de("webx-blocks"), b = De(), P = T(() => s.state.manifest?.modules.find((y) => y.id === "blocks")?.meta?.groups ?? ["content"]), v = U({ title: "", slug: "", group: P.value[0] ?? "content" }), p = U({}), g = U(!1), f = U(!1), k = T(
2608
- () => P.value.map((m) => ({ value: m, label: ze(m, n) }))
2929
+ setup(e) {
2930
+ const { resolve: n, dismiss: t, open: s } = Mt(), a = Oe(), i = ze(a);
2931
+ Fe();
2932
+ const o = de("webx-blocks"), r = Re(), m = V(() => a.state.manifest?.modules.find((_) => _.id === "blocks")?.meta?.groups ?? ["content"]), c = N({ title: "", slug: "", group: m.value[0] ?? "content" }), d = N({}), p = N(!1), v = N(!1), g = V(
2933
+ () => m.value.map((y) => ({ value: y, label: Me(y, o) }))
2609
2934
  );
2610
- function C(m) {
2611
- return m.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/^[^a-z]+/, "").slice(0, 64);
2935
+ function x(y) {
2936
+ return y.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/^[^a-z]+/, "").slice(0, 64);
2612
2937
  }
2613
- X(
2614
- () => v.value.title,
2615
- (m) => {
2616
- f.value || (v.value.slug = C(m));
2938
+ te(
2939
+ () => c.value.title,
2940
+ (y) => {
2941
+ v.value || (c.value.slug = x(y));
2617
2942
  }
2618
2943
  );
2619
- function V(m) {
2620
- return p.value[m]?.[0];
2944
+ function T(y) {
2945
+ return d.value[y]?.[0];
2621
2946
  }
2622
- async function x() {
2623
- g.value = !0, p.value = {};
2947
+ async function w() {
2948
+ p.value = !0, d.value = {};
2624
2949
  try {
2625
- l(await r.create(v.value));
2626
- } catch (m) {
2627
- const y = m.body;
2628
- y?.errors ? p.value = y.errors : G.danger(b(m, n("page.failed")));
2950
+ n(await i.create(c.value));
2951
+ } catch (y) {
2952
+ const _ = y.body;
2953
+ _?.errors ? d.value = _.errors : Z.danger(r(y, o("page.failed")));
2629
2954
  } finally {
2630
- g.value = !1;
2955
+ p.value = !1;
2631
2956
  }
2632
2957
  }
2633
- return (m, y) => (i(), I(e(Lt), {
2634
- open: e(a),
2635
- "onUpdate:open": y[5] || (y[5] = (R) => $t(a) ? a.value = R : null),
2636
- title: e(n)("page.new"),
2958
+ return (y, _) => (u(), D(l(Dt), {
2959
+ open: l(s),
2960
+ "onUpdate:open": _[5] || (_[5] = (R) => Vt(s) ? s.value = R : null),
2961
+ title: l(o)("page.new"),
2637
2962
  width: 520
2638
2963
  }, {
2639
- footer: d(() => [
2640
- u(e(bl), { size: "sm" }, {
2641
- default: d(() => [
2642
- u(e(ce), {
2964
+ footer: b(() => [
2965
+ f(l(El), { size: "sm" }, {
2966
+ default: b(() => [
2967
+ f(l(ce), {
2643
2968
  variant: "outline",
2644
- onClick: y[4] || (y[4] = (R) => e(o)())
2969
+ onClick: _[4] || (_[4] = (R) => l(t)())
2645
2970
  }, {
2646
- default: d(() => [
2647
- W(_(e(n)("page.cancel")), 1)
2971
+ default: b(() => [
2972
+ z(S(l(o)("page.cancel")), 1)
2648
2973
  ]),
2649
2974
  _: 1
2650
2975
  }),
2651
- u(e(ce), {
2976
+ f(l(ce), {
2652
2977
  type: "primary",
2653
- loading: g.value,
2654
- onClick: x
2978
+ loading: p.value,
2979
+ onClick: w
2655
2980
  }, {
2656
- default: d(() => [
2657
- W(_(e(n)("page.create")), 1)
2981
+ default: b(() => [
2982
+ z(S(l(o)("page.create")), 1)
2658
2983
  ]),
2659
2984
  _: 1
2660
2985
  }, 8, ["loading"])
@@ -2662,46 +2987,46 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
2662
2987
  _: 1
2663
2988
  })
2664
2989
  ]),
2665
- default: d(() => [
2666
- E("div", sa, [
2667
- u(e(ne), {
2668
- label: e(n)("page.title"),
2669
- error: V("title")
2990
+ default: b(() => [
2991
+ B("div", Ns, [
2992
+ f(l(oe), {
2993
+ label: l(o)("page.title"),
2994
+ error: T("title")
2670
2995
  }, {
2671
- default: d(() => [
2672
- u(e(Pe), {
2673
- modelValue: v.value.title,
2674
- "onUpdate:modelValue": y[0] || (y[0] = (R) => v.value.title = R),
2996
+ default: b(() => [
2997
+ f(l(Pe), {
2998
+ modelValue: c.value.title,
2999
+ "onUpdate:modelValue": _[0] || (_[0] = (R) => c.value.title = R),
2675
3000
  autofocus: ""
2676
3001
  }, null, 8, ["modelValue"])
2677
3002
  ]),
2678
3003
  _: 1
2679
3004
  }, 8, ["label", "error"]),
2680
- u(e(ne), {
2681
- label: e(n)("page.identifier"),
2682
- help: e(n)("page.identifier-help"),
2683
- error: V("slug")
3005
+ f(l(oe), {
3006
+ label: l(o)("page.identifier"),
3007
+ help: l(o)("page.identifier-help"),
3008
+ error: T("slug")
2684
3009
  }, {
2685
- default: d(() => [
2686
- u(e(Pe), {
2687
- modelValue: v.value.slug,
2688
- "onUpdate:modelValue": y[1] || (y[1] = (R) => v.value.slug = R),
3010
+ default: b(() => [
3011
+ f(l(Pe), {
3012
+ modelValue: c.value.slug,
3013
+ "onUpdate:modelValue": _[1] || (_[1] = (R) => c.value.slug = R),
2689
3014
  placeholder: "hero",
2690
- onInput: y[2] || (y[2] = (R) => f.value = !0)
3015
+ onInput: _[2] || (_[2] = (R) => v.value = !0)
2691
3016
  }, null, 8, ["modelValue"])
2692
3017
  ]),
2693
3018
  _: 1
2694
3019
  }, 8, ["label", "help", "error"]),
2695
- u(e(ne), {
2696
- label: e(n)("page.group"),
2697
- help: e(n)("page.group-help"),
2698
- error: V("group")
3020
+ f(l(oe), {
3021
+ label: l(o)("page.group"),
3022
+ help: l(o)("page.group-help"),
3023
+ error: T("group")
2699
3024
  }, {
2700
- default: d(() => [
2701
- u(e(Et), {
2702
- modelValue: v.value.group,
2703
- "onUpdate:modelValue": y[3] || (y[3] = (R) => v.value.group = R),
2704
- options: k.value
3025
+ default: b(() => [
3026
+ f(l(zt), {
3027
+ modelValue: c.value.group,
3028
+ "onUpdate:modelValue": _[3] || (_[3] = (R) => c.value.group = R),
3029
+ options: g.value
2705
3030
  }, null, 8, ["modelValue", "options"])
2706
3031
  ]),
2707
3032
  _: 1
@@ -2711,121 +3036,121 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
2711
3036
  _: 1
2712
3037
  }, 8, ["open", "title"]));
2713
3038
  }
2714
- }), ra = /* @__PURE__ */ oe(ia, [["__scopeId", "data-v-a4c0d44c"]]), ua = {
3039
+ }), Us = /* @__PURE__ */ ie(Ps, [["__scopeId", "data-v-a4c0d44c"]]), Os = {
2715
3040
  key: 1,
2716
3041
  class: "wx-blocks-page__toolbar"
2717
- }, ca = { class: "wx-blocks-page__cards" }, da = { class: "wx-blocks-page__ghost-body" }, pa = {
3042
+ }, Rs = { class: "wx-blocks-page__cards" }, js = { class: "wx-blocks-page__ghost-body" }, Fs = {
2718
3043
  key: 0,
2719
3044
  class: "wx-blocks-page__group-title"
2720
- }, va = { class: "wx-blocks-page__cards" }, fa = /* @__PURE__ */ ae({
3045
+ }, Hs = { class: "wx-blocks-page__cards" }, qs = /* @__PURE__ */ ae({
2721
3046
  __name: "BlocksPage",
2722
3047
  props: {
2723
3048
  base: { default: "/blocks" }
2724
3049
  },
2725
- setup(t) {
2726
- const l = t, o = Me(), a = Ae(o), s = Tt();
2727
- Re();
2728
- const r = de("webx-blocks"), n = De(), b = U([]), P = U(!0), v = U(""), p = U(""), g = At(ra), f = T(() => {
2729
- const c = o.state.manifest?.modules.find((B) => B.id === "blocks")?.meta;
3050
+ setup(e) {
3051
+ const n = e, t = Oe(), s = ze(t), a = At();
3052
+ Fe();
3053
+ const i = de("webx-blocks"), o = Re(), r = N([]), m = N(!0), c = N(""), d = N(""), p = Nt(Us), v = V(() => {
3054
+ const h = t.state.manifest?.modules.find((A) => A.id === "blocks")?.meta;
2730
3055
  return {
2731
- groups: c?.groups ?? [],
2732
- editing: c?.editing ?? !0,
2733
- provides: c?.provides ?? []
3056
+ groups: h?.groups ?? [],
3057
+ editing: h?.editing ?? !0,
3058
+ provides: h?.provides ?? []
2734
3059
  };
2735
- }), k = T(() => o.can("blocks.manage") && f.value.editing), C = T(
2736
- () => o.state.manifest?.modules.find((c) => c.id === "blocks")?.title ?? r("module.title")
2737
- ), V = T(() => {
2738
- const c = v.value.trim().toLowerCase(), B = p.value === "" ? b.value : b.value.filter((D) => D.group === p.value);
2739
- return c === "" ? B : B.filter(
2740
- (D) => D.title.toLowerCase().includes(c) || D.slug.includes(c) || (D.description ?? "").toLowerCase().includes(c)
3060
+ }), g = V(() => t.can("blocks.manage") && v.value.editing), x = V(
3061
+ () => t.state.manifest?.modules.find((h) => h.id === "blocks")?.title ?? i("module.title")
3062
+ ), T = V(() => {
3063
+ const h = c.value.trim().toLowerCase(), A = d.value === "" ? r.value : r.value.filter((P) => P.group === d.value);
3064
+ return h === "" ? A : A.filter(
3065
+ (P) => P.title.toLowerCase().includes(h) || P.slug.includes(h) || (P.description ?? "").toLowerCase().includes(h)
2741
3066
  );
2742
- }), x = T(() => {
2743
- const c = [...f.value.groups];
2744
- for (const B of b.value)
2745
- c.includes(B.group) || c.push(B.group);
2746
- return c.filter((B) => b.value.some((D) => D.group === B));
2747
- }), m = T(
2748
- () => x.value.length < 2 ? [] : [
2749
- { value: "", label: r("page.all-groups") },
2750
- ...x.value.map((c) => ({ value: c, label: ze(c, r) }))
3067
+ }), w = V(() => {
3068
+ const h = [...v.value.groups];
3069
+ for (const A of r.value)
3070
+ h.includes(A.group) || h.push(A.group);
3071
+ return h.filter((A) => r.value.some((P) => P.group === A));
3072
+ }), y = V(
3073
+ () => w.value.length < 2 ? [] : [
3074
+ { value: "", label: i("page.all-groups") },
3075
+ ...w.value.map((h) => ({ value: h, label: Me(h, i) }))
2751
3076
  ]
2752
- ), y = T(() => {
2753
- const c = x.value.map((D) => ({
2754
- id: D,
2755
- label: ze(D, r),
2756
- blocks: V.value.filter((K) => K.group === D)
2757
- })).filter((D) => D.blocks.length > 0);
2758
- return p.value !== "" || V.value.length <= 5 || v.value.trim() !== "" || c.length < 2 ? [{ id: "", label: "", blocks: V.value }] : c;
3077
+ ), _ = V(() => {
3078
+ const h = w.value.map((P) => ({
3079
+ id: P,
3080
+ label: Me(P, i),
3081
+ blocks: T.value.filter((J) => J.group === P)
3082
+ })).filter((P) => P.blocks.length > 0);
3083
+ return d.value !== "" || T.value.length <= 5 || c.value.trim() !== "" || h.length < 2 ? [{ id: "", label: "", blocks: T.value }] : h;
2759
3084
  });
2760
3085
  async function R() {
2761
- P.value = !0;
3086
+ m.value = !0;
2762
3087
  try {
2763
- b.value = await a.list();
2764
- } catch (c) {
2765
- G.danger(n(c));
3088
+ r.value = await s.list();
3089
+ } catch (h) {
3090
+ Z.danger(o(h));
2766
3091
  } finally {
2767
- P.value = !1;
3092
+ m.value = !1;
2768
3093
  }
2769
3094
  }
2770
- function q(c) {
2771
- s.push(`${l.base}/${c.id}`);
3095
+ function K(h) {
3096
+ a.push(`${n.base}/${h.id}`);
2772
3097
  }
2773
- async function J() {
2774
- const c = await g({});
2775
- c && q(c);
3098
+ async function Y() {
3099
+ const h = await p({});
3100
+ h && K(h);
2776
3101
  }
2777
3102
  Ue(R);
2778
- const Z = T(
2779
- () => k.value ? [{ key: "new", label: r("page.new"), icon: "plus", primary: !0, run: () => {
2780
- J();
3103
+ const X = V(
3104
+ () => g.value ? [{ key: "new", label: i("page.new"), icon: "plus", primary: !0, run: () => {
3105
+ Y();
2781
3106
  } }] : []
2782
3107
  );
2783
- return (c, B) => (i(), I(e(rl), {
2784
- view: p.value,
2785
- "onUpdate:view": B[1] || (B[1] = (D) => p.value = D),
3108
+ return (h, A) => (u(), D(l(bl), {
3109
+ view: d.value,
3110
+ "onUpdate:view": A[1] || (A[1] = (P) => d.value = P),
2786
3111
  class: "wx-blocks-page",
2787
- title: C.value,
2788
- views: m.value,
2789
- actions: Z.value
3112
+ title: x.value,
3113
+ views: y.value,
3114
+ actions: X.value
2790
3115
  }, {
2791
- default: d(() => [
2792
- f.value.editing ? N("", !0) : (i(), I(e(Vt), {
3116
+ default: b(() => [
3117
+ v.value.editing ? I("", !0) : (u(), D(l(Lt), {
2793
3118
  key: 0,
2794
3119
  type: "info",
2795
3120
  variant: "soft",
2796
- description: e(r)("page.editing-off")
3121
+ description: l(i)("page.editing-off")
2797
3122
  }, null, 8, ["description"])),
2798
- P.value || b.value.length > 0 ? (i(), S("div", ua, [
2799
- u(e(Pe), {
2800
- modelValue: v.value,
2801
- "onUpdate:modelValue": B[0] || (B[0] = (D) => v.value = D),
3123
+ m.value || r.value.length > 0 ? (u(), C("div", Os, [
3124
+ f(l(Pe), {
3125
+ modelValue: c.value,
3126
+ "onUpdate:modelValue": A[0] || (A[0] = (P) => c.value = P),
2802
3127
  class: "wx-blocks-page__search",
2803
- placeholder: e(r)("page.search"),
3128
+ placeholder: l(i)("page.search"),
2804
3129
  clearable: ""
2805
3130
  }, null, 8, ["modelValue", "placeholder"])
2806
- ])) : N("", !0),
2807
- P.value ? (i(), I(e(We), { key: 2 }, {
2808
- template: d(() => [
2809
- E("div", ca, [
2810
- (i(), S(j, null, ee(4, (D) => E("div", {
2811
- key: D,
3131
+ ])) : I("", !0),
3132
+ m.value ? (u(), D(l(We), { key: 2 }, {
3133
+ template: b(() => [
3134
+ B("div", Rs, [
3135
+ (u(), C(F, null, le(4, (P) => B("div", {
3136
+ key: P,
2812
3137
  class: "wx-blocks-page__ghost"
2813
3138
  }, [
2814
- u(e(Fe), {
3139
+ f(l(qe), {
2815
3140
  variant: "image",
2816
3141
  height: 120,
2817
3142
  class: "wx-blocks-page__ghost-thumb"
2818
3143
  }),
2819
- E("div", da, [
2820
- u(e(Fe), {
3144
+ B("div", js, [
3145
+ f(l(qe), {
2821
3146
  variant: "title",
2822
3147
  width: "45%"
2823
3148
  }),
2824
- u(e(Fe), {
3149
+ f(l(qe), {
2825
3150
  variant: "text",
2826
3151
  width: "70%"
2827
3152
  }),
2828
- u(e(Fe), {
3153
+ f(l(qe), {
2829
3154
  variant: "button",
2830
3155
  width: "64px",
2831
3156
  height: "22px"
@@ -2835,21 +3160,21 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
2835
3160
  ])
2836
3161
  ]),
2837
3162
  _: 1
2838
- })) : b.value.length === 0 ? (i(), I(e(Wt), {
3163
+ })) : r.value.length === 0 ? (u(), D(l(It), {
2839
3164
  key: 3,
2840
3165
  icon: "grid",
2841
- title: e(r)("page.empty"),
2842
- description: e(r)("page.empty-help")
2843
- }, null, 8, ["title", "description"])) : (i(!0), S(j, { key: 4 }, ee(y.value, (D) => (i(), S("section", {
2844
- key: D.id,
3166
+ title: l(i)("page.empty"),
3167
+ description: l(i)("page.empty-help")
3168
+ }, null, 8, ["title", "description"])) : (u(!0), C(F, { key: 4 }, le(_.value, (P) => (u(), C("section", {
3169
+ key: P.id,
2845
3170
  class: "wx-blocks-page__group"
2846
3171
  }, [
2847
- D.label ? (i(), S("div", pa, _(D.label), 1)) : N("", !0),
2848
- E("div", va, [
2849
- (i(!0), S(j, null, ee(D.blocks, (K) => (i(), I(oa, {
2850
- key: K.id,
2851
- block: K,
2852
- onOpen: q
3172
+ P.label ? (u(), C("div", Fs, S(P.label), 1)) : I("", !0),
3173
+ B("div", Hs, [
3174
+ (u(!0), C(F, null, le(P.blocks, (J) => (u(), D(Is, {
3175
+ key: J.id,
3176
+ block: J,
3177
+ onOpen: K
2853
3178
  }, null, 8, ["block"]))), 128))
2854
3179
  ])
2855
3180
  ]))), 128))
@@ -2857,19 +3182,19 @@ const _t = /* @__PURE__ */ Symbol("wx-blocks-root"), Un = {
2857
3182
  _: 1
2858
3183
  }, 8, ["view", "title", "views", "actions"]));
2859
3184
  }
2860
- }), ma = /* @__PURE__ */ oe(fa, [["__scopeId", "data-v-553b680f"]]);
2861
- function $a(t = {}) {
2862
- const l = t.path ?? "/blocks";
3185
+ }), Ks = /* @__PURE__ */ ie(qs, [["__scopeId", "data-v-553b680f"]]);
3186
+ function so(e = {}) {
3187
+ const n = e.path ?? "/blocks";
2863
3188
  return {
2864
3189
  id: "blocks",
2865
- path: l,
3190
+ path: n,
2866
3191
  routes: [
2867
- { path: l, name: "webx.blocks", component: ma, props: { base: l } },
3192
+ { path: n, name: "webx.blocks", component: Ks, props: { base: n } },
2868
3193
  {
2869
- path: `${l}/:id(\\d+)`,
3194
+ path: `${n}/:id(\\d+)`,
2870
3195
  name: "webx.blocks.edit",
2871
- component: dn,
2872
- props: { base: l }
3196
+ component: jn,
3197
+ props: { base: n }
2873
3198
  }
2874
3199
  ],
2875
3200
  // What a screen means by `wx-blocks`: the content of an entity as a tree of blocks. A
@@ -2877,47 +3202,47 @@ function $a(t = {}) {
2877
3202
  // draws its children through the renderer; it needs the node for `props.allow` alone.
2878
3203
  types: {
2879
3204
  "wx-blocks": {
2880
- component: ea,
3205
+ component: Ws,
2881
3206
  kind: "field",
2882
3207
  nested: !0,
2883
3208
  wide: !0,
2884
- bind: () => ({ blocksPath: l })
3209
+ bind: () => ({ blocksPath: n })
2885
3210
  }
2886
3211
  }
2887
3212
  };
2888
3213
  }
2889
3214
  export {
2890
- dn as WxBlockEditorPage,
2891
- _n as WxBlockPicker,
2892
- zl as WxBlockStage,
2893
- Ft as WxBlockThumb,
2894
- ea as WxBlocks,
2895
- ma as WxBlocksPage,
2896
- $a as blocks,
2897
- Hl as blocksMessages,
2898
- it as blocksPreviewKey,
2899
- Ot as cloneNode,
2900
- Nl as countType,
2901
- Ae as createBlocksApi,
2902
- It as findRange,
2903
- st as formSchema,
2904
- et as highlightBlock,
2905
- kt as insertNode,
2906
- Ut as isNode,
2907
- Ze as isNodeList,
2908
- Fl as lintBlock,
3215
+ jn as WxBlockEditorPage,
3216
+ es as WxBlockPicker,
3217
+ ql as WxBlockStage,
3218
+ el as WxBlockThumb,
3219
+ Ws as WxBlocks,
3220
+ Ks as WxBlocksPage,
3221
+ so as blocks,
3222
+ tn as blocksMessages,
3223
+ pt as blocksPreviewKey,
3224
+ qt as cloneNode,
3225
+ Yl as countType,
3226
+ ze as createBlocksApi,
3227
+ Ut as findRange,
3228
+ dt as formSchema,
3229
+ nt as highlightBlock,
3230
+ xt as insertNode,
3231
+ jt as isNode,
3232
+ Xe as isNodeList,
3233
+ $n as lintBlock,
2909
3234
  re as locate,
2910
- Il as makeNode,
2911
- lt as newKey,
2912
- _a as provideBlocksPreview,
2913
- Dl as removeNode,
2914
- Nt as replaceBlock,
2915
- Rl as replaceList,
2916
- Pt as stageDocument,
2917
- wa as typesIn,
2918
- ql as undeclared,
2919
- Ol as updateValues,
2920
- xa as useBlocksPreview,
2921
- Oe as walk
3235
+ Kl as makeNode,
3236
+ at as newKey,
3237
+ lo as provideBlocksPreview,
3238
+ Ql as removeNode,
3239
+ Ot as replaceBlock,
3240
+ en as replaceList,
3241
+ Rt as stageDocument,
3242
+ to as typesIn,
3243
+ Sn as undeclared,
3244
+ Xl as updateValues,
3245
+ no as useBlocksPreview,
3246
+ je as walk
2922
3247
  };
2923
3248
  //# sourceMappingURL=index.js.map