use-scroll-animate 2.3.0 → 2.4.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 +11 -0
- package/README.md +1 -0
- package/README_ja.md +1 -0
- package/README_zh.md +1 -0
- package/dist/chunks/spring-BKUU7-Xm.js +219 -0
- package/dist/chunks/spring-BKUU7-Xm.js.map +1 -0
- package/dist/chunks/spring-CGO9Jd9b.cjs +232 -0
- package/dist/chunks/spring-CGO9Jd9b.cjs.map +1 -0
- package/dist/components/cards.cjs +563 -0
- package/dist/components/cards.cjs.map +1 -0
- package/dist/components/cards.css +6 -0
- package/dist/components/cards.d.cts +142 -0
- package/dist/components/cards.d.ts +142 -0
- package/dist/components/cards.js +555 -0
- package/dist/components/cards.js.map +1 -0
- package/dist/components/physics.cjs +24 -238
- package/dist/components/physics.cjs.map +1 -1
- package/dist/components/physics.js +5 -218
- package/dist/components/physics.js.map +1 -1
- package/dist/components.cjs +22 -12
- package/dist/components.cjs.map +1 -1
- package/dist/components.css +4 -0
- package/dist/components.d.cts +106 -2
- package/dist/components.d.ts +106 -2
- package/dist/components.js +7 -2
- package/dist/components.js.map +1 -1
- package/dist/components.umd.js +2 -2
- package/dist/components.umd.js.map +1 -1
- package/docs/components.md +9 -0
- package/package.json +13 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cards.js","sources":["../../src/components/cards/card.ts","../../src/components/cards/card-stack.ts","../../src/components/cards/sticky-stack.ts","../../src/components/cards/carousel-3d.ts","../../src/components/cards/index.ts"],"sourcesContent":["import { defineElement, raf, caf, clamp, EASE_OUT, type UsaElement } from '../base';\nimport { springEasing } from '../physics/spring';\nimport css from './card.css?raw';\n\nexport const CARD_EFFECTS = ['flip', 'holo', 'glass', 'border-glow', 'conic-border', 'lift', 'spotlight', 'sheen', 'parallax-layers', 'expand'] as const;\nexport type CardEffect = (typeof CARD_EFFECTS)[number];\n\n/** Effects that follow the pointer (they share one rAF-throttled tracker). */\nconst TRACKING = new Set(['holo', 'border-glow', 'spotlight', 'parallax-layers', 'lift']);\n\n/**\n * `<usa-card>` — card effects, combinable: `effect=\"lift sheen\"`.\n *\n * - `flip` — front/back (`[data-front]` / `[data-back]` children) flip on\n * hover or `trigger=\"click\"`, `axis=\"y\"` (default, horizontal flip) or `x`.\n * - `holo` — holographic foil that shifts with the pointer.\n * - `glass` — frosted glass surface (backdrop blur).\n * - `border-glow` — a glow on the border that follows the pointer.\n * - `conic-border` — a rotating conic-gradient border.\n * - `lift` — rises with a deeper shadow and a slight pointer tilt.\n * - `spotlight` — a soft light that follows the pointer.\n * - `sheen` — a light sweep across the card on hover / focus.\n * - `parallax-layers` — children with `data-depth=\"0.2…1\"` move at different depths.\n * - `expand` — click to grow into a full detail view (`[data-detail]`\n * content is shown), FLIP + spring; Esc, `[data-close]` or the backdrop closes.\n *\n * Attributes: `effect`, `axis`, `trigger`, `depth` (parallax px, 16),\n * `color` (glow / spotlight colour), `flipped`, `expanded`, `disabled`.\n * CSS variables: `--usa-card-x/-y` (pointer %, 0–100), `--usa-card-nx/-ny` (−1…1).\n * Methods: `flip(force?)`, `expand()`, `collapse()`. Events: `usa:flip`,\n * `usa:expand`, `usa:collapse`. Reduced motion: no tilt / parallax / sweep;\n * flips and expansions cross-fade.\n */\nexport interface UsaCardElement extends UsaElement {\n readonly effects: string[];\n flipped: boolean;\n readonly expanded: boolean;\n flip(force?: boolean): void;\n expand(): Promise<void>;\n collapse(): Promise<void>;\n}\n\nexport function defineCard(tag = 'usa-card'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaCard extends Base {\n static get observedAttributes(): string[] {\n return ['effect', 'trigger', 'disabled'];\n }\n\n private _frame = 0;\n private _spacer: HTMLElement | null = null;\n private _backdrop: HTMLElement | null = null;\n private _busy = false;\n\n get effects(): string[] {\n return this.str('effect', 'lift').split(/[\\s,]+/).filter(Boolean);\n }\n private has(e: string): boolean {\n return this.effects.includes(e);\n }\n get flipped(): boolean {\n return this.flag('flipped');\n }\n set flipped(v: boolean) {\n this.setFlag('flipped', v);\n }\n get expanded(): boolean {\n return this.flag('expanded');\n }\n\n mount(): void {\n if (this.flag('disabled')) return;\n const color = this.str('color');\n if (color) this.style.setProperty('--usa-card-glow', color);\n if (this.has('sheen') && !this.querySelector(':scope > .usa-card-sheen')) this.append(deco('usa-card-sheen'));\n if (this.has('holo') && !this.querySelector(':scope > .usa-card-holo')) this.append(deco('usa-card-holo'));\n if (this.has('flip')) {\n const click = this.str('trigger', 'hover') === 'click';\n if (click) {\n if (!this.hasAttribute('tabindex')) this.tabIndex = 0;\n this.setAttribute('role', this.getAttribute('role') || 'button');\n this.setAttribute('aria-pressed', String(this.flipped));\n this.listen(this, 'click', (e: MouseEvent) => !interactive(e.target, this) && this.flip());\n this.listen(this, 'keydown', (e: KeyboardEvent) => {\n if ((e.key === 'Enter' || e.key === ' ') && e.target === this) {\n e.preventDefault();\n this.flip();\n }\n });\n }\n this.setBackHidden();\n }\n if (this.has('expand')) {\n if (!this.hasAttribute('tabindex')) this.tabIndex = 0;\n this.setAttribute('aria-expanded', String(this.expanded));\n this.listen(this, 'click', (e: MouseEvent) => {\n const t = e.target as Element;\n if (t.closest?.('[data-close]')) {\n e.stopPropagation();\n this.collapse();\n } else if (!this.expanded && !interactive(t, this)) this.expand();\n });\n this.listen(this, 'keydown', (e: KeyboardEvent) => {\n if (e.key === 'Escape' && this.expanded) this.collapse();\n else if ((e.key === 'Enter' || e.key === ' ') && e.target === this && !this.expanded) {\n e.preventDefault();\n this.expand();\n }\n });\n }\n if (!this.effects.some((e) => TRACKING.has(e)) || this.reduced) return;\n let rect: DOMRect | null = null;\n let px = 0.5;\n let py = 0.5;\n const apply = () => {\n this._frame = 0;\n const nx = clamp(px * 2 - 1, -1, 1);\n const ny = clamp(py * 2 - 1, -1, 1);\n this.style.setProperty('--usa-card-x', `${(px * 100).toFixed(1)}%`);\n this.style.setProperty('--usa-card-y', `${(py * 100).toFixed(1)}%`);\n this.style.setProperty('--usa-card-nx', nx.toFixed(3));\n this.style.setProperty('--usa-card-ny', ny.toFixed(3));\n if (this.has('parallax-layers')) {\n const depth = this.num('depth', 16);\n this.querySelectorAll<HTMLElement>('[data-depth]').forEach((l) => {\n const d = Number(l.dataset.depth) || 0.5;\n l.style.transform = `translate3d(${(nx * depth * d).toFixed(1)}px, ${(ny * depth * d).toFixed(1)}px, 0)`;\n });\n }\n };\n this.listen(this, 'pointerenter', () => {\n rect = this.getBoundingClientRect();\n this.setAttribute('data-hover', '');\n });\n this.listen(this, 'pointermove', (e: PointerEvent) => {\n if (this.expanded) return;\n rect = rect || this.getBoundingClientRect();\n px = (e.clientX - rect.left) / (rect.width || 1);\n py = (e.clientY - rect.top) / (rect.height || 1);\n if (!this._frame) this._frame = raf(apply);\n });\n this.listen(this, 'pointerleave', () => {\n rect = null;\n px = py = 0.5;\n this.removeAttribute('data-hover');\n if (!this._frame) this._frame = raf(apply);\n });\n }\n\n unmount(): void {\n caf(this._frame);\n this._frame = 0;\n if (this.expanded) this.finishCollapse();\n }\n\n private setBackHidden(): void {\n const front = this.querySelector<HTMLElement>(':scope > [data-front]');\n const back = this.querySelector<HTMLElement>(':scope > [data-back]');\n front?.setAttribute('aria-hidden', String(this.flipped));\n back?.setAttribute('aria-hidden', String(!this.flipped));\n }\n\n flip(force?: boolean): void {\n const next = force === undefined ? !this.flipped : force;\n if (next === this.flipped) return;\n this.flipped = next;\n if (this.hasAttribute('aria-pressed')) this.setAttribute('aria-pressed', String(next));\n this.setBackHidden();\n this.emit('flip', { flipped: next });\n }\n\n async expand(): Promise<void> {\n if (this.expanded || this._busy) return;\n this._busy = true;\n const first = this.getBoundingClientRect();\n const spacer = document.createElement('div');\n spacer.className = 'usa-card-spacer';\n spacer.style.cssText = `width:${first.width}px;height:${first.height}px`;\n spacer.setAttribute('aria-hidden', 'true');\n this.before(spacer);\n this._spacer = spacer;\n const backdrop = document.createElement('div');\n backdrop.className = 'usa-card-backdrop';\n backdrop.addEventListener('click', () => this.collapse());\n this.before(backdrop);\n this._backdrop = backdrop;\n this.setFlag('expanded', true);\n this.setAttribute('aria-expanded', 'true');\n this.emit('expand');\n const last = this.getBoundingClientRect();\n await this.flipFrom(first, last);\n this.motion(backdrop, [{ opacity: 0 }, { opacity: 1 }], { duration: 250, easing: 'ease-out' });\n this.focus({ preventScroll: true });\n this._busy = false;\n }\n\n async collapse(): Promise<void> {\n if (!this.expanded || this._busy) return;\n this._busy = true;\n const first = this.getBoundingClientRect();\n const b = this._backdrop;\n if (b) this.motion(b, [{ opacity: 1 }, { opacity: 0 }], { duration: 200, easing: 'ease-in', fill: 'forwards' });\n this.finishCollapse();\n this.emit('collapse');\n const last = this.getBoundingClientRect();\n await this.flipFrom(first, last);\n this._busy = false;\n }\n\n private finishCollapse(): void {\n this.setFlag('expanded', false);\n this.setAttribute('aria-expanded', 'false');\n this._spacer?.remove();\n this._backdrop?.remove();\n this._spacer = this._backdrop = null;\n }\n\n private async flipFrom(first: DOMRect, last: DOMRect): Promise<void> {\n if (this.reduced) {\n const a = this.motion(this, [{ opacity: 0.4 }, { opacity: 1 }], { duration: 200 });\n await a?.finished.catch(() => undefined);\n return;\n }\n const sx = first.width / (last.width || 1);\n const sy = first.height / (last.height || 1);\n const dx = first.left - last.left;\n const dy = first.top - last.top;\n const { easing, duration } = springEasing('stiff');\n const a = this.motion(\n this,\n [{ transformOrigin: '0 0', transform: `translate(${dx}px, ${dy}px) scale(${sx}, ${sy})` }, { transformOrigin: '0 0', transform: 'none' }],\n { duration: Math.min(duration, 900), easing: easing || EASE_OUT }\n );\n await a?.finished.catch(() => undefined);\n }\n },\n { id: 'card', text: css }\n );\n}\n\nfunction deco(cls: string): HTMLSpanElement {\n const s = document.createElement('span');\n s.className = cls;\n s.setAttribute('aria-hidden', 'true');\n return s;\n}\n\n/** Clicks on links, buttons and form fields inside the card keep their own behaviour. */\nfunction interactive(t: EventTarget | null, host: Element): boolean {\n const el = (t as Element)?.closest?.('a, button, input, select, textarea, label, [contenteditable]');\n return !!el && el !== host && host.contains(el);\n}\n","import { defineElement, type UsaElement } from '../base';\nimport { createSpring, type SpringValue } from '../physics/spring';\nimport css from './card-stack.css?raw';\n\n/**\n * `<usa-card-stack>` — a deck of cards (its element children). The top card\n * can be swiped away left or right (pointer, touch or arrow keys); the rest\n * fan out behind it and move up with a spring.\n *\n * Attributes: `threshold` (px to dismiss, 90), `visible` (cards fanned\n * behind, 3), `offset` (px between cards, 10), `loop` (swiped cards go back\n * to the bottom), `disabled`. Methods: `swipe(direction)`, `top`. Events:\n * `usa:swipe` (`{ direction: 'left' | 'right', card }`), `usa:empty`.\n * Reduced motion: cards are removed instantly, no rotation.\n */\nexport interface UsaCardStackElement extends UsaElement {\n readonly top: HTMLElement | null;\n swipe(direction: 'left' | 'right'): Promise<void>;\n}\n\nexport function defineCardStack(tag = 'usa-card-stack'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaCardStack extends Base {\n static get observedAttributes(): string[] {\n return ['visible', 'offset', 'disabled'];\n }\n\n private _x!: SpringValue;\n private _drag: { id: number; x0: number; t0: number } | null = null;\n private _busy = false;\n\n get top(): HTMLElement | null {\n return this.cards()[0] || null;\n }\n\n private cards(): HTMLElement[] {\n return Array.from(this.children).filter((c) => !(c as HTMLElement).hasAttribute('data-gone')) as HTMLElement[];\n }\n\n private layout(dragX = 0): void {\n const visible = this.num('visible', 3);\n const off = this.num('offset', 10);\n const reduced = this.reduced;\n this.cards().forEach((c, i) => {\n c.style.zIndex = String(100 - i);\n c.toggleAttribute('data-top', i === 0);\n c.setAttribute('aria-hidden', String(i !== 0));\n if (i === 0) {\n const rot = reduced ? 0 : dragX / 18;\n c.style.transform = `translate3d(${dragX}px, 0, 0) rotate(${rot.toFixed(2)}deg)`;\n c.style.opacity = '1';\n } else {\n const k = Math.min(i, visible);\n const pull = Math.min(1, Math.abs(dragX) / this.num('threshold', 90));\n const kk = Math.max(0, k - pull);\n c.style.transform = `translate3d(0, ${(kk * off).toFixed(1)}px, 0) scale(${(1 - kk * 0.05).toFixed(3)})`;\n c.style.opacity = i > visible ? '0' : '1';\n }\n });\n }\n\n mount(): void {\n if (!this.hasAttribute('tabindex')) this.tabIndex = 0;\n if (!this.hasAttribute('role')) this.setAttribute('role', 'group');\n this.setAttribute('aria-roledescription', 'card stack');\n this._x = createSpring({ spring: 'wobbly', onUpdate: (v) => this.layout(v) });\n this.layout();\n this.listen(this, 'pointerdown', (e: PointerEvent) => {\n if (this.flag('disabled') || this._busy || !this.top || !this.top.contains(e.target as Node)) return;\n this._x.stop();\n this._drag = { id: e.pointerId, x0: e.clientX - this._x.value, t0: e.timeStamp };\n try {\n this.setPointerCapture?.(e.pointerId);\n } catch {\n /* synthetic */\n }\n this.setAttribute('data-dragging', '');\n });\n this.listen(this, 'pointermove', (e: PointerEvent) => {\n if (!this._drag || e.pointerId !== this._drag.id) return;\n this._x.jump(e.clientX - this._drag.x0);\n });\n const up = (e: PointerEvent) => {\n if (!this._drag || e.pointerId !== this._drag.id) return;\n this._drag = null;\n this.removeAttribute('data-dragging');\n const x = this._x.value;\n if (Math.abs(x) >= this.num('threshold', 90)) this.swipe(x > 0 ? 'right' : 'left');\n else this._x.set(0);\n };\n this.listen(this, 'pointerup', up);\n this.listen(this, 'pointercancel', up);\n this.listen(this, 'keydown', (e: KeyboardEvent) => {\n if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {\n e.preventDefault();\n this.swipe(e.key === 'ArrowLeft' ? 'left' : 'right');\n }\n });\n const mo = typeof MutationObserver !== 'undefined' ? new MutationObserver(() => this.layout(this._x.value)) : null;\n mo?.observe(this, { childList: true });\n this.onCleanup(() => mo?.disconnect());\n }\n\n unmount(): void {\n this._x?.stop();\n }\n\n async swipe(direction: 'left' | 'right'): Promise<void> {\n const card = this.top;\n if (!card || this._busy || this.flag('disabled')) return;\n this._busy = true;\n this._x.stop();\n const from = this._x.value;\n const to = (direction === 'left' ? -1 : 1) * Math.max(320, (this.getBoundingClientRect().width || 300) * 1.4);\n card.setAttribute('data-gone', '');\n this._x.jump(0);\n this.layout(0);\n const a = this.reduced\n ? null\n : this.motion(card, [{ transform: `translate3d(${from}px,0,0) rotate(${from / 18}deg)`, opacity: 1 }, { transform: `translate3d(${to}px,0,0) rotate(${to / 14}deg)`, opacity: 0 }], {\n duration: 380,\n easing: 'cubic-bezier(0.3, 0.7, 0.4, 1)',\n fill: 'forwards',\n });\n await a?.finished.catch(() => undefined);\n a?.cancel();\n card.removeAttribute('data-gone');\n if (this.flag('loop')) this.append(card);\n else card.remove();\n this.layout(0);\n this._busy = false;\n this.emit('swipe', { direction, card });\n if (!this.top) this.emit('empty');\n }\n },\n { id: 'card-stack', text: css }\n );\n}\n","import { defineElement, raf, caf, clamp, type UsaElement } from '../base';\nimport css from './sticky-stack.css?raw';\n\n/**\n * `<usa-sticky-stack>` — cards (element children) stick to the top while\n * scrolling and the ones underneath scale down and dim as the next card\n * slides over them, like a deck building up.\n *\n * Attributes: `top` (px from the viewport top, 80), `gap` (px each card\n * peeks below the previous, 16), `scale` (how much a covered card shrinks,\n * 0.06). Reduced motion: cards still stack (sticky) but do not scale.\n */\nexport interface UsaStickyStackElement extends UsaElement {\n update(): void;\n}\n\nexport function defineStickyStack(tag = 'usa-sticky-stack'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaStickyStack extends Base {\n static get observedAttributes(): string[] {\n return ['top', 'gap', 'scale'];\n }\n\n private _frame = 0;\n\n mount(): void {\n const top = this.num('top', 80);\n const gap = this.num('gap', 16);\n const cards = Array.from(this.children) as HTMLElement[];\n cards.forEach((c, i) => {\n c.style.top = `${top + i * gap}px`;\n c.style.zIndex = String(i + 1);\n });\n if (this.reduced) return;\n const schedule = () => {\n if (!this._frame) this._frame = raf(() => this.update());\n };\n let active = false;\n this.inView((v) => {\n if (v && !active) {\n active = true;\n window.addEventListener('scroll', schedule, { passive: true });\n window.addEventListener('resize', schedule, { passive: true });\n schedule();\n } else if (!v && active) {\n active = false;\n window.removeEventListener('scroll', schedule);\n window.removeEventListener('resize', schedule);\n }\n });\n this.onCleanup(() => {\n window.removeEventListener('scroll', schedule);\n window.removeEventListener('resize', schedule);\n });\n }\n\n unmount(): void {\n caf(this._frame);\n this._frame = 0;\n }\n\n update(): void {\n this._frame = 0;\n const cards = Array.from(this.children) as HTMLElement[];\n const rects = cards.map((c) => c.getBoundingClientRect());\n const shrink = this.num('scale', 0.06);\n cards.forEach((c, i) => {\n let covered = 0;\n for (let j = i + 1; j < cards.length; j++) {\n const h = rects[i].height || 1;\n covered += clamp((rects[i].bottom - rects[j].top) / h, 0, 1);\n }\n const s = 1 - Math.min(3, covered) * shrink;\n c.style.transform = covered > 0.001 ? `scale(${s.toFixed(4)})` : '';\n c.style.filter = covered > 0.001 ? `brightness(${(1 - Math.min(0.35, covered * 0.12)).toFixed(3)})` : '';\n });\n }\n },\n { id: 'sticky-stack', text: css }\n );\n}\n","import { defineElement, type UsaElement } from '../base';\nimport { createSpring, type SpringValue } from '../physics/spring';\nimport css from './carousel-3d.css?raw';\n\n/**\n * `<usa-carousel-3d>` — its element children on a 3D ring. Rotate with the\n * arrow keys, a drag/swipe, the wheel (shift) or `next()` / `prev()`; the\n * front item is `aria-current`. Spring-driven rotation.\n *\n * Attributes: `radius` (px, auto from item width), `autoplay` (ms between\n * steps, pauses on hover/focus), `perspective` (px, 1200), `index`.\n * Events: `usa:change` (`{ index }`). Reduced motion: a flat, instant\n * switch (only the current item is shown, others dimmed).\n */\nexport interface UsaCarousel3dElement extends UsaElement {\n index: number;\n next(): void;\n prev(): void;\n goTo(i: number): void;\n}\n\nexport function defineCarousel3d(tag = 'usa-carousel-3d'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaCarousel3d extends Base {\n static get observedAttributes(): string[] {\n return ['radius', 'perspective', 'autoplay'];\n }\n\n private _angle!: SpringValue;\n private _i = 0;\n\n get index(): number {\n return this._i;\n }\n set index(v: number) {\n this.goTo(v);\n }\n\n private items(): HTMLElement[] {\n return Array.from(this.children) as HTMLElement[];\n }\n\n private render(angle: number): void {\n const items = this.items();\n const n = items.length || 1;\n const step = 360 / n;\n const w = items[0]?.offsetWidth || 200;\n const r = this.num('radius', Math.round(w / 2 / Math.tan(Math.PI / n)) + 24);\n const reduced = this.reduced;\n items.forEach((it, i) => {\n const norm = ((((i * step - angle) % 360) + 540) % 360) - 180;\n it.style.transform = reduced ? '' : `rotateY(${norm.toFixed(2)}deg) translateZ(${r}px)`;\n it.style.opacity = reduced ? (i === this._i ? '1' : '0') : String(Math.max(0.25, 1 - Math.abs(norm) / 200));\n });\n }\n\n mount(): void {\n this.style.setProperty('--usa-c3d-perspective', `${this.num('perspective', 1200)}px`);\n if (!this.hasAttribute('tabindex')) this.tabIndex = 0;\n this.setAttribute('role', 'region');\n this.setAttribute('aria-roledescription', 'carousel');\n this._i = Math.max(0, Math.min(this.items().length - 1, this.num('index', 0)));\n const step = () => 360 / (this.items().length || 1);\n this._angle = createSpring({ value: this._i * step(), spring: 'gentle', onUpdate: (v) => this.render(v) });\n this.render(this._angle.value);\n this.mark();\n this.listen(this, 'keydown', (e: KeyboardEvent) => {\n if (e.key === 'ArrowRight') this.next();\n else if (e.key === 'ArrowLeft') this.prev();\n else return;\n e.preventDefault();\n });\n let x0: number | null = null;\n this.listen(this, 'pointerdown', (e: PointerEvent) => (x0 = e.clientX));\n this.listen(this, 'pointerup', (e: PointerEvent) => {\n if (x0 === null) return;\n const dx = e.clientX - x0;\n x0 = null;\n if (Math.abs(dx) > 40) dx < 0 ? this.next() : this.prev();\n });\n this.listen(this, 'click', (e: MouseEvent) => {\n const it = this.items().find((c) => c.contains(e.target as Node));\n if (it) {\n const i = this.items().indexOf(it);\n if (i !== this._i) this.goTo(i);\n }\n });\n const every = this.num('autoplay', 0);\n if (every > 0 && !this.reduced) {\n let paused = false;\n const pause = () => (paused = true);\n const resume = () => (paused = false);\n this.listen(this, 'pointerenter', pause);\n this.listen(this, 'pointerleave', resume);\n this.listen(this, 'focusin', pause);\n this.listen(this, 'focusout', resume);\n const t = setInterval(() => !paused && !document.hidden && this.next(), every);\n this.onCleanup(() => clearInterval(t));\n }\n }\n\n unmount(): void {\n this._angle?.stop();\n }\n\n private mark(): void {\n this.items().forEach((it, i) => {\n if (i === this._i) it.setAttribute('aria-current', 'true');\n else it.removeAttribute('aria-current');\n });\n }\n\n goTo(i: number): void {\n const n = this.items().length;\n if (!n || !this._angle) return;\n const step = 360 / n;\n // shortest rotation from the current target\n const cur = this._angle.target;\n const curIdx = Math.round(cur / step);\n let delta = (((i - curIdx) % n) + n) % n;\n if (delta > n / 2) delta -= n;\n this._i = ((i % n) + n) % n;\n this._angle.set((curIdx + delta) * step);\n if (this.reduced) this.render(this._angle.value);\n this.mark();\n this.emit('change', { index: this._i });\n }\n\n next(): void {\n this.goTo(this._i + 1);\n }\n\n prev(): void {\n this.goTo(this._i - 1);\n }\n },\n { id: 'carousel-3d', text: css }\n );\n}\n","/**\n * use-scroll-animate/components/cards — card effects (v2.4).\n * `<usa-card effect=\"flip | holo | glass | border-glow | conic-border | lift |\n * spotlight | sheen | parallax-layers | expand\">` (combinable),\n * `<usa-card-stack>` (swipeable deck), `<usa-sticky-stack>` (stacking on\n * scroll) and `<usa-carousel-3d>`.\n */\nimport { defineCard, type UsaCardElement } from './card';\nimport { defineCardStack, type UsaCardStackElement } from './card-stack';\nimport { defineStickyStack, type UsaStickyStackElement } from './sticky-stack';\nimport { defineCarousel3d, type UsaCarousel3dElement } from './carousel-3d';\n\nexport { defineCard, defineCardStack, defineStickyStack, defineCarousel3d };\nexport { CARD_EFFECTS } from './card';\nexport type { CardEffect } from './card';\nexport type { UsaCardElement, UsaCardStackElement, UsaStickyStackElement, UsaCarousel3dElement };\nexport { configureComponents, prefersReducedMotion } from '../base';\nexport type { ComponentsConfig, UsaElement } from '../base';\n\n/** Register every component of this category under its default tag. */\nexport function defineCardComponents(): void {\n defineCard();\n defineCardStack();\n defineStickyStack();\n defineCarousel3d();\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'usa-card': UsaCardElement;\n 'usa-card-stack': UsaCardStackElement;\n 'usa-sticky-stack': UsaStickyStackElement;\n 'usa-carousel-3d': UsaCarousel3dElement;\n }\n}\n"],"names":["css"],"mappings":";;;;;;AAIO,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ;AAG9I;AACA,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAC;AAkCnF,SAAU,UAAU,CAAC,GAAG,GAAG,UAAU,EAAA;AACzC,IAAA,OAAO,aAAa,CAClB,GAAG,EACH,CAAC,IAAI,KACH,MAAM,OAAQ,SAAQ,IAAI,CAAA;AAA1B,QAAA,WAAA,GAAA;;YAKU,IAAA,CAAA,MAAM,GAAG,CAAC;YACV,IAAA,CAAA,OAAO,GAAuB,IAAI;YAClC,IAAA,CAAA,SAAS,GAAuB,IAAI;YACpC,IAAA,CAAA,KAAK,GAAG,KAAK;QAuLvB;AA9LE,QAAA,WAAW,kBAAkB,GAAA;AAC3B,YAAA,OAAO,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC;QAC1C;AAOA,QAAA,IAAI,OAAO,GAAA;AACT,YAAA,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;QACnE;AACQ,QAAA,GAAG,CAAC,CAAS,EAAA;YACnB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;QACjC;AACA,QAAA,IAAI,OAAO,GAAA;AACT,YAAA,OAAO,IAAI,CAAC,I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EA,IAAI,GAAA;YACF,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QACxB;KACD,EACH,EAAE,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,EAAE,CACjC;AACH;;AC5IA;;;;;;AAMG;AAaH;SACgB,oBAAoB,GAAA;AAClC,IAAA,UAAU,EAAE;AACZ,IAAA,eAAe,EAAE;AACjB,IAAA,iBAAiB,EAAE;AACnB,IAAA,gBAAgB,EAAE;AACpB;;;;"}
|
|
@@ -1,221 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var base = require('../chunks/base-CJ7XfidP.cjs');
|
|
4
|
-
|
|
5
|
-
const SPRING_PRESETS = {
|
|
6
|
-
default: { stiffness: 170, damping: 26, mass: 1 },
|
|
7
|
-
gentle: { stiffness: 120, damping: 14, mass: 1 },
|
|
8
|
-
wobbly: { stiffness: 180, damping: 12, mass: 1 },
|
|
9
|
-
stiff: { stiffness: 210, damping: 20, mass: 1 },
|
|
10
|
-
bouncy: { stiffness: 300, damping: 10, mass: 1 },
|
|
11
|
-
slow: { stiffness: 280, damping: 60, mass: 1 },
|
|
12
|
-
molasses: { stiffness: 280, damping: 120, mass: 1 },
|
|
13
|
-
};
|
|
14
|
-
/** Resolve a preset name or a partial config to a full config. */
|
|
15
|
-
function resolveSpring(input) {
|
|
16
|
-
const base = typeof input === 'string' ? SPRING_PRESETS[input] || SPRING_PRESETS.default : { ...SPRING_PRESETS.default, ...(input || {}) };
|
|
17
|
-
const pos = (v, d) => (typeof v === 'number' && Number.isFinite(v) && v > 0 ? v : d);
|
|
18
|
-
const o = (typeof input === 'object' && input) || {};
|
|
19
|
-
return {
|
|
20
|
-
stiffness: pos(base.stiffness, 170),
|
|
21
|
-
damping: Math.max(0, Number.isFinite(base.damping) ? base.damping : 26),
|
|
22
|
-
mass: pos(base.mass, 1),
|
|
23
|
-
velocity: Number.isFinite(o.velocity) ? o.velocity : 0,
|
|
24
|
-
precision: pos(o.precision, 0.001),
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
/** One integration step (semi-implicit Euler) towards `to`. Returns [x, v]. */
|
|
28
|
-
function stepSpring(cfg, x, v, to, dt) {
|
|
29
|
-
const a = (-cfg.stiffness * (x - to) - cfg.damping * v) / cfg.mass;
|
|
30
|
-
const nv = v + a * dt;
|
|
31
|
-
return [x + nv * dt, nv];
|
|
32
|
-
}
|
|
33
|
-
const cache = new Map();
|
|
34
|
-
/**
|
|
35
|
-
* Sample the spring from 0 to 1 at `fps` (default 60). `values` may exceed 1
|
|
36
|
-
* (overshoot); `duration` is the time to rest, in ms (max 10 s).
|
|
37
|
-
*/
|
|
38
|
-
function springSamples(input, fps = 60) {
|
|
39
|
-
const cfg = resolveSpring(input);
|
|
40
|
-
const key = `${cfg.stiffness}|${cfg.damping}|${cfg.mass}|${cfg.velocity}|${cfg.precision}|${fps}`;
|
|
41
|
-
const hit = cache.get(key);
|
|
42
|
-
if (hit)
|
|
43
|
-
return hit;
|
|
44
|
-
const values = [0];
|
|
45
|
-
let x = 0;
|
|
46
|
-
let v = cfg.velocity;
|
|
47
|
-
const frame = 1000 / fps;
|
|
48
|
-
let t = 0;
|
|
49
|
-
let next = frame;
|
|
50
|
-
while (t < 10000) {
|
|
51
|
-
[x, v] = stepSpring(cfg, x, v, 1, 0.001);
|
|
52
|
-
t += 1;
|
|
53
|
-
if (t >= next) {
|
|
54
|
-
values.push(x);
|
|
55
|
-
next += frame;
|
|
56
|
-
if (Math.abs(1 - x) < cfg.precision && Math.abs(v) < cfg.precision * 10)
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
values[values.length - 1] = 1;
|
|
61
|
-
const out = { values, duration: Math.round(t) };
|
|
62
|
-
if (cache.size > 64)
|
|
63
|
-
cache.clear();
|
|
64
|
-
cache.set(key, out);
|
|
65
|
-
return out;
|
|
66
|
-
}
|
|
67
|
-
/** `true` when CSS `linear()` easing is supported. */
|
|
68
|
-
function supportsLinearEasing() {
|
|
69
|
-
return typeof CSS !== 'undefined' && typeof CSS.supports === 'function' && CSS.supports('animation-timing-function', 'linear(0, 1)');
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* The spring as `{ easing, duration }` for `el.animate()` / CSS. `easing` is
|
|
73
|
-
* a `linear(…)` function with at most `points` stops (default 48), or a
|
|
74
|
-
* cubic-bezier overshoot where `linear()` is unsupported.
|
|
75
|
-
*/
|
|
76
|
-
function springEasing(input, points = 48) {
|
|
77
|
-
const { values, duration } = springSamples(input);
|
|
78
|
-
if (!supportsLinearEasing())
|
|
79
|
-
return { easing: base.EASE_SPRING, duration: Math.min(duration, 1200) };
|
|
80
|
-
return { easing: linearEasing(values, points), duration };
|
|
81
|
-
}
|
|
82
|
-
/** Build a CSS `linear()` easing from samples (down-sampled to `points`). */
|
|
83
|
-
function linearEasing(values, points = 48) {
|
|
84
|
-
const n = values.length;
|
|
85
|
-
const step = Math.max(1, Math.ceil((n - 1) / Math.max(2, points - 1)));
|
|
86
|
-
const out = [];
|
|
87
|
-
for (let i = 0; i < n - 1; i += step)
|
|
88
|
-
out.push(String(Math.round(values[i] * 1000) / 1000));
|
|
89
|
-
out.push('1');
|
|
90
|
-
return `linear(${out.join(', ')})`;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Animate `el` between keyframes with spring timing (WAAPI). Under reduced
|
|
94
|
-
* motion the final frame is applied immediately. Returns the Animation (or
|
|
95
|
-
* `null` without WAAPI / under reduced motion).
|
|
96
|
-
*/
|
|
97
|
-
function spring(el, keyframes, input, options = {}) {
|
|
98
|
-
const target = el;
|
|
99
|
-
if (base.prefersReducedMotion() || typeof target.animate !== 'function') {
|
|
100
|
-
base.applyFrame(target, keyframes[keyframes.length - 1]);
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
const { easing, duration } = springEasing(input);
|
|
104
|
-
return target.animate(keyframes, { duration, easing, fill: 'both', ...options });
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* An interruptible spring-animated number: call `set()` as often as you like,
|
|
108
|
-
* the motion keeps its velocity (like iOS / Framer springs). Reduced motion
|
|
109
|
-
* jumps straight to the target.
|
|
110
|
-
*/
|
|
111
|
-
function createSpring(opts = {}) {
|
|
112
|
-
let cfg = resolveSpring(opts.spring);
|
|
113
|
-
let x = opts.value ?? 0;
|
|
114
|
-
let v = 0;
|
|
115
|
-
let to = x;
|
|
116
|
-
let id = 0;
|
|
117
|
-
let last = 0;
|
|
118
|
-
let running = false;
|
|
119
|
-
const stop = () => {
|
|
120
|
-
if (running)
|
|
121
|
-
base.caf(id);
|
|
122
|
-
running = false;
|
|
123
|
-
};
|
|
124
|
-
const loop = () => {
|
|
125
|
-
const t = base.now();
|
|
126
|
-
let dt = Math.min(64, Math.max(1, t - last));
|
|
127
|
-
last = t;
|
|
128
|
-
while (dt > 0) {
|
|
129
|
-
const s = Math.min(dt, 4);
|
|
130
|
-
[x, v] = stepSpring(cfg, x, v, to, s / 1000);
|
|
131
|
-
dt -= s;
|
|
132
|
-
}
|
|
133
|
-
const scale = Math.max(1, Math.abs(to) * 0.0005);
|
|
134
|
-
if (Math.abs(to - x) < cfg.precision * scale * 10 && Math.abs(v) < cfg.precision * scale * 100) {
|
|
135
|
-
x = to;
|
|
136
|
-
v = 0;
|
|
137
|
-
running = false;
|
|
138
|
-
opts.onUpdate?.(x, 0);
|
|
139
|
-
opts.onRest?.(x);
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
opts.onUpdate?.(x, v);
|
|
143
|
-
id = base.raf(loop);
|
|
144
|
-
};
|
|
145
|
-
const api = {
|
|
146
|
-
get value() {
|
|
147
|
-
return x;
|
|
148
|
-
},
|
|
149
|
-
get velocity() {
|
|
150
|
-
return v;
|
|
151
|
-
},
|
|
152
|
-
get target() {
|
|
153
|
-
return to;
|
|
154
|
-
},
|
|
155
|
-
get animating() {
|
|
156
|
-
return running;
|
|
157
|
-
},
|
|
158
|
-
set(target, velocity) {
|
|
159
|
-
to = target;
|
|
160
|
-
if (velocity !== undefined && Number.isFinite(velocity))
|
|
161
|
-
v = velocity;
|
|
162
|
-
if (base.prefersReducedMotion()) {
|
|
163
|
-
api.jump(target);
|
|
164
|
-
opts.onRest?.(target);
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
if (!running) {
|
|
168
|
-
running = true;
|
|
169
|
-
last = base.now();
|
|
170
|
-
id = base.raf(loop);
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
jump(value) {
|
|
174
|
-
stop();
|
|
175
|
-
x = to = value;
|
|
176
|
-
v = 0;
|
|
177
|
-
opts.onUpdate?.(x, 0);
|
|
178
|
-
},
|
|
179
|
-
stop() {
|
|
180
|
-
stop();
|
|
181
|
-
v = 0;
|
|
182
|
-
to = x;
|
|
183
|
-
},
|
|
184
|
-
configure(input) {
|
|
185
|
-
cfg = resolveSpring(input);
|
|
186
|
-
},
|
|
187
|
-
};
|
|
188
|
-
return api;
|
|
189
|
-
}
|
|
190
|
-
/* ------------------------------------------------------------------ */
|
|
191
|
-
/* Inertia + snapping */
|
|
192
|
-
/* ------------------------------------------------------------------ */
|
|
193
|
-
/**
|
|
194
|
-
* Where a flick at `velocity` (units/s) comes to rest with exponential
|
|
195
|
-
* decay: `value + velocity · timeConstant` (default 0.325 s, iOS-like).
|
|
196
|
-
*/
|
|
197
|
-
function projectInertia(value, velocity, timeConstant = 0.325) {
|
|
198
|
-
return value + velocity * timeConstant;
|
|
199
|
-
}
|
|
200
|
-
/** Snap to a grid (`number`) or the nearest of a list of points. */
|
|
201
|
-
function snapTo(value, to) {
|
|
202
|
-
if (Array.isArray(to)) {
|
|
203
|
-
if (!to.length)
|
|
204
|
-
return value;
|
|
205
|
-
return to.reduce((best, p) => (Math.abs(p - value) < Math.abs(best - value) ? p : best), to[0]);
|
|
206
|
-
}
|
|
207
|
-
if (typeof to === 'number' && to > 0)
|
|
208
|
-
return Math.round(value / to) * to;
|
|
209
|
-
return value;
|
|
210
|
-
}
|
|
211
|
-
/** iOS-style rubber-band resistance: how far content moves when pulled `distance` past an edge. */
|
|
212
|
-
function rubberBand(distance, dimension, constant = 0.55) {
|
|
213
|
-
if (dimension <= 0)
|
|
214
|
-
return 0;
|
|
215
|
-
const sign = distance < 0 ? -1 : 1;
|
|
216
|
-
const d = Math.abs(distance);
|
|
217
|
-
return sign * (1 - 1 / ((d * constant) / dimension + 1)) * dimension;
|
|
218
|
-
}
|
|
4
|
+
var spring = require('../chunks/spring-CGO9Jd9b.cjs');
|
|
219
5
|
|
|
220
6
|
var css$2 = "usa-spring{display:inline-block;transform-origin:50% 70%}usa-spring[block]{display:block}usa-spring[effect=\"drop\"]{transform-origin:50% 100%}usa-spring[data-state=\"hidden\"]{opacity:0}usa-spring[trigger=\"click\"],usa-spring[trigger=\"hover\"]{cursor:pointer;-webkit-tap-highlight-color:transparent}";
|
|
221
7
|
|
|
@@ -314,7 +100,7 @@ function defineSpring(tag = 'usa-spring') {
|
|
|
314
100
|
this.setAttribute('data-state', 'playing');
|
|
315
101
|
const frames = springEffectKeyframes(effect, reduced);
|
|
316
102
|
const timing = ENTRANCE.has(effect) && !reduced
|
|
317
|
-
? springEasing(this.config())
|
|
103
|
+
? spring.springEasing(this.config())
|
|
318
104
|
: { duration: reduced ? 250 : this.num('duration', 900), easing: 'ease-out' };
|
|
319
105
|
const a = this.motion(this, frames, { ...timing, delay: this.num('delay', 0), fill: 'backwards' });
|
|
320
106
|
this._anim = a;
|
|
@@ -392,9 +178,9 @@ function defineDraggable(tag = 'usa-draggable') {
|
|
|
392
178
|
this.emit('settle', { x: this._x, y: this._y });
|
|
393
179
|
}
|
|
394
180
|
};
|
|
395
|
-
const spring = this.str('preset', 'wobbly');
|
|
396
|
-
this._sx = createSpring({ value: this._x, spring, onUpdate: (v) => ((this._x = v), this.render()), onRest: rest });
|
|
397
|
-
this._sy = createSpring({ value: this._y, spring, onUpdate: (v) => ((this._y = v), this.render()), onRest: rest });
|
|
181
|
+
const spring$1 = this.str('preset', 'wobbly');
|
|
182
|
+
this._sx = spring.createSpring({ value: this._x, spring: spring$1, onUpdate: (v) => ((this._x = v), this.render()), onRest: rest });
|
|
183
|
+
this._sy = spring.createSpring({ value: this._y, spring: spring$1, onUpdate: (v) => ((this._y = v), this.render()), onRest: rest });
|
|
398
184
|
if (!this.hasAttribute('tabindex'))
|
|
399
185
|
this.tabIndex = 0;
|
|
400
186
|
this.setAttribute('aria-roledescription', 'draggable');
|
|
@@ -434,7 +220,7 @@ function defineDraggable(tag = 'usa-draggable') {
|
|
|
434
220
|
let y = axis === 'x' ? d.oy : d.oy + e.clientY - d.py;
|
|
435
221
|
const b = this.limits();
|
|
436
222
|
if (b) {
|
|
437
|
-
const band = (v, lo, hi, dim) => (v < lo ? lo + rubberBand(v - lo, dim) : v > hi ? hi + rubberBand(v - hi, dim) : v);
|
|
223
|
+
const band = (v, lo, hi, dim) => (v < lo ? lo + spring.rubberBand(v - lo, dim) : v > hi ? hi + spring.rubberBand(v - hi, dim) : v);
|
|
438
224
|
x = band(x, b.minX, b.maxX, 200);
|
|
439
225
|
y = band(y, b.minY, b.maxY, 200);
|
|
440
226
|
}
|
|
@@ -477,8 +263,8 @@ function defineDraggable(tag = 'usa-draggable') {
|
|
|
477
263
|
}
|
|
478
264
|
else {
|
|
479
265
|
if (this.flag('inertia') && !this.reduced) {
|
|
480
|
-
tx = projectInertia(tx, vx);
|
|
481
|
-
ty = projectInertia(ty, vy);
|
|
266
|
+
tx = spring.projectInertia(tx, vx);
|
|
267
|
+
ty = spring.projectInertia(ty, vy);
|
|
482
268
|
}
|
|
483
269
|
[tx, ty] = this.constrain(tx, ty);
|
|
484
270
|
}
|
|
@@ -487,8 +273,8 @@ function defineDraggable(tag = 'usa-draggable') {
|
|
|
487
273
|
}
|
|
488
274
|
constrain(x, y) {
|
|
489
275
|
const snap = parseSnap(this.str('snap'));
|
|
490
|
-
let tx = snapTo(x, snap);
|
|
491
|
-
let ty = snapTo(y, snap);
|
|
276
|
+
let tx = spring.snapTo(x, snap);
|
|
277
|
+
let ty = spring.snapTo(y, snap);
|
|
492
278
|
const b = this.limits();
|
|
493
279
|
if (b) {
|
|
494
280
|
tx = base.clamp(tx, b.minX, Math.max(b.minX, b.maxX));
|
|
@@ -562,10 +348,10 @@ function defineOverscroll(tag = 'usa-overscroll') {
|
|
|
562
348
|
}
|
|
563
349
|
stretch(raw) {
|
|
564
350
|
const max = this.num('max', 120);
|
|
565
|
-
this.set(Math.max(-max, Math.min(max, rubberBand(raw, max * 2.5))));
|
|
351
|
+
this.set(Math.max(-max, Math.min(max, spring.rubberBand(raw, max * 2.5))));
|
|
566
352
|
}
|
|
567
353
|
mount() {
|
|
568
|
-
this._spring = createSpring({ spring: this.str('preset', 'default'), onUpdate: (v) => this.set(v) });
|
|
354
|
+
this._spring = spring.createSpring({ spring: this.str('preset', 'default'), onUpdate: (v) => this.set(v) });
|
|
569
355
|
const x = this.str('axis', 'y') === 'x';
|
|
570
356
|
const off = () => this.flag('disabled') || this.reduced;
|
|
571
357
|
// Wheel / trackpad: accumulate past the edge, spring back when it stops.
|
|
@@ -643,22 +429,22 @@ function definePhysicsComponents() {
|
|
|
643
429
|
|
|
644
430
|
exports.configureComponents = base.configureComponents;
|
|
645
431
|
exports.prefersReducedMotion = base.prefersReducedMotion;
|
|
432
|
+
exports.SPRING_PRESETS = spring.SPRING_PRESETS;
|
|
433
|
+
exports.createSpring = spring.createSpring;
|
|
434
|
+
exports.linearEasing = spring.linearEasing;
|
|
435
|
+
exports.projectInertia = spring.projectInertia;
|
|
436
|
+
exports.resolveSpring = spring.resolveSpring;
|
|
437
|
+
exports.rubberBand = spring.rubberBand;
|
|
438
|
+
exports.snapTo = spring.snapTo;
|
|
439
|
+
exports.spring = spring.spring;
|
|
440
|
+
exports.springEasing = spring.springEasing;
|
|
441
|
+
exports.springSamples = spring.springSamples;
|
|
442
|
+
exports.stepSpring = spring.stepSpring;
|
|
443
|
+
exports.supportsLinearEasing = spring.supportsLinearEasing;
|
|
646
444
|
exports.SPRING_EFFECTS = SPRING_EFFECTS;
|
|
647
|
-
exports.SPRING_PRESETS = SPRING_PRESETS;
|
|
648
|
-
exports.createSpring = createSpring;
|
|
649
445
|
exports.defineDraggable = defineDraggable;
|
|
650
446
|
exports.defineOverscroll = defineOverscroll;
|
|
651
447
|
exports.definePhysicsComponents = definePhysicsComponents;
|
|
652
448
|
exports.defineSpring = defineSpring;
|
|
653
|
-
exports.linearEasing = linearEasing;
|
|
654
|
-
exports.projectInertia = projectInertia;
|
|
655
|
-
exports.resolveSpring = resolveSpring;
|
|
656
|
-
exports.rubberBand = rubberBand;
|
|
657
|
-
exports.snapTo = snapTo;
|
|
658
|
-
exports.spring = spring;
|
|
659
|
-
exports.springEasing = springEasing;
|
|
660
449
|
exports.springEffectKeyframes = springEffectKeyframes;
|
|
661
|
-
exports.springSamples = springSamples;
|
|
662
|
-
exports.stepSpring = stepSpring;
|
|
663
|
-
exports.supportsLinearEasing = supportsLinearEasing;
|
|
664
450
|
//# sourceMappingURL=physics.cjs.map
|