bitboss-ui 0.2.3 → 0.2.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.
Files changed (133) hide show
  1. package/dist/components/BbTable/BbTable.vue.d.ts +15 -15
  2. package/dist/components/BbTable/types.d.ts +9 -14
  3. package/dist/index101.js +3 -3
  4. package/dist/index101.js.map +1 -1
  5. package/dist/index103.js +2 -2
  6. package/dist/index109.js +1 -1
  7. package/dist/index11.js +2 -2
  8. package/dist/index111.js +4 -4
  9. package/dist/index113.js +1 -1
  10. package/dist/index116.js +1 -1
  11. package/dist/index117.js +1 -1
  12. package/dist/index118.js +1 -1
  13. package/dist/index119.js +1 -1
  14. package/dist/index121.js +1 -1
  15. package/dist/index125.js +1 -1
  16. package/dist/index126.js +1 -1
  17. package/dist/index128.js +2 -2
  18. package/dist/index15.js +8 -8
  19. package/dist/index17.js +9 -9
  20. package/dist/index19.js +3 -3
  21. package/dist/index195.js +5 -2
  22. package/dist/index195.js.map +1 -1
  23. package/dist/index196.js +16 -4
  24. package/dist/index196.js.map +1 -1
  25. package/dist/index197.js +16 -3
  26. package/dist/index197.js.map +1 -1
  27. package/dist/index198.js +19 -35
  28. package/dist/index198.js.map +1 -1
  29. package/dist/index199.js +20 -6
  30. package/dist/index199.js.map +1 -1
  31. package/dist/index200.js +29 -2
  32. package/dist/index200.js.map +1 -1
  33. package/dist/index201.js +8 -351
  34. package/dist/index201.js.map +1 -1
  35. package/dist/index202.js +2 -134
  36. package/dist/index202.js.map +1 -1
  37. package/dist/index203.js +235 -5
  38. package/dist/index203.js.map +1 -1
  39. package/dist/index204.js +10 -19
  40. package/dist/index204.js.map +1 -1
  41. package/dist/index205.js +2 -2
  42. package/dist/index205.js.map +1 -1
  43. package/dist/index206.js +4 -2
  44. package/dist/index206.js.map +1 -1
  45. package/dist/index207.js +336 -171
  46. package/dist/index207.js.map +1 -1
  47. package/dist/index208.js +134 -23
  48. package/dist/index208.js.map +1 -1
  49. package/dist/index209.js +2 -369
  50. package/dist/index209.js.map +1 -1
  51. package/dist/index21.js +2 -2
  52. package/dist/index210.js +186 -2
  53. package/dist/index210.js.map +1 -1
  54. package/dist/index211.js +23 -16
  55. package/dist/index211.js.map +1 -1
  56. package/dist/index212.js +367 -14
  57. package/dist/index212.js.map +1 -1
  58. package/dist/index213.js +2 -20
  59. package/dist/index213.js.map +1 -1
  60. package/dist/index214.js +2 -29
  61. package/dist/index214.js.map +1 -1
  62. package/dist/index215.js +3 -8
  63. package/dist/index215.js.map +1 -1
  64. package/dist/index216.js +3 -235
  65. package/dist/index216.js.map +1 -1
  66. package/dist/index217.js +3 -10
  67. package/dist/index217.js.map +1 -1
  68. package/dist/index219.js +6 -3
  69. package/dist/index219.js.map +1 -1
  70. package/dist/index220.js +35 -3
  71. package/dist/index220.js.map +1 -1
  72. package/dist/index222.js +4 -4
  73. package/dist/index223.js +1 -1
  74. package/dist/index225.js +1 -1
  75. package/dist/index226.js +2 -4
  76. package/dist/index226.js.map +1 -1
  77. package/dist/index227.js +3 -434
  78. package/dist/index227.js.map +1 -1
  79. package/dist/index228.js +294 -88
  80. package/dist/index228.js.map +1 -1
  81. package/dist/index229.js +6 -200
  82. package/dist/index229.js.map +1 -1
  83. package/dist/index23.js +1 -1
  84. package/dist/index230.js +2 -6
  85. package/dist/index230.js.map +1 -1
  86. package/dist/index231.js +2 -2
  87. package/dist/index232.js +2 -295
  88. package/dist/index232.js.map +1 -1
  89. package/dist/index233.js +2 -2
  90. package/dist/index235.js +2 -117
  91. package/dist/index235.js.map +1 -1
  92. package/dist/index236.js +68 -105
  93. package/dist/index236.js.map +1 -1
  94. package/dist/index237.js +162 -2
  95. package/dist/index237.js.map +1 -1
  96. package/dist/index238.js +2 -2
  97. package/dist/index239.js +2 -2
  98. package/dist/index240.js +117 -2
  99. package/dist/index240.js.map +1 -1
  100. package/dist/index241.js +106 -2
  101. package/dist/index241.js.map +1 -1
  102. package/dist/index242.js +2 -69
  103. package/dist/index242.js.map +1 -1
  104. package/dist/index243.js +224 -2
  105. package/dist/index243.js.map +1 -1
  106. package/dist/index244.js +257 -161
  107. package/dist/index244.js.map +1 -1
  108. package/dist/index245.js +2 -2
  109. package/dist/index245.js.map +1 -1
  110. package/dist/index246.js +89 -2
  111. package/dist/index246.js.map +1 -1
  112. package/dist/index247.js +430 -219
  113. package/dist/index247.js.map +1 -1
  114. package/dist/index248.js +200 -258
  115. package/dist/index248.js.map +1 -1
  116. package/dist/index25.js +2 -2
  117. package/dist/index252.js +1 -1
  118. package/dist/index253.js +2 -2
  119. package/dist/index29.js +3 -3
  120. package/dist/index31.js +5 -5
  121. package/dist/index33.js +2 -2
  122. package/dist/index35.js +2 -2
  123. package/dist/index47.js +1 -1
  124. package/dist/index49.js +1 -1
  125. package/dist/index65.js +3 -3
  126. package/dist/index72.js +1 -1
  127. package/dist/index75.js +1 -1
  128. package/dist/index79.js +3 -3
  129. package/dist/index8.js +72 -72
  130. package/dist/index8.js.map +1 -1
  131. package/dist/index81.js +1 -1
  132. package/dist/style.css +1 -1
  133. package/package.json +1 -1
