@stonecrop/stonecrop 0.8.3 → 0.8.5

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/stonecrop.js CHANGED
@@ -1,4 +1,4 @@
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";
1
+ import { hasInjectionContext as Ae, inject as oe, toRaw as Me, computed as W, isRef as se, isReactive as be, toRef as ce, getCurrentInstance as Fe, 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
2
  const te = typeof window < "u";
3
3
  let G;
4
4
  const me = (n) => G = n;
@@ -198,7 +198,7 @@ function _e(n, e, t = {}, r, o, s) {
198
198
  ) : p, te && (M._getters || // @ts-expect-error: same
199
199
  (M._getters = ae([]))).push(d));
200
200
  }
201
- if (z(v, M), z(Fe(v), M), Object.defineProperty(v, "$state", {
201
+ if (z(v, M), z(Me(v), M), Object.defineProperty(v, "$state", {
202
202
  get: () => process.env.NODE_ENV !== "production" && o ? x.value : r.state.value[n],
203
203
  set: (d) => {
204
204
  if (process.env.NODE_ENV !== "production" && o)
@@ -288,7 +288,7 @@ This will fail in production.`);
288
288
  a._hotUpdate(b), delete i.state.value[g], i._s.delete(g);
289
289
  }
290
290
  if (process.env.NODE_ENV !== "production" && te) {
291
- const g = Me();
291
+ const g = Fe();
292
292
  if (g && g.proxy && // avoid adding stores that are just built for hot module replacement
293
293
  !a) {
294
294
  const b = g.proxy, A = "_pStores" in b ? b._pStores : b._pStores = {};
@@ -300,7 +300,7 @@ This will fail in production.`);
300
300
  return s.$id = n, s;
301
301
  }
302
302
  function Ue(n) {
303
- const e = Fe(n), t = {};
303
+ const e = Me(n), t = {};
304
304
  for (const r in e) {
305
305
  const o = e[r];
306
306
  o.effect ? t[r] = // ...
@@ -361,7 +361,7 @@ function Oe(n) {
361
361
  return Array.isArray(n) ? n : [n];
362
362
  }
363
363
  function pt(n) {
364
- return Me();
364
+ return Fe();
365
365
  }
366
366
  function ht(n, e, t = {}) {
367
367
  const { eventFilter: r = qe, ...o } = t;
@@ -379,11 +379,10 @@ function gt(n, e, t = {}) {
379
379
  isActive: f
380
380
  };
381
381
  }
382
- const vt = gt;
383
- function yt(n, e = !0, t) {
382
+ function vt(n, e = !0, t) {
384
383
  pt() ? Be(n, t) : e ? n() : de(n);
385
384
  }
386
- function mt(n, e, t) {
385
+ function yt(n, e, t) {
387
386
  return U(n, e, {
388
387
  ...t,
389
388
  immediate: !0
@@ -398,7 +397,7 @@ function ie(n, e, t) {
398
397
  });
399
398
  }
400
399
  const Q = at ? window : void 0;
401
- function St(n) {
400
+ function mt(n) {
402
401
  var e;
403
402
  const t = q(n);
404
403
  return (e = t?.$el) !== null && e !== void 0 ? e : t;
@@ -408,10 +407,10 @@ function re(...n) {
408
407
  const r = Oe(q(n[0])).filter((o) => o != null);
409
408
  return r.every((o) => typeof o != "string") ? r : void 0;
410
409
  });
411
- return mt(() => {
410
+ return yt(() => {
412
411
  var r, o;
413
412
  return [
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),
413
+ (r = (o = t.value) === null || o === void 0 ? void 0 : o.map((s) => mt(s))) !== null && r !== void 0 ? r : [Q].filter((s) => s != null),
415
414
  Oe(q(t.value ? n[1] : n[0])),
416
415
  Oe(rt(t.value ? n[2] : n[1])),
417
416
  q(t.value ? n[3] : n[2])
@@ -424,17 +423,17 @@ function re(...n) {
424
423
  });
425
424
  }, { flush: "post" });
426
425
  }
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() {
426
+ const he = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, ge = "__vueuse_ssr_handlers__", St = /* @__PURE__ */ bt();
427
+ function bt() {
429
428
  return ge in he || (he[ge] = he[ge] || {}), he[ge];
430
429
  }
431
- function Et(n, e) {
432
- return bt[n] || e;
430
+ function wt(n, e) {
431
+ return St[n] || e;
433
432
  }
434
- function Ot(n) {
433
+ function Et(n) {
435
434
  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
435
  }
437
- const Rt = {
436
+ const Ot = {
438
437
  boolean: {
439
438
  read: (n) => n === "true",
440
439
  write: (n) => String(n)
@@ -468,18 +467,18 @@ const Rt = {
468
467
  write: (n) => n.toISOString()
469
468
  }
470
469
  }, Le = "vueuse-storage";
471
- function At(n, e, t, r = {}) {
470
+ function Rt(n, e, t, r = {}) {
472
471
  var o;
473
472
  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
473
  console.error(w);
475
474
  }, initOnMounted: k } = r, x = (g ? We : B)(e), N = W(() => q(n));
476
475
  if (!t) try {
477
- t = Et("getDefaultStorage", () => Q?.localStorage)();
476
+ t = wt("getDefaultStorage", () => Q?.localStorage)();
478
477
  } catch (w) {
479
478
  $(w);
480
479
  }
481
480
  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), {
481
+ const D = q(e), P = Et(D), S = (o = r.serializer) !== null && o !== void 0 ? o : Ot[P], { pause: C, resume: O } = gt(x, (w) => d(w), {
483
482
  flush: s,
484
483
  deep: i,
485
484
  eventFilter: A
@@ -491,7 +490,7 @@ function At(n, e, t, r = {}) {
491
490
  }, j = (w) => {
492
491
  k && !_ || F(w);
493
492
  };
494
- b && a && (t instanceof Storage ? re(b, "storage", v, { passive: !0 }) : re(b, Le, j)), k ? yt(() => {
493
+ b && a && (t instanceof Storage ? re(b, "storage", v, { passive: !0 }) : re(b, Le, j)), k ? vt(() => {
495
494
  _ = !0, R();
496
495
  }) : R();
497
496
  function M(w, T) {
@@ -554,11 +553,11 @@ function At(n, e, t, r = {}) {
554
553
  }
555
554
  return x;
556
555
  }
557
- function Pt(n, e, t = {}) {
556
+ function At(n, e, t = {}) {
558
557
  const { window: r = Q } = t;
559
- return At(n, e, r?.localStorage, t);
558
+ return Rt(n, e, r?.localStorage, t);
560
559
  }
561
- const Nt = {
560
+ const Pt = {
562
561
  ctrl: "control",
563
562
  command: "meta",
564
563
  cmd: "meta",
@@ -568,8 +567,8 @@ const Nt = {
568
567
  left: "arrowleft",
569
568
  right: "arrowright"
570
569
  };
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 = {
570
+ function Nt(n = {}) {
571
+ const { reactive: e = !1, target: t = Q, aliasMap: r = Pt, passive: o = !0, onEventFired: s = Je } = n, i = ye(/* @__PURE__ */ new Set()), a = {
573
572
  toJSON() {
574
573
  return {};
575
574
  },
@@ -606,7 +605,7 @@ function _t(n = {}) {
606
605
  function N(P, S) {
607
606
  var C, O;
608
607
  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
- if (_ !== "") {
608
+ if (_) {
610
609
  _ && (S ? i.add(_) : i.delete(_));
611
610
  for (const j of v)
612
611
  b.add(j), A(j, S);
@@ -644,7 +643,7 @@ function ve(n) {
644
643
  timestamp: t.timestamp.toISOString()
645
644
  }))), e;
646
645
  }
647
- function $t(n) {
646
+ function _t(n) {
648
647
  const e = {
649
648
  type: n.type,
650
649
  clientId: n.clientId,
@@ -814,7 +813,7 @@ const pe = /* @__PURE__ */ it("hst-operation-log", () => {
814
813
  typeof window > "u" || !window.BroadcastChannel || (d = new BroadcastChannel("stonecrop-operation-log"), d.addEventListener("message", (u) => {
815
814
  const l = u.data;
816
815
  if (!l || typeof l != "object") return;
817
- const h = $t(l);
816
+ const h = _t(l);
818
817
  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
818
  }));
820
819
  }
@@ -858,7 +857,7 @@ const pe = /* @__PURE__ */ it("hst-operation-log", () => {
858
857
  };
859
858
  d.postMessage(ve(l));
860
859
  }
861
- const L = Pt("stonecrop-ops-operations", null, {
860
+ const L = At("stonecrop-ops-operations", null, {
862
861
  serializer: {
863
862
  read: (u) => {
864
863
  try {
@@ -1271,16 +1270,16 @@ class ue {
1271
1270
  function K(n) {
1272
1271
  return new ue(n);
1273
1272
  }
1274
- function xt(n, e) {
1273
+ function Vt(n, e) {
1275
1274
  K().registerAction(n, e);
1276
1275
  }
1277
- function Mt(n, e) {
1276
+ function xt(n, e) {
1278
1277
  K().registerTransitionAction(n, e);
1279
1278
  }
1280
- function Ft(n, e, t) {
1279
+ function Mt(n, e, t) {
1281
1280
  K().setFieldRollback(n, e, t);
1282
1281
  }
1283
- async function Bt(n, e, t) {
1282
+ async function Ft(n, e, t) {
1284
1283
  const r = K(), o = {
1285
1284
  path: t?.path || (t?.recordId ? `${n}.${t.recordId}` : n),
1286
1285
  fieldname: "",
@@ -1297,7 +1296,7 @@ async function Bt(n, e, t) {
1297
1296
  };
1298
1297
  return await r.executeTransitionActions(o);
1299
1298
  }
1300
- function jt(n, e) {
1299
+ function Bt(n, e) {
1301
1300
  if (n)
1302
1301
  try {
1303
1302
  pe().markIrreversible(n, e);
@@ -1588,7 +1587,7 @@ class Se {
1588
1587
  return e ? e.replace(/\[(\d+)\]/g, ".$1").split(".").filter((r) => r.length > 0) : [];
1589
1588
  }
1590
1589
  }
1591
- function Dt(n, e, t) {
1590
+ function $t(n, e, t) {
1592
1591
  return new Se(n, e, "", null, t);
1593
1592
  }
1594
1593
  class Ke {
@@ -1619,7 +1618,7 @@ class Ke {
1619
1618
  const e = {};
1620
1619
  Object.keys(this.registry.registry).forEach((t) => {
1621
1620
  e[t] = {};
1622
- }), this.hstStore = Dt(ye(e), "StonecropStore");
1621
+ }), this.hstStore = $t(ye(e), "StonecropStore");
1623
1622
  }
1624
1623
  /**
1625
1624
  * Setup automatic sync with Registry when doctypes are added
@@ -1763,7 +1762,7 @@ class Ke {
1763
1762
  return this.hstStore;
1764
1763
  }
1765
1764
  }
1766
- function Wt(n) {
1765
+ function jt(n) {
1767
1766
  n || (n = {});
1768
1767
  const e = n.registry || oe("$registry"), t = oe("$stonecrop"), r = B(), o = B(), s = B({}), i = B(), a = B(), c = B([]);
1769
1768
  if (n.doctype && e) {
@@ -1890,7 +1889,7 @@ function Wt(n) {
1890
1889
  }
1891
1890
  o.value.set(y.path, y.value);
1892
1891
  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;
1892
+ u.length === 1 ? l[u[0]] = y.value : Dt(l, u, y.value), s.value = l;
1894
1893
  } catch {
1895
1894
  }
1896
1895
  };
@@ -2015,7 +2014,7 @@ function xe(n, e, t, r) {
2015
2014
  { deep: !0 }
2016
2015
  );
2017
2016
  }
2018
- function Tt(n, e, t) {
2017
+ function Dt(n, e, t) {
2019
2018
  let r = n;
2020
2019
  for (let s = 0; s < e.length - 1; s++) {
2021
2020
  const i = e[s];
@@ -2094,9 +2093,9 @@ function Ge(n) {
2094
2093
  configure: C
2095
2094
  };
2096
2095
  }
2097
- function Ht(n, e = !0) {
2096
+ function Wt(n, e = !0) {
2098
2097
  if (!e) return;
2099
- const { undo: t, redo: r, canUndo: o, canRedo: s } = Ge(), i = _t();
2098
+ const { undo: t, redo: r, canUndo: o, canRedo: s } = Ge(), i = Nt();
2100
2099
  ie(i["Ctrl+Z"], () => {
2101
2100
  o.value && t(n);
2102
2101
  }), ie(i["Meta+Z"], () => {
@@ -2109,7 +2108,7 @@ function Ht(n, e = !0) {
2109
2108
  s.value && r(n);
2110
2109
  });
2111
2110
  }
2112
- async function zt(n, e) {
2111
+ async function Ht(n, e) {
2113
2112
  const { startBatch: t, commitBatch: r, cancelBatch: o } = Ge();
2114
2113
  t();
2115
2114
  try {
@@ -2118,7 +2117,7 @@ async function zt(n, e) {
2118
2117
  throw o(), s;
2119
2118
  }
2120
2119
  }
2121
- class Ut {
2120
+ class zt {
2122
2121
  /**
2123
2122
  * The doctype name
2124
2123
  * @public
@@ -2369,14 +2368,14 @@ class fe {
2369
2368
  // }
2370
2369
  // }
2371
2370
  }
2372
- async function It(n, e, t) {
2371
+ async function Tt(n, e, t) {
2373
2372
  await de();
2374
2373
  try {
2375
2374
  await t(n, e);
2376
2375
  } catch {
2377
2376
  }
2378
2377
  }
2379
- const Jt = {
2378
+ const Ut = {
2380
2379
  install: (n, e) => {
2381
2380
  const t = n.config.globalProperties.$router, r = e?.router, o = t || r;
2382
2381
  !t && r && n.use(r);
@@ -2396,11 +2395,11 @@ const Jt = {
2396
2395
  if (e?.components)
2397
2396
  for (const [a, c] of Object.entries(e.components))
2398
2397
  n.component(a, c);
2399
- e?.autoInitializeRouter && e.onRouterInitialized && It(s, i, e.onRouterInitialized);
2398
+ e?.autoInitializeRouter && e.onRouterInitialized && Tt(s, i, e.onRouterInitialized);
2400
2399
  }
2401
2400
  };
2402
- var Ct = /* @__PURE__ */ ((n) => (n.ERROR = "error", n.WARNING = "warning", n.INFO = "info", n))(Ct || {});
2403
- class kt {
2401
+ var It = /* @__PURE__ */ ((n) => (n.ERROR = "error", n.WARNING = "warning", n.INFO = "info", n))(It || {});
2402
+ class Ct {
2404
2403
  options;
2405
2404
  /**
2406
2405
  * Creates a new SchemaValidator instance
@@ -2605,36 +2604,36 @@ class kt {
2605
2604
  return r;
2606
2605
  }
2607
2606
  }
2608
- function Lt(n, e) {
2609
- return new kt({
2607
+ function kt(n, e) {
2608
+ return new Ct({
2610
2609
  registry: n,
2611
2610
  ...e
2612
2611
  });
2613
2612
  }
2614
- function qt(n, e, t, r, o) {
2615
- return Lt(t).validate(n, e, r, o);
2613
+ function Jt(n, e, t, r, o) {
2614
+ return kt(t).validate(n, e, r, o);
2616
2615
  }
2617
2616
  export {
2618
- Ut as DoctypeMeta,
2617
+ zt as DoctypeMeta,
2619
2618
  ne as HST,
2620
2619
  fe as Registry,
2621
- kt as SchemaValidator,
2620
+ Ct as SchemaValidator,
2622
2621
  Ke as Stonecrop,
2623
- Ct as ValidationSeverity,
2624
- Dt as createHST,
2625
- Lt as createValidator,
2626
- Jt as default,
2622
+ It as ValidationSeverity,
2623
+ $t as createHST,
2624
+ kt as createValidator,
2625
+ Ut as default,
2627
2626
  K as getGlobalTriggerEngine,
2628
- jt as markOperationIrreversible,
2629
- xt as registerGlobalAction,
2630
- Mt as registerTransitionAction,
2631
- Ft as setFieldRollback,
2632
- Bt as triggerTransition,
2627
+ Bt as markOperationIrreversible,
2628
+ Vt as registerGlobalAction,
2629
+ xt as registerTransitionAction,
2630
+ Mt as setFieldRollback,
2631
+ Ft as triggerTransition,
2633
2632
  Ge as useOperationLog,
2634
2633
  pe as useOperationLogStore,
2635
- Wt as useStonecrop,
2636
- Ht as useUndoRedoShortcuts,
2637
- qt as validateSchema,
2638
- zt as withBatch
2634
+ jt as useStonecrop,
2635
+ Wt as useUndoRedoShortcuts,
2636
+ Jt as validateSchema,
2637
+ Ht as withBatch
2639
2638
  };
2640
2639
  //# sourceMappingURL=stonecrop.js.map