@stonecrop/desktop 0.6.3 → 0.7.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.css +1 -1
- package/dist/desktop.js +760 -742
- package/dist/desktop.js.map +1 -1
- package/dist/desktop.umd.cjs +11 -11
- package/dist/desktop.umd.cjs.map +1 -1
- package/package.json +16 -16
- package/src/components/Desktop.vue +6 -6
- package/src/components/SheetNav.vue +54 -117
- package/dist/actions-Bg0Mh5s7.js +0 -137
- package/dist/actions-Bg0Mh5s7.js.map +0 -1
- package/dist/index-C3nXTrEd.js +0 -1895
- package/dist/index-C3nXTrEd.js.map +0 -1
- package/dist/operation-log-DB-dGNT9-C9cIr4-e.js +0 -592
- package/dist/operation-log-DB-dGNT9-C9cIr4-e.js.map +0 -1
package/dist/desktop.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { defineComponent as we, ref as R, onMounted as Te, createElementBlock as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as we, ref as R, onMounted as Te, createElementBlock as M, openBlock as L, normalizeClass as ke, createElementVNode as T, Fragment as me, renderList as ye, createCommentVNode as fe, toDisplayString as Y, withDirectives as Ne, vShow as Be, useTemplateRef as st, computed as A, watch as H, nextTick as oe, createBlock as Ke, Teleport as Et, createVNode as se, Transition as Ot, withCtx as be, withModifiers as it, vModelText as lt, renderSlot as xe, createTextVNode as De, inject as He, provide as Ue, toRaw as ct, isRef as le, isReactive as Ae, toRef as ie, hasInjectionContext as kt, getCurrentInstance as ut, reactive as Nt, markRaw as de, effectScope as Dt, getCurrentScope as dt, onScopeDispose as pt, toRefs as Ze, shallowRef as Je, toValue as ee, readonly as Ge, customRef as vt, unref as Oe, watchEffect as Rt, resolveDynamicComponent as Ct, mergeProps as It, resolveComponent as Tt, withKeys as ue, normalizeStyle as Ve } from "vue";
|
|
2
|
+
const At = { class: "action-menu-icon" }, xt = ["disabled", "onClick"], Vt = { key: 1 }, Pt = ["onClick"], jt = { class: "dropdown-container" }, Lt = { class: "dropdown" }, Ft = ["onClick"], Mt = ["href"], Bt = { class: "dropdown-item" }, Ht = /* @__PURE__ */ we({
|
|
3
3
|
__name: "ActionSet",
|
|
4
4
|
props: {
|
|
5
5
|
elements: { default: () => [] }
|
|
6
6
|
},
|
|
7
7
|
emits: ["actionClick"],
|
|
8
|
-
setup(
|
|
9
|
-
const t = e,
|
|
8
|
+
setup(o, { emit: e }) {
|
|
9
|
+
const t = e, a = R({}), n = R(!1), s = R(-1), r = R(!1), c = R(!1);
|
|
10
10
|
Te(() => {
|
|
11
11
|
i();
|
|
12
12
|
});
|
|
13
13
|
const i = () => {
|
|
14
|
-
|
|
14
|
+
a.value = {};
|
|
15
15
|
}, u = () => {
|
|
16
16
|
r.value = !0, s.value = setTimeout(() => {
|
|
17
|
-
r.value && (
|
|
17
|
+
r.value && (n.value = !0);
|
|
18
18
|
}, 500);
|
|
19
19
|
}, p = () => {
|
|
20
|
-
r.value = !1, c.value = !1, clearTimeout(s.value),
|
|
21
|
-
}, b = (
|
|
22
|
-
const O = !
|
|
23
|
-
i(), O && (
|
|
24
|
-
},
|
|
25
|
-
t("actionClick", O,
|
|
20
|
+
r.value = !1, c.value = !1, clearTimeout(s.value), n.value = !1;
|
|
21
|
+
}, b = (N) => {
|
|
22
|
+
const O = !a.value[N];
|
|
23
|
+
i(), O && (a.value[N] = !0);
|
|
24
|
+
}, w = (N, O) => {
|
|
25
|
+
t("actionClick", O, N);
|
|
26
26
|
};
|
|
27
|
-
return (
|
|
28
|
-
class: ke([{ "open-set":
|
|
27
|
+
return (N, O) => (L(), M("div", {
|
|
28
|
+
class: ke([{ "open-set": n.value, "hovered-and-closed": c.value }, "action-set collapse"]),
|
|
29
29
|
onMouseover: u,
|
|
30
30
|
onMouseleave: p
|
|
31
31
|
}, [
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
T("div", At, [
|
|
33
|
+
T("div", {
|
|
34
34
|
id: "chevron",
|
|
35
35
|
onClick: O[0] || (O[0] = (k) => c.value = !c.value)
|
|
36
36
|
}, [...O[1] || (O[1] = [
|
|
37
|
-
|
|
37
|
+
T("svg", {
|
|
38
38
|
id: "Layer_1",
|
|
39
39
|
class: "leftBar",
|
|
40
40
|
version: "1.1",
|
|
@@ -47,9 +47,9 @@ const xt = { class: "action-menu-icon" }, At = ["disabled", "onClick"], Vt = { k
|
|
|
47
47
|
width: "50",
|
|
48
48
|
height: "50"
|
|
49
49
|
}, [
|
|
50
|
-
|
|
50
|
+
T("polygon", { points: "54.2,33.4 29.2,58.8 25,54.6 50,29.2 " })
|
|
51
51
|
], -1),
|
|
52
|
-
|
|
52
|
+
T("svg", {
|
|
53
53
|
id: "Layer_1",
|
|
54
54
|
class: "rightBar",
|
|
55
55
|
version: "1.1",
|
|
@@ -62,54 +62,54 @@ const xt = { class: "action-menu-icon" }, At = ["disabled", "onClick"], Vt = { k
|
|
|
62
62
|
width: "50",
|
|
63
63
|
height: "50"
|
|
64
64
|
}, [
|
|
65
|
-
|
|
65
|
+
T("polygon", { points: "70.8,58.8 45.8,33.4 50,29.2 75,54.6 " })
|
|
66
66
|
], -1)
|
|
67
67
|
])])
|
|
68
68
|
]),
|
|
69
|
-
O[2] || (O[2] =
|
|
70
|
-
(
|
|
69
|
+
O[2] || (O[2] = T("div", { style: { "margin-right": "30px" } }, null, -1)),
|
|
70
|
+
(L(!0), M(me, null, ye(o.elements, (k, V) => (L(), M("div", {
|
|
71
71
|
key: k.label,
|
|
72
72
|
class: "action-element"
|
|
73
73
|
}, [
|
|
74
|
-
k.type == "button" ? (
|
|
74
|
+
k.type == "button" ? (L(), M("button", {
|
|
75
75
|
key: 0,
|
|
76
76
|
disabled: k.disabled,
|
|
77
77
|
class: "button-default",
|
|
78
|
-
onClick: (
|
|
79
|
-
}, Y(k.label), 9,
|
|
80
|
-
k.type == "dropdown" ? (
|
|
81
|
-
|
|
78
|
+
onClick: (P) => w(k.action, k.label)
|
|
79
|
+
}, Y(k.label), 9, xt)) : fe("", !0),
|
|
80
|
+
k.type == "dropdown" ? (L(), M("div", Vt, [
|
|
81
|
+
T("button", {
|
|
82
82
|
class: "button-default",
|
|
83
|
-
onClick: (
|
|
83
|
+
onClick: (P) => b(V)
|
|
84
84
|
}, Y(k.label), 9, Pt),
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
(
|
|
88
|
-
key:
|
|
85
|
+
Ne(T("div", jt, [
|
|
86
|
+
T("div", Lt, [
|
|
87
|
+
(L(!0), M(me, null, ye(k.actions, (P, x) => (L(), M("div", {
|
|
88
|
+
key: P.label
|
|
89
89
|
}, [
|
|
90
|
-
|
|
90
|
+
P.action != null ? (L(), M("button", {
|
|
91
91
|
key: 0,
|
|
92
92
|
class: "dropdown-item",
|
|
93
|
-
onClick: (W) =>
|
|
94
|
-
}, Y(
|
|
93
|
+
onClick: (W) => w(P.action, P.label)
|
|
94
|
+
}, Y(P.label), 9, Ft)) : P.link != null ? (L(), M("a", {
|
|
95
95
|
key: 1,
|
|
96
|
-
href:
|
|
96
|
+
href: P.link
|
|
97
97
|
}, [
|
|
98
|
-
|
|
99
|
-
], 8,
|
|
98
|
+
T("button", Bt, Y(P.label), 1)
|
|
99
|
+
], 8, Mt)) : fe("", !0)
|
|
100
100
|
]))), 128))
|
|
101
101
|
])
|
|
102
102
|
], 512), [
|
|
103
|
-
[Be,
|
|
103
|
+
[Be, a.value[V]]
|
|
104
104
|
])
|
|
105
105
|
])) : fe("", !0)
|
|
106
106
|
]))), 128))
|
|
107
107
|
], 34));
|
|
108
108
|
}
|
|
109
|
-
}), ft = (
|
|
110
|
-
const t =
|
|
111
|
-
for (const [
|
|
112
|
-
t[
|
|
109
|
+
}), ft = (o, e) => {
|
|
110
|
+
const t = o.__vccOpts || o;
|
|
111
|
+
for (const [a, n] of e)
|
|
112
|
+
t[a] = n;
|
|
113
113
|
return t;
|
|
114
114
|
}, ht = /* @__PURE__ */ ft(Ht, [["__scopeId", "data-v-eb01c863"]]), Ut = { class: "command-palette-header" }, Wt = ["placeholder"], zt = {
|
|
115
115
|
key: 0,
|
|
@@ -126,15 +126,15 @@ const xt = { class: "action-menu-icon" }, At = ["disabled", "onClick"], Vt = { k
|
|
|
126
126
|
maxResults: { default: 10 }
|
|
127
127
|
},
|
|
128
128
|
emits: ["select", "close"],
|
|
129
|
-
setup(
|
|
130
|
-
const t = e,
|
|
129
|
+
setup(o, { emit: e }) {
|
|
130
|
+
const t = e, a = R(""), n = R(0), s = st("input"), r = A(() => a.value ? o.search(a.value).slice(0, o.maxResults) : []);
|
|
131
131
|
H(
|
|
132
|
-
() =>
|
|
132
|
+
() => o.isOpen,
|
|
133
133
|
async (p) => {
|
|
134
|
-
p && (
|
|
134
|
+
p && (a.value = "", n.value = 0, await oe(), s.value?.focus());
|
|
135
135
|
}
|
|
136
136
|
), H(r, () => {
|
|
137
|
-
|
|
137
|
+
n.value = 0;
|
|
138
138
|
});
|
|
139
139
|
const c = () => {
|
|
140
140
|
t("close");
|
|
@@ -144,61 +144,61 @@ const xt = { class: "action-menu-icon" }, At = ["disabled", "onClick"], Vt = { k
|
|
|
144
144
|
c();
|
|
145
145
|
break;
|
|
146
146
|
case "ArrowDown":
|
|
147
|
-
p.preventDefault(), r.value.length && (
|
|
147
|
+
p.preventDefault(), r.value.length && (n.value = (n.value + 1) % r.value.length);
|
|
148
148
|
break;
|
|
149
149
|
case "ArrowUp":
|
|
150
|
-
p.preventDefault(), r.value.length && (
|
|
150
|
+
p.preventDefault(), r.value.length && (n.value = (n.value - 1 + r.value.length) % r.value.length);
|
|
151
151
|
break;
|
|
152
152
|
case "Enter":
|
|
153
|
-
r.value.length &&
|
|
153
|
+
r.value.length && n.value >= 0 && u(r.value[n.value]);
|
|
154
154
|
break;
|
|
155
155
|
}
|
|
156
156
|
}, u = (p) => {
|
|
157
157
|
t("select", p), c();
|
|
158
158
|
};
|
|
159
|
-
return (p, b) => (
|
|
159
|
+
return (p, b) => (L(), Ke(Et, { to: "body" }, [
|
|
160
160
|
se(Ot, { name: "fade" }, {
|
|
161
161
|
default: be(() => [
|
|
162
|
-
|
|
162
|
+
o.isOpen ? (L(), M("div", {
|
|
163
163
|
key: 0,
|
|
164
164
|
class: "command-palette-overlay",
|
|
165
165
|
onClick: c
|
|
166
166
|
}, [
|
|
167
|
-
|
|
167
|
+
T("div", {
|
|
168
168
|
class: "command-palette",
|
|
169
169
|
onClick: b[1] || (b[1] = it(() => {
|
|
170
170
|
}, ["stop"]))
|
|
171
171
|
}, [
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
T("div", Ut, [
|
|
173
|
+
Ne(T("input", {
|
|
174
174
|
ref: "input",
|
|
175
|
-
"onUpdate:modelValue": b[0] || (b[0] = (
|
|
175
|
+
"onUpdate:modelValue": b[0] || (b[0] = (w) => a.value = w),
|
|
176
176
|
type: "text",
|
|
177
177
|
class: "command-palette-input",
|
|
178
|
-
placeholder:
|
|
178
|
+
placeholder: o.placeholder,
|
|
179
179
|
autofocus: "",
|
|
180
180
|
onKeydown: i
|
|
181
181
|
}, null, 40, Wt), [
|
|
182
|
-
[lt,
|
|
182
|
+
[lt, a.value]
|
|
183
183
|
])
|
|
184
184
|
]),
|
|
185
|
-
r.value.length ? (
|
|
186
|
-
(
|
|
187
|
-
key:
|
|
188
|
-
class: ke(["command-palette-result", { selected:
|
|
189
|
-
onClick: (O) => u(
|
|
190
|
-
onMouseover: (O) =>
|
|
185
|
+
r.value.length ? (L(), M("div", zt, [
|
|
186
|
+
(L(!0), M(me, null, ye(r.value, (w, N) => (L(), M("div", {
|
|
187
|
+
key: N,
|
|
188
|
+
class: ke(["command-palette-result", { selected: N === n.value }]),
|
|
189
|
+
onClick: (O) => u(w),
|
|
190
|
+
onMouseover: (O) => n.value = N
|
|
191
191
|
}, [
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
T("div", Jt, [
|
|
193
|
+
xe(p.$slots, "title", { result: w })
|
|
194
194
|
]),
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
T("div", Gt, [
|
|
196
|
+
xe(p.$slots, "content", { result: w })
|
|
197
197
|
])
|
|
198
198
|
], 42, Kt))), 128))
|
|
199
|
-
])) :
|
|
200
|
-
|
|
201
|
-
|
|
199
|
+
])) : a.value && !r.value.length ? (L(), M("div", qt, [
|
|
200
|
+
xe(p.$slots, "empty", {}, () => [
|
|
201
|
+
De(' No results found for "' + Y(a.value) + '" ', 1)
|
|
202
202
|
])
|
|
203
203
|
])) : fe("", !0)
|
|
204
204
|
])
|
|
@@ -210,112 +210,112 @@ const xt = { class: "action-menu-icon" }, At = ["disabled", "onClick"], Vt = { k
|
|
|
210
210
|
}
|
|
211
211
|
}), pe = typeof window < "u";
|
|
212
212
|
let ve;
|
|
213
|
-
const Re = (
|
|
213
|
+
const Re = (o) => ve = o;
|
|
214
214
|
process.env.NODE_ENV;
|
|
215
215
|
const Zt = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia") : (
|
|
216
216
|
/* istanbul ignore next */
|
|
217
217
|
/* @__PURE__ */ Symbol()
|
|
218
218
|
);
|
|
219
|
-
function
|
|
220
|
-
return
|
|
219
|
+
function ae(o) {
|
|
220
|
+
return o && typeof o == "object" && Object.prototype.toString.call(o) === "[object Object]" && typeof o.toJSON != "function";
|
|
221
221
|
}
|
|
222
222
|
var he;
|
|
223
|
-
(function(
|
|
224
|
-
|
|
223
|
+
(function(o) {
|
|
224
|
+
o.direct = "direct", o.patchObject = "patch object", o.patchFunction = "patch function";
|
|
225
225
|
})(he || (he = {}));
|
|
226
|
-
function mt(
|
|
226
|
+
function mt(o, e) {
|
|
227
227
|
for (const t in e) {
|
|
228
|
-
const
|
|
229
|
-
if (!(t in
|
|
228
|
+
const a = e[t];
|
|
229
|
+
if (!(t in o))
|
|
230
230
|
continue;
|
|
231
|
-
const
|
|
232
|
-
|
|
231
|
+
const n = o[t];
|
|
232
|
+
ae(n) && ae(a) && !le(a) && !Ae(a) ? o[t] = mt(n, a) : o[t] = a;
|
|
233
233
|
}
|
|
234
|
-
return
|
|
234
|
+
return o;
|
|
235
235
|
}
|
|
236
236
|
const yt = () => {
|
|
237
237
|
};
|
|
238
|
-
function Qe(
|
|
239
|
-
|
|
240
|
-
const
|
|
241
|
-
|
|
238
|
+
function Qe(o, e, t, a = yt) {
|
|
239
|
+
o.add(e);
|
|
240
|
+
const n = () => {
|
|
241
|
+
o.delete(e) && a();
|
|
242
242
|
};
|
|
243
|
-
return !t && dt() && pt(
|
|
243
|
+
return !t && dt() && pt(n), n;
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
|
|
245
|
+
function ne(o, ...e) {
|
|
246
|
+
o.forEach((t) => {
|
|
247
247
|
t(...e);
|
|
248
248
|
});
|
|
249
249
|
}
|
|
250
|
-
const Qt = (
|
|
251
|
-
function We(
|
|
252
|
-
|
|
250
|
+
const Qt = (o) => o(), Xe = /* @__PURE__ */ Symbol(), Pe = /* @__PURE__ */ Symbol();
|
|
251
|
+
function We(o, e) {
|
|
252
|
+
o instanceof Map && e instanceof Map ? e.forEach((t, a) => o.set(a, t)) : o instanceof Set && e instanceof Set && e.forEach(o.add, o);
|
|
253
253
|
for (const t in e) {
|
|
254
254
|
if (!e.hasOwnProperty(t))
|
|
255
255
|
continue;
|
|
256
|
-
const
|
|
257
|
-
|
|
256
|
+
const a = e[t], n = o[t];
|
|
257
|
+
ae(n) && ae(a) && o.hasOwnProperty(t) && !le(a) && !Ae(a) ? o[t] = We(n, a) : o[t] = a;
|
|
258
258
|
}
|
|
259
|
-
return
|
|
259
|
+
return o;
|
|
260
260
|
}
|
|
261
261
|
const Xt = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia:skipHydration") : (
|
|
262
262
|
/* istanbul ignore next */
|
|
263
263
|
/* @__PURE__ */ Symbol()
|
|
264
264
|
);
|
|
265
|
-
function Yt(
|
|
266
|
-
return !
|
|
265
|
+
function Yt(o) {
|
|
266
|
+
return !ae(o) || !Object.prototype.hasOwnProperty.call(o, Xt);
|
|
267
267
|
}
|
|
268
268
|
const { assign: Z } = Object;
|
|
269
|
-
function Ye(
|
|
270
|
-
return !!(le(
|
|
269
|
+
function Ye(o) {
|
|
270
|
+
return !!(le(o) && o.effect);
|
|
271
271
|
}
|
|
272
|
-
function et(
|
|
273
|
-
const { state:
|
|
272
|
+
function et(o, e, t, a) {
|
|
273
|
+
const { state: n, actions: s, getters: r } = e, c = t.state.value[o];
|
|
274
274
|
let i;
|
|
275
275
|
function u() {
|
|
276
|
-
!c && (process.env.NODE_ENV === "production" || !
|
|
277
|
-
const p = process.env.NODE_ENV !== "production" &&
|
|
276
|
+
!c && (process.env.NODE_ENV === "production" || !a) && (t.state.value[o] = n ? n() : {});
|
|
277
|
+
const p = process.env.NODE_ENV !== "production" && a ? (
|
|
278
278
|
// use ref() to unwrap refs inside state TODO: check if this is still necessary
|
|
279
|
-
Ze(R(
|
|
280
|
-
) : Ze(t.state.value[
|
|
281
|
-
return Z(p, s, Object.keys(r || {}).reduce((b,
|
|
279
|
+
Ze(R(n ? n() : {}).value)
|
|
280
|
+
) : Ze(t.state.value[o]);
|
|
281
|
+
return Z(p, s, Object.keys(r || {}).reduce((b, w) => (process.env.NODE_ENV !== "production" && w in p && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${w}" in store "${o}".`), b[w] = de(A(() => {
|
|
282
282
|
Re(t);
|
|
283
|
-
const
|
|
284
|
-
return r[
|
|
283
|
+
const N = t._s.get(o);
|
|
284
|
+
return r[w].call(N, N);
|
|
285
285
|
})), b), {}));
|
|
286
286
|
}
|
|
287
|
-
return i = ze(
|
|
287
|
+
return i = ze(o, u, e, t, a, !0), i;
|
|
288
288
|
}
|
|
289
|
-
function ze(
|
|
289
|
+
function ze(o, e, t = {}, a, n, s) {
|
|
290
290
|
let r;
|
|
291
291
|
const c = Z({ actions: {} }, t);
|
|
292
|
-
if (process.env.NODE_ENV !== "production" && !
|
|
292
|
+
if (process.env.NODE_ENV !== "production" && !a._e.active)
|
|
293
293
|
throw new Error("Pinia destroyed");
|
|
294
294
|
const i = { deep: !0 };
|
|
295
295
|
process.env.NODE_ENV !== "production" && (i.onTrigger = (m) => {
|
|
296
|
-
u ?
|
|
296
|
+
u ? N = m : u == !1 && !_._hotUpdating && (Array.isArray(N) ? N.push(m) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
|
|
297
297
|
});
|
|
298
|
-
let u, p, b = /* @__PURE__ */ new Set(),
|
|
299
|
-
const O =
|
|
300
|
-
!s && !O && (process.env.NODE_ENV === "production" || !
|
|
298
|
+
let u, p, b = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), N;
|
|
299
|
+
const O = a.state.value[o];
|
|
300
|
+
!s && !O && (process.env.NODE_ENV === "production" || !n) && (a.state.value[o] = {});
|
|
301
301
|
const k = R({});
|
|
302
|
-
let
|
|
303
|
-
function
|
|
302
|
+
let V;
|
|
303
|
+
function P(m) {
|
|
304
304
|
let v;
|
|
305
|
-
u = p = !1, process.env.NODE_ENV !== "production" && (
|
|
305
|
+
u = p = !1, process.env.NODE_ENV !== "production" && (N = []), typeof m == "function" ? (m(a.state.value[o]), v = {
|
|
306
306
|
type: he.patchFunction,
|
|
307
|
-
storeId:
|
|
308
|
-
events:
|
|
309
|
-
}) : (We(
|
|
307
|
+
storeId: o,
|
|
308
|
+
events: N
|
|
309
|
+
}) : (We(a.state.value[o], m), v = {
|
|
310
310
|
type: he.patchObject,
|
|
311
311
|
payload: m,
|
|
312
|
-
storeId:
|
|
313
|
-
events:
|
|
312
|
+
storeId: o,
|
|
313
|
+
events: N
|
|
314
314
|
});
|
|
315
|
-
const C =
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
}), p = !0,
|
|
315
|
+
const C = V = /* @__PURE__ */ Symbol();
|
|
316
|
+
oe().then(() => {
|
|
317
|
+
V === C && (u = !0);
|
|
318
|
+
}), p = !0, ne(b, v, a.state.value[o]);
|
|
319
319
|
}
|
|
320
320
|
const x = s ? function() {
|
|
321
321
|
const { state: m } = t, v = m ? m() : {};
|
|
@@ -325,38 +325,38 @@ function ze(n, e, t = {}, o, a, s) {
|
|
|
325
325
|
} : (
|
|
326
326
|
/* istanbul ignore next */
|
|
327
327
|
process.env.NODE_ENV !== "production" ? () => {
|
|
328
|
-
throw new Error(`🍍: Store "${
|
|
328
|
+
throw new Error(`🍍: Store "${o}" is built using the setup syntax and does not implement $reset().`);
|
|
329
329
|
} : yt
|
|
330
330
|
);
|
|
331
331
|
function W() {
|
|
332
|
-
r.stop(), b.clear(),
|
|
332
|
+
r.stop(), b.clear(), w.clear(), a._s.delete(o);
|
|
333
333
|
}
|
|
334
334
|
const J = (m, v = "") => {
|
|
335
335
|
if (Xe in m)
|
|
336
336
|
return m[Pe] = v, m;
|
|
337
337
|
const C = function() {
|
|
338
|
-
Re(
|
|
338
|
+
Re(a);
|
|
339
339
|
const F = Array.from(arguments), E = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set();
|
|
340
|
-
function $(
|
|
341
|
-
E.add(
|
|
340
|
+
function $(B) {
|
|
341
|
+
E.add(B);
|
|
342
342
|
}
|
|
343
|
-
function
|
|
344
|
-
h.add(
|
|
343
|
+
function D(B) {
|
|
344
|
+
h.add(B);
|
|
345
345
|
}
|
|
346
|
-
|
|
346
|
+
ne(w, {
|
|
347
347
|
args: F,
|
|
348
348
|
name: C[Pe],
|
|
349
349
|
store: _,
|
|
350
350
|
after: $,
|
|
351
|
-
onError:
|
|
351
|
+
onError: D
|
|
352
352
|
});
|
|
353
|
-
let
|
|
353
|
+
let j;
|
|
354
354
|
try {
|
|
355
|
-
|
|
356
|
-
} catch (
|
|
357
|
-
throw
|
|
355
|
+
j = m.apply(this && this.$id === o ? this : _, F);
|
|
356
|
+
} catch (B) {
|
|
357
|
+
throw ne(h, B), B;
|
|
358
358
|
}
|
|
359
|
-
return
|
|
359
|
+
return j instanceof Promise ? j.then((B) => (ne(E, B), B)).catch((B) => (ne(h, B), Promise.reject(B))) : (ne(E, j), j);
|
|
360
360
|
};
|
|
361
361
|
return C[Xe] = !0, C[Pe] = v, C;
|
|
362
362
|
}, K = /* @__PURE__ */ de({
|
|
@@ -365,24 +365,24 @@ function ze(n, e, t = {}, o, a, s) {
|
|
|
365
365
|
state: [],
|
|
366
366
|
hotState: k
|
|
367
367
|
}), z = {
|
|
368
|
-
_p:
|
|
368
|
+
_p: a,
|
|
369
369
|
// _s: scope,
|
|
370
|
-
$id:
|
|
371
|
-
$onAction: Qe.bind(null,
|
|
372
|
-
$patch:
|
|
370
|
+
$id: o,
|
|
371
|
+
$onAction: Qe.bind(null, w),
|
|
372
|
+
$patch: P,
|
|
373
373
|
$reset: x,
|
|
374
374
|
$subscribe(m, v = {}) {
|
|
375
|
-
const C = Qe(b, m, v.detached, () => F()), F = r.run(() => H(() =>
|
|
375
|
+
const C = Qe(b, m, v.detached, () => F()), F = r.run(() => H(() => a.state.value[o], (E) => {
|
|
376
376
|
(v.flush === "sync" ? p : u) && m({
|
|
377
|
-
storeId:
|
|
377
|
+
storeId: o,
|
|
378
378
|
type: he.direct,
|
|
379
|
-
events:
|
|
379
|
+
events: N
|
|
380
380
|
}, E);
|
|
381
381
|
}, Z({}, i, v)));
|
|
382
382
|
return C;
|
|
383
383
|
},
|
|
384
384
|
$dispose: W
|
|
385
|
-
}, _ =
|
|
385
|
+
}, _ = Nt(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && pe ? Z(
|
|
386
386
|
{
|
|
387
387
|
_hmrPayload: K,
|
|
388
388
|
_customProperties: de(/* @__PURE__ */ new Set())
|
|
@@ -392,14 +392,14 @@ function ze(n, e, t = {}, o, a, s) {
|
|
|
392
392
|
// must be added later
|
|
393
393
|
// setupStore
|
|
394
394
|
) : z);
|
|
395
|
-
|
|
396
|
-
const U = (
|
|
395
|
+
a._s.set(o, _);
|
|
396
|
+
const U = (a._a && a._a.runWithContext || Qt)(() => a._e.run(() => (r = Dt()).run(() => e({ action: J }))));
|
|
397
397
|
for (const m in U) {
|
|
398
398
|
const v = U[m];
|
|
399
|
-
if (le(v) && !Ye(v) ||
|
|
400
|
-
process.env.NODE_ENV !== "production" &&
|
|
399
|
+
if (le(v) && !Ye(v) || Ae(v))
|
|
400
|
+
process.env.NODE_ENV !== "production" && n ? k.value[m] = ie(U, m) : s || (O && Yt(v) && (le(v) ? v.value = O[m] : We(v, O[m])), a.state.value[o][m] = v), process.env.NODE_ENV !== "production" && K.state.push(m);
|
|
401
401
|
else if (typeof v == "function") {
|
|
402
|
-
const C = process.env.NODE_ENV !== "production" &&
|
|
402
|
+
const C = process.env.NODE_ENV !== "production" && n ? v : J(v, m);
|
|
403
403
|
U[m] = C, process.env.NODE_ENV !== "production" && (K.actions[m] = v), c.actions[m] = v;
|
|
404
404
|
} else process.env.NODE_ENV !== "production" && Ye(v) && (K.getters[m] = s ? (
|
|
405
405
|
// @ts-expect-error
|
|
@@ -408,11 +408,11 @@ function ze(n, e, t = {}, o, a, s) {
|
|
|
408
408
|
(U._getters = de([]))).push(m));
|
|
409
409
|
}
|
|
410
410
|
if (Z(_, U), Z(ct(_), U), Object.defineProperty(_, "$state", {
|
|
411
|
-
get: () => process.env.NODE_ENV !== "production" &&
|
|
411
|
+
get: () => process.env.NODE_ENV !== "production" && n ? k.value : a.state.value[o],
|
|
412
412
|
set: (m) => {
|
|
413
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
413
|
+
if (process.env.NODE_ENV !== "production" && n)
|
|
414
414
|
throw new Error("cannot set hotState");
|
|
415
|
-
|
|
415
|
+
P((v) => {
|
|
416
416
|
Z(v, m);
|
|
417
417
|
});
|
|
418
418
|
}
|
|
@@ -420,12 +420,12 @@ function ze(n, e, t = {}, o, a, s) {
|
|
|
420
420
|
_._hotUpdating = !0, m._hmrPayload.state.forEach((v) => {
|
|
421
421
|
if (v in _.$state) {
|
|
422
422
|
const C = m.$state[v], F = _.$state[v];
|
|
423
|
-
typeof C == "object" &&
|
|
423
|
+
typeof C == "object" && ae(C) && ae(F) ? mt(C, F) : m.$state[v] = F;
|
|
424
424
|
}
|
|
425
425
|
_[v] = ie(m.$state, v);
|
|
426
426
|
}), Object.keys(_.$state).forEach((v) => {
|
|
427
427
|
v in m.$state || delete _[v];
|
|
428
|
-
}), u = !1, p = !1,
|
|
428
|
+
}), u = !1, p = !1, a.state.value[o] = ie(m._hmrPayload, "hotState"), p = !0, oe().then(() => {
|
|
429
429
|
u = !0;
|
|
430
430
|
});
|
|
431
431
|
for (const v in m._hmrPayload.actions) {
|
|
@@ -436,7 +436,7 @@ function ze(n, e, t = {}, o, a, s) {
|
|
|
436
436
|
for (const v in m._hmrPayload.getters) {
|
|
437
437
|
const C = m._hmrPayload.getters[v], F = s ? (
|
|
438
438
|
// special handling of options api
|
|
439
|
-
|
|
439
|
+
A(() => (Re(a), C.call(_, _)))
|
|
440
440
|
) : C;
|
|
441
441
|
_[v] = //
|
|
442
442
|
F;
|
|
@@ -457,20 +457,20 @@ function ze(n, e, t = {}, o, a, s) {
|
|
|
457
457
|
Object.defineProperty(_, v, Z({ value: _[v] }, m));
|
|
458
458
|
});
|
|
459
459
|
}
|
|
460
|
-
return
|
|
460
|
+
return a._p.forEach((m) => {
|
|
461
461
|
if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && pe) {
|
|
462
462
|
const v = r.run(() => m({
|
|
463
463
|
store: _,
|
|
464
|
-
app:
|
|
465
|
-
pinia:
|
|
464
|
+
app: a._a,
|
|
465
|
+
pinia: a,
|
|
466
466
|
options: c
|
|
467
467
|
}));
|
|
468
468
|
Object.keys(v || {}).forEach((C) => _._customProperties.add(C)), Z(_, v);
|
|
469
469
|
} else
|
|
470
470
|
Z(_, r.run(() => m({
|
|
471
471
|
store: _,
|
|
472
|
-
app:
|
|
473
|
-
pinia:
|
|
472
|
+
app: a._a,
|
|
473
|
+
pinia: a,
|
|
474
474
|
options: c
|
|
475
475
|
})));
|
|
476
476
|
}), process.env.NODE_ENV !== "production" && _.$state && typeof _.$state == "object" && typeof _.$state.constructor == "function" && !_.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be
|
|
@@ -478,10 +478,10 @@ function ze(n, e, t = {}, o, a, s) {
|
|
|
478
478
|
Found in store "${_.$id}".`), O && s && t.hydrate && t.hydrate(_.$state, O), u = !0, p = !0, _;
|
|
479
479
|
}
|
|
480
480
|
// @__NO_SIDE_EFFECTS__
|
|
481
|
-
function
|
|
482
|
-
let
|
|
483
|
-
const
|
|
484
|
-
|
|
481
|
+
function eo(o, e, t) {
|
|
482
|
+
let a;
|
|
483
|
+
const n = typeof e == "function";
|
|
484
|
+
a = n ? t : e;
|
|
485
485
|
function s(r, c) {
|
|
486
486
|
const i = kt();
|
|
487
487
|
if (r = // in test mode, ignore the argument provided as we can always retrieve a
|
|
@@ -490,96 +490,96 @@ function en(n, e, t) {
|
|
|
490
490
|
throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
|
|
491
491
|
See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
|
|
492
492
|
This will fail in production.`);
|
|
493
|
-
r = ve, r._s.has(
|
|
494
|
-
const u = r._s.get(
|
|
493
|
+
r = ve, r._s.has(o) || (n ? ze(o, e, a, r) : et(o, a, r), process.env.NODE_ENV !== "production" && (s._pinia = r));
|
|
494
|
+
const u = r._s.get(o);
|
|
495
495
|
if (process.env.NODE_ENV !== "production" && c) {
|
|
496
|
-
const p = "__hot:" +
|
|
496
|
+
const p = "__hot:" + o, b = n ? ze(p, e, a, r, !0) : et(p, Z({}, a), r, !0);
|
|
497
497
|
c._hotUpdate(b), delete r.state.value[p], r._s.delete(p);
|
|
498
498
|
}
|
|
499
499
|
if (process.env.NODE_ENV !== "production" && pe) {
|
|
500
500
|
const p = ut();
|
|
501
501
|
if (p && p.proxy && // avoid adding stores that are just built for hot module replacement
|
|
502
502
|
!c) {
|
|
503
|
-
const b = p.proxy,
|
|
504
|
-
|
|
503
|
+
const b = p.proxy, w = "_pStores" in b ? b._pStores : b._pStores = {};
|
|
504
|
+
w[o] = u;
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
507
|
return u;
|
|
508
508
|
}
|
|
509
|
-
return s.$id =
|
|
509
|
+
return s.$id = o, s;
|
|
510
510
|
}
|
|
511
|
-
function
|
|
512
|
-
const e = ct(
|
|
513
|
-
for (const
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
get: () =>
|
|
511
|
+
function to(o) {
|
|
512
|
+
const e = ct(o), t = {};
|
|
513
|
+
for (const a in e) {
|
|
514
|
+
const n = e[a];
|
|
515
|
+
n.effect ? t[a] = // ...
|
|
516
|
+
A({
|
|
517
|
+
get: () => o[a],
|
|
518
518
|
set(s) {
|
|
519
|
-
|
|
519
|
+
o[a] = s;
|
|
520
520
|
}
|
|
521
|
-
}) : (le(
|
|
522
|
-
ie(
|
|
521
|
+
}) : (le(n) || Ae(n)) && (t[a] = // ---
|
|
522
|
+
ie(o, a));
|
|
523
523
|
}
|
|
524
524
|
return t;
|
|
525
525
|
}
|
|
526
|
-
const
|
|
526
|
+
const oo = typeof window < "u" && typeof document < "u";
|
|
527
527
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
528
|
-
const
|
|
528
|
+
const ao = Object.prototype.toString, no = (o) => ao.call(o) === "[object Object]", ro = () => {
|
|
529
529
|
};
|
|
530
|
-
function
|
|
531
|
-
if (
|
|
532
|
-
const e =
|
|
530
|
+
function so(...o) {
|
|
531
|
+
if (o.length !== 1) return ie(...o);
|
|
532
|
+
const e = o[0];
|
|
533
533
|
return typeof e == "function" ? Ge(vt(() => ({
|
|
534
534
|
get: e,
|
|
535
|
-
set:
|
|
535
|
+
set: ro
|
|
536
536
|
}))) : R(e);
|
|
537
537
|
}
|
|
538
|
-
function
|
|
539
|
-
function t(...
|
|
540
|
-
return new Promise((
|
|
541
|
-
Promise.resolve(
|
|
538
|
+
function io(o, e) {
|
|
539
|
+
function t(...a) {
|
|
540
|
+
return new Promise((n, s) => {
|
|
541
|
+
Promise.resolve(o(() => e.apply(this, a), {
|
|
542
542
|
fn: e,
|
|
543
543
|
thisArg: this,
|
|
544
|
-
args:
|
|
545
|
-
})).then(
|
|
544
|
+
args: a
|
|
545
|
+
})).then(n).catch(s);
|
|
546
546
|
});
|
|
547
547
|
}
|
|
548
548
|
return t;
|
|
549
549
|
}
|
|
550
|
-
const bt = (
|
|
551
|
-
function
|
|
552
|
-
const { initialState: t = "active" } = e,
|
|
553
|
-
function
|
|
554
|
-
|
|
550
|
+
const bt = (o) => o();
|
|
551
|
+
function lo(o = bt, e = {}) {
|
|
552
|
+
const { initialState: t = "active" } = e, a = so(t === "active");
|
|
553
|
+
function n() {
|
|
554
|
+
a.value = !1;
|
|
555
555
|
}
|
|
556
556
|
function s() {
|
|
557
|
-
|
|
557
|
+
a.value = !0;
|
|
558
558
|
}
|
|
559
559
|
const r = (...c) => {
|
|
560
|
-
|
|
560
|
+
a.value && o(...c);
|
|
561
561
|
};
|
|
562
562
|
return {
|
|
563
|
-
isActive: Ge(
|
|
564
|
-
pause:
|
|
563
|
+
isActive: Ge(a),
|
|
564
|
+
pause: n,
|
|
565
565
|
resume: s,
|
|
566
566
|
eventFilter: r
|
|
567
567
|
};
|
|
568
568
|
}
|
|
569
|
-
function je(
|
|
570
|
-
return Array.isArray(
|
|
569
|
+
function je(o) {
|
|
570
|
+
return Array.isArray(o) ? o : [o];
|
|
571
571
|
}
|
|
572
|
-
function
|
|
572
|
+
function co(o) {
|
|
573
573
|
return ut();
|
|
574
574
|
}
|
|
575
|
-
function
|
|
576
|
-
const { eventFilter:
|
|
577
|
-
return H(
|
|
575
|
+
function uo(o, e, t = {}) {
|
|
576
|
+
const { eventFilter: a = bt, ...n } = t;
|
|
577
|
+
return H(o, io(a, e), n);
|
|
578
578
|
}
|
|
579
|
-
function
|
|
580
|
-
const { eventFilter:
|
|
579
|
+
function po(o, e, t = {}) {
|
|
580
|
+
const { eventFilter: a, initialState: n = "active", ...s } = t, { eventFilter: r, pause: c, resume: i, isActive: u } = lo(a, { initialState: n });
|
|
581
581
|
return {
|
|
582
|
-
stop:
|
|
582
|
+
stop: uo(o, e, {
|
|
583
583
|
...s,
|
|
584
584
|
eventFilter: r
|
|
585
585
|
}),
|
|
@@ -588,164 +588,164 @@ function pn(n, e, t = {}) {
|
|
|
588
588
|
isActive: u
|
|
589
589
|
};
|
|
590
590
|
}
|
|
591
|
-
const
|
|
592
|
-
function
|
|
593
|
-
|
|
591
|
+
const vo = po;
|
|
592
|
+
function fo(o, e = !0, t) {
|
|
593
|
+
co() ? Te(o, t) : e ? o() : oe(o);
|
|
594
594
|
}
|
|
595
|
-
function
|
|
596
|
-
return H(
|
|
595
|
+
function ho(o, e, t) {
|
|
596
|
+
return H(o, e, {
|
|
597
597
|
...t,
|
|
598
598
|
immediate: !0
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
|
-
const Ce =
|
|
602
|
-
function
|
|
601
|
+
const Ce = oo ? window : void 0;
|
|
602
|
+
function go(o) {
|
|
603
603
|
var e;
|
|
604
|
-
const t = ee(
|
|
604
|
+
const t = ee(o);
|
|
605
605
|
return (e = t?.$el) !== null && e !== void 0 ? e : t;
|
|
606
606
|
}
|
|
607
|
-
function tt(...
|
|
608
|
-
const e = (
|
|
609
|
-
const
|
|
610
|
-
return
|
|
607
|
+
function tt(...o) {
|
|
608
|
+
const e = (a, n, s, r) => (a.addEventListener(n, s, r), () => a.removeEventListener(n, s, r)), t = A(() => {
|
|
609
|
+
const a = je(ee(o[0])).filter((n) => n != null);
|
|
610
|
+
return a.every((n) => typeof n != "string") ? a : void 0;
|
|
611
611
|
});
|
|
612
|
-
return
|
|
613
|
-
var
|
|
612
|
+
return ho(() => {
|
|
613
|
+
var a, n;
|
|
614
614
|
return [
|
|
615
|
-
(
|
|
616
|
-
je(ee(t.value ?
|
|
617
|
-
je(Oe(t.value ?
|
|
618
|
-
ee(t.value ?
|
|
615
|
+
(a = (n = t.value) === null || n === void 0 ? void 0 : n.map((s) => go(s))) !== null && a !== void 0 ? a : [Ce].filter((s) => s != null),
|
|
616
|
+
je(ee(t.value ? o[1] : o[0])),
|
|
617
|
+
je(Oe(t.value ? o[2] : o[1])),
|
|
618
|
+
ee(t.value ? o[3] : o[2])
|
|
619
619
|
];
|
|
620
|
-
}, ([
|
|
621
|
-
if (!
|
|
622
|
-
const u =
|
|
620
|
+
}, ([a, n, s, r], c, i) => {
|
|
621
|
+
if (!a?.length || !n?.length || !s?.length) return;
|
|
622
|
+
const u = no(r) ? { ...r } : r, p = a.flatMap((b) => n.flatMap((w) => s.map((N) => e(b, w, N, u))));
|
|
623
623
|
i(() => {
|
|
624
624
|
p.forEach((b) => b());
|
|
625
625
|
});
|
|
626
626
|
}, { flush: "post" });
|
|
627
627
|
}
|
|
628
|
-
const Se = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, $e = "__vueuse_ssr_handlers__",
|
|
629
|
-
function
|
|
628
|
+
const Se = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, $e = "__vueuse_ssr_handlers__", mo = /* @__PURE__ */ yo();
|
|
629
|
+
function yo() {
|
|
630
630
|
return $e in Se || (Se[$e] = Se[$e] || {}), Se[$e];
|
|
631
631
|
}
|
|
632
|
-
function
|
|
633
|
-
return
|
|
632
|
+
function bo(o, e) {
|
|
633
|
+
return mo[o] || e;
|
|
634
634
|
}
|
|
635
|
-
function
|
|
636
|
-
return
|
|
635
|
+
function wo(o) {
|
|
636
|
+
return o == null ? "any" : o instanceof Set ? "set" : o instanceof Map ? "map" : o instanceof Date ? "date" : typeof o == "boolean" ? "boolean" : typeof o == "string" ? "string" : typeof o == "object" ? "object" : Number.isNaN(o) ? "any" : "number";
|
|
637
637
|
}
|
|
638
|
-
const
|
|
638
|
+
const So = {
|
|
639
639
|
boolean: {
|
|
640
|
-
read: (
|
|
641
|
-
write: (
|
|
640
|
+
read: (o) => o === "true",
|
|
641
|
+
write: (o) => String(o)
|
|
642
642
|
},
|
|
643
643
|
object: {
|
|
644
|
-
read: (
|
|
645
|
-
write: (
|
|
644
|
+
read: (o) => JSON.parse(o),
|
|
645
|
+
write: (o) => JSON.stringify(o)
|
|
646
646
|
},
|
|
647
647
|
number: {
|
|
648
|
-
read: (
|
|
649
|
-
write: (
|
|
648
|
+
read: (o) => Number.parseFloat(o),
|
|
649
|
+
write: (o) => String(o)
|
|
650
650
|
},
|
|
651
651
|
any: {
|
|
652
|
-
read: (
|
|
653
|
-
write: (
|
|
652
|
+
read: (o) => o,
|
|
653
|
+
write: (o) => String(o)
|
|
654
654
|
},
|
|
655
655
|
string: {
|
|
656
|
-
read: (
|
|
657
|
-
write: (
|
|
656
|
+
read: (o) => o,
|
|
657
|
+
write: (o) => String(o)
|
|
658
658
|
},
|
|
659
659
|
map: {
|
|
660
|
-
read: (
|
|
661
|
-
write: (
|
|
660
|
+
read: (o) => new Map(JSON.parse(o)),
|
|
661
|
+
write: (o) => JSON.stringify(Array.from(o.entries()))
|
|
662
662
|
},
|
|
663
663
|
set: {
|
|
664
|
-
read: (
|
|
665
|
-
write: (
|
|
664
|
+
read: (o) => new Set(JSON.parse(o)),
|
|
665
|
+
write: (o) => JSON.stringify(Array.from(o))
|
|
666
666
|
},
|
|
667
667
|
date: {
|
|
668
|
-
read: (
|
|
669
|
-
write: (
|
|
668
|
+
read: (o) => new Date(o),
|
|
669
|
+
write: (o) => o.toISOString()
|
|
670
670
|
}
|
|
671
|
-
},
|
|
672
|
-
function $
|
|
673
|
-
var
|
|
674
|
-
const { flush: s = "pre", deep: r = !0, listenToStorageChanges: c = !0, writeDefaults: i = !0, mergeDefaults: u = !1, shallow: p, window: b = Ce, eventFilter:
|
|
671
|
+
}, ot = "vueuse-storage";
|
|
672
|
+
function $o(o, e, t, a = {}) {
|
|
673
|
+
var n;
|
|
674
|
+
const { flush: s = "pre", deep: r = !0, listenToStorageChanges: c = !0, writeDefaults: i = !0, mergeDefaults: u = !1, shallow: p, window: b = Ce, eventFilter: w, onError: N = (h) => {
|
|
675
675
|
console.error(h);
|
|
676
|
-
}, initOnMounted: O } =
|
|
676
|
+
}, initOnMounted: O } = a, k = (p ? Je : R)(e), V = A(() => ee(o));
|
|
677
677
|
if (!t) try {
|
|
678
|
-
t =
|
|
678
|
+
t = bo("getDefaultStorage", () => Ce?.localStorage)();
|
|
679
679
|
} catch (h) {
|
|
680
|
-
|
|
680
|
+
N(h);
|
|
681
681
|
}
|
|
682
682
|
if (!t) return k;
|
|
683
|
-
const
|
|
683
|
+
const P = ee(e), x = wo(P), W = (n = a.serializer) !== null && n !== void 0 ? n : So[x], { pause: J, resume: K } = vo(k, (h) => v(h), {
|
|
684
684
|
flush: s,
|
|
685
685
|
deep: r,
|
|
686
|
-
eventFilter:
|
|
686
|
+
eventFilter: w
|
|
687
687
|
});
|
|
688
|
-
H(
|
|
688
|
+
H(V, () => F(), { flush: s });
|
|
689
689
|
let z = !1;
|
|
690
690
|
const _ = (h) => {
|
|
691
691
|
O && !z || F(h);
|
|
692
692
|
}, U = (h) => {
|
|
693
693
|
O && !z || E(h);
|
|
694
694
|
};
|
|
695
|
-
b && c && (t instanceof Storage ? tt(b, "storage", _, { passive: !0 }) : tt(b,
|
|
695
|
+
b && c && (t instanceof Storage ? tt(b, "storage", _, { passive: !0 }) : tt(b, ot, U)), O ? fo(() => {
|
|
696
696
|
z = !0, F();
|
|
697
697
|
}) : F();
|
|
698
698
|
function m(h, $) {
|
|
699
699
|
if (b) {
|
|
700
|
-
const
|
|
701
|
-
key:
|
|
700
|
+
const D = {
|
|
701
|
+
key: V.value,
|
|
702
702
|
oldValue: h,
|
|
703
703
|
newValue: $,
|
|
704
704
|
storageArea: t
|
|
705
705
|
};
|
|
706
|
-
b.dispatchEvent(t instanceof Storage ? new StorageEvent("storage",
|
|
706
|
+
b.dispatchEvent(t instanceof Storage ? new StorageEvent("storage", D) : new CustomEvent(ot, { detail: D }));
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
709
|
function v(h) {
|
|
710
710
|
try {
|
|
711
|
-
const $ = t.getItem(
|
|
711
|
+
const $ = t.getItem(V.value);
|
|
712
712
|
if (h == null)
|
|
713
|
-
m($, null), t.removeItem(
|
|
713
|
+
m($, null), t.removeItem(V.value);
|
|
714
714
|
else {
|
|
715
|
-
const
|
|
716
|
-
$ !==
|
|
715
|
+
const D = W.write(h);
|
|
716
|
+
$ !== D && (t.setItem(V.value, D), m($, D));
|
|
717
717
|
}
|
|
718
718
|
} catch ($) {
|
|
719
|
-
|
|
719
|
+
N($);
|
|
720
720
|
}
|
|
721
721
|
}
|
|
722
722
|
function C(h) {
|
|
723
|
-
const $ = h ? h.newValue : t.getItem(
|
|
723
|
+
const $ = h ? h.newValue : t.getItem(V.value);
|
|
724
724
|
if ($ == null)
|
|
725
|
-
return i &&
|
|
725
|
+
return i && P != null && t.setItem(V.value, W.write(P)), P;
|
|
726
726
|
if (!h && u) {
|
|
727
|
-
const
|
|
728
|
-
return typeof u == "function" ? u(
|
|
729
|
-
...
|
|
730
|
-
...
|
|
731
|
-
} :
|
|
727
|
+
const D = W.read($);
|
|
728
|
+
return typeof u == "function" ? u(D, P) : x === "object" && !Array.isArray(D) ? {
|
|
729
|
+
...P,
|
|
730
|
+
...D
|
|
731
|
+
} : D;
|
|
732
732
|
} else return typeof $ != "string" ? $ : W.read($);
|
|
733
733
|
}
|
|
734
734
|
function F(h) {
|
|
735
735
|
if (!(h && h.storageArea !== t)) {
|
|
736
736
|
if (h && h.key == null) {
|
|
737
|
-
k.value =
|
|
737
|
+
k.value = P;
|
|
738
738
|
return;
|
|
739
739
|
}
|
|
740
|
-
if (!(h && h.key !==
|
|
740
|
+
if (!(h && h.key !== V.value)) {
|
|
741
741
|
J();
|
|
742
742
|
try {
|
|
743
743
|
const $ = W.write(k.value);
|
|
744
744
|
(h === void 0 || h?.newValue !== $) && (k.value = C(h));
|
|
745
745
|
} catch ($) {
|
|
746
|
-
|
|
746
|
+
N($);
|
|
747
747
|
} finally {
|
|
748
|
-
h ?
|
|
748
|
+
h ? oe(K) : K();
|
|
749
749
|
}
|
|
750
750
|
}
|
|
751
751
|
}
|
|
@@ -755,88 +755,88 @@ function $n(n, e, t, o = {}) {
|
|
|
755
755
|
}
|
|
756
756
|
return k;
|
|
757
757
|
}
|
|
758
|
-
function
|
|
759
|
-
const { window:
|
|
760
|
-
return $
|
|
758
|
+
function _o(o, e, t = {}) {
|
|
759
|
+
const { window: a = Ce } = t;
|
|
760
|
+
return $o(o, e, a?.localStorage, t);
|
|
761
761
|
}
|
|
762
|
-
function
|
|
762
|
+
function Le() {
|
|
763
763
|
return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
764
764
|
}
|
|
765
|
-
function _e(
|
|
765
|
+
function _e(o) {
|
|
766
766
|
const e = {
|
|
767
|
-
type:
|
|
768
|
-
clientId:
|
|
769
|
-
timestamp:
|
|
767
|
+
type: o.type,
|
|
768
|
+
clientId: o.clientId,
|
|
769
|
+
timestamp: o.timestamp.toISOString()
|
|
770
770
|
};
|
|
771
|
-
return
|
|
772
|
-
...
|
|
773
|
-
timestamp:
|
|
774
|
-
}),
|
|
771
|
+
return o.operation && (e.operation = {
|
|
772
|
+
...o.operation,
|
|
773
|
+
timestamp: o.operation.timestamp.toISOString()
|
|
774
|
+
}), o.operations && (e.operations = o.operations.map((t) => ({
|
|
775
775
|
...t,
|
|
776
776
|
timestamp: t.timestamp.toISOString()
|
|
777
777
|
}))), e;
|
|
778
778
|
}
|
|
779
|
-
function
|
|
779
|
+
function Eo(o) {
|
|
780
780
|
const e = {
|
|
781
|
-
type:
|
|
782
|
-
clientId:
|
|
783
|
-
timestamp: new Date(
|
|
781
|
+
type: o.type,
|
|
782
|
+
clientId: o.clientId,
|
|
783
|
+
timestamp: new Date(o.timestamp)
|
|
784
784
|
};
|
|
785
|
-
return
|
|
786
|
-
...
|
|
787
|
-
timestamp: new Date(
|
|
788
|
-
}),
|
|
785
|
+
return o.operation && (e.operation = {
|
|
786
|
+
...o.operation,
|
|
787
|
+
timestamp: new Date(o.operation.timestamp)
|
|
788
|
+
}), o.operations && (e.operations = o.operations.map((t) => ({
|
|
789
789
|
...t,
|
|
790
790
|
timestamp: new Date(t.timestamp)
|
|
791
791
|
}))), e;
|
|
792
792
|
}
|
|
793
|
-
const wt = /* @__PURE__ */
|
|
794
|
-
const
|
|
793
|
+
const wt = /* @__PURE__ */ eo("hst-operation-log", () => {
|
|
794
|
+
const o = R({
|
|
795
795
|
maxOperations: 100,
|
|
796
796
|
enableCrossTabSync: !0,
|
|
797
797
|
autoSyncInterval: 3e4,
|
|
798
798
|
enablePersistence: !1,
|
|
799
799
|
persistenceKeyPrefix: "stonecrop-ops"
|
|
800
|
-
}), e = R([]), t = R(-1),
|
|
800
|
+
}), e = R([]), t = R(-1), a = R(Le()), n = R(!1), s = R([]), r = R(null), c = A(() => t.value < 0 ? !1 : e.value[t.value]?.reversible ?? !1), i = A(() => t.value < e.value.length - 1), u = A(() => {
|
|
801
801
|
let g = 0;
|
|
802
802
|
for (let f = t.value; f >= 0 && e.value[f]?.reversible; f--)
|
|
803
803
|
g++;
|
|
804
804
|
return g;
|
|
805
|
-
}), p =
|
|
805
|
+
}), p = A(() => e.value.length - 1 - t.value), b = A(() => ({
|
|
806
806
|
canUndo: c.value,
|
|
807
807
|
canRedo: i.value,
|
|
808
808
|
undoCount: u.value,
|
|
809
809
|
redoCount: p.value,
|
|
810
810
|
currentIndex: t.value
|
|
811
811
|
}));
|
|
812
|
-
function
|
|
813
|
-
|
|
812
|
+
function w(g) {
|
|
813
|
+
o.value = { ...o.value, ...g }, o.value.enablePersistence && (j(), G()), o.value.enableCrossTabSync && C();
|
|
814
814
|
}
|
|
815
|
-
function
|
|
815
|
+
function N(g, f = "user") {
|
|
816
816
|
const y = {
|
|
817
817
|
...g,
|
|
818
|
-
id:
|
|
818
|
+
id: Le(),
|
|
819
819
|
timestamp: /* @__PURE__ */ new Date(),
|
|
820
820
|
source: f,
|
|
821
|
-
userId:
|
|
821
|
+
userId: o.value.userId
|
|
822
822
|
};
|
|
823
|
-
if (
|
|
823
|
+
if (o.value.operationFilter && !o.value.operationFilter(y))
|
|
824
824
|
return y.id;
|
|
825
|
-
if (
|
|
825
|
+
if (n.value)
|
|
826
826
|
return s.value.push(y), y.id;
|
|
827
|
-
if (t.value < e.value.length - 1 && (e.value = e.value.slice(0, t.value + 1)), e.value.push(y), t.value++,
|
|
828
|
-
const l = e.value.length -
|
|
827
|
+
if (t.value < e.value.length - 1 && (e.value = e.value.slice(0, t.value + 1)), e.value.push(y), t.value++, o.value.maxOperations && e.value.length > o.value.maxOperations) {
|
|
828
|
+
const l = e.value.length - o.value.maxOperations;
|
|
829
829
|
e.value = e.value.slice(l), t.value -= l;
|
|
830
830
|
}
|
|
831
|
-
return
|
|
831
|
+
return o.value.enableCrossTabSync && F(y), y.id;
|
|
832
832
|
}
|
|
833
833
|
function O() {
|
|
834
|
-
|
|
834
|
+
n.value = !0, s.value = [], r.value = Le();
|
|
835
835
|
}
|
|
836
836
|
function k(g) {
|
|
837
|
-
if (!
|
|
838
|
-
return
|
|
839
|
-
const f = r.value, y = s.value.every((
|
|
837
|
+
if (!n.value || s.value.length === 0)
|
|
838
|
+
return n.value = !1, s.value = [], r.value = null, null;
|
|
839
|
+
const f = r.value, y = s.value.every((S) => S.reversible), l = {
|
|
840
840
|
id: f,
|
|
841
841
|
type: "batch",
|
|
842
842
|
path: "",
|
|
@@ -849,19 +849,19 @@ const wt = /* @__PURE__ */ en("hst-operation-log", () => {
|
|
|
849
849
|
source: "user",
|
|
850
850
|
reversible: y,
|
|
851
851
|
irreversibleReason: y ? void 0 : "Contains irreversible operations",
|
|
852
|
-
childOperationIds: s.value.map((
|
|
852
|
+
childOperationIds: s.value.map((S) => S.id),
|
|
853
853
|
metadata: { description: g }
|
|
854
854
|
};
|
|
855
|
-
s.value.forEach((
|
|
856
|
-
|
|
857
|
-
}), e.value.push(...s.value, l), t.value = e.value.length - 1,
|
|
855
|
+
s.value.forEach((S) => {
|
|
856
|
+
S.parentOperationId = f;
|
|
857
|
+
}), e.value.push(...s.value, l), t.value = e.value.length - 1, o.value.enableCrossTabSync && E(s.value, l);
|
|
858
858
|
const d = f;
|
|
859
|
-
return
|
|
859
|
+
return n.value = !1, s.value = [], r.value = null, d;
|
|
860
860
|
}
|
|
861
|
-
function
|
|
862
|
-
|
|
861
|
+
function V() {
|
|
862
|
+
n.value = !1, s.value = [], r.value = null;
|
|
863
863
|
}
|
|
864
|
-
function
|
|
864
|
+
function P(g) {
|
|
865
865
|
if (!c.value) return !1;
|
|
866
866
|
const f = e.value[t.value];
|
|
867
867
|
if (!f.reversible)
|
|
@@ -869,12 +869,12 @@ const wt = /* @__PURE__ */ en("hst-operation-log", () => {
|
|
|
869
869
|
try {
|
|
870
870
|
if (f.type === "batch" && f.childOperationIds)
|
|
871
871
|
for (let y = f.childOperationIds.length - 1; y >= 0; y--) {
|
|
872
|
-
const l = f.childOperationIds[y], d = e.value.find((
|
|
872
|
+
const l = f.childOperationIds[y], d = e.value.find((S) => S.id === l);
|
|
873
873
|
d && W(d, g);
|
|
874
874
|
}
|
|
875
875
|
else
|
|
876
876
|
W(f, g);
|
|
877
|
-
return t.value--,
|
|
877
|
+
return t.value--, o.value.enableCrossTabSync && h(f), !0;
|
|
878
878
|
} catch (y) {
|
|
879
879
|
return typeof console < "u" && console.error("Undo failed:", y), !1;
|
|
880
880
|
}
|
|
@@ -890,7 +890,7 @@ const wt = /* @__PURE__ */ en("hst-operation-log", () => {
|
|
|
890
890
|
}
|
|
891
891
|
else
|
|
892
892
|
J(f, g);
|
|
893
|
-
return t.value++,
|
|
893
|
+
return t.value++, o.value.enableCrossTabSync && $(f), !0;
|
|
894
894
|
} catch (y) {
|
|
895
895
|
return typeof console < "u" && console.error("Redo failed:", y), !1;
|
|
896
896
|
}
|
|
@@ -924,7 +924,7 @@ const wt = /* @__PURE__ */ en("hst-operation-log", () => {
|
|
|
924
924
|
y && (y.reversible = !1, y.irreversibleReason = f);
|
|
925
925
|
}
|
|
926
926
|
function m(g, f, y, l = "success", d) {
|
|
927
|
-
const
|
|
927
|
+
const S = {
|
|
928
928
|
type: "action",
|
|
929
929
|
path: y && y.length > 0 ? `${g}.${y[0]}` : g,
|
|
930
930
|
fieldname: "",
|
|
@@ -939,15 +939,15 @@ const wt = /* @__PURE__ */ en("hst-operation-log", () => {
|
|
|
939
939
|
actionResult: l,
|
|
940
940
|
actionError: d
|
|
941
941
|
};
|
|
942
|
-
return
|
|
942
|
+
return N(S);
|
|
943
943
|
}
|
|
944
944
|
let v = null;
|
|
945
945
|
function C() {
|
|
946
946
|
typeof window > "u" || !window.BroadcastChannel || (v = new BroadcastChannel("stonecrop-operation-log"), v.addEventListener("message", (g) => {
|
|
947
947
|
const f = g.data;
|
|
948
948
|
if (!f || typeof f != "object") return;
|
|
949
|
-
const y =
|
|
950
|
-
y.clientId !==
|
|
949
|
+
const y = Eo(f);
|
|
950
|
+
y.clientId !== a.value && (y.type === "operation" && y.operation ? (e.value.push({ ...y.operation, source: "sync" }), t.value = e.value.length - 1) : y.type === "operation" && y.operations && (e.value.push(...y.operations.map((l) => ({ ...l, source: "sync" }))), t.value = e.value.length - 1));
|
|
951
951
|
}));
|
|
952
952
|
}
|
|
953
953
|
function F(g) {
|
|
@@ -955,7 +955,7 @@ const wt = /* @__PURE__ */ en("hst-operation-log", () => {
|
|
|
955
955
|
const f = {
|
|
956
956
|
type: "operation",
|
|
957
957
|
operation: g,
|
|
958
|
-
clientId:
|
|
958
|
+
clientId: a.value,
|
|
959
959
|
timestamp: /* @__PURE__ */ new Date()
|
|
960
960
|
};
|
|
961
961
|
v.postMessage(_e(f));
|
|
@@ -965,7 +965,7 @@ const wt = /* @__PURE__ */ en("hst-operation-log", () => {
|
|
|
965
965
|
const y = {
|
|
966
966
|
type: "operation",
|
|
967
967
|
operations: [...g, f],
|
|
968
|
-
clientId:
|
|
968
|
+
clientId: a.value,
|
|
969
969
|
timestamp: /* @__PURE__ */ new Date()
|
|
970
970
|
};
|
|
971
971
|
v.postMessage(_e(y));
|
|
@@ -975,7 +975,7 @@ const wt = /* @__PURE__ */ en("hst-operation-log", () => {
|
|
|
975
975
|
const f = {
|
|
976
976
|
type: "undo",
|
|
977
977
|
operation: g,
|
|
978
|
-
clientId:
|
|
978
|
+
clientId: a.value,
|
|
979
979
|
timestamp: /* @__PURE__ */ new Date()
|
|
980
980
|
};
|
|
981
981
|
v.postMessage(_e(f));
|
|
@@ -985,12 +985,12 @@ const wt = /* @__PURE__ */ en("hst-operation-log", () => {
|
|
|
985
985
|
const f = {
|
|
986
986
|
type: "redo",
|
|
987
987
|
operation: g,
|
|
988
|
-
clientId:
|
|
988
|
+
clientId: a.value,
|
|
989
989
|
timestamp: /* @__PURE__ */ new Date()
|
|
990
990
|
};
|
|
991
991
|
v.postMessage(_e(f));
|
|
992
992
|
}
|
|
993
|
-
const
|
|
993
|
+
const D = _o("stonecrop-ops-operations", null, {
|
|
994
994
|
serializer: {
|
|
995
995
|
read: (g) => {
|
|
996
996
|
try {
|
|
@@ -1002,10 +1002,10 @@ const wt = /* @__PURE__ */ en("hst-operation-log", () => {
|
|
|
1002
1002
|
write: (g) => g ? JSON.stringify(g) : ""
|
|
1003
1003
|
}
|
|
1004
1004
|
});
|
|
1005
|
-
function
|
|
1005
|
+
function j() {
|
|
1006
1006
|
if (!(typeof window > "u"))
|
|
1007
1007
|
try {
|
|
1008
|
-
const g =
|
|
1008
|
+
const g = D.value;
|
|
1009
1009
|
g && Array.isArray(g.operations) && (e.value = g.operations.map((f) => ({
|
|
1010
1010
|
...f,
|
|
1011
1011
|
timestamp: new Date(f.timestamp)
|
|
@@ -1014,10 +1014,10 @@ const wt = /* @__PURE__ */ en("hst-operation-log", () => {
|
|
|
1014
1014
|
typeof console < "u" && console.error("Failed to load operations from persistence:", g);
|
|
1015
1015
|
}
|
|
1016
1016
|
}
|
|
1017
|
-
function
|
|
1017
|
+
function B() {
|
|
1018
1018
|
if (!(typeof window > "u"))
|
|
1019
1019
|
try {
|
|
1020
|
-
|
|
1020
|
+
D.value = {
|
|
1021
1021
|
operations: e.value.map((g) => ({
|
|
1022
1022
|
...g,
|
|
1023
1023
|
timestamp: g.timestamp.toISOString()
|
|
@@ -1032,7 +1032,7 @@ const wt = /* @__PURE__ */ en("hst-operation-log", () => {
|
|
|
1032
1032
|
H(
|
|
1033
1033
|
[e, t],
|
|
1034
1034
|
() => {
|
|
1035
|
-
|
|
1035
|
+
o.value.enablePersistence && B();
|
|
1036
1036
|
},
|
|
1037
1037
|
{ deep: !0 }
|
|
1038
1038
|
);
|
|
@@ -1041,8 +1041,8 @@ const wt = /* @__PURE__ */ en("hst-operation-log", () => {
|
|
|
1041
1041
|
// State
|
|
1042
1042
|
operations: e,
|
|
1043
1043
|
currentIndex: t,
|
|
1044
|
-
config:
|
|
1045
|
-
clientId:
|
|
1044
|
+
config: o,
|
|
1045
|
+
clientId: a,
|
|
1046
1046
|
undoRedoState: b,
|
|
1047
1047
|
// Computed
|
|
1048
1048
|
canUndo: c,
|
|
@@ -1050,12 +1050,12 @@ const wt = /* @__PURE__ */ en("hst-operation-log", () => {
|
|
|
1050
1050
|
undoCount: u,
|
|
1051
1051
|
redoCount: p,
|
|
1052
1052
|
// Methods
|
|
1053
|
-
configure:
|
|
1054
|
-
addOperation:
|
|
1053
|
+
configure: w,
|
|
1054
|
+
addOperation: N,
|
|
1055
1055
|
startBatch: O,
|
|
1056
1056
|
commitBatch: k,
|
|
1057
|
-
cancelBatch:
|
|
1058
|
-
undo:
|
|
1057
|
+
cancelBatch: V,
|
|
1058
|
+
undo: P,
|
|
1059
1059
|
redo: x,
|
|
1060
1060
|
clear: z,
|
|
1061
1061
|
getOperationsFor: _,
|
|
@@ -1116,8 +1116,8 @@ class ge {
|
|
|
1116
1116
|
* @param fieldname - The field name
|
|
1117
1117
|
* @param enableRollback - Whether to enable rollback
|
|
1118
1118
|
*/
|
|
1119
|
-
setFieldRollback(e, t,
|
|
1120
|
-
this.fieldRollbackConfig.has(e) || this.fieldRollbackConfig.set(e, /* @__PURE__ */ new Map()), this.fieldRollbackConfig.get(e).set(t,
|
|
1119
|
+
setFieldRollback(e, t, a) {
|
|
1120
|
+
this.fieldRollbackConfig.has(e) || this.fieldRollbackConfig.set(e, /* @__PURE__ */ new Map()), this.fieldRollbackConfig.get(e).set(t, a);
|
|
1121
1121
|
}
|
|
1122
1122
|
/**
|
|
1123
1123
|
* Get rollback configuration for a specific field trigger
|
|
@@ -1133,25 +1133,25 @@ class ge {
|
|
|
1133
1133
|
*/
|
|
1134
1134
|
registerDoctypeActions(e, t) {
|
|
1135
1135
|
if (!t) return;
|
|
1136
|
-
const
|
|
1136
|
+
const a = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
1137
1137
|
if (typeof t.entrySeq == "function")
|
|
1138
1138
|
t.entrySeq().forEach(([s, r]) => {
|
|
1139
|
-
this.categorizeAction(s, r,
|
|
1139
|
+
this.categorizeAction(s, r, a, n);
|
|
1140
1140
|
});
|
|
1141
1141
|
else if (t instanceof Map)
|
|
1142
1142
|
for (const [s, r] of t)
|
|
1143
|
-
this.categorizeAction(s, r,
|
|
1143
|
+
this.categorizeAction(s, r, a, n);
|
|
1144
1144
|
else t && typeof t == "object" && Object.entries(t).forEach(([s, r]) => {
|
|
1145
|
-
this.categorizeAction(s, r,
|
|
1145
|
+
this.categorizeAction(s, r, a, n);
|
|
1146
1146
|
});
|
|
1147
|
-
this.doctypeActions.set(e,
|
|
1147
|
+
this.doctypeActions.set(e, a), this.doctypeTransitions.set(e, n);
|
|
1148
1148
|
}
|
|
1149
1149
|
/**
|
|
1150
1150
|
* Categorize an action as either a field trigger or XState transition
|
|
1151
1151
|
* Uses uppercase convention: UPPERCASE = transition, lowercase/mixed = field trigger
|
|
1152
1152
|
*/
|
|
1153
|
-
categorizeAction(e, t,
|
|
1154
|
-
this.isTransitionKey(e) ?
|
|
1153
|
+
categorizeAction(e, t, a, n) {
|
|
1154
|
+
this.isTransitionKey(e) ? n.set(e, t) : a.set(e, t);
|
|
1155
1155
|
}
|
|
1156
1156
|
/**
|
|
1157
1157
|
* Determine if a key represents an XState transition
|
|
@@ -1166,7 +1166,7 @@ class ge {
|
|
|
1166
1166
|
* @param options - Execution options (timeout and enableRollback)
|
|
1167
1167
|
*/
|
|
1168
1168
|
async executeFieldTriggers(e, t = {}) {
|
|
1169
|
-
const { doctype:
|
|
1169
|
+
const { doctype: a, fieldname: n } = e, s = this.findFieldTriggers(a, n);
|
|
1170
1170
|
if (s.length === 0)
|
|
1171
1171
|
return {
|
|
1172
1172
|
path: e.path,
|
|
@@ -1178,47 +1178,47 @@ class ge {
|
|
|
1178
1178
|
};
|
|
1179
1179
|
const r = performance.now(), c = [];
|
|
1180
1180
|
let i = !1, u = !1, p;
|
|
1181
|
-
const b = this.getFieldRollback(
|
|
1182
|
-
|
|
1181
|
+
const b = this.getFieldRollback(a, n), w = t.enableRollback ?? b ?? this.options.enableRollback;
|
|
1182
|
+
w && e.store && (p = this.captureSnapshot(e));
|
|
1183
1183
|
for (const k of s)
|
|
1184
1184
|
try {
|
|
1185
|
-
const
|
|
1186
|
-
if (c.push(
|
|
1185
|
+
const V = await this.executeAction(k, e, t.timeout);
|
|
1186
|
+
if (c.push(V), !V.success) {
|
|
1187
1187
|
i = !0;
|
|
1188
1188
|
break;
|
|
1189
1189
|
}
|
|
1190
|
-
} catch (
|
|
1191
|
-
const
|
|
1190
|
+
} catch (V) {
|
|
1191
|
+
const P = {
|
|
1192
1192
|
success: !1,
|
|
1193
|
-
error:
|
|
1193
|
+
error: V instanceof Error ? V : new Error(String(V)),
|
|
1194
1194
|
executionTime: 0,
|
|
1195
1195
|
action: k
|
|
1196
1196
|
};
|
|
1197
|
-
c.push(
|
|
1197
|
+
c.push(P), i = !0;
|
|
1198
1198
|
break;
|
|
1199
1199
|
}
|
|
1200
|
-
if (
|
|
1200
|
+
if (w && i && p && e.store)
|
|
1201
1201
|
try {
|
|
1202
1202
|
this.restoreSnapshot(e, p), u = !0;
|
|
1203
1203
|
} catch (k) {
|
|
1204
1204
|
console.error("[FieldTriggers] Rollback failed:", k);
|
|
1205
1205
|
}
|
|
1206
|
-
const
|
|
1206
|
+
const N = performance.now() - r, O = c.filter((k) => !k.success);
|
|
1207
1207
|
if (O.length > 0 && this.options.errorHandler)
|
|
1208
1208
|
for (const k of O)
|
|
1209
1209
|
try {
|
|
1210
1210
|
this.options.errorHandler(k.error, e, k.action);
|
|
1211
|
-
} catch (
|
|
1212
|
-
console.error("[FieldTriggers] Error in global error handler:",
|
|
1211
|
+
} catch (V) {
|
|
1212
|
+
console.error("[FieldTriggers] Error in global error handler:", V);
|
|
1213
1213
|
}
|
|
1214
1214
|
return {
|
|
1215
1215
|
path: e.path,
|
|
1216
1216
|
actionResults: c,
|
|
1217
|
-
totalExecutionTime:
|
|
1217
|
+
totalExecutionTime: N,
|
|
1218
1218
|
allSucceeded: c.every((k) => k.success),
|
|
1219
1219
|
stoppedOnError: i,
|
|
1220
1220
|
rolledBack: u,
|
|
1221
|
-
snapshot: this.options.debug &&
|
|
1221
|
+
snapshot: this.options.debug && w ? p : void 0
|
|
1222
1222
|
// Only include snapshot in debug mode if rollback is enabled
|
|
1223
1223
|
};
|
|
1224
1224
|
}
|
|
@@ -1229,7 +1229,7 @@ class ge {
|
|
|
1229
1229
|
* @param options - Execution options (timeout)
|
|
1230
1230
|
*/
|
|
1231
1231
|
async executeTransitionActions(e, t = {}) {
|
|
1232
|
-
const { doctype:
|
|
1232
|
+
const { doctype: a, transition: n } = e, s = this.findTransitionActions(a, n);
|
|
1233
1233
|
if (s.length === 0)
|
|
1234
1234
|
return [];
|
|
1235
1235
|
const r = [];
|
|
@@ -1244,7 +1244,7 @@ class ge {
|
|
|
1244
1244
|
error: u instanceof Error ? u : new Error(String(u)),
|
|
1245
1245
|
executionTime: 0,
|
|
1246
1246
|
action: i,
|
|
1247
|
-
transition:
|
|
1247
|
+
transition: n
|
|
1248
1248
|
};
|
|
1249
1249
|
r.push(p);
|
|
1250
1250
|
break;
|
|
@@ -1263,14 +1263,14 @@ class ge {
|
|
|
1263
1263
|
* Find transition actions for a specific doctype and transition
|
|
1264
1264
|
*/
|
|
1265
1265
|
findTransitionActions(e, t) {
|
|
1266
|
-
const
|
|
1267
|
-
return
|
|
1266
|
+
const a = this.doctypeTransitions.get(e);
|
|
1267
|
+
return a ? a.get(t) || [] : [];
|
|
1268
1268
|
}
|
|
1269
1269
|
/**
|
|
1270
1270
|
* Execute a single transition action by name
|
|
1271
1271
|
*/
|
|
1272
|
-
async executeTransitionAction(e, t,
|
|
1273
|
-
const
|
|
1272
|
+
async executeTransitionAction(e, t, a) {
|
|
1273
|
+
const n = performance.now(), s = a ?? this.options.defaultTimeout;
|
|
1274
1274
|
try {
|
|
1275
1275
|
let r = this.globalTransitionActions.get(e);
|
|
1276
1276
|
if (!r) {
|
|
@@ -1281,12 +1281,12 @@ class ge {
|
|
|
1281
1281
|
throw new Error(`Transition action "${e}" not found in registry`);
|
|
1282
1282
|
return await this.executeWithTimeout(r, t, s), {
|
|
1283
1283
|
success: !0,
|
|
1284
|
-
executionTime: performance.now() -
|
|
1284
|
+
executionTime: performance.now() - n,
|
|
1285
1285
|
action: e,
|
|
1286
1286
|
transition: t.transition
|
|
1287
1287
|
};
|
|
1288
1288
|
} catch (r) {
|
|
1289
|
-
const c = performance.now() -
|
|
1289
|
+
const c = performance.now() - n;
|
|
1290
1290
|
return {
|
|
1291
1291
|
success: !1,
|
|
1292
1292
|
error: r instanceof Error ? r : new Error(String(r)),
|
|
@@ -1301,12 +1301,12 @@ class ge {
|
|
|
1301
1301
|
* Field triggers are identified by keys that look like field paths (contain dots or match field names)
|
|
1302
1302
|
*/
|
|
1303
1303
|
findFieldTriggers(e, t) {
|
|
1304
|
-
const
|
|
1305
|
-
if (!
|
|
1306
|
-
const
|
|
1307
|
-
for (const [s, r] of
|
|
1308
|
-
this.isFieldTriggerKey(s, t) &&
|
|
1309
|
-
return
|
|
1304
|
+
const a = this.doctypeActions.get(e);
|
|
1305
|
+
if (!a) return [];
|
|
1306
|
+
const n = [];
|
|
1307
|
+
for (const [s, r] of a)
|
|
1308
|
+
this.isFieldTriggerKey(s, t) && n.push(...r);
|
|
1309
|
+
return n;
|
|
1310
1310
|
}
|
|
1311
1311
|
/**
|
|
1312
1312
|
* Determine if an action key represents a field trigger
|
|
@@ -1323,11 +1323,11 @@ class ge {
|
|
|
1323
1323
|
* Supports wildcards (*) for dynamic segments
|
|
1324
1324
|
*/
|
|
1325
1325
|
matchFieldPattern(e, t) {
|
|
1326
|
-
const
|
|
1327
|
-
if (
|
|
1326
|
+
const a = e.split("."), n = t.split(".");
|
|
1327
|
+
if (a.length !== n.length)
|
|
1328
1328
|
return !1;
|
|
1329
|
-
for (let s = 0; s <
|
|
1330
|
-
const r =
|
|
1329
|
+
for (let s = 0; s < a.length; s++) {
|
|
1330
|
+
const r = a[s], c = n[s];
|
|
1331
1331
|
if (r !== "*" && r !== c)
|
|
1332
1332
|
return !1;
|
|
1333
1333
|
}
|
|
@@ -1336,19 +1336,19 @@ class ge {
|
|
|
1336
1336
|
/**
|
|
1337
1337
|
* Execute a single action by name
|
|
1338
1338
|
*/
|
|
1339
|
-
async executeAction(e, t,
|
|
1340
|
-
const
|
|
1339
|
+
async executeAction(e, t, a) {
|
|
1340
|
+
const n = performance.now(), s = a ?? this.options.defaultTimeout;
|
|
1341
1341
|
try {
|
|
1342
1342
|
const r = this.globalActions.get(e);
|
|
1343
1343
|
if (!r)
|
|
1344
1344
|
throw new Error(`Action "${e}" not found in registry`);
|
|
1345
1345
|
return await this.executeWithTimeout(r, t, s), {
|
|
1346
1346
|
success: !0,
|
|
1347
|
-
executionTime: performance.now() -
|
|
1347
|
+
executionTime: performance.now() - n,
|
|
1348
1348
|
action: e
|
|
1349
1349
|
};
|
|
1350
1350
|
} catch (r) {
|
|
1351
|
-
const c = performance.now() -
|
|
1351
|
+
const c = performance.now() - n;
|
|
1352
1352
|
return {
|
|
1353
1353
|
success: !1,
|
|
1354
1354
|
error: r instanceof Error ? r : new Error(String(r)),
|
|
@@ -1360,13 +1360,13 @@ class ge {
|
|
|
1360
1360
|
/**
|
|
1361
1361
|
* Execute a function with timeout
|
|
1362
1362
|
*/
|
|
1363
|
-
async executeWithTimeout(e, t,
|
|
1364
|
-
return new Promise((
|
|
1363
|
+
async executeWithTimeout(e, t, a) {
|
|
1364
|
+
return new Promise((n, s) => {
|
|
1365
1365
|
const r = setTimeout(() => {
|
|
1366
|
-
s(new Error(`Action timeout after ${
|
|
1367
|
-
},
|
|
1366
|
+
s(new Error(`Action timeout after ${a}ms`));
|
|
1367
|
+
}, a);
|
|
1368
1368
|
Promise.resolve(e(t)).then((c) => {
|
|
1369
|
-
clearTimeout(r),
|
|
1369
|
+
clearTimeout(r), n(c);
|
|
1370
1370
|
}).catch((c) => {
|
|
1371
1371
|
clearTimeout(r), s(c);
|
|
1372
1372
|
});
|
|
@@ -1379,8 +1379,8 @@ class ge {
|
|
|
1379
1379
|
captureSnapshot(e) {
|
|
1380
1380
|
if (!(!e.store || !e.doctype || !e.recordId))
|
|
1381
1381
|
try {
|
|
1382
|
-
const t = `${e.doctype}.${e.recordId}`,
|
|
1383
|
-
return !
|
|
1382
|
+
const t = `${e.doctype}.${e.recordId}`, a = e.store.get(t);
|
|
1383
|
+
return !a || typeof a != "object" ? void 0 : JSON.parse(JSON.stringify(a));
|
|
1384
1384
|
} catch (t) {
|
|
1385
1385
|
this.options.debug && console.warn("[FieldTriggers] Failed to capture snapshot:", t);
|
|
1386
1386
|
return;
|
|
@@ -1393,17 +1393,17 @@ class ge {
|
|
|
1393
1393
|
restoreSnapshot(e, t) {
|
|
1394
1394
|
if (!(!e.store || !e.doctype || !e.recordId || !t))
|
|
1395
1395
|
try {
|
|
1396
|
-
const
|
|
1397
|
-
e.store.set(
|
|
1398
|
-
} catch (
|
|
1399
|
-
throw console.error("[FieldTriggers] Failed to restore snapshot:",
|
|
1396
|
+
const a = `${e.doctype}.${e.recordId}`;
|
|
1397
|
+
e.store.set(a, t), this.options.debug && console.log(`[FieldTriggers] Rolled back ${a} to previous state`);
|
|
1398
|
+
} catch (a) {
|
|
1399
|
+
throw console.error("[FieldTriggers] Failed to restore snapshot:", a), a;
|
|
1400
1400
|
}
|
|
1401
1401
|
}
|
|
1402
1402
|
}
|
|
1403
|
-
function
|
|
1404
|
-
return new ge(
|
|
1403
|
+
function at(o) {
|
|
1404
|
+
return new ge(o);
|
|
1405
1405
|
}
|
|
1406
|
-
function
|
|
1406
|
+
function nt() {
|
|
1407
1407
|
try {
|
|
1408
1408
|
return wt();
|
|
1409
1409
|
} catch {
|
|
@@ -1458,8 +1458,8 @@ class Ie {
|
|
|
1458
1458
|
doctype;
|
|
1459
1459
|
parentDoctype;
|
|
1460
1460
|
hst;
|
|
1461
|
-
constructor(e, t,
|
|
1462
|
-
return this.target = e, this.parentPath =
|
|
1461
|
+
constructor(e, t, a = "", n = null, s) {
|
|
1462
|
+
return this.target = e, this.parentPath = a, this.rootNode = n || this, this.doctype = t, this.parentDoctype = s, this.hst = re.getInstance(), new Proxy(this, {
|
|
1463
1463
|
get(r, c) {
|
|
1464
1464
|
if (c in r) return r[c];
|
|
1465
1465
|
const i = String(c);
|
|
@@ -1476,20 +1476,20 @@ class Ie {
|
|
|
1476
1476
|
}
|
|
1477
1477
|
// Method to get a tree-wrapped node for navigation
|
|
1478
1478
|
getNode(e) {
|
|
1479
|
-
const t = this.resolvePath(e),
|
|
1479
|
+
const t = this.resolvePath(e), a = this.resolveValue(e), n = t.split(".");
|
|
1480
1480
|
let s = this.doctype;
|
|
1481
|
-
return this.doctype === "StonecropStore" &&
|
|
1481
|
+
return this.doctype === "StonecropStore" && n.length >= 1 && (s = n[0]), typeof a == "object" && a !== null && !this.isPrimitive(a) ? new Ie(a, s, t, this.rootNode, this.parentDoctype) : new Ie(a, s, t, this.rootNode, this.parentDoctype);
|
|
1482
1482
|
}
|
|
1483
|
-
set(e, t,
|
|
1484
|
-
const
|
|
1485
|
-
if (
|
|
1486
|
-
const r =
|
|
1483
|
+
set(e, t, a = "user") {
|
|
1484
|
+
const n = this.resolvePath(e), s = this.has(e) ? this.get(e) : void 0;
|
|
1485
|
+
if (a !== "undo" && a !== "redo") {
|
|
1486
|
+
const r = nt();
|
|
1487
1487
|
if (r && typeof r.addOperation == "function") {
|
|
1488
|
-
const c =
|
|
1488
|
+
const c = n.split("."), i = this.doctype === "StonecropStore" && c.length >= 1 ? c[0] : this.doctype, u = c.length >= 2 ? c[1] : void 0, p = c.slice(2).join(".") || c[c.length - 1], b = t === void 0 && s !== void 0 ? "delete" : "set";
|
|
1489
1489
|
r.addOperation(
|
|
1490
1490
|
{
|
|
1491
1491
|
type: b,
|
|
1492
|
-
path:
|
|
1492
|
+
path: n,
|
|
1493
1493
|
fieldname: p,
|
|
1494
1494
|
beforeValue: s,
|
|
1495
1495
|
afterValue: t,
|
|
@@ -1498,25 +1498,25 @@ class Ie {
|
|
|
1498
1498
|
reversible: !0
|
|
1499
1499
|
// Default to reversible, can be changed by field triggers
|
|
1500
1500
|
},
|
|
1501
|
-
|
|
1501
|
+
a
|
|
1502
1502
|
);
|
|
1503
1503
|
}
|
|
1504
1504
|
}
|
|
1505
|
-
this.updateValue(e, t), this.triggerFieldActions(
|
|
1505
|
+
this.updateValue(e, t), this.triggerFieldActions(n, s, t);
|
|
1506
1506
|
}
|
|
1507
1507
|
has(e) {
|
|
1508
1508
|
try {
|
|
1509
1509
|
if (e === "")
|
|
1510
1510
|
return !0;
|
|
1511
1511
|
const t = this.parsePath(e);
|
|
1512
|
-
let
|
|
1513
|
-
for (let
|
|
1514
|
-
const s = t[
|
|
1515
|
-
if (
|
|
1512
|
+
let a = this.target;
|
|
1513
|
+
for (let n = 0; n < t.length; n++) {
|
|
1514
|
+
const s = t[n];
|
|
1515
|
+
if (a == null)
|
|
1516
1516
|
return !1;
|
|
1517
|
-
if (
|
|
1518
|
-
return this.isImmutable(
|
|
1519
|
-
|
|
1517
|
+
if (n === t.length - 1)
|
|
1518
|
+
return this.isImmutable(a) ? a.has(s) : this.isPiniaStore(a) && a.$state && s in a.$state || s in a;
|
|
1519
|
+
a = this.getProperty(a, s);
|
|
1520
1520
|
}
|
|
1521
1521
|
return !1;
|
|
1522
1522
|
} catch {
|
|
@@ -1545,9 +1545,9 @@ class Ie {
|
|
|
1545
1545
|
* Trigger an XState transition with optional context data
|
|
1546
1546
|
*/
|
|
1547
1547
|
async triggerTransition(e, t) {
|
|
1548
|
-
const
|
|
1548
|
+
const a = at(), n = this.parentPath.split(".");
|
|
1549
1549
|
let s = this.doctype, r;
|
|
1550
|
-
this.doctype === "StonecropStore" &&
|
|
1550
|
+
this.doctype === "StonecropStore" && n.length >= 1 && (s = n[0]), n.length >= 2 && (r = n[1]);
|
|
1551
1551
|
const c = {
|
|
1552
1552
|
path: this.parentPath,
|
|
1553
1553
|
fieldname: "",
|
|
@@ -1563,7 +1563,7 @@ class Ie {
|
|
|
1563
1563
|
currentState: t?.currentState,
|
|
1564
1564
|
targetState: t?.targetState,
|
|
1565
1565
|
fsmContext: t?.fsmContext
|
|
1566
|
-
}, i =
|
|
1566
|
+
}, i = nt();
|
|
1567
1567
|
return i && typeof i.addOperation == "function" && i.addOperation(
|
|
1568
1568
|
{
|
|
1569
1569
|
type: "transition",
|
|
@@ -1583,7 +1583,7 @@ class Ie {
|
|
|
1583
1583
|
}
|
|
1584
1584
|
},
|
|
1585
1585
|
"user"
|
|
1586
|
-
), await
|
|
1586
|
+
), await a.executeTransitionActions(c);
|
|
1587
1587
|
}
|
|
1588
1588
|
// Private helper methods
|
|
1589
1589
|
resolvePath(e) {
|
|
@@ -1593,53 +1593,53 @@ class Ie {
|
|
|
1593
1593
|
if (e === "")
|
|
1594
1594
|
return this.target;
|
|
1595
1595
|
const t = this.parsePath(e);
|
|
1596
|
-
let
|
|
1597
|
-
for (const
|
|
1598
|
-
if (
|
|
1596
|
+
let a = this.target;
|
|
1597
|
+
for (const n of t) {
|
|
1598
|
+
if (a == null)
|
|
1599
1599
|
return;
|
|
1600
|
-
|
|
1600
|
+
a = this.getProperty(a, n);
|
|
1601
1601
|
}
|
|
1602
|
-
return
|
|
1602
|
+
return a;
|
|
1603
1603
|
}
|
|
1604
1604
|
updateValue(e, t) {
|
|
1605
1605
|
if (e === "")
|
|
1606
1606
|
throw new Error("Cannot set value on empty path");
|
|
1607
|
-
const
|
|
1607
|
+
const a = this.parsePath(e), n = a.pop();
|
|
1608
1608
|
let s = this.target;
|
|
1609
|
-
for (const r of
|
|
1609
|
+
for (const r of a)
|
|
1610
1610
|
if (s = this.getProperty(s, r), s == null)
|
|
1611
1611
|
throw new Error(`Cannot set property on null/undefined path: ${e}`);
|
|
1612
|
-
this.setProperty(s,
|
|
1612
|
+
this.setProperty(s, n, t);
|
|
1613
1613
|
}
|
|
1614
1614
|
getProperty(e, t) {
|
|
1615
1615
|
return this.isImmutable(e) ? e.get(t) : this.isVueReactive(e) ? e[t] : this.isPiniaStore(e) ? e.$state?.[t] ?? e[t] : e[t];
|
|
1616
1616
|
}
|
|
1617
|
-
setProperty(e, t,
|
|
1617
|
+
setProperty(e, t, a) {
|
|
1618
1618
|
if (this.isImmutable(e))
|
|
1619
1619
|
throw new Error("Cannot directly mutate immutable objects. Use immutable update methods instead.");
|
|
1620
1620
|
if (this.isPiniaStore(e)) {
|
|
1621
|
-
e.$patch ? e.$patch({ [t]:
|
|
1621
|
+
e.$patch ? e.$patch({ [t]: a }) : e[t] = a;
|
|
1622
1622
|
return;
|
|
1623
1623
|
}
|
|
1624
|
-
e[t] =
|
|
1624
|
+
e[t] = a;
|
|
1625
1625
|
}
|
|
1626
|
-
async triggerFieldActions(e, t,
|
|
1626
|
+
async triggerFieldActions(e, t, a) {
|
|
1627
1627
|
try {
|
|
1628
1628
|
if (!e || typeof e != "string")
|
|
1629
1629
|
return;
|
|
1630
|
-
const
|
|
1631
|
-
if (
|
|
1630
|
+
const n = e.split(".");
|
|
1631
|
+
if (n.length < 3)
|
|
1632
1632
|
return;
|
|
1633
|
-
const s =
|
|
1633
|
+
const s = at(), r = n.slice(2).join(".") || n[n.length - 1];
|
|
1634
1634
|
let c = this.doctype;
|
|
1635
|
-
this.doctype === "StonecropStore" &&
|
|
1635
|
+
this.doctype === "StonecropStore" && n.length >= 1 && (c = n[0]);
|
|
1636
1636
|
let i;
|
|
1637
|
-
|
|
1637
|
+
n.length >= 2 && (i = n[1]);
|
|
1638
1638
|
const u = {
|
|
1639
1639
|
path: e,
|
|
1640
1640
|
fieldname: r,
|
|
1641
1641
|
beforeValue: t,
|
|
1642
|
-
afterValue:
|
|
1642
|
+
afterValue: a,
|
|
1643
1643
|
operation: "set",
|
|
1644
1644
|
doctype: c,
|
|
1645
1645
|
recordId: i,
|
|
@@ -1648,8 +1648,8 @@ class Ie {
|
|
|
1648
1648
|
// Pass the root store for snapshot/rollback capabilities
|
|
1649
1649
|
};
|
|
1650
1650
|
await s.executeFieldTriggers(u);
|
|
1651
|
-
} catch (
|
|
1652
|
-
|
|
1651
|
+
} catch (n) {
|
|
1652
|
+
n instanceof Error && console.warn("Field trigger error:", n.message);
|
|
1653
1653
|
}
|
|
1654
1654
|
}
|
|
1655
1655
|
isVueReactive(e) {
|
|
@@ -1661,7 +1661,7 @@ class Ie {
|
|
|
1661
1661
|
isImmutable(e) {
|
|
1662
1662
|
if (!e || typeof e != "object")
|
|
1663
1663
|
return !1;
|
|
1664
|
-
const t = "get" in e && typeof e.get == "function",
|
|
1664
|
+
const t = "get" in e && typeof e.get == "function", a = "set" in e && typeof e.set == "function", n = "has" in e && typeof e.has == "function", s = "__ownerID" in e || "_map" in e || "_list" in e || "_origin" in e || "_capacity" in e || "_defaultValues" in e || "_tail" in e || "_root" in e || "size" in e && t && a;
|
|
1665
1665
|
let r;
|
|
1666
1666
|
try {
|
|
1667
1667
|
const i = e;
|
|
@@ -1672,8 +1672,8 @@ class Ie {
|
|
|
1672
1672
|
} catch {
|
|
1673
1673
|
r = void 0;
|
|
1674
1674
|
}
|
|
1675
|
-
const c = r && (r.includes("Map") || r.includes("List") || r.includes("Set") || r.includes("Stack") || r.includes("Seq")) && (t ||
|
|
1676
|
-
return !!(t &&
|
|
1675
|
+
const c = r && (r.includes("Map") || r.includes("List") || r.includes("Set") || r.includes("Stack") || r.includes("Seq")) && (t || a);
|
|
1676
|
+
return !!(t && a && n && s || t && a && c);
|
|
1677
1677
|
}
|
|
1678
1678
|
isPrimitive(e) {
|
|
1679
1679
|
return e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "function" || typeof e == "symbol" || typeof e == "bigint";
|
|
@@ -1682,10 +1682,10 @@ class Ie {
|
|
|
1682
1682
|
return e ? e.split(".").filter((t) => t.length > 0) : [];
|
|
1683
1683
|
}
|
|
1684
1684
|
}
|
|
1685
|
-
function
|
|
1686
|
-
return new Ie(
|
|
1685
|
+
function Oo(o, e, t) {
|
|
1686
|
+
return new Ie(o, e, "", null, t);
|
|
1687
1687
|
}
|
|
1688
|
-
class
|
|
1688
|
+
class ko {
|
|
1689
1689
|
hstStore;
|
|
1690
1690
|
_operationLogStore;
|
|
1691
1691
|
_operationLogConfig;
|
|
@@ -1713,7 +1713,7 @@ class kn {
|
|
|
1713
1713
|
const e = {};
|
|
1714
1714
|
Object.keys(this.registry.registry).forEach((t) => {
|
|
1715
1715
|
e[t] = {};
|
|
1716
|
-
}), this.hstStore =
|
|
1716
|
+
}), this.hstStore = Oo(e, "StonecropStore");
|
|
1717
1717
|
}
|
|
1718
1718
|
/**
|
|
1719
1719
|
* Setup automatic sync with Registry when doctypes are added
|
|
@@ -1739,9 +1739,9 @@ class kn {
|
|
|
1739
1739
|
* @param recordId - The record ID
|
|
1740
1740
|
* @param recordData - The record data
|
|
1741
1741
|
*/
|
|
1742
|
-
addRecord(e, t,
|
|
1743
|
-
const
|
|
1744
|
-
this.ensureDoctypeExists(
|
|
1742
|
+
addRecord(e, t, a) {
|
|
1743
|
+
const n = typeof e == "string" ? e : e.slug;
|
|
1744
|
+
this.ensureDoctypeExists(n), this.hstStore.set(`${n}.${t}`, a);
|
|
1745
1745
|
}
|
|
1746
1746
|
/**
|
|
1747
1747
|
* Get a specific record
|
|
@@ -1750,9 +1750,9 @@ class kn {
|
|
|
1750
1750
|
* @returns HST node for the record or undefined
|
|
1751
1751
|
*/
|
|
1752
1752
|
getRecordById(e, t) {
|
|
1753
|
-
const
|
|
1754
|
-
if (this.ensureDoctypeExists(
|
|
1755
|
-
return this.hstStore.getNode(`${
|
|
1753
|
+
const a = typeof e == "string" ? e : e.slug;
|
|
1754
|
+
if (this.ensureDoctypeExists(a), !(!this.hstStore.has(`${a}.${t}`) || this.hstStore.get(`${a}.${t}`) === void 0))
|
|
1755
|
+
return this.hstStore.getNode(`${a}.${t}`);
|
|
1756
1756
|
}
|
|
1757
1757
|
/**
|
|
1758
1758
|
* Remove a record from the store
|
|
@@ -1760,8 +1760,8 @@ class kn {
|
|
|
1760
1760
|
* @param recordId - The record ID
|
|
1761
1761
|
*/
|
|
1762
1762
|
removeRecord(e, t) {
|
|
1763
|
-
const
|
|
1764
|
-
this.ensureDoctypeExists(
|
|
1763
|
+
const a = typeof e == "string" ? e : e.slug;
|
|
1764
|
+
this.ensureDoctypeExists(a), this.hstStore.has(`${a}.${t}`) && this.hstStore.set(`${a}.${t}`, void 0);
|
|
1765
1765
|
}
|
|
1766
1766
|
/**
|
|
1767
1767
|
* Get all record IDs for a doctype
|
|
@@ -1771,8 +1771,8 @@ class kn {
|
|
|
1771
1771
|
getRecordIds(e) {
|
|
1772
1772
|
const t = typeof e == "string" ? e : e.slug;
|
|
1773
1773
|
this.ensureDoctypeExists(t);
|
|
1774
|
-
const
|
|
1775
|
-
return !
|
|
1774
|
+
const a = this.hstStore.get(t);
|
|
1775
|
+
return !a || typeof a != "object" ? [] : Object.keys(a).filter((n) => a[n] !== void 0);
|
|
1776
1776
|
}
|
|
1777
1777
|
/**
|
|
1778
1778
|
* Clear all records for a doctype
|
|
@@ -1780,8 +1780,8 @@ class kn {
|
|
|
1780
1780
|
*/
|
|
1781
1781
|
clearRecords(e) {
|
|
1782
1782
|
const t = typeof e == "string" ? e : e.slug;
|
|
1783
|
-
this.ensureDoctypeExists(t), this.getRecordIds(t).forEach((
|
|
1784
|
-
this.hstStore.set(`${t}.${
|
|
1783
|
+
this.ensureDoctypeExists(t), this.getRecordIds(t).forEach((a) => {
|
|
1784
|
+
this.hstStore.set(`${t}.${a}`, void 0);
|
|
1785
1785
|
});
|
|
1786
1786
|
}
|
|
1787
1787
|
/**
|
|
@@ -1798,13 +1798,13 @@ class kn {
|
|
|
1798
1798
|
* @param action - The action to run
|
|
1799
1799
|
* @param args - Action arguments (typically record IDs)
|
|
1800
1800
|
*/
|
|
1801
|
-
runAction(e, t,
|
|
1802
|
-
const
|
|
1801
|
+
runAction(e, t, a) {
|
|
1802
|
+
const n = this.registry.registry[e.slug]?.actions?.get(t), s = Array.isArray(a) ? a.filter((u) => typeof u == "string") : void 0, r = this.getOperationLogStore();
|
|
1803
1803
|
let c = "success", i;
|
|
1804
1804
|
try {
|
|
1805
|
-
|
|
1805
|
+
n && n.length > 0 && n.forEach((u) => {
|
|
1806
1806
|
try {
|
|
1807
|
-
new Function("args", u)(
|
|
1807
|
+
new Function("args", u)(a);
|
|
1808
1808
|
} catch (p) {
|
|
1809
1809
|
throw c = "failure", i = p instanceof Error ? p.message : "Unknown error", p;
|
|
1810
1810
|
}
|
|
@@ -1829,8 +1829,8 @@ class kn {
|
|
|
1829
1829
|
* @param recordId - The record ID
|
|
1830
1830
|
*/
|
|
1831
1831
|
async getRecord(e, t) {
|
|
1832
|
-
const
|
|
1833
|
-
this.addRecord(e, t,
|
|
1832
|
+
const a = await (await fetch(`/${e.slug}/${t}`)).json();
|
|
1833
|
+
this.addRecord(e, t, a);
|
|
1834
1834
|
}
|
|
1835
1835
|
/**
|
|
1836
1836
|
* Ensure doctype section exists in HST store
|
|
@@ -1857,38 +1857,38 @@ class kn {
|
|
|
1857
1857
|
return this.hstStore;
|
|
1858
1858
|
}
|
|
1859
1859
|
}
|
|
1860
|
-
function
|
|
1861
|
-
|
|
1862
|
-
const e =
|
|
1863
|
-
() =>
|
|
1860
|
+
function No(o) {
|
|
1861
|
+
o || (o = {});
|
|
1862
|
+
const e = o.registry || He("$registry"), t = He("$stonecrop"), a = R(), n = R(), s = R({}), r = R(), c = R(), i = R([]), u = R(-1), p = A(() => a.value?.getOperationLogStore().canUndo ?? !1), b = A(() => a.value?.getOperationLogStore().canRedo ?? !1), w = A(() => a.value?.getOperationLogStore().undoCount ?? 0), N = A(() => a.value?.getOperationLogStore().redoCount ?? 0), O = A(
|
|
1863
|
+
() => a.value?.getOperationLogStore().undoRedoState ?? {
|
|
1864
1864
|
canUndo: !1,
|
|
1865
1865
|
canRedo: !1,
|
|
1866
1866
|
undoCount: 0,
|
|
1867
1867
|
redoCount: 0,
|
|
1868
1868
|
currentIndex: -1
|
|
1869
1869
|
}
|
|
1870
|
-
), k = (E) =>
|
|
1871
|
-
|
|
1872
|
-
}, x = (E) =>
|
|
1873
|
-
|
|
1870
|
+
), k = (E) => a.value?.getOperationLogStore().undo(E) ?? !1, V = (E) => a.value?.getOperationLogStore().redo(E) ?? !1, P = () => {
|
|
1871
|
+
a.value?.getOperationLogStore().startBatch();
|
|
1872
|
+
}, x = (E) => a.value?.getOperationLogStore().commitBatch(E) ?? null, W = () => {
|
|
1873
|
+
a.value?.getOperationLogStore().cancelBatch();
|
|
1874
1874
|
}, J = () => {
|
|
1875
|
-
|
|
1876
|
-
}, K = (E, h) =>
|
|
1875
|
+
a.value?.getOperationLogStore().clear();
|
|
1876
|
+
}, K = (E, h) => a.value?.getOperationLogStore().getOperationsFor(E, h) ?? [], z = () => a.value?.getOperationLogStore().getSnapshot() ?? {
|
|
1877
1877
|
operations: [],
|
|
1878
1878
|
currentIndex: -1,
|
|
1879
1879
|
totalOperations: 0,
|
|
1880
1880
|
reversibleOperations: 0,
|
|
1881
1881
|
irreversibleOperations: 0
|
|
1882
1882
|
}, _ = (E, h) => {
|
|
1883
|
-
|
|
1884
|
-
}, U = (E, h, $,
|
|
1885
|
-
|
|
1883
|
+
a.value?.getOperationLogStore().markIrreversible(E, h);
|
|
1884
|
+
}, U = (E, h, $, D = "success", j) => a.value?.getOperationLogStore().logAction(E, h, $, D, j) ?? "", m = (E) => {
|
|
1885
|
+
a.value?.getOperationLogStore().configure(E);
|
|
1886
1886
|
};
|
|
1887
1887
|
Te(async () => {
|
|
1888
1888
|
if (e) {
|
|
1889
|
-
|
|
1889
|
+
a.value = t || new ko(e);
|
|
1890
1890
|
try {
|
|
1891
|
-
const E =
|
|
1891
|
+
const E = a.value.getOperationLogStore(), h = to(E);
|
|
1892
1892
|
i.value = h.operations.value, u.value = h.currentIndex.value, H(
|
|
1893
1893
|
() => h.operations.value,
|
|
1894
1894
|
($) => {
|
|
@@ -1902,95 +1902,95 @@ function Dn(n) {
|
|
|
1902
1902
|
);
|
|
1903
1903
|
} catch {
|
|
1904
1904
|
}
|
|
1905
|
-
if (!
|
|
1905
|
+
if (!o.doctype && e.router) {
|
|
1906
1906
|
const E = e.router.currentRoute.value;
|
|
1907
1907
|
if (!E.path) return;
|
|
1908
|
-
const h = E.path.split("/").filter((
|
|
1908
|
+
const h = E.path.split("/").filter((D) => D.length > 0), $ = h[1]?.toLowerCase();
|
|
1909
1909
|
if (h.length > 0) {
|
|
1910
|
-
const
|
|
1910
|
+
const D = {
|
|
1911
1911
|
path: E.path,
|
|
1912
1912
|
segments: h
|
|
1913
|
-
},
|
|
1914
|
-
if (
|
|
1915
|
-
if (e.addDoctype(
|
|
1916
|
-
const
|
|
1917
|
-
if (
|
|
1918
|
-
s.value =
|
|
1913
|
+
}, j = await e.getMeta?.(D);
|
|
1914
|
+
if (j) {
|
|
1915
|
+
if (e.addDoctype(j), a.value.setup(j), r.value = j, c.value = $, n.value = a.value.getStore(), $ && $ !== "new") {
|
|
1916
|
+
const B = a.value.getRecordById(j, $);
|
|
1917
|
+
if (B)
|
|
1918
|
+
s.value = B.get("") || {};
|
|
1919
1919
|
else
|
|
1920
1920
|
try {
|
|
1921
|
-
await
|
|
1922
|
-
const G =
|
|
1921
|
+
await a.value.getRecord(j, $);
|
|
1922
|
+
const G = a.value.getRecordById(j, $);
|
|
1923
1923
|
G && (s.value = G.get("") || {});
|
|
1924
1924
|
} catch {
|
|
1925
|
-
s.value = Ee(
|
|
1925
|
+
s.value = Ee(j);
|
|
1926
1926
|
}
|
|
1927
1927
|
} else
|
|
1928
|
-
s.value = Ee(
|
|
1929
|
-
|
|
1928
|
+
s.value = Ee(j);
|
|
1929
|
+
n.value && rt(j, $ || "new", s, n.value), a.value.runAction(j, "load", $ ? [$] : void 0);
|
|
1930
1930
|
}
|
|
1931
1931
|
}
|
|
1932
1932
|
}
|
|
1933
|
-
if (
|
|
1934
|
-
|
|
1935
|
-
const E =
|
|
1933
|
+
if (o.doctype) {
|
|
1934
|
+
n.value = a.value.getStore();
|
|
1935
|
+
const E = o.doctype, h = o.recordId;
|
|
1936
1936
|
if (h && h !== "new") {
|
|
1937
|
-
const $ =
|
|
1937
|
+
const $ = a.value.getRecordById(E, h);
|
|
1938
1938
|
if ($)
|
|
1939
1939
|
s.value = $.get("") || {};
|
|
1940
1940
|
else
|
|
1941
1941
|
try {
|
|
1942
|
-
await
|
|
1943
|
-
const
|
|
1944
|
-
|
|
1942
|
+
await a.value.getRecord(E, h);
|
|
1943
|
+
const D = a.value.getRecordById(E, h);
|
|
1944
|
+
D && (s.value = D.get("") || {});
|
|
1945
1945
|
} catch {
|
|
1946
1946
|
s.value = Ee(E);
|
|
1947
1947
|
}
|
|
1948
1948
|
} else
|
|
1949
1949
|
s.value = Ee(E);
|
|
1950
|
-
|
|
1950
|
+
n.value && rt(E, h || "new", s, n.value);
|
|
1951
1951
|
}
|
|
1952
1952
|
}
|
|
1953
1953
|
});
|
|
1954
1954
|
const v = (E, h) => {
|
|
1955
|
-
const $ =
|
|
1955
|
+
const $ = o.doctype || r.value;
|
|
1956
1956
|
if (!$) return "";
|
|
1957
|
-
const
|
|
1958
|
-
return `${$.slug}.${
|
|
1957
|
+
const D = h || o.recordId || c.value || "new";
|
|
1958
|
+
return `${$.slug}.${D}.${E}`;
|
|
1959
1959
|
}, C = (E) => {
|
|
1960
|
-
const h =
|
|
1961
|
-
if (!(!
|
|
1960
|
+
const h = o.doctype || r.value;
|
|
1961
|
+
if (!(!n.value || !a.value || !h))
|
|
1962
1962
|
try {
|
|
1963
1963
|
const $ = E.path.split(".");
|
|
1964
1964
|
if ($.length >= 2) {
|
|
1965
|
-
const
|
|
1966
|
-
if (
|
|
1967
|
-
const g = `${
|
|
1965
|
+
const B = $[0], G = $[1];
|
|
1966
|
+
if (n.value.has(`${B}.${G}`) || a.value.addRecord(h, G, { ...s.value }), $.length > 3) {
|
|
1967
|
+
const g = `${B}.${G}`, f = $.slice(2);
|
|
1968
1968
|
let y = g;
|
|
1969
1969
|
for (let l = 0; l < f.length - 1; l++)
|
|
1970
|
-
if (y += `.${f[l]}`, !
|
|
1971
|
-
const d = f[l + 1],
|
|
1972
|
-
|
|
1970
|
+
if (y += `.${f[l]}`, !n.value.has(y)) {
|
|
1971
|
+
const d = f[l + 1], S = !isNaN(Number(d));
|
|
1972
|
+
n.value.set(y, S ? [] : {});
|
|
1973
1973
|
}
|
|
1974
1974
|
}
|
|
1975
1975
|
}
|
|
1976
|
-
|
|
1977
|
-
const
|
|
1978
|
-
|
|
1976
|
+
n.value.set(E.path, E.value);
|
|
1977
|
+
const D = E.fieldname.split("."), j = { ...s.value };
|
|
1978
|
+
D.length === 1 ? j[D[0]] = E.value : Do(j, D, E.value), s.value = j;
|
|
1979
1979
|
} catch {
|
|
1980
1980
|
}
|
|
1981
1981
|
};
|
|
1982
|
-
(
|
|
1982
|
+
(o.doctype || e?.router) && (Ue("hstPathProvider", v), Ue("hstChangeHandler", C));
|
|
1983
1983
|
const F = {
|
|
1984
1984
|
operations: i,
|
|
1985
1985
|
currentIndex: u,
|
|
1986
1986
|
undoRedoState: O,
|
|
1987
1987
|
canUndo: p,
|
|
1988
1988
|
canRedo: b,
|
|
1989
|
-
undoCount:
|
|
1990
|
-
redoCount:
|
|
1989
|
+
undoCount: w,
|
|
1990
|
+
redoCount: N,
|
|
1991
1991
|
undo: k,
|
|
1992
|
-
redo:
|
|
1993
|
-
startBatch:
|
|
1992
|
+
redo: V,
|
|
1993
|
+
startBatch: P,
|
|
1994
1994
|
commitBatch: x,
|
|
1995
1995
|
cancelBatch: W,
|
|
1996
1996
|
clear: J,
|
|
@@ -2000,28 +2000,28 @@ function Dn(n) {
|
|
|
2000
2000
|
logAction: U,
|
|
2001
2001
|
configure: m
|
|
2002
2002
|
};
|
|
2003
|
-
return
|
|
2004
|
-
stonecrop:
|
|
2003
|
+
return o.doctype ? {
|
|
2004
|
+
stonecrop: a,
|
|
2005
2005
|
operationLog: F,
|
|
2006
2006
|
provideHSTPath: v,
|
|
2007
2007
|
handleHSTChange: C,
|
|
2008
|
-
hstStore:
|
|
2008
|
+
hstStore: n,
|
|
2009
2009
|
formData: s
|
|
2010
|
-
} : !
|
|
2011
|
-
stonecrop:
|
|
2010
|
+
} : !o.doctype && e?.router ? {
|
|
2011
|
+
stonecrop: a,
|
|
2012
2012
|
operationLog: F,
|
|
2013
2013
|
provideHSTPath: v,
|
|
2014
2014
|
handleHSTChange: C,
|
|
2015
|
-
hstStore:
|
|
2015
|
+
hstStore: n,
|
|
2016
2016
|
formData: s
|
|
2017
2017
|
} : {
|
|
2018
|
-
stonecrop:
|
|
2018
|
+
stonecrop: a,
|
|
2019
2019
|
operationLog: F
|
|
2020
2020
|
};
|
|
2021
2021
|
}
|
|
2022
|
-
function Ee(
|
|
2022
|
+
function Ee(o) {
|
|
2023
2023
|
const e = {};
|
|
2024
|
-
return
|
|
2024
|
+
return o.schema && o.schema.forEach((t) => {
|
|
2025
2025
|
switch ("fieldtype" in t ? t.fieldtype : "Data") {
|
|
2026
2026
|
case "Data":
|
|
2027
2027
|
case "Text":
|
|
@@ -2045,15 +2045,15 @@ function Ee(n) {
|
|
|
2045
2045
|
}
|
|
2046
2046
|
}), e;
|
|
2047
2047
|
}
|
|
2048
|
-
function rt(
|
|
2048
|
+
function rt(o, e, t, a) {
|
|
2049
2049
|
H(
|
|
2050
2050
|
t,
|
|
2051
|
-
(
|
|
2052
|
-
const s = `${
|
|
2053
|
-
Object.keys(
|
|
2051
|
+
(n) => {
|
|
2052
|
+
const s = `${o.slug}.${e}`;
|
|
2053
|
+
Object.keys(n).forEach((r) => {
|
|
2054
2054
|
const c = `${s}.${r}`;
|
|
2055
2055
|
try {
|
|
2056
|
-
|
|
2056
|
+
a.set(c, n[r]);
|
|
2057
2057
|
} catch {
|
|
2058
2058
|
}
|
|
2059
2059
|
});
|
|
@@ -2061,132 +2061,132 @@ function rt(n, e, t, o) {
|
|
|
2061
2061
|
{ deep: !0 }
|
|
2062
2062
|
);
|
|
2063
2063
|
}
|
|
2064
|
-
function
|
|
2065
|
-
let
|
|
2064
|
+
function Do(o, e, t) {
|
|
2065
|
+
let a = o;
|
|
2066
2066
|
for (let s = 0; s < e.length - 1; s++) {
|
|
2067
2067
|
const r = e[s];
|
|
2068
|
-
(!(r in
|
|
2068
|
+
(!(r in a) || typeof a[r] != "object") && (a[r] = isNaN(Number(e[s + 1])) ? {} : []), a = a[r];
|
|
2069
2069
|
}
|
|
2070
|
-
const
|
|
2071
|
-
|
|
2070
|
+
const n = e[e.length - 1];
|
|
2071
|
+
a[n] = t;
|
|
2072
2072
|
}
|
|
2073
|
-
const
|
|
2074
|
-
const t =
|
|
2075
|
-
for (const [
|
|
2076
|
-
t[
|
|
2073
|
+
const Ro = (o, e) => {
|
|
2074
|
+
const t = o.__vccOpts || o;
|
|
2075
|
+
for (const [a, n] of e)
|
|
2076
|
+
t[a] = n;
|
|
2077
2077
|
return t;
|
|
2078
2078
|
};
|
|
2079
|
-
function
|
|
2080
|
-
return dt() ? (pt(
|
|
2079
|
+
function Co(o, e) {
|
|
2080
|
+
return dt() ? (pt(o, e), !0) : !1;
|
|
2081
2081
|
}
|
|
2082
2082
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
2083
|
-
const
|
|
2083
|
+
const Io = () => {
|
|
2084
2084
|
};
|
|
2085
|
-
function
|
|
2086
|
-
if (
|
|
2087
|
-
const e =
|
|
2085
|
+
function To(...o) {
|
|
2086
|
+
if (o.length !== 1) return ie(...o);
|
|
2087
|
+
const e = o[0];
|
|
2088
2088
|
return typeof e == "function" ? Ge(vt(() => ({
|
|
2089
2089
|
get: e,
|
|
2090
|
-
set:
|
|
2090
|
+
set: Io
|
|
2091
2091
|
}))) : R(e);
|
|
2092
2092
|
}
|
|
2093
|
-
function Fe(
|
|
2094
|
-
return typeof Window < "u" &&
|
|
2093
|
+
function Fe(o) {
|
|
2094
|
+
return typeof Window < "u" && o instanceof Window ? o.document.documentElement : typeof Document < "u" && o instanceof Document ? o.documentElement : o;
|
|
2095
2095
|
}
|
|
2096
|
-
const
|
|
2097
|
-
function
|
|
2096
|
+
const Me = /* @__PURE__ */ new WeakMap();
|
|
2097
|
+
function Ao(o, e = !1) {
|
|
2098
2098
|
const t = Je(e);
|
|
2099
|
-
let
|
|
2100
|
-
H(
|
|
2099
|
+
let a = "";
|
|
2100
|
+
H(To(o), (r) => {
|
|
2101
2101
|
const c = Fe(ee(r));
|
|
2102
2102
|
if (c) {
|
|
2103
2103
|
const i = c;
|
|
2104
|
-
if (
|
|
2104
|
+
if (Me.get(i) || Me.set(i, i.style.overflow), i.style.overflow !== "hidden" && (a = i.style.overflow), i.style.overflow === "hidden") return t.value = !0;
|
|
2105
2105
|
if (t.value) return i.style.overflow = "hidden";
|
|
2106
2106
|
}
|
|
2107
2107
|
}, { immediate: !0 });
|
|
2108
|
-
const
|
|
2109
|
-
const r = Fe(ee(
|
|
2108
|
+
const n = () => {
|
|
2109
|
+
const r = Fe(ee(o));
|
|
2110
2110
|
!r || t.value || (r.style.overflow = "hidden", t.value = !0);
|
|
2111
2111
|
}, s = () => {
|
|
2112
|
-
const r = Fe(ee(
|
|
2113
|
-
!r || !t.value || (r.style.overflow =
|
|
2112
|
+
const r = Fe(ee(o));
|
|
2113
|
+
!r || !t.value || (r.style.overflow = a, Me.delete(r), t.value = !1);
|
|
2114
2114
|
};
|
|
2115
|
-
return
|
|
2115
|
+
return Co(s), A({
|
|
2116
2116
|
get() {
|
|
2117
2117
|
return t.value;
|
|
2118
2118
|
},
|
|
2119
2119
|
set(r) {
|
|
2120
|
-
r ?
|
|
2120
|
+
r ? n() : s();
|
|
2121
2121
|
}
|
|
2122
2122
|
});
|
|
2123
2123
|
}
|
|
2124
|
-
function
|
|
2125
|
-
let
|
|
2124
|
+
function xo() {
|
|
2125
|
+
let o = !1;
|
|
2126
2126
|
const e = Je(!1);
|
|
2127
|
-
return (t,
|
|
2128
|
-
if (e.value =
|
|
2129
|
-
|
|
2130
|
-
const
|
|
2131
|
-
H(e, (s) =>
|
|
2127
|
+
return (t, a) => {
|
|
2128
|
+
if (e.value = a.value, o) return;
|
|
2129
|
+
o = !0;
|
|
2130
|
+
const n = Ao(t, a.value);
|
|
2131
|
+
H(e, (s) => n.value = s);
|
|
2132
2132
|
};
|
|
2133
2133
|
}
|
|
2134
|
-
|
|
2134
|
+
xo();
|
|
2135
2135
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
2136
|
-
const
|
|
2136
|
+
const Vo = { class: "aform" }, Po = /* @__PURE__ */ we({
|
|
2137
2137
|
__name: "AForm",
|
|
2138
2138
|
props: {
|
|
2139
2139
|
modelValue: {},
|
|
2140
2140
|
data: {},
|
|
2141
|
-
|
|
2141
|
+
readOnly: { type: Boolean }
|
|
2142
2142
|
},
|
|
2143
2143
|
emits: ["update:modelValue"],
|
|
2144
|
-
setup(
|
|
2145
|
-
const t = e,
|
|
2144
|
+
setup(o, { emit: e }) {
|
|
2145
|
+
const t = e, a = R(o.data || {});
|
|
2146
2146
|
Rt(() => {
|
|
2147
|
-
|
|
2148
|
-
r.fieldname &&
|
|
2147
|
+
o.data && (a.value = o.data, o.modelValue.forEach((r) => {
|
|
2148
|
+
r.fieldname && o.data[r.fieldname] !== void 0 && (r.value = o.data[r.fieldname]);
|
|
2149
2149
|
}));
|
|
2150
2150
|
});
|
|
2151
|
-
const
|
|
2151
|
+
const n = (r) => {
|
|
2152
2152
|
let c = {};
|
|
2153
2153
|
for (const [i, u] of Object.entries(r))
|
|
2154
|
-
["component", "fieldtype"].includes(i) || (c[i] = u), i === "rows" && u && u.length === 0 && (c.rows =
|
|
2154
|
+
["component", "fieldtype"].includes(i) || (c[i] = u), i === "rows" && u && u.length === 0 && (c.rows = a.value[r.fieldname]);
|
|
2155
2155
|
return c;
|
|
2156
|
-
}, s =
|
|
2157
|
-
get: () =>
|
|
2156
|
+
}, s = A({
|
|
2157
|
+
get: () => o.modelValue.map((r, c) => A({
|
|
2158
2158
|
get() {
|
|
2159
2159
|
return r.value;
|
|
2160
2160
|
},
|
|
2161
2161
|
set: (i) => {
|
|
2162
|
-
|
|
2162
|
+
o.modelValue[c].value = i, t("update:modelValue", o.modelValue);
|
|
2163
2163
|
}
|
|
2164
2164
|
})),
|
|
2165
2165
|
set: () => {
|
|
2166
2166
|
}
|
|
2167
2167
|
});
|
|
2168
|
-
return (r, c) => (
|
|
2169
|
-
(
|
|
2168
|
+
return (r, c) => (L(), M("form", Vo, [
|
|
2169
|
+
(L(!0), M(me, null, ye(o.modelValue, (i, u) => (L(), Ke(Ct(i.component), It({
|
|
2170
2170
|
key: u,
|
|
2171
2171
|
modelValue: s.value[u].value,
|
|
2172
2172
|
"onUpdate:modelValue": (p) => s.value[u].value = p,
|
|
2173
2173
|
schema: i,
|
|
2174
|
-
data:
|
|
2175
|
-
|
|
2176
|
-
}, { ref_for: !0 },
|
|
2174
|
+
data: a.value[i.fieldname],
|
|
2175
|
+
readOnly: o.readOnly
|
|
2176
|
+
}, { ref_for: !0 }, n(i)), null, 16, ["modelValue", "onUpdate:modelValue", "schema", "data", "readOnly"]))), 128))
|
|
2177
2177
|
]));
|
|
2178
2178
|
}
|
|
2179
|
-
}),
|
|
2179
|
+
}), jo = /* @__PURE__ */ Ro(Po, [["__scopeId", "data-v-5336a410"]]), Lo = { class: "tabs" }, Fo = { tabindex: "0" }, Mo = { tabindex: "0" }, Bo = /* @__PURE__ */ we({
|
|
2180
2180
|
__name: "SheetNav",
|
|
2181
2181
|
props: {
|
|
2182
2182
|
breadcrumbs: { default: () => [] }
|
|
2183
2183
|
},
|
|
2184
|
-
setup(
|
|
2185
|
-
const e = R(!0), t = R(!1),
|
|
2184
|
+
setup(o) {
|
|
2185
|
+
const e = R(!0), t = R(!1), a = R(""), n = st("searchinput"), s = A(() => e.value ? "unrotated" : "rotated"), r = () => {
|
|
2186
2186
|
e.value = !e.value;
|
|
2187
2187
|
}, c = async () => {
|
|
2188
|
-
t.value = !t.value, await
|
|
2189
|
-
|
|
2188
|
+
t.value = !t.value, await oe(() => {
|
|
2189
|
+
n.value?.focus();
|
|
2190
2190
|
});
|
|
2191
2191
|
}, i = (b) => {
|
|
2192
2192
|
b.preventDefault(), b.stopPropagation();
|
|
@@ -2194,83 +2194,101 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2194
2194
|
b.preventDefault(), b.stopPropagation(), await c();
|
|
2195
2195
|
}, p = () => {
|
|
2196
2196
|
};
|
|
2197
|
-
return (b,
|
|
2198
|
-
const
|
|
2199
|
-
return
|
|
2200
|
-
|
|
2201
|
-
|
|
2197
|
+
return (b, w) => {
|
|
2198
|
+
const N = Tt("router-link");
|
|
2199
|
+
return L(), M("footer", null, [
|
|
2200
|
+
T("ul", Lo, [
|
|
2201
|
+
T("li", {
|
|
2202
2202
|
class: "hidebreadcrumbs",
|
|
2203
2203
|
onClick: r,
|
|
2204
2204
|
onKeydown: ue(r, ["enter"])
|
|
2205
2205
|
}, [
|
|
2206
|
-
|
|
2207
|
-
|
|
2206
|
+
T("a", Fo, [
|
|
2207
|
+
T("div", {
|
|
2208
2208
|
class: ke(s.value)
|
|
2209
2209
|
}, "×", 2)
|
|
2210
2210
|
])
|
|
2211
2211
|
], 32),
|
|
2212
|
-
|
|
2212
|
+
T("li", {
|
|
2213
2213
|
class: "hometab",
|
|
2214
2214
|
style: Ve({ display: e.value ? "block" : "none" }),
|
|
2215
2215
|
onClick: p,
|
|
2216
2216
|
onKeydown: ue(p, ["enter"])
|
|
2217
2217
|
}, [
|
|
2218
|
-
se(
|
|
2218
|
+
se(N, {
|
|
2219
2219
|
to: "/",
|
|
2220
2220
|
tabindex: "0"
|
|
2221
2221
|
}, {
|
|
2222
|
-
default: be(() => [...
|
|
2223
|
-
|
|
2224
|
-
class: "icon
|
|
2225
|
-
"aria-label": "Home"
|
|
2226
|
-
|
|
2222
|
+
default: be(() => [...w[5] || (w[5] = [
|
|
2223
|
+
T("svg", {
|
|
2224
|
+
class: "icon",
|
|
2225
|
+
"aria-label": "Home",
|
|
2226
|
+
viewBox: "0 0 24 24",
|
|
2227
|
+
fill: "none",
|
|
2228
|
+
stroke: "currentColor",
|
|
2229
|
+
"stroke-width": "2"
|
|
2230
|
+
}, [
|
|
2231
|
+
T("path", { d: "M3 12l9-9 9 9" }),
|
|
2232
|
+
T("path", { d: "M9 21V12h6v9" })
|
|
2233
|
+
], -1)
|
|
2227
2234
|
])]),
|
|
2228
2235
|
_: 1
|
|
2229
2236
|
})
|
|
2230
2237
|
], 36),
|
|
2231
|
-
|
|
2238
|
+
T("li", {
|
|
2232
2239
|
class: ke(["searchtab", { "search-active": t.value }]),
|
|
2233
2240
|
style: Ve({ display: e.value ? "block" : "none" })
|
|
2234
2241
|
}, [
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
class: "search-icon",
|
|
2242
|
+
T("a", Mo, [
|
|
2243
|
+
Ne((L(), M("svg", {
|
|
2244
|
+
class: "icon search-icon",
|
|
2238
2245
|
role: "button",
|
|
2239
2246
|
"aria-label": "Search",
|
|
2247
|
+
viewBox: "0 0 24 24",
|
|
2248
|
+
fill: "none",
|
|
2249
|
+
stroke: "currentColor",
|
|
2250
|
+
"stroke-width": "2",
|
|
2240
2251
|
onClick: c,
|
|
2241
2252
|
onKeydown: ue(c, ["enter"])
|
|
2242
|
-
},
|
|
2253
|
+
}, [...w[6] || (w[6] = [
|
|
2254
|
+
T("circle", {
|
|
2255
|
+
cx: "11",
|
|
2256
|
+
cy: "11",
|
|
2257
|
+
r: "7"
|
|
2258
|
+
}, null, -1),
|
|
2259
|
+
T("path", { d: "M21 21l-4.35-4.35" }, null, -1)
|
|
2260
|
+
])], 544)), [
|
|
2243
2261
|
[Be, !t.value]
|
|
2244
2262
|
]),
|
|
2245
|
-
|
|
2263
|
+
Ne(T("input", {
|
|
2246
2264
|
ref: "searchinput",
|
|
2247
|
-
"onUpdate:modelValue":
|
|
2265
|
+
"onUpdate:modelValue": w[0] || (w[0] = (O) => a.value = O),
|
|
2248
2266
|
type: "text",
|
|
2249
2267
|
placeholder: "Search...",
|
|
2250
|
-
onClick:
|
|
2268
|
+
onClick: w[1] || (w[1] = it(() => {
|
|
2251
2269
|
}, ["stop"])),
|
|
2252
|
-
onInput:
|
|
2253
|
-
onBlur:
|
|
2270
|
+
onInput: w[2] || (w[2] = (O) => i(O)),
|
|
2271
|
+
onBlur: w[3] || (w[3] = (O) => u(O)),
|
|
2254
2272
|
onKeydown: [
|
|
2255
|
-
|
|
2273
|
+
w[4] || (w[4] = ue((O) => u(O), ["enter"])),
|
|
2256
2274
|
ue(c, ["escape"])
|
|
2257
2275
|
]
|
|
2258
2276
|
}, null, 544), [
|
|
2259
2277
|
[Be, t.value],
|
|
2260
|
-
[lt,
|
|
2278
|
+
[lt, a.value]
|
|
2261
2279
|
])
|
|
2262
2280
|
])
|
|
2263
2281
|
], 6),
|
|
2264
|
-
(
|
|
2282
|
+
(L(!0), M(me, null, ye(o.breadcrumbs, (O) => (L(), M("li", {
|
|
2265
2283
|
key: O.title,
|
|
2266
2284
|
style: Ve({ display: e.value ? "block" : "none" })
|
|
2267
2285
|
}, [
|
|
2268
|
-
se(
|
|
2286
|
+
se(N, {
|
|
2269
2287
|
tabindex: "0",
|
|
2270
2288
|
to: O.to
|
|
2271
2289
|
}, {
|
|
2272
2290
|
default: be(() => [
|
|
2273
|
-
|
|
2291
|
+
De(Y(O.title), 1)
|
|
2274
2292
|
]),
|
|
2275
2293
|
_: 2
|
|
2276
2294
|
}, 1032, ["to"])
|
|
@@ -2279,19 +2297,19 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2279
2297
|
]);
|
|
2280
2298
|
};
|
|
2281
2299
|
}
|
|
2282
|
-
}), St = /* @__PURE__ */ ft(
|
|
2300
|
+
}), St = /* @__PURE__ */ ft(Bo, [["__scopeId", "data-v-eb5bcbb6"]]), Ho = {
|
|
2283
2301
|
key: 1,
|
|
2284
2302
|
class: "loading"
|
|
2285
|
-
},
|
|
2303
|
+
}, Uo = {
|
|
2286
2304
|
key: 2,
|
|
2287
2305
|
class: "loading"
|
|
2288
|
-
},
|
|
2306
|
+
}, Wo = /* @__PURE__ */ we({
|
|
2289
2307
|
__name: "Desktop",
|
|
2290
2308
|
props: {
|
|
2291
2309
|
availableDoctypes: { default: () => [] }
|
|
2292
2310
|
},
|
|
2293
|
-
setup(
|
|
2294
|
-
const { stonecrop: e } =
|
|
2311
|
+
setup(o) {
|
|
2312
|
+
const { stonecrop: e } = No(), t = R(!1), a = R(!1), n = R(!1), s = A({
|
|
2295
2313
|
get() {
|
|
2296
2314
|
if (!e.value || !i.value || !p.value)
|
|
2297
2315
|
return {};
|
|
@@ -2305,15 +2323,15 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2305
2323
|
if (!(!e.value || !i.value || !p.value))
|
|
2306
2324
|
try {
|
|
2307
2325
|
const d = e.value.getStore();
|
|
2308
|
-
for (const [
|
|
2309
|
-
const X = `${i.value}.${p.value}.${
|
|
2326
|
+
for (const [S, I] of Object.entries(l)) {
|
|
2327
|
+
const X = `${i.value}.${p.value}.${S}`;
|
|
2310
2328
|
d.set(X, I);
|
|
2311
2329
|
}
|
|
2312
2330
|
} catch (d) {
|
|
2313
2331
|
console.warn("HST update failed:", d);
|
|
2314
2332
|
}
|
|
2315
2333
|
}
|
|
2316
|
-
}), r =
|
|
2334
|
+
}), r = A(() => Oe(e.value?.registry.router?.currentRoute)), c = A(() => e.value?.registry.router), i = A(() => {
|
|
2317
2335
|
if (!r.value) return "";
|
|
2318
2336
|
if (r.value.meta?.actualDoctype)
|
|
2319
2337
|
return r.value.meta.actualDoctype;
|
|
@@ -2321,7 +2339,7 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2321
2339
|
return r.value.params.doctype;
|
|
2322
2340
|
const l = r.value.params.pathMatch;
|
|
2323
2341
|
return l && l.length > 0 ? l[0] : "";
|
|
2324
|
-
}), u =
|
|
2342
|
+
}), u = A(() => {
|
|
2325
2343
|
if (!r.value) return "";
|
|
2326
2344
|
if (r.value.meta?.doctype)
|
|
2327
2345
|
return r.value.meta.doctype;
|
|
@@ -2329,13 +2347,13 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2329
2347
|
return r.value.params.doctype;
|
|
2330
2348
|
const l = r.value.params.pathMatch;
|
|
2331
2349
|
return l && l.length > 0 ? l[0] : "";
|
|
2332
|
-
}), p =
|
|
2350
|
+
}), p = A(() => {
|
|
2333
2351
|
if (!r.value) return "";
|
|
2334
2352
|
if (r.value.params.recordId)
|
|
2335
2353
|
return r.value.params.recordId;
|
|
2336
2354
|
const l = r.value.params.pathMatch;
|
|
2337
2355
|
return l && l.length > 1 ? l[1] : "";
|
|
2338
|
-
}), b =
|
|
2356
|
+
}), b = A(() => p.value?.startsWith("new-")), w = A(() => {
|
|
2339
2357
|
if (!r.value || r.value.name === "home" || r.value.path === "/")
|
|
2340
2358
|
return "doctypes";
|
|
2341
2359
|
if (r.value.name && r.value.name !== "catch-all") {
|
|
@@ -2347,21 +2365,21 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2347
2365
|
}
|
|
2348
2366
|
const l = r.value.params.pathMatch;
|
|
2349
2367
|
return l && l.length > 0 ? l.length === 1 ? "records" : "record" : "doctypes";
|
|
2350
|
-
}),
|
|
2368
|
+
}), N = () => {
|
|
2351
2369
|
if (!e.value || !i.value || !p.value)
|
|
2352
2370
|
return [];
|
|
2353
2371
|
try {
|
|
2354
2372
|
const d = e.value.registry.registry[i.value];
|
|
2355
2373
|
if (!d?.workflow?.states)
|
|
2356
2374
|
return [];
|
|
2357
|
-
const
|
|
2375
|
+
const S = b.value ? "creating" : "editing", I = d.workflow.states[S];
|
|
2358
2376
|
return I?.on ? Object.keys(I.on).map((q) => {
|
|
2359
2377
|
const ce = I.on?.[q], Q = typeof ce == "string" ? ce : "unknown", $t = async () => {
|
|
2360
2378
|
const qe = e.value?.getRecordById(i.value, p.value);
|
|
2361
2379
|
if (qe) {
|
|
2362
2380
|
const _t = s.value || {};
|
|
2363
2381
|
await qe.triggerTransition(q, {
|
|
2364
|
-
currentState:
|
|
2382
|
+
currentState: S,
|
|
2365
2383
|
targetState: Q,
|
|
2366
2384
|
fsmContext: _t
|
|
2367
2385
|
});
|
|
@@ -2375,9 +2393,9 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2375
2393
|
} catch (l) {
|
|
2376
2394
|
return console.warn("Error getting available transitions:", l), [];
|
|
2377
2395
|
}
|
|
2378
|
-
}, O =
|
|
2396
|
+
}, O = A(() => {
|
|
2379
2397
|
const l = [];
|
|
2380
|
-
switch (
|
|
2398
|
+
switch (w.value) {
|
|
2381
2399
|
case "doctypes":
|
|
2382
2400
|
l.push({
|
|
2383
2401
|
type: "button",
|
|
@@ -2406,7 +2424,7 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2406
2424
|
);
|
|
2407
2425
|
break;
|
|
2408
2426
|
case "record": {
|
|
2409
|
-
const d =
|
|
2427
|
+
const d = N();
|
|
2410
2428
|
d.length > 0 && l.push({
|
|
2411
2429
|
type: "dropdown",
|
|
2412
2430
|
label: "Actions",
|
|
@@ -2416,17 +2434,17 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2416
2434
|
}
|
|
2417
2435
|
}
|
|
2418
2436
|
return l;
|
|
2419
|
-
}), k =
|
|
2437
|
+
}), k = A(() => {
|
|
2420
2438
|
const l = [];
|
|
2421
|
-
return
|
|
2439
|
+
return w.value === "records" && u.value ? l.push(
|
|
2422
2440
|
{ title: "Home", to: "/" },
|
|
2423
2441
|
{ title: x(u.value), to: `/${u.value}` }
|
|
2424
|
-
) :
|
|
2442
|
+
) : w.value === "record" && u.value && l.push(
|
|
2425
2443
|
{ title: "Home", to: "/" },
|
|
2426
2444
|
{ title: x(u.value), to: `/${u.value}` },
|
|
2427
2445
|
{ title: b.value ? "New Record" : "Edit Record", to: r.value?.fullPath || "" }
|
|
2428
2446
|
), l;
|
|
2429
|
-
}),
|
|
2447
|
+
}), V = (l) => {
|
|
2430
2448
|
const d = [
|
|
2431
2449
|
{
|
|
2432
2450
|
title: "Go Home",
|
|
@@ -2438,7 +2456,7 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2438
2456
|
{
|
|
2439
2457
|
title: "Toggle Command Palette",
|
|
2440
2458
|
description: "Open/close the command palette",
|
|
2441
|
-
action: () =>
|
|
2459
|
+
action: () => n.value = !n.value
|
|
2442
2460
|
}
|
|
2443
2461
|
];
|
|
2444
2462
|
return u.value && (d.push({
|
|
@@ -2453,19 +2471,19 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2453
2471
|
action: () => {
|
|
2454
2472
|
z();
|
|
2455
2473
|
}
|
|
2456
|
-
})),
|
|
2474
|
+
})), o.availableDoctypes.forEach((S) => {
|
|
2457
2475
|
d.push({
|
|
2458
|
-
title: `View ${x(
|
|
2459
|
-
description: `Navigate to ${
|
|
2476
|
+
title: `View ${x(S)}`,
|
|
2477
|
+
description: `Navigate to ${S} list`,
|
|
2460
2478
|
action: () => {
|
|
2461
|
-
c.value?.push(`/${
|
|
2479
|
+
c.value?.push(`/${S}`);
|
|
2462
2480
|
}
|
|
2463
2481
|
});
|
|
2464
2482
|
}), l ? d.filter(
|
|
2465
|
-
(
|
|
2483
|
+
(S) => S.title.toLowerCase().includes(l.toLowerCase()) || S.description.toLowerCase().includes(l.toLowerCase())
|
|
2466
2484
|
) : d;
|
|
2467
|
-
},
|
|
2468
|
-
l.action(),
|
|
2485
|
+
}, P = (l) => {
|
|
2486
|
+
l.action(), n.value = !1;
|
|
2469
2487
|
}, x = (l) => l.split("-").map((d) => d.charAt(0).toUpperCase() + d.slice(1)).join(" "), W = (l) => e.value ? e.value.getRecordIds(l).length : 0, J = async (l) => {
|
|
2470
2488
|
await c.value?.push(`/${l}`);
|
|
2471
2489
|
}, K = async (l) => {
|
|
@@ -2480,8 +2498,8 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2480
2498
|
} catch {
|
|
2481
2499
|
}
|
|
2482
2500
|
}, U = () => {
|
|
2483
|
-
if (!
|
|
2484
|
-
const l =
|
|
2501
|
+
if (!o.availableDoctypes.length) return [];
|
|
2502
|
+
const l = o.availableDoctypes.map((d) => ({
|
|
2485
2503
|
id: d,
|
|
2486
2504
|
doctype: d,
|
|
2487
2505
|
display_name: x(d),
|
|
@@ -2505,7 +2523,7 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2505
2523
|
{
|
|
2506
2524
|
label: "Doctype",
|
|
2507
2525
|
name: "doctype",
|
|
2508
|
-
|
|
2526
|
+
fieldtype: "Data",
|
|
2509
2527
|
align: "left",
|
|
2510
2528
|
edit: !1,
|
|
2511
2529
|
width: "20ch"
|
|
@@ -2513,7 +2531,7 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2513
2531
|
{
|
|
2514
2532
|
label: "Name",
|
|
2515
2533
|
name: "display_name",
|
|
2516
|
-
|
|
2534
|
+
fieldtype: "Data",
|
|
2517
2535
|
align: "left",
|
|
2518
2536
|
edit: !1,
|
|
2519
2537
|
width: "30ch"
|
|
@@ -2521,7 +2539,7 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2521
2539
|
{
|
|
2522
2540
|
label: "Records",
|
|
2523
2541
|
name: "record_count",
|
|
2524
|
-
|
|
2542
|
+
fieldtype: "Int",
|
|
2525
2543
|
align: "center",
|
|
2526
2544
|
edit: !1,
|
|
2527
2545
|
width: "15ch"
|
|
@@ -2529,7 +2547,7 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2529
2547
|
{
|
|
2530
2548
|
label: "Actions",
|
|
2531
2549
|
name: "actions",
|
|
2532
|
-
|
|
2550
|
+
fieldtype: "Data",
|
|
2533
2551
|
align: "center",
|
|
2534
2552
|
edit: !1,
|
|
2535
2553
|
width: "20ch"
|
|
@@ -2572,7 +2590,7 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2572
2590
|
`
|
|
2573
2591
|
}
|
|
2574
2592
|
];
|
|
2575
|
-
const
|
|
2593
|
+
const S = l.map((I) => ({
|
|
2576
2594
|
...I,
|
|
2577
2595
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2578
2596
|
id: I.id || "",
|
|
@@ -2625,7 +2643,7 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2625
2643
|
...d.map((I) => ({
|
|
2626
2644
|
label: I.label,
|
|
2627
2645
|
name: I.fieldname,
|
|
2628
|
-
|
|
2646
|
+
fieldtype: I.fieldtype,
|
|
2629
2647
|
align: "left",
|
|
2630
2648
|
edit: !1,
|
|
2631
2649
|
width: "20ch"
|
|
@@ -2633,7 +2651,7 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2633
2651
|
{
|
|
2634
2652
|
label: "Actions",
|
|
2635
2653
|
name: "actions",
|
|
2636
|
-
|
|
2654
|
+
fieldtype: "Data",
|
|
2637
2655
|
align: "center",
|
|
2638
2656
|
edit: !1,
|
|
2639
2657
|
width: "20ch"
|
|
@@ -2643,7 +2661,7 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2643
2661
|
view: "list",
|
|
2644
2662
|
fullWidth: !0
|
|
2645
2663
|
},
|
|
2646
|
-
rows:
|
|
2664
|
+
rows: S
|
|
2647
2665
|
}
|
|
2648
2666
|
]
|
|
2649
2667
|
];
|
|
@@ -2682,7 +2700,7 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2682
2700
|
`
|
|
2683
2701
|
}
|
|
2684
2702
|
];
|
|
2685
|
-
const
|
|
2703
|
+
const S = "toArray" in d.schema ? d.schema.toArray() : d.schema, I = E();
|
|
2686
2704
|
return [
|
|
2687
2705
|
{
|
|
2688
2706
|
fieldname: "header",
|
|
@@ -2709,15 +2727,15 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2709
2727
|
component: "div",
|
|
2710
2728
|
value: `
|
|
2711
2729
|
<div class="view-actions">
|
|
2712
|
-
<button class="btn-primary" data-action="save" ${
|
|
2713
|
-
${
|
|
2730
|
+
<button class="btn-primary" data-action="save" ${a.value ? "disabled" : ""}>
|
|
2731
|
+
${a.value ? "Saving..." : "Save"}
|
|
2714
2732
|
</button>
|
|
2715
2733
|
<button class="btn-secondary" data-action="cancel">Cancel</button>
|
|
2716
2734
|
${b.value ? "" : '<button class="btn-danger" data-action="delete">Delete</button>'}
|
|
2717
2735
|
</div>
|
|
2718
2736
|
`
|
|
2719
2737
|
},
|
|
2720
|
-
...
|
|
2738
|
+
...S.map((X) => ({
|
|
2721
2739
|
...X,
|
|
2722
2740
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2723
2741
|
value: I[X.fieldname] || ""
|
|
@@ -2754,8 +2772,8 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2754
2772
|
} catch {
|
|
2755
2773
|
}
|
|
2756
2774
|
return [];
|
|
2757
|
-
}, E = () => !e.value || !i.value || b.value ? {} : e.value.getRecordById(i.value, p.value)?.get("") || {}, h =
|
|
2758
|
-
switch (
|
|
2775
|
+
}, E = () => !e.value || !i.value || b.value ? {} : e.value.getRecordById(i.value, p.value)?.get("") || {}, h = A(() => {
|
|
2776
|
+
switch (w.value) {
|
|
2759
2777
|
case "doctypes":
|
|
2760
2778
|
return U();
|
|
2761
2779
|
case "records":
|
|
@@ -2778,10 +2796,10 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2778
2796
|
if (!(!e.value || !i.value || !p.value || b.value))
|
|
2779
2797
|
try {
|
|
2780
2798
|
const d = e.value.getStore();
|
|
2781
|
-
l.forEach((
|
|
2782
|
-
if (
|
|
2783
|
-
const I = `${i.value}.${p.value}.${
|
|
2784
|
-
(d.has(I) ? d.get(I) : void 0) !==
|
|
2799
|
+
l.forEach((S) => {
|
|
2800
|
+
if (S.fieldname && "value" in S && !["header", "actions", "loading", "error"].includes(S.fieldname)) {
|
|
2801
|
+
const I = `${i.value}.${p.value}.${S.fieldname}`;
|
|
2802
|
+
(d.has(I) ? d.get(I) : void 0) !== S.value && d.set(I, S.value);
|
|
2785
2803
|
}
|
|
2786
2804
|
});
|
|
2787
2805
|
} catch (d) {
|
|
@@ -2790,25 +2808,25 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2790
2808
|
},
|
|
2791
2809
|
{ deep: !0 }
|
|
2792
2810
|
);
|
|
2793
|
-
const
|
|
2811
|
+
const D = async () => {
|
|
2794
2812
|
if (e.value) {
|
|
2795
|
-
|
|
2813
|
+
a.value = !0;
|
|
2796
2814
|
try {
|
|
2797
2815
|
const l = s.value || {};
|
|
2798
2816
|
if (b.value) {
|
|
2799
|
-
const d = `record-${Date.now()}`,
|
|
2800
|
-
e.value.addRecord(i.value, d,
|
|
2817
|
+
const d = `record-${Date.now()}`, S = { id: d, ...l };
|
|
2818
|
+
e.value.addRecord(i.value, d, S);
|
|
2801
2819
|
const I = e.value.getRecordById(i.value, d);
|
|
2802
2820
|
I && await I.triggerTransition("SAVE", {
|
|
2803
2821
|
currentState: "creating",
|
|
2804
2822
|
targetState: "saved",
|
|
2805
|
-
fsmContext:
|
|
2823
|
+
fsmContext: S
|
|
2806
2824
|
}), await c.value?.replace(`/${u.value}/${d}`);
|
|
2807
2825
|
} else {
|
|
2808
2826
|
const d = { id: p.value, ...l };
|
|
2809
2827
|
e.value.addRecord(i.value, p.value, d);
|
|
2810
|
-
const
|
|
2811
|
-
|
|
2828
|
+
const S = e.value.getRecordById(i.value, p.value);
|
|
2829
|
+
S && await S.triggerTransition("SAVE", {
|
|
2812
2830
|
currentState: "editing",
|
|
2813
2831
|
targetState: "saved",
|
|
2814
2832
|
fsmContext: d
|
|
@@ -2816,10 +2834,10 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2816
2834
|
}
|
|
2817
2835
|
} catch {
|
|
2818
2836
|
} finally {
|
|
2819
|
-
|
|
2837
|
+
a.value = !1;
|
|
2820
2838
|
}
|
|
2821
2839
|
}
|
|
2822
|
-
},
|
|
2840
|
+
}, j = async () => {
|
|
2823
2841
|
if (b.value)
|
|
2824
2842
|
await c.value?.push(`/${u.value}`);
|
|
2825
2843
|
else {
|
|
@@ -2832,30 +2850,30 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2832
2850
|
}
|
|
2833
2851
|
f();
|
|
2834
2852
|
}
|
|
2835
|
-
},
|
|
2853
|
+
}, B = (l, d) => {
|
|
2836
2854
|
d && d();
|
|
2837
2855
|
}, G = async (l) => {
|
|
2838
2856
|
if (!e.value) return;
|
|
2839
2857
|
const d = l || p.value;
|
|
2840
2858
|
if (d && confirm("Are you sure you want to delete this record?")) {
|
|
2841
|
-
const
|
|
2842
|
-
|
|
2859
|
+
const S = e.value.getRecordById(i.value, d);
|
|
2860
|
+
S && await S.triggerTransition("DELETE", {
|
|
2843
2861
|
currentState: "editing",
|
|
2844
2862
|
targetState: "deleted"
|
|
2845
|
-
}), e.value.removeRecord(i.value, d),
|
|
2863
|
+
}), e.value.removeRecord(i.value, d), w.value === "record" && await c.value?.push(`/${u.value}`);
|
|
2846
2864
|
}
|
|
2847
2865
|
}, g = async (l) => {
|
|
2848
|
-
const d = l.target,
|
|
2849
|
-
if (
|
|
2850
|
-
switch (
|
|
2866
|
+
const d = l.target, S = d.getAttribute("data-action");
|
|
2867
|
+
if (S)
|
|
2868
|
+
switch (S) {
|
|
2851
2869
|
case "create":
|
|
2852
2870
|
await z();
|
|
2853
2871
|
break;
|
|
2854
2872
|
case "save":
|
|
2855
|
-
await
|
|
2873
|
+
await D();
|
|
2856
2874
|
break;
|
|
2857
2875
|
case "cancel":
|
|
2858
|
-
await
|
|
2876
|
+
await j();
|
|
2859
2877
|
break;
|
|
2860
2878
|
case "delete":
|
|
2861
2879
|
await G();
|
|
@@ -2886,9 +2904,9 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2886
2904
|
}
|
|
2887
2905
|
};
|
|
2888
2906
|
H(
|
|
2889
|
-
[
|
|
2907
|
+
[w, i, p],
|
|
2890
2908
|
() => {
|
|
2891
|
-
|
|
2909
|
+
w.value === "record" && f();
|
|
2892
2910
|
},
|
|
2893
2911
|
{ immediate: !0 }
|
|
2894
2912
|
), H(
|
|
@@ -2897,9 +2915,9 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2897
2915
|
},
|
|
2898
2916
|
{ immediate: !0 }
|
|
2899
2917
|
), H(
|
|
2900
|
-
[
|
|
2901
|
-
([l, d,
|
|
2902
|
-
l === "records" && d &&
|
|
2918
|
+
[w, i, e],
|
|
2919
|
+
([l, d, S]) => {
|
|
2920
|
+
l === "records" && d && S && _(d);
|
|
2903
2921
|
},
|
|
2904
2922
|
{ immediate: !0 }
|
|
2905
2923
|
);
|
|
@@ -2919,65 +2937,65 @@ const Vn = { class: "aform" }, Pn = /* @__PURE__ */ we({
|
|
|
2919
2937
|
navigateToDoctype: J,
|
|
2920
2938
|
openRecord: K,
|
|
2921
2939
|
createNewRecord: z,
|
|
2922
|
-
handleSave:
|
|
2923
|
-
handleCancel:
|
|
2940
|
+
handleSave: D,
|
|
2941
|
+
handleCancel: j,
|
|
2924
2942
|
handleDelete: G
|
|
2925
2943
|
}), Te(() => {
|
|
2926
|
-
|
|
2927
|
-
|
|
2944
|
+
oe(() => {
|
|
2945
|
+
w.value === "records" && i.value && e.value && _(i.value);
|
|
2928
2946
|
});
|
|
2929
2947
|
const l = (d) => {
|
|
2930
|
-
(d.ctrlKey || d.metaKey) && d.key === "k" && (d.preventDefault(),
|
|
2948
|
+
(d.ctrlKey || d.metaKey) && d.key === "k" && (d.preventDefault(), n.value = !0), d.key === "Escape" && n.value && (n.value = !1);
|
|
2931
2949
|
};
|
|
2932
2950
|
return document.addEventListener("keydown", l), () => {
|
|
2933
2951
|
document.removeEventListener("keydown", l);
|
|
2934
2952
|
};
|
|
2935
|
-
}), (l, d) => (
|
|
2953
|
+
}), (l, d) => (L(), M("div", {
|
|
2936
2954
|
class: "desktop",
|
|
2937
2955
|
onClick: g
|
|
2938
2956
|
}, [
|
|
2939
2957
|
se(ht, {
|
|
2940
2958
|
elements: O.value,
|
|
2941
|
-
onActionClick:
|
|
2959
|
+
onActionClick: B
|
|
2942
2960
|
}, null, 8, ["elements"]),
|
|
2943
|
-
$.value.length > 0 ? (
|
|
2961
|
+
$.value.length > 0 ? (L(), Ke(Oe(jo), {
|
|
2944
2962
|
key: 0,
|
|
2945
2963
|
modelValue: $.value,
|
|
2946
|
-
"onUpdate:modelValue": d[0] || (d[0] = (
|
|
2964
|
+
"onUpdate:modelValue": d[0] || (d[0] = (S) => $.value = S),
|
|
2947
2965
|
data: s.value
|
|
2948
|
-
}, null, 8, ["modelValue", "data"])) : Oe(e) ? (
|
|
2949
|
-
|
|
2950
|
-
])) : (
|
|
2951
|
-
|
|
2966
|
+
}, null, 8, ["modelValue", "data"])) : Oe(e) ? (L(), M("div", Uo, [
|
|
2967
|
+
T("p", null, "Loading " + Y(w.value) + " data...", 1)
|
|
2968
|
+
])) : (L(), M("div", Ho, [...d[2] || (d[2] = [
|
|
2969
|
+
T("p", null, "Initializing Stonecrop...", -1)
|
|
2952
2970
|
])])),
|
|
2953
2971
|
se(St, { breadcrumbs: k.value }, null, 8, ["breadcrumbs"]),
|
|
2954
2972
|
se(gt, {
|
|
2955
|
-
"is-open":
|
|
2956
|
-
search:
|
|
2973
|
+
"is-open": n.value,
|
|
2974
|
+
search: V,
|
|
2957
2975
|
placeholder: "Type a command or search...",
|
|
2958
|
-
onSelect:
|
|
2959
|
-
onClose: d[1] || (d[1] = (
|
|
2976
|
+
onSelect: P,
|
|
2977
|
+
onClose: d[1] || (d[1] = (S) => n.value = !1)
|
|
2960
2978
|
}, {
|
|
2961
|
-
title: be(({ result:
|
|
2962
|
-
|
|
2979
|
+
title: be(({ result: S }) => [
|
|
2980
|
+
De(Y(S.title), 1)
|
|
2963
2981
|
]),
|
|
2964
|
-
content: be(({ result:
|
|
2965
|
-
|
|
2982
|
+
content: be(({ result: S }) => [
|
|
2983
|
+
De(Y(S.description), 1)
|
|
2966
2984
|
]),
|
|
2967
2985
|
_: 1
|
|
2968
2986
|
}, 8, ["is-open"])
|
|
2969
2987
|
]));
|
|
2970
2988
|
}
|
|
2971
|
-
}),
|
|
2972
|
-
install: (
|
|
2973
|
-
|
|
2989
|
+
}), Jo = {
|
|
2990
|
+
install: (o) => {
|
|
2991
|
+
o.component("ActionSet", ht), o.component("CommandPalette", gt), o.component("Desktop", Wo), o.component("SheetNav", St);
|
|
2974
2992
|
}
|
|
2975
2993
|
};
|
|
2976
2994
|
export {
|
|
2977
2995
|
ht as ActionSet,
|
|
2978
2996
|
gt as CommandPalette,
|
|
2979
|
-
|
|
2997
|
+
Wo as Desktop,
|
|
2980
2998
|
St as SheetNav,
|
|
2981
|
-
|
|
2999
|
+
Jo as StonecropDesktop
|
|
2982
3000
|
};
|
|
2983
3001
|
//# sourceMappingURL=desktop.js.map
|