@stonecrop/desktop 0.24.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/desktop.js CHANGED
@@ -1,98 +1,98 @@
1
- import { defineComponent as Q, ref as M, onMounted as de, openBlock as m, createElementBlock as g, normalizeClass as F, createElementVNode as c, Fragment as W, renderList as q, toDisplayString as V, createCommentVNode as L, withDirectives as G, vShow as ae, useTemplateRef as ve, computed as S, watch as H, nextTick as pe, createBlock as fe, Teleport as Ee, createVNode as j, Transition as Oe, withCtx as z, withModifiers as me, vModelText as he, renderSlot as Y, createTextVNode as J, resolveComponent as Be, withKeys as K, normalizeStyle as Z, unref as ee, provide as te, onUnmounted as Fe } from "vue";
2
- import { useStonecrop as Le, useValidationStore as je, isDraftRecordId as Pe, DRAFT_RECORD_ID as Ke } from "@stonecrop/stonecrop";
3
- import { AForm as He } from "@stonecrop/aform";
4
- import { flattenFields as ze, componentLinkExpansion as Ue } from "@stonecrop/schema";
5
- const We = { class: "action-menu-icon" }, qe = { class: "action-element-header" }, Ge = ["disabled", "onClick"], Je = { key: 0 }, Qe = { class: "dropdown-header" }, Xe = ["onClick"], Ye = ["onClick"], Ze = { class: "dropdown-container" }, et = { class: "dropdown" }, tt = ["onClick"], at = ["href"], ot = { class: "dropdown-item" }, rt = /* @__PURE__ */ Q({
1
+ import { defineComponent as Q, ref as M, onMounted as ue, openBlock as y, createElementBlock as g, normalizeClass as O, createElementVNode as c, Fragment as W, renderList as q, toDisplayString as V, createCommentVNode as K, withDirectives as G, vShow as oe, useTemplateRef as de, computed as $, watch as H, nextTick as ve, createBlock as pe, Teleport as Te, createVNode as L, Transition as Ve, withCtx as z, withModifiers as fe, vModelText as me, renderSlot as Y, createTextVNode as J, resolveComponent as Ee, withKeys as j, normalizeStyle as Z, unref as ee, provide as te, onUnmounted as Be } from "vue";
2
+ import { useStonecrop as Fe, useValidationStore as Oe, isDraftRecordId as Le, DRAFT_RECORD_ID as Pe } from "@stonecrop/stonecrop";
3
+ import { AForm as je, resolvedFieldsToColumns as Ke } from "@stonecrop/aform";
4
+ import { flattenFields as He, componentLinkExpansion as ze } from "@stonecrop/schema";
5
+ const Ue = { class: "action-menu-icon" }, We = { class: "action-element-header" }, qe = ["disabled", "onClick"], Ge = { key: 0 }, Je = { class: "dropdown-header" }, Qe = ["onClick"], Xe = ["onClick"], Ye = { class: "dropdown-container" }, Ze = { class: "dropdown" }, et = ["onClick"], tt = ["href"], ot = { class: "dropdown-item" }, at = /* @__PURE__ */ Q({
6
6
  __name: "ActionSet",
7
7
  props: {
8
8
  elements: { default: () => [] }
9
9
  },
10
10
  emits: ["actionClick"],
11
- setup(l, { emit: $ }) {
12
- const D = $, w = M({}), d = M(!0), a = M([]);
13
- de(() => {
14
- v();
11
+ setup(l, { emit: S }) {
12
+ const D = S, w = M({}), d = M(!0), o = M([]);
13
+ ue(() => {
14
+ p();
15
15
  });
16
- const v = () => {
17
- w.value = {}, a.value = [];
18
- }, x = () => {
16
+ const p = () => {
17
+ w.value = {}, o.value = [];
18
+ }, _ = () => {
19
19
  d.value = !d.value;
20
- }, N = (i) => {
21
- const p = !w.value[i];
22
- v(), p && (w.value[i] = !0, a.value[i] = !0);
23
- }, C = (i, p) => {
24
- D("actionClick", p, i);
20
+ }, T = (i) => {
21
+ const f = !w.value[i];
22
+ p(), f && (w.value[i] = !0, o.value[i] = !0);
23
+ }, C = (i, f) => {
24
+ D("actionClick", f, i);
25
25
  };
26
- return (i, p) => (m(), g("div", {
27
- class: F([{ collapsed: !d.value }, "action-set"])
26
+ return (i, f) => (y(), g("div", {
27
+ class: O([{ collapsed: !d.value }, "action-set"])
28
28
  }, [
29
- c("div", We, [
29
+ c("div", Ue, [
30
30
  c("div", {
31
31
  id: "cross",
32
- class: F({ rotated: d.value }),
33
- onClick: x
32
+ class: O({ rotated: d.value }),
33
+ onClick: _
34
34
  }, "×", 2)
35
35
  ]),
36
- p[0] || (p[0] = c("div", { style: { "margin-right": "30px" } }, null, -1)),
37
- (m(!0), g(W, null, q(l.elements, (s, n) => (m(), g("div", {
36
+ f[0] || (f[0] = c("div", { style: { "margin-right": "30px" } }, null, -1)),
37
+ (y(!0), g(W, null, q(l.elements, (s, r) => (y(), g("div", {
38
38
  key: s.label,
39
39
  class: "action-element"
40
40
  }, [
41
- c("div", qe, [
42
- s.type == "button" ? (m(), g("button", {
41
+ c("div", We, [
42
+ s.type == "button" ? (y(), g("button", {
43
43
  key: 0,
44
44
  disabled: s.disabled,
45
45
  class: "button-default",
46
46
  onClick: (u) => C(s.action, s.label)
47
- }, V(s.label), 9, Ge)) : L("", !0)
47
+ }, V(s.label), 9, qe)) : K("", !0)
48
48
  ]),
49
- s.type == "dropdown" ? (m(), g("div", Je, [
50
- c("div", Qe, [
49
+ s.type == "dropdown" ? (y(), g("div", Ge, [
50
+ c("div", Je, [
51
51
  c("div", {
52
- class: F(["cross", { rotated: a.value[n] }]),
53
- onClick: (u) => N(n)
54
- }, "×", 10, Xe),
52
+ class: O(["cross", { rotated: o.value[r] }]),
53
+ onClick: (u) => T(r)
54
+ }, "×", 10, Qe),
55
55
  c("button", {
56
56
  class: "button-default dropdown-title",
57
- onClick: (u) => N(n)
58
- }, V(s.label), 9, Ye)
57
+ onClick: (u) => T(r)
58
+ }, V(s.label), 9, Xe)
59
59
  ]),
60
- G(c("div", Ze, [
61
- c("div", et, [
62
- (m(!0), g(W, null, q(s.actions, (u) => (m(), g("div", {
60
+ G(c("div", Ye, [
61
+ c("div", Ze, [
62
+ (y(!0), g(W, null, q(s.actions, (u) => (y(), g("div", {
63
63
  key: u.label
64
64
  }, [
65
- u.action != null ? (m(), g("button", {
65
+ u.action != null ? (y(), g("button", {
66
66
  key: 0,
67
67
  class: "dropdown-item",
68
- onClick: (r) => C(u.action, u.label)
69
- }, V(u.label), 9, tt)) : u.link != null ? (m(), g("a", {
68
+ onClick: (n) => C(u.action, u.label)
69
+ }, V(u.label), 9, et)) : u.link != null ? (y(), g("a", {
70
70
  key: 1,
71
71
  href: u.link
72
72
  }, [
73
73
  c("button", ot, V(u.label), 1)
74
- ], 8, at)) : L("", !0)
74
+ ], 8, tt)) : K("", !0)
75
75
  ]))), 128))
76
76
  ])
77
77
  ], 512), [
78
- [ae, w.value[n]]
78
+ [oe, w.value[r]]
79
79
  ])
80
- ])) : L("", !0)
80
+ ])) : K("", !0)
81
81
  ]))), 128))
82
82
  ], 2));
83
83
  }
84
- }), ye = (l, $) => {
84
+ }), ye = (l, S) => {
85
85
  const D = l.__vccOpts || l;
86
- for (const [w, d] of $)
86
+ for (const [w, d] of S)
87
87
  D[w] = d;
88
88
  return D;
89
- }, ge = /* @__PURE__ */ ye(rt, [["__scopeId", "data-v-54797d4b"]]), nt = { class: "command-palette-header" }, lt = ["placeholder"], st = {
89
+ }, he = /* @__PURE__ */ ye(at, [["__scopeId", "data-v-54797d4b"]]), nt = { class: "command-palette-header" }, rt = ["placeholder"], lt = {
90
90
  key: 0,
91
91
  class: "command-palette-results"
92
- }, ct = ["onClick", "onMouseover"], it = { class: "result-title" }, ut = { class: "result-content" }, dt = {
92
+ }, st = ["onClick", "onMouseover"], ct = { class: "result-title" }, it = { class: "result-content" }, ut = {
93
93
  key: 1,
94
94
  class: "command-palette-no-results"
95
- }, we = /* @__PURE__ */ Q({
95
+ }, ge = /* @__PURE__ */ Q({
96
96
  __name: "CommandPalette",
97
97
  props: {
98
98
  search: { type: Function },
@@ -101,128 +101,128 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
101
101
  maxResults: { default: 10 }
102
102
  },
103
103
  emits: ["select", "close"],
104
- setup(l, { emit: $ }) {
105
- const D = $, w = M(""), d = M(0), a = ve("input"), v = S(() => w.value ? l.search(w.value).slice(0, l.maxResults) : []);
104
+ setup(l, { emit: S }) {
105
+ const D = S, w = M(""), d = M(0), o = de("input"), p = $(() => w.value ? l.search(w.value).slice(0, l.maxResults) : []);
106
106
  H(
107
107
  () => l.isOpen,
108
108
  async (i) => {
109
- i && (w.value = "", d.value = 0, await pe(), a.value?.focus());
109
+ i && (w.value = "", d.value = 0, await ve(), o.value?.focus());
110
110
  }
111
- ), H(v, () => {
111
+ ), H(p, () => {
112
112
  d.value = 0;
113
113
  });
114
- const x = () => {
114
+ const _ = () => {
115
115
  D("close");
116
- }, N = (i) => {
116
+ }, T = (i) => {
117
117
  switch (i.key) {
118
118
  case "Escape":
119
- x();
119
+ _();
120
120
  break;
121
121
  case "ArrowDown":
122
- i.preventDefault(), v.value.length && (d.value = (d.value + 1) % v.value.length);
122
+ i.preventDefault(), p.value.length && (d.value = (d.value + 1) % p.value.length);
123
123
  break;
124
124
  case "ArrowUp":
125
- i.preventDefault(), v.value.length && (d.value = (d.value - 1 + v.value.length) % v.value.length);
125
+ i.preventDefault(), p.value.length && (d.value = (d.value - 1 + p.value.length) % p.value.length);
126
126
  break;
127
127
  case "Enter":
128
- v.value.length && d.value >= 0 && C(v.value[d.value]);
128
+ p.value.length && d.value >= 0 && C(p.value[d.value]);
129
129
  break;
130
130
  }
131
131
  }, C = (i) => {
132
- D("select", i), x();
132
+ D("select", i), _();
133
133
  };
134
- return (i, p) => (m(), fe(Ee, { to: "body" }, [
135
- j(Oe, { name: "fade" }, {
134
+ return (i, f) => (y(), pe(Te, { to: "body" }, [
135
+ L(Ve, { name: "fade" }, {
136
136
  default: z(() => [
137
- l.isOpen ? (m(), g("div", {
137
+ l.isOpen ? (y(), g("div", {
138
138
  key: 0,
139
139
  class: "command-palette-overlay",
140
- onClick: x
140
+ onClick: _
141
141
  }, [
142
142
  c("div", {
143
143
  class: "command-palette",
144
- onClick: p[1] || (p[1] = me(() => {
144
+ onClick: f[1] || (f[1] = fe(() => {
145
145
  }, ["stop"]))
146
146
  }, [
147
147
  c("div", nt, [
148
148
  G(c("input", {
149
149
  ref: "input",
150
- "onUpdate:modelValue": p[0] || (p[0] = (s) => w.value = s),
150
+ "onUpdate:modelValue": f[0] || (f[0] = (s) => w.value = s),
151
151
  type: "text",
152
152
  class: "command-palette-input",
153
153
  placeholder: l.placeholder,
154
154
  autofocus: "",
155
- onKeydown: N
156
- }, null, 40, lt), [
157
- [he, w.value]
155
+ onKeydown: T
156
+ }, null, 40, rt), [
157
+ [me, w.value]
158
158
  ])
159
159
  ]),
160
- v.value.length ? (m(), g("div", st, [
161
- (m(!0), g(W, null, q(v.value, (s, n) => (m(), g("div", {
162
- key: n,
163
- class: F(["command-palette-result", { selected: n === d.value }]),
160
+ p.value.length ? (y(), g("div", lt, [
161
+ (y(!0), g(W, null, q(p.value, (s, r) => (y(), g("div", {
162
+ key: r,
163
+ class: O(["command-palette-result", { selected: r === d.value }]),
164
164
  onClick: (u) => C(s),
165
- onMouseover: (u) => d.value = n
165
+ onMouseover: (u) => d.value = r
166
166
  }, [
167
- c("div", it, [
167
+ c("div", ct, [
168
168
  Y(i.$slots, "title", { result: s })
169
169
  ]),
170
- c("div", ut, [
170
+ c("div", it, [
171
171
  Y(i.$slots, "content", { result: s })
172
172
  ])
173
- ], 42, ct))), 128))
174
- ])) : w.value && !v.value.length ? (m(), g("div", dt, [
173
+ ], 42, st))), 128))
174
+ ])) : w.value && !p.value.length ? (y(), g("div", ut, [
175
175
  Y(i.$slots, "empty", {}, () => [
176
176
  J(' No results found for "' + V(w.value) + '" ', 1)
177
177
  ])
178
- ])) : L("", !0)
178
+ ])) : K("", !0)
179
179
  ])
180
- ])) : L("", !0)
180
+ ])) : K("", !0)
181
181
  ]),
182
182
  _: 3
183
183
  })
184
184
  ]));
185
185
  }
186
- }), vt = { class: "tabs" }, pt = { tabindex: "0" }, ft = { tabindex: "0" }, mt = /* @__PURE__ */ Q({
186
+ }), dt = { class: "tabs" }, vt = { tabindex: "0" }, pt = { tabindex: "0" }, ft = /* @__PURE__ */ Q({
187
187
  __name: "SheetNav",
188
188
  props: {
189
189
  breadcrumbs: { default: () => [] }
190
190
  },
191
191
  setup(l) {
192
- const $ = M(!0), D = M(!1), w = M(""), d = ve("searchinput"), a = S(() => $.value ? "unrotated" : "rotated"), v = () => {
193
- $.value = !$.value;
194
- }, x = async () => {
195
- D.value = !D.value, await pe(() => {
192
+ const S = M(!0), D = M(!1), w = M(""), d = de("searchinput"), o = $(() => S.value ? "unrotated" : "rotated"), p = () => {
193
+ S.value = !S.value;
194
+ }, _ = async () => {
195
+ D.value = !D.value, await ve(() => {
196
196
  d.value?.focus();
197
197
  });
198
- }, N = (p) => {
199
- p.preventDefault(), p.stopPropagation();
200
- }, C = async (p) => {
201
- p.preventDefault(), p.stopPropagation(), await x();
198
+ }, T = (f) => {
199
+ f.preventDefault(), f.stopPropagation();
200
+ }, C = async (f) => {
201
+ f.preventDefault(), f.stopPropagation(), await _();
202
202
  }, i = () => {
203
203
  };
204
- return (p, s) => {
205
- const n = Be("router-link");
206
- return m(), g("footer", null, [
207
- c("ul", vt, [
204
+ return (f, s) => {
205
+ const r = Ee("router-link");
206
+ return y(), g("footer", null, [
207
+ c("ul", dt, [
208
208
  c("li", {
209
209
  class: "hidebreadcrumbs",
210
- onClick: v,
211
- onKeydown: K(v, ["enter"])
210
+ onClick: p,
211
+ onKeydown: j(p, ["enter"])
212
212
  }, [
213
- c("a", pt, [
213
+ c("a", vt, [
214
214
  c("div", {
215
- class: F(a.value)
215
+ class: O(o.value)
216
216
  }, "×", 2)
217
217
  ])
218
218
  ], 32),
219
219
  c("li", {
220
220
  class: "hometab",
221
- style: Z({ display: $.value ? "block" : "none" }),
221
+ style: Z({ display: S.value ? "block" : "none" }),
222
222
  onClick: i,
223
- onKeydown: K(i, ["enter"])
223
+ onKeydown: j(i, ["enter"])
224
224
  }, [
225
- j(n, {
225
+ L(r, {
226
226
  to: "/",
227
227
  tabindex: "0"
228
228
  }, {
@@ -243,11 +243,11 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
243
243
  })
244
244
  ], 36),
245
245
  c("li", {
246
- class: F(["searchtab", { "search-active": D.value }]),
247
- style: Z({ display: $.value ? "block" : "none" })
246
+ class: O(["searchtab", { "search-active": D.value }]),
247
+ style: Z({ display: S.value ? "block" : "none" })
248
248
  }, [
249
- c("a", ft, [
250
- G((m(), g("svg", {
249
+ c("a", pt, [
250
+ G((y(), g("svg", {
251
251
  class: "icon search-icon",
252
252
  role: "button",
253
253
  "aria-label": "Search",
@@ -255,8 +255,8 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
255
255
  fill: "none",
256
256
  stroke: "currentColor",
257
257
  "stroke-width": "2",
258
- onClick: x,
259
- onKeydown: K(x, ["enter"])
258
+ onClick: _,
259
+ onKeydown: j(_, ["enter"])
260
260
  }, [...s[6] || (s[6] = [
261
261
  c("circle", {
262
262
  cx: "11",
@@ -265,32 +265,32 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
265
265
  }, null, -1),
266
266
  c("path", { d: "M21 21l-4.35-4.35" }, null, -1)
267
267
  ])], 544)), [
268
- [ae, !D.value]
268
+ [oe, !D.value]
269
269
  ]),
270
270
  G(c("input", {
271
271
  ref: "searchinput",
272
272
  "onUpdate:modelValue": s[0] || (s[0] = (u) => w.value = u),
273
273
  type: "text",
274
274
  placeholder: "Search...",
275
- onClick: s[1] || (s[1] = me(() => {
275
+ onClick: s[1] || (s[1] = fe(() => {
276
276
  }, ["stop"])),
277
- onInput: s[2] || (s[2] = (u) => N(u)),
277
+ onInput: s[2] || (s[2] = (u) => T(u)),
278
278
  onBlur: s[3] || (s[3] = (u) => C(u)),
279
279
  onKeydown: [
280
- s[4] || (s[4] = K((u) => C(u), ["enter"])),
281
- K(x, ["escape"])
280
+ s[4] || (s[4] = j((u) => C(u), ["enter"])),
281
+ j(_, ["escape"])
282
282
  ]
283
283
  }, null, 544), [
284
- [ae, D.value],
285
- [he, w.value]
284
+ [oe, D.value],
285
+ [me, w.value]
286
286
  ])
287
287
  ])
288
288
  ], 6),
289
- (m(!0), g(W, null, q(l.breadcrumbs, (u) => (m(), g("li", {
289
+ (y(!0), g(W, null, q(l.breadcrumbs, (u) => (y(), g("li", {
290
290
  key: u.title,
291
- style: Z({ display: $.value ? "block" : "none" })
291
+ style: Z({ display: S.value ? "block" : "none" })
292
292
  }, [
293
- j(n, {
293
+ L(r, {
294
294
  tabindex: "0",
295
295
  to: u.to
296
296
  }, {
@@ -304,57 +304,54 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
304
304
  ]);
305
305
  };
306
306
  }
307
- }), be = /* @__PURE__ */ ye(mt, [["__scopeId", "data-v-0072260b"]]), ht = {
307
+ }), we = /* @__PURE__ */ ye(ft, [["__scopeId", "data-v-0072260b"]]), mt = {
308
308
  key: 1,
309
309
  class: "loading"
310
310
  }, yt = {
311
311
  key: 2,
312
312
  class: "loading"
313
- }, gt = {
314
- key: 3,
315
- class: "truncation-note"
316
- }, wt = /* @__PURE__ */ Q({
313
+ }, ht = /* @__PURE__ */ Q({
317
314
  __name: "Desktop",
318
315
  props: {
319
316
  availableDoctypes: { default: () => [] },
320
317
  routeAdapter: {}
321
318
  },
322
319
  emits: ["action", "navigate", "record:open", "load-records", "load-record"],
323
- setup(l, { emit: $ }) {
320
+ setup(l, { emit: S }) {
324
321
  function D(e) {
325
- const t = ze(e).filter((o) => o.kind === "field" && !!o.doctype);
322
+ const t = He(e).filter((a) => a.kind === "field" && !!a.doctype);
326
323
  return new Set(
327
- t.filter((o) => Ue(o.component) === "inline").map((o) => o.fieldname)
324
+ t.filter((a) => ze(a.component) === "inline").map((a) => a.fieldname)
328
325
  );
329
326
  }
330
327
  function w(e) {
331
328
  return e !== null && typeof e == "object" && !Array.isArray(e) && "id" in e ? e.id : e;
332
329
  }
333
- const d = $, { stonecrop: a } = Le();
334
- let v = null;
330
+ const d = S, { stonecrop: o } = Fe();
331
+ let p = null;
335
332
  try {
336
- v = je();
333
+ p = Oe();
337
334
  } catch {
338
- v = null;
335
+ p = null;
339
336
  }
340
- const x = S(
341
- () => I.value === "record" ? v?.errorsByField ?? {} : {}
342
- ), N = M(!1), C = M(!1), i = M({}), p = S({
337
+ const _ = $(
338
+ () => x.value === "record" ? p?.errorsByField ?? {} : {}
339
+ ), T = M(!1), C = M(!1), i = M({}), f = $({
343
340
  get() {
344
- if (I.value === "doctypes")
341
+ if (x.value === "doctypes")
345
342
  return {
346
343
  doctypes_table: l.availableDoctypes?.map((e) => ({
347
344
  id: e,
348
345
  doctype: e,
349
- display_name: B(e),
346
+ display_name: F(e),
350
347
  actions: "View Records"
351
348
  })) ?? []
352
349
  };
353
- if (I.value === "records")
350
+ if (x.value === "records")
354
351
  return {
355
- records_table: se().map(
352
+ records_table: le().map(
356
353
  (e) => Object.assign({}, e, {
357
- id: ie(e) ?? "",
354
+ id: ce(e) ?? "",
358
355
  // A list row is navigation. Actions live on the record view, where the Actions
359
356
  // dropdown is built from what the doctype declares and what the record's
360
357
  // current state allows. This cell used to also offer Delete, which dispatched
@@ -365,17 +362,17 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
365
362
  })
366
363
  )
367
364
  };
368
- if (!a.value || !r.value || !h.value)
365
+ if (!o.value || !n.value || !h.value)
369
366
  return {};
370
367
  try {
371
- const t = { ...O.value ? i.value : a.value.getRecordById(r.value, h.value)?.get("") }, o = a.value.registry.registry[r.value];
372
- if (o) {
373
- for (const y of o.getSchemaArray())
374
- if (y.kind === "fieldset") {
375
- const f = {};
376
- for (const A of y.schema)
377
- A.fieldname && (f[A.fieldname] = t[A.fieldname]);
378
- t[y.fieldname] = f;
368
+ const t = { ...B.value ? i.value : o.value.getRecordById(n.value, h.value)?.get("") }, a = o.value.registry.registry[n.value];
369
+ if (a) {
370
+ for (const m of a.getSchemaArray())
371
+ if (m.kind === "fieldset") {
372
+ const v = {};
373
+ for (const A of m.schema)
374
+ A.fieldname && (v[A.fieldname] = t[A.fieldname]);
375
+ t[m.fieldname] = v;
379
376
  }
380
377
  }
381
378
  return t;
@@ -384,135 +381,135 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
384
381
  }
385
382
  },
386
383
  set(e) {
387
- if (I.value === "record" && !(!a.value || !r.value || !h.value))
384
+ if (x.value === "record" && !(!o.value || !n.value || !h.value))
388
385
  try {
389
- const t = a.value.registry.registry[r.value], o = /* @__PURE__ */ new Set();
386
+ const t = o.value.registry.registry[n.value], a = /* @__PURE__ */ new Set();
390
387
  if (t)
391
388
  for (const k of t.getSchemaArray())
392
- k.kind === "fieldset" && o.add(k.fieldname);
393
- const y = D(t ? t.getSchemaArray() : []), f = {}, A = [];
389
+ k.kind === "fieldset" && a.add(k.fieldname);
390
+ const m = D(t ? t.getSchemaArray() : []), v = {}, A = [];
394
391
  for (const [k, b] of Object.entries(e))
395
- o.has(k) && b && typeof b == "object" && !Array.isArray(b) ? A.push(b) : f[k] = b;
392
+ a.has(k) && b && typeof b == "object" && !Array.isArray(b) ? A.push(b) : v[k] = b;
396
393
  for (const k of A)
397
- Object.assign(f, k);
398
- const _ = [];
399
- if (O.value) {
394
+ Object.assign(v, k);
395
+ const I = [];
396
+ if (B.value) {
400
397
  const k = { ...i.value };
401
- for (const [b, T] of Object.entries(f)) {
402
- if (T === void 0) continue;
403
- const P = y.has(b) ? w(T) : T;
404
- k[b] !== P && (k[b] = P, _.push(b));
398
+ for (const [b, N] of Object.entries(v)) {
399
+ if (N === void 0) continue;
400
+ const P = m.has(b) ? w(N) : N;
401
+ k[b] !== P && (k[b] = P, I.push(b));
405
402
  }
406
403
  i.value = k;
407
404
  } else {
408
- const k = a.value.getStore();
409
- for (const [b, T] of Object.entries(f)) {
410
- if (T === void 0) continue;
411
- const P = y.has(b) ? w(T) : T, X = `${r.value}.${h.value}.${b}`;
412
- (k.has(X) ? k.get(X) : void 0) !== P && (k.set(X, P), _.push(b));
405
+ const k = o.value.getStore();
406
+ for (const [b, N] of Object.entries(v)) {
407
+ if (N === void 0) continue;
408
+ const P = m.has(b) ? w(N) : N, X = `${n.value}.${h.value}.${b}`;
409
+ (k.has(X) ? k.get(X) : void 0) !== P && (k.set(X, P), I.push(b));
413
410
  }
414
411
  }
415
- _.length > 0 && s(_);
412
+ I.length > 0 && s(I);
416
413
  } catch (t) {
417
414
  console.warn("HST update failed:", t);
418
415
  }
419
416
  }
420
417
  });
421
418
  function s(e) {
422
- if (!v || !a.value || !r.value || !h.value) return;
423
- const o = a.value.registry.getDoctype(r.value)?.getTriggers();
424
- if (!o || Object.keys(o).length === 0) return;
425
- const y = O.value ? { ...i.value } : {
426
- ...a.value.getRecordById(r.value, h.value)?.get("")
419
+ if (!p || !o.value || !n.value || !h.value) return;
420
+ const a = o.value.registry.getDoctype(n.value)?.getTriggers();
421
+ if (!a || Object.keys(a).length === 0) return;
422
+ const m = B.value ? { ...i.value } : {
423
+ ...o.value.getRecordById(n.value, h.value)?.get("")
427
424
  };
428
- for (const f of e)
429
- v.validateField(o, f, y);
425
+ for (const v of e)
426
+ p.validateField(a, v, m);
430
427
  }
431
- const n = S(() => l.routeAdapter ? null : ee(a.value?.registry.router?.currentRoute)), u = S(() => l.routeAdapter ? null : a.value?.registry.router), r = S(() => {
428
+ const r = $(() => l.routeAdapter ? null : ee(o.value?.registry.router?.currentRoute)), u = $(() => l.routeAdapter ? null : o.value?.registry.router), n = $(() => {
432
429
  if (l.routeAdapter) return l.routeAdapter.getCurrentDoctype();
433
- if (!n.value) return "";
434
- if (n.value.meta?.actualDoctype)
435
- return n.value.meta.actualDoctype;
436
- if (n.value.params.doctype)
437
- return n.value.params.doctype.toString();
438
- const e = n.value.params.pathMatch;
430
+ if (!r.value) return "";
431
+ if (r.value.meta?.actualDoctype)
432
+ return r.value.meta.actualDoctype;
433
+ if (r.value.params.doctype)
434
+ return r.value.params.doctype.toString();
435
+ const e = r.value.params.pathMatch;
439
436
  return e && e.length > 0 ? e[0] : "";
440
- }), R = S(() => {
437
+ }), R = $(() => {
441
438
  if (l.routeAdapter) return l.routeAdapter.getCurrentDoctype();
442
- if (!n.value) return "";
443
- if (n.value.meta?.doctype)
444
- return n.value.meta.doctype;
445
- if (n.value.params.doctype)
446
- return n.value.params.doctype.toString();
447
- const e = n.value.params.pathMatch;
439
+ if (!r.value) return "";
440
+ if (r.value.meta?.doctype)
441
+ return r.value.meta.doctype;
442
+ if (r.value.params.doctype)
443
+ return r.value.params.doctype.toString();
444
+ const e = r.value.params.pathMatch;
448
445
  return e && e.length > 0 ? e[0] : "";
449
- }), h = S(() => {
446
+ }), h = $(() => {
450
447
  if (l.routeAdapter) return l.routeAdapter.getCurrentRecordId();
451
- if (!n.value) return "";
452
- if (n.value.params.recordId)
453
- return n.value.params.recordId.toString();
454
- const e = n.value.params.pathMatch;
448
+ if (!r.value) return "";
449
+ if (r.value.params.recordId)
450
+ return r.value.params.recordId.toString();
451
+ const e = r.value.params.pathMatch;
455
452
  return e && e.length > 1 ? e[1] : "";
456
- }), O = S(() => Pe(h.value)), I = S(() => {
453
+ }), B = $(() => Le(h.value)), x = $(() => {
457
454
  if (l.routeAdapter) return l.routeAdapter.getCurrentView();
458
- if (!n.value || n.value.name === "home" || n.value.path === "/")
455
+ if (!r.value || r.value.name === "home" || r.value.path === "/")
459
456
  return "doctypes";
460
- if (n.value.name && n.value.name !== "catch-all") {
461
- const t = n.value.name;
462
- if (t.includes("form") || n.value.params.recordId)
457
+ if (r.value.name && r.value.name !== "catch-all") {
458
+ const t = r.value.name;
459
+ if (t.includes("form") || r.value.params.recordId)
463
460
  return "record";
464
- if (t.includes("list") || n.value.params.doctype)
461
+ if (t.includes("list") || r.value.params.doctype)
465
462
  return "records";
466
463
  }
467
- const e = n.value.params.pathMatch;
464
+ const e = r.value.params.pathMatch;
468
465
  return e && e.length > 0 ? e.length === 1 ? "records" : "record" : "doctypes";
469
- }), ke = () => {
470
- if (!a.value || !r.value || !h.value)
466
+ }), be = () => {
467
+ if (!o.value || !n.value || !h.value)
471
468
  return [];
472
469
  try {
473
- const e = a.value.registry.getDoctype(r.value);
470
+ const e = o.value.registry.getDoctype(n.value);
474
471
  if (!e?.workflow) return [];
475
- const t = a.value.getRecordState(r.value, h.value), o = e.getAvailableTransitions(t), y = p.value || {};
476
- return o.map(({ name: f }) => ({
472
+ const t = o.value.getRecordState(n.value, h.value), a = e.getAvailableTransitions(t), m = f.value || {};
473
+ return a.map(({ name: v }) => ({
477
474
  // Prefer the workflow action's human-readable label (WorkflowMeta format);
478
475
  // fall back to the raw transition name for XState workflows with no action meta.
479
- label: e.getActionMeta(f)?.label ?? f,
476
+ label: e.getActionMeta(v)?.label ?? v,
480
477
  action: () => {
481
478
  d("action", {
482
- name: f,
483
- doctype: r.value,
479
+ name: v,
480
+ doctype: n.value,
484
481
  recordId: h.value,
485
- data: y
482
+ data: m
486
483
  });
487
484
  }
488
485
  }));
489
486
  } catch (e) {
490
487
  return console.warn("Error getting available transitions:", e), [];
491
488
  }
492
- }, Ce = () => {
493
- if (!a.value || !r.value || !h.value)
489
+ }, ke = () => {
490
+ if (!o.value || !n.value || !h.value)
494
491
  return [];
495
492
  try {
496
- const e = a.value.registry.getDoctype(r.value);
493
+ const e = o.value.registry.getDoctype(n.value);
497
494
  if (!e?.workflow) return [];
498
- const t = a.value.getRecordState(r.value, h.value), o = e.getAvailableCommands(t), y = p.value || {};
499
- return o.map(({ name: f }) => ({
500
- label: e.getActionMeta(f)?.label ?? f,
495
+ const t = o.value.getRecordState(n.value, h.value), a = e.getAvailableCommands(t), m = f.value || {};
496
+ return a.map(({ name: v }) => ({
497
+ label: e.getActionMeta(v)?.label ?? v,
501
498
  action: () => {
502
499
  d("action", {
503
- name: f,
504
- doctype: r.value,
500
+ name: v,
501
+ doctype: n.value,
505
502
  recordId: h.value,
506
- data: y
503
+ data: m
507
504
  });
508
505
  }
509
506
  }));
510
507
  } catch (e) {
511
508
  return console.warn("Error getting available commands:", e), [];
512
509
  }
513
- }, Ae = S(() => {
510
+ }, Ce = $(() => {
514
511
  const e = [];
515
- switch (I.value) {
512
+ switch (x.value) {
516
513
  case "records":
517
514
  e.push({
518
515
  type: "button",
@@ -523,7 +520,7 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
523
520
  });
524
521
  break;
525
522
  case "record": {
526
- const t = [...ke(), ...Ce()];
523
+ const t = [...be(), ...ke()];
527
524
  t.length > 0 && e.push({
528
525
  type: "dropdown",
529
526
  label: "Actions",
@@ -533,23 +530,23 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
533
530
  }
534
531
  }
535
532
  return e;
536
- }), De = S(() => {
533
+ }), Ae = $(() => {
537
534
  const e = [];
538
- if (I.value === "records" && R.value)
535
+ if (x.value === "records" && R.value)
539
536
  e.push(
540
537
  { title: "Home", to: "/" },
541
- { title: B(R.value), to: `/${R.value}` }
538
+ { title: F(R.value), to: `/${R.value}` }
542
539
  );
543
- else if (I.value === "record" && R.value) {
544
- const t = h.value ? `/${R.value}/${h.value}` : n.value?.fullPath ?? "";
540
+ else if (x.value === "record" && R.value) {
541
+ const t = h.value ? `/${R.value}/${h.value}` : r.value?.fullPath ?? "";
545
542
  e.push(
546
543
  { title: "Home", to: "/" },
547
- { title: B(R.value), to: `/${R.value}` },
548
- { title: O.value ? "New Record" : "Edit Record", to: t }
544
+ { title: F(R.value), to: `/${R.value}` },
545
+ { title: B.value ? "New Record" : "Edit Record", to: t }
549
546
  );
550
547
  }
551
548
  return e;
552
- }), Re = (e) => {
549
+ }), De = (e) => {
553
550
  const t = [
554
551
  {
555
552
  title: "Go Home",
@@ -565,45 +562,45 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
565
562
  }
566
563
  ];
567
564
  return R.value && (t.push({
568
- title: `View ${B(R.value)} Records`,
565
+ title: `View ${F(R.value)} Records`,
569
566
  description: `Navigate to ${R.value} list`,
570
567
  action: () => {
571
568
  E({ view: "records", doctype: R.value });
572
569
  }
573
570
  }), t.push({
574
- title: `Create New ${B(R.value)}`,
571
+ title: `Create New ${F(R.value)}`,
575
572
  description: `Create a new ${R.value} record`,
576
573
  action: () => {
577
574
  U();
578
575
  }
579
- })), l.availableDoctypes.forEach((o) => {
576
+ })), l.availableDoctypes.forEach((a) => {
580
577
  t.push({
581
- title: `View ${B(o)}`,
582
- description: `Navigate to ${o} list`,
578
+ title: `View ${F(a)}`,
579
+ description: `Navigate to ${a} list`,
583
580
  action: () => {
584
- E({ view: "records", doctype: o });
581
+ E({ view: "records", doctype: a });
585
582
  }
586
583
  });
587
584
  }), e ? t.filter(
588
- (o) => o.title.toLowerCase().includes(e.toLowerCase()) || o.description.toLowerCase().includes(e.toLowerCase())
585
+ (a) => a.title.toLowerCase().includes(e.toLowerCase()) || a.description.toLowerCase().includes(e.toLowerCase())
589
586
  ) : t;
590
- }, Se = (e) => {
587
+ }, Re = (e) => {
591
588
  e.action(), C.value = !1;
592
- }, B = (e) => e.split("-").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" "), $e = S(() => I.value !== "records" || !r.value ? !1 : a.value?.getPageInfo(r.value)?.hasMore === !0), E = async (e) => {
589
+ }, Se = (e) => {
590
+ if (!o.value || !n.value)
591
+ return Promise.resolve({ data: [], hasMore: !1 });
592
+ const t = o.value.registry.getDoctype(n.value);
593
+ return t ? o.value.getRecords(t, e) : Promise.resolve({ data: [], hasMore: !1 });
594
+ }, F = (e) => e.split("-").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" "), E = async (e) => {
593
595
  d("navigate", e), l.routeAdapter ? await l.routeAdapter.navigate(e) : e.view === "doctypes" ? await u.value?.push("/") : e.view === "records" && e.doctype ? await u.value?.push(`/${e.doctype}`) : e.view === "record" && e.doctype && e.recordId && await u.value?.push(`/${e.doctype}/${e.recordId}`);
594
- }, oe = async (e) => {
596
+ }, ae = async (e) => {
595
597
  await E({ view: "records", doctype: e });
596
- }, re = async (e) => {
598
+ }, ne = async (e) => {
597
599
  const t = R.value;
598
600
  d("record:open", { doctype: t, recordId: e }), await E({ view: "record", doctype: t, recordId: e });
599
601
  }, U = async () => {
600
- await E({ view: "record", doctype: R.value, recordId: Ke });
601
- }, ne = (e) => {
602
- const t = [];
603
- for (const o of e)
604
- o.kind === "fieldset" ? t.push(...ne(o.schema)) : t.push(o);
605
- return t;
606
- }, Ie = () => l.availableDoctypes?.length ? [
602
+ await E({ view: "record", doctype: R.value, recordId: Pe });
603
+ }, $e = () => l.availableDoctypes?.length ? [
607
604
  {
608
605
  kind: "table",
609
606
  fieldname: "doctypes_table",
@@ -641,132 +638,122 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
641
638
  ],
642
639
  config: { view: "list", fullWidth: !0 }
643
640
  }
644
- ] : [], _e = () => {
645
- if (!r.value) return [];
646
- if (!a.value) return [];
647
- const e = a.value.registry, t = e.registry[r.value];
641
+ ] : [], Ie = () => {
642
+ if (!n.value) return [];
643
+ if (!o.value) return [];
644
+ const e = o.value.registry, t = e.registry[n.value];
648
645
  if (!t) return [];
649
- const o = e.resolveSchema(t);
650
- return o.length === 0 ? [] : [
646
+ const a = e.resolveSchema(t);
647
+ if (a.length === 0) return [];
648
+ const m = n.value, v = !!o.value.getClient();
649
+ return [
651
650
  {
652
651
  kind: "table",
653
652
  fieldname: "records_table",
654
653
  component: "ATable",
655
- schema: [
656
- ...ne(o),
657
- { fieldname: "actions", label: "Actions", component: "ATextInput" }
658
- ],
659
- config: { view: "list", fullWidth: !0 }
654
+ // Which resolved fields a cell can render is answered once, in @stonecrop/aform, and
655
+ // called by the child-table builder too. Flattening alone is not the rule: it kept the
656
+ // expanding links, whose value is a nested record or an array of them.
657
+ schema: [...Ke(a), { fieldname: "actions", label: "Actions", component: "ATextInput" }],
658
+ config: { view: "list", fullWidth: !0 },
659
+ ...v ? { getRecords: Se, sourceKey: m } : {}
660
660
  }
661
661
  ];
662
- }, le = () => {
663
- if (!r.value) return [];
664
- if (!a.value) return [];
662
+ }, re = () => {
663
+ if (!n.value) return [];
664
+ if (!o.value) return [];
665
665
  try {
666
- const e = a.value?.registry, t = e?.registry[r.value];
666
+ const e = o.value?.registry, t = e?.registry[n.value];
667
667
  return t?.schema ? e.resolveSchema(t) : [];
668
668
  } catch {
669
669
  return [];
670
670
  }
671
- }, se = () => {
672
- if (!a.value || !r.value)
671
+ }, le = () => {
672
+ if (!o.value || !n.value)
673
673
  return [];
674
- const t = a.value.records(r.value)?.get("");
674
+ const t = o.value.records(n.value)?.get("");
675
675
  return t && typeof t == "object" && !Array.isArray(t) ? Object.values(t) : [];
676
- }, ce = S(() => {
677
- switch (I.value) {
676
+ }, se = $(() => {
677
+ switch (x.value) {
678
678
  case "doctypes":
679
- return Ie();
679
+ return $e();
680
680
  case "records":
681
- return _e();
681
+ return Ie();
682
682
  case "record":
683
- return le();
683
+ return re();
684
684
  default:
685
685
  return [];
686
686
  }
687
- }), xe = (e, t) => {
687
+ }), _e = (e, t) => {
688
688
  t && t();
689
- }, ie = (e) => {
690
- if (!(!a.value || !r.value))
691
- return a.value.registry.registry[r.value]?.getRecordId(e);
692
- }, Ne = (e) => {
689
+ }, ce = (e) => {
690
+ if (!(!o.value || !n.value))
691
+ return o.value.registry.registry[n.value]?.getRecordId(e);
692
+ }, xe = (e) => {
693
693
  const t = e.querySelector("td[data-rowindex]");
694
694
  if (!t) return null;
695
- const o = t.getAttribute("data-rowindex");
696
- if (o === null) return null;
697
- const y = parseInt(o, 10);
698
- if (isNaN(y)) return null;
699
- const A = se()[y];
700
- return A ? ie(A) ?? null : null;
701
- }, Te = async (e) => {
695
+ const a = t.getAttribute("data-rowindex");
696
+ if (a === null) return null;
697
+ const m = parseInt(a, 10);
698
+ if (isNaN(m)) return null;
699
+ const A = le()[m];
700
+ return A ? ce(A) ?? null : null;
701
+ }, Ne = async (e) => {
702
702
  const t = e.target;
703
703
  t.getAttribute("data-action") === "create" && await U();
704
- const y = t.closest("td, th");
705
- if (y) {
706
- const f = y.textContent?.trim(), A = y.closest("tr");
707
- if (f === "View Records" && A) {
708
- const _ = A.querySelectorAll("td");
709
- if (_.length > 0) {
710
- const b = _[1].textContent?.trim();
711
- b && await oe(b);
704
+ const m = t.closest("td, th");
705
+ if (m) {
706
+ const v = m.textContent?.trim(), A = m.closest("tr");
707
+ if (v === "View Records" && A) {
708
+ const I = A.querySelectorAll("td");
709
+ if (I.length > 0) {
710
+ const b = I[1].textContent?.trim();
711
+ b && await ae(b);
712
712
  }
713
- } else if (f === "Edit" && A) {
714
- const _ = Ne(A);
715
- _ && await re(_);
713
+ } else if (v === "Edit" && A) {
714
+ const I = xe(A);
715
+ I && await ne(I);
716
716
  }
717
717
  }
718
718
  }, Me = async () => {
719
- if (!(!a.value || !r.value || !a.value.getClient())) {
720
- N.value = !0;
719
+ if (!(!o.value || !n.value || !o.value.getClient())) {
720
+ T.value = !0;
721
721
  try {
722
- await a.value.getRecord(r.value, h.value);
722
+ await o.value.getRecord(n.value, h.value);
723
723
  } catch (e) {
724
724
  console.warn("Error fetching record:", e);
725
725
  } finally {
726
- N.value = !1;
727
- }
728
- }
729
- }, Ve = async () => {
730
- if (!a.value || !r.value || !a.value.getClient()) return;
731
- const e = a.value.registry.getDoctype(r.value);
732
- if (e) {
733
- N.value = !0;
734
- try {
735
- await a.value.getRecords(e);
736
- } catch (t) {
737
- console.warn("Error fetching records:", t);
738
- } finally {
739
- N.value = !1;
726
+ T.value = !1;
740
727
  }
741
728
  }
742
729
  };
743
730
  H(
744
- [I, r, h],
731
+ [x, n, h],
745
732
  () => {
746
- if (I.value === "records" && r.value)
747
- d("load-records", { doctype: r.value }), Ve();
748
- else if (I.value === "record" && r.value && h.value) {
749
- if (O.value) return;
750
- d("load-record", { doctype: r.value, recordId: h.value }), Me();
733
+ if (x.value === "records" && n.value)
734
+ d("load-records", { doctype: n.value });
735
+ else if (x.value === "record" && n.value && h.value) {
736
+ if (B.value) return;
737
+ d("load-record", { doctype: n.value, recordId: h.value }), Me();
751
738
  }
752
739
  },
753
740
  { immediate: !0 }
754
- ), H([r, h], () => {
755
- v?.clearAll();
741
+ ), H([n, h], () => {
742
+ p?.clearAll();
756
743
  }), H(
757
- [r, h],
744
+ [n, h],
758
745
  () => {
759
- if (!O.value) {
746
+ if (!B.value) {
760
747
  i.value = {};
761
748
  return;
762
749
  }
763
- const e = a.value?.registry;
764
- i.value = e ? e.initializeRecord(le()) : {};
750
+ const e = o.value?.registry;
751
+ i.value = e ? e.initializeRecord(re()) : {};
765
752
  },
766
753
  { immediate: !0 }
767
754
  ), te("desktopMethods", {
768
- navigateToDoctype: oe,
769
- openRecord: re,
755
+ navigateToDoctype: ae,
756
+ openRecord: ne,
770
757
  createNewRecord: U,
771
758
  /**
772
759
  * Convenience wrapper so child components (e.g. slot content) can emit
@@ -775,9 +762,9 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
775
762
  emitAction: (e, t) => {
776
763
  d("action", {
777
764
  name: e,
778
- doctype: r.value,
765
+ doctype: n.value,
779
766
  recordId: h.value,
780
- data: t ?? p.value ?? {}
767
+ data: t ?? f.value ?? {}
781
768
  });
782
769
  }
783
770
  }), te("aformLinkNavigator", {
@@ -785,78 +772,77 @@ const We = { class: "action-menu-icon" }, qe = { class: "action-element-header"
785
772
  E({ view: "record", doctype: e, recordId: String(t) });
786
773
  }
787
774
  }), te("aformLinkResolver", async (e, t) => {
788
- if (a.value)
775
+ if (o.value)
789
776
  try {
790
- const y = (await a.value.getMeta({ path: `/${e}`, segments: [e] }))?.displayField;
791
- if (!y) return;
792
- const f = (b) => {
777
+ const m = (await o.value.getMeta({ path: `/${e}`, segments: [e] }))?.displayField;
778
+ if (!m) return;
779
+ const v = (b) => {
793
780
  if (!b) return;
794
- const T = b[y];
795
- return typeof T == "string" || typeof T == "number" ? String(T) : void 0;
796
- }, A = a.value.getRecordById(e, t)?.get(""), _ = f(A);
797
- if (_ != null) return _;
798
- await a.value.getRecord(e, t);
799
- const k = a.value.getRecordById(e, t)?.get("");
800
- return f(k);
781
+ const N = b[m];
782
+ return typeof N == "string" || typeof N == "number" ? String(N) : void 0;
783
+ }, A = o.value.getRecordById(e, t)?.get(""), I = v(A);
784
+ if (I != null) return I;
785
+ await o.value.getRecord(e, t);
786
+ const k = o.value.getRecordById(e, t)?.get("");
787
+ return v(k);
801
788
  } catch {
802
789
  return;
803
790
  }
804
791
  });
805
- const ue = (e) => {
792
+ const ie = (e) => {
806
793
  (e.ctrlKey || e.metaKey) && e.key === "k" && (e.preventDefault(), C.value = !0), e.key === "Escape" && C.value && (C.value = !1);
807
794
  };
808
- return de(() => {
809
- document.addEventListener("keydown", ue);
810
- }), Fe(() => {
811
- document.removeEventListener("keydown", ue);
812
- }), (e, t) => (m(), g("div", {
795
+ return ue(() => {
796
+ document.addEventListener("keydown", ie);
797
+ }), Be(() => {
798
+ document.removeEventListener("keydown", ie);
799
+ }), (e, t) => (y(), g("div", {
813
800
  class: "desktop",
814
- onClick: Te
801
+ onClick: Ne
815
802
  }, [
816
- j(ge, {
817
- elements: Ae.value,
818
- onActionClick: xe
803
+ L(he, {
804
+ elements: Ce.value,
805
+ onActionClick: _e
819
806
  }, null, 8, ["elements"]),
820
- ce.value.length > 0 ? (m(), fe(ee(He), {
807
+ se.value.length > 0 ? (y(), pe(ee(je), {
821
808
  key: 0,
822
- data: p.value,
823
- "onUpdate:data": t[0] || (t[0] = (o) => p.value = o),
824
- schema: ce.value,
825
- errors: x.value
826
- }, null, 8, ["data", "schema", "errors"])) : ee(a) ? (m(), g("div", yt, [
827
- c("p", null, "Loading " + V(I.value) + " data...", 1)
828
- ])) : (m(), g("div", ht, [...t[2] || (t[2] = [
809
+ data: f.value,
810
+ "onUpdate:data": t[0] || (t[0] = (a) => f.value = a),
811
+ schema: se.value,
812
+ errors: _.value
813
+ }, null, 8, ["data", "schema", "errors"])) : ee(o) ? (y(), g("div", yt, [
814
+ c("p", null, "Loading " + V(x.value) + " data...", 1)
815
+ ])) : (y(), g("div", mt, [...t[2] || (t[2] = [
829
816
  c("p", null, "Initializing Stonecrop...", -1)
830
817
  ])])),
831
- $e.value ? (m(), g("p", gt, "This is a partial list — more records exist on the server.")) : L("", !0),
832
- j(be, { breadcrumbs: De.value }, null, 8, ["breadcrumbs"]),
833
- j(we, {
818
+ L(we, { breadcrumbs: Ae.value }, null, 8, ["breadcrumbs"]),
819
+ L(ge, {
834
820
  "is-open": C.value,
835
- search: Re,
821
+ search: De,
836
822
  placeholder: "Type a command or search...",
837
- onSelect: Se,
838
- onClose: t[1] || (t[1] = (o) => C.value = !1)
823
+ onSelect: Re,
824
+ onClose: t[1] || (t[1] = (a) => C.value = !1)
839
825
  }, {
840
- title: z(({ result: o }) => [
841
- J(V(o.title), 1)
826
+ title: z(({ result: a }) => [
827
+ J(V(a.title), 1)
842
828
  ]),
843
- content: z(({ result: o }) => [
844
- J(V(o.description), 1)
829
+ content: z(({ result: a }) => [
830
+ J(V(a.description), 1)
845
831
  ]),
846
832
  _: 1
847
833
  }, 8, ["is-open"])
848
834
  ]));
849
835
  }
850
- }), St = {
836
+ }), Dt = {
851
837
  install: (l) => {
852
- l.component("ActionSet", ge), l.component("CommandPalette", we), l.component("Desktop", wt), l.component("SheetNav", be);
838
+ l.component("ActionSet", he), l.component("CommandPalette", ge), l.component("Desktop", ht), l.component("SheetNav", we);
853
839
  }
854
840
  };
855
841
  export {
856
- ge as ActionSet,
857
- we as CommandPalette,
858
- wt as Desktop,
859
- be as SheetNav,
860
- St as StonecropDesktop
842
+ he as ActionSet,
843
+ ge as CommandPalette,
844
+ ht as Desktop,
845
+ we as SheetNav,
846
+ Dt as StonecropDesktop
861
847
  };
862
848
  //# sourceMappingURL=desktop.js.map