bitboss-ui 0.2.9 → 0.2.10
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/index101.js +3 -3
- package/dist/index103.js +2 -2
- package/dist/index109.js +1 -1
- package/dist/index11.js +2 -2
- package/dist/index111.js +5 -5
- package/dist/index113.js +1 -1
- package/dist/index116.js +1 -1
- package/dist/index117.js +1 -1
- package/dist/index118.js +1 -1
- package/dist/index119.js +1 -1
- package/dist/index121.js +1 -1
- package/dist/index125.js +1 -1
- package/dist/index126.js +1 -1
- package/dist/index128.js +2 -2
- package/dist/index15.js +8 -8
- package/dist/index17.js +9 -9
- package/dist/index19.js +3 -3
- package/dist/index195.js +351 -2
- package/dist/index195.js.map +1 -1
- package/dist/index196.js +134 -4
- package/dist/index196.js.map +1 -1
- package/dist/index197.js +5 -2
- package/dist/index197.js.map +1 -1
- package/dist/index198.js +19 -5
- package/dist/index198.js.map +1 -1
- package/dist/index199.js +2 -16
- package/dist/index199.js.map +1 -1
- package/dist/index200.js +2 -16
- package/dist/index200.js.map +1 -1
- package/dist/index201.js +184 -17
- package/dist/index201.js.map +1 -1
- package/dist/index202.js +23 -20
- package/dist/index202.js.map +1 -1
- package/dist/index203.js +367 -27
- package/dist/index203.js.map +1 -1
- package/dist/index204.js +3 -8
- package/dist/index204.js.map +1 -1
- package/dist/index205.js +3 -2
- package/dist/index205.js.map +1 -1
- package/dist/index206.js +14 -349
- package/dist/index206.js.map +1 -1
- package/dist/index207.js +16 -2
- package/dist/index207.js.map +1 -1
- package/dist/index208.js +20 -6
- package/dist/index208.js.map +1 -1
- package/dist/index209.js +27 -367
- package/dist/index209.js.map +1 -1
- package/dist/index21.js +2 -2
- package/dist/index210.js +8 -3
- package/dist/index210.js.map +1 -1
- package/dist/index211.js +3 -35
- package/dist/index211.js.map +1 -1
- package/dist/index212.js +34 -9
- package/dist/index212.js.map +1 -1
- package/dist/index213.js +6 -134
- package/dist/index213.js.map +1 -1
- package/dist/index214.js +2 -2
- package/dist/index214.js.map +1 -1
- package/dist/index215.js +4 -186
- package/dist/index215.js.map +1 -1
- package/dist/index216.js +235 -23
- package/dist/index216.js.map +1 -1
- package/dist/index217.js +10 -2
- package/dist/index217.js.map +1 -1
- package/dist/index218.js +2 -235
- package/dist/index218.js.map +1 -1
- package/dist/index219.js +2 -3
- package/dist/index219.js.map +1 -1
- package/dist/index220.js +2 -3
- package/dist/index220.js.map +1 -1
- package/dist/index221.js +27 -8
- package/dist/index221.js.map +1 -1
- package/dist/index222.js +12 -115
- package/dist/index222.js.map +1 -1
- package/dist/index223.js +8 -27
- package/dist/index223.js.map +1 -1
- package/dist/index224.js +115 -12
- package/dist/index224.js.map +1 -1
- package/dist/index225.js +1 -1
- package/dist/index226.js +6 -4
- package/dist/index226.js.map +1 -1
- package/dist/index227.js +2 -295
- package/dist/index227.js.map +1 -1
- package/dist/index228.js +294 -5
- package/dist/index228.js.map +1 -1
- package/dist/index23.js +1 -1
- package/dist/index231.js +117 -2
- package/dist/index231.js.map +1 -1
- package/dist/index232.js +106 -2
- package/dist/index232.js.map +1 -1
- package/dist/index233.js +224 -2
- package/dist/index233.js.map +1 -1
- package/dist/index234.js +258 -2
- package/dist/index234.js.map +1 -1
- package/dist/index235.js +2 -117
- package/dist/index235.js.map +1 -1
- package/dist/index236.js +2 -106
- package/dist/index236.js.map +1 -1
- package/dist/index237.js +2 -69
- package/dist/index237.js.map +1 -1
- package/dist/index238.js +2 -2
- package/dist/index238.js.map +1 -1
- package/dist/index239.js +2 -2
- package/dist/index239.js.map +1 -1
- package/dist/index240.js +4 -162
- package/dist/index240.js.map +1 -1
- package/dist/index241.js +435 -2
- package/dist/index241.js.map +1 -1
- package/dist/index242.js +82 -428
- package/dist/index242.js.map +1 -1
- package/dist/index243.js +161 -88
- package/dist/index243.js.map +1 -1
- package/dist/index244.js +2 -200
- package/dist/index244.js.map +1 -1
- package/dist/index245.js +69 -2
- package/dist/index245.js.map +1 -1
- package/dist/index246.js +2 -224
- package/dist/index246.js.map +1 -1
- package/dist/index247.js +200 -258
- package/dist/index247.js.map +1 -1
- package/dist/index248.js +2 -38
- package/dist/index248.js.map +1 -1
- package/dist/index249.js +38 -2
- package/dist/index249.js.map +1 -1
- package/dist/index25.js +2 -2
- package/dist/index250.js +2 -2
- package/dist/index250.js.map +1 -1
- package/dist/index251.js +2 -2
- package/dist/index251.js.map +1 -1
- package/dist/index252.js +3 -2
- package/dist/index252.js.map +1 -1
- package/dist/index253.js +2 -3
- package/dist/index253.js.map +1 -1
- package/dist/index29.js +3 -3
- package/dist/index31.js +6 -6
- package/dist/index33.js +2 -2
- package/dist/index35.js +2 -2
- package/dist/index47.js +1 -1
- package/dist/index49.js +1 -1
- package/dist/index65.js +5 -5
- package/dist/index69.js +2 -2
- package/dist/index72.js +1 -1
- package/dist/index75.js +1 -1
- package/dist/index79.js +4 -4
- package/dist/index8.js +56 -56
- package/dist/index8.js.map +1 -1
- package/dist/index81.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index8.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { reactive as L, watch as f, toValue as Y, computed as
|
|
1
|
+
import { reactive as L, watch as f, toValue as Y, computed as y, provide as D } from "vue";
|
|
2
2
|
import { mapValues as G } from "./index127.js";
|
|
3
3
|
import { useStepper as H } from "./index128.js";
|
|
4
4
|
import { useRoute as Q } from "./index129.js";
|
|
5
5
|
import { useRouter as X } from "./index130.js";
|
|
6
|
-
import { isNotNil as
|
|
6
|
+
import { isNotNil as l } from "./index124.js";
|
|
7
7
|
const Z = Symbol(), R = /((step\/)(?<step>[\s\S]+?)(?=[/?]))|((step\/)(?<step2>[\s\S]+))/, J = (i) => {
|
|
8
8
|
var r, u;
|
|
9
9
|
const e = i.match(R);
|
|
10
10
|
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;
|
|
11
|
-
},
|
|
11
|
+
}, ne = (i) => {
|
|
12
12
|
if (!i.name)
|
|
13
13
|
throw new Error(
|
|
14
14
|
"You need to provide a unique name for the current wizard instance to be used to save data"
|
|
@@ -18,29 +18,29 @@ const Z = Symbol(), R = /((step\/)(?<step>[\s\S]+?)(?=[/?]))|((step\/)(?<step2>[
|
|
|
18
18
|
throw new Error(
|
|
19
19
|
"Navigation is enabled but could not retrieve the router instance in useWizard."
|
|
20
20
|
);
|
|
21
|
-
const
|
|
21
|
+
const a = L(
|
|
22
22
|
b && sessionStorage.getItem(i.name) ? Object.assign(
|
|
23
23
|
{},
|
|
24
24
|
i.initialState,
|
|
25
25
|
JSON.parse(sessionStorage.getItem(i.name))
|
|
26
26
|
) : i.initialState
|
|
27
27
|
);
|
|
28
|
-
b && f(
|
|
29
|
-
sessionStorage.setItem(i.name, JSON.stringify(
|
|
28
|
+
b && f(a, () => {
|
|
29
|
+
sessionStorage.setItem(i.name, JSON.stringify(a));
|
|
30
30
|
});
|
|
31
|
-
const W = Y(i.steps), o =
|
|
31
|
+
const W = Y(i.steps), o = y(
|
|
32
32
|
() => Object.entries(W).reduce(
|
|
33
|
-
(t, [s,
|
|
33
|
+
(t, [s, n]) => (n.condition && !n.condition(a) || (t[s] = { ...n, key: s }), t),
|
|
34
34
|
{}
|
|
35
35
|
)
|
|
36
|
-
), m =
|
|
36
|
+
), m = y(
|
|
37
37
|
() => G(o.value, (t) => ({
|
|
38
38
|
...t,
|
|
39
|
-
isValid: t.isValid ? t.isValid(
|
|
39
|
+
isValid: t.isValid ? t.isValid(a) : !0
|
|
40
40
|
}))
|
|
41
41
|
);
|
|
42
|
-
let
|
|
43
|
-
if (u &&
|
|
42
|
+
let p = null;
|
|
43
|
+
if (u && l(e.value)) {
|
|
44
44
|
let t = null;
|
|
45
45
|
if (q === "query")
|
|
46
46
|
e.value.query.step && (t = e.value.query.step);
|
|
@@ -48,15 +48,15 @@ const Z = Symbol(), R = /((step\/)(?<step>[\s\S]+?)(?=[/?]))|((step\/)(?<step2>[
|
|
|
48
48
|
const s = J(e.value.fullPath);
|
|
49
49
|
s && (t = s);
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
p = t;
|
|
52
52
|
}
|
|
53
|
-
if (
|
|
53
|
+
if (p)
|
|
54
54
|
for (const t in o.value) {
|
|
55
|
-
if (t ===
|
|
55
|
+
if (t === p)
|
|
56
56
|
break;
|
|
57
57
|
const s = m.value[t];
|
|
58
58
|
if (!s || !s.isValid) {
|
|
59
|
-
|
|
59
|
+
p = null;
|
|
60
60
|
break;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -67,10 +67,10 @@ const Z = Symbol(), R = /((step\/)(?<step>[\s\S]+?)(?=[/?]))|((step\/)(?<step2>[
|
|
|
67
67
|
goToPrevious: N,
|
|
68
68
|
goTo: d,
|
|
69
69
|
index: $,
|
|
70
|
-
at:
|
|
71
|
-
get:
|
|
72
|
-
goBackTo:
|
|
73
|
-
isAfter:
|
|
70
|
+
at: O,
|
|
71
|
+
get: x,
|
|
72
|
+
goBackTo: k,
|
|
73
|
+
isAfter: w,
|
|
74
74
|
isBefore: P,
|
|
75
75
|
isCurrent: j,
|
|
76
76
|
isFirst: A,
|
|
@@ -82,18 +82,18 @@ const Z = Symbol(), R = /((step\/)(?<step>[\s\S]+?)(?=[/?]))|((step\/)(?<step2>[
|
|
|
82
82
|
stepNames: U
|
|
83
83
|
} = H(
|
|
84
84
|
m,
|
|
85
|
-
|
|
86
|
-
),
|
|
85
|
+
p || Object.values(o.value)[0].key
|
|
86
|
+
), c = y(() => Object.keys(o.value)[$.value]);
|
|
87
87
|
if (D(Z, {
|
|
88
88
|
goToNext: V,
|
|
89
89
|
goToPrevious: N,
|
|
90
90
|
current: T,
|
|
91
|
-
data:
|
|
91
|
+
data: a,
|
|
92
92
|
steps: S,
|
|
93
|
-
at:
|
|
94
|
-
get:
|
|
95
|
-
goBackTo:
|
|
96
|
-
isAfter:
|
|
93
|
+
at: O,
|
|
94
|
+
get: x,
|
|
95
|
+
goBackTo: k,
|
|
96
|
+
isAfter: w,
|
|
97
97
|
isBefore: P,
|
|
98
98
|
isCurrent: j,
|
|
99
99
|
isFirst: A,
|
|
@@ -106,11 +106,11 @@ const Z = Symbol(), R = /((step\/)(?<step>[\s\S]+?)(?=[/?]))|((step\/)(?<step2>[
|
|
|
106
106
|
}), u)
|
|
107
107
|
if (q === "query")
|
|
108
108
|
f(
|
|
109
|
-
|
|
109
|
+
c,
|
|
110
110
|
() => {
|
|
111
|
-
|
|
111
|
+
l(r) && l(e.value) && r.push({
|
|
112
112
|
...e,
|
|
113
|
-
query: { ...e.value.query, step:
|
|
113
|
+
query: { ...e.value.query, step: c.value ?? null }
|
|
114
114
|
});
|
|
115
115
|
},
|
|
116
116
|
{ immediate: !0 }
|
|
@@ -123,39 +123,39 @@ const Z = Symbol(), R = /((step\/)(?<step>[\s\S]+?)(?=[/?]))|((step\/)(?<step2>[
|
|
|
123
123
|
if (t) {
|
|
124
124
|
const s = t;
|
|
125
125
|
if (s in o.value) {
|
|
126
|
-
const
|
|
126
|
+
const n = s, v = Object.keys(o.value);
|
|
127
127
|
v.slice(
|
|
128
128
|
0,
|
|
129
|
-
v.indexOf(
|
|
129
|
+
v.indexOf(n)
|
|
130
130
|
).every(
|
|
131
131
|
(B) => {
|
|
132
|
-
var
|
|
133
|
-
return (
|
|
132
|
+
var g;
|
|
133
|
+
return (g = m.value[B]) == null ? void 0 : g.isValid;
|
|
134
134
|
}
|
|
135
|
-
) && d(
|
|
135
|
+
) && d(n);
|
|
136
136
|
}
|
|
137
137
|
} else
|
|
138
138
|
d(S.value[0]);
|
|
139
139
|
}
|
|
140
140
|
);
|
|
141
141
|
else {
|
|
142
|
-
const t =
|
|
143
|
-
if (
|
|
142
|
+
const t = y(() => {
|
|
143
|
+
if (l(e.value))
|
|
144
144
|
return J(e.value.fullPath);
|
|
145
145
|
});
|
|
146
146
|
f(
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
147
|
+
c,
|
|
148
|
+
(s) => {
|
|
149
|
+
l(e.value) && l(r) && (e.value.path.includes("step") ? r.push({
|
|
150
150
|
query: e.value.query,
|
|
151
151
|
path: e.value.path.replace(
|
|
152
152
|
R,
|
|
153
|
-
`step/${
|
|
153
|
+
`step/${s}`
|
|
154
154
|
)
|
|
155
|
-
}) :
|
|
155
|
+
}) : r.push({
|
|
156
156
|
query: e.value.query,
|
|
157
157
|
// Normalizes paths with / and without
|
|
158
|
-
path: (e.value.path + `/step/${
|
|
158
|
+
path: (e.value.path + `/step/${s}`).replace(
|
|
159
159
|
"//",
|
|
160
160
|
"/"
|
|
161
161
|
),
|
|
@@ -166,17 +166,17 @@ const Z = Symbol(), R = /((step\/)(?<step>[\s\S]+?)(?=[/?]))|((step\/)(?<step2>[
|
|
|
166
166
|
), f(
|
|
167
167
|
() => t.value,
|
|
168
168
|
(s) => {
|
|
169
|
-
if (s) {
|
|
170
|
-
const
|
|
171
|
-
if (
|
|
172
|
-
const v =
|
|
169
|
+
if (s && s !== c.value) {
|
|
170
|
+
const n = s;
|
|
171
|
+
if (n in o.value) {
|
|
172
|
+
const v = n, h = Object.keys(o.value);
|
|
173
173
|
h.slice(
|
|
174
174
|
0,
|
|
175
175
|
h.indexOf(v)
|
|
176
176
|
).every(
|
|
177
|
-
(
|
|
177
|
+
(g) => {
|
|
178
178
|
var E;
|
|
179
|
-
return (E = o.value[
|
|
179
|
+
return (E = o.value[g]) == null ? void 0 : E.isValid;
|
|
180
180
|
}
|
|
181
181
|
) && d(v);
|
|
182
182
|
}
|
|
@@ -190,12 +190,12 @@ const Z = Symbol(), R = /((step\/)(?<step>[\s\S]+?)(?=[/?]))|((step\/)(?<step2>[
|
|
|
190
190
|
goToNext: V,
|
|
191
191
|
goToPrevious: N,
|
|
192
192
|
goTo: d,
|
|
193
|
-
key:
|
|
194
|
-
data:
|
|
195
|
-
at:
|
|
196
|
-
get:
|
|
197
|
-
goBackTo:
|
|
198
|
-
isAfter:
|
|
193
|
+
key: c,
|
|
194
|
+
data: a,
|
|
195
|
+
at: O,
|
|
196
|
+
get: x,
|
|
197
|
+
goBackTo: k,
|
|
198
|
+
isAfter: w,
|
|
199
199
|
isBefore: P,
|
|
200
200
|
isCurrent: j,
|
|
201
201
|
isFirst: A,
|
|
@@ -208,7 +208,7 @@ const Z = Symbol(), R = /((step\/)(?<step>[\s\S]+?)(?=[/?]))|((step\/)(?<step2>[
|
|
|
208
208
|
};
|
|
209
209
|
};
|
|
210
210
|
export {
|
|
211
|
-
|
|
211
|
+
ne as useWizard,
|
|
212
212
|
Z as wizardInjectionKey
|
|
213
213
|
};
|
|
214
214
|
//# sourceMappingURL=index8.js.map
|
package/dist/index8.js.map
CHANGED
|
@@ -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\";\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 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 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 }\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;AA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AAMC,IAAeD;AACjB,gBAAAC,KAAgBjC,EAAc,OAAO;AACvC,oBAAMkC,IAAYD,GACZE,IAAW,OAAO,KAAKnC,EAAc,KAAK;AAQhD,cAP2BmC,EAAS;AAAA,gBAClC;AAAA,gBACAA,EAAS,QAAQD,CAAS;AAAA,cAAA,EAEQ;AAAA,gBAClC,CAAC/B,MAAAA;;AAAQ,0BAAAnB,IAAAgB,EAAc,MAAMG,CAAG,MAAvB,gBAAAnB,EAA0B;AAAA;AAAA,cAAA,KAGnC+B,EAAKmB,CAAS;AAAA,YAElB;AAAA,UACF;AAAA,QACF;AAAA,MAAA;AAAA,IAEJ;AAGK,SAAA;AAAA,IACL,OAAAtB;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;"}
|
|
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 (value) => {\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/${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/${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 && value !== key.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 }\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,I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Block as n, normalizeClass as m, createElementVNode as i, normalizeStyle as c } from "vue";
|
|
2
|
-
import { clamp as p } from "./
|
|
2
|
+
import { clamp as p } from "./index218.js";
|
|
3
3
|
import { getAsPercentageBetween as d } from "./index121.js";
|
|
4
4
|
const v = /* @__PURE__ */ a({
|
|
5
5
|
__name: "BbProgress",
|