nuxt-unified-ui 0.5.6 → 0.5.7
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.
|
@@ -1,90 +1,121 @@
|
|
|
1
1
|
import confetti from 'canvas-confetti';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
type IMakeConfettiArgs = {
|
|
5
|
+
template?: 'parade' | 'on-top' | 'on-left' | 'on-right' | 'on-bottom' | 'on-frame' | 'split-on-top' | 'on-curtain';
|
|
6
|
+
duration?: number;
|
|
7
|
+
amount?: number;
|
|
8
|
+
} & confetti.Options;
|
|
5
9
|
|
|
6
|
-
|
|
7
|
-
|
|
10
|
+
type IConfettiBump = {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
angle: number;
|
|
14
|
+
};
|
|
8
15
|
|
|
9
16
|
|
|
17
|
+
const bumpsPerFullEdge = 24;
|
|
18
|
+
const bumpsPerHalfEdge = bumpsPerFullEdge / 2;
|
|
19
|
+
const bumpsPerFullFrame = (bumpsPerHalfEdge * 2) + bumpsPerFullEdge;
|
|
20
|
+
const sequenceAmount = 6;
|
|
21
|
+
const sequenceDelay = 70;
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
function makeWaveBumps(options: { includeTop?: boolean; includeSides?: boolean; includeBottom?: boolean; }) {
|
|
10
25
|
return {
|
|
11
26
|
left: [
|
|
12
|
-
...
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
27
|
+
...(options.includeTop
|
|
28
|
+
? makeSectionBumps({
|
|
29
|
+
from: {
|
|
30
|
+
x: 0.5,
|
|
31
|
+
y: 0,
|
|
32
|
+
},
|
|
33
|
+
to: {
|
|
34
|
+
x: 0,
|
|
35
|
+
y: 0,
|
|
36
|
+
},
|
|
37
|
+
angle: 270,
|
|
38
|
+
count: bumpsPerHalfEdge,
|
|
39
|
+
includeEnd: !options.includeSides && !options.includeBottom,
|
|
40
|
+
})
|
|
41
|
+
: []),
|
|
42
|
+
...(options.includeSides
|
|
43
|
+
? makeSectionBumps({
|
|
44
|
+
from: {
|
|
45
|
+
x: 0,
|
|
46
|
+
y: 0,
|
|
47
|
+
},
|
|
48
|
+
to: {
|
|
49
|
+
x: 0,
|
|
50
|
+
y: 1,
|
|
51
|
+
},
|
|
52
|
+
angle: 0,
|
|
53
|
+
count: bumpsPerFullEdge,
|
|
54
|
+
includeEnd: !options.includeBottom,
|
|
55
|
+
})
|
|
56
|
+
: []),
|
|
57
|
+
...(options.includeBottom
|
|
58
|
+
? makeSectionBumps({
|
|
59
|
+
from: {
|
|
60
|
+
x: 0,
|
|
61
|
+
y: 1,
|
|
62
|
+
},
|
|
63
|
+
to: {
|
|
64
|
+
x: 0.5,
|
|
65
|
+
y: 1,
|
|
66
|
+
},
|
|
67
|
+
angle: 90,
|
|
68
|
+
count: bumpsPerHalfEdge,
|
|
69
|
+
includeEnd: true,
|
|
70
|
+
})
|
|
71
|
+
: []),
|
|
49
72
|
],
|
|
50
73
|
right: [
|
|
51
|
-
...
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
74
|
+
...(options.includeTop
|
|
75
|
+
? makeSectionBumps({
|
|
76
|
+
from: {
|
|
77
|
+
x: 0.5,
|
|
78
|
+
y: 0,
|
|
79
|
+
},
|
|
80
|
+
to: {
|
|
81
|
+
x: 1,
|
|
82
|
+
y: 0,
|
|
83
|
+
},
|
|
84
|
+
angle: 270,
|
|
85
|
+
count: bumpsPerHalfEdge,
|
|
86
|
+
includeEnd: !options.includeSides && !options.includeBottom,
|
|
87
|
+
})
|
|
88
|
+
: []),
|
|
89
|
+
...(options.includeSides
|
|
90
|
+
? makeSectionBumps({
|
|
91
|
+
from: {
|
|
92
|
+
x: 1,
|
|
93
|
+
y: 0,
|
|
94
|
+
},
|
|
95
|
+
to: {
|
|
96
|
+
x: 1,
|
|
97
|
+
y: 1,
|
|
98
|
+
},
|
|
99
|
+
angle: 180,
|
|
100
|
+
count: bumpsPerFullEdge,
|
|
101
|
+
includeEnd: !options.includeBottom,
|
|
102
|
+
})
|
|
103
|
+
: []),
|
|
104
|
+
...(options.includeBottom
|
|
105
|
+
? makeSectionBumps({
|
|
106
|
+
from: {
|
|
107
|
+
x: 1,
|
|
108
|
+
y: 1,
|
|
109
|
+
},
|
|
110
|
+
to: {
|
|
111
|
+
x: 0.5,
|
|
112
|
+
y: 1,
|
|
113
|
+
},
|
|
114
|
+
angle: 90,
|
|
115
|
+
count: bumpsPerHalfEdge,
|
|
116
|
+
includeEnd: true,
|
|
117
|
+
})
|
|
118
|
+
: []),
|
|
88
119
|
],
|
|
89
120
|
};
|
|
90
121
|
|
|
@@ -106,22 +137,23 @@ function makeSectionBumps(options: { from: { x: number, y: number; }; to: { x: n
|
|
|
106
137
|
});
|
|
107
138
|
}
|
|
108
139
|
|
|
140
|
+
function makeSequence(args: IMakeConfettiArgs, options: confetti.Options) {
|
|
109
141
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (import.meta.server) {
|
|
113
|
-
return Promise.resolve();
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
142
|
+
const duration = args.duration ?? 1000;
|
|
143
|
+
const amount = args.amount ?? sequenceAmount;
|
|
117
144
|
const end = Date.now() + duration;
|
|
118
145
|
|
|
119
146
|
(function frame() {
|
|
120
147
|
|
|
121
|
-
confetti(
|
|
148
|
+
confetti({
|
|
149
|
+
startVelocity: 22,
|
|
150
|
+
scalar: 0.7,
|
|
151
|
+
...options,
|
|
152
|
+
particleCount: amount,
|
|
153
|
+
});
|
|
122
154
|
|
|
123
155
|
if (Date.now() < end) {
|
|
124
|
-
|
|
156
|
+
setTimeout(frame, sequenceDelay);
|
|
125
157
|
}
|
|
126
158
|
|
|
127
159
|
}());
|
|
@@ -131,35 +163,35 @@ export function makeConfettiParade(duration = 1000, config: confetti.Options) {
|
|
|
131
163
|
|
|
132
164
|
}
|
|
133
165
|
|
|
134
|
-
|
|
135
|
-
return
|
|
136
|
-
|
|
137
|
-
|
|
166
|
+
function makeParade(args: IMakeConfettiArgs) {
|
|
167
|
+
return makeSequence(args, args);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function makeOnDirection(args: IMakeConfettiArgs, direction: { angle: number; x: number; y: number; }) {
|
|
171
|
+
return makeSequence(args, {
|
|
172
|
+
angle: direction.angle,
|
|
138
173
|
origin: {
|
|
139
|
-
x:
|
|
140
|
-
y:
|
|
174
|
+
x: direction.x,
|
|
175
|
+
y: direction.y,
|
|
141
176
|
},
|
|
142
177
|
});
|
|
143
178
|
}
|
|
144
179
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if (import.meta.server) {
|
|
148
|
-
return Promise.resolve();
|
|
149
|
-
}
|
|
150
|
-
|
|
180
|
+
function makeWave(args: IMakeConfettiArgs, bumps: { left: IConfettiBump[]; right: IConfettiBump[]; }) {
|
|
151
181
|
|
|
152
|
-
const
|
|
153
|
-
const
|
|
182
|
+
const duration = args.duration ?? 2000;
|
|
183
|
+
const amount = args.amount ?? 24;
|
|
184
|
+
const delay = duration / bumpsPerFullFrame;
|
|
185
|
+
const elapsed = delay * bumps.left.length;
|
|
154
186
|
|
|
155
187
|
|
|
156
|
-
for (const [index, leftBump] of left.entries()) {
|
|
188
|
+
for (const [index, leftBump] of bumps.left.entries()) {
|
|
157
189
|
|
|
158
190
|
setTimeout(() => {
|
|
159
191
|
|
|
160
|
-
for (const bump of [leftBump, right[index]!]) {
|
|
192
|
+
for (const bump of [leftBump, bumps.right[index]!]) {
|
|
161
193
|
confetti({
|
|
162
|
-
particleCount:
|
|
194
|
+
particleCount: amount,
|
|
163
195
|
angle: bump.angle,
|
|
164
196
|
spread: 50,
|
|
165
197
|
startVelocity: 22,
|
|
@@ -177,6 +209,69 @@ export function makeConfettiOnEdges(duration = 2000) {
|
|
|
177
209
|
}
|
|
178
210
|
|
|
179
211
|
|
|
180
|
-
return new Promise(resolve => setTimeout(resolve,
|
|
212
|
+
return new Promise(resolve => setTimeout(resolve, elapsed));
|
|
213
|
+
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
export function makeConfetti(args: IMakeConfettiArgs) {
|
|
218
|
+
|
|
219
|
+
if (import.meta.server) {
|
|
220
|
+
return Promise.resolve();
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
if (args.template === 'parade') {
|
|
225
|
+
return makeParade(args);
|
|
226
|
+
}
|
|
227
|
+
else if (args.template === 'on-top') {
|
|
228
|
+
return makeOnDirection(args, {
|
|
229
|
+
angle: 270,
|
|
230
|
+
x: 0.5,
|
|
231
|
+
y: 0,
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
else if (args.template === 'on-left') {
|
|
235
|
+
return makeOnDirection(args, {
|
|
236
|
+
angle: 0,
|
|
237
|
+
x: 0,
|
|
238
|
+
y: 0.5,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
else if (args.template === 'on-right') {
|
|
242
|
+
return makeOnDirection(args, {
|
|
243
|
+
angle: 180,
|
|
244
|
+
x: 1,
|
|
245
|
+
y: 0.5,
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
else if (args.template === 'on-bottom') {
|
|
249
|
+
return makeOnDirection(args, {
|
|
250
|
+
angle: 90,
|
|
251
|
+
x: 0.5,
|
|
252
|
+
y: 1,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
else if (args.template === 'on-frame') {
|
|
256
|
+
return makeWave(args, makeWaveBumps({
|
|
257
|
+
includeTop: true,
|
|
258
|
+
includeSides: true,
|
|
259
|
+
includeBottom: true,
|
|
260
|
+
}));
|
|
261
|
+
}
|
|
262
|
+
else if (args.template === 'split-on-top') {
|
|
263
|
+
return makeWave(args, makeWaveBumps({
|
|
264
|
+
includeTop: true,
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
else if (args.template === 'on-curtain') {
|
|
268
|
+
return makeWave(args, makeWaveBumps({
|
|
269
|
+
includeTop: true,
|
|
270
|
+
includeSides: true,
|
|
271
|
+
}));
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
return confetti(args);
|
|
275
|
+
}
|
|
181
276
|
|
|
182
277
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-unified-ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.7",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"types": "./index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@formkit/tempo": "1.1.0",
|
|
23
|
-
"@iconify-json/lucide": "1.2.
|
|
23
|
+
"@iconify-json/lucide": "1.2.126",
|
|
24
24
|
"@nuxt/kit": "4.5.2",
|
|
25
25
|
"@nuxt/ui": "4.11.0",
|
|
26
26
|
"@nuxtjs/i18n": "10.6.0",
|
|
@@ -55,7 +55,7 @@ Plugin: `plugins/use-toaster.ts` → `provide.toaster = useToast()`.
|
|
|
55
55
|
| `formatDate` / `parseDate` | `utils/format-date.ts` | `@formkit/tempo` helpers |
|
|
56
56
|
| `isSlotFilled` | `utils/is-slot-filled.ts` | Slot emptiness check |
|
|
57
57
|
| `pathRelativeToBase` | `utils/path-relative.ts` | Also exported from package entry |
|
|
58
|
-
| `
|
|
58
|
+
| `makeConfetti` | `utils/make-confetti.ts` | `canvas-confetti` helper; `template` runs a built-in effect (`parade`, `on-top` / `on-left` / `on-right` / `on-bottom`, `on-frame`, `split-on-top`, `on-curtain`), `amount` overrides particles per burst, otherwise args go to `confetti()` |
|
|
59
59
|
|
|
60
60
|
## Built-in form element identifiers
|
|
61
61
|
|