@stonecrop/stonecrop 0.7.9 → 0.8.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/composable.d.ts +8 -0
- package/dist/src/composable.d.ts.map +1 -1
- package/dist/src/composable.js +129 -0
- package/dist/src/registry.d.ts +59 -0
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +166 -0
- package/dist/src/stonecrop.d.ts.map +1 -1
- package/dist/src/stonecrop.js +6 -3
- package/dist/src/stores/hst.d.ts +5 -0
- package/dist/src/stores/hst.d.ts.map +1 -1
- package/dist/src/stores/hst.js +10 -3
- package/dist/stonecrop.d.ts +163 -1
- package/dist/stonecrop.js +917 -729
- 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 +3 -3
- package/src/composable.ts +166 -0
- package/src/registry.ts +189 -0
- package/src/stonecrop.ts +6 -3
- package/src/stores/hst.ts +13 -3
package/dist/stonecrop.js
CHANGED
|
@@ -1,182 +1,182 @@
|
|
|
1
|
-
import { hasInjectionContext as
|
|
2
|
-
const
|
|
3
|
-
let
|
|
4
|
-
const
|
|
1
|
+
import { hasInjectionContext as Ae, inject as oe, getCurrentInstance as Me, toRaw as Fe, computed as W, isRef as se, isReactive as be, toRef as ce, ref as B, reactive as ye, markRaw as ae, effectScope as Ye, nextTick as de, getCurrentScope as Xe, onScopeDispose as et, watch as U, toRefs as $e, onMounted as Be, readonly as je, customRef as tt, toValue as q, shallowRef as We, unref as rt, provide as De } from "vue";
|
|
2
|
+
const te = typeof window < "u";
|
|
3
|
+
let G;
|
|
4
|
+
const me = (n) => G = n;
|
|
5
5
|
process.env.NODE_ENV;
|
|
6
|
-
const
|
|
6
|
+
const Pe = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia") : (
|
|
7
7
|
/* istanbul ignore next */
|
|
8
8
|
/* @__PURE__ */ Symbol()
|
|
9
9
|
);
|
|
10
|
-
function
|
|
10
|
+
function Y(n) {
|
|
11
11
|
return n && typeof n == "object" && Object.prototype.toString.call(n) === "[object Object]" && typeof n.toJSON != "function";
|
|
12
12
|
}
|
|
13
|
-
var
|
|
13
|
+
var le;
|
|
14
14
|
(function(n) {
|
|
15
15
|
n.direct = "direct", n.patchObject = "patch object", n.patchFunction = "patch function";
|
|
16
|
-
})(
|
|
17
|
-
function
|
|
16
|
+
})(le || (le = {}));
|
|
17
|
+
function He(n, e) {
|
|
18
18
|
for (const t in e) {
|
|
19
19
|
const r = e[t];
|
|
20
20
|
if (!(t in n))
|
|
21
21
|
continue;
|
|
22
22
|
const o = n[t];
|
|
23
|
-
|
|
23
|
+
Y(o) && Y(r) && !se(r) && !be(r) ? n[t] = He(o, r) : n[t] = r;
|
|
24
24
|
}
|
|
25
25
|
return n;
|
|
26
26
|
}
|
|
27
|
-
const
|
|
27
|
+
const ze = () => {
|
|
28
28
|
};
|
|
29
|
-
function
|
|
29
|
+
function Te(n, e, t, r = ze) {
|
|
30
30
|
n.add(e);
|
|
31
31
|
const o = () => {
|
|
32
32
|
n.delete(e) && r();
|
|
33
33
|
};
|
|
34
|
-
return !t &&
|
|
34
|
+
return !t && Xe() && et(o), o;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function ee(n, ...e) {
|
|
37
37
|
n.forEach((t) => {
|
|
38
38
|
t(...e);
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
function
|
|
41
|
+
const nt = (n) => n(), Ie = /* @__PURE__ */ Symbol(), Ee = /* @__PURE__ */ Symbol();
|
|
42
|
+
function Ne(n, e) {
|
|
43
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
47
|
const r = e[t], o = n[t];
|
|
48
|
-
|
|
48
|
+
Y(o) && Y(r) && n.hasOwnProperty(t) && !se(r) && !be(r) ? n[t] = Ne(o, r) : n[t] = r;
|
|
49
49
|
}
|
|
50
50
|
return n;
|
|
51
51
|
}
|
|
52
|
-
const
|
|
52
|
+
const ot = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia:skipHydration") : (
|
|
53
53
|
/* istanbul ignore next */
|
|
54
54
|
/* @__PURE__ */ Symbol()
|
|
55
55
|
);
|
|
56
|
-
function
|
|
57
|
-
return !
|
|
56
|
+
function st(n) {
|
|
57
|
+
return !Y(n) || !Object.prototype.hasOwnProperty.call(n, ot);
|
|
58
58
|
}
|
|
59
|
-
const { assign:
|
|
60
|
-
function
|
|
61
|
-
return !!(
|
|
59
|
+
const { assign: z } = Object;
|
|
60
|
+
function Ce(n) {
|
|
61
|
+
return !!(se(n) && n.effect);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function ke(n, e, t, r) {
|
|
64
64
|
const { state: o, actions: s, getters: i } = e, a = t.state.value[n];
|
|
65
65
|
let c;
|
|
66
|
-
function
|
|
66
|
+
function f() {
|
|
67
67
|
!a && (process.env.NODE_ENV === "production" || !r) && (t.state.value[n] = o ? o() : {});
|
|
68
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
|
-
|
|
71
|
-
) :
|
|
72
|
-
return
|
|
73
|
-
|
|
70
|
+
$e(B(o ? o() : {}).value)
|
|
71
|
+
) : $e(t.state.value[n]);
|
|
72
|
+
return z(g, s, Object.keys(i || {}).reduce((b, A) => (process.env.NODE_ENV !== "production" && A in g && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${A}" in store "${n}".`), b[A] = ae(W(() => {
|
|
73
|
+
me(t);
|
|
74
74
|
const $ = t._s.get(n);
|
|
75
|
-
return i[
|
|
76
|
-
})),
|
|
75
|
+
return i[A].call($, $);
|
|
76
|
+
})), b), {}));
|
|
77
77
|
}
|
|
78
|
-
return c =
|
|
78
|
+
return c = _e(n, f, e, t, r, !0), c;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function _e(n, e, t = {}, r, o, s) {
|
|
81
81
|
let i;
|
|
82
|
-
const a =
|
|
82
|
+
const a = z({ 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
|
-
|
|
86
|
+
process.env.NODE_ENV !== "production" && (c.onTrigger = (d) => {
|
|
87
|
+
f ? $ = d : f == !1 && !v._hotUpdating && (Array.isArray($) ? $.push(d) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
|
|
88
88
|
});
|
|
89
|
-
let
|
|
90
|
-
const
|
|
91
|
-
!s && !
|
|
92
|
-
const
|
|
93
|
-
let
|
|
94
|
-
function
|
|
95
|
-
let
|
|
96
|
-
|
|
97
|
-
type:
|
|
89
|
+
let f, g, b = /* @__PURE__ */ new Set(), A = /* @__PURE__ */ new Set(), $;
|
|
90
|
+
const k = r.state.value[n];
|
|
91
|
+
!s && !k && (process.env.NODE_ENV === "production" || !o) && (r.state.value[n] = {});
|
|
92
|
+
const x = B({});
|
|
93
|
+
let N;
|
|
94
|
+
function D(d) {
|
|
95
|
+
let p;
|
|
96
|
+
f = g = !1, process.env.NODE_ENV !== "production" && ($ = []), typeof d == "function" ? (d(r.state.value[n]), p = {
|
|
97
|
+
type: le.patchFunction,
|
|
98
98
|
storeId: n,
|
|
99
99
|
events: $
|
|
100
|
-
}) : (
|
|
101
|
-
type:
|
|
102
|
-
payload:
|
|
100
|
+
}) : (Ne(r.state.value[n], d), p = {
|
|
101
|
+
type: le.patchObject,
|
|
102
|
+
payload: d,
|
|
103
103
|
storeId: n,
|
|
104
104
|
events: $
|
|
105
105
|
});
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}), g = !0,
|
|
110
|
-
}
|
|
111
|
-
const
|
|
112
|
-
const { state:
|
|
113
|
-
this.$patch((
|
|
114
|
-
|
|
106
|
+
const R = N = /* @__PURE__ */ Symbol();
|
|
107
|
+
de().then(() => {
|
|
108
|
+
N === R && (f = !0);
|
|
109
|
+
}), g = !0, ee(b, p, r.state.value[n]);
|
|
110
|
+
}
|
|
111
|
+
const P = s ? function() {
|
|
112
|
+
const { state: p } = t, R = p ? p() : {};
|
|
113
|
+
this.$patch((F) => {
|
|
114
|
+
z(F, R);
|
|
115
115
|
});
|
|
116
116
|
} : (
|
|
117
117
|
/* istanbul ignore next */
|
|
118
118
|
process.env.NODE_ENV !== "production" ? () => {
|
|
119
119
|
throw new Error(`🍍: Store "${n}" is built using the setup syntax and does not implement $reset().`);
|
|
120
|
-
} :
|
|
120
|
+
} : ze
|
|
121
121
|
);
|
|
122
122
|
function S() {
|
|
123
|
-
i.stop(),
|
|
124
|
-
}
|
|
125
|
-
const
|
|
126
|
-
if (
|
|
127
|
-
return
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
const
|
|
131
|
-
function
|
|
132
|
-
|
|
123
|
+
i.stop(), b.clear(), A.clear(), r._s.delete(n);
|
|
124
|
+
}
|
|
125
|
+
const C = (d, p = "") => {
|
|
126
|
+
if (Ie in d)
|
|
127
|
+
return d[Ee] = p, d;
|
|
128
|
+
const R = function() {
|
|
129
|
+
me(r);
|
|
130
|
+
const F = Array.from(arguments), w = /* @__PURE__ */ new Set(), T = /* @__PURE__ */ new Set();
|
|
131
|
+
function L(m) {
|
|
132
|
+
w.add(m);
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
|
|
134
|
+
function y(m) {
|
|
135
|
+
T.add(m);
|
|
136
136
|
}
|
|
137
|
-
|
|
138
|
-
args:
|
|
139
|
-
name:
|
|
137
|
+
ee(A, {
|
|
138
|
+
args: F,
|
|
139
|
+
name: R[Ee],
|
|
140
140
|
store: v,
|
|
141
|
-
after:
|
|
142
|
-
onError:
|
|
141
|
+
after: L,
|
|
142
|
+
onError: y
|
|
143
143
|
});
|
|
144
|
-
let
|
|
144
|
+
let E;
|
|
145
145
|
try {
|
|
146
|
-
|
|
147
|
-
} catch (
|
|
148
|
-
throw
|
|
146
|
+
E = d.apply(this && this.$id === n ? this : v, F);
|
|
147
|
+
} catch (m) {
|
|
148
|
+
throw ee(T, m), m;
|
|
149
149
|
}
|
|
150
|
-
return
|
|
150
|
+
return E instanceof Promise ? E.then((m) => (ee(w, m), m)).catch((m) => (ee(T, m), Promise.reject(m))) : (ee(w, E), E);
|
|
151
151
|
};
|
|
152
|
-
return
|
|
153
|
-
},
|
|
152
|
+
return R[Ie] = !0, R[Ee] = p, R;
|
|
153
|
+
}, O = /* @__PURE__ */ ae({
|
|
154
154
|
actions: {},
|
|
155
155
|
getters: {},
|
|
156
156
|
state: [],
|
|
157
|
-
hotState:
|
|
157
|
+
hotState: x
|
|
158
158
|
}), _ = {
|
|
159
159
|
_p: r,
|
|
160
160
|
// _s: scope,
|
|
161
161
|
$id: n,
|
|
162
|
-
$onAction:
|
|
163
|
-
$patch:
|
|
164
|
-
$reset:
|
|
165
|
-
$subscribe(
|
|
166
|
-
const
|
|
167
|
-
(
|
|
162
|
+
$onAction: Te.bind(null, A),
|
|
163
|
+
$patch: D,
|
|
164
|
+
$reset: P,
|
|
165
|
+
$subscribe(d, p = {}) {
|
|
166
|
+
const R = Te(b, d, p.detached, () => F()), F = i.run(() => U(() => r.state.value[n], (w) => {
|
|
167
|
+
(p.flush === "sync" ? g : f) && d({
|
|
168
168
|
storeId: n,
|
|
169
|
-
type:
|
|
169
|
+
type: le.direct,
|
|
170
170
|
events: $
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
return
|
|
171
|
+
}, w);
|
|
172
|
+
}, z({}, c, p)));
|
|
173
|
+
return R;
|
|
174
174
|
},
|
|
175
175
|
$dispose: S
|
|
176
|
-
}, v =
|
|
176
|
+
}, v = ye(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && te ? z(
|
|
177
177
|
{
|
|
178
|
-
_hmrPayload:
|
|
179
|
-
_customProperties:
|
|
178
|
+
_hmrPayload: O,
|
|
179
|
+
_customProperties: ae(/* @__PURE__ */ new Set())
|
|
180
180
|
// devtools custom properties
|
|
181
181
|
},
|
|
182
182
|
_
|
|
@@ -184,81 +184,81 @@ function Ne(n, e, t = {}, r, o, s) {
|
|
|
184
184
|
// setupStore
|
|
185
185
|
) : _);
|
|
186
186
|
r._s.set(n, v);
|
|
187
|
-
const
|
|
188
|
-
for (const
|
|
189
|
-
const
|
|
190
|
-
if (
|
|
191
|
-
process.env.NODE_ENV !== "production" && o ?
|
|
192
|
-
else if (typeof
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
} else process.env.NODE_ENV !== "production" &&
|
|
187
|
+
const M = (r._a && r._a.runWithContext || nt)(() => r._e.run(() => (i = Ye()).run(() => e({ action: C }))));
|
|
188
|
+
for (const d in M) {
|
|
189
|
+
const p = M[d];
|
|
190
|
+
if (se(p) && !Ce(p) || be(p))
|
|
191
|
+
process.env.NODE_ENV !== "production" && o ? x.value[d] = ce(M, d) : s || (k && st(p) && (se(p) ? p.value = k[d] : Ne(p, k[d])), r.state.value[n][d] = p), process.env.NODE_ENV !== "production" && O.state.push(d);
|
|
192
|
+
else if (typeof p == "function") {
|
|
193
|
+
const R = process.env.NODE_ENV !== "production" && o ? p : C(p, d);
|
|
194
|
+
M[d] = R, process.env.NODE_ENV !== "production" && (O.actions[d] = p), a.actions[d] = p;
|
|
195
|
+
} else process.env.NODE_ENV !== "production" && Ce(p) && (O.getters[d] = s ? (
|
|
196
196
|
// @ts-expect-error
|
|
197
|
-
t.getters[
|
|
198
|
-
) :
|
|
199
|
-
(
|
|
197
|
+
t.getters[d]
|
|
198
|
+
) : p, te && (M._getters || // @ts-expect-error: same
|
|
199
|
+
(M._getters = ae([]))).push(d));
|
|
200
200
|
}
|
|
201
|
-
if (
|
|
202
|
-
get: () => process.env.NODE_ENV !== "production" && o ?
|
|
203
|
-
set: (
|
|
201
|
+
if (z(v, M), z(Fe(v), M), Object.defineProperty(v, "$state", {
|
|
202
|
+
get: () => process.env.NODE_ENV !== "production" && o ? x.value : r.state.value[n],
|
|
203
|
+
set: (d) => {
|
|
204
204
|
if (process.env.NODE_ENV !== "production" && o)
|
|
205
205
|
throw new Error("cannot set hotState");
|
|
206
|
-
|
|
207
|
-
|
|
206
|
+
D((p) => {
|
|
207
|
+
z(p, d);
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
|
-
}), process.env.NODE_ENV !== "production" && (v._hotUpdate =
|
|
211
|
-
v._hotUpdating = !0,
|
|
212
|
-
if (
|
|
213
|
-
const
|
|
214
|
-
typeof
|
|
210
|
+
}), process.env.NODE_ENV !== "production" && (v._hotUpdate = ae((d) => {
|
|
211
|
+
v._hotUpdating = !0, d._hmrPayload.state.forEach((p) => {
|
|
212
|
+
if (p in v.$state) {
|
|
213
|
+
const R = d.$state[p], F = v.$state[p];
|
|
214
|
+
typeof R == "object" && Y(R) && Y(F) ? He(R, F) : d.$state[p] = F;
|
|
215
215
|
}
|
|
216
|
-
v[
|
|
217
|
-
}), Object.keys(v.$state).forEach((
|
|
218
|
-
|
|
219
|
-
}),
|
|
220
|
-
|
|
216
|
+
v[p] = ce(d.$state, p);
|
|
217
|
+
}), Object.keys(v.$state).forEach((p) => {
|
|
218
|
+
p in d.$state || delete v[p];
|
|
219
|
+
}), f = !1, g = !1, r.state.value[n] = ce(d._hmrPayload, "hotState"), g = !0, de().then(() => {
|
|
220
|
+
f = !0;
|
|
221
221
|
});
|
|
222
|
-
for (const
|
|
223
|
-
const
|
|
224
|
-
v[
|
|
225
|
-
|
|
222
|
+
for (const p in d._hmrPayload.actions) {
|
|
223
|
+
const R = d[p];
|
|
224
|
+
v[p] = //
|
|
225
|
+
C(R, p);
|
|
226
226
|
}
|
|
227
|
-
for (const
|
|
228
|
-
const
|
|
227
|
+
for (const p in d._hmrPayload.getters) {
|
|
228
|
+
const R = d._hmrPayload.getters[p], F = s ? (
|
|
229
229
|
// special handling of options api
|
|
230
|
-
|
|
231
|
-
) :
|
|
232
|
-
v[
|
|
233
|
-
|
|
230
|
+
W(() => (me(r), R.call(v, v)))
|
|
231
|
+
) : R;
|
|
232
|
+
v[p] = //
|
|
233
|
+
F;
|
|
234
234
|
}
|
|
235
|
-
Object.keys(v._hmrPayload.getters).forEach((
|
|
236
|
-
|
|
237
|
-
}), Object.keys(v._hmrPayload.actions).forEach((
|
|
238
|
-
|
|
239
|
-
}), v._hmrPayload =
|
|
240
|
-
})), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" &&
|
|
241
|
-
const
|
|
235
|
+
Object.keys(v._hmrPayload.getters).forEach((p) => {
|
|
236
|
+
p in d._hmrPayload.getters || delete v[p];
|
|
237
|
+
}), Object.keys(v._hmrPayload.actions).forEach((p) => {
|
|
238
|
+
p in d._hmrPayload.actions || delete v[p];
|
|
239
|
+
}), v._hmrPayload = d._hmrPayload, v._getters = d._getters, v._hotUpdating = !1;
|
|
240
|
+
})), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && te) {
|
|
241
|
+
const d = {
|
|
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(v,
|
|
247
|
+
["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((p) => {
|
|
248
|
+
Object.defineProperty(v, p, z({ value: v[p] }, d));
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
|
-
return r._p.forEach((
|
|
252
|
-
if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" &&
|
|
253
|
-
const
|
|
251
|
+
return r._p.forEach((d) => {
|
|
252
|
+
if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && te) {
|
|
253
|
+
const p = i.run(() => d({
|
|
254
254
|
store: v,
|
|
255
255
|
app: r._a,
|
|
256
256
|
pinia: r,
|
|
257
257
|
options: a
|
|
258
258
|
}));
|
|
259
|
-
Object.keys(
|
|
259
|
+
Object.keys(p || {}).forEach((R) => v._customProperties.add(R)), z(v, p);
|
|
260
260
|
} else
|
|
261
|
-
|
|
261
|
+
z(v, i.run(() => d({
|
|
262
262
|
store: v,
|
|
263
263
|
app: r._a,
|
|
264
264
|
pinia: r,
|
|
@@ -266,67 +266,67 @@ function Ne(n, e, t = {}, r, o, s) {
|
|
|
266
266
|
})));
|
|
267
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 "${v.$id}".`),
|
|
269
|
+
Found in store "${v.$id}".`), k && s && t.hydrate && t.hydrate(v.$state, k), f = !0, g = !0, v;
|
|
270
270
|
}
|
|
271
271
|
// @__NO_SIDE_EFFECTS__
|
|
272
|
-
function
|
|
272
|
+
function it(n, e, t) {
|
|
273
273
|
let r;
|
|
274
274
|
const o = typeof e == "function";
|
|
275
275
|
r = o ? t : e;
|
|
276
276
|
function s(i, a) {
|
|
277
|
-
const c =
|
|
277
|
+
const c = Ae();
|
|
278
278
|
if (i = // in test mode, ignore the argument provided as we can always retrieve a
|
|
279
279
|
// pinia instance with getActivePinia()
|
|
280
|
-
(process.env.NODE_ENV === "test" &&
|
|
280
|
+
(process.env.NODE_ENV === "test" && G && G._testing ? null : i) || (c ? oe(Pe, null) : null), i && me(i), process.env.NODE_ENV !== "production" && !G)
|
|
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 =
|
|
285
|
-
const
|
|
284
|
+
i = G, i._s.has(n) || (o ? _e(n, e, r, i) : ke(n, r, i), process.env.NODE_ENV !== "production" && (s._pinia = i));
|
|
285
|
+
const f = i._s.get(n);
|
|
286
286
|
if (process.env.NODE_ENV !== "production" && a) {
|
|
287
|
-
const g = "__hot:" + n,
|
|
288
|
-
a._hotUpdate(
|
|
287
|
+
const g = "__hot:" + n, b = o ? _e(g, e, r, i, !0) : ke(g, z({}, r), i, !0);
|
|
288
|
+
a._hotUpdate(b), delete i.state.value[g], i._s.delete(g);
|
|
289
289
|
}
|
|
290
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
291
|
-
const g =
|
|
290
|
+
if (process.env.NODE_ENV !== "production" && te) {
|
|
291
|
+
const g = Me();
|
|
292
292
|
if (g && g.proxy && // avoid adding stores that are just built for hot module replacement
|
|
293
293
|
!a) {
|
|
294
|
-
const
|
|
295
|
-
|
|
294
|
+
const b = g.proxy, A = "_pStores" in b ? b._pStores : b._pStores = {};
|
|
295
|
+
A[n] = f;
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
|
-
return
|
|
298
|
+
return f;
|
|
299
299
|
}
|
|
300
300
|
return s.$id = n, s;
|
|
301
301
|
}
|
|
302
|
-
function
|
|
303
|
-
const e =
|
|
302
|
+
function Ue(n) {
|
|
303
|
+
const e = Fe(n), t = {};
|
|
304
304
|
for (const r in e) {
|
|
305
305
|
const o = e[r];
|
|
306
306
|
o.effect ? t[r] = // ...
|
|
307
|
-
|
|
307
|
+
W({
|
|
308
308
|
get: () => n[r],
|
|
309
309
|
set(s) {
|
|
310
310
|
n[r] = s;
|
|
311
311
|
}
|
|
312
|
-
}) : (
|
|
313
|
-
|
|
312
|
+
}) : (se(o) || be(o)) && (t[r] = // ---
|
|
313
|
+
ce(n, r));
|
|
314
314
|
}
|
|
315
315
|
return t;
|
|
316
316
|
}
|
|
317
|
-
const
|
|
317
|
+
const at = typeof window < "u" && typeof document < "u";
|
|
318
318
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
319
|
-
const
|
|
319
|
+
const ct = Object.prototype.toString, lt = (n) => ct.call(n) === "[object Object]", Je = () => {
|
|
320
320
|
};
|
|
321
|
-
function
|
|
322
|
-
if (n.length !== 1) return
|
|
321
|
+
function ut(...n) {
|
|
322
|
+
if (n.length !== 1) return ce(...n);
|
|
323
323
|
const e = n[0];
|
|
324
|
-
return typeof e == "function" ?
|
|
324
|
+
return typeof e == "function" ? je(tt(() => ({
|
|
325
325
|
get: e,
|
|
326
|
-
set:
|
|
327
|
-
}))) :
|
|
326
|
+
set: Je
|
|
327
|
+
}))) : B(e);
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function ft(n, e) {
|
|
330
330
|
function t(...r) {
|
|
331
331
|
return new Promise((o, s) => {
|
|
332
332
|
Promise.resolve(n(() => e.apply(this, r), {
|
|
@@ -338,9 +338,9 @@ function it(n, e) {
|
|
|
338
338
|
}
|
|
339
339
|
return t;
|
|
340
340
|
}
|
|
341
|
-
const
|
|
342
|
-
function
|
|
343
|
-
const { initialState: t = "active" } = e, r =
|
|
341
|
+
const qe = (n) => n();
|
|
342
|
+
function dt(n = qe, e = {}) {
|
|
343
|
+
const { initialState: t = "active" } = e, r = ut(t === "active");
|
|
344
344
|
function o() {
|
|
345
345
|
r.value = !1;
|
|
346
346
|
}
|
|
@@ -351,90 +351,90 @@ function at(n = ze, e = {}) {
|
|
|
351
351
|
r.value && n(...a);
|
|
352
352
|
};
|
|
353
353
|
return {
|
|
354
|
-
isActive:
|
|
354
|
+
isActive: je(r),
|
|
355
355
|
pause: o,
|
|
356
356
|
resume: s,
|
|
357
357
|
eventFilter: i
|
|
358
358
|
};
|
|
359
359
|
}
|
|
360
|
-
function
|
|
360
|
+
function Oe(n) {
|
|
361
361
|
return Array.isArray(n) ? n : [n];
|
|
362
362
|
}
|
|
363
|
-
function
|
|
364
|
-
return
|
|
363
|
+
function pt(n) {
|
|
364
|
+
return Me();
|
|
365
365
|
}
|
|
366
|
-
function
|
|
367
|
-
const { eventFilter: r =
|
|
368
|
-
return
|
|
366
|
+
function ht(n, e, t = {}) {
|
|
367
|
+
const { eventFilter: r = qe, ...o } = t;
|
|
368
|
+
return U(n, ft(r, e), o);
|
|
369
369
|
}
|
|
370
|
-
function
|
|
371
|
-
const { eventFilter: r, initialState: o = "active", ...s } = t, { eventFilter: i, pause: a, resume: c, isActive:
|
|
370
|
+
function gt(n, e, t = {}) {
|
|
371
|
+
const { eventFilter: r, initialState: o = "active", ...s } = t, { eventFilter: i, pause: a, resume: c, isActive: f } = dt(r, { initialState: o });
|
|
372
372
|
return {
|
|
373
|
-
stop:
|
|
373
|
+
stop: ht(n, e, {
|
|
374
374
|
...s,
|
|
375
375
|
eventFilter: i
|
|
376
376
|
}),
|
|
377
377
|
pause: a,
|
|
378
378
|
resume: c,
|
|
379
|
-
isActive:
|
|
379
|
+
isActive: f
|
|
380
380
|
};
|
|
381
381
|
}
|
|
382
|
-
const
|
|
383
|
-
function
|
|
384
|
-
|
|
382
|
+
const vt = gt;
|
|
383
|
+
function yt(n, e = !0, t) {
|
|
384
|
+
pt() ? Be(n, t) : e ? n() : de(n);
|
|
385
385
|
}
|
|
386
|
-
function
|
|
387
|
-
return
|
|
386
|
+
function mt(n, e, t) {
|
|
387
|
+
return U(n, e, {
|
|
388
388
|
...t,
|
|
389
389
|
immediate: !0
|
|
390
390
|
});
|
|
391
391
|
}
|
|
392
|
-
function
|
|
393
|
-
return
|
|
392
|
+
function ie(n, e, t) {
|
|
393
|
+
return U(n, (o, s, i) => {
|
|
394
394
|
o && e(o, s, i);
|
|
395
395
|
}, {
|
|
396
396
|
...t,
|
|
397
397
|
once: !1
|
|
398
398
|
});
|
|
399
399
|
}
|
|
400
|
-
const
|
|
401
|
-
function
|
|
400
|
+
const Q = at ? window : void 0;
|
|
401
|
+
function St(n) {
|
|
402
402
|
var e;
|
|
403
403
|
const t = q(n);
|
|
404
404
|
return (e = t?.$el) !== null && e !== void 0 ? e : t;
|
|
405
405
|
}
|
|
406
|
-
function
|
|
407
|
-
const e = (r, o, s, i) => (r.addEventListener(o, s, i), () => r.removeEventListener(o, s, i)), t =
|
|
408
|
-
const r =
|
|
406
|
+
function re(...n) {
|
|
407
|
+
const e = (r, o, s, i) => (r.addEventListener(o, s, i), () => r.removeEventListener(o, s, i)), t = W(() => {
|
|
408
|
+
const r = Oe(q(n[0])).filter((o) => o != null);
|
|
409
409
|
return r.every((o) => typeof o != "string") ? r : void 0;
|
|
410
410
|
});
|
|
411
|
-
return
|
|
411
|
+
return mt(() => {
|
|
412
412
|
var r, o;
|
|
413
413
|
return [
|
|
414
|
-
(r = (o = t.value) === null || o === void 0 ? void 0 : o.map((s) =>
|
|
415
|
-
|
|
416
|
-
|
|
414
|
+
(r = (o = t.value) === null || o === void 0 ? void 0 : o.map((s) => St(s))) !== null && r !== void 0 ? r : [Q].filter((s) => s != null),
|
|
415
|
+
Oe(q(t.value ? n[1] : n[0])),
|
|
416
|
+
Oe(rt(t.value ? n[2] : n[1])),
|
|
417
417
|
q(t.value ? n[3] : n[2])
|
|
418
418
|
];
|
|
419
419
|
}, ([r, o, s, i], a, c) => {
|
|
420
420
|
if (!r?.length || !o?.length || !s?.length) return;
|
|
421
|
-
const
|
|
421
|
+
const f = lt(i) ? { ...i } : i, g = r.flatMap((b) => o.flatMap((A) => s.map(($) => e(b, A, $, f))));
|
|
422
422
|
c(() => {
|
|
423
|
-
g.forEach((
|
|
423
|
+
g.forEach((b) => b());
|
|
424
424
|
});
|
|
425
425
|
}, { flush: "post" });
|
|
426
426
|
}
|
|
427
|
-
const
|
|
428
|
-
function
|
|
429
|
-
return
|
|
427
|
+
const he = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, ge = "__vueuse_ssr_handlers__", bt = /* @__PURE__ */ wt();
|
|
428
|
+
function wt() {
|
|
429
|
+
return ge in he || (he[ge] = he[ge] || {}), he[ge];
|
|
430
430
|
}
|
|
431
|
-
function
|
|
432
|
-
return
|
|
431
|
+
function Et(n, e) {
|
|
432
|
+
return bt[n] || e;
|
|
433
433
|
}
|
|
434
|
-
function
|
|
434
|
+
function Ot(n) {
|
|
435
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 Rt = {
|
|
438
438
|
boolean: {
|
|
439
439
|
read: (n) => n === "true",
|
|
440
440
|
write: (n) => String(n)
|
|
@@ -467,98 +467,98 @@ const bt = {
|
|
|
467
467
|
read: (n) => new Date(n),
|
|
468
468
|
write: (n) => n.toISOString()
|
|
469
469
|
}
|
|
470
|
-
},
|
|
471
|
-
function
|
|
470
|
+
}, Le = "vueuse-storage";
|
|
471
|
+
function At(n, e, t, r = {}) {
|
|
472
472
|
var o;
|
|
473
|
-
const { flush: s = "pre", deep: i = !0, listenToStorageChanges: a = !0, writeDefaults: c = !0, mergeDefaults:
|
|
474
|
-
console.error(
|
|
475
|
-
}, initOnMounted:
|
|
473
|
+
const { flush: s = "pre", deep: i = !0, listenToStorageChanges: a = !0, writeDefaults: c = !0, mergeDefaults: f = !1, shallow: g, window: b = Q, eventFilter: A, onError: $ = (w) => {
|
|
474
|
+
console.error(w);
|
|
475
|
+
}, initOnMounted: k } = r, x = (g ? We : B)(e), N = W(() => q(n));
|
|
476
476
|
if (!t) try {
|
|
477
|
-
t =
|
|
478
|
-
} catch (
|
|
479
|
-
$(
|
|
477
|
+
t = Et("getDefaultStorage", () => Q?.localStorage)();
|
|
478
|
+
} catch (w) {
|
|
479
|
+
$(w);
|
|
480
480
|
}
|
|
481
|
-
if (!t) return
|
|
482
|
-
const
|
|
481
|
+
if (!t) return x;
|
|
482
|
+
const D = q(e), P = Ot(D), S = (o = r.serializer) !== null && o !== void 0 ? o : Rt[P], { pause: C, resume: O } = vt(x, (w) => d(w), {
|
|
483
483
|
flush: s,
|
|
484
484
|
deep: i,
|
|
485
|
-
eventFilter:
|
|
485
|
+
eventFilter: A
|
|
486
486
|
});
|
|
487
|
-
|
|
487
|
+
U(N, () => R(), { flush: s });
|
|
488
488
|
let _ = !1;
|
|
489
|
-
const v = (
|
|
490
|
-
|
|
491
|
-
},
|
|
492
|
-
|
|
489
|
+
const v = (w) => {
|
|
490
|
+
k && !_ || R(w);
|
|
491
|
+
}, j = (w) => {
|
|
492
|
+
k && !_ || F(w);
|
|
493
493
|
};
|
|
494
|
-
|
|
495
|
-
_ = !0,
|
|
496
|
-
}) :
|
|
497
|
-
function
|
|
498
|
-
if (
|
|
499
|
-
const
|
|
500
|
-
key:
|
|
501
|
-
oldValue:
|
|
502
|
-
newValue:
|
|
494
|
+
b && a && (t instanceof Storage ? re(b, "storage", v, { passive: !0 }) : re(b, Le, j)), k ? yt(() => {
|
|
495
|
+
_ = !0, R();
|
|
496
|
+
}) : R();
|
|
497
|
+
function M(w, T) {
|
|
498
|
+
if (b) {
|
|
499
|
+
const L = {
|
|
500
|
+
key: N.value,
|
|
501
|
+
oldValue: w,
|
|
502
|
+
newValue: T,
|
|
503
503
|
storageArea: t
|
|
504
504
|
};
|
|
505
|
-
|
|
505
|
+
b.dispatchEvent(t instanceof Storage ? new StorageEvent("storage", L) : new CustomEvent(Le, { detail: L }));
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
|
-
function
|
|
508
|
+
function d(w) {
|
|
509
509
|
try {
|
|
510
|
-
const
|
|
511
|
-
if (
|
|
512
|
-
|
|
510
|
+
const T = t.getItem(N.value);
|
|
511
|
+
if (w == null)
|
|
512
|
+
M(T, null), t.removeItem(N.value);
|
|
513
513
|
else {
|
|
514
|
-
const
|
|
515
|
-
|
|
514
|
+
const L = S.write(w);
|
|
515
|
+
T !== L && (t.setItem(N.value, L), M(T, L));
|
|
516
516
|
}
|
|
517
|
-
} catch (
|
|
518
|
-
$(
|
|
517
|
+
} catch (T) {
|
|
518
|
+
$(T);
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
-
function
|
|
522
|
-
const
|
|
523
|
-
if (
|
|
524
|
-
return c &&
|
|
525
|
-
if (!
|
|
526
|
-
const
|
|
527
|
-
return typeof
|
|
528
|
-
...
|
|
529
|
-
...
|
|
530
|
-
} :
|
|
531
|
-
} else return typeof
|
|
532
|
-
}
|
|
533
|
-
function
|
|
534
|
-
if (!(
|
|
535
|
-
if (
|
|
536
|
-
|
|
521
|
+
function p(w) {
|
|
522
|
+
const T = w ? w.newValue : t.getItem(N.value);
|
|
523
|
+
if (T == null)
|
|
524
|
+
return c && D != null && t.setItem(N.value, S.write(D)), D;
|
|
525
|
+
if (!w && f) {
|
|
526
|
+
const L = S.read(T);
|
|
527
|
+
return typeof f == "function" ? f(L, D) : P === "object" && !Array.isArray(L) ? {
|
|
528
|
+
...D,
|
|
529
|
+
...L
|
|
530
|
+
} : L;
|
|
531
|
+
} else return typeof T != "string" ? T : S.read(T);
|
|
532
|
+
}
|
|
533
|
+
function R(w) {
|
|
534
|
+
if (!(w && w.storageArea !== t)) {
|
|
535
|
+
if (w && w.key == null) {
|
|
536
|
+
x.value = D;
|
|
537
537
|
return;
|
|
538
538
|
}
|
|
539
|
-
if (!(
|
|
540
|
-
|
|
539
|
+
if (!(w && w.key !== N.value)) {
|
|
540
|
+
C();
|
|
541
541
|
try {
|
|
542
|
-
const
|
|
543
|
-
(
|
|
544
|
-
} catch (
|
|
545
|
-
$(
|
|
542
|
+
const T = S.write(x.value);
|
|
543
|
+
(w === void 0 || w?.newValue !== T) && (x.value = p(w));
|
|
544
|
+
} catch (T) {
|
|
545
|
+
$(T);
|
|
546
546
|
} finally {
|
|
547
|
-
|
|
547
|
+
w ? de(O) : O();
|
|
548
548
|
}
|
|
549
549
|
}
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
|
-
function
|
|
553
|
-
|
|
552
|
+
function F(w) {
|
|
553
|
+
R(w.detail);
|
|
554
554
|
}
|
|
555
|
-
return
|
|
555
|
+
return x;
|
|
556
556
|
}
|
|
557
|
-
function
|
|
558
|
-
const { window: r =
|
|
559
|
-
return
|
|
557
|
+
function Pt(n, e, t = {}) {
|
|
558
|
+
const { window: r = Q } = t;
|
|
559
|
+
return At(n, e, r?.localStorage, t);
|
|
560
560
|
}
|
|
561
|
-
const
|
|
561
|
+
const Nt = {
|
|
562
562
|
ctrl: "control",
|
|
563
563
|
command: "meta",
|
|
564
564
|
cmd: "meta",
|
|
@@ -568,69 +568,69 @@ const Et = {
|
|
|
568
568
|
left: "arrowleft",
|
|
569
569
|
right: "arrowright"
|
|
570
570
|
};
|
|
571
|
-
function
|
|
572
|
-
const { reactive: e = !1, target: t =
|
|
571
|
+
function _t(n = {}) {
|
|
572
|
+
const { reactive: e = !1, target: t = Q, aliasMap: r = Nt, passive: o = !0, onEventFired: s = Je } = n, i = ye(/* @__PURE__ */ new Set()), a = {
|
|
573
573
|
toJSON() {
|
|
574
574
|
return {};
|
|
575
575
|
},
|
|
576
576
|
current: i
|
|
577
|
-
}, c = e ?
|
|
578
|
-
["Meta",
|
|
577
|
+
}, c = e ? ye(a) : a, f = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Map([
|
|
578
|
+
["Meta", f],
|
|
579
579
|
["Shift", /* @__PURE__ */ new Set()],
|
|
580
580
|
["Alt", /* @__PURE__ */ new Set()]
|
|
581
|
-
]),
|
|
582
|
-
function
|
|
583
|
-
|
|
581
|
+
]), b = /* @__PURE__ */ new Set();
|
|
582
|
+
function A(P, S) {
|
|
583
|
+
P in c && (e ? c[P] = S : c[P].value = S);
|
|
584
584
|
}
|
|
585
585
|
function $() {
|
|
586
586
|
i.clear();
|
|
587
|
-
for (const
|
|
587
|
+
for (const P of b) A(P, !1);
|
|
588
588
|
}
|
|
589
|
-
function
|
|
590
|
-
if (!(!
|
|
591
|
-
for (const [
|
|
592
|
-
|
|
589
|
+
function k(P, S, C) {
|
|
590
|
+
if (!(!P || typeof S.getModifierState != "function")) {
|
|
591
|
+
for (const [O, _] of g) if (S.getModifierState(O)) {
|
|
592
|
+
C.forEach((v) => _.add(v));
|
|
593
593
|
break;
|
|
594
594
|
}
|
|
595
595
|
}
|
|
596
596
|
}
|
|
597
|
-
function
|
|
598
|
-
if (
|
|
599
|
-
const
|
|
600
|
-
if (!["shift", "alt"].includes(S) || !
|
|
601
|
-
const _ = Array.from(
|
|
602
|
-
_.forEach((
|
|
603
|
-
|
|
604
|
-
}),
|
|
605
|
-
}
|
|
606
|
-
function P
|
|
607
|
-
var
|
|
608
|
-
const _ = (
|
|
597
|
+
function x(P, S) {
|
|
598
|
+
if (P) return;
|
|
599
|
+
const C = `${S[0].toUpperCase()}${S.slice(1)}`, O = g.get(C);
|
|
600
|
+
if (!["shift", "alt"].includes(S) || !O) return;
|
|
601
|
+
const _ = Array.from(O), v = _.indexOf(S);
|
|
602
|
+
_.forEach((j, M) => {
|
|
603
|
+
M >= v && (i.delete(j), A(j, !1));
|
|
604
|
+
}), O.clear();
|
|
605
|
+
}
|
|
606
|
+
function N(P, S) {
|
|
607
|
+
var C, O;
|
|
608
|
+
const _ = (C = P.key) === null || C === void 0 ? void 0 : C.toLowerCase(), v = [(O = P.code) === null || O === void 0 ? void 0 : O.toLowerCase(), _].filter(Boolean);
|
|
609
609
|
if (_ !== "") {
|
|
610
610
|
_ && (S ? i.add(_) : i.delete(_));
|
|
611
|
-
for (const
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
i.delete(
|
|
615
|
-
}),
|
|
611
|
+
for (const j of v)
|
|
612
|
+
b.add(j), A(j, S);
|
|
613
|
+
k(S, P, [...i, ...v]), x(S, _), _ === "meta" && !S && (f.forEach((j) => {
|
|
614
|
+
i.delete(j), A(j, !1);
|
|
615
|
+
}), f.clear());
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
|
-
|
|
619
|
-
const
|
|
620
|
-
if (typeof S != "string") return Reflect.get(
|
|
618
|
+
re(t, "keydown", (P) => (N(P, !0), s(P)), { passive: o }), re(t, "keyup", (P) => (N(P, !1), s(P)), { passive: o }), re("blur", $, { passive: o }), re("focus", $, { passive: o });
|
|
619
|
+
const D = new Proxy(c, { get(P, S, C) {
|
|
620
|
+
if (typeof S != "string") return Reflect.get(P, S, C);
|
|
621
621
|
if (S = S.toLowerCase(), S in r && (S = r[S]), !(S in c)) if (/[+_-]/.test(S)) {
|
|
622
622
|
const _ = S.split(/[+_-]/g).map((v) => v.trim());
|
|
623
|
-
c[S] =
|
|
624
|
-
} else c[S] =
|
|
625
|
-
const
|
|
626
|
-
return e ? q(
|
|
623
|
+
c[S] = W(() => _.map((v) => q(D[v])).every(Boolean));
|
|
624
|
+
} else c[S] = We(!1);
|
|
625
|
+
const O = Reflect.get(P, S, C);
|
|
626
|
+
return e ? q(O) : O;
|
|
627
627
|
} });
|
|
628
|
-
return
|
|
628
|
+
return D;
|
|
629
629
|
}
|
|
630
|
-
function
|
|
630
|
+
function Re() {
|
|
631
631
|
return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
632
632
|
}
|
|
633
|
-
function
|
|
633
|
+
function ve(n) {
|
|
634
634
|
const e = {
|
|
635
635
|
type: n.type,
|
|
636
636
|
clientId: n.clientId,
|
|
@@ -644,7 +644,7 @@ function pe(n) {
|
|
|
644
644
|
timestamp: t.timestamp.toISOString()
|
|
645
645
|
}))), e;
|
|
646
646
|
}
|
|
647
|
-
function
|
|
647
|
+
function $t(n) {
|
|
648
648
|
const e = {
|
|
649
649
|
type: n.type,
|
|
650
650
|
clientId: n.clientId,
|
|
@@ -658,54 +658,54 @@ function Rt(n) {
|
|
|
658
658
|
timestamp: new Date(t.timestamp)
|
|
659
659
|
}))), e;
|
|
660
660
|
}
|
|
661
|
-
const
|
|
662
|
-
const n =
|
|
661
|
+
const pe = /* @__PURE__ */ it("hst-operation-log", () => {
|
|
662
|
+
const n = B({
|
|
663
663
|
maxOperations: 100,
|
|
664
664
|
enableCrossTabSync: !0,
|
|
665
665
|
autoSyncInterval: 3e4,
|
|
666
666
|
enablePersistence: !1,
|
|
667
667
|
persistenceKeyPrefix: "stonecrop-ops"
|
|
668
|
-
}), e =
|
|
669
|
-
let
|
|
670
|
-
for (let
|
|
671
|
-
|
|
672
|
-
return
|
|
673
|
-
}), g =
|
|
668
|
+
}), e = B([]), t = B(-1), r = B(Re()), o = B(!1), s = B([]), i = B(null), a = W(() => t.value < 0 ? !1 : e.value[t.value]?.reversible ?? !1), c = W(() => t.value < e.value.length - 1), f = W(() => {
|
|
669
|
+
let u = 0;
|
|
670
|
+
for (let l = t.value; l >= 0 && e.value[l]?.reversible; l--)
|
|
671
|
+
u++;
|
|
672
|
+
return u;
|
|
673
|
+
}), g = W(() => e.value.length - 1 - t.value), b = W(() => ({
|
|
674
674
|
canUndo: a.value,
|
|
675
675
|
canRedo: c.value,
|
|
676
|
-
undoCount:
|
|
676
|
+
undoCount: f.value,
|
|
677
677
|
redoCount: g.value,
|
|
678
678
|
currentIndex: t.value
|
|
679
679
|
}));
|
|
680
|
-
function
|
|
681
|
-
n.value = { ...n.value, ...
|
|
680
|
+
function A(u) {
|
|
681
|
+
n.value = { ...n.value, ...u }, n.value.enablePersistence && (y(), m()), n.value.enableCrossTabSync && p();
|
|
682
682
|
}
|
|
683
|
-
function $(
|
|
684
|
-
const
|
|
685
|
-
...
|
|
686
|
-
id:
|
|
683
|
+
function $(u, l = "user") {
|
|
684
|
+
const h = {
|
|
685
|
+
...u,
|
|
686
|
+
id: Re(),
|
|
687
687
|
timestamp: /* @__PURE__ */ new Date(),
|
|
688
|
-
source:
|
|
688
|
+
source: l,
|
|
689
689
|
userId: n.value.userId
|
|
690
690
|
};
|
|
691
|
-
if (n.value.operationFilter && !n.value.operationFilter(
|
|
692
|
-
return
|
|
691
|
+
if (n.value.operationFilter && !n.value.operationFilter(h))
|
|
692
|
+
return h.id;
|
|
693
693
|
if (o.value)
|
|
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(
|
|
694
|
+
return s.value.push(h), h.id;
|
|
695
|
+
if (t.value < e.value.length - 1 && (e.value = e.value.slice(0, t.value + 1)), e.value.push(h), t.value++, n.value.maxOperations && e.value.length > n.value.maxOperations) {
|
|
696
|
+
const I = e.value.length - n.value.maxOperations;
|
|
697
|
+
e.value = e.value.slice(I), t.value -= I;
|
|
698
698
|
}
|
|
699
|
-
return n.value.enableCrossTabSync &&
|
|
699
|
+
return n.value.enableCrossTabSync && R(h), h.id;
|
|
700
700
|
}
|
|
701
|
-
function
|
|
702
|
-
o.value = !0, s.value = [], i.value =
|
|
701
|
+
function k() {
|
|
702
|
+
o.value = !0, s.value = [], i.value = Re();
|
|
703
703
|
}
|
|
704
|
-
function
|
|
704
|
+
function x(u) {
|
|
705
705
|
if (!o.value || s.value.length === 0)
|
|
706
706
|
return o.value = !1, s.value = [], i.value = null, null;
|
|
707
|
-
const
|
|
708
|
-
id:
|
|
707
|
+
const l = i.value, h = s.value.every((V) => V.reversible), I = {
|
|
708
|
+
id: l,
|
|
709
709
|
type: "batch",
|
|
710
710
|
path: "",
|
|
711
711
|
// Batch doesn't have a single path
|
|
@@ -715,192 +715,192 @@ const ue = /* @__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((
|
|
721
|
-
metadata: { description:
|
|
718
|
+
reversible: h,
|
|
719
|
+
irreversibleReason: h ? void 0 : "Contains irreversible operations",
|
|
720
|
+
childOperationIds: s.value.map((V) => V.id),
|
|
721
|
+
metadata: { description: u }
|
|
722
722
|
};
|
|
723
|
-
s.value.forEach((
|
|
724
|
-
|
|
725
|
-
}), e.value.push(...s.value,
|
|
726
|
-
const
|
|
727
|
-
return o.value = !1, s.value = [], i.value = null,
|
|
723
|
+
s.value.forEach((V) => {
|
|
724
|
+
V.parentOperationId = l;
|
|
725
|
+
}), e.value.push(...s.value, I), t.value = e.value.length - 1, n.value.enableCrossTabSync && F(s.value, I);
|
|
726
|
+
const H = l;
|
|
727
|
+
return o.value = !1, s.value = [], i.value = null, H;
|
|
728
728
|
}
|
|
729
|
-
function
|
|
729
|
+
function N() {
|
|
730
730
|
o.value = !1, s.value = [], i.value = null;
|
|
731
731
|
}
|
|
732
|
-
function
|
|
732
|
+
function D(u) {
|
|
733
733
|
if (!a.value) return !1;
|
|
734
|
-
const
|
|
735
|
-
if (!
|
|
736
|
-
return typeof console < "u" &&
|
|
734
|
+
const l = e.value[t.value];
|
|
735
|
+
if (!l.reversible)
|
|
736
|
+
return typeof console < "u" && l.irreversibleReason && console.warn("Cannot undo irreversible operation:", l.irreversibleReason), !1;
|
|
737
737
|
try {
|
|
738
|
-
if (
|
|
739
|
-
for (let
|
|
740
|
-
const
|
|
741
|
-
|
|
738
|
+
if (l.type === "batch" && l.childOperationIds)
|
|
739
|
+
for (let h = l.childOperationIds.length - 1; h >= 0; h--) {
|
|
740
|
+
const I = l.childOperationIds[h], H = e.value.find((V) => V.id === I);
|
|
741
|
+
H && S(H, u);
|
|
742
742
|
}
|
|
743
743
|
else
|
|
744
|
-
S(
|
|
745
|
-
return t.value--, n.value.enableCrossTabSync &&
|
|
746
|
-
} catch (
|
|
747
|
-
return typeof console < "u" && console.error("Undo failed:",
|
|
744
|
+
S(l, u);
|
|
745
|
+
return t.value--, n.value.enableCrossTabSync && w(l), !0;
|
|
746
|
+
} catch (h) {
|
|
747
|
+
return typeof console < "u" && console.error("Undo failed:", h), !1;
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
|
-
function
|
|
750
|
+
function P(u) {
|
|
751
751
|
if (!c.value) return !1;
|
|
752
|
-
const
|
|
752
|
+
const l = e.value[t.value + 1];
|
|
753
753
|
try {
|
|
754
|
-
if (
|
|
755
|
-
for (const
|
|
756
|
-
const
|
|
757
|
-
|
|
754
|
+
if (l.type === "batch" && l.childOperationIds)
|
|
755
|
+
for (const h of l.childOperationIds) {
|
|
756
|
+
const I = e.value.find((H) => H.id === h);
|
|
757
|
+
I && C(I, u);
|
|
758
758
|
}
|
|
759
759
|
else
|
|
760
|
-
|
|
761
|
-
return t.value++, n.value.enableCrossTabSync &&
|
|
762
|
-
} catch (
|
|
763
|
-
return typeof console < "u" && console.error("Redo failed:",
|
|
760
|
+
C(l, u);
|
|
761
|
+
return t.value++, n.value.enableCrossTabSync && T(l), !0;
|
|
762
|
+
} catch (h) {
|
|
763
|
+
return typeof console < "u" && console.error("Redo failed:", h), !1;
|
|
764
764
|
}
|
|
765
765
|
}
|
|
766
|
-
function S(
|
|
767
|
-
(
|
|
766
|
+
function S(u, l) {
|
|
767
|
+
(u.type === "set" || u.type === "delete") && l && typeof l.set == "function" && l.set(u.path, u.beforeValue, "undo");
|
|
768
768
|
}
|
|
769
|
-
function
|
|
770
|
-
(
|
|
769
|
+
function C(u, l) {
|
|
770
|
+
(u.type === "set" || u.type === "delete") && l && typeof l.set == "function" && l.set(u.path, u.afterValue, "redo");
|
|
771
771
|
}
|
|
772
|
-
function
|
|
773
|
-
const
|
|
772
|
+
function O() {
|
|
773
|
+
const u = e.value.filter((h) => h.reversible).length, l = e.value.map((h) => h.timestamp);
|
|
774
774
|
return {
|
|
775
775
|
operations: [...e.value],
|
|
776
776
|
currentIndex: t.value,
|
|
777
777
|
totalOperations: e.value.length,
|
|
778
|
-
reversibleOperations:
|
|
779
|
-
irreversibleOperations: e.value.length -
|
|
780
|
-
oldestOperation:
|
|
781
|
-
newestOperation:
|
|
778
|
+
reversibleOperations: u,
|
|
779
|
+
irreversibleOperations: e.value.length - u,
|
|
780
|
+
oldestOperation: l.length > 0 ? new Date(Math.min(...l.map((h) => h.getTime()))) : void 0,
|
|
781
|
+
newestOperation: l.length > 0 ? new Date(Math.max(...l.map((h) => h.getTime()))) : void 0
|
|
782
782
|
};
|
|
783
783
|
}
|
|
784
784
|
function _() {
|
|
785
785
|
e.value = [], t.value = -1;
|
|
786
786
|
}
|
|
787
|
-
function v(
|
|
788
|
-
return e.value.filter((
|
|
787
|
+
function v(u, l) {
|
|
788
|
+
return e.value.filter((h) => h.doctype === u && (l === void 0 || h.recordId === l));
|
|
789
789
|
}
|
|
790
|
-
function
|
|
791
|
-
const
|
|
792
|
-
|
|
790
|
+
function j(u, l) {
|
|
791
|
+
const h = e.value.find((I) => I.id === u);
|
|
792
|
+
h && (h.reversible = !1, h.irreversibleReason = l);
|
|
793
793
|
}
|
|
794
|
-
function
|
|
795
|
-
const
|
|
794
|
+
function M(u, l, h, I = "success", H) {
|
|
795
|
+
const V = {
|
|
796
796
|
type: "action",
|
|
797
|
-
path:
|
|
797
|
+
path: h && h.length > 0 ? `${u}.${h[0]}` : u,
|
|
798
798
|
fieldname: "",
|
|
799
799
|
beforeValue: null,
|
|
800
800
|
afterValue: null,
|
|
801
|
-
doctype:
|
|
802
|
-
recordId:
|
|
801
|
+
doctype: u,
|
|
802
|
+
recordId: h && h.length > 0 ? h[0] : void 0,
|
|
803
803
|
reversible: !1,
|
|
804
804
|
// Actions are typically not reversible
|
|
805
|
-
actionName:
|
|
806
|
-
actionRecordIds:
|
|
807
|
-
actionResult:
|
|
808
|
-
actionError:
|
|
805
|
+
actionName: l,
|
|
806
|
+
actionRecordIds: h,
|
|
807
|
+
actionResult: I,
|
|
808
|
+
actionError: H
|
|
809
809
|
};
|
|
810
|
-
return $(
|
|
811
|
-
}
|
|
812
|
-
let
|
|
813
|
-
function
|
|
814
|
-
typeof window > "u" || !window.BroadcastChannel || (
|
|
815
|
-
const
|
|
816
|
-
if (!
|
|
817
|
-
const
|
|
818
|
-
|
|
810
|
+
return $(V);
|
|
811
|
+
}
|
|
812
|
+
let d = null;
|
|
813
|
+
function p() {
|
|
814
|
+
typeof window > "u" || !window.BroadcastChannel || (d = new BroadcastChannel("stonecrop-operation-log"), d.addEventListener("message", (u) => {
|
|
815
|
+
const l = u.data;
|
|
816
|
+
if (!l || typeof l != "object") return;
|
|
817
|
+
const h = $t(l);
|
|
818
|
+
h.clientId !== r.value && (h.type === "operation" && h.operation ? (e.value.push({ ...h.operation, source: "sync" }), t.value = e.value.length - 1) : h.type === "operation" && h.operations && (e.value.push(...h.operations.map((I) => ({ ...I, source: "sync" }))), t.value = e.value.length - 1));
|
|
819
819
|
}));
|
|
820
820
|
}
|
|
821
|
-
function
|
|
822
|
-
if (!
|
|
823
|
-
const
|
|
821
|
+
function R(u) {
|
|
822
|
+
if (!d) return;
|
|
823
|
+
const l = {
|
|
824
824
|
type: "operation",
|
|
825
|
-
operation:
|
|
825
|
+
operation: u,
|
|
826
826
|
clientId: r.value,
|
|
827
827
|
timestamp: /* @__PURE__ */ new Date()
|
|
828
828
|
};
|
|
829
|
-
|
|
829
|
+
d.postMessage(ve(l));
|
|
830
830
|
}
|
|
831
|
-
function
|
|
832
|
-
if (!
|
|
833
|
-
const
|
|
831
|
+
function F(u, l) {
|
|
832
|
+
if (!d) return;
|
|
833
|
+
const h = {
|
|
834
834
|
type: "operation",
|
|
835
|
-
operations: [...
|
|
835
|
+
operations: [...u, l],
|
|
836
836
|
clientId: r.value,
|
|
837
837
|
timestamp: /* @__PURE__ */ new Date()
|
|
838
838
|
};
|
|
839
|
-
|
|
839
|
+
d.postMessage(ve(h));
|
|
840
840
|
}
|
|
841
|
-
function
|
|
842
|
-
if (!
|
|
843
|
-
const
|
|
841
|
+
function w(u) {
|
|
842
|
+
if (!d) return;
|
|
843
|
+
const l = {
|
|
844
844
|
type: "undo",
|
|
845
|
-
operation:
|
|
845
|
+
operation: u,
|
|
846
846
|
clientId: r.value,
|
|
847
847
|
timestamp: /* @__PURE__ */ new Date()
|
|
848
848
|
};
|
|
849
|
-
|
|
849
|
+
d.postMessage(ve(l));
|
|
850
850
|
}
|
|
851
|
-
function
|
|
852
|
-
if (!
|
|
853
|
-
const
|
|
851
|
+
function T(u) {
|
|
852
|
+
if (!d) return;
|
|
853
|
+
const l = {
|
|
854
854
|
type: "redo",
|
|
855
|
-
operation:
|
|
855
|
+
operation: u,
|
|
856
856
|
clientId: r.value,
|
|
857
857
|
timestamp: /* @__PURE__ */ new Date()
|
|
858
858
|
};
|
|
859
|
-
|
|
859
|
+
d.postMessage(ve(l));
|
|
860
860
|
}
|
|
861
|
-
const
|
|
861
|
+
const L = Pt("stonecrop-ops-operations", null, {
|
|
862
862
|
serializer: {
|
|
863
|
-
read: (
|
|
863
|
+
read: (u) => {
|
|
864
864
|
try {
|
|
865
|
-
return JSON.parse(
|
|
865
|
+
return JSON.parse(u);
|
|
866
866
|
} catch {
|
|
867
867
|
return null;
|
|
868
868
|
}
|
|
869
869
|
},
|
|
870
|
-
write: (
|
|
870
|
+
write: (u) => u ? JSON.stringify(u) : ""
|
|
871
871
|
}
|
|
872
872
|
});
|
|
873
|
-
function
|
|
873
|
+
function y() {
|
|
874
874
|
if (!(typeof window > "u"))
|
|
875
875
|
try {
|
|
876
|
-
const
|
|
877
|
-
|
|
878
|
-
...
|
|
879
|
-
timestamp: new Date(
|
|
880
|
-
})), t.value =
|
|
881
|
-
} catch (
|
|
882
|
-
typeof console < "u" && console.error("Failed to load operations from persistence:",
|
|
876
|
+
const u = L.value;
|
|
877
|
+
u && Array.isArray(u.operations) && (e.value = u.operations.map((l) => ({
|
|
878
|
+
...l,
|
|
879
|
+
timestamp: new Date(l.timestamp)
|
|
880
|
+
})), t.value = u.currentIndex ?? -1);
|
|
881
|
+
} catch (u) {
|
|
882
|
+
typeof console < "u" && console.error("Failed to load operations from persistence:", u);
|
|
883
883
|
}
|
|
884
884
|
}
|
|
885
|
-
function
|
|
885
|
+
function E() {
|
|
886
886
|
if (!(typeof window > "u"))
|
|
887
887
|
try {
|
|
888
|
-
|
|
889
|
-
operations: e.value.map((
|
|
890
|
-
...
|
|
891
|
-
timestamp:
|
|
888
|
+
L.value = {
|
|
889
|
+
operations: e.value.map((u) => ({
|
|
890
|
+
...u,
|
|
891
|
+
timestamp: u.timestamp.toISOString()
|
|
892
892
|
})),
|
|
893
893
|
currentIndex: t.value
|
|
894
894
|
};
|
|
895
|
-
} catch (
|
|
896
|
-
typeof console < "u" && console.error("Failed to save operations to persistence:",
|
|
895
|
+
} catch (u) {
|
|
896
|
+
typeof console < "u" && console.error("Failed to save operations to persistence:", u);
|
|
897
897
|
}
|
|
898
898
|
}
|
|
899
|
-
function
|
|
900
|
-
|
|
899
|
+
function m() {
|
|
900
|
+
U(
|
|
901
901
|
[e, t],
|
|
902
902
|
() => {
|
|
903
|
-
n.value.enablePersistence &&
|
|
903
|
+
n.value.enablePersistence && E();
|
|
904
904
|
},
|
|
905
905
|
{ deep: !0 }
|
|
906
906
|
);
|
|
@@ -911,28 +911,28 @@ const ue = /* @__PURE__ */ tt("hst-operation-log", () => {
|
|
|
911
911
|
currentIndex: t,
|
|
912
912
|
config: n,
|
|
913
913
|
clientId: r,
|
|
914
|
-
undoRedoState:
|
|
914
|
+
undoRedoState: b,
|
|
915
915
|
// Computed
|
|
916
916
|
canUndo: a,
|
|
917
917
|
canRedo: c,
|
|
918
|
-
undoCount:
|
|
918
|
+
undoCount: f,
|
|
919
919
|
redoCount: g,
|
|
920
920
|
// Methods
|
|
921
|
-
configure:
|
|
921
|
+
configure: A,
|
|
922
922
|
addOperation: $,
|
|
923
|
-
startBatch:
|
|
924
|
-
commitBatch:
|
|
925
|
-
cancelBatch:
|
|
926
|
-
undo:
|
|
927
|
-
redo:
|
|
923
|
+
startBatch: k,
|
|
924
|
+
commitBatch: x,
|
|
925
|
+
cancelBatch: N,
|
|
926
|
+
undo: D,
|
|
927
|
+
redo: P,
|
|
928
928
|
clear: _,
|
|
929
929
|
getOperationsFor: v,
|
|
930
|
-
getSnapshot:
|
|
931
|
-
markIrreversible:
|
|
932
|
-
logAction:
|
|
930
|
+
getSnapshot: O,
|
|
931
|
+
markIrreversible: j,
|
|
932
|
+
logAction: M
|
|
933
933
|
};
|
|
934
934
|
});
|
|
935
|
-
class
|
|
935
|
+
class ue {
|
|
936
936
|
/**
|
|
937
937
|
* The root FieldTriggerEngine instance
|
|
938
938
|
*/
|
|
@@ -953,9 +953,9 @@ class ae {
|
|
|
953
953
|
* @param options - Configuration options for the field trigger engine
|
|
954
954
|
*/
|
|
955
955
|
constructor(e = {}) {
|
|
956
|
-
if (
|
|
957
|
-
return
|
|
958
|
-
|
|
956
|
+
if (ue._root)
|
|
957
|
+
return ue._root;
|
|
958
|
+
ue._root = this, this.options = {
|
|
959
959
|
defaultTimeout: e.defaultTimeout ?? 5e3,
|
|
960
960
|
debug: e.debug ?? !1,
|
|
961
961
|
enableRollback: e.enableRollback ?? !0,
|
|
@@ -1045,48 +1045,48 @@ class ae {
|
|
|
1045
1045
|
rolledBack: !1
|
|
1046
1046
|
};
|
|
1047
1047
|
const i = performance.now(), a = [];
|
|
1048
|
-
let c = !1,
|
|
1049
|
-
const
|
|
1050
|
-
|
|
1051
|
-
for (const
|
|
1048
|
+
let c = !1, f = !1, g;
|
|
1049
|
+
const b = this.getFieldRollback(r, o), A = t.enableRollback ?? b ?? this.options.enableRollback;
|
|
1050
|
+
A && e.store && (g = this.captureSnapshot(e));
|
|
1051
|
+
for (const N of s)
|
|
1052
1052
|
try {
|
|
1053
|
-
const
|
|
1054
|
-
if (a.push(
|
|
1053
|
+
const D = await this.executeAction(N, e, t.timeout);
|
|
1054
|
+
if (a.push(D), !D.success) {
|
|
1055
1055
|
c = !0;
|
|
1056
1056
|
break;
|
|
1057
1057
|
}
|
|
1058
|
-
} catch (
|
|
1058
|
+
} catch (D) {
|
|
1059
1059
|
const S = {
|
|
1060
1060
|
success: !1,
|
|
1061
|
-
error:
|
|
1061
|
+
error: D instanceof Error ? D : new Error(String(D)),
|
|
1062
1062
|
executionTime: 0,
|
|
1063
|
-
action:
|
|
1063
|
+
action: N
|
|
1064
1064
|
};
|
|
1065
1065
|
a.push(S), c = !0;
|
|
1066
1066
|
break;
|
|
1067
1067
|
}
|
|
1068
|
-
if (
|
|
1068
|
+
if (A && c && g && e.store)
|
|
1069
1069
|
try {
|
|
1070
|
-
this.restoreSnapshot(e, g),
|
|
1071
|
-
} catch (
|
|
1072
|
-
console.error("[FieldTriggers] Rollback failed:",
|
|
1070
|
+
this.restoreSnapshot(e, g), f = !0;
|
|
1071
|
+
} catch (N) {
|
|
1072
|
+
console.error("[FieldTriggers] Rollback failed:", N);
|
|
1073
1073
|
}
|
|
1074
|
-
const $ = performance.now() - i,
|
|
1075
|
-
if (
|
|
1076
|
-
for (const
|
|
1074
|
+
const $ = performance.now() - i, k = a.filter((N) => !N.success);
|
|
1075
|
+
if (k.length > 0 && this.options.errorHandler)
|
|
1076
|
+
for (const N of k)
|
|
1077
1077
|
try {
|
|
1078
|
-
this.options.errorHandler(
|
|
1079
|
-
} catch (
|
|
1080
|
-
console.error("[FieldTriggers] Error in global error handler:",
|
|
1078
|
+
this.options.errorHandler(N.error, e, N.action);
|
|
1079
|
+
} catch (D) {
|
|
1080
|
+
console.error("[FieldTriggers] Error in global error handler:", D);
|
|
1081
1081
|
}
|
|
1082
1082
|
return {
|
|
1083
1083
|
path: e.path,
|
|
1084
1084
|
actionResults: a,
|
|
1085
1085
|
totalExecutionTime: $,
|
|
1086
|
-
allSucceeded: a.every((
|
|
1086
|
+
allSucceeded: a.every((N) => N.success),
|
|
1087
1087
|
stoppedOnError: c,
|
|
1088
|
-
rolledBack:
|
|
1089
|
-
snapshot: this.options.debug &&
|
|
1088
|
+
rolledBack: f,
|
|
1089
|
+
snapshot: this.options.debug && A ? g : void 0
|
|
1090
1090
|
// Only include snapshot in debug mode if rollback is enabled
|
|
1091
1091
|
};
|
|
1092
1092
|
}
|
|
@@ -1103,18 +1103,18 @@ class ae {
|
|
|
1103
1103
|
const i = [];
|
|
1104
1104
|
for (const c of s)
|
|
1105
1105
|
try {
|
|
1106
|
-
const
|
|
1107
|
-
if (i.push(
|
|
1106
|
+
const f = await this.executeTransitionAction(c, e, t.timeout);
|
|
1107
|
+
if (i.push(f), !f.success)
|
|
1108
1108
|
break;
|
|
1109
|
-
} catch (
|
|
1110
|
-
const
|
|
1109
|
+
} catch (f) {
|
|
1110
|
+
const b = {
|
|
1111
1111
|
success: !1,
|
|
1112
|
-
error:
|
|
1112
|
+
error: f instanceof Error ? f : new Error(String(f)),
|
|
1113
1113
|
executionTime: 0,
|
|
1114
1114
|
action: c,
|
|
1115
1115
|
transition: o
|
|
1116
1116
|
};
|
|
1117
|
-
i.push(
|
|
1117
|
+
i.push(b);
|
|
1118
1118
|
break;
|
|
1119
1119
|
}
|
|
1120
1120
|
const a = i.filter((c) => !c.success);
|
|
@@ -1122,8 +1122,8 @@ class ae {
|
|
|
1122
1122
|
for (const c of a)
|
|
1123
1123
|
try {
|
|
1124
1124
|
this.options.errorHandler(c.error, e, c.action);
|
|
1125
|
-
} catch (
|
|
1126
|
-
console.error("[FieldTriggers] Error in global error handler:",
|
|
1125
|
+
} catch (f) {
|
|
1126
|
+
console.error("[FieldTriggers] Error in global error handler:", f);
|
|
1127
1127
|
}
|
|
1128
1128
|
return i;
|
|
1129
1129
|
}
|
|
@@ -1268,20 +1268,20 @@ class ae {
|
|
|
1268
1268
|
}
|
|
1269
1269
|
}
|
|
1270
1270
|
}
|
|
1271
|
-
function
|
|
1272
|
-
return new
|
|
1271
|
+
function K(n) {
|
|
1272
|
+
return new ue(n);
|
|
1273
1273
|
}
|
|
1274
|
-
function
|
|
1275
|
-
|
|
1274
|
+
function xt(n, e) {
|
|
1275
|
+
K().registerAction(n, e);
|
|
1276
1276
|
}
|
|
1277
|
-
function
|
|
1278
|
-
|
|
1277
|
+
function Mt(n, e) {
|
|
1278
|
+
K().registerTransitionAction(n, e);
|
|
1279
1279
|
}
|
|
1280
|
-
function
|
|
1281
|
-
|
|
1280
|
+
function Ft(n, e, t) {
|
|
1281
|
+
K().setFieldRollback(n, e, t);
|
|
1282
1282
|
}
|
|
1283
|
-
async function
|
|
1284
|
-
const r =
|
|
1283
|
+
async function Bt(n, e, t) {
|
|
1284
|
+
const r = K(), o = {
|
|
1285
1285
|
path: t?.path || (t?.recordId ? `${n}.${t.recordId}` : n),
|
|
1286
1286
|
fieldname: "",
|
|
1287
1287
|
beforeValue: void 0,
|
|
@@ -1297,28 +1297,28 @@ async function Ft(n, e, t) {
|
|
|
1297
1297
|
};
|
|
1298
1298
|
return await r.executeTransitionActions(o);
|
|
1299
1299
|
}
|
|
1300
|
-
function
|
|
1300
|
+
function jt(n, e) {
|
|
1301
1301
|
if (n)
|
|
1302
1302
|
try {
|
|
1303
|
-
|
|
1303
|
+
pe().markIrreversible(n, e);
|
|
1304
1304
|
} catch {
|
|
1305
1305
|
}
|
|
1306
1306
|
}
|
|
1307
|
-
function
|
|
1307
|
+
function Ve() {
|
|
1308
1308
|
try {
|
|
1309
|
-
return
|
|
1309
|
+
return pe();
|
|
1310
1310
|
} catch {
|
|
1311
1311
|
return null;
|
|
1312
1312
|
}
|
|
1313
1313
|
}
|
|
1314
|
-
class
|
|
1314
|
+
class ne {
|
|
1315
1315
|
static instance;
|
|
1316
1316
|
/**
|
|
1317
1317
|
* Gets the singleton instance of HST
|
|
1318
1318
|
* @returns The HST singleton instance
|
|
1319
1319
|
*/
|
|
1320
1320
|
static getInstance() {
|
|
1321
|
-
return
|
|
1321
|
+
return ne.instance || (ne.instance = new ne()), ne.instance;
|
|
1322
1322
|
}
|
|
1323
1323
|
/**
|
|
1324
1324
|
* Gets the global registry instance
|
|
@@ -1352,7 +1352,7 @@ class ee {
|
|
|
1352
1352
|
return t.registry[e];
|
|
1353
1353
|
}
|
|
1354
1354
|
}
|
|
1355
|
-
class
|
|
1355
|
+
class Se {
|
|
1356
1356
|
target;
|
|
1357
1357
|
parentPath;
|
|
1358
1358
|
rootNode;
|
|
@@ -1360,15 +1360,15 @@ class ve {
|
|
|
1360
1360
|
parentDoctype;
|
|
1361
1361
|
hst;
|
|
1362
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 =
|
|
1363
|
+
return this.target = e, this.parentPath = r, this.rootNode = o || this, this.doctype = t, this.parentDoctype = s, this.hst = ne.getInstance(), new Proxy(this, {
|
|
1364
1364
|
get(i, a) {
|
|
1365
1365
|
if (a in i) return i[a];
|
|
1366
1366
|
const c = String(a);
|
|
1367
1367
|
return i.getNode(c);
|
|
1368
1368
|
},
|
|
1369
1369
|
set(i, a, c) {
|
|
1370
|
-
const
|
|
1371
|
-
return i.set(
|
|
1370
|
+
const f = String(a);
|
|
1371
|
+
return i.set(f, c), !0;
|
|
1372
1372
|
}
|
|
1373
1373
|
});
|
|
1374
1374
|
}
|
|
@@ -1379,23 +1379,23 @@ class ve {
|
|
|
1379
1379
|
getNode(e) {
|
|
1380
1380
|
const t = this.resolvePath(e), r = this.resolveValue(e), o = t.split(".");
|
|
1381
1381
|
let s = this.doctype;
|
|
1382
|
-
return this.doctype === "StonecropStore" && o.length >= 1 && (s = o[0]), typeof r == "object" && r !== null && !this.isPrimitive(r) ? new
|
|
1382
|
+
return this.doctype === "StonecropStore" && o.length >= 1 && (s = o[0]), typeof r == "object" && r !== null && !this.isPrimitive(r) ? new Se(r, s, t, this.rootNode, this.parentDoctype) : new Se(r, s, t, this.rootNode, this.parentDoctype);
|
|
1383
1383
|
}
|
|
1384
1384
|
set(e, t, r = "user") {
|
|
1385
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 = Ve();
|
|
1388
1388
|
if (i && typeof i.addOperation == "function") {
|
|
1389
|
-
const a = o.split("."), c = this.doctype === "StonecropStore" && a.length >= 1 ? a[0] : this.doctype,
|
|
1389
|
+
const a = o.split("."), c = this.doctype === "StonecropStore" && a.length >= 1 ? a[0] : this.doctype, f = a.length >= 2 ? a[1] : void 0, g = a.slice(2).join(".") || a[a.length - 1], A = t === void 0 && s !== void 0 ? "delete" : "set";
|
|
1390
1390
|
i.addOperation(
|
|
1391
1391
|
{
|
|
1392
|
-
type:
|
|
1392
|
+
type: A,
|
|
1393
1393
|
path: o,
|
|
1394
1394
|
fieldname: g,
|
|
1395
1395
|
beforeValue: s,
|
|
1396
1396
|
afterValue: t,
|
|
1397
1397
|
doctype: c,
|
|
1398
|
-
recordId:
|
|
1398
|
+
recordId: f,
|
|
1399
1399
|
reversible: !0
|
|
1400
1400
|
// Default to reversible, can be changed by field triggers
|
|
1401
1401
|
},
|
|
@@ -1446,7 +1446,7 @@ 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 = K(), o = this.parentPath.split(".");
|
|
1450
1450
|
let s = this.doctype, i;
|
|
1451
1451
|
this.doctype === "StonecropStore" && o.length >= 1 && (s = o[0]), o.length >= 2 && (i = o[1]);
|
|
1452
1452
|
const a = {
|
|
@@ -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 = Ve();
|
|
1468
1468
|
return c && typeof c.addOperation == "function" && c.addOperation(
|
|
1469
1469
|
{
|
|
1470
1470
|
type: "transition",
|
|
@@ -1531,12 +1531,12 @@ class ve {
|
|
|
1531
1531
|
const o = e.split(".");
|
|
1532
1532
|
if (o.length < 3)
|
|
1533
1533
|
return;
|
|
1534
|
-
const s =
|
|
1534
|
+
const s = K(), i = o.slice(2).join(".") || o[o.length - 1];
|
|
1535
1535
|
let a = this.doctype;
|
|
1536
1536
|
this.doctype === "StonecropStore" && o.length >= 1 && (a = o[0]);
|
|
1537
1537
|
let c;
|
|
1538
1538
|
o.length >= 2 && (c = o[1]);
|
|
1539
|
-
const
|
|
1539
|
+
const f = {
|
|
1540
1540
|
path: e,
|
|
1541
1541
|
fieldname: i,
|
|
1542
1542
|
beforeValue: t,
|
|
@@ -1548,7 +1548,7 @@ class ve {
|
|
|
1548
1548
|
store: this.rootNode || void 0
|
|
1549
1549
|
// Pass the root store for snapshot/rollback capabilities
|
|
1550
1550
|
};
|
|
1551
|
-
await s.executeFieldTriggers(
|
|
1551
|
+
await s.executeFieldTriggers(f);
|
|
1552
1552
|
} catch (o) {
|
|
1553
1553
|
o instanceof Error && console.warn("Field trigger error:", o.message);
|
|
1554
1554
|
}
|
|
@@ -1567,8 +1567,8 @@ class ve {
|
|
|
1567
1567
|
try {
|
|
1568
1568
|
const c = e;
|
|
1569
1569
|
if ("constructor" in c && c.constructor && typeof c.constructor == "object" && "name" in c.constructor) {
|
|
1570
|
-
const
|
|
1571
|
-
i = typeof
|
|
1570
|
+
const f = c.constructor.name;
|
|
1571
|
+
i = typeof f == "string" ? f : void 0;
|
|
1572
1572
|
}
|
|
1573
1573
|
} catch {
|
|
1574
1574
|
i = void 0;
|
|
@@ -1579,14 +1579,19 @@ class ve {
|
|
|
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";
|
|
1581
1581
|
}
|
|
1582
|
+
/**
|
|
1583
|
+
* Parse a path string into segments, handling both dot notation and array bracket notation
|
|
1584
|
+
* @param path - The path string to parse (e.g., "order.456.line_items[0].product")
|
|
1585
|
+
* @returns Array of path segments (e.g., ['order', '456', 'line_items', '0', 'product'])
|
|
1586
|
+
*/
|
|
1582
1587
|
parsePath(e) {
|
|
1583
|
-
return e ? e.split(".").filter((
|
|
1588
|
+
return e ? e.replace(/\[(\d+)\]/g, ".$1").split(".").filter((r) => r.length > 0) : [];
|
|
1584
1589
|
}
|
|
1585
1590
|
}
|
|
1586
|
-
function
|
|
1587
|
-
return new
|
|
1591
|
+
function Dt(n, e, t) {
|
|
1592
|
+
return new Se(n, e, "", null, t);
|
|
1588
1593
|
}
|
|
1589
|
-
class
|
|
1594
|
+
class Ke {
|
|
1590
1595
|
hstStore;
|
|
1591
1596
|
_operationLogStore;
|
|
1592
1597
|
_operationLogConfig;
|
|
@@ -1605,7 +1610,7 @@ class He {
|
|
|
1605
1610
|
* @internal
|
|
1606
1611
|
*/
|
|
1607
1612
|
getOperationLogStore() {
|
|
1608
|
-
return this._operationLogStore || (this._operationLogStore =
|
|
1613
|
+
return this._operationLogStore || (this._operationLogStore = pe(), this._operationLogConfig && this._operationLogStore.configure(this._operationLogConfig)), this._operationLogStore;
|
|
1609
1614
|
}
|
|
1610
1615
|
/**
|
|
1611
1616
|
* Initialize the HST store structure
|
|
@@ -1614,7 +1619,7 @@ class He {
|
|
|
1614
1619
|
const e = {};
|
|
1615
1620
|
Object.keys(this.registry.registry).forEach((t) => {
|
|
1616
1621
|
e[t] = {};
|
|
1617
|
-
}), this.hstStore =
|
|
1622
|
+
}), this.hstStore = Dt(ye(e), "StonecropStore");
|
|
1618
1623
|
}
|
|
1619
1624
|
/**
|
|
1620
1625
|
* Setup automatic sync with Registry when doctypes are added
|
|
@@ -1701,18 +1706,18 @@ class He {
|
|
|
1701
1706
|
*/
|
|
1702
1707
|
runAction(e, t, r) {
|
|
1703
1708
|
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
|
-
let c = "success",
|
|
1709
|
+
let c = "success", f;
|
|
1705
1710
|
try {
|
|
1706
1711
|
s && s.length > 0 && s.forEach((g) => {
|
|
1707
1712
|
try {
|
|
1708
1713
|
new Function("args", g)(r);
|
|
1709
|
-
} catch (
|
|
1710
|
-
throw c = "failure",
|
|
1714
|
+
} catch (b) {
|
|
1715
|
+
throw c = "failure", f = b instanceof Error ? b.message : "Unknown error", b;
|
|
1711
1716
|
}
|
|
1712
1717
|
});
|
|
1713
1718
|
} catch {
|
|
1714
1719
|
} finally {
|
|
1715
|
-
a.logAction(e.doctype, t, i, c,
|
|
1720
|
+
a.logAction(e.doctype, t, i, c, f);
|
|
1716
1721
|
}
|
|
1717
1722
|
}
|
|
1718
1723
|
/**
|
|
@@ -1758,9 +1763,14 @@ class He {
|
|
|
1758
1763
|
return this.hstStore;
|
|
1759
1764
|
}
|
|
1760
1765
|
}
|
|
1761
|
-
function
|
|
1766
|
+
function Wt(n) {
|
|
1762
1767
|
n || (n = {});
|
|
1763
|
-
const e = n.registry ||
|
|
1768
|
+
const e = n.registry || oe("$registry"), t = oe("$stonecrop"), r = B(), o = B(), s = B({}), i = B(), a = B(), c = B([]);
|
|
1769
|
+
if (n.doctype && e) {
|
|
1770
|
+
const y = n.doctype.schema ? Array.isArray(n.doctype.schema) ? n.doctype.schema : Array.from(n.doctype.schema) : [];
|
|
1771
|
+
c.value = e.resolveSchema(y);
|
|
1772
|
+
}
|
|
1773
|
+
const f = B([]), g = B(-1), b = W(() => r.value?.getOperationLogStore().canUndo ?? !1), A = W(() => r.value?.getOperationLogStore().canRedo ?? !1), $ = W(() => r.value?.getOperationLogStore().undoCount ?? 0), k = W(() => r.value?.getOperationLogStore().redoCount ?? 0), x = W(
|
|
1764
1774
|
() => r.value?.getOperationLogStore().undoRedoState ?? {
|
|
1765
1775
|
canUndo: !1,
|
|
1766
1776
|
canRedo: !1,
|
|
@@ -1768,159 +1778,202 @@ function Vt(n) {
|
|
|
1768
1778
|
redoCount: 0,
|
|
1769
1779
|
currentIndex: -1
|
|
1770
1780
|
}
|
|
1771
|
-
),
|
|
1781
|
+
), N = (y) => r.value?.getOperationLogStore().undo(y) ?? !1, D = (y) => r.value?.getOperationLogStore().redo(y) ?? !1, P = () => {
|
|
1772
1782
|
r.value?.getOperationLogStore().startBatch();
|
|
1773
|
-
},
|
|
1783
|
+
}, S = (y) => r.value?.getOperationLogStore().commitBatch(y) ?? null, C = () => {
|
|
1774
1784
|
r.value?.getOperationLogStore().cancelBatch();
|
|
1775
|
-
},
|
|
1785
|
+
}, O = () => {
|
|
1776
1786
|
r.value?.getOperationLogStore().clear();
|
|
1777
|
-
},
|
|
1787
|
+
}, _ = (y, E) => r.value?.getOperationLogStore().getOperationsFor(y, E) ?? [], v = () => r.value?.getOperationLogStore().getSnapshot() ?? {
|
|
1778
1788
|
operations: [],
|
|
1779
1789
|
currentIndex: -1,
|
|
1780
1790
|
totalOperations: 0,
|
|
1781
1791
|
reversibleOperations: 0,
|
|
1782
1792
|
irreversibleOperations: 0
|
|
1783
|
-
},
|
|
1784
|
-
r.value?.getOperationLogStore().markIrreversible(
|
|
1785
|
-
},
|
|
1786
|
-
r.value?.getOperationLogStore().configure(
|
|
1793
|
+
}, j = (y, E) => {
|
|
1794
|
+
r.value?.getOperationLogStore().markIrreversible(y, E);
|
|
1795
|
+
}, M = (y, E, m, u = "success", l) => r.value?.getOperationLogStore().logAction(y, E, m, u, l) ?? "", d = (y) => {
|
|
1796
|
+
r.value?.getOperationLogStore().configure(y);
|
|
1787
1797
|
};
|
|
1788
|
-
|
|
1798
|
+
Be(async () => {
|
|
1789
1799
|
if (e) {
|
|
1790
|
-
r.value = t || new
|
|
1800
|
+
r.value = t || new Ke(e);
|
|
1791
1801
|
try {
|
|
1792
|
-
const
|
|
1793
|
-
|
|
1794
|
-
() =>
|
|
1795
|
-
(
|
|
1796
|
-
|
|
1802
|
+
const y = r.value.getOperationLogStore(), E = Ue(y);
|
|
1803
|
+
f.value = E.operations.value, g.value = E.currentIndex.value, U(
|
|
1804
|
+
() => E.operations.value,
|
|
1805
|
+
(m) => {
|
|
1806
|
+
f.value = m;
|
|
1797
1807
|
}
|
|
1798
|
-
),
|
|
1799
|
-
() =>
|
|
1800
|
-
(
|
|
1801
|
-
|
|
1808
|
+
), U(
|
|
1809
|
+
() => E.currentIndex.value,
|
|
1810
|
+
(m) => {
|
|
1811
|
+
g.value = m;
|
|
1802
1812
|
}
|
|
1803
1813
|
);
|
|
1804
1814
|
} catch {
|
|
1805
1815
|
}
|
|
1806
1816
|
if (!n.doctype && e.router) {
|
|
1807
|
-
const
|
|
1808
|
-
if (!
|
|
1809
|
-
const
|
|
1810
|
-
if (
|
|
1811
|
-
const
|
|
1812
|
-
path:
|
|
1813
|
-
segments:
|
|
1814
|
-
},
|
|
1815
|
-
if (
|
|
1816
|
-
if (e.addDoctype(
|
|
1817
|
-
const
|
|
1818
|
-
|
|
1819
|
-
|
|
1817
|
+
const y = e.router.currentRoute.value;
|
|
1818
|
+
if (!y.path) return;
|
|
1819
|
+
const E = y.path.split("/").filter((u) => u.length > 0), m = E[1]?.toLowerCase();
|
|
1820
|
+
if (E.length > 0) {
|
|
1821
|
+
const u = {
|
|
1822
|
+
path: y.path,
|
|
1823
|
+
segments: E
|
|
1824
|
+
}, l = await e.getMeta?.(u);
|
|
1825
|
+
if (l) {
|
|
1826
|
+
if (e.addDoctype(l), r.value.setup(l), i.value = l, a.value = m, o.value = r.value.getStore(), e) {
|
|
1827
|
+
const h = l.schema ? Array.isArray(l.schema) ? l.schema : Array.from(l.schema) : [];
|
|
1828
|
+
c.value = e.resolveSchema(h);
|
|
1829
|
+
}
|
|
1830
|
+
if (m && m !== "new") {
|
|
1831
|
+
const h = r.value.getRecordById(l, m);
|
|
1832
|
+
if (h)
|
|
1833
|
+
s.value = h.get("") || {};
|
|
1820
1834
|
else
|
|
1821
1835
|
try {
|
|
1822
|
-
await r.value.getRecord(
|
|
1823
|
-
const
|
|
1824
|
-
|
|
1836
|
+
await r.value.getRecord(l, m);
|
|
1837
|
+
const I = r.value.getRecordById(l, m);
|
|
1838
|
+
I && (s.value = I.get("") || {});
|
|
1825
1839
|
} catch {
|
|
1826
|
-
s.value =
|
|
1840
|
+
s.value = J(l);
|
|
1827
1841
|
}
|
|
1828
1842
|
} else
|
|
1829
|
-
s.value =
|
|
1830
|
-
o.value &&
|
|
1843
|
+
s.value = J(l);
|
|
1844
|
+
o.value && xe(l, m || "new", s, o.value), r.value.runAction(l, "load", m ? [m] : void 0);
|
|
1831
1845
|
}
|
|
1832
1846
|
}
|
|
1833
1847
|
}
|
|
1834
1848
|
if (n.doctype) {
|
|
1835
1849
|
o.value = r.value.getStore();
|
|
1836
|
-
const
|
|
1837
|
-
if (
|
|
1838
|
-
const
|
|
1839
|
-
if (
|
|
1840
|
-
s.value =
|
|
1850
|
+
const y = n.doctype, E = n.recordId;
|
|
1851
|
+
if (E && E !== "new") {
|
|
1852
|
+
const m = r.value.getRecordById(y, E);
|
|
1853
|
+
if (m)
|
|
1854
|
+
s.value = m.get("") || {};
|
|
1841
1855
|
else
|
|
1842
1856
|
try {
|
|
1843
|
-
await r.value.getRecord(
|
|
1844
|
-
const
|
|
1845
|
-
|
|
1857
|
+
await r.value.getRecord(y, E);
|
|
1858
|
+
const u = r.value.getRecordById(y, E);
|
|
1859
|
+
u && (s.value = u.get("") || {});
|
|
1846
1860
|
} catch {
|
|
1847
|
-
s.value =
|
|
1861
|
+
s.value = J(y);
|
|
1848
1862
|
}
|
|
1849
1863
|
} else
|
|
1850
|
-
s.value =
|
|
1851
|
-
o.value &&
|
|
1864
|
+
s.value = J(y);
|
|
1865
|
+
o.value && xe(y, E || "new", s, o.value);
|
|
1852
1866
|
}
|
|
1853
1867
|
}
|
|
1854
1868
|
});
|
|
1855
|
-
const
|
|
1856
|
-
const
|
|
1857
|
-
if (!
|
|
1858
|
-
const
|
|
1859
|
-
return `${
|
|
1860
|
-
},
|
|
1861
|
-
const
|
|
1862
|
-
if (!(!o.value || !r.value || !
|
|
1869
|
+
const p = (y, E) => {
|
|
1870
|
+
const m = n.doctype || i.value;
|
|
1871
|
+
if (!m) return "";
|
|
1872
|
+
const u = E || n.recordId || a.value || "new";
|
|
1873
|
+
return `${m.slug}.${u}.${y}`;
|
|
1874
|
+
}, R = (y) => {
|
|
1875
|
+
const E = n.doctype || i.value;
|
|
1876
|
+
if (!(!o.value || !r.value || !E))
|
|
1863
1877
|
try {
|
|
1864
|
-
const
|
|
1865
|
-
if (
|
|
1866
|
-
const
|
|
1867
|
-
if (o.value.has(`${
|
|
1868
|
-
const
|
|
1869
|
-
let
|
|
1870
|
-
for (let
|
|
1871
|
-
if (
|
|
1872
|
-
const
|
|
1873
|
-
o.value.set(
|
|
1878
|
+
const m = y.path.split(".");
|
|
1879
|
+
if (m.length >= 2) {
|
|
1880
|
+
const h = m[0], I = m[1];
|
|
1881
|
+
if (o.value.has(`${h}.${I}`) || r.value.addRecord(E, I, { ...s.value }), m.length > 3) {
|
|
1882
|
+
const H = `${h}.${I}`, V = m.slice(2);
|
|
1883
|
+
let Z = H;
|
|
1884
|
+
for (let X = 0; X < V.length - 1; X++)
|
|
1885
|
+
if (Z += `.${V[X]}`, !o.value.has(Z)) {
|
|
1886
|
+
const we = V[X + 1], Qe = !isNaN(Number(we));
|
|
1887
|
+
o.value.set(Z, Qe ? [] : {});
|
|
1874
1888
|
}
|
|
1875
1889
|
}
|
|
1876
1890
|
}
|
|
1877
|
-
o.value.set(
|
|
1878
|
-
const
|
|
1879
|
-
|
|
1891
|
+
o.value.set(y.path, y.value);
|
|
1892
|
+
const u = y.fieldname.split("."), l = { ...s.value };
|
|
1893
|
+
u.length === 1 ? l[u[0]] = y.value : Tt(l, u, y.value), s.value = l;
|
|
1880
1894
|
} catch {
|
|
1881
1895
|
}
|
|
1882
1896
|
};
|
|
1883
|
-
(n.doctype || e?.router) && (
|
|
1884
|
-
const
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1897
|
+
(n.doctype || e?.router) && (De("hstPathProvider", p), De("hstChangeHandler", R));
|
|
1898
|
+
const F = (y, E, m) => {
|
|
1899
|
+
if (!r.value)
|
|
1900
|
+
return J(E);
|
|
1901
|
+
if (m)
|
|
1902
|
+
try {
|
|
1903
|
+
const u = o.value?.get(y);
|
|
1904
|
+
return u && typeof u == "object" ? u : J(E);
|
|
1905
|
+
} catch {
|
|
1906
|
+
return J(E);
|
|
1907
|
+
}
|
|
1908
|
+
return J(E);
|
|
1909
|
+
}, w = async (y, E) => {
|
|
1910
|
+
if (!o.value || !r.value)
|
|
1911
|
+
throw new Error("HST store not initialized");
|
|
1912
|
+
const m = `${y.slug}.${E}`, l = { ...o.value.get(m) || {} }, h = y.schema ? Array.isArray(y.schema) ? y.schema : Array.from(y.schema) : [], H = (e ? e.resolveSchema(h) : h).filter(
|
|
1913
|
+
(V) => "fieldtype" in V && V.fieldtype === "Doctype" && "schema" in V && Array.isArray(V.schema)
|
|
1914
|
+
);
|
|
1915
|
+
for (const V of H) {
|
|
1916
|
+
const Z = V, X = `${m}.${Z.fieldname}`, we = Ze(Z.schema, X, o.value);
|
|
1917
|
+
l[Z.fieldname] = we;
|
|
1918
|
+
}
|
|
1919
|
+
return l;
|
|
1920
|
+
}, T = (y, E) => ({
|
|
1921
|
+
provideHSTPath: (l) => `${y}.${l}`,
|
|
1922
|
+
handleHSTChange: (l) => {
|
|
1923
|
+
const h = l.path.startsWith(y) ? l.path : `${y}.${l.fieldname}`;
|
|
1924
|
+
R({
|
|
1925
|
+
...l,
|
|
1926
|
+
path: h
|
|
1927
|
+
});
|
|
1928
|
+
}
|
|
1929
|
+
}), L = {
|
|
1930
|
+
operations: f,
|
|
1931
|
+
currentIndex: g,
|
|
1932
|
+
undoRedoState: x,
|
|
1933
|
+
canUndo: b,
|
|
1934
|
+
canRedo: A,
|
|
1935
|
+
undoCount: $,
|
|
1936
|
+
redoCount: k,
|
|
1937
|
+
undo: N,
|
|
1938
|
+
redo: D,
|
|
1939
|
+
startBatch: P,
|
|
1940
|
+
commitBatch: S,
|
|
1941
|
+
cancelBatch: C,
|
|
1942
|
+
clear: O,
|
|
1943
|
+
getOperationsFor: _,
|
|
1944
|
+
getSnapshot: v,
|
|
1945
|
+
markIrreversible: j,
|
|
1946
|
+
logAction: M,
|
|
1947
|
+
configure: d
|
|
1903
1948
|
};
|
|
1904
1949
|
return n.doctype ? {
|
|
1905
1950
|
stonecrop: r,
|
|
1906
|
-
operationLog:
|
|
1907
|
-
provideHSTPath:
|
|
1908
|
-
handleHSTChange:
|
|
1951
|
+
operationLog: L,
|
|
1952
|
+
provideHSTPath: p,
|
|
1953
|
+
handleHSTChange: R,
|
|
1909
1954
|
hstStore: o,
|
|
1910
|
-
formData: s
|
|
1955
|
+
formData: s,
|
|
1956
|
+
resolvedSchema: c,
|
|
1957
|
+
loadNestedData: F,
|
|
1958
|
+
saveRecursive: w,
|
|
1959
|
+
createNestedContext: T
|
|
1911
1960
|
} : !n.doctype && e?.router ? {
|
|
1912
1961
|
stonecrop: r,
|
|
1913
|
-
operationLog:
|
|
1914
|
-
provideHSTPath:
|
|
1915
|
-
handleHSTChange:
|
|
1962
|
+
operationLog: L,
|
|
1963
|
+
provideHSTPath: p,
|
|
1964
|
+
handleHSTChange: R,
|
|
1916
1965
|
hstStore: o,
|
|
1917
|
-
formData: s
|
|
1966
|
+
formData: s,
|
|
1967
|
+
resolvedSchema: c,
|
|
1968
|
+
loadNestedData: F,
|
|
1969
|
+
saveRecursive: w,
|
|
1970
|
+
createNestedContext: T
|
|
1918
1971
|
} : {
|
|
1919
1972
|
stonecrop: r,
|
|
1920
|
-
operationLog:
|
|
1973
|
+
operationLog: L
|
|
1921
1974
|
};
|
|
1922
1975
|
}
|
|
1923
|
-
function
|
|
1976
|
+
function J(n) {
|
|
1924
1977
|
const e = {};
|
|
1925
1978
|
return n.schema && n.schema.forEach((t) => {
|
|
1926
1979
|
switch ("fieldtype" in t ? t.fieldtype : "Data") {
|
|
@@ -1946,8 +1999,8 @@ function he(n) {
|
|
|
1946
1999
|
}
|
|
1947
2000
|
}), e;
|
|
1948
2001
|
}
|
|
1949
|
-
function
|
|
1950
|
-
|
|
2002
|
+
function xe(n, e, t, r) {
|
|
2003
|
+
U(
|
|
1951
2004
|
t,
|
|
1952
2005
|
(o) => {
|
|
1953
2006
|
const s = `${n.slug}.${e}`;
|
|
@@ -1962,7 +2015,7 @@ function ke(n, e, t, r) {
|
|
|
1962
2015
|
{ deep: !0 }
|
|
1963
2016
|
);
|
|
1964
2017
|
}
|
|
1965
|
-
function
|
|
2018
|
+
function Tt(n, e, t) {
|
|
1966
2019
|
let r = n;
|
|
1967
2020
|
for (let s = 0; s < e.length - 1; s++) {
|
|
1968
2021
|
const i = e[s];
|
|
@@ -1971,42 +2024,52 @@ function Pt(n, e, t) {
|
|
|
1971
2024
|
const o = e[e.length - 1];
|
|
1972
2025
|
r[o] = t;
|
|
1973
2026
|
}
|
|
1974
|
-
function
|
|
1975
|
-
const
|
|
2027
|
+
function Ze(n, e, t) {
|
|
2028
|
+
const o = { ...t.get(e) || {} }, s = n.filter(
|
|
2029
|
+
(i) => "fieldtype" in i && i.fieldtype === "Doctype" && "schema" in i && Array.isArray(i.schema)
|
|
2030
|
+
);
|
|
2031
|
+
for (const i of s) {
|
|
2032
|
+
const a = i, c = `${e}.${a.fieldname}`, f = Ze(a.schema, c, t);
|
|
2033
|
+
o[a.fieldname] = f;
|
|
2034
|
+
}
|
|
2035
|
+
return o;
|
|
2036
|
+
}
|
|
2037
|
+
function Ge(n) {
|
|
2038
|
+
const t = oe("$operationLogStore", void 0) || pe();
|
|
1976
2039
|
n && t.configure(n);
|
|
1977
|
-
const { operations: r, currentIndex: o, undoRedoState: s, canUndo: i, canRedo: a, undoCount: c, redoCount:
|
|
1978
|
-
function g(
|
|
1979
|
-
return t.undo(
|
|
2040
|
+
const { operations: r, currentIndex: o, undoRedoState: s, canUndo: i, canRedo: a, undoCount: c, redoCount: f } = Ue(t);
|
|
2041
|
+
function g(O) {
|
|
2042
|
+
return t.undo(O);
|
|
1980
2043
|
}
|
|
1981
|
-
function
|
|
1982
|
-
return t.redo(
|
|
2044
|
+
function b(O) {
|
|
2045
|
+
return t.redo(O);
|
|
1983
2046
|
}
|
|
1984
|
-
function
|
|
2047
|
+
function A() {
|
|
1985
2048
|
t.startBatch();
|
|
1986
2049
|
}
|
|
1987
|
-
function $(
|
|
1988
|
-
return t.commitBatch(
|
|
2050
|
+
function $(O) {
|
|
2051
|
+
return t.commitBatch(O);
|
|
1989
2052
|
}
|
|
1990
|
-
function
|
|
2053
|
+
function k() {
|
|
1991
2054
|
t.cancelBatch();
|
|
1992
2055
|
}
|
|
1993
|
-
function
|
|
2056
|
+
function x() {
|
|
1994
2057
|
t.clear();
|
|
1995
2058
|
}
|
|
1996
|
-
function
|
|
1997
|
-
return t.getOperationsFor(
|
|
2059
|
+
function N(O, _) {
|
|
2060
|
+
return t.getOperationsFor(O, _);
|
|
1998
2061
|
}
|
|
1999
|
-
function
|
|
2062
|
+
function D() {
|
|
2000
2063
|
return t.getSnapshot();
|
|
2001
2064
|
}
|
|
2002
|
-
function
|
|
2003
|
-
t.markIrreversible(
|
|
2065
|
+
function P(O, _) {
|
|
2066
|
+
t.markIrreversible(O, _);
|
|
2004
2067
|
}
|
|
2005
|
-
function S(
|
|
2006
|
-
return t.logAction(
|
|
2068
|
+
function S(O, _, v, j = "success", M) {
|
|
2069
|
+
return t.logAction(O, _, v, j, M);
|
|
2007
2070
|
}
|
|
2008
|
-
function
|
|
2009
|
-
t.configure(
|
|
2071
|
+
function C(O) {
|
|
2072
|
+
t.configure(O);
|
|
2010
2073
|
}
|
|
2011
2074
|
return {
|
|
2012
2075
|
// State
|
|
@@ -2016,38 +2079,38 @@ function qe(n) {
|
|
|
2016
2079
|
canUndo: i,
|
|
2017
2080
|
canRedo: a,
|
|
2018
2081
|
undoCount: c,
|
|
2019
|
-
redoCount:
|
|
2082
|
+
redoCount: f,
|
|
2020
2083
|
// Methods
|
|
2021
2084
|
undo: g,
|
|
2022
|
-
redo:
|
|
2023
|
-
startBatch:
|
|
2085
|
+
redo: b,
|
|
2086
|
+
startBatch: A,
|
|
2024
2087
|
commitBatch: $,
|
|
2025
|
-
cancelBatch:
|
|
2026
|
-
clear:
|
|
2027
|
-
getOperationsFor:
|
|
2028
|
-
getSnapshot:
|
|
2029
|
-
markIrreversible:
|
|
2088
|
+
cancelBatch: k,
|
|
2089
|
+
clear: x,
|
|
2090
|
+
getOperationsFor: N,
|
|
2091
|
+
getSnapshot: D,
|
|
2092
|
+
markIrreversible: P,
|
|
2030
2093
|
logAction: S,
|
|
2031
|
-
configure:
|
|
2094
|
+
configure: C
|
|
2032
2095
|
};
|
|
2033
2096
|
}
|
|
2034
|
-
function
|
|
2097
|
+
function Ht(n, e = !0) {
|
|
2035
2098
|
if (!e) return;
|
|
2036
|
-
const { undo: t, redo: r, canUndo: o, canRedo: s } =
|
|
2037
|
-
|
|
2099
|
+
const { undo: t, redo: r, canUndo: o, canRedo: s } = Ge(), i = _t();
|
|
2100
|
+
ie(i["Ctrl+Z"], () => {
|
|
2038
2101
|
o.value && t(n);
|
|
2039
|
-
}),
|
|
2102
|
+
}), ie(i["Meta+Z"], () => {
|
|
2040
2103
|
o.value && t(n);
|
|
2041
|
-
}),
|
|
2104
|
+
}), ie(i["Ctrl+Shift+Z"], () => {
|
|
2042
2105
|
s.value && r(n);
|
|
2043
|
-
}),
|
|
2106
|
+
}), ie(i["Meta+Shift+Z"], () => {
|
|
2044
2107
|
s.value && r(n);
|
|
2045
|
-
}),
|
|
2108
|
+
}), ie(i["Ctrl+Y"], () => {
|
|
2046
2109
|
s.value && r(n);
|
|
2047
2110
|
});
|
|
2048
2111
|
}
|
|
2049
|
-
async function
|
|
2050
|
-
const { startBatch: t, commitBatch: r, cancelBatch: o } =
|
|
2112
|
+
async function zt(n, e) {
|
|
2113
|
+
const { startBatch: t, commitBatch: r, cancelBatch: o } = Ge();
|
|
2051
2114
|
t();
|
|
2052
2115
|
try {
|
|
2053
2116
|
return await n(), r(e);
|
|
@@ -2055,7 +2118,7 @@ async function xt(n, e) {
|
|
|
2055
2118
|
throw o(), s;
|
|
2056
2119
|
}
|
|
2057
2120
|
}
|
|
2058
|
-
class
|
|
2121
|
+
class Ut {
|
|
2059
2122
|
/**
|
|
2060
2123
|
* The doctype name
|
|
2061
2124
|
* @public
|
|
@@ -2117,7 +2180,7 @@ class Bt {
|
|
|
2117
2180
|
return this.doctype.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
2118
2181
|
}
|
|
2119
2182
|
}
|
|
2120
|
-
class
|
|
2183
|
+
class fe {
|
|
2121
2184
|
/**
|
|
2122
2185
|
* The root Registry instance
|
|
2123
2186
|
*/
|
|
@@ -2144,9 +2207,9 @@ class ce {
|
|
|
2144
2207
|
* @param getMeta - Optional function to fetch doctype metadata from an API
|
|
2145
2208
|
*/
|
|
2146
2209
|
constructor(e, t) {
|
|
2147
|
-
if (
|
|
2148
|
-
return
|
|
2149
|
-
|
|
2210
|
+
if (fe._root)
|
|
2211
|
+
return fe._root;
|
|
2212
|
+
fe._root = this, this.name = "Registry", this.registry = {}, this.router = e, this.getMeta = t;
|
|
2150
2213
|
}
|
|
2151
2214
|
/**
|
|
2152
2215
|
* The getMeta function fetches doctype metadata from an API based on route context
|
|
@@ -2161,13 +2224,138 @@ class ce {
|
|
|
2161
2224
|
*/
|
|
2162
2225
|
addDoctype(e) {
|
|
2163
2226
|
e.doctype in Object.keys(this.registry) || (this.registry[e.slug] = e);
|
|
2164
|
-
const t =
|
|
2227
|
+
const t = K();
|
|
2165
2228
|
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
2229
|
path: `/${e.slug}`,
|
|
2167
2230
|
name: e.slug,
|
|
2168
2231
|
component: e.component
|
|
2169
2232
|
});
|
|
2170
2233
|
}
|
|
2234
|
+
/**
|
|
2235
|
+
* Resolve nested Doctype and Table fields in a schema by embedding child schemas inline.
|
|
2236
|
+
*
|
|
2237
|
+
* @remarks
|
|
2238
|
+
* Walks the schema array and for each field with `fieldtype: 'Doctype'` and a string
|
|
2239
|
+
* `options` value, looks up the referenced doctype in the registry and embeds its schema
|
|
2240
|
+
* as the field's `schema` property. Recurses for deeply nested doctypes.
|
|
2241
|
+
*
|
|
2242
|
+
* For fields with `fieldtype: 'Table'`, looks up the referenced child doctype and
|
|
2243
|
+
* auto-derives `columns` from its schema fields (unless columns are already provided).
|
|
2244
|
+
* Also sets sensible defaults for `component` (`'ATable'`) and `config` (`{ view: 'list' }`).
|
|
2245
|
+
* Row data is expected to come from the parent form's data model at `data[fieldname]`.
|
|
2246
|
+
*
|
|
2247
|
+
* Returns a new array — does not mutate the original schema.
|
|
2248
|
+
*
|
|
2249
|
+
* @param schema - The schema array to resolve
|
|
2250
|
+
* @returns A new schema array with nested Doctype fields resolved
|
|
2251
|
+
*
|
|
2252
|
+
* @example
|
|
2253
|
+
* ```ts
|
|
2254
|
+
* registry.addDoctype(addressDoctype)
|
|
2255
|
+
* registry.addDoctype(customerDoctype)
|
|
2256
|
+
*
|
|
2257
|
+
* // Before: customer schema has { fieldname: 'address', fieldtype: 'Doctype', options: 'address' }
|
|
2258
|
+
* const resolved = registry.resolveSchema(customerSchema)
|
|
2259
|
+
* // After: address field now has schema: [...address fields...]
|
|
2260
|
+
* ```
|
|
2261
|
+
*
|
|
2262
|
+
* @public
|
|
2263
|
+
*/
|
|
2264
|
+
resolveSchema(e, t) {
|
|
2265
|
+
const r = t || /* @__PURE__ */ new Set();
|
|
2266
|
+
return e.map((o) => {
|
|
2267
|
+
if ("fieldtype" in o && o.fieldtype === "Doctype" && "options" in o && typeof o.options == "string") {
|
|
2268
|
+
const s = o.options;
|
|
2269
|
+
if (r.has(s))
|
|
2270
|
+
return { ...o };
|
|
2271
|
+
const i = this.registry[s];
|
|
2272
|
+
if (i && i.schema) {
|
|
2273
|
+
const a = Array.isArray(i.schema) ? i.schema : Array.from(i.schema);
|
|
2274
|
+
r.add(s);
|
|
2275
|
+
const c = this.resolveSchema(a, r);
|
|
2276
|
+
return r.delete(s), { ...o, schema: c };
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
if ("fieldtype" in o && o.fieldtype === "Table" && "options" in o && typeof o.options == "string") {
|
|
2280
|
+
const s = o.options;
|
|
2281
|
+
if (r.has(s))
|
|
2282
|
+
return { ...o };
|
|
2283
|
+
const i = this.registry[s];
|
|
2284
|
+
if (i && i.schema) {
|
|
2285
|
+
const a = Array.isArray(i.schema) ? i.schema : Array.from(i.schema), c = { ...o };
|
|
2286
|
+
return (!("columns" in o) || !o.columns) && (c.columns = a.map((f) => ({
|
|
2287
|
+
name: f.fieldname,
|
|
2288
|
+
fieldname: f.fieldname,
|
|
2289
|
+
label: "label" in f && f.label || f.fieldname,
|
|
2290
|
+
fieldtype: "fieldtype" in f ? f.fieldtype : "Data",
|
|
2291
|
+
align: "align" in f && f.align || "left",
|
|
2292
|
+
edit: "edit" in f ? f.edit : !0,
|
|
2293
|
+
width: "width" in f && f.width || "20ch"
|
|
2294
|
+
}))), c.component || (c.component = "ATable"), (!("config" in o) || !o.config) && (c.config = { view: "list" }), (!("rows" in o) || !o.rows) && (c.rows = []), c;
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
return { ...o };
|
|
2298
|
+
});
|
|
2299
|
+
}
|
|
2300
|
+
/**
|
|
2301
|
+
* Initialize a new record with default values based on a schema.
|
|
2302
|
+
*
|
|
2303
|
+
* @remarks
|
|
2304
|
+
* Creates a plain object with keys from the schema's fieldnames and default values
|
|
2305
|
+
* derived from each field's `fieldtype`:
|
|
2306
|
+
* - Data, Text → `''`
|
|
2307
|
+
* - Check → `false`
|
|
2308
|
+
* - Int, Float, Decimal, Currency, Quantity → `0`
|
|
2309
|
+
* - Table → `[]`
|
|
2310
|
+
* - JSON, Doctype → `{}`
|
|
2311
|
+
* - All others → `null`
|
|
2312
|
+
*
|
|
2313
|
+
* For Doctype fields with a resolved `schema` array, recursively initializes the nested record.
|
|
2314
|
+
*
|
|
2315
|
+
* @param schema - The schema array to derive defaults from
|
|
2316
|
+
* @returns A plain object with default values for each field
|
|
2317
|
+
*
|
|
2318
|
+
* @example
|
|
2319
|
+
* ```ts
|
|
2320
|
+
* const defaults = registry.initializeRecord(addressSchema)
|
|
2321
|
+
* // { street: '', city: '', state: '', zip_code: '' }
|
|
2322
|
+
* ```
|
|
2323
|
+
*
|
|
2324
|
+
* @public
|
|
2325
|
+
*/
|
|
2326
|
+
initializeRecord(e) {
|
|
2327
|
+
const t = {};
|
|
2328
|
+
return e.forEach((r) => {
|
|
2329
|
+
switch ("fieldtype" in r ? r.fieldtype : "Data") {
|
|
2330
|
+
case "Data":
|
|
2331
|
+
case "Text":
|
|
2332
|
+
case "Code":
|
|
2333
|
+
t[r.fieldname] = "";
|
|
2334
|
+
break;
|
|
2335
|
+
case "Check":
|
|
2336
|
+
t[r.fieldname] = !1;
|
|
2337
|
+
break;
|
|
2338
|
+
case "Int":
|
|
2339
|
+
case "Float":
|
|
2340
|
+
case "Decimal":
|
|
2341
|
+
case "Currency":
|
|
2342
|
+
case "Quantity":
|
|
2343
|
+
t[r.fieldname] = 0;
|
|
2344
|
+
break;
|
|
2345
|
+
case "Table":
|
|
2346
|
+
t[r.fieldname] = [];
|
|
2347
|
+
break;
|
|
2348
|
+
case "JSON":
|
|
2349
|
+
t[r.fieldname] = {};
|
|
2350
|
+
break;
|
|
2351
|
+
case "Doctype":
|
|
2352
|
+
"schema" in r && Array.isArray(r.schema) ? t[r.fieldname] = this.initializeRecord(r.schema) : t[r.fieldname] = {};
|
|
2353
|
+
break;
|
|
2354
|
+
default:
|
|
2355
|
+
t[r.fieldname] = null;
|
|
2356
|
+
}
|
|
2357
|
+
}), t;
|
|
2358
|
+
}
|
|
2171
2359
|
// TODO: should we allow clearing the registry at all?
|
|
2172
2360
|
// clear() {
|
|
2173
2361
|
// this.registry = {}
|
|
@@ -2181,25 +2369,25 @@ class ce {
|
|
|
2181
2369
|
// }
|
|
2182
2370
|
// }
|
|
2183
2371
|
}
|
|
2184
|
-
async function
|
|
2185
|
-
await
|
|
2372
|
+
async function It(n, e, t) {
|
|
2373
|
+
await de();
|
|
2186
2374
|
try {
|
|
2187
2375
|
await t(n, e);
|
|
2188
2376
|
} catch {
|
|
2189
2377
|
}
|
|
2190
2378
|
}
|
|
2191
|
-
const
|
|
2379
|
+
const Jt = {
|
|
2192
2380
|
install: (n, e) => {
|
|
2193
2381
|
const t = n.config.globalProperties.$router, r = e?.router, o = t || r;
|
|
2194
2382
|
!t && r && n.use(r);
|
|
2195
|
-
const s = new
|
|
2383
|
+
const s = new fe(o, e?.getMeta);
|
|
2196
2384
|
n.provide("$registry", s), n.config.globalProperties.$registry = s;
|
|
2197
|
-
const i = new
|
|
2385
|
+
const i = new Ke(s);
|
|
2198
2386
|
n.provide("$stonecrop", i), n.config.globalProperties.$stonecrop = i;
|
|
2199
2387
|
try {
|
|
2200
2388
|
const a = n.config.globalProperties.$pinia;
|
|
2201
2389
|
if (a) {
|
|
2202
|
-
const c =
|
|
2390
|
+
const c = pe(a);
|
|
2203
2391
|
n.provide("$operationLogStore", c), n.config.globalProperties.$operationLogStore = c;
|
|
2204
2392
|
}
|
|
2205
2393
|
} catch (a) {
|
|
@@ -2208,11 +2396,11 @@ const jt = {
|
|
|
2208
2396
|
if (e?.components)
|
|
2209
2397
|
for (const [a, c] of Object.entries(e.components))
|
|
2210
2398
|
n.component(a, c);
|
|
2211
|
-
e?.autoInitializeRouter && e.onRouterInitialized &&
|
|
2399
|
+
e?.autoInitializeRouter && e.onRouterInitialized && It(s, i, e.onRouterInitialized);
|
|
2212
2400
|
}
|
|
2213
2401
|
};
|
|
2214
|
-
var
|
|
2215
|
-
class
|
|
2402
|
+
var Ct = /* @__PURE__ */ ((n) => (n.ERROR = "error", n.WARNING = "warning", n.INFO = "info", n))(Ct || {});
|
|
2403
|
+
class kt {
|
|
2216
2404
|
options;
|
|
2217
2405
|
/**
|
|
2218
2406
|
* Creates a new SchemaValidator instance
|
|
@@ -2247,7 +2435,7 @@ class $t {
|
|
|
2247
2435
|
).length, c = s.filter(
|
|
2248
2436
|
(g) => g.severity === "warning"
|
|
2249
2437
|
/* WARNING */
|
|
2250
|
-
).length,
|
|
2438
|
+
).length, f = s.filter(
|
|
2251
2439
|
(g) => g.severity === "info"
|
|
2252
2440
|
/* INFO */
|
|
2253
2441
|
).length;
|
|
@@ -2256,7 +2444,7 @@ class $t {
|
|
|
2256
2444
|
issues: s,
|
|
2257
2445
|
errorCount: a,
|
|
2258
2446
|
warningCount: c,
|
|
2259
|
-
infoCount:
|
|
2447
|
+
infoCount: f
|
|
2260
2448
|
};
|
|
2261
2449
|
}
|
|
2262
2450
|
/**
|
|
@@ -2365,13 +2553,13 @@ class $t {
|
|
|
2365
2553
|
for (const [i, a] of Object.entries(t.states)) {
|
|
2366
2554
|
const c = a;
|
|
2367
2555
|
if (c.on) {
|
|
2368
|
-
for (const [
|
|
2556
|
+
for (const [f, g] of Object.entries(c.on))
|
|
2369
2557
|
if (typeof g == "string")
|
|
2370
2558
|
s.add(g);
|
|
2371
2559
|
else if (g && typeof g == "object") {
|
|
2372
|
-
const
|
|
2373
|
-
typeof
|
|
2374
|
-
typeof
|
|
2560
|
+
const b = "target" in g ? g.target : void 0;
|
|
2561
|
+
typeof b == "string" ? s.add(b) : Array.isArray(b) && b.forEach((A) => {
|
|
2562
|
+
typeof A == "string" && s.add(A);
|
|
2375
2563
|
});
|
|
2376
2564
|
}
|
|
2377
2565
|
}
|
|
@@ -2391,7 +2579,7 @@ class $t {
|
|
|
2391
2579
|
* @internal
|
|
2392
2580
|
*/
|
|
2393
2581
|
validateActionRegistration(e, t) {
|
|
2394
|
-
const r = [], o =
|
|
2582
|
+
const r = [], o = K();
|
|
2395
2583
|
for (const [s, i] of Object.entries(t)) {
|
|
2396
2584
|
if (!Array.isArray(i)) {
|
|
2397
2585
|
r.push({
|
|
@@ -2417,36 +2605,36 @@ class $t {
|
|
|
2417
2605
|
return r;
|
|
2418
2606
|
}
|
|
2419
2607
|
}
|
|
2420
|
-
function
|
|
2421
|
-
return new
|
|
2608
|
+
function Lt(n, e) {
|
|
2609
|
+
return new kt({
|
|
2422
2610
|
registry: n,
|
|
2423
2611
|
...e
|
|
2424
2612
|
});
|
|
2425
2613
|
}
|
|
2426
|
-
function
|
|
2427
|
-
return
|
|
2614
|
+
function qt(n, e, t, r, o) {
|
|
2615
|
+
return Lt(t).validate(n, e, r, o);
|
|
2428
2616
|
}
|
|
2429
2617
|
export {
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2618
|
+
Ut as DoctypeMeta,
|
|
2619
|
+
ne as HST,
|
|
2620
|
+
fe as Registry,
|
|
2621
|
+
kt as SchemaValidator,
|
|
2622
|
+
Ke as Stonecrop,
|
|
2623
|
+
Ct as ValidationSeverity,
|
|
2624
|
+
Dt as createHST,
|
|
2625
|
+
Lt as createValidator,
|
|
2626
|
+
Jt as default,
|
|
2627
|
+
K as getGlobalTriggerEngine,
|
|
2628
|
+
jt as markOperationIrreversible,
|
|
2629
|
+
xt as registerGlobalAction,
|
|
2630
|
+
Mt as registerTransitionAction,
|
|
2631
|
+
Ft as setFieldRollback,
|
|
2632
|
+
Bt as triggerTransition,
|
|
2633
|
+
Ge as useOperationLog,
|
|
2634
|
+
pe as useOperationLogStore,
|
|
2635
|
+
Wt as useStonecrop,
|
|
2636
|
+
Ht as useUndoRedoShortcuts,
|
|
2637
|
+
qt as validateSchema,
|
|
2638
|
+
zt as withBatch
|
|
2451
2639
|
};
|
|
2452
2640
|
//# sourceMappingURL=stonecrop.js.map
|