@ansh-ui/react 0.3.0 → 0.3.1

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 (57) hide show
  1. package/dist/{chunk-YACOHFYJ.cjs → chunk-2U7BHYIQ.cjs} +121 -121
  2. package/dist/chunk-2U7BHYIQ.cjs.map +1 -0
  3. package/dist/{chunk-WNWGYXJY.js → chunk-7QGB2X7R.js} +34 -26
  4. package/dist/chunk-7QGB2X7R.js.map +1 -0
  5. package/dist/{chunk-OLTS6G5M.js → chunk-GNA33V2J.js} +11 -6
  6. package/dist/chunk-GNA33V2J.js.map +1 -0
  7. package/dist/{chunk-IZ6T7LO3.cjs → chunk-MPX7QT4R.cjs} +2 -2
  8. package/dist/chunk-MPX7QT4R.cjs.map +1 -0
  9. package/dist/{chunk-PVDQPVYF.js → chunk-NJUVVMJV.js} +2 -2
  10. package/dist/chunk-NJUVVMJV.js.map +1 -0
  11. package/dist/{chunk-CWYBOVCZ.js → chunk-RGGNLAAA.js} +121 -121
  12. package/dist/chunk-RGGNLAAA.js.map +1 -0
  13. package/dist/{chunk-OJN5JBNP.cjs → chunk-VJI6V27F.cjs} +99 -99
  14. package/dist/chunk-VJI6V27F.cjs.map +1 -0
  15. package/dist/{chunk-HPGCILO4.js → chunk-XRKZPLUT.js} +99 -99
  16. package/dist/chunk-XRKZPLUT.js.map +1 -0
  17. package/dist/{chunk-DATBU46V.cjs → chunk-XYT6OXKP.cjs} +10 -4
  18. package/dist/chunk-XYT6OXKP.cjs.map +1 -0
  19. package/dist/{chunk-3SWO2M33.cjs → chunk-YVJB7AAZ.cjs} +34 -26
  20. package/dist/chunk-YVJB7AAZ.cjs.map +1 -0
  21. package/dist/data.cjs +16 -16
  22. package/dist/data.d.cts +23 -22
  23. package/dist/data.d.ts +23 -22
  24. package/dist/data.js +1 -1
  25. package/dist/form.cjs +36 -36
  26. package/dist/form.d.cts +2 -0
  27. package/dist/form.d.ts +2 -0
  28. package/dist/form.js +1 -1
  29. package/dist/index.cjs +99 -99
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +1 -1
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.js +10 -9
  34. package/dist/index.js.map +1 -1
  35. package/dist/{motion-DsQPOsTT.d.cts → motion-C6WfBFES.d.cts} +20 -17
  36. package/dist/{motion-DoT_sTl1.d.ts → motion-ugXmf505.d.ts} +20 -17
  37. package/dist/motion.cjs +17 -17
  38. package/dist/motion.d.cts +1 -1
  39. package/dist/motion.d.ts +1 -1
  40. package/dist/motion.js +1 -1
  41. package/dist/navigation.cjs +8 -8
  42. package/dist/navigation.js +1 -1
  43. package/dist/overlay.cjs +15 -15
  44. package/dist/overlay.d.cts +14 -12
  45. package/dist/overlay.d.ts +14 -12
  46. package/dist/overlay.js +1 -1
  47. package/package.json +3 -3
  48. package/dist/chunk-3SWO2M33.cjs.map +0 -1
  49. package/dist/chunk-CWYBOVCZ.js.map +0 -1
  50. package/dist/chunk-DATBU46V.cjs.map +0 -1
  51. package/dist/chunk-HPGCILO4.js.map +0 -1
  52. package/dist/chunk-IZ6T7LO3.cjs.map +0 -1
  53. package/dist/chunk-OJN5JBNP.cjs.map +0 -1
  54. package/dist/chunk-OLTS6G5M.js.map +0 -1
  55. package/dist/chunk-PVDQPVYF.js.map +0 -1
  56. package/dist/chunk-WNWGYXJY.js.map +0 -1
  57. package/dist/chunk-YACOHFYJ.cjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { useControllableState } from './chunk-LXCIXR5T.js';
2
2
  import { cx } from './chunk-H34OXXJU.js';
3
- import { useId, useRef, useState, useEffect } from 'react';
3
+ import { useId, useRef, useState, useEffect, version } from 'react';
4
4
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
5
 
6
6
  function Tabs({
@@ -396,6 +396,11 @@ function NavigationMenu({
396
396
  }
397
397
  );
398
398
  }
399
+ var BOOLEAN_INERT = Number.parseInt(version, 10) >= 19;
400
+ function inertProps(inert) {
401
+ if (!inert) return {};
402
+ return BOOLEAN_INERT ? { inert: true } : { inert: "" };
403
+ }
399
404
  function Collapsible({
400
405
  open,
401
406
  defaultOpen = false,
@@ -453,7 +458,7 @@ function Collapsible({
453
458
  id,
454
459
  role: "region",
455
460
  "data-state": isOpen ? "open" : "closed",
456
- children: /* @__PURE__ */ jsx("div", { className: "ansh-collapsible__inner", ...isOpen ? null : { inert: true }, children })
461
+ children: /* @__PURE__ */ jsx("div", { className: "ansh-collapsible__inner", ...inertProps(!isOpen), children })
457
462
  }
458
463
  )
459
464
  ] });
@@ -563,7 +568,7 @@ function Accordion({
563
568
  role: "region",
564
569
  "aria-labelledby": headerId,
565
570
  "data-state": open ? "open" : "closed",
566
- children: /* @__PURE__ */ jsx("div", { className: "ansh-accordion__panel", ...open ? null : { inert: true }, children: item.content })
571
+ children: /* @__PURE__ */ jsx("div", { className: "ansh-accordion__panel", ...inertProps(!open), children: item.content })
567
572
  }
568
573
  )
569
574
  ]
@@ -601,6 +606,6 @@ function DisclosureList({
601
606
  ] });
602
607
  }
603
608
 
