use-scroll-animate 3.1.0 → 3.2.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +1 -0
  3. package/README_ja.md +1 -0
  4. package/README_zh.md +1 -0
  5. package/dist/chunks/{index-tags-Gw1G06Pb.cjs → index-tags-DCTX4F9b.cjs} +2 -1
  6. package/dist/chunks/{index-tags-Gw1G06Pb.cjs.map → index-tags-DCTX4F9b.cjs.map} +1 -1
  7. package/dist/chunks/{index-tags-D7NynL4r.js → index-tags-DZ-gjMZc.js} +2 -1
  8. package/dist/chunks/{index-tags-D7NynL4r.js.map → index-tags-DZ-gjMZc.js.map} +1 -1
  9. package/dist/components/gesture.cjs +387 -0
  10. package/dist/components/gesture.cjs.map +1 -0
  11. package/dist/components/gesture.css +3 -0
  12. package/dist/components/gesture.d.cts +169 -0
  13. package/dist/components/gesture.d.ts +169 -0
  14. package/dist/components/gesture.js +379 -0
  15. package/dist/components/gesture.js.map +1 -0
  16. package/dist/components/jsx.d.cts +1 -0
  17. package/dist/components/jsx.d.ts +1 -0
  18. package/dist/components/lazy.cjs +2 -1
  19. package/dist/components/lazy.cjs.map +1 -1
  20. package/dist/components/lazy.d.cts +1 -0
  21. package/dist/components/lazy.d.ts +1 -0
  22. package/dist/components/lazy.js +2 -1
  23. package/dist/components/lazy.js.map +1 -1
  24. package/dist/components/react.cjs +1 -1
  25. package/dist/components/react.js +1 -1
  26. package/dist/components/vue.cjs +2 -1
  27. package/dist/components/vue.cjs.map +1 -1
  28. package/dist/components/vue.d.cts +48 -0
  29. package/dist/components/vue.d.ts +48 -0
  30. package/dist/components/vue.js +2 -1
  31. package/dist/components/vue.js.map +1 -1
  32. package/dist/components.cjs +9 -1
  33. package/dist/components.cjs.map +1 -1
  34. package/dist/components.css +1 -0
  35. package/dist/components.d.cts +125 -2
  36. package/dist/components.d.ts +125 -2
  37. package/dist/components.js +5 -2
  38. package/dist/components.js.map +1 -1
  39. package/dist/components.umd.js +2 -2
  40. package/dist/components.umd.js.map +1 -1
  41. package/docs/components.md +8 -0
  42. package/package.json +13 -2
@@ -1374,6 +1374,53 @@ declare global {
1374
1374
  }
1375
1375
  }
1376
1376
 
1377
+ type SwipeDirection = 'left' | 'right' | 'up' | 'down';
1378
+
1379
+ /**
1380
+ * `<usa-swipeable>` — swipe-to-dismiss / swipe actions. The content follows
1381
+ * the finger (rubber-banded past `distance`), flies out on a swipe or a drag
1382
+ * past `distance`, otherwise springs home with the release velocity.
1383
+ *
1384
+ * Attributes: `axis` (`x` default · `y`), `distance` (px, 120), `preset`
1385
+ * (spring), `dismiss` (remove the element after flying out), `disabled`.
1386
+ * Keyboard: Delete/Backspace dismisses, ←/→ swipe. Events `usa:swipe`
1387
+ * (`{ direction }`, cancelable), `usa:dismiss`. Methods `swipe(dir)`, `reset()`.
1388
+ * Reduced motion: no follow / fly-out animation, events still fire.
1389
+ */
1390
+ interface UsaSwipeableElement extends UsaElement {
1391
+ swipe(direction: SwipeDirection): void;
1392
+ reset(): void;
1393
+ readonly offset: number;
1394
+ }
1395
+
1396
+ /**
1397
+ * `<usa-pinch-zoom>` — pinch (two fingers or Ctrl/⌘ + wheel / trackpad
1398
+ * pinch) to zoom its content, pan while zoomed, double-tap to toggle zoom;
1399
+ * scale and position spring back inside the bounds on release.
1400
+ *
1401
+ * Attributes: `min` (1), `max` (4), `double-tap` (zoom level, 2), `preset`.
1402
+ * Keyboard: `+` / `-` / `0`. Property `scale`, method `zoomTo(scale)`.
1403
+ * Event `usa:zoom` (`{ scale }`). Reduced motion: zoom changes instantly.
1404
+ */
1405
+ interface UsaPinchZoomElement extends UsaElement {
1406
+ readonly scale: number;
1407
+ zoomTo(scale: number): void;
1408
+ }
1409
+
1410
+ /**
1411
+ * use-scroll-animate/components/gesture — unified gestures (v3.2).
1412
+ * `gesture()` recognises pan, swipe, pinch, long-press, tap and double-tap
1413
+ * with release velocities for springs; `<usa-swipeable>` (swipe-to-dismiss)
1414
+ * and `<usa-pinch-zoom>` are built on it.
1415
+ */
1416
+
1417
+ declare global {
1418
+ interface HTMLElementTagNameMap {
1419
+ 'usa-swipeable': UsaSwipeableElement;
1420
+ 'usa-pinch-zoom': UsaPinchZoomElement;
1421
+ }
1422
+ }
1423
+
1377
1424
  /** The component categories and their default tags. */
1378
1425
  declare const COMPONENT_CATEGORIES: {
1379
1426
  readonly reveal: readonly ["usa-reveal", "usa-stagger", "usa-scroll-progress", "usa-scrolly"];
@@ -1388,6 +1435,7 @@ declare const COMPONENT_CATEGORIES: {
1388
1435
  readonly ui: readonly ["usa-tabs", "usa-drawer", "usa-bottom-sheet", "usa-pull-refresh", "usa-fab", "usa-navbar", "usa-slider", "usa-rating", "usa-tooltip", "usa-popover", "usa-badge", "usa-avatar-stack"];
1389
1436
  readonly page: readonly ["usa-cursor", "usa-fullpage", "usa-loading-bar", "usa-back-to-top", "usa-ambient", "usa-splash", "usa-auto-skeleton", "usa-motion-switch"];
1390
1437
  readonly timeline: readonly ["usa-timeline"];
1438
+ readonly gesture: readonly ["usa-swipeable", "usa-pinch-zoom"];
1391
1439
  };
1392
1440
  type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
1393
1441
 
@@ -1374,6 +1374,53 @@ declare global {
1374
1374
  }
1375
1375
  }
1376
1376
 
1377
+ type SwipeDirection = 'left' | 'right' | 'up' | 'down';
1378
+
1379
+ /**
1380
+ * `<usa-swipeable>` — swipe-to-dismiss / swipe actions. The content follows
1381
+ * the finger (rubber-banded past `distance`), flies out on a swipe or a drag
1382
+ * past `distance`, otherwise springs home with the release velocity.
1383
+ *
1384
+ * Attributes: `axis` (`x` default · `y`), `distance` (px, 120), `preset`
1385
+ * (spring), `dismiss` (remove the element after flying out), `disabled`.
1386
+ * Keyboard: Delete/Backspace dismisses, ←/→ swipe. Events `usa:swipe`
1387
+ * (`{ direction }`, cancelable), `usa:dismiss`. Methods `swipe(dir)`, `reset()`.
1388
+ * Reduced motion: no follow / fly-out animation, events still fire.
1389
+ */
1390
+ interface UsaSwipeableElement extends UsaElement {
1391
+ swipe(direction: SwipeDirection): void;
1392
+ reset(): void;
1393
+ readonly offset: number;
1394
+ }
1395
+
1396
+ /**
1397
+ * `<usa-pinch-zoom>` — pinch (two fingers or Ctrl/⌘ + wheel / trackpad
1398
+ * pinch) to zoom its content, pan while zoomed, double-tap to toggle zoom;
1399
+ * scale and position spring back inside the bounds on release.
1400
+ *
1401
+ * Attributes: `min` (1), `max` (4), `double-tap` (zoom level, 2), `preset`.
1402
+ * Keyboard: `+` / `-` / `0`. Property `scale`, method `zoomTo(scale)`.
1403
+ * Event `usa:zoom` (`{ scale }`). Reduced motion: zoom changes instantly.
1404
+ */
1405
+ interface UsaPinchZoomElement extends UsaElement {
1406
+ readonly scale: number;
1407
+ zoomTo(scale: number): void;
1408
+ }
1409
+
1410
+ /**
1411
+ * use-scroll-animate/components/gesture — unified gestures (v3.2).
1412
+ * `gesture()` recognises pan, swipe, pinch, long-press, tap and double-tap
1413
+ * with release velocities for springs; `<usa-swipeable>` (swipe-to-dismiss)
1414
+ * and `<usa-pinch-zoom>` are built on it.
1415
+ */
1416
+
1417
+ declare global {
1418
+ interface HTMLElementTagNameMap {
1419
+ 'usa-swipeable': UsaSwipeableElement;
1420
+ 'usa-pinch-zoom': UsaPinchZoomElement;
1421
+ }
1422
+ }
1423
+
1377
1424
  /** The component categories and their default tags. */