package/dist/index25.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as g, computed as n, ref as _, openBlock as w, createElementBlock as B, normalizeClass as C, createElementVNode as l, normalizeProps as t, guardReactiveProps as u, renderSlot as V } from "vue";
2
- import { isCssColor as i } from "./index195.js";
3
- import { when as E } from "./index196.js";
2
+ import { isCssColor as i } from "./index205.js";
3
+ import { when as E } from "./index206.js";
4
4
  const N = {
5
5
  class: "bb-base-radio-container",
6
6
  "aria-hidden": "true"
package/dist/index252.js CHANGED
@@ -1,4 +1,4 @@
1
- import f from "./index242.js";
1
+ import f from "./index236.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/dist/index253.js CHANGED
@@ -1,5 +1,5 @@
1
- import o from "./index244.js";
2
- import "./index245.js";
1
+ import o from "./index237.js";
2
+ import "./index238.js";
3
3
  export {
4
4
  o as default
5
5
  };
package/dist/index29.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as C, ref as b, computed as f, openBlock as l, createElementBlock as i, mergeProps as g, createElementVNode as r, Fragment as I, renderList as V, normalizeClass as B, toDisplayString as h, renderSlot as x } from "vue";
2
- import { booleanishToBoolean as M } from "./index210.js";
3
- import { identity as F } from "./index205.js";
4
- import { isCssColor as p } from "./index195.js";
2
+ import { booleanishToBoolean as M } from "./index214.js";
3
+ import { identity as F } from "./index209.js";
4
+ import { isCssColor as p } from "./index205.js";
5
5
  import { isNotNil as T } from "./index124.js";
