@webx-ui/module-blocks 0.2.0 → 0.4.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,29 @@
1
- import { defineComponent as K, computed as C, openBlock as r, createElementBlock as V, createVNode as u, unref as e, createElementVNode as x, createTextVNode as $, toDisplayString as f, Fragment as j, createCommentVNode as E, renderList as Y, ref as U, onMounted as ye, watch as le, createBlock as W, withCtx as c, normalizeStyle as fe, reactive as Le, onBeforeUnmount as Re, resolveComponent as je, withDirectives as Wt, vModelText as At, isRef as it, normalizeClass as me, withKeys as Ge, withModifiers as Me, provide as rt, inject as ze, useModel as zt, getCurrentInstance as Et, mergeModels as Ut } from "vue";
2
- import { useRoute as It, useRouter as ut } from "vue-router";
3
- import { useTranslate as Q, useAdmin as we, adminKey as Nt } from "@webx-ui/module-admin";
4
- import { WxIcon as ne, WxSkeleton as pe, WxText as R, WxBadge as G, WxButton as q, confirm as Oe, toast as F, useElementWidth as He, WxSegmented as ct, WxCard as ce, WxAlert as dt, WxTabs as Lt, WxTab as de, WxCodeEditor as We, WxFormItem as J, WxInput as ve, WxSelect as pt, WxTextarea as Mt, WxInputNumber as Ye, WxTagsInput as Qe, WxSwitch as Pt, useModal as ft, WxDialog as mt, WxEmpty as vt, WxSortableList as Dt, WxAction as Xe, createModal as ht, WxSpace as Ot, WxHeading as Rt, WxSkeletonItem as Ae } from "@webx-ui/core";
5
- import { WxScreenRenderer as bt, coreTypes as Pe } from "@webx-ui/schema";
6
- function he(t) {
7
- const l = `${t.apiPath}/blocks`, a = (s) => s.data;
1
+ import { defineComponent as Q, computed as B, openBlock as i, createElementBlock as V, createVNode as u, unref as e, createElementVNode as $, createTextVNode as w, toDisplayString as p, Fragment as H, createCommentVNode as L, renderList as te, ref as U, onMounted as Ce, watch as ie, createBlock as W, withCtx as c, normalizeStyle as ce, reactive as je, onBeforeUnmount as Ze, resolveComponent as vt, isRef as mt, normalizeClass as be, withKeys as lt, withModifiers as He, provide as ht, inject as Ne, useModel as Ut, getCurrentInstance as Nt, mergeModels as Pt, createSlots as Mt } from "vue";
2
+ import { useRoute as Ot, useRouter as bt } from "vue-router";
3
+ import { useTranslate as le, useAdmin as Te, useErrorText as Be, WxDate as Dt, WxBackButton as Rt, WxRenameButton as jt, WxHelpButton as Ht, adminKey as Ft, WxListScreen as qt } from "@webx-ui/module-admin";
4
+ import { WxIcon as oe, WxSkeleton as he, WxText as j, WxBadge as J, WxButton as q, confirm as Me, toast as F, useElementWidth as Ge, WxSegmented as gt, WxCard as ve, WxAlert as kt, WxTabs as Jt, WxTab as me, WxCodeEditor as Ie, WxFormItem as Y, WxInput as ge, WxSelect as yt, WxTextarea as Kt, WxInputNumber as nt, WxTagsInput as at, WxSwitch as Zt, WxActionBar as Gt, useModal as wt, WxDialog as _t, WxEmpty as xt, WxSortableList as Yt, WxAction as Fe, createModal as $t, WxSpace as Qt, WxSkeletonItem as Ue } from "@webx-ui/core";
5
+ import { WxScreenRenderer as Vt, coreTypes as qe } from "@webx-ui/schema";
6
+ function ke(t) {
7
+ const l = `${t.apiPath}/blocks`, s = (n) => n.data;
8
8
  return {
9
- list: () => t.http.get(l).then(a),
10
- catalog: () => t.http.get(`${l}/catalog`).then(a),
11
- get: (s) => t.http.get(`${l}/${s}`).then(a),
12
- create: (s) => t.http.post(l, s).then(a),
13
- update: (s, o) => t.http.put(`${l}/${s}`, o).then(a),
14
- remove: (s) => t.http.delete(`${l}/${s}`),
15
- publish: (s) => t.http.post(`${l}/${s}/publish`, {}).then(a),
16
- render: (s, o = {}) => t.http.post(`${l}/${s}/render`, o).then(a),
17
- usage: (s) => t.http.get(`${l}/${s}/usage`).then(a),
18
- versions: (s) => t.http.get(`${l}/${s}/versions`).then(a),
19
- version: (s, o) => t.http.get(`${l}/${s}/versions/${o}`).then(a),
20
- restore: (s, o) => t.http.post(`${l}/${s}/versions/${o}/restore`, {}).then(a)
9
+ list: () => t.http.get(l).then(s),
10
+ catalog: () => t.http.get(`${l}/catalog`).then(s),
11
+ get: (n) => t.http.get(`${l}/${n}`).then(s),
12
+ create: (n) => t.http.post(l, n).then(s),
13
+ update: (n, o) => t.http.put(`${l}/${n}`, o).then(s),
14
+ remove: (n) => t.http.delete(`${l}/${n}`),
15
+ publish: (n) => t.http.post(`${l}/${n}/publish`, {}).then(s),
16
+ render: (n, o = {}) => t.http.post(`${l}/${n}/render`, o).then(s),
17
+ usage: (n) => t.http.get(`${l}/${n}/usage`).then(s),
18
+ versions: (n) => t.http.get(`${l}/${n}/versions`).then(s),
19
+ version: (n, o) => t.http.get(`${l}/${n}/versions/${o}`).then(s),
20
+ restore: (n, o) => t.http.post(`${l}/${n}/versions/${o}/restore`, {}).then(s)
21
21
  };
22
22
  }
23
- const jt = { class: "wx-block-checks" }, Ht = {
23
+ const Xt = { class: "wx-block-checks" }, el = {
24
24
  key: 0,
25
25
  class: "wx-block-checks__line is-error"
26
- }, Ft = /* @__PURE__ */ K({
26
+ }, tl = /* @__PURE__ */ Q({
27
27
  __name: "BlockChecks",
28
28
  props: {
29
29
  file: {},
@@ -32,50 +32,50 @@ const jt = { class: "wx-block-checks" }, Ht = {
32
32
  error: {}
33
33
  },
34
34
  setup(t) {
35
- const l = t, a = Q("webx-blocks"), s = C(() => l.lints.filter((i) => i.file === l.file)), o = C(() => {
36
- const i = new Set(s.value.map((h) => h.code)), n = [];
37
- return l.file === "template" && (i.has("no-marker") || n.push(a("checks.ok-marker")), i.has("variables-missing") || n.push(a("checks.ok-variables"))), l.file === "styles" && (i.has("stray-selectors") || n.push(a("checks.ok-prefix", { slug: l.slug })), i.has("bare-selectors") || n.push(a("checks.ok-bare")), i.has("media-query") || n.push(a("checks.ok-container"))), n;
35
+ const l = t, s = le("webx-blocks"), n = B(() => l.lints.filter((r) => r.file === l.file)), o = B(() => {
36
+ const r = new Set(n.value.map((v) => v.code)), a = [];
37
+ return l.file === "template" && (r.has("no-marker") || a.push(s("checks.ok-marker")), r.has("variables-missing") || a.push(s("checks.ok-variables"))), l.file === "styles" && (r.has("stray-selectors") || a.push(s("checks.ok-prefix", { slug: l.slug })), r.has("bare-selectors") || a.push(s("checks.ok-bare")), r.has("media-query") || a.push(s("checks.ok-container"))), a;
38
38
  });
39
- return (i, n) => (r(), V("div", jt, [
40
- t.error ? (r(), V("div", Ht, [
41
- u(e(ne), { name: "close-circle" }),
42
- x("span", null, [
43
- $(f(t.error.message) + " ", 1),
44
- t.error.line !== null ? (r(), V(j, { key: 0 }, [
45
- $(" · " + f(e(a)("page.line", { line: t.error.line })), 1)
46
- ], 64)) : E("", !0),
47
- t.error.where ? (r(), V(j, { key: 1 }, [
48
- $(" · " + f(t.error.where), 1)
49
- ], 64)) : E("", !0)
39
+ return (r, a) => (i(), V("div", Xt, [
40
+ t.error ? (i(), V("div", el, [
41
+ u(e(oe), { name: "close-circle" }),
42
+ $("span", null, [
43
+ w(p(t.error.message) + " ", 1),
44
+ t.error.line !== null ? (i(), V(H, { key: 0 }, [
45
+ w(" · " + p(e(s)("page.line", { line: t.error.line })), 1)
46
+ ], 64)) : L("", !0),
47
+ t.error.where ? (i(), V(H, { key: 1 }, [
48
+ w(" · " + p(t.error.where), 1)
49
+ ], 64)) : L("", !0)
50
50
  ])
51
- ])) : E("", !0),
52
- (r(!0), V(j, null, Y(s.value, (h) => (r(), V("div", {
53
- key: h.code,
51
+ ])) : L("", !0),
52
+ (i(!0), V(H, null, te(n.value, (v) => (i(), V("div", {
53
+ key: v.code,
54
54
  class: "wx-block-checks__line is-warning"
55
55
  }, [
56
- u(e(ne), { name: "warning" }),
57
- x("span", null, [
58
- $(f(h.message) + " ", 1),
59
- h.line !== null ? (r(), V(j, { key: 0 }, [
60
- $(" · " + f(e(a)("page.line", { line: h.line })), 1)
61
- ], 64)) : E("", !0)
56
+ u(e(oe), { name: "warning" }),
57
+ $("span", null, [
58
+ w(p(v.message) + " ", 1),
59
+ v.line !== null ? (i(), V(H, { key: 0 }, [
60
+ w(" · " + p(e(s)("page.line", { line: v.line })), 1)
61
+ ], 64)) : L("", !0)
62
62
  ])
63
63
  ]))), 128)),
64
- (r(!0), V(j, null, Y(o.value, (h) => (r(), V("div", {
65
- key: h,
64
+ (i(!0), V(H, null, te(o.value, (v) => (i(), V("div", {
65
+ key: v,
66
66
  class: "wx-block-checks__line is-ok"
67
67
  }, [
68
- u(e(ne), { name: "check" }),
69
- x("span", null, f(h), 1)
68
+ u(e(oe), { name: "check" }),
69
+ $("span", null, p(v), 1)
70
70
  ]))), 128))
71
71
  ]));
72
72
  }
73
- }), Z = (t, l) => {
74
- const a = t.__vccOpts || t;
75
- for (const [s, o] of l)
76
- a[s] = o;
77
- return a;
78
- }, et = /* @__PURE__ */ Z(Ft, [["__scopeId", "data-v-a96ffa19"]]), qt = { class: "wx-block-history" }, Jt = { class: "wx-block-history__number" }, Kt = { class: "wx-block-history__who" }, Zt = /* @__PURE__ */ K({
73
+ }), X = (t, l) => {
74
+ const s = t.__vccOpts || t;
75
+ for (const [n, o] of l)
76
+ s[n] = o;
77
+ return s;
78
+ }, st = /* @__PURE__ */ X(tl, [["__scopeId", "data-v-e56947a8"]]), ll = { class: "wx-block-history" }, nl = { class: "wx-block-history__number" }, al = { class: "wx-block-history__who" }, sl = /* @__PURE__ */ Q({
79
79
  __name: "BlockHistory",
80
80
  props: {
81
81
  block: {},
@@ -83,164 +83,212 @@ const jt = { class: "wx-block-checks" }, Ht = {
83
83
  },
84
84
  emits: ["restored"],
85
85
  setup(t, { emit: l }) {
86
- const a = t, s = l, o = we(), i = he(o), n = Q("webx-blocks"), h = U(null);
87
- async function p() {
88
- h.value = await i.versions(a.block.id);
89
- }
90
- function S(b) {
91
- return a.block.draft?.number === b.number ? "draft" : a.block.published?.number === b.number ? "live" : "replaced";
86
+ const s = t, n = l, o = Te(), r = ke(o), a = le("webx-blocks"), v = Be(), A = U(null);
87
+ async function d() {
88
+ A.value = await r.versions(s.block.id);
92
89
  }
93
- function _(b) {
94
- return b.created_at ? new Date(b.created_at).toLocaleString(o.i18n.state.locale) : "";
90
+ function b(h) {
91
+ return s.block.draft?.number === h.number ? "draft" : s.block.published?.number === h.number ? "live" : "replaced";
95
92
  }
96
- async function k(b) {
97
- if (await Oe({
98
- title: n("page.restore-title", { number: b.number }),
99
- message: n("page.restore-text"),
100
- confirmText: n("page.restore"),
101
- cancelText: n("page.cancel")
93
+ async function m(h) {
94
+ if (await Me({
95
+ title: a("page.restore-title", { number: h.number }),
96
+ message: a("page.restore-text"),
97
+ confirmText: a("page.restore"),
98
+ cancelText: a("page.cancel")
102
99
  }))
103
100
  try {
104
- const y = await i.restore(a.block.id, b.number);
105
- F.success(n("page.restored", { number: y.draft?.number ?? b.number })), s("restored", y), await p();
101
+ const y = await r.restore(s.block.id, h.number);
102
+ F.success(a("page.restored", { number: y.draft?.number ?? h.number })), n("restored", y), await d();
106
103
  } catch (y) {
107
- F.danger(y.body?.message ?? String(y));
104
+ F.danger(v(y));
108
105
  }
109
106
  }
110
- return ye(p), le(
111
- () => [a.block.draft?.number, a.block.published?.number],
107
+ return Ce(d), ie(
108
+ () => [s.block.draft?.number, s.block.published?.number],
112
109
  () => {
113
- p();
110
+ d();
114
111
  }
115
- ), (b, m) => (r(), V("div", qt, [
116
- h.value === null ? (r(), W(e(pe), {
112
+ ), (h, f) => (i(), V("div", ll, [
113
+ A.value === null ? (i(), W(e(he), {
117
114
  key: 0,
115
+ class: "wx-block-history__ghost",
118
116
  rows: 3
119
- })) : (r(!0), V(j, { key: 1 }, Y(h.value, (y) => (r(), V("div", {
117
+ })) : (i(!0), V(H, { key: 1 }, te(A.value, (y) => (i(), V("div", {
120
118
  key: y.number,
121
119
  class: "wx-block-history__row"
122
120
  }, [
123
- x("code", Jt, f(e(n)("page.version", { number: y.number })), 1),
124
- x("div", Kt, [
125
- u(e(R), null, {
121
+ $("code", nl, p(e(a)("page.version", { number: y.number })), 1),
122
+ $("div", al, [
123
+ u(e(j), null, {
126
124
  default: c(() => [
127
- $(f(e(n)(`page.version-${S(y)}`)), 1)
125
+ w(p(e(a)(`page.version-${b(y)}`)), 1)
128
126
  ]),
129
127
  _: 2
130
128
  }, 1024),
131
- u(e(R), {
129
+ u(e(j), {
132
130
  size: "sm",
133
131
  tone: "muted"
134
132
  }, {
135
133
  default: c(() => [
136
- $(f(_(y)) + " · " + f(y.author ?? e(n)(`page.source-${y.source}`)) + " ", 1),
137
- y.comment ? (r(), V(j, { key: 0 }, [
138
- $(" · " + f(y.comment), 1)
139
- ], 64)) : E("", !0)
134
+ y.created_at ? (i(), W(e(Dt), {
135
+ key: 0,
136
+ value: y.created_at
137
+ }, null, 8, ["value"])) : L("", !0),
138
+ w(" · " + p(y.author ?? e(a)(`page.source-${y.source}`)) + " ", 1),
139
+ y.comment ? (i(), V(H, { key: 1 }, [
140
+ w(" · " + p(y.comment), 1)
141
+ ], 64)) : L("", !0)
140
142
  ]),
141
143
  _: 2
142
144
  }, 1024)
143
145
  ]),
144
- S(y) === "draft" ? (r(), W(e(G), {
146
+ b(y) === "draft" ? (i(), W(e(J), {
145
147
  key: 0,
146
148
  type: "warning",
147
149
  dot: ""
148
150
  }, {
149
151
  default: c(() => [
150
- $(f(e(n)("page.version-draft")), 1)
152
+ w(p(e(a)("page.version-draft")), 1)
151
153
  ]),
152
154
  _: 1
153
- })) : S(y) === "live" ? (r(), W(e(G), {
155
+ })) : b(y) === "live" ? (i(), W(e(J), {
154
156
  key: 1,
155
157
  type: "success",
156
158
  dot: ""
157
159
  }, {
158
160
  default: c(() => [
159
- $(f(e(n)("page.version-live")), 1)
161
+ w(p(e(a)("page.version-live")), 1)
160
162
  ]),
161
163
  _: 1
162
- })) : E("", !0),
163
- t.canManage && S(y) === "replaced" ? (r(), W(e(q), {
164
+ })) : L("", !0),
165
+ t.canManage && b(y) === "replaced" ? (i(), W(e(q), {
164
166
  key: 2,
165
167
  size: "sm",
166
168
  variant: "outline",
167
- onClick: (g) => k(y)
169
+ onClick: (_) => m(y)
168
170
  }, {
169
171
  default: c(() => [
170
- $(f(e(n)("page.restore")), 1)
172
+ w(p(e(a)("page.restore")), 1)
171
173
  ]),
172
174
  _: 1
173
- }, 8, ["onClick"])) : E("", !0)
175
+ }, 8, ["onClick"])) : L("", !0)
174
176
  ]))), 128))
175
177
  ]));
176
178
  }
177
- }), Gt = /* @__PURE__ */ Z(Zt, [["__scopeId", "data-v-e88160ce"]]), Ee = "wx-preview-selected", tt = "wx-preview-style";
178
- function gt(t, l) {
179
- const s = (t.ownerDocument ?? t).createTreeWalker(
179
+ }), ol = /* @__PURE__ */ X(sl, [["__scopeId", "data-v-42c6b7ad"]]), Se = "wx-preview-selected", Pe = "wx-preview-hover", ot = "wx-preview-style";
180
+ function St(t, l) {
181
+ const n = (t.ownerDocument ?? t).createTreeWalker(
180
182
  t,
181
183
  128
182
184
  /* NodeFilter.SHOW_COMMENT */
183
185
  );
184
186
  let o = null;
185
- for (let i = s.nextNode(); i; i = s.nextNode()) {
186
- const n = i.data.trim();
187
- if (o === null && n === `wx:${l}`)
188
- o = i;
189
- else if (o !== null && n === `/wx:${l}`)
190
- return { start: o, end: i };
187
+ for (let r = n.nextNode(); r; r = n.nextNode()) {
188
+ const a = r.data.trim();
189
+ if (o === null && a === `wx:${l}`)
190
+ o = r;
191
+ else if (o !== null && a === `/wx:${l}`)
192
+ return { start: o, end: r };
191
193
  }
192
194
  return null;
193
195
  }
194
- function Yt(t, l, a) {
195
- const s = gt(t, l);
196
- if (!s) return !1;
197
- const o = s.start.parentNode;
196
+ function il(t, l, s) {
197
+ const n = St(t, l);
198
+ if (!n) return !1;
199
+ const o = n.start.parentNode;
198
200
  if (!o) return !1;
199
- const i = t.createElement("template");
200
- i.innerHTML = a;
201
- const n = s.end.nextSibling;
202
- let h = s.start;
203
- for (; h; ) {
204
- const k = h.nextSibling, b = h === s.end;
205
- if (o.removeChild(h), b) break;
206
- h = k;
201
+ const r = t.createElement("template");
202
+ r.innerHTML = s;
203
+ const a = n.end.nextSibling;
204
+ let v = n.start;
205
+ for (; v; ) {
206
+ const m = v.nextSibling, h = v === n.end;
207
+ if (o.removeChild(v), h) break;
208
+ v = m;
207
209
  }
208
- const p = i.content, S = Array.from(p.childNodes);
209
- o.insertBefore(p, n);
210
- const _ = t.defaultView?.webx;
211
- if (_?.mount)
212
- for (const k of S)
213
- k.nodeType === 1 && _.mount(k);
210
+ const A = r.content, d = Array.from(A.childNodes);
211
+ o.insertBefore(A, a);
212
+ const b = t.defaultView?.webx;
213
+ if (b?.mount)
214
+ for (const m of d)
215
+ m.nodeType === 1 && b.mount(m);
214
216
  return !0;
215
217
  }
216
- function Qt(t, l) {
217
- const a = gt(t, l);
218
- if (!a) return null;
219
- for (let s = a.start.nextSibling; s && s !== a.end; s = s.nextSibling)
220
- if (s.nodeType === 1) return s;
218
+ function Ye(t, l) {
219
+ const s = St(t, l);
220
+ if (!s) return null;
221
+ for (let n = s.start.nextSibling; n && n !== s.end; n = n.nextSibling)
222
+ if (n.nodeType === 1) return n;
221
223
  return null;
222
224
  }
223
- function De(t, l) {
224
- Xt(t);
225
- for (const s of Array.from(t.querySelectorAll(`.${Ee}`)))
226
- s.classList.remove(Ee);
225
+ function Je(t, l) {
226
+ Qe(t);
227
+ for (const n of Array.from(t.querySelectorAll(`.${Se}`)))
228
+ n.classList.remove(Se);
227
229
  if (l === null) return null;
228
- const a = Qt(t, l);
229
- return a?.classList.add(Ee), a;
230
+ const s = Ye(t, l);
231
+ return s?.classList.add(Se), s;
232
+ }
233
+ function it(t, l) {
234
+ Qe(t);
235
+ for (const s of Array.from(t.querySelectorAll(`.${Pe}`)))
236
+ s.classList.remove(Pe);
237
+ l !== null && Ye(t, l)?.classList.add(Pe);
238
+ }
239
+ function rt(t) {
240
+ let l = t?.nodeType === 1 ? t : t?.parentElement ?? null;
241
+ for (; l; ) {
242
+ let s = 0;
243
+ for (let n = l.previousSibling; n; n = n.previousSibling) {
244
+ if (n.nodeType !== 8) continue;
245
+ const o = n.data.trim();
246
+ if (o.startsWith("/wx:"))
247
+ s += 1;
248
+ else if (o.startsWith("wx:")) {
249
+ if (s === 0) return o.slice(3);
250
+ s -= 1;
251
+ }
252
+ }
253
+ l = l.parentElement;
254
+ }
255
+ return null;
230
256
  }
231
- function Xt(t) {
232
- if (t.getElementById(tt)) return;
257
+ function rl(t, l) {
258
+ Qe(t);
259
+ let s = null;
260
+ function n(v) {
261
+ v.preventDefault(), v.stopPropagation();
262
+ }
263
+ function o(v) {
264
+ n(v), l.select(rt(v.target));
265
+ }
266
+ function r(v) {
267
+ const A = rt(v.target);
268
+ A !== s && (s = A, it(t, A));
269
+ }
270
+ function a() {
271
+ s = null, it(t, null);
272
+ }
273
+ return t.addEventListener("click", o, !0), t.addEventListener("auxclick", n, !0), t.addEventListener("submit", n, !0), t.addEventListener("dragstart", n, !0), t.addEventListener("mousemove", r, !0), t.addEventListener("mouseleave", a), {
274
+ release() {
275
+ t.removeEventListener("click", o, !0), t.removeEventListener("auxclick", n, !0), t.removeEventListener("submit", n, !0), t.removeEventListener("dragstart", n, !0), t.removeEventListener("mousemove", r, !0), t.removeEventListener("mouseleave", a);
276
+ }
277
+ };
278
+ }
279
+ function Qe(t) {
280
+ if (t.getElementById(ot)) return;
233
281
  const l = t.createElement("style");
234
- l.id = tt, l.textContent = `.${Ee}{outline:2px solid #427edd;outline-offset:-2px;}`, (t.head ?? t.documentElement).appendChild(l);
282
+ l.id = ot, l.textContent = `.${Se}{outline:2px solid #427edd;outline-offset:-2px;}.${Pe}:not(.${Se}){outline:1px solid #427edd;outline-offset:-1px;cursor:pointer;}`, (t.head ?? t.documentElement).appendChild(l);
235
283
  }
236
- function kt(t) {
237
- const l = t.base ? `<base href="${lt(t.base)}">` : "", a = t.frame ? `<style>${t.frame}</style>` : "", s = t.script && t.runtime ? `<script src="${lt(t.runtime)}"><\/script><script>${t.script}<\/script>` : "";
238
- 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>${a}<style>${t.styles}</style></head><body>${t.html}${s}</body></html>`;
284
+ function Ct(t) {
285
+ const l = t.base ? `<base href="${ut(t.base)}">` : "", s = t.frame ? `<style>${t.frame}</style>` : "", n = t.script && t.runtime ? `<script src="${ut(t.runtime)}"><\/script><script>${t.script}<\/script>` : "";
286
+ 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>${s}<style>${t.styles}</style></head><body>${t.html}${n}</body></html>`;
239
287
  }
240
- function lt(t) {
288
+ function ut(t) {
241
289
  return t.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
242
290
  }
243
- const el = { class: "wx-block-stage" }, tl = { class: "wx-block-stage__bar" }, ll = ["srcdoc", "title"], nl = /* @__PURE__ */ K({
291
+ const ul = { class: "wx-block-stage" }, cl = { class: "wx-block-stage__bar" }, dl = ["srcdoc", "title"], pl = /* @__PURE__ */ Q({
244
292
  __name: "BlockStage",
245
293
  props: {
246
294
  html: {},
@@ -250,12 +298,12 @@ const el = { class: "wx-block-stage" }, tl = { class: "wx-block-stage__bar" }, l
250
298
  loading: { type: Boolean, default: !1 }
251
299
  },
252
300
  setup(t) {
253
- const l = t, a = Q("webx-blocks"), s = C(() => [
254
- { value: 1280, label: a("page.width-desktop") },
255
- { value: 834, label: a("page.width-tablet") },
256
- { value: 390, label: a("page.width-phone") }
257
- ]), o = U(1280), i = U(null), n = U(null), h = He(i), p = U(360), S = C(() => h.value === 0 ? 1 : Math.min(1, h.value / o.value)), _ = C(
258
- () => kt({
301
+ const l = t, s = le("webx-blocks"), n = B(() => [
302
+ { value: 1280, label: s("page.width-desktop") },
303
+ { value: 834, label: s("page.width-tablet") },
304
+ { value: 390, label: s("page.width-phone") }
305
+ ]), o = U(1280), r = U(null), a = U(null), v = Ge(r), A = U(360), d = B(() => v.value === 0 ? 1 : Math.min(1, v.value / o.value)), b = B(
306
+ () => Ct({
259
307
  html: l.html,
260
308
  styles: l.styles,
261
309
  script: l.script,
@@ -263,146 +311,156 @@ const el = { class: "wx-block-stage" }, tl = { class: "wx-block-stage__bar" }, l
263
311
  base: typeof location > "u" ? null : location.origin + "/"
264
312
  })
265
313
  );
266
- function k() {
267
- const g = n.value?.contentDocument;
268
- g?.documentElement && (p.value = Math.max(120, g.documentElement.scrollHeight));
314
+ function m() {
315
+ const _ = a.value?.contentDocument;
316
+ _?.documentElement && (A.value = Math.max(120, _.documentElement.scrollHeight));
269
317
  }
270
- function b() {
271
- k(), setTimeout(k, 300);
318
+ function h() {
319
+ m(), setTimeout(m, 300);
272
320
  }
273
- le(o, () => setTimeout(k, 50));
274
- const m = C(() => ({
321
+ ie(o, () => setTimeout(m, 50));
322
+ const f = B(() => ({
275
323
  width: `${o.value}px`,
276
- height: `${p.value}px`,
277
- transform: `scale(${S.value})`
278
- })), y = C(() => ({
279
- width: `${Math.round(o.value * S.value)}px`,
280
- height: `${Math.round(p.value * S.value)}px`
324
+ height: `${A.value}px`,
325
+ transform: `scale(${d.value})`
326
+ })), y = B(() => ({
327
+ width: `${Math.round(o.value * d.value)}px`,
328
+ height: `${Math.round(A.value * d.value)}px`
281
329
  }));
282
- return (g, d) => (r(), V("div", el, [
283
- x("div", tl, [
284
- u(e(ct), {
330
+ return (_, S) => (i(), V("div", ul, [
331
+ $("div", cl, [
332
+ u(e(gt), {
285
333
  modelValue: o.value,
286
- "onUpdate:modelValue": d[0] || (d[0] = (w) => o.value = w),
287
- options: s.value,
334
+ "onUpdate:modelValue": S[0] || (S[0] = (k) => o.value = k),
335
+ options: n.value,
288
336
  size: "sm"
289
337
  }, null, 8, ["modelValue", "options"])
290
338
  ]),
291
- x("div", {
339
+ $("div", {
292
340
  ref_key: "box",
293
- ref: i,
341
+ ref: r,
294
342
  class: "wx-block-stage__ground"
295
343
  }, [
296
- t.loading && !t.html ? (r(), W(e(pe), {
344
+ t.loading && !t.html ? (i(), W(e(he), {
297
345
  key: 0,
298
346
  rows: 3
299
- })) : (r(), V("div", {
347
+ })) : (i(), V("div", {
300
348
  key: 1,
301
349
  class: "wx-block-stage__clip",
302
- style: fe(y.value)
350
+ style: ce(y.value)
303
351
  }, [
304
- x("iframe", {
352
+ $("iframe", {
305
353
  ref_key: "frame",
306
- ref: n,
354
+ ref: a,
307
355
  class: "wx-block-stage__frame",
308
- srcdoc: _.value,
309
- style: fe(m.value),
356
+ srcdoc: b.value,
357
+ style: ce(f.value),
310
358
  sandbox: "allow-same-origin allow-scripts",
311
- title: e(a)("page.preview"),
312
- onLoad: b
313
- }, null, 44, ll)
359
+ title: e(s)("page.preview"),
360
+ onLoad: h
361
+ }, null, 44, dl)
314
362
  ], 4))
315
363
  ], 512)
316
364
  ]));
317
365
  }
318
- }), al = /* @__PURE__ */ Z(nl, [["__scopeId", "data-v-976b03f0"]]);
319
- function yt(t) {
366
+ }), fl = /* @__PURE__ */ X(pl, [["__scopeId", "data-v-9aa4b1df"]]);
367
+ function Tt(t) {
320
368
  return typeof t == "object" && t !== null && typeof t.type == "string" && t.type !== "";
321
369
  }
322
- function Fe(t) {
323
- return Array.isArray(t) && t.length > 0 && t.every(yt);
370
+ function Oe(t) {
371
+ return Array.isArray(t) && t.length > 0 && t.every(Tt);
324
372
  }
325
- function wt() {
373
+ function Ke() {
326
374
  return (typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID().replace(/-/g, "") : Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2)).slice(0, 12);
327
375
  }
328
- function sl(t, l = {}) {
329
- return { key: wt(), type: t, values: l };
376
+ function vl(t, l = {}) {
377
+ return { key: Ke(), type: t, values: l };
330
378
  }
331
- function oe(t, l) {
332
- return _t(t, l, null, null);
379
+ function se(t, l) {
380
+ return Bt(t, l, null, null);
333
381
  }
334
- function _t(t, l, a, s) {
382
+ function Bt(t, l, s, n) {
335
383
  for (let o = 0; o < t.length; o++) {
336
- const i = t[o];
337
- if (i.key === l) return { node: i, parent: a, field: s, list: t, index: o };
338
- for (const [n, h] of Object.entries(i.values ?? {}))
339
- if (Fe(h)) {
340
- const p = _t(h, l, i, n);
341
- if (p) return p;
384
+ const r = t[o];
385
+ if (r.key === l) return { node: r, parent: s, field: n, list: t, index: o };
386
+ for (const [a, v] of Object.entries(r.values ?? {}))
387
+ if (Oe(v)) {
388
+ const A = Bt(v, l, r, a);
389
+ if (A) return A;
342
390
  }
343
391
  }
344
392
  return null;
345
393
  }
346
- function qe(t, l, a = 0, s = null) {
394
+ function De(t, l, s = 0, n = null) {
347
395
  for (const o of t)
348
- if (yt(o)) {
349
- l(o, a, s);
350
- for (const i of Object.values(o.values ?? {}))
351
- Fe(i) && qe(i, l, a + 1, o);
396
+ if (Tt(o)) {
397
+ l(o, s, n);
398
+ for (const r of Object.values(o.values ?? {}))
399
+ Oe(r) && De(r, l, s + 1, o);
352
400
  }
353
401
  }
354
- function ol(t, l) {
355
- let a = 0;
356
- return qe(t, (s) => {
357
- s.type === l && a++;
358
- }), a;
402
+ function ml(t, l) {
403
+ let s = 0;
404
+ return De(t, (n) => {
405
+ n.type === l && s++;
406
+ }), s;
359
407
  }
360
- function Fn(t) {
408
+ function hl(t) {
409
+ let l = 0;
410
+ for (const s of Object.values(t.values ?? {}))
411
+ Oe(s) && De(s, () => l++);
412
+ return l;
413
+ }
414
+ function aa(t) {
361
415
  const l = [];
362
- return qe(t, (a) => {
363
- l.includes(a.type) || l.push(a.type);
416
+ return De(t, (s) => {
417
+ l.includes(s.type) || l.push(s.type);
364
418
  }), l;
365
419
  }
366
- function xt(t) {
420
+ function Et(t) {
367
421
  const l = [];
368
- for (const a of t)
369
- a.type === "wx-blocks" && l.push(a), a.children && l.push(...xt(a.children));
422
+ for (const s of t)
423
+ s.type === "wx-blocks" && l.push(s), s.children && l.push(...Et(s.children));
370
424
  return l;
371
425
  }
372
- function $t(t) {
426
+ function Wt(t) {
373
427
  const l = {};
374
- for (const [a, s] of Object.entries(t.values ?? {}))
375
- l[a] = Fe(s) ? s.map($t) : ae(s);
376
- return { key: wt(), type: t.type, values: l };
428
+ for (const [s, n] of Object.entries(t.values ?? {}))
429
+ l[s] = Oe(n) ? n.map(Wt) : re(n);
430
+ return t.hidden === !0 ? { key: Ke(), type: t.type, hidden: !0, values: l } : { key: Ke(), type: t.type, values: l };
431
+ }
432
+ function bl(t, l, s) {
433
+ const n = re(t), o = se(n, l);
434
+ return o ? (s ? o.node.hidden = !0 : delete o.node.hidden, n) : t;
377
435
  }
378
- function il(t, l, a) {
436
+ function gl(t, l, s) {
379
437
  if (l === null) return t;
380
- const s = oe(t, l);
381
- if (!s || a === null) return null;
382
- const o = s.node.values[a];
383
- return Array.isArray(o) || (s.node.values[a] = []), s.node.values[a];
438
+ const n = se(t, l);
439
+ if (!n || s === null) return null;
440
+ const o = n.node.values[s];
441
+ return Array.isArray(o) || (n.node.values[s] = []), n.node.values[s];
384
442
  }
385
- function nt(t, l, a, s, o) {
386
- const i = ae(t), n = il(i, l, a);
387
- return n ? (n.splice(Math.max(0, Math.min(s, n.length)), 0, o), i) : t;
443
+ function ct(t, l, s, n, o) {
444
+ const r = re(t), a = gl(r, l, s);
445
+ return a ? (a.splice(Math.max(0, Math.min(n, a.length)), 0, o), r) : t;
388
446
  }
389
- function rl(t, l) {
390
- const a = ae(t), s = oe(a, l);
391
- return s ? (s.list.splice(s.index, 1), a) : t;
447
+ function kl(t, l) {
448
+ const s = re(t), n = se(s, l);
449
+ return n ? (n.list.splice(n.index, 1), s) : t;
392
450
  }
393
- function ul(t, l, a) {
394
- const s = ae(t), o = oe(s, l);
395
- return o ? (o.node.values = a, s) : t;
451
+ function yl(t, l, s) {
452
+ const n = re(t), o = se(n, l);
453
+ return o ? (o.node.values = s, n) : t;
396
454
  }
397
- function cl(t, l, a, s) {
398
- if (l === null) return ae(s);
399
- const o = ae(t), i = oe(o, l);
400
- return !i || a === null ? t : (i.node.values[a] = ae(s), o);
455
+ function wl(t, l, s, n) {
456
+ if (l === null) return re(n);
457
+ const o = re(t), r = se(o, l);
458
+ return !r || s === null ? t : (r.node.values[s] = re(n), o);
401
459
  }
402
- function ae(t) {
460
+ function re(t) {
403
461
  return t === void 0 ? t : JSON.parse(JSON.stringify(t));
404
462
  }
405
- const dl = {
463
+ const _l = {
406
464
  module: {
407
465
  title: "Blocks"
408
466
  },
@@ -410,6 +468,7 @@ const dl = {
410
468
  blocks: "Blocks",
411
469
  new: "New block",
412
470
  search: "Search by name or identifier",
471
+ "all-groups": "All groups",
413
472
  empty: "No block types yet.",
414
473
  "empty-help": "A block type is made here entirely: its fields, its template, its styles and its script.",
415
474
  "editing-off": "Editing is switched off on this site: the types arrive by import, and the section is read-only.",
@@ -501,8 +560,11 @@ const dl = {
501
560
  done: "Done",
502
561
  remove: "Remove",
503
562
  "remove-title": 'Remove ":title"?',
504
- "remove-text": "The blocks inside it go with it.",
563
+ "remove-text": "The :count blocks inside it go with it.",
505
564
  duplicate: "Duplicate",
565
+ hide: "Hide from the site",
566
+ show: "Show on the site",
567
+ "hidden-note": "Hidden: it is not drawn on the site, nor is anything inside it",
506
568
  empty: "No blocks yet. Add the first one.",
507
569
  "nested-note": "Nested blocks are edited in the tree on the left.",
508
570
  "unknown-type": 'Unknown block type ":type"',
@@ -541,127 +603,127 @@ const dl = {
541
603
  "ok-container": "Width is decided by container queries.",
542
604
  "ok-variables": "Every variable of the template is a field of the schema."
543
605
  }
544
- }, at = /* @__PURE__ */ new WeakSet();
545
- function _e() {
606
+ }, dt = /* @__PURE__ */ new WeakSet();
607
+ function Ee() {
546
608
  try {
547
- const { i18n: t } = we();
548
- at.has(t) || (t.defaults("webx-blocks", dl), at.add(t));
609
+ const { i18n: t } = Te();
610
+ dt.has(t) || (t.defaults("webx-blocks", _l), dt.add(t));
549
611
  } catch {
550
612
  }
551
613
  }
552
- const pl = ["block", "entity", "loop", "__env", "errors", "app"];
553
- function fl(t, l, a) {
554
- const s = [];
555
- /data-wx-block\s*=/.test(l.template) || s.push({ file: "template", code: "no-marker", line: null, message: a("checks.no-marker") });
556
- const o = ml(l.template, l.schema);
557
- o.length > 0 && s.push({
614
+ const xl = ["block", "entity", "loop", "__env", "errors", "app"];
615
+ function $l(t, l, s) {
616
+ const n = [];
617
+ /data-wx-block\s*=/.test(l.template) || n.push({ file: "template", code: "no-marker", line: null, message: s("checks.no-marker") });
618
+ const o = Vl(l.template, l.schema);
619
+ o.length > 0 && n.push({
558
620
  file: "template",
559
621
  code: "variables-missing",
560
622
  line: null,
561
- message: a("checks.variables-missing", {
562
- variables: o.map((_) => `$${_}`).join(", ")
623
+ message: s("checks.variables-missing", {
624
+ variables: o.map((b) => `$${b}`).join(", ")
563
625
  })
564
626
  });
565
- const i = [], n = [], h = `.b-${t}`;
566
- for (const [_, k] of vl(l.styles))
567
- _.startsWith(h) || _.startsWith("&") || (/^[a-z][a-z0-9-]*/i.test(_) ? n.push([_, k]) : i.push([_, k]));
568
- i.length > 0 && s.push({
627
+ const r = [], a = [], v = `.b-${t}`;
628
+ for (const [b, m] of Sl(l.styles))
629
+ b.startsWith(v) || b.startsWith("&") || (/^[a-z][a-z0-9-]*/i.test(b) ? a.push([b, m]) : r.push([b, m]));
630
+ r.length > 0 && n.push({
569
631
  file: "styles",
570
632
  code: "stray-selectors",
571
- line: i[0][1],
572
- message: a("checks.stray-selectors", { slug: t, selectors: st(i) })
573
- }), n.length > 0 && s.push({
633
+ line: r[0][1],
634
+ message: s("checks.stray-selectors", { slug: t, selectors: pt(r) })
635
+ }), a.length > 0 && n.push({
574
636
  file: "styles",
575
637
  code: "bare-selectors",
576
- line: n[0][1],
577
- message: a("checks.bare-selectors", { selectors: st(n) })
638
+ line: a[0][1],
639
+ message: s("checks.bare-selectors", { selectors: pt(a) })
578
640
  });
579
- const p = St(l.styles), S = /@media\b/.exec(p);
580
- return S && s.push({
641
+ const A = Lt(l.styles), d = /@media\b/.exec(A);
642
+ return d && n.push({
581
643
  file: "styles",
582
644
  code: "media-query",
583
- line: Tt(p, S.index),
584
- message: a("checks.media-query")
585
- }), s;
645
+ line: zt(A, d.index),
646
+ message: s("checks.media-query")
647
+ }), n;
586
648
  }
587
- function Vt(t) {
649
+ function At(t) {
588
650
  const l = [];
589
- for (const a of t)
590
- a.id && l.push(a.id), a.children && l.push(...Vt(a.children));
651
+ for (const s of t)
652
+ s.id && l.push(s.id), s.children && l.push(...At(s.children));
591
653
  return l;
592
654
  }
593
- function ml(t, l) {
594
- const a = /* @__PURE__ */ new Set([...Vt(l), ...pl]);
655
+ function Vl(t, l) {
656
+ const s = /* @__PURE__ */ new Set([...At(l), ...xl]);
595
657
  for (const o of t.matchAll(/\bas\s+\$([a-zA-Z_]\w*)(?:\s*=>\s*\$([a-zA-Z_]\w*))?/g))
596
- a.add(o[1]), o[2] && a.add(o[2]);
658
+ s.add(o[1]), o[2] && s.add(o[2]);
597
659
  for (const o of t.matchAll(/\$([a-zA-Z_]\w*)\s*(?:=[^=]|\+\+|--|\.=|\+=|-=)/g))
598
- a.add(o[1]);
599
- const s = [];
660
+ s.add(o[1]);
661
+ const n = [];
600
662
  for (const o of t.matchAll(/\$([a-zA-Z_]\w*)/g)) {
601
- const i = o[1];
602
- !a.has(i) && !s.includes(i) && s.push(i);
663
+ const r = o[1];
664
+ !s.has(r) && !n.includes(r) && n.push(r);
603
665
  }
604
- return s;
666
+ return n;
605
667
  }
606
- function vl(t) {
607
- const l = St(t), a = [];
608
- for (const s of l.matchAll(/([^{};]+)\{/g)) {
609
- const o = s[1], i = o.trim();
610
- if (!(i === "" || i.startsWith("@")))
611
- for (const n of o.split(",")) {
612
- const h = n.trim();
613
- h === "" || h === "from" || h === "to" || h.endsWith("%") || a.push([h, Tt(l, s.index + o.indexOf(h))]);
668
+ function Sl(t) {
669
+ const l = Lt(t), s = [];
670
+ for (const n of l.matchAll(/([^{};]+)\{/g)) {
671
+ const o = n[1], r = o.trim();
672
+ if (!(r === "" || r.startsWith("@")))
673
+ for (const a of o.split(",")) {
674
+ const v = a.trim();
675
+ v === "" || v === "from" || v === "to" || v.endsWith("%") || s.push([v, zt(l, n.index + o.indexOf(v))]);
614
676
  }
615
677
  }
616
- return a;
678
+ return s;
617
679
  }
618
- function St(t) {
680
+ function Lt(t) {
619
681
  return t.replace(/\/\*[\s\S]*?\*\//g, (l) => l.replace(/[^\n]/g, " "));
620
682
  }
621
- function Tt(t, l) {
683
+ function zt(t, l) {
622
684
  return t.slice(0, Math.max(0, l)).split(`
623
685
  `).length;
624
686
  }
625
- function st(t) {
626
- const l = [...new Set(t.map(([a]) => a))];
687
+ function pt(t) {
688
+ const l = [...new Set(t.map(([s]) => s))];
627
689
  return l.slice(0, 3).join(", ") + (l.length > 3 ? ", …" : "");
628
690
  }
629
- function Je(t) {
691
+ function Xe(t) {
630
692
  return t.map((l) => ({
631
693
  ...l,
632
694
  name: l.name ?? l.id,
633
- children: l.children ? Je(l.children) : l.children
695
+ children: l.children ? Xe(l.children) : l.children
634
696
  }));
635
697
  }
636
- function ke(t, l) {
637
- const a = `groups.${t}`, s = l(a);
638
- return s === a || s === `webx-blocks::${a}` ? t.charAt(0).toUpperCase() + t.slice(1) : s;
698
+ function ye(t, l) {
699
+ const s = `groups.${t}`, n = l(s);
700
+ return n === s || n === `webx-blocks::${s}` ? t.charAt(0).toUpperCase() + t.slice(1) : n;
639
701
  }
640
- const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns" }, gl = { class: "wx-block-editor__head" }, kl = { class: "wx-block-editor__id" }, yl = ["aria-label", "disabled"], wl = { class: "wx-block-editor__actions" }, _l = { class: "wx-block-editor__columns" }, xl = { class: "wx-block-editor__files" }, $l = { class: "wx-block-editor__pane" }, Vl = {
702
+ const Cl = { class: "wx-block-editor" }, Tl = { class: "wx-block-editor__columns" }, Bl = { class: "wx-block-editor__head" }, El = { class: "wx-block-editor__id" }, Wl = { class: "wx-block-editor__name" }, Al = { class: "wx-block-editor__title" }, Ll = { class: "wx-block-editor__actions" }, zl = { class: "wx-block-editor__columns" }, Il = { class: "wx-block-editor__files" }, Ul = { class: "wx-block-editor__pane" }, Nl = {
641
703
  key: 0,
642
704
  class: "wx-block-editor__pills"
643
- }, Sl = ["disabled", "onClick", "textContent"], Tl = { class: "wx-block-editor__pane" }, Cl = { class: "wx-block-editor__pane" }, Bl = { class: "wx-block-editor__note" }, Wl = { class: "wx-block-editor__pane" }, Al = { class: "wx-block-editor__note" }, zl = { class: "wx-block-editor__settings" }, El = {
705
+ }, Pl = ["disabled", "onClick", "textContent"], Ml = { class: "wx-block-editor__pane" }, Ol = { class: "wx-block-editor__pane" }, Dl = { class: "wx-block-editor__note" }, Rl = { class: "wx-block-editor__pane" }, jl = { class: "wx-block-editor__note" }, Hl = { class: "wx-block-editor__settings" }, Fl = {
644
706
  key: 0,
645
707
  class: "is-wide wx-block-editor__danger"
646
- }, Ul = { class: "wx-block-editor__side" }, Il = {
708
+ }, ql = { class: "wx-block-editor__side" }, Jl = {
647
709
  key: 1,
648
710
  class: "wx-block-editor__usage"
649
- }, Nl = /* @__PURE__ */ K({
711
+ }, Kl = /* @__PURE__ */ Q({
650
712
  __name: "BlockEditorPage",
651
713
  props: {
652
714
  base: { default: "/blocks" }
653
715
  },
654
716
  setup(t) {
655
- const l = t, a = we(), s = he(a), o = It(), i = ut();
656
- _e();
657
- const n = Q("webx-blocks"), h = C(() => Number(o.params.id)), p = U(null), S = U([]), _ = U(!0), k = U(!1), b = U(!1), m = U("template"), y = C(() => {
658
- const T = a.state.manifest?.modules.find((v) => v.id === "blocks")?.meta;
717
+ const l = t, s = Te(), n = ke(s), o = Ot(), r = bt();
718
+ Ee();
719
+ const a = le("webx-blocks"), v = Be(), A = B(() => Number(o.params.id)), d = U(null), b = U([]), m = U(!0), h = U(!1), f = U(!1), y = U("template"), _ = B(() => {
720
+ const E = s.state.manifest?.modules.find((g) => g.id === "blocks")?.meta;
659
721
  return {
660
- groups: T?.groups ?? [],
661
- editing: T?.editing ?? !0,
662
- provides: T?.provides ?? []
722
+ groups: E?.groups ?? [],
723
+ editing: E?.editing ?? !0,
724
+ provides: E?.provides ?? []
663
725
  };
664
- }), g = C(() => a.can("blocks.manage") && y.value.editing), d = Le({
726
+ }), S = B(() => s.can("blocks.manage") && _.value.editing), k = je({
665
727
  slug: "",
666
728
  title: "",
667
729
  description: "",
@@ -672,768 +734,824 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
672
734
  allowed_in: [],
673
735
  max_per_entity: null,
674
736
  is_enabled: !0
675
- }), w = Le({
737
+ }), C = je({
676
738
  schema: [],
677
739
  template: "",
678
740
  styles: "",
679
741
  script: null,
680
742
  sample: {}
681
- }), B = U("[]"), M = U(null), N = U(""), I = U({}), P = U(null), H = Le({
743
+ }), D = U("[]"), K = U(null), ne = U(""), z = U({}), N = U(null), I = je({
682
744
  html: "",
683
745
  styles: "",
684
746
  script: null,
685
747
  runtime: null,
686
748
  loading: !1
687
- }), xe = C(() => JSON.stringify({ settings: d, content: w })), ie = C(() => N.value !== "" && xe.value !== N.value), $e = C(() => fl(d.slug, w, n)), Ue = C(() => {
688
- const T = [...y.value.groups];
689
- return T.includes(d.group) || T.push(d.group), T.map((v) => ({ value: v, label: ke(v, n) }));
690
- }), be = C({
691
- get: () => w.sample,
692
- set: (T) => {
693
- w.sample = T;
749
+ }), M = B(() => JSON.stringify({ settings: k, content: C })), O = B(() => ne.value !== "" && M.value !== ne.value), ee = B(() => $l(k.slug, C, a)), de = B(() => {
750
+ const E = [..._.value.groups];
751
+ return E.includes(k.group) || E.push(k.group), E.map((g) => ({ value: g, label: ye(g, a) }));
752
+ }), We = B({
753
+ get: () => C.sample,
754
+ set: (E) => {
755
+ C.sample = E;
694
756
  }
695
- }), Ve = C(() => re(w.schema));
696
- function re(T) {
697
- const v = [];
698
- for (const O of T)
699
- O.type !== "wx-blocks" && !(O.children?.length && !O.name) && v.push(O.id), O.children && v.push(...re(O.children));
700
- return v;
757
+ }), Ae = B(() => we(C.schema));
758
+ function we(E) {
759
+ const g = [];
760
+ for (const x of E)
761
+ x.type !== "wx-blocks" && !(x.children?.length && !x.name) && g.push(x.id), x.children && g.push(...we(x.children));
762
+ return g;
701
763
  }
702
- function se(T) {
703
- p.value = T, Object.assign(d, {
704
- slug: T.slug,
705
- title: T.title,
706
- description: T.description,
707
- icon: T.icon,
708
- group: T.group,
709
- sort: T.sort,
710
- allow: T.allow ?? [],
711
- allowed_in: T.allowed_in ?? [],
712
- max_per_entity: T.max_per_entity,
713
- is_enabled: T.is_enabled
764
+ function pe(E) {
765
+ d.value = E, Object.assign(k, {
766
+ slug: E.slug,
767
+ title: E.title,
768
+ description: E.description,
769
+ icon: E.icon,
770
+ group: E.group,
771
+ sort: E.sort,
772
+ allow: E.allow ?? [],
773
+ allowed_in: E.allowed_in ?? [],
774
+ max_per_entity: E.max_per_entity,
775
+ is_enabled: E.is_enabled
714
776
  });
715
- const v = T.content ?? {
777
+ const g = E.content ?? {
716
778
  schema: [],
717
779
  template: "",
718
780
  styles: "",
719
781
  script: null,
720
782
  sample: {}
721
783
  };
722
- Object.assign(w, ae(v)), B.value = JSON.stringify(v.schema, null, 2), M.value = null, N.value = xe.value;
784
+ Object.assign(C, re(g)), D.value = JSON.stringify(g.schema, null, 2), K.value = null, ne.value = M.value;
723
785
  }
724
- async function Se() {
725
- _.value = !0;
786
+ async function fe() {
787
+ m.value = !0;
726
788
  try {
727
- se(await s.get(h.value)), S.value = await s.usage(h.value);
728
- } catch (T) {
729
- F.danger(T.body?.message ?? String(T));
789
+ pe(await n.get(A.value)), b.value = await n.usage(A.value);
790
+ } catch (E) {
791
+ F.danger(v(E));
730
792
  } finally {
731
- _.value = !1;
793
+ m.value = !1;
732
794
  }
733
795
  }
734
- function A(T) {
735
- B.value = T;
796
+ function Le(E) {
797
+ D.value = E;
736
798
  try {
737
- const v = JSON.parse(T);
738
- if (!Array.isArray(v)) throw new Error("not a list");
739
- w.schema = v, M.value = null;
740
- } catch (v) {
741
- M.value = n("page.schema-invalid", { error: v.message });
799
+ const g = JSON.parse(E);
800
+ if (!Array.isArray(g)) throw new Error("not a list");
801
+ C.schema = g, K.value = null;
802
+ } catch (g) {
803
+ K.value = a("page.schema-invalid", { error: g.message });
742
804
  }
743
805
  }
744
- let L, D = 0;
745
- function X() {
746
- clearTimeout(L), L = setTimeout(() => {
747
- ee();
806
+ let _e, T = 0;
807
+ function P() {
808
+ clearTimeout(_e), _e = setTimeout(() => {
809
+ R();
748
810
  }, 250);
749
811
  }
750
- async function ee() {
751
- if (!p.value) return;
752
- const T = ++D;
753
- H.loading = !0;
812
+ async function R() {
813
+ if (!d.value) return;
814
+ const E = ++T;
815
+ I.loading = !0;
754
816
  try {
755
- const v = await s.render(p.value.id, {
756
- values: w.sample,
757
- content: g.value ? {
758
- template: w.template,
759
- styles: w.styles,
760
- script: w.script,
761
- schema: w.schema
817
+ const g = await n.render(d.value.id, {
818
+ values: C.sample,
819
+ content: S.value ? {
820
+ template: C.template,
821
+ styles: C.styles,
822
+ script: C.script,
823
+ schema: C.schema
762
824
  } : void 0
763
825
  });
764
- if (T !== D) return;
765
- H.html = v.html, H.styles = v.styles, H.script = v.script, H.runtime = v.runtime;
766
- } catch (v) {
767
- T === D && F.danger(v.body?.message ?? String(v));
826
+ if (E !== T) return;
827
+ I.html = g.html, I.styles = g.styles, I.script = g.script, I.runtime = g.runtime;
828
+ } catch (g) {
829
+ E === T && F.danger(v(g));
768
830
  } finally {
769
- T === D && (H.loading = !1);
831
+ E === T && (I.loading = !1);
770
832
  }
771
833
  }
772
- le(
773
- () => [w.template, w.styles, w.script, w.schema, w.sample],
774
- X,
834
+ ie(
835
+ () => [C.template, C.styles, C.script, C.schema, C.sample],
836
+ P,
775
837
  { deep: !0 }
776
838
  );
777
- const Te = U(null);
778
- function ge(T) {
779
- return `{{ $${T} }}`;
839
+ const Z = U(null);
840
+ function G(E) {
841
+ return `{{ $${E} }}`;
780
842
  }
781
- function Ce(T) {
782
- const O = Te.value?.view?.value;
783
- if (!O) {
784
- w.template += `{{ $${T} }}`;
843
+ function Re(E) {
844
+ const x = Z.value?.view?.value;
845
+ if (!x) {
846
+ C.template += `{{ $${E} }}`;
785
847
  return;
786
848
  }
787
- O.dispatch(O.state.replaceSelection(`{{ $${T} }}`)), O.focus();
849
+ x.dispatch(x.state.replaceSelection(`{{ $${E} }}`)), x.focus();
788
850
  }
789
851
  async function ue() {
790
- if (!p.value) return;
791
- k.value = !0, I.value = {}, P.value = null;
792
- const T = p.value.draft?.number ?? null;
852
+ if (!d.value) return;
853
+ h.value = !0, z.value = {}, N.value = null;
854
+ const E = d.value.draft?.number ?? null;
793
855
  try {
794
- const v = await s.update(p.value.id, {
795
- ...d,
796
- allow: d.allow.length ? d.allow : null,
797
- allowed_in: d.allowed_in.length ? d.allowed_in : null,
798
- description: d.description || null,
799
- icon: d.icon || null,
800
- content: M.value ? { ...w, schema: void 0 } : w
856
+ const g = await n.update(d.value.id, {
857
+ ...k,
858
+ allow: k.allow.length ? k.allow : null,
859
+ allowed_in: k.allowed_in.length ? k.allowed_in : null,
860
+ description: k.description || null,
861
+ icon: k.icon || null,
862
+ content: K.value ? { ...C, schema: void 0 } : C
801
863
  });
802
- se(v), F.success(
803
- v.draft && v.draft.number !== T ? n("page.saved", { number: v.draft.number }) : n("page.unchanged")
864
+ pe(g), F.success(
865
+ g.draft && g.draft.number !== E ? a("page.saved", { number: g.draft.number }) : a("page.unchanged")
804
866
  );
805
- } catch (v) {
806
- const O = v.body;
807
- O?.errors ? (I.value = O.errors, F.danger(n("page.failed"))) : F.danger(O?.message ?? n("page.failed"));
867
+ } catch (g) {
868
+ const x = g.body;
869
+ x?.errors ? (z.value = x.errors, F.danger(a("page.failed"))) : F.danger(v(g, a("page.failed")));
808
870
  } finally {
809
- k.value = !1;
871
+ h.value = !1;
810
872
  }
811
873
  }
812
- async function Be() {
813
- if (!(!p.value?.draft || (ie.value && await ue(), !p.value.draft) || !await Oe({
814
- title: n("page.publish-title", { number: p.value.draft.number }),
815
- message: n("page.publish-text", { count: p.value.usage_count }),
816
- confirmText: n("page.publish"),
817
- cancelText: n("page.cancel")
874
+ async function xe() {
875
+ if (!(!d.value?.draft || (O.value && await ue(), !d.value.draft) || !await Me({
876
+ title: a("page.publish-title", { number: d.value.draft.number }),
877
+ message: a("page.publish-text", { count: d.value.usage_count }),
878
+ confirmText: a("page.publish"),
879
+ cancelText: a("page.cancel")
818
880
  }))) {
819
- b.value = !0, P.value = null;
881
+ f.value = !0, N.value = null;
820
882
  try {
821
- se(await s.publish(p.value.id)), F.success(n("page.published", { number: p.value.published?.number ?? 0 }));
822
- } catch (v) {
823
- const O = v.body;
824
- O?.errors ? (P.value = O, m.value = "template", F.danger(n("page.publish-failed"))) : F.danger(O?.message ?? n("page.publish-failed"));
883
+ pe(await n.publish(d.value.id)), F.success(a("page.published", { number: d.value.published?.number ?? 0 }));
884
+ } catch (g) {
885
+ const x = g.body;
886
+ x?.errors ? (N.value = x, y.value = "template", F.danger(a("page.publish-failed"))) : F.danger(v(g, a("page.publish-failed")));
825
887
  } finally {
826
- b.value = !1;
888
+ f.value = !1;
827
889
  }
828
890
  }
829
891
  }
830
- async function Ie() {
831
- if (!(!p.value || !await Oe({
832
- title: n("page.delete-title", { title: p.value.title }),
833
- message: n("page.delete-text"),
834
- confirmText: n("page.delete"),
835
- cancelText: n("page.cancel"),
892
+ async function $e() {
893
+ if (!(!d.value || !await Me({
894
+ title: a("page.delete-title", { title: d.value.title }),
895
+ message: a("page.delete-text"),
896
+ confirmText: a("page.delete"),
897
+ cancelText: a("page.cancel"),
836
898
  tone: "danger"
837
899
  })))
838
900
  try {
839
- await s.remove(p.value.id), F.success(n("page.deleted")), i.push(l.base);
840
- } catch (v) {
841
- F.danger(v.body?.message ?? String(v));
901
+ await n.remove(d.value.id), F.success(a("page.deleted")), r.push(l.base);
902
+ } catch (g) {
903
+ F.danger(v(g));
842
904
  }
843
905
  }
844
- const Bt = C(
845
- () => P.value ? {
846
- message: P.value.errors.template?.[0] ?? P.value.message,
847
- line: P.value.line,
848
- where: P.value.entity ? n("page.failed-on", {
849
- title: P.value.entity.title ?? `#${P.value.entity.id}`
906
+ const ze = B(
907
+ () => N.value ? {
908
+ message: N.value.errors.template?.[0] ?? N.value.message,
909
+ line: N.value.line,
910
+ where: N.value.entity ? a("page.failed-on", {
911
+ title: N.value.entity.title ?? `#${N.value.entity.id}`
850
912
  }) : null
851
913
  } : null
852
- ), Ne = C(() => S.value.slice(0, 5));
853
- function te(T) {
854
- return I.value[T]?.[0];
914
+ ), Ve = B(() => b.value.slice(0, 5));
915
+ function ae(E) {
916
+ return z.value[E]?.[0];
855
917
  }
856
- function Ze(T) {
857
- ie.value && T.preventDefault();
918
+ function tt(E) {
919
+ O.value && E.preventDefault();
858
920
  }
859
- return ye(() => {
860
- Se(), window.addEventListener("beforeunload", Ze);
861
- }), Re(() => {
862
- clearTimeout(L), window.removeEventListener("beforeunload", Ze);
863
- }), le(h, () => {
864
- Se();
865
- }), (T, v) => {
866
- const O = je("router-link");
867
- return r(), V("div", hl, [
868
- _.value || !p.value ? (r(), V(j, { key: 0 }, [
869
- u(e(pe), {
870
- class: "wx-block-editor__ghost-head",
871
- title: "",
872
- rows: 1
921
+ return Ce(() => {
922
+ fe(), window.addEventListener("beforeunload", tt);
923
+ }), Ze(() => {
924
+ clearTimeout(_e), window.removeEventListener("beforeunload", tt);
925
+ }), ie(A, () => {
926
+ fe();
927
+ }), (E, g) => (i(), V("div", Cl, [
928
+ m.value || !d.value ? (i(), V(H, { key: 0 }, [
929
+ u(e(he), {
930
+ class: "wx-block-editor__ghost-head",
931
+ title: "",
932
+ rows: 1
933
+ }),
934
+ $("div", Tl, [
935
+ u(e(ve), null, {
936
+ default: c(() => [
937
+ u(e(he), { rows: 8 })
938
+ ]),
939
+ _: 1
873
940
  }),
874
- x("div", bl, [
875
- u(e(ce), null, {
941
+ u(e(ve), null, {
942
+ default: c(() => [
943
+ u(e(he), { rows: 4 })
944
+ ]),
945
+ _: 1
946
+ })
947
+ ])
948
+ ], 64)) : (i(), V(H, { key: 1 }, [
949
+ $("div", Bl, [
950
+ u(e(Rt), {
951
+ class: "wx-block-editor__back",
952
+ to: t.base,
953
+ label: e(a)("page.back")
954
+ }, null, 8, ["to", "label"]),
955
+ $("div", El, [
956
+ $("div", Wl, [
957
+ $("h1", Al, p(k.title), 1),
958
+ S.value ? (i(), W(e(jt), {
959
+ key: 0,
960
+ name: k.title,
961
+ placeholder: e(a)("page.title"),
962
+ onRename: g[0] || (g[0] = (x) => k.title = x)
963
+ }, null, 8, ["name", "placeholder"])) : L("", !0)
964
+ ]),
965
+ u(e(j), {
966
+ size: "sm",
967
+ tone: "muted"
968
+ }, {
876
969
  default: c(() => [
877
- u(e(pe), { rows: 8 })
970
+ $("code", null, p(k.slug), 1),
971
+ w(" · " + p(e(ye)(k.group, e(a))) + " · " + p(d.value.usage_count > 0 ? e(a)("page.on-pages", { count: d.value.usage_count }) : e(a)("page.not-used")), 1)
878
972
  ]),
879
973
  _: 1
880
- }),
881
- u(e(ce), null, {
974
+ })
975
+ ]),
976
+ $("div", Ll, [
977
+ O.value ? (i(), W(e(J), {
978
+ key: 0,
979
+ type: "primary",
980
+ dot: ""
981
+ }, {
882
982
  default: c(() => [
883
- u(e(pe), { rows: 4 })
983
+ w(p(e(a)("page.unsaved")), 1)
884
984
  ]),
885
985
  _: 1
886
- })
887
- ])
888
- ], 64)) : (r(), V(j, { key: 1 }, [
889
- x("div", gl, [
890
- x("div", kl, [
891
- u(O, {
892
- to: t.base,
893
- class: "wx-block-editor__back"
894
- }, {
895
- default: c(() => [
896
- $("‹ " + f(e(n)("page.back")), 1)
897
- ]),
898
- _: 1
899
- }, 8, ["to"]),
900
- Wt(x("input", {
901
- "onUpdate:modelValue": v[0] || (v[0] = (z) => d.title = z),
902
- class: "wx-block-editor__title",
903
- "aria-label": e(n)("page.title"),
904
- disabled: !g.value
905
- }, null, 8, yl), [
906
- [At, d.title]
986
+ })) : L("", !0),
987
+ d.value.draft ? (i(), W(e(J), {
988
+ key: 1,
989
+ type: "warning",
990
+ dot: ""
991
+ }, {
992
+ default: c(() => [
993
+ w(p(e(a)("page.draft", { number: d.value.draft.number })), 1)
907
994
  ]),
908
- u(e(R), {
909
- size: "sm",
910
- tone: "muted"
995
+ _: 1
996
+ })) : L("", !0),
997
+ d.value.published ? (i(), W(e(J), {
998
+ key: 2,
999
+ type: "success",
1000
+ dot: ""
1001
+ }, {
1002
+ default: c(() => [
1003
+ w(p(e(a)("page.live", { number: d.value.published.number })), 1)
1004
+ ]),
1005
+ _: 1
1006
+ })) : (i(), W(e(J), {
1007
+ key: 3,
1008
+ type: "default"
1009
+ }, {
1010
+ default: c(() => [
1011
+ w(p(e(a)("page.never-published")), 1)
1012
+ ]),
1013
+ _: 1
1014
+ })),
1015
+ S.value ? (i(), V(H, { key: 4 }, [
1016
+ u(e(q), {
1017
+ variant: "outline",
1018
+ loading: h.value,
1019
+ onClick: ue
911
1020
  }, {
912
1021
  default: c(() => [
913
- x("code", null, f(d.slug), 1),
914
- $(" · " + f(e(ke)(d.group, e(n))) + " · " + f(p.value.usage_count > 0 ? e(n)("page.on-pages", { count: p.value.usage_count }) : e(n)("page.not-used")), 1)
1022
+ w(p(e(a)("page.save")), 1)
915
1023
  ]),
916
1024
  _: 1
917
- })
918
- ]),
919
- x("div", wl, [
920
- ie.value ? (r(), W(e(G), {
921
- key: 0,
1025
+ }, 8, ["loading"]),
1026
+ u(e(q), {
922
1027
  type: "primary",
923
- dot: ""
924
- }, {
925
- default: c(() => [
926
- $(f(e(n)("page.unsaved")), 1)
927
- ]),
928
- _: 1
929
- })) : E("", !0),
930
- p.value.draft ? (r(), W(e(G), {
931
- key: 1,
932
- type: "warning",
933
- dot: ""
1028
+ loading: f.value,
1029
+ disabled: !d.value.draft && !O.value,
1030
+ onClick: xe
934
1031
  }, {
935
1032
  default: c(() => [
936
- $(f(e(n)("page.draft", { number: p.value.draft.number })), 1)
1033
+ w(p(e(a)("page.publish")), 1)
937
1034
  ]),
938
1035
  _: 1
939
- })) : E("", !0),
940
- p.value.published ? (r(), W(e(G), {
941
- key: 2,
942
- type: "success",
943
- dot: ""
944
- }, {
945
- default: c(() => [
946
- $(f(e(n)("page.live", { number: p.value.published.number })), 1)
947
- ]),
948
- _: 1
949
- })) : (r(), W(e(G), {
950
- key: 3,
951
- type: "default"
952
- }, {
953
- default: c(() => [
954
- $(f(e(n)("page.never-published")), 1)
955
- ]),
956
- _: 1
957
- })),
958
- g.value ? (r(), V(j, { key: 4 }, [
959
- u(e(q), {
960
- variant: "outline",
961
- loading: k.value,
962
- onClick: ue
1036
+ }, 8, ["loading", "disabled"])
1037
+ ], 64)) : L("", !0)
1038
+ ])
1039
+ ]),
1040
+ _.value.editing ? L("", !0) : (i(), W(e(kt), {
1041
+ key: 0,
1042
+ type: "info",
1043
+ variant: "soft",
1044
+ description: e(a)("page.editing-off")
1045
+ }, null, 8, ["description"])),
1046
+ $("div", zl, [
1047
+ $("div", Il, [
1048
+ u(e(Jt), {
1049
+ modelValue: y.value,
1050
+ "onUpdate:modelValue": g[13] || (g[13] = (x) => y.value = x),
1051
+ "keep-alive": ""
1052
+ }, {
1053
+ default: c(() => [
1054
+ u(e(me), {
1055
+ value: "template",
1056
+ label: e(a)("page.tab-template")
963
1057
  }, {
964
1058
  default: c(() => [
965
- $(f(e(n)("page.save")), 1)
1059
+ $("div", Ul, [
1060
+ u(e(Ie), {
1061
+ ref_key: "templateEditor",
1062
+ ref: Z,
1063
+ modelValue: C.template,
1064
+ "onUpdate:modelValue": g[1] || (g[1] = (x) => C.template = x),
1065
+ language: "php",
1066
+ readonly: !S.value,
1067
+ "min-height": "340px",
1068
+ "max-height": "70vh",
1069
+ "line-wrapping": ""
1070
+ }, null, 8, ["modelValue", "readonly"]),
1071
+ Ae.value.length ? (i(), V("div", Nl, [
1072
+ u(e(j), {
1073
+ size: "sm",
1074
+ tone: "muted"
1075
+ }, {
1076
+ default: c(() => [
1077
+ w(p(e(a)("page.insert-field")), 1)
1078
+ ]),
1079
+ _: 1
1080
+ }),
1081
+ (i(!0), V(H, null, te(Ae.value, (x) => (i(), V("button", {
1082
+ key: x,
1083
+ type: "button",
1084
+ class: "wx-block-editor__pill",
1085
+ disabled: !S.value,
1086
+ onClick: (Qn) => Re(x),
1087
+ textContent: p(G(x))
1088
+ }, null, 8, Pl))), 128))
1089
+ ])) : L("", !0),
1090
+ u(st, {
1091
+ file: "template",
1092
+ lints: ee.value,
1093
+ slug: k.slug,
1094
+ error: ze.value
1095
+ }, null, 8, ["lints", "slug", "error"])
1096
+ ])
966
1097
  ]),
967
1098
  _: 1
968
- }, 8, ["loading"]),
969
- u(e(q), {
970
- type: "primary",
971
- loading: b.value,
972
- disabled: !p.value.draft && !ie.value,
973
- onClick: Be
1099
+ }, 8, ["label"]),
1100
+ u(e(me), {
1101
+ value: "styles",
1102
+ label: e(a)("page.tab-styles")
974
1103
  }, {
975
1104
  default: c(() => [
976
- $(f(e(n)("page.publish")), 1)
1105
+ $("div", Ml, [
1106
+ u(e(Ie), {
1107
+ modelValue: C.styles,
1108
+ "onUpdate:modelValue": g[2] || (g[2] = (x) => C.styles = x),
1109
+ language: "css",
1110
+ readonly: !S.value,
1111
+ "min-height": "340px",
1112
+ "max-height": "70vh"
1113
+ }, null, 8, ["modelValue", "readonly"]),
1114
+ u(st, {
1115
+ file: "styles",
1116
+ lints: ee.value,
1117
+ slug: k.slug
1118
+ }, null, 8, ["lints", "slug"])
1119
+ ])
977
1120
  ]),
978
1121
  _: 1
979
- }, 8, ["loading", "disabled"])
980
- ], 64)) : E("", !0)
981
- ])
982
- ]),
983
- y.value.editing ? E("", !0) : (r(), W(e(dt), {
984
- key: 0,
985
- type: "info",
986
- variant: "soft",
987
- description: e(n)("page.editing-off")
988
- }, null, 8, ["description"])),
989
- x("div", _l, [
990
- x("div", xl, [
991
- u(e(Lt), {
992
- modelValue: m.value,
993
- "onUpdate:modelValue": v[13] || (v[13] = (z) => m.value = z),
994
- "keep-alive": ""
995
- }, {
996
- default: c(() => [
997
- u(e(de), {
998
- value: "template",
999
- label: e(n)("page.tab-template")
1000
- }, {
1001
- default: c(() => [
1002
- x("div", $l, [
1003
- u(e(We), {
1004
- ref_key: "templateEditor",
1005
- ref: Te,
1006
- modelValue: w.template,
1007
- "onUpdate:modelValue": v[1] || (v[1] = (z) => w.template = z),
1008
- language: "php",
1009
- readonly: !g.value,
1010
- "min-height": "340px",
1011
- "max-height": "70vh",
1012
- "line-wrapping": ""
1013
- }, null, 8, ["modelValue", "readonly"]),
1014
- Ve.value.length ? (r(), V("div", Vl, [
1015
- u(e(R), {
1016
- size: "sm",
1017
- tone: "muted"
1122
+ }, 8, ["label"]),
1123
+ u(e(me), {
1124
+ value: "script",
1125
+ label: e(a)("page.tab-script")
1126
+ }, {
1127
+ default: c(() => [
1128
+ $("div", Ol, [
1129
+ u(e(Ie), {
1130
+ "model-value": C.script ?? "",
1131
+ language: "javascript",
1132
+ readonly: !S.value,
1133
+ "min-height": "340px",
1134
+ "max-height": "70vh",
1135
+ "onUpdate:modelValue": g[3] || (g[3] = (x) => C.script = x || null)
1136
+ }, null, 8, ["model-value", "readonly"]),
1137
+ $("div", Dl, [
1138
+ u(e(j), {
1139
+ size: "sm",
1140
+ tone: "muted"
1141
+ }, {
1142
+ default: c(() => [
1143
+ w(p(e(a)("page.script-help")), 1)
1144
+ ]),
1145
+ _: 1
1146
+ }),
1147
+ u(e(j), {
1148
+ size: "sm",
1149
+ tone: "muted"
1150
+ }, {
1151
+ default: c(() => [
1152
+ w(p(_.value.provides.length ? e(a)("page.provides", { names: _.value.provides.join(", ") }) : e(a)("page.provides-none")), 1)
1153
+ ]),
1154
+ _: 1
1155
+ })
1156
+ ])
1157
+ ])
1158
+ ]),
1159
+ _: 1
1160
+ }, 8, ["label"]),
1161
+ u(e(me), {
1162
+ value: "fields",
1163
+ label: e(a)("page.tab-fields")
1164
+ }, {
1165
+ default: c(() => [
1166
+ $("div", Rl, [
1167
+ u(e(Ie), {
1168
+ "model-value": D.value,
1169
+ language: "json",
1170
+ lint: "",
1171
+ readonly: !S.value,
1172
+ "min-height": "340px",
1173
+ "max-height": "70vh",
1174
+ "onUpdate:modelValue": Le
1175
+ }, null, 8, ["model-value", "readonly"]),
1176
+ $("div", jl, [
1177
+ K.value ? (i(), W(e(j), {
1178
+ key: 0,
1179
+ size: "sm",
1180
+ tone: "danger"
1181
+ }, {
1182
+ default: c(() => [
1183
+ w(p(K.value), 1)
1184
+ ]),
1185
+ _: 1
1186
+ })) : ae("content.schema") ? (i(), W(e(j), {
1187
+ key: 1,
1188
+ size: "sm",
1189
+ tone: "danger"
1190
+ }, {
1191
+ default: c(() => [
1192
+ w(p(ae("content.schema")), 1)
1193
+ ]),
1194
+ _: 1
1195
+ })) : (i(), W(e(j), {
1196
+ key: 2,
1197
+ size: "sm",
1198
+ tone: "muted"
1199
+ }, {
1200
+ default: c(() => [
1201
+ w(p(e(a)("page.fields-help")), 1)
1202
+ ]),
1203
+ _: 1
1204
+ })),
1205
+ u(e(Ht), {
1206
+ title: e(a)("help.schema-title"),
1207
+ body: e(a)("help.schema")
1208
+ }, null, 8, ["title", "body"])
1209
+ ])
1210
+ ])
1211
+ ]),
1212
+ _: 1
1213
+ }, 8, ["label"]),
1214
+ u(e(me), {
1215
+ value: "settings",
1216
+ label: e(a)("page.tab-settings")
1217
+ }, {
1218
+ default: c(() => [
1219
+ u(e(ve), { class: "wx-block-editor__sheet" }, {
1220
+ default: c(() => [
1221
+ $("div", Hl, [
1222
+ u(e(Y), {
1223
+ label: e(a)("page.identifier"),
1224
+ help: e(a)("page.identifier-help"),
1225
+ error: ae("slug"),
1226
+ disabled: !S.value
1018
1227
  }, {
1019
1228
  default: c(() => [
1020
- $(f(e(n)("page.insert-field")), 1)
1229
+ u(e(ge), {
1230
+ modelValue: k.slug,
1231
+ "onUpdate:modelValue": g[4] || (g[4] = (x) => k.slug = x)
1232
+ }, null, 8, ["modelValue"])
1021
1233
  ]),
1022
1234
  _: 1
1023
- }),
1024
- (r(!0), V(j, null, Y(Ve.value, (z) => (r(), V("button", {
1025
- key: z,
1026
- type: "button",
1027
- class: "wx-block-editor__pill",
1028
- disabled: !g.value,
1029
- onClick: (Pn) => Ce(z),
1030
- textContent: f(ge(z))
1031
- }, null, 8, Sl))), 128))
1032
- ])) : E("", !0),
1033
- u(et, {
1034
- file: "template",
1035
- lints: $e.value,
1036
- slug: d.slug,
1037
- error: Bt.value
1038
- }, null, 8, ["lints", "slug", "error"])
1039
- ])
1040
- ]),
1041
- _: 1
1042
- }, 8, ["label"]),
1043
- u(e(de), {
1044
- value: "styles",
1045
- label: e(n)("page.tab-styles")
1046
- }, {
1047
- default: c(() => [
1048
- x("div", Tl, [
1049
- u(e(We), {
1050
- modelValue: w.styles,
1051
- "onUpdate:modelValue": v[2] || (v[2] = (z) => w.styles = z),
1052
- language: "css",
1053
- readonly: !g.value,
1054
- "min-height": "340px",
1055
- "max-height": "70vh"
1056
- }, null, 8, ["modelValue", "readonly"]),
1057
- u(et, {
1058
- file: "styles",
1059
- lints: $e.value,
1060
- slug: d.slug
1061
- }, null, 8, ["lints", "slug"])
1062
- ])
1063
- ]),
1064
- _: 1
1065
- }, 8, ["label"]),
1066
- u(e(de), {
1067
- value: "script",
1068
- label: e(n)("page.tab-script")
1069
- }, {
1070
- default: c(() => [
1071
- x("div", Cl, [
1072
- u(e(We), {
1073
- "model-value": w.script ?? "",
1074
- language: "javascript",
1075
- readonly: !g.value,
1076
- "min-height": "340px",
1077
- "max-height": "70vh",
1078
- "onUpdate:modelValue": v[3] || (v[3] = (z) => w.script = z || null)
1079
- }, null, 8, ["model-value", "readonly"]),
1080
- x("div", Bl, [
1081
- u(e(R), {
1082
- size: "sm",
1083
- tone: "muted"
1235
+ }, 8, ["label", "help", "error", "disabled"]),
1236
+ u(e(Y), {
1237
+ label: e(a)("page.group"),
1238
+ help: e(a)("page.group-help"),
1239
+ error: ae("group"),
1240
+ disabled: !S.value
1084
1241
  }, {
1085
1242
  default: c(() => [
1086
- $(f(e(n)("page.script-help")), 1)
1243
+ u(e(yt), {
1244
+ modelValue: k.group,
1245
+ "onUpdate:modelValue": g[5] || (g[5] = (x) => k.group = x),
1246
+ options: de.value
1247
+ }, null, 8, ["modelValue", "options"])
1087
1248
  ]),
1088
1249
  _: 1
1089
- }),
1090
- u(e(R), {
1091
- size: "sm",
1092
- tone: "muted"
1250
+ }, 8, ["label", "help", "error", "disabled"]),
1251
+ u(e(Y), {
1252
+ class: "is-wide",
1253
+ label: e(a)("page.description"),
1254
+ help: e(a)("page.description-help"),
1255
+ error: ae("description"),
1256
+ disabled: !S.value
1093
1257
  }, {
1094
1258
  default: c(() => [
1095
- $(f(y.value.provides.length ? e(n)("page.provides", { names: y.value.provides.join(", ") }) : e(n)("page.provides-none")), 1)
1259
+ u(e(Kt), {
1260
+ "model-value": k.description ?? "",
1261
+ rows: 2,
1262
+ "onUpdate:modelValue": g[6] || (g[6] = (x) => k.description = String(x ?? ""))
1263
+ }, null, 8, ["model-value"])
1096
1264
  ]),
1097
1265
  _: 1
1098
- })
1099
- ])
1100
- ])
1101
- ]),
1102
- _: 1
1103
- }, 8, ["label"]),
1104
- u(e(de), {
1105
- value: "fields",
1106
- label: e(n)("page.tab-fields")
1107
- }, {
1108
- default: c(() => [
1109
- x("div", Wl, [
1110
- u(e(We), {
1111
- "model-value": B.value,
1112
- language: "json",
1113
- lint: "",
1114
- readonly: !g.value,
1115
- "min-height": "340px",
1116
- "max-height": "70vh",
1117
- "onUpdate:modelValue": A
1118
- }, null, 8, ["model-value", "readonly"]),
1119
- x("div", Al, [
1120
- M.value ? (r(), W(e(R), {
1121
- key: 0,
1122
- size: "sm",
1123
- tone: "danger"
1266
+ }, 8, ["label", "help", "error", "disabled"]),
1267
+ u(e(Y), {
1268
+ label: e(a)("page.icon"),
1269
+ error: ae("icon"),
1270
+ disabled: !S.value
1124
1271
  }, {
1125
1272
  default: c(() => [
1126
- $(f(M.value), 1)
1273
+ u(e(ge), {
1274
+ "model-value": k.icon ?? "",
1275
+ placeholder: "grid",
1276
+ "onUpdate:modelValue": g[7] || (g[7] = (x) => k.icon = String(x ?? ""))
1277
+ }, null, 8, ["model-value"])
1127
1278
  ]),
1128
1279
  _: 1
1129
- })) : te("content.schema") ? (r(), W(e(R), {
1130
- key: 1,
1131
- size: "sm",
1132
- tone: "danger"
1280
+ }, 8, ["label", "error", "disabled"]),
1281
+ u(e(Y), {
1282
+ label: e(a)("page.sort"),
1283
+ help: e(a)("page.sort-help"),
1284
+ error: ae("sort"),
1285
+ disabled: !S.value
1133
1286
  }, {
1134
1287
  default: c(() => [
1135
- $(f(te("content.schema")), 1)
1288
+ u(e(nt), {
1289
+ modelValue: k.sort,
1290
+ "onUpdate:modelValue": g[8] || (g[8] = (x) => k.sort = x)
1291
+ }, null, 8, ["modelValue"])
1136
1292
  ]),
1137
1293
  _: 1
1138
- })) : (r(), W(e(R), {
1139
- key: 2,
1140
- size: "sm",
1141
- tone: "muted"
1294
+ }, 8, ["label", "help", "error", "disabled"]),
1295
+ u(e(Y), {
1296
+ label: e(a)("page.allow"),
1297
+ help: e(a)("page.allow-help"),
1298
+ error: ae("allow"),
1299
+ disabled: !S.value
1142
1300
  }, {
1143
1301
  default: c(() => [
1144
- $(f(e(n)("page.fields-help")), 1)
1302
+ u(e(at), {
1303
+ modelValue: k.allow,
1304
+ "onUpdate:modelValue": g[9] || (g[9] = (x) => k.allow = x),
1305
+ "allow-create": ""
1306
+ }, null, 8, ["modelValue"])
1145
1307
  ]),
1146
1308
  _: 1
1147
- }))
1148
- ])
1149
- ])
1150
- ]),
1151
- _: 1
1152
- }, 8, ["label"]),
1153
- u(e(de), {
1154
- value: "settings",
1155
- label: e(n)("page.tab-settings")
1156
- }, {
1157
- default: c(() => [
1158
- u(e(ce), { class: "wx-block-editor__sheet" }, {
1159
- default: c(() => [
1160
- x("div", zl, [
1161
- u(e(J), {
1162
- label: e(n)("page.identifier"),
1163
- help: e(n)("page.identifier-help"),
1164
- error: te("slug"),
1165
- disabled: !g.value
1166
- }, {
1167
- default: c(() => [
1168
- u(e(ve), {
1169
- modelValue: d.slug,
1170
- "onUpdate:modelValue": v[4] || (v[4] = (z) => d.slug = z)
1171
- }, null, 8, ["modelValue"])
1172
- ]),
1173
- _: 1
1174
- }, 8, ["label", "help", "error", "disabled"]),
1175
- u(e(J), {
1176
- label: e(n)("page.group"),
1177
- help: e(n)("page.group-help"),
1178
- error: te("group"),
1179
- disabled: !g.value
1180
- }, {
1181
- default: c(() => [
1182
- u(e(pt), {
1183
- modelValue: d.group,
1184
- "onUpdate:modelValue": v[5] || (v[5] = (z) => d.group = z),
1185
- options: Ue.value
1186
- }, null, 8, ["modelValue", "options"])
1187
- ]),
1188
- _: 1
1189
- }, 8, ["label", "help", "error", "disabled"]),
1190
- u(e(J), {
1191
- class: "is-wide",
1192
- label: e(n)("page.description"),
1193
- help: e(n)("page.description-help"),
1194
- error: te("description"),
1195
- disabled: !g.value
1196
- }, {
1197
- default: c(() => [
1198
- u(e(Mt), {
1199
- "model-value": d.description ?? "",
1200
- rows: 2,
1201
- "onUpdate:modelValue": v[6] || (v[6] = (z) => d.description = String(z ?? ""))
1202
- }, null, 8, ["model-value"])
1203
- ]),
1204
- _: 1
1205
- }, 8, ["label", "help", "error", "disabled"]),
1206
- u(e(J), {
1207
- label: e(n)("page.icon"),
1208
- error: te("icon"),
1209
- disabled: !g.value
1210
- }, {
1211
- default: c(() => [
1212
- u(e(ve), {
1213
- "model-value": d.icon ?? "",
1214
- placeholder: "grid",
1215
- "onUpdate:modelValue": v[7] || (v[7] = (z) => d.icon = String(z ?? ""))
1216
- }, null, 8, ["model-value"])
1217
- ]),
1218
- _: 1
1219
- }, 8, ["label", "error", "disabled"]),
1220
- u(e(J), {
1221
- label: e(n)("page.sort"),
1222
- help: e(n)("page.sort-help"),
1223
- error: te("sort"),
1224
- disabled: !g.value
1225
- }, {
1226
- default: c(() => [
1227
- u(e(Ye), {
1228
- modelValue: d.sort,
1229
- "onUpdate:modelValue": v[8] || (v[8] = (z) => d.sort = z)
1230
- }, null, 8, ["modelValue"])
1231
- ]),
1232
- _: 1
1233
- }, 8, ["label", "help", "error", "disabled"]),
1234
- u(e(J), {
1235
- label: e(n)("page.allow"),
1236
- help: e(n)("page.allow-help"),
1237
- error: te("allow"),
1238
- disabled: !g.value
1239
- }, {
1240
- default: c(() => [
1241
- u(e(Qe), {
1242
- modelValue: d.allow,
1243
- "onUpdate:modelValue": v[9] || (v[9] = (z) => d.allow = z),
1244
- "allow-create": ""
1245
- }, null, 8, ["modelValue"])
1246
- ]),
1247
- _: 1
1248
- }, 8, ["label", "help", "error", "disabled"]),
1249
- u(e(J), {
1250
- label: e(n)("page.allowed-in"),
1251
- help: e(n)("page.allowed-in-help"),
1252
- error: te("allowed_in"),
1253
- disabled: !g.value
1254
- }, {
1255
- default: c(() => [
1256
- u(e(Qe), {
1257
- modelValue: d.allowed_in,
1258
- "onUpdate:modelValue": v[10] || (v[10] = (z) => d.allowed_in = z),
1259
- "allow-create": "",
1260
- suggestions: ["root"]
1261
- }, null, 8, ["modelValue"])
1262
- ]),
1263
- _: 1
1264
- }, 8, ["label", "help", "error", "disabled"]),
1265
- u(e(J), {
1266
- label: e(n)("page.max-per-entity"),
1267
- help: e(n)("page.max-per-entity-help"),
1268
- error: te("max_per_entity"),
1269
- disabled: !g.value
1309
+ }, 8, ["label", "help", "error", "disabled"]),
1310
+ u(e(Y), {
1311
+ label: e(a)("page.allowed-in"),
1312
+ help: e(a)("page.allowed-in-help"),
1313
+ error: ae("allowed_in"),
1314
+ disabled: !S.value
1315
+ }, {
1316
+ default: c(() => [
1317
+ u(e(at), {
1318
+ modelValue: k.allowed_in,
1319
+ "onUpdate:modelValue": g[10] || (g[10] = (x) => k.allowed_in = x),
1320
+ "allow-create": "",
1321
+ suggestions: ["root"]
1322
+ }, null, 8, ["modelValue"])
1323
+ ]),
1324
+ _: 1
1325
+ }, 8, ["label", "help", "error", "disabled"]),
1326
+ u(e(Y), {
1327
+ label: e(a)("page.max-per-entity"),
1328
+ help: e(a)("page.max-per-entity-help"),
1329
+ error: ae("max_per_entity"),
1330
+ disabled: !S.value
1331
+ }, {
1332
+ default: c(() => [
1333
+ u(e(nt), {
1334
+ "model-value": k.max_per_entity ?? void 0,
1335
+ min: 1,
1336
+ "onUpdate:modelValue": g[11] || (g[11] = (x) => k.max_per_entity = x ?? null)
1337
+ }, null, 8, ["model-value"])
1338
+ ]),
1339
+ _: 1
1340
+ }, 8, ["label", "help", "error", "disabled"]),
1341
+ u(e(Y), {
1342
+ label: e(a)("page.enabled"),
1343
+ help: e(a)("page.enabled-help"),
1344
+ disabled: !S.value
1345
+ }, {
1346
+ default: c(() => [
1347
+ u(e(Zt), {
1348
+ modelValue: k.is_enabled,
1349
+ "onUpdate:modelValue": g[12] || (g[12] = (x) => k.is_enabled = x)
1350
+ }, null, 8, ["modelValue"])
1351
+ ]),
1352
+ _: 1
1353
+ }, 8, ["label", "help", "disabled"]),
1354
+ S.value ? (i(), V("div", Fl, [
1355
+ u(e(q), {
1356
+ type: "danger",
1357
+ variant: "outline",
1358
+ disabled: d.value.usage_count > 0,
1359
+ onClick: $e
1270
1360
  }, {
1271
1361
  default: c(() => [
1272
- u(e(Ye), {
1273
- "model-value": d.max_per_entity ?? void 0,
1274
- min: 1,
1275
- "onUpdate:modelValue": v[11] || (v[11] = (z) => d.max_per_entity = z ?? null)
1276
- }, null, 8, ["model-value"])
1362
+ w(p(e(a)("page.delete")), 1)
1277
1363
  ]),
1278
1364
  _: 1
1279
- }, 8, ["label", "help", "error", "disabled"]),
1280
- u(e(J), {
1281
- label: e(n)("page.enabled"),
1282
- help: e(n)("page.enabled-help"),
1283
- disabled: !g.value
1365
+ }, 8, ["disabled"]),
1366
+ d.value.usage_count > 0 ? (i(), W(e(j), {
1367
+ key: 0,
1368
+ size: "sm",
1369
+ tone: "muted"
1284
1370
  }, {
1285
1371
  default: c(() => [
1286
- u(e(Pt), {
1287
- modelValue: d.is_enabled,
1288
- "onUpdate:modelValue": v[12] || (v[12] = (z) => d.is_enabled = z)
1289
- }, null, 8, ["modelValue"])
1372
+ w(p(e(a)("page.delete-used", { count: d.value.usage_count })), 1)
1290
1373
  ]),
1291
1374
  _: 1
1292
- }, 8, ["label", "help", "disabled"]),
1293
- g.value ? (r(), V("div", El, [
1294
- u(e(q), {
1295
- type: "danger",
1296
- variant: "outline",
1297
- disabled: p.value.usage_count > 0,
1298
- onClick: Ie
1299
- }, {
1300
- default: c(() => [
1301
- $(f(e(n)("page.delete")), 1)
1302
- ]),
1303
- _: 1
1304
- }, 8, ["disabled"]),
1305
- p.value.usage_count > 0 ? (r(), W(e(R), {
1306
- key: 0,
1307
- size: "sm",
1308
- tone: "muted"
1309
- }, {
1310
- default: c(() => [
1311
- $(f(e(n)("page.delete-used", { count: p.value.usage_count })), 1)
1312
- ]),
1313
- _: 1
1314
- })) : E("", !0)
1315
- ])) : E("", !0)
1316
- ])
1317
- ]),
1318
- _: 1
1319
- })
1320
- ]),
1321
- _: 1
1322
- }, 8, ["label"]),
1323
- u(e(de), {
1324
- value: "history",
1325
- label: e(n)("page.tab-history")
1326
- }, {
1327
- default: c(() => [
1328
- u(e(ce), {
1329
- class: "wx-block-editor__sheet",
1330
- padding: "none"
1331
- }, {
1332
- default: c(() => [
1333
- u(Gt, {
1334
- block: p.value,
1335
- "can-manage": g.value,
1336
- onRestored: se
1337
- }, null, 8, ["block", "can-manage"])
1338
- ]),
1339
- _: 1
1340
- })
1341
- ]),
1342
- _: 1
1343
- }, 8, ["label"])
1344
- ]),
1345
- _: 1
1346
- }, 8, ["modelValue"])
1347
- ]),
1348
- x("div", Ul, [
1349
- u(al, {
1350
- html: H.html,
1351
- styles: H.styles,
1352
- script: H.script,
1353
- runtime: H.runtime,
1354
- loading: H.loading
1355
- }, null, 8, ["html", "styles", "script", "runtime", "loading"]),
1356
- u(e(ce), {
1357
- title: e(n)("page.sample")
1358
- }, {
1359
- default: c(() => [
1360
- w.schema.length ? (r(), W(e(bt), {
1361
- key: 0,
1362
- modelValue: be.value,
1363
- "onUpdate:modelValue": v[14] || (v[14] = (z) => be.value = z),
1364
- root: e(Je)(w.schema),
1365
- types: e(a).types,
1366
- translate: e(a).i18n.t,
1367
- can: e(a).can,
1368
- disabled: !g.value,
1369
- size: "sm"
1370
- }, null, 8, ["modelValue", "root", "types", "translate", "can", "disabled"])) : E("", !0),
1371
- u(e(R), {
1372
- size: "sm",
1373
- tone: "muted"
1374
- }, {
1375
- default: c(() => [
1376
- $(f(e(n)("page.sample-help")), 1)
1377
- ]),
1378
- _: 1
1379
- })
1380
- ]),
1381
- _: 1
1382
- }, 8, ["title"]),
1383
- u(e(ce), {
1384
- title: e(n)("page.usage")
1385
- }, {
1386
- default: c(() => [
1387
- S.value.length === 0 ? (r(), W(e(R), {
1375
+ })) : L("", !0)
1376
+ ])) : L("", !0)
1377
+ ])
1378
+ ]),
1379
+ _: 1
1380
+ })
1381
+ ]),
1382
+ _: 1
1383
+ }, 8, ["label"]),
1384
+ u(e(me), {
1385
+ value: "history",
1386
+ label: e(a)("page.tab-history")
1387
+ }, {
1388
+ default: c(() => [
1389
+ u(e(ve), {
1390
+ class: "wx-block-editor__sheet",
1391
+ padding: "none"
1392
+ }, {
1393
+ default: c(() => [
1394
+ u(ol, {
1395
+ block: d.value,
1396
+ "can-manage": S.value,
1397
+ onRestored: pe
1398
+ }, null, 8, ["block", "can-manage"])
1399
+ ]),
1400
+ _: 1
1401
+ })
1402
+ ]),
1403
+ _: 1
1404
+ }, 8, ["label"])
1405
+ ]),
1406
+ _: 1
1407
+ }, 8, ["modelValue"])
1408
+ ]),
1409
+ $("div", ql, [
1410
+ u(fl, {
1411
+ html: I.html,
1412
+ styles: I.styles,
1413
+ script: I.script,
1414
+ runtime: I.runtime,
1415
+ loading: I.loading
1416
+ }, null, 8, ["html", "styles", "script", "runtime", "loading"]),
1417
+ u(e(ve), {
1418
+ title: e(a)("page.sample")
1419
+ }, {
1420
+ default: c(() => [
1421
+ C.schema.length ? (i(), W(e(Vt), {
1422
+ key: 0,
1423
+ modelValue: We.value,
1424
+ "onUpdate:modelValue": g[14] || (g[14] = (x) => We.value = x),
1425
+ root: e(Xe)(C.schema),
1426
+ types: e(s).types,
1427
+ translate: e(s).i18n.t,
1428
+ can: e(s).can,
1429
+ disabled: !S.value,
1430
+ size: "sm"
1431
+ }, null, 8, ["modelValue", "root", "types", "translate", "can", "disabled"])) : L("", !0),
1432
+ u(e(j), {
1433
+ size: "sm",
1434
+ tone: "muted"
1435
+ }, {
1436
+ default: c(() => [
1437
+ w(p(e(a)("page.sample-help")), 1)
1438
+ ]),
1439
+ _: 1
1440
+ })
1441
+ ]),
1442
+ _: 1
1443
+ }, 8, ["title"]),
1444
+ u(e(ve), {
1445
+ title: e(a)("page.usage")
1446
+ }, {
1447
+ default: c(() => [
1448
+ b.value.length === 0 ? (i(), W(e(j), {
1449
+ key: 0,
1450
+ size: "sm",
1451
+ tone: "muted"
1452
+ }, {
1453
+ default: c(() => [
1454
+ w(p(e(a)("page.usage-empty")), 1)
1455
+ ]),
1456
+ _: 1
1457
+ })) : (i(), V("div", Jl, [
1458
+ (i(!0), V(H, null, te(Ve.value, (x) => (i(), V("div", {
1459
+ key: `${x.model}:${x.id}`,
1460
+ class: "wx-block-editor__use"
1461
+ }, [
1462
+ $("span", null, p(x.title ?? `#${x.id}`), 1),
1463
+ x.published ? L("", !0) : (i(), W(e(J), {
1464
+ key: 0,
1465
+ type: "warning",
1466
+ size: "sm"
1467
+ }, {
1468
+ default: c(() => [
1469
+ w(p(e(a)("page.unpublished-page")), 1)
1470
+ ]),
1471
+ _: 1
1472
+ }))
1473
+ ]))), 128)),
1474
+ b.value.length > Ve.value.length ? (i(), W(e(j), {
1388
1475
  key: 0,
1389
1476
  size: "sm",
1390
1477
  tone: "muted"
1391
1478
  }, {
1392
1479
  default: c(() => [
1393
- $(f(e(n)("page.usage-empty")), 1)
1480
+ w(p(e(a)("page.usage-more", { count: b.value.length - Ve.value.length })), 1)
1394
1481
  ]),
1395
1482
  _: 1
1396
- })) : (r(), V("div", Il, [
1397
- (r(!0), V(j, null, Y(Ne.value, (z) => (r(), V("div", {
1398
- key: `${z.model}:${z.id}`,
1399
- class: "wx-block-editor__use"
1400
- }, [
1401
- x("span", null, f(z.title ?? `#${z.id}`), 1),
1402
- z.published ? E("", !0) : (r(), W(e(G), {
1403
- key: 0,
1404
- type: "warning",
1405
- size: "sm"
1406
- }, {
1407
- default: c(() => [
1408
- $(f(e(n)("page.unpublished-page")), 1)
1409
- ]),
1410
- _: 1
1411
- }))
1412
- ]))), 128)),
1413
- S.value.length > Ne.value.length ? (r(), W(e(R), {
1414
- key: 0,
1415
- size: "sm",
1416
- tone: "muted"
1417
- }, {
1418
- default: c(() => [
1419
- $(f(e(n)("page.usage-more", { count: S.value.length - Ne.value.length })), 1)
1420
- ]),
1421
- _: 1
1422
- })) : E("", !0)
1423
- ]))
1424
- ]),
1425
- _: 1
1426
- }, 8, ["title"])
1427
- ])
1483
+ })) : L("", !0)
1484
+ ]))
1485
+ ]),
1486
+ _: 1
1487
+ }, 8, ["title"])
1428
1488
  ])
1429
- ], 64))
1430
- ]);
1431
- };
1489
+ ]),
1490
+ S.value ? (i(), W(e(Gt), { key: 1 }, {
1491
+ state: c(() => [
1492
+ O.value ? (i(), W(e(J), {
1493
+ key: 0,
1494
+ type: "primary",
1495
+ dot: ""
1496
+ }, {
1497
+ default: c(() => [
1498
+ w(p(e(a)("page.unsaved")), 1)
1499
+ ]),
1500
+ _: 1
1501
+ })) : L("", !0),
1502
+ d.value.draft ? (i(), W(e(J), {
1503
+ key: 1,
1504
+ type: "warning",
1505
+ dot: ""
1506
+ }, {
1507
+ default: c(() => [
1508
+ w(p(e(a)("page.draft", { number: d.value.draft.number })), 1)
1509
+ ]),
1510
+ _: 1
1511
+ })) : L("", !0),
1512
+ d.value.published ? (i(), W(e(J), {
1513
+ key: 2,
1514
+ type: "success",
1515
+ dot: ""
1516
+ }, {
1517
+ default: c(() => [
1518
+ w(p(e(a)("page.live", { number: d.value.published.number })), 1)
1519
+ ]),
1520
+ _: 1
1521
+ })) : L("", !0)
1522
+ ]),
1523
+ default: c(() => [
1524
+ u(e(q), {
1525
+ variant: "outline",
1526
+ loading: h.value,
1527
+ onClick: ue
1528
+ }, {
1529
+ default: c(() => [
1530
+ w(p(e(a)("page.save")), 1)
1531
+ ]),
1532
+ _: 1
1533
+ }, 8, ["loading"]),
1534
+ u(e(q), {
1535
+ type: "primary",
1536
+ loading: f.value,
1537
+ disabled: !d.value.draft && !O.value,
1538
+ onClick: xe
1539
+ }, {
1540
+ default: c(() => [
1541
+ w(p(e(a)("page.publish")), 1)
1542
+ ]),
1543
+ _: 1
1544
+ }, 8, ["loading", "disabled"])
1545
+ ]),
1546
+ _: 1
1547
+ })) : L("", !0)
1548
+ ], 64))
1549
+ ]));
1432
1550
  }
1433
- }), Ll = /* @__PURE__ */ Z(Nl, [["__scopeId", "data-v-70d6f765"]]), Ml = ["srcdoc"], Pl = {
1551
+ }), Zl = /* @__PURE__ */ X(Kl, [["__scopeId", "data-v-ae45e358"]]), Gl = ["srcdoc"], Yl = {
1434
1552
  key: 1,
1435
1553
  class: "wx-block-thumb__empty"
1436
- }, Dl = /* @__PURE__ */ K({
1554
+ }, Ql = /* @__PURE__ */ Q({
1437
1555
  __name: "BlockThumb",
1438
1556
  props: {
1439
1557
  thumbnail: {},
@@ -1441,36 +1559,36 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
1441
1559
  height: { default: 120 }
1442
1560
  },
1443
1561
  setup(t) {
1444
- const l = t, a = U(null), s = He(a), o = C(() => s.value > 0 ? s.value / l.width : 0.2), i = C(
1445
- () => l.thumbnail ? kt({ html: l.thumbnail.html, styles: l.thumbnail.styles }) : ""
1446
- ), n = C(() => ({
1562
+ const l = t, s = U(null), n = Ge(s), o = B(() => n.value > 0 ? n.value / l.width : 0.2), r = B(
1563
+ () => l.thumbnail ? Ct({ html: l.thumbnail.html, styles: l.thumbnail.styles }) : ""
1564
+ ), a = B(() => ({
1447
1565
  width: `${l.width}px`,
1448
1566
  height: `${Math.round(l.height / o.value)}px`,
1449
1567
  transform: `scale(${o.value})`
1450
1568
  }));
1451
- return (h, p) => (r(), V("div", {
1569
+ return (v, A) => (i(), V("div", {
1452
1570
  ref_key: "box",
1453
- ref: a,
1571
+ ref: s,
1454
1572
  class: "wx-block-thumb",
1455
- style: fe({ height: `${t.height}px` })
1573
+ style: ce({ height: `${t.height}px` })
1456
1574
  }, [
1457
- t.thumbnail ? (r(), V("iframe", {
1575
+ t.thumbnail ? (i(), V("iframe", {
1458
1576
  key: 0,
1459
1577
  class: "wx-block-thumb__frame",
1460
- srcdoc: i.value,
1461
- style: fe(n.value),
1578
+ srcdoc: r.value,
1579
+ style: ce(a.value),
1462
1580
  sandbox: "allow-same-origin",
1463
1581
  tabindex: "-1",
1464
1582
  "aria-hidden": "true"
1465
- }, null, 12, Ml)) : (r(), V("div", Pl, [
1466
- u(e(ne), { name: "grid" })
1583
+ }, null, 12, Gl)) : (i(), V("div", Yl, [
1584
+ u(e(oe), { name: "grid" })
1467
1585
  ]))
1468
1586
  ], 4));
1469
1587
  }
1470
- }), Ct = /* @__PURE__ */ Z(Dl, [["__scopeId", "data-v-615b818a"]]), Ol = { class: "wx-block-picker" }, Rl = {
1588
+ }), It = /* @__PURE__ */ X(Ql, [["__scopeId", "data-v-615b818a"]]), Xl = { class: "wx-block-picker" }, en = {
1471
1589
  key: 0,
1472
1590
  class: "wx-block-picker__group-title"
1473
- }, jl = { class: "wx-block-picker__cards" }, Hl = ["disabled", "title", "onClick"], Fl = { class: "wx-block-picker__body" }, ql = { class: "wx-block-picker__title" }, Jl = /* @__PURE__ */ K({
1591
+ }, tn = { class: "wx-block-picker__cards" }, ln = ["disabled", "title", "onClick"], nn = { class: "wx-block-picker__body" }, an = { class: "wx-block-picker__title" }, sn = /* @__PURE__ */ Q({
1474
1592
  __name: "BlockPicker",
1475
1593
  props: {
1476
1594
  catalog: {},
@@ -1481,134 +1599,134 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
1481
1599
  blocksPath: { default: null }
1482
1600
  },
1483
1601
  setup(t) {
1484
- const l = t, { resolve: a, dismiss: s, open: o } = ft();
1485
- _e();
1486
- const i = Q("webx-blocks"), n = U("");
1487
- function h(b) {
1602
+ const l = t, { resolve: s, dismiss: n, open: o } = wt();
1603
+ Ee();
1604
+ const r = le("webx-blocks"), a = U("");
1605
+ function v(h) {
1488
1606
  if (l.parent === null)
1489
- return b.allowed_in === null || b.allowed_in.includes("root");
1490
- const m = l.allow ? l.allow.includes(b.slug) : l.parent.allow?.includes(b.slug) === !0, y = b.allowed_in === null || b.allowed_in.includes(l.parent.slug);
1491
- return m && y;
1607
+ return h.allowed_in === null || h.allowed_in.includes("root");
1608
+ const f = l.allow ? l.allow.includes(h.slug) : l.parent.allow?.includes(h.slug) === !0, y = h.allowed_in === null || h.allowed_in.includes(l.parent.slug);
1609
+ return f && y;
1492
1610
  }
1493
- const p = C(
1494
- () => l.catalog.filter((b) => b.is_enabled && b.published !== null && h(b)).map((b) => {
1495
- const m = ol(l.tree, b.slug), y = b.max_per_entity !== null && m >= b.max_per_entity;
1496
- return { type: b, reason: y ? i("field.limit-reached", { count: m }) : null };
1611
+ const A = B(
1612
+ () => l.catalog.filter((h) => h.is_enabled && h.published !== null && v(h)).map((h) => {
1613
+ const f = ml(l.tree, h.slug), y = h.max_per_entity !== null && f >= h.max_per_entity;
1614
+ return { type: h, reason: y ? r("field.limit-reached", { count: f }) : null };
1497
1615
  })
1498
- ), S = C(() => {
1499
- const b = n.value.trim().toLowerCase();
1500
- return b === "" ? p.value : p.value.filter(
1501
- ({ type: m }) => m.title.toLowerCase().includes(b) || m.slug.includes(b) || (m.description ?? "").toLowerCase().includes(b)
1616
+ ), d = B(() => {
1617
+ const h = a.value.trim().toLowerCase();
1618
+ return h === "" ? A.value : A.value.filter(
1619
+ ({ type: f }) => f.title.toLowerCase().includes(h) || f.slug.includes(h) || (f.description ?? "").toLowerCase().includes(h)
1502
1620
  );
1503
- }), _ = C(() => {
1504
- const b = [...l.groups];
1505
- for (const { type: g } of S.value)
1506
- b.includes(g.group) || b.push(g.group);
1507
- const m = b.map((g) => ({
1508
- id: g,
1509
- label: ke(g, i),
1510
- options: S.value.filter((d) => d.type.group === g)
1511
- })).filter((g) => g.options.length > 0);
1512
- return S.value.length <= 5 || n.value.trim() !== "" || m.length < 2 ? [{ id: "", label: "", options: S.value }] : m;
1513
- }), k = C(() => {
1514
- if (l.catalog.length === 0) return i("field.pick-none");
1515
- if (p.value.length === 0 && l.parent) {
1516
- const b = (l.allow ?? l.parent.allow ?? []).filter(
1517
- (m) => l.catalog.some((y) => y.slug === m)
1621
+ }), b = B(() => {
1622
+ const h = [...l.groups];
1623
+ for (const { type: _ } of d.value)
1624
+ h.includes(_.group) || h.push(_.group);
1625
+ const f = h.map((_) => ({
1626
+ id: _,
1627
+ label: ye(_, r),
1628
+ options: d.value.filter((S) => S.type.group === _)
1629
+ })).filter((_) => _.options.length > 0);
1630
+ return d.value.length <= 5 || a.value.trim() !== "" || f.length < 2 ? [{ id: "", label: "", options: d.value }] : f;
1631
+ }), m = B(() => {
1632
+ if (l.catalog.length === 0) return r("field.pick-none");
1633
+ if (A.value.length === 0 && l.parent) {
1634
+ const h = (l.allow ?? l.parent.allow ?? []).filter(
1635
+ (f) => l.catalog.some((y) => y.slug === f)
1518
1636
  );
1519
- return b.length === 0 ? i("field.pick-nothing-allowed", { parent: l.parent.title }) : i("field.pick-limited", { parent: l.parent.title, types: b.join(", ") });
1637
+ return h.length === 0 ? r("field.pick-nothing-allowed", { parent: l.parent.title }) : r("field.pick-limited", { parent: l.parent.title, types: h.join(", ") });
1520
1638
  }
1521
- return i("field.pick-empty");
1639
+ return r("field.pick-empty");
1522
1640
  });
1523
- return (b, m) => {
1524
- const y = je("router-link");
1525
- return r(), W(e(mt), {
1641
+ return (h, f) => {
1642
+ const y = vt("router-link");
1643
+ return i(), W(e(_t), {
1526
1644
  open: e(o),
1527
- "onUpdate:open": m[2] || (m[2] = (g) => it(o) ? o.value = g : null),
1528
- title: e(i)("field.pick"),
1645
+ "onUpdate:open": f[2] || (f[2] = (_) => mt(o) ? o.value = _ : null),
1646
+ title: e(r)("field.pick"),
1529
1647
  width: 860
1530
1648
  }, {
1531
1649
  footer: c(() => [
1532
1650
  u(e(q), {
1533
1651
  variant: "outline",
1534
- onClick: m[1] || (m[1] = (g) => e(s)())
1652
+ onClick: f[1] || (f[1] = (_) => e(n)())
1535
1653
  }, {
1536
1654
  default: c(() => [
1537
- $(f(e(i)("field.close")), 1)
1655
+ w(p(e(r)("field.close")), 1)
1538
1656
  ]),
1539
1657
  _: 1
1540
1658
  })
1541
1659
  ]),
1542
1660
  default: c(() => [
1543
- x("div", Ol, [
1544
- p.value.length > 0 ? (r(), W(e(ve), {
1661
+ $("div", Xl, [
1662
+ A.value.length > 0 ? (i(), W(e(ge), {
1545
1663
  key: 0,
1546
- modelValue: n.value,
1547
- "onUpdate:modelValue": m[0] || (m[0] = (g) => n.value = g),
1548
- placeholder: e(i)("field.search"),
1664
+ modelValue: a.value,
1665
+ "onUpdate:modelValue": f[0] || (f[0] = (_) => a.value = _),
1666
+ placeholder: e(r)("field.search"),
1549
1667
  clearable: "",
1550
1668
  autofocus: ""
1551
- }, null, 8, ["modelValue", "placeholder"])) : E("", !0),
1552
- S.value.length === 0 ? (r(), W(e(vt), {
1669
+ }, null, 8, ["modelValue", "placeholder"])) : L("", !0),
1670
+ d.value.length === 0 ? (i(), W(e(xt), {
1553
1671
  key: 1,
1554
1672
  icon: "grid",
1555
- title: k.value,
1673
+ title: m.value,
1556
1674
  size: "sm"
1557
1675
  }, {
1558
1676
  default: c(() => [
1559
- t.catalog.length === 0 && t.blocksPath ? (r(), W(y, {
1677
+ t.catalog.length === 0 && t.blocksPath ? (i(), W(y, {
1560
1678
  key: 0,
1561
1679
  to: t.blocksPath
1562
1680
  }, {
1563
1681
  default: c(() => [
1564
- $(f(e(i)("field.pick-none-link")), 1)
1682
+ w(p(e(r)("field.pick-none-link")), 1)
1565
1683
  ]),
1566
1684
  _: 1
1567
- }, 8, ["to"])) : E("", !0)
1685
+ }, 8, ["to"])) : L("", !0)
1568
1686
  ]),
1569
1687
  _: 1
1570
- }, 8, ["title"])) : E("", !0),
1571
- (r(!0), V(j, null, Y(_.value, (g) => (r(), V("section", {
1572
- key: g.id,
1688
+ }, 8, ["title"])) : L("", !0),
1689
+ (i(!0), V(H, null, te(b.value, (_) => (i(), V("section", {
1690
+ key: _.id,
1573
1691
  class: "wx-block-picker__group"
1574
1692
  }, [
1575
- g.label ? (r(), V("div", Rl, f(g.label), 1)) : E("", !0),
1576
- x("div", jl, [
1577
- (r(!0), V(j, null, Y(g.options, (d) => (r(), V("button", {
1578
- key: d.type.id,
1693
+ _.label ? (i(), V("div", en, p(_.label), 1)) : L("", !0),
1694
+ $("div", tn, [
1695
+ (i(!0), V(H, null, te(_.options, (S) => (i(), V("button", {
1696
+ key: S.type.id,
1579
1697
  type: "button",
1580
- class: me(["wx-block-picker__card", { "is-disabled": d.reason !== null }]),
1581
- disabled: d.reason !== null,
1582
- title: d.reason ?? void 0,
1583
- onClick: (w) => e(a)(d.type)
1698
+ class: be(["wx-block-picker__card", { "is-disabled": S.reason !== null }]),
1699
+ disabled: S.reason !== null,
1700
+ title: S.reason ?? void 0,
1701
+ onClick: (k) => e(s)(S.type)
1584
1702
  }, [
1585
- u(Ct, {
1586
- thumbnail: d.type.thumbnail,
1703
+ u(It, {
1704
+ thumbnail: S.type.thumbnail,
1587
1705
  height: 96
1588
1706
  }, null, 8, ["thumbnail"]),
1589
- x("div", Fl, [
1590
- x("div", ql, f(d.type.title), 1),
1591
- d.reason ? (r(), W(e(R), {
1707
+ $("div", nn, [
1708
+ $("div", an, p(S.type.title), 1),
1709
+ S.reason ? (i(), W(e(j), {
1592
1710
  key: 0,
1593
1711
  size: "sm",
1594
1712
  tone: "warning"
1595
1713
  }, {
1596
1714
  default: c(() => [
1597
- $(f(d.reason), 1)
1715
+ w(p(S.reason), 1)
1598
1716
  ]),
1599
1717
  _: 2
1600
- }, 1024)) : d.type.description ? (r(), W(e(R), {
1718
+ }, 1024)) : S.type.description ? (i(), W(e(j), {
1601
1719
  key: 1,
1602
1720
  size: "sm",
1603
1721
  tone: "muted"
1604
1722
  }, {
1605
1723
  default: c(() => [
1606
- $(f(d.type.description), 1)
1724
+ w(p(S.type.description), 1)
1607
1725
  ]),
1608
1726
  _: 2
1609
- }, 1024)) : E("", !0)
1727
+ }, 1024)) : L("", !0)
1610
1728
  ])
1611
- ], 10, Hl))), 128))
1729
+ ], 10, ln))), 128))
1612
1730
  ])
1613
1731
  ]))), 128))
1614
1732
  ])
@@ -1617,7 +1735,7 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
1617
1735
  }, 8, ["open", "title"]);
1618
1736
  };
1619
1737
  }
1620
- }), Kl = /* @__PURE__ */ Z(Jl, [["__scopeId", "data-v-99f4090e"]]), Zl = { class: "wx-blocks-preview__bar" }, Gl = { class: "wx-blocks-preview__tools" }, Yl = ["src", "title"], Ql = /* @__PURE__ */ K({
1738
+ }), on = /* @__PURE__ */ X(sn, [["__scopeId", "data-v-99f4090e"]]), rn = { class: "wx-blocks-preview__bar" }, un = { class: "wx-blocks-preview__tools" }, cn = ["src", "title"], dn = /* @__PURE__ */ Q({
1621
1739
  __name: "BlocksPreview",
1622
1740
  props: {
1623
1741
  url: {},
@@ -1626,81 +1744,93 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
1626
1744
  reload: { default: 0 },
1627
1745
  fill: { type: Boolean, default: !1 }
1628
1746
  },
1629
- setup(t, { expose: l }) {
1630
- const a = t, s = Q("webx-blocks"), o = U(null), i = U(null), n = He(i), h = U(!1), p = U(1280), S = U(!1), _ = C(() => [
1631
- { value: 1280, label: s("field.width-desktop") },
1632
- { value: 834, label: s("field.width-tablet") },
1633
- { value: 390, label: s("field.width-phone") }
1634
- ]), k = C(
1635
- () => h.value ? p.value : a.mode === "phone" ? 390 : 1280
1636
- ), b = C(() => h.value || a.mode === "phone" || n.value === 0 ? 1 : Math.min(1, n.value / k.value)), m = C(() => ({
1637
- width: `${k.value}px`,
1638
- transform: `scale(${b.value})`
1639
- })), y = C(() => {
1640
- if (!a.url) return "";
1747
+ emits: ["select"],
1748
+ setup(t, { expose: l, emit: s }) {
1749
+ const n = t, o = s, r = le("webx-blocks"), a = U(null), v = U(null), A = Ge(v), d = U(!1), b = U(1280), m = U(!1), h = B(() => [
1750
+ { value: 1280, label: r("field.width-desktop") },
1751
+ { value: 834, label: r("field.width-tablet") },
1752
+ { value: 390, label: r("field.width-phone") }
1753
+ ]), f = B(
1754
+ () => d.value ? b.value : n.mode === "phone" ? 390 : 1280
1755
+ ), y = B(() => d.value || n.mode === "phone" || A.value === 0 ? 1 : Math.min(1, A.value / f.value)), _ = B(() => ({
1756
+ width: `${f.value}px`,
1757
+ transform: `scale(${y.value})`
1758
+ })), S = B(() => {
1759
+ if (!n.url) return "";
1641
1760
  try {
1642
- return `${new URL(a.url, location.origin).pathname} · ${k.value} px`;
1761
+ return `${new URL(n.url, location.origin).pathname} · ${f.value} px`;
1643
1762
  } catch {
1644
- return a.url;
1763
+ return n.url;
1645
1764
  }
1646
1765
  });
1647
- function g() {
1766
+ function k() {
1648
1767
  try {
1649
- return o.value?.contentDocument ?? null;
1768
+ return a.value?.contentDocument ?? null;
1650
1769
  } catch {
1651
1770
  return null;
1652
1771
  }
1653
1772
  }
1654
- function d() {
1655
- S.value = !0;
1656
- const N = g();
1657
- N && De(N, a.selected ?? null);
1773
+ let C = null, D = !1;
1774
+ function K() {
1775
+ m.value = !0;
1776
+ const M = k();
1777
+ M && (C?.release(), C = rl(M, {
1778
+ select: (O) => {
1779
+ D = !0, o("select", O), D = !1;
1780
+ }
1781
+ }), Je(M, n.selected ?? null), ne(M, n.selected ?? null));
1782
+ }
1783
+ function ne(M, O) {
1784
+ O === null || D || Ye(M, O)?.scrollIntoView({ behavior: "smooth", block: "center" });
1658
1785
  }
1659
- function w(N, I) {
1660
- const P = g();
1661
- if (!P || !S.value) return !1;
1662
- const H = Yt(P, N, I);
1663
- return H && De(P, a.selected ?? null), H;
1786
+ function z(M, O) {
1787
+ const ee = k();
1788
+ if (!ee || !m.value) return !1;
1789
+ const de = il(ee, M, O);
1790
+ return de && Je(ee, n.selected ?? null), de;
1664
1791
  }
1665
- function B() {
1666
- S.value = !1, o.value && a.url && (o.value.src = a.url);
1792
+ function N() {
1793
+ m.value = !1, a.value && n.url && (a.value.src = n.url);
1667
1794
  }
1668
- function M(N) {
1669
- N.key === "Escape" && h.value && (h.value = !1, N.stopPropagation());
1795
+ function I(M) {
1796
+ M.key === "Escape" && d.value && (d.value = !1, M.stopPropagation());
1670
1797
  }
1671
- return le(
1672
- () => a.selected,
1673
- (N) => {
1674
- const I = g();
1675
- I && S.value && De(I, N ?? null);
1798
+ return ie(
1799
+ () => n.selected,
1800
+ (M) => {
1801
+ const O = k();
1802
+ !O || !m.value || (Je(O, M ?? null), ne(O, M ?? null));
1676
1803
  }
1677
- ), le(() => a.reload, B), le(
1678
- () => a.url,
1679
- () => S.value = !1
1680
- ), ye(() => window.addEventListener("keydown", M)), Re(() => window.removeEventListener("keydown", M)), l({ replace: w, refresh: B, open: () => h.value = !0 }), (N, I) => (r(), V("div", {
1681
- class: me(["wx-blocks-preview", { "is-fullscreen": h.value, "is-phone": t.mode === "phone", "is-fill": t.fill }])
1804
+ ), ie(() => n.reload, N), ie(
1805
+ () => n.url,
1806
+ () => m.value = !1
1807
+ ), Ce(() => window.addEventListener("keydown", I)), Ze(() => {
1808
+ window.removeEventListener("keydown", I), C?.release();
1809
+ }), l({ replace: z, refresh: N, open: () => d.value = !0 }), (M, O) => (i(), V("div", {
1810
+ class: be(["wx-blocks-preview", { "is-fullscreen": d.value, "is-phone": t.mode === "phone", "is-fill": t.fill }]),
1811
+ style: ce({ "--wx-preview-scale": y.value })
1682
1812
  }, [
1683
- x("div", Zl, [
1684
- u(e(R), {
1813
+ $("div", rn, [
1814
+ u(e(j), {
1685
1815
  size: "xs",
1686
1816
  tone: "muted",
1687
1817
  class: "wx-blocks-preview__label",
1688
1818
  truncate: ""
1689
1819
  }, {
1690
1820
  default: c(() => [
1691
- $(f(y.value), 1)
1821
+ w(p(S.value), 1)
1692
1822
  ]),
1693
1823
  _: 1
1694
1824
  }),
1695
- x("div", Gl, [
1696
- h.value ? (r(), W(e(ct), {
1825
+ $("div", un, [
1826
+ d.value ? (i(), W(e(gt), {
1697
1827
  key: 0,
1698
- modelValue: p.value,
1699
- "onUpdate:modelValue": I[0] || (I[0] = (P) => p.value = P),
1700
- options: _.value,
1828
+ modelValue: b.value,
1829
+ "onUpdate:modelValue": O[0] || (O[0] = (ee) => b.value = ee),
1830
+ options: h.value,
1701
1831
  size: "sm"
1702
- }, null, 8, ["modelValue", "options"])) : E("", !0),
1703
- t.url ? (r(), W(e(q), {
1832
+ }, null, 8, ["modelValue", "options"])) : L("", !0),
1833
+ t.url ? (i(), W(e(q), {
1704
1834
  key: 1,
1705
1835
  size: "sm",
1706
1836
  variant: "outline",
@@ -1709,46 +1839,46 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
1709
1839
  rel: "noopener"
1710
1840
  }, {
1711
1841
  default: c(() => [
1712
- $(f(e(s)("field.open-site")), 1)
1842
+ w(p(e(r)("field.open-site")), 1)
1713
1843
  ]),
1714
1844
  _: 1
1715
- }, 8, ["href"])) : E("", !0),
1845
+ }, 8, ["href"])) : L("", !0),
1716
1846
  u(e(q), {
1717
1847
  size: "sm",
1718
1848
  variant: "outline",
1719
- onClick: I[1] || (I[1] = (P) => h.value = !h.value)
1849
+ onClick: O[1] || (O[1] = (ee) => d.value = !d.value)
1720
1850
  }, {
1721
1851
  default: c(() => [
1722
- $(f(h.value ? e(s)("field.close") : e(s)("field.fullscreen")), 1)
1852
+ w(p(d.value ? e(r)("field.close") : e(r)("field.fullscreen")), 1)
1723
1853
  ]),
1724
1854
  _: 1
1725
1855
  })
1726
1856
  ])
1727
1857
  ]),
1728
- x("div", {
1858
+ $("div", {
1729
1859
  ref_key: "box",
1730
- ref: i,
1860
+ ref: v,
1731
1861
  class: "wx-blocks-preview__ground"
1732
1862
  }, [
1733
- x("div", {
1863
+ $("div", {
1734
1864
  class: "wx-blocks-preview__clip",
1735
- style: fe({ width: `${Math.round(k.value * b.value)}px` })
1865
+ style: ce({ width: `${Math.round(f.value * y.value)}px` })
1736
1866
  }, [
1737
- t.url ? (r(), V("iframe", {
1867
+ t.url ? (i(), V("iframe", {
1738
1868
  key: 0,
1739
1869
  ref_key: "frame",
1740
- ref: o,
1870
+ ref: a,
1741
1871
  class: "wx-blocks-preview__frame",
1742
1872
  src: t.url,
1743
- style: fe(m.value),
1744
- title: e(s)("field.preview"),
1745
- onLoad: d
1746
- }, null, 44, Yl)) : E("", !0)
1873
+ style: ce(_.value),
1874
+ title: e(r)("field.preview"),
1875
+ onLoad: K
1876
+ }, null, 44, cn)) : L("", !0)
1747
1877
  ], 4)
1748
1878
  ], 512)
1749
- ], 2));
1879
+ ], 6));
1750
1880
  }
1751
- }), Xl = /* @__PURE__ */ Z(Ql, [["__scopeId", "data-v-2482da45"]]), en = { class: "wx-blocks-tree__node" }, tn = ["onClick", "onKeydown"], ln = { class: "wx-blocks-tree__icon" }, nn = { class: "wx-blocks-tree__name" }, an = ["title"], sn = ["title"], on = ["title"], rn = ["onClick"], un = /* @__PURE__ */ K({
1881
+ }), pn = /* @__PURE__ */ X(dn, [["__scopeId", "data-v-0b137d74"]]), fn = { class: "wx-blocks-tree__node" }, vn = ["onClick", "onKeydown"], mn = { class: "wx-blocks-tree__icon" }, hn = { class: "wx-blocks-tree__name" }, bn = ["title"], gn = ["title"], kn = ["title"], yn = ["title"], wn = ["onClick"], _n = /* @__PURE__ */ Q({
1752
1882
  __name: "BlocksTree",
1753
1883
  props: {
1754
1884
  nodes: {},
@@ -1759,126 +1889,140 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
1759
1889
  disabled: { type: Boolean, default: !1 },
1760
1890
  depth: { default: 0 }
1761
1891
  },
1762
- emits: ["select", "add", "remove", "duplicate", "reorder"],
1892
+ emits: ["select", "add", "remove", "duplicate", "visibility", "reorder"],
1763
1893
  setup(t, { emit: l }) {
1764
- const a = t, s = l, o = Q("webx-blocks");
1765
- function i(_) {
1766
- return a.catalog.find((k) => k.slug === _.type) ?? null;
1894
+ const s = t, n = l, o = le("webx-blocks");
1895
+ function r(b) {
1896
+ return s.catalog.find((m) => m.slug === b.type) ?? null;
1767
1897
  }
1768
- function n(_) {
1769
- return i(_)?.title ?? _.type;
1898
+ function a(b) {
1899
+ return r(b)?.title ?? b.type;
1770
1900
  }
1771
- function h(_) {
1772
- const k = i(_);
1773
- return k?.content ? xt(k.content.schema) : [];
1901
+ function v(b) {
1902
+ const m = r(b);
1903
+ return m?.content ? Et(m.content.schema) : [];
1774
1904
  }
1775
- function p(_, k) {
1776
- const b = _.values[k.id];
1777
- return Array.isArray(b) ? b : [];
1905
+ function A(b, m) {
1906
+ const h = b.values[m.id];
1907
+ return Array.isArray(h) ? h : [];
1778
1908
  }
1779
- function S(_) {
1780
- return i(_)?.icon ?? "grid";
1909
+ function d(b) {
1910
+ return r(b)?.icon ?? "grid";
1781
1911
  }
1782
- return (_, k) => {
1783
- const b = je("blocks-tree", !0);
1784
- return r(), W(e(Dt), {
1912
+ return (b, m) => {
1913
+ const h = vt("blocks-tree", !0);
1914
+ return i(), W(e(Yt), {
1785
1915
  "model-value": t.nodes,
1786
1916
  "item-key": "key",
1787
- "item-label": (m) => n(m),
1917
+ "item-label": (f) => a(f),
1788
1918
  disabled: t.disabled,
1789
1919
  plain: "",
1790
1920
  size: "sm",
1791
1921
  "empty-text": t.depth === 0 ? e(o)("field.empty") : "",
1792
- class: me(["wx-blocks-tree", { "is-nested": t.depth > 0 }]),
1793
- "onUpdate:modelValue": k[6] || (k[6] = (m) => s("reorder", t.parentKey, t.field, m))
1922
+ class: be(["wx-blocks-tree", { "is-nested": t.depth > 0 }]),
1923
+ "onUpdate:modelValue": m[7] || (m[7] = (f) => n("reorder", t.parentKey, t.field, f))
1794
1924
  }, {
1795
- default: c(({ item: m }) => [
1796
- x("div", en, [
1797
- x("div", {
1798
- class: me(["wx-blocks-tree__row", { "is-selected": t.selected === m.key }]),
1925
+ default: c(({ item: f }) => [
1926
+ $("div", fn, [
1927
+ $("div", {
1928
+ class: be(["wx-blocks-tree__row", { "is-selected": t.selected === f.key, "is-hidden": f.hidden === !0 }]),
1799
1929
  role: "button",
1800
1930
  tabindex: "0",
1801
- onClick: (y) => s("select", m.key),
1931
+ onClick: (y) => n("select", f.key),
1802
1932
  onKeydown: [
1803
- Ge(Me((y) => s("select", m.key), ["prevent"]), ["enter"]),
1804
- Ge(Me((y) => s("select", m.key), ["prevent"]), ["space"])
1933
+ lt(He((y) => n("select", f.key), ["prevent"]), ["enter"]),
1934
+ lt(He((y) => n("select", f.key), ["prevent"]), ["space"])
1805
1935
  ]
1806
1936
  }, [
1807
- x("span", ln, [
1808
- u(e(ne), {
1809
- name: S(m)
1937
+ $("span", mn, [
1938
+ u(e(oe), {
1939
+ name: d(f)
1810
1940
  }, null, 8, ["name"])
1811
1941
  ]),
1812
- x("span", nn, f(n(m)), 1),
1813
- i(m) ? i(m)?.draft ? (r(), V("span", {
1942
+ $("span", hn, p(a(f)), 1),
1943
+ r(f) ? r(f)?.draft ? (i(), V("span", {
1814
1944
  key: 1,
1815
1945
  class: "wx-blocks-tree__flag is-warning",
1816
1946
  title: e(o)("field.draft-type")
1817
1947
  }, [
1818
- u(e(ne), { name: "warning" })
1819
- ], 8, sn)) : i(m)?.is_enabled === !1 ? (r(), V("span", {
1948
+ u(e(oe), { name: "warning" })
1949
+ ], 8, gn)) : r(f)?.is_enabled === !1 ? (i(), V("span", {
1820
1950
  key: 2,
1821
1951
  class: "wx-blocks-tree__flag",
1822
1952
  title: e(o)("field.disabled-type")
1823
1953
  }, [
1824
- u(e(ne), { name: "eye-off" })
1825
- ], 8, on)) : E("", !0) : (r(), V("span", {
1954
+ u(e(oe), { name: "lock" })
1955
+ ], 8, kn)) : L("", !0) : (i(), V("span", {
1826
1956
  key: 0,
1827
1957
  class: "wx-blocks-tree__flag is-danger",
1828
- title: e(o)("field.unknown-type", { type: m.type })
1958
+ title: e(o)("field.unknown-type", { type: f.type })
1829
1959
  }, [
1830
- u(e(ne), { name: "close-circle" })
1831
- ], 8, an)),
1832
- t.disabled ? E("", !0) : (r(), V("span", {
1960
+ u(e(oe), { name: "close-circle" })
1961
+ ], 8, bn)),
1962
+ f.hidden === !0 ? (i(), V("span", {
1833
1963
  key: 3,
1964
+ class: "wx-blocks-tree__flag",
1965
+ title: e(o)("field.hidden-note")
1966
+ }, [
1967
+ u(e(oe), { name: "eye-off" })
1968
+ ], 8, yn)) : L("", !0),
1969
+ t.disabled ? L("", !0) : (i(), V("span", {
1970
+ key: 4,
1834
1971
  class: "wx-blocks-tree__actions",
1835
- onClick: k[0] || (k[0] = Me(() => {
1972
+ onClick: m[0] || (m[0] = He(() => {
1836
1973
  }, ["stop"]))
1837
1974
  }, [
1838
- u(e(Xe), {
1975
+ u(e(Fe), {
1976
+ icon: f.hidden === !0 ? "eye-off" : "eye",
1977
+ size: "sm",
1978
+ title: f.hidden === !0 ? e(o)("field.show") : e(o)("field.hide"),
1979
+ onClick: (y) => n("visibility", f.key, f.hidden !== !0)
1980
+ }, null, 8, ["icon", "title", "onClick"]),
1981
+ u(e(Fe), {
1839
1982
  icon: "copy",
1840
1983
  size: "sm",
1841
1984
  title: e(o)("field.duplicate"),
1842
- onClick: (y) => s("duplicate", m.key)
1985
+ onClick: (y) => n("duplicate", f.key)
1843
1986
  }, null, 8, ["title", "onClick"]),
1844
- u(e(Xe), {
1987
+ u(e(Fe), {
1845
1988
  icon: "trash",
1846
1989
  size: "sm",
1847
1990
  tone: "danger",
1848
1991
  title: e(o)("field.remove"),
1849
- onClick: (y) => s("remove", m.key)
1992
+ onClick: (y) => n("remove", f.key)
1850
1993
  }, null, 8, ["title", "onClick"])
1851
1994
  ]))
1852
- ], 42, tn),
1853
- (r(!0), V(j, null, Y(h(m), (y) => (r(), V("div", {
1995
+ ], 42, vn),
1996
+ (i(!0), V(H, null, te(v(f), (y) => (i(), V("div", {
1854
1997
  key: y.id,
1855
1998
  class: "wx-blocks-tree__kids"
1856
1999
  }, [
1857
- u(b, {
1858
- nodes: p(m, y),
2000
+ u(h, {
2001
+ nodes: A(f, y),
1859
2002
  catalog: t.catalog,
1860
- "parent-key": m.key,
2003
+ "parent-key": f.key,
1861
2004
  field: y.id,
1862
2005
  selected: t.selected,
1863
2006
  disabled: t.disabled,
1864
2007
  depth: t.depth + 1,
1865
- onSelect: k[1] || (k[1] = (g) => s("select", g)),
1866
- onAdd: k[2] || (k[2] = (g, d, w) => s("add", g, d, w)),
1867
- onRemove: k[3] || (k[3] = (g) => s("remove", g)),
1868
- onDuplicate: k[4] || (k[4] = (g) => s("duplicate", g)),
1869
- onReorder: k[5] || (k[5] = (g, d, w) => s("reorder", g, d, w))
2008
+ onSelect: m[1] || (m[1] = (_) => n("select", _)),
2009
+ onAdd: m[2] || (m[2] = (_, S, k) => n("add", _, S, k)),
2010
+ onRemove: m[3] || (m[3] = (_) => n("remove", _)),
2011
+ onDuplicate: m[4] || (m[4] = (_) => n("duplicate", _)),
2012
+ onVisibility: m[5] || (m[5] = (_, S) => n("visibility", _, S)),
2013
+ onReorder: m[6] || (m[6] = (_, S, k) => n("reorder", _, S, k))
1870
2014
  }, null, 8, ["nodes", "catalog", "parent-key", "field", "selected", "disabled", "depth"]),
1871
- t.disabled ? E("", !0) : (r(), V("button", {
2015
+ t.disabled ? L("", !0) : (i(), V("button", {
1872
2016
  key: 0,
1873
2017
  type: "button",
1874
2018
  class: "wx-blocks-tree__add is-inner",
1875
- onClick: (g) => s("add", m.key, y.id, y)
2019
+ onClick: (_) => n("add", f.key, y.id, y)
1876
2020
  }, [
1877
- $(" + " + f(e(o)("field.add-inside")), 1),
1878
- h(m).length > 1 ? (r(), V(j, { key: 0 }, [
1879
- $(" · " + f(y.label ?? y.id), 1)
1880
- ], 64)) : E("", !0)
1881
- ], 8, rn))
2021
+ w(" + " + p(e(o)("field.add-inside")), 1),
2022
+ v(f).length > 1 ? (i(), V(H, { key: 0 }, [
2023
+ w(" · " + p(y.label ?? y.id), 1)
2024
+ ], 64)) : L("", !0)
2025
+ ], 8, wn))
1882
2026
  ]))), 128))
1883
2027
  ])
1884
2028
  ]),
@@ -1886,27 +2030,27 @@ const hl = { class: "wx-block-editor" }, bl = { class: "wx-block-editor__columns
1886
2030
  }, 8, ["model-value", "item-label", "disabled", "empty-text", "class"]);
1887
2031
  };
1888
2032
  }
1889
- }), cn = /* @__PURE__ */ Z(un, [["__scopeId", "data-v-5d559d85"]]), Ke = /* @__PURE__ */ Symbol("wx-blocks-preview");
1890
- function qn(t) {
1891
- rt(Ke, t);
2033
+ }), xn = /* @__PURE__ */ X(_n, [["__scopeId", "data-v-4fe464bb"]]), et = /* @__PURE__ */ Symbol("wx-blocks-preview");
2034
+ function sa(t) {
2035
+ ht(et, t);
1892
2036
  }
1893
- function Jn() {
1894
- return ze(Ke, null);
2037
+ function oa() {
2038
+ return Ne(et, null);
1895
2039
  }
1896
- const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
2040
+ const ft = /* @__PURE__ */ Symbol("wx-blocks-root"), $n = {
1897
2041
  key: 0,
1898
2042
  class: "wx-blocks-nested"
1899
- }, pn = { class: "wx-blocks__tree" }, fn = { class: "wx-blocks__panel-head" }, mn = { class: "wx-blocks__panel-title" }, vn = {
2043
+ }, Vn = { class: "wx-blocks__tree" }, Sn = { class: "wx-blocks__panel-head" }, Cn = { class: "wx-blocks__panel-title" }, Tn = { class: "wx-blocks__tools" }, Bn = {
1900
2044
  key: 0,
1901
2045
  class: "wx-blocks__fields"
1902
- }, hn = { class: "wx-blocks__panel-head" }, bn = { class: "wx-blocks__panel-title" }, gn = { class: "wx-blocks__panel-extra" }, kn = { class: "wx-blocks__form" }, yn = {
2046
+ }, En = { class: "wx-blocks__panel-head" }, Wn = { class: "wx-blocks__panel-title" }, An = { class: "wx-blocks__panel-extra" }, Ln = { class: "wx-blocks__form" }, zn = {
1903
2047
  key: 1,
1904
2048
  class: "wx-blocks__preview"
1905
- }, wn = /* @__PURE__ */ K({
2049
+ }, In = /* @__PURE__ */ Q({
1906
2050
  name: "WxBlocks",
1907
2051
  inheritAttrs: !1,
1908
2052
  __name: "BlocksField",
1909
- props: /* @__PURE__ */ Ut({
2053
+ props: /* @__PURE__ */ Pt({
1910
2054
  node: { default: void 0 },
1911
2055
  context: { default: void 0 },
1912
2056
  name: { default: void 0 },
@@ -1923,283 +2067,303 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
1923
2067
  }),
1924
2068
  emits: ["update:modelValue"],
1925
2069
  setup(t) {
1926
- const l = t, a = zt(t, "modelValue"), s = ze(ot, !1);
1927
- rt(ot, !0), _e();
1928
- const o = Q("webx-blocks"), i = ze(Nt, null);
1929
- let n = null;
1930
- const h = U([]), p = C(() => l.catalog ?? h.value), S = C(() => Array.isArray(a.value) ? a.value : []), _ = U(null), k = C(() => _.value ? oe(S.value, _.value) : null), b = C(
1931
- () => k.value ? p.value.find((A) => A.slug === k.value?.node.type) ?? null : null
1932
- ), m = ze(Ke, null), y = U(null), g = C(
1933
- () => i?.state.manifest?.modules.find((A) => A.id === "blocks")?.meta?.groups ?? []
1934
- ), d = Et()?.type, w = C(() => l.context?.types ? l.context.types : i?.types ? { ...Pe, ...i.types } : d ? { ...Pe, "wx-blocks": { component: d, kind: "field", nested: !0 } } : Pe), B = C(
1935
- () => l.context?.translate ?? i?.i18n.t ?? ((A) => A)
1936
- ), M = C(() => l.context?.can ?? i?.can ?? (() => !0)), N = ht(Kl);
1937
- function I(A) {
1938
- a.value = A;
2070
+ const l = t, s = Ut(t, "modelValue"), n = Ne(ft, !1);
2071
+ ht(ft, !0), Ee();
2072
+ const o = le("webx-blocks"), r = Be(), a = Ne(Ft, null);
2073
+ let v = null;
2074
+ const A = U([]), d = B(() => l.catalog ?? A.value), b = B(() => Array.isArray(s.value) ? s.value : []), m = U(null), h = B(() => m.value ? se(b.value, m.value) : null), f = B(
2075
+ () => h.value ? d.value.find((T) => T.slug === h.value?.node.type) ?? null : null
2076
+ ), y = Ne(et, null), _ = U(null), S = B(
2077
+ () => a?.state.manifest?.modules.find((T) => T.id === "blocks")?.meta?.groups ?? []
2078
+ ), k = Nt()?.type, C = B(() => l.context?.types ? l.context.types : a?.types ? { ...qe, ...a.types } : k ? { ...qe, "wx-blocks": { component: k, kind: "field", nested: !0 } } : qe), D = B(
2079
+ () => l.context?.translate ?? a?.i18n.t ?? ((T) => T)
2080
+ ), K = B(() => l.context?.can ?? a?.can ?? (() => !0)), ne = $t(on);
2081
+ function z(T) {
2082
+ s.value = T;
1939
2083
  }
1940
- async function P(A, L, D) {
1941
- const X = A ? oe(S.value, A) : null, ee = X ? p.value.find((Ie) => Ie.slug === X.node.type) ?? null : null, Te = A === null ? l.allow : D?.props?.allow ?? null, ge = A === null ? l.max : D?.props?.max ?? null, Ce = A === null ? S.value : X && L ? X.node.values[L] ?? [] : [];
1942
- if (ge != null && Ce.length >= ge) return;
1943
- const ue = await N({
1944
- catalog: p.value,
1945
- parent: ee,
1946
- allow: Te,
1947
- tree: S.value,
1948
- groups: g.value,
2084
+ async function N(T, P, R) {
2085
+ const Z = T ? se(b.value, T) : null, G = Z ? d.value.find((Ve) => Ve.slug === Z.node.type) ?? null : null, Re = T === null ? l.allow : R?.props?.allow ?? null, ue = T === null ? l.max : R?.props?.max ?? null, xe = T === null ? b.value : Z && P ? Z.node.values[P] ?? [] : [];
2086
+ if (ue != null && xe.length >= ue) return;
2087
+ const $e = await ne({
2088
+ catalog: d.value,
2089
+ parent: G,
2090
+ allow: Re,
2091
+ tree: b.value,
2092
+ groups: S.value,
1949
2093
  blocksPath: l.blocksPath
1950
2094
  });
1951
- if (!ue) return;
1952
- const Be = sl(ue.slug, H(ue));
1953
- I(nt(S.value, A, L, Ce.length, Be)), _.value = Be.key;
2095
+ if (!$e) return;
2096
+ const ze = vl($e.slug, I($e));
2097
+ z(ct(b.value, T, P, xe.length, ze)), m.value = ze.key;
2098
+ }
2099
+ function I(T) {
2100
+ const P = T.content?.sample ?? {}, R = {};
2101
+ for (const [Z, G] of Object.entries(P))
2102
+ (!Array.isArray(G) || G.length === 0 || typeof G[0] != "object") && (R[Z] = G);
2103
+ return R;
2104
+ }
2105
+ async function M(T) {
2106
+ const P = se(b.value, T);
2107
+ if (!P) return;
2108
+ const R = hl(P.node);
2109
+ R > 0 && !await Me({
2110
+ title: o("field.remove-title", {
2111
+ title: d.value.find((G) => G.slug === P.node.type)?.title ?? P.node.type
2112
+ }),
2113
+ message: o("field.remove-text", { count: R }),
2114
+ confirmText: o("field.remove"),
2115
+ cancelText: o("page.cancel"),
2116
+ tone: "danger"
2117
+ }) || (m.value === T && (m.value = null), z(kl(b.value, T)));
1954
2118
  }
1955
- function H(A) {
1956
- const L = A.content?.sample ?? {}, D = {};
1957
- for (const [X, ee] of Object.entries(L))
1958
- (!Array.isArray(ee) || ee.length === 0 || typeof ee[0] != "object") && (D[X] = ee);
1959
- return D;
2119
+ function O(T) {
2120
+ const P = se(b.value, T);
2121
+ if (!P) return;
2122
+ const R = Wt(P.node);
2123
+ z(ct(b.value, P.parent?.key ?? null, P.field, P.index + 1, R)), m.value = R.key;
1960
2124
  }
1961
- function xe(A) {
1962
- _.value === A && (_.value = null), I(rl(S.value, A));
2125
+ function ee(T, P) {
2126
+ z(bl(b.value, T, P));
1963
2127
  }
1964
- function ie(A) {
1965
- const L = oe(S.value, A);
1966
- if (!L) return;
1967
- const D = $t(L.node);
1968
- I(nt(S.value, L.parent?.key ?? null, L.field, L.index + 1, D)), _.value = D.key;
2128
+ function de(T, P, R) {
2129
+ z(wl(b.value, T, P, R));
1969
2130
  }
1970
- function $e(A, L, D) {
1971
- I(cl(S.value, A, L, D));
2131
+ function We(T) {
2132
+ m.value = m.value === T ? null : T;
1972
2133
  }
1973
- function Ue(A) {
1974
- _.value = _.value === A ? null : A;
2134
+ function Ae(T) {
2135
+ T === null || !se(b.value, T) || (m.value = T);
1975
2136
  }
1976
- function be() {
1977
- _.value = null;
2137
+ function we() {
2138
+ m.value = null;
1978
2139
  }
1979
- function Ve(A) {
1980
- _.value && I(ul(S.value, _.value, A));
2140
+ function pe(T) {
2141
+ m.value && z(yl(b.value, m.value, T));
1981
2142
  }
1982
- let re;
1983
- le(
1984
- () => k.value?.node.values,
1985
- (A, L) => {
1986
- if (!A || !L || !b.value || !n || !m) return;
1987
- const D = _.value, X = b.value.id;
1988
- clearTimeout(re), re = setTimeout(() => {
1989
- !D || !n || n.render(X, { values: A, key: D }).then((ee) => {
1990
- y.value?.replace(D, ee.html) || y.value?.refresh();
2143
+ let fe;
2144
+ ie(
2145
+ () => h.value?.node.values,
2146
+ (T, P) => {
2147
+ if (!T || !P || !f.value || !v || !y) return;
2148
+ const R = m.value, Z = f.value.id;
2149
+ clearTimeout(fe), fe = setTimeout(() => {
2150
+ !R || !v || v.render(Z, { values: T, key: R }).then((G) => {
2151
+ _.value?.replace(R, G.html) || _.value?.refresh();
1991
2152
  }).catch(() => {
1992
2153
  });
1993
2154
  }, 300);
1994
2155
  },
1995
2156
  { deep: !0 }
1996
2157
  );
1997
- function se(A) {
1998
- A.key === "Escape" && _.value && be();
2158
+ function Le(T) {
2159
+ T.key === "Escape" && m.value && we();
1999
2160
  }
2000
- ye(async () => {
2001
- if (window.addEventListener("keydown", se), l.catalog === null && i) {
2002
- n = he(i);
2161
+ Ce(async () => {
2162
+ if (window.addEventListener("keydown", Le), l.catalog === null && a) {
2163
+ v = ke(a);
2003
2164
  try {
2004
- h.value = await n.catalog();
2005
- } catch (A) {
2006
- F.danger(A.body?.message ?? String(A));
2165
+ A.value = await v.catalog();
2166
+ } catch (T) {
2167
+ F.danger(r(T));
2007
2168
  }
2008
- } else i && (n = he(i));
2009
- }), Re(() => {
2010
- clearTimeout(re), window.removeEventListener("keydown", se);
2169
+ } else a && (v = ke(a));
2170
+ }), Ze(() => {
2171
+ clearTimeout(fe), window.removeEventListener("keydown", Le);
2011
2172
  });
2012
- const Se = C(
2013
- () => b.value?.content ? Je(b.value.content.schema) : []
2173
+ const _e = B(
2174
+ () => f.value?.content ? Xe(f.value.content.schema) : []
2014
2175
  );
2015
- return (A, L) => e(s) ? (r(), V("div", dn, [
2016
- u(e(R), {
2176
+ return (T, P) => e(n) ? (i(), V("div", $n, [
2177
+ u(e(j), {
2017
2178
  size: "sm",
2018
2179
  tone: "muted"
2019
2180
  }, {
2020
2181
  default: c(() => [
2021
- $(f(e(o)("field.nested-note")), 1)
2182
+ w(p(e(o)("field.nested-note")), 1)
2022
2183
  ]),
2023
2184
  _: 1
2024
2185
  })
2025
- ])) : (r(), V("div", {
2186
+ ])) : (i(), V("div", {
2026
2187
  key: 1,
2027
- class: me(["wx-blocks-host", { "is-fill": t.fill }])
2188
+ class: be(["wx-blocks-host", { "is-fill": t.fill }])
2028
2189
  }, [
2029
- x("div", {
2030
- class: me(["wx-blocks", {
2031
- "is-editing": k.value !== null,
2032
- "has-preview": e(m) !== null && e(m).url.value !== null
2190
+ $("div", {
2191
+ class: be(["wx-blocks", {
2192
+ "is-editing": h.value !== null,
2193
+ "has-preview": e(y) !== null && e(y).url.value !== null
2033
2194
  }])
2034
2195
  }, [
2035
- x("div", pn, [
2036
- x("div", fn, [
2037
- x("span", mn, f(e(o)("field.blocks")), 1),
2038
- u(e(R), {
2196
+ $("div", Vn, [
2197
+ $("div", Sn, [
2198
+ $("span", Cn, p(e(o)("field.blocks")), 1),
2199
+ u(e(j), {
2039
2200
  size: "sm",
2040
2201
  tone: "muted"
2041
2202
  }, {
2042
2203
  default: c(() => [
2043
- $(f(S.value.length), 1)
2204
+ w(p(b.value.length), 1)
2044
2205
  ]),
2045
2206
  _: 1
2046
2207
  })
2047
2208
  ]),
2048
- u(cn, {
2049
- nodes: S.value,
2050
- catalog: p.value,
2051
- selected: _.value,
2209
+ u(xn, {
2210
+ nodes: b.value,
2211
+ catalog: d.value,
2212
+ selected: m.value,
2052
2213
  disabled: t.disabled,
2053
- onSelect: Ue,
2054
- onAdd: P,
2055
- onRemove: xe,
2056
- onDuplicate: ie,
2057
- onReorder: $e
2214
+ onSelect: We,
2215
+ onAdd: N,
2216
+ onRemove: M,
2217
+ onDuplicate: O,
2218
+ onVisibility: ee,
2219
+ onReorder: de
2058
2220
  }, null, 8, ["nodes", "catalog", "selected", "disabled"]),
2059
- !t.disabled && (t.max === null || S.value.length < t.max) ? (r(), W(e(q), {
2060
- key: 0,
2061
- variant: "outline",
2062
- block: "",
2063
- icon: "plus",
2064
- class: "wx-blocks__add",
2065
- onClick: L[0] || (L[0] = (D) => P(null, null, null))
2066
- }, {
2067
- default: c(() => [
2068
- $(f(e(o)("field.add")), 1)
2069
- ]),
2070
- _: 1
2071
- })) : E("", !0),
2072
- e(m) && e(m).url.value ? (r(), W(e(q), {
2073
- key: 1,
2074
- variant: "text",
2075
- block: "",
2076
- class: "wx-blocks__preview-button",
2077
- onClick: L[1] || (L[1] = (D) => y.value?.open())
2078
- }, {
2079
- default: c(() => [
2080
- $(f(e(o)("field.preview")), 1)
2081
- ]),
2082
- _: 1
2083
- })) : E("", !0)
2221
+ $("div", Tn, [
2222
+ !t.disabled && (t.max === null || b.value.length < t.max) ? (i(), W(e(q), {
2223
+ key: 0,
2224
+ variant: "outline",
2225
+ icon: "plus",
2226
+ class: "wx-blocks__add",
2227
+ onClick: P[0] || (P[0] = (R) => N(null, null, null))
2228
+ }, {
2229
+ default: c(() => [
2230
+ w(p(e(o)("field.add")), 1)
2231
+ ]),
2232
+ _: 1
2233
+ })) : L("", !0),
2234
+ e(y) && e(y).url.value ? (i(), W(e(q), {
2235
+ key: 1,
2236
+ variant: "outline",
2237
+ icon: "eye",
2238
+ class: "wx-blocks__preview-button",
2239
+ onClick: P[1] || (P[1] = (R) => _.value?.open())
2240
+ }, {
2241
+ default: c(() => [
2242
+ w(p(e(o)("field.preview")), 1)
2243
+ ]),
2244
+ _: 1
2245
+ })) : L("", !0)
2246
+ ])
2084
2247
  ]),
2085
- k.value ? (r(), V("div", vn, [
2086
- x("div", hn, [
2087
- x("span", bn, f(b.value?.title ?? k.value.node.type), 1),
2088
- x("span", gn, [
2089
- x("code", null, f(k.value.node.type), 1),
2248
+ h.value ? (i(), V("div", Bn, [
2249
+ $("div", En, [
2250
+ $("span", Wn, p(f.value?.title ?? h.value.node.type), 1),
2251
+ $("span", An, [
2252
+ $("code", null, p(h.value.node.type), 1),
2090
2253
  u(e(q), {
2091
2254
  size: "sm",
2092
2255
  variant: "outline",
2093
- onClick: be
2256
+ onClick: we
2094
2257
  }, {
2095
2258
  default: c(() => [
2096
- $(f(e(o)("field.done")) + " · Esc", 1)
2259
+ w(p(e(o)("field.done")) + " · Esc", 1)
2097
2260
  ]),
2098
2261
  _: 1
2099
2262
  })
2100
2263
  ])
2101
2264
  ]),
2102
- x("div", kn, [
2103
- b.value?.content ? (r(), W(e(bt), {
2104
- key: k.value.node.key,
2105
- "model-value": k.value.node.values,
2106
- root: Se.value,
2107
- types: w.value,
2108
- translate: B.value,
2109
- can: M.value,
2265
+ $("div", Ln, [
2266
+ f.value?.content ? (i(), W(e(Vt), {
2267
+ key: h.value.node.key,
2268
+ "model-value": h.value.node.values,
2269
+ root: _e.value,
2270
+ types: C.value,
2271
+ translate: D.value,
2272
+ can: K.value,
2110
2273
  disabled: t.disabled,
2111
- "onUpdate:modelValue": Ve
2112
- }, null, 8, ["model-value", "root", "types", "translate", "can", "disabled"])) : (r(), W(e(R), {
2274
+ "onUpdate:modelValue": pe
2275
+ }, null, 8, ["model-value", "root", "types", "translate", "can", "disabled"])) : (i(), W(e(j), {
2113
2276
  key: 1,
2114
2277
  size: "sm",
2115
2278
  tone: "danger"
2116
2279
  }, {
2117
2280
  default: c(() => [
2118
- $(f(e(o)("field.unknown-type", { type: k.value.node.type })), 1)
2281
+ w(p(e(o)("field.unknown-type", { type: h.value.node.type })), 1)
2119
2282
  ]),
2120
2283
  _: 1
2121
2284
  }))
2122
2285
  ])
2123
- ])) : E("", !0),
2124
- e(m) && e(m).url.value ? (r(), V("div", yn, [
2125
- u(Xl, {
2286
+ ])) : L("", !0),
2287
+ e(y) && e(y).url.value ? (i(), V("div", zn, [
2288
+ u(pn, {
2126
2289
  ref_key: "previewEl",
2127
- ref: y,
2128
- url: e(m).url.value,
2129
- selected: _.value,
2130
- mode: k.value ? "phone" : "wide",
2131
- reload: e(m).reload?.value ?? 0,
2132
- fill: t.fill
2290
+ ref: _,
2291
+ url: e(y).url.value,
2292
+ selected: m.value,
2293
+ mode: h.value ? "phone" : "wide",
2294
+ reload: e(y).reload?.value ?? 0,
2295
+ fill: t.fill,
2296
+ onSelect: Ae
2133
2297
  }, null, 8, ["url", "selected", "mode", "reload", "fill"])
2134
- ])) : E("", !0)
2298
+ ])) : L("", !0)
2135
2299
  ], 2)
2136
2300
  ], 2));
2137
2301
  }
2138
- }), _n = /* @__PURE__ */ Z(wn, [["__scopeId", "data-v-3f14c6c6"]]), xn = { class: "wx-block-card__body" }, $n = { class: "wx-block-card__title" }, Vn = { class: "wx-block-card__chips" }, Sn = /* @__PURE__ */ K({
2302
+ }), Un = /* @__PURE__ */ X(In, [["__scopeId", "data-v-40ee98fe"]]), Nn = { class: "wx-block-card__body" }, Pn = { class: "wx-block-card__title" }, Mn = { class: "wx-block-card__chips" }, On = /* @__PURE__ */ Q({
2139
2303
  __name: "BlockCard",
2140
2304
  props: {
2141
2305
  block: {}
2142
2306
  },
2143
2307
  emits: ["open"],
2144
2308
  setup(t, { emit: l }) {
2145
- const a = l, s = Q("webx-blocks");
2146
- return (o, i) => (r(), V("button", {
2309
+ const s = l, n = le("webx-blocks");
2310
+ return (o, r) => (i(), V("button", {
2147
2311
  type: "button",
2148
2312
  class: "wx-block-card",
2149
- onClick: i[0] || (i[0] = (n) => a("open", t.block))
2313
+ onClick: r[0] || (r[0] = (a) => s("open", t.block))
2150
2314
  }, [
2151
- u(Ct, {
2315
+ u(It, {
2152
2316
  thumbnail: t.block.thumbnail,
2153
2317
  height: 120
2154
2318
  }, null, 8, ["thumbnail"]),
2155
- x("div", xn, [
2156
- x("div", $n, f(t.block.title), 1),
2157
- u(e(R), {
2319
+ $("div", Nn, [
2320
+ $("div", Pn, p(t.block.title), 1),
2321
+ u(e(j), {
2158
2322
  size: "sm",
2159
2323
  tone: "muted"
2160
2324
  }, {
2161
2325
  default: c(() => [
2162
- x("code", null, f(t.block.slug), 1),
2163
- $(" · " + f(t.block.usage_count > 0 ? e(s)("page.on-pages", { count: t.block.usage_count }) : e(s)("page.not-used")), 1)
2326
+ $("code", null, p(t.block.slug), 1),
2327
+ w(" · " + p(t.block.usage_count > 0 ? e(n)("page.on-pages", { count: t.block.usage_count }) : e(n)("page.not-used")), 1)
2164
2328
  ]),
2165
2329
  _: 1
2166
2330
  }),
2167
- x("div", Vn, [
2168
- t.block.draft ? (r(), W(e(G), {
2331
+ $("div", Mn, [
2332
+ t.block.draft ? (i(), W(e(J), {
2169
2333
  key: 0,
2170
2334
  type: "warning",
2171
2335
  dot: ""
2172
2336
  }, {
2173
2337
  default: c(() => [
2174
- $(f(e(s)("page.draft", { number: t.block.draft.number })), 1)
2338
+ w(p(e(n)("page.draft", { number: t.block.draft.number })), 1)
2175
2339
  ]),
2176
2340
  _: 1
2177
- })) : E("", !0),
2178
- t.block.published ? (r(), W(e(G), {
2341
+ })) : L("", !0),
2342
+ t.block.published ? (i(), W(e(J), {
2179
2343
  key: 1,
2180
2344
  type: "success",
2181
2345
  dot: ""
2182
2346
  }, {
2183
2347
  default: c(() => [
2184
- $(f(e(s)("page.live", { number: t.block.published.number })), 1)
2348
+ w(p(e(n)("page.live", { number: t.block.published.number })), 1)
2185
2349
  ]),
2186
2350
  _: 1
2187
- })) : (r(), W(e(G), {
2351
+ })) : (i(), W(e(J), {
2188
2352
  key: 2,
2189
2353
  type: "default"
2190
2354
  }, {
2191
2355
  default: c(() => [
2192
- $(f(e(s)("page.never-published")), 1)
2356
+ w(p(e(n)("page.never-published")), 1)
2193
2357
  ]),
2194
2358
  _: 1
2195
2359
  })),
2196
- t.block.is_enabled ? E("", !0) : (r(), W(e(G), {
2360
+ t.block.is_enabled ? L("", !0) : (i(), W(e(J), {
2197
2361
  key: 3,
2198
2362
  type: "default",
2199
2363
  variant: "outline"
2200
2364
  }, {
2201
2365
  default: c(() => [
2202
- $(f(e(s)("page.hidden")), 1)
2366
+ w(p(e(n)("page.hidden")), 1)
2203
2367
  ]),
2204
2368
  _: 1
2205
2369
  }))
@@ -2207,62 +2371,62 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
2207
2371
  ])
2208
2372
  ]));
2209
2373
  }
2210
- }), Tn = /* @__PURE__ */ Z(Sn, [["__scopeId", "data-v-daa12de4"]]), Cn = { class: "wx-block-create" }, Bn = /* @__PURE__ */ K({
2374
+ }), Dn = /* @__PURE__ */ X(On, [["__scopeId", "data-v-daa12de4"]]), Rn = { class: "wx-block-create" }, jn = /* @__PURE__ */ Q({
2211
2375
  __name: "BlockCreateDialog",
2212
2376
  setup(t) {
2213
- const { resolve: l, dismiss: a, open: s } = ft(), o = we(), i = he(o);
2214
- _e();
2215
- const n = Q("webx-blocks"), h = C(() => o.state.manifest?.modules.find((w) => w.id === "blocks")?.meta?.groups ?? ["content"]), p = U({ title: "", slug: "", group: h.value[0] ?? "content" }), S = U({}), _ = U(!1), k = U(!1), b = C(
2216
- () => h.value.map((d) => ({ value: d, label: ke(d, n) }))
2377
+ const { resolve: l, dismiss: s, open: n } = wt(), o = Te(), r = ke(o);
2378
+ Ee();
2379
+ const a = le("webx-blocks"), v = Be(), A = B(() => o.state.manifest?.modules.find((C) => C.id === "blocks")?.meta?.groups ?? ["content"]), d = U({ title: "", slug: "", group: A.value[0] ?? "content" }), b = U({}), m = U(!1), h = U(!1), f = B(
2380
+ () => A.value.map((k) => ({ value: k, label: ye(k, a) }))
2217
2381
  );
2218
- function m(d) {
2219
- return d.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/^[^a-z]+/, "").slice(0, 64);
2382
+ function y(k) {
2383
+ return k.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/^[^a-z]+/, "").slice(0, 64);
2220
2384
  }
2221
- le(
2222
- () => p.value.title,
2223
- (d) => {
2224
- k.value || (p.value.slug = m(d));
2385
+ ie(
2386
+ () => d.value.title,
2387
+ (k) => {
2388
+ h.value || (d.value.slug = y(k));
2225
2389
  }
2226
2390
  );
2227
- function y(d) {
2228
- return S.value[d]?.[0];
2391
+ function _(k) {
2392
+ return b.value[k]?.[0];
2229
2393
  }
2230
- async function g() {
2231
- _.value = !0, S.value = {};
2394
+ async function S() {
2395
+ m.value = !0, b.value = {};
2232
2396
  try {
2233
- l(await i.create(p.value));
2234
- } catch (d) {
2235
- const w = d.body;
2236
- w?.errors ? S.value = w.errors : F.danger(w?.message ?? n("page.failed"));
2397
+ l(await r.create(d.value));
2398
+ } catch (k) {
2399
+ const C = k.body;
2400
+ C?.errors ? b.value = C.errors : F.danger(v(k, a("page.failed")));
2237
2401
  } finally {
2238
- _.value = !1;
2402
+ m.value = !1;
2239
2403
  }
2240
2404
  }
2241
- return (d, w) => (r(), W(e(mt), {
2242
- open: e(s),
2243
- "onUpdate:open": w[5] || (w[5] = (B) => it(s) ? s.value = B : null),
2244
- title: e(n)("page.new"),
2405
+ return (k, C) => (i(), W(e(_t), {
2406
+ open: e(n),
2407
+ "onUpdate:open": C[5] || (C[5] = (D) => mt(n) ? n.value = D : null),
2408
+ title: e(a)("page.new"),
2245
2409
  width: 520
2246
2410
  }, {
2247
2411
  footer: c(() => [
2248
- u(e(Ot), { size: "sm" }, {
2412
+ u(e(Qt), { size: "sm" }, {
2249
2413
  default: c(() => [
2250
2414
  u(e(q), {
2251
2415
  variant: "outline",
2252
- onClick: w[4] || (w[4] = (B) => e(a)())
2416
+ onClick: C[4] || (C[4] = (D) => e(s)())
2253
2417
  }, {
2254
2418
  default: c(() => [
2255
- $(f(e(n)("page.cancel")), 1)
2419
+ w(p(e(a)("page.cancel")), 1)
2256
2420
  ]),
2257
2421
  _: 1
2258
2422
  }),
2259
2423
  u(e(q), {
2260
2424
  type: "primary",
2261
- loading: _.value,
2262
- onClick: g
2425
+ loading: m.value,
2426
+ onClick: S
2263
2427
  }, {
2264
2428
  default: c(() => [
2265
- $(f(e(n)("page.create")), 1)
2429
+ w(p(e(a)("page.create")), 1)
2266
2430
  ]),
2267
2431
  _: 1
2268
2432
  }, 8, ["loading"])
@@ -2271,45 +2435,45 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
2271
2435
  })
2272
2436
  ]),
2273
2437
  default: c(() => [
2274
- x("div", Cn, [
2275
- u(e(J), {
2276
- label: e(n)("page.title"),
2277
- error: y("title")
2438
+ $("div", Rn, [
2439
+ u(e(Y), {
2440
+ label: e(a)("page.title"),
2441
+ error: _("title")
2278
2442
  }, {
2279
2443
  default: c(() => [
2280
- u(e(ve), {
2281
- modelValue: p.value.title,
2282
- "onUpdate:modelValue": w[0] || (w[0] = (B) => p.value.title = B),
2444
+ u(e(ge), {
2445
+ modelValue: d.value.title,
2446
+ "onUpdate:modelValue": C[0] || (C[0] = (D) => d.value.title = D),
2283
2447
  autofocus: ""
2284
2448
  }, null, 8, ["modelValue"])
2285
2449
  ]),
2286
2450
  _: 1
2287
2451
  }, 8, ["label", "error"]),
2288
- u(e(J), {
2289
- label: e(n)("page.identifier"),
2290
- help: e(n)("page.identifier-help"),
2291
- error: y("slug")
2452
+ u(e(Y), {
2453
+ label: e(a)("page.identifier"),
2454
+ help: e(a)("page.identifier-help"),
2455
+ error: _("slug")
2292
2456
  }, {
2293
2457
  default: c(() => [
2294
- u(e(ve), {
2295
- modelValue: p.value.slug,
2296
- "onUpdate:modelValue": w[1] || (w[1] = (B) => p.value.slug = B),
2458
+ u(e(ge), {
2459
+ modelValue: d.value.slug,
2460
+ "onUpdate:modelValue": C[1] || (C[1] = (D) => d.value.slug = D),
2297
2461
  placeholder: "hero",
2298
- onInput: w[2] || (w[2] = (B) => k.value = !0)
2462
+ onInput: C[2] || (C[2] = (D) => h.value = !0)
2299
2463
  }, null, 8, ["modelValue"])
2300
2464
  ]),
2301
2465
  _: 1
2302
2466
  }, 8, ["label", "help", "error"]),
2303
- u(e(J), {
2304
- label: e(n)("page.group"),
2305
- help: e(n)("page.group-help"),
2306
- error: y("group")
2467
+ u(e(Y), {
2468
+ label: e(a)("page.group"),
2469
+ help: e(a)("page.group-help"),
2470
+ error: _("group")
2307
2471
  }, {
2308
2472
  default: c(() => [
2309
- u(e(pt), {
2310
- modelValue: p.value.group,
2311
- "onUpdate:modelValue": w[3] || (w[3] = (B) => p.value.group = B),
2312
- options: b.value
2473
+ u(e(yt), {
2474
+ modelValue: d.value.group,
2475
+ "onUpdate:modelValue": C[3] || (C[3] = (D) => d.value.group = D),
2476
+ options: f.value
2313
2477
  }, null, 8, ["modelValue", "options"])
2314
2478
  ]),
2315
2479
  _: 1
@@ -2319,156 +2483,174 @@ const ot = /* @__PURE__ */ Symbol("wx-blocks-root"), dn = {
2319
2483
  _: 1
2320
2484
  }, 8, ["open", "title"]));
2321
2485
  }
2322
- }), Wn = /* @__PURE__ */ Z(Bn, [["__scopeId", "data-v-274bc88a"]]), An = { class: "wx-blocks-page" }, zn = { class: "wx-blocks-page__head" }, En = { class: "wx-blocks-page__cards" }, Un = { class: "wx-blocks-page__ghost-body" }, In = {
2486
+ }), Hn = /* @__PURE__ */ X(jn, [["__scopeId", "data-v-a4c0d44c"]]), Fn = {
2487
+ key: 1,
2488
+ class: "wx-blocks-page__toolbar"
2489
+ }, qn = { class: "wx-blocks-page__cards" }, Jn = { class: "wx-blocks-page__ghost-body" }, Kn = {
2323
2490
  key: 0,
2324
2491
  class: "wx-blocks-page__group-title"
2325
- }, Nn = { class: "wx-blocks-page__cards" }, Ln = /* @__PURE__ */ K({
2492
+ }, Zn = { class: "wx-blocks-page__cards" }, Gn = /* @__PURE__ */ Q({
2326
2493
  __name: "BlocksPage",
2327
2494
  props: {
2328
2495
  base: { default: "/blocks" }
2329
2496
  },
2330
2497
  setup(t) {
2331
- const l = t, a = we(), s = he(a), o = ut();
2332
- _e();
2333
- const i = Q("webx-blocks"), n = U([]), h = U(!0), p = U(""), S = ht(Wn), _ = C(() => {
2334
- const B = a.state.manifest?.modules.find((M) => M.id === "blocks")?.meta;
2498
+ const l = t, s = Te(), n = ke(s), o = bt();
2499
+ Ee();
2500
+ const r = le("webx-blocks"), a = Be(), v = U([]), A = U(!0), d = U(""), b = U(""), m = $t(Hn), h = B(() => {
2501
+ const z = s.state.manifest?.modules.find((N) => N.id === "blocks")?.meta;
2335
2502
  return {
2336
- groups: B?.groups ?? [],
2337
- editing: B?.editing ?? !0,
2338
- provides: B?.provides ?? []
2503
+ groups: z?.groups ?? [],
2504
+ editing: z?.editing ?? !0,
2505
+ provides: z?.provides ?? []
2339
2506
  };
2340
- }), k = C(() => a.can("blocks.manage") && _.value.editing), b = C(
2341
- () => a.state.manifest?.modules.find((B) => B.id === "blocks")?.title ?? i("module.title")
2342
- ), m = C(() => {
2343
- const B = p.value.trim().toLowerCase();
2344
- return B === "" ? n.value : n.value.filter(
2345
- (M) => M.title.toLowerCase().includes(B) || M.slug.includes(B) || (M.description ?? "").toLowerCase().includes(B)
2507
+ }), f = B(() => s.can("blocks.manage") && h.value.editing), y = B(
2508
+ () => s.state.manifest?.modules.find((z) => z.id === "blocks")?.title ?? r("module.title")
2509
+ ), _ = B(() => {
2510
+ const z = d.value.trim().toLowerCase(), N = b.value === "" ? v.value : v.value.filter((I) => I.group === b.value);
2511
+ return z === "" ? N : N.filter(
2512
+ (I) => I.title.toLowerCase().includes(z) || I.slug.includes(z) || (I.description ?? "").toLowerCase().includes(z)
2346
2513
  );
2347
- }), y = C(() => {
2348
- const B = [..._.value.groups];
2349
- for (const I of m.value)
2350
- B.includes(I.group) || B.push(I.group);
2351
- const M = B.map((I) => ({
2514
+ }), S = B(() => {
2515
+ const z = [...h.value.groups];
2516
+ for (const N of v.value)
2517
+ z.includes(N.group) || z.push(N.group);
2518
+ return z.filter((N) => v.value.some((I) => I.group === N));
2519
+ }), k = B(
2520
+ () => S.value.length < 2 ? [] : [
2521
+ { value: "", label: r("page.all-groups") },
2522
+ ...S.value.map((z) => ({ value: z, label: ye(z, r) }))
2523
+ ]
2524
+ ), C = B(() => {
2525
+ const z = S.value.map((I) => ({
2352
2526
  id: I,
2353
- label: ke(I, i),
2354
- blocks: m.value.filter((P) => P.group === I)
2527
+ label: ye(I, r),
2528
+ blocks: _.value.filter((M) => M.group === I)
2355
2529
  })).filter((I) => I.blocks.length > 0);
2356
- return m.value.length <= 5 || p.value.trim() !== "" || M.length < 2 ? [{ id: "", label: "", blocks: m.value }] : M;
2530
+ return b.value !== "" || _.value.length <= 5 || d.value.trim() !== "" || z.length < 2 ? [{ id: "", label: "", blocks: _.value }] : z;
2357
2531
  });
2358
- async function g() {
2359
- h.value = !0;
2532
+ async function D() {
2533
+ A.value = !0;
2360
2534
  try {
2361
- n.value = await s.list();
2362
- } catch (B) {
2363
- F.danger(B.body?.message ?? String(B));
2535
+ v.value = await n.list();
2536
+ } catch (z) {
2537
+ F.danger(a(z));
2364
2538
  } finally {
2365
- h.value = !1;
2539
+ A.value = !1;
2366
2540
  }
2367
2541
  }
2368
- function d(B) {
2369
- o.push(`${l.base}/${B.id}`);
2542
+ function K(z) {
2543
+ o.push(`${l.base}/${z.id}`);
2370
2544
  }
2371
- async function w() {
2372
- const B = await S({});
2373
- B && d(B);
2545
+ async function ne() {
2546
+ const z = await m({});
2547
+ z && K(z);
2374
2548
  }
2375
- return ye(g), (B, M) => (r(), V("div", An, [
2376
- x("div", zn, [
2377
- u(e(Rt), { level: 2 }, {
2378
- default: c(() => [
2379
- $(f(b.value), 1)
2380
- ]),
2381
- _: 1
2382
- }),
2383
- k.value ? (r(), W(e(q), {
2549
+ return Ce(D), (z, N) => (i(), W(e(qt), {
2550
+ view: b.value,
2551
+ "onUpdate:view": N[1] || (N[1] = (I) => b.value = I),
2552
+ class: "wx-blocks-page",
2553
+ title: y.value,
2554
+ views: k.value
2555
+ }, Mt({
2556
+ default: c(() => [
2557
+ h.value.editing ? L("", !0) : (i(), W(e(kt), {
2384
2558
  key: 0,
2385
- type: "primary",
2386
- icon: "plus",
2387
- onClick: w
2388
- }, {
2389
- default: c(() => [
2390
- $(f(e(i)("page.new")), 1)
2559
+ type: "info",
2560
+ variant: "soft",
2561
+ description: e(r)("page.editing-off")
2562
+ }, null, 8, ["description"])),
2563
+ A.value || v.value.length > 0 ? (i(), V("div", Fn, [
2564
+ u(e(ge), {
2565
+ modelValue: d.value,
2566
+ "onUpdate:modelValue": N[0] || (N[0] = (I) => d.value = I),
2567
+ class: "wx-blocks-page__search",
2568
+ placeholder: e(r)("page.search"),
2569
+ clearable: ""
2570
+ }, null, 8, ["modelValue", "placeholder"])
2571
+ ])) : L("", !0),
2572
+ A.value ? (i(), W(e(he), { key: 2 }, {
2573
+ template: c(() => [
2574
+ $("div", qn, [
2575
+ (i(), V(H, null, te(4, (I) => $("div", {
2576
+ key: I,
2577
+ class: "wx-blocks-page__ghost"
2578
+ }, [
2579
+ u(e(Ue), {
2580
+ variant: "image",
2581
+ height: 120,
2582
+ class: "wx-blocks-page__ghost-thumb"
2583
+ }),
2584
+ $("div", Jn, [
2585
+ u(e(Ue), {
2586
+ variant: "title",
2587
+ width: "45%"
2588
+ }),
2589
+ u(e(Ue), {
2590
+ variant: "text",
2591
+ width: "70%"
2592
+ }),
2593
+ u(e(Ue), {
2594
+ variant: "button",
2595
+ width: "64px",
2596
+ height: "22px"
2597
+ })
2598
+ ])
2599
+ ])), 64))
2600
+ ])
2391
2601
  ]),
2392
2602
  _: 1
2393
- })) : E("", !0)
2394
- ]),
2395
- _.value.editing ? E("", !0) : (r(), W(e(dt), {
2396
- key: 0,
2397
- type: "info",
2398
- variant: "soft",
2399
- description: e(i)("page.editing-off")
2400
- }, null, 8, ["description"])),
2401
- h.value || n.value.length > 0 ? (r(), W(e(ve), {
2402
- key: 1,
2403
- modelValue: p.value,
2404
- "onUpdate:modelValue": M[0] || (M[0] = (N) => p.value = N),
2405
- class: "wx-blocks-page__search",
2406
- placeholder: e(i)("page.search"),
2407
- clearable: ""
2408
- }, null, 8, ["modelValue", "placeholder"])) : E("", !0),
2409
- h.value ? (r(), W(e(pe), { key: 2 }, {
2410
- template: c(() => [
2411
- x("div", En, [
2412
- (r(), V(j, null, Y(4, (N) => x("div", {
2413
- key: N,
2414
- class: "wx-blocks-page__ghost"
2415
- }, [
2416
- u(e(Ae), {
2417
- variant: "image",
2418
- height: 120,
2419
- class: "wx-blocks-page__ghost-thumb"
2420
- }),
2421
- x("div", Un, [
2422
- u(e(Ae), {
2423
- variant: "title",
2424
- width: "45%"
2425
- }),
2426
- u(e(Ae), {
2427
- variant: "text",
2428
- width: "70%"
2429
- }),
2430
- u(e(Ae), {
2431
- variant: "button",
2432
- width: "64px",
2433
- height: "22px"
2434
- })
2435
- ])
2436
- ])), 64))
2603
+ })) : v.value.length === 0 ? (i(), W(e(xt), {
2604
+ key: 3,
2605
+ icon: "grid",
2606
+ title: e(r)("page.empty"),
2607
+ description: e(r)("page.empty-help")
2608
+ }, null, 8, ["title", "description"])) : (i(!0), V(H, { key: 4 }, te(C.value, (I) => (i(), V("section", {
2609
+ key: I.id,
2610
+ class: "wx-blocks-page__group"
2611
+ }, [
2612
+ I.label ? (i(), V("div", Kn, p(I.label), 1)) : L("", !0),
2613
+ $("div", Zn, [
2614
+ (i(!0), V(H, null, te(I.blocks, (M) => (i(), W(Dn, {
2615
+ key: M.id,
2616
+ block: M,
2617
+ onOpen: K
2618
+ }, null, 8, ["block"]))), 128))
2437
2619
  ])
2620
+ ]))), 128))
2621
+ ]),
2622
+ _: 2
2623
+ }, [
2624
+ f.value ? {
2625
+ name: "actions",
2626
+ fn: c(() => [
2627
+ u(e(q), {
2628
+ type: "primary",
2629
+ icon: "plus",
2630
+ onClick: ne
2631
+ }, {
2632
+ default: c(() => [
2633
+ w(p(e(r)("page.new")), 1)
2634
+ ]),
2635
+ _: 1
2636
+ })
2438
2637
  ]),
2439
- _: 1
2440
- })) : n.value.length === 0 ? (r(), W(e(vt), {
2441
- key: 3,
2442
- icon: "grid",
2443
- title: e(i)("page.empty"),
2444
- description: e(i)("page.empty-help")
2445
- }, null, 8, ["title", "description"])) : (r(!0), V(j, { key: 4 }, Y(y.value, (N) => (r(), V("section", {
2446
- key: N.id,
2447
- class: "wx-blocks-page__group"
2448
- }, [
2449
- N.label ? (r(), V("div", In, f(N.label), 1)) : E("", !0),
2450
- x("div", Nn, [
2451
- (r(!0), V(j, null, Y(N.blocks, (I) => (r(), W(Tn, {
2452
- key: I.id,
2453
- block: I,
2454
- onOpen: d
2455
- }, null, 8, ["block"]))), 128))
2456
- ])
2457
- ]))), 128))
2458
- ]));
2638
+ key: "0"
2639
+ } : void 0
2640
+ ]), 1032, ["view", "title", "views"]));
2459
2641
  }
2460
- }), Mn = /* @__PURE__ */ Z(Ln, [["__scopeId", "data-v-6e58b664"]]);
2461
- function Kn(t = {}) {
2642
+ }), Yn = /* @__PURE__ */ X(Gn, [["__scopeId", "data-v-3cb993d5"]]);
2643
+ function ia(t = {}) {
2462
2644
  const l = t.path ?? "/blocks";
2463
2645
  return {
2464
2646
  id: "blocks",
2465
2647
  path: l,
2466
2648
  routes: [
2467
- { path: l, name: "webx.blocks", component: Mn, props: { base: l } },
2649
+ { path: l, name: "webx.blocks", component: Yn, props: { base: l } },
2468
2650
  {
2469
2651
  path: `${l}/:id(\\d+)`,
2470
2652
  name: "webx.blocks.edit",
2471
- component: Ll,
2653
+ component: Zl,
2472
2654
  props: { base: l }
2473
2655
  }
2474
2656
  ],
@@ -2477,7 +2659,7 @@ function Kn(t = {}) {
2477
2659
  // draws its children through the renderer; it needs the node for `props.allow` alone.
2478
2660
  types: {
2479
2661
  "wx-blocks": {
2480
- component: _n,
2662
+ component: Un,
2481
2663
  kind: "field",
2482
2664
  nested: !0,
2483
2665
  bind: () => ({ blocksPath: l })
@@ -2486,37 +2668,37 @@ function Kn(t = {}) {
2486
2668
  };
2487
2669
  }
2488
2670
  export {
2489
- Ll as WxBlockEditorPage,
2490
- Kl as WxBlockPicker,
2491
- al as WxBlockStage,
2492
- Ct as WxBlockThumb,
2493
- _n as WxBlocks,
2494
- Mn as WxBlocksPage,
2495
- Kn as blocks,
2496
- dl as blocksMessages,
2497
- Ke as blocksPreviewKey,
2498
- $t as cloneNode,
2499
- ol as countType,
2500
- he as createBlocksApi,
2501
- gt as findRange,
2502
- Je as formSchema,
2503
- De as highlightBlock,
2504
- nt as insertNode,
2505
- yt as isNode,
2506
- Fe as isNodeList,
2507
- fl as lintBlock,
2508
- oe as locate,
2509
- sl as makeNode,
2510
- wt as newKey,
2511
- qn as provideBlocksPreview,
2512
- rl as removeNode,
2513
- Yt as replaceBlock,
2514
- cl as replaceList,
2515
- kt as stageDocument,
2516
- Fn as typesIn,
2517
- ml as undeclared,
2518
- ul as updateValues,
2519
- Jn as useBlocksPreview,
2520
- qe as walk
2671
+ Zl as WxBlockEditorPage,
2672
+ on as WxBlockPicker,
2673
+ fl as WxBlockStage,
2674
+ It as WxBlockThumb,
2675
+ Un as WxBlocks,
2676
+ Yn as WxBlocksPage,
2677
+ ia as blocks,
2678
+ _l as blocksMessages,
2679
+ et as blocksPreviewKey,
2680
+ Wt as cloneNode,
2681
+ ml as countType,
2682
+ ke as createBlocksApi,
2683
+ St as findRange,
2684
+ Xe as formSchema,
2685
+ Je as highlightBlock,
2686
+ ct as insertNode,
2687
+ Tt as isNode,
2688
+ Oe as isNodeList,
2689
+ $l as lintBlock,
2690
+ se as locate,
2691
+ vl as makeNode,
2692
+ Ke as newKey,
2693
+ sa as provideBlocksPreview,
2694
+ kl as removeNode,
2695
+ il as replaceBlock,
2696
+ wl as replaceList,
2697
+ Ct as stageDocument,
2698
+ aa as typesIn,
2699
+ Vl as undeclared,
2700
+ yl as updateValues,
2701
+ oa as useBlocksPreview,
2702
+ De as walk
2521
2703
  };
2522
2704
  //# sourceMappingURL=index.js.map