604
- export { Accordion, Breadcrumbs, Collapsible, DisclosureList, NavigationMenu, Stepper, Tabs };
605
- //# sourceMappingURL=chunk-OLTS6G5M.js.map
606
- //# sourceMappingURL=chunk-OLTS6G5M.js.map
609
+ export { Accordion, Breadcrumbs, Collapsible, DisclosureList, NavigationMenu, Stepper, Tabs, inertProps };
610
+ //# sourceMappingURL=chunk-GNA33V2J.js.map
611
+ //# sourceMappingURL=chunk-GNA33V2J.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/navigation/tabs.tsx","../src/components/navigation/breadcrumbs.tsx","../src/components/navigation/nav-menu.tsx","../src/primitives/inert.ts","../src/components/disclosure.tsx"],"names":["jsx","jsxs","useState","useRef","useId"],"mappings":";;;;;AAgDO,SAAS,IAAA,CAAK;AAAA,EACnB,KAAA;AAAA,EACA,KAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA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,OAAO,GAAG,GAAA,CAAI,CAAC,MAAM,KAAA,qBACvDA,IAAC,IAAA,EAAA,EAAgB,QAAA,EAAA,IAAA,EAAA,EAAR,KAAa,CACvB,CAAA,EACH,CAAA;AAAA,oBACAA,GAAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAK,QAAA;AAAA,QACL,SAAA,EAAU,6CAAA;AAAA,QACV,eAAA,EAAe,QAAA;AAAA,QACf,eAAA,EAAe,EAAA;AAAA,QACf,SAAS,MAAM,WAAA,CAAY,CAAC,CAAA,KAAM,CAAC,CAAC,CAAA;AAAA,QAEnC,QAAA,EAAA,QAAA,GAAW,SAAA,GAAY,SAAA,CAAU,MAAM;AAAA;AAAA;AAC1C,GAAA,EACF,CAAA;AAEJ","file":"chunk-GNA33V2J.js","sourcesContent":["import { type ReactNode, useId, useRef } from 'react'\nimport { cx } from '../../primitives/compose'\nimport { useControllableState } from '../../primitives/use-controllable-state'\n\nexport interface TabItem {\n id: string\n label: ReactNode\n icon?: ReactNode\n /** Count or status shown after the label. */\n badge?: ReactNode\n disabled?: boolean\n content?: ReactNode\n}\n\nexport interface TabsProps {\n items: readonly TabItem[]\n value?: string\n defaultValue?: string\n onChange?: (value: string) => void\n variant?: 'underline' | 'pill' | 'enclosed'\n orientation?: 'horizontal' | 'vertical'\n size?: 'sm' | 'md'\n /** Stretch tabs to fill the available width. */\n fitted?: boolean\n /**\n * Activate on arrow-key focus, rather than requiring Enter.\n *\n * Automatic is the ARIA-preferred default for cheap panels. Set `false` when switching a tab\n * triggers a fetch — arrowing past three tabs would fire three requests.\n */\n activateOnFocus?: boolean\n /** Accessible name for the tab list. */\n label: string\n className?: string\n children?: ReactNode\n}\n\n/**\n * Tabs.\n *\n * The full WAI-ARIA tab pattern: a single tab stop for the whole list (roving tabindex), arrow keys\n * to move between tabs, Home/End to jump to the ends, and `aria-controls`/`aria-labelledby` linking\n * each tab to its panel in both directions.\n *\n * Panels are unmounted when inactive rather than hidden. Hiding keeps the whole tree mounted, which\n * means timers keep running, media keeps buffering and forms keep their state — the last of which\n * sounds desirable until a hidden required field blocks submission with no visible error.\n */\nexport function Tabs({\n items,\n value,\n defaultValue,\n onChange,\n variant = 'underline',\n orientation = 'horizontal',\n size = 'md',\n fitted = false,\n activateOnFocus = true,\n label,\n className,\n children,\n}: TabsProps) {\n const [active, setActive] = useControllableState<string>({\n value,\n defaultValue: defaultValue ?? items.find((item) => !item.disabled)?.id ?? '',\n onChange,\n })\n\n const baseId = useId()\n const tabRefs = useRef<Array<HTMLButtonElement | null>>([])\n\n const activeIndex = items.findIndex((item) => item.id === active)\n const activeItem = items[activeIndex]\n\n const move = (delta: number) => {\n if (items.length === 0) return\n let next = activeIndex < 0 ? 0 : activeIndex\n for (let attempts = 0; attempts < items.length; attempts++) {\n next = (next + delta + items.length) % items.length\n if (!items[next]?.disabled) break\n }\n tabRefs.current[next]?.focus()\n if (activateOnFocus) setActive(items[next]!.id)\n }\n\n const onKeyDown = (event: React.KeyboardEvent) => {\n const forward = orientation === 'horizontal' ? 'ArrowRight' : 'ArrowDown'\n const backward = orientation === 'horizontal' ? 'ArrowLeft' : 'ArrowUp'\n\n switch (event.key) {\n case forward:\n event.preventDefault()\n move(1)\n break\n case backward:\n event.preventDefault()\n move(-1)\n break\n case 'Home': {\n event.preventDefault()\n const first = items.findIndex((item) => !item.disabled)\n if (first >= 0) {\n tabRefs.current[first]?.focus()\n if (activateOnFocus) setActive(items[first]!.id)\n }\n break\n }\n case 'End': {\n event.preventDefault()\n for (let i = items.length - 1; i >= 0; i--) {\n if (!items[i]?.disabled) {\n tabRefs.current[i]?.focus()\n if (activateOnFocus) setActive(items[i]!.id)\n break\n }\n }\n break\n }\n }\n }\n\n return (\n <div\n className={cx(\n 'ansh-tabs',\n `ansh-tabs--${variant}`,\n `ansh-tabs--${orientation}`,\n `ansh-tabs--${size}`,\n className,\n )}\n >\n <div\n role=\"tablist\"\n aria-label={label}\n aria-orientation={orientation}\n className={cx('ansh-tabs__list', fitted && 'ansh-tabs__list--fitted')}\n onKeyDown={onKeyDown}\n >\n {items.map((item, index) => {\n const selected = item.id === active\n return (\n <button\n key={item.id}\n ref={(node) => {\n tabRefs.current[index] = node\n }}\n type=\"button\"\n role=\"tab\"\n id={`${baseId}-tab-${item.id}`}\n aria-selected={selected}\n aria-controls={`${baseId}-panel-${item.id}`}\n // Exactly one tab is in the tab order. Without this, a bar of eight tabs costs a\n // keyboard user eight presses to pass.\n tabIndex={selected ? 0 : -1}\n disabled={item.disabled}\n className={cx(\n 'ansh-tabs__tab',\n selected && 'ansh-tabs__tab--active',\n 'ansh-focusable',\n )}\n onClick={() => setActive(item.id)}\n >\n {item.icon ? <span className=\"ansh-tabs__icon\">{item.icon}</span> : null}\n <span>{item.label}</span>\n {item.badge !== undefined ? (\n <span className=\"ansh-tabs__badge\">{item.badge}</span>\n ) : null}\n </button>\n )\n })}\n </div>\n\n {activeItem?.content !== undefined || children ? (\n <div\n role=\"tabpanel\"\n id={`${baseId}-panel-${active}`}\n aria-labelledby={`${baseId}-tab-${active}`}\n // Focusable so a keyboard user can Tab from the tab into its panel and scroll it, which\n // is required when the panel has no focusable content of its own.\n tabIndex={0}\n className=\"ansh-tabs__panel ansh-focusable\"\n >\n {activeItem?.content ?? children}\n </div>\n ) : null}\n </div>\n )\n}\n","import { type ReactNode, useState } from 'react'\nimport { cx } from '../../primitives/compose'\n\nexport interface Crumb {\n label: ReactNode\n href?: string\n icon?: ReactNode\n onClick?: () => void\n}\n\nexport interface BreadcrumbsProps {\n items: readonly Crumb[]\n /** Collapse the middle when there are more than this many. Default `Infinity`. */\n maxItems?: number\n separator?: ReactNode\n className?: string\n}\n\n/**\n * A breadcrumb trail.\n *\n * `<nav aria-label=\"Breadcrumb\">` around an ordered list, with the last item marked\n * `aria-current=\"page\"` and rendered as text rather than a link. Making the current page a link to\n * itself is a small thing that wastes a keyboard user's time on every page.\n *\n * Separators are `aria-hidden`, so the trail reads as \"Home, Projects, Invoice 401\" rather than\n * \"Home slash Projects slash\".\n */\nexport function Breadcrumbs({\n items,\n maxItems = Number.POSITIVE_INFINITY,\n separator,\n className,\n}: BreadcrumbsProps) {\n const [expanded, setExpanded] = useState(false)\n\n const collapsed = !expanded && items.length > maxItems && maxItems >= 2\n // Keep the first and the last two — the root and where you are — which is the information\n // people actually navigate by.\n const shown = collapsed ? [items[0]!, ...items.slice(-2)] : items\n const gapAfter = collapsed ? 0 : -1\n\n const chevron = separator ?? (\n <svg viewBox=\"0 0 12 12\" width=\"12\" height=\"12\" aria-hidden=\"true\">\n <path\n d=\"M4.5 2.5L8 6l-3.5 3.5\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n )\n\n return (\n <nav aria-label=\"Breadcrumb\" className={cx('ansh-breadcrumbs', className)}>\n <ol className=\"ansh-breadcrumbs__list\">\n {shown.map((crumb, index) => {\n const isLast = index === shown.length - 1\n return (\n <li key={index} className=\"ansh-breadcrumbs__item\">\n {index > 0 ? (\n <span className=\"ansh-breadcrumbs__separator\" aria-hidden=\"true\">\n {chevron}\n </span>\n ) : null}\n\n {isLast ? (\n <span className=\"ansh-breadcrumbs__current\" aria-current=\"page\">\n {crumb.icon}\n {crumb.label}\n </span>\n ) : (\n <a\n href={crumb.href ?? '#'}\n className=\"ansh-breadcrumbs__link ansh-focusable\"\n onClick={\n crumb.onClick\n ? (event) => {\n event.preventDefault()\n crumb.onClick!()\n }\n : undefined\n }\n >\n {crumb.icon}\n {crumb.label}\n </a>\n )}\n\n {index === gapAfter ? (\n <>\n <span className=\"ansh-breadcrumbs__separator\" aria-hidden=\"true\">\n {chevron}\n </span>\n <button\n type=\"button\"\n className=\"ansh-breadcrumbs__more ansh-focusable\"\n aria-label={`Show ${items.length - 3} hidden breadcrumbs`}\n aria-expanded={false}\n onClick={() => setExpanded(true)}\n >\n …\n </button>\n </>\n ) : null}\n </li>\n )\n })}\n </ol>\n </nav>\n )\n}\n\nexport interface Step {\n id: string\n label: ReactNode\n description?: ReactNode\n /** Marks the step failed — validation errors on a wizard page. */\n error?: boolean\n /** Allow jumping to this step directly. */\n clickable?: boolean\n}\n\nexport interface StepperProps {\n steps: readonly Step[]\n /** Index of the current step. Steps before it are complete. */\n current: number\n onStepChange?: (index: number) => void\n orientation?: 'horizontal' | 'vertical'\n className?: string\n}\n\n/**\n * A progress stepper for multi-page flows — checkout, onboarding, approvals.\n *\n * The state of each step is announced in text, not just drawn: `aria-current=\"step\"` on the active\n * one and a visually hidden \"completed\"/\"current\"/\"not started\" on each. A stepper that\n * distinguishes its states with a tick glyph and a colour tells a screen-reader user nothing.\n */\nexport function Stepper({\n steps,\n current,\n onStepChange,\n orientation = 'horizontal',\n className,\n}: StepperProps) {\n return (\n <nav\n className={cx('ansh-stepper', `ansh-stepper--${orientation}`, className)}\n aria-label=\"Progress\"\n >\n <ol className=\"ansh-stepper__list\">\n {steps.map((step, index) => {\n const complete = index < current\n const active = index === current\n const state = step.error\n ? 'error'\n : complete\n ? 'complete'\n : active\n ? 'current'\n : 'upcoming'\n const interactive = step.clickable && onStepChange && index !== current\n\n const inner = (\n <>\n <span\n className={cx('ansh-stepper__marker', `ansh-stepper__marker--${state}`)}\n aria-hidden=\"true\"\n >\n {step.error ? (\n '!'\n ) : complete ? (\n <svg viewBox=\"0 0 14 14\" width=\"12\" height=\"12\">\n <path\n d=\"M2.5 7.5l3 3 6-6.5\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n fill=\"none\"\n />\n </svg>\n ) : (\n index + 1\n )}\n </span>\n <span className=\"ansh-stepper__text\">\n <span className=\"ansh-stepper__label\">{step.label}</span>\n {step.description ? (\n <span className=\"ansh-stepper__description\">{step.description}</span>\n ) : null}\n <span className=\"ansh-visually-hidden\">\n {step.error\n ? ' — has errors'\n : complete\n ? ' — completed'\n : active\n ? ' — current step'\n : ' — not started'}\n </span>\n </span>\n </>\n )\n\n return (\n <li\n key={step.id}\n className={cx('ansh-stepper__item', `ansh-stepper__item--${state}`)}\n aria-current={active ? 'step' : undefined}\n >\n {interactive ? (\n <button\n type=\"button\"\n className=\"ansh-stepper__button ansh-focusable\"\n onClick={() => onStepChange!(index)}\n >\n {inner}\n </button>\n ) : (\n <span className=\"ansh-stepper__button\">{inner}</span>\n )}\n </li>\n )\n })}\n </ol>\n </nav>\n )\n}\n","import { type ReactNode, useEffect, useId, useRef, useState } from 'react'\nimport { cx } from '../../primitives/compose'\n\nexport interface MegaMenuLink {\n id: string\n label: string\n description?: string\n href?: string\n icon?: ReactNode\n onClick?: () => void\n}\n\nexport interface MegaMenuColumn {\n id: string\n heading?: string\n links: readonly MegaMenuLink[]\n}\n\nexport interface NavMenuItem {\n id: string\n label: string\n href?: string\n /** Columns of links. Presence of this makes the item a dropdown rather than a link. */\n columns?: readonly MegaMenuColumn[]\n /** Promoted panel on the right of the dropdown — a featured post, a CTA. */\n feature?: ReactNode\n}\n\nexport interface NavigationMenuProps {\n items: readonly NavMenuItem[]\n label?: string\n className?: string\n}\n\n/**\n * A site navigation bar with mega-menu dropdowns.\n *\n * The pattern marketing sites need and the one most likely to be built with hover alone. This one:\n *\n * - opens on hover **and** on click/Enter, so it works with a keyboard and on touch;\n * - keeps the panel open while the pointer travels toward it, via a close delay;\n * - closes on Escape, returning focus to the trigger;\n * - marks each trigger `aria-expanded` and links it to its panel with `aria-controls`.\n *\n * The panel is a plain absolutely-positioned element rather than a portal. A mega menu is full-width\n * and anchored to the bar, not to a point, so the portal's viewport-relative positioning would fight\n * the layout rather than help it.\n */\nexport function NavigationMenu({\n items,\n label = 'Main navigation',\n className,\n}: NavigationMenuProps) {\n const [openId, setOpenId] = useState<string | null>(null)\n const timerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n const rootRef = useRef<HTMLElement | null>(null)\n const baseId = useId()\n\n const schedule = (next: string | null, delay: number) => {\n clearTimeout(timerRef.current)\n timerRef.current = setTimeout(() => setOpenId(next), delay)\n }\n\n useEffect(() => () => clearTimeout(timerRef.current), [])\n\n // Close when focus leaves the whole bar. `focusout` with a `relatedTarget` containment check is\n // the reliable way to detect that — a blur handler on each trigger fires while focus is still\n // moving to a link inside the panel, closing it just before the click lands.\n useEffect(() => {\n if (!openId) return\n const root = rootRef.current\n if (!root) return\n\n const onFocusOut = (event: FocusEvent) => {\n const next = event.relatedTarget as Node | null\n if (next && root.contains(next)) return\n setOpenId(null)\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') return\n setOpenId(null)\n root.querySelector<HTMLElement>(`[aria-expanded=\"true\"]`)?.focus()\n }\n\n root.addEventListener('focusout', onFocusOut)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n root.removeEventListener('focusout', onFocusOut)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [openId])\n\n return (\n <nav\n ref={rootRef as React.Ref<HTMLElement>}\n className={cx('ansh-navmenu', className)}\n aria-label={label}\n onMouseLeave={() => schedule(null, 200)}\n >\n <ul className=\"ansh-navmenu__list\">\n {items.map((item) => {\n const hasPanel = Boolean(item.columns?.length)\n const open = openId === item.id\n const panelId = `${baseId}-${item.id}`\n\n if (!hasPanel) {\n return (\n <li key={item.id} className=\"ansh-navmenu__item\">\n <a href={item.href ?? '#'} className=\"ansh-navmenu__link ansh-focusable\">\n {item.label}\n </a>\n </li>\n )\n }\n\n return (\n <li\n key={item.id}\n className={cx('ansh-navmenu__item', open && 'ansh-navmenu__item--open')}\n onMouseEnter={() => schedule(item.id, 80)}\n >\n <button\n type=\"button\"\n className=\"ansh-navmenu__link ansh-navmenu__link--trigger ansh-focusable\"\n aria-expanded={open}\n aria-controls={panelId}\n onClick={() => setOpenId(open ? null : item.id)}\n onKeyDown={(event) => {\n if (event.key === 'ArrowDown') {\n event.preventDefault()\n setOpenId(item.id)\n // Focus the first link in the panel on the next frame, once it exists.\n requestAnimationFrame(() => {\n document\n .getElementById(panelId)\n ?.querySelector<HTMLElement>('a, button')\n ?.focus()\n })\n }\n }}\n >\n {item.label}\n <span\n className={cx('ansh-navmenu__chevron', open && 'ansh-navmenu__chevron--open')}\n aria-hidden=\"true\"\n >\n <svg viewBox=\"0 0 12 12\" width=\"10\" height=\"10\">\n <path\n d=\"M3 4.5L6 7.5l3-3\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </span>\n </button>\n\n <div\n id={panelId}\n className=\"ansh-navmenu__panel\"\n hidden={!open}\n onMouseEnter={() => clearTimeout(timerRef.current)}\n >\n <div className=\"ansh-navmenu__grid\">\n {item.columns!.map((column) => (\n <div className=\"ansh-navmenu__column\" key={column.id}>\n {column.heading ? (\n <p className=\"ansh-navmenu__heading\">{column.heading}</p>\n ) : null}\n <ul className=\"ansh-navmenu__links\">\n {column.links.map((link) => (\n <li key={link.id}>\n <a\n href={link.href ?? '#'}\n className=\"ansh-navmenu__entry ansh-focusable\"\n onClick={\n link.onClick\n ? (event) => {\n event.preventDefault()\n link.onClick!()\n setOpenId(null)\n }\n : () => setOpenId(null)\n }\n >\n {link.icon ? (\n <span className=\"ansh-navmenu__icon\" aria-hidden=\"true\">\n {link.icon}\n </span>\n ) : null}\n <span className=\"ansh-navmenu__entry-text\">\n <span className=\"ansh-navmenu__entry-label\">{link.label}</span>\n {link.description ? (\n <span className=\"ansh-navmenu__entry-description\">\n {link.description}\n </span>\n ) : null}\n </span>\n </a>\n </li>\n ))}\n </ul>\n </div>\n ))}\n\n {item.feature ? (\n <div className=\"ansh-navmenu__feature\">{item.feature}</div>\n ) : null}\n </div>\n </div>\n </li>\n )\n })}\n </ul>\n </nav>\n )\n}\n","import { version } from 'react'\n\n// React 19 treats `inert` as a boolean prop. React 18 doesn't know it, so it drops `inert={true}`\n// with a warning and only writes the attribute for a string, while React 19 reads `inert=\"\"` as\n// false. The peer range covers both, so the form is chosen from the running version.\nconst BOOLEAN_INERT = Number.parseInt(version, 10) >= 19\n\n/**\n * Props that make an element `inert` (out of the tab order, the accessibility tree and\n * hit-testing) on both React 18 and 19. Spread them: `<div {...inertProps(!open)}>`.\n */\nexport function inertProps(inert: boolean): { inert?: boolean } {\n if (!inert) return {}\n // The string form is the React 18 attribute; the cast is because @types/react 19 says boolean.\n return BOOLEAN_INERT ? { inert: true } : ({ inert: '' } as unknown as { inert: boolean })\n}\n","import { type ReactNode, useId, useRef, useState } from 'react'\nimport { cx } from '../primitives/compose'\nimport { useControllableState } from '../primitives/use-controllable-state'\nimport { inertProps } from '../primitives/inert'\n\n/**\n * Disclosure widgets.\n *\n * The animation here is the interesting part. Height cannot be transitioned to `auto`, so the usual\n * workarounds are measuring the content with JavaScript (a forced layout on every toggle, and wrong\n * the moment the content reflows) or a `max-height` guess (which either clips tall content or makes\n * short content ease over an invisible gap, so the timing looks wrong).\n *\n * `grid-template-rows: 0fr → 1fr` transitions to the content's intrinsic height with no JavaScript\n * and no magic numbers. It needs the extra wrapper with `min-height: 0` — without that the grid\n * child refuses to shrink below its content size and nothing animates.\n */\n\nexport interface CollapsibleProps {\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n trigger: ReactNode\n /** Render the trigger as-is rather than wrapping it in the styled button row. */\n bare?: boolean\n className?: string\n children: ReactNode\n}\n\n/** A single show/hide region. */\nexport function Collapsible({\n open,\n defaultOpen = false,\n onOpenChange,\n trigger,\n bare = false,\n className,\n children,\n}: CollapsibleProps) {\n const [isOpen, setOpen] = useControllableState<boolean>({\n value: open,\n defaultValue: defaultOpen,\n onChange: onOpenChange,\n })\n const id = useId()\n\n return (\n <div className={cx('ansh-collapsible', className)} data-state={isOpen ? 'open' : 'closed'}>\n <button\n type=\"button\"\n className={cx(\n bare ? 'ansh-collapsible__bare' : 'ansh-collapsible__trigger',\n 'ansh-focusable',\n )}\n aria-expanded={isOpen}\n aria-controls={id}\n onClick={() => setOpen(!isOpen)}\n >\n {trigger}\n <span\n className={cx('ansh-collapsible__chevron', isOpen && 'ansh-collapsible__chevron--open')}\n aria-hidden=\"true\"\n >\n <svg viewBox=\"0 0 12 12\" width=\"12\" height=\"12\">\n <path\n d=\"M3 4.5L6 7.5l3-3\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </span>\n </button>\n\n <div\n className=\"ansh-collapsible__region\"\n id={id}\n role=\"region\"\n data-state={isOpen ? 'open' : 'closed'}\n >\n {/* `inert` on the collapsed panel removes its contents from the tab order and the\n accessibility tree. Without it, a keyboard user tabs into links inside a section that\n is visually closed — invisible focus, and no way to tell where they are. */}\n <div className=\"ansh-collapsible__inner\" {...inertProps(!isOpen)}>\n {children}\n </div>\n </div>\n </div>\n )\n}\n\nexport interface AccordionItem {\n id: string\n title: ReactNode\n /** Secondary line under the title. */\n subtitle?: ReactNode\n icon?: ReactNode\n disabled?: boolean\n content: ReactNode\n}\n\nexport interface AccordionProps {\n items: readonly AccordionItem[]\n /** Allow several panels open at once. Default `false`. */\n multiple?: boolean\n /** Open panel ids. */\n value?: readonly string[]\n defaultValue?: readonly string[]\n onChange?: (value: readonly string[]) => void\n variant?: 'bordered' | 'separated' | 'plain'\n className?: string\n}\n\n/**\n * A stack of collapsible sections.\n *\n * Headings are real `<h3>` elements wrapping the button, which is the ARIA-recommended structure: a\n * screen-reader user navigating by heading finds each section, and the button inside carries the\n * expanded state. A `<div>` with `role=\"button\"` looks identical and is invisible to heading\n * navigation.\n *\n * Arrow keys move between headers, and Home/End jump to the ends — the accordion is a composite\n * widget, so this is expected behaviour rather than a nicety.\n */\nexport function Accordion({\n items,\n multiple = false,\n value,\n defaultValue = [],\n onChange,\n variant = 'bordered',\n className,\n}: AccordionProps) {\n const [openIds, setOpenIds] = useControllableState<readonly string[]>({\n value,\n defaultValue,\n onChange,\n })\n const baseId = useId()\n const headerRefs = useRef<Array<HTMLButtonElement | null>>([])\n\n const toggle = (id: string) => {\n if (openIds.includes(id)) {\n setOpenIds(openIds.filter((entry) => entry !== id))\n } else {\n setOpenIds(multiple ? [...openIds, id] : [id])\n }\n }\n\n const onKeyDown = (index: number) => (event: React.KeyboardEvent) => {\n const enabled = items\n .map((item, i) => ({ item, i }))\n .filter(({ item }) => !item.disabled)\n .map(({ i }) => i)\n const position = enabled.indexOf(index)\n let next: number | undefined\n\n switch (event.key) {\n case 'ArrowDown':\n next = enabled[(position + 1) % enabled.length]\n break\n case 'ArrowUp':\n next = enabled[(position - 1 + enabled.length) % enabled.length]\n break\n case 'Home':\n next = enabled[0]\n break\n case 'End':\n next = enabled[enabled.length - 1]\n break\n default:\n return\n }\n\n event.preventDefault()\n if (next !== undefined) headerRefs.current[next]?.focus()\n }\n\n return (\n <div className={cx('ansh-accordion', `ansh-accordion--${variant}`, className)}>\n {items.map((item, index) => {\n const open = openIds.includes(item.id)\n const panelId = `${baseId}-panel-${item.id}`\n const headerId = `${baseId}-header-${item.id}`\n\n return (\n <div\n key={item.id}\n className={cx('ansh-accordion__item', open && 'ansh-accordion__item--open')}\n data-state={open ? 'open' : 'closed'}\n >\n <h3 className=\"ansh-accordion__heading\">\n <button\n ref={(node) => {\n headerRefs.current[index] = node\n }}\n type=\"button\"\n id={headerId}\n className=\"ansh-accordion__trigger ansh-focusable\"\n aria-expanded={open}\n aria-controls={panelId}\n disabled={item.disabled}\n onClick={() => toggle(item.id)}\n onKeyDown={onKeyDown(index)}\n >\n {item.icon ? <span className=\"ansh-accordion__icon\">{item.icon}</span> : null}\n <span className=\"ansh-accordion__text\">\n <span className=\"ansh-accordion__title\">{item.title}</span>\n {item.subtitle ? (\n <span className=\"ansh-accordion__subtitle\">{item.subtitle}</span>\n ) : null}\n </span>\n <span\n className={cx('ansh-accordion__chevron', open && 'ansh-accordion__chevron--open')}\n aria-hidden=\"true\"\n >\n <svg viewBox=\"0 0 12 12\" width=\"12\" height=\"12\">\n <path\n d=\"M3 4.5L6 7.5l3-3\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </span>\n </button>\n </h3>\n\n <div\n className=\"ansh-accordion__region\"\n id={panelId}\n role=\"region\"\n aria-labelledby={headerId}\n data-state={open ? 'open' : 'closed'}\n >\n <div className=\"ansh-accordion__panel\" {...inertProps(!open)}>\n {item.content}\n </div>\n </div>\n </div>\n )\n })}\n </div>\n )\n}\n\nexport interface DisclosureListProps {\n /** Simple show-more list — the pattern for \"N more items\". */\n items: readonly ReactNode[]\n /** How many to show before collapsing. Default `3`. */\n initial?: number\n moreLabel?: (hidden: number) => string\n lessLabel?: string\n className?: string\n}\n\n/** Show a few items with a \"show N more\" toggle. */\nexport function DisclosureList({\n items,\n initial = 3,\n moreLabel = (hidden) => `Show ${hidden} more`,\n lessLabel = 'Show less',\n className,\n}: DisclosureListProps) {\n const [expanded, setExpanded] = useState(false)\n const id = useId()\n const hidden = items.length - initial\n\n if (hidden <= 0) {\n return (\n <ul className={cx('ansh-disclosure-list', className)}>\n {items.map((item, index) => (\n <li key={index}>{item}</li>\n ))}\n </ul>\n )\n }\n\n return (\n <div className={className}>\n <ul className=\"ansh-disclosure-list\" id={id}>\n {(expanded ? items : items.slice(0, initial)).map((item, index) => (\n <li key={index}>{item}</li>\n ))}\n </ul>\n <button\n type=\"button\"\n className=\"ansh-disclosure-list__toggle ansh-focusable\"\n aria-expanded={expanded}\n aria-controls={id}\n onClick={() => setExpanded((v) => !v)}\n >\n {expanded ? lessLabel : moreLabel(hidden)}\n </button>\n </div>\n )\n}\n"]}
@@ -714,5 +714,5 @@ exports.themeScript = themeScript;
714
714
  exports.useBehaviour = useBehaviour;
