use-scroll-animate 3.4.0 → 3.5.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/{base-Cu-86Z31.js → base-BpROOcey.js} +2 -2
- package/dist/chunks/{base-Cu-86Z31.js.map → base-BpROOcey.js.map} +1 -1
- package/dist/chunks/core-IaorbTdu.cjs +185 -0
- package/dist/chunks/core-IaorbTdu.cjs.map +1 -0
- package/dist/chunks/core-uxs3ETou.js +181 -0
- package/dist/chunks/core-uxs3ETou.js.map +1 -0
- package/dist/chunks/{index-tags-BKcHAxBK.cjs → index-tags-CLFrjVR7.cjs} +2 -1
- package/dist/chunks/{index-tags-BKcHAxBK.cjs.map → index-tags-CLFrjVR7.cjs.map} +1 -1
- package/dist/chunks/{index-tags-qc6OWsJ8.js → index-tags-uw1Fospg.js} +2 -1
- package/dist/chunks/{index-tags-qc6OWsJ8.js.map → index-tags-uw1Fospg.js.map} +1 -1
- package/dist/chunks/{spring-BV-cpTHC.js → spring-C-fw7_9f.js} +2 -2
- package/dist/chunks/{spring-BV-cpTHC.js.map → spring-C-fw7_9f.js.map} +1 -1
- package/dist/chunks/{variants-BQ3gCb5L.js → variants-CHe1VbSn.js} +2 -2
- package/dist/chunks/{variants-BQ3gCb5L.js.map → variants-CHe1VbSn.js.map} +1 -1
- package/dist/components/background.js +3 -3
- package/dist/components/cards.js +3 -3
- package/dist/components/click.js +3 -3
- package/dist/components/depth.cjs +252 -0
- package/dist/components/depth.cjs.map +1 -0
- package/dist/components/depth.css +3 -0
- package/dist/components/depth.d.cts +121 -0
- package/dist/components/depth.d.ts +121 -0
- package/dist/components/depth.js +243 -0
- package/dist/components/depth.js.map +1 -0
- package/dist/components/feedback.js +2 -2
- package/dist/components/gesture.cjs +6 -182
- package/dist/components/gesture.cjs.map +1 -1
- package/dist/components/gesture.js +6 -181
- package/dist/components/gesture.js.map +1 -1
- package/dist/components/interaction.js +2 -2
- package/dist/components/jsx.d.cts +1 -0
- package/dist/components/jsx.d.ts +1 -0
- package/dist/components/lazy.cjs +2 -1
- package/dist/components/lazy.cjs.map +1 -1
- package/dist/components/lazy.d.cts +1 -0
- package/dist/components/lazy.d.ts +1 -0
- package/dist/components/lazy.js +2 -1
- package/dist/components/lazy.js.map +1 -1
- package/dist/components/page.js +3 -3
- package/dist/components/physics.js +4 -4
- package/dist/components/react.cjs +1 -1
- package/dist/components/react.js +1 -1
- package/dist/components/reveal.js +2 -2
- package/dist/components/svg.js +2 -2
- package/dist/components/text.js +2 -2
- package/dist/components/timeline.js +2 -2
- package/dist/components/transitions.js +2 -2
- package/dist/components/ui.js +5 -5
- package/dist/components/vue.cjs +3 -1
- package/dist/components/vue.cjs.map +1 -1
- package/dist/components/vue.d.cts +47 -0
- package/dist/components/vue.d.ts +47 -0
- package/dist/components/vue.js +6 -4
- package/dist/components/vue.js.map +1 -1
- package/dist/components/webgl.js +2 -2
- package/dist/components.cjs +14 -4
- package/dist/components.cjs.map +1 -1
- package/dist/components.css +1 -0
- package/dist/components.d.cts +77 -2
- package/dist/components.d.ts +77 -2
- package/dist/components.js +12 -8
- 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 +10 -0
- package/package.json +13 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gesture.js","sources":["../../src/components/gesture/core.ts","../../src/components/gesture/swipeable.ts","../../src/components/gesture/pinch-zoom.ts","../../src/components/gesture/index.ts"],"sourcesContent":["import { clamp } from '../base';\n\nexport interface PanState {\n /** Offset from the gesture start (px). */\n dx: number;\n dy: number;\n /** Velocity (px/s). */\n vx: number;\n vy: number;\n first: boolean;\n last: boolean;\n event: Event;\n}\nexport type SwipeDirection = 'left' | 'right' | 'up' | 'down';\nexport interface SwipeState { direction: SwipeDirection; velocity: number; dx: number; dy: number }\nexport interface PinchState { scale: number; /** Midpoint of the two pointers (client px). */ x: number; y: number; first: boolean; last: boolean }\nexport interface PressState { x: number; y: number }\n\nexport interface GestureHandlers {\n onPan?: (s: PanState) => void;\n onSwipe?: (s: SwipeState) => void;\n onPinch?: (s: PinchState) => void;\n onLongPress?: (s: PressState) => void;\n onTap?: (s: PressState) => void;\n onDoubleTap?: (s: PressState) => void;\n}\n\nexport interface GestureOptions {\n /** Restrict panning to an axis. */\n axis?: 'x' | 'y';\n /** Movement (px) before a pan starts (default 4). */\n threshold?: number;\n /** Minimum distance (px, default 40) and speed (px/s, default 300) for a swipe. */\n swipeDistance?: number;\n swipeVelocity?: number;\n /** Long-press delay (ms, default 500). */\n longPress?: number;\n /** Ctrl/⌘ + wheel (trackpad pinch) counts as pinch (default true). */\n wheelPinch?: boolean;\n}\n\n/** The swipe a pointer release represents, or `null` (pure). */\nexport function swipeDirection(dx: number, dy: number, vx: number, vy: number, o: { distance?: number; velocity?: number; axis?: 'x' | 'y' } = {}): SwipeState | null {\n const dist = o.distance ?? 40;\n const vel = o.velocity ?? 300;\n const horiz = o.axis === 'x' || (o.axis !== 'y' && Math.abs(dx) >= Math.abs(dy));\n const d = horiz ? dx : dy;\n const v = horiz ? vx : vy;\n if (Math.abs(d) < dist && Math.abs(v) < vel * 2) return null;\n if (Math.abs(v) < vel && Math.abs(d) < dist * 3) return null;\n const direction: SwipeDirection = horiz ? (d > 0 ? 'right' : 'left') : d > 0 ? 'down' : 'up';\n return { direction, velocity: Math.abs(v), dx, dy };\n}\n\n/** Scale between two pointer distances, clamped to [min, max] (pure). */\nexport function pinchScale(startDistance: number, distance: number, base = 1, min = 0.5, max = 4): number {\n if (!startDistance) return base;\n return clamp(base * (distance / startDistance), min, max);\n}\n\ntype P = { x: number; y: number };\nconst pid = (e: any): number => (typeof e.pointerId === 'number' ? e.pointerId : 1);\n\n/**\n * One recognizer for pan, swipe, pinch (two pointers or Ctrl + wheel),\n * long-press, tap and double-tap, with velocities ready to hand to a spring\n * (`createSpring().set(target, velocity)`). Works with mouse, touch and pen\n * through Pointer Events. Returns a cleanup function.\n *\n * @example\n * const x = createSpring({ onUpdate: (v) => (card.style.translate = `${v}px`) });\n * gesture(card, {\n * onPan: ({ dx, last, vx }) => (last ? x.set(0, vx) : x.jump(dx)),\n * onSwipe: ({ direction }) => dismiss(direction),\n * }, { axis: 'x' });\n */\nexport function gesture(el: HTMLElement, h: GestureHandlers, o: GestureOptions = {}): () => void {\n const pts = new Map<number, P>();\n let start: P = { x: 0, y: 0 };\n let last: P & { t: number } = { x: 0, y: 0, t: 0 };\n let vx = 0;\n let vy = 0;\n let panning = false;\n let pinch: { d0: number; first: boolean } | null = null;\n let pinchScaleNow = 1;\n let press: ReturnType<typeof setTimeout> | undefined;\n let pressed = false;\n let lastTap = -1e9;\n const th = o.threshold ?? 4;\n const dist = () => {\n const [a, b] = [...pts.values()];\n return Math.hypot(a.x - b.x, a.y - b.y);\n };\n const mid = () => {\n const [a, b] = [...pts.values()];\n return { x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 };\n };\n const t = (e: Event) => (e.timeStamp || Date.now());\n\n const down = (e: PointerEvent) => {\n pts.set(pid(e), { x: e.clientX, y: e.clientY });\n try { el.setPointerCapture?.(pid(e)); } catch { /* jsdom / synthetic */ }\n if (pts.size === 2 && h.onPinch) {\n clearTimeout(press);\n if (panning) h.onPan?.({ dx: last.x - start.x, dy: last.y - start.y, vx: 0, vy: 0, first: false, last: true, event: e });\n panning = false;\n pinch = { d0: dist(), first: true };\n return;\n }\n if (pts.size > 1) return;\n start = { x: e.clientX, y: e.clientY };\n last = { ...start, t: t(e) };\n vx = vy = 0;\n pressed = false;\n if (h.onLongPress) press = setTimeout(() => { pressed = true; h.onLongPress?.({ x: start.x, y: start.y }); }, o.longPress ?? 500);\n };\n const move = (e: PointerEvent) => {\n if (!pts.has(pid(e))) return;\n pts.set(pid(e), { x: e.clientX, y: e.clientY });\n if (pinch && pts.size >= 2) {\n const m = mid();\n pinchScaleNow = pinchScale(pinch.d0, dist(), 1, 0.05, 20);\n h.onPinch?.({ scale: pinchScaleNow, x: m.x, y: m.y, first: pinch.first, last: false });\n pinch.first = false;\n return;\n }\n const dx = e.clientX - start.x;\n const dy = e.clientY - start.y;\n const dt = Math.max(1, t(e) - last.t) / 1000;\n vx = (e.clientX - last.x) / dt;\n vy = (e.clientY - last.y) / dt;\n last = { x: e.clientX, y: e.clientY, t: t(e) };\n if (!panning) {\n const off = o.axis === 'x' ? Math.abs(dx) : o.axis === 'y' ? Math.abs(dy) : Math.hypot(dx, dy);\n if (off < th) return;\n clearTimeout(press);\n if (o.axis && Math.abs(o.axis === 'x' ? dy : dx) > off) { pts.delete(pid(e)); return; } // wrong axis: let the page scroll\n panning = true;\n h.onPan?.({ dx: o.axis === 'y' ? 0 : dx, dy: o.axis === 'x' ? 0 : dy, vx, vy, first: true, last: false, event: e });\n return;\n }\n if (e.cancelable) e.preventDefault();\n h.onPan?.({ dx: o.axis === 'y' ? 0 : dx, dy: o.axis === 'x' ? 0 : dy, vx, vy, first: false, last: false, event: e });\n };\n const up = (e: PointerEvent) => {\n if (!pts.has(pid(e))) return;\n pts.delete(pid(e));\n clearTimeout(press);\n if (pinch) {\n if (pts.size < 2) {\n h.onPinch?.({ scale: pinchScaleNow, ...start, first: false, last: true });\n pinch = null;\n pts.clear();\n }\n return;\n }\n const dx = e.clientX - start.x;\n const dy = e.clientY - start.y;\n if (panning) {\n panning = false;\n if (t(e) - last.t > 80) vx = vy = 0; // paused before release\n h.onPan?.({ dx: o.axis === 'y' ? 0 : dx, dy: o.axis === 'x' ? 0 : dy, vx, vy, first: false, last: true, event: e });\n const s = swipeDirection(dx, dy, vx, vy, { distance: o.swipeDistance, velocity: o.swipeVelocity, axis: o.axis });\n if (s) h.onSwipe?.(s);\n return;\n }\n if (pressed || e.type === 'pointercancel') return;\n const p = { x: e.clientX, y: e.clientY };\n const n = t(e);\n if (h.onDoubleTap && n - lastTap < 300) { lastTap = -1e9; h.onDoubleTap(p); return; }\n lastTap = n;\n h.onTap?.(p);\n };\n const wheel = (e: WheelEvent) => {\n if (!h.onPinch || o.wheelPinch === false || !e.ctrlKey) return;\n e.preventDefault();\n const s = Math.exp(-e.deltaY / 100);\n h.onPinch({ scale: s, x: e.clientX, y: e.clientY, first: true, last: true });\n };\n const opts: AddEventListenerOptions = { passive: false };\n el.addEventListener('pointerdown', down as EventListener);\n el.addEventListener('pointermove', move as EventListener, opts);\n el.addEventListener('pointerup', up as EventListener);\n el.addEventListener('pointercancel', up as EventListener);\n el.addEventListener('wheel', wheel as EventListener, opts);\n if (o.axis && !el.style.touchAction) el.style.touchAction = o.axis === 'x' ? 'pan-y' : 'pan-x';\n else if (!o.axis && !el.style.touchAction && (h.onPan || h.onPinch)) el.style.touchAction = 'none';\n return () => {\n clearTimeout(press);\n el.removeEventListener('pointerdown', down as EventListener);\n el.removeEventListener('pointermove', move as EventListener, opts);\n el.removeEventListener('pointerup', up as EventListener);\n el.removeEventListener('pointercancel', up as EventListener);\n el.removeEventListener('wheel', wheel as EventListener, opts);\n };\n}\n","import { defineElement, type UsaElement } from '../base';\nimport { createSpring, type SpringValue } from '../physics/spring';\nimport { gesture, type SwipeDirection } from './core';\nimport css from './gesture.css?raw';\n\n/**\n * `<usa-swipeable>` — swipe-to-dismiss / swipe actions. The content follows\n * the finger (rubber-banded past `distance`), flies out on a swipe or a drag\n * past `distance`, otherwise springs home with the release velocity.\n *\n * Attributes: `axis` (`x` default · `y`), `distance` (px, 120), `preset`\n * (spring), `dismiss` (remove the element after flying out), `disabled`.\n * Keyboard: Delete/Backspace dismisses, ←/→ swipe. Events `usa:swipe`\n * (`{ direction }`, cancelable), `usa:dismiss`. Methods `swipe(dir)`, `reset()`.\n * Reduced motion: no follow / fly-out animation, events still fire.\n */\nexport interface UsaSwipeableElement extends UsaElement {\n swipe(direction: SwipeDirection): void;\n reset(): void;\n readonly offset: number;\n}\n\nexport function defineSwipeable(tag = 'usa-swipeable'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaSwipeable extends Base {\n static get observedAttributes(): string[] {\n return ['axis', 'disabled'];\n }\n private _s!: SpringValue;\n private _off = 0;\n\n get offset(): number {\n return this._off;\n }\n\n private put(v: number): void {\n this._off = v;\n this.style.setProperty('--usa-swipe', `${v}px`);\n this.style.setProperty('--usa-swipe-p', String(Math.min(1, Math.abs(v) / this.num('distance', 120))));\n }\n\n swipe(direction: SwipeDirection): void {\n if (!this.emit('swipe', { direction })) return this.reset();\n const sign = direction === 'left' || direction === 'up' ? -1 : 1;\n const far = sign * ((this.str('axis', 'x') === 'y' ? this.offsetHeight : this.offsetWidth) + 80 || 600);\n const done = () => {\n this.emit('dismiss', { direction });\n if (this.flag('dismiss')) this.remove();\n };\n if (this.reduced) {\n this.put(0);\n return done();\n }\n this.setAttribute('data-gone', '');\n this._s = createSpring({ spring: 'stiff', value: this._off, onUpdate: (v) => this.put(v), onRest: done });\n this._s.set(far, sign * 1500);\n }\n\n reset(): void {\n this.removeAttribute('data-gone');\n if (this.reduced) return this.put(0);\n this._s.set(0);\n }\n\n mount(): void {\n this._s = createSpring({ spring: this.str('preset', 'default'), onUpdate: (v) => this.put(v) });\n if (!this.hasAttribute('tabindex')) this.tabIndex = 0;\n const y = this.str('axis', 'x') === 'y';\n const max = () => this.num('distance', 120);\n this.onCleanup(\n gesture(this, {\n onPan: ({ dx, dy, vx, vy, last }) => {\n if (this.flag('disabled')) return;\n const d = y ? dy : dx;\n if (!last) {\n this._s.stop();\n if (!this.reduced) this.put(Math.abs(d) > max() ? Math.sign(d) * (max() + (Math.abs(d) - max()) * 0.35) : d);\n return;\n }\n if (Math.abs(d) > max()) this.swipe(y ? (d > 0 ? 'down' : 'up') : d > 0 ? 'right' : 'left');\n else if (!this.hasAttribute('data-gone')) {\n if (this.reduced) this.put(0);\n else this._s.set(0, y ? vy : vx);\n }\n },\n onSwipe: ({ direction }) => {\n if (this.flag('disabled') || this.hasAttribute('data-gone')) return;\n if (y === (direction === 'up' || direction === 'down')) this.swipe(direction);\n },\n }, { axis: y ? 'y' : 'x' })\n );\n this.listen(this, 'keydown', (e: KeyboardEvent) => {\n if (this.flag('disabled')) return;\n const map: Record<string, SwipeDirection> = y ? { ArrowUp: 'up', ArrowDown: 'down' } : { ArrowLeft: 'left', ArrowRight: 'right' };\n if (e.key === 'Delete' || e.key === 'Backspace') this.swipe(y ? 'up' : 'left');\n else if (map[e.key]) this.swipe(map[e.key]);\n else return;\n e.preventDefault();\n });\n }\n\n unmount(): void {\n this._s?.stop();\n }\n },\n { id: 'gesture', text: css }\n );\n}\n","import { defineElement, clamp, type UsaElement } from '../base';\nimport { createSpring, type SpringValue } from '../physics/spring';\nimport { gesture } from './core';\nimport css from './gesture.css?raw';\n\n/**\n * `<usa-pinch-zoom>` — pinch (two fingers or Ctrl/⌘ + wheel / trackpad\n * pinch) to zoom its content, pan while zoomed, double-tap to toggle zoom;\n * scale and position spring back inside the bounds on release.\n *\n * Attributes: `min` (1), `max` (4), `double-tap` (zoom level, 2), `preset`.\n * Keyboard: `+` / `-` / `0`. Property `scale`, method `zoomTo(scale)`.\n * Event `usa:zoom` (`{ scale }`). Reduced motion: zoom changes instantly.\n */\nexport interface UsaPinchZoomElement extends UsaElement {\n readonly scale: number;\n zoomTo(scale: number): void;\n}\n\nexport function definePinchZoom(tag = 'usa-pinch-zoom'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaPinchZoom extends Base {\n private _k!: SpringValue;\n private _x!: SpringValue;\n private _y!: SpringValue;\n private _v = { k: 1, x: 0, y: 0 };\n\n get scale(): number {\n return this._v.k;\n }\n\n private paint(): void {\n const { k, x, y } = this._v;\n this.style.setProperty('--usa-zoom', String(k));\n this.style.setProperty('--usa-zoom-x', `${x}px`);\n this.style.setProperty('--usa-zoom-y', `${y}px`);\n this.toggleAttribute('data-zoomed', k > 1.01);\n }\n\n private bound(k: number, x: number, y: number) {\n const w = (this.clientWidth * (k - 1)) / 2;\n const h = (this.clientHeight * (k - 1)) / 2;\n return { x: clamp(x, -w, w), y: clamp(y, -h, h) };\n }\n\n zoomTo(scale: number): void {\n const k = clamp(scale, this.num('min', 1), this.num('max', 4));\n const b = this.bound(k, this._v.x, this._v.y);\n if (this.reduced) {\n this._v = { k, ...b };\n this.paint();\n } else {\n this._k.set(k);\n this._x.set(b.x);\n this._y.set(b.y);\n }\n this.emit('zoom', { scale: k });\n }\n\n mount(): void {\n const preset = this.str('preset', 'gentle');\n this._k = createSpring({ spring: preset, value: this._v.k, onUpdate: (v) => ((this._v.k = v), this.paint()) });\n this._x = createSpring({ spring: preset, value: this._v.x, onUpdate: (v) => ((this._v.x = v), this.paint()) });\n this._y = createSpring({ spring: preset, value: this._v.y, onUpdate: (v) => ((this._v.y = v), this.paint()) });\n if (!this.hasAttribute('tabindex')) this.tabIndex = 0;\n let base = 1;\n let ox = 0;\n let oy = 0;\n this.onCleanup(\n gesture(this, {\n onPinch: ({ scale, first, last }) => {\n if (first) base = this._v.k;\n const k = clamp(base * scale, this.num('min', 1) * 0.7, this.num('max', 4) * 1.3);\n if (last) return this.zoomTo(k);\n this._k.jump(k);\n },\n onPan: ({ dx, dy, vx, vy, first, last }) => {\n if (this._v.k <= 1.01) return;\n if (first) ((ox = this._v.x), (oy = this._v.y));\n if (!last) {\n this._x.jump(ox + dx);\n this._y.jump(oy + dy);\n return;\n }\n const b = this.bound(this._v.k, ox + dx + vx * 0.15, oy + dy + vy * 0.15);\n this._x.set(b.x, vx);\n this._y.set(b.y, vy);\n },\n onDoubleTap: () => this.zoomTo(this._v.k > 1.01 ? 1 : this.num('double-tap', 2)),\n })\n );\n this.listen(this, 'keydown', (e: KeyboardEvent) => {\n if (e.key === '+' || e.key === '=') this.zoomTo(this._v.k * 1.25);\n else if (e.key === '-') this.zoomTo(this._v.k / 1.25);\n else if (e.key === '0') this.zoomTo(1);\n else return;\n e.preventDefault();\n });\n this.paint();\n }\n\n unmount(): void {\n [this._k, this._x, this._y].forEach((s) => s?.stop());\n }\n },\n { id: 'gesture', text: css }\n );\n}\n","/**\n * use-scroll-animate/components/gesture — unified gestures (v3.2).\n * `gesture()` recognises pan, swipe, pinch, long-press, tap and double-tap\n * with release velocities for springs; `<usa-swipeable>` (swipe-to-dismiss)\n * and `<usa-pinch-zoom>` are built on it.\n */\nimport { defineSwipeable, type UsaSwipeableElement } from './swipeable';\nimport { definePinchZoom, type UsaPinchZoomElement } from './pinch-zoom';\n\nexport { defineSwipeable, definePinchZoom };\nexport { gesture, swipeDirection, pinchScale } from './core';\nexport type { GestureHandlers, GestureOptions, PanState, SwipeState, SwipeDirection, PinchState, PressState } from './core';\nexport type { UsaSwipeableElement, UsaPinchZoomElement };\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 defineGestureComponents(): void {\n defineSwipeable();\n definePinchZoom();\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'usa-swipeable': UsaSwipeableElement;\n 'usa-pinch-zoom': UsaPinchZoomElement;\n }\n}\n"],"names":[],"mappings":";;;;AAyCA;AACM,SAAU,cAAc,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,CAAA,GAAgE,EAAE,EAAA;AAC/I,IAAA,MAAM,IAAI,GAAG,CAAC,CAAC,QAAQ,IAAI,EAAE;AAC7B,IAAA,MAAM,GAAG,GAAG,CAAC,CAAC,QAAQ,IAAI,GAAG;AAC7B,IAAA,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,KAAK,GAAG,KAAK,CAAC,CAAC,IAAI,KAAK,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChF,MAAM,CAAC,GAAG,KAAK,GAAG,EAAE,GAAG,EAAE;IACzB,MAAM,CAAC,GAAG,KAAK,GAAG,EAAE,GAAG,EAAE;AACz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CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;AAChD,qBAAA,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG;AAAE,oBAAA,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;;oBACjC;gBACL,CAAC,CAAC,cAAc,EAAE;AACpB,YAAA,CAAC,CAAC;YACF,IAAI,CAAC,KAAK,EAAE;QACd;QAEA,OAAO,GAAA;YACL,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;QACvD;KACD,EACH,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,CAC7B;AACH;;AC7GA;;;;;AAKG;AAWH;SACgB,uBAAuB,GAAA;AACrC,IAAA,eAAe,EAAE;AACjB,IAAA,eAAe,EAAE;AACnB;;;;"}
|
|
1
|
+
{"version":3,"file":"gesture.js","sources":["../../src/components/gesture/swipeable.ts","../../src/components/gesture/pinch-zoom.ts","../../src/components/gesture/index.ts"],"sourcesContent":["import { defineElement, type UsaElement } from '../base';\nimport { createSpring, type SpringValue } from '../physics/spring';\nimport { gesture, type SwipeDirection } from './core';\nimport css from './gesture.css?raw';\n\n/**\n * `<usa-swipeable>` — swipe-to-dismiss / swipe actions. The content follows\n * the finger (rubber-banded past `distance`), flies out on a swipe or a drag\n * past `distance`, otherwise springs home with the release velocity.\n *\n * Attributes: `axis` (`x` default · `y`), `distance` (px, 120), `preset`\n * (spring), `dismiss` (remove the element after flying out), `disabled`.\n * Keyboard: Delete/Backspace dismisses, ←/→ swipe. Events `usa:swipe`\n * (`{ direction }`, cancelable), `usa:dismiss`. Methods `swipe(dir)`, `reset()`.\n * Reduced motion: no follow / fly-out animation, events still fire.\n */\nexport interface UsaSwipeableElement extends UsaElement {\n swipe(direction: SwipeDirection): void;\n reset(): void;\n readonly offset: number;\n}\n\nexport function defineSwipeable(tag = 'usa-swipeable'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaSwipeable extends Base {\n static get observedAttributes(): string[] {\n return ['axis', 'disabled'];\n }\n private _s!: SpringValue;\n private _off = 0;\n\n get offset(): number {\n return this._off;\n }\n\n private put(v: number): void {\n this._off = v;\n this.style.setProperty('--usa-swipe', `${v}px`);\n this.style.setProperty('--usa-swipe-p', String(Math.min(1, Math.abs(v) / this.num('distance', 120))));\n }\n\n swipe(direction: SwipeDirection): void {\n if (!this.emit('swipe', { direction })) return this.reset();\n const sign = direction === 'left' || direction === 'up' ? -1 : 1;\n const far = sign * ((this.str('axis', 'x') === 'y' ? this.offsetHeight : this.offsetWidth) + 80 || 600);\n const done = () => {\n this.emit('dismiss', { direction });\n if (this.flag('dismiss')) this.remove();\n };\n if (this.reduced) {\n this.put(0);\n return done();\n }\n this.setAttribute('data-gone', '');\n this._s = createSpring({ spring: 'stiff', value: this._off, onUpdate: (v) => this.put(v), onRest: done });\n this._s.set(far, sign * 1500);\n }\n\n reset(): void {\n this.removeAttribute('data-gone');\n if (this.reduced) return this.put(0);\n this._s.set(0);\n }\n\n mount(): void {\n this._s = createSpring({ spring: this.str('preset', 'default'), onUpdate: (v) => this.put(v) });\n if (!this.hasAttribute('tabindex')) this.tabIndex = 0;\n const y = this.str('axis', 'x') === 'y';\n const max = () => this.num('distance', 120);\n this.onCleanup(\n gesture(this, {\n onPan: ({ dx, dy, vx, vy, last }) => {\n if (this.flag('disabled')) return;\n const d = y ? dy : dx;\n if (!last) {\n this._s.stop();\n if (!this.reduced) this.put(Math.abs(d) > max() ? Math.sign(d) * (max() + (Math.abs(d) - max()) * 0.35) : d);\n return;\n }\n if (Math.abs(d) > max()) this.swipe(y ? (d > 0 ? 'down' : 'up') : d > 0 ? 'right' : 'left');\n else if (!this.hasAttribute('data-gone')) {\n if (this.reduced) this.put(0);\n else this._s.set(0, y ? vy : vx);\n }\n },\n onSwipe: ({ direction }) => {\n if (this.flag('disabled') || this.hasAttribute('data-gone')) return;\n if (y === (direction === 'up' || direction === 'down')) this.swipe(direction);\n },\n }, { axis: y ? 'y' : 'x' })\n );\n this.listen(this, 'keydown', (e: KeyboardEvent) => {\n if (this.flag('disabled')) return;\n const map: Record<string, SwipeDirection> = y ? { ArrowUp: 'up', ArrowDown: 'down' } : { ArrowLeft: 'left', ArrowRight: 'right' };\n if (e.key === 'Delete' || e.key === 'Backspace') this.swipe(y ? 'up' : 'left');\n else if (map[e.key]) this.swipe(map[e.key]);\n else return;\n e.preventDefault();\n });\n }\n\n unmount(): void {\n this._s?.stop();\n }\n },\n { id: 'gesture', text: css }\n );\n}\n","import { defineElement, clamp, type UsaElement } from '../base';\nimport { createSpring, type SpringValue } from '../physics/spring';\nimport { gesture } from './core';\nimport css from './gesture.css?raw';\n\n/**\n * `<usa-pinch-zoom>` — pinch (two fingers or Ctrl/⌘ + wheel / trackpad\n * pinch) to zoom its content, pan while zoomed, double-tap to toggle zoom;\n * scale and position spring back inside the bounds on release.\n *\n * Attributes: `min` (1), `max` (4), `double-tap` (zoom level, 2), `preset`.\n * Keyboard: `+` / `-` / `0`. Property `scale`, method `zoomTo(scale)`.\n * Event `usa:zoom` (`{ scale }`). Reduced motion: zoom changes instantly.\n */\nexport interface UsaPinchZoomElement extends UsaElement {\n readonly scale: number;\n zoomTo(scale: number): void;\n}\n\nexport function definePinchZoom(tag = 'usa-pinch-zoom'): CustomElementConstructor | undefined {\n return defineElement(\n tag,\n (Base) =>\n class UsaPinchZoom extends Base {\n private _k!: SpringValue;\n private _x!: SpringValue;\n private _y!: SpringValue;\n private _v = { k: 1, x: 0, y: 0 };\n\n get scale(): number {\n return this._v.k;\n }\n\n private paint(): void {\n const { k, x, y } = this._v;\n this.style.setProperty('--usa-zoom', String(k));\n this.style.setProperty('--usa-zoom-x', `${x}px`);\n this.style.setProperty('--usa-zoom-y', `${y}px`);\n this.toggleAttribute('data-zoomed', k > 1.01);\n }\n\n private bound(k: number, x: number, y: number) {\n const w = (this.clientWidth * (k - 1)) / 2;\n const h = (this.clientHeight * (k - 1)) / 2;\n return { x: clamp(x, -w, w), y: clamp(y, -h, h) };\n }\n\n zoomTo(scale: number): void {\n const k = clamp(scale, this.num('min', 1), this.num('max', 4));\n const b = this.bound(k, this._v.x, this._v.y);\n if (this.reduced) {\n this._v = { k, ...b };\n this.paint();\n } else {\n this._k.set(k);\n this._x.set(b.x);\n this._y.set(b.y);\n }\n this.emit('zoom', { scale: k });\n }\n\n mount(): void {\n const preset = this.str('preset', 'gentle');\n this._k = createSpring({ spring: preset, value: this._v.k, onUpdate: (v) => ((this._v.k = v), this.paint()) });\n this._x = createSpring({ spring: preset, value: this._v.x, onUpdate: (v) => ((this._v.x = v), this.paint()) });\n this._y = createSpring({ spring: preset, value: this._v.y, onUpdate: (v) => ((this._v.y = v), this.paint()) });\n if (!this.hasAttribute('tabindex')) this.tabIndex = 0;\n let base = 1;\n let ox = 0;\n let oy = 0;\n this.onCleanup(\n gesture(this, {\n onPinch: ({ scale, first, last }) => {\n if (first) base = this._v.k;\n const k = clamp(base * scale, this.num('min', 1) * 0.7, this.num('max', 4) * 1.3);\n if (last) return this.zoomTo(k);\n this._k.jump(k);\n },\n onPan: ({ dx, dy, vx, vy, first, last }) => {\n if (this._v.k <= 1.01) return;\n if (first) ((ox = this._v.x), (oy = this._v.y));\n if (!last) {\n this._x.jump(ox + dx);\n this._y.jump(oy + dy);\n return;\n }\n const b = this.bound(this._v.k, ox + dx + vx * 0.15, oy + dy + vy * 0.15);\n this._x.set(b.x, vx);\n this._y.set(b.y, vy);\n },\n onDoubleTap: () => this.zoomTo(this._v.k > 1.01 ? 1 : this.num('double-tap', 2)),\n })\n );\n this.listen(this, 'keydown', (e: KeyboardEvent) => {\n if (e.key === '+' || e.key === '=') this.zoomTo(this._v.k * 1.25);\n else if (e.key === '-') this.zoomTo(this._v.k / 1.25);\n else if (e.key === '0') this.zoomTo(1);\n else return;\n e.preventDefault();\n });\n this.paint();\n }\n\n unmount(): void {\n [this._k, this._x, this._y].forEach((s) => s?.stop());\n }\n },\n { id: 'gesture', text: css }\n );\n}\n","/**\n * use-scroll-animate/components/gesture — unified gestures (v3.2).\n * `gesture()` recognises pan, swipe, pinch, long-press, tap and double-tap\n * with release velocities for springs; `<usa-swipeable>` (swipe-to-dismiss)\n * and `<usa-pinch-zoom>` are built on it.\n */\nimport { defineSwipeable, type UsaSwipeableElement } from './swipeable';\nimport { definePinchZoom, type UsaPinchZoomElement } from './pinch-zoom';\n\nexport { defineSwipeable, definePinchZoom };\nexport { gesture, swipeDirection, pinchScale } from './core';\nexport type { GestureHandlers, GestureOptions, PanState, SwipeState, SwipeDirection, PinchState, PressState } from './core';\nexport type { UsaSwipeableElement, UsaPinchZoomElement };\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 defineGestureComponents(): void {\n defineSwipeable();\n definePinchZoom();\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'usa-swipeable': UsaSwipeableElement;\n 'usa-pinch-zoom': UsaPinchZoomElement;\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAsBM,SAAU,eAAe,CAAC,GAAG,GAAG,eAAe,EAAA;AACnD,IAAA,OAAO,aAAa,CAClB,GAAG,EACH,CAAC,IAAI,KACH,MAAM,YAAa,SAAQ,IAAI,CAAA;AAA/B,QAAA,WAAA,GAAA;;YAKU,IAAA,CAAA,IAAI,GAAG,CAAC;QA2ElB;AA/EE,QAAA,WAAW,kBAAkB,GAAA;AAC3B,YAAA,OAAO,CAAC,MAAM,EAAE,UAAU,CAAC;QAC7B;AAIA,QAAA,IAAI,MAAM,GAAA;YACR,OAAO,IAAI,CAAC,IAAI;QAClB;AAEQ,QAAA,GAAG,CAAC,CAAS,EAAA;AACnB,YAAA,IAAI,CAAC,IAAI,GAAG,CAAC;YACb,IAAI,CAAC,KAAK,CAAC,WA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D,EACH,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,CAC7B;AACH;;AC7GA;;;;;AAKG;AAWH;SACgB,uBAAuB,GAAA;AACrC,IAAA,eAAe,EAAE;AACjB,IAAA,eAAe,EAAE;AACnB;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as defineElement, i as EASE_OUT, r as raf,
|
|
2
|
-
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-
|
|
1
|
+
import { h as defineElement, i as EASE_OUT, r as raf, e as caf, b as clamp, E as EASE_SPRING } from '../chunks/base-BpROOcey.js';
|
|
2
|
+
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-BpROOcey.js';
|
|
3
3
|
|
|
4
4
|
var css$5 = "usa-ripple{position:relative;display:inline-block;overflow:hidden;isolation:isolate;border-radius:inherit;-webkit-tap-highlight-color:transparent}usa-ripple[block]{display:block}usa-ripple .usa-ripple-wave{position:absolute;border-radius:50%;pointer-events:none;transform:scale(0);z-index:-1;will-change:transform,opacity}";
|
|
5
5
|
|
|
@@ -15,6 +15,7 @@ declare const COMPONENT_CATEGORIES: {
|
|
|
15
15
|
readonly gesture: readonly ["usa-swipeable", "usa-pinch-zoom"];
|
|
16
16
|
readonly svg: readonly ["usa-draw", "usa-morph", "usa-mask-reveal", "usa-anim-icon"];
|
|
17
17
|
readonly webgl: readonly ["usa-shader", "usa-distort", "usa-liquid"];
|
|
18
|
+
readonly depth: readonly ["usa-cube", "usa-depth"];
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
/**
|
package/dist/components/jsx.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ declare const COMPONENT_CATEGORIES: {
|
|
|
15
15
|
readonly gesture: readonly ["usa-swipeable", "usa-pinch-zoom"];
|
|
16
16
|
readonly svg: readonly ["usa-draw", "usa-morph", "usa-mask-reveal", "usa-anim-icon"];
|
|
17
17
|
readonly webgl: readonly ["usa-shader", "usa-distort", "usa-liquid"];
|
|
18
|
+
readonly depth: readonly ["usa-cube", "usa-depth"];
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
/**
|
package/dist/components/lazy.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var indexTags = require('../chunks/index-tags-
|
|
3
|
+
var indexTags = require('../chunks/index-tags-CLFrjVR7.cjs');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* use-scroll-animate/components/lazy — lazy, per-category registration (v2.9).
|
|
@@ -31,6 +31,7 @@ const LOADERS = {
|
|
|
31
31
|
gesture: () => Promise.resolve().then(function () { return require('./gesture.cjs'); }),
|
|
32
32
|
svg: () => Promise.resolve().then(function () { return require('./svg.cjs'); }),
|
|
33
33
|
webgl: () => Promise.resolve().then(function () { return require('./webgl.cjs'); }),
|
|
34
|
+
depth: () => Promise.resolve().then(function () { return require('./depth.cjs'); }),
|
|
34
35
|
};
|
|
35
36
|
const TAG_TO_CAT = new Map();
|
|
36
37
|
for (const [cat, tags] of Object.entries(indexTags.COMPONENT_CATEGORIES))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.cjs","sources":["../../src/components/lazy.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/lazy — lazy, per-category registration (v2.9).\n *\n * `lazyDefine()` scans the page (and watches it with a MutationObserver) for\n * `<usa-*>` tags that are not registered yet and dynamically imports only the\n * categories they belong to. Bundlers split each category into its own chunk,\n * so a page that only uses `<usa-button>` loads just the click category.\n *\n * ```js\n * import { lazyDefine } from 'use-scroll-animate/components/lazy';\n * lazyDefine(); // returns a stop() function\n * ```\n */\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from './index-tags';\n\nconst LOADERS: Record<ComponentCategory, () => Promise<Record<string, any>>> = {\n reveal: () => import('./reveal/index'),\n text: () => import('./text/index'),\n interaction: () => import('./interaction/index'),\n feedback: () => import('./feedback/index'),\n background: () => import('./background/index'),\n transitions: () => import('./transitions/index'),\n physics: () => import('./physics/index'),\n cards: () => import('./cards/index'),\n click: () => import('./click/index'),\n ui: () => import('./ui/index'),\n page: () => import('./page/index'),\n timeline: () => import('./timeline/index'),\n gesture: () => import('./gesture/index'),\n svg: () => import('./svg/index'),\n webgl: () => import('./webgl/index'),\n};\n\nconst TAG_TO_CAT = new Map<string, ComponentCategory>();\nfor (const [cat, tags] of Object.entries(COMPONENT_CATEGORIES)) for (const t of tags) TAG_TO_CAT.set(t, cat as ComponentCategory);\nconst loaded = new Map<ComponentCategory, Promise<void>>();\n\n/** Category of a tag (`usa-button` → `click`), or `null`. */\nexport const categoryOfTag = (tag: string): ComponentCategory | null => TAG_TO_CAT.get(tag.toLowerCase()) ?? null;\n\n/** Load and register one category (once). */\nexport function loadCategory(cat: ComponentCategory): Promise<void> {\n let p = loaded.get(cat);\n if (!p) {\n p = LOADERS[cat]().then((m) => {\n const fn = Object.keys(m).find((k) => /^define[A-Z]\\w*Components$/.test(k));\n if (fn) m[fn]();\n });\n loaded.set(cat, p);\n }\n return p;\n}\n\n/** Register the categories needed by the `<usa-*>` tags under `root`. Resolves when they are defined. */\nexport async function defineUsed(root: ParentNode = document): Promise<ComponentCategory[]> {\n if (typeof customElements === 'undefined') return [];\n const cats = new Set<ComponentCategory>();\n const scan = (el: Element) => {\n const c = el.localName.startsWith('usa-') && !customElements.get(el.localName) ? categoryOfTag(el.localName) : null;\n if (c) cats.add(c);\n };\n if ((root as Element).localName) scan(root as Element);\n root.querySelectorAll('*').forEach(scan);\n await Promise.all([...cats].map(loadCategory));\n return [...cats];\n}\n\n/** `defineUsed()` now and whenever new `<usa-*>` elements are added. Returns a stop function. */\nexport function lazyDefine(root: ParentNode = typeof document !== 'undefined' ? document : (undefined as any)): () => void {\n if (!root || typeof MutationObserver === 'undefined') return () => undefined;\n defineUsed(root);\n const mo = new MutationObserver((records) => {\n for (const r of records) r.addedNodes.forEach((n) => n.nodeType === 1 && defineUsed(n as Element));\n });\n mo.observe(root as Node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AAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AAC9C,IAAA,OAAO,CAAC,GAAG,IAAI,CAAC;AAClB;AAEA;AACM,SAAU,UAAU,CAAC,IAAA,GAAmB,OAAO,QAAQ,KAAK,WAAW,GAAG,QAAQ,GAAI,SAAiB,EAAA;AAC3G,IAAA,IAAI,CAAC,IAAI,IAAI,OAAO,gBAAgB,KAAK,WAAW;AAAE,QAAA,OAAO,MAAM,SAAS;IAC5E,UAAU,CAAC,IAAI,CAAC;IAChB,MAAM,EAAE,GAAG,IAAI,gBAAgB,CAAC,CAAC,OAAO,KAAI;QAC1C,KAAK,MAAM,CAAC,IAAI,OAAO;YAAE,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,KAAK,CAAC,IAAI,UAAU,CAAC,CAAY,CAAC,CAAC;AACpG,IAAA,CAAC,CAAC;AACF,IAAA,EAAE,CAAC,OAAO,CAAC,IAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC5D,IAAA,OAAO,MAAM,EAAE,CAAC,UAAU,EAAE;AAC9B;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"lazy.cjs","sources":["../../src/components/lazy.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/lazy — lazy, per-category registration (v2.9).\n *\n * `lazyDefine()` scans the page (and watches it with a MutationObserver) for\n * `<usa-*>` tags that are not registered yet and dynamically imports only the\n * categories they belong to. Bundlers split each category into its own chunk,\n * so a page that only uses `<usa-button>` loads just the click category.\n *\n * ```js\n * import { lazyDefine } from 'use-scroll-animate/components/lazy';\n * lazyDefine(); // returns a stop() function\n * ```\n */\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from './index-tags';\n\nconst LOADERS: Record<ComponentCategory, () => Promise<Record<string, any>>> = {\n reveal: () => import('./reveal/index'),\n text: () => import('./text/index'),\n interaction: () => import('./interaction/index'),\n feedback: () => import('./feedback/index'),\n background: () => import('./background/index'),\n transitions: () => import('./transitions/index'),\n physics: () => import('./physics/index'),\n cards: () => import('./cards/index'),\n click: () => import('./click/index'),\n ui: () => import('./ui/index'),\n page: () => import('./page/index'),\n timeline: () => import('./timeline/index'),\n gesture: () => import('./gesture/index'),\n svg: () => import('./svg/index'),\n webgl: () => import('./webgl/index'),\n depth: () => import('./depth/index'),\n};\n\nconst TAG_TO_CAT = new Map<string, ComponentCategory>();\nfor (const [cat, tags] of Object.entries(COMPONENT_CATEGORIES)) for (const t of tags) TAG_TO_CAT.set(t, cat as ComponentCategory);\nconst loaded = new Map<ComponentCategory, Promise<void>>();\n\n/** Category of a tag (`usa-button` → `click`), or `null`. */\nexport const categoryOfTag = (tag: string): ComponentCategory | null => TAG_TO_CAT.get(tag.toLowerCase()) ?? null;\n\n/** Load and register one category (once). */\nexport function loadCategory(cat: ComponentCategory): Promise<void> {\n let p = loaded.get(cat);\n if (!p) {\n p = LOADERS[cat]().then((m) => {\n const fn = Object.keys(m).find((k) => /^define[A-Z]\\w*Components$/.test(k));\n if (fn) m[fn]();\n });\n loaded.set(cat, p);\n }\n return p;\n}\n\n/** Register the categories needed by the `<usa-*>` tags under `root`. Resolves when they are defined. */\nexport async function defineUsed(root: ParentNode = document): Promise<ComponentCategory[]> {\n if (typeof customElements === 'undefined') return [];\n const cats = new Set<ComponentCategory>();\n const scan = (el: Element) => {\n const c = el.localName.startsWith('usa-') && !customElements.get(el.localName) ? categoryOfTag(el.localName) : null;\n if (c) cats.add(c);\n };\n if ((root as Element).localName) scan(root as Element);\n root.querySelectorAll('*').forEach(scan);\n await Promise.all([...cats].map(loadCategory));\n return [...cats];\n}\n\n/** `defineUsed()` now and whenever new `<usa-*>` elements are added. Returns a stop function. */\nexport function lazyDefine(root: ParentNode = typeof document !== 'undefined' ? document : (undefined as any)): () => void {\n if (!root || typeof MutationObserver === 'undefined') return () => undefined;\n defineUsed(root);\n const mo = new MutationObserver((records) => {\n for (const r of records) r.addedNodes.forEach((n) => n.nodeType === 1 && defineUsed(n as Element));\n });\n mo.observe(root as Node, { childList: true, subtree: true });\n return () => mo.disconnect();\n}\n"],"names":["COMPONENT_CATEGORIES"],"mappings":";;;;AAAA;;;;;;;;;;;;AAYG;AAGH,MAAM,OAAO,GAAkE;AAC7E,IAAA,MAAM,EAAE,MAAM,oDAAO,cAAgB,KAAC;AACtC,IAAA,IAAI,EAAE,MAAM,oDAAO,YAAc,KAAC;AAClC,IAAA,WAAW,EAAE,MAAM,oDAAO,mBAAqB,KAAC;AAChD,IAAA,QAAQ,EAAE,MAAM,oDAAO,gBAAkB,KAAC;AAC1C,IAAA,UAAU,EAAE,MAAM,oDAAO,kBAAoB,KAAC;AAC9C,IAAA,WAAW,EAAE,MAAM,oDAAO,mBAAqB,KAAC;AAChD,IAAA,OAAO,EAAE,MAAM,oDAAO,eAAiB,KAAC;AACxC,IAAA,KAAK,EAAE,MAAM,oDAAO,aAAe,KAAC;AACpC,IAAA,KAAK,EAAE,MAAM,oDAAO,aAAe,KAAC;AACpC,IAAA,EAAE,EAAE,MAAM,oDAAO,UAAY,KAAC;AAC9B,IAAA,IAAI,EAAE,MAAM,oDAAO,YAAc,KAAC;AAClC,IAAA,QAAQ,EAAE,MAAM,oDAAO,gBAAkB,KAAC;AAC1C,IAAA,OAAO,EAAE,MAAM,oDAAO,eAAiB,KAAC;AACxC,IAAA,GAAG,EAAE,MAAM,oDAAO,WAAa,KAAC;AAChC,IAAA,KAAK,EAAE,MAAM,oDAAO,aAAe,KAAC;AACpC,IAAA,KAAK,EAAE,MAAM,oDAAO,aAAe,KAAC;CACrC;AAED,MAAM,UAAU,GAAG,IAAI,GAAG,EAA6B;AACvD,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAACA,8BAAoB,CAAC;IAAE,KAAK,MAAM,CAAC,IAAI,IAAI;AAAE,QAAA,UAA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C;IACD,IAAK,IAAgB,CAAC,SAAS;QAAE,IAAI,CAAC,IAAe,CAAC;IACtD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;AACxC,IAAA,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AAC9C,IAAA,OAAO,CAAC,GAAG,IAAI,CAAC;AAClB;AAEA;AACM,SAAU,UAAU,CAAC,IAAA,GAAmB,OAAO,QAAQ,KAAK,WAAW,GAAG,QAAQ,GAAI,SAAiB,EAAA;AAC3G,IAAA,IAAI,CAAC,IAAI,IAAI,OAAO,gBAAgB,KAAK,WAAW;AAAE,QAAA,OAAO,MAAM,SAAS;IAC5E,UAAU,CAAC,IAAI,CAAC;IAChB,MAAM,EAAE,GAAG,IAAI,gBAAgB,CAAC,CAAC,OAAO,KAAI;QAC1C,KAAK,MAAM,CAAC,IAAI,OAAO;YAAE,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,KAAK,CAAC,IAAI,UAAU,CAAC,CAAY,CAAC,CAAC;AACpG,IAAA,CAAC,CAAC;AACF,IAAA,EAAE,CAAC,OAAO,CAAC,IAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC5D,IAAA,OAAO,MAAM,EAAE,CAAC,UAAU,EAAE;AAC9B;;;;;;;"}
|
|
@@ -15,6 +15,7 @@ declare const COMPONENT_CATEGORIES: {
|
|
|
15
15
|
readonly gesture: readonly ["usa-swipeable", "usa-pinch-zoom"];
|
|
16
16
|
readonly svg: readonly ["usa-draw", "usa-morph", "usa-mask-reveal", "usa-anim-icon"];
|
|
17
17
|
readonly webgl: readonly ["usa-shader", "usa-distort", "usa-liquid"];
|
|
18
|
+
readonly depth: readonly ["usa-cube", "usa-depth"];
|
|
18
19
|
};
|
|
19
20
|
type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
|
|
20
21
|
|
|
@@ -15,6 +15,7 @@ declare const COMPONENT_CATEGORIES: {
|
|
|
15
15
|
readonly gesture: readonly ["usa-swipeable", "usa-pinch-zoom"];
|
|
16
16
|
readonly svg: readonly ["usa-draw", "usa-morph", "usa-mask-reveal", "usa-anim-icon"];
|
|
17
17
|
readonly webgl: readonly ["usa-shader", "usa-distort", "usa-liquid"];
|
|
18
|
+
readonly depth: readonly ["usa-cube", "usa-depth"];
|
|
18
19
|
};
|
|
19
20
|
type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
|
|
20
21
|
|
package/dist/components/lazy.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as COMPONENT_CATEGORIES } from '../chunks/index-tags-
|
|
1
|
+
import { C as COMPONENT_CATEGORIES } from '../chunks/index-tags-uw1Fospg.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* use-scroll-animate/components/lazy — lazy, per-category registration (v2.9).
|
|
@@ -29,6 +29,7 @@ const LOADERS = {
|
|
|
29
29
|
gesture: () => import('./gesture.js'),
|
|
30
30
|
svg: () => import('./svg.js'),
|
|
31
31
|
webgl: () => import('./webgl.js'),
|
|
32
|
+
depth: () => import('./depth.js'),
|
|
32
33
|
};
|
|
33
34
|
const TAG_TO_CAT = new Map();
|
|
34
35
|
for (const [cat, tags] of Object.entries(COMPONENT_CATEGORIES))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.js","sources":["../../src/components/lazy.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/lazy — lazy, per-category registration (v2.9).\n *\n * `lazyDefine()` scans the page (and watches it with a MutationObserver) for\n * `<usa-*>` tags that are not registered yet and dynamically imports only the\n * categories they belong to. Bundlers split each category into its own chunk,\n * so a page that only uses `<usa-button>` loads just the click category.\n *\n * ```js\n * import { lazyDefine } from 'use-scroll-animate/components/lazy';\n * lazyDefine(); // returns a stop() function\n * ```\n */\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from './index-tags';\n\nconst LOADERS: Record<ComponentCategory, () => Promise<Record<string, any>>> = {\n reveal: () => import('./reveal/index'),\n text: () => import('./text/index'),\n interaction: () => import('./interaction/index'),\n feedback: () => import('./feedback/index'),\n background: () => import('./background/index'),\n transitions: () => import('./transitions/index'),\n physics: () => import('./physics/index'),\n cards: () => import('./cards/index'),\n click: () => import('./click/index'),\n ui: () => import('./ui/index'),\n page: () => import('./page/index'),\n timeline: () => import('./timeline/index'),\n gesture: () => import('./gesture/index'),\n svg: () => import('./svg/index'),\n webgl: () => import('./webgl/index'),\n};\n\nconst TAG_TO_CAT = new Map<string, ComponentCategory>();\nfor (const [cat, tags] of Object.entries(COMPONENT_CATEGORIES)) for (const t of tags) TAG_TO_CAT.set(t, cat as ComponentCategory);\nconst loaded = new Map<ComponentCategory, Promise<void>>();\n\n/** Category of a tag (`usa-button` → `click`), or `null`. */\nexport const categoryOfTag = (tag: string): ComponentCategory | null => TAG_TO_CAT.get(tag.toLowerCase()) ?? null;\n\n/** Load and register one category (once). */\nexport function loadCategory(cat: ComponentCategory): Promise<void> {\n let p = loaded.get(cat);\n if (!p) {\n p = LOADERS[cat]().then((m) => {\n const fn = Object.keys(m).find((k) => /^define[A-Z]\\w*Components$/.test(k));\n if (fn) m[fn]();\n });\n loaded.set(cat, p);\n }\n return p;\n}\n\n/** Register the categories needed by the `<usa-*>` tags under `root`. Resolves when they are defined. */\nexport async function defineUsed(root: ParentNode = document): Promise<ComponentCategory[]> {\n if (typeof customElements === 'undefined') return [];\n const cats = new Set<ComponentCategory>();\n const scan = (el: Element) => {\n const c = el.localName.startsWith('usa-') && !customElements.get(el.localName) ? categoryOfTag(el.localName) : null;\n if (c) cats.add(c);\n };\n if ((root as Element).localName) scan(root as Element);\n root.querySelectorAll('*').forEach(scan);\n await Promise.all([...cats].map(loadCategory));\n return [...cats];\n}\n\n/** `defineUsed()` now and whenever new `<usa-*>` elements are added. Returns a stop function. */\nexport function lazyDefine(root: ParentNode = typeof document !== 'undefined' ? document : (undefined as any)): () => void {\n if (!root || typeof MutationObserver === 'undefined') return () => undefined;\n defineUsed(root);\n const mo = new MutationObserver((records) => {\n for (const r of records) r.addedNodes.forEach((n) => n.nodeType === 1 && defineUsed(n as Element));\n });\n mo.observe(root as Node, { childList: true, subtree: true });\n return () => mo.disconnect();\n}\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;AAYG;AAGH,MAAM,OAAO,GAAkE;AAC7E,IAAA,MAAM,EAAE,MAAM,OAAO,aAAgB,CAAC;AACtC,IAAA,IAAI,EAAE,MAAM,OAAO,WAAc,CAAC;AAClC,IAAA,WAAW,EAAE,MAAM,OAAO,kBAAqB,CAAC;AAChD,IAAA,QAAQ,EAAE,MAAM,OAAO,eAAkB,CAAC;AAC1C,IAAA,UAAU,EAAE,MAAM,OAAO,iBAAoB,CAAC;AAC9C,IAAA,WAAW,EAAE,MAAM,OAAO,kBAAqB,CAAC;AAChD,IAAA,OAAO,EAAE,MAAM,OAAO,cAAiB,CAAC;AACxC,IAAA,KAAK,EAAE,MAAM,OAAO,YAAe,CAAC;AACpC,IAAA,KAAK,EAAE,MAAM,OAAO,YAAe,CAAC;AACpC,IAAA,EAAE,EAAE,MAAM,OAAO,SAAY,CAAC;AAC9B,IAAA,IAAI,EAAE,MAAM,OAAO,WAAc,CAAC;AAClC,IAAA,QAAQ,EAAE,MAAM,OAAO,eAAkB,CAAC;AAC1C,IAAA,OAAO,EAAE,MAAM,OAAO,cAAiB,CAAC;AACxC,IAAA,GAAG,EAAE,MAAM,OAAO,UAAa,CAAC;AAChC,IAAA,KAAK,EAAE,MAAM,OAAO,YAAe,CAAC;CACrC;AAED,MAAM,UAAU,GAAG,IAAI,GAAG,EAA6B;AACvD,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC;IAAE,KAAK,MAAM,CAAC,IAAI,I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AAC;AACpB,IAAA,CAAC;IACD,IAAK,IAAgB,CAAC,SAAS;QAAE,IAAI,CAAC,IAAe,CAAC;IACtD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;AACxC,IAAA,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AAC9C,IAAA,OAAO,CAAC,GAAG,IAAI,CAAC;AAClB;AAEA;AACM,SAAU,UAAU,CAAC,IAAA,GAAmB,OAAO,QAAQ,KAAK,WAAW,GAAG,QAAQ,GAAI,SAAiB,EAAA;AAC3G,IAAA,IAAI,CAAC,IAAI,IAAI,OAAO,gBAAgB,KAAK,WAAW;AAAE,QAAA,OAAO,MAAM,SAAS;IAC5E,UAAU,CAAC,IAAI,CAAC;IAChB,MAAM,EAAE,GAAG,IAAI,gBAAgB,CAAC,CAAC,OAAO,KAAI;QAC1C,KAAK,MAAM,CAAC,IAAI,OAAO;YAAE,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,KAAK,CAAC,IAAI,UAAU,CAAC,CAAY,CAAC,CAAC;AACpG,IAAA,CAAC,CAAC;AACF,IAAA,EAAE,CAAC,OAAO,CAAC,IAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC5D,IAAA,OAAO,MAAM,EAAE,CAAC,UAAU,EAAE;AAC9B;;;;"}
|
|
1
|
+
{"version":3,"file":"lazy.js","sources":["../../src/components/lazy.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/lazy — lazy, per-category registration (v2.9).\n *\n * `lazyDefine()` scans the page (and watches it with a MutationObserver) for\n * `<usa-*>` tags that are not registered yet and dynamically imports only the\n * categories they belong to. Bundlers split each category into its own chunk,\n * so a page that only uses `<usa-button>` loads just the click category.\n *\n * ```js\n * import { lazyDefine } from 'use-scroll-animate/components/lazy';\n * lazyDefine(); // returns a stop() function\n * ```\n */\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from './index-tags';\n\nconst LOADERS: Record<ComponentCategory, () => Promise<Record<string, any>>> = {\n reveal: () => import('./reveal/index'),\n text: () => import('./text/index'),\n interaction: () => import('./interaction/index'),\n feedback: () => import('./feedback/index'),\n background: () => import('./background/index'),\n transitions: () => import('./transitions/index'),\n physics: () => import('./physics/index'),\n cards: () => import('./cards/index'),\n click: () => import('./click/index'),\n ui: () => import('./ui/index'),\n page: () => import('./page/index'),\n timeline: () => import('./timeline/index'),\n gesture: () => import('./gesture/index'),\n svg: () => import('./svg/index'),\n webgl: () => import('./webgl/index'),\n depth: () => import('./depth/index'),\n};\n\nconst TAG_TO_CAT = new Map<string, ComponentCategory>();\nfor (const [cat, tags] of Object.entries(COMPONENT_CATEGORIES)) for (const t of tags) TAG_TO_CAT.set(t, cat as ComponentCategory);\nconst loaded = new Map<ComponentCategory, Promise<void>>();\n\n/** Category of a tag (`usa-button` → `click`), or `null`. */\nexport const categoryOfTag = (tag: string): ComponentCategory | null => TAG_TO_CAT.get(tag.toLowerCase()) ?? null;\n\n/** Load and register one category (once). */\nexport function loadCategory(cat: ComponentCategory): Promise<void> {\n let p = loaded.get(cat);\n if (!p) {\n p = LOADERS[cat]().then((m) => {\n const fn = Object.keys(m).find((k) => /^define[A-Z]\\w*Components$/.test(k));\n if (fn) m[fn]();\n });\n loaded.set(cat, p);\n }\n return p;\n}\n\n/** Register the categories needed by the `<usa-*>` tags under `root`. Resolves when they are defined. */\nexport async function defineUsed(root: ParentNode = document): Promise<ComponentCategory[]> {\n if (typeof customElements === 'undefined') return [];\n const cats = new Set<ComponentCategory>();\n const scan = (el: Element) => {\n const c = el.localName.startsWith('usa-') && !customElements.get(el.localName) ? categoryOfTag(el.localName) : null;\n if (c) cats.add(c);\n };\n if ((root as Element).localName) scan(root as Element);\n root.querySelectorAll('*').forEach(scan);\n await Promise.all([...cats].map(loadCategory));\n return [...cats];\n}\n\n/** `defineUsed()` now and whenever new `<usa-*>` elements are added. Returns a stop function. */\nexport function lazyDefine(root: ParentNode = typeof document !== 'undefined' ? document : (undefined as any)): () => void {\n if (!root || typeof MutationObserver === 'undefined') return () => undefined;\n defineUsed(root);\n const mo = new MutationObserver((records) => {\n for (const r of records) r.addedNodes.forEach((n) => n.nodeType === 1 && defineUsed(n as Element));\n });\n mo.observe(root as Node, { childList: true, subtree: true });\n return () => mo.disconnect();\n}\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;AAYG;AAGH,MAAM,OAAO,GAAkE;AAC7E,IAAA,MAAM,EAAE,MAAM,OAAO,aAAgB,CAAC;AACtC,IAAA,IAAI,EAAE,MAAM,OAAO,WAAc,CAAC;AAClC,IAAA,WAAW,EAAE,MAAM,OAAO,kBAAqB,CAAC;AAChD,IAAA,QAAQ,EAAE,MAAM,OAAO,eAAkB,CAAC;AAC1C,IAAA,UAAU,EAAE,MAAM,OAAO,iBAAoB,CAAC;AAC9C,IAAA,WAAW,EAAE,MAAM,OAAO,kBAAqB,CAAC;AAChD,IAAA,OAAO,EAAE,MAAM,OAAO,cAAiB,CAAC;AACxC,IAAA,KAAK,EAAE,MAAM,OAAO,YAAe,CAAC;AACpC,IAAA,KAAK,EAAE,MAAM,OAAO,YAAe,CAAC;AACpC,IAAA,EAAE,EAAE,MAAM,OAAO,SAAY,CAAC;AAC9B,IAAA,IAAI,EAAE,MAAM,OAAO,WAAc,CAAC;AAClC,IAAA,QAAQ,EAAE,MAAM,OAAO,eAAkB,CAAC;AAC1C,IAAA,OAAO,EAAE,MAAM,OAAO,cAAiB,CAAC;AACxC,IAAA,GAAG,EAAE,MAAM,OAAO,UAAa,CAAC;AAChC,IAAA,KAAK,EAAE,MAAM,OAAO,YAAe,CAAC;AACpC,IAAA,KAAK,EAAE,MAAM,OAAO,YAAe,CAAC;CACrC;AAED,MAAM,UAAU,GAAG,IAAI,GAAG,EAA6B;AACvD,KAAK,MAAM,CAA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AAE,CAAC,SAAS,CAAC,GAAG,IAAI;AACnH,QAAA,IAAI,CAAC;AAAE,YAAA,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACpB,IAAA,CAAC;IACD,IAAK,IAAgB,CAAC,SAAS;QAAE,IAAI,CAAC,IAAe,CAAC;IACtD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;AACxC,IAAA,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AAC9C,IAAA,OAAO,CAAC,GAAG,IAAI,CAAC;AAClB;AAEA;AACM,SAAU,UAAU,CAAC,IAAA,GAAmB,OAAO,QAAQ,KAAK,WAAW,GAAG,QAAQ,GAAI,SAAiB,EAAA;AAC3G,IAAA,IAAI,CAAC,IAAI,IAAI,OAAO,gBAAgB,KAAK,WAAW;AAAE,QAAA,OAAO,MAAM,SAAS;IAC5E,UAAU,CAAC,IAAI,CAAC;IAChB,MAAM,EAAE,GAAG,IAAI,gBAAgB,CAAC,CAAC,OAAO,KAAI;QAC1C,KAAK,MAAM,CAAC,IAAI,OAAO;YAAE,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,KAAK,CAAC,IAAI,UAAU,CAAC,CAAY,CAAC,CAAC;AACpG,IAAA,CAAC,CAAC;AACF,IAAA,EAAE,CAAC,OAAO,CAAC,IAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC5D,IAAA,OAAO,MAAM,EAAE,CAAC,UAAU,EAAE;AAC9B;;;;"}
|
package/dist/components/page.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { h as defineElement,
|
|
2
|
-
export { M as MOTION_SCALE } from '../chunks/base-
|
|
3
|
-
import { e as springSamples } from '../chunks/spring-
|
|
1
|
+
import { h as defineElement, e as caf, r as raf, p as prefersReducedMotion, n as now, g as getMotionIntensity, a as configureComponents, f as adoptStyles } from '../chunks/base-BpROOcey.js';
|
|
2
|
+
export { M as MOTION_SCALE } from '../chunks/base-BpROOcey.js';
|
|
3
|
+
import { e as springSamples } from '../chunks/spring-C-fw7_9f.js';
|
|
4
4
|
|
|
5
5
|
var css$8 = "usa-cursor{--usa-cursor-color:var(--usa-accent,#7c5cff);--usa-cursor-size:28px;position:fixed;inset:0;pointer-events:none;z-index:2147483600;opacity:0;transition:opacity 0.2s ease;contain:strict}usa-cursor[data-active]{opacity:1}usa-cursor .usa-cursor-ring{position:absolute;left:0;top:0;width:var(--usa-cursor-size);height:var(--usa-cursor-size);margin:calc(var(--usa-cursor-size) / -2) 0 0 calc(var(--usa-cursor-size) / -2);border:1.5px solid var(--usa-cursor-color);border-radius:999px;box-sizing:border-box;transition:width 0.25s cubic-bezier(0.34,1.56,0.64,1),height 0.25s cubic-bezier(0.34,1.56,0.64,1),margin 0.25s ease,border-radius 0.25s ease,background-color 0.2s ease;will-change:transform}usa-cursor[mode=\"trail\"] .usa-cursor-ring{border:0;background:var(--usa-cursor-color);width:calc(var(--usa-cursor-size) * (0.45 - var(--i) * 0.04));height:calc(var(--usa-cursor-size) * (0.45 - var(--i) * 0.04));margin:calc(var(--usa-cursor-size) * (0.45 - var(--i) * 0.04) / -2) 0 0 calc(var(--usa-cursor-size) * (0.45 - var(--i) * 0.04) / -2);opacity:calc(1 - var(--i) * 0.11)}usa-cursor[data-hover] .usa-cursor-ring:first-child{width:calc(var(--usa-cursor-size) * 1.6);height:calc(var(--usa-cursor-size) * 1.6);margin:calc(var(--usa-cursor-size) * -0.8) 0 0 calc(var(--usa-cursor-size) * -0.8);background:color-mix(in srgb,var(--usa-cursor-color) 15%,transparent)}usa-cursor[data-snapped] .usa-cursor-ring{border-radius:12px;background:color-mix(in srgb,var(--usa-cursor-color) 12%,transparent);translate:-50% -50%;margin:0}usa-cursor[data-down] .usa-cursor-ring:first-child{scale:0.8}usa-cursor .usa-cursor-dot{position:absolute;left:-3px;top:-3px;width:6px;height:6px;border-radius:50%;background:var(--usa-cursor-color)}usa-cursor[data-snapped] .usa-cursor-dot{opacity:0}usa-cursor .usa-cursor-glow{position:absolute;left:-200px;top:-200px;width:400px;height:400px;border-radius:50%;background:radial-gradient(circle,color-mix(in srgb,var(--usa-cursor-color) 35%,transparent),transparent 65%);mix-blend-mode:screen}.usa-cursor-none,.usa-cursor-none *{cursor:none !important}@media (pointer:coarse),(prefers-reduced-motion:reduce){usa-cursor{display:none}.usa-cursor-none,.usa-cursor-none *{cursor:auto !important}}";
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { h as defineElement,
|
|
2
|
-
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-
|
|
3
|
-
import { d as springEasing, c as createSpring, s as snapTo, a as rubberBand, p as projectInertia } from '../chunks/spring-
|
|
4
|
-
export { S as SPRING_PRESETS, l as linearEasing, r as resolveSpring, b as spring, e as springSamples, f as stepSpring, g as supportsLinearEasing } from '../chunks/spring-
|
|
1
|
+
import { h as defineElement, b as clamp } from '../chunks/base-BpROOcey.js';
|
|
2
|
+
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-BpROOcey.js';
|
|
3
|
+
import { d as springEasing, c as createSpring, s as snapTo, a as rubberBand, p as projectInertia } from '../chunks/spring-C-fw7_9f.js';
|
|
4
|
+
export { S as SPRING_PRESETS, l as linearEasing, r as resolveSpring, b as spring, e as springSamples, f as stepSpring, g as supportsLinearEasing } from '../chunks/spring-C-fw7_9f.js';
|
|
5
5
|
|
|
6
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}";
|
|
7
7
|
|
package/dist/components/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as defineElement, i as EASE_OUT,
|
|
2
|
-
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-
|
|
1
|
+
import { h as defineElement, i as EASE_OUT, b as clamp, e as caf, r as raf } from '../chunks/base-BpROOcey.js';
|
|
2
|
+
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-BpROOcey.js';
|
|
3
3
|
|
|
4
4
|
/** Entrance effects shared by `<usa-reveal>` and `<usa-stagger>` (transform / opacity / filter only). */
|
|
5
5
|
const REVEAL_EFFECTS = [
|
package/dist/components/svg.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { a as configureComponents } from '../chunks/base-
|
|
1
|
+
import { b as clamp, m as motionScale, e as caf, p as prefersReducedMotion, n as now, r as raf, h as defineElement, i as EASE_OUT } from '../chunks/base-BpROOcey.js';
|
|
2
|
+
export { a as configureComponents } from '../chunks/base-BpROOcey.js';
|
|
3
3
|
|
|
4
4
|
const NUM = /-?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?/gi;
|
|
5
5
|
/** `true` when two path strings share the same commands (so their numbers can be interpolated). */
|
package/dist/components/text.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as defineElement, j as srText,
|
|
2
|
-
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-
|
|
1
|
+
import { h as defineElement, j as srText, e as caf, n as now, r as raf, i as EASE_OUT, E as EASE_SPRING, b as clamp } from '../chunks/base-BpROOcey.js';
|
|
2
|
+
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-BpROOcey.js';
|
|
3
3
|
|
|
4
4
|
var css$5 = "usa-typewriter{white-space:pre-wrap}usa-typewriter .usa-tw-caret{display:inline-block;width:var(--usa-caret-width,0.08em);height:1.05em;margin-left:0.06em;vertical-align:-0.12em;background:var(--usa-caret-color,currentColor);animation:usa-caret 1.06s steps(1) infinite}usa-typewriter[data-typing] .usa-tw-caret{animation:none}usa-typewriter[data-no-cursor] .usa-tw-caret{display:none}@keyframes usa-caret{50%{opacity:0}}@media (prefers-reduced-motion:reduce){usa-typewriter .usa-tw-caret,usa-shimmer-text{animation:none}}";
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as prefersReducedMotion,
|
|
2
|
-
export { a as configureComponents } from '../chunks/base-
|
|
1
|
+
import { p as prefersReducedMotion, e as caf, b as clamp, d as applyFrame, r as raf, m as motionScale, n as now, h as defineElement } from '../chunks/base-BpROOcey.js';
|
|
2
|
+
export { a as configureComponents } from '../chunks/base-BpROOcey.js';
|
|
3
3
|
|
|
4
4
|
/** Keyframe presets usable by name in `to()` and `data-tl`. */
|
|
5
5
|
const TIMELINE_PRESETS = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as defineElement, k as kindOf, s as shadowStyles, i as EASE_OUT, F as FLUENT_DECELERATE, p as prefersReducedMotion } from '../chunks/base-
|
|
2
|
-
export { a as configureComponents } from '../chunks/base-
|
|
1
|
+
import { h as defineElement, k as kindOf, s as shadowStyles, i as EASE_OUT, F as FLUENT_DECELERATE, p as prefersReducedMotion } from '../chunks/base-BpROOcey.js';
|
|
2
|
+
export { a as configureComponents } from '../chunks/base-BpROOcey.js';
|
|
3
3
|
|
|
4
4
|
var shadowCss = ":host{display:contents}dialog{position:fixed;inset:0;width:100%;height:100%;max-width:none;max-height:none;margin:0;padding:0;border:0;background:transparent;color:inherit;overflow:hidden}dialog:not([open]){display:none}dialog::backdrop{background:transparent}[part=\"backdrop\"]{position:absolute;inset:0;background:var(--usa-dialog-backdrop,rgb(0 0 0 / 0.42))}[part=\"panel\"]{position:absolute;left:50%;top:50%;translate:-50% -50%;box-sizing:border-box;width:min(var(--usa-dialog-width,480px),calc(100vw - 32px));max-height:calc(100vh - 32px);overflow:auto;padding:var(--usa-dialog-padding,24px);border-radius:var(--usa-dialog-radius,12px);background:var(--usa-dialog-bg,Canvas);color:var(--usa-dialog-fg,CanvasText);box-shadow:0 32px 64px -12px rgb(0 0 0 / 0.45),0 0 0 1px rgb(127 127 127 / 0.18)}dialog[data-kind^=\"drawer\"] [part=\"panel\"]{top:0;bottom:0;translate:none;max-height:none;height:100%;border-radius:0;width:min(var(--usa-dialog-width,380px),88vw)}dialog[data-kind=\"drawer-start\"] [part=\"panel\"]{left:0}dialog[data-kind=\"drawer-end\"] [part=\"panel\"]{left:auto;right:0}dialog[data-kind=\"drawer-bottom\"] [part=\"panel\"],dialog[data-kind=\"sheet\"] [part=\"panel\"]{top:auto;bottom:0;left:0;right:0;translate:none;width:100%;height:auto;max-height:85vh;border-radius:var(--usa-dialog-radius,16px) var(--usa-dialog-radius,16px) 0 0}dialog[data-kind=\"sheet\"] [part=\"panel\"]{left:50%;translate:-50% 0;width:min(var(--usa-dialog-width,560px),100vw)}";
|
|
5
5
|
|
package/dist/components/ui.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { h as defineElement,
|
|
2
|
-
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-
|
|
3
|
-
import { d as springEasing, c as createSpring, p as projectInertia, s as snapTo, a as rubberBand } from '../chunks/spring-
|
|
4
|
-
import { a as adoptVariants } from '../chunks/variants-
|
|
5
|
-
export { V as VARIANTS, s as setVariant } from '../chunks/variants-
|
|
1
|
+
import { h as defineElement, b as clamp, e as caf, r as raf } from '../chunks/base-BpROOcey.js';
|
|
2
|
+
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-BpROOcey.js';
|
|
3
|
+
import { d as springEasing, c as createSpring, p as projectInertia, s as snapTo, a as rubberBand } from '../chunks/spring-C-fw7_9f.js';
|
|
4
|
+
import { a as adoptVariants } from '../chunks/variants-CHe1VbSn.js';
|
|
5
|
+
export { V as VARIANTS, s as setVariant } from '../chunks/variants-CHe1VbSn.js';
|
|
6
6
|
|
|
7
7
|
/** Position a fixed `floating` element next to `anchor`, flipping when it would leave the viewport. */
|
|
8
8
|
function place(floating, anchor, placement = 'top', gap = 8) {
|
package/dist/components/vue.cjs
CHANGED
|
@@ -17,9 +17,11 @@ require('./ui.cjs');
|
|
|
17
17
|
require('./page.cjs');
|
|
18
18
|
require('./timeline.cjs');
|
|
19
19
|
require('./gesture.cjs');
|
|
20
|
+
require('../chunks/core-IaorbTdu.cjs');
|
|
20
21
|
require('./svg.cjs');
|
|
21
22
|
require('./webgl.cjs');
|
|
22
|
-
require('
|
|
23
|
+
require('./depth.cjs');
|
|
24
|
+
require('../chunks/index-tags-CLFrjVR7.cjs');
|
|
23
25
|
|
|
24
26
|
/**
|
|
25
27
|
* use-scroll-animate/components/vue — Vue integration (v2.9).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue.cjs","sources":["../../src/components/frameworks/vue.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/vue — Vue integration (v2.9).\n *\n * ```js\n * // vite.config.js\n * import vue from '@vitejs/plugin-vue';\n * import { isUsaElement } from 'use-scroll-animate/components/vue';\n * export default { plugins: [vue({ template: { compilerOptions: { isCustomElement: isUsaElement } } })] };\n *\n * // main.js\n * import { UsaPlugin } from 'use-scroll-animate/components/vue';\n * app.use(UsaPlugin, { categories: ['click', 'cards'] });\n * ```\n * In templates, listen with `@usa:change=\"…\"` and bind properties with\n * `.prop`: `<usa-toggle :checked.prop=\"on\" @usa:change=\"on = $event.detail.checked\">`.\n */\nimport { defineComponents, type ComponentCategory } from '../index';\n\n/** `compilerOptions.isCustomElement` predicate for every `<usa-*>` tag. */\nexport const isUsaElement = (tag: string): boolean => tag.startsWith('usa-');\n\nexport interface UsaPluginOptions {\n /** Only register these categories (default: all). */\n categories?: ComponentCategory[];\n}\n\n/** Vue plugin: registers the `<usa-*>` elements (client only) and sets `isCustomElement` at runtime. */\nexport const UsaPlugin = {\n install(app: { config: { compilerOptions?: { isCustomElement?: (t: string) => boolean } } }, options: UsaPluginOptions = {}): void {\n const co = (app.config.compilerOptions ||= {});\n const prev = co.isCustomElement;\n co.isCustomElement = (t: string) => isUsaElement(t) || !!prev?.(t);\n defineComponents(options.categories);\n },\n};\n"],"names":["defineComponents"],"mappings":"
|
|
1
|
+
{"version":3,"file":"vue.cjs","sources":["../../src/components/frameworks/vue.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/vue — Vue integration (v2.9).\n *\n * ```js\n * // vite.config.js\n * import vue from '@vitejs/plugin-vue';\n * import { isUsaElement } from 'use-scroll-animate/components/vue';\n * export default { plugins: [vue({ template: { compilerOptions: { isCustomElement: isUsaElement } } })] };\n *\n * // main.js\n * import { UsaPlugin } from 'use-scroll-animate/components/vue';\n * app.use(UsaPlugin, { categories: ['click', 'cards'] });\n * ```\n * In templates, listen with `@usa:change=\"…\"` and bind properties with\n * `.prop`: `<usa-toggle :checked.prop=\"on\" @usa:change=\"on = $event.detail.checked\">`.\n */\nimport { defineComponents, type ComponentCategory } from '../index';\n\n/** `compilerOptions.isCustomElement` predicate for every `<usa-*>` tag. */\nexport const isUsaElement = (tag: string): boolean => tag.startsWith('usa-');\n\nexport interface UsaPluginOptions {\n /** Only register these categories (default: all). */\n categories?: ComponentCategory[];\n}\n\n/** Vue plugin: registers the `<usa-*>` elements (client only) and sets `isCustomElement` at runtime. */\nexport const UsaPlugin = {\n install(app: { config: { compilerOptions?: { isCustomElement?: (t: string) => boolean } } }, options: UsaPluginOptions = {}): void {\n const co = (app.config.compilerOptions ||= {});\n const prev = co.isCustomElement;\n co.isCustomElement = (t: string) => isUsaElement(t) || !!prev?.(t);\n defineComponents(options.categories);\n },\n};\n"],"names":["defineComponents"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;AAeG;AAGH;AACO,MAAM,YAAY,GAAG,CAAC,GAAW,KAAc,GAAG,CAAC,UAAU,CAAC,MAAM;AAO3E;AACO,MAAM,SAAS,GAAG;AACvB,IAAA,OAAO,CAAC,GAAmF,EAAE,OAAA,GAA4B,EAAE,EAAA;;AACzH,QAAA,MAAM,EAAE,IAAG,CAAA,EAAA,GAAC,GAAG,CAAC,MAAM,EAAC,eAAe,KAAA,EAAA,CAAf,eAAe,GAAK,EAAE,EAAC;AAC9C,QAAA,MAAM,IAAI,GAAG,EAAE,CAAC,eAAe;QAC/B,EAAE,CAAC,eAAe,GAAG,CAAC,CAAS,KAAK,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;AAClE,QAAAA,2BAAgB,CAAC,OAAO,CAAC,UAAU,CAAC;IACtC,CAAC;;;;;;"}
|
|
@@ -1510,6 +1510,52 @@ declare global {
|
|
|
1510
1510
|
}
|
|
1511
1511
|
}
|
|
1512
1512
|
|
|
1513
|
+
/**
|
|
1514
|
+
* `<usa-cube>` — a CSS 3D cube whose up-to-six element children are its faces
|
|
1515
|
+
* (front, right, back, left, top, bottom). Rotate with drag / swipe, arrow
|
|
1516
|
+
* keys, `autoplay` (ms) or `show(face | index)`; spring-driven.
|
|
1517
|
+
* Attributes: `size` (px, 200), `autoplay`, `perspective` (900).
|
|
1518
|
+
* `usa:change` (`{ index, face }`). Reduced motion: instant face switch.
|
|
1519
|
+
*/
|
|
1520
|
+
interface UsaCubeElement extends UsaElement {
|
|
1521
|
+
readonly index: number;
|
|
1522
|
+
show(face: number | string): void;
|
|
1523
|
+
next(): void;
|
|
1524
|
+
prev(): void;
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
/**
|
|
1528
|
+
* `<usa-depth>` — depth parallax: children with `data-depth` (-1…1, 0 = the
|
|
1529
|
+
* screen plane) move and scale by depth as the pointer moves, the device
|
|
1530
|
+
* tilts (`orientation`) or the page scrolls (`scroll`).
|
|
1531
|
+
* Attributes: `source` (`pointer` default · `orientation` · `scroll` ·
|
|
1532
|
+
* space-separated mix), `strength` (px at depth 1, 40), `rotate` (max tilt
|
|
1533
|
+
* of the whole scene in deg, 0). `requestPermission()` for iOS motion.
|
|
1534
|
+
* Reduced motion: layers stay flat.
|
|
1535
|
+
*/
|
|
1536
|
+
interface UsaDepthElement extends UsaElement {
|
|
1537
|
+
/** Current -1…1 input. */
|
|
1538
|
+
readonly tilt: {
|
|
1539
|
+
x: number;
|
|
1540
|
+
y: number;
|
|
1541
|
+
};
|
|
1542
|
+
requestPermission(): Promise<boolean>;
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
/**
|
|
1546
|
+
* use-scroll-animate/components/depth — 3D (v3.5).
|
|
1547
|
+
* `<usa-cube>` (CSS 3D cube), `<usa-depth>` (layered depth parallax driven by
|
|
1548
|
+
* pointer, device orientation or scroll) and `deviceTilt()`. The 3D ring
|
|
1549
|
+
* carousel is `<usa-carousel-3d>` in `components/cards`.
|
|
1550
|
+
*/
|
|
1551
|
+
|
|
1552
|
+
declare global {
|
|
1553
|
+
interface HTMLElementTagNameMap {
|
|
1554
|
+
'usa-cube': UsaCubeElement;
|
|
1555
|
+
'usa-depth': UsaDepthElement;
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1513
1559
|
/** The component categories and their default tags. */
|
|
1514
1560
|
declare const COMPONENT_CATEGORIES: {
|
|
1515
1561
|
readonly reveal: readonly ["usa-reveal", "usa-stagger", "usa-scroll-progress", "usa-scrolly"];
|
|
@@ -1527,6 +1573,7 @@ declare const COMPONENT_CATEGORIES: {
|
|
|
1527
1573
|
readonly gesture: readonly ["usa-swipeable", "usa-pinch-zoom"];
|
|
1528
1574
|
readonly svg: readonly ["usa-draw", "usa-morph", "usa-mask-reveal", "usa-anim-icon"];
|
|
1529
1575
|
readonly webgl: readonly ["usa-shader", "usa-distort", "usa-liquid"];
|
|
1576
|
+
readonly depth: readonly ["usa-cube", "usa-depth"];
|
|
1530
1577
|
};
|
|
1531
1578
|
type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
|
|
1532
1579
|
|
package/dist/components/vue.d.ts
CHANGED
|
@@ -1510,6 +1510,52 @@ declare global {
|
|
|
1510
1510
|
}
|
|
1511
1511
|
}
|
|
1512
1512
|
|
|
1513
|
+
/**
|
|
1514
|
+
* `<usa-cube>` — a CSS 3D cube whose up-to-six element children are its faces
|
|
1515
|
+
* (front, right, back, left, top, bottom). Rotate with drag / swipe, arrow
|
|
1516
|
+
* keys, `autoplay` (ms) or `show(face | index)`; spring-driven.
|
|
1517
|
+
* Attributes: `size` (px, 200), `autoplay`, `perspective` (900).
|
|
1518
|
+
* `usa:change` (`{ index, face }`). Reduced motion: instant face switch.
|
|
1519
|
+
*/
|
|
1520
|
+
interface UsaCubeElement extends UsaElement {
|
|
1521
|
+
readonly index: number;
|
|
1522
|
+
show(face: number | string): void;
|
|
1523
|
+
next(): void;
|
|
1524
|
+
prev(): void;
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
/**
|
|
1528
|
+
* `<usa-depth>` — depth parallax: children with `data-depth` (-1…1, 0 = the
|
|
1529
|
+
* screen plane) move and scale by depth as the pointer moves, the device
|
|
1530
|
+
* tilts (`orientation`) or the page scrolls (`scroll`).
|
|
1531
|
+
* Attributes: `source` (`pointer` default · `orientation` · `scroll` ·
|
|
1532
|
+
* space-separated mix), `strength` (px at depth 1, 40), `rotate` (max tilt
|
|
1533
|
+
* of the whole scene in deg, 0). `requestPermission()` for iOS motion.
|
|
1534
|
+
* Reduced motion: layers stay flat.
|
|
1535
|
+
*/
|
|
1536
|
+
interface UsaDepthElement extends UsaElement {
|
|
1537
|
+
/** Current -1…1 input. */
|
|
1538
|
+
readonly tilt: {
|
|
1539
|
+
x: number;
|
|
1540
|
+
y: number;
|
|
1541
|
+
};
|
|
1542
|
+
requestPermission(): Promise<boolean>;
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
/**
|
|
1546
|
+
* use-scroll-animate/components/depth — 3D (v3.5).
|
|
1547
|
+
* `<usa-cube>` (CSS 3D cube), `<usa-depth>` (layered depth parallax driven by
|
|
1548
|
+
* pointer, device orientation or scroll) and `deviceTilt()`. The 3D ring
|
|
1549
|
+
* carousel is `<usa-carousel-3d>` in `components/cards`.
|
|
1550
|
+
*/
|
|
1551
|
+
|
|
1552
|
+
declare global {
|
|
1553
|
+
interface HTMLElementTagNameMap {
|
|
1554
|
+
'usa-cube': UsaCubeElement;
|
|
1555
|
+
'usa-depth': UsaDepthElement;
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1513
1559
|
/** The component categories and their default tags. */
|
|
1514
1560
|
declare const COMPONENT_CATEGORIES: {
|
|
1515
1561
|
readonly reveal: readonly ["usa-reveal", "usa-stagger", "usa-scroll-progress", "usa-scrolly"];
|
|
@@ -1527,6 +1573,7 @@ declare const COMPONENT_CATEGORIES: {
|
|
|
1527
1573
|
readonly gesture: readonly ["usa-swipeable", "usa-pinch-zoom"];
|
|
1528
1574
|
readonly svg: readonly ["usa-draw", "usa-morph", "usa-mask-reveal", "usa-anim-icon"];
|
|
1529
1575
|
readonly webgl: readonly ["usa-shader", "usa-distort", "usa-liquid"];
|
|
1576
|
+
readonly depth: readonly ["usa-cube", "usa-depth"];
|
|
1530
1577
|
};
|
|
1531
1578
|
type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
|
|
1532
1579
|
|
package/dist/components/vue.js
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { defineComponents } from '../components.js';
|
|
2
2
|
import './reveal.js';
|
|
3
|
-
import '../chunks/base-
|
|
3
|
+
import '../chunks/base-BpROOcey.js';
|
|
4
4
|
import './text.js';
|
|
5
5
|
import './interaction.js';
|
|
6
6
|
import './feedback.js';
|
|
7
7
|
import './background.js';
|
|
8
|
-
import '../chunks/variants-
|
|
8
|
+
import '../chunks/variants-CHe1VbSn.js';
|
|
9
9
|
import './transitions.js';
|
|
10
10
|
import './physics.js';
|
|
11
|
-
import '../chunks/spring-
|
|
11
|
+
import '../chunks/spring-C-fw7_9f.js';
|
|
12
12
|
import './cards.js';
|
|
13
13
|
import './click.js';
|
|
14
14
|
import './ui.js';
|
|
15
15
|
import './page.js';
|
|
16
16
|
import './timeline.js';
|
|
17
17
|
import './gesture.js';
|
|
18
|
+
import '../chunks/core-uxs3ETou.js';
|
|
18
19
|
import './svg.js';
|
|
19
20
|
import './webgl.js';
|
|
20
|
-
import '
|
|
21
|
+
import './depth.js';
|
|
22
|
+
import '../chunks/index-tags-uw1Fospg.js';
|
|
21
23
|
|
|
22
24
|
/**
|
|
23
25
|
* use-scroll-animate/components/vue — Vue integration (v2.9).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue.js","sources":["../../src/components/frameworks/vue.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/vue — Vue integration (v2.9).\n *\n * ```js\n * // vite.config.js\n * import vue from '@vitejs/plugin-vue';\n * import { isUsaElement } from 'use-scroll-animate/components/vue';\n * export default { plugins: [vue({ template: { compilerOptions: { isCustomElement: isUsaElement } } })] };\n *\n * // main.js\n * import { UsaPlugin } from 'use-scroll-animate/components/vue';\n * app.use(UsaPlugin, { categories: ['click', 'cards'] });\n * ```\n * In templates, listen with `@usa:change=\"…\"` and bind properties with\n * `.prop`: `<usa-toggle :checked.prop=\"on\" @usa:change=\"on = $event.detail.checked\">`.\n */\nimport { defineComponents, type ComponentCategory } from '../index';\n\n/** `compilerOptions.isCustomElement` predicate for every `<usa-*>` tag. */\nexport const isUsaElement = (tag: string): boolean => tag.startsWith('usa-');\n\nexport interface UsaPluginOptions {\n /** Only register these categories (default: all). */\n categories?: ComponentCategory[];\n}\n\n/** Vue plugin: registers the `<usa-*>` elements (client only) and sets `isCustomElement` at runtime. */\nexport const UsaPlugin = {\n install(app: { config: { compilerOptions?: { isCustomElement?: (t: string) => boolean } } }, options: UsaPluginOptions = {}): void {\n const co = (app.config.compilerOptions ||= {});\n const prev = co.isCustomElement;\n co.isCustomElement = (t: string) => isUsaElement(t) || !!prev?.(t);\n defineComponents(options.categories);\n },\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vue.js","sources":["../../src/components/frameworks/vue.ts"],"sourcesContent":["/**\n * use-scroll-animate/components/vue — Vue integration (v2.9).\n *\n * ```js\n * // vite.config.js\n * import vue from '@vitejs/plugin-vue';\n * import { isUsaElement } from 'use-scroll-animate/components/vue';\n * export default { plugins: [vue({ template: { compilerOptions: { isCustomElement: isUsaElement } } })] };\n *\n * // main.js\n * import { UsaPlugin } from 'use-scroll-animate/components/vue';\n * app.use(UsaPlugin, { categories: ['click', 'cards'] });\n * ```\n * In templates, listen with `@usa:change=\"…\"` and bind properties with\n * `.prop`: `<usa-toggle :checked.prop=\"on\" @usa:change=\"on = $event.detail.checked\">`.\n */\nimport { defineComponents, type ComponentCategory } from '../index';\n\n/** `compilerOptions.isCustomElement` predicate for every `<usa-*>` tag. */\nexport const isUsaElement = (tag: string): boolean => tag.startsWith('usa-');\n\nexport interface UsaPluginOptions {\n /** Only register these categories (default: all). */\n categories?: ComponentCategory[];\n}\n\n/** Vue plugin: registers the `<usa-*>` elements (client only) and sets `isCustomElement` at runtime. */\nexport const UsaPlugin = {\n install(app: { config: { compilerOptions?: { isCustomElement?: (t: string) => boolean } } }, options: UsaPluginOptions = {}): void {\n const co = (app.config.compilerOptions ||= {});\n const prev = co.isCustomElement;\n co.isCustomElement = (t: string) => isUsaElement(t) || !!prev?.(t);\n defineComponents(options.categories);\n },\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;AAeG;AAGH;AACO,MAAM,YAAY,GAAG,CAAC,GAAW,KAAc,GAAG,CAAC,UAAU,CAAC,MAAM;AAO3E;AACO,MAAM,SAAS,GAAG;AACvB,IAAA,OAAO,CAAC,GAAmF,EAAE,OAAA,GAA4B,EAAE,EAAA;;AACzH,QAAA,MAAM,EAAE,IAAG,CAAA,EAAA,GAAC,GAAG,CAAC,MAAM,EAAC,eAAe,KAAA,EAAA,CAAf,eAAe,GAAK,EAAE,EAAC;AAC9C,QAAA,MAAM,IAAI,GAAG,EAAE,CAAC,eAAe;QAC/B,EAAE,CAAC,eAAe,GAAG,CAAC,CAAS,KAAK,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;AAClE,QAAA,gBAAgB,CAAC,OAAO,CAAC,UAAU,CAAC;IACtC,CAAC;;;;;"}
|
package/dist/components/webgl.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as defineElement, n as now,
|
|
2
|
-
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-
|
|
1
|
+
import { h as defineElement, n as now, e as caf, b as clamp, r as raf } from '../chunks/base-BpROOcey.js';
|
|
2
|
+
export { a as configureComponents, p as prefersReducedMotion } from '../chunks/base-BpROOcey.js';
|
|
3
3
|
|
|
4
4
|
/** Minimal WebGL runner: one full-canvas quad, one fragment shader, optional image texture. */
|
|
5
5
|
const VERTEX = 'attribute vec2 p;varying vec2 v_uv;void main(){v_uv=p*.5+.5;gl_Position=vec4(p,0.,1.);}';
|