@stonecrop/stonecrop 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/src/index.d.ts +4 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -0
- package/dist/src/schema-validator.d.ts +132 -0
- package/dist/src/schema-validator.d.ts.map +1 -0
- package/dist/src/schema-validator.js +315 -0
- package/dist/stonecrop.d.ts +140 -14
- package/dist/stonecrop.js +949 -730
- package/dist/stonecrop.js.map +1 -1
- package/dist/stonecrop.umd.cjs +3 -3
- package/dist/stonecrop.umd.cjs.map +1 -1
- package/package.json +20 -20
- package/src/index.ts +9 -0
- package/src/schema-validator.ts +427 -0
- package/dist/composable.js +0 -348
- package/dist/composables/operation-log.js +0 -221
- package/dist/doctype.js +0 -73
- package/dist/exceptions.js +0 -16
- package/dist/field-triggers.js +0 -564
- package/dist/index.js +0 -18
- package/dist/operation-log-DB-dGNT9.js +0 -593
- package/dist/operation-log-DB-dGNT9.js.map +0 -1
- package/dist/plugins/index.js +0 -90
- package/dist/registry.js +0 -72
- package/dist/src/stores/data.d.ts +0 -11
- package/dist/src/stores/data.d.ts.map +0 -1
- package/dist/src/stores/xstate.d.ts +0 -31
- package/dist/src/stores/xstate.d.ts.map +0 -1
- package/dist/stores/data.js +0 -7
- package/dist/stores/hst.js +0 -483
- package/dist/stores/index.js +0 -12
- package/dist/stores/operation-log.js +0 -571
- package/dist/stores/xstate.js +0 -29
- package/dist/types/field-triggers.js +0 -4
- package/dist/types/index.js +0 -4
- package/dist/types/operation-log.js +0 -0
- package/dist/types/registry.js +0 -0
package/dist/stonecrop.js
CHANGED
|
@@ -1,278 +1,278 @@
|
|
|
1
|
-
import { hasInjectionContext as we, inject as te, getCurrentInstance as
|
|
1
|
+
import { hasInjectionContext as we, inject as te, getCurrentInstance as Fe, toRaw as Le, computed as B, isRef as re, isReactive as ye, toRef as se, ref as M, reactive as Ee, markRaw as oe, effectScope as Je, nextTick as le, getCurrentScope as Ke, onScopeDispose as Ze, watch as H, toRefs as Pe, onMounted as Ve, readonly as Me, customRef as Ge, toValue as q, shallowRef as xe, unref as Ye, provide as _e } from "vue";
|
|
2
2
|
const Q = typeof window < "u";
|
|
3
3
|
let K;
|
|
4
|
-
const ge = (
|
|
4
|
+
const ge = (n) => K = n;
|
|
5
5
|
process.env.NODE_ENV;
|
|
6
6
|
const Oe = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia") : (
|
|
7
7
|
/* istanbul ignore next */
|
|
8
8
|
/* @__PURE__ */ Symbol()
|
|
9
9
|
);
|
|
10
|
-
function
|
|
11
|
-
return
|
|
10
|
+
function G(n) {
|
|
11
|
+
return n && typeof n == "object" && Object.prototype.toString.call(n) === "[object Object]" && typeof n.toJSON != "function";
|
|
12
12
|
}
|
|
13
13
|
var ie;
|
|
14
|
-
(function(
|
|
15
|
-
|
|
14
|
+
(function(n) {
|
|
15
|
+
n.direct = "direct", n.patchObject = "patch object", n.patchFunction = "patch function";
|
|
16
16
|
})(ie || (ie = {}));
|
|
17
|
-
function Be(
|
|
17
|
+
function Be(n, e) {
|
|
18
18
|
for (const t in e) {
|
|
19
19
|
const r = e[t];
|
|
20
|
-
if (!(t in
|
|
20
|
+
if (!(t in n))
|
|
21
21
|
continue;
|
|
22
|
-
const
|
|
23
|
-
|
|
22
|
+
const o = n[t];
|
|
23
|
+
G(o) && G(r) && !re(r) && !ye(r) ? n[t] = Be(o, r) : n[t] = r;
|
|
24
24
|
}
|
|
25
|
-
return
|
|
25
|
+
return n;
|
|
26
26
|
}
|
|
27
27
|
const je = () => {
|
|
28
28
|
};
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
29
|
+
function Ae(n, e, t, r = je) {
|
|
30
|
+
n.add(e);
|
|
31
|
+
const o = () => {
|
|
32
|
+
n.delete(e) && r();
|
|
33
33
|
};
|
|
34
|
-
return !t &&
|
|
34
|
+
return !t && Ke() && Ze(o), o;
|
|
35
35
|
}
|
|
36
|
-
function Y(
|
|
37
|
-
|
|
36
|
+
function Y(n, ...e) {
|
|
37
|
+
n.forEach((t) => {
|
|
38
38
|
t(...e);
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
const Qe = (
|
|
42
|
-
function Re(
|
|
43
|
-
|
|
41
|
+
const Qe = (n) => n(), $e = /* @__PURE__ */ Symbol(), me = /* @__PURE__ */ Symbol();
|
|
42
|
+
function Re(n, e) {
|
|
43
|
+
n instanceof Map && e instanceof Map ? e.forEach((t, r) => n.set(r, t)) : n instanceof Set && e instanceof Set && e.forEach(n.add, n);
|
|
44
44
|
for (const t in e) {
|
|
45
45
|
if (!e.hasOwnProperty(t))
|
|
46
46
|
continue;
|
|
47
|
-
const r = e[t],
|
|
48
|
-
|
|
47
|
+
const r = e[t], o = n[t];
|
|
48
|
+
G(o) && G(r) && n.hasOwnProperty(t) && !re(r) && !ye(r) ? n[t] = Re(o, r) : n[t] = r;
|
|
49
49
|
}
|
|
50
|
-
return
|
|
50
|
+
return n;
|
|
51
51
|
}
|
|
52
52
|
const Xe = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia:skipHydration") : (
|
|
53
53
|
/* istanbul ignore next */
|
|
54
54
|
/* @__PURE__ */ Symbol()
|
|
55
55
|
);
|
|
56
|
-
function et(
|
|
57
|
-
return !
|
|
56
|
+
function et(n) {
|
|
57
|
+
return !G(n) || !Object.prototype.hasOwnProperty.call(n, Xe);
|
|
58
58
|
}
|
|
59
|
-
const { assign:
|
|
60
|
-
function
|
|
61
|
-
return !!(re(
|
|
59
|
+
const { assign: W } = Object;
|
|
60
|
+
function Ie(n) {
|
|
61
|
+
return !!(re(n) && n.effect);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
const { state:
|
|
63
|
+
function De(n, e, t, r) {
|
|
64
|
+
const { state: o, actions: s, getters: i } = e, a = t.state.value[n];
|
|
65
65
|
let c;
|
|
66
66
|
function h() {
|
|
67
|
-
!a && (process.env.NODE_ENV === "production" || !r) && (t.state.value[
|
|
68
|
-
const
|
|
67
|
+
!a && (process.env.NODE_ENV === "production" || !r) && (t.state.value[n] = o ? o() : {});
|
|
68
|
+
const g = process.env.NODE_ENV !== "production" && r ? (
|
|
69
69
|
// use ref() to unwrap refs inside state TODO: check if this is still necessary
|
|
70
|
-
Pe(
|
|
71
|
-
) : Pe(t.state.value[
|
|
72
|
-
return
|
|
70
|
+
Pe(M(o ? o() : {}).value)
|
|
71
|
+
) : Pe(t.state.value[n]);
|
|
72
|
+
return W(g, s, Object.keys(i || {}).reduce((w, R) => (process.env.NODE_ENV !== "production" && R in g && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${R}" in store "${n}".`), w[R] = oe(B(() => {
|
|
73
73
|
ge(t);
|
|
74
|
-
const
|
|
75
|
-
return i[
|
|
74
|
+
const $ = t._s.get(n);
|
|
75
|
+
return i[R].call($, $);
|
|
76
76
|
})), w), {}));
|
|
77
77
|
}
|
|
78
|
-
return c =
|
|
78
|
+
return c = Ne(n, h, e, t, r, !0), c;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function Ne(n, e, t = {}, r, o, s) {
|
|
81
81
|
let i;
|
|
82
|
-
const a =
|
|
82
|
+
const a = W({ actions: {} }, t);
|
|
83
83
|
if (process.env.NODE_ENV !== "production" && !r._e.active)
|
|
84
84
|
throw new Error("Pinia destroyed");
|
|
85
85
|
const c = { deep: !0 };
|
|
86
|
-
process.env.NODE_ENV !== "production" && (c.onTrigger = (
|
|
87
|
-
h ?
|
|
86
|
+
process.env.NODE_ENV !== "production" && (c.onTrigger = (l) => {
|
|
87
|
+
h ? $ = l : h == !1 && !v._hotUpdating && (Array.isArray($) ? $.push(l) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
|
|
88
88
|
});
|
|
89
|
-
let h,
|
|
90
|
-
const
|
|
91
|
-
!s && !
|
|
92
|
-
const
|
|
93
|
-
let
|
|
94
|
-
function
|
|
95
|
-
let
|
|
96
|
-
h =
|
|
89
|
+
let h, g, w = /* @__PURE__ */ new Set(), R = /* @__PURE__ */ new Set(), $;
|
|
90
|
+
const T = r.state.value[n];
|
|
91
|
+
!s && !T && (process.env.NODE_ENV === "production" || !o) && (r.state.value[n] = {});
|
|
92
|
+
const L = M({});
|
|
93
|
+
let P;
|
|
94
|
+
function I(l) {
|
|
95
|
+
let u;
|
|
96
|
+
h = g = !1, process.env.NODE_ENV !== "production" && ($ = []), typeof l == "function" ? (l(r.state.value[n]), u = {
|
|
97
97
|
type: ie.patchFunction,
|
|
98
|
-
storeId:
|
|
99
|
-
events:
|
|
100
|
-
}) : (Re(r.state.value[
|
|
98
|
+
storeId: n,
|
|
99
|
+
events: $
|
|
100
|
+
}) : (Re(r.state.value[n], l), u = {
|
|
101
101
|
type: ie.patchObject,
|
|
102
|
-
payload:
|
|
103
|
-
storeId:
|
|
104
|
-
events:
|
|
102
|
+
payload: l,
|
|
103
|
+
storeId: n,
|
|
104
|
+
events: $
|
|
105
105
|
});
|
|
106
|
-
const O =
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}),
|
|
110
|
-
}
|
|
111
|
-
const
|
|
112
|
-
const { state:
|
|
113
|
-
this.$patch((
|
|
114
|
-
|
|
106
|
+
const O = P = /* @__PURE__ */ Symbol();
|
|
107
|
+
le().then(() => {
|
|
108
|
+
P === O && (h = !0);
|
|
109
|
+
}), g = !0, Y(w, u, r.state.value[n]);
|
|
110
|
+
}
|
|
111
|
+
const N = s ? function() {
|
|
112
|
+
const { state: u } = t, O = u ? u() : {};
|
|
113
|
+
this.$patch((m) => {
|
|
114
|
+
W(m, O);
|
|
115
115
|
});
|
|
116
116
|
} : (
|
|
117
117
|
/* istanbul ignore next */
|
|
118
118
|
process.env.NODE_ENV !== "production" ? () => {
|
|
119
|
-
throw new Error(`🍍: Store "${
|
|
119
|
+
throw new Error(`🍍: Store "${n}" is built using the setup syntax and does not implement $reset().`);
|
|
120
120
|
} : je
|
|
121
121
|
);
|
|
122
122
|
function S() {
|
|
123
|
-
i.stop(), w.clear(),
|
|
123
|
+
i.stop(), w.clear(), R.clear(), r._s.delete(n);
|
|
124
124
|
}
|
|
125
|
-
const
|
|
126
|
-
if (
|
|
127
|
-
return
|
|
125
|
+
const D = (l, u = "") => {
|
|
126
|
+
if ($e in l)
|
|
127
|
+
return l[me] = u, l;
|
|
128
128
|
const O = function() {
|
|
129
129
|
ge(r);
|
|
130
|
-
const
|
|
131
|
-
function
|
|
132
|
-
f.add(
|
|
130
|
+
const m = Array.from(arguments), f = /* @__PURE__ */ new Set(), b = /* @__PURE__ */ new Set();
|
|
131
|
+
function A(k) {
|
|
132
|
+
f.add(k);
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
|
|
134
|
+
function C(k) {
|
|
135
|
+
b.add(k);
|
|
136
136
|
}
|
|
137
|
-
Y(
|
|
138
|
-
args:
|
|
137
|
+
Y(R, {
|
|
138
|
+
args: m,
|
|
139
139
|
name: O[me],
|
|
140
|
-
store:
|
|
141
|
-
after:
|
|
142
|
-
onError:
|
|
140
|
+
store: v,
|
|
141
|
+
after: A,
|
|
142
|
+
onError: C
|
|
143
143
|
});
|
|
144
144
|
let j;
|
|
145
145
|
try {
|
|
146
|
-
j =
|
|
147
|
-
} catch (
|
|
148
|
-
throw Y(
|
|
146
|
+
j = l.apply(this && this.$id === n ? this : v, m);
|
|
147
|
+
} catch (k) {
|
|
148
|
+
throw Y(b, k), k;
|
|
149
149
|
}
|
|
150
|
-
return j instanceof Promise ? j.then((
|
|
150
|
+
return j instanceof Promise ? j.then((k) => (Y(f, k), k)).catch((k) => (Y(b, k), Promise.reject(k))) : (Y(f, j), j);
|
|
151
151
|
};
|
|
152
|
-
return O[
|
|
153
|
-
}, E = /* @__PURE__ */
|
|
152
|
+
return O[$e] = !0, O[me] = u, O;
|
|
153
|
+
}, E = /* @__PURE__ */ oe({
|
|
154
154
|
actions: {},
|
|
155
155
|
getters: {},
|
|
156
156
|
state: [],
|
|
157
|
-
hotState:
|
|
158
|
-
}),
|
|
157
|
+
hotState: L
|
|
158
|
+
}), _ = {
|
|
159
159
|
_p: r,
|
|
160
160
|
// _s: scope,
|
|
161
|
-
$id:
|
|
162
|
-
$onAction:
|
|
163
|
-
$patch:
|
|
164
|
-
$reset:
|
|
165
|
-
$subscribe(
|
|
166
|
-
const O =
|
|
167
|
-
(
|
|
168
|
-
storeId:
|
|
161
|
+
$id: n,
|
|
162
|
+
$onAction: Ae.bind(null, R),
|
|
163
|
+
$patch: I,
|
|
164
|
+
$reset: N,
|
|
165
|
+
$subscribe(l, u = {}) {
|
|
166
|
+
const O = Ae(w, l, u.detached, () => m()), m = i.run(() => H(() => r.state.value[n], (f) => {
|
|
167
|
+
(u.flush === "sync" ? g : h) && l({
|
|
168
|
+
storeId: n,
|
|
169
169
|
type: ie.direct,
|
|
170
|
-
events:
|
|
170
|
+
events: $
|
|
171
171
|
}, f);
|
|
172
|
-
},
|
|
172
|
+
}, W({}, c, u)));
|
|
173
173
|
return O;
|
|
174
174
|
},
|
|
175
175
|
$dispose: S
|
|
176
|
-
},
|
|
176
|
+
}, v = Ee(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && Q ? W(
|
|
177
177
|
{
|
|
178
178
|
_hmrPayload: E,
|
|
179
|
-
_customProperties:
|
|
179
|
+
_customProperties: oe(/* @__PURE__ */ new Set())
|
|
180
180
|
// devtools custom properties
|
|
181
181
|
},
|
|
182
|
-
|
|
182
|
+
_
|
|
183
183
|
// must be added later
|
|
184
184
|
// setupStore
|
|
185
|
-
) :
|
|
186
|
-
r._s.set(
|
|
187
|
-
const
|
|
188
|
-
for (const
|
|
189
|
-
const
|
|
190
|
-
if (re(
|
|
191
|
-
process.env.NODE_ENV !== "production" &&
|
|
192
|
-
else if (typeof
|
|
193
|
-
const O = process.env.NODE_ENV !== "production" &&
|
|
194
|
-
|
|
195
|
-
} else process.env.NODE_ENV !== "production" &&
|
|
185
|
+
) : _);
|
|
186
|
+
r._s.set(n, v);
|
|
187
|
+
const V = (r._a && r._a.runWithContext || Qe)(() => r._e.run(() => (i = Je()).run(() => e({ action: D }))));
|
|
188
|
+
for (const l in V) {
|
|
189
|
+
const u = V[l];
|
|
190
|
+
if (re(u) && !Ie(u) || ye(u))
|
|
191
|
+
process.env.NODE_ENV !== "production" && o ? L.value[l] = se(V, l) : s || (T && et(u) && (re(u) ? u.value = T[l] : Re(u, T[l])), r.state.value[n][l] = u), process.env.NODE_ENV !== "production" && E.state.push(l);
|
|
192
|
+
else if (typeof u == "function") {
|
|
193
|
+
const O = process.env.NODE_ENV !== "production" && o ? u : D(u, l);
|
|
194
|
+
V[l] = O, process.env.NODE_ENV !== "production" && (E.actions[l] = u), a.actions[l] = u;
|
|
195
|
+
} else process.env.NODE_ENV !== "production" && Ie(u) && (E.getters[l] = s ? (
|
|
196
196
|
// @ts-expect-error
|
|
197
|
-
t.getters[
|
|
198
|
-
) :
|
|
199
|
-
(
|
|
200
|
-
}
|
|
201
|
-
if (
|
|
202
|
-
get: () => process.env.NODE_ENV !== "production" &&
|
|
203
|
-
set: (
|
|
204
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
197
|
+
t.getters[l]
|
|
198
|
+
) : u, Q && (V._getters || // @ts-expect-error: same
|
|
199
|
+
(V._getters = oe([]))).push(l));
|
|
200
|
+
}
|
|
201
|
+
if (W(v, V), W(Le(v), V), Object.defineProperty(v, "$state", {
|
|
202
|
+
get: () => process.env.NODE_ENV !== "production" && o ? L.value : r.state.value[n],
|
|
203
|
+
set: (l) => {
|
|
204
|
+
if (process.env.NODE_ENV !== "production" && o)
|
|
205
205
|
throw new Error("cannot set hotState");
|
|
206
|
-
|
|
207
|
-
|
|
206
|
+
I((u) => {
|
|
207
|
+
W(u, l);
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
|
-
}), process.env.NODE_ENV !== "production" && (
|
|
211
|
-
|
|
212
|
-
if (
|
|
213
|
-
const O =
|
|
214
|
-
typeof O == "object" &&
|
|
210
|
+
}), process.env.NODE_ENV !== "production" && (v._hotUpdate = oe((l) => {
|
|
211
|
+
v._hotUpdating = !0, l._hmrPayload.state.forEach((u) => {
|
|
212
|
+
if (u in v.$state) {
|
|
213
|
+
const O = l.$state[u], m = v.$state[u];
|
|
214
|
+
typeof O == "object" && G(O) && G(m) ? Be(O, m) : l.$state[u] = m;
|
|
215
215
|
}
|
|
216
|
-
|
|
217
|
-
}), Object.keys(
|
|
218
|
-
|
|
219
|
-
}), h = !1,
|
|
216
|
+
v[u] = se(l.$state, u);
|
|
217
|
+
}), Object.keys(v.$state).forEach((u) => {
|
|
218
|
+
u in l.$state || delete v[u];
|
|
219
|
+
}), h = !1, g = !1, r.state.value[n] = se(l._hmrPayload, "hotState"), g = !0, le().then(() => {
|
|
220
220
|
h = !0;
|
|
221
221
|
});
|
|
222
|
-
for (const
|
|
223
|
-
const O = u
|
|
224
|
-
|
|
225
|
-
|
|
222
|
+
for (const u in l._hmrPayload.actions) {
|
|
223
|
+
const O = l[u];
|
|
224
|
+
v[u] = //
|
|
225
|
+
D(O, u);
|
|
226
226
|
}
|
|
227
|
-
for (const
|
|
228
|
-
const O =
|
|
227
|
+
for (const u in l._hmrPayload.getters) {
|
|
228
|
+
const O = l._hmrPayload.getters[u], m = s ? (
|
|
229
229
|
// special handling of options api
|
|
230
|
-
B(() => (ge(r), O.call(
|
|
230
|
+
B(() => (ge(r), O.call(v, v)))
|
|
231
231
|
) : O;
|
|
232
|
-
|
|
233
|
-
|
|
232
|
+
v[u] = //
|
|
233
|
+
m;
|
|
234
234
|
}
|
|
235
|
-
Object.keys(
|
|
236
|
-
|
|
237
|
-
}), Object.keys(
|
|
238
|
-
|
|
239
|
-
}),
|
|
235
|
+
Object.keys(v._hmrPayload.getters).forEach((u) => {
|
|
236
|
+
u in l._hmrPayload.getters || delete v[u];
|
|
237
|
+
}), Object.keys(v._hmrPayload.actions).forEach((u) => {
|
|
238
|
+
u in l._hmrPayload.actions || delete v[u];
|
|
239
|
+
}), v._hmrPayload = l._hmrPayload, v._getters = l._getters, v._hotUpdating = !1;
|
|
240
240
|
})), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && Q) {
|
|
241
|
-
const
|
|
241
|
+
const l = {
|
|
242
242
|
writable: !0,
|
|
243
243
|
configurable: !0,
|
|
244
244
|
// avoid warning on devtools trying to display this property
|
|
245
245
|
enumerable: !1
|
|
246
246
|
};
|
|
247
|
-
["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((
|
|
248
|
-
Object.defineProperty(
|
|
247
|
+
["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((u) => {
|
|
248
|
+
Object.defineProperty(v, u, W({ value: v[u] }, l));
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
|
-
return r._p.forEach((
|
|
251
|
+
return r._p.forEach((l) => {
|
|
252
252
|
if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && Q) {
|
|
253
|
-
const
|
|
254
|
-
store:
|
|
253
|
+
const u = i.run(() => l({
|
|
254
|
+
store: v,
|
|
255
255
|
app: r._a,
|
|
256
256
|
pinia: r,
|
|
257
257
|
options: a
|
|
258
258
|
}));
|
|
259
|
-
Object.keys(
|
|
259
|
+
Object.keys(u || {}).forEach((O) => v._customProperties.add(O)), W(v, u);
|
|
260
260
|
} else
|
|
261
|
-
|
|
262
|
-
store:
|
|
261
|
+
W(v, i.run(() => l({
|
|
262
|
+
store: v,
|
|
263
263
|
app: r._a,
|
|
264
264
|
pinia: r,
|
|
265
265
|
options: a
|
|
266
266
|
})));
|
|
267
|
-
}), process.env.NODE_ENV !== "production" &&
|
|
267
|
+
}), process.env.NODE_ENV !== "production" && v.$state && typeof v.$state == "object" && typeof v.$state.constructor == "function" && !v.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be
|
|
268
268
|
state: () => new MyClass()
|
|
269
|
-
Found in store "${
|
|
269
|
+
Found in store "${v.$id}".`), T && s && t.hydrate && t.hydrate(v.$state, T), h = !0, g = !0, v;
|
|
270
270
|
}
|
|
271
271
|
// @__NO_SIDE_EFFECTS__
|
|
272
|
-
function tt(
|
|
272
|
+
function tt(n, e, t) {
|
|
273
273
|
let r;
|
|
274
|
-
const
|
|
275
|
-
r =
|
|
274
|
+
const o = typeof e == "function";
|
|
275
|
+
r = o ? t : e;
|
|
276
276
|
function s(i, a) {
|
|
277
277
|
const c = we();
|
|
278
278
|
if (i = // in test mode, ignore the argument provided as we can always retrieve a
|
|
@@ -281,96 +281,96 @@ function tt(o, e, t) {
|
|
|
281
281
|
throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
|
|
282
282
|
See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
|
|
283
283
|
This will fail in production.`);
|
|
284
|
-
i = K, i._s.has(
|
|
285
|
-
const h = i._s.get(
|
|
284
|
+
i = K, i._s.has(n) || (o ? Ne(n, e, r, i) : De(n, r, i), process.env.NODE_ENV !== "production" && (s._pinia = i));
|
|
285
|
+
const h = i._s.get(n);
|
|
286
286
|
if (process.env.NODE_ENV !== "production" && a) {
|
|
287
|
-
const
|
|
288
|
-
a._hotUpdate(w), delete i.state.value[
|
|
287
|
+
const g = "__hot:" + n, w = o ? Ne(g, e, r, i, !0) : De(g, W({}, r), i, !0);
|
|
288
|
+
a._hotUpdate(w), delete i.state.value[g], i._s.delete(g);
|
|
289
289
|
}
|
|
290
290
|
if (process.env.NODE_ENV !== "production" && Q) {
|
|
291
|
-
const
|
|
292
|
-
if (
|
|
291
|
+
const g = Fe();
|
|
292
|
+
if (g && g.proxy && // avoid adding stores that are just built for hot module replacement
|
|
293
293
|
!a) {
|
|
294
|
-
const w =
|
|
295
|
-
|
|
294
|
+
const w = g.proxy, R = "_pStores" in w ? w._pStores : w._pStores = {};
|
|
295
|
+
R[n] = h;
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
return h;
|
|
299
299
|
}
|
|
300
|
-
return s.$id =
|
|
300
|
+
return s.$id = n, s;
|
|
301
301
|
}
|
|
302
|
-
function
|
|
303
|
-
const e =
|
|
302
|
+
function We(n) {
|
|
303
|
+
const e = Le(n), t = {};
|
|
304
304
|
for (const r in e) {
|
|
305
|
-
const
|
|
306
|
-
|
|
305
|
+
const o = e[r];
|
|
306
|
+
o.effect ? t[r] = // ...
|
|
307
307
|
B({
|
|
308
|
-
get: () =>
|
|
308
|
+
get: () => n[r],
|
|
309
309
|
set(s) {
|
|
310
|
-
|
|
310
|
+
n[r] = s;
|
|
311
311
|
}
|
|
312
|
-
}) : (re(
|
|
313
|
-
se(
|
|
312
|
+
}) : (re(o) || ye(o)) && (t[r] = // ---
|
|
313
|
+
se(n, r));
|
|
314
314
|
}
|
|
315
315
|
return t;
|
|
316
316
|
}
|
|
317
317
|
const rt = typeof window < "u" && typeof document < "u";
|
|
318
318
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
319
|
-
const
|
|
319
|
+
const nt = Object.prototype.toString, ot = (n) => nt.call(n) === "[object Object]", Ue = () => {
|
|
320
320
|
};
|
|
321
|
-
function st(...
|
|
322
|
-
if (
|
|
323
|
-
const e =
|
|
324
|
-
return typeof e == "function" ?
|
|
321
|
+
function st(...n) {
|
|
322
|
+
if (n.length !== 1) return se(...n);
|
|
323
|
+
const e = n[0];
|
|
324
|
+
return typeof e == "function" ? Me(Ge(() => ({
|
|
325
325
|
get: e,
|
|
326
|
-
set:
|
|
327
|
-
}))) :
|
|
326
|
+
set: Ue
|
|
327
|
+
}))) : M(e);
|
|
328
328
|
}
|
|
329
|
-
function it(
|
|
329
|
+
function it(n, e) {
|
|
330
330
|
function t(...r) {
|
|
331
|
-
return new Promise((
|
|
332
|
-
Promise.resolve(
|
|
331
|
+
return new Promise((o, s) => {
|
|
332
|
+
Promise.resolve(n(() => e.apply(this, r), {
|
|
333
333
|
fn: e,
|
|
334
334
|
thisArg: this,
|
|
335
335
|
args: r
|
|
336
|
-
})).then(
|
|
336
|
+
})).then(o).catch(s);
|
|
337
337
|
});
|
|
338
338
|
}
|
|
339
339
|
return t;
|
|
340
340
|
}
|
|
341
|
-
const ze = (
|
|
342
|
-
function at(
|
|
341
|
+
const ze = (n) => n();
|
|
342
|
+
function at(n = ze, e = {}) {
|
|
343
343
|
const { initialState: t = "active" } = e, r = st(t === "active");
|
|
344
|
-
function
|
|
344
|
+
function o() {
|
|
345
345
|
r.value = !1;
|
|
346
346
|
}
|
|
347
347
|
function s() {
|
|
348
348
|
r.value = !0;
|
|
349
349
|
}
|
|
350
350
|
const i = (...a) => {
|
|
351
|
-
r.value &&
|
|
351
|
+
r.value && n(...a);
|
|
352
352
|
};
|
|
353
353
|
return {
|
|
354
|
-
isActive:
|
|
355
|
-
pause:
|
|
354
|
+
isActive: Me(r),
|
|
355
|
+
pause: o,
|
|
356
356
|
resume: s,
|
|
357
357
|
eventFilter: i
|
|
358
358
|
};
|
|
359
359
|
}
|
|
360
|
-
function
|
|
361
|
-
return Array.isArray(
|
|
360
|
+
function be(n) {
|
|
361
|
+
return Array.isArray(n) ? n : [n];
|
|
362
362
|
}
|
|
363
|
-
function ct(
|
|
364
|
-
return
|
|
363
|
+
function ct(n) {
|
|
364
|
+
return Fe();
|
|
365
365
|
}
|
|
366
|
-
function
|
|
367
|
-
const { eventFilter: r = ze, ...
|
|
368
|
-
return H(
|
|
366
|
+
function lt(n, e, t = {}) {
|
|
367
|
+
const { eventFilter: r = ze, ...o } = t;
|
|
368
|
+
return H(n, it(r, e), o);
|
|
369
369
|
}
|
|
370
|
-
function
|
|
371
|
-
const { eventFilter: r, initialState:
|
|
370
|
+
function ut(n, e, t = {}) {
|
|
371
|
+
const { eventFilter: r, initialState: o = "active", ...s } = t, { eventFilter: i, pause: a, resume: c, isActive: h } = at(r, { initialState: o });
|
|
372
372
|
return {
|
|
373
|
-
stop:
|
|
373
|
+
stop: lt(n, e, {
|
|
374
374
|
...s,
|
|
375
375
|
eventFilter: i
|
|
376
376
|
}),
|
|
@@ -379,48 +379,48 @@ function lt(o, e, t = {}) {
|
|
|
379
379
|
isActive: h
|
|
380
380
|
};
|
|
381
381
|
}
|
|
382
|
-
const ft =
|
|
383
|
-
function dt(
|
|
384
|
-
ct() ?
|
|
382
|
+
const ft = ut;
|
|
383
|
+
function dt(n, e = !0, t) {
|
|
384
|
+
ct() ? Ve(n, t) : e ? n() : le(n);
|
|
385
385
|
}
|
|
386
|
-
function pt(
|
|
387
|
-
return H(
|
|
386
|
+
function pt(n, e, t) {
|
|
387
|
+
return H(n, e, {
|
|
388
388
|
...t,
|
|
389
389
|
immediate: !0
|
|
390
390
|
});
|
|
391
391
|
}
|
|
392
|
-
function
|
|
393
|
-
return H(
|
|
394
|
-
|
|
392
|
+
function ne(n, e, t) {
|
|
393
|
+
return H(n, (o, s, i) => {
|
|
394
|
+
o && e(o, s, i);
|
|
395
395
|
}, {
|
|
396
396
|
...t,
|
|
397
397
|
once: !1
|
|
398
398
|
});
|
|
399
399
|
}
|
|
400
400
|
const Z = rt ? window : void 0;
|
|
401
|
-
function ht(
|
|
401
|
+
function ht(n) {
|
|
402
402
|
var e;
|
|
403
|
-
const t =
|
|
403
|
+
const t = q(n);
|
|
404
404
|
return (e = t?.$el) !== null && e !== void 0 ? e : t;
|
|
405
405
|
}
|
|
406
|
-
function X(...
|
|
407
|
-
const e = (r,
|
|
408
|
-
const r =
|
|
409
|
-
return r.every((
|
|
406
|
+
function X(...n) {
|
|
407
|
+
const e = (r, o, s, i) => (r.addEventListener(o, s, i), () => r.removeEventListener(o, s, i)), t = B(() => {
|
|
408
|
+
const r = be(q(n[0])).filter((o) => o != null);
|
|
409
|
+
return r.every((o) => typeof o != "string") ? r : void 0;
|
|
410
410
|
});
|
|
411
411
|
return pt(() => {
|
|
412
|
-
var r,
|
|
412
|
+
var r, o;
|
|
413
413
|
return [
|
|
414
|
-
(r = (
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
414
|
+
(r = (o = t.value) === null || o === void 0 ? void 0 : o.map((s) => ht(s))) !== null && r !== void 0 ? r : [Z].filter((s) => s != null),
|
|
415
|
+
be(q(t.value ? n[1] : n[0])),
|
|
416
|
+
be(Ye(t.value ? n[2] : n[1])),
|
|
417
|
+
q(t.value ? n[3] : n[2])
|
|
418
418
|
];
|
|
419
|
-
}, ([r,
|
|
420
|
-
if (!r?.length || !
|
|
421
|
-
const h =
|
|
419
|
+
}, ([r, o, s, i], a, c) => {
|
|
420
|
+
if (!r?.length || !o?.length || !s?.length) return;
|
|
421
|
+
const h = ot(i) ? { ...i } : i, g = r.flatMap((w) => o.flatMap((R) => s.map(($) => e(w, R, $, h))));
|
|
422
422
|
c(() => {
|
|
423
|
-
|
|
423
|
+
g.forEach((w) => w());
|
|
424
424
|
});
|
|
425
425
|
}, { flush: "post" });
|
|
426
426
|
}
|
|
@@ -428,135 +428,135 @@ const fe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window :
|
|
|
428
428
|
function vt() {
|
|
429
429
|
return de in fe || (fe[de] = fe[de] || {}), fe[de];
|
|
430
430
|
}
|
|
431
|
-
function yt(
|
|
432
|
-
return gt[
|
|
431
|
+
function yt(n, e) {
|
|
432
|
+
return gt[n] || e;
|
|
433
433
|
}
|
|
434
|
-
function mt(
|
|
435
|
-
return
|
|
434
|
+
function mt(n) {
|
|
435
|
+
return n == null ? "any" : n instanceof Set ? "set" : n instanceof Map ? "map" : n instanceof Date ? "date" : typeof n == "boolean" ? "boolean" : typeof n == "string" ? "string" : typeof n == "object" ? "object" : Number.isNaN(n) ? "any" : "number";
|
|
436
436
|
}
|
|
437
|
-
const
|
|
437
|
+
const bt = {
|
|
438
438
|
boolean: {
|
|
439
|
-
read: (
|
|
440
|
-
write: (
|
|
439
|
+
read: (n) => n === "true",
|
|
440
|
+
write: (n) => String(n)
|
|
441
441
|
},
|
|
442
442
|
object: {
|
|
443
|
-
read: (
|
|
444
|
-
write: (
|
|
443
|
+
read: (n) => JSON.parse(n),
|
|
444
|
+
write: (n) => JSON.stringify(n)
|
|
445
445
|
},
|
|
446
446
|
number: {
|
|
447
|
-
read: (
|
|
448
|
-
write: (
|
|
447
|
+
read: (n) => Number.parseFloat(n),
|
|
448
|
+
write: (n) => String(n)
|
|
449
449
|
},
|
|
450
450
|
any: {
|
|
451
|
-
read: (
|
|
452
|
-
write: (
|
|
451
|
+
read: (n) => n,
|
|
452
|
+
write: (n) => String(n)
|
|
453
453
|
},
|
|
454
454
|
string: {
|
|
455
|
-
read: (
|
|
456
|
-
write: (
|
|
455
|
+
read: (n) => n,
|
|
456
|
+
write: (n) => String(n)
|
|
457
457
|
},
|
|
458
458
|
map: {
|
|
459
|
-
read: (
|
|
460
|
-
write: (
|
|
459
|
+
read: (n) => new Map(JSON.parse(n)),
|
|
460
|
+
write: (n) => JSON.stringify(Array.from(n.entries()))
|
|
461
461
|
},
|
|
462
462
|
set: {
|
|
463
|
-
read: (
|
|
464
|
-
write: (
|
|
463
|
+
read: (n) => new Set(JSON.parse(n)),
|
|
464
|
+
write: (n) => JSON.stringify(Array.from(n))
|
|
465
465
|
},
|
|
466
466
|
date: {
|
|
467
|
-
read: (
|
|
468
|
-
write: (
|
|
467
|
+
read: (n) => new Date(n),
|
|
468
|
+
write: (n) => n.toISOString()
|
|
469
469
|
}
|
|
470
|
-
},
|
|
471
|
-
function
|
|
472
|
-
var
|
|
473
|
-
const { flush: s = "pre", deep: i = !0, listenToStorageChanges: a = !0, writeDefaults: c = !0, mergeDefaults: h = !1, shallow:
|
|
470
|
+
}, Te = "vueuse-storage";
|
|
471
|
+
function St(n, e, t, r = {}) {
|
|
472
|
+
var o;
|
|
473
|
+
const { flush: s = "pre", deep: i = !0, listenToStorageChanges: a = !0, writeDefaults: c = !0, mergeDefaults: h = !1, shallow: g, window: w = Z, eventFilter: R, onError: $ = (f) => {
|
|
474
474
|
console.error(f);
|
|
475
|
-
}, initOnMounted:
|
|
475
|
+
}, initOnMounted: T } = r, L = (g ? xe : M)(e), P = B(() => q(n));
|
|
476
476
|
if (!t) try {
|
|
477
477
|
t = yt("getDefaultStorage", () => Z?.localStorage)();
|
|
478
478
|
} catch (f) {
|
|
479
|
-
|
|
479
|
+
$(f);
|
|
480
480
|
}
|
|
481
|
-
if (!t) return
|
|
482
|
-
const
|
|
481
|
+
if (!t) return L;
|
|
482
|
+
const I = q(e), N = mt(I), S = (o = r.serializer) !== null && o !== void 0 ? o : bt[N], { pause: D, resume: E } = ft(L, (f) => l(f), {
|
|
483
483
|
flush: s,
|
|
484
484
|
deep: i,
|
|
485
|
-
eventFilter:
|
|
485
|
+
eventFilter: R
|
|
486
486
|
});
|
|
487
|
-
H(
|
|
488
|
-
let
|
|
489
|
-
const
|
|
490
|
-
|
|
487
|
+
H(P, () => O(), { flush: s });
|
|
488
|
+
let _ = !1;
|
|
489
|
+
const v = (f) => {
|
|
490
|
+
T && !_ || O(f);
|
|
491
491
|
}, x = (f) => {
|
|
492
|
-
|
|
492
|
+
T && !_ || m(f);
|
|
493
493
|
};
|
|
494
|
-
w && a && (t instanceof Storage ? X(w, "storage",
|
|
495
|
-
|
|
494
|
+
w && a && (t instanceof Storage ? X(w, "storage", v, { passive: !0 }) : X(w, Te, x)), T ? dt(() => {
|
|
495
|
+
_ = !0, O();
|
|
496
496
|
}) : O();
|
|
497
|
-
function
|
|
497
|
+
function V(f, b) {
|
|
498
498
|
if (w) {
|
|
499
|
-
const
|
|
500
|
-
key:
|
|
499
|
+
const A = {
|
|
500
|
+
key: P.value,
|
|
501
501
|
oldValue: f,
|
|
502
|
-
newValue:
|
|
502
|
+
newValue: b,
|
|
503
503
|
storageArea: t
|
|
504
504
|
};
|
|
505
|
-
w.dispatchEvent(t instanceof Storage ? new StorageEvent("storage",
|
|
505
|
+
w.dispatchEvent(t instanceof Storage ? new StorageEvent("storage", A) : new CustomEvent(Te, { detail: A }));
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
|
-
function
|
|
508
|
+
function l(f) {
|
|
509
509
|
try {
|
|
510
|
-
const
|
|
510
|
+
const b = t.getItem(P.value);
|
|
511
511
|
if (f == null)
|
|
512
|
-
|
|
512
|
+
V(b, null), t.removeItem(P.value);
|
|
513
513
|
else {
|
|
514
|
-
const
|
|
515
|
-
|
|
514
|
+
const A = S.write(f);
|
|
515
|
+
b !== A && (t.setItem(P.value, A), V(b, A));
|
|
516
516
|
}
|
|
517
|
-
} catch (
|
|
518
|
-
|
|
517
|
+
} catch (b) {
|
|
518
|
+
$(b);
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
-
function
|
|
522
|
-
const
|
|
523
|
-
if (
|
|
524
|
-
return c &&
|
|
521
|
+
function u(f) {
|
|
522
|
+
const b = f ? f.newValue : t.getItem(P.value);
|
|
523
|
+
if (b == null)
|
|
524
|
+
return c && I != null && t.setItem(P.value, S.write(I)), I;
|
|
525
525
|
if (!f && h) {
|
|
526
|
-
const
|
|
527
|
-
return typeof h == "function" ? h(
|
|
528
|
-
|
|
529
|
-
...
|
|
530
|
-
} :
|
|
531
|
-
} else return typeof
|
|
526
|
+
const A = S.read(b);
|
|
527
|
+
return typeof h == "function" ? h(A, I) : N === "object" && !Array.isArray(A) ? {
|
|
528
|
+
...I,
|
|
529
|
+
...A
|
|
530
|
+
} : A;
|
|
531
|
+
} else return typeof b != "string" ? b : S.read(b);
|
|
532
532
|
}
|
|
533
533
|
function O(f) {
|
|
534
534
|
if (!(f && f.storageArea !== t)) {
|
|
535
535
|
if (f && f.key == null) {
|
|
536
|
-
|
|
536
|
+
L.value = I;
|
|
537
537
|
return;
|
|
538
538
|
}
|
|
539
|
-
if (!(f && f.key !==
|
|
540
|
-
|
|
539
|
+
if (!(f && f.key !== P.value)) {
|
|
540
|
+
D();
|
|
541
541
|
try {
|
|
542
|
-
const
|
|
543
|
-
(f === void 0 || f?.newValue !==
|
|
544
|
-
} catch (
|
|
545
|
-
|
|
542
|
+
const b = S.write(L.value);
|
|
543
|
+
(f === void 0 || f?.newValue !== b) && (L.value = u(f));
|
|
544
|
+
} catch (b) {
|
|
545
|
+
$(b);
|
|
546
546
|
} finally {
|
|
547
|
-
f ?
|
|
547
|
+
f ? le(E) : E();
|
|
548
548
|
}
|
|
549
549
|
}
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
|
-
function
|
|
552
|
+
function m(f) {
|
|
553
553
|
O(f.detail);
|
|
554
554
|
}
|
|
555
|
-
return
|
|
555
|
+
return L;
|
|
556
556
|
}
|
|
557
|
-
function wt(
|
|
557
|
+
function wt(n, e, t = {}) {
|
|
558
558
|
const { window: r = Z } = t;
|
|
559
|
-
return
|
|
559
|
+
return St(n, e, r?.localStorage, t);
|
|
560
560
|
}
|
|
561
561
|
const Et = {
|
|
562
562
|
ctrl: "control",
|
|
@@ -568,143 +568,143 @@ const Et = {
|
|
|
568
568
|
left: "arrowleft",
|
|
569
569
|
right: "arrowright"
|
|
570
570
|
};
|
|
571
|
-
function Ot(
|
|
572
|
-
const { reactive: e = !1, target: t = Z, aliasMap: r = Et, passive:
|
|
571
|
+
function Ot(n = {}) {
|
|
572
|
+
const { reactive: e = !1, target: t = Z, aliasMap: r = Et, passive: o = !0, onEventFired: s = Ue } = n, i = Ee(/* @__PURE__ */ new Set()), a = {
|
|
573
573
|
toJSON() {
|
|
574
574
|
return {};
|
|
575
575
|
},
|
|
576
576
|
current: i
|
|
577
|
-
}, c = e ? Ee(a) : a, h = /* @__PURE__ */ new Set(),
|
|
577
|
+
}, c = e ? Ee(a) : a, h = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Map([
|
|
578
578
|
["Meta", h],
|
|
579
579
|
["Shift", /* @__PURE__ */ new Set()],
|
|
580
580
|
["Alt", /* @__PURE__ */ new Set()]
|
|
581
581
|
]), w = /* @__PURE__ */ new Set();
|
|
582
|
-
function
|
|
583
|
-
|
|
582
|
+
function R(N, S) {
|
|
583
|
+
N in c && (e ? c[N] = S : c[N].value = S);
|
|
584
584
|
}
|
|
585
|
-
function
|
|
585
|
+
function $() {
|
|
586
586
|
i.clear();
|
|
587
|
-
for (const
|
|
587
|
+
for (const N of w) R(N, !1);
|
|
588
588
|
}
|
|
589
|
-
function
|
|
590
|
-
if (!(!
|
|
591
|
-
for (const [E,
|
|
592
|
-
|
|
589
|
+
function T(N, S, D) {
|
|
590
|
+
if (!(!N || typeof S.getModifierState != "function")) {
|
|
591
|
+
for (const [E, _] of g) if (S.getModifierState(E)) {
|
|
592
|
+
D.forEach((v) => _.add(v));
|
|
593
593
|
break;
|
|
594
594
|
}
|
|
595
595
|
}
|
|
596
596
|
}
|
|
597
|
-
function
|
|
598
|
-
if (
|
|
599
|
-
const
|
|
597
|
+
function L(N, S) {
|
|
598
|
+
if (N) return;
|
|
599
|
+
const D = `${S[0].toUpperCase()}${S.slice(1)}`, E = g.get(D);
|
|
600
600
|
if (!["shift", "alt"].includes(S) || !E) return;
|
|
601
|
-
const
|
|
602
|
-
|
|
603
|
-
|
|
601
|
+
const _ = Array.from(E), v = _.indexOf(S);
|
|
602
|
+
_.forEach((x, V) => {
|
|
603
|
+
V >= v && (i.delete(x), R(x, !1));
|
|
604
604
|
}), E.clear();
|
|
605
605
|
}
|
|
606
|
-
function
|
|
607
|
-
var
|
|
608
|
-
const
|
|
609
|
-
if (
|
|
610
|
-
|
|
611
|
-
for (const x of
|
|
612
|
-
w.add(x),
|
|
613
|
-
|
|
614
|
-
i.delete(x),
|
|
606
|
+
function P(N, S) {
|
|
607
|
+
var D, E;
|
|
608
|
+
const _ = (D = N.key) === null || D === void 0 ? void 0 : D.toLowerCase(), v = [(E = N.code) === null || E === void 0 ? void 0 : E.toLowerCase(), _].filter(Boolean);
|
|
609
|
+
if (_ !== "") {
|
|
610
|
+
_ && (S ? i.add(_) : i.delete(_));
|
|
611
|
+
for (const x of v)
|
|
612
|
+
w.add(x), R(x, S);
|
|
613
|
+
T(S, N, [...i, ...v]), L(S, _), _ === "meta" && !S && (h.forEach((x) => {
|
|
614
|
+
i.delete(x), R(x, !1);
|
|
615
615
|
}), h.clear());
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
|
-
X(t, "keydown", (
|
|
619
|
-
const
|
|
620
|
-
if (typeof S != "string") return Reflect.get(
|
|
618
|
+
X(t, "keydown", (N) => (P(N, !0), s(N)), { passive: o }), X(t, "keyup", (N) => (P(N, !1), s(N)), { passive: o }), X("blur", $, { passive: o }), X("focus", $, { passive: o });
|
|
619
|
+
const I = new Proxy(c, { get(N, S, D) {
|
|
620
|
+
if (typeof S != "string") return Reflect.get(N, S, D);
|
|
621
621
|
if (S = S.toLowerCase(), S in r && (S = r[S]), !(S in c)) if (/[+_-]/.test(S)) {
|
|
622
|
-
const
|
|
623
|
-
c[S] = B(() =>
|
|
622
|
+
const _ = S.split(/[+_-]/g).map((v) => v.trim());
|
|
623
|
+
c[S] = B(() => _.map((v) => q(I[v])).every(Boolean));
|
|
624
624
|
} else c[S] = xe(!1);
|
|
625
|
-
const E = Reflect.get(
|
|
626
|
-
return e ?
|
|
625
|
+
const E = Reflect.get(N, S, D);
|
|
626
|
+
return e ? q(E) : E;
|
|
627
627
|
} });
|
|
628
|
-
return
|
|
628
|
+
return I;
|
|
629
629
|
}
|
|
630
|
-
function
|
|
630
|
+
function Se() {
|
|
631
631
|
return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
632
632
|
}
|
|
633
|
-
function pe(
|
|
633
|
+
function pe(n) {
|
|
634
634
|
const e = {
|
|
635
|
-
type:
|
|
636
|
-
clientId:
|
|
637
|
-
timestamp:
|
|
635
|
+
type: n.type,
|
|
636
|
+
clientId: n.clientId,
|
|
637
|
+
timestamp: n.timestamp.toISOString()
|
|
638
638
|
};
|
|
639
|
-
return
|
|
640
|
-
...
|
|
641
|
-
timestamp:
|
|
642
|
-
}),
|
|
639
|
+
return n.operation && (e.operation = {
|
|
640
|
+
...n.operation,
|
|
641
|
+
timestamp: n.operation.timestamp.toISOString()
|
|
642
|
+
}), n.operations && (e.operations = n.operations.map((t) => ({
|
|
643
643
|
...t,
|
|
644
644
|
timestamp: t.timestamp.toISOString()
|
|
645
645
|
}))), e;
|
|
646
646
|
}
|
|
647
|
-
function Rt(
|
|
647
|
+
function Rt(n) {
|
|
648
648
|
const e = {
|
|
649
|
-
type:
|
|
650
|
-
clientId:
|
|
651
|
-
timestamp: new Date(
|
|
649
|
+
type: n.type,
|
|
650
|
+
clientId: n.clientId,
|
|
651
|
+
timestamp: new Date(n.timestamp)
|
|
652
652
|
};
|
|
653
|
-
return
|
|
654
|
-
...
|
|
655
|
-
timestamp: new Date(
|
|
656
|
-
}),
|
|
653
|
+
return n.operation && (e.operation = {
|
|
654
|
+
...n.operation,
|
|
655
|
+
timestamp: new Date(n.operation.timestamp)
|
|
656
|
+
}), n.operations && (e.operations = n.operations.map((t) => ({
|
|
657
657
|
...t,
|
|
658
658
|
timestamp: new Date(t.timestamp)
|
|
659
659
|
}))), e;
|
|
660
660
|
}
|
|
661
|
-
const
|
|
662
|
-
const
|
|
661
|
+
const ue = /* @__PURE__ */ tt("hst-operation-log", () => {
|
|
662
|
+
const n = M({
|
|
663
663
|
maxOperations: 100,
|
|
664
664
|
enableCrossTabSync: !0,
|
|
665
665
|
autoSyncInterval: 3e4,
|
|
666
666
|
enablePersistence: !1,
|
|
667
667
|
persistenceKeyPrefix: "stonecrop-ops"
|
|
668
|
-
}), e =
|
|
668
|
+
}), e = M([]), t = M(-1), r = M(Se()), o = M(!1), s = M([]), i = M(null), a = B(() => t.value < 0 ? !1 : e.value[t.value]?.reversible ?? !1), c = B(() => t.value < e.value.length - 1), h = B(() => {
|
|
669
669
|
let d = 0;
|
|
670
670
|
for (let p = t.value; p >= 0 && e.value[p]?.reversible; p--)
|
|
671
671
|
d++;
|
|
672
672
|
return d;
|
|
673
|
-
}),
|
|
673
|
+
}), g = B(() => e.value.length - 1 - t.value), w = B(() => ({
|
|
674
674
|
canUndo: a.value,
|
|
675
675
|
canRedo: c.value,
|
|
676
676
|
undoCount: h.value,
|
|
677
|
-
redoCount:
|
|
677
|
+
redoCount: g.value,
|
|
678
678
|
currentIndex: t.value
|
|
679
679
|
}));
|
|
680
|
-
function
|
|
681
|
-
|
|
680
|
+
function R(d) {
|
|
681
|
+
n.value = { ...n.value, ...d }, n.value.enablePersistence && (C(), k()), n.value.enableCrossTabSync && u();
|
|
682
682
|
}
|
|
683
|
-
function
|
|
684
|
-
const
|
|
683
|
+
function $(d, p = "user") {
|
|
684
|
+
const y = {
|
|
685
685
|
...d,
|
|
686
|
-
id:
|
|
686
|
+
id: Se(),
|
|
687
687
|
timestamp: /* @__PURE__ */ new Date(),
|
|
688
688
|
source: p,
|
|
689
|
-
userId:
|
|
689
|
+
userId: n.value.userId
|
|
690
690
|
};
|
|
691
|
-
if (
|
|
692
|
-
return
|
|
693
|
-
if (
|
|
694
|
-
return s.value.push(
|
|
695
|
-
if (t.value < e.value.length - 1 && (e.value = e.value.slice(0, t.value + 1)), e.value.push(
|
|
696
|
-
const
|
|
697
|
-
e.value = e.value.slice(
|
|
691
|
+
if (n.value.operationFilter && !n.value.operationFilter(y))
|
|
692
|
+
return y.id;
|
|
693
|
+
if (o.value)
|
|
694
|
+
return s.value.push(y), y.id;
|
|
695
|
+
if (t.value < e.value.length - 1 && (e.value = e.value.slice(0, t.value + 1)), e.value.push(y), t.value++, n.value.maxOperations && e.value.length > n.value.maxOperations) {
|
|
696
|
+
const F = e.value.length - n.value.maxOperations;
|
|
697
|
+
e.value = e.value.slice(F), t.value -= F;
|
|
698
698
|
}
|
|
699
|
-
return
|
|
699
|
+
return n.value.enableCrossTabSync && O(y), y.id;
|
|
700
700
|
}
|
|
701
|
-
function
|
|
702
|
-
|
|
701
|
+
function T() {
|
|
702
|
+
o.value = !0, s.value = [], i.value = Se();
|
|
703
703
|
}
|
|
704
|
-
function
|
|
705
|
-
if (!
|
|
706
|
-
return
|
|
707
|
-
const p = i.value,
|
|
704
|
+
function L(d) {
|
|
705
|
+
if (!o.value || s.value.length === 0)
|
|
706
|
+
return o.value = !1, s.value = [], i.value = null, null;
|
|
707
|
+
const p = i.value, y = s.value.every((U) => U.reversible), F = {
|
|
708
708
|
id: p,
|
|
709
709
|
type: "batch",
|
|
710
710
|
path: "",
|
|
@@ -715,150 +715,150 @@ const le = /* @__PURE__ */ tt("hst-operation-log", () => {
|
|
|
715
715
|
doctype: s.value[0]?.doctype || "",
|
|
716
716
|
timestamp: /* @__PURE__ */ new Date(),
|
|
717
717
|
source: "user",
|
|
718
|
-
reversible:
|
|
719
|
-
irreversibleReason:
|
|
720
|
-
childOperationIds: s.value.map((
|
|
718
|
+
reversible: y,
|
|
719
|
+
irreversibleReason: y ? void 0 : "Contains irreversible operations",
|
|
720
|
+
childOperationIds: s.value.map((U) => U.id),
|
|
721
721
|
metadata: { description: d }
|
|
722
722
|
};
|
|
723
|
-
s.value.forEach((
|
|
724
|
-
|
|
725
|
-
}), e.value.push(...s.value,
|
|
723
|
+
s.value.forEach((U) => {
|
|
724
|
+
U.parentOperationId = p;
|
|
725
|
+
}), e.value.push(...s.value, F), t.value = e.value.length - 1, n.value.enableCrossTabSync && m(s.value, F);
|
|
726
726
|
const z = p;
|
|
727
|
-
return
|
|
727
|
+
return o.value = !1, s.value = [], i.value = null, z;
|
|
728
728
|
}
|
|
729
|
-
function
|
|
730
|
-
|
|
729
|
+
function P() {
|
|
730
|
+
o.value = !1, s.value = [], i.value = null;
|
|
731
731
|
}
|
|
732
|
-
function
|
|
732
|
+
function I(d) {
|
|
733
733
|
if (!a.value) return !1;
|
|
734
734
|
const p = e.value[t.value];
|
|
735
735
|
if (!p.reversible)
|
|
736
736
|
return typeof console < "u" && p.irreversibleReason && console.warn("Cannot undo irreversible operation:", p.irreversibleReason), !1;
|
|
737
737
|
try {
|
|
738
738
|
if (p.type === "batch" && p.childOperationIds)
|
|
739
|
-
for (let
|
|
740
|
-
const
|
|
739
|
+
for (let y = p.childOperationIds.length - 1; y >= 0; y--) {
|
|
740
|
+
const F = p.childOperationIds[y], z = e.value.find((U) => U.id === F);
|
|
741
741
|
z && S(z, d);
|
|
742
742
|
}
|
|
743
743
|
else
|
|
744
744
|
S(p, d);
|
|
745
|
-
return t.value--,
|
|
746
|
-
} catch (
|
|
747
|
-
return typeof console < "u" && console.error("Undo failed:",
|
|
745
|
+
return t.value--, n.value.enableCrossTabSync && f(p), !0;
|
|
746
|
+
} catch (y) {
|
|
747
|
+
return typeof console < "u" && console.error("Undo failed:", y), !1;
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
|
-
function
|
|
750
|
+
function N(d) {
|
|
751
751
|
if (!c.value) return !1;
|
|
752
752
|
const p = e.value[t.value + 1];
|
|
753
753
|
try {
|
|
754
754
|
if (p.type === "batch" && p.childOperationIds)
|
|
755
|
-
for (const
|
|
756
|
-
const
|
|
757
|
-
|
|
755
|
+
for (const y of p.childOperationIds) {
|
|
756
|
+
const F = e.value.find((z) => z.id === y);
|
|
757
|
+
F && D(F, d);
|
|
758
758
|
}
|
|
759
759
|
else
|
|
760
|
-
|
|
761
|
-
return t.value++,
|
|
762
|
-
} catch (
|
|
763
|
-
return typeof console < "u" && console.error("Redo failed:",
|
|
760
|
+
D(p, d);
|
|
761
|
+
return t.value++, n.value.enableCrossTabSync && b(p), !0;
|
|
762
|
+
} catch (y) {
|
|
763
|
+
return typeof console < "u" && console.error("Redo failed:", y), !1;
|
|
764
764
|
}
|
|
765
765
|
}
|
|
766
766
|
function S(d, p) {
|
|
767
767
|
(d.type === "set" || d.type === "delete") && p && typeof p.set == "function" && p.set(d.path, d.beforeValue, "undo");
|
|
768
768
|
}
|
|
769
|
-
function
|
|
769
|
+
function D(d, p) {
|
|
770
770
|
(d.type === "set" || d.type === "delete") && p && typeof p.set == "function" && p.set(d.path, d.afterValue, "redo");
|
|
771
771
|
}
|
|
772
772
|
function E() {
|
|
773
|
-
const d = e.value.filter((
|
|
773
|
+
const d = e.value.filter((y) => y.reversible).length, p = e.value.map((y) => y.timestamp);
|
|
774
774
|
return {
|
|
775
775
|
operations: [...e.value],
|
|
776
776
|
currentIndex: t.value,
|
|
777
777
|
totalOperations: e.value.length,
|
|
778
778
|
reversibleOperations: d,
|
|
779
779
|
irreversibleOperations: e.value.length - d,
|
|
780
|
-
oldestOperation: p.length > 0 ? new Date(Math.min(...p.map((
|
|
781
|
-
newestOperation: p.length > 0 ? new Date(Math.max(...p.map((
|
|
780
|
+
oldestOperation: p.length > 0 ? new Date(Math.min(...p.map((y) => y.getTime()))) : void 0,
|
|
781
|
+
newestOperation: p.length > 0 ? new Date(Math.max(...p.map((y) => y.getTime()))) : void 0
|
|
782
782
|
};
|
|
783
783
|
}
|
|
784
|
-
function
|
|
784
|
+
function _() {
|
|
785
785
|
e.value = [], t.value = -1;
|
|
786
786
|
}
|
|
787
|
-
function
|
|
788
|
-
return e.value.filter((
|
|
787
|
+
function v(d, p) {
|
|
788
|
+
return e.value.filter((y) => y.doctype === d && (p === void 0 || y.recordId === p));
|
|
789
789
|
}
|
|
790
790
|
function x(d, p) {
|
|
791
|
-
const
|
|
792
|
-
|
|
791
|
+
const y = e.value.find((F) => F.id === d);
|
|
792
|
+
y && (y.reversible = !1, y.irreversibleReason = p);
|
|
793
793
|
}
|
|
794
|
-
function
|
|
795
|
-
const
|
|
794
|
+
function V(d, p, y, F = "success", z) {
|
|
795
|
+
const U = {
|
|
796
796
|
type: "action",
|
|
797
|
-
path:
|
|
797
|
+
path: y && y.length > 0 ? `${d}.${y[0]}` : d,
|
|
798
798
|
fieldname: "",
|
|
799
799
|
beforeValue: null,
|
|
800
800
|
afterValue: null,
|
|
801
801
|
doctype: d,
|
|
802
|
-
recordId:
|
|
802
|
+
recordId: y && y.length > 0 ? y[0] : void 0,
|
|
803
803
|
reversible: !1,
|
|
804
804
|
// Actions are typically not reversible
|
|
805
805
|
actionName: p,
|
|
806
|
-
actionRecordIds:
|
|
807
|
-
actionResult:
|
|
806
|
+
actionRecordIds: y,
|
|
807
|
+
actionResult: F,
|
|
808
808
|
actionError: z
|
|
809
809
|
};
|
|
810
|
-
return
|
|
810
|
+
return $(U);
|
|
811
811
|
}
|
|
812
|
-
let
|
|
813
|
-
function
|
|
814
|
-
typeof window > "u" || !window.BroadcastChannel || (
|
|
812
|
+
let l = null;
|
|
813
|
+
function u() {
|
|
814
|
+
typeof window > "u" || !window.BroadcastChannel || (l = new BroadcastChannel("stonecrop-operation-log"), l.addEventListener("message", (d) => {
|
|
815
815
|
const p = d.data;
|
|
816
816
|
if (!p || typeof p != "object") return;
|
|
817
|
-
const
|
|
818
|
-
|
|
817
|
+
const y = Rt(p);
|
|
818
|
+
y.clientId !== r.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((F) => ({ ...F, source: "sync" }))), t.value = e.value.length - 1));
|
|
819
819
|
}));
|
|
820
820
|
}
|
|
821
821
|
function O(d) {
|
|
822
|
-
if (!
|
|
822
|
+
if (!l) return;
|
|
823
823
|
const p = {
|
|
824
824
|
type: "operation",
|
|
825
825
|
operation: d,
|
|
826
826
|
clientId: r.value,
|
|
827
827
|
timestamp: /* @__PURE__ */ new Date()
|
|
828
828
|
};
|
|
829
|
-
|
|
829
|
+
l.postMessage(pe(p));
|
|
830
830
|
}
|
|
831
|
-
function
|
|
832
|
-
if (!
|
|
833
|
-
const
|
|
831
|
+
function m(d, p) {
|
|
832
|
+
if (!l) return;
|
|
833
|
+
const y = {
|
|
834
834
|
type: "operation",
|
|
835
835
|
operations: [...d, p],
|
|
836
836
|
clientId: r.value,
|
|
837
837
|
timestamp: /* @__PURE__ */ new Date()
|
|
838
838
|
};
|
|
839
|
-
|
|
839
|
+
l.postMessage(pe(y));
|
|
840
840
|
}
|
|
841
841
|
function f(d) {
|
|
842
|
-
if (!
|
|
842
|
+
if (!l) return;
|
|
843
843
|
const p = {
|
|
844
844
|
type: "undo",
|
|
845
845
|
operation: d,
|
|
846
846
|
clientId: r.value,
|
|
847
847
|
timestamp: /* @__PURE__ */ new Date()
|
|
848
848
|
};
|
|
849
|
-
|
|
849
|
+
l.postMessage(pe(p));
|
|
850
850
|
}
|
|
851
|
-
function
|
|
852
|
-
if (!
|
|
851
|
+
function b(d) {
|
|
852
|
+
if (!l) return;
|
|
853
853
|
const p = {
|
|
854
854
|
type: "redo",
|
|
855
855
|
operation: d,
|
|
856
856
|
clientId: r.value,
|
|
857
857
|
timestamp: /* @__PURE__ */ new Date()
|
|
858
858
|
};
|
|
859
|
-
|
|
859
|
+
l.postMessage(pe(p));
|
|
860
860
|
}
|
|
861
|
-
const
|
|
861
|
+
const A = wt("stonecrop-ops-operations", null, {
|
|
862
862
|
serializer: {
|
|
863
863
|
read: (d) => {
|
|
864
864
|
try {
|
|
@@ -870,10 +870,10 @@ const le = /* @__PURE__ */ tt("hst-operation-log", () => {
|
|
|
870
870
|
write: (d) => d ? JSON.stringify(d) : ""
|
|
871
871
|
}
|
|
872
872
|
});
|
|
873
|
-
function
|
|
873
|
+
function C() {
|
|
874
874
|
if (!(typeof window > "u"))
|
|
875
875
|
try {
|
|
876
|
-
const d =
|
|
876
|
+
const d = A.value;
|
|
877
877
|
d && Array.isArray(d.operations) && (e.value = d.operations.map((p) => ({
|
|
878
878
|
...p,
|
|
879
879
|
timestamp: new Date(p.timestamp)
|
|
@@ -885,7 +885,7 @@ const le = /* @__PURE__ */ tt("hst-operation-log", () => {
|
|
|
885
885
|
function j() {
|
|
886
886
|
if (!(typeof window > "u"))
|
|
887
887
|
try {
|
|
888
|
-
|
|
888
|
+
A.value = {
|
|
889
889
|
operations: e.value.map((d) => ({
|
|
890
890
|
...d,
|
|
891
891
|
timestamp: d.timestamp.toISOString()
|
|
@@ -896,11 +896,11 @@ const le = /* @__PURE__ */ tt("hst-operation-log", () => {
|
|
|
896
896
|
typeof console < "u" && console.error("Failed to save operations to persistence:", d);
|
|
897
897
|
}
|
|
898
898
|
}
|
|
899
|
-
function
|
|
899
|
+
function k() {
|
|
900
900
|
H(
|
|
901
901
|
[e, t],
|
|
902
902
|
() => {
|
|
903
|
-
|
|
903
|
+
n.value.enablePersistence && j();
|
|
904
904
|
},
|
|
905
905
|
{ deep: !0 }
|
|
906
906
|
);
|
|
@@ -909,27 +909,27 @@ const le = /* @__PURE__ */ tt("hst-operation-log", () => {
|
|
|
909
909
|
// State
|
|
910
910
|
operations: e,
|
|
911
911
|
currentIndex: t,
|
|
912
|
-
config:
|
|
912
|
+
config: n,
|
|
913
913
|
clientId: r,
|
|
914
914
|
undoRedoState: w,
|
|
915
915
|
// Computed
|
|
916
916
|
canUndo: a,
|
|
917
917
|
canRedo: c,
|
|
918
918
|
undoCount: h,
|
|
919
|
-
redoCount:
|
|
919
|
+
redoCount: g,
|
|
920
920
|
// Methods
|
|
921
|
-
configure:
|
|
922
|
-
addOperation:
|
|
923
|
-
startBatch:
|
|
924
|
-
commitBatch:
|
|
925
|
-
cancelBatch:
|
|
926
|
-
undo:
|
|
927
|
-
redo:
|
|
928
|
-
clear:
|
|
929
|
-
getOperationsFor:
|
|
921
|
+
configure: R,
|
|
922
|
+
addOperation: $,
|
|
923
|
+
startBatch: T,
|
|
924
|
+
commitBatch: L,
|
|
925
|
+
cancelBatch: P,
|
|
926
|
+
undo: I,
|
|
927
|
+
redo: N,
|
|
928
|
+
clear: _,
|
|
929
|
+
getOperationsFor: v,
|
|
930
930
|
getSnapshot: E,
|
|
931
931
|
markIrreversible: x,
|
|
932
|
-
logAction:
|
|
932
|
+
logAction: V
|
|
933
933
|
};
|
|
934
934
|
});
|
|
935
935
|
class ae {
|
|
@@ -1001,25 +1001,25 @@ class ae {
|
|
|
1001
1001
|
*/
|
|
1002
1002
|
registerDoctypeActions(e, t) {
|
|
1003
1003
|
if (!t) return;
|
|
1004
|
-
const r = /* @__PURE__ */ new Map(),
|
|
1004
|
+
const r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
1005
1005
|
if (typeof t.entrySeq == "function")
|
|
1006
1006
|
t.entrySeq().forEach(([s, i]) => {
|
|
1007
|
-
this.categorizeAction(s, i, r,
|
|
1007
|
+
this.categorizeAction(s, i, r, o);
|
|
1008
1008
|
});
|
|
1009
1009
|
else if (t instanceof Map)
|
|
1010
1010
|
for (const [s, i] of t)
|
|
1011
|
-
this.categorizeAction(s, i, r,
|
|
1011
|
+
this.categorizeAction(s, i, r, o);
|
|
1012
1012
|
else t && typeof t == "object" && Object.entries(t).forEach(([s, i]) => {
|
|
1013
|
-
this.categorizeAction(s, i, r,
|
|
1013
|
+
this.categorizeAction(s, i, r, o);
|
|
1014
1014
|
});
|
|
1015
|
-
this.doctypeActions.set(e, r), this.doctypeTransitions.set(e,
|
|
1015
|
+
this.doctypeActions.set(e, r), this.doctypeTransitions.set(e, o);
|
|
1016
1016
|
}
|
|
1017
1017
|
/**
|
|
1018
1018
|
* Categorize an action as either a field trigger or XState transition
|
|
1019
1019
|
* Uses uppercase convention: UPPERCASE = transition, lowercase/mixed = field trigger
|
|
1020
1020
|
*/
|
|
1021
|
-
categorizeAction(e, t, r,
|
|
1022
|
-
this.isTransitionKey(e) ?
|
|
1021
|
+
categorizeAction(e, t, r, o) {
|
|
1022
|
+
this.isTransitionKey(e) ? o.set(e, t) : r.set(e, t);
|
|
1023
1023
|
}
|
|
1024
1024
|
/**
|
|
1025
1025
|
* Determine if a key represents an XState transition
|
|
@@ -1034,7 +1034,7 @@ class ae {
|
|
|
1034
1034
|
* @param options - Execution options (timeout and enableRollback)
|
|
1035
1035
|
*/
|
|
1036
1036
|
async executeFieldTriggers(e, t = {}) {
|
|
1037
|
-
const { doctype: r, fieldname:
|
|
1037
|
+
const { doctype: r, fieldname: o } = e, s = this.findFieldTriggers(r, o);
|
|
1038
1038
|
if (s.length === 0)
|
|
1039
1039
|
return {
|
|
1040
1040
|
path: e.path,
|
|
@@ -1045,48 +1045,48 @@ class ae {
|
|
|
1045
1045
|
rolledBack: !1
|
|
1046
1046
|
};
|
|
1047
1047
|
const i = performance.now(), a = [];
|
|
1048
|
-
let c = !1, h = !1,
|
|
1049
|
-
const w = this.getFieldRollback(r,
|
|
1050
|
-
|
|
1051
|
-
for (const
|
|
1048
|
+
let c = !1, h = !1, g;
|
|
1049
|
+
const w = this.getFieldRollback(r, o), R = t.enableRollback ?? w ?? this.options.enableRollback;
|
|
1050
|
+
R && e.store && (g = this.captureSnapshot(e));
|
|
1051
|
+
for (const P of s)
|
|
1052
1052
|
try {
|
|
1053
|
-
const
|
|
1054
|
-
if (a.push(
|
|
1053
|
+
const I = await this.executeAction(P, e, t.timeout);
|
|
1054
|
+
if (a.push(I), !I.success) {
|
|
1055
1055
|
c = !0;
|
|
1056
1056
|
break;
|
|
1057
1057
|
}
|
|
1058
|
-
} catch (
|
|
1058
|
+
} catch (I) {
|
|
1059
1059
|
const S = {
|
|
1060
1060
|
success: !1,
|
|
1061
|
-
error:
|
|
1061
|
+
error: I instanceof Error ? I : new Error(String(I)),
|
|
1062
1062
|
executionTime: 0,
|
|
1063
|
-
action:
|
|
1063
|
+
action: P
|
|
1064
1064
|
};
|
|
1065
1065
|
a.push(S), c = !0;
|
|
1066
1066
|
break;
|
|
1067
1067
|
}
|
|
1068
|
-
if (
|
|
1068
|
+
if (R && c && g && e.store)
|
|
1069
1069
|
try {
|
|
1070
|
-
this.restoreSnapshot(e,
|
|
1071
|
-
} catch (
|
|
1072
|
-
console.error("[FieldTriggers] Rollback failed:",
|
|
1070
|
+
this.restoreSnapshot(e, g), h = !0;
|
|
1071
|
+
} catch (P) {
|
|
1072
|
+
console.error("[FieldTriggers] Rollback failed:", P);
|
|
1073
1073
|
}
|
|
1074
|
-
const
|
|
1075
|
-
if (
|
|
1076
|
-
for (const
|
|
1074
|
+
const $ = performance.now() - i, T = a.filter((P) => !P.success);
|
|
1075
|
+
if (T.length > 0 && this.options.errorHandler)
|
|
1076
|
+
for (const P of T)
|
|
1077
1077
|
try {
|
|
1078
|
-
this.options.errorHandler(
|
|
1079
|
-
} catch (
|
|
1080
|
-
console.error("[FieldTriggers] Error in global error handler:",
|
|
1078
|
+
this.options.errorHandler(P.error, e, P.action);
|
|
1079
|
+
} catch (I) {
|
|
1080
|
+
console.error("[FieldTriggers] Error in global error handler:", I);
|
|
1081
1081
|
}
|
|
1082
1082
|
return {
|
|
1083
1083
|
path: e.path,
|
|
1084
1084
|
actionResults: a,
|
|
1085
|
-
totalExecutionTime:
|
|
1086
|
-
allSucceeded: a.every((
|
|
1085
|
+
totalExecutionTime: $,
|
|
1086
|
+
allSucceeded: a.every((P) => P.success),
|
|
1087
1087
|
stoppedOnError: c,
|
|
1088
1088
|
rolledBack: h,
|
|
1089
|
-
snapshot: this.options.debug &&
|
|
1089
|
+
snapshot: this.options.debug && R ? g : void 0
|
|
1090
1090
|
// Only include snapshot in debug mode if rollback is enabled
|
|
1091
1091
|
};
|
|
1092
1092
|
}
|
|
@@ -1097,7 +1097,7 @@ class ae {
|
|
|
1097
1097
|
* @param options - Execution options (timeout)
|
|
1098
1098
|
*/
|
|
1099
1099
|
async executeTransitionActions(e, t = {}) {
|
|
1100
|
-
const { doctype: r, transition:
|
|
1100
|
+
const { doctype: r, transition: o } = e, s = this.findTransitionActions(r, o);
|
|
1101
1101
|
if (s.length === 0)
|
|
1102
1102
|
return [];
|
|
1103
1103
|
const i = [];
|
|
@@ -1112,7 +1112,7 @@ class ae {
|
|
|
1112
1112
|
error: h instanceof Error ? h : new Error(String(h)),
|
|
1113
1113
|
executionTime: 0,
|
|
1114
1114
|
action: c,
|
|
1115
|
-
transition:
|
|
1115
|
+
transition: o
|
|
1116
1116
|
};
|
|
1117
1117
|
i.push(w);
|
|
1118
1118
|
break;
|
|
@@ -1138,7 +1138,7 @@ class ae {
|
|
|
1138
1138
|
* Execute a single transition action by name
|
|
1139
1139
|
*/
|
|
1140
1140
|
async executeTransitionAction(e, t, r) {
|
|
1141
|
-
const
|
|
1141
|
+
const o = performance.now(), s = r ?? this.options.defaultTimeout;
|
|
1142
1142
|
try {
|
|
1143
1143
|
let i = this.globalTransitionActions.get(e);
|
|
1144
1144
|
if (!i) {
|
|
@@ -1149,12 +1149,12 @@ class ae {
|
|
|
1149
1149
|
throw new Error(`Transition action "${e}" not found in registry`);
|
|
1150
1150
|
return await this.executeWithTimeout(i, t, s), {
|
|
1151
1151
|
success: !0,
|
|
1152
|
-
executionTime: performance.now() -
|
|
1152
|
+
executionTime: performance.now() - o,
|
|
1153
1153
|
action: e,
|
|
1154
1154
|
transition: t.transition
|
|
1155
1155
|
};
|
|
1156
1156
|
} catch (i) {
|
|
1157
|
-
const a = performance.now() -
|
|
1157
|
+
const a = performance.now() - o;
|
|
1158
1158
|
return {
|
|
1159
1159
|
success: !1,
|
|
1160
1160
|
error: i instanceof Error ? i : new Error(String(i)),
|
|
@@ -1171,10 +1171,10 @@ class ae {
|
|
|
1171
1171
|
findFieldTriggers(e, t) {
|
|
1172
1172
|
const r = this.doctypeActions.get(e);
|
|
1173
1173
|
if (!r) return [];
|
|
1174
|
-
const
|
|
1174
|
+
const o = [];
|
|
1175
1175
|
for (const [s, i] of r)
|
|
1176
|
-
this.isFieldTriggerKey(s, t) &&
|
|
1177
|
-
return
|
|
1176
|
+
this.isFieldTriggerKey(s, t) && o.push(...i);
|
|
1177
|
+
return o;
|
|
1178
1178
|
}
|
|
1179
1179
|
/**
|
|
1180
1180
|
* Determine if an action key represents a field trigger
|
|
@@ -1191,11 +1191,11 @@ class ae {
|
|
|
1191
1191
|
* Supports wildcards (*) for dynamic segments
|
|
1192
1192
|
*/
|
|
1193
1193
|
matchFieldPattern(e, t) {
|
|
1194
|
-
const r = e.split("."),
|
|
1195
|
-
if (r.length !==
|
|
1194
|
+
const r = e.split("."), o = t.split(".");
|
|
1195
|
+
if (r.length !== o.length)
|
|
1196
1196
|
return !1;
|
|
1197
1197
|
for (let s = 0; s < r.length; s++) {
|
|
1198
|
-
const i = r[s], a =
|
|
1198
|
+
const i = r[s], a = o[s];
|
|
1199
1199
|
if (i !== "*" && i !== a)
|
|
1200
1200
|
return !1;
|
|
1201
1201
|
}
|
|
@@ -1205,18 +1205,18 @@ class ae {
|
|
|
1205
1205
|
* Execute a single action by name
|
|
1206
1206
|
*/
|
|
1207
1207
|
async executeAction(e, t, r) {
|
|
1208
|
-
const
|
|
1208
|
+
const o = performance.now(), s = r ?? this.options.defaultTimeout;
|
|
1209
1209
|
try {
|
|
1210
1210
|
const i = this.globalActions.get(e);
|
|
1211
1211
|
if (!i)
|
|
1212
1212
|
throw new Error(`Action "${e}" not found in registry`);
|
|
1213
1213
|
return await this.executeWithTimeout(i, t, s), {
|
|
1214
1214
|
success: !0,
|
|
1215
|
-
executionTime: performance.now() -
|
|
1215
|
+
executionTime: performance.now() - o,
|
|
1216
1216
|
action: e
|
|
1217
1217
|
};
|
|
1218
1218
|
} catch (i) {
|
|
1219
|
-
const a = performance.now() -
|
|
1219
|
+
const a = performance.now() - o;
|
|
1220
1220
|
return {
|
|
1221
1221
|
success: !1,
|
|
1222
1222
|
error: i instanceof Error ? i : new Error(String(i)),
|
|
@@ -1229,12 +1229,12 @@ class ae {
|
|
|
1229
1229
|
* Execute a function with timeout
|
|
1230
1230
|
*/
|
|
1231
1231
|
async executeWithTimeout(e, t, r) {
|
|
1232
|
-
return new Promise((
|
|
1232
|
+
return new Promise((o, s) => {
|
|
1233
1233
|
const i = setTimeout(() => {
|
|
1234
1234
|
s(new Error(`Action timeout after ${r}ms`));
|
|
1235
1235
|
}, r);
|
|
1236
1236
|
Promise.resolve(e(t)).then((a) => {
|
|
1237
|
-
clearTimeout(i),
|
|
1237
|
+
clearTimeout(i), o(a);
|
|
1238
1238
|
}).catch((a) => {
|
|
1239
1239
|
clearTimeout(i), s(a);
|
|
1240
1240
|
});
|
|
@@ -1268,26 +1268,26 @@ class ae {
|
|
|
1268
1268
|
}
|
|
1269
1269
|
}
|
|
1270
1270
|
}
|
|
1271
|
-
function
|
|
1272
|
-
return new ae(
|
|
1271
|
+
function J(n) {
|
|
1272
|
+
return new ae(n);
|
|
1273
1273
|
}
|
|
1274
|
-
function
|
|
1275
|
-
|
|
1274
|
+
function Tt(n, e) {
|
|
1275
|
+
J().registerAction(n, e);
|
|
1276
1276
|
}
|
|
1277
|
-
function
|
|
1278
|
-
|
|
1277
|
+
function Ct(n, e) {
|
|
1278
|
+
J().registerTransitionAction(n, e);
|
|
1279
1279
|
}
|
|
1280
|
-
function
|
|
1281
|
-
|
|
1280
|
+
function kt(n, e, t) {
|
|
1281
|
+
J().setFieldRollback(n, e, t);
|
|
1282
1282
|
}
|
|
1283
|
-
async function
|
|
1284
|
-
const r =
|
|
1285
|
-
path: t?.path || (t?.recordId ? `${
|
|
1283
|
+
async function Ft(n, e, t) {
|
|
1284
|
+
const r = J(), o = {
|
|
1285
|
+
path: t?.path || (t?.recordId ? `${n}.${t.recordId}` : n),
|
|
1286
1286
|
fieldname: "",
|
|
1287
1287
|
beforeValue: void 0,
|
|
1288
1288
|
afterValue: void 0,
|
|
1289
1289
|
operation: "set",
|
|
1290
|
-
doctype:
|
|
1290
|
+
doctype: n,
|
|
1291
1291
|
recordId: t?.recordId,
|
|
1292
1292
|
timestamp: /* @__PURE__ */ new Date(),
|
|
1293
1293
|
transition: e,
|
|
@@ -1295,18 +1295,18 @@ async function Ct(o, e, t) {
|
|
|
1295
1295
|
targetState: t?.targetState,
|
|
1296
1296
|
fsmContext: t?.fsmContext
|
|
1297
1297
|
};
|
|
1298
|
-
return await r.executeTransitionActions(
|
|
1298
|
+
return await r.executeTransitionActions(o);
|
|
1299
1299
|
}
|
|
1300
|
-
function
|
|
1301
|
-
if (
|
|
1300
|
+
function Lt(n, e) {
|
|
1301
|
+
if (n)
|
|
1302
1302
|
try {
|
|
1303
|
-
|
|
1303
|
+
ue().markIrreversible(n, e);
|
|
1304
1304
|
} catch {
|
|
1305
1305
|
}
|
|
1306
1306
|
}
|
|
1307
|
-
function
|
|
1307
|
+
function Ce() {
|
|
1308
1308
|
try {
|
|
1309
|
-
return
|
|
1309
|
+
return ue();
|
|
1310
1310
|
} catch {
|
|
1311
1311
|
return null;
|
|
1312
1312
|
}
|
|
@@ -1359,8 +1359,8 @@ class ve {
|
|
|
1359
1359
|
doctype;
|
|
1360
1360
|
parentDoctype;
|
|
1361
1361
|
hst;
|
|
1362
|
-
constructor(e, t, r = "",
|
|
1363
|
-
return this.target = e, this.parentPath = r, this.rootNode =
|
|
1362
|
+
constructor(e, t, r = "", o = null, s) {
|
|
1363
|
+
return this.target = e, this.parentPath = r, this.rootNode = o || this, this.doctype = t, this.parentDoctype = s, this.hst = ee.getInstance(), new Proxy(this, {
|
|
1364
1364
|
get(i, a) {
|
|
1365
1365
|
if (a in i) return i[a];
|
|
1366
1366
|
const c = String(a);
|
|
@@ -1377,21 +1377,21 @@ class ve {
|
|
|
1377
1377
|
}
|
|
1378
1378
|
// Method to get a tree-wrapped node for navigation
|
|
1379
1379
|
getNode(e) {
|
|
1380
|
-
const t = this.resolvePath(e), r = this.resolveValue(e),
|
|
1380
|
+
const t = this.resolvePath(e), r = this.resolveValue(e), o = t.split(".");
|
|
1381
1381
|
let s = this.doctype;
|
|
1382
|
-
return this.doctype === "StonecropStore" &&
|
|
1382
|
+
return this.doctype === "StonecropStore" && o.length >= 1 && (s = o[0]), typeof r == "object" && r !== null && !this.isPrimitive(r) ? new ve(r, s, t, this.rootNode, this.parentDoctype) : new ve(r, s, t, this.rootNode, this.parentDoctype);
|
|
1383
1383
|
}
|
|
1384
1384
|
set(e, t, r = "user") {
|
|
1385
|
-
const
|
|
1385
|
+
const o = this.resolvePath(e), s = this.has(e) ? this.get(e) : void 0;
|
|
1386
1386
|
if (r !== "undo" && r !== "redo") {
|
|
1387
|
-
const i =
|
|
1387
|
+
const i = Ce();
|
|
1388
1388
|
if (i && typeof i.addOperation == "function") {
|
|
1389
|
-
const a =
|
|
1389
|
+
const a = o.split("."), c = this.doctype === "StonecropStore" && a.length >= 1 ? a[0] : this.doctype, h = a.length >= 2 ? a[1] : void 0, g = a.slice(2).join(".") || a[a.length - 1], R = t === void 0 && s !== void 0 ? "delete" : "set";
|
|
1390
1390
|
i.addOperation(
|
|
1391
1391
|
{
|
|
1392
|
-
type:
|
|
1393
|
-
path:
|
|
1394
|
-
fieldname:
|
|
1392
|
+
type: R,
|
|
1393
|
+
path: o,
|
|
1394
|
+
fieldname: g,
|
|
1395
1395
|
beforeValue: s,
|
|
1396
1396
|
afterValue: t,
|
|
1397
1397
|
doctype: c,
|
|
@@ -1403,7 +1403,7 @@ class ve {
|
|
|
1403
1403
|
);
|
|
1404
1404
|
}
|
|
1405
1405
|
}
|
|
1406
|
-
this.updateValue(e, t), this.triggerFieldActions(
|
|
1406
|
+
this.updateValue(e, t), this.triggerFieldActions(o, s, t);
|
|
1407
1407
|
}
|
|
1408
1408
|
has(e) {
|
|
1409
1409
|
try {
|
|
@@ -1411,11 +1411,11 @@ class ve {
|
|
|
1411
1411
|
return !0;
|
|
1412
1412
|
const t = this.parsePath(e);
|
|
1413
1413
|
let r = this.target;
|
|
1414
|
-
for (let
|
|
1415
|
-
const s = t[
|
|
1414
|
+
for (let o = 0; o < t.length; o++) {
|
|
1415
|
+
const s = t[o];
|
|
1416
1416
|
if (r == null)
|
|
1417
1417
|
return !1;
|
|
1418
|
-
if (
|
|
1418
|
+
if (o === t.length - 1)
|
|
1419
1419
|
return this.isImmutable(r) ? r.has(s) : this.isPiniaStore(r) && r.$state && s in r.$state || s in r;
|
|
1420
1420
|
r = this.getProperty(r, s);
|
|
1421
1421
|
}
|
|
@@ -1446,9 +1446,9 @@ class ve {
|
|
|
1446
1446
|
* Trigger an XState transition with optional context data
|
|
1447
1447
|
*/
|
|
1448
1448
|
async triggerTransition(e, t) {
|
|
1449
|
-
const r =
|
|
1449
|
+
const r = J(), o = this.parentPath.split(".");
|
|
1450
1450
|
let s = this.doctype, i;
|
|
1451
|
-
this.doctype === "StonecropStore" &&
|
|
1451
|
+
this.doctype === "StonecropStore" && o.length >= 1 && (s = o[0]), o.length >= 2 && (i = o[1]);
|
|
1452
1452
|
const a = {
|
|
1453
1453
|
path: this.parentPath,
|
|
1454
1454
|
fieldname: "",
|
|
@@ -1464,7 +1464,7 @@ class ve {
|
|
|
1464
1464
|
currentState: t?.currentState,
|
|
1465
1465
|
targetState: t?.targetState,
|
|
1466
1466
|
fsmContext: t?.fsmContext
|
|
1467
|
-
}, c =
|
|
1467
|
+
}, c = Ce();
|
|
1468
1468
|
return c && typeof c.addOperation == "function" && c.addOperation(
|
|
1469
1469
|
{
|
|
1470
1470
|
type: "transition",
|
|
@@ -1495,22 +1495,22 @@ class ve {
|
|
|
1495
1495
|
return this.target;
|
|
1496
1496
|
const t = this.parsePath(e);
|
|
1497
1497
|
let r = this.target;
|
|
1498
|
-
for (const
|
|
1498
|
+
for (const o of t) {
|
|
1499
1499
|
if (r == null)
|
|
1500
1500
|
return;
|
|
1501
|
-
r = this.getProperty(r,
|
|
1501
|
+
r = this.getProperty(r, o);
|
|
1502
1502
|
}
|
|
1503
1503
|
return r;
|
|
1504
1504
|
}
|
|
1505
1505
|
updateValue(e, t) {
|
|
1506
1506
|
if (e === "")
|
|
1507
1507
|
throw new Error("Cannot set value on empty path");
|
|
1508
|
-
const r = this.parsePath(e),
|
|
1508
|
+
const r = this.parsePath(e), o = r.pop();
|
|
1509
1509
|
let s = this.target;
|
|
1510
1510
|
for (const i of r)
|
|
1511
1511
|
if (s = this.getProperty(s, i), s == null)
|
|
1512
1512
|
throw new Error(`Cannot set property on null/undefined path: ${e}`);
|
|
1513
|
-
this.setProperty(s,
|
|
1513
|
+
this.setProperty(s, o, t);
|
|
1514
1514
|
}
|
|
1515
1515
|
getProperty(e, t) {
|
|
1516
1516
|
return this.isImmutable(e) ? e.get(t) : this.isVueReactive(e) ? e[t] : this.isPiniaStore(e) ? e.$state?.[t] ?? e[t] : e[t];
|
|
@@ -1528,14 +1528,14 @@ class ve {
|
|
|
1528
1528
|
try {
|
|
1529
1529
|
if (!e || typeof e != "string")
|
|
1530
1530
|
return;
|
|
1531
|
-
const
|
|
1532
|
-
if (
|
|
1531
|
+
const o = e.split(".");
|
|
1532
|
+
if (o.length < 3)
|
|
1533
1533
|
return;
|
|
1534
|
-
const s =
|
|
1534
|
+
const s = J(), i = o.slice(2).join(".") || o[o.length - 1];
|
|
1535
1535
|
let a = this.doctype;
|
|
1536
|
-
this.doctype === "StonecropStore" &&
|
|
1536
|
+
this.doctype === "StonecropStore" && o.length >= 1 && (a = o[0]);
|
|
1537
1537
|
let c;
|
|
1538
|
-
|
|
1538
|
+
o.length >= 2 && (c = o[1]);
|
|
1539
1539
|
const h = {
|
|
1540
1540
|
path: e,
|
|
1541
1541
|
fieldname: i,
|
|
@@ -1549,8 +1549,8 @@ class ve {
|
|
|
1549
1549
|
// Pass the root store for snapshot/rollback capabilities
|
|
1550
1550
|
};
|
|
1551
1551
|
await s.executeFieldTriggers(h);
|
|
1552
|
-
} catch (
|
|
1553
|
-
|
|
1552
|
+
} catch (o) {
|
|
1553
|
+
o instanceof Error && console.warn("Field trigger error:", o.message);
|
|
1554
1554
|
}
|
|
1555
1555
|
}
|
|
1556
1556
|
isVueReactive(e) {
|
|
@@ -1562,7 +1562,7 @@ class ve {
|
|
|
1562
1562
|
isImmutable(e) {
|
|
1563
1563
|
if (!e || typeof e != "object")
|
|
1564
1564
|
return !1;
|
|
1565
|
-
const t = "get" in e && typeof e.get == "function", r = "set" in e && typeof e.set == "function",
|
|
1565
|
+
const t = "get" in e && typeof e.get == "function", r = "set" in e && typeof e.set == "function", o = "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 && r;
|
|
1566
1566
|
let i;
|
|
1567
1567
|
try {
|
|
1568
1568
|
const c = e;
|
|
@@ -1574,7 +1574,7 @@ class ve {
|
|
|
1574
1574
|
i = void 0;
|
|
1575
1575
|
}
|
|
1576
1576
|
const a = i && (i.includes("Map") || i.includes("List") || i.includes("Set") || i.includes("Stack") || i.includes("Seq")) && (t || r);
|
|
1577
|
-
return !!(t && r &&
|
|
1577
|
+
return !!(t && r && o && s || t && r && a);
|
|
1578
1578
|
}
|
|
1579
1579
|
isPrimitive(e) {
|
|
1580
1580
|
return e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "function" || typeof e == "symbol" || typeof e == "bigint";
|
|
@@ -1583,8 +1583,8 @@ class ve {
|
|
|
1583
1583
|
return e ? e.split(".").filter((t) => t.length > 0) : [];
|
|
1584
1584
|
}
|
|
1585
1585
|
}
|
|
1586
|
-
function
|
|
1587
|
-
return new ve(
|
|
1586
|
+
function Nt(n, e, t) {
|
|
1587
|
+
return new ve(n, e, "", null, t);
|
|
1588
1588
|
}
|
|
1589
1589
|
class He {
|
|
1590
1590
|
hstStore;
|
|
@@ -1605,7 +1605,7 @@ class He {
|
|
|
1605
1605
|
* @internal
|
|
1606
1606
|
*/
|
|
1607
1607
|
getOperationLogStore() {
|
|
1608
|
-
return this._operationLogStore || (this._operationLogStore =
|
|
1608
|
+
return this._operationLogStore || (this._operationLogStore = ue(), this._operationLogConfig && this._operationLogStore.configure(this._operationLogConfig)), this._operationLogStore;
|
|
1609
1609
|
}
|
|
1610
1610
|
/**
|
|
1611
1611
|
* Initialize the HST store structure
|
|
@@ -1614,7 +1614,7 @@ class He {
|
|
|
1614
1614
|
const e = {};
|
|
1615
1615
|
Object.keys(this.registry.registry).forEach((t) => {
|
|
1616
1616
|
e[t] = {};
|
|
1617
|
-
}), this.hstStore =
|
|
1617
|
+
}), this.hstStore = Nt(e, "StonecropStore");
|
|
1618
1618
|
}
|
|
1619
1619
|
/**
|
|
1620
1620
|
* Setup automatic sync with Registry when doctypes are added
|
|
@@ -1641,8 +1641,8 @@ class He {
|
|
|
1641
1641
|
* @param recordData - The record data
|
|
1642
1642
|
*/
|
|
1643
1643
|
addRecord(e, t, r) {
|
|
1644
|
-
const
|
|
1645
|
-
this.ensureDoctypeExists(
|
|
1644
|
+
const o = typeof e == "string" ? e : e.slug;
|
|
1645
|
+
this.ensureDoctypeExists(o), this.hstStore.set(`${o}.${t}`, r);
|
|
1646
1646
|
}
|
|
1647
1647
|
/**
|
|
1648
1648
|
* Get a specific record
|
|
@@ -1673,7 +1673,7 @@ class He {
|
|
|
1673
1673
|
const t = typeof e == "string" ? e : e.slug;
|
|
1674
1674
|
this.ensureDoctypeExists(t);
|
|
1675
1675
|
const r = this.hstStore.get(t);
|
|
1676
|
-
return !r || typeof r != "object" ? [] : Object.keys(r).filter((
|
|
1676
|
+
return !r || typeof r != "object" ? [] : Object.keys(r).filter((o) => r[o] !== void 0);
|
|
1677
1677
|
}
|
|
1678
1678
|
/**
|
|
1679
1679
|
* Clear all records for a doctype
|
|
@@ -1681,8 +1681,8 @@ class He {
|
|
|
1681
1681
|
*/
|
|
1682
1682
|
clearRecords(e) {
|
|
1683
1683
|
const t = typeof e == "string" ? e : e.slug;
|
|
1684
|
-
this.ensureDoctypeExists(t), this.getRecordIds(t).forEach((
|
|
1685
|
-
this.hstStore.set(`${t}.${
|
|
1684
|
+
this.ensureDoctypeExists(t), this.getRecordIds(t).forEach((o) => {
|
|
1685
|
+
this.hstStore.set(`${t}.${o}`, void 0);
|
|
1686
1686
|
});
|
|
1687
1687
|
}
|
|
1688
1688
|
/**
|
|
@@ -1700,12 +1700,12 @@ class He {
|
|
|
1700
1700
|
* @param args - Action arguments (typically record IDs)
|
|
1701
1701
|
*/
|
|
1702
1702
|
runAction(e, t, r) {
|
|
1703
|
-
const s = this.registry.registry[e.slug]?.actions?.get(t), i = Array.isArray(r) ? r.filter((
|
|
1703
|
+
const s = this.registry.registry[e.slug]?.actions?.get(t), i = Array.isArray(r) ? r.filter((g) => typeof g == "string") : void 0, a = this.getOperationLogStore();
|
|
1704
1704
|
let c = "success", h;
|
|
1705
1705
|
try {
|
|
1706
|
-
s && s.length > 0 && s.forEach((
|
|
1706
|
+
s && s.length > 0 && s.forEach((g) => {
|
|
1707
1707
|
try {
|
|
1708
|
-
new Function("args",
|
|
1708
|
+
new Function("args", g)(r);
|
|
1709
1709
|
} catch (w) {
|
|
1710
1710
|
throw c = "failure", h = w instanceof Error ? w.message : "Unknown error", w;
|
|
1711
1711
|
}
|
|
@@ -1720,8 +1720,8 @@ class He {
|
|
|
1720
1720
|
* @param doctype - The doctype
|
|
1721
1721
|
*/
|
|
1722
1722
|
async getRecords(e) {
|
|
1723
|
-
(await (await fetch(`/${e.slug}`)).json()).forEach((
|
|
1724
|
-
|
|
1723
|
+
(await (await fetch(`/${e.slug}`)).json()).forEach((o) => {
|
|
1724
|
+
o.id && this.addRecord(e, o.id, o);
|
|
1725
1725
|
});
|
|
1726
1726
|
}
|
|
1727
1727
|
/**
|
|
@@ -1730,8 +1730,8 @@ class He {
|
|
|
1730
1730
|
* @param recordId - The record ID
|
|
1731
1731
|
*/
|
|
1732
1732
|
async getRecord(e, t) {
|
|
1733
|
-
const
|
|
1734
|
-
this.addRecord(e, t,
|
|
1733
|
+
const o = await (await fetch(`/${e.slug}/${t}`)).json();
|
|
1734
|
+
this.addRecord(e, t, o);
|
|
1735
1735
|
}
|
|
1736
1736
|
/**
|
|
1737
1737
|
* Ensure doctype section exists in HST store
|
|
@@ -1758,9 +1758,9 @@ class He {
|
|
|
1758
1758
|
return this.hstStore;
|
|
1759
1759
|
}
|
|
1760
1760
|
}
|
|
1761
|
-
function Vt(
|
|
1762
|
-
|
|
1763
|
-
const e =
|
|
1761
|
+
function Vt(n) {
|
|
1762
|
+
n || (n = {});
|
|
1763
|
+
const e = n.registry || te("$registry"), t = te("$stonecrop"), r = M(), o = M(), s = M({}), i = M(), a = M(), c = M([]), h = M(-1), g = B(() => r.value?.getOperationLogStore().canUndo ?? !1), w = B(() => r.value?.getOperationLogStore().canRedo ?? !1), R = B(() => r.value?.getOperationLogStore().undoCount ?? 0), $ = B(() => r.value?.getOperationLogStore().redoCount ?? 0), T = B(
|
|
1764
1764
|
() => r.value?.getOperationLogStore().undoRedoState ?? {
|
|
1765
1765
|
canUndo: !1,
|
|
1766
1766
|
canRedo: !1,
|
|
@@ -1768,161 +1768,161 @@ function Vt(o) {
|
|
|
1768
1768
|
redoCount: 0,
|
|
1769
1769
|
currentIndex: -1
|
|
1770
1770
|
}
|
|
1771
|
-
),
|
|
1771
|
+
), L = (m) => r.value?.getOperationLogStore().undo(m) ?? !1, P = (m) => r.value?.getOperationLogStore().redo(m) ?? !1, I = () => {
|
|
1772
1772
|
r.value?.getOperationLogStore().startBatch();
|
|
1773
|
-
},
|
|
1773
|
+
}, N = (m) => r.value?.getOperationLogStore().commitBatch(m) ?? null, S = () => {
|
|
1774
1774
|
r.value?.getOperationLogStore().cancelBatch();
|
|
1775
|
-
},
|
|
1775
|
+
}, D = () => {
|
|
1776
1776
|
r.value?.getOperationLogStore().clear();
|
|
1777
|
-
}, E = (
|
|
1777
|
+
}, E = (m, f) => r.value?.getOperationLogStore().getOperationsFor(m, f) ?? [], _ = () => r.value?.getOperationLogStore().getSnapshot() ?? {
|
|
1778
1778
|
operations: [],
|
|
1779
1779
|
currentIndex: -1,
|
|
1780
1780
|
totalOperations: 0,
|
|
1781
1781
|
reversibleOperations: 0,
|
|
1782
1782
|
irreversibleOperations: 0
|
|
1783
|
-
},
|
|
1784
|
-
r.value?.getOperationLogStore().markIrreversible(
|
|
1785
|
-
}, x = (
|
|
1786
|
-
r.value?.getOperationLogStore().configure(
|
|
1783
|
+
}, v = (m, f) => {
|
|
1784
|
+
r.value?.getOperationLogStore().markIrreversible(m, f);
|
|
1785
|
+
}, x = (m, f, b, A = "success", C) => r.value?.getOperationLogStore().logAction(m, f, b, A, C) ?? "", V = (m) => {
|
|
1786
|
+
r.value?.getOperationLogStore().configure(m);
|
|
1787
1787
|
};
|
|
1788
|
-
|
|
1788
|
+
Ve(async () => {
|
|
1789
1789
|
if (e) {
|
|
1790
1790
|
r.value = t || new He(e);
|
|
1791
1791
|
try {
|
|
1792
|
-
const
|
|
1792
|
+
const m = r.value.getOperationLogStore(), f = We(m);
|
|
1793
1793
|
c.value = f.operations.value, h.value = f.currentIndex.value, H(
|
|
1794
1794
|
() => f.operations.value,
|
|
1795
|
-
(
|
|
1796
|
-
c.value =
|
|
1795
|
+
(b) => {
|
|
1796
|
+
c.value = b;
|
|
1797
1797
|
}
|
|
1798
1798
|
), H(
|
|
1799
1799
|
() => f.currentIndex.value,
|
|
1800
|
-
(
|
|
1801
|
-
h.value =
|
|
1800
|
+
(b) => {
|
|
1801
|
+
h.value = b;
|
|
1802
1802
|
}
|
|
1803
1803
|
);
|
|
1804
1804
|
} catch {
|
|
1805
1805
|
}
|
|
1806
|
-
if (!
|
|
1807
|
-
const
|
|
1808
|
-
if (!
|
|
1809
|
-
const f =
|
|
1806
|
+
if (!n.doctype && e.router) {
|
|
1807
|
+
const m = e.router.currentRoute.value;
|
|
1808
|
+
if (!m.path) return;
|
|
1809
|
+
const f = m.path.split("/").filter((A) => A.length > 0), b = f[1]?.toLowerCase();
|
|
1810
1810
|
if (f.length > 0) {
|
|
1811
|
-
const
|
|
1812
|
-
path:
|
|
1811
|
+
const A = {
|
|
1812
|
+
path: m.path,
|
|
1813
1813
|
segments: f
|
|
1814
|
-
},
|
|
1815
|
-
if (
|
|
1816
|
-
if (e.addDoctype(
|
|
1817
|
-
const j = r.value.getRecordById(
|
|
1814
|
+
}, C = await e.getMeta?.(A);
|
|
1815
|
+
if (C) {
|
|
1816
|
+
if (e.addDoctype(C), r.value.setup(C), i.value = C, a.value = b, o.value = r.value.getStore(), b && b !== "new") {
|
|
1817
|
+
const j = r.value.getRecordById(C, b);
|
|
1818
1818
|
if (j)
|
|
1819
1819
|
s.value = j.get("") || {};
|
|
1820
1820
|
else
|
|
1821
1821
|
try {
|
|
1822
|
-
await r.value.getRecord(
|
|
1823
|
-
const
|
|
1824
|
-
|
|
1822
|
+
await r.value.getRecord(C, b);
|
|
1823
|
+
const k = r.value.getRecordById(C, b);
|
|
1824
|
+
k && (s.value = k.get("") || {});
|
|
1825
1825
|
} catch {
|
|
1826
|
-
s.value = he(
|
|
1826
|
+
s.value = he(C);
|
|
1827
1827
|
}
|
|
1828
1828
|
} else
|
|
1829
|
-
s.value = he(
|
|
1830
|
-
|
|
1829
|
+
s.value = he(C);
|
|
1830
|
+
o.value && ke(C, b || "new", s, o.value), r.value.runAction(C, "load", b ? [b] : void 0);
|
|
1831
1831
|
}
|
|
1832
1832
|
}
|
|
1833
1833
|
}
|
|
1834
|
-
if (
|
|
1835
|
-
|
|
1836
|
-
const
|
|
1834
|
+
if (n.doctype) {
|
|
1835
|
+
o.value = r.value.getStore();
|
|
1836
|
+
const m = n.doctype, f = n.recordId;
|
|
1837
1837
|
if (f && f !== "new") {
|
|
1838
|
-
const
|
|
1839
|
-
if (
|
|
1840
|
-
s.value =
|
|
1838
|
+
const b = r.value.getRecordById(m, f);
|
|
1839
|
+
if (b)
|
|
1840
|
+
s.value = b.get("") || {};
|
|
1841
1841
|
else
|
|
1842
1842
|
try {
|
|
1843
|
-
await r.value.getRecord(
|
|
1844
|
-
const
|
|
1845
|
-
|
|
1843
|
+
await r.value.getRecord(m, f);
|
|
1844
|
+
const A = r.value.getRecordById(m, f);
|
|
1845
|
+
A && (s.value = A.get("") || {});
|
|
1846
1846
|
} catch {
|
|
1847
|
-
s.value = he(
|
|
1847
|
+
s.value = he(m);
|
|
1848
1848
|
}
|
|
1849
1849
|
} else
|
|
1850
|
-
s.value = he(
|
|
1851
|
-
|
|
1850
|
+
s.value = he(m);
|
|
1851
|
+
o.value && ke(m, f || "new", s, o.value);
|
|
1852
1852
|
}
|
|
1853
1853
|
}
|
|
1854
1854
|
});
|
|
1855
|
-
const
|
|
1856
|
-
const
|
|
1857
|
-
if (!
|
|
1858
|
-
const
|
|
1859
|
-
return `${
|
|
1860
|
-
},
|
|
1861
|
-
const f =
|
|
1862
|
-
if (!(!
|
|
1855
|
+
const l = (m, f) => {
|
|
1856
|
+
const b = n.doctype || i.value;
|
|
1857
|
+
if (!b) return "";
|
|
1858
|
+
const A = f || n.recordId || a.value || "new";
|
|
1859
|
+
return `${b.slug}.${A}.${m}`;
|
|
1860
|
+
}, u = (m) => {
|
|
1861
|
+
const f = n.doctype || i.value;
|
|
1862
|
+
if (!(!o.value || !r.value || !f))
|
|
1863
1863
|
try {
|
|
1864
|
-
const
|
|
1865
|
-
if (
|
|
1866
|
-
const j =
|
|
1867
|
-
if (
|
|
1868
|
-
const d = `${j}.${
|
|
1869
|
-
let
|
|
1870
|
-
for (let
|
|
1871
|
-
if (
|
|
1872
|
-
const z = p[
|
|
1873
|
-
|
|
1864
|
+
const b = m.path.split(".");
|
|
1865
|
+
if (b.length >= 2) {
|
|
1866
|
+
const j = b[0], k = b[1];
|
|
1867
|
+
if (o.value.has(`${j}.${k}`) || r.value.addRecord(f, k, { ...s.value }), b.length > 3) {
|
|
1868
|
+
const d = `${j}.${k}`, p = b.slice(2);
|
|
1869
|
+
let y = d;
|
|
1870
|
+
for (let F = 0; F < p.length - 1; F++)
|
|
1871
|
+
if (y += `.${p[F]}`, !o.value.has(y)) {
|
|
1872
|
+
const z = p[F + 1], U = !isNaN(Number(z));
|
|
1873
|
+
o.value.set(y, U ? [] : {});
|
|
1874
1874
|
}
|
|
1875
1875
|
}
|
|
1876
1876
|
}
|
|
1877
|
-
|
|
1878
|
-
const
|
|
1879
|
-
|
|
1877
|
+
o.value.set(m.path, m.value);
|
|
1878
|
+
const A = m.fieldname.split("."), C = { ...s.value };
|
|
1879
|
+
A.length === 1 ? C[A[0]] = m.value : Pt(C, A, m.value), s.value = C;
|
|
1880
1880
|
} catch {
|
|
1881
1881
|
}
|
|
1882
1882
|
};
|
|
1883
|
-
(
|
|
1883
|
+
(n.doctype || e?.router) && (_e("hstPathProvider", l), _e("hstChangeHandler", u));
|
|
1884
1884
|
const O = {
|
|
1885
1885
|
operations: c,
|
|
1886
1886
|
currentIndex: h,
|
|
1887
|
-
undoRedoState:
|
|
1888
|
-
canUndo:
|
|
1887
|
+
undoRedoState: T,
|
|
1888
|
+
canUndo: g,
|
|
1889
1889
|
canRedo: w,
|
|
1890
|
-
undoCount:
|
|
1891
|
-
redoCount:
|
|
1892
|
-
undo:
|
|
1893
|
-
redo:
|
|
1894
|
-
startBatch:
|
|
1895
|
-
commitBatch:
|
|
1890
|
+
undoCount: R,
|
|
1891
|
+
redoCount: $,
|
|
1892
|
+
undo: L,
|
|
1893
|
+
redo: P,
|
|
1894
|
+
startBatch: I,
|
|
1895
|
+
commitBatch: N,
|
|
1896
1896
|
cancelBatch: S,
|
|
1897
|
-
clear:
|
|
1897
|
+
clear: D,
|
|
1898
1898
|
getOperationsFor: E,
|
|
1899
|
-
getSnapshot:
|
|
1900
|
-
markIrreversible:
|
|
1899
|
+
getSnapshot: _,
|
|
1900
|
+
markIrreversible: v,
|
|
1901
1901
|
logAction: x,
|
|
1902
|
-
configure:
|
|
1902
|
+
configure: V
|
|
1903
1903
|
};
|
|
1904
|
-
return
|
|
1904
|
+
return n.doctype ? {
|
|
1905
1905
|
stonecrop: r,
|
|
1906
1906
|
operationLog: O,
|
|
1907
|
-
provideHSTPath:
|
|
1908
|
-
handleHSTChange:
|
|
1909
|
-
hstStore:
|
|
1907
|
+
provideHSTPath: l,
|
|
1908
|
+
handleHSTChange: u,
|
|
1909
|
+
hstStore: o,
|
|
1910
1910
|
formData: s
|
|
1911
|
-
} : !
|
|
1911
|
+
} : !n.doctype && e?.router ? {
|
|
1912
1912
|
stonecrop: r,
|
|
1913
1913
|
operationLog: O,
|
|
1914
|
-
provideHSTPath:
|
|
1915
|
-
handleHSTChange:
|
|
1916
|
-
hstStore:
|
|
1914
|
+
provideHSTPath: l,
|
|
1915
|
+
handleHSTChange: u,
|
|
1916
|
+
hstStore: o,
|
|
1917
1917
|
formData: s
|
|
1918
1918
|
} : {
|
|
1919
1919
|
stonecrop: r,
|
|
1920
1920
|
operationLog: O
|
|
1921
1921
|
};
|
|
1922
1922
|
}
|
|
1923
|
-
function he(
|
|
1923
|
+
function he(n) {
|
|
1924
1924
|
const e = {};
|
|
1925
|
-
return
|
|
1925
|
+
return n.schema && n.schema.forEach((t) => {
|
|
1926
1926
|
switch ("fieldtype" in t ? t.fieldtype : "Data") {
|
|
1927
1927
|
case "Data":
|
|
1928
1928
|
case "Text":
|
|
@@ -1946,15 +1946,15 @@ function he(o) {
|
|
|
1946
1946
|
}
|
|
1947
1947
|
}), e;
|
|
1948
1948
|
}
|
|
1949
|
-
function
|
|
1949
|
+
function ke(n, e, t, r) {
|
|
1950
1950
|
H(
|
|
1951
1951
|
t,
|
|
1952
|
-
(
|
|
1953
|
-
const s = `${
|
|
1954
|
-
Object.keys(
|
|
1952
|
+
(o) => {
|
|
1953
|
+
const s = `${n.slug}.${e}`;
|
|
1954
|
+
Object.keys(o).forEach((i) => {
|
|
1955
1955
|
const a = `${s}.${i}`;
|
|
1956
1956
|
try {
|
|
1957
|
-
r.set(a,
|
|
1957
|
+
r.set(a, o[i]);
|
|
1958
1958
|
} catch {
|
|
1959
1959
|
}
|
|
1960
1960
|
});
|
|
@@ -1962,100 +1962,100 @@ function Ve(o, e, t, r) {
|
|
|
1962
1962
|
{ deep: !0 }
|
|
1963
1963
|
);
|
|
1964
1964
|
}
|
|
1965
|
-
function Pt(
|
|
1966
|
-
let r =
|
|
1965
|
+
function Pt(n, e, t) {
|
|
1966
|
+
let r = n;
|
|
1967
1967
|
for (let s = 0; s < e.length - 1; s++) {
|
|
1968
1968
|
const i = e[s];
|
|
1969
1969
|
(!(i in r) || typeof r[i] != "object") && (r[i] = isNaN(Number(e[s + 1])) ? {} : []), r = r[i];
|
|
1970
1970
|
}
|
|
1971
|
-
const
|
|
1972
|
-
r[
|
|
1971
|
+
const o = e[e.length - 1];
|
|
1972
|
+
r[o] = t;
|
|
1973
1973
|
}
|
|
1974
|
-
function
|
|
1975
|
-
const t = te("$operationLogStore", void 0) ||
|
|
1976
|
-
|
|
1977
|
-
const { operations: r, currentIndex:
|
|
1978
|
-
function
|
|
1974
|
+
function qe(n) {
|
|
1975
|
+
const t = te("$operationLogStore", void 0) || ue();
|
|
1976
|
+
n && t.configure(n);
|
|
1977
|
+
const { operations: r, currentIndex: o, undoRedoState: s, canUndo: i, canRedo: a, undoCount: c, redoCount: h } = We(t);
|
|
1978
|
+
function g(E) {
|
|
1979
1979
|
return t.undo(E);
|
|
1980
1980
|
}
|
|
1981
1981
|
function w(E) {
|
|
1982
1982
|
return t.redo(E);
|
|
1983
1983
|
}
|
|
1984
|
-
function
|
|
1984
|
+
function R() {
|
|
1985
1985
|
t.startBatch();
|
|
1986
1986
|
}
|
|
1987
|
-
function
|
|
1987
|
+
function $(E) {
|
|
1988
1988
|
return t.commitBatch(E);
|
|
1989
1989
|
}
|
|
1990
|
-
function
|
|
1990
|
+
function T() {
|
|
1991
1991
|
t.cancelBatch();
|
|
1992
1992
|
}
|
|
1993
|
-
function
|
|
1993
|
+
function L() {
|
|
1994
1994
|
t.clear();
|
|
1995
1995
|
}
|
|
1996
|
-
function
|
|
1997
|
-
return t.getOperationsFor(E,
|
|
1996
|
+
function P(E, _) {
|
|
1997
|
+
return t.getOperationsFor(E, _);
|
|
1998
1998
|
}
|
|
1999
|
-
function
|
|
1999
|
+
function I() {
|
|
2000
2000
|
return t.getSnapshot();
|
|
2001
2001
|
}
|
|
2002
|
-
function
|
|
2003
|
-
t.markIrreversible(E,
|
|
2002
|
+
function N(E, _) {
|
|
2003
|
+
t.markIrreversible(E, _);
|
|
2004
2004
|
}
|
|
2005
|
-
function S(E,
|
|
2006
|
-
return t.logAction(E,
|
|
2005
|
+
function S(E, _, v, x = "success", V) {
|
|
2006
|
+
return t.logAction(E, _, v, x, V);
|
|
2007
2007
|
}
|
|
2008
|
-
function
|
|
2008
|
+
function D(E) {
|
|
2009
2009
|
t.configure(E);
|
|
2010
2010
|
}
|
|
2011
2011
|
return {
|
|
2012
2012
|
// State
|
|
2013
2013
|
operations: r,
|
|
2014
|
-
currentIndex:
|
|
2014
|
+
currentIndex: o,
|
|
2015
2015
|
undoRedoState: s,
|
|
2016
2016
|
canUndo: i,
|
|
2017
2017
|
canRedo: a,
|
|
2018
2018
|
undoCount: c,
|
|
2019
2019
|
redoCount: h,
|
|
2020
2020
|
// Methods
|
|
2021
|
-
undo:
|
|
2021
|
+
undo: g,
|
|
2022
2022
|
redo: w,
|
|
2023
|
-
startBatch:
|
|
2024
|
-
commitBatch:
|
|
2025
|
-
cancelBatch:
|
|
2026
|
-
clear:
|
|
2027
|
-
getOperationsFor:
|
|
2028
|
-
getSnapshot:
|
|
2029
|
-
markIrreversible:
|
|
2023
|
+
startBatch: R,
|
|
2024
|
+
commitBatch: $,
|
|
2025
|
+
cancelBatch: T,
|
|
2026
|
+
clear: L,
|
|
2027
|
+
getOperationsFor: P,
|
|
2028
|
+
getSnapshot: I,
|
|
2029
|
+
markIrreversible: N,
|
|
2030
2030
|
logAction: S,
|
|
2031
|
-
configure:
|
|
2031
|
+
configure: D
|
|
2032
2032
|
};
|
|
2033
2033
|
}
|
|
2034
|
-
function
|
|
2034
|
+
function Mt(n, e = !0) {
|
|
2035
2035
|
if (!e) return;
|
|
2036
|
-
const { undo: t, redo: r, canUndo:
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
}),
|
|
2040
|
-
|
|
2041
|
-
}),
|
|
2042
|
-
s.value && r(
|
|
2043
|
-
}),
|
|
2044
|
-
s.value && r(
|
|
2045
|
-
}),
|
|
2046
|
-
s.value && r(
|
|
2036
|
+
const { undo: t, redo: r, canUndo: o, canRedo: s } = qe(), i = Ot();
|
|
2037
|
+
ne(i["Ctrl+Z"], () => {
|
|
2038
|
+
o.value && t(n);
|
|
2039
|
+
}), ne(i["Meta+Z"], () => {
|
|
2040
|
+
o.value && t(n);
|
|
2041
|
+
}), ne(i["Ctrl+Shift+Z"], () => {
|
|
2042
|
+
s.value && r(n);
|
|
2043
|
+
}), ne(i["Meta+Shift+Z"], () => {
|
|
2044
|
+
s.value && r(n);
|
|
2045
|
+
}), ne(i["Ctrl+Y"], () => {
|
|
2046
|
+
s.value && r(n);
|
|
2047
2047
|
});
|
|
2048
2048
|
}
|
|
2049
|
-
async function
|
|
2050
|
-
const { startBatch: t, commitBatch: r, cancelBatch:
|
|
2049
|
+
async function xt(n, e) {
|
|
2050
|
+
const { startBatch: t, commitBatch: r, cancelBatch: o } = qe();
|
|
2051
2051
|
t();
|
|
2052
2052
|
try {
|
|
2053
|
-
return await
|
|
2053
|
+
return await n(), r(e);
|
|
2054
2054
|
} catch (s) {
|
|
2055
|
-
throw
|
|
2055
|
+
throw o(), s;
|
|
2056
2056
|
}
|
|
2057
2057
|
}
|
|
2058
|
-
class
|
|
2058
|
+
class Bt {
|
|
2059
2059
|
/**
|
|
2060
2060
|
* The doctype name
|
|
2061
2061
|
* @public
|
|
@@ -2094,8 +2094,8 @@ class Mt {
|
|
|
2094
2094
|
* @param actions - The doctype actions and field triggers
|
|
2095
2095
|
* @param component - Optional Vue component for rendering the doctype
|
|
2096
2096
|
*/
|
|
2097
|
-
constructor(e, t, r,
|
|
2098
|
-
this.doctype = e, this.schema = t, this.workflow = r, this.actions =
|
|
2097
|
+
constructor(e, t, r, o, s) {
|
|
2098
|
+
this.doctype = e, this.schema = t, this.workflow = r, this.actions = o, this.component = s;
|
|
2099
2099
|
}
|
|
2100
2100
|
/**
|
|
2101
2101
|
* Converts the registered doctype string to a slug (kebab-case). The following conversions are made:
|
|
@@ -2161,7 +2161,7 @@ class ce {
|
|
|
2161
2161
|
*/
|
|
2162
2162
|
addDoctype(e) {
|
|
2163
2163
|
e.doctype in Object.keys(this.registry) || (this.registry[e.slug] = e);
|
|
2164
|
-
const t =
|
|
2164
|
+
const t = J();
|
|
2165
2165
|
t.registerDoctypeActions(e.doctype, e.actions), e.slug !== e.doctype && t.registerDoctypeActions(e.slug, e.actions), e.component && this.router && !this.router.hasRoute(e.doctype) && this.router.addRoute({
|
|
2166
2166
|
path: `/${e.slug}`,
|
|
2167
2167
|
name: e.slug,
|
|
@@ -2181,53 +2181,272 @@ class ce {
|
|
|
2181
2181
|
// }
|
|
2182
2182
|
// }
|
|
2183
2183
|
}
|
|
2184
|
-
async function
|
|
2185
|
-
await
|
|
2184
|
+
async function _t(n, e, t) {
|
|
2185
|
+
await le();
|
|
2186
2186
|
try {
|
|
2187
|
-
await t(
|
|
2187
|
+
await t(n, e);
|
|
2188
2188
|
} catch {
|
|
2189
2189
|
}
|
|
2190
2190
|
}
|
|
2191
|
-
const
|
|
2192
|
-
install: (
|
|
2193
|
-
const t =
|
|
2194
|
-
!t && r &&
|
|
2195
|
-
const s = new ce(
|
|
2196
|
-
|
|
2191
|
+
const jt = {
|
|
2192
|
+
install: (n, e) => {
|
|
2193
|
+
const t = n.config.globalProperties.$router, r = e?.router, o = t || r;
|
|
2194
|
+
!t && r && n.use(r);
|
|
2195
|
+
const s = new ce(o, e?.getMeta);
|
|
2196
|
+
n.provide("$registry", s), n.config.globalProperties.$registry = s;
|
|
2197
2197
|
const i = new He(s);
|
|
2198
|
-
|
|
2198
|
+
n.provide("$stonecrop", i), n.config.globalProperties.$stonecrop = i;
|
|
2199
2199
|
try {
|
|
2200
|
-
const a =
|
|
2200
|
+
const a = n.config.globalProperties.$pinia;
|
|
2201
2201
|
if (a) {
|
|
2202
|
-
const c =
|
|
2203
|
-
|
|
2202
|
+
const c = ue(a);
|
|
2203
|
+
n.provide("$operationLogStore", c), n.config.globalProperties.$operationLogStore = c;
|
|
2204
2204
|
}
|
|
2205
2205
|
} catch (a) {
|
|
2206
2206
|
console.warn("Pinia not available - operation log features will be disabled:", a);
|
|
2207
2207
|
}
|
|
2208
2208
|
if (e?.components)
|
|
2209
2209
|
for (const [a, c] of Object.entries(e.components))
|
|
2210
|
-
|
|
2211
|
-
e?.autoInitializeRouter && e.onRouterInitialized &&
|
|
2210
|
+
n.component(a, c);
|
|
2211
|
+
e?.autoInitializeRouter && e.onRouterInitialized && _t(s, i, e.onRouterInitialized);
|
|
2212
2212
|
}
|
|
2213
2213
|
};
|
|
2214
|
+
var At = /* @__PURE__ */ ((n) => (n.ERROR = "error", n.WARNING = "warning", n.INFO = "info", n))(At || {});
|
|
2215
|
+
class $t {
|
|
2216
|
+
options;
|
|
2217
|
+
/**
|
|
2218
|
+
* Creates a new SchemaValidator instance
|
|
2219
|
+
* @param options - Validator configuration options
|
|
2220
|
+
*/
|
|
2221
|
+
constructor(e = {}) {
|
|
2222
|
+
this.options = {
|
|
2223
|
+
registry: e.registry || null,
|
|
2224
|
+
validateLinkTargets: e.validateLinkTargets ?? !0,
|
|
2225
|
+
validateActions: e.validateActions ?? !0,
|
|
2226
|
+
validateWorkflows: e.validateWorkflows ?? !0,
|
|
2227
|
+
validateRequiredProperties: e.validateRequiredProperties ?? !0
|
|
2228
|
+
};
|
|
2229
|
+
}
|
|
2230
|
+
/**
|
|
2231
|
+
* Validates a complete doctype schema
|
|
2232
|
+
* @param doctype - Doctype name
|
|
2233
|
+
* @param schema - Schema fields (List or Array)
|
|
2234
|
+
* @param workflow - Optional workflow configuration
|
|
2235
|
+
* @param actions - Optional actions map
|
|
2236
|
+
* @returns Validation result
|
|
2237
|
+
*/
|
|
2238
|
+
validate(e, t, r, o) {
|
|
2239
|
+
const s = [], i = t ? Array.isArray(t) ? t : t.toArray() : [];
|
|
2240
|
+
if (this.options.validateRequiredProperties && s.push(...this.validateRequiredProperties(e, i)), this.options.validateLinkTargets && this.options.registry && s.push(...this.validateLinkFields(e, i, this.options.registry)), this.options.validateWorkflows && r && s.push(...this.validateWorkflow(e, r)), this.options.validateActions && o) {
|
|
2241
|
+
const g = o instanceof Map ? o : o.toObject();
|
|
2242
|
+
s.push(...this.validateActionRegistration(e, g));
|
|
2243
|
+
}
|
|
2244
|
+
const a = s.filter(
|
|
2245
|
+
(g) => g.severity === "error"
|
|
2246
|
+
/* ERROR */
|
|
2247
|
+
).length, c = s.filter(
|
|
2248
|
+
(g) => g.severity === "warning"
|
|
2249
|
+
/* WARNING */
|
|
2250
|
+
).length, h = s.filter(
|
|
2251
|
+
(g) => g.severity === "info"
|
|
2252
|
+
/* INFO */
|
|
2253
|
+
).length;
|
|
2254
|
+
return {
|
|
2255
|
+
valid: a === 0,
|
|
2256
|
+
issues: s,
|
|
2257
|
+
errorCount: a,
|
|
2258
|
+
warningCount: c,
|
|
2259
|
+
infoCount: h
|
|
2260
|
+
};
|
|
2261
|
+
}
|
|
2262
|
+
/**
|
|
2263
|
+
* Validates that required schema properties are present
|
|
2264
|
+
* @internal
|
|
2265
|
+
*/
|
|
2266
|
+
validateRequiredProperties(e, t) {
|
|
2267
|
+
const r = [];
|
|
2268
|
+
for (const o of t) {
|
|
2269
|
+
if (!o.fieldname) {
|
|
2270
|
+
r.push({
|
|
2271
|
+
severity: "error",
|
|
2272
|
+
rule: "required-fieldname",
|
|
2273
|
+
message: "Field is missing required property: fieldname",
|
|
2274
|
+
doctype: e,
|
|
2275
|
+
context: { field: o }
|
|
2276
|
+
});
|
|
2277
|
+
continue;
|
|
2278
|
+
}
|
|
2279
|
+
if (!o.component && !("fieldtype" in o) && r.push({
|
|
2280
|
+
severity: "error",
|
|
2281
|
+
rule: "required-component-or-fieldtype",
|
|
2282
|
+
message: `Field "${o.fieldname}" must have either component or fieldtype property`,
|
|
2283
|
+
doctype: e,
|
|
2284
|
+
fieldname: o.fieldname
|
|
2285
|
+
}), "schema" in o) {
|
|
2286
|
+
const s = o.schema, i = Array.isArray(s) ? s : s.toArray?.() || [];
|
|
2287
|
+
r.push(...this.validateRequiredProperties(e, i));
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
return r;
|
|
2291
|
+
}
|
|
2292
|
+
/**
|
|
2293
|
+
* Validates Link field targets exist in registry
|
|
2294
|
+
* @internal
|
|
2295
|
+
*/
|
|
2296
|
+
validateLinkFields(e, t, r) {
|
|
2297
|
+
const o = [];
|
|
2298
|
+
for (const s of t) {
|
|
2299
|
+
if (("fieldtype" in s ? s.fieldtype : void 0) === "Link") {
|
|
2300
|
+
const a = "options" in s ? s.options : void 0;
|
|
2301
|
+
if (!a) {
|
|
2302
|
+
o.push({
|
|
2303
|
+
severity: "error",
|
|
2304
|
+
rule: "link-missing-options",
|
|
2305
|
+
message: `Link field "${s.fieldname}" is missing options property (target doctype)`,
|
|
2306
|
+
doctype: e,
|
|
2307
|
+
fieldname: s.fieldname
|
|
2308
|
+
});
|
|
2309
|
+
continue;
|
|
2310
|
+
}
|
|
2311
|
+
const c = typeof a == "string" ? a : "";
|
|
2312
|
+
if (!c) {
|
|
2313
|
+
o.push({
|
|
2314
|
+
severity: "error",
|
|
2315
|
+
rule: "link-invalid-options",
|
|
2316
|
+
message: `Link field "${s.fieldname}" has invalid options format (expected string doctype name)`,
|
|
2317
|
+
doctype: e,
|
|
2318
|
+
fieldname: s.fieldname
|
|
2319
|
+
});
|
|
2320
|
+
continue;
|
|
2321
|
+
}
|
|
2322
|
+
r.registry[c] || r.registry[c.toLowerCase()] || o.push({
|
|
2323
|
+
severity: "error",
|
|
2324
|
+
rule: "link-invalid-target",
|
|
2325
|
+
message: `Link field "${s.fieldname}" references non-existent doctype: "${c}"`,
|
|
2326
|
+
doctype: e,
|
|
2327
|
+
fieldname: s.fieldname,
|
|
2328
|
+
context: { targetDoctype: c }
|
|
2329
|
+
});
|
|
2330
|
+
}
|
|
2331
|
+
if ("schema" in s) {
|
|
2332
|
+
const a = s.schema, c = Array.isArray(a) ? a : a.toArray?.() || [];
|
|
2333
|
+
o.push(...this.validateLinkFields(e, c, r));
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
return o;
|
|
2337
|
+
}
|
|
2338
|
+
/**
|
|
2339
|
+
* Validates workflow state machine configuration
|
|
2340
|
+
* @internal
|
|
2341
|
+
*/
|
|
2342
|
+
validateWorkflow(e, t) {
|
|
2343
|
+
const r = [];
|
|
2344
|
+
if (!t.initial && !t.type && r.push({
|
|
2345
|
+
severity: "warning",
|
|
2346
|
+
rule: "workflow-missing-initial",
|
|
2347
|
+
message: "Workflow is missing initial state property",
|
|
2348
|
+
doctype: e
|
|
2349
|
+
}), !t.states || Object.keys(t.states).length === 0)
|
|
2350
|
+
return r.push({
|
|
2351
|
+
severity: "warning",
|
|
2352
|
+
rule: "workflow-no-states",
|
|
2353
|
+
message: "Workflow has no states defined",
|
|
2354
|
+
doctype: e
|
|
2355
|
+
}), r;
|
|
2356
|
+
t.initial && typeof t.initial == "string" && !t.states[t.initial] && r.push({
|
|
2357
|
+
severity: "error",
|
|
2358
|
+
rule: "workflow-invalid-initial",
|
|
2359
|
+
message: `Workflow initial state "${t.initial}" does not exist in states`,
|
|
2360
|
+
doctype: e,
|
|
2361
|
+
context: { initialState: t.initial }
|
|
2362
|
+
});
|
|
2363
|
+
const o = Object.keys(t.states), s = /* @__PURE__ */ new Set();
|
|
2364
|
+
t.initial && typeof t.initial == "string" && s.add(t.initial);
|
|
2365
|
+
for (const [i, a] of Object.entries(t.states)) {
|
|
2366
|
+
const c = a;
|
|
2367
|
+
if (c.on) {
|
|
2368
|
+
for (const [h, g] of Object.entries(c.on))
|
|
2369
|
+
if (typeof g == "string")
|
|
2370
|
+
s.add(g);
|
|
2371
|
+
else if (g && typeof g == "object") {
|
|
2372
|
+
const w = "target" in g ? g.target : void 0;
|
|
2373
|
+
typeof w == "string" ? s.add(w) : Array.isArray(w) && w.forEach((R) => {
|
|
2374
|
+
typeof R == "string" && s.add(R);
|
|
2375
|
+
});
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
for (const i of o)
|
|
2380
|
+
s.has(i) || r.push({
|
|
2381
|
+
severity: "warning",
|
|
2382
|
+
rule: "workflow-unreachable-state",
|
|
2383
|
+
message: `Workflow state "${i}" may not be reachable`,
|
|
2384
|
+
doctype: e,
|
|
2385
|
+
context: { stateName: i }
|
|
2386
|
+
});
|
|
2387
|
+
return r;
|
|
2388
|
+
}
|
|
2389
|
+
/**
|
|
2390
|
+
* Validates that actions are registered in the FieldTriggerEngine
|
|
2391
|
+
* @internal
|
|
2392
|
+
*/
|
|
2393
|
+
validateActionRegistration(e, t) {
|
|
2394
|
+
const r = [], o = J();
|
|
2395
|
+
for (const [s, i] of Object.entries(t)) {
|
|
2396
|
+
if (!Array.isArray(i)) {
|
|
2397
|
+
r.push({
|
|
2398
|
+
severity: "error",
|
|
2399
|
+
rule: "action-invalid-format",
|
|
2400
|
+
message: `Action configuration for "${s}" must be an array`,
|
|
2401
|
+
doctype: e,
|
|
2402
|
+
context: { triggerName: s, actionNames: i }
|
|
2403
|
+
});
|
|
2404
|
+
continue;
|
|
2405
|
+
}
|
|
2406
|
+
for (const a of i) {
|
|
2407
|
+
const c = o;
|
|
2408
|
+
c.globalActions?.has(a) || c.globalTransitionActions?.has(a) || r.push({
|
|
2409
|
+
severity: "warning",
|
|
2410
|
+
rule: "action-not-registered",
|
|
2411
|
+
message: `Action "${a}" referenced in "${s}" is not registered in FieldTriggerEngine`,
|
|
2412
|
+
doctype: e,
|
|
2413
|
+
context: { triggerName: s, actionName: a }
|
|
2414
|
+
});
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
return r;
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2420
|
+
function It(n, e) {
|
|
2421
|
+
return new $t({
|
|
2422
|
+
registry: n,
|
|
2423
|
+
...e
|
|
2424
|
+
});
|
|
2425
|
+
}
|
|
2426
|
+
function Wt(n, e, t, r, o) {
|
|
2427
|
+
return It(t).validate(n, e, r, o);
|
|
2428
|
+
}
|
|
2214
2429
|
export {
|
|
2215
|
-
|
|
2430
|
+
Bt as DoctypeMeta,
|
|
2216
2431
|
ee as HST,
|
|
2217
2432
|
ce as Registry,
|
|
2433
|
+
$t as SchemaValidator,
|
|
2218
2434
|
He as Stonecrop,
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
Tt as
|
|
2226
|
-
Ct as
|
|
2227
|
-
|
|
2228
|
-
|
|
2435
|
+
At as ValidationSeverity,
|
|
2436
|
+
Nt as createHST,
|
|
2437
|
+
It as createValidator,
|
|
2438
|
+
jt as default,
|
|
2439
|
+
J as getGlobalTriggerEngine,
|
|
2440
|
+
Lt as markOperationIrreversible,
|
|
2441
|
+
Tt as registerGlobalAction,
|
|
2442
|
+
Ct as registerTransitionAction,
|
|
2443
|
+
kt as setFieldRollback,
|
|
2444
|
+
Ft as triggerTransition,
|
|
2445
|
+
qe as useOperationLog,
|
|
2446
|
+
ue as useOperationLogStore,
|
|
2229
2447
|
Vt as useStonecrop,
|
|
2230
|
-
|
|
2231
|
-
|
|
2448
|
+
Mt as useUndoRedoShortcuts,
|
|
2449
|
+
Wt as validateSchema,
|
|
2450
|
+
xt as withBatch
|
|
2232
2451
|
};
|
|
2233
2452
|
//# sourceMappingURL=stonecrop.js.map
|