715
715
  exports.useMotionConfig = useMotionConfig;
716
716
  exports.useTheme = useTheme;
717
- //# sourceMappingURL=chunk-IZ6T7LO3.cjs.map
718
- //# sourceMappingURL=chunk-IZ6T7LO3.cjs.map
717
+ //# sourceMappingURL=chunk-MPX7QT4R.cjs.map
718
+ //# sourceMappingURL=chunk-MPX7QT4R.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/factory/create-behaviour-component.tsx","../src/components/interaction.tsx","../src/components/text.tsx","../src/components/providers.tsx","../src/components/motion/shared.ts","../src/components/motion/motion.tsx","../src/components/motion/animate-presence.tsx","../src/components/motion/draggable.tsx"],"names":["Component","useRef","useMergedRef","useEffect","mountBehaviour","jsx","forwardRef","magnetic","tilt","ripple","marquee","scrollReveal","parallax","useLayoutEffect","useMemo","resolvePalette","createGradient","prefersReducedMotion","jsxs","resolveEasing","stagger","getTicker","observeIntersection","createContext","setReducedMotionMode","attachLifecycle","useContext","useState","applyTheme","resolveTheme","useCallback","springs","animate","Children","isValidElement","currentKeys","Fragment","cloneElement","cx"],"mappings":";;;;;;;;;AAqEO,SAAS,wBAAA,CAId,UAAA,EACA,WAAA,EACA,cAAA,GAA8B,KAAA,EACG;AACjC,EAAA,MAAM,aAAa,IAAI,GAAA,CAAI,OAAO,IAAA,CAAK,UAAA,CAAW,QAAQ,CAAC,CAAA;AAE3D,EAAA,SAAS,MAAA,CAAO,OAAmB,YAAA,EAAgC;AACjE,IAAA,MAAM,EAAE,IAAIA,UAAAA,GAAY,cAAA,EAAgB,WAAW,KAAA,EAAO,QAAA,EAAU,GAAG,IAAA,EAAK,GAAI,KAAA;AAEhF,IAAA,MAAM,OAAA,GAAUC,aAAkB,IAAI,CAAA;AACtC,IAAA,MAAM,SAAA,GAAYA,aAAwC,IAAI,CAAA;AAC9D,IAAA,MAAM,SAAA,GAAYC,8BAAA,CAAiB,OAAA,EAAS,YAAY,CAAA;AAExD,IAAA,MAAM,UAAmC,EAAC;AAC1C,IAAA,MAAM,WAAoC,EAAC;AAC3C,IAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,IAAI,CAAA,EAAG;AAC/C,MAAA,IAAI,WAAW,GAAA,CAAI,GAAG,CAAA,E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AA,MAEC;AAAA;AAAA,GACH;AAEJ","file":"chunk-MPX7QT4R.cjs","sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type CSSProperties,\n type ElementType,\n type ForwardRefExoticComponent,\n type ForwardedRef,\n type ReactNode,\n type RefAttributes,\n forwardRef,\n useEffect,\n useRef,\n} from 'react'\nimport {\n type BaseBehaviourOptions,\n type BehaviourDefinition,\n type BehaviourHandle,\n mountBehaviour,\n} from '@ansh-ui/core'\nimport { useMergedRef } from '../hooks/use-observers'\n\n/**\n * Turn a {@link BehaviourDefinition} into a React component.\n *\n * The DOM counterpart of {@link import('./create-effect-component').createEffectComponent}. The\n * difference in the API is deliberate and small: a behaviour component renders its children\n * *directly* rather than wrapping them in a positioned layer, because a behaviour manipulates the\n * host element itself and inserting a wrapper would break the author's layout.\n *\n * ```tsx\n * export const MagneticButton = createBehaviourComponent(magnetic, 'MagneticButton', 'button')\n * ```\n */\n\nexport interface BehaviourComponentBaseProps {\n as?: ElementType\n className?: string\n style?: React.CSSProperties\n children?: ReactNode\n}\n\nexport type BehaviourComponentProps<Options extends BaseBehaviourOptions> = Options &\n BehaviourComponentBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof Options | 'style' | 'className' | 'children'> &\n /**\n * Attributes that only make sense on the elements `as` is actually used with.\n *\n * `as=\"a\"` without this is a type error on `href`, which makes the prop useless for the case it\n * exists for — turning a magnetic button into a link. Full polymorphic typing (`as` as a generic\n * that rewrites the whole prop set) is the textbook answer and it collapses inference for every\n * behaviour option in the intersection, producing error messages nobody can read. Naming the two\n * element types `as` is realistically pointed at is the trade that keeps both working.\n */\n Partial<Pick<ComponentPropsWithoutRef<'a'>, 'href' | 'target' | 'rel' | 'download'>> &\n Partial<Pick<ComponentPropsWithoutRef<'button'>, 'type' | 'disabled' | 'form' | 'name' | 'value'>>\n\n/** The type of a component produced by {@link createBehaviourComponent}. */\nexport type BehaviourComponent<\n Options extends BaseBehaviourOptions,\n El extends HTMLElement = HTMLElement,\n> = ForwardRefExoticComponent<BehaviourComponentProps<Options> & RefAttributes<El>>\n\n/** See the note on the equivalent type in `create-effect-component.tsx`. */\ntype LooseProps = Record<string, unknown> & {\n as?: ElementType\n className?: string\n style?: CSSProperties\n children?: ReactNode\n}\n\nexport function createBehaviourComponent<\n Options extends BaseBehaviourOptions,\n El extends HTMLElement = HTMLElement,\n>(\n definition: BehaviourDefinition<Options, El>,\n displayName?: string,\n defaultElement: ElementType = 'div',\n): BehaviourComponent<Options, El> {\n const optionKeys = new Set(Object.keys(definition.defaults))\n\n function Render(props: LooseProps, forwardedRef: ForwardedRef<El>) {\n const { as: Component = defaultElement, className, style, children, ...rest } = props\n\n const hostRef = useRef<El | null>(null)\n const handleRef = useRef<BehaviourHandle<Options> | null>(null)\n const mergedRef = useMergedRef<El>(hostRef, forwardedRef)\n\n const options: Record<string, unknown> = {}\n const domProps: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(rest)) {\n if (optionKeys.has(key)) options[key] = value\n else domProps[key] = value\n }\n\n const optionsKey = stableKey(options)\n const optionsRef = useRef(options)\n optionsRef.current = options\n\n useEffect(() => {\n const host = hostRef.current\n if (!host) return\n\n const handle = mountBehaviour(definition, host, optionsRef.current as Partial<Options>)\n handleRef.current = handle\n\n return () => {\n handle.destroy()\n handleRef.current = null\n }\n // Mount-only. Behaviours that restructure the DOM (marquee, split-text) must not be torn\n // down and rebuilt on an unrelated prop change — that would lose scroll position and\n // restart animations.\n }, [])\n\n useEffect(() => {\n handleRef.current?.update(optionsRef.current as Partial<Options>)\n }, [optionsKey])\n\n return (\n <Component ref={mergedRef} className={className} style={style} {...domProps}>\n {children}\n </Component>\n )\n }\n\n const Component = forwardRef(Render)\n Component.displayName = displayName ?? `Ansh(${definition.name})`\n\n return Component as unknown as BehaviourComponent<Options, El>\n}\n\n/** See the note on the identical helper in `create-effect-component.tsx`. */\nfunction stableKey(options: Record<string, unknown>): string {\n const keys = Object.keys(options).sort()\n const parts: string[] = []\n for (const key of keys) {\n const value = options[key]\n if (typeof value === 'function') parts.push(`${key}:fn`)\n else if (value === undefined) continue\n else parts.push(`${key}:${JSON.stringify(value)}`)\n }\n return parts.join('|')\n}\n\n/**\n * Attach a behaviour to an element you already have a ref to.\n *\n * The hook form, for when a component's own element must carry the behaviour rather than being\n * wrapped — which is most of the time when integrating with an existing design system.\n *\n * ```tsx\n * const ref = useRef<HTMLButtonElement>(null)\n * useBehaviour(ref, magnetic, { strength: 16 })\n * ```\n */\nexport function useBehaviour<Options extends BaseBehaviourOptions, El extends HTMLElement>(\n ref: React.RefObject<El | null>,\n definition: BehaviourDefinition<Options, El>,\n options?: Partial<Options>,\n): void {\n const handleRef = useRef<BehaviourHandle<Options> | null>(null)\n const optionsRef = useRef(options ?? {})\n optionsRef.current = options ?? {}\n\n const optionsKey = stableKey(optionsRef.current as Record<string, unknown>)\n\n useEffect(() => {\n const element = ref.current\n if (!element) return\n\n const handle = mountBehaviour(definition, element, optionsRef.current)\n handleRef.current = handle\n\n return () => {\n handle.destroy()\n handleRef.current = null\n }\n }, [definition, ref])\n\n useEffect(() => {\n handleRef.current?.update(optionsRef.current)\n }, [optionsKey])\n}\n","import { magnetic, marquee, parallax, ripple, scrollReveal, tilt } from '@ansh-ui/core'\nimport { createBehaviourComponent } from '../factory/create-behaviour-component'\n\n/**\n * DOM behaviour components.\n *\n * Unlike the canvas backgrounds these render their children directly — no wrapper, no positioned\n * layer — because a behaviour manipulates the host element and inserting a wrapper would break the\n * author's layout.\n */\n\n/**\n * An element that leans toward the pointer, spring-driven.\n *\n * Renders a `<button>` by default so it is keyboard-focusable and announced correctly. Pass\n * `as=\"a\"` or `as=\"div\"` when it isn't a button — but if it *acts* like a button, leave it.\n *\n * ```tsx\n * <MagneticButton strength={16} scale={1.04} onClick={submit}>\n * Get started\n * </MagneticButton>\n * ```\n */\nexport const MagneticButton = createBehaviourComponent(magnetic, 'MagneticButton', 'button')\n\n/**\n * A card that rotates in 3D toward the pointer, with a moving specular highlight.\n *\n * The `perspective()` is baked into the transform as its first function, so no parent wrapper is\n * needed — which is the usual reason tilt implementations come out looking sheared rather than 3D.\n */\nexport const TiltCard = createBehaviourComponent(tilt, 'TiltCard', 'div')\n\n/**\n * A wave that expands from the point of contact.\n *\n * Also fires on Enter and Space, so keyboard activation gets the same feedback as a click. The\n * ripple layer inherits the host's `border-radius`, so a pill button clips its ripple to a pill\n * with no extra configuration.\n */\nexport const Ripple = createBehaviourComponent(ripple, 'Ripple', 'div')\n\n/**\n * Seamless infinite scrolling content.\n *\n * Speed is in **pixels per second**, not a duration, so adding an item to a logo strip doesn't\n * change how fast it scrolls. Content is duplicated as many times as needed to cover the\n * container, and clones are `aria-hidden` so a screen reader reads the list once.\n *\n * ```tsx\n * <Marquee speed={40} fadeEdges={64} pauseOnHover>\n * {logos.map((logo) => <img key={logo.id} src={logo.src} alt={logo.name} />)}\n * </Marquee>\n * ```\n */\nexport const Marquee = createBehaviourComponent(marquee, 'Marquee', 'div')\n\n/**\n * Reveal content as it enters the viewport.\n *\n * The hidden starting state is applied **in JavaScript**, not CSS. If the script never runs, the\n * content is simply visible — degraded but readable. A CSS-hidden initial state means content that\n * is permanently invisible when JavaScript fails, which has shipped to production on a lot of\n * marketing sites.\n *\n * Pass `children=\".selector\"` to stagger descendants instead of revealing the host as one block.\n */\nexport const ScrollReveal = createBehaviourComponent(scrollReveal, 'ScrollReveal', 'div')\n\n/**\n * Move an element at a different rate from the scroll.\n *\n * All measurement happens in the ticker's `read` phase, so fifty parallax elements cost one layout\n * read per frame between them rather than one per scroll event each. Disabled outright under\n * `prefers-reduced-motion` — parallax is the canonical vestibular trigger, and a slow parallax is\n * still parallax.\n */\nexport const Parallax = createBehaviourComponent(parallax, 'Parallax', 'div')\n","import { type ElementType, useEffect, useLayoutEffect, useMemo, useRef } from 'react'\nimport {\n type EasingInput,\n type StaggerFrom,\n createGradient,\n getTicker,\n observeIntersection,\n prefersReducedMotion,\n resolveEasing,\n resolvePalette,\n stagger,\n} from '@ansh-ui/core'\n\n/**\n * Text components.\n *\n * These are written by hand rather than generated from a behaviour, because text animation has one\n * requirement no generic factory can satisfy: **the accessible text must never be the animated\n * text.** Splitting a heading into per-character spans and animating them is fine visually and an\n * accessibility failure if the split structure is what a screen reader reads.\n *\n * The pattern used throughout: the real string lives in a visually-hidden element that remains the\n * accessible name, and the entire animated structure is `aria-hidden`. Assistive technology reads\n * \"Motion, refined.\"; the eye sees fifteen characters arriving in sequence.\n */\n\n/**\n * `useLayoutEffect` on the client, `useEffect` on the server.\n *\n * The distinction matters here specifically. `AnimatedText` renders its units *visible* so the\n * server HTML and the first client render agree — anything else is a hydration mismatch. The hidden\n * starting state is then applied by an effect. With `useEffect` that happens **after** the browser\n * paints, so there is a visible one-frame flash of the final text before it hides and animates in.\n * `useLayoutEffect` runs before paint, so the flash cannot occur.\n *\n * The plain `useEffect` fallback on the server exists only to silence React's warning; layout\n * effects never run during SSR anyway.\n */\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect\n\nconst VISUALLY_HIDDEN: React.CSSProperties = {\n position: 'absolute',\n width: 1,\n height: 1,\n padding: 0,\n margin: -1,\n overflow: 'hidden',\n clipPath: 'inset(50%)',\n whiteSpace: 'nowrap',\n borderWidth: 0,\n}\n\n// ---------------------------------------------------------------------------\n// GradientText\n// ---------------------------------------------------------------------------\n\nexport interface GradientTextProps {\n children: string\n /** Any number of colours, or a built-in palette name. */\n colors?: readonly string[] | Parameters<typeof resolvePalette>[0]\n /** Gradient angle in degrees. Default `100`. */\n angle?: number\n /** Seconds for one full cycle. `0` holds a static gradient. Default `0` (static). */\n duration?: number\n /** Interpolated stops handed to CSS. More is smoother. Default `16`. */\n stops?: number\n as?: ElementType\n className?: string\n style?: React.CSSProperties\n}\n\n/**\n * Text filled with a perceptual gradient.\n *\n * Uses `background-clip: text`, and the stops are generated through the OKLab interpolator rather\n * than handed to CSS as two endpoints. That is the whole point: a CSS\n * `linear-gradient(#0275f4, #9f0550)` passes through a desaturated grey-brown at its midpoint,\n * which on text — where the gradient crosses a narrow band — is exactly where the eye lands.\n *\n * Animation is a CSS `background-position` shift rather than a JS loop, because for a single\n * property with no interaction the browser's own compositor is strictly better than anything we\n * could do on the main thread.\n */\nexport function GradientText({\n children,\n colors,\n angle = 100,\n duration = 0,\n stops = 16,\n as: Component = 'span',\n className,\n style,\n}: GradientTextProps) {\n const gradientCss = useMemo(() => {\n const palette = resolvePalette(colors as never)\n // Duplicated so an animated background-position shift wraps seamlessly instead of jumping.\n const looped = duration > 0 ? [...palette, ...palette] : palette\n return createGradient(looped, { space: 'oklab' }).toCss(`${angle}deg`, stops)\n }, [colors, angle, duration, stops])\n\n const animated = duration > 0 && !prefersReducedMotion()\n\n return (\n <Component\n className={className}\n style={{\n backgroundImage: gradientCss,\n backgroundSize: animated ? '200% 100%' : '100% 100%',\n backgroundClip: 'text',\n WebkitBackgroundClip: 'text',\n color: 'transparent',\n // A fallback for the rare engine without background-clip support: the first colour still\n // renders as solid text rather than the content vanishing entirely.\n WebkitTextFillColor: 'transparent',\n display: 'inline-block',\n ...(animated\n ? {\n animation: `ansh-gradient-shift ${duration}s linear infinite`,\n }\n : {}),\n ...style,\n }}\n >\n {children}\n {animated ? <GradientKeyframes /> : null}\n </Component>\n )\n}\n\n/**\n * The keyframes for {@link GradientText}.\n *\n * Injected as a `<style>` element rather than requiring a stylesheet import, so\n * `<GradientText duration={6} />` works with no setup. The rule is idempotent — several instances\n * emit identical CSS and the browser deduplicates it.\n */\nfunction GradientKeyframes() {\n return (\n <style\n dangerouslySetInnerHTML={{\n __html:\n '@keyframes ansh-gradient-shift{from{background-position:0% 50%}to{background-position:200% 50%}}',\n }}\n />\n )\n}\n\n// ---------------------------------------------------------------------------\n// AnimatedText\n// ---------------------------------------------------------------------------\n\nexport interface AnimatedTextProps {\n children: string\n /** Split granularity. Default `'chars'`. */\n by?: 'chars' | 'words'\n /** Seconds per unit's animation. Default `0.6`. */\n duration?: number\n /** Seconds between units. Default `0.03`. */\n each?: number\n /** Where the reveal wave begins. Default `'first'`. */\n from?: StaggerFrom\n easing?: EasingInput\n /** Distance each unit travels into place, in pixels. Default `18`. */\n distance?: number\n /** Starting blur in pixels — the \"focus in\" look. Default `0`. */\n blur?: number\n /** Starting rotation in degrees. Default `0`. */\n rotate?: number\n /** Clip each unit so it rises from behind a mask. Default `false`. */\n mask?: boolean\n /** Wait until scrolled into view. Default `true`. */\n whenInView?: boolean\n /** Replay every time it re-enters the viewport. Default `false`. */\n repeat?: boolean\n /** Seconds to wait before starting. Default `0`. */\n delay?: number\n as?: ElementType\n className?: string\n style?: React.CSSProperties\n onComplete?: () => void\n}\n\ninterface Unit {\n text: string\n /** `true` for whitespace, which is rendered as a plain gap rather than an animated unit. */\n space: boolean\n}\n\n/**\n * Text that reveals unit by unit.\n *\n * The split happens in React (so the markup is server-rendered and present in the HTML source for\n * SEO and for no-JS readers) while the animation runs on the shared ticker (so a page full of these\n * shares one clock and cannot drift).\n *\n * Under `prefers-reduced-motion` the text renders in its final state immediately — no hidden\n * frame, no fade.\n */\nexport function AnimatedText({\n children,\n by = 'chars',\n duration = 0.6,\n each = 0.03,\n from = 'first',\n easing = 'cinematic',\n distance = 18,\n blur = 0,\n rotate = 0,\n mask = false,\n whenInView = true,\n repeat = false,\n delay = 0,\n as: Component = 'span',\n className,\n style,\n onComplete,\n}: AnimatedTextProps) {\n const hostRef = useRef<HTMLElement | null>(null)\n const unitRefs = useRef<(HTMLSpanElement | null)[]>([])\n const onCompleteRef = useRef(onComplete)\n onCompleteRef.current = onComplete\n\n /**\n * Split into units.\n *\n * Grapheme-aware via `Intl.Segmenter`: `[...string]` splits by code point, which breaks emoji\n * with modifiers and combining accents into multiple \"characters\".\n */\n const units = useMemo<Unit[]>(() => {\n if (by === 'words') {\n return children\n .split(/(\\s+)/)\n .filter((token) => token.length > 0)\n .map((token) => ({ text: token, space: /^\\s+$/.test(token) }))\n }\n\n const graphemes =\n typeof Intl !== 'undefined' && 'Segmenter' in Intl\n ? Array.from(\n new Intl.Segmenter(undefined, { granularity: 'grapheme' }).segment(children),\n (s) => s.segment,\n )\n : Array.from(children)\n\n return graphemes.map((character) => ({ text: character, space: /^\\s$/.test(character) }))\n }, [children, by])\n\n const animatedCount = useMemo(() => units.filter((u) => !u.space).length, [units])\n\n useIsomorphicLayoutEffect(() => {\n const host = hostRef.current\n if (!host) return\n\n // Reduced motion: leave everything at its final state. The units are rendered without inline\n // styles below when this is true, so there is nothing to undo.\n if (prefersReducedMotion()) {\n onCompleteRef.current?.()\n return\n }\n\n const ease = resolveEasing(easing)\n const delayFor = stagger(animatedCount, { each, from })\n const ticker = getTicker()\n\n // Map each rendered unit to its animation index, skipping whitespace so the stagger counts\n // visible characters rather than including gaps.\n const targets: { node: HTMLSpanElement; delay: number }[] = []\n let animationIndex = 0\n units.forEach((unit, i) => {\n if (unit.space) return\n const node = unitRefs.current[i]\n if (node) targets.push({ node, delay: delay + delayFor(animationIndex) })\n animationIndex++\n })\n\n const apply = (node: HTMLSpanElement, progress: number): void => {\n const eased = ease(progress)\n const inverse = 1 - eased\n node.style.opacity = String(eased)\n const parts = [`translate3d(0, ${(distance * inverse).toFixed(2)}px, 0)`]\n if (rotate !== 0) parts.push(`rotate(${(rotate * inverse).toFixed(2)}deg)`)\n node.style.transform = parts.join(' ')\n if (blur > 0) {\n const amount = blur * inverse\n node.style.filter = amount > 0.05 ? `blur(${amount.toFixed(2)}px)` : ''\n }\n }\n\n const reset = (): void => {\n for (const { node } of targets) apply(node, 0)\n }\n\n const settle = (node: HTMLSpanElement): void => {\n node.style.opacity = ''\n node.style.transform = ''\n node.style.filter = ''\n // Drop the compositor promotion once at rest.\n node.style.willChange = ''\n }\n\n let elapsed = 0\n let running = false\n let stopTicker: (() => void) | null = null\n\n const start = (): void => {\n if (running) return\n running = true\n elapsed = 0\n for (const { node } of targets) node.style.willChange = 'opacity, transform'\n reset()\n\n stopTicker = ticker.add(\n ({ delta }) => {\n elapsed += delta\n let allDone = true\n\n for (const target of targets) {\n const local = elapsed - target.delay\n if (local < 0) {\n allDone = false\n continue\n }\n const progress = duration <= 0 ? 1 : local / duration\n if (progress >= 1) {\n settle(target.node)\n continue\n }\n apply(target.node, progress)\n allDone = false\n }\n\n if (allDone) {\n stopTicker?.()\n stopTicker = null\n running = false\n onCompleteRef.current?.()\n }\n },\n { phase: 'write', name: 'AnimatedText' },\n )\n }\n\n if (!whenInView) {\n // Hide immediately so there is no flash of final state before the first frame.\n reset()\n start()\n return () => {\n stopTicker?.()\n for (const { node } of targets) settle(node)\n }\n }\n\n reset()\n\n const stopObserver = observeIntersection(\n host,\n (entry) => {\n if (entry.isIntersecting) {\n start()\n } else if (repeat) {\n stopTicker?.()\n stopTicker = null\n running = false\n reset()\n }\n },\n { threshold: 0.2, rootMargin: '0px 0px -8% 0px' },\n )\n\n return () => {\n stopObserver()\n stopTicker?.()\n for (const { node } of targets) settle(node)\n }\n }, [\n units,\n animatedCount,\n duration,\n each,\n from,\n easing,\n distance,\n blur,\n rotate,\n whenInView,\n repeat,\n delay,\n ])\n\n return (\n <Component ref={hostRef} className={className} style={{ display: 'inline-block', ...style }}>\n {/* The accessible representation: the real string, unfragmented. */}\n <span style={VISUALLY_HIDDEN}>{children}</span>\n\n <span aria-hidden=\"true\">\n {units.map((unit, i) =>\n unit.space ? (\n // Whitespace as a plain text node so it collapses and wraps like real text.\n <span key={i}>{unit.text}</span>\n ) : mask ? (\n <span\n key={i}\n style={{ display: 'inline-block', overflow: 'hidden', verticalAlign: 'top' }}\n >\n <span\n ref={(node) => {\n unitRefs.current[i] = node\n }}\n style={{ display: 'inline-block' }}\n >\n {unit.text}\n </span>\n </span>\n ) : (\n <span\n key={i}\n ref={(node) => {\n unitRefs.current[i] = node\n }}\n style={{ display: 'inline-block' }}\n >\n {unit.text}\n </span>\n ),\n )}\n </span>\n </Component>\n )\n}\n","import { type ReactNode, createContext, useContext, useEffect, useMemo, useState } from 'react'\nimport {\n type ReducedMotionMode,\n attachLifecycle,\n getTicker,\n setReducedMotionMode,\n} from '@ansh-ui/core'\nimport { applyTheme, resolveTheme } from '@ansh-ui/tokens'\n\n// ---------------------------------------------------------------------------\n// MotionConfig\n// ---------------------------------------------------------------------------\n\nexport interface MotionConfigValue {\n reducedMotion: ReducedMotionMode\n /** Global playback rate. `0.5` is slow motion across every animation on the page. */\n timeScale: number\n /** Pin adaptive quality, or `null` to let the frame budget decide. */\n quality: number | null\n}\n\nconst MotionConfigContext = createContext<MotionConfigValue>({\n reducedMotion: 'auto',\n timeScale: 1,\n quality: null,\n})\n\nexport interface MotionConfigProps extends Partial<MotionConfigValue> {\n /**\n * Pause every animation while the document is hidden. Default `true`.\n *\n * Leave this on. Animating a background tab burns battery and spins fans for output nobody can\n * see, and it is the most common performance complaint about animation-heavy sites.\n */\n pauseWhenHidden?: boolean\n /** Also pause when the window loses focus. Default `false` — a visible unfocused window still\n * expects to animate. */\n pauseWhenBlurred?: boolean\n /** Reduce quality on low battery where the platform exposes it. Default `true`. */\n respectBattery?: boolean\n children?: ReactNode\n}\n\n/**\n * Application-level motion configuration.\n *\n * Optional — every component works without it. Mount it once at the root when you need\n * app-wide control:\n *\n * ```tsx\n * <MotionConfig reducedMotion={userPrefersCalm ? 'always' : 'auto'}>\n * <App />\n * </MotionConfig>\n * ```\n *\n * `reducedMotion=\"always\"` is genuinely useful in production, as the backing for an in-app\n * \"reduce motion\" setting — many users who want calmer interfaces have never found the OS toggle.\n */\nexport function MotionConfig({\n reducedMotion = 'auto',\n timeScale = 1,\n quality = null,\n pauseWhenHidden = true,\n pauseWhenBlurred = false,\n respectBattery = true,\n children,\n}: MotionConfigProps) {\n useEffect(() => {\n setReducedMotionMode(reducedMotion)\n }, [reducedMotion])\n\n useEffect(() => {\n getTicker().timeScale = timeScale\n }, [timeScale])\n\n useEffect(() => {\n if (quality !== null) getTicker().lockQuality(quality)\n }, [quality])\n\n useEffect(\n () =>\n attachLifecycle(getTicker(), {\n pauseWhenHidden,\n pauseWhenBlurred,\n respectBattery,\n }),\n [pauseWhenHidden, pauseWhenBlurred, respectBattery],\n )\n\n const value = useMemo(\n () => ({ reducedMotion, timeScale, quality }),\n [reducedMotion, timeScale, quality],\n )\n\n return <MotionConfigContext.Provider value={value}>{children}</MotionConfigContext.Provider>\n}\n\n/** Read the nearest {@link MotionConfig}. Returns sensible defaults with no provider present. */\nexport function useMotionConfig(): MotionConfigValue {\n return useContext(MotionConfigContext)\n}\n\n// ---------------------------------------------------------------------------\n// ThemeProvider\n// ---------------------------------------------------------------------------\n\nexport type ThemeSetting = 'light' | 'dark' | 'system'\n\nexport interface ThemeContextValue {\n /** What was requested, including `'system'`. */\n theme: ThemeSetting\n /** What is actually rendering. `'system'` is resolved to one or the other. */\n resolved: 'light' | 'dark'\n setTheme: (theme: ThemeSetting) => void\n}\n\nconst ThemeContext = createContext<ThemeContextValue>({\n theme: 'system',\n resolved: 'light',\n setTheme: () => {},\n})\n\nexport interface ThemeProviderProps {\n /** Initial setting. Default `'system'`. */\n defaultTheme?: ThemeSetting\n /** Persist the choice under this `localStorage` key. Pass `null` to disable. Default `'ansh-theme'`. */\n storageKey?: string | null\n children?: ReactNode\n}\n\n/**\n * Theme control over the `@ansh-ui/tokens` stylesheet.\n *\n * Sets `data-theme` on `<html>`, which the token stylesheet already understands. Two details that\n * are easy to get wrong and are handled here:\n *\n * **`'system'` removes the attribute rather than writing a resolved value.** The token stylesheet\n * guards its `prefers-color-scheme` rule with `:root:not([data-theme])`, so removing the attribute\n * hands control back to the OS — and, importantly, means the theme keeps following the OS if the\n * user changes it while the page is open.\n *\n * **The initial render always reports `'light'`.** Reading `localStorage` during render would be a\n * hydration mismatch, since the server has no access to it. The stored value is applied in an\n * effect. To avoid a flash of the wrong theme, ship the small inline script from\n * {@link themeScript} in your document `<head>` — that is the only way to set the attribute before\n * first paint, and it is what every correct implementation does.\n */\nexport function ThemeProvider({\n defaultTheme = 'system',\n storageKey = 'ansh-theme',\n children,\n}: ThemeProviderProps) {\n const [theme, setThemeState] = useState<ThemeSetting>(defaultTheme)\n const [resolved, setResolved] = useState<'light' | 'dark'>('light')\n\n // Read the stored preference after mount, never during render.\n useEffect(() => {\n if (!storageKey) return\n try {\n const stored = localStorage.getItem(storageKey)\n if (stored === 'light' || stored === 'dark' || stored === 'system') {\n setThemeState(stored)\n }\n } catch {\n // Storage can throw in private browsing or with cookies disabled. A theme preference is\n // not worth breaking the page over.\n }\n }, [storageKey])\n\n useEffect(() => {\n applyTheme(theme)\n setResolved(resolveTheme())\n\n if (storageKey) {\n try {\n localStorage.setItem(storageKey, theme)\n } catch {\n // As above.\n }\n }\n }, [theme, storageKey])\n\n // Follow the OS while set to `'system'`.\n useEffect(() => {\n if (theme !== 'system' || typeof matchMedia !== 'function') return\n const query = matchMedia('(prefers-color-scheme: dark)')\n const onChange = () => setResolved(query.matches ? 'dark' : 'light')\n query.addEventListener('change', onChange)\n return () => query.removeEventListener('change', onChange)\n }, [theme])\n\n const value = useMemo(() => ({ theme, resolved, setTheme: setThemeState }), [theme, resolved])\n\n return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>\n}\n\nexport function useTheme(): ThemeContextValue {\n return useContext(ThemeContext)\n}\n\n/**\n * The blocking script that prevents a theme flash.\n *\n * Inject this in `<head>`, before any stylesheet. It reads the stored preference and sets\n * `data-theme` synchronously, before the browser paints — which is the only point at which it can\n * be done without a visible flash. It is deliberately tiny and dependency-free.\n *\n * ```tsx\n * // Next.js app/layout.tsx\n * <head>\n * <script dangerouslySetInnerHTML={{ __html: themeScript() }} />\n * </head>\n * ```\n */\nexport function themeScript(storageKey = 'ansh-theme'): string {\n return (\n `(function(){try{var t=localStorage.getItem(${JSON.stringify(storageKey)});` +\n `if(t==='light'||t==='dark'){document.documentElement.setAttribute('data-theme',t)}}` +\n `catch(e){}})()`\n )\n}\n","import { type CSSProperties, type ElementType, type ReactNode } from 'react'\nimport { type EasingInput, type SpringOptions, type springs } from '@ansh-ui/core'\n\nexport interface MotionValues {\n opacity?: number\n x?: number\n y?: number\n scale?: number\n scaleX?: number\n scaleY?: number\n rotate?: number\n /** Blur radius in px. */\n blur?: number\n}\n\nexport interface MotionTransition {\n /** Seconds. Ignored when `spring` is set. Default `0.4`. */\n duration?: number\n /** Seconds to wait. Default `0`. */\n delay?: number\n easing?: EasingInput\n /** Use a spring instead of a tween. `true` uses the `smooth` preset. */\n spring?: boolean | SpringOptions | keyof typeof springs\n}\n\nexport type MotionElementProps = {\n as?: ElementType\n /** Starting values. Applied before the first paint. */\n initial?: MotionValues\n /** Target values. Changing these animates to the new target. */\n animate?: MotionValues\n /** Values to animate to when removed by `AnimatePresence`. */\n exit?: MotionValues\n transition?: MotionTransition\n whileHover?: MotionValues\n whileTap?: MotionValues\n /** Animate to `animate` only once scrolled into view. */\n whileInView?: boolean\n /** Fraction visible before `whileInView` triggers. Default `0.2`. */\n inViewAmount?: number\n className?: string\n style?: CSSProperties\n children?: ReactNode\n}\n\nexport const DEFAULTS: Required<Omit<MotionValues, never>> = {\n opacity: 1,\n x: 0,\n y: 0,\n scale: 1,\n scaleX: 1,\n scaleY: 1,\n rotate: 0,\n blur: 0,\n}\n\n/** Compose the values into a transform string plus the properties that aren't transforms. */\nexport function applyValues(node: HTMLElement, values: Required<MotionValues>): void {\n const transform =\n `translate3d(${values.x}px, ${values.y}px, 0)` +\n ` scale(${values.scale * values.scaleX}, ${values.scale * values.scaleY})` +\n ` rotate(${values.rotate}deg)`\n\n node.style.transform = transform\n node.style.opacity = String(values.opacity)\n // Only written when non-zero: an always-present `filter` creates a containing block and a new\n // stacking context, which changes how `position: fixed` descendants resolve.\n node.style.filter = values.blur > 0 ? `blur(${values.blur}px)` : ''\n}\n\nexport function resolve(\n values: MotionValues | undefined,\n base: Required<MotionValues>,\n): Required<MotionValues> {\n return { ...base, ...values }\n}\n","import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'\nimport { type AnimationOptions, animate, springs } from '@ansh-ui/core'\nimport {\n DEFAULTS,\n type MotionElementProps,\n type MotionTransition,\n type MotionValues,\n applyValues,\n resolve,\n} from './shared'\n\n/**\n * Declarative motion.\n *\n * A deliberately **small** subset of what a full motion library does: transform properties and\n * opacity, animated from `initial` to `animate`, plus hover and press states and an exit animation\n * when paired with `AnimatePresence`.\n *\n * That scope is a decision, not a gap. Layout animation (FLIP), shared-element transitions and\n * variant propagation each need machinery an order of magnitude larger than this file, and a\n * half-implementation of them is worse than none — it works in the demo and fails on the real page.\n * For those, use a dedicated library; for the 90% case of \"fade this in, slide that up, spring the\n * card on hover\", this costs a fraction of the bundle.\n *\n * Values are written straight to the element's `style` from the ticker's write phase. React never\n * re-renders during an animation.\n */\n\n/**\n * An animated element.\n *\n * ```tsx\n * <Motion initial={{ opacity: 0, y: 24 }} animate={{ opacity: 1, y: 0 }} whileInView>\n * <Card />\n * </Motion>\n * ```\n */\nexport function Motion({\n as: Component = 'div',\n initial,\n animate: target,\n // Destructured but unused here: `AnimatePresence` reads `exit` off the element's props when the\n // child is removed and swaps it into `animate`. Pulling it out of `rest` stops it reaching the\n // DOM as an unknown attribute.\n exit: _exit,\n transition,\n whileHover,\n whileTap,\n whileInView = false,\n inViewAmount = 0.2,\n className,\n style,\n children,\n ...rest\n}: MotionElementProps & Record<string, unknown>) {\n const nodeRef = useRef<HTMLElement | null>(null)\n const currentRef = useRef<Required<MotionValues>>(resolve(initial, DEFAULTS))\n const controlsRef = useRef<ReturnType<typeof animate> | null>(null)\n const [inView, setInView] = useState(!whileInView)\n\n // Applied before paint, not in an effect. `useEffect` runs after the browser has already painted\n // the element at its natural position, so an element that should fade in flashes at full opacity\n // for one frame first.\n useLayoutEffect(() => {\n if (nodeRef.current) applyValues(nodeRef.current, currentRef.current)\n }, [])\n\n const runTo = useCallback(\n (next: Required<MotionValues>, options?: MotionTransition) => {\n const node = nodeRef.current\n if (!node) return\n\n controlsRef.current?.stop()\n\n const from = { ...currentRef.current }\n const springOption = options?.spring ?? transition?.spring\n\n const animationOptions: AnimationOptions<number> = {\n ...((options?.delay ?? transition?.delay !== undefined)\n ? { delay: options?.delay ?? transition?.delay ?? 0 }\n : null),\n ...(springOption\n ? {\n spring:\n springOption === true\n ? springs.default\n : typeof springOption === 'string'\n ? springs[springOption]\n : springOption,\n }\n : {\n duration: options?.duration ?? transition?.duration ?? 0.4,\n ...((options?.easing ?? transition?.easing)\n ? { easing: (options?.easing ?? transition?.easing)! }\n : null),\n }),\n onUpdate: (t) => {\n // One scalar drives every property, so all of them stay in lockstep. Animating each\n // independently would need one ticker subscription per property and they would drift\n // apart under a spring, which is not time-based.\n const frame = {} as Required<MotionValues>\n for (const key of Object.keys(DEFAULTS) as Array<keyof MotionValues>) {\n frame[key] = from[key] + (next[key] - from[key]) * t\n }\n currentRef.current = frame\n applyValues(node, frame)\n },\n onComplete: () => {\n currentRef.current = next\n applyValues(node, next)\n },\n }\n\n controlsRef.current = animate(0, 1, animationOptions)\n },\n [transition],\n )\n\n // Animate to the target whenever it changes (or when it scrolls into view).\n const targetKey = JSON.stringify(target ?? null)\n useEffect(() => {\n if (!inView) return\n runTo(resolve(target, DEFAULTS))\n // `targetKey` stands in for `target`, which is nearly always an inline object literal whose\n // identity changes on every render.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [targetKey, inView, runTo])\n\n useEffect(() => {\n if (!whileInView) return\n const node = nodeRef.current\n if (!node || typeof IntersectionObserver === 'undefined') {\n setInView(true)\n return\n }\n const observer = new IntersectionObserver(\n ([entry]) => {\n if (entry?.isIntersecting) {\n setInView(true)\n observer.disconnect()\n }\n },\n { threshold: inViewAmount },\n )\n observer.observe(node)\n return () => observer.disconnect()\n }, [whileInView, inViewAmount])\n\n useEffect(() => () => controlsRef.current?.stop(), [])\n\n const interaction: Record<string, unknown> = {}\n if (whileHover) {\n interaction.onMouseEnter = () => runTo(resolve({ ...target, ...whileHover }, DEFAULTS))\n interaction.onMouseLeave = () => runTo(resolve(target, DEFAULTS))\n }\n if (whileTap) {\n interaction.onPointerDown = () =>\n runTo(resolve({ ...target, ...whileTap }, DEFAULTS), { duration: 0.12 })\n interaction.onPointerUp = () => runTo(resolve({ ...target, ...whileHover }, DEFAULTS))\n }\n\n return (\n <Component\n ref={nodeRef}\n className={className}\n // `will-change` is set once, statically. Toggling it per animation causes the compositor to\n // create and destroy a layer on every interaction, which is more expensive than the hint saves.\n style={{ willChange: 'transform, opacity', ...style }}\n {...interaction}\n {...rest}\n >\n {children}\n </Component>\n )\n}\n","import {\n type ReactElement,\n type ReactNode,\n Children,\n cloneElement,\n isValidElement,\n useEffect,\n useRef,\n useState,\n} from 'react'\nimport { prefersReducedMotion } from '@ansh-ui/core'\nimport { type MotionElementProps } from './shared'\n\nexport interface AnimatePresenceProps {\n children: ReactNode\n /** Seconds to keep a removed child mounted. Default `0.35`. */\n exitDuration?: number\n}\n\n/**\n * Keep removed children mounted long enough to animate out.\n *\n * React unmounts immediately when a child disappears from the tree, so an exit animation never gets\n * a chance to run. This holds departing children in its own state, plays their `exit` values, then\n * drops them.\n *\n * Children **must** have stable `key`s — that is how removals are detected at all. Without keys,\n * React reuses element positions and this sees no removal to animate.\n */\nexport function AnimatePresence({ children, exitDuration = 0.35 }: AnimatePresenceProps) {\n const currentChildren = Children.toArray(children).filter(isValidElement) as ReactElement[]\n const [rendered, setRendered] = useState<ReactElement[]>(currentChildren)\n const timersRef = useRef(new Map<string, ReturnType<typeof setTimeout>>())\n\n const keys = currentChildren.map((child) => String(child.key))\n const keysSignature = keys.join('|')\n\n useEffect(() => {\n const currentKeys = new Set(keys)\n const departing = rendered.filter((child) => !currentKeys.has(String(child.key)))\n\n if (departing.length === 0) {\n // Straight replacement keeps updated props flowing to children that are still present.\n setRendered(currentChildren)\n return\n }\n\n // Keep the departing children in place, appended after the current set so they don't reorder\n // the survivors while they animate out.\n setRendered([...currentChildren, ...departing])\n\n const delay = prefersReducedMotion() ? 0 : exitDuration * 1000\n for (const child of departing) {\n const key = String(child.key)\n clearTimeout(timersRef.current.get(key))\n timersRef.current.set(\n key,\n setTimeout(() => {\n setRendered((previous) => previous.filter((entry) => String(entry.key) !== key))\n timersRef.current.delete(key)\n }, delay),\n )\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [keysSignature, exitDuration])\n\n useEffect(() => {\n const timers = timersRef.current\n return () => {\n for (const timer of timers.values()) clearTimeout(timer)\n timers.clear()\n }\n }, [])\n\n const currentKeys = new Set(keys)\n\n return (\n <>\n {rendered.map((child) => {\n const leaving = !currentKeys.has(String(child.key))\n if (!leaving) return child\n\n // A departing child animates to its `exit` values by having them swapped into `animate`.\n const props = child.props as MotionElementProps\n return cloneElement(child as ReactElement<MotionElementProps>, {\n animate: props.exit ?? { opacity: 0, scale: 0.96 },\n transition: { duration: exitDuration, ...props.transition },\n })\n })}\n </>\n )\n}\n","import { type CSSProperties, type ReactNode, useCallback, useRef, useState } from 'react'\nimport { animate, getTicker, springs } from '@ansh-ui/core'\nimport { cx } from '../../primitives/compose'\n\nexport interface DraggableProps {\n /** Constrain movement. */\n axis?: 'x' | 'y' | 'both'\n /** Bounds relative to the starting position, in px. */\n bounds?: { left?: number; right?: number; top?: number; bottom?: number }\n /** Spring back to the origin on release. */\n snapBack?: boolean\n /** Carry momentum after release. Default `true` when not snapping back. */\n momentum?: boolean\n onDragStart?: () => void\n onDragEnd?: (offset: { x: number; y: number }) => void\n className?: string\n style?: CSSProperties\n children: ReactNode\n}\n\n/**\n * A draggable surface with inertia.\n *\n * The momentum on release is what separates a drag that feels physical from one that stops dead.\n * Velocity is measured over the last few pointer samples rather than the last two — a single pair\n * of events is dominated by whatever jitter the final sample had, which produces a flick in the\n * wrong direction often enough to be noticeable.\n */\nexport function Draggable({\n axis = 'both',\n bounds,\n snapBack = false,\n momentum,\n onDragStart,\n onDragEnd,\n className,\n style,\n children,\n}: DraggableProps) {\n const nodeRef = useRef<HTMLDivElement | null>(null)\n const offsetRef = useRef({ x: 0, y: 0 })\n const [dragging, setDragging] = useState(false)\n\n const useMomentum = momentum ?? !snapBack\n\n const clamp = useCallback(\n (value: { x: number; y: number }) => ({\n x: Math.min(Math.max(value.x, bounds?.left ?? -Infinity), bounds?.right ?? Infinity),\n y: Math.min(Math.max(value.y, bounds?.top ?? -Infinity), bounds?.bottom ?? Infinity),\n }),\n [bounds],\n )\n\n const write = (value: { x: number; y: number }) => {\n if (nodeRef.current) {\n nodeRef.current.style.transform = `translate3d(${value.x}px, ${value.y}px, 0)`\n }\n }\n\n const onPointerDown = (event: React.PointerEvent<HTMLDivElement>) => {\n event.currentTarget.setPointerCapture(event.pointerId)\n setDragging(true)\n onDragStart?.()\n\n const start = { x: event.clientX, y: event.clientY }\n const origin = { ...offsetRef.current }\n // A short ring of recent samples, for a velocity estimate that isn't hostage to the last event.\n const samples: Array<{ x: number; y: number; t: number }> = []\n\n const onMove = (moveEvent: PointerEvent) => {\n const next = clamp({\n x: axis === 'y' ? origin.x : origin.x + (moveEvent.clientX - start.x),\n y: axis === 'x' ? origin.y : origin.y + (moveEvent.clientY - start.y),\n })\n offsetRef.current = next\n write(next)\n\n samples.push({ x: next.x, y: next.y, t: performance.now() })\n if (samples.length > 5) samples.shift()\n }\n\n const onUp = () => {\n setDragging(false)\n window.removeEventListener('pointermove', onMove)\n window.removeEventListener('pointerup', onUp)\n window.removeEventListener('pointercancel', onUp)\n\n if (snapBack) {\n animate(0, 1, {\n spring: springs.subtle,\n onUpdate: (t) => {\n const value = { x: offsetRef.current.x * (1 - t), y: offsetRef.current.y * (1 - t) }\n write(value)\n },\n onComplete: () => {\n offsetRef.current = { x: 0, y: 0 }\n write(offsetRef.current)\n onDragEnd?.(offsetRef.current)\n },\n })\n return\n }\n\n if (useMomentum && samples.length >= 2) {\n const first = samples[0]!\n const last = samples[samples.length - 1]!\n const elapsed = Math.max(1, last.t - first.t)\n let velocity = {\n x: ((last.x - first.x) / elapsed) * 1000,\n y: ((last.y - first.y) / elapsed) * 1000,\n }\n\n const decay = 0.95\n const stop = getTicker().add(\n ({ delta }) => {\n // Exponential decay, frame-rate independent: raising the per-second factor to the\n // power of the frame time keeps the glide identical at 60 and 120 Hz.\n const factor = Math.pow(decay, delta * 60)\n velocity = { x: velocity.x * factor, y: velocity.y * factor }\n\n const next = clamp({\n x: offsetRef.current.x + velocity.x * delta,\n y: offsetRef.current.y + velocity.y * delta,\n })\n offsetRef.current = next\n write(next)\n\n if (Math.hypot(velocity.x, velocity.y) < 8) {\n stop()\n onDragEnd?.(offsetRef.current)\n }\n },\n { phase: 'write', name: 'Draggable' },\n )\n return\n }\n\n onDragEnd?.(offsetRef.current)\n }\n\n window.addEventListener('pointermove', onMove)\n window.addEventListener('pointerup', onUp)\n window.addEventListener('pointercancel', onUp)\n }\n\n return (\n <div\n ref={nodeRef}\n className={cx('ansh-draggable', dragging && 'ansh-draggable--active', className)}\n style={{ touchAction: axis === 'x' ? 'pan-y' : axis === 'y' ? 'pan-x' : 'none', ...style }}\n onPointerDown={onPointerDown}\n >\n {children}\n </div>\n )\n}\n"]}
@@ -695,5 +695,5 @@ function Draggable({
695
695
  }
696
696
 
697
697
  export { AnimatePresence, AnimatedText, Draggable, GradientText, MagneticButton, Marquee, Motion, MotionConfig, Parallax, Ripple, ScrollReveal, ThemeProvider, TiltCard, createBehaviourComponent, themeScript, useBehaviour, useMotionConfig, useTheme };
698
- //# sourceMappingURL=chunk-PVDQPVYF.js.map
699
- //# sourceMappingURL=chunk-PVDQPVYF.js.map
698
+ //# sourceMappingURL=chunk-NJUVVMJV.js.map
699
+ //# sourceMappingURL=chunk-NJUVVMJV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/factory/create-behaviour-component.tsx","../src/components/interaction.tsx","../src/components/text.tsx","../src/components/providers.tsx","../src/components/motion/shared.ts","../src/components/motion/motion.tsx","../src/components/motion/animate-presence.tsx","../src/components/motion/draggable.tsx"],"names":["Component","useEffect","jsx","useRef","getTicker","useMemo","useState","useLayoutEffect","currentKeys","prefersReducedMotion","useCallback","animate","springs"],"mappings":";;;;;;;AAqEO,SAAS,wBAAA,CAId,UAAA,EACA,WAAA,EACA,cAA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C/B,CAAA;AAEA,IAAA,MAAA,CAAO,gBAAA,CAAiB,eAAe,MAAM,CAAA;AAC7C,IAAA,MAAA,CAAO,gBAAA,CAAiB,aAAa,IAAI,CAAA;AACzC,IAAA,MAAA,CAAO,gBAAA,CAAiB,iBAAiB,IAAI,CAAA;AAAA,EAC/C,CAAA;AAEA,EAAA,uBACEF,GAAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA,EAAK,OAAA;AAAA,MACL,SAAA,EAAW,EAAA,CAAG,gBAAA,EAAkB,QAAA,IAAY,0BAA0B,SAAS,CAAA;AAAA,MAC/E,KAAA,EAAO,EAAE,WAAA,EAAa,IAAA,KAAS,GAAA,GAAM,OAAA,GAAU,IAAA,KAAS,GAAA,GAAM,OAAA,GAAU,MAAA,EAAQ,GAAG,KAAA,EAAM;AAAA,MACzF,aAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ","file":"chunk-NJUVVMJV.js","sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type CSSProperties,\n type ElementType,\n type ForwardRefExoticComponent,\n type ForwardedRef,\n type ReactNode,\n type RefAttributes,\n forwardRef,\n useEffect,\n useRef,\n} from 'react'\nimport {\n type BaseBehaviourOptions,\n type BehaviourDefinition,\n type BehaviourHandle,\n mountBehaviour,\n} from '@ansh-ui/core'\nimport { useMergedRef } from '../hooks/use-observers'\n\n/**\n * Turn a {@link BehaviourDefinition} into a React component.\n *\n * The DOM counterpart of {@link import('./create-effect-component').createEffectComponent}. The\n * difference in the API is deliberate and small: a behaviour component renders its children\n * *directly* rather than wrapping them in a positioned layer, because a behaviour manipulates the\n * host element itself and inserting a wrapper would break the author's layout.\n *\n * ```tsx\n * export const MagneticButton = createBehaviourComponent(magnetic, 'MagneticButton', 'button')\n * ```\n */\n\nexport interface BehaviourComponentBaseProps {\n as?: ElementType\n className?: string\n style?: React.CSSProperties\n children?: ReactNode\n}\n\nexport type BehaviourComponentProps<Options extends BaseBehaviourOptions> = Options &\n BehaviourComponentBaseProps &\n Omit<ComponentPropsWithoutRef<'div'>, keyof Options | 'style' | 'className' | 'children'> &\n /**\n * Attributes that only make sense on the elements `as` is actually used with.\n *\n * `as=\"a\"` without this is a type error on `href`, which makes the prop useless for the case it\n * exists for — turning a magnetic button into a link. Full polymorphic typing (`as` as a generic\n * that rewrites the whole prop set) is the textbook answer and it collapses inference for every\n * behaviour option in the intersection, producing error messages nobody can read. Naming the two\n * element types `as` is realistically pointed at is the trade that keeps both working.\n */\n Partial<Pick<ComponentPropsWithoutRef<'a'>, 'href' | 'target' | 'rel' | 'download'>> &\n Partial<Pick<ComponentPropsWithoutRef<'button'>, 'type' | 'disabled' | 'form' | 'name' | 'value'>>\n\n/** The type of a component produced by {@link createBehaviourComponent}. */\nexport type BehaviourComponent<\n Options extends BaseBehaviourOptions,\n El extends HTMLElement = HTMLElement,\n> = ForwardRefExoticComponent<BehaviourComponentProps<Options> & RefAttributes<El>>\n\n/** See the note on the equivalent type in `create-effect-component.tsx`. */\ntype LooseProps = Record<string, unknown> & {\n as?: ElementType\n className?: string\n style?: CSSProperties\n children?: ReactNode\n}\n\nexport function createBehaviourComponent<\n Options extends BaseBehaviourOptions,\n El extends HTMLElement = HTMLElement,\n>(\n definition: BehaviourDefinition<Options, El>,\n displayName?: string,\n defaultElement: ElementType = 'div',\n): BehaviourComponent<Options, El> {\n const optionKeys = new Set(Object.keys(definition.defaults))\n\n function Render(props: LooseProps, forwardedRef: ForwardedRef<El>) {\n const { as: Component = defaultElement, className, style, children, ...rest } = props\n\n const hostRef = useRef<El | null>(null)\n const handleRef = useRef<BehaviourHandle<Options> | null>(null)\n const mergedRef = useMergedRef<El>(hostRef, forwardedRef)\n\n const options: Record<string, unknown> = {}\n const domProps: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(rest)) {\n if (optionKeys.has(key)) options[key] = value\n else domProps[key] = value\n }\n\n const optionsKey = stableKey(options)\n const optionsRef = useRef(options)\n optionsRef.current = options\n\n useEffect(() => {\n const host = hostRef.current\n if (!host) return\n\n const handle = mountBehaviour(definition, host, optionsRef.current as Partial<Options>)\n handleRef.current = handle\n\n return () => {\n handle.destroy()\n handleRef.current = null\n }\n // Mount-only. Behaviours that restructure the DOM (marquee, split-text) must not be torn\n // down and rebuilt on an unrelated prop change — that would lose scroll position and\n // restart animations.\n }, [])\n\n useEffect(() => {\n handleRef.current?.update(optionsRef.current as Partial<Options>)\n }, [optionsKey])\n\n return (\n <Component ref={mergedRef} className={className} style={style} {...domProps}>\n {children}\n </Component>\n )\n }\n\n const Component = forwardRef(Render)\n Component.displayName = displayName ?? `Ansh(${definition.name})`\n\n return Component as unknown as BehaviourComponent<Options, El>\n}\n\n/** See the note on the identical helper in `create-effect-component.tsx`. */\nfunction stableKey(options: Record<string, unknown>): string {\n const keys = Object.keys(options).sort()\n const parts: string[] = []\n for (const key of keys) {\n const value = options[key]\n if (typeof value === 'function') parts.push(`${key}:fn`)\n else if (value === undefined) continue\n else parts.push(`${key}:${JSON.stringify(value)}`)\n }\n return parts.join('|')\n}\n\n/**\n * Attach a behaviour to an element you already have a ref to.\n *\n * The hook form, for when a component's own element must carry the behaviour rather than being\n * wrapped — which is most of the time when integrating with an existing design system.\n *\n * ```tsx\n * const ref = useRef<HTMLButtonElement>(null)\n * useBehaviour(ref, magnetic, { strength: 16 })\n * ```\n */\nexport function useBehaviour<Options extends BaseBehaviourOptions, El extends HTMLElement>(\n ref: React.RefObject<El | null>,\n definition: BehaviourDefinition<Options, El>,\n options?: Partial<Options>,\n): void {\n const handleRef = useRef<BehaviourHandle<Options> | null>(null)\n const optionsRef = useRef(options ?? {})\n optionsRef.current = options ?? {}\n\n const optionsKey = stableKey(optionsRef.current as Record<string, unknown>)\n\n useEffect(() => {\n const element = ref.current\n if (!element) return\n\n const handle = mountBehaviour(definition, element, optionsRef.current)\n handleRef.current = handle\n\n return () => {\n handle.destroy()\n handleRef.current = null\n }\n }, [definition, ref])\n\n useEffect(() => {\n handleRef.current?.update(optionsRef.current)\n }, [optionsKey])\n}\n","import { magnetic, marquee, parallax, ripple, scrollReveal, tilt } from '@ansh-ui/core'\nimport { createBehaviourComponent } from '../factory/create-behaviour-component'\n\n/**\n * DOM behaviour components.\n *\n * Unlike the canvas backgrounds these render their children directly — no wrapper, no positioned\n * layer — because a behaviour manipulates the host element and inserting a wrapper would break the\n * author's layout.\n */\n\n/**\n * An element that leans toward the pointer, spring-driven.\n *\n * Renders a `<button>` by default so it is keyboard-focusable and announced correctly. Pass\n * `as=\"a\"` or `as=\"div\"` when it isn't a button — but if it *acts* like a button, leave it.\n *\n * ```tsx\n * <MagneticButton strength={16} scale={1.04} onClick={submit}>\n * Get started\n * </MagneticButton>\n * ```\n */\nexport const MagneticButton = createBehaviourComponent(magnetic, 'MagneticButton', 'button')\n\n/**\n * A card that rotates in 3D toward the pointer, with a moving specular highlight.\n *\n * The `perspective()` is baked into the transform as its first function, so no parent wrapper is\n * needed — which is the usual reason tilt implementations come out looking sheared rather than 3D.\n */\nexport const TiltCard = createBehaviourComponent(tilt, 'TiltCard', 'div')\n\n/**\n * A wave that expands from the point of contact.\n *\n * Also fires on Enter and Space, so keyboard activation gets the same feedback as a click. The\n * ripple layer inherits the host's `border-radius`, so a pill button clips its ripple to a pill\n * with no extra configuration.\n */\nexport const Ripple = createBehaviourComponent(ripple, 'Ripple', 'div')\n\n/**\n * Seamless infinite scrolling content.\n *\n * Speed is in **pixels per second**, not a duration, so adding an item to a logo strip doesn't\n * change how fast it scrolls. Content is duplicated as many times as needed to cover the\n * container, and clones are `aria-hidden` so a screen reader reads the list once.\n *\n * ```tsx\n * <Marquee speed={40} fadeEdges={64} pauseOnHover>\n * {logos.map((logo) => <img key={logo.id} src={logo.src} alt={logo.name} />)}\n * </Marquee>\n * ```\n */\nexport const Marquee = createBehaviourComponent(marquee, 'Marquee', 'div')\n\n/**\n * Reveal content as it enters the viewport.\n *\n * The hidden starting state is applied **in JavaScript**, not CSS. If the script never runs, the\n * content is simply visible — degraded but readable. A CSS-hidden initial state means content that\n * is permanently invisible when JavaScript fails, which has shipped to production on a lot of\n * marketing sites.\n *\n * Pass `children=\".selector\"` to stagger descendants instead of revealing the host as one block.\n */\nexport const ScrollReveal = createBehaviourComponent(scrollReveal, 'ScrollReveal', 'div')\n\n/**\n * Move an element at a different rate from the scroll.\n *\n * All measurement happens in the ticker's `read` phase, so fifty parallax elements cost one layout\n * read per frame between them rather than one per scroll event each. Disabled outright under\n * `prefers-reduced-motion` — parallax is the canonical vestibular trigger, and a slow parallax is\n * still parallax.\n */\nexport const Parallax = createBehaviourComponent(parallax, 'Parallax', 'div')\n","import { type ElementType, useEffect, useLayoutEffect, useMemo, useRef } from 'react'\nimport {\n type EasingInput,\n type StaggerFrom,\n createGradient,\n getTicker,\n observeIntersection,\n prefersReducedMotion,\n resolveEasing,\n resolvePalette,\n stagger,\n} from '@ansh-ui/core'\n\n/**\n * Text components.\n *\n * These are written by hand rather than generated from a behaviour, because text animation has one\n * requirement no generic factory can satisfy: **the accessible text must never be the animated\n * text.** Splitting a heading into per-character spans and animating them is fine visually and an\n * accessibility failure if the split structure is what a screen reader reads.\n *\n * The pattern used throughout: the real string lives in a visually-hidden element that remains the\n * accessible name, and the entire animated structure is `aria-hidden`. Assistive technology reads\n * \"Motion, refined.\"; the eye sees fifteen characters arriving in sequence.\n */\n\n/**\n * `useLayoutEffect` on the client, `useEffect` on the server.\n *\n * The distinction matters here specifically. `AnimatedText` renders its units *visible* so the\n * server HTML and the first client render agree — anything else is a hydration mismatch. The hidden\n * starting state is then applied by an effect. With `useEffect` that happens **after** the browser\n * paints, so there is a visible one-frame flash of the final text before it hides and animates in.\n * `useLayoutEffect` runs before paint, so the flash cannot occur.\n *\n * The plain `useEffect` fallback on the server exists only to silence React's warning; layout\n * effects never run during SSR anyway.\n */\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect\n\nconst VISUALLY_HIDDEN: React.CSSProperties = {\n position: 'absolute',\n width: 1,\n height: 1,\n padding: 0,\n margin: -1,\n overflow: 'hidden',\n clipPath: 'inset(50%)',\n whiteSpace: 'nowrap',\n borderWidth: 0,\n}\n\n// ---------------------------------------------------------------------------\n// GradientText\n// ---------------------------------------------------------------------------\n\nexport interface GradientTextProps {\n children: string\n /** Any number of colours, or a built-in palette name. */\n colors?: readonly string[] | Parameters<typeof resolvePalette>[0]\n /** Gradient angle in degrees. Default `100`. */\n angle?: number\n /** Seconds for one full cycle. `0` holds a static gradient. Default `0` (static). */\n duration?: number\n /** Interpolated stops handed to CSS. More is smoother. Default `16`. */\n stops?: number\n as?: ElementType\n className?: string\n style?: React.CSSProperties\n}\n\n/**\n * Text filled with a perceptual gradient.\n *\n * Uses `background-clip: text`, and the stops are generated through the OKLab interpolator rather\n * than handed to CSS as two endpoints. That is the whole point: a CSS\n * `linear-gradient(#0275f4, #9f0550)` passes through a desaturated grey-brown at its midpoint,\n * which on text — where the gradient crosses a narrow band — is exactly where the eye lands.\n *\n * Animation is a CSS `background-position` shift rather than a JS loop, because for a single\n * property with no interaction the browser's own compositor is strictly better than anything we\n * could do on the main thread.\n */\nexport function GradientText({\n children,\n colors,\n angle = 100,\n duration = 0,\n stops = 16,\n as: Component = 'span',\n className,\n style,\n}: GradientTextProps) {\n const gradientCss = useMemo(() => {\n const palette = resolvePalette(colors as never)\n // Duplicated so an animated background-position shift wraps seamlessly instead of jumping.\n const looped = duration > 0 ? [...palette, ...palette] : palette\n return createGradient(looped, { space: 'oklab' }).toCss(`${angle}deg`, stops)\n }, [colors, angle, duration, stops])\n\n const animated = duration > 0 && !prefersReducedMotion()\n\n return (\n <Component\n className={className}\n style={{\n backgroundImage: gradientCss,\n backgroundSize: animated ? '200% 100%' : '100% 100%',\n backgroundClip: 'text',\n WebkitBackgroundClip: 'text',\n color: 'transparent',\n // A fallback for the rare engine without background-clip support: the first colour still\n // renders as solid text rather than the content vanishing entirely.\n WebkitTextFillColor: 'transparent',\n display: 'inline-block',\n ...(animated\n ? {\n animation: `ansh-gradient-shift ${duration}s linear infinite`,\n }\n : {}),\n ...style,\n }}\n >\n {children}\n {animated ? <GradientKeyframes /> : null}\n </Component>\n )\n}\n\n/**\n * The keyframes for {@link GradientText}.\n *\n * Injected as a `<style>` element rather than requiring a stylesheet import, so\n * `<GradientText duration={6} />` works with no setup. The rule is idempotent — several instances\n * emit identical CSS and the browser deduplicates it.\n */\nfunction GradientKeyframes() {\n return (\n <style\n dangerouslySetInnerHTML={{\n __html:\n '@keyframes ansh-gradient-shift{from{background-position:0% 50%}to{background-position:200% 50%}}',\n }}\n />\n )\n}\n\n// ---------------------------------------------------------------------------\n// AnimatedText\n// ---------------------------------------------------------------------------\n\nexport interface AnimatedTextProps {\n children: string\n /** Split granularity. Default `'chars'`. */\n by?: 'chars' | 'words'\n /** Seconds per unit's animation. Default `0.6`. */\n duration?: number\n /** Seconds between units. Default `0.03`. */\n each?: number\n /** Where the reveal wave begins. Default `'first'`. */\n from?: StaggerFrom\n easing?: EasingInput\n /** Distance each unit travels into place, in pixels. Default `18`. */\n distance?: number\n /** Starting blur in pixels — the \"focus in\" look. Default `0`. */\n blur?: number\n /** Starting rotation in degrees. Default `0`. */\n rotate?: number\n /** Clip each unit so it rises from behind a mask. Default `false`. */\n mask?: boolean\n /** Wait until scrolled into view. Default `true`. */\n whenInView?: boolean\n /** Replay every time it re-enters the viewport. Default `false`. */\n repeat?: boolean\n /** Seconds to wait before starting. Default `0`. */\n delay?: number\n as?: ElementType\n className?: string\n style?: React.CSSProperties\n onComplete?: () => void\n}\n\ninterface Unit {\n text: string\n /** `true` for whitespace, which is rendered as a plain gap rather than an animated unit. */\n space: boolean\n}\n\n/**\n * Text that reveals unit by unit.\n *\n * The split happens in React (so the markup is server-rendered and present in the HTML source for\n * SEO and for no-JS readers) while the animation runs on the shared ticker (so a page full of these\n * shares one clock and cannot drift).\n *\n * Under `prefers-reduced-motion` the text renders in its final state immediately — no hidden\n * frame, no fade.\n */\nexport function AnimatedText({\n children,\n by = 'chars',\n duration = 0.6,\n each = 0.03,\n from = 'first',\n easing = 'cinematic',\n distance = 18,\n blur = 0,\n rotate = 0,\n mask = false,\n whenInView = true,\n repeat = false,\n delay = 0,\n as: Component = 'span',\n className,\n style,\n onComplete,\n}: AnimatedTextProps) {\n const hostRef = useRef<HTMLElement | null>(null)\n const unitRefs = useRef<(HTMLSpanElement | null)[]>([])\n const onCompleteRef = useRef(onComplete)\n onCompleteRef.current = onComplete\n\n /**\n * Split into units.\n *\n * Grapheme-aware via `Intl.Segmenter`: `[...string]` splits by code point, which breaks emoji\n * with modifiers and combining accents into multiple \"characters\".\n */\n const units = useMemo<Unit[]>(() => {\n if (by === 'words') {\n return children\n .split(/(\\s+)/)\n .filter((token) => token.length > 0)\n .map((token) => ({ text: token, space: /^\\s+$/.test(token) }))\n }\n\n const graphemes =\n typeof Intl !== 'undefined' && 'Segmenter' in Intl\n ? Array.from(\n new Intl.Segmenter(undefined, { granularity: 'grapheme' }).segment(children),\n (s) => s.segment,\n )\n : Array.from(children)\n\n return graphemes.map((character) => ({ text: character, space: /^\\s$/.test(character) }))\n }, [children, by])\n\n const animatedCount = useMemo(() => units.filter((u) => !u.space).length, [units])\n\n useIsomorphicLayoutEffect(() => {\n const host = hostRef.current\n if (!host) return\n\n // Reduced motion: leave everything at its final state. The units are rendered without inline\n // styles below when this is true, so there is nothing to undo.\n if (prefersReducedMotion()) {\n onCompleteRef.current?.()\n return\n }\n\n const ease = resolveEasing(easing)\n const delayFor = stagger(animatedCount, { each, from })\n const ticker = getTicker()\n\n // Map each rendered unit to its animation index, skipping whitespace so the stagger counts\n // visible characters rather than including gaps.\n const targets: { node: HTMLSpanElement; delay: number }[] = []\n let animationIndex = 0\n units.forEach((unit, i) => {\n if (unit.space) return\n const node = unitRefs.current[i]\n if (node) targets.push({ node, delay: delay + delayFor(animationIndex) })\n animationIndex++\n })\n\n const apply = (node: HTMLSpanElement, progress: number): void => {\n const eased = ease(progress)\n const inverse = 1 - eased\n node.style.opacity = String(eased)\n const parts = [`translate3d(0, ${(distance * inverse).toFixed(2)}px, 0)`]\n if (rotate !== 0) parts.push(`rotate(${(rotate * inverse).toFixed(2)}deg)`)\n node.style.transform = parts.join(' ')\n if (blur > 0) {\n const amount = blur * inverse\n node.style.filter = amount > 0.05 ? `blur(${amount.toFixed(2)}px)` : ''\n }\n }\n\n const reset = (): void => {\n for (const { node } of targets) apply(node, 0)\n }\n\n const settle = (node: HTMLSpanElement): void => {\n node.style.opacity = ''\n node.style.transform = ''\n node.style.filter = ''\n // Drop the compositor promotion once at rest.\n node.style.willChange = ''\n }\n\n let elapsed = 0\n let running = false\n let stopTicker: (() => void) | null = null\n\n const start = (): void => {\n if (running) return\n running = true\n elapsed = 0\n for (const { node } of targets) node.style.willChange = 'opacity, transform'\n reset()\n\n stopTicker = ticker.add(\n ({ delta }) => {\n elapsed += delta\n let allDone = true\n\n for (const target of targets) {\n const local = elapsed - target.delay\n if (local < 0) {\n allDone = false\n continue\n }\n const progress = duration <= 0 ? 1 : local / duration\n if (progress >= 1) {\n settle(target.node)\n continue\n }\n apply(target.node, progress)\n allDone = false\n }\n\n if (allDone) {\n stopTicker?.()\n stopTicker = null\n running = false\n onCompleteRef.current?.()\n }\n },\n { phase: 'write', name: 'AnimatedText' },\n )\n }\n\n if (!whenInView) {\n // Hide immediately so there is no flash of final state before the first frame.\n reset()\n start()\n return () => {\n stopTicker?.()\n for (const { node } of targets) settle(node)\n }\n }\n\n reset()\n\n const stopObserver = observeIntersection(\n host,\n (entry) => {\n if (entry.isIntersecting) {\n start()\n } else if (repeat) {\n stopTicker?.()\n stopTicker = null\n running = false\n reset()\n }\n },\n { threshold: 0.2, rootMargin: '0px 0px -8% 0px' },\n )\n\n return () => {\n stopObserver()\n stopTicker?.()\n for (const { node } of targets) settle(node)\n }\n }, [\n units,\n animatedCount,\n duration,\n each,\n from,\n easing,\n distance,\n blur,\n rotate,\n whenInView,\n repeat,\n delay,\n ])\n\n return (\n <Component ref={hostRef} className={className} style={{ display: 'inline-block', ...style }}>\n {/* The accessible representation: the real string, unfragmented. */}\n <span style={VISUALLY_HIDDEN}>{children}</span>\n\n <span aria-hidden=\"true\">\n {units.map((unit, i) =>\n unit.space ? (\n // Whitespace as a plain text node so it collapses and wraps like real text.\n <span key={i}>{unit.text}</span>\n ) : mask ? (\n <span\n key={i}\n style={{ display: 'inline-block', overflow: 'hidden', verticalAlign: 'top' }}\n >\n <span\n ref={(node) => {\n unitRefs.current[i] = node\n }}\n style={{ display: 'inline-block' }}\n >\n {unit.text}\n </span>\n </span>\n ) : (\n <span\n key={i}\n ref={(node) => {\n unitRefs.current[i] = node\n }}\n style={{ display: 'inline-block' }}\n >\n {unit.text}\n </span>\n ),\n )}\n </span>\n </Component>\n )\n}\n","import { type ReactNode, createContext, useContext, useEffect, useMemo, useState } from 'react'\nimport {\n type ReducedMotionMode,\n attachLifecycle,\n getTicker,\n setReducedMotionMode,\n} from '@ansh-ui/core'\nimport { applyTheme, resolveTheme } from '@ansh-ui/tokens'\n\n// ---------------------------------------------------------------------------\n// MotionConfig\n// ---------------------------------------------------------------------------\n\nexport interface MotionConfigValue {\n reducedMotion: ReducedMotionMode\n /** Global playback rate. `0.5` is slow motion across every animation on the page. */\n timeScale: number\n /** Pin adaptive quality, or `null` to let the frame budget decide. */\n quality: number | null\n}\n\nconst MotionConfigContext = createContext<MotionConfigValue>({\n reducedMotion: 'auto',\n timeScale: 1,\n quality: null,\n})\n\nexport interface MotionConfigProps extends Partial<MotionConfigValue> {\n /**\n * Pause every animation while the document is hidden. Default `true`.\n *\n * Leave this on. Animating a background tab burns battery and spins fans for output nobody can\n * see, and it is the most common performance complaint about animation-heavy sites.\n */\n pauseWhenHidden?: boolean\n /** Also pause when the window loses focus. Default `false` — a visible unfocused window still\n * expects to animate. */\n pauseWhenBlurred?: boolean\n /** Reduce quality on low battery where the platform exposes it. Default `true`. */\n respectBattery?: boolean\n children?: ReactNode\n}\n\n/**\n * Application-level motion configuration.\n *\n * Optional — every component works without it. Mount it once at the root when you need\n * app-wide control:\n *\n * ```tsx\n * <MotionConfig reducedMotion={userPrefersCalm ? 'always' : 'auto'}>\n * <App />\n * </MotionConfig>\n * ```\n *\n * `reducedMotion=\"always\"` is genuinely useful in production, as the backing for an in-app\n * \"reduce motion\" setting — many users who want calmer interfaces have never found the OS toggle.\n */\nexport function MotionConfig({\n reducedMotion = 'auto',\n timeScale = 1,\n quality = null,\n pauseWhenHidden = true,\n pauseWhenBlurred = false,\n respectBattery = true,\n children,\n}: MotionConfigProps) {\n useEffect(() => {\n setReducedMotionMode(reducedMotion)\n }, [reducedMotion])\n\n useEffect(() => {\n getTicker().timeScale = timeScale\n }, [timeScale])\n\n useEffect(() => {\n if (quality !== null) getTicker().lockQuality(quality)\n }, [quality])\n\n useEffect(\n () =>\n attachLifecycle(getTicker(), {\n pauseWhenHidden,\n pauseWhenBlurred,\n respectBattery,\n }),\n [pauseWhenHidden, pauseWhenBlurred, respectBattery],\n )\n\n const value = useMemo(\n () => ({ reducedMotion, timeScale, quality }),\n [reducedMotion, timeScale, quality],\n )\n\n return <MotionConfigContext.Provider value={value}>{children}</MotionConfigContext.Provider>\n}\n\n/** Read the nearest {@link MotionConfig}. Returns sensible defaults with no provider present. */\nexport function useMotionConfig(): MotionConfigValue {\n return useContext(MotionConfigContext)\n}\n\n// ---------------------------------------------------------------------------\n// ThemeProvider\n// ---------------------------------------------------------------------------\n\nexport type ThemeSetting = 'light' | 'dark' | 'system'\n\nexport interface ThemeContextValue {\n /** What was requested, including `'system'`. */\n theme: ThemeSetting\n /** What is actually rendering. `'system'` is resolved to one or the other. */\n resolved: 'light' | 'dark'\n setTheme: (theme: ThemeSetting) => void\n}\n\nconst ThemeContext = createContext<ThemeContextValue>({\n theme: 'system',\n resolved: 'light',\n setTheme: () => {},\n})\n\nexport interface ThemeProviderProps {\n /** Initial setting. Default `'system'`. */\n defaultTheme?: ThemeSetting\n /** Persist the choice under this `localStorage` key. Pass `null` to disable. Default `'ansh-theme'`. */\n storageKey?: string | null\n children?: ReactNode\n}\n\n/**\n * Theme control over the `@ansh-ui/tokens` stylesheet.\n *\n * Sets `data-theme` on `<html>`, which the token stylesheet already understands. Two details that\n * are easy to get wrong and are handled here:\n *\n * **`'system'` removes the attribute rather than writing a resolved value.** The token stylesheet\n * guards its `prefers-color-scheme` rule with `:root:not([data-theme])`, so removing the attribute\n * hands control back to the OS — and, importantly, means the theme keeps following the OS if the\n * user changes it while the page is open.\n *\n * **The initial render always reports `'light'`.** Reading `localStorage` during render would be a\n * hydration mismatch, since the server has no access to it. The stored value is applied in an\n * effect. To avoid a flash of the wrong theme, ship the small inline script from\n * {@link themeScript} in your document `<head>` — that is the only way to set the attribute before\n * first paint, and it is what every correct implementation does.\n */\nexport function ThemeProvider({\n defaultTheme = 'system',\n storageKey = 'ansh-theme',\n children,\n}: ThemeProviderProps) {\n const [theme, setThemeState] = useState<ThemeSetting>(defaultTheme)\n const [resolved, setResolved] = useState<'light' | 'dark'>('light')\n\n // Read the stored preference after mount, never during render.\n useEffect(() => {\n if (!storageKey) return\n try {\n const stored = localStorage.getItem(storageKey)\n if (stored === 'light' || stored === 'dark' || stored === 'system') {\n setThemeState(stored)\n }\n } catch {\n // Storage can throw in private browsing or with cookies disabled. A theme preference is\n // not worth breaking the page over.\n }\n }, [storageKey])\n\n useEffect(() => {\n applyTheme(theme)\n setResolved(resolveTheme())\n\n if (storageKey) {\n try {\n localStorage.setItem(storageKey, theme)\n } catch {\n // As above.\n }\n }\n }, [theme, storageKey])\n\n // Follow the OS while set to `'system'`.\n useEffect(() => {\n if (theme !== 'system' || typeof matchMedia !== 'function') return\n const query = matchMedia('(prefers-color-scheme: dark)')\n const onChange = () => setResolved(query.matches ? 'dark' : 'light')\n query.addEventListener('change', onChange)\n return () => query.removeEventListener('change', onChange)\n }, [theme])\n\n const value = useMemo(() => ({ theme, resolved, setTheme: setThemeState }), [theme, resolved])\n\n return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>\n}\n\nexport function useTheme(): ThemeContextValue {\n return useContext(ThemeContext)\n}\n\n/**\n * The blocking script that prevents a theme flash.\n *\n * Inject this in `<head>`, before any stylesheet. It reads the stored preference and sets\n * `data-theme` synchronously, before the browser paints — which is the only point at which it can\n * be done without a visible flash. It is deliberately tiny and dependency-free.\n *\n * ```tsx\n * // Next.js app/layout.tsx\n * <head>\n * <script dangerouslySetInnerHTML={{ __html: themeScript() }} />\n * </head>\n * ```\n */\nexport function themeScript(storageKey = 'ansh-theme'): string {\n return (\n `(function(){try{var t=localStorage.getItem(${JSON.stringify(storageKey)});` +\n `if(t==='light'||t==='dark'){document.documentElement.setAttribute('data-theme',t)}}` +\n `catch(e){}})()`\n )\n}\n","import { type CSSProperties, type ElementType, type ReactNode } from 'react'\nimport { type EasingInput, type SpringOptions, type springs } from '@ansh-ui/core'\n\nexport interface MotionValues {\n opacity?: number\n x?: number\n y?: number\n scale?: number\n scaleX?: number\n scaleY?: number\n rotate?: number\n /** Blur radius in px. */\n blur?: number\n}\n\nexport interface MotionTransition {\n /** Seconds. Ignored when `spring` is set. Default `0.4`. */\n duration?: number\n /** Seconds to wait. Default `0`. */\n delay?: number\n easing?: EasingInput\n /** Use a spring instead of a tween. `true` uses the `smooth` preset. */\n spring?: boolean | SpringOptions | keyof typeof springs\n}\n\nexport type MotionElementProps = {\n as?: ElementType\n /** Starting values. Applied before the first paint. */\n initial?: MotionValues\n /** Target values. Changing these animates to the new target. */\n animate?: MotionValues\n /** Values to animate to when removed by `AnimatePresence`. */\n exit?: MotionValues\n transition?: MotionTransition\n whileHover?: MotionValues\n whileTap?: MotionValues\n /** Animate to `animate` only once scrolled into view. */\n whileInView?: boolean\n /** Fraction visible before `whileInView` triggers. Default `0.2`. */\n inViewAmount?: number\n className?: string\n style?: CSSProperties\n children?: ReactNode\n}\n\nexport const DEFAULTS: Required<Omit<MotionValues, never>> = {\n opacity: 1,\n x: 0,\n y: 0,\n scale: 1,\n scaleX: 1,\n scaleY: 1,\n rotate: 0,\n blur: 0,\n}\n\n/** Compose the values into a transform string plus the properties that aren't transforms. */\nexport function applyValues(node: HTMLElement, values: Required<MotionValues>): void {\n const transform =\n `translate3d(${values.x}px, ${values.y}px, 0)` +\n ` scale(${values.scale * values.scaleX}, ${values.scale * values.scaleY})` +\n ` rotate(${values.rotate}deg)`\n\n node.style.transform = transform\n node.style.opacity = String(values.opacity)\n // Only written when non-zero: an always-present `filter` creates a containing block and a new\n // stacking context, which changes how `position: fixed` descendants resolve.\n node.style.filter = values.blur > 0 ? `blur(${values.blur}px)` : ''\n}\n\nexport function resolve(\n values: MotionValues | undefined,\n base: Required<MotionValues>,\n): Required<MotionValues> {\n return { ...base, ...values }\n}\n","import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'\nimport { type AnimationOptions, animate, springs } from '@ansh-ui/core'\nimport {\n DEFAULTS,\n type MotionElementProps,\n type MotionTransition,\n type MotionValues,\n applyValues,\n resolve,\n} from './shared'\n\n/**\n * Declarative motion.\n *\n * A deliberately **small** subset of what a full motion library does: transform properties and\n * opacity, animated from `initial` to `animate`, plus hover and press states and an exit animation\n * when paired with `AnimatePresence`.\n *\n * That scope is a decision, not a gap. Layout animation (FLIP), shared-element transitions and\n * variant propagation each need machinery an order of magnitude larger than this file, and a\n * half-implementation of them is worse than none — it works in the demo and fails on the real page.\n * For those, use a dedicated library; for the 90% case of \"fade this in, slide that up, spring the\n * card on hover\", this costs a fraction of the bundle.\n *\n * Values are written straight to the element's `style` from the ticker's write phase. React never\n * re-renders during an animation.\n */\n\n/**\n * An animated element.\n *\n * ```tsx\n * <Motion initial={{ opacity: 0, y: 24 }} animate={{ opacity: 1, y: 0 }} whileInView>\n * <Card />\n * </Motion>\n * ```\n */\nexport function Motion({\n as: Component = 'div',\n initial,\n animate: target,\n // Destructured but unused here: `AnimatePresence` reads `exit` off the element's props when the\n // child is removed and swaps it into `animate`. Pulling it out of `rest` stops it reaching the\n // DOM as an unknown attribute.\n exit: _exit,\n transition,\n whileHover,\n whileTap,\n whileInView = false,\n inViewAmount = 0.2,\n className,\n style,\n children,\n ...rest\n}: MotionElementProps & Record<string, unknown>) {\n const nodeRef = useRef<HTMLElement | null>(null)\n const currentRef = useRef<Required<MotionValues>>(resolve(initial, DEFAULTS))\n const controlsRef = useRef<ReturnType<typeof animate> | null>(null)\n const [inView, setInView] = useState(!whileInView)\n\n // Applied before paint, not in an effect. `useEffect` runs after the browser has already painted\n // the element at its natural position, so an element that should fade in flashes at full opacity\n // for one frame first.\n useLayoutEffect(() => {\n if (nodeRef.current) applyValues(nodeRef.current, currentRef.current)\n }, [])\n\n const runTo = useCallback(\n (next: Required<MotionValues>, options?: MotionTransition) => {\n const node = nodeRef.current\n if (!node) return\n\n controlsRef.current?.stop()\n\n const from = { ...currentRef.current }\n const springOption = options?.spring ?? transition?.spring\n\n const animationOptions: AnimationOptions<number> = {\n ...((options?.delay ?? transition?.delay !== undefined)\n ? { delay: options?.delay ?? transition?.delay ?? 0 }\n : null),\n ...(springOption\n ? {\n spring:\n springOption === true\n ? springs.default\n : typeof springOption === 'string'\n ? springs[springOption]\n : springOption,\n }\n : {\n duration: options?.duration ?? transition?.duration ?? 0.4,\n ...((options?.easing ?? transition?.easing)\n ? { easing: (options?.easing ?? transition?.easing)! }\n : null),\n }),\n onUpdate: (t) => {\n // One scalar drives every property, so all of them stay in lockstep. Animating each\n // independently would need one ticker subscription per property and they would drift\n // apart under a spring, which is not time-based.\n const frame = {} as Required<MotionValues>\n for (const key of Object.keys(DEFAULTS) as Array<keyof MotionValues>) {\n frame[key] = from[key] + (next[key] - from[key]) * t\n }\n currentRef.current = frame\n applyValues(node, frame)\n },\n onComplete: () => {\n currentRef.current = next\n applyValues(node, next)\n },\n }\n\n controlsRef.current = animate(0, 1, animationOptions)\n },\n [transition],\n )\n\n // Animate to the target whenever it changes (or when it scrolls into view).\n const targetKey = JSON.stringify(target ?? null)\n useEffect(() => {\n if (!inView) return\n runTo(resolve(target, DEFAULTS))\n // `targetKey` stands in for `target`, which is nearly always an inline object literal whose\n // identity changes on every render.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [targetKey, inView, runTo])\n\n useEffect(() => {\n if (!whileInView) return\n const node = nodeRef.current\n if (!node || typeof IntersectionObserver === 'undefined') {\n setInView(true)\n return\n }\n const observer = new IntersectionObserver(\n ([entry]) => {\n if (entry?.isIntersecting) {\n setInView(true)\n observer.disconnect()\n }\n },\n { threshold: inViewAmount },\n )\n observer.observe(node)\n return () => observer.disconnect()\n }, [whileInView, inViewAmount])\n\n useEffect(() => () => controlsRef.current?.stop(), [])\n\n const interaction: Record<string, unknown> = {}\n if (whileHover) {\n interaction.onMouseEnter = () => runTo(resolve({ ...target, ...whileHover }, DEFAULTS))\n interaction.onMouseLeave = () => runTo(resolve(target, DEFAULTS))\n }\n if (whileTap) {\n interaction.onPointerDown = () =>\n runTo(resolve({ ...target, ...whileTap }, DEFAULTS), { duration: 0.12 })\n interaction.onPointerUp = () => runTo(resolve({ ...target, ...whileHover }, DEFAULTS))\n }\n\n return (\n <Component\n ref={nodeRef}\n className={className}\n // `will-change` is set once, statically. Toggling it per animation causes the compositor to\n // create and destroy a layer on every interaction, which is more expensive than the hint saves.\n style={{ willChange: 'transform, opacity', ...style }}\n {...interaction}\n {...rest}\n >\n {children}\n </Component>\n )\n}\n","import {\n type ReactElement,\n type ReactNode,\n Children,\n cloneElement,\n isValidElement,\n useEffect,\n useRef,\n useState,\n} from 'react'\nimport { prefersReducedMotion } from '@ansh-ui/core'\nimport { type MotionElementProps } from './shared'\n\nexport interface AnimatePresenceProps {\n children: ReactNode\n /** Seconds to keep a removed child mounted. Default `0.35`. */\n exitDuration?: number\n}\n\n/**\n * Keep removed children mounted long enough to animate out.\n *\n * React unmounts immediately when a child disappears from the tree, so an exit animation never gets\n * a chance to run. This holds departing children in its own state, plays their `exit` values, then\n * drops them.\n *\n * Children **must** have stable `key`s — that is how removals are detected at all. Without keys,\n * React reuses element positions and this sees no removal to animate.\n */\nexport function AnimatePresence({ children, exitDuration = 0.35 }: AnimatePresenceProps) {\n const currentChildren = Children.toArray(children).filter(isValidElement) as ReactElement[]\n const [rendered, setRendered] = useState<ReactElement[]>(currentChildren)\n const timersRef = useRef(new Map<string, ReturnType<typeof setTimeout>>())\n\n const keys = currentChildren.map((child) => String(child.key))\n const keysSignature = keys.join('|')\n\n useEffect(() => {\n const currentKeys = new Set(keys)\n const departing = rendered.filter((child) => !currentKeys.has(String(child.key)))\n\n if (departing.length === 0) {\n // Straight replacement keeps updated props flowing to children that are still present.\n setRendered(currentChildren)\n return\n }\n\n // Keep the departing children in place, appended after the current set so they don't reorder\n // the survivors while they animate out.\n setRendered([...currentChildren, ...departing])\n\n const delay = prefersReducedMotion() ? 0 : exitDuration * 1000\n for (const child of departing) {\n const key = String(child.key)\n clearTimeout(timersRef.current.get(key))\n timersRef.current.set(\n key,\n setTimeout(() => {\n setRendered((previous) => previous.filter((entry) => String(entry.key) !== key))\n timersRef.current.delete(key)\n }, delay),\n )\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [keysSignature, exitDuration])\n\n useEffect(() => {\n const timers = timersRef.current\n return () => {\n for (const timer of timers.values()) clearTimeout(timer)\n timers.clear()\n }\n }, [])\n\n const currentKeys = new Set(keys)\n\n return (\n <>\n {rendered.map((child) => {\n const leaving = !currentKeys.has(String(child.key))\n if (!leaving) return child\n\n // A departing child animates to its `exit` values by having them swapped into `animate`.\n const props = child.props as MotionElementProps\n return cloneElement(child as ReactElement<MotionElementProps>, {\n animate: props.exit ?? { opacity: 0, scale: 0.96 },\n transition: { duration: exitDuration, ...props.transition },\n })\n })}\n </>\n )\n}\n","import { type CSSProperties, type ReactNode, useCallback, useRef, useState } from 'react'\nimport { animate, getTicker, springs } from '@ansh-ui/core'\nimport { cx } from '../../primitives/compose'\n\nexport interface DraggableProps {\n /** Constrain movement. */\n axis?: 'x' | 'y' | 'both'\n /** Bounds relative to the starting position, in px. */\n bounds?: { left?: number; right?: number; top?: number; bottom?: number }\n /** Spring back to the origin on release. */\n snapBack?: boolean\n /** Carry momentum after release. Default `true` when not snapping back. */\n momentum?: boolean\n onDragStart?: () => void\n onDragEnd?: (offset: { x: number; y: number }) => void\n className?: string\n style?: CSSProperties\n children: ReactNode\n}\n\n/**\n * A draggable surface with inertia.\n *\n * The momentum on release is what separates a drag that feels physical from one that stops dead.\n * Velocity is measured over the last few pointer samples rather than the last two — a single pair\n * of events is dominated by whatever jitter the final sample had, which produces a flick in the\n * wrong direction often enough to be noticeable.\n */\nexport function Draggable({\n axis = 'both',\n bounds,\n snapBack = false,\n momentum,\n onDragStart,\n onDragEnd,\n className,\n style,\n children,\n}: DraggableProps) {\n const nodeRef = useRef<HTMLDivElement | null>(null)\n const offsetRef = useRef({ x: 0, y: 0 })\n const [dragging, setDragging] = useState(false)\n\n const useMomentum = momentum ?? !snapBack\n\n const clamp = useCallback(\n (value: { x: number; y: number }) => ({\n x: Math.min(Math.max(value.x, bounds?.left ?? -Infinity), bounds?.right ?? Infinity),\n y: Math.min(Math.max(value.y, bounds?.top ?? -Infinity), bounds?.bottom ?? Infinity),\n }),\n [bounds],\n )\n\n const write = (value: { x: number; y: number }) => {\n if (nodeRef.current) {\n nodeRef.current.style.transform = `translate3d(${value.x}px, ${value.y}px, 0)`\n }\n }\n\n const onPointerDown = (event: React.PointerEvent<HTMLDivElement>) => {\n event.currentTarget.setPointerCapture(event.pointerId)\n setDragging(true)\n onDragStart?.()\n\n const start = { x: event.clientX, y: event.clientY }\n const origin = { ...offsetRef.current }\n // A short ring of recent samples, for a velocity estimate that isn't hostage to the last event.\n const samples: Array<{ x: number; y: number; t: number }> = []\n\n const onMove = (moveEvent: PointerEvent) => {\n const next = clamp({\n x: axis === 'y' ? origin.x : origin.x + (moveEvent.clientX - start.x),\n y: axis === 'x' ? origin.y : origin.y + (moveEvent.clientY - start.y),\n })\n offsetRef.current = next\n write(next)\n\n samples.push({ x: next.x, y: next.y, t: performance.now() })\n if (samples.length > 5) samples.shift()\n }\n\n const onUp = () => {\n setDragging(false)\n window.removeEventListener('pointermove', onMove)\n window.removeEventListener('pointerup', onUp)\n window.removeEventListener('pointercancel', onUp)\n\n if (snapBack) {\n animate(0, 1, {\n spring: springs.subtle,\n onUpdate: (t) => {\n const value = { x: offsetRef.current.x * (1 - t), y: offsetRef.current.y * (1 - t) }\n write(value)\n },\n onComplete: () => {\n offsetRef.current = { x: 0, y: 0 }\n write(offsetRef.current)\n onDragEnd?.(offsetRef.current)\n },\n })\n return\n }\n\n if (useMomentum && samples.length >= 2) {\n const first = samples[0]!\n const last = samples[samples.length - 1]!\n const elapsed = Math.max(1, last.t - first.t)\n let velocity = {\n x: ((last.x - first.x) / elapsed) * 1000,\n y: ((last.y - first.y) / elapsed) * 1000,\n }\n\n const decay = 0.95\n const stop = getTicker().add(\n ({ delta }) => {\n // Exponential decay, frame-rate independent: raising the per-second factor to the\n // power of the frame time keeps the glide identical at 60 and 120 Hz.\n const factor = Math.pow(decay, delta * 60)\n velocity = { x: velocity.x * factor, y: velocity.y * factor }\n\n const next = clamp({\n x: offsetRef.current.x + velocity.x * delta,\n y: offsetRef.current.y + velocity.y * delta,\n })\n offsetRef.current = next\n write(next)\n\n if (Math.hypot(velocity.x, velocity.y) < 8) {\n stop()\n onDragEnd?.(offsetRef.current)\n }\n },\n { phase: 'write', name: 'Draggable' },\n )\n return\n }\n\n onDragEnd?.(offsetRef.current)\n }\n\n window.addEventListener('pointermove', onMove)\n window.addEventListener('pointerup', onUp)\n window.addEventListener('pointercancel', onUp)\n }\n\n return (\n <div\n ref={nodeRef}\n className={cx('ansh-draggable', dragging && 'ansh-draggable--active', className)}\n style={{ touchAction: axis === 'x' ? 'pan-y' : axis === 'y' ? 'pan-x' : 'none', ...style }}\n onPointerDown={onPointerDown}\n >\n {children}\n </div>\n )\n}\n"]}