use-scroll-animate 5.8.0 → 5.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/bin/usa-codemod-6.mjs +146 -0
- package/dist/components/angular.d.cts +2 -1
- package/dist/components/angular.d.ts +2 -1
- package/dist/components/click.cjs +23 -4
- package/dist/components/click.cjs.map +1 -1
- package/dist/components/click.d.cts +12 -7
- package/dist/components/click.d.ts +12 -7
- package/dist/components/click.js +28 -9
- package/dist/components/click.js.map +1 -1
- package/dist/components/effects.cjs +306 -1
- package/dist/components/effects.cjs.map +1 -1
- package/dist/components/effects.d.cts +66 -2
- package/dist/components/effects.d.ts +66 -2
- package/dist/components/effects.js +303 -2
- package/dist/components/effects.js.map +1 -1
- package/dist/components/fx.cjs +2 -2
- package/dist/components/fx.cjs.map +1 -1
- package/dist/components/fx.js +2 -2
- package/dist/components/fx.js.map +1 -1
- package/dist/components/lite.cjs +35 -14
- package/dist/components/lite.cjs.map +1 -1
- package/dist/components/lite.js +35 -14
- package/dist/components/lite.js.map +1 -1
- package/dist/components/page.cjs +2 -0
- package/dist/components/page.cjs.map +1 -1
- package/dist/components/page.js +3 -1
- package/dist/components/page.js.map +1 -1
- package/dist/components/solid.d.cts +2 -1
- package/dist/components/solid.d.ts +2 -1
- package/dist/components/svelte.d.cts +2 -1
- package/dist/components/svelte.d.ts +2 -1
- package/dist/components/vue.d.cts +2 -1
- package/dist/components/vue.d.ts +2 -1
- package/dist/components.cjs +5 -5
- package/dist/components.d.cts +12 -7
- package/dist/components.d.ts +12 -7
- package/dist/components.js +2 -2
- package/dist/components.umd.js +2 -2
- package/dist/components.umd.js.map +1 -1
- package/docs/ROADMAP.md +1 -1
- package/docs/components.md +26 -0
- package/docs/deprecations.md +4 -0
- package/docs/upgrading-6.md +32 -0
- package/package.json +3 -2
package/dist/components/lite.js
CHANGED
|
@@ -5435,7 +5435,7 @@ const done = (a, el) => {
|
|
|
5435
5435
|
el.remove();
|
|
5436
5436
|
};
|
|
5437
5437
|
/** Particles radiating from client point (x, y). Returns the number spawned. */
|
|
5438
|
-
function burst(x, y, options = {}) {
|
|
5438
|
+
function burst$1(x, y, options = {}) {
|
|
5439
5439
|
if (typeof document === 'undefined' || prefersReducedMotion())
|
|
5440
5440
|
return 0;
|
|
5441
5441
|
const { count = 12, colors = PALETTE, distance = 48, size = 6, shape = 'circle', duration = 600 } = options;
|
|
@@ -5454,7 +5454,7 @@ function burst(x, y, options = {}) {
|
|
|
5454
5454
|
return count;
|
|
5455
5455
|
}
|
|
5456
5456
|
/** A confetti cannon (paper pieces with gravity, drift and spin). */
|
|
5457
|
-
function confetti(options = {}) {
|
|
5457
|
+
function confetti$1(options = {}) {
|
|
5458
5458
|
if (typeof document === 'undefined' || prefersReducedMotion())
|
|
5459
5459
|
return 0;
|
|
5460
5460
|
const W = window.innerWidth || 800;
|
|
@@ -5485,7 +5485,7 @@ function confetti(options = {}) {
|
|
|
5485
5485
|
return count;
|
|
5486
5486
|
}
|
|
5487
5487
|
/** Horizontal error shake (`intensity` px, default 8). Reduced motion: a red outline flash. */
|
|
5488
|
-
function shake(el, intensity = 8, duration = 480) {
|
|
5488
|
+
function shake$1(el, intensity = 8, duration = 480) {
|
|
5489
5489
|
const t = el;
|
|
5490
5490
|
if (typeof t.animate !== 'function')
|
|
5491
5491
|
return null;
|
|
@@ -5562,15 +5562,15 @@ function defineClick(tag = 'usa-click') {
|
|
|
5562
5562
|
const fx = this.effects;
|
|
5563
5563
|
const colors = this.str('color') ? this.str('color').split(',') : undefined;
|
|
5564
5564
|
if (fx.includes('burst'))
|
|
5565
|
-
burst(x, y, { count: this.num('count', 12), shape: this.str('shape', 'circle'), colors });
|
|
5565
|
+
burst$1(x, y, { count: this.num('count', 12), shape: this.str('shape', 'circle'), colors });
|
|
5566
5566
|
if (fx.includes('confetti'))
|
|
5567
|
-
confetti({ x, y, count: this.num('count', 60), colors, spread: 90, velocity: 0.8 });
|
|
5567
|
+
confetti$1({ x, y, count: this.num('count', 60), colors, spread: 90, velocity: 0.8 });
|
|
5568
5568
|
if (this.hasAttribute('haptic'))
|
|
5569
5569
|
haptic(this.num('haptic', 10));
|
|
5570
5570
|
this.emit('click-effect', { x, y, effects: fx });
|
|
5571
5571
|
}
|
|
5572
5572
|
shake() {
|
|
5573
|
-
shake(this);
|
|
5573
|
+
shake$1(this);
|
|
5574
5574
|
if (this.hasAttribute('haptic'))
|
|
5575
5575
|
haptic([30, 40, 30]);
|
|
5576
5576
|
}
|
|
@@ -5875,7 +5875,7 @@ function defineButton(tag = 'usa-button') {
|
|
|
5875
5875
|
t.removeAttribute('aria-busy');
|
|
5876
5876
|
}
|
|
5877
5877
|
if (s === 'error') {
|
|
5878
|
-
shake(t);
|
|
5878
|
+
shake$1(t);
|
|
5879
5879
|
if (this.hasAttribute('haptic'))
|
|
5880
5880
|
haptic([30, 40, 30]);
|
|
5881
5881
|
}
|
|
@@ -6081,7 +6081,7 @@ function defineLike(tag = 'usa-like') {
|
|
|
6081
6081
|
if (next && heart && !this.reduced) {
|
|
6082
6082
|
this.motion(heart, [{ transform: 'scale(0.4)' }, { transform: 'scale(1)' }], springEasing('bouncy'));
|
|
6083
6083
|
const r = heart.getBoundingClientRect();
|
|
6084
|
-
burst(r.left + r.width / 2, r.top + r.height / 2, { count: 10, distance: 28, size: 5, colors: [getComputedStyle(this).getPropertyValue('--usa-like-color').trim() || '#f43f5e', '#fb923c', '#facc15'] });
|
|
6084
|
+
burst$1(r.left + r.width / 2, r.top + r.height / 2, { count: 10, distance: 28, size: 5, colors: [getComputedStyle(this).getPropertyValue('--usa-like-color').trim() || '#f43f5e', '#fb923c', '#facc15'] });
|
|
6085
6085
|
}
|
|
6086
6086
|
if (this.hasAttribute('haptic'))
|
|
6087
6087
|
haptic(this.num('haptic', 12));
|
|
@@ -6258,7 +6258,7 @@ function defineDoubleTap(tag = 'usa-double-tap') {
|
|
|
6258
6258
|
a.onfinish = () => icon.remove();
|
|
6259
6259
|
else
|
|
6260
6260
|
icon.remove();
|
|
6261
|
-
burst(x, y, { count: 8, distance: 40, size: 5, colors: [this.str('color', '#f43f5e'), '#fb923c', '#facc15'] });
|
|
6261
|
+
burst$1(x, y, { count: 8, distance: 40, size: 5, colors: [this.str('color', '#f43f5e'), '#fb923c', '#facc15'] });
|
|
6262
6262
|
if (this.hasAttribute('haptic'))
|
|
6263
6263
|
haptic(15);
|
|
6264
6264
|
this.emit('double-tap', { x: x - r.left, y: y - r.top });
|
|
@@ -6347,8 +6347,27 @@ function defineCheckbox(tag = 'usa-checkbox') {
|
|
|
6347
6347
|
* `<usa-button>` (button click deformation: squash, wobble, gooey, dent;
|
|
6348
6348
|
* shape morph; submit → loading → success), `<usa-icon-morph>`,
|
|
6349
6349
|
* `<usa-like>`, `<usa-hold>`, `<usa-double-tap>`, `<usa-checkbox>`, plus
|
|
6350
|
-
* `burst()`, `confetti()`, `shake()`
|
|
6350
|
+
* `haptic()` (`burst()`, `confetti()`, `shake()` are deprecated in 5.9 —
|
|
6351
|
+
* use the registered effects through `playEffect()`).
|
|
6351
6352
|
*/
|
|
6353
|
+
/**
|
|
6354
|
+
* @deprecated 5.9 — removed in 6.0. Use the registered effect:
|
|
6355
|
+
* `playEffect(document.body, 'burst', { x, y, ...options })` (`use-scroll-animate/components/fx`).
|
|
6356
|
+
*/
|
|
6357
|
+
function burst(x, y, options = {}) {
|
|
6358
|
+
deprecate('burst()', "burst() is deprecated and removed in 6.0 — use playEffect(el, 'burst', { x, y, …options }) from use-scroll-animate/components/fx (npx usa-codemod-6).");
|
|
6359
|
+
return burst$1(x, y, options);
|
|
6360
|
+
}
|
|
6361
|
+
/** @deprecated 5.9 — removed in 6.0. Use `playEffect(document.body, 'confetti', options)`. */
|
|
6362
|
+
function confetti(options = {}) {
|
|
6363
|
+
deprecate('confetti()', "confetti() is deprecated and removed in 6.0 — use playEffect(el, 'confetti', options) from use-scroll-animate/components/fx (npx usa-codemod-6).");
|
|
6364
|
+
return confetti$1(options);
|
|
6365
|
+
}
|
|
6366
|
+
/** @deprecated 5.9 — removed in 6.0. Use `playEffect(el, 'shake', { intensity, duration })`. */
|
|
6367
|
+
function shake(el, intensity = 8, duration = 480) {
|
|
6368
|
+
deprecate('shake()', "shake() is deprecated and removed in 6.0 — use playEffect(el, 'shake', { intensity, duration }) from use-scroll-animate/components/fx (npx usa-codemod-6).");
|
|
6369
|
+
return shake$1(el, intensity, duration);
|
|
6370
|
+
}
|
|
6352
6371
|
/** Register every component of this category under its default tag. */
|
|
6353
6372
|
function defineClickComponents() {
|
|
6354
6373
|
defineClick();
|
|
@@ -7411,6 +7430,8 @@ function defineCursor(tag = 'usa-cursor') {
|
|
|
7411
7430
|
return;
|
|
7412
7431
|
}
|
|
7413
7432
|
const mode = this.str('mode', 'dot');
|
|
7433
|
+
if (mode === 'trail')
|
|
7434
|
+
deprecate('usa-cursor-trail', '<usa-cursor mode="trail"> is deprecated and removed in 6.0 — use the registered comet-trail effect: <usa-fx effect="comet-trail" trigger="load" self> around the page content (see docs/upgrading-6.md).');
|
|
7414
7435
|
const n = mode === 'trail' ? 8 : 1;
|
|
7415
7436
|
this.innerHTML = Array.from({ length: n }, (_, i) => `<span class="usa-cursor-${mode === 'glow' ? 'glow' : 'ring'}" style="--i:${i}"></span>`).join('') + (mode === 'glow' ? '' : '<span class="usa-cursor-dot"></span>');
|
|
7416
7437
|
if (this.str('color'))
|
|
@@ -10279,14 +10300,14 @@ const click = [
|
|
|
10279
10300
|
{
|
|
10280
10301
|
name: 'burst',
|
|
10281
10302
|
kind: 'click',
|
|
10282
|
-
description: 'Particle burst from the click point (or the element center).',
|
|
10303
|
+
description: 'Particle burst from the click point (or `x` / `y`, or the element center).',
|
|
10283
10304
|
defaults: { count: 12 },
|
|
10284
10305
|
run: (el, o, ctx) => {
|
|
10285
10306
|
if (ctx.reduced)
|
|
10286
10307
|
return;
|
|
10287
10308
|
const r = el.getBoundingClientRect();
|
|
10288
10309
|
const e = ctx.event;
|
|
10289
|
-
burst(e?.clientX ?? r.left + r.width / 2, e?.clientY ?? r.top + r.height / 2, o);
|
|
10310
|
+
burst$1(o.x ?? e?.clientX ?? r.left + r.width / 2, o.y ?? e?.clientY ?? r.top + r.height / 2, o);
|
|
10290
10311
|
},
|
|
10291
10312
|
},
|
|
10292
10313
|
{
|
|
@@ -10298,7 +10319,7 @@ const click = [
|
|
|
10298
10319
|
if (ctx.reduced)
|
|
10299
10320
|
return;
|
|
10300
10321
|
const r = el.getBoundingClientRect();
|
|
10301
|
-
confetti({ x: r.left + r.width / 2, y: r.top + r.height / 2, ...o });
|
|
10322
|
+
confetti$1({ x: r.left + r.width / 2, y: r.top + r.height / 2, ...o });
|
|
10302
10323
|
},
|
|
10303
10324
|
},
|
|
10304
10325
|
{
|
|
@@ -10306,7 +10327,7 @@ const click = [
|
|
|
10306
10327
|
kind: 'attention',
|
|
10307
10328
|
description: 'Horizontal "no" shake (errors, wrong password).',
|
|
10308
10329
|
defaults: { intensity: 8, duration: 480 },
|
|
10309
|
-
run: (el, o, ctx) => (ctx.reduced ? ctx.animate(el, [{ opacity: 1 }, { opacity: 0.5 }, { opacity: 1 }], { duration: 300 }) : shake(el, o.intensity, o.duration)),
|
|
10330
|
+
run: (el, o, ctx) => (ctx.reduced ? ctx.animate(el, [{ opacity: 1 }, { opacity: 0.5 }, { opacity: 1 }], { duration: 300 }) : shake$1(el, o.intensity, o.duration)),
|
|
10310
10331
|
},
|
|
10311
10332
|
{
|
|
10312
10333
|
name: 'ripple',
|