@webx-ui/module-pages 0.2.0 → 0.3.1

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