@webx-ui/module-pages 0.3.3 → 0.3.6

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,38 +1,38 @@
1
- import { inject as Le, provide as Oe, defineComponent as K, ref as k, computed as W, openBlock as m, createBlock as V, unref as e, withCtx as n, createElementVNode as E, createElementBlock as A, createVNode as g, createTextVNode as y, toDisplayString as b, createCommentVNode as N, useTemplateRef as Be, watch as ae, onMounted as pe, onBeforeUnmount as Ke, Fragment as j, renderList as Me, normalizeClass as Fe, useModel as He, mergeModels as je, nextTick as Ge, isRef as De, withKeys as Pe, createSlots as Je, withModifiers as Qe } from "vue";
2
- import { useRouter as ye, useRoute as Xe, onBeforeRouteLeave as Ye } from "vue-router";
3
- import { useAdmin as G, useTranslate as F, useErrorText as ie, WxBackButton as Ze, WxScreen as qe, WxDate as me, WxRowMenu as et, WxListScreen as tt } from "@webx-ui/module-admin";
4
- import { WxCard as at, WxText as R, WxButton as I, confirm as O, toast as z, useLocales as Se, useElementWidth as lt, localizedValue as nt, WxSkeleton as be, WxBreadcrumb as st, WxBreadcrumbItem as fe, WxBadge as we, WxDropdown as ot, WxDropdownItem as We, WxAction as it, WxAlert as xe, WxActionBar as rt, WxEmpty as ut, WxTreeSelect as dt, WxFormItem as oe, useModal as Ne, WxDialog as Ae, WxInput as Ve, WxSpace as _e, createModal as ze, WxTable as ct } from "@webx-ui/core";
5
- import { provideBlocksPreview as pt } from "@webx-ui/module-blocks";
6
- function Z(u) {
7
- const r = `${u.apiPath}/pages`, h = (l) => l.data;
1
+ import { inject as Ae, provide as Ie, defineComponent as F, ref as x, computed as W, openBlock as f, createBlock as C, unref as e, withCtx as i, createElementVNode as K, createElementBlock as N, createVNode as v, createTextVNode as $, toDisplayString as w, createCommentVNode as I, watch as ae, onMounted as ce, onBeforeUnmount as Ue, Fragment as Z, renderList as Ce, normalizeClass as Re, useModel as Le, mergeModels as Oe, useTemplateRef as Ke, nextTick as Fe, isRef as Me, withKeys as Pe, withModifiers as He } from "vue";
2
+ import { useRouter as _e, useRoute as je, onBeforeRouteLeave as Ge } from "vue-router";
3
+ import { useAdmin as Q, useTranslate as H, useErrorText as ie, WxScreenHead as Je, WxScreen as Qe, WxDate as be, WxRowMenu as Xe, rowMenuWidth as Ye, WxListScreen as Ze } from "@webx-ui/module-admin";
4
+ import { WxCard as qe, WxText as U, WxButton as R, confirm as L, toast as V, useLocales as Se, localizedValue as et, WxSkeleton as ye, WxBadge as xe, WxBreadcrumb as tt, WxBreadcrumbItem as fe, WxAlert as ke, WxActionBar as at, WxEmpty as lt, WxTreeSelect as st, WxFormItem as ne, useModal as Be, WxDialog as De, WxInput as We, WxSpace as we, createModal as Ve, WxTable as nt } from "@webx-ui/core";
5
+ import { provideBlocksPreview as it } from "@webx-ui/module-blocks";
6
+ function q(u) {
7
+ const o = `${u.apiPath}/pages`, g = (l) => l.data;
8
8
  return {
9
9
  list: (l = {}) => {
10
10
  const s = new URLSearchParams();
11
11
  l.parent != null && s.set("parent", String(l.parent)), l.search && s.set("search", l.search), l.status && s.set("status", l.status), l.trashed && s.set("trashed", "1"), l.flat && s.set("flat", "1");
12
12
  const t = s.size > 0 ? `?${s}` : "";
13
- return u.http.get(`${r}${t}`).then(h);
13
+ return u.http.get(`${o}${t}`).then(g);
14
14
  },
15
- get: (l) => u.http.get(`${r}/${l}`).then(h),
16
- create: (l) => u.http.post(r, l).then(h),
17
- save: (l, s) => u.http.put(`${r}/${l}`, s).then(h),
18
- move: (l, s, t) => u.http.post(`${r}/${l}/move`, { target: s, zone: t }).then(h),
19
- duplicate: (l) => u.http.post(`${r}/${l}/duplicate`, {}).then(h),
20
- publish: (l) => u.http.post(`${r}/${l}/publish`, {}).then(h),
21
- unpublish: (l) => u.http.post(`${r}/${l}/unpublish`, {}).then(h),
22
- remove: (l) => u.http.delete(`${r}/${l}`).then((s) => s.data.trashed),
23
- restore: (l) => u.http.post(`${r}/${l}/restore`, {}).then((s) => s.data.restored),
24
- versions: (l) => u.http.get(`${r}/${l}/versions`).then(h),
25
- restoreVersion: (l, s) => u.http.post(`${r}/${l}/versions/${s}/restore`, {}).then(h)
15
+ get: (l) => u.http.get(`${o}/${l}`).then(g),
16
+ create: (l) => u.http.post(o, l).then(g),
17
+ save: (l, s) => u.http.put(`${o}/${l}`, s).then(g),
18
+ move: (l, s, t) => u.http.post(`${o}/${l}/move`, { target: s, zone: t }).then(g),
19
+ duplicate: (l) => u.http.post(`${o}/${l}/duplicate`, {}).then(g),
20
+ publish: (l) => u.http.post(`${o}/${l}/publish`, {}).then(g),
21
+ unpublish: (l) => u.http.post(`${o}/${l}/unpublish`, {}).then(g),
22
+ remove: (l) => u.http.delete(`${o}/${l}`).then((s) => s.data.trashed),
23
+ restore: (l) => u.http.post(`${o}/${l}/restore`, {}).then((s) => s.data.restored),
24
+ versions: (l) => u.http.get(`${o}/${l}/versions`).then(g),
25
+ restoreVersion: (l, s) => u.http.post(`${o}/${l}/versions/${s}/restore`, {}).then(g)
26
26
  };
27
27
  }
28
- const Ee = /* @__PURE__ */ Symbol("wx-page-editor");
29
- function gt(u) {
30
- Oe(Ee, u);
28
+ const Ne = /* @__PURE__ */ Symbol("wx-page-editor");
29
+ function ot(u) {
30
+ Ie(Ne, u);
31
31
  }
32
- function ke() {
33
- return Le(Ee, null);
32
+ function Te() {
33
+ return Ae(Ne, null);
34
34
  }
35
- const vt = {
35
+ const rt = {
36
36
  module: {
37
37
  title: "Pages"
38
38
  },
@@ -137,28 +137,28 @@ const vt = {
137
137
  "restore-text": "It becomes the draft. The site keeps showing what is published until you publish this.",
138
138
  "restored-version": "Version :number is now the draft."
139
139
  }
140
- }, Ce = /* @__PURE__ */ new WeakSet();
141
- function H() {
140
+ }, ze = /* @__PURE__ */ new WeakSet();
141
+ function j() {
142
142
  try {
143
- const { i18n: u } = G();
144
- Ce.has(u) || (u.defaults("webx-pages", vt), Ce.add(u));
143
+ const { i18n: u } = Q();
144
+ ze.has(u) || (u.defaults("webx-pages", rt), ze.add(u));
145
145
  } catch {
146
146
  }
147
147
  }
148
- const ht = { class: "wx-page-danger" }, ft = {
148
+ const ut = { class: "wx-page-danger" }, dt = {
149
149
  key: 0,
150
150
  class: "wx-page-danger__row"
151
- }, mt = { class: "wx-page-danger__what" }, bt = { class: "wx-page-danger__row" }, _t = { class: "wx-page-danger__what" }, yt = /* @__PURE__ */ K({
151
+ }, ct = { class: "wx-page-danger__what" }, pt = { class: "wx-page-danger__row" }, gt = { class: "wx-page-danger__what" }, vt = /* @__PURE__ */ F({
152
152
  name: "WxPageDanger",
153
153
  __name: "PageDanger",
154
154
  setup(u) {
155
- const r = G(), h = Z(r), l = ye(), s = ke();
156
- H();
157
- const t = F("webx-pages"), d = ie(), a = k(!1), c = W(() => s?.page.value ?? null), f = W(() => r.can("pages.manage"));
158
- async function i() {
159
- const x = c.value;
160
- if (!(!x || !await O({
161
- title: t("page.unpublish-title", { title: x.title }),
155
+ const o = Q(), g = q(o), l = _e(), s = Te();
156
+ j();
157
+ const t = H("webx-pages"), d = ie(), a = x(!1), c = W(() => s?.page.value ?? null), h = W(() => o.can("pages.manage"));
158
+ async function r() {
159
+ const _ = c.value;
160
+ if (!(!_ || !await L({
161
+ title: t("page.unpublish-title", { title: _.title }),
162
162
  message: t("page.unpublish-text"),
163
163
  confirmText: t("page.unpublish"),
164
164
  cancelText: t("page.cancel"),
@@ -166,97 +166,97 @@ const ht = { class: "wx-page-danger" }, ft = {
166
166
  }))) {
167
167
  a.value = !0;
168
168
  try {
169
- await h.unpublish(x.id), await s?.reload(), z.success(t("page.unpublished"));
170
- } catch (_) {
171
- z.danger(d(_));
169
+ await g.unpublish(_.id), await s?.reload(), V.success(t("page.unpublished"));
170
+ } catch (b) {
171
+ V.danger(d(b));
172
172
  } finally {
173
173
  a.value = !1;
174
174
  }
175
175
  }
176
176
  }
177
- async function T() {
178
- const x = c.value;
179
- if (!(!x || !await O({
180
- title: t("page.delete-title", { title: x.title }),
177
+ async function k() {
178
+ const _ = c.value;
179
+ if (!(!_ || !await L({
180
+ title: t("page.delete-title", { title: _.title }),
181
181
  // The whole branch, not the level under it (§7): a catalogue with two sections and forty
182
182
  // products is forty-two pages leaving the site at once.
183
- message: x.descendants_count > 0 ? `${t("page.delete-text")} ${t("page.delete-branch", { count: x.descendants_count })}` : t("page.delete-text"),
183
+ message: _.descendants_count > 0 ? `${t("page.delete-text")} ${t("page.delete-branch", { count: _.descendants_count })}` : t("page.delete-text"),
184
184
  confirmText: t("page.delete"),
185
185
  cancelText: t("page.cancel"),
186
186
  tone: "danger"
187
187
  }))) {
188
188
  a.value = !0;
189
189
  try {
190
- await h.remove(x.id), z.success(t("page.deleted")), l.push(s?.base ?? "/pages");
191
- } catch (_) {
192
- z.danger(d(_));
190
+ await g.remove(_.id), V.success(t("page.deleted")), l.push(s?.base ?? "/pages");
191
+ } catch (b) {
192
+ V.danger(d(b));
193
193
  } finally {
194
194
  a.value = !1;
195
195
  }
196
196
  }
197
197
  }
198
- return (x, C) => c.value && f.value ? (m(), V(e(at), {
198
+ return (_, z) => c.value && h.value ? (f(), C(e(qe), {
199
199
  key: 0,
200
200
  title: e(t)("page.danger")
201
201
  }, {
202
- default: n(() => [
203
- E("div", ht, [
204
- c.value.status !== "draft" ? (m(), A("div", ft, [
205
- E("div", mt, [
206
- g(e(R), { weight: "medium" }, {
207
- default: n(() => [
208
- y(b(e(t)("page.unpublish")), 1)
202
+ default: i(() => [
203
+ K("div", ut, [
204
+ c.value.status !== "draft" ? (f(), N("div", dt, [
205
+ K("div", ct, [
206
+ v(e(U), { weight: "medium" }, {
207
+ default: i(() => [
208
+ $(w(e(t)("page.unpublish")), 1)
209
209
  ]),
210
210
  _: 1
211
211
  }),
212
- g(e(R), {
212
+ v(e(U), {
213
213
  size: "sm",
214
214
  tone: "muted"
215
215
  }, {
216
- default: n(() => [
217
- y(b(e(t)("page.unpublish-help")), 1)
216
+ default: i(() => [
217
+ $(w(e(t)("page.unpublish-help")), 1)
218
218
  ]),
219
219
  _: 1
220
220
  })
221
221
  ]),
222
- g(e(I), {
222
+ v(e(R), {
223
223
  variant: "outline",
224
224
  loading: a.value,
225
- onClick: i
225
+ onClick: r
226
226
  }, {
227
- default: n(() => [
228
- y(b(e(t)("page.unpublish")), 1)
227
+ default: i(() => [
228
+ $(w(e(t)("page.unpublish")), 1)
229
229
  ]),
230
230
  _: 1
231
231
  }, 8, ["loading"])
232
- ])) : N("", !0),
233
- E("div", bt, [
234
- E("div", _t, [
235
- g(e(R), { weight: "medium" }, {
236
- default: n(() => [
237
- y(b(e(t)("page.delete")), 1)
232
+ ])) : I("", !0),
233
+ K("div", pt, [
234
+ K("div", gt, [
235
+ v(e(U), { weight: "medium" }, {
236
+ default: i(() => [
237
+ $(w(e(t)("page.delete")), 1)
238
238
  ]),
239
239
  _: 1
240
240
  }),
241
- g(e(R), {
241
+ v(e(U), {
242
242
  size: "sm",
243
243
  tone: "muted"
244
244
  }, {
245
- default: n(() => [
246
- y(b(c.value.can.delete ? e(t)("page.delete-help") : e(t)("page.delete-home")), 1)
245
+ default: i(() => [
246
+ $(w(c.value.can.delete ? e(t)("page.delete-help") : e(t)("page.delete-home")), 1)
247
247
  ]),
248
248
  _: 1
249
249
  })
250
250
  ]),
251
- g(e(I), {
251
+ v(e(R), {
252
252
  type: "danger",
253
253
  variant: "outline",
254
254
  disabled: !c.value.can.delete,
255
255
  loading: a.value,
256
- onClick: T
256
+ onClick: k
257
257
  }, {
258
- default: n(() => [
259
- y(b(e(t)("page.delete")), 1)
258
+ default: i(() => [
259
+ $(w(e(t)("page.delete")), 1)
260
260
  ]),
261
261
  _: 1
262
262
  }, 8, ["disabled", "loading"])
@@ -264,373 +264,310 @@ const ht = { class: "wx-page-danger" }, ft = {
264
264
  ])
265
265
  ]),
266
266
  _: 1
267
- }, 8, ["title"])) : N("", !0);
267
+ }, 8, ["title"])) : I("", !0);
268
268
  }
269
- }), re = (u, r) => {
270
- const h = u.__vccOpts || u;
271
- for (const [l, s] of r)
272
- h[l] = s;
273
- return h;
274
- }, wt = /* @__PURE__ */ re(yt, [["__scopeId", "data-v-d4a9083f"]]), xt = { class: "wx-page-editor__head" }, kt = { class: "wx-page-editor__id" }, Tt = { class: "wx-page-editor__name" }, $t = { class: "wx-page-editor__title" }, Pt = { class: "wx-page-editor__actions" }, Wt = { class: "wx-page-editor__screen" }, Vt = 1200, zt = 720, Ct = /* @__PURE__ */ K({
269
+ }), oe = (u, o) => {
270
+ const g = u.__vccOpts || u;
271
+ for (const [l, s] of o)
272
+ g[l] = s;
273
+ return g;
274
+ }, ht = /* @__PURE__ */ oe(vt, [["__scopeId", "data-v-d4a9083f"]]), mt = { class: "wx-page-editor__screen" }, ft = 1200, bt = /* @__PURE__ */ F({
275
275
  __name: "PageEditorPage",
276
276
  props: {
277
277
  base: { default: "/pages" }
278
278
  },
279
279
  setup(u) {
280
- const r = u, h = G(), l = Z(h), s = Xe(), t = ye(), d = Se();
281
- H();
282
- const a = F("webx-pages"), c = ie(), f = W(() => Number(s.params.id)), i = k(null), T = k([]), x = k({}), C = k(""), _ = k(null), p = k({}), B = k(!0), $ = k(!1), D = k(!1), le = k({}), U = k(null), q = k(""), ue = k(0), M = W(() => h.can("pages.manage")), de = Be("root"), ee = lt(de), ce = W(() => ee.value > 0 && ee.value < zt), te = W(() => JSON.stringify(x.value)), L = W(() => q.value !== "" && te.value !== q.value), ge = W(() => $.value ? "saving" : L.value ? "unsaved" : "saved"), ne = W(() => {
283
- const P = x.value.title;
284
- return nt(P, d.active.value, i.value?.title ?? "");
285
- }), ve = W(
286
- () => T.value.map((P) => ({
287
- id: P.id,
288
- label: P.is_home ? a("pages.home") : P.title
280
+ const o = u, g = Q(), l = q(g), s = je(), t = _e(), d = Se();
281
+ j();
282
+ const a = H("webx-pages"), c = ie(), h = W(() => Number(s.params.id)), r = x(null), k = x([]), _ = x({}), z = x(""), b = x(null), p = x({}), M = x(!0), P = x(!1), B = x(!1), le = x({}), A = x(null), ee = x(""), re = x(0), S = W(() => g.can("pages.manage")), te = W(() => JSON.stringify(_.value)), E = W(() => ee.value !== "" && te.value !== ee.value), ue = W(() => P.value ? "saving" : E.value ? "unsaved" : "saved"), de = W(() => {
283
+ const y = _.value.title;
284
+ return et(y, d.active.value, r.value?.title ?? "");
285
+ }), pe = W(
286
+ () => k.value.map((y) => ({
287
+ id: y.id,
288
+ label: y.is_home ? a("pages.home") : y.title
289
289
  }))
290
290
  );
291
- pt({ url: W(() => _.value), reload: ue }), gt({
292
- page: i,
293
- ancestors: T,
294
- values: x,
291
+ it({ url: W(() => b.value), reload: re }), ot({
292
+ page: r,
293
+ ancestors: k,
294
+ values: _,
295
295
  prefixes: p,
296
- base: r.base,
297
- canManage: M.value,
298
- reload: () => J(!0),
299
- save: () => v()
296
+ base: o.base,
297
+ canManage: S.value,
298
+ reload: () => G(!0),
299
+ save: () => O()
300
300
  });
301
- function he(P) {
302
- i.value = P.page, T.value = P.ancestors, x.value = P.values, C.value = P.revision, _.value = P.preview_url, p.value = P.address_prefix, q.value = JSON.stringify(P.values), U.value = null;
301
+ function ge(y) {
302
+ r.value = y.page, k.value = y.ancestors, _.value = y.values, z.value = y.revision, b.value = y.preview_url, p.value = y.address_prefix, ee.value = JSON.stringify(y.values), A.value = null;
303
303
  }
304
- async function J(P = !1) {
305
- P || (B.value = !0);
304
+ async function G(y = !1) {
305
+ y || (M.value = !0);
306
306
  try {
307
- he(await l.get(f.value));
307
+ ge(await l.get(h.value));
308
308
  } catch (Y) {
309
- z.danger(c(Y)), t.push(r.base);
309
+ V.danger(c(Y)), t.push(o.base);
310
310
  } finally {
311
- B.value = !1;
311
+ M.value = !1;
312
312
  }
313
313
  }
314
- let Q;
315
- function o() {
316
- !M.value || U.value || !L.value || (clearTimeout(Q), Q = setTimeout(() => {
317
- v();
318
- }, Vt));
314
+ let X;
315
+ function ve() {
316
+ !S.value || A.value || !E.value || (clearTimeout(X), X = setTimeout(() => {
317
+ O();
318
+ }, ft));
319
319
  }
320
- function w() {
321
- !M.value || U.value || !L.value || $.value || (clearTimeout(Q), v());
320
+ function he() {
321
+ !S.value || A.value || !E.value || P.value || (clearTimeout(X), O());
322
322
  }
323
- async function v() {
324
- if (!i.value || $.value || !M.value) return;
325
- clearTimeout(Q);
326
- const P = te.value, Y = x.value;
327
- $.value = !0, le.value = {};
323
+ async function O() {
324
+ if (!r.value || P.value || !S.value) return;
325
+ clearTimeout(X);
326
+ const y = te.value, Y = _.value;
327
+ P.value = !0, le.value = {};
328
328
  try {
329
- const S = await l.save(i.value.id, { values: Y, revision: C.value });
330
- i.value = S.page, T.value = S.ancestors, C.value = S.revision, _.value = S.preview_url, p.value = S.address_prefix, U.value = null, te.value === P && (q.value = P), ue.value += 1;
331
- } catch (S) {
332
- const se = S;
333
- se.status === 409 && se.body?.data ? U.value = se.body : se.body?.errors ? (le.value = se.body.errors, z.danger(a("page.save-failed"))) : z.danger(c(S));
329
+ const D = await l.save(r.value.id, { values: Y, revision: z.value });
330
+ r.value = D.page, k.value = D.ancestors, z.value = D.revision, b.value = D.preview_url, p.value = D.address_prefix, A.value = null, te.value === y && (ee.value = y), re.value += 1;
331
+ } catch (D) {
332
+ const se = D;
333
+ se.status === 409 && se.body?.data ? A.value = se.body : se.body?.errors ? (le.value = se.body.errors, V.danger(a("page.save-failed"))) : V.danger(c(D));
334
334
  } finally {
335
- $.value = !1;
335
+ P.value = !1;
336
336
  }
337
337
  }
338
- async function X() {
339
- await O({
338
+ async function me() {
339
+ await L({
340
340
  title: a("page.conflict-theirs-title"),
341
341
  message: a("page.conflict-theirs-text"),
342
342
  confirmText: a("page.conflict-theirs"),
343
343
  cancelText: a("page.cancel"),
344
344
  tone: "danger"
345
- }) && await J(!0);
345
+ }) && await G(!0);
346
346
  }
347
- async function Ie() {
348
- const P = U.value;
349
- P && (C.value = P.data.revision, U.value = null, await v());
347
+ async function n() {
348
+ const y = A.value;
349
+ y && (z.value = y.data.revision, A.value = null, await O());
350
350
  }
351
- async function Ue() {
352
- if (!i.value) return;
353
- const P = i.value.path === null ? null : `/${i.value.path}`;
354
- if (await O({
355
- title: a("page.publish-title", { title: i.value.title }),
356
- message: P === null ? a("page.publish-text-nowhere") : a("page.publish-text", { address: P }),
351
+ async function T() {
352
+ if (!r.value) return;
353
+ const y = r.value.path === null ? null : `/${r.value.path}`;
354
+ if (await L({
355
+ title: a("page.publish-title", { title: r.value.title }),
356
+ message: y === null ? a("page.publish-text-nowhere") : a("page.publish-text", { address: y }),
357
357
  confirmText: a("page.publish"),
358
358
  cancelText: a("page.cancel")
359
- }) && (L.value && await v(), !U.value)) {
360
- D.value = !0;
359
+ }) && (E.value && await O(), !A.value)) {
360
+ B.value = !0;
361
361
  try {
362
- await l.publish(i.value.id), await J(!0), z.success(a("page.published"));
363
- } catch (S) {
364
- z.danger(c(S));
362
+ await l.publish(r.value.id), await G(!0), V.success(a("page.published"));
363
+ } catch (D) {
364
+ V.danger(c(D));
365
365
  } finally {
366
- D.value = !1;
366
+ B.value = !1;
367
367
  }
368
368
  }
369
369
  }
370
- function Re() {
371
- return i.value?.status === "published" ? "success" : i.value?.status === "modified" ? "warning" : "default";
370
+ function m() {
371
+ return r.value?.status === "published" ? "success" : r.value?.status === "modified" ? "warning" : "default";
372
372
  }
373
- function $e(P) {
374
- L.value && P.preventDefault();
373
+ function J(y) {
374
+ E.value && y.preventDefault();
375
375
  }
376
- return ae(te, o), ae(f, () => {
377
- J();
378
- }), pe(() => {
379
- J(), window.addEventListener("beforeunload", $e);
380
- }), Ke(() => {
381
- clearTimeout(Q), window.removeEventListener("beforeunload", $e);
382
- }), Ye(async () => !L.value || !M.value || (await v(), !L.value) ? !0 : await O({
376
+ ae(te, ve), ae(h, () => {
377
+ G();
378
+ }), ce(() => {
379
+ G(), window.addEventListener("beforeunload", J);
380
+ }), Ue(() => {
381
+ clearTimeout(X), window.removeEventListener("beforeunload", J);
382
+ }), Ge(async () => !E.value || !S.value || (await O(), !E.value) ? !0 : await L({
383
383
  title: a("page.leave-title"),
384
384
  message: a("page.leave-text"),
385
385
  confirmText: a("page.leave"),
386
386
  cancelText: a("page.cancel"),
387
387
  tone: "danger"
388
- })), (P, Y) => (m(), A("div", {
389
- ref_key: "root",
390
- ref: de,
388
+ }));
389
+ const Ee = W(() => {
390
+ const y = [];
391
+ return b.value && y.push({ key: "preview", label: a("page.preview"), icon: "eye", href: b.value }), r.value?.url && r.value.status !== "draft" && y.push({ key: "site", label: a("page.open-on-site"), icon: "link", href: r.value.url }), y;
392
+ });
393
+ return (y, Y) => (f(), N("div", {
391
394
  class: "wx-page-editor",
392
- onFocusout: w
395
+ onFocusout: he
393
396
  }, [
394
- B.value || !i.value ? (m(), A(j, { key: 0 }, [
395
- g(e(be), {
397
+ M.value || !r.value ? (f(), N(Z, { key: 0 }, [
398
+ v(e(ye), {
396
399
  class: "wx-page-editor__ghost",
397
400
  title: "",
398
401
  rows: 1
399
402
  }),
400
- g(e(be), { rows: 8 })
401
- ], 64)) : (m(), A(j, { key: 1 }, [
402
- E("div", xt, [
403
- g(e(Ze), {
404
- class: "wx-page-editor__back",
405
- to: u.base,
406
- label: e(a)("module.title")
407
- }, null, 8, ["to", "label"]),
408
- E("div", kt, [
409
- g(e(st), {
403
+ v(e(ye), { rows: 8 })
404
+ ], 64)) : (f(), N(Z, { key: 1 }, [
405
+ v(e(Je), {
406
+ divider: "",
407
+ back: u.base,
408
+ "back-label": e(a)("module.title"),
409
+ title: r.value.is_home ? e(a)("pages.home") : de.value || e(a)("page.untitled"),
410
+ actions: Ee.value
411
+ }, {
412
+ trail: i(() => [
413
+ v(e(tt), {
410
414
  size: "sm",
411
415
  label: e(a)("page.trail")
412
416
  }, {
413
- default: n(() => [
414
- g(e(fe), {
417
+ default: i(() => [
418
+ v(e(fe), {
415
419
  as: "router-link",
416
420
  to: u.base
417
421
  }, {
418
- default: n(() => [
419
- y(b(e(a)("module.title")), 1)
422
+ default: i(() => [
423
+ $(w(e(a)("module.title")), 1)
420
424
  ]),
421
425
  _: 1
422
426
  }, 8, ["to"]),
423
- (m(!0), A(j, null, Me(ve.value, (S) => (m(), V(e(fe), {
424
- key: S.id,
427
+ (f(!0), N(Z, null, Ce(pe.value, (D) => (f(), C(e(fe), {
428
+ key: D.id,
425
429
  as: "router-link",
426
- to: `${u.base}/${S.id}`
430
+ to: `${u.base}/${D.id}`
427
431
  }, {
428
- default: n(() => [
429
- y(b(S.label), 1)
432
+ default: i(() => [
433
+ $(w(D.label), 1)
430
434
  ]),
431
435
  _: 2
432
436
  }, 1032, ["to"]))), 128)),
433
- g(e(fe), { current: "" }, {
434
- default: n(() => [
435
- y(b(i.value.is_home ? e(a)("pages.home") : ne.value), 1)
437
+ v(e(fe), { current: "" }, {
438
+ default: i(() => [
439
+ $(w(r.value.is_home ? e(a)("pages.home") : de.value), 1)
436
440
  ]),
437
441
  _: 1
438
442
  })
439
443
  ]),
440
444
  _: 1
441
- }, 8, ["label"]),
442
- E("div", Tt, [
443
- E("span", $t, b(i.value.is_home ? e(a)("pages.home") : ne.value || e(a)("page.untitled")), 1),
444
- g(e(we), {
445
- type: Re(),
446
- dot: ""
447
- }, {
448
- default: n(() => [
449
- y(b(e(a)(`page.status-${i.value.status}`)), 1)
450
- ]),
451
- _: 1
452
- }, 8, ["type"])
453
- ])
445
+ }, 8, ["label"])
454
446
  ]),
455
- E("div", Pt, [
456
- ce.value ? (m(), V(e(ot), {
457
- key: 0,
458
- align: "end"
447
+ "title-after": i(() => [
448
+ v(e(xe), {
449
+ type: m(),
450
+ dot: ""
459
451
  }, {
460
- trigger: n(() => [
461
- g(e(it), {
462
- type: "more",
463
- title: e(a)("page.more")
464
- }, null, 8, ["title"])
465
- ]),
466
- default: n(() => [
467
- _.value ? (m(), V(e(We), {
468
- key: 0,
469
- icon: "eye",
470
- href: _.value,
471
- target: "_blank",
472
- rel: "noopener"
473
- }, {
474
- default: n(() => [
475
- y(b(e(a)("page.preview")), 1)
476
- ]),
477
- _: 1
478
- }, 8, ["href"])) : N("", !0),
479
- i.value.url && i.value.status !== "draft" ? (m(), V(e(We), {
480
- key: 1,
481
- icon: "link",
482
- href: i.value.url,
483
- target: "_blank",
484
- rel: "noopener"
485
- }, {
486
- default: n(() => [
487
- y(b(e(a)("page.open-on-site")), 1)
488
- ]),
489
- _: 1
490
- }, 8, ["href"])) : N("", !0)
452
+ default: i(() => [
453
+ $(w(e(a)(`page.status-${r.value.status}`)), 1)
491
454
  ]),
492
455
  _: 1
493
- })) : (m(), A(j, { key: 1 }, [
494
- _.value ? (m(), V(e(I), {
495
- key: 0,
496
- variant: "outline",
497
- icon: "eye",
498
- href: _.value,
499
- target: "_blank",
500
- rel: "noopener"
501
- }, {
502
- default: n(() => [
503
- y(b(e(a)("page.preview")), 1)
504
- ]),
505
- _: 1
506
- }, 8, ["href"])) : N("", !0),
507
- i.value.url && i.value.status !== "draft" ? (m(), V(e(I), {
508
- key: 1,
509
- variant: "outline",
510
- icon: "link",
511
- href: i.value.url,
512
- target: "_blank",
513
- rel: "noopener"
514
- }, {
515
- default: n(() => [
516
- y(b(e(a)("page.open-on-site")), 1)
517
- ]),
518
- _: 1
519
- }, 8, ["href"])) : N("", !0)
520
- ], 64))
521
- ])
522
- ]),
523
- U.value ? (m(), V(e(xe), {
456
+ }, 8, ["type"])
457
+ ]),
458
+ _: 1
459
+ }, 8, ["back", "back-label", "title", "actions"]),
460
+ A.value ? (f(), C(e(ke), {
524
461
  key: 0,
525
462
  type: "warning",
526
463
  title: e(a)("page.conflict-title"),
527
- description: U.value.message
464
+ description: A.value.message
528
465
  }, {
529
- actions: n(() => [
530
- g(e(I), {
466
+ actions: i(() => [
467
+ v(e(R), {
531
468
  size: "sm",
532
469
  variant: "outline",
533
- onClick: X
470
+ onClick: me
534
471
  }, {
535
- default: n(() => [
536
- y(b(e(a)("page.conflict-theirs")), 1)
472
+ default: i(() => [
473
+ $(w(e(a)("page.conflict-theirs")), 1)
537
474
  ]),
538
475
  _: 1
539
476
  }),
540
- g(e(I), {
477
+ v(e(R), {
541
478
  size: "sm",
542
479
  type: "primary",
543
- onClick: Ie
480
+ onClick: n
544
481
  }, {
545
- default: n(() => [
546
- y(b(e(a)("page.conflict-mine")), 1)
482
+ default: i(() => [
483
+ $(w(e(a)("page.conflict-mine")), 1)
547
484
  ]),
548
485
  _: 1
549
486
  })
550
487
  ]),
551
488
  _: 1
552
- }, 8, ["title", "description"])) : N("", !0),
553
- E("div", Wt, [
554
- g(e(qe), {
555
- modelValue: x.value,
556
- "onUpdate:modelValue": Y[0] || (Y[0] = (S) => x.value = S),
489
+ }, 8, ["title", "description"])) : I("", !0),
490
+ K("div", mt, [
491
+ v(e(Qe), {
492
+ modelValue: _.value,
493
+ "onUpdate:modelValue": Y[0] || (Y[0] = (D) => _.value = D),
557
494
  name: "pages.form",
558
495
  errors: le.value,
559
- disabled: !M.value || D.value
496
+ disabled: !S.value || B.value
560
497
  }, null, 8, ["modelValue", "errors", "disabled"])
561
498
  ]),
562
- M.value ? (m(), V(e(rt), { key: 1 }, {
563
- state: n(() => [
564
- g(e(R), {
499
+ S.value ? (f(), C(e(at), { key: 1 }, {
500
+ state: i(() => [
501
+ v(e(U), {
565
502
  size: "sm",
566
503
  tone: "muted"
567
504
  }, {
568
- default: n(() => [
569
- y(b(e(a)(`page.state-${ge.value}`)), 1)
505
+ default: i(() => [
506
+ $(w(e(a)(`page.state-${ue.value}`)), 1)
570
507
  ]),
571
508
  _: 1
572
509
  })
573
510
  ]),
574
- default: n(() => [
575
- g(e(I), {
511
+ default: i(() => [
512
+ v(e(R), {
576
513
  variant: "outline",
577
- loading: $.value,
578
- disabled: !L.value,
579
- onClick: v
514
+ loading: P.value,
515
+ disabled: !E.value,
516
+ onClick: O
580
517
  }, {
581
- default: n(() => [
582
- y(b(e(a)("page.save")), 1)
518
+ default: i(() => [
519
+ $(w(e(a)("page.save")), 1)
583
520
  ]),
584
521
  _: 1
585
522
  }, 8, ["loading", "disabled"]),
586
- g(e(I), {
523
+ v(e(R), {
587
524
  type: "primary",
588
- loading: D.value,
589
- disabled: i.value.status === "published" && !L.value,
590
- onClick: Ue
525
+ loading: B.value,
526
+ disabled: r.value.status === "published" && !E.value,
527
+ onClick: T
591
528
  }, {
592
- default: n(() => [
593
- y(b(e(a)("page.publish")), 1)
529
+ default: i(() => [
530
+ $(w(e(a)("page.publish")), 1)
594
531
  ]),
595
532
  _: 1
596
533
  }, 8, ["loading", "disabled"])
597
534
  ]),
598
535
  _: 1
599
- })) : N("", !0)
536
+ })) : I("", !0)
600
537
  ], 64))
601
- ], 544));
538
+ ], 32));
602
539
  }
603
- }), Bt = /* @__PURE__ */ re(Ct, [["__scopeId", "data-v-268d0501"]]), Mt = { class: "wx-page-history" }, Dt = { class: "wx-page-history__number" }, St = { class: "wx-page-history__who" }, Nt = /* @__PURE__ */ K({
540
+ }), yt = /* @__PURE__ */ oe(bt, [["__scopeId", "data-v-a68a7efb"]]), wt = { class: "wx-page-history" }, _t = { class: "wx-page-history__number" }, xt = { class: "wx-page-history__who" }, kt = /* @__PURE__ */ F({
604
541
  name: "WxPageHistory",
605
542
  __name: "PageHistory",
606
543
  setup(u) {
607
- const r = G(), h = Z(r), l = ke();
608
- H();
609
- const s = F("webx-pages"), t = ie(), d = k(null), a = k(!1), c = W(() => l?.page.value ?? null), f = W(() => r.can("pages.manage")), i = W(
544
+ const o = Q(), g = q(o), l = Te();
545
+ j();
546
+ const s = H("webx-pages"), t = ie(), d = x(null), a = x(!1), c = W(() => l?.page.value ?? null), h = W(() => o.can("pages.manage")), r = W(
610
547
  () => c.value?.published_at ? d.value?.[0]?.number ?? null : null
611
548
  );
612
- async function T() {
613
- const C = c.value;
614
- if (C)
549
+ async function k() {
550
+ const z = c.value;
551
+ if (z)
615
552
  try {
616
- d.value = await h.versions(C.id);
617
- } catch (_) {
618
- d.value = [], z.danger(t(_));
553
+ d.value = await g.versions(z.id);
554
+ } catch (b) {
555
+ d.value = [], V.danger(t(b));
619
556
  }
620
557
  }
621
- async function x(C) {
622
- const _ = c.value;
623
- if (!(!_ || !await O({
624
- title: s("page.restore-title", { number: C.number }),
558
+ async function _(z) {
559
+ const b = c.value;
560
+ if (!(!b || !await L({
561
+ title: s("page.restore-title", { number: z.number }),
625
562
  message: s("page.restore-text"),
626
563
  confirmText: s("page.restore"),
627
564
  cancelText: s("page.cancel")
628
565
  }))) {
629
566
  a.value = !0;
630
567
  try {
631
- await h.restoreVersion(_.id, C.number), await l?.reload(), z.success(s("page.restored-version", { number: C.number }));
632
- } catch (B) {
633
- z.danger(t(B));
568
+ await g.restoreVersion(b.id, z.number), await l?.reload(), V.success(s("page.restored-version", { number: z.number }));
569
+ } catch (M) {
570
+ V.danger(t(M));
634
571
  } finally {
635
572
  a.value = !1;
636
573
  }
@@ -639,72 +576,72 @@ const ht = { class: "wx-page-danger" }, ft = {
639
576
  return ae(
640
577
  () => [c.value?.id, c.value?.published_at, c.value?.updated_at],
641
578
  () => {
642
- T();
579
+ k();
643
580
  },
644
581
  {
645
582
  immediate: !0
646
583
  }
647
- ), (C, _) => (m(), A("div", Mt, [
648
- d.value === null ? (m(), V(e(be), {
584
+ ), (z, b) => (f(), N("div", wt, [
585
+ d.value === null ? (f(), C(e(ye), {
649
586
  key: 0,
650
587
  class: "wx-page-history__ghost",
651
588
  rows: 3
652
- })) : d.value.length === 0 ? (m(), V(e(ut), {
589
+ })) : d.value.length === 0 ? (f(), C(e(lt), {
653
590
  key: 1,
654
591
  description: e(s)("page.history-empty")
655
- }, null, 8, ["description"])) : (m(!0), A(j, { key: 2 }, Me(d.value, (p) => (m(), A("div", {
592
+ }, null, 8, ["description"])) : (f(!0), N(Z, { key: 2 }, Ce(d.value, (p) => (f(), N("div", {
656
593
  key: p.number,
657
- class: Fe(["wx-page-history__row", { "is-live": p.number === i.value }])
594
+ class: Re(["wx-page-history__row", { "is-live": p.number === r.value }])
658
595
  }, [
659
- E("code", Dt, b(e(s)("page.version", { number: p.number })), 1),
660
- E("div", St, [
661
- p.created_at ? (m(), V(e(me), {
596
+ K("code", _t, w(e(s)("page.version", { number: p.number })), 1),
597
+ K("div", xt, [
598
+ p.created_at ? (f(), C(e(be), {
662
599
  key: 0,
663
600
  value: p.created_at,
664
601
  size: "md",
665
602
  tone: "default"
666
- }, null, 8, ["value"])) : N("", !0),
667
- g(e(R), {
603
+ }, null, 8, ["value"])) : I("", !0),
604
+ v(e(U), {
668
605
  size: "sm",
669
606
  tone: "muted"
670
607
  }, {
671
- default: n(() => [
672
- y(b(p.author ?? e(s)(`page.source-${p.source}`)) + " ", 1),
673
- p.comment ? (m(), A(j, { key: 0 }, [
674
- y(" · " + b(p.comment), 1)
675
- ], 64)) : N("", !0)
608
+ default: i(() => [
609
+ $(w(p.author ?? e(s)(`page.source-${p.source}`)) + " ", 1),
610
+ p.comment ? (f(), N(Z, { key: 0 }, [
611
+ $(" · " + w(p.comment), 1)
612
+ ], 64)) : I("", !0)
676
613
  ]),
677
614
  _: 2
678
615
  }, 1024)
679
616
  ]),
680
- p.number === i.value ? (m(), V(e(we), {
617
+ p.number === r.value ? (f(), C(e(xe), {
681
618
  key: 0,
682
619
  type: "success",
683
620
  dot: ""
684
621
  }, {
685
- default: n(() => [
686
- y(b(e(s)("page.version-live")), 1)
622
+ default: i(() => [
623
+ $(w(e(s)("page.version-live")), 1)
687
624
  ]),
688
625
  _: 1
689
- })) : N("", !0),
690
- f.value && p.number !== i.value ? (m(), V(e(I), {
626
+ })) : I("", !0),
627
+ h.value && p.number !== r.value ? (f(), C(e(R), {
691
628
  key: 1,
692
629
  size: "sm",
693
630
  variant: "outline",
694
631
  loading: a.value,
695
- onClick: (B) => x(p)
632
+ onClick: (M) => _(p)
696
633
  }, {
697
- default: n(() => [
698
- y(b(e(s)("page.restore")), 1)
634
+ default: i(() => [
635
+ $(w(e(s)("page.restore")), 1)
699
636
  ]),
700
637
  _: 1
701
- }, 8, ["loading", "onClick"])) : N("", !0)
638
+ }, 8, ["loading", "onClick"])) : I("", !0)
702
639
  ], 2))), 128))
703
640
  ]));
704
641
  }
705
- }), At = /* @__PURE__ */ re(Nt, [["__scopeId", "data-v-41bcd106"]]), Te = /* @__PURE__ */ K({
642
+ }), Tt = /* @__PURE__ */ oe(kt, [["__scopeId", "data-v-41bcd106"]]), $e = /* @__PURE__ */ F({
706
643
  __name: "PagePicker",
707
- props: /* @__PURE__ */ je({
644
+ props: /* @__PURE__ */ Oe({
708
645
  exclude: { default: () => [] },
709
646
  placeholder: { default: void 0 },
710
647
  selected: { default: () => [] }
@@ -714,74 +651,74 @@ const ht = { class: "wx-page-danger" }, ft = {
714
651
  }),
715
652
  emits: ["update:modelValue"],
716
653
  setup(u) {
717
- const r = u, h = He(u, "modelValue"), l = G(), s = Z(l);
718
- H();
719
- const t = F("webx-pages"), d = k([]);
720
- pe(async () => {
721
- const f = await s.list();
722
- f.home && (d.value = [
654
+ const o = u, g = Le(u, "modelValue"), l = Q(), s = q(l);
655
+ j();
656
+ const t = H("webx-pages"), d = x([]);
657
+ ce(async () => {
658
+ const h = await s.list();
659
+ h.home && (d.value = [
723
660
  a(
724
- f.home,
725
- f.items.map((i) => a(i))
661
+ h.home,
662
+ h.items.map((r) => a(r))
726
663
  )
727
664
  ]);
728
665
  });
729
- function a(f, i) {
666
+ function a(h, r) {
730
667
  return {
731
- id: f.id,
732
- label: f.is_home ? t("pages.home") : f.title,
733
- disabled: r.exclude.includes(f.id),
734
- leaf: f.children_count === 0,
735
- ...i ? { children: i } : {}
668
+ id: h.id,
669
+ label: h.is_home ? t("pages.home") : h.title,
670
+ disabled: o.exclude.includes(h.id),
671
+ leaf: h.children_count === 0,
672
+ ...r ? { children: r } : {}
736
673
  };
737
674
  }
738
- async function c(f) {
739
- return (await s.list({ parent: Number(f.id) })).items.map((T) => a(T));
675
+ async function c(h) {
676
+ return (await s.list({ parent: Number(h.id) })).items.map((k) => a(k));
740
677
  }
741
- return (f, i) => (m(), V(e(dt), {
742
- modelValue: h.value,
743
- "onUpdate:modelValue": i[0] || (i[0] = (T) => h.value = T),
678
+ return (h, r) => (f(), C(e(st), {
679
+ modelValue: g.value,
680
+ "onUpdate:modelValue": r[0] || (r[0] = (k) => g.value = k),
744
681
  nodes: d.value,
745
682
  lazy: "",
746
683
  load: c,
747
684
  "show-path": "",
748
685
  clearable: "",
749
- "selected-path": r.selected.map((T) => ({
750
- id: T.id,
751
- label: T.is_home ? e(t)("pages.home") : T.title
686
+ "selected-path": o.selected.map((k) => ({
687
+ id: k.id,
688
+ label: k.is_home ? e(t)("pages.home") : k.title
752
689
  })),
753
- placeholder: r.placeholder ?? e(t)("page.field-parent"),
690
+ placeholder: o.placeholder ?? e(t)("page.field-parent"),
754
691
  "aria-label": e(t)("page.field-parent"),
755
692
  teleport: ""
756
693
  }, null, 8, ["modelValue", "nodes", "selected-path", "placeholder", "aria-label"]));
757
694
  }
758
- }), Et = {
695
+ }), $t = {
759
696
  key: 0,
760
697
  class: "wx-page-place"
761
- }, It = /* @__PURE__ */ K({
698
+ }, Pt = /* @__PURE__ */ F({
762
699
  name: "WxPagePlace",
763
700
  __name: "PagePlace",
764
701
  setup(u) {
765
- const r = G(), h = Z(r), l = ke(), s = Se();
766
- H();
767
- const t = F("webx-pages"), d = ie(), a = k(!1), c = k(null), f = W(() => l?.page.value ?? null), i = W(() => l?.ancestors.value.length === 0 ? null : l?.prefixes.value[s.active.value] ?? null), T = W(() => {
768
- const _ = l?.values.value.slug;
769
- return typeof _ == "string" ? _ : _?.[s.active.value] ?? "";
770
- }), x = W(() => f.value?.is_home ? "/" : i.value === null || T.value === "" ? null : `/${[i.value, T.value].filter(Boolean).join("/")}`);
702
+ const o = Q(), g = q(o), l = Te(), s = Se();
703
+ j();
704
+ const t = H("webx-pages"), d = ie(), a = x(!1), c = x(null), h = W(() => l?.page.value ?? null), r = W(() => l?.ancestors.value.length === 0 ? null : l?.prefixes.value[s.active.value] ?? null), k = W(() => {
705
+ const b = l?.values.value.slug;
706
+ return typeof b == "string" ? b : b?.[s.active.value] ?? "";
707
+ }), _ = W(() => h.value?.is_home ? "/" : r.value === null || k.value === "" ? null : `/${[r.value, k.value].filter(Boolean).join("/")}`);
771
708
  ae(
772
- f,
773
- (_) => {
774
- c.value = _?.parent_id ?? null;
709
+ h,
710
+ (b) => {
711
+ c.value = b?.parent_id ?? null;
775
712
  },
776
713
  { immediate: !0 }
777
714
  );
778
- async function C(_) {
779
- const p = f.value;
780
- if (!p || _ === null || _ === p.parent_id || a.value) return;
781
- const B = p.descendants_count + 1;
782
- if (B > 1 && !await O({
715
+ async function z(b) {
716
+ const p = h.value;
717
+ if (!p || b === null || b === p.parent_id || a.value) return;
718
+ const M = p.descendants_count + 1;
719
+ if (M > 1 && !await L({
783
720
  title: t("page.move-title", { title: p.title }),
784
- message: t("page.move-branch", { count: B }),
721
+ message: t("page.move-branch", { count: M }),
785
722
  confirmText: t("page.move-confirm"),
786
723
  cancelText: t("page.cancel")
787
724
  })) {
@@ -790,82 +727,82 @@ const ht = { class: "wx-page-danger" }, ft = {
790
727
  }
791
728
  a.value = !0;
792
729
  try {
793
- const $ = await h.move(p.id, _, "inside");
794
- z.success(
795
- $.addresses_changed > 1 ? t("page.moved", { count: $.addresses_changed }) : t("page.moved-one")
730
+ const P = await g.move(p.id, b, "inside");
731
+ V.success(
732
+ P.addresses_changed > 1 ? t("page.moved", { count: P.addresses_changed }) : t("page.moved-one")
796
733
  ), await l?.reload();
797
- } catch ($) {
798
- z.danger(d($)), c.value = p.parent_id;
734
+ } catch (P) {
735
+ V.danger(d(P)), c.value = p.parent_id;
799
736
  } finally {
800
737
  a.value = !1;
801
738
  }
802
739
  }
803
- return (_, p) => f.value ? (m(), A("div", Et, [
804
- g(e(oe), {
740
+ return (b, p) => h.value ? (f(), N("div", $t, [
741
+ v(e(ne), {
805
742
  label: e(t)("page.address")
806
743
  }, {
807
- default: n(() => [
808
- x.value ? (m(), V(e(R), {
744
+ default: i(() => [
745
+ _.value ? (f(), C(e(U), {
809
746
  key: 0,
810
747
  mono: "",
811
748
  class: "wx-page-place__address"
812
749
  }, {
813
- default: n(() => [
814
- y(b(x.value), 1)
750
+ default: i(() => [
751
+ $(w(_.value), 1)
815
752
  ]),
816
753
  _: 1
817
- })) : (m(), V(e(R), {
754
+ })) : (f(), C(e(U), {
818
755
  key: 1,
819
756
  size: "sm",
820
757
  tone: "muted"
821
758
  }, {
822
- default: n(() => [
823
- y(b(e(t)("page.no-address")), 1)
759
+ default: i(() => [
760
+ $(w(e(t)("page.no-address")), 1)
824
761
  ]),
825
762
  _: 1
826
763
  }))
827
764
  ]),
828
765
  _: 1
829
766
  }, 8, ["label"]),
830
- f.value.can.move ? (m(), A(j, { key: 0 }, [
831
- g(e(oe), {
767
+ h.value.can.move ? (f(), N(Z, { key: 0 }, [
768
+ v(e(ne), {
832
769
  label: e(t)("page.field-parent"),
833
770
  help: e(t)("page.parent-help")
834
771
  }, {
835
- default: n(() => [
836
- g(Te, {
772
+ default: i(() => [
773
+ v($e, {
837
774
  modelValue: c.value,
838
775
  "onUpdate:modelValue": [
839
- p[0] || (p[0] = (B) => c.value = B),
840
- C
776
+ p[0] || (p[0] = (M) => c.value = M),
777
+ z
841
778
  ],
842
- exclude: [f.value.id],
779
+ exclude: [h.value.id],
843
780
  selected: e(l)?.ancestors.value ?? []
844
781
  }, null, 8, ["modelValue", "exclude", "selected"])
845
782
  ]),
846
783
  _: 1
847
784
  }, 8, ["label", "help"]),
848
- g(e(xe), {
785
+ v(e(ke), {
849
786
  type: "info",
850
787
  variant: "soft",
851
788
  description: e(t)("page.parent-warning")
852
789
  }, null, 8, ["description"])
853
- ], 64)) : N("", !0)
854
- ])) : N("", !0);
790
+ ], 64)) : I("", !0)
791
+ ])) : I("", !0);
855
792
  }
856
- }), Ut = /* @__PURE__ */ re(It, [["__scopeId", "data-v-bf094be2"]]), Rt = /* @__PURE__ */ K({
793
+ }), Wt = /* @__PURE__ */ oe(Pt, [["__scopeId", "data-v-bf094be2"]]), Vt = /* @__PURE__ */ F({
857
794
  __name: "PageActions",
858
795
  props: {
859
796
  page: {},
860
797
  inBin: { type: Boolean, default: !1 }
861
798
  },
862
799
  emits: ["open", "add", "duplicate", "move", "copy", "remove", "restore"],
863
- setup(u, { emit: r }) {
864
- const h = u, l = r;
865
- H();
866
- const s = F("webx-pages"), t = W(() => {
867
- const d = h.page;
868
- if (h.inBin)
800
+ setup(u, { emit: o }) {
801
+ const g = u, l = o;
802
+ j();
803
+ const s = H("webx-pages"), t = W(() => {
804
+ const d = g.page;
805
+ if (g.inBin)
869
806
  return [
870
807
  {
871
808
  key: "restore",
@@ -906,12 +843,12 @@ const ht = { class: "wx-page-danger" }, ft = {
906
843
  run: () => l("remove", d)
907
844
  }), a;
908
845
  });
909
- return (d, a) => (m(), V(e(et), {
846
+ return (d, a) => (f(), C(e(Xe), {
910
847
  actions: t.value,
911
- label: h.page.title
848
+ label: g.page.title
912
849
  }, null, 8, ["actions", "label"]));
913
850
  }
914
- }), Lt = {
851
+ }), zt = {
915
852
  а: "a",
916
853
  б: "b",
917
854
  в: "v",
@@ -970,67 +907,67 @@ const ht = { class: "wx-page-danger" }, ft = {
970
907
  ź: "z",
971
908
  ż: "z"
972
909
  };
973
- function Ot(u) {
974
- return u.toLowerCase().split("").map((r) => Lt[r] ?? r).join("").normalize("NFD").replace(/[̀-ͯ]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
910
+ function Ct(u) {
911
+ return u.toLowerCase().split("").map((o) => zt[o] ?? o).join("").normalize("NFD").replace(/[̀-ͯ]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
975
912
  }
976
- const Kt = /* @__PURE__ */ K({
913
+ const Mt = /* @__PURE__ */ F({
977
914
  __name: "PageCreateDialog",
978
915
  props: {
979
916
  parent: { default: null }
980
917
  },
981
918
  setup(u) {
982
- const r = u, { open: h, resolve: l, dismiss: s } = Ne(), t = G(), d = Z(t);
983
- H();
984
- const a = F("webx-pages"), c = k(""), f = k(""), i = k(r.parent?.id ?? null), T = k(!1), x = k({}), C = Be("field"), _ = k(!1);
985
- ae(c, (B) => {
986
- _.value || (f.value = Ot(B));
987
- }), pe(async () => {
988
- await Ge(), C.value?.querySelector("input")?.focus();
919
+ const o = u, { open: g, resolve: l, dismiss: s } = Be(), t = Q(), d = q(t);
920
+ j();
921
+ const a = H("webx-pages"), c = x(""), h = x(""), r = x(o.parent?.id ?? null), k = x(!1), _ = x({}), z = Ke("field"), b = x(!1);
922
+ ae(c, (M) => {
923
+ b.value || (h.value = Ct(M));
924
+ }), ce(async () => {
925
+ await Fe(), z.value?.querySelector("input")?.focus();
989
926
  });
990
927
  async function p() {
991
- if (!(c.value.trim() === "" || T.value)) {
992
- T.value = !0, x.value = {};
928
+ if (!(c.value.trim() === "" || k.value)) {
929
+ k.value = !0, _.value = {};
993
930
  try {
994
931
  l(
995
932
  await d.create({
996
933
  title: c.value.trim(),
997
- slug: f.value.trim(),
998
- parent_id: i.value
934
+ slug: h.value.trim(),
935
+ parent_id: r.value
999
936
  })
1000
937
  );
1001
- } catch (B) {
1002
- x.value = B.body?.errors ?? {};
938
+ } catch (M) {
939
+ _.value = M.body?.errors ?? {};
1003
940
  } finally {
1004
- T.value = !1;
941
+ k.value = !1;
1005
942
  }
1006
943
  }
1007
944
  }
1008
- return (B, $) => (m(), V(e(Ae), {
1009
- open: e(h),
1010
- "onUpdate:open": $[5] || ($[5] = (D) => De(h) ? h.value = D : null),
945
+ return (M, P) => (f(), C(e(De), {
946
+ open: e(g),
947
+ "onUpdate:open": P[5] || (P[5] = (B) => Me(g) ? g.value = B : null),
1011
948
  title: e(a)("page.new-title"),
1012
949
  width: 460
1013
950
  }, {
1014
- footer: n(() => [
1015
- g(e(_e), { size: "sm" }, {
1016
- default: n(() => [
1017
- g(e(I), {
951
+ footer: i(() => [
952
+ v(e(we), { size: "sm" }, {
953
+ default: i(() => [
954
+ v(e(R), {
1018
955
  variant: "outline",
1019
- onClick: $[4] || ($[4] = (D) => e(s)())
956
+ onClick: P[4] || (P[4] = (B) => e(s)())
1020
957
  }, {
1021
- default: n(() => [
1022
- y(b(e(a)("page.cancel")), 1)
958
+ default: i(() => [
959
+ $(w(e(a)("page.cancel")), 1)
1023
960
  ]),
1024
961
  _: 1
1025
962
  }),
1026
- g(e(I), {
963
+ v(e(R), {
1027
964
  type: "primary",
1028
- loading: T.value,
965
+ loading: k.value,
1029
966
  disabled: c.value.trim() === "",
1030
967
  onClick: p
1031
968
  }, {
1032
- default: n(() => [
1033
- y(b(e(a)("page.create")), 1)
969
+ default: i(() => [
970
+ $(w(e(a)("page.create")), 1)
1034
971
  ]),
1035
972
  _: 1
1036
973
  }, 8, ["loading", "disabled"])
@@ -1038,20 +975,20 @@ const Kt = /* @__PURE__ */ K({
1038
975
  _: 1
1039
976
  })
1040
977
  ]),
1041
- default: n(() => [
1042
- g(e(oe), {
978
+ default: i(() => [
979
+ v(e(ne), {
1043
980
  label: e(a)("page.field-title"),
1044
- error: x.value.title?.[0],
981
+ error: _.value.title?.[0],
1045
982
  required: ""
1046
983
  }, {
1047
- default: n(() => [
1048
- E("div", {
984
+ default: i(() => [
985
+ K("div", {
1049
986
  ref_key: "field",
1050
- ref: C
987
+ ref: z
1051
988
  }, [
1052
- g(e(Ve), {
989
+ v(e(We), {
1053
990
  modelValue: c.value,
1054
- "onUpdate:modelValue": $[0] || ($[0] = (D) => c.value = D),
991
+ "onUpdate:modelValue": P[0] || (P[0] = (B) => c.value = B),
1055
992
  "aria-label": e(a)("page.field-title"),
1056
993
  onKeyup: Pe(p, ["enter"])
1057
994
  }, null, 8, ["modelValue", "aria-label"])
@@ -1059,31 +996,31 @@ const Kt = /* @__PURE__ */ K({
1059
996
  ]),
1060
997
  _: 1
1061
998
  }, 8, ["label", "error"]),
1062
- g(e(oe), {
999
+ v(e(ne), {
1063
1000
  label: e(a)("page.field-slug"),
1064
- error: x.value.slug?.[0],
1001
+ error: _.value.slug?.[0],
1065
1002
  help: e(a)("page.slug-help")
1066
1003
  }, {
1067
- default: n(() => [
1068
- g(e(Ve), {
1069
- modelValue: f.value,
1070
- "onUpdate:modelValue": $[1] || ($[1] = (D) => f.value = D),
1004
+ default: i(() => [
1005
+ v(e(We), {
1006
+ modelValue: h.value,
1007
+ "onUpdate:modelValue": P[1] || (P[1] = (B) => h.value = B),
1071
1008
  "aria-label": e(a)("page.field-slug"),
1072
- onInput: $[2] || ($[2] = (D) => _.value = !0),
1009
+ onInput: P[2] || (P[2] = (B) => b.value = !0),
1073
1010
  onKeyup: Pe(p, ["enter"])
1074
1011
  }, null, 8, ["modelValue", "aria-label"])
1075
1012
  ]),
1076
1013
  _: 1
1077
1014
  }, 8, ["label", "error", "help"]),
1078
- g(e(oe), {
1015
+ v(e(ne), {
1079
1016
  label: e(a)("page.field-parent"),
1080
- error: x.value.parent_id?.[0]
1017
+ error: _.value.parent_id?.[0]
1081
1018
  }, {
1082
- default: n(() => [
1083
- g(Te, {
1084
- modelValue: i.value,
1085
- "onUpdate:modelValue": $[3] || ($[3] = (D) => i.value = D),
1086
- selected: r.parent ? [r.parent] : []
1019
+ default: i(() => [
1020
+ v($e, {
1021
+ modelValue: r.value,
1022
+ "onUpdate:modelValue": P[3] || (P[3] = (B) => r.value = B),
1023
+ selected: o.parent ? [o.parent] : []
1087
1024
  }, null, 8, ["modelValue", "selected"])
1088
1025
  ]),
1089
1026
  _: 1
@@ -1092,40 +1029,40 @@ const Kt = /* @__PURE__ */ K({
1092
1029
  _: 1
1093
1030
  }, 8, ["open", "title"]));
1094
1031
  }
1095
- }), Ft = /* @__PURE__ */ K({
1032
+ }), St = /* @__PURE__ */ F({
1096
1033
  __name: "PageMoveDialog",
1097
1034
  props: {
1098
1035
  page: {}
1099
1036
  },
1100
1037
  setup(u) {
1101
- const r = u, { open: h, resolve: l, dismiss: s } = Ne();
1102
- H();
1103
- const t = F("webx-pages"), d = k(r.page.parent_id);
1104
- return (a, c) => (m(), V(e(Ae), {
1105
- open: e(h),
1106
- "onUpdate:open": c[3] || (c[3] = (f) => De(h) ? h.value = f : null),
1107
- title: e(t)("page.move-title", { title: r.page.title }),
1038
+ const o = u, { open: g, resolve: l, dismiss: s } = Be();
1039
+ j();
1040
+ const t = H("webx-pages"), d = x(o.page.parent_id);
1041
+ return (a, c) => (f(), C(e(De), {
1042
+ open: e(g),
1043
+ "onUpdate:open": c[3] || (c[3] = (h) => Me(g) ? g.value = h : null),
1044
+ title: e(t)("page.move-title", { title: o.page.title }),
1108
1045
  width: 460
1109
1046
  }, {
1110
- footer: n(() => [
1111
- g(e(_e), { size: "sm" }, {
1112
- default: n(() => [
1113
- g(e(I), {
1047
+ footer: i(() => [
1048
+ v(e(we), { size: "sm" }, {
1049
+ default: i(() => [
1050
+ v(e(R), {
1114
1051
  variant: "outline",
1115
- onClick: c[1] || (c[1] = (f) => e(s)())
1052
+ onClick: c[1] || (c[1] = (h) => e(s)())
1116
1053
  }, {
1117
- default: n(() => [
1118
- y(b(e(t)("page.cancel")), 1)
1054
+ default: i(() => [
1055
+ $(w(e(t)("page.cancel")), 1)
1119
1056
  ]),
1120
1057
  _: 1
1121
1058
  }),
1122
- g(e(I), {
1059
+ v(e(R), {
1123
1060
  type: "primary",
1124
- disabled: d.value === null || d.value === r.page.parent_id,
1125
- onClick: c[2] || (c[2] = (f) => e(l)(d.value))
1061
+ disabled: d.value === null || d.value === o.page.parent_id,
1062
+ onClick: c[2] || (c[2] = (h) => e(l)(d.value))
1126
1063
  }, {
1127
- default: n(() => [
1128
- y(b(e(t)("page.move-confirm")), 1)
1064
+ default: i(() => [
1065
+ $(w(e(t)("page.move-confirm")), 1)
1129
1066
  ]),
1130
1067
  _: 1
1131
1068
  }, 8, ["disabled"])
@@ -1133,22 +1070,22 @@ const Kt = /* @__PURE__ */ K({
1133
1070
  _: 1
1134
1071
  })
1135
1072
  ]),
1136
- default: n(() => [
1137
- g(e(_e), {
1073
+ default: i(() => [
1074
+ v(e(we), {
1138
1075
  direction: "vertical",
1139
1076
  size: "md",
1140
1077
  fill: ""
1141
1078
  }, {
1142
- default: n(() => [
1143
- g(e(xe), {
1079
+ default: i(() => [
1080
+ v(e(ke), {
1144
1081
  type: "info",
1145
1082
  variant: "soft",
1146
1083
  description: e(t)("page.move-help")
1147
1084
  }, null, 8, ["description"]),
1148
- g(Te, {
1085
+ v($e, {
1149
1086
  modelValue: d.value,
1150
- "onUpdate:modelValue": c[0] || (c[0] = (f) => d.value = f),
1151
- exclude: [r.page.id]
1087
+ "onUpdate:modelValue": c[0] || (c[0] = (h) => d.value = h),
1088
+ exclude: [o.page.id]
1152
1089
  }, null, 8, ["modelValue", "exclude"])
1153
1090
  ]),
1154
1091
  _: 1
@@ -1157,25 +1094,25 @@ const Kt = /* @__PURE__ */ K({
1157
1094
  _: 1
1158
1095
  }, 8, ["open", "title"]));
1159
1096
  }
1160
- }), Ht = { class: "wx-pages" }, jt = { class: "wx-pages__title" }, Gt = ["href"], Jt = /* @__PURE__ */ K({
1097
+ }), Bt = { class: "wx-pages" }, Dt = { class: "wx-pages__title" }, Nt = ["href"], Et = /* @__PURE__ */ F({
1161
1098
  __name: "PagesPage",
1162
1099
  props: {
1163
1100
  base: { default: "/pages" }
1164
1101
  },
1165
1102
  setup(u) {
1166
- const r = u, h = G(), l = Z(h), s = ye();
1167
- H();
1168
- const t = F("webx-pages"), d = ie(), a = k(null), c = k([]), f = k(!0), i = k(""), T = k(""), x = ze(Kt), C = ze(Ft), _ = W(() => h.can("pages.manage")), p = W(() => T.value === "trashed"), B = W(() => !p.value && i.value.trim() === ""), $ = W(
1169
- () => h.state.manifest?.modules.find((o) => o.id === "pages")?.title ?? t("module.title")
1170
- ), D = W(() => [
1103
+ const o = u, g = Q(), l = q(g), s = _e();
1104
+ j();
1105
+ const t = H("webx-pages"), d = ie(), a = x(null), c = x([]), h = x(!0), r = x(""), k = x(""), _ = Ve(Mt), z = Ve(St), b = W(() => g.can("pages.manage")), p = W(() => k.value === "trashed"), M = W(() => !p.value && r.value.trim() === ""), P = W(
1106
+ () => g.state.manifest?.modules.find((n) => n.id === "pages")?.title ?? t("module.title")
1107
+ ), B = W(() => [
1171
1108
  { value: "", label: t("page.filter-all") },
1172
1109
  { value: "draft", label: t("page.filter-draft") },
1173
1110
  { value: "published", label: t("page.filter-published") },
1174
1111
  { value: "modified", label: t("page.filter-modified") },
1175
1112
  { value: "trashed", label: t("page.bin"), icon: "trash" }
1176
1113
  ]), le = W(
1177
- () => B.value && a.value ? [{ ...a.value, children_count: 0 }, ...c.value] : c.value
1178
- ), U = W(() => [
1114
+ () => M.value && a.value ? [{ ...a.value, children_count: 0 }, ...c.value] : c.value
1115
+ ), A = W(() => [
1179
1116
  { key: "title", label: t("page.column-title"), minWidth: 200 },
1180
1117
  { key: "path", label: t("page.column-address"), width: 200, hideBelow: 560 },
1181
1118
  // In the bin the state of a page is not what it was published as — it is off the site either
@@ -1184,290 +1121,281 @@ const Kt = /* @__PURE__ */ K({
1184
1121
  key: "status",
1185
1122
  label: p.value ? t("page.column-deleted") : t("page.column-status"),
1186
1123
  align: "center",
1187
- width: 130,
1124
+ width: 150,
1188
1125
  hideBelow: 620
1189
1126
  },
1190
1127
  {
1191
1128
  key: "updated_at",
1192
1129
  label: t("page.column-updated"),
1193
- width: 180,
1130
+ width: 150,
1194
1131
  hideBelow: 900,
1195
1132
  hidden: p.value
1196
1133
  },
1197
- { key: "actions", label: "", width: 56, align: "right" }
1198
- ]), q = W(
1199
- () => B.value ? {
1134
+ { key: "actions", label: "", width: Ye, align: "right" }
1135
+ ]), ee = W(
1136
+ () => M.value ? {
1200
1137
  childrenKey: "children",
1201
1138
  hasChildrenKey: "children_count",
1202
1139
  lazy: !0,
1203
- load: (o) => l.list({ parent: o.id }).then((w) => w.items),
1204
- draggable: _.value,
1205
- allowDrag: (o) => o.can.move,
1206
- allowDrop: ue
1140
+ load: (n) => l.list({ parent: n.id }).then((T) => T.items),
1141
+ draggable: b.value,
1142
+ allowDrag: (n) => n.can.move,
1143
+ allowDrop: re
1207
1144
  } : void 0
1208
1145
  );
1209
- function ue(o, w, v) {
1210
- return w.is_home ? v === "inside" : o.id !== w.id;
1146
+ function re(n, T, m) {
1147
+ return T.is_home ? m === "inside" : n.id !== T.id;
1211
1148
  }
1212
- async function M() {
1213
- f.value = !0;
1149
+ async function S() {
1150
+ h.value = !0;
1214
1151
  try {
1215
- const o = await l.list({
1216
- search: i.value.trim(),
1217
- status: p.value ? "" : T.value,
1152
+ const n = await l.list({
1153
+ search: r.value.trim(),
1154
+ status: p.value ? "" : k.value,
1218
1155
  trashed: p.value
1219
1156
  });
1220
- a.value = o.home, c.value = o.items;
1221
- } catch (o) {
1222
- z.danger(d(o));
1157
+ a.value = n.home, c.value = n.items;
1158
+ } catch (n) {
1159
+ V.danger(d(n));
1223
1160
  } finally {
1224
- f.value = !1;
1161
+ h.value = !1;
1225
1162
  }
1226
1163
  }
1227
- function de(o) {
1228
- o.search !== i.value && (i.value = o.search, M());
1164
+ function te(n) {
1165
+ n.search !== r.value && (r.value = n.search, S());
1229
1166
  }
1230
- function ee(o) {
1231
- const w = `${r.base}/${o.id}`;
1232
- s.resolve(w).matched.length > 0 && s.push(w);
1167
+ function E(n) {
1168
+ const T = `${o.base}/${n.id}`;
1169
+ s.resolve(T).matched.length > 0 && s.push(T);
1233
1170
  }
1234
- async function ce(o) {
1235
- const w = await x({ parent: o });
1236
- w && (await M(), ee(w));
1171
+ async function ue(n) {
1172
+ const T = await _({ parent: n });
1173
+ T && (await S(), E(T));
1237
1174
  }
1238
- async function te(o) {
1175
+ async function de(n) {
1239
1176
  try {
1240
- await l.duplicate(o.id), z.success(t("page.duplicated")), await M();
1241
- } catch (w) {
1242
- z.danger(d(w));
1177
+ await l.duplicate(n.id), V.success(t("page.duplicated")), await S();
1178
+ } catch (T) {
1179
+ V.danger(d(T));
1243
1180
  }
1244
1181
  }
1245
- async function L(o) {
1246
- const w = await C({ page: o });
1247
- w != null && await ne(o, w, "inside");
1182
+ async function pe(n) {
1183
+ const T = await z({ page: n });
1184
+ T != null && await G(n, T, "inside");
1248
1185
  }
1249
- async function ge(o) {
1250
- const w = o.zone === "inside" ? o.target.id : o.target.parent_id, v = o.row.descendants_count + 1;
1251
- if (w !== o.row.parent_id && v > 1 && !await O({
1252
- title: t("page.move-title", { title: o.row.title }),
1253
- message: t("page.move-branch", { count: v }),
1186
+ async function ge(n) {
1187
+ const T = n.zone === "inside" ? n.target.id : n.target.parent_id, m = n.row.descendants_count + 1;
1188
+ if (T !== n.row.parent_id && m > 1 && !await L({
1189
+ title: t("page.move-title", { title: n.row.title }),
1190
+ message: t("page.move-branch", { count: m }),
1254
1191
  confirmText: t("page.move-confirm"),
1255
1192
  cancelText: t("page.cancel")
1256
1193
  })) {
1257
- await M();
1194
+ await S();
1258
1195
  return;
1259
1196
  }
1260
- await ne(o.row, o.target.id, o.zone);
1197
+ await G(n.row, n.target.id, n.zone);
1261
1198
  }
1262
- async function ne(o, w, v) {
1199
+ async function G(n, T, m) {
1263
1200
  try {
1264
- const X = await l.move(o.id, w, v);
1265
- z.success(
1266
- X.addresses_changed > 1 ? t("page.moved", { count: X.addresses_changed }) : t("page.moved-one")
1201
+ const J = await l.move(n.id, T, m);
1202
+ V.success(
1203
+ J.addresses_changed > 1 ? t("page.moved", { count: J.addresses_changed }) : t("page.moved-one")
1267
1204
  );
1268
- } catch (X) {
1269
- z.danger(d(X));
1205
+ } catch (J) {
1206
+ V.danger(d(J));
1270
1207
  } finally {
1271
- await M();
1208
+ await S();
1272
1209
  }
1273
1210
  }
1274
- async function ve(o) {
1275
- if (await O({
1276
- title: t("page.delete-title", { title: o.title }),
1211
+ async function X(n) {
1212
+ if (await L({
1213
+ title: t("page.delete-title", { title: n.title }),
1277
1214
  message: (
1278
1215
  // The whole branch, not the level under it: a catalogue with two sections and forty
1279
1216
  // products is forty-two pages leaving the site, and "2" would be a comforting lie.
1280
- o.descendants_count > 0 ? `${t("page.delete-text")} ${t("page.delete-branch", { count: o.descendants_count })}` : t("page.delete-text")
1217
+ n.descendants_count > 0 ? `${t("page.delete-text")} ${t("page.delete-branch", { count: n.descendants_count })}` : t("page.delete-text")
1281
1218
  ),
1282
1219
  confirmText: t("page.delete"),
1283
1220
  cancelText: t("page.cancel"),
1284
1221
  tone: "danger"
1285
1222
  }))
1286
1223
  try {
1287
- await l.remove(o.id), z.success(t("page.deleted")), await M();
1288
- } catch (v) {
1289
- z.danger(d(v));
1224
+ await l.remove(n.id), V.success(t("page.deleted")), await S();
1225
+ } catch (m) {
1226
+ V.danger(d(m));
1290
1227
  }
1291
1228
  }
1292
- async function he(o) {
1293
- if (await O({
1294
- title: t("page.restore-page-title", { title: o.title }),
1295
- message: o.descendants_count > 0 ? `${t("page.restore-page-text")} ${t("page.restore-branch", { count: o.descendants_count })}` : t("page.restore-page-text"),
1229
+ async function ve(n) {
1230
+ if (await L({
1231
+ title: t("page.restore-page-title", { title: n.title }),
1232
+ message: n.descendants_count > 0 ? `${t("page.restore-page-text")} ${t("page.restore-branch", { count: n.descendants_count })}` : t("page.restore-page-text"),
1296
1233
  confirmText: t("page.restore"),
1297
1234
  cancelText: t("page.cancel")
1298
1235
  }))
1299
1236
  try {
1300
- const v = await l.restore(o.id);
1301
- z.success(
1302
- v > 1 ? t("page.restored-branch", { count: v }) : t("page.restored")
1303
- ), await M();
1304
- } catch (v) {
1305
- z.danger(d(v));
1237
+ const m = await l.restore(n.id);
1238
+ V.success(
1239
+ m > 1 ? t("page.restored-branch", { count: m }) : t("page.restored")
1240
+ ), await S();
1241
+ } catch (m) {
1242
+ V.danger(d(m));
1306
1243
  }
1307
1244
  }
1308
- async function J(o) {
1309
- if (o.url)
1245
+ async function he(n) {
1246
+ if (n.url)
1310
1247
  try {
1311
- await navigator.clipboard.writeText(o.url), z.success(t("page.address-copied"));
1248
+ await navigator.clipboard.writeText(n.url), V.success(t("page.address-copied"));
1312
1249
  } catch {
1313
1250
  }
1314
1251
  }
1315
- function Q(o) {
1316
- return o === "published" ? "success" : o === "modified" ? "warning" : "default";
1252
+ function O(n) {
1253
+ return n === "published" ? "success" : n === "modified" ? "warning" : "default";
1317
1254
  }
1318
- return ae(T, () => {
1319
- M();
1320
- }), pe(M), (o, w) => (m(), A("div", Ht, [
1321
- g(e(tt), {
1322
- view: T.value,
1323
- "onUpdate:view": w[2] || (w[2] = (v) => T.value = v),
1324
- title: $.value,
1325
- views: D.value
1326
- }, Je({
1327
- default: n(() => [
1328
- g(e(ct), {
1255
+ ae(k, () => {
1256
+ S();
1257
+ }), ce(S);
1258
+ const me = W(
1259
+ () => b.value ? [{ key: "new", label: t("page.new"), icon: "plus", primary: !0, run: () => {
1260
+ ue(null);
1261
+ } }] : []
1262
+ );
1263
+ return (n, T) => (f(), N("div", Bt, [
1264
+ v(e(Ze), {
1265
+ view: k.value,
1266
+ "onUpdate:view": T[1] || (T[1] = (m) => k.value = m),
1267
+ title: P.value,
1268
+ views: B.value,
1269
+ actions: me.value
1270
+ }, {
1271
+ default: i(() => [
1272
+ v(e(nt), {
1329
1273
  data: le.value,
1330
- columns: U.value,
1274
+ columns: A.value,
1331
1275
  "row-key": "id",
1332
- tree: q.value,
1276
+ tree: ee.value,
1333
1277
  searchable: "",
1334
1278
  clickable: !p.value,
1335
1279
  hover: !p.value,
1336
1280
  flush: "",
1337
1281
  layout: "fixed",
1338
- loading: f.value,
1282
+ loading: h.value,
1339
1283
  "cards-below": 0,
1340
1284
  "search-placeholder": e(t)("page.search"),
1341
- "empty-text": i.value ? e(t)("page.empty-search") : p.value ? e(t)("page.empty-bin") : e(t)("page.empty"),
1342
- "aria-label": $.value,
1343
- onRowClick: ee,
1344
- onStateChange: de,
1285
+ "empty-text": r.value ? e(t)("page.empty-search") : p.value ? e(t)("page.empty-bin") : e(t)("page.empty"),
1286
+ "aria-label": P.value,
1287
+ onRowClick: E,
1288
+ onStateChange: te,
1345
1289
  onNodeDrop: ge
1346
1290
  }, {
1347
- "cell-title": n(({ row: v }) => [
1348
- E("span", jt, b(v.is_home ? e(t)("pages.home") : v.title), 1)
1291
+ "cell-title": i(({ row: m }) => [
1292
+ K("span", Dt, w(m.is_home ? e(t)("pages.home") : m.title), 1)
1349
1293
  ]),
1350
- "cell-path": n(({ row: v }) => [
1351
- p.value ? (m(), V(e(R), {
1294
+ "cell-path": i(({ row: m }) => [
1295
+ p.value ? (f(), C(e(U), {
1352
1296
  key: 0,
1353
1297
  size: "sm",
1354
1298
  tone: "muted"
1355
1299
  }, {
1356
- default: n(() => [...w[3] || (w[3] = [
1357
- y("—", -1)
1300
+ default: i(() => [...T[2] || (T[2] = [
1301
+ $("—", -1)
1358
1302
  ])]),
1359
1303
  _: 1
1360
- })) : v.url && v.status !== "draft" ? (m(), A("a", {
1304
+ })) : m.url && m.status !== "draft" ? (f(), N("a", {
1361
1305
  key: 1,
1362
1306
  class: "wx-pages__address",
1363
- href: v.url,
1307
+ href: m.url,
1364
1308
  target: "_blank",
1365
1309
  rel: "noopener",
1366
- onClick: w[1] || (w[1] = Qe(() => {
1310
+ onClick: T[0] || (T[0] = He(() => {
1367
1311
  }, ["stop"]))
1368
- }, " /" + b(v.path), 9, Gt)) : v.path !== null ? (m(), V(e(R), {
1312
+ }, " /" + w(m.path), 9, Nt)) : m.path !== null ? (f(), C(e(U), {
1369
1313
  key: 2,
1370
1314
  mono: "",
1371
1315
  size: "sm",
1372
1316
  tone: "muted"
1373
1317
  }, {
1374
- default: n(() => [
1375
- y("/" + b(v.path), 1)
1318
+ default: i(() => [
1319
+ $("/" + w(m.path), 1)
1376
1320
  ]),
1377
1321
  _: 2
1378
- }, 1024)) : (m(), V(e(R), {
1322
+ }, 1024)) : (f(), C(e(U), {
1379
1323
  key: 3,
1380
1324
  size: "sm",
1381
1325
  tone: "muted"
1382
1326
  }, {
1383
- default: n(() => [
1384
- y(b(e(t)("page.no-address")), 1)
1327
+ default: i(() => [
1328
+ $(w(e(t)("page.no-address")), 1)
1385
1329
  ]),
1386
1330
  _: 1
1387
1331
  }))
1388
1332
  ]),
1389
- "cell-status": n(({ row: v }) => [
1390
- p.value ? (m(), V(e(me), {
1333
+ "cell-status": i(({ row: m }) => [
1334
+ p.value ? (f(), C(e(be), {
1391
1335
  key: 0,
1392
- value: v.deleted_at
1393
- }, null, 8, ["value"])) : (m(), V(e(we), {
1336
+ value: m.deleted_at
1337
+ }, null, 8, ["value"])) : (f(), C(e(xe), {
1394
1338
  key: 1,
1395
- type: Q(v.status),
1339
+ type: O(m.status),
1396
1340
  dot: ""
1397
1341
  }, {
1398
- default: n(() => [
1399
- y(b(e(t)(`page.status-${v.status}`)), 1)
1342
+ default: i(() => [
1343
+ $(w(e(t)(`page.status-${m.status}`)), 1)
1400
1344
  ]),
1401
1345
  _: 2
1402
1346
  }, 1032, ["type"]))
1403
1347
  ]),
1404
- "cell-updated_at": n(({ row: v }) => [
1405
- g(e(R), {
1348
+ "cell-updated_at": i(({ row: m }) => [
1349
+ v(e(U), {
1406
1350
  size: "sm",
1407
1351
  tone: "muted"
1408
1352
  }, {
1409
- default: n(() => [
1410
- g(e(me), {
1411
- value: v.updated_at
1353
+ default: i(() => [
1354
+ v(e(be), {
1355
+ value: m.updated_at,
1356
+ compact: ""
1412
1357
  }, null, 8, ["value"]),
1413
- v.edited_by && !p.value ? (m(), A(j, { key: 0 }, [
1414
- y(", " + b(v.edited_by), 1)
1415
- ], 64)) : N("", !0)
1358
+ m.edited_by && !p.value ? (f(), N(Z, { key: 0 }, [
1359
+ $(", " + w(m.edited_by), 1)
1360
+ ], 64)) : I("", !0)
1416
1361
  ]),
1417
1362
  _: 2
1418
1363
  }, 1024)
1419
1364
  ]),
1420
- "cell-actions": n(({ row: v }) => [
1421
- _.value ? (m(), V(Rt, {
1365
+ "cell-actions": i(({ row: m }) => [
1366
+ b.value ? (f(), C(Vt, {
1422
1367
  key: 0,
1423
- page: v,
1368
+ page: m,
1424
1369
  "in-bin": p.value,
1425
- onOpen: ee,
1426
- onAdd: ce,
1427
- onDuplicate: te,
1428
- onMove: L,
1429
- onCopy: J,
1430
- onRemove: ve,
1431
- onRestore: he
1432
- }, null, 8, ["page", "in-bin"])) : N("", !0)
1370
+ onOpen: E,
1371
+ onAdd: ue,
1372
+ onDuplicate: de,
1373
+ onMove: pe,
1374
+ onCopy: he,
1375
+ onRemove: X,
1376
+ onRestore: ve
1377
+ }, null, 8, ["page", "in-bin"])) : I("", !0)
1433
1378
  ]),
1434
1379
  _: 1
1435
1380
  }, 8, ["data", "columns", "tree", "clickable", "hover", "loading", "search-placeholder", "empty-text", "aria-label"])
1436
1381
  ]),
1437
- _: 2
1438
- }, [
1439
- _.value ? {
1440
- name: "actions",
1441
- fn: n(() => [
1442
- g(e(I), {
1443
- type: "primary",
1444
- icon: "plus",
1445
- onClick: w[0] || (w[0] = (v) => ce(null))
1446
- }, {
1447
- default: n(() => [
1448
- y(b(e(t)("page.new")), 1)
1449
- ]),
1450
- _: 1
1451
- })
1452
- ]),
1453
- key: "0"
1454
- } : void 0
1455
- ]), 1032, ["view", "title", "views"])
1382
+ _: 1
1383
+ }, 8, ["view", "title", "views", "actions"])
1456
1384
  ]));
1457
1385
  }
1458
- }), Qt = /* @__PURE__ */ re(Jt, [["__scopeId", "data-v-580089b5"]]);
1459
- function ta(u = {}) {
1460
- const r = u.path ?? "/pages";
1386
+ }), At = /* @__PURE__ */ oe(Et, [["__scopeId", "data-v-9f11d1cb"]]);
1387
+ function Kt(u = {}) {
1388
+ const o = u.path ?? "/pages";
1461
1389
  return {
1462
1390
  id: "pages",
1463
- path: r,
1391
+ path: o,
1464
1392
  routes: [
1465
- { path: r, name: "webx.pages", component: Qt, props: { base: r } },
1393
+ { path: o, name: "webx.pages", component: At, props: { base: o } },
1466
1394
  {
1467
- path: `${r}/:id(\\d+)`,
1395
+ path: `${o}/:id(\\d+)`,
1468
1396
  name: "webx.pages.edit",
1469
- component: Bt,
1470
- props: { base: r }
1397
+ component: yt,
1398
+ props: { base: o }
1471
1399
  }
1472
1400
  ],
1473
1401
  /*
@@ -1479,25 +1407,25 @@ function ta(u = {}) {
1479
1407
  * page from the editor above it rather than from the description.
1480
1408
  */
1481
1409
  types: {
1482
- "wx-page-place": { component: Ut, kind: "display" },
1483
- "wx-page-danger": { component: wt, kind: "display" },
1484
- "wx-page-history": { component: At, kind: "display" }
1410
+ "wx-page-place": { component: Wt, kind: "display" },
1411
+ "wx-page-danger": { component: ht, kind: "display" },
1412
+ "wx-page-history": { component: Tt, kind: "display" }
1485
1413
  }
1486
1414
  };
1487
1415
  }
1488
1416
  export {
1489
- wt as WxPageDanger,
1490
- Bt as WxPageEditorPage,
1491
- At as WxPageHistory,
1492
- Te as WxPagePicker,
1493
- Ut as WxPagePlace,
1494
- Qt as WxPagesPage,
1495
- Z as createPagesApi,
1496
- Ee as pageEditorKey,
1497
- ta as pages,
1498
- vt as pagesMessages,
1499
- gt as providePageEditor,
1500
- Ot as slugify,
1501
- ke as usePageEditor
1417
+ ht as WxPageDanger,
1418
+ yt as WxPageEditorPage,
1419
+ Tt as WxPageHistory,
1420
+ $e as WxPagePicker,
1421
+ Wt as WxPagePlace,
1422
+ At as WxPagesPage,
1423
+ q as createPagesApi,
1424
+ Ne as pageEditorKey,
1425
+ Kt as pages,
1426
+ rt as pagesMessages,
1427
+ ot as providePageEditor,
1428
+ Ct as slugify,
1429
+ Te as usePageEditor
1502
1430
  };
1503
1431
  //# sourceMappingURL=index.js.map