1378
1425
  declare const COMPONENT_CATEGORIES: {
1379
1426
  readonly reveal: readonly ["usa-reveal", "usa-stagger", "usa-scroll-progress", "usa-scrolly"];
@@ -1388,6 +1435,7 @@ declare const COMPONENT_CATEGORIES: {
1388
1435
  readonly ui: readonly ["usa-tabs", "usa-drawer", "usa-bottom-sheet", "usa-pull-refresh", "usa-fab", "usa-navbar", "usa-slider", "usa-rating", "usa-tooltip", "usa-popover", "usa-badge", "usa-avatar-stack"];
1389
1436
  readonly page: readonly ["usa-cursor", "usa-fullpage", "usa-loading-bar", "usa-back-to-top", "usa-ambient", "usa-splash", "usa-auto-skeleton", "usa-motion-switch"];
1390
1437
  readonly timeline: readonly ["usa-timeline"];
1438
+ readonly gesture: readonly ["usa-swipeable", "usa-pinch-zoom"];
1391
1439
  };
1392
1440
  type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
1393
1441
 
@@ -14,7 +14,8 @@ import './click.js';
14
14
  import './ui.js';
15
15
  import './page.js';
16
16
  import './timeline.js';
17
- import '../chunks/index-tags-D7NynL4r.js';
17
+ import './gesture.js';
18
+ import '../chunks/index-tags-DZ-gjMZc.js';
18
19
 
19
20
  /**
20
21
  * 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":";;;;;;;;;;;;;;;;;;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;;;;;"}
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;;;;;"}
@@ -12,9 +12,10 @@ var components_click = require('./components/click.cjs');
12
12
  var components_ui = require('./components/ui.cjs');
13
13
  var components_page = require('./components/page.cjs');
14
14
  var components_timeline = require('./components/timeline.cjs');
15
+ var components_gesture = require('./components/gesture.cjs');
15
16
  var variants = require('./chunks/variants-BNIrn4ch.cjs');
16
17
  var base = require('./chunks/base-CXx7jZ-o.cjs');
17
- var indexTags = require('./chunks/index-tags-Gw1G06Pb.cjs');
18
+ var indexTags = require('./chunks/index-tags-DCTX4F9b.cjs');
18
19
  var spring = require('./chunks/spring-2OTnYCzm.cjs');
19
20
 
20
21
  /**
@@ -50,6 +51,7 @@ const BY_CATEGORY = {
50
51
  ui: components_ui.defineUiComponents,
51
52
  page: components_page.definePageComponents,
52
53
  timeline: components_timeline.defineTimelineComponents,
54
+ gesture: components_gesture.defineGestureComponents,
53
55
  };
54
56
  /**
55
57
  * Register every `<usa-*>` component (or only the given categories).
@@ -184,6 +186,12 @@ exports.defineTimeline = components_timeline.defineTimeline;
184
186
  exports.defineTimelineComponents = components_timeline.defineTimelineComponents;
185
187
  exports.resolvePosition = components_timeline.resolvePosition;
186
188
  exports.timeline = components_timeline.timeline;
189
+ exports.defineGestureComponents = components_gesture.defineGestureComponents;
190
+ exports.definePinchZoom = components_gesture.definePinchZoom;
191
+ exports.defineSwipeable = components_gesture.defineSwipeable;
192
+ exports.gesture = components_gesture.gesture;
193
+ exports.pinchScale = components_gesture.pinchScale;
194
+ exports.swipeDirection = components_gesture.swipeDirection;
187
195
  exports.VARIANTS = variants.VARIANTS;
188
196
  exports.adoptVariants = variants.adoptVariants;
189
197
  exports.setVariant = variants.setVariant;
@@ -1 +1 @@
1
- {"version":3,"file":"components.cjs","sources":["../src/components/index.ts"],"sourcesContent":["/**\n * use-scroll-animate/components\n *\n * Framework-agnostic, dependency-free animated UI components built on\n * Custom Elements + CSS + the Web Animations API. They run in any browser\n * and in Windows desktop apps that render with a web view: Electron, Tauri\n * (WebView2), WinUI 3 / WPF / WinForms with WebView2, and installed PWAs.\n *\n * ```js\n * import { defineComponents } from 'use-scroll-animate/components';\n * defineComponents(); // registers every <usa-*> element\n * // or only what you use (tree-shakable):\n * import { defineTypewriter } from 'use-scroll-animate/components/text';\n * ```\n *\n * Importing has no side effects and is SSR-safe; nothing is registered\n * until a `define*()` function runs in a browser.\n *\n * @license MIT\n */\nimport { defineRevealComponents } from './reveal/index';\nimport { defineTextComponents } from './text/index';\nimport { defineInteractionComponents } from './interaction/index';\nimport { defineFeedbackComponents } from './feedback/index';\nimport { defineBackgroundComponents } from './background/index';\nimport { defineTransitionComponents } from './transitions/index';\nimport { definePhysicsComponents } from './physics/index';\nimport { defineCardComponents } from './cards/index';\nimport { defineClickComponents } from './click/index';\nimport { defineUiComponents } from './ui/index';\nimport { definePageComponents } from './page/index';\nimport { defineTimelineComponents } from './timeline/index';\nimport { adoptVariants } from './ui/variants';\nimport { canDefine } from './base';\n\nexport * from './reveal/index';\nexport * from './text/index';\nexport * from './interaction/index';\nexport * from './feedback/index';\nexport * from './background/index';\nexport * from './transitions/index';\nexport * from './physics/index';\nexport * from './cards/index';\nexport * from './click/index';\nexport * from './ui/index';\nexport * from './page/index';\nexport * from './timeline/index';\n\nexport { COMPONENT_CATEGORIES } from './index-tags';\nexport type { ComponentCategory } from './index-tags';\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from './index-tags';\n\nconst BY_CATEGORY: Record<ComponentCategory, () => void> = {\n reveal: defineRevealComponents,\n text: defineTextComponents,\n interaction: defineInteractionComponents,\n feedback: defineFeedbackComponents,\n background: defineBackgroundComponents,\n transitions: defineTransitionComponents,\n physics: definePhysicsComponents,\n cards: defineCardComponents,\n click: defineClickComponents,\n ui: defineUiComponents,\n page: definePageComponents,\n timeline: defineTimelineComponents,\n};\n\n/**\n * Register every `<usa-*>` component (or only the given categories).\n * Safe to call more than once and on the server (no-op without DOM).\n */\nexport function defineComponents(categories?: ComponentCategory[]): void {\n if (canDefine()) adoptVariants();\n (categories || (Object.keys(BY_CATEGORY) as ComponentCategory[])).forEach((c) => BY_CATEGORY[c]?.());\n}\n"],"names":["defineRevealComponents","defineTextComponents","defineInteractionComponents","defineFeedbackComponents","defineBackgroundComponents","defineTransitionComponents","definePhysicsComponents","defineCardComponents","defineClickComponents","defineUiComponents","definePageComponents","defineTimelineComponents","canDefine","adoptVariants"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAiCH,MAAM,WAAW,GAA0C;AACzD,IAAA,MAAM,EAAEA,wCAAsB;AAC9B,IAAA,IAAI,EAAEC,oCAAoB;AAC1B,IAAA,WAAW,EAAEC,kDAA2B;AACxC,IAAA,QAAQ,EAAEC,4CAAwB;AAClC,IAAA,UAAU,EAAEC,gDAA0B;AACtC,IAAA,WAAW,EAAEC,iDAA0B;AACvC,IAAA,OAAO,EAAEC,0CAAuB;AAChC,IAAA,KAAK,EAAEC,qCAAoB;AAC3B,IAAA,KAAK,EAAEC,sCAAqB;AAC5B,IAAA,EAAE,EAAEC,gCAAkB;AACtB,IAAA,IAAI,EAAEC,oCAAoB;AAC1B,IAAA,QAAQ,EAAEC,4CAAwB;CACnC;AAED;;;AAGG;AACG,SAAU,gBAAgB,CAAC,UAAgC,EAAA;AAC/D,IAAA,IAAIC,cAAS,EAAE;AAAE,QAAAC,sBAAa,EAAE;IAChC,CAAC,UAAU,IAAK,MAAM,CAAC,IAAI,CAAC,WAAW,CAAyB,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;AACtG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"components.cjs","sources":["../src/components/index.ts"],"sourcesContent":["/**\n * use-scroll-animate/components\n *\n * Framework-agnostic, dependency-free animated UI components built on\n * Custom Elements + CSS + the Web Animations API. They run in any browser\n * and in Windows desktop apps that render with a web view: Electron, Tauri\n * (WebView2), WinUI 3 / WPF / WinForms with WebView2, and installed PWAs.\n *\n * ```js\n * import { defineComponents } from 'use-scroll-animate/components';\n * defineComponents(); // registers every <usa-*> element\n * // or only what you use (tree-shakable):\n * import { defineTypewriter } from 'use-scroll-animate/components/text';\n * ```\n *\n * Importing has no side effects and is SSR-safe; nothing is registered\n * until a `define*()` function runs in a browser.\n *\n * @license MIT\n */\nimport { defineRevealComponents } from './reveal/index';\nimport { defineTextComponents } from './text/index';\nimport { defineInteractionComponents } from './interaction/index';\nimport { defineFeedbackComponents } from './feedback/index';\nimport { defineBackgroundComponents } from './background/index';\nimport { defineTransitionComponents } from './transitions/index';\nimport { definePhysicsComponents } from './physics/index';\nimport { defineCardComponents } from './cards/index';\nimport { defineClickComponents } from './click/index';\nimport { defineUiComponents } from './ui/index';\nimport { definePageComponents } from './page/index';\nimport { defineTimelineComponents } from './timeline/index';\nimport { defineGestureComponents } from './gesture/index';\nimport { adoptVariants } from './ui/variants';\nimport { canDefine } from './base';\n\nexport * from './reveal/index';\nexport * from './text/index';\nexport * from './interaction/index';\nexport * from './feedback/index';\nexport * from './background/index';\nexport * from './transitions/index';\nexport * from './physics/index';\nexport * from './cards/index';\nexport * from './click/index';\nexport * from './ui/index';\nexport * from './page/index';\nexport * from './timeline/index';\nexport * from './gesture/index';\n\nexport { COMPONENT_CATEGORIES } from './index-tags';\nexport type { ComponentCategory } from './index-tags';\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from './index-tags';\n\nconst BY_CATEGORY: Record<ComponentCategory, () => void> = {\n reveal: defineRevealComponents,\n text: defineTextComponents,\n interaction: defineInteractionComponents,\n feedback: defineFeedbackComponents,\n background: defineBackgroundComponents,\n transitions: defineTransitionComponents,\n physics: definePhysicsComponents,\n cards: defineCardComponents,\n click: defineClickComponents,\n ui: defineUiComponents,\n page: definePageComponents,\n timeline: defineTimelineComponents,\n gesture: defineGestureComponents,\n};\n\n/**\n * Register every `<usa-*>` component (or only the given categories).\n * Safe to call more than once and on the server (no-op without DOM).\n */\nexport function defineComponents(categories?: ComponentCategory[]): void {\n if (canDefine()) adoptVariants();\n (categories || (Object.keys(BY_CATEGORY) as ComponentCategory[])).forEach((c) => BY_CATEGORY[c]?.());\n}\n"],"names":["defineRevealComponents","defineTextComponents","defineInteractionComponents","defineFeedbackComponents","defineBackgroundComponents","defineTransitionComponents","definePhysicsComponents","defineCardComponents","defineClickComponents","defineUiComponents","definePageComponents","defineTimelineComponents","defineGestureComponents","canDefine","adoptVariants"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAmCH,MAAM,WAAW,GAA0C;AACzD,IAAA,MAAM,EAAEA,wCAAsB;AAC9B,IAAA,IAAI,EAAEC,oCAAoB;AAC1B,IAAA,WAAW,EAAEC,kDAA2B;AACxC,IAAA,QAAQ,EAAEC,4CAAwB;AAClC,IAAA,UAAU,EAAEC,gDAA0B;AACtC,IAAA,WAAW,EAAEC,iDAA0B;AACvC,IAAA,OAAO,EAAEC,0CAAuB;AAChC,IAAA,KAAK,EAAEC,qCAAoB;AAC3B,IAAA,KAAK,EAAEC,sCAAqB;AAC5B,IAAA,EAAE,EAAEC,gCAAkB;AACtB,IAAA,IAAI,EAAEC,oCAAoB;AAC1B,IAAA,QAAQ,EAAEC,4CAAwB;AAClC,IAAA,OAAO,EAAEC,0CAAuB;CACjC;AAED;;;AAGG;AACG,SAAU,gBAAgB,CAAC,UAAgC,EAAA;AAC/D,IAAA,IAAIC,cAAS,EAAE;AAAE,QAAAC,sBAAa,EAAE;IAChC,CAAC,UAAU,IAAK,MAAM,CAAC,IAAI,CAAC,WAAW,CAAyB,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;AACtG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -67,3 +67,4 @@ usa-motion-switch{--usa-motion-i:2;position:relative;display:inline-grid;grid-au
67
67
  usa-splash{position:fixed;inset:0;z-index:2147483400;display:grid;place-items:center;background:var(--usa-splash-bg,var(--usa-surface,#0b0d12));color:var(--usa-text,#fff)}usa-splash[hidden]{display:none}
68
68
  ::view-transition-group(root){animation-duration:var(--usa-pt-duration,600ms)}html[data-usa-pt] ::view-transition-old(root),html[data-usa-pt] ::view-transition-new(root){animation-duration:var(--usa-pt-duration,600ms);animation-timing-function:cubic-bezier(0.22,1,0.36,1);mix-blend-mode:normal}html[data-usa-pt="slide"] ::view-transition-old(root),html[data-usa-pt="slide-left"] ::view-transition-old(root){animation-name:usa-pt-out-left}html[data-usa-pt="slide"] ::view-transition-new(root),html[data-usa-pt="slide-left"] ::view-transition-new(root){animation-name:usa-pt-in-right}html[data-usa-pt="slide-right"] ::view-transition-old(root){animation-name:usa-pt-out-right}html[data-usa-pt="slide-right"] ::view-transition-new(root){animation-name:usa-pt-in-left}html[data-usa-pt="slide-up"] ::view-transition-old(root){animation-name:usa-pt-out-up}html[data-usa-pt="slide-up"] ::view-transition-new(root){animation-name:usa-pt-in-up}html[data-usa-pt="zoom"] ::view-transition-old(root){animation-name:usa-pt-zoom-out}html[data-usa-pt="zoom"] ::view-transition-new(root){animation-name:usa-pt-zoom-in}html[data-usa-pt="circle"] ::view-transition-old(root){animation:none}html[data-usa-pt="circle"] ::view-transition-new(root){animation-name:usa-pt-circle}html[data-usa-pt="blinds"] ::view-transition-old(root){animation:none}html[data-usa-pt="blinds"] ::view-transition-new(root){animation-name:usa-pt-blinds;-webkit-mask-image:repeating-linear-gradient(to bottom,#000 0 var(--usa-blind),transparent var(--usa-blind) 10vh);mask-image:repeating-linear-gradient(to bottom,#000 0 var(--usa-blind),transparent var(--usa-blind) 10vh)}html[data-usa-pt="pixel"] ::view-transition-old(root){animation-name:usa-pt-pixel-out;animation-timing-function:steps(10,end)}html[data-usa-pt="pixel"] ::view-transition-new(root){animation-name:usa-pt-pixel-in;animation-timing-function:steps(10,end)}@property --usa-blind{syntax:"<length-percentage>";inherits:false;initial-value:0vh}@keyframes usa-pt-out-left{to{transform:translateX(-30%);opacity:0}}@keyframes usa-pt-in-right{from{transform:translateX(30%);opacity:0}}@keyframes usa-pt-out-right{to{transform:translateX(30%);opacity:0}}@keyframes usa-pt-in-left{from{transform:translateX(-30%);opacity:0}}@keyframes usa-pt-out-up{to{transform:translateY(-12%);opacity:0}}@keyframes usa-pt-in-up{from{transform:translateY(12%);opacity:0}}@keyframes usa-pt-zoom-out{to{transform:scale(0.92);opacity:0}}@keyframes usa-pt-zoom-in{from{transform:scale(1.08);opacity:0}}@keyframes usa-pt-circle{from{clip-path:circle(0 at var(--usa-pt-x,50%) var(--usa-pt-y,50%))}to{clip-path:circle(var(--usa-pt-r,150vmax) at var(--usa-pt-x,50%) var(--usa-pt-y,50%))}}@keyframes usa-pt-blinds{from{--usa-blind:0vh}to{--usa-blind:10vh}}@keyframes usa-pt-pixel-out{to{opacity:0;filter:blur(6px) contrast(1.4)}}@keyframes usa-pt-pixel-in{from{opacity:0;filter:blur(6px) contrast(1.4)}}@media (prefers-reduced-motion:reduce){::view-transition-group(*),::view-transition-old(*),::view-transition-new(*){animation:none !important}}
69
69
  usa-timeline{display:block}usa-timeline[scrub]{position:relative}@media (prefers-reduced-motion:reduce){usa-timeline [data-tl]{opacity:1 !important;transform:none !important;filter:none !important;clip-path:none !important}}
70
+ usa-swipeable{display:block;touch-action:pan-y;user-select:none;-webkit-user-select:none}usa-swipeable[axis="y"]{touch-action:pan-x}usa-swipeable>*{transform:translate3d(var(--usa-swipe,0px),0,0);opacity:calc(1 - var(--usa-swipe-p,0) * 0.5)}usa-swipeable[axis="y"]>*{transform:translate3d(0,var(--usa-swipe,0px),0)}usa-swipeable:focus-visible{outline:2px solid currentColor;outline-offset:2px}usa-pinch-zoom{display:block;overflow:hidden;touch-action:none;position:relative}usa-pinch-zoom>*{transform:translate3d(var(--usa-zoom-x,0px),var(--usa-zoom-y,0px),0) scale(var(--usa-zoom,1));transform-origin:50% 50%}usa-pinch-zoom[data-zoomed]{cursor:grab}usa-pinch-zoom:focus-visible{outline:2px solid currentColor;outline-offset:2px}
@@ -1891,6 +1891,128 @@ declare global {
1891
1891
  }
1892
1892
  }
1893
1893
 
1894
+ interface PanState {
1895
+ /** Offset from the gesture start (px). */
1896
+ dx: number;
1897
+ dy: number;
1898
+ /** Velocity (px/s). */
1899
+ vx: number;
1900
+ vy: number;
1901
+ first: boolean;
1902
+ last: boolean;
1903
+ event: Event;
1904
+ }
1905
+ type SwipeDirection = 'left' | 'right' | 'up' | 'down';
1906
+ interface SwipeState {
1907
+ direction: SwipeDirection;
1908
+ velocity: number;
1909
+ dx: number;
1910
+ dy: number;
1911
+ }
1912
+ interface PinchState {
1913
+ scale: number; /** Midpoint of the two pointers (client px). */
1914
+ x: number;
1915
+ y: number;
1916
+ first: boolean;
1917
+ last: boolean;
1918
+ }
1919
+ interface PressState {
1920
+ x: number;
1921
+ y: number;
1922
+ }
1923
+ interface GestureHandlers {
1924
+ onPan?: (s: PanState) => void;
1925
+ onSwipe?: (s: SwipeState) => void;
1926
+ onPinch?: (s: PinchState) => void;
1927
+ onLongPress?: (s: PressState) => void;
1928
+ onTap?: (s: PressState) => void;
1929
+ onDoubleTap?: (s: PressState) => void;
1930
+ }
1931
+ interface GestureOptions {
1932
+ /** Restrict panning to an axis. */
1933
+ axis?: 'x' | 'y';
1934
+ /** Movement (px) before a pan starts (default 4). */
1935
+ threshold?: number;
1936
+ /** Minimum distance (px, default 40) and speed (px/s, default 300) for a swipe. */
1937
+ swipeDistance?: number;
1938
+ swipeVelocity?: number;
1939
+ /** Long-press delay (ms, default 500). */
1940
+ longPress?: number;
1941
+ /** Ctrl/⌘ + wheel (trackpad pinch) counts as pinch (default true). */
1942
+ wheelPinch?: boolean;
1943
+ }
1944
+ /** The swipe a pointer release represents, or `null` (pure). */
1945
+ declare function swipeDirection(dx: number, dy: number, vx: number, vy: number, o?: {
1946
+ distance?: number;
1947
+ velocity?: number;
1948
+ axis?: 'x' | 'y';
1949
+ }): SwipeState | null;
1950
+ /** Scale between two pointer distances, clamped to [min, max] (pure). */
1951
+ declare function pinchScale(startDistance: number, distance: number, base?: number, min?: number, max?: number): number;
1952
+ /**
1953
+ * One recognizer for pan, swipe, pinch (two pointers or Ctrl + wheel),
1954
+ * long-press, tap and double-tap, with velocities ready to hand to a spring
1955
+ * (`createSpring().set(target, velocity)`). Works with mouse, touch and pen
1956
+ * through Pointer Events. Returns a cleanup function.
1957
+ *
1958
+ * @example
1959
+ * const x = createSpring({ onUpdate: (v) => (card.style.translate = `${v}px`) });
1960
+ * gesture(card, {
1961
+ * onPan: ({ dx, last, vx }) => (last ? x.set(0, vx) : x.jump(dx)),
1962
+ * onSwipe: ({ direction }) => dismiss(direction),
1963
+ * }, { axis: 'x' });
1964
+ */
1965
+ declare function gesture(el: HTMLElement, h: GestureHandlers, o?: GestureOptions): () => void;
1966
+
1967
+ /**
1968
+ * `<usa-swipeable>` — swipe-to-dismiss / swipe actions. The content follows
1969
+ * the finger (rubber-banded past `distance`), flies out on a swipe or a drag
1970
+ * past `distance`, otherwise springs home with the release velocity.
1971
+ *
1972
+ * Attributes: `axis` (`x` default · `y`), `distance` (px, 120), `preset`
1973
+ * (spring), `dismiss` (remove the element after flying out), `disabled`.
1974
+ * Keyboard: Delete/Backspace dismisses, ←/→ swipe. Events `usa:swipe`
1975
+ * (`{ direction }`, cancelable), `usa:dismiss`. Methods `swipe(dir)`, `reset()`.
1976
+ * Reduced motion: no follow / fly-out animation, events still fire.
1977
+ */
1978
+ interface UsaSwipeableElement extends UsaElement {
1979
+ swipe(direction: SwipeDirection): void;
1980
+ reset(): void;
1981
+ readonly offset: number;
1982
+ }
1983
+ declare function defineSwipeable(tag?: string): CustomElementConstructor | undefined;
1984
+
1985
+ /**
1986
+ * `<usa-pinch-zoom>` — pinch (two fingers or Ctrl/⌘ + wheel / trackpad
1987
+ * pinch) to zoom its content, pan while zoomed, double-tap to toggle zoom;
1988
+ * scale and position spring back inside the bounds on release.
1989
+ *
1990
+ * Attributes: `min` (1), `max` (4), `double-tap` (zoom level, 2), `preset`.
1991
+ * Keyboard: `+` / `-` / `0`. Property `scale`, method `zoomTo(scale)`.
1992
+ * Event `usa:zoom` (`{ scale }`). Reduced motion: zoom changes instantly.
1993
+ */
1994
+ interface UsaPinchZoomElement extends UsaElement {
1995
+ readonly scale: number;
1996
+ zoomTo(scale: number): void;
1997
+ }
1998
+ declare function definePinchZoom(tag?: string): CustomElementConstructor | undefined;
1999
+
2000
+ /**
2001
+ * use-scroll-animate/components/gesture — unified gestures (v3.2).
2002
+ * `gesture()` recognises pan, swipe, pinch, long-press, tap and double-tap
2003
+ * with release velocities for springs; `<usa-swipeable>` (swipe-to-dismiss)
2004
+ * and `<usa-pinch-zoom>` are built on it.
2005
+ */
2006
+
2007
+ /** Register every component of this category under its default tag. */
2008
+ declare function defineGestureComponents(): void;
2009
+ declare global {
2010
+ interface HTMLElementTagNameMap {
2011
+ 'usa-swipeable': UsaSwipeableElement;
2012
+ 'usa-pinch-zoom': UsaPinchZoomElement;
2013
+ }
2014
+ }
2015
+
1894
2016
  /** The component categories and their default tags. */
1895
2017
  declare const COMPONENT_CATEGORIES: {
1896
2018
  readonly reveal: readonly ["usa-reveal", "usa-stagger", "usa-scroll-progress", "usa-scrolly"];
@@ -1905,6 +2027,7 @@ declare const COMPONENT_CATEGORIES: {
1905
2027
  readonly ui: readonly ["usa-tabs", "usa-drawer", "usa-bottom-sheet", "usa-pull-refresh", "usa-fab", "usa-navbar", "usa-slider", "usa-rating", "usa-tooltip", "usa-popover", "usa-badge", "usa-avatar-stack"];
1906
2028
  readonly page: readonly ["usa-cursor", "usa-fullpage", "usa-loading-bar", "usa-back-to-top", "usa-ambient", "usa-splash", "usa-auto-skeleton", "usa-motion-switch"];
1907
2029
  readonly timeline: readonly ["usa-timeline"];
2030
+ readonly gesture: readonly ["usa-swipeable", "usa-pinch-zoom"];
1908
2031
  };
1909
2032
  type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
1910
2033
 
@@ -1914,5 +2037,5 @@ type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
1914
2037
  */
1915
2038
  declare function defineComponents(categories?: ComponentCategory[]): void;
1916
2039
 
1917
- export { AMBIENT_EFFECTS, BUTTON_DEFORMS, CARD_EFFECTS, CLICK_EFFECTS, COMPONENT_CATEGORIES, CURSOR_MODES, MORPH_ICONS, MOTION_SCALE, PAGE_EFFECTS, REVEAL_EFFECTS, SPINNER_VARIANTS, SPRING_EFFECTS, SPRING_PRESETS, TIMELINE_PRESETS, VARIANTS, adoptVariants, burst, confetti, configureComponents, connectedAnimation, createSpring, defineAccordion, defineAcrylic, defineAmbient, defineAurora, defineAutoSkeleton, defineAvatarStack, defineBackToTop, defineBackgroundComponents, defineBadge, defineBlobs, defineBottomSheet, defineButton, defineCard, defineCardComponents, defineCardStack, defineCarousel3d, defineCheck, defineCheckbox, defineClick, defineClickComponents, defineComponents, defineCounter, defineCursor, defineDialog, defineDotNetwork, defineDoubleTap, defineDraggable, defineDrawer, defineFab, defineFeedbackComponents, defineFlipList, defineFullpage, defineGlitch, defineGradientText, defineGrain, defineGridGlow, defineHandwriting, defineHold, defineIconMorph, defineInteractionComponents, defineLike, defineLoadingBar, defineMagnetic, defineMarquee, defineMotionSwitch, defineNavbar, defineOverscroll, definePageComponents, defineParticles, definePhysicsComponents, definePopover, definePress, defineProgress, definePullRefresh, defineRating, defineReveal, defineRevealComponents, defineRipple, defineScramble, defineScrollHighlight, defineScrollProgress, defineScrolly, defineShimmerText, defineSkeleton, defineSlider, defineSpinner, defineSplash, defineSplitText, defineSpotlight, defineSpring, defineStagger, defineStickyStack, defineTabs, defineTextComponents, defineTextRotate, defineTilt, defineTimeline, defineTimelineComponents, defineToaster, defineToggle, defineTooltip, defineTransitionComponents, defineTypewriter, defineUiComponents, defineViewSwitch, defineWaterRipple, defineWaveText, easeOutExpo, enableMpaTransitions, flip, fluentPreset, getMotionIntensity, haptic, linearEasing, loadingBar, morphPath, pageTransition, prefersReducedMotion, projectInertia, readScrollProgress, resolvePosition, resolveSpring, restoreMotionIntensity, revealKeyframes, rubberBand, scrambleFrame, scrollToTarget, setMotionIntensity, setVariant, shake, smoothScroll, snapTo, spring, springEasing, springEffectKeyframes, springSamples, stepSpring, supportsLinearEasing, supportsViewTransitions, themeTransition, timeline, toast, viewTransition };
1918
- export type { AmbientEffect, BurstOptions, ButtonDeform, ButtonShape, ButtonState, CardEffect, ClickEffect, ComponentCategory, ComponentsConfig, ConfettiOptions, ConnectedOptions, CursorMode, DialogVariant, FlipOptions, FluentPresetOptions, MotionIntensity, PageEffect, PageTransitionOptions, Placement, RevealEffect, ScrubOptions, SmoothScrollOptions, SpinnerVariant, SpringConfig, SpringEffect, SpringInput, SpringPreset, SpringValue, SpringValueOptions, Timeline, TimelineOptions, TimelinePosition, TimelineStepOptions, ToastHandle, ToastOptions, ToastType, UsaAccordionElement, UsaAcrylicElement, UsaAmbientElement, UsaAuroraElement, UsaAutoSkeletonElement, UsaAvatarStackElement, UsaBackToTopElement, UsaBadgeElement, UsaBlobsElement, UsaBottomSheetElement, UsaButtonElement, UsaCardElement, UsaCardStackElement, UsaCarousel3dElement, UsaCheckElement, UsaCheckboxElement, UsaClickElement, UsaCounterElement, UsaCursorElement, UsaDialogElement, UsaDotNetworkElement, UsaDoubleTapElement, UsaDraggableElement, UsaDrawerElement, UsaElement, UsaFabElement, UsaFlipListElement, UsaFullpageElement, UsaGlitchElement, UsaGradientTextElement, UsaGrainElement, UsaGridGlowElement, UsaHandwritingElement, UsaHoldElement, UsaIconMorphElement, UsaLikeElement, UsaLoadingBarElement, UsaMagneticElement, UsaMarqueeElement, UsaMotionSwitchElement, UsaNavbarElement, UsaOverscrollElement, UsaParticlesElement, UsaPopoverElement, UsaPressElement, UsaProgressElement, UsaPullRefreshElement, UsaRatingElement, UsaRevealElement, UsaRippleElement, UsaScrambleElement, UsaScrollHighlightElement, UsaScrollProgressElement, UsaScrollyElement, UsaShimmerTextElement, UsaSkeletonElement, UsaSliderElement, UsaSpinnerElement, UsaSplashElement, UsaSplitTextElement, UsaSpotlightElement, UsaSpringElement, UsaStaggerElement, UsaStickyStackElement, UsaTabsElement, UsaTextRotateElement, UsaTiltElement, UsaTimelineElement, UsaToasterElement, UsaToggleElement, UsaTooltipElement, UsaTypewriterElement, UsaViewSwitchElement, UsaWaterRippleElement, UsaWaveTextElement, Variant, ViewTransitionOptions };
2040
+ export { AMBIENT_EFFECTS, BUTTON_DEFORMS, CARD_EFFECTS, CLICK_EFFECTS, COMPONENT_CATEGORIES, CURSOR_MODES, MORPH_ICONS, MOTION_SCALE, PAGE_EFFECTS, REVEAL_EFFECTS, SPINNER_VARIANTS, SPRING_EFFECTS, SPRING_PRESETS, TIMELINE_PRESETS, VARIANTS, adoptVariants, burst, confetti, configureComponents, connectedAnimation, createSpring, defineAccordion, defineAcrylic, defineAmbient, defineAurora, defineAutoSkeleton, defineAvatarStack, defineBackToTop, defineBackgroundComponents, defineBadge, defineBlobs, defineBottomSheet, defineButton, defineCard, defineCardComponents, defineCardStack, defineCarousel3d, defineCheck, defineCheckbox, defineClick, defineClickComponents, defineComponents, defineCounter, defineCursor, defineDialog, defineDotNetwork, defineDoubleTap, defineDraggable, defineDrawer, defineFab, defineFeedbackComponents, defineFlipList, defineFullpage, defineGestureComponents, defineGlitch, defineGradientText, defineGrain, defineGridGlow, defineHandwriting, defineHold, defineIconMorph, defineInteractionComponents, defineLike, defineLoadingBar, defineMagnetic, defineMarquee, defineMotionSwitch, defineNavbar, defineOverscroll, definePageComponents, defineParticles, definePhysicsComponents, definePinchZoom, definePopover, definePress, defineProgress, definePullRefresh, defineRating, defineReveal, defineRevealComponents, defineRipple, defineScramble, defineScrollHighlight, defineScrollProgress, defineScrolly, defineShimmerText, defineSkeleton, defineSlider, defineSpinner, defineSplash, defineSplitText, defineSpotlight, defineSpring, defineStagger, defineStickyStack, defineSwipeable, defineTabs, defineTextComponents, defineTextRotate, defineTilt, defineTimeline, defineTimelineComponents, defineToaster, defineToggle, defineTooltip, defineTransitionComponents, defineTypewriter, defineUiComponents, defineViewSwitch, defineWaterRipple, defineWaveText, easeOutExpo, enableMpaTransitions, flip, fluentPreset, gesture, getMotionIntensity, haptic, linearEasing, loadingBar, morphPath, pageTransition, pinchScale, prefersReducedMotion, projectInertia, readScrollProgress, resolvePosition, resolveSpring, restoreMotionIntensity, revealKeyframes, rubberBand, scrambleFrame, scrollToTarget, setMotionIntensity, setVariant, shake, smoothScroll, snapTo, spring, springEasing, springEffectKeyframes, springSamples, stepSpring, supportsLinearEasing, supportsViewTransitions, swipeDirection, themeTransition, timeline, toast, viewTransition };
2041
+ export type { AmbientEffect, BurstOptions, ButtonDeform, ButtonShape, ButtonState, CardEffect, ClickEffect, ComponentCategory, ComponentsConfig, ConfettiOptions, ConnectedOptions, CursorMode, DialogVariant, FlipOptions, FluentPresetOptions, GestureHandlers, GestureOptions, MotionIntensity, PageEffect, PageTransitionOptions, PanState, PinchState, Placement, PressState, RevealEffect, ScrubOptions, SmoothScrollOptions, SpinnerVariant, SpringConfig, SpringEffect, SpringInput, SpringPreset, SpringValue, SpringValueOptions, SwipeDirection, SwipeState, Timeline, TimelineOptions, TimelinePosition, TimelineStepOptions, ToastHandle, ToastOptions, ToastType, UsaAccordionElement, UsaAcrylicElement, UsaAmbientElement, UsaAuroraElement, UsaAutoSkeletonElement, UsaAvatarStackElement, UsaBackToTopElement, UsaBadgeElement, UsaBlobsElement, UsaBottomSheetElement, UsaButtonElement, UsaCardElement, UsaCardStackElement, UsaCarousel3dElement, UsaCheckElement, UsaCheckboxElement, UsaClickElement, UsaCounterElement, UsaCursorElement, UsaDialogElement, UsaDotNetworkElement, UsaDoubleTapElement, UsaDraggableElement, UsaDrawerElement, UsaElement, UsaFabElement, UsaFlipListElement, UsaFullpageElement, UsaGlitchElement, UsaGradientTextElement, UsaGrainElement, UsaGridGlowElement, UsaHandwritingElement, UsaHoldElement, UsaIconMorphElement, UsaLikeElement, UsaLoadingBarElement, UsaMagneticElement, UsaMarqueeElement, UsaMotionSwitchElement, UsaNavbarElement, UsaOverscrollElement, UsaParticlesElement, UsaPinchZoomElement, UsaPopoverElement, UsaPressElement, UsaProgressElement, UsaPullRefreshElement, UsaRatingElement, UsaRevealElement, UsaRippleElement, UsaScrambleElement, UsaScrollHighlightElement, UsaScrollProgressElement, UsaScrollyElement, UsaShimmerTextElement, UsaSkeletonElement, UsaSliderElement, UsaSpinnerElement, UsaSplashElement, UsaSplitTextElement, UsaSpotlightElement, UsaSpringElement, UsaStaggerElement, UsaStickyStackElement, UsaSwipeableElement, UsaTabsElement, UsaTextRotateElement, UsaTiltElement, UsaTimelineElement, UsaToasterElement, UsaToggleElement, UsaTooltipElement, UsaTypewriterElement, UsaViewSwitchElement, UsaWaterRippleElement, UsaWaveTextElement, Variant, ViewTransitionOptions };
@@ -1891,6 +1891,128 @@ declare global {
1891
1891
  }
1892
1892
  }
1893
1893
 
1894
+ interface PanState {
1895
+ /** Offset from the gesture start (px). */
1896
+ dx: number;
1897
+ dy: number;
1898
+ /** Velocity (px/s). */
1899
+ vx: number;
1900
+ vy: number;
1901
+ first: boolean;
1902
+ last: boolean;
1903
+ event: Event;
1904
+ }
1905
+ type SwipeDirection = 'left' | 'right' | 'up' | 'down';
1906
+ interface SwipeState {
1907
+ direction: SwipeDirection;
1908
+ velocity: number;
1909
+ dx: number;
1910
+ dy: number;
1911
+ }
1912
+ interface PinchState {
1913
+ scale: number; /** Midpoint of the two pointers (client px). */
1914
+ x: number;
1915
+ y: number;
1916
+ first: boolean;
1917
+ last: boolean;
1918
+ }
1919
+ interface PressState {
1920
+ x: number;
1921
+ y: number;
1922
+ }
1923
+ interface GestureHandlers {
1924
+ onPan?: (s: PanState) => void;
1925
+ onSwipe?: (s: SwipeState) => void;
1926
+ onPinch?: (s: PinchState) => void;
1927
+ onLongPress?: (s: PressState) => void;
1928
+ onTap?: (s: PressState) => void;
1929
+ onDoubleTap?: (s: PressState) => void;
1930
+ }
1931
+ interface GestureOptions {
1932
+ /** Restrict panning to an axis. */
1933
+ axis?: 'x' | 'y';
1934
+ /** Movement (px) before a pan starts (default 4). */
1935
+ threshold?: number;
1936
+ /** Minimum distance (px, default 40) and speed (px/s, default 300) for a swipe. */
1937
+ swipeDistance?: number;
1938
+ swipeVelocity?: number;
1939
+ /** Long-press delay (ms, default 500). */
1940
+ longPress?: number;
1941
+ /** Ctrl/⌘ + wheel (trackpad pinch) counts as pinch (default true). */
1942
+ wheelPinch?: boolean;
1943
+ }
1944
+ /** The swipe a pointer release represents, or `null` (pure). */
1945
+ declare function swipeDirection(dx: number, dy: number, vx: number, vy: number, o?: {
1946
+ distance?: number;
1947
+ velocity?: number;
1948
+ axis?: 'x' | 'y';
1949
+ }): SwipeState | null;
1950
+ /** Scale between two pointer distances, clamped to [min, max] (pure). */
1951
+ declare function pinchScale(startDistance: number, distance: number, base?: number, min?: number, max?: number): number;
1952
+ /**
1953
+ * One recognizer for pan, swipe, pinch (two pointers or Ctrl + wheel),
1954
+ * long-press, tap and double-tap, with velocities ready to hand to a spring
1955
+ * (`createSpring().set(target, velocity)`). Works with mouse, touch and pen
1956
+ * through Pointer Events. Returns a cleanup function.
1957
+ *
1958
+ * @example
1959
+ * const x = createSpring({ onUpdate: (v) => (card.style.translate = `${v}px`) });
1960
+ * gesture(card, {
1961
+ * onPan: ({ dx, last, vx }) => (last ? x.set(0, vx) : x.jump(dx)),
1962
+ * onSwipe: ({ direction }) => dismiss(direction),
1963
+ * }, { axis: 'x' });
1964
+ */
1965
+ declare function gesture(el: HTMLElement, h: GestureHandlers, o?: GestureOptions): () => void;
1966
+
1967
+ /**
1968
+ * `<usa-swipeable>` — swipe-to-dismiss / swipe actions. The content follows
1969
+ * the finger (rubber-banded past `distance`), flies out on a swipe or a drag
1970
+ * past `distance`, otherwise springs home with the release velocity.
1971
+ *
1972
+ * Attributes: `axis` (`x` default · `y`), `distance` (px, 120), `preset`
1973
+ * (spring), `dismiss` (remove the element after flying out), `disabled`.
1974
+ * Keyboard: Delete/Backspace dismisses, ←/→ swipe. Events `usa:swipe`
1975
+ * (`{ direction }`, cancelable), `usa:dismiss`. Methods `swipe(dir)`, `reset()`.
1976
+ * Reduced motion: no follow / fly-out animation, events still fire.
1977
+ */
1978
+ interface UsaSwipeableElement extends UsaElement {
1979
+ swipe(direction: SwipeDirection): void;
1980
+ reset(): void;
1981
+ readonly offset: number;
1982
+ }
1983
+ declare function defineSwipeable(tag?: string): CustomElementConstructor | undefined;
1984
+
1985
+ /**
1986
+ * `<usa-pinch-zoom>` — pinch (two fingers or Ctrl/⌘ + wheel / trackpad
1987
+ * pinch) to zoom its content, pan while zoomed, double-tap to toggle zoom;
1988
+ * scale and position spring back inside the bounds on release.
1989
+ *
1990
+ * Attributes: `min` (1), `max` (4), `double-tap` (zoom level, 2), `preset`.
1991
+ * Keyboard: `+` / `-` / `0`. Property `scale`, method `zoomTo(scale)`.
1992
+ * Event `usa:zoom` (`{ scale }`). Reduced motion: zoom changes instantly.
1993
+ */
1994
+ interface UsaPinchZoomElement extends UsaElement {
1995
+ readonly scale: number;
1996
+ zoomTo(scale: number): void;
1997
+ }
1998
+ declare function definePinchZoom(tag?: string): CustomElementConstructor | undefined;
1999
+
2000
+ /**
2001
+ * use-scroll-animate/components/gesture — unified gestures (v3.2).
2002
+ * `gesture()` recognises pan, swipe, pinch, long-press, tap and double-tap
2003
+ * with release velocities for springs; `<usa-swipeable>` (swipe-to-dismiss)
2004
+ * and `<usa-pinch-zoom>` are built on it.
2005
+ */
2006
+
2007
+ /** Register every component of this category under its default tag. */
2008
+ declare function defineGestureComponents(): void;
2009
+ declare global {
2010
+ interface HTMLElementTagNameMap {
2011
+ 'usa-swipeable': UsaSwipeableElement;
2012
+ 'usa-pinch-zoom': UsaPinchZoomElement;
2013
+ }
2014
+ }
2015
+
1894
2016
  /** The component categories and their default tags. */
1895
2017
  declare const COMPONENT_CATEGORIES: {
1896
2018
  readonly reveal: readonly ["usa-reveal", "usa-stagger", "usa-scroll-progress", "usa-scrolly"];
@@ -1905,6 +2027,7 @@ declare const COMPONENT_CATEGORIES: {
1905
2027
  readonly ui: readonly ["usa-tabs", "usa-drawer", "usa-bottom-sheet", "usa-pull-refresh", "usa-fab", "usa-navbar", "usa-slider", "usa-rating", "usa-tooltip", "usa-popover", "usa-badge", "usa-avatar-stack"];
1906
2028
  readonly page: readonly ["usa-cursor", "usa-fullpage", "usa-loading-bar", "usa-back-to-top", "usa-ambient", "usa-splash", "usa-auto-skeleton", "usa-motion-switch"];
1907
2029
  readonly timeline: readonly ["usa-timeline"];
2030
+ readonly gesture: readonly ["usa-swipeable", "usa-pinch-zoom"];
1908
2031
  };
1909
2032
  type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
1910
2033
 
@@ -1914,5 +2037,5 @@ type ComponentCategory = keyof typeof COMPONENT_CATEGORIES;
1914
2037
  */
1915
2038
  declare function defineComponents(categories?: ComponentCategory[]): void;
1916
2039
 
1917
- export { AMBIENT_EFFECTS, BUTTON_DEFORMS, CARD_EFFECTS, CLICK_EFFECTS, COMPONENT_CATEGORIES, CURSOR_MODES, MORPH_ICONS, MOTION_SCALE, PAGE_EFFECTS, REVEAL_EFFECTS, SPINNER_VARIANTS, SPRING_EFFECTS, SPRING_PRESETS, TIMELINE_PRESETS, VARIANTS, adoptVariants, burst, confetti, configureComponents, connectedAnimation, createSpring, defineAccordion, defineAcrylic, defineAmbient, defineAurora, defineAutoSkeleton, defineAvatarStack, defineBackToTop, defineBackgroundComponents, defineBadge, defineBlobs, defineBottomSheet, defineButton, defineCard, defineCardComponents, defineCardStack, defineCarousel3d, defineCheck, defineCheckbox, defineClick, defineClickComponents, defineComponents, defineCounter, defineCursor, defineDialog, defineDotNetwork, defineDoubleTap, defineDraggable, defineDrawer, defineFab, defineFeedbackComponents, defineFlipList, defineFullpage, defineGlitch, defineGradientText, defineGrain, defineGridGlow, defineHandwriting, defineHold, defineIconMorph, defineInteractionComponents, defineLike, defineLoadingBar, defineMagnetic, defineMarquee, defineMotionSwitch, defineNavbar, defineOverscroll, definePageComponents, defineParticles, definePhysicsComponents, definePopover, definePress, defineProgress, definePullRefresh, defineRating, defineReveal, defineRevealComponents, defineRipple, defineScramble, defineScrollHighlight, defineScrollProgress, defineScrolly, defineShimmerText, defineSkeleton, defineSlider, defineSpinner, defineSplash, defineSplitText, defineSpotlight, defineSpring, defineStagger, defineStickyStack, defineTabs, defineTextComponents, defineTextRotate, defineTilt, defineTimeline, defineTimelineComponents, defineToaster, defineToggle, defineTooltip, defineTransitionComponents, defineTypewriter, defineUiComponents, defineViewSwitch, defineWaterRipple, defineWaveText, easeOutExpo, enableMpaTransitions, flip, fluentPreset, getMotionIntensity, haptic, linearEasing, loadingBar, morphPath, pageTransition, prefersReducedMotion, projectInertia, readScrollProgress, resolvePosition, resolveSpring, restoreMotionIntensity, revealKeyframes, rubberBand, scrambleFrame, scrollToTarget, setMotionIntensity, setVariant, shake, smoothScroll, snapTo, spring, springEasing, springEffectKeyframes, springSamples, stepSpring, supportsLinearEasing, supportsViewTransitions, themeTransition, timeline, toast, viewTransition };
1918
- export type { AmbientEffect, BurstOptions, ButtonDeform, ButtonShape, ButtonState, CardEffect, ClickEffect, ComponentCategory, ComponentsConfig, ConfettiOptions, ConnectedOptions, CursorMode, DialogVariant, FlipOptions, FluentPresetOptions, MotionIntensity, PageEffect, PageTransitionOptions, Placement, RevealEffect, ScrubOptions, SmoothScrollOptions, SpinnerVariant, SpringConfig, SpringEffect, SpringInput, SpringPreset, SpringValue, SpringValueOptions, Timeline, TimelineOptions, TimelinePosition, TimelineStepOptions, ToastHandle, ToastOptions, ToastType, UsaAccordionElement, UsaAcrylicElement, UsaAmbientElement, UsaAuroraElement, UsaAutoSkeletonElement, UsaAvatarStackElement, UsaBackToTopElement, UsaBadgeElement, UsaBlobsElement, UsaBottomSheetElement, UsaButtonElement, UsaCardElement, UsaCardStackElement, UsaCarousel3dElement, UsaCheckElement, UsaCheckboxElement, UsaClickElement, UsaCounterElement, UsaCursorElement, UsaDialogElement, UsaDotNetworkElement, UsaDoubleTapElement, UsaDraggableElement, UsaDrawerElement, UsaElement, UsaFabElement, UsaFlipListElement, UsaFullpageElement, UsaGlitchElement, UsaGradientTextElement, UsaGrainElement, UsaGridGlowElement, UsaHandwritingElement, UsaHoldElement, UsaIconMorphElement, UsaLikeElement, UsaLoadingBarElement, UsaMagneticElement, UsaMarqueeElement, UsaMotionSwitchElement, UsaNavbarElement, UsaOverscrollElement, UsaParticlesElement, UsaPopoverElement, UsaPressElement, UsaProgressElement, UsaPullRefreshElement, UsaRatingElement, UsaRevealElement, UsaRippleElement, UsaScrambleElement, UsaScrollHighlightElement, UsaScrollProgressElement, UsaScrollyElement, UsaShimmerTextElement, UsaSkeletonElement, UsaSliderElement, UsaSpinnerElement, UsaSplashElement, UsaSplitTextElement, UsaSpotlightElement, UsaSpringElement, UsaStaggerElement, UsaStickyStackElement, UsaTabsElement, UsaTextRotateElement, UsaTiltElement, UsaTimelineElement, UsaToasterElement, UsaToggleElement, UsaTooltipElement, UsaTypewriterElement, UsaViewSwitchElement, UsaWaterRippleElement, UsaWaveTextElement, Variant, ViewTransitionOptions };
2040
+ export { AMBIENT_EFFECTS, BUTTON_DEFORMS, CARD_EFFECTS, CLICK_EFFECTS, COMPONENT_CATEGORIES, CURSOR_MODES, MORPH_ICONS, MOTION_SCALE, PAGE_EFFECTS, REVEAL_EFFECTS, SPINNER_VARIANTS, SPRING_EFFECTS, SPRING_PRESETS, TIMELINE_PRESETS, VARIANTS, adoptVariants, burst, confetti, configureComponents, connectedAnimation, createSpring, defineAccordion, defineAcrylic, defineAmbient, defineAurora, defineAutoSkeleton, defineAvatarStack, defineBackToTop, defineBackgroundComponents, defineBadge, defineBlobs, defineBottomSheet, defineButton, defineCard, defineCardComponents, defineCardStack, defineCarousel3d, defineCheck, defineCheckbox, defineClick, defineClickComponents, defineComponents, defineCounter, defineCursor, defineDialog, defineDotNetwork, defineDoubleTap, defineDraggable, defineDrawer, defineFab, defineFeedbackComponents, defineFlipList, defineFullpage, defineGestureComponents, defineGlitch, defineGradientText, defineGrain, defineGridGlow, defineHandwriting, defineHold, defineIconMorph, defineInteractionComponents, defineLike, defineLoadingBar, defineMagnetic, defineMarquee, defineMotionSwitch, defineNavbar, defineOverscroll, definePageComponents, defineParticles, definePhysicsComponents, definePinchZoom, definePopover, definePress, defineProgress, definePullRefresh, defineRating, defineReveal, defineRevealComponents, defineRipple, defineScramble, defineScrollHighlight, defineScrollProgress, defineScrolly, defineShimmerText, defineSkeleton, defineSlider, defineSpinner, defineSplash, defineSplitText, defineSpotlight, defineSpring, defineStagger, defineStickyStack, defineSwipeable, defineTabs, defineTextComponents, defineTextRotate, defineTilt, defineTimeline, defineTimelineComponents, defineToaster, defineToggle, defineTooltip, defineTransitionComponents, defineTypewriter, defineUiComponents, defineViewSwitch, defineWaterRipple, defineWaveText, easeOutExpo, enableMpaTransitions, flip, fluentPreset, gesture, getMotionIntensity, haptic, linearEasing, loadingBar, morphPath, pageTransition, pinchScale, prefersReducedMotion, projectInertia, readScrollProgress, resolvePosition, resolveSpring, restoreMotionIntensity, revealKeyframes, rubberBand, scrambleFrame, scrollToTarget, setMotionIntensity, setVariant, shake, smoothScroll, snapTo, spring, springEasing, springEffectKeyframes, springSamples, stepSpring, supportsLinearEasing, supportsViewTransitions, swipeDirection, themeTransition, timeline, toast, viewTransition };
2041
+ export type { AmbientEffect, BurstOptions, ButtonDeform, ButtonShape, ButtonState, CardEffect, ClickEffect, ComponentCategory, ComponentsConfig, ConfettiOptions, ConnectedOptions, CursorMode, DialogVariant, FlipOptions, FluentPresetOptions, GestureHandlers, GestureOptions, MotionIntensity, PageEffect, PageTransitionOptions, PanState, PinchState, Placement, PressState, RevealEffect, ScrubOptions, SmoothScrollOptions, SpinnerVariant, SpringConfig, SpringEffect, SpringInput, SpringPreset, SpringValue, SpringValueOptions, SwipeDirection, SwipeState, Timeline, TimelineOptions, TimelinePosition, TimelineStepOptions, ToastHandle, ToastOptions, ToastType, UsaAccordionElement, UsaAcrylicElement, UsaAmbientElement, UsaAuroraElement, UsaAutoSkeletonElement, UsaAvatarStackElement, UsaBackToTopElement, UsaBadgeElement, UsaBlobsElement, UsaBottomSheetElement, UsaButtonElement, UsaCardElement, UsaCardStackElement, UsaCarousel3dElement, UsaCheckElement, UsaCheckboxElement, UsaClickElement, UsaCounterElement, UsaCursorElement, UsaDialogElement, UsaDotNetworkElement, UsaDoubleTapElement, UsaDraggableElement, UsaDrawerElement, UsaElement, UsaFabElement, UsaFlipListElement, UsaFullpageElement, UsaGlitchElement, UsaGradientTextElement, UsaGrainElement, UsaGridGlowElement, UsaHandwritingElement, UsaHoldElement, UsaIconMorphElement, UsaLikeElement, UsaLoadingBarElement, UsaMagneticElement, UsaMarqueeElement, UsaMotionSwitchElement, UsaNavbarElement, UsaOverscrollElement, UsaParticlesElement, UsaPinchZoomElement, UsaPopoverElement, UsaPressElement, UsaProgressElement, UsaPullRefreshElement, UsaRatingElement, UsaRevealElement, UsaRippleElement, UsaScrambleElement, UsaScrollHighlightElement, UsaScrollProgressElement, UsaScrollyElement, UsaShimmerTextElement, UsaSkeletonElement, UsaSliderElement, UsaSpinnerElement, UsaSplashElement, UsaSplitTextElement, UsaSpotlightElement, UsaSpringElement, UsaStaggerElement, UsaStickyStackElement, UsaSwipeableElement, UsaTabsElement, UsaTextRotateElement, UsaTiltElement, UsaTimelineElement, UsaToasterElement, UsaToggleElement, UsaTooltipElement, UsaTypewriterElement, UsaViewSwitchElement, UsaWaterRippleElement, UsaWaveTextElement, Variant, ViewTransitionOptions };
@@ -22,11 +22,13 @@ import { definePageComponents } from './components/page.js';
22
22
  export { AMBIENT_EFFECTS, CURSOR_MODES, PAGE_EFFECTS, defineAmbient, defineAutoSkeleton, defineBackToTop, defineCursor, defineFullpage, defineLoadingBar, defineMotionSwitch, defineSplash, enableMpaTransitions, loadingBar, pageTransition, restoreMotionIntensity, scrollToTarget, setMotionIntensity, smoothScroll, supportsViewTransitions, themeTransition } from './components/page.js';
23
23
  import { defineTimelineComponents } from './components/timeline.js';
24
24
  export { TIMELINE_PRESETS, defineTimeline, resolvePosition, timeline } from './components/timeline.js';
25
+ import { defineGestureComponents } from './components/gesture.js';
26
+ export { definePinchZoom, defineSwipeable, gesture, pinchScale, swipeDirection } from './components/gesture.js';
25
27
  import { a as adoptVariants } from './chunks/variants-BQ3gCb5L.js';
26
28
  export { V as VARIANTS, s as setVariant } from './chunks/variants-BQ3gCb5L.js';
27
29
  import { c as canDefine } from './chunks/base-Cu-86Z31.js';
28
30
  export { M as MOTION_SCALE, a as configureComponents, g as getMotionIntensity, p as prefersReducedMotion } from './chunks/base-Cu-86Z31.js';
29
- export { C as COMPONENT_CATEGORIES } from './chunks/index-tags-D7NynL4r.js';
31
+ export { C as COMPONENT_CATEGORIES } from './chunks/index-tags-DZ-gjMZc.js';
30
32
  export { S as SPRING_PRESETS, c as createSpring, l as linearEasing, p as projectInertia, r as resolveSpring, a as rubberBand, s as snapTo, b as spring, d as springEasing, e as springSamples, f as stepSpring, g as supportsLinearEasing } from './chunks/spring-BV-cpTHC.js';
31
33
 
32
34
  /**
@@ -62,6 +64,7 @@ const BY_CATEGORY = {
62
64
  ui: defineUiComponents,
63
65
  page: definePageComponents,
64
66
  timeline: defineTimelineComponents,
67
+ gesture: defineGestureComponents,
65
68
  };
66
69
  /**
67
70
  * Register every `<usa-*>` component (or only the given categories).
@@ -73,5 +76,5 @@ function defineComponents(categories) {
73
76
  (categories || Object.keys(BY_CATEGORY)).forEach((c) => BY_CATEGORY[c]?.());
74
77
  }
75
78
 
76
- export { adoptVariants, defineBackgroundComponents, defineCardComponents, defineClickComponents, defineComponents, defineFeedbackComponents, defineInteractionComponents, definePageComponents, definePhysicsComponents, defineRevealComponents, defineTextComponents, defineTimelineComponents, defineTransitionComponents, defineUiComponents };
79
+ export { adoptVariants, defineBackgroundComponents, defineCardComponents, defineClickComponents, defineComponents, defineFeedbackComponents, defineGestureComponents, defineInteractionComponents, definePageComponents, definePhysicsComponents, defineRevealComponents, defineTextComponents, defineTimelineComponents, defineTransitionComponents, defineUiComponents };
77
80
  //# sourceMappingURL=components.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","sources":["../src/components/index.ts"],"sourcesContent":["/**\n * use-scroll-animate/components\n *\n * Framework-agnostic, dependency-free animated UI components built on\n * Custom Elements + CSS + the Web Animations API. They run in any browser\n * and in Windows desktop apps that render with a web view: Electron, Tauri\n * (WebView2), WinUI 3 / WPF / WinForms with WebView2, and installed PWAs.\n *\n * ```js\n * import { defineComponents } from 'use-scroll-animate/components';\n * defineComponents(); // registers every <usa-*> element\n * // or only what you use (tree-shakable):\n * import { defineTypewriter } from 'use-scroll-animate/components/text';\n * ```\n *\n * Importing has no side effects and is SSR-safe; nothing is registered\n * until a `define*()` function runs in a browser.\n *\n * @license MIT\n */\nimport { defineRevealComponents } from './reveal/index';\nimport { defineTextComponents } from './text/index';\nimport { defineInteractionComponents } from './interaction/index';\nimport { defineFeedbackComponents } from './feedback/index';\nimport { defineBackgroundComponents } from './background/index';\nimport { defineTransitionComponents } from './transitions/index';\nimport { definePhysicsComponents } from './physics/index';\nimport { defineCardComponents } from './cards/index';\nimport { defineClickComponents } from './click/index';\nimport { defineUiComponents } from './ui/index';\nimport { definePageComponents } from './page/index';\nimport { defineTimelineComponents } from './timeline/index';\nimport { adoptVariants } from './ui/variants';\nimport { canDefine } from './base';\n\nexport * from './reveal/index';\nexport * from './text/index';\nexport * from './interaction/index';\nexport * from './feedback/index';\nexport * from './background/index';\nexport * from './transitions/index';\nexport * from './physics/index';\nexport * from './cards/index';\nexport * from './click/index';\nexport * from './ui/index';\nexport * from './page/index';\nexport * from './timeline/index';\n\nexport { COMPONENT_CATEGORIES } from './index-tags';\nexport type { ComponentCategory } from './index-tags';\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from './index-tags';\n\nconst BY_CATEGORY: Record<ComponentCategory, () => void> = {\n reveal: defineRevealComponents,\n text: defineTextComponents,\n interaction: defineInteractionComponents,\n feedback: defineFeedbackComponents,\n background: defineBackgroundComponents,\n transitions: defineTransitionComponents,\n physics: definePhysicsComponents,\n cards: defineCardComponents,\n click: defineClickComponents,\n ui: defineUiComponents,\n page: definePageComponents,\n timeline: defineTimelineComponents,\n};\n\n/**\n * Register every `<usa-*>` component (or only the given categories).\n * Safe to call more than once and on the server (no-op without DOM).\n */\nexport function defineComponents(categories?: ComponentCategory[]): void {\n if (canDefine()) adoptVariants();\n (categories || (Object.keys(BY_CATEGORY) as ComponentCategory[])).forEach((c) => BY_CATEGORY[c]?.());\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAiCH,MAAM,WAAW,GAA0C;AACzD,IAAA,MAAM,EAAE,sBAAsB;AAC9B,IAAA,IAAI,EAAE,oBAAoB;AAC1B,IAAA,WAAW,EAAE,2BAA2B;AACxC,IAAA,QAAQ,EAAE,wBAAwB;AAClC,IAAA,UAAU,EAAE,0BAA0B;AACtC,IAAA,WAAW,EAAE,0BAA0B;AACvC,IAAA,OAAO,EAAE,uBAAuB;AAChC,IAAA,KAAK,EAAE,oBAAoB;AAC3B,IAAA,KAAK,EAAE,qBAAqB;AAC5B,IAAA,EAAE,EAAE,kBAAkB;AACtB,IAAA,IAAI,EAAE,oBAAoB;AAC1B,IAAA,QAAQ,EAAE,wBAAwB;CACnC;AAED;;;AAGG;AACG,SAAU,gBAAgB,CAAC,UAAgC,EAAA;AAC/D,IAAA,IAAI,SAAS,EAAE;AAAE,QAAA,aAAa,EAAE;IAChC,CAAC,UAAU,IAAK,MAAM,CAAC,IAAI,CAAC,WAAW,CAAyB,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;AACtG;;;;"}
1
+ {"version":3,"file":"components.js","sources":["../src/components/index.ts"],"sourcesContent":["/**\n * use-scroll-animate/components\n *\n * Framework-agnostic, dependency-free animated UI components built on\n * Custom Elements + CSS + the Web Animations API. They run in any browser\n * and in Windows desktop apps that render with a web view: Electron, Tauri\n * (WebView2), WinUI 3 / WPF / WinForms with WebView2, and installed PWAs.\n *\n * ```js\n * import { defineComponents } from 'use-scroll-animate/components';\n * defineComponents(); // registers every <usa-*> element\n * // or only what you use (tree-shakable):\n * import { defineTypewriter } from 'use-scroll-animate/components/text';\n * ```\n *\n * Importing has no side effects and is SSR-safe; nothing is registered\n * until a `define*()` function runs in a browser.\n *\n * @license MIT\n */\nimport { defineRevealComponents } from './reveal/index';\nimport { defineTextComponents } from './text/index';\nimport { defineInteractionComponents } from './interaction/index';\nimport { defineFeedbackComponents } from './feedback/index';\nimport { defineBackgroundComponents } from './background/index';\nimport { defineTransitionComponents } from './transitions/index';\nimport { definePhysicsComponents } from './physics/index';\nimport { defineCardComponents } from './cards/index';\nimport { defineClickComponents } from './click/index';\nimport { defineUiComponents } from './ui/index';\nimport { definePageComponents } from './page/index';\nimport { defineTimelineComponents } from './timeline/index';\nimport { defineGestureComponents } from './gesture/index';\nimport { adoptVariants } from './ui/variants';\nimport { canDefine } from './base';\n\nexport * from './reveal/index';\nexport * from './text/index';\nexport * from './interaction/index';\nexport * from './feedback/index';\nexport * from './background/index';\nexport * from './transitions/index';\nexport * from './physics/index';\nexport * from './cards/index';\nexport * from './click/index';\nexport * from './ui/index';\nexport * from './page/index';\nexport * from './timeline/index';\nexport * from './gesture/index';\n\nexport { COMPONENT_CATEGORIES } from './index-tags';\nexport type { ComponentCategory } from './index-tags';\nimport { COMPONENT_CATEGORIES, type ComponentCategory } from './index-tags';\n\nconst BY_CATEGORY: Record<ComponentCategory, () => void> = {\n reveal: defineRevealComponents,\n text: defineTextComponents,\n interaction: defineInteractionComponents,\n feedback: defineFeedbackComponents,\n background: defineBackgroundComponents,\n transitions: defineTransitionComponents,\n physics: definePhysicsComponents,\n cards: defineCardComponents,\n click: defineClickComponents,\n ui: defineUiComponents,\n page: definePageComponents,\n timeline: defineTimelineComponents,\n gesture: defineGestureComponents,\n};\n\n/**\n * Register every `<usa-*>` component (or only the given categories).\n * Safe to call more than once and on the server (no-op without DOM).\n */\nexport function defineComponents(categories?: ComponentCategory[]): void {\n if (canDefine()) adoptVariants();\n (categories || (Object.keys(BY_CATEGORY) as ComponentCategory[])).forEach((c) => BY_CATEGORY[c]?.());\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBG;AAmCH,MAAM,WAAW,GAA0C;AACzD,IAAA,MAAM,EAAE,sBAAsB;AAC9B,IAAA,IAAI,EAAE,oBAAoB;AAC1B,IAAA,WAAW,EAAE,2BAA2B;AACxC,IAAA,QAAQ,EAAE,wBAAwB;AAClC,IAAA,UAAU,EAAE,0BAA0B;AACtC,IAAA,WAAW,EAAE,0BAA0B;AACvC,IAAA,OAAO,EAAE,uBAAuB;AAChC,IAAA,KAAK,EAAE,oBAAoB;AAC3B,IAAA,KAAK,EAAE,qBAAqB;AAC5B,IAAA,EAAE,EAAE,kBAAkB;AACtB,IAAA,IAAI,EAAE,oBAAoB;AAC1B,IAAA,QAAQ,EAAE,wBAAwB;AAClC,IAAA,OAAO,EAAE,uBAAuB;CACjC;AAED;;;AAGG;AACG,SAAU,gBAAgB,CAAC,UAAgC,EAAA;AAC/D,IAAA,IAAI,SAAS,EAAE;AAAE,QAAA,aAAa,EAAE;IAChC,CAAC,UAAU,IAAK,MAAM,CAAC,IAAI,CAAC,WAAW,CAAyB,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;AACtG;;;;"}