6
6
  const H = { class: "bb-base-rating__inner-container" }, D = { class: "bb-base-rating__label-text" }, N = ["autofocus", "checked", "disabled", "id", "name", "value"], j = ["width", "height"], A = /* @__PURE__ */ r("path", {
7
7
  "stroke-linecap": "round",
package/dist/index31.js CHANGED
@@ -3,17 +3,17 @@ import Pe from "./index115.js";
3
3
  import "./index157.js";
4
4
  import He from "./index119.js";
5
5
  import "./index184.js";
6
- import { autoUpdate as je, computePosition as Qe } from "./index201.js";
6
+ import { autoUpdate as je, computePosition as Qe } from "./index207.js";
7
7
  import { deepEqual as re } from "./index123.js";
8
8
  import { head as le } from "./index218.js";
9
9
  import { isNotNil as I } from "./index124.js";
10
- import { last as Ue } from "./index206.js";
10
+ import { last as Ue } from "./index202.js";
11
11
  import { useItemText as We } from "./index125.js";
12
12
  import { useItemValue as Ke } from "./index126.js";
13
13
  import { wait as q } from "./index122.js";
14
- import { waitFor as Re } from "./index199.js";
15
- import { when as Ye } from "./index196.js";
16
- import { offset as Ze, flip as Ge, shift as Xe } from "./index209.js";
14
+ import { waitFor as Re } from "./index219.js";
15
+ import { when as Ye } from "./index206.js";
16
+ import { offset as Ze, flip as Ge, shift as Xe } from "./index212.js";
17
17
  const el = { class: "bb-base-select__input-container" }, ll = ["autofocus", "disabled", "id", "placeholder", "readonly", "onBlur", "onFocus", "onChange", "onInput", "onKeydown"], tl = {
18
18
  key: 0,
19
19
  class: "bb-base-select__loading-container"
package/dist/index33.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as R, ref as l, onMounted as S, watchEffect as z, computed as y, openBlock as D, createElementBlock as F, mergeProps as h, renderSlot as g, createElementVNode as t, normalizeProps as H, guardReactiveProps as T, normalizeStyle as E, unref as X } from "vue";
2
- import { clamp as K } from "./index200.js";
3
- import { isCssColor as w } from "./index195.js";
2
+ import { clamp as K } from "./index213.js";
3
+ import { isCssColor as w } from "./index205.js";
4
4
  import { isNil as O } from "./index120.js";
5
5
  import { transposeValue as L } from "./index121.js";
6
6
  const Y = { class: "bb-base-slider__slider-container" }, j = ["disabled", "id", "name", "readonly", "value"], q = ["aria-readonly", "aria-valuemax", "aria-valuemin", "aria-valuenow", "tabindex"], W = /* @__PURE__ */ R({
package/dist/index35.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as I, ref as b, computed as n, watch as F, openBlock as m, createElementBlock as p, normalizeClass as N, normalizeProps as c, mergeProps as h, createCommentVNode as S, createElementVNode as l, renderSlot as x, guardReactiveProps as f } from "vue";
2
- import { isCssColor as V } from "./index195.js";
3
- import { when as A } from "./index196.js";
2
+ import { isCssColor as V } from "./index205.js";
3
+ import { when as A } from "./index206.js";
4
4
  const J = { class: "bb-base-switch-container" }, M = /* @__PURE__ */ l("span", { class: "bb-base-switch-container__icon-thumb" }, null, -1), O = [
5
5
  M
6
6
  ], H = /* @__PURE__ */ I({
package/dist/index47.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as p, computed as u, ref as d, watch as f, openBlock as a, createElementBlock as l, normalizeProps as b, guardReactiveProps as z, createElementVNode as v, renderSlot as g, createCommentVNode as h } from "vue";
2
- import { isCssColor as _ } from "./index195.js";
2
+ import { isCssColor as _ } from "./index205.js";
3
3
  const k = { class: "bb-avatar__fallback" }, C = ["alt", "src", "srcset", "sizes"], B = /* @__PURE__ */ p({
4
4
  __name: "BbAvatar",
5
5
  props: {
package/dist/index49.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as p, useSlots as d, computed as n, openBlock as m, createElementBlock as u, normalizeClass as g, createElementVNode as s, renderSlot as l, mergeProps as f, createTextVNode as _, toDisplayString as y } from "vue";
2
- import { isCssColor as r } from "./index195.js";
2
+ import { isCssColor as r } from "./index205.js";
3
3
  import { isNil as B } from "./index120.js";
4
4
  const C = { class: "bb-badge__wrapper" }, h = { class: "bb-badge__content-inner" }, S = /* @__PURE__ */ p({
5
5
  __name: "BbBadge",
package/dist/index65.js CHANGED
@@ -5,9 +5,9 @@ import { useId as de } from "./index7.js";
5
5
  import { wait as U } from "./index122.js";
6
6
  import ce from "./index9.js";
7
7
  import "./index10.js";
8
- import V from "./index208.js";
9
- import { autoUpdate as fe } from "./index201.js";
10
- import { flip as pe, offset as be, shift as me } from "./index209.js";
8
+ import V from "./index211.js";
9
+ import { autoUpdate as fe } from "./index207.js";
10
+ import { flip as pe, offset as be, shift as me } from "./index212.js";
11
11
  const ve = ["aria-labelledby", "id"], we = { class: "bb-dropdown__items-container" }, Me = /* @__PURE__ */ Y({
12
12
  __name: "BbDropdown",
13
13
  props: {
package/dist/index72.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as h, ref as t, onMounted as m, onBeforeUnmount as p, openBlock as g, createBlock as b, resolveDynamicComponent as w, withCtx as _, renderSlot as I } from "vue";
2
- import { throttle as c } from "./index197.js";
2
+ import { throttle as c } from "./index217.js";
3
3
  const M = /* @__PURE__ */ h({
4
4
  __name: "BbIntersection",
5
5
  props: {
package/dist/index75.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as G, ref as o, useAttrs as J, computed as b, onMounted as Q, watch as U, openBlock as m, createBlock as X, Teleport as Y, createElementVNode as s, mergeProps as N, createElementBlock as w, renderSlot as n, createTextVNode as Z, toDisplayString as z, createCommentVNode as B, nextTick as ee } from "vue";
2
- import { useFocusTrap as te } from "./index198.js";
2
+ import { useFocusTrap as te } from "./index220.js";
3
3
  import { useId as L } from "./index7.js";
4
4
  import { wait as E } from "./index122.js";
5
5
  const se = { class: "bb-offcanvas-close" }, oe = { class: "bb-offcanvas-close__content" }, ae = { class: "bb-offcanvas-close__label" }, le = /* @__PURE__ */ s("span", { class: "bb-offcanvas-close__icon" }, [
package/dist/index79.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { defineComponent as N, ref as a, computed as C, openBlock as f, createElementBlock as $, mergeProps as T, createElementVNode as s, renderSlot as B, normalizeProps as V, guardReactiveProps as I, unref as m, createBlock as P, Teleport as R, normalizeClass as U, normalizeStyle as j, withCtx as G, createCommentVNode as D, nextTick as J } from "vue";
2
2
  import { useFloating as K, arrow as Q } from "./index222.js";
3
- import { useFocusTrap as W } from "./index198.js";
3
+ import { useFocusTrap as W } from "./index220.js";
4
4
  import { useId as X } from "./index7.js";
5
5
  import { wait as E } from "./index122.js";
6
6
  import Y from "./index9.js";
7
7
  import "./index10.js";
8
- import { autoUpdate as Z } from "./index201.js";
9
- import { flip as ee, offset as oe, shift as te } from "./index209.js";
8
+ import { autoUpdate as Z } from "./index207.js";
9
+ import { flip as ee, offset as oe, shift as te } from "./index212.js";
10
10
  const ae = ["id"], re = { class: "bb-popover__bubble" }, ne = /* @__PURE__ */ s("span", { class: "bb-popover__close-label" }, "Chiudi", -1), se = /* @__PURE__ */ s("svg", {
11
11
  viewBox: "0 0 24 24",
12
12
  fill: "none",
package/dist/index8.js CHANGED
@@ -1,52 +1,51 @@
1
- import { reactive as Y, watch as d, toValue as D, computed as m, provide as G } from "vue";
2
- import { mapValues as H } from "./index127.js";
3
- import { useStepper as Q } from "./index128.js";
4
- import { useRoute as X } from "./index129.js";
5
- import { useRouter as Z } from "./index130.js";
1
+ import { reactive as L, watch as d, toValue as Y, computed as m, provide as D } from "vue";
2
+ import { mapValues as G } from "./index127.js";
3
+ import { useStepper as H } from "./index128.js";
4
+ import { useRoute as Q } from "./index129.js";
5
+ import { useRouter as X } from "./index130.js";
6
6
  import { isNotNil as p } from "./index124.js";
7
- import { wait as J } from "./index122.js";
8
- const _ = Symbol(), W = /((step\/)(?<step>[\s\S]+?)(?=[/?]))|((step\/)(?<step2>[\s\S]+))/, R = (i) => {
9
- var r, u;
10
- const e = i.match(W);
11
- return ((r = e == null ? void 0 : e.groups) == null ? void 0 : r.step) ?? ((u = e == null ? void 0 : e.groups) == null ? void 0 : u.step2) ?? null;
12
- }, ne = (i) => {
7
+ const Z = Symbol(), R = /((step\/)(?<step>[\s\S]+?)(?=[/?]))|((step\/)(?<step2>[\s\S]+))/, J = (i) => {
8
+ var r, a;
9
+ const e = i.match(R);
10
+ return ((r = e == null ? void 0 : e.groups) == null ? void 0 : r.step) ?? ((a = e == null ? void 0 : e.groups) == null ? void 0 : a.step2) ?? null;
11
+ }, ue = (i) => {
13
12
  if (!i.name)
14
13
  throw new Error(
15
14
  "You need to provide a unique name for the current wizard instance to be used to save data"
16
15
  );
17
- const e = X(), r = Z(), u = i.useNavigation ?? !0, q = i.navigationMode ?? "query", w = i.persist ?? !0;
18
- if (u && (!e.value || !r))
16
+ const e = Q(), r = X(), a = i.useNavigation ?? !0, q = i.navigationMode ?? "query", b = i.persist ?? !0;
17
+ if (a && (!e.value || !r))
19
18
  throw new Error(
20
19
  "Navigation is enabled but could not retrieve the router instance in useWizard."
21
20
  );
22
- const n = Y(
23
- w && sessionStorage.getItem(i.name) ? Object.assign(
21
+ const n = L(
22
+ b && sessionStorage.getItem(i.name) ? Object.assign(
24
23
  {},
25
24
  i.initialState,
26
25
  JSON.parse(sessionStorage.getItem(i.name))
27
26
  ) : i.initialState
28
27
  );
29
- w && d(n, () => {
28
+ b && d(n, () => {
30
29
  sessionStorage.setItem(i.name, JSON.stringify(n));
31
30
  });
32
- const $ = D(i.steps), o = m(
33
- () => Object.entries($).reduce(
34
- (t, [s, a]) => (a.condition && !a.condition(n) || (t[s] = { ...a, key: s }), t),
31
+ const W = Y(i.steps), o = m(
32
+ () => Object.entries(W).reduce(
33
+ (t, [s, u]) => (u.condition && !u.condition(n) || (t[s] = { ...u, key: s }), t),
35
34
  {}
36
35
  )
37
36
  ), S = m(
38
- () => H(o.value, (t) => ({
37
+ () => G(o.value, (t) => ({
39
38
  ...t,
40
39
  isValid: t.isValid ? t.isValid(n) : !0
41
40
  }))
42
41
  );
43
42
  let c = null;
44
- if (u && p(e.value)) {
43
+ if (a && p(e.value)) {
45
44
  let t = null;
46
45
  if (q === "query")
47
46
  e.value.query.step && (t = e.value.query.step);
48
47
  else {
49
- const s = R(e.value.fullPath);
48
+ const s = J(e.value.fullPath);
50
49
  s && (t = s);
51
50
  }
52
51
  c = t;
@@ -62,16 +61,16 @@ const _ = Symbol(), W = /((step\/)(?<step>[\s\S]+?)(?=[/?]))|((step\/)(?<step2>[
62
61
  }
63
62
  }
64
63
  const {
65
- steps: y,
66
- current: b,
67
- goToNext: T,
68
- goToPrevious: V,
64
+ steps: g,
65
+ current: T,
66
+ goToNext: V,
67
+ goToPrevious: N,
69
68
  goTo: v,
70
- index: C,
71
- at: N,
72
- get: O,
73
- goBackTo: x,
74
- isAfter: k,
69
+ index: $,
70
+ at: O,
71
+ get: x,
72
+ goBackTo: k,
73
+ isAfter: w,
75
74
  isBefore: P,
76
75
  isCurrent: j,
77
76
  isFirst: A,
@@ -81,20 +80,20 @@ const _ = Symbol(), W = /((step\/)(?<step>[\s\S]+?)(?=[/?]))|((step\/)(?<step2>[
81
80
  next: I,
82
81
  previous: M,
83
82
  stepNames: U
84
- } = Q(
83
+ } = H(
85
84
  S,
86
85
  c || Object.values(o.value)[0].key
87
- ), l = m(() => Object.keys(o.value)[C.value]);
88
- if (G(_, {
89
- goToNext: T,
90
- goToPrevious: V,
91
- current: b,
86
+ ), l = m(() => Object.keys(o.value)[$.value]);
87
+ if (D(Z, {
88
+ goToNext: V,
89
+ goToPrevious: N,
90
+ current: T,
92
91
  data: n,
93
- steps: y,
94
- at: N,
95
- get: O,
96
- goBackTo: x,
97
- isAfter: k,
92
+ steps: g,
93
+ at: O,
94
+ get: x,
95
+ goBackTo: k,
96
+ isAfter: w,
98
97
  isBefore: P,
99
98
  isCurrent: j,
100
99
  isFirst: A,
@@ -104,7 +103,7 @@ const _ = Symbol(), W = /((step\/)(?<step>[\s\S]+?)(?=[/?]))|((step\/)(?<step2>[
104
103
  next: I,
105
104
  previous: M,
106
105
  stepNames: U
107
- }), u)
106
+ }), a)
108
107
  if (q === "query")
109
108
  d(
110
109
  l,
@@ -124,36 +123,36 @@ const _ = Symbol(), W = /((step\/)(?<step>[\s\S]+?)(?=[/?]))|((step\/)(?<step2>[
124
123
  if (t) {
125
124
  const s = t;
126
125
  if (s in o.value) {
127
- const a = s, f = Object.keys(o.value);
126
+ const u = s, f = Object.keys(o.value);
128
127
  f.slice(
129
128
  0,
130
- f.indexOf(a)
129
+ f.indexOf(u)
131
130
  ).every(
132
131
  (B) => {
133
- var g;
134
- return (g = S.value[B]) == null ? void 0 : g.isValid;
132
+ var y;
133
+ return (y = S.value[B]) == null ? void 0 : y.isValid;
135
134
  }
136
- ) && v(a);
135
+ ) && v(u);
137
136
  }
138
137
  } else
139
- v(y.value[0]);
138
+ v(g.value[0]);
140
139
  }
141
140
  );
142
141
  else {
143
142
  const t = m(() => {
144
143
  if (p(e.value))
145
- return R(e.value.fullPath);
144
+ return J(e.value.fullPath);
146
145
  });
147
146
  d(
148
147
  l,
149
- async () => {
150
- p(e.value) && p(r) && (e.value.path.includes("step") ? (await J(50), await r.push({
148
+ () => {
149
+ p(e.value) && p(r) && (e.value.path.includes("step") ? r.push({
151
150
  query: e.value.query,
152
151
  path: e.value.path.replace(
153
- W,
152
+ R,
154
153
  `step/${l.value}`
155
154
  )
156
- })) : (await J(50), await r.push({
155
+ }) : r.push({
157
156
  query: e.value.query,
158
157
  // Normalizes paths with / and without
159
158
  path: (e.value.path + `/step/${l.value}`).replace(
@@ -161,42 +160,43 @@ const _ = Symbol(), W = /((step\/)(?<step>[\s\S]+?)(?=[/?]))|((step\/)(?<step2>[
161
160
  "/"
162
161
  ),
163
162
  replace: !0
164
- })));
165
- }
163
+ }));
164
+ },
165
+ { immediate: !0, flush: "post" }
166
166
  ), d(
167
167
  () => t.value,
168
168
  (s) => {
169
169
  if (s) {
170
- const a = s;
171
- if (a in o.value) {
172
- const f = a, h = Object.keys(o.value);
170
+ const u = s;
171
+ if (u in o.value) {
172
+ const f = u, h = Object.keys(o.value);
173
173
  h.slice(
174
174
  0,
175
175
  h.indexOf(f)
176
176
  ).every(
177
- (g) => {
177
+ (y) => {
178
178
  var E;
179
- return (E = o.value[g]) == null ? void 0 : E.isValid;
179
+ return (E = o.value[y]) == null ? void 0 : E.isValid;
180
180
  }
181
181
  ) && v(f);
182
182
  }
183
183
  } else
184
- v(y.value[0]);
184
+ v(g.value[0]);
185
185
  }
186
186
  );
187
187
  }
188
188
  return {
189
- steps: y,
190
- current: b,
191
- goToNext: T,
192
- goToPrevious: V,
189
+ steps: g,
190
+ current: T,
191
+ goToNext: V,
192
+ goToPrevious: N,
193
193
  goTo: v,
194
194
  key: l,
195
195
  data: n,
196
- at: N,
197
- get: O,
198
- goBackTo: x,
199
- isAfter: k,
196
+ at: O,
197
+ get: x,
198
+ goBackTo: k,
199
+ isAfter: w,
200
200
  isBefore: P,
201
201
  isCurrent: j,
202
202
  isFirst: A,
@@ -209,7 +209,7 @@ const _ = Symbol(), W = /((step\/)(?<step>[\s\S]+?)(?=[/?]))|((step\/)(?<step2>[
209
209
  };
210
210
  };
211
211
  export {
212
- ne as useWizard,
213
- _ as wizardInjectionKey
212
+ ue as useWizard,
213
+ Z as wizardInjectionKey
214
214
  };
215
215
  //# sourceMappingURL=index8.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index8.js","sources":["../src/composables/useWizard.ts"],"sourcesContent":["import { computed, provide, reactive, watch, toValue } from \"vue\";\nimport { mapValues } from \"@/utilities/functions/mapValues\";\nimport { useStepper } from \"@vueuse/core\";\nimport { useRoute } from \"./useRoute\";\nimport { useRouter } from \"./useRouter\";\nimport type { ComputedRef, MaybeRef } from \"vue\";\nimport { isNotNil } from \"@/utilities/functions/isNotNil\";\nimport { wait } from \"@/utilities/functions/wait\";\n\nexport const wizardInjectionKey = Symbol();\nexport type Step<U> = {\n /**\n * Function that accepts a state object and returns a boolean.\n * When step are accessed at the end of the pipeline the result\n * is provided so you don't have to run the function yourself.\n * It determines if the validation has passed for the step.\n */\n isValid?: (state: U) => boolean;\n /**\n * Function that accepts a state object and returns a boolean.\n * When step are accessed at the end of the pipeline the result\n * is provided so you don't have to run the function yourself.\n * Steps that do not pass the condition are removed.\n */\n condition?: (state: U) => boolean;\n [key: string]: any;\n};\nexport type WizardState<T extends Record<string, any>> = Pick<\n ReturnType<typeof useWizard<T>>,\n | \"data\"\n | \"goToNext\"\n | \"goToPrevious\"\n | \"current\"\n | \"steps\"\n | \"at\"\n | \"get\"\n | \"goBackTo\"\n | \"isAfter\"\n | \"isBefore\"\n | \"isCurrent\"\n | \"isFirst\"\n | \"isLast\"\n | \"isNext\"\n | \"isPrevious\"\n | \"next\"\n | \"previous\"\n | \"stepNames\"\n>;\n\nconst regexMatchStep =\n /((step\\/)(?<step>[\\s\\S]+?)(?=[/?]))|((step\\/)(?<step2>[\\s\\S]+))/;\n/**\n * With a url that follows the rule xyz.com/anything/step/:nameofthestep[/?query]\n * will match the :nameofthestep substring\n */\nconst extractStepFromUrl = (url: string) => {\n const match = url.match(regexMatchStep);\n return match?.groups?.step ?? match?.groups?.step2 ?? null;\n};\nexport const useWizard = <T extends object>(params: {\n /**\n * The steps definition for the wizard\n */\n steps: MaybeRef<Record<string, Step<T>>>;\n /**\n * Name of the wizard used to persist state\n */\n name: string;\n /**\n * Initial set of data to be made available throughout\n */\n initialState: T;\n /**\n * When navogation is enabled, to whether use the query parameters or an entire substring of the URL like xyz/steps/....\n * The latter useful with nuxt so you can leverage the automatic import of components based on the URL.\n */\n navigationMode?: \"query\" | \"route\";\n /**\n * Whether to use navigation at all. When disabled no query or URL is changed.\n */\n useNavigation?: boolean;\n /**\n *\n */\n persist?: boolean;\n}) => {\n if (!params.name) {\n throw new Error(\n \"You need to provide a unique name for the current wizard instance to be used to save data\"\n );\n }\n const route = useRoute();\n const router = useRouter();\n\n const useNavigation = params.useNavigation ?? true;\n const navigationMode = params.navigationMode ?? \"query\";\n const persist = params.persist ?? true;\n\n if (useNavigation && (!route.value || !router)) {\n throw new Error(\n \"Navigation is enabled but could not retrieve the router instance in useWizard.\"\n );\n }\n\n /**\n * Initial state is either read from session storage or the one provided\n */\n const innerState = reactive<typeof params.initialState>(\n persist && sessionStorage.getItem(params.name)\n ? Object.assign(\n {},\n params.initialState,\n JSON.parse(sessionStorage.getItem(params.name)!)\n )\n : params.initialState\n );\n\n if (persist) {\n /**\n * Every time the state changes save it to sessionStorage\n */\n watch(innerState, () => {\n sessionStorage.setItem(params.name, JSON.stringify(innerState));\n });\n }\n\n /**\n * Steps can be passed as ref so we need to unwrap them\n */\n const unwrappedSteps = toValue(params.steps);\n const filteredSteps = computed(() =>\n Object.entries(unwrappedSteps).reduce(\n (acc: typeof unwrappedSteps, [key, step]) => {\n if (step.condition) {\n if (!step.condition(innerState as T)) {\n return acc;\n }\n }\n acc[key] = { ...step, key };\n return acc;\n },\n {}\n )\n );\n\n /**\n * Steps can have a isValid function that receives the current state\n * but we don't want to have to call it every single time so we call it once here\n */\n const mappedSteps = computed(() =>\n mapValues(filteredSteps.value, (step) => {\n return {\n ...step,\n isValid: step.isValid ? step.isValid(innerState as T) : true,\n };\n })\n );\n\n /**\n * Get the initial step from the query.\n * If it exists check that every step before it is also valid\n * so user cannot manually jump by changing the URL\n */\n let initialStep = null;\n if (useNavigation && isNotNil(route.value)) {\n let step: string | null = null;\n if (navigationMode === \"query\") {\n if (route.value.query.step) {\n step = route.value.query.step as string;\n }\n } else {\n const stepFromUrl = extractStepFromUrl(route.value.fullPath);\n if (stepFromUrl) {\n step = stepFromUrl;\n }\n }\n initialStep = step;\n }\n\n if (initialStep) {\n for (const stepName in filteredSteps.value) {\n if (stepName === initialStep) break;\n const current = mappedSteps.value[stepName];\n if (!current || !current.isValid) {\n initialStep = null;\n break;\n }\n }\n }\n\n /**\n * Define the state of the wizard\n * A few data come from useStepper\n */\n const {\n steps,\n current,\n goToNext,\n goToPrevious,\n goTo,\n index,\n at,\n get,\n goBackTo,\n isAfter,\n isBefore,\n isCurrent,\n isFirst,\n isLast,\n isNext,\n isPrevious,\n next,\n previous,\n stepNames,\n } = useStepper(\n mappedSteps as any,\n initialStep || Object.values(filteredSteps.value)[0].key\n );\n\n const key = computed(() => Object.keys(filteredSteps.value)[index.value]);\n\n /**\n * Complete state object\n */\n const state = {\n goToNext,\n goToPrevious,\n current: current as ComputedRef<Step<T> & { isValid: boolean }>,\n data: innerState,\n steps,\n at,\n get,\n goBackTo,\n isAfter,\n isBefore,\n isCurrent,\n isFirst,\n isLast,\n isNext,\n isPrevious,\n next,\n previous,\n stepNames,\n };\n\n provide(wizardInjectionKey, state);\n\n if (useNavigation) {\n if (navigationMode === \"query\") {\n /**\n * Every time the current step changes update route\n */\n watch(\n key,\n () => {\n if (isNotNil(router) && isNotNil(route.value)) {\n router.push({\n ...route,\n query: { ...route.value.query, step: key.value ?? null },\n });\n }\n },\n { immediate: true }\n );\n\n /**\n * Every time the route changes align the current step to the route\n */\n watch(\n () => route.value?.query.step,\n (value) => {\n if (value) {\n const stepAsString = value as string;\n if (stepAsString in filteredSteps.value) {\n const stepAsKey = stepAsString;\n const stepKeys = Object.keys(filteredSteps.value);\n const stepsPriorToTarget = stepKeys.slice(\n 0,\n stepKeys.indexOf(stepAsKey)\n );\n const allValid = stepsPriorToTarget.every(\n (key) => mappedSteps.value[key]?.isValid\n );\n if (allValid) {\n goTo(stepAsKey);\n }\n }\n } else {\n goTo(steps.value[0]);\n }\n }\n );\n } else {\n const stepFromUrl = computed(() => {\n if (isNotNil(route.value)) {\n return extractStepFromUrl(route.value.fullPath);\n }\n });\n\n /**\n * Every time the current step changes update route\n */\n watch(\n key,\n async () => {\n if (isNotNil(route.value) && isNotNil(router)) {\n if (route.value.path.includes(\"step\")) {\n await wait(50)\n await router.push({\n query: route.value.query,\n path: route.value.path.replace(\n regexMatchStep,\n `step/${key.value}`\n ),\n });\n } else {\n await wait(50)\n await router.push({\n query: route.value.query,\n // Normalizes paths with / and without\n path: (route.value.path + `/step/${key.value}`).replace(\n \"//\",\n \"/\"\n ),\n replace: true,\n });\n }\n }\n },\n );\n\n /**\n * Every time the route changes align the current step to the route\n */\n watch(\n () => stepFromUrl.value,\n (value) => {\n if (value) {\n const stepAsString = value as string;\n if (stepAsString in filteredSteps.value) {\n const stepAsKey = stepAsString;\n const stepKeys = Object.keys(filteredSteps.value);\n const stepsPriorToTarget = stepKeys.slice(\n 0,\n stepKeys.indexOf(stepAsKey)\n );\n const allValid = stepsPriorToTarget.every(\n (key) => filteredSteps.value[key]?.isValid\n );\n if (allValid) {\n goTo(stepAsKey);\n }\n }\n } else {\n goTo(steps.value[0]);\n }\n }\n );\n }\n }\n\n return {\n steps,\n current: current as ComputedRef<Step<T> & { isValid: boolean }>,\n goToNext,\n goToPrevious,\n goTo,\n key,\n data: innerState,\n at,\n get,\n goBackTo,\n isAfter,\n isBefore,\n isCurrent,\n isFirst,\n isLast,\n isNext,\n isPrevious,\n next,\n previous,\n stepNames,\n };\n};\n"],"names":["wizardInjectionKey","regexMatchStep","extractStepFromUrl","url","match","_a","_b","useWizard","params","route","useRoute","router","useRouter","useNavigation","navigationMode","persist","innerState","reactive","watch","unwrappedSteps","toValue","filteredSteps","computed","acc","key","step","mappedSteps","mapValues","initialStep","isNotNil","stepFromUrl","stepName","current","steps","goToNext","goToPrevious","goTo","index","at","get","goBackTo","isAfter","isBefore","isCurrent","isFirst","isLast","isNext","isPrevious","next","previous","stepNames","useStepper","provide","value","stepAsString","stepAsKey","stepKeys","wait"],"mappings":";;;;;;;AASO,MAAMA,IAAqB,OAAO,GAwCnCC,IACJ,mEAKIC,IAAqB,CAACC,MAAgB;;AACpC,QAAAC,IAAQD,EAAI,MAAMF,CAAc;AACtC,WAAOI,IAAAD,KAAA,gBAAAA,EAAO,W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,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,MAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"index8.js","sources":["../src/composables/useWizard.ts"],"sourcesContent":["import { computed, provide, reactive, watch, toValue } from \"vue\";\nimport { mapValues } from \"@/utilities/functions/mapValues\";\nimport { useStepper } from \"@vueuse/core\";\nimport { useRoute } from \"./useRoute\";\nimport { useRouter } from \"./useRouter\";\nimport type { ComputedRef, MaybeRef } from \"vue\";\nimport { isNotNil } from \"@/utilities/functions/isNotNil\";\n\nexport const wizardInjectionKey = Symbol();\nexport type Step<U> = {\n /**\n * Function that accepts a state object and returns a boolean.\n * When step are accessed at the end of the pipeline the result\n * is provided so you don't have to run the function yourself.\n * It determines if the validation has passed for the step.\n */\n isValid?: (state: U) => boolean;\n /**\n * Function that accepts a state object and returns a boolean.\n * When step are accessed at the end of the pipeline the result\n * is provided so you don't have to run the function yourself.\n * Steps that do not pass the condition are removed.\n */\n condition?: (state: U) => boolean;\n [key: string]: any;\n};\nexport type WizardState<T extends Record<string, any>> = Pick<\n ReturnType<typeof useWizard<T>>,\n | \"data\"\n | \"goToNext\"\n | \"goToPrevious\"\n | \"current\"\n | \"steps\"\n | \"at\"\n | \"get\"\n | \"goBackTo\"\n | \"isAfter\"\n | \"isBefore\"\n | \"isCurrent\"\n | \"isFirst\"\n | \"isLast\"\n | \"isNext\"\n | \"isPrevious\"\n | \"next\"\n | \"previous\"\n | \"stepNames\"\n>;\n\nconst regexMatchStep =\n /((step\\/)(?<step>[\\s\\S]+?)(?=[/?]))|((step\\/)(?<step2>[\\s\\S]+))/;\n/**\n * With a url that follows the rule xyz.com/anything/step/:nameofthestep[/?query]\n * will match the :nameofthestep substring\n */\nconst extractStepFromUrl = (url: string) => {\n const match = url.match(regexMatchStep);\n return match?.groups?.step ?? match?.groups?.step2 ?? null;\n};\nexport const useWizard = <T extends object>(params: {\n /**\n * The steps definition for the wizard\n */\n steps: MaybeRef<Record<string, Step<T>>>;\n /**\n * Name of the wizard used to persist state\n */\n name: string;\n /**\n * Initial set of data to be made available throughout\n */\n initialState: T;\n /**\n * When navogation is enabled, to whether use the query parameters or an entire substring of the URL like xyz/steps/....\n * The latter useful with nuxt so you can leverage the automatic import of components based on the URL.\n */\n navigationMode?: \"query\" | \"route\";\n /**\n * Whether to use navigation at all. When disabled no query or URL is changed.\n */\n useNavigation?: boolean;\n /**\n *\n */\n persist?: boolean;\n}) => {\n if (!params.name) {\n throw new Error(\n \"You need to provide a unique name for the current wizard instance to be used to save data\"\n );\n }\n const route = useRoute();\n const router = useRouter();\n\n const useNavigation = params.useNavigation ?? true;\n const navigationMode = params.navigationMode ?? \"query\";\n const persist = params.persist ?? true;\n\n if (useNavigation && (!route.value || !router)) {\n throw new Error(\n \"Navigation is enabled but could not retrieve the router instance in useWizard.\"\n );\n }\n\n /**\n * Initial state is either read from session storage or the one provided\n */\n const innerState = reactive<typeof params.initialState>(\n persist && sessionStorage.getItem(params.name)\n ? Object.assign(\n {},\n params.initialState,\n JSON.parse(sessionStorage.getItem(params.name)!)\n )\n : params.initialState\n );\n\n if (persist) {\n /**\n * Every time the state changes save it to sessionStorage\n */\n watch(innerState, () => {\n sessionStorage.setItem(params.name, JSON.stringify(innerState));\n });\n }\n\n /**\n * Steps can be passed as ref so we need to unwrap them\n */\n const unwrappedSteps = toValue(params.steps);\n const filteredSteps = computed(() =>\n Object.entries(unwrappedSteps).reduce(\n (acc: typeof unwrappedSteps, [key, step]) => {\n if (step.condition) {\n if (!step.condition(innerState as T)) {\n return acc;\n }\n }\n acc[key] = { ...step, key };\n return acc;\n },\n {}\n )\n );\n\n /**\n * Steps can have a isValid function that receives the current state\n * but we don't want to have to call it every single time so we call it once here\n */\n const mappedSteps = computed(() =>\n mapValues(filteredSteps.value, (step) => {\n return {\n ...step,\n isValid: step.isValid ? step.isValid(innerState as T) : true,\n };\n })\n );\n\n /**\n * Get the initial step from the query.\n * If it exists check that every step before it is also valid\n * so user cannot manually jump by changing the URL\n */\n let initialStep = null;\n if (useNavigation && isNotNil(route.value)) {\n let step: string | null = null;\n if (navigationMode === \"query\") {\n if (route.value.query.step) {\n step = route.value.query.step as string;\n }\n } else {\n const stepFromUrl = extractStepFromUrl(route.value.fullPath);\n if (stepFromUrl) {\n step = stepFromUrl;\n }\n }\n initialStep = step;\n }\n\n if (initialStep) {\n for (const stepName in filteredSteps.value) {\n if (stepName === initialStep) break;\n const current = mappedSteps.value[stepName];\n if (!current || !current.isValid) {\n initialStep = null;\n break;\n }\n }\n }\n\n /**\n * Define the state of the wizard\n * A few data come from useStepper\n */\n const {\n steps,\n current,\n goToNext,\n goToPrevious,\n goTo,\n index,\n at,\n get,\n goBackTo,\n isAfter,\n isBefore,\n isCurrent,\n isFirst,\n isLast,\n isNext,\n isPrevious,\n next,\n previous,\n stepNames,\n } = useStepper(\n mappedSteps as any,\n initialStep || Object.values(filteredSteps.value)[0].key\n );\n\n const key = computed(() => Object.keys(filteredSteps.value)[index.value]);\n\n /**\n * Complete state object\n */\n const state = {\n goToNext,\n goToPrevious,\n current: current as ComputedRef<Step<T> & { isValid: boolean }>,\n data: innerState,\n steps,\n at,\n get,\n goBackTo,\n isAfter,\n isBefore,\n isCurrent,\n isFirst,\n isLast,\n isNext,\n isPrevious,\n next,\n previous,\n stepNames,\n };\n\n provide(wizardInjectionKey, state);\n\n if (useNavigation) {\n if (navigationMode === \"query\") {\n /**\n * Every time the current step changes update route\n */\n watch(\n key,\n () => {\n if (isNotNil(router) && isNotNil(route.value)) {\n router.push({\n ...route,\n query: { ...route.value.query, step: key.value ?? null },\n });\n }\n },\n { immediate: true }\n );\n\n /**\n * Every time the route changes align the current step to the route\n */\n watch(\n () => route.value?.query.step,\n (value) => {\n if (value) {\n const stepAsString = value as string;\n if (stepAsString in filteredSteps.value) {\n const stepAsKey = stepAsString;\n const stepKeys = Object.keys(filteredSteps.value);\n const stepsPriorToTarget = stepKeys.slice(\n 0,\n stepKeys.indexOf(stepAsKey)\n );\n const allValid = stepsPriorToTarget.every(\n (key) => mappedSteps.value[key]?.isValid\n );\n if (allValid) {\n goTo(stepAsKey);\n }\n }\n } else {\n goTo(steps.value[0]);\n }\n }\n );\n } else {\n const stepFromUrl = computed(() => {\n if (isNotNil(route.value)) {\n return extractStepFromUrl(route.value.fullPath);\n }\n });\n\n /**\n * Every time the current step changes update route\n */\n watch(\n key,\n () => {\n if (isNotNil(route.value) && isNotNil(router)) {\n if (route.value.path.includes(\"step\")) {\n router.push({\n query: route.value.query,\n path: route.value.path.replace(\n regexMatchStep,\n `step/${key.value}`\n ),\n });\n } else {\n router.push({\n query: route.value.query,\n // Normalizes paths with / and without\n path: (route.value.path + `/step/${key.value}`).replace(\n \"//\",\n \"/\"\n ),\n replace: true,\n });\n }\n }\n },\n { immediate: true, flush: 'post' }\n );\n\n /**\n * Every time the route changes align the current step to the route\n */\n watch(\n () => stepFromUrl.value,\n (value) => {\n if (value) {\n const stepAsString = value as string;\n if (stepAsString in filteredSteps.value) {\n const stepAsKey = stepAsString;\n const stepKeys = Object.keys(filteredSteps.value);\n const stepsPriorToTarget = stepKeys.slice(\n 0,\n stepKeys.indexOf(stepAsKey)\n );\n const allValid = stepsPriorToTarget.every(\n (key) => filteredSteps.value[key]?.isValid\n );\n if (allValid) {\n goTo(stepAsKey);\n }\n }\n } else {\n goTo(steps.value[0]);\n }\n }\n );\n }\n }\n\n return {\n steps,\n current: current as ComputedRef<Step<T> & { isValid: boolean }>,\n goToNext,\n goToPrevious,\n goTo,\n key,\n data: innerState,\n at,\n get,\n goBackTo,\n isAfter,\n isBefore,\n isCurrent,\n isFirst,\n isLast,\n isNext,\n isPrevious,\n next,\n previous,\n stepNames,\n };\n};\n"],"names":["wizardInjectionKey","regexMatchStep","extractStepFromUrl","url","match","_a","_b","useWizard","params","route","useRoute","router","useRouter","useNavigation","navigationMode","persist","innerState","reactive","watch","unwrappedSteps","toValue","filteredSteps","computed","acc","key","step","mappedSteps","mapValues","initialStep","isNotNil","stepFromUrl","stepName","current","steps","goToNext","goToPrevious","goTo","index","at","get","goBackTo","isAfter","isBefore","isCurrent","isFirst","isLast","isNext","isPrevious","next","previous","stepNames","useStepper","provide","value","stepAsString","stepAsKey","stepKeys"],"mappings":";;;;;;AAQO,MAAMA,IAAqB,OAAO,GAwCnCC,IACJ,mEAKIC,IAAqB,CAACC,MAAgB;;AACpC,QAAAC,IAAQD,EAAI,MAAMF,CAAc;AACtC,WAAOI,IAAAD,KAAA,gBAAAA,EAAO,WAAP,gBAAAC,EAAe,WAAQC,IAAAF,KAAA,gBAAAA,EAAO,WAAP,gBAAAE,EAAe,UAAS;AACxD,GACaC,KAAY,CAAmBC,MA0BtC;AACA,MAAA,CAACA,EAAO;AACV,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAGJ,QAAMC,IAAQC,KACRC,IAASC,KAETC,IAAgBL,EAAO,iBAAiB,IACxCM,IAAiBN,EAAO,kBAAkB,SAC1CO,IAAUP,EAAO,WAAW;AAElC,MAAIK,MAAkB,CAACJ,EAAM,SAAS,CAACE;AACrC,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAOJ,QAAMK,IAAaC;AAAA,IACjBF,KAAW,eAAe,QAAQP,EAAO,IAAI,IACzC,OAAO;AAAA,MACL,CAAC;AAAA,MACDA,EAAO;AAAA,MACP,KAAK,MAAM,eAAe,QAAQA,EAAO,IAAI,CAAE;AAAA,QAEjDA,EAAO;AAAA,EAAA;AAGb,EAAIO,KAIFG,EAAMF,GAAY,MAAM;AACtB,mBAAe,QAAQR,EAAO,MAAM,KAAK,UAAUQ,CAAU,CAAC;AAAA,EAAA,CAC/D;AAMG,QAAAG,IAAiBC,EAAQZ,EAAO,KAAK,GACrCa,IAAgBC;AAAA,IAAS,MAC7B,OAAO,QAAQH,CAAc,EAAE;AAAA,MAC7B,CAACI,GA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AAAnB,EAA0B;AAAA;AAAA,cAAA,KAGnC+B,EAAKmB,CAAS;AAAA,YAElB;AAAA,UAAA;AAEK,YAAAnB,EAAAH,EAAM,MAAM,CAAC,CAAC;AAAA,QAEvB;AAAA,MAAA;AAAA,IAEJ;AAGK,SAAA;AAAA,IACL,OAAAA;AAAA,IACA,SAAAD;AAAA,IACA,UAAAE;AAAA,IACA,cAAAC;AAAA,IACA,MAAAC;AAAA,IACA,KAAAZ;AAAA,IACA,MAAMR;AAAA,IACN,IAAAsB;AAAA,IACA,KAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,MAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,EAAA;AAEJ;"}
package/dist/index81.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as a, computed as l, openBlock as s, createElementBlock as n, normalizeClass as m, createElementVNode as i, normalizeStyle as c } from "vue";
2
- import { clamp as p } from "./index200.js";
2
+ import { clamp as p } from "./index213.js";
3
3
  import { getAsPercentageBetween as d } from "./index121.js";
4
4
  const v = /* @__PURE__ */ a({
5
5
  __name: "BbProgress",