fancy-ui-vue 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (292) hide show
  1. package/PORTING.md +123 -2
  2. package/README.md +15 -13
  3. package/dist/components/accordion/Accordion.vue.d.ts +44 -0
  4. package/dist/components/accordion/Accordion.vue.js +88 -0
  5. package/dist/components/accordion/Accordion.vue2.js +4 -0
  6. package/dist/components/accordion/AccordionContent.vue.d.ts +25 -0
  7. package/dist/components/accordion/AccordionContent.vue.js +42 -0
  8. package/dist/components/accordion/AccordionContent.vue2.js +4 -0
  9. package/dist/components/accordion/AccordionItem.vue.d.ts +21 -0
  10. package/dist/components/accordion/AccordionItem.vue.js +66 -0
  11. package/dist/components/accordion/AccordionItem.vue2.js +4 -0
  12. package/dist/components/accordion/AccordionTrigger.vue.d.ts +24 -0
  13. package/dist/components/accordion/AccordionTrigger.vue.js +83 -0
  14. package/dist/components/accordion/AccordionTrigger.vue2.js +4 -0
  15. package/dist/components/accordion/accordion-core.d.ts +35 -0
  16. package/dist/components/accordion/accordion-core.js +44 -0
  17. package/dist/components/accordion/index.d.ts +11 -0
  18. package/dist/components/accordion/types.d.ts +45 -0
  19. package/dist/components/accordion/types.js +7 -0
  20. package/dist/components/alert-dialog/AlertDialog.vue.js +22 -3
  21. package/dist/components/animated-testimonials/AnimatedTestimonials.vue.js +3 -3
  22. package/dist/components/apple-card-carousel/AppleCard.vue.js +1 -1
  23. package/dist/components/autocomplete/Autocomplete.vue.js +1 -1
  24. package/dist/components/autocomplete/Autocomplete.vue2.js +22 -15
  25. package/dist/components/avatar/Avatar.vue.d.ts +27 -0
  26. package/dist/components/avatar/Avatar.vue.js +119 -0
  27. package/dist/components/avatar/Avatar.vue2.js +4 -0
  28. package/dist/components/avatar/avatar-core.d.ts +40 -0
  29. package/dist/components/avatar/avatar-core.js +57 -0
  30. package/dist/components/avatar/index.d.ts +2 -0
  31. package/dist/components/badge/Badge.vue.d.ts +21 -0
  32. package/dist/components/badge/Badge.vue.js +46 -0
  33. package/dist/components/badge/Badge.vue2.js +4 -0
  34. package/dist/components/badge/index.d.ts +2 -0
  35. package/dist/components/bento-grid/BentoFrame.vue.js +1 -1
  36. package/dist/components/bento-grid/BentoFrame.vue2.js +6 -5
  37. package/dist/components/bento-grid/BentoGrid.vue.js +1 -1
  38. package/dist/components/bento-grid/BentoGrid.vue2.js +12 -12
  39. package/dist/components/bento-grid/BentoGridCard.vue.js +6 -5
  40. package/dist/components/bento-grid/BentoGridItem.vue.js +6 -5
  41. package/dist/components/bg-falling-stars/FallingStarsBg.vue.d.ts +1 -1
  42. package/dist/components/bg-falling-stars/FallingStarsBg.vue.js +1 -1
  43. package/dist/components/bg-falling-stars/bg-falling-stars-core.d.ts +1 -1
  44. package/dist/components/bg-falling-stars/bg-falling-stars-core.js +47 -12
  45. package/dist/components/book/Book.vue.js +8 -9
  46. package/dist/components/book/BookDescription.vue.js +6 -5
  47. package/dist/components/book/BookHeader.vue.js +6 -5
  48. package/dist/components/book/BookTitle.vue.js +6 -5
  49. package/dist/components/box-reveal/BoxReveal.vue.js +6 -5
  50. package/dist/components/button/Button.vue.d.ts +6 -4
  51. package/dist/components/button/Button.vue.js +1 -1
  52. package/dist/components/button/Button.vue2.js +50 -22
  53. package/dist/components/card-3d/CardContainer.vue.js +1 -1
  54. package/dist/components/card-3d/CardItem.vue.js +1 -1
  55. package/dist/components/card-spotlight/CardSpotlight.vue.js +1 -1
  56. package/dist/components/chat-message/ChatMessageAction.vue.d.ts +4 -2
  57. package/dist/components/chat-message/ChatMessageAction.vue.js +4 -2
  58. package/dist/components/checkbox/Checkbox.vue.d.ts +2 -0
  59. package/dist/components/checkbox/Checkbox.vue.js +1 -1
  60. package/dist/components/checkbox/Checkbox.vue2.js +17 -7
  61. package/dist/components/collapsible/Collapsible.vue.d.ts +31 -0
  62. package/dist/components/collapsible/Collapsible.vue.js +60 -0
  63. package/dist/components/collapsible/Collapsible.vue2.js +4 -0
  64. package/dist/components/collapsible/CollapsibleContent.vue.d.ts +26 -0
  65. package/dist/components/collapsible/CollapsibleContent.vue.js +81 -0
  66. package/dist/components/collapsible/CollapsibleContent.vue2.js +4 -0
  67. package/dist/components/collapsible/CollapsibleTrigger.vue.d.ts +21 -0
  68. package/dist/components/collapsible/CollapsibleTrigger.vue.js +57 -0
  69. package/dist/components/collapsible/CollapsibleTrigger.vue2.js +4 -0
  70. package/dist/components/collapsible/collapsible-core.d.ts +47 -0
  71. package/dist/components/collapsible/collapsible-core.js +40 -0
  72. package/dist/components/collapsible/index.d.ts +8 -0
  73. package/dist/components/collapsible/types.d.ts +24 -0
  74. package/dist/components/collapsible/types.js +5 -0
  75. package/dist/components/combobox/Combobox.vue.js +1 -1
  76. package/dist/components/combobox/Combobox.vue2.js +24 -16
  77. package/dist/components/command-menu/CommandMenu.vue.d.ts +5 -0
  78. package/dist/components/command-menu/CommandMenu.vue.js +1 -1
  79. package/dist/components/command-menu/CommandMenu.vue2.js +5 -2
  80. package/dist/components/compare/Compare.vue.d.ts +15 -5
  81. package/dist/components/compare/Compare.vue.js +1 -1
  82. package/dist/components/compare/Compare.vue2.js +28 -13
  83. package/dist/components/composer/ComposerInput.vue.js +1 -1
  84. package/dist/components/composer/ComposerInput.vue2.js +11 -11
  85. package/dist/components/composer/ComposerModelPicker.vue.d.ts +4 -0
  86. package/dist/components/composer/ComposerModelPicker.vue.js +1 -1
  87. package/dist/components/composer/ComposerModelPicker.vue2.js +29 -15
  88. package/dist/components/composer/ComposerSubmit.vue.d.ts +2 -0
  89. package/dist/components/composer/ComposerSubmit.vue.js +16 -15
  90. package/dist/components/confetti/ConfettiButton.vue.d.ts +9 -2
  91. package/dist/components/confetti/ConfettiButton.vue.js +24 -6
  92. package/dist/components/container-text-flip/ContainerTextFlip.vue.js +1 -1
  93. package/dist/components/container-text-flip/ContainerTextFlip.vue2.js +12 -13
  94. package/dist/components/copy-button/CopyButton.vue.d.ts +5 -0
  95. package/dist/components/copy-button/CopyButton.vue.js +1 -1
  96. package/dist/components/copy-button/CopyButton.vue2.js +72 -11
  97. package/dist/components/datamosh-transition/DatamoshTransition.vue.d.ts +6 -2
  98. package/dist/components/datamosh-transition/DatamoshTransition.vue.js +7 -4
  99. package/dist/components/date-picker/DatePicker.vue.js +1 -1
  100. package/dist/components/date-picker/DatePicker.vue2.js +27 -21
  101. package/dist/components/dialog/Dialog.vue.js +20 -1
  102. package/dist/components/dialog/DialogSurface.vue.js +1 -1
  103. package/dist/components/dialog/DialogSurface.vue2.js +5 -2
  104. package/dist/components/dialog/types.d.ts +2 -0
  105. package/dist/components/direction-aware-hover/DirectionAwareHover.vue.js +1 -1
  106. package/dist/components/direction-aware-hover/DirectionAwareHover.vue2.js +9 -7
  107. package/dist/components/displacement-text/DisplacementText.vue.d.ts +4 -1
  108. package/dist/components/displacement-text/DisplacementText.vue.js +38 -11
  109. package/dist/components/displacement-text/displacement-text-core.d.ts +94 -4
  110. package/dist/components/displacement-text/displacement-text-core.js +287 -97
  111. package/dist/components/drawer/Drawer.vue.d.ts +5 -0
  112. package/dist/components/drawer/Drawer.vue.js +1 -1
  113. package/dist/components/drawer/Drawer.vue2.js +5 -2
  114. package/dist/components/dropdown-menu/DropdownMenuContent.vue.js +2 -1
  115. package/dist/components/dropdown-menu/DropdownMenuItem.vue.d.ts +4 -0
  116. package/dist/components/dropdown-menu/DropdownMenuItem.vue.js +17 -10
  117. package/dist/components/dropdown-menu/DropdownMenuSubTrigger.vue.d.ts +8 -0
  118. package/dist/components/dropdown-menu/DropdownMenuSubTrigger.vue.js +28 -13
  119. package/dist/components/dropdown-menu/DropdownMenuTrigger.vue.d.ts +4 -0
  120. package/dist/components/dropdown-menu/DropdownMenuTrigger.vue.js +1 -1
  121. package/dist/components/dropdown-menu/DropdownMenuTrigger.vue2.js +20 -10
  122. package/dist/components/editorial-engine/EditorialEngine.vue.js +1 -1
  123. package/dist/components/editorial-engine/engine.js +13 -0
  124. package/dist/components/file-upload/FileUpload.vue.d.ts +2 -0
  125. package/dist/components/file-upload/FileUpload.vue.js +1 -1
  126. package/dist/components/file-upload/FileUpload.vue2.js +20 -10
  127. package/dist/components/fireworks-hdr/FireworksHdr.vue.js +2 -2
  128. package/dist/components/flickering-grid/FlickeringGrid.vue.d.ts +1 -1
  129. package/dist/components/flickering-grid/FlickeringGrid.vue.js +1 -1
  130. package/dist/components/flickering-grid/flickering-grid-core.d.ts +1 -1
  131. package/dist/components/flickering-grid/flickering-grid-core.js +51 -9
  132. package/dist/components/flip-card/FlipCard.vue.d.ts +3 -1
  133. package/dist/components/flip-card/FlipCard.vue.js +1 -1
  134. package/dist/components/flip-card/FlipCard.vue2.js +5 -3
  135. package/dist/components/fluid-cursor/FluidCursor.vue.js +37 -9
  136. package/dist/components/fluid-cursor/fluid-cursor-core.js +3 -3
  137. package/dist/components/fluid-cursor/webgpu-engine.js +3 -3
  138. package/dist/components/focus/Focus.vue.js +1 -1
  139. package/dist/components/focus/Focus.vue2.js +2 -2
  140. package/dist/components/follow-button/FollowButton.vue.d.ts +69 -0
  141. package/dist/components/follow-button/FollowButton.vue.js +7 -0
  142. package/dist/components/follow-button/FollowButton.vue2.js +239 -0
  143. package/dist/components/follow-button/follow-core.d.ts +83 -0
  144. package/dist/components/follow-button/follow-core.js +92 -0
  145. package/dist/components/follow-button/index.d.ts +2 -0
  146. package/dist/components/frosted-glass/FrostedGlass.vue.js +1 -1
  147. package/dist/components/glare-card/GlareCard.vue.js +1 -1
  148. package/dist/components/glare-card/GlareCard.vue2.js +4 -4
  149. package/dist/components/glowing-effect/GlowingEffect.vue.js +3 -3
  150. package/dist/components/glowing-effect/glowing-effect-core.js +4 -1
  151. package/dist/components/gradient-button/GradientButton.vue.d.ts +6 -4
  152. package/dist/components/gradient-button/GradientButton.vue.js +1 -1
  153. package/dist/components/gradient-button/GradientButton.vue2.js +13 -3
  154. package/dist/components/icon-button/IconButton.vue.d.ts +6 -4
  155. package/dist/components/icon-button/IconButton.vue.js +11 -8
  156. package/dist/components/image-trail-cursor/ImageTrailCursor.vue.js +17 -7
  157. package/dist/components/image-trail-cursor/trail-variants.js +3 -6
  158. package/dist/components/inline-citation/InlineCitation.vue.js +1 -1
  159. package/dist/components/inline-citation/InlineCitation.vue2.js +20 -14
  160. package/dist/components/input/Input.vue.js +1 -1
  161. package/dist/components/input/Input.vue2.js +18 -8
  162. package/dist/components/interactive-grid-pattern/InteractiveGridPattern.vue.js +1 -1
  163. package/dist/components/interactive-grid-pattern/InteractiveGridPattern.vue2.js +1 -1
  164. package/dist/components/interactive-hover-button/InteractiveHoverButton.vue.d.ts +6 -3
  165. package/dist/components/interactive-hover-button/InteractiveHoverButton.vue.js +1 -1
  166. package/dist/components/interactive-hover-button/InteractiveHoverButton.vue2.js +12 -2
  167. package/dist/components/letter-pullup/LetterPullup.vue.js +4 -4
  168. package/dist/components/line-hover-link/LineHoverLink.vue.js +1 -1
  169. package/dist/components/line-hover-link/LineHoverLink.vue2.js +5 -6
  170. package/dist/components/link/Link.vue.d.ts +4 -2
  171. package/dist/components/link/Link.vue.js +1 -1
  172. package/dist/components/link/Link.vue2.js +11 -8
  173. package/dist/components/mosaic-glow/MosaicGlow.vue.d.ts +6 -0
  174. package/dist/components/mosaic-glow/MosaicGlow.vue.js +53 -9
  175. package/dist/components/mosaic-glow/mosaic-glow-core.d.ts +30 -0
  176. package/dist/components/mosaic-glow/mosaic-glow-core.js +27 -0
  177. package/dist/components/mosaic-glow/mosaic-glow-hdr.d.ts +24 -0
  178. package/dist/components/mosaic-glow/mosaic-glow-hdr.js +200 -0
  179. package/dist/components/navbar/NavbarLink.vue.d.ts +4 -2
  180. package/dist/components/navbar/NavbarLink.vue.js +1 -1
  181. package/dist/components/navbar/NavbarLink.vue2.js +16 -13
  182. package/dist/components/navigation-menu/NavigationMenu.vue.js +6 -3
  183. package/dist/components/navigation-menu/NavigationMenuLink.vue.js +1 -1
  184. package/dist/components/navigation-menu/NavigationMenuLink.vue2.js +8 -8
  185. package/dist/components/navigation-menu/NavigationMenuTrigger.vue.d.ts +15 -0
  186. package/dist/components/navigation-menu/NavigationMenuTrigger.vue.js +1 -1
  187. package/dist/components/navigation-menu/NavigationMenuTrigger.vue2.js +36 -15
  188. package/dist/components/neon-border/NeonBorder.vue.js +1 -1
  189. package/dist/components/neon-border/NeonBorder.vue2.js +10 -11
  190. package/dist/components/number-input/NumberInput.vue.js +1 -1
  191. package/dist/components/number-input/NumberInput.vue2.js +22 -12
  192. package/dist/components/password-input/PasswordInput.vue.js +1 -1
  193. package/dist/components/password-input/PasswordInput.vue2.js +18 -11
  194. package/dist/components/pixel-loader/PixelLoader.vue.js +1 -1
  195. package/dist/components/pixel-loader/PixelLoader.vue2.js +6 -6
  196. package/dist/components/popover/Popover.vue.d.ts +4 -0
  197. package/dist/components/popover/Popover.vue.js +1 -1
  198. package/dist/components/popover/Popover.vue2.js +8 -6
  199. package/dist/components/popover/PopoverContent.vue.js +6 -2
  200. package/dist/components/pulse-beam/PulseBeam.vue.d.ts +6 -2
  201. package/dist/components/pulse-beam/PulseBeam.vue.js +1 -1
  202. package/dist/components/pulse-beam/PulseBeam.vue2.js +7 -4
  203. package/dist/components/radio-group/RadioGroup.vue.js +12 -11
  204. package/dist/components/radio-group/RadioGroupItem.vue.d.ts +2 -0
  205. package/dist/components/radio-group/RadioGroupItem.vue.js +1 -1
  206. package/dist/components/radio-group/RadioGroupItem.vue2.js +20 -7
  207. package/dist/components/rainbow-button/RainbowButton.vue.d.ts +11 -2
  208. package/dist/components/rainbow-button/RainbowButton.vue.js +1 -1
  209. package/dist/components/rainbow-button/RainbowButton.vue2.js +35 -18
  210. package/dist/components/ripple-button/RippleButton.vue.d.ts +6 -4
  211. package/dist/components/ripple-button/RippleButton.vue.js +1 -1
  212. package/dist/components/ripple-button/RippleButton.vue2.js +10 -5
  213. package/dist/components/search-input/SearchInput.vue.js +1 -1
  214. package/dist/components/search-input/SearchInput.vue2.js +19 -9
  215. package/dist/components/select/Select.vue.d.ts +1 -1
  216. package/dist/components/select/Select.vue.js +1 -1
  217. package/dist/components/select/Select.vue2.js +25 -17
  218. package/dist/components/sheet/Sheet.vue.d.ts +5 -0
  219. package/dist/components/sheet/Sheet.vue.js +5 -2
  220. package/dist/components/shimmer-button/ShimmerButton.vue.d.ts +2 -2
  221. package/dist/components/shimmer-button/ShimmerButton.vue.js +1 -1
  222. package/dist/components/shimmer-button/ShimmerButton.vue2.js +14 -6
  223. package/dist/components/sidebar/SidebarItem.vue.d.ts +4 -2
  224. package/dist/components/sidebar/SidebarItem.vue.js +1 -1
  225. package/dist/components/sidebar/SidebarItem.vue2.js +4 -2
  226. package/dist/components/slider/Slider.vue.d.ts +4 -0
  227. package/dist/components/slider/Slider.vue.js +1 -1
  228. package/dist/components/slider/Slider.vue2.js +20 -8
  229. package/dist/components/sources/SourcesTrigger.vue.js +1 -1
  230. package/dist/components/sources/SourcesTrigger.vue2.js +11 -11
  231. package/dist/components/sparkles/sparkles-core.d.ts +1 -1
  232. package/dist/components/sparkles/sparkles-core.js +36 -2
  233. package/dist/components/switch/Switch.vue.d.ts +2 -0
  234. package/dist/components/switch/Switch.vue.js +1 -1
  235. package/dist/components/switch/Switch.vue2.js +16 -6
  236. package/dist/components/tabs/TabsTrigger.vue.d.ts +6 -0
  237. package/dist/components/tabs/TabsTrigger.vue.js +1 -1
  238. package/dist/components/tabs/TabsTrigger.vue2.js +28 -15
  239. package/dist/components/terminal-block/TerminalBlock.vue.js +1 -1
  240. package/dist/components/terminal-block/TerminalBlock.vue2.js +10 -9
  241. package/dist/components/text-reveal-card/TextRevealCard.vue.js +1 -2
  242. package/dist/components/textarea/Textarea.vue.js +1 -1
  243. package/dist/components/textarea/Textarea.vue2.js +19 -12
  244. package/dist/components/tick-nav/TickNav.vue.d.ts +71 -0
  245. package/dist/components/tick-nav/TickNav.vue.js +7 -0
  246. package/dist/components/tick-nav/TickNav.vue2.js +285 -0
  247. package/dist/components/tick-nav/index.d.ts +3 -0
  248. package/dist/components/tick-nav/tick-nav-core.d.ts +102 -0
  249. package/dist/components/tick-nav/tick-nav-core.js +398 -0
  250. package/dist/components/tick-nav/tick-nav-hdr.d.ts +60 -0
  251. package/dist/components/tick-nav/tick-nav-hdr.js +284 -0
  252. package/dist/components/tick-nav/types.d.ts +13 -0
  253. package/dist/components/time-picker/TimePicker.vue.js +1 -1
  254. package/dist/components/time-picker/TimePicker.vue2.js +25 -17
  255. package/dist/components/toast/Toast.vue.js +1 -1
  256. package/dist/components/toast/Toast.vue2.js +16 -4
  257. package/dist/components/toast/index.d.ts +1 -1
  258. package/dist/components/toast/store.d.ts +23 -0
  259. package/dist/components/toast/store.js +35 -7
  260. package/dist/components/toggle/Toggle.vue.d.ts +12 -0
  261. package/dist/components/toggle/Toggle.vue.js +1 -1
  262. package/dist/components/toggle/Toggle.vue2.js +27 -11
  263. package/dist/components/toggle-group/ToggleGroup.vue.d.ts +11 -0
  264. package/dist/components/toggle-group/ToggleGroup.vue.js +1 -1
  265. package/dist/components/toggle-group/ToggleGroup.vue2.js +16 -3
  266. package/dist/components/toggle-group/ToggleGroupItem.vue.d.ts +6 -0
  267. package/dist/components/toggle-group/ToggleGroupItem.vue.js +1 -1
  268. package/dist/components/toggle-group/ToggleGroupItem.vue2.js +27 -14
  269. package/dist/components/tooltip/Tooltip.vue.js +13 -0
  270. package/dist/components/typing-indicator/TypingIndicator.vue.js +1 -1
  271. package/dist/components/typing-indicator/TypingIndicator.vue2.js +7 -6
  272. package/dist/index.d.ts +6 -0
  273. package/dist/index.js +440 -413
  274. package/dist/internals/anchor-position.js +3 -0
  275. package/dist/internals/call-listener.d.ts +11 -0
  276. package/dist/internals/call-listener.js +31 -0
  277. package/dist/internals/dismissable.d.ts +17 -0
  278. package/dist/internals/dismissable.js +44 -1
  279. package/dist/internals/env.d.ts +1 -0
  280. package/dist/internals/env.js +11 -0
  281. package/dist/internals/focus-trap.js +29 -4
  282. package/dist/internals/merge-ids.d.ts +6 -0
  283. package/dist/internals/merge-ids.js +11 -0
  284. package/dist/internals/motion/presence-core.d.ts +1 -1
  285. package/dist/sound/engine.js +23 -9
  286. package/dist/sound/themes.d.ts +4 -3
  287. package/dist/sound/themes.js +49 -211
  288. package/dist/sound/types.d.ts +9 -1
  289. package/dist/sound/types.js +2 -2
  290. package/dist/styles.css +974 -571
  291. package/package.json +2 -2
  292. package/tailwind.css +9 -9
@@ -0,0 +1,398 @@
1
+ const TICK_NAV_TICK_REST = 24;
2
+ const TICK_NAV_TICK_GROW = 16;
3
+ const TICK_NAV_DEFAULTS = Object.freeze({
4
+ reach: 4,
5
+ restLength: 32,
6
+ activeLength: 55,
7
+ proximityLength: 16
8
+ });
9
+ const TICK_NAV_FLAT_PATH = "M0 4L54 4";
10
+ const PLUCK_MS = 500;
11
+ const REPLUCK_MS = 120;
12
+ const RESTRIKE_MS = 60;
13
+ const PREVIEW_OFFSET = 14;
14
+ const LENGTH_SPRING = { stiffness: 250, damping: 30, mass: 1 };
15
+ const PROXIMITY_SPRING = { stiffness: 400, damping: 30, mass: 0.6 };
16
+ const PREVIEW_SPRING = { stiffness: 400, damping: 30, mass: 1 };
17
+ function spring(x) {
18
+ return { x, v: 0, target: x };
19
+ }
20
+ function stepSpring(s, config, dt, rest) {
21
+ const h = 1 / 240;
22
+ let left = dt;
23
+ while (left > 0) {
24
+ const d = Math.min(h, left);
25
+ const a = (-config.stiffness * (s.x - s.target) - config.damping * s.v) / config.mass;
26
+ s.v += a * d;
27
+ s.x += s.v * d;
28
+ left -= d;
29
+ }
30
+ if (Math.abs(s.x - s.target) < rest && Math.abs(s.v) < rest * 10) {
31
+ s.x = s.target;
32
+ s.v = 0;
33
+ return false;
34
+ }
35
+ return true;
36
+ }
37
+ function smoothstep(x) {
38
+ const t = Math.min(1, Math.max(0, x));
39
+ return t * t * (3 - 2 * t);
40
+ }
41
+ function pluckPath(p, amplitude = 1) {
42
+ const head = 54 * p;
43
+ const fade = Math.max(0, 1 - head / 54 * 0.3);
44
+ let d = "";
45
+ for (let x = 0; x <= 54; x += 1) {
46
+ const envelope = Math.max(0, 1 - Math.abs(head - x) / 20);
47
+ const y = 4 + 3.5 * amplitude * Math.sin((x - 0.5 * head) * 0.8) * envelope * fade;
48
+ d += `${x === 0 ? "M" : "L"}${x} ${y.toFixed(2)}`;
49
+ }
50
+ return d;
51
+ }
52
+ const TICK_AMPLITUDE = 0.7;
53
+ function createTickNavCore(root, list, initial = {}) {
54
+ const options = {
55
+ reach: TICK_NAV_DEFAULTS.reach,
56
+ restLength: TICK_NAV_DEFAULTS.restLength,
57
+ activeLength: TICK_NAV_DEFAULTS.activeLength,
58
+ proximityLength: TICK_NAV_DEFAULTS.proximityLength,
59
+ current: -1,
60
+ reducedMotion: false,
61
+ ...initial
62
+ };
63
+ let rows = [];
64
+ let lines = [];
65
+ let hovered = -1;
66
+ let lastY = null;
67
+ const preview = spring(0);
68
+ let frame = 0;
69
+ let lastT = 0;
70
+ let destroyed = false;
71
+ function readRows() {
72
+ const previous = rows;
73
+ const known = new Map(lines.map((line) => [line.path, line]));
74
+ lines = [];
75
+ rows = Array.from(list.querySelectorAll(":scope > .tn-item")).map((el, i) => {
76
+ const old = previous[i];
77
+ const rest = i === options.current ? options.activeLength : options.restLength;
78
+ const path = el.querySelector(".tn-path");
79
+ const line = path ? reuse(known, path, "row", i) : null;
80
+ if (line) lines.push(line);
81
+ el.querySelectorAll(".tn-tick-path").forEach((tick) => {
82
+ lines.push(reuse(known, tick, "tick", i));
83
+ });
84
+ return {
85
+ el,
86
+ line,
87
+ length: old?.length ?? spring(rest),
88
+ near: old?.near ?? spring(0),
89
+ tickNear: old?.tickNear ?? spring(0)
90
+ };
91
+ });
92
+ }
93
+ function reuse(known, path, kind, row) {
94
+ const line = known.get(path);
95
+ if (!line) return makeLine(path, kind, row);
96
+ line.kind = kind;
97
+ line.row = row;
98
+ line.beam = line.svg?.querySelector(".tn-beam") ?? null;
99
+ return line;
100
+ }
101
+ function makeLine(path, kind, row) {
102
+ const svg = path.ownerSVGElement;
103
+ return {
104
+ path,
105
+ beam: svg?.querySelector(".tn-beam") ?? null,
106
+ svg,
107
+ kind,
108
+ row,
109
+ y: 0,
110
+ rootX: 0,
111
+ rootY: 0,
112
+ progress: null,
113
+ pluckStart: null,
114
+ lastPluck: -Infinity
115
+ };
116
+ }
117
+ function setShape(line, d, progress) {
118
+ line.progress = progress;
119
+ line.path.setAttribute("d", d);
120
+ line.beam?.setAttribute("d", d);
121
+ if (!line.svg) return;
122
+ if (progress === null) {
123
+ line.svg.removeAttribute("data-plucking");
124
+ line.svg.style.removeProperty("--tn-p");
125
+ } else {
126
+ line.svg.setAttribute("data-plucking", "");
127
+ line.svg.style.setProperty("--tn-p", progress.toFixed(4));
128
+ }
129
+ }
130
+ function measureLines() {
131
+ const top = list.getBoundingClientRect().top;
132
+ const rootBox = root.getBoundingClientRect();
133
+ for (const line of lines) {
134
+ const box = line.path.getBoundingClientRect();
135
+ const centre = box.top + box.height / 2;
136
+ line.y = centre - top;
137
+ line.rootX = (line.svg ?? line.path).getBoundingClientRect().left - rootBox.left;
138
+ line.rootY = centre - rootBox.top;
139
+ }
140
+ }
141
+ function retarget() {
142
+ const reach = Math.max(0.5, options.reach);
143
+ rows.forEach((row, i) => {
144
+ row.length.target = i === hovered || i === options.current ? options.activeLength : options.restLength;
145
+ const off = hovered < 0 || options.reducedMotion;
146
+ row.near.target = off ? 0 : smoothstep(1 - Math.abs(i - hovered) / reach);
147
+ row.tickNear.target = off ? 0 : smoothstep(1 - Math.abs(i + 0.5 - hovered) / reach);
148
+ });
149
+ preview.target = hovered >= 0 ? 1 : 0;
150
+ if (hovered < 0) {
151
+ preview.x = 0;
152
+ preview.v = 0;
153
+ }
154
+ }
155
+ function paint() {
156
+ for (const row of rows) {
157
+ const width = row.length.x + options.proximityLength * row.near.x;
158
+ row.el.style.setProperty("--tn-len", `${width.toFixed(2)}px`);
159
+ row.el.style.setProperty("--tn-near", row.near.x.toFixed(4));
160
+ row.el.style.setProperty("--tn-tick-near", row.tickNear.x.toFixed(4));
161
+ }
162
+ root.style.setProperty("--tn-po", preview.x.toFixed(4));
163
+ if (options.onFrame) {
164
+ try {
165
+ options.onFrame(frameState());
166
+ } catch (error) {
167
+ options.onFrame = void 0;
168
+ console.warn("[TickNav] light layer disabled:", error);
169
+ }
170
+ }
171
+ }
172
+ function frameState() {
173
+ return lines.map((line) => {
174
+ const row = rows[line.row];
175
+ const near = line.kind === "row" ? row?.near.x ?? 0 : row?.tickNear.x ?? 0;
176
+ const length = line.kind === "row" ? (row?.length.x ?? 0) + options.proximityLength * near : TICK_NAV_TICK_REST + TICK_NAV_TICK_GROW * near;
177
+ return {
178
+ kind: line.kind,
179
+ row: line.row,
180
+ x: line.rootX,
181
+ y: line.rootY,
182
+ length,
183
+ near,
184
+ progress: line.progress,
185
+ current: line.kind === "row" && line.row === options.current
186
+ };
187
+ });
188
+ }
189
+ function snapAll() {
190
+ for (const row of rows) {
191
+ for (const s of [row.length, row.near, row.tickNear]) {
192
+ s.x = s.target;
193
+ s.v = 0;
194
+ }
195
+ }
196
+ preview.x = preview.target;
197
+ preview.v = 0;
198
+ }
199
+ function step() {
200
+ frame = 0;
201
+ if (destroyed) return;
202
+ const t = performance.now();
203
+ const dt = lastT ? Math.min(1 / 30, (t - lastT) / 1e3) : 1 / 60;
204
+ lastT = t;
205
+ let moving = false;
206
+ for (const row of rows) {
207
+ if (stepSpring(row.length, LENGTH_SPRING, dt, 0.05)) moving = true;
208
+ if (stepSpring(row.near, PROXIMITY_SPRING, dt, 1e-3)) moving = true;
209
+ if (stepSpring(row.tickNear, PROXIMITY_SPRING, dt, 1e-3)) moving = true;
210
+ }
211
+ for (const line of lines) {
212
+ if (line.pluckStart === null) continue;
213
+ const p = Math.min((t - line.pluckStart) / PLUCK_MS, 1);
214
+ if (p < 1) {
215
+ const amplitude = line.kind === "tick" ? TICK_AMPLITUDE : 1;
216
+ const eased = 1 - Math.pow(1 - p, 3);
217
+ setShape(line, pluckPath(eased, amplitude), eased);
218
+ moving = true;
219
+ } else {
220
+ setShape(line, TICK_NAV_FLAT_PATH, null);
221
+ line.pluckStart = null;
222
+ }
223
+ }
224
+ if (stepSpring(preview, PREVIEW_SPRING, dt, 1e-3)) moving = true;
225
+ paint();
226
+ if (moving) frame = requestAnimationFrame(step);
227
+ else lastT = 0;
228
+ }
229
+ function kick() {
230
+ if (options.reducedMotion) {
231
+ snapAll();
232
+ paint();
233
+ return;
234
+ }
235
+ if (!frame) frame = requestAnimationFrame(step);
236
+ }
237
+ function stopPluck(line) {
238
+ line.pluckStart = null;
239
+ setShape(line, TICK_NAV_FLAT_PATH, null);
240
+ }
241
+ function pluck(line, pointer, now) {
242
+ line.lastPluck = now;
243
+ if (!options.reducedMotion) {
244
+ line.pluckStart = now;
245
+ kick();
246
+ }
247
+ if (pointer && !isDisabled(line.row)) options.onPluck?.(line.kind, line.row);
248
+ }
249
+ function setHovered(index, pointer, pluckRow = !pointer) {
250
+ if (index === hovered) return;
251
+ hovered = index;
252
+ const line = rows[index]?.line;
253
+ const now = performance.now();
254
+ if (line && pluckRow && now - line.lastPluck > REPLUCK_MS) pluck(line, pointer, now);
255
+ retarget();
256
+ kick();
257
+ options.onActiveChange?.(index, pointer);
258
+ }
259
+ function rowIndexOf(target) {
260
+ const el = target instanceof Element ? target.closest(".tn-item") : null;
261
+ return el ? rows.findIndex((r) => r.el === el) : -1;
262
+ }
263
+ function isDisabled(index) {
264
+ return rows[index]?.el.hasAttribute("data-disabled") ?? false;
265
+ }
266
+ function focusedIndex() {
267
+ const el = list.ownerDocument.activeElement;
268
+ if (!el || !list.contains(el) || !el.matches(":focus-visible")) return -1;
269
+ const index = rowIndexOf(el);
270
+ return isDisabled(index) ? -1 : index;
271
+ }
272
+ function anchorTo(index) {
273
+ const row = rows[index];
274
+ if (!row) return;
275
+ const box = root.getBoundingClientRect();
276
+ const rowBox = row.el.getBoundingClientRect();
277
+ root.style.setProperty("--tn-px", `${(rowBox.right - box.left + PREVIEW_OFFSET).toFixed(1)}px`);
278
+ root.style.setProperty("--tn-py", `${(rowBox.top - box.top + PREVIEW_OFFSET).toFixed(1)}px`);
279
+ }
280
+ function releasePointer() {
281
+ const focused = focusedIndex();
282
+ if (focused >= 0) anchorTo(focused);
283
+ setHovered(focused, false, false);
284
+ }
285
+ function onPointerOver(event) {
286
+ if (event.pointerType === "touch") return;
287
+ const link = event.target instanceof Element ? event.target.closest(".tn-link") : null;
288
+ if (!link) return;
289
+ const index = rowIndexOf(link);
290
+ if (index < 0) return;
291
+ if (isDisabled(index)) {
292
+ if (hovered >= 0) releasePointer();
293
+ return;
294
+ }
295
+ setHovered(index, true, lastY === null);
296
+ }
297
+ function strum(event) {
298
+ const y = event.clientY - list.getBoundingClientRect().top;
299
+ if (lastY === null) {
300
+ measureLines();
301
+ lastY = y;
302
+ return;
303
+ }
304
+ const from = lastY;
305
+ lastY = y;
306
+ if (from === y) return;
307
+ const down = y > from;
308
+ const lo = Math.min(from, y);
309
+ const hi = Math.max(from, y);
310
+ const crossed = lines.filter((line) => line.y > lo && line.y <= hi);
311
+ crossed.sort((a, b) => down ? a.y - b.y : b.y - a.y);
312
+ const now = performance.now();
313
+ for (const line of crossed) {
314
+ if (now - line.lastPluck < RESTRIKE_MS) continue;
315
+ pluck(line, true, now);
316
+ }
317
+ }
318
+ function onPointerMove(event) {
319
+ if (event.pointerType === "touch") return;
320
+ if (list.contains(event.target)) strum(event);
321
+ const box = root.getBoundingClientRect();
322
+ root.style.setProperty(
323
+ "--tn-px",
324
+ `${(event.clientX - box.left + PREVIEW_OFFSET).toFixed(1)}px`
325
+ );
326
+ root.style.setProperty("--tn-py", `${(event.clientY - box.top + PREVIEW_OFFSET).toFixed(1)}px`);
327
+ }
328
+ function onPointerLeave(event) {
329
+ if (event.pointerType === "touch") return;
330
+ lastY = null;
331
+ releasePointer();
332
+ }
333
+ function onFocusIn(event) {
334
+ const el = event.target;
335
+ if (!el || !el.matches?.(":focus-visible")) return;
336
+ const index = rowIndexOf(el);
337
+ if (!rows[index]) return;
338
+ anchorTo(index);
339
+ setHovered(index, false);
340
+ }
341
+ function onFocusOut(event) {
342
+ const next = event.relatedTarget;
343
+ if (next && list.contains(next)) return;
344
+ setHovered(-1, false);
345
+ }
346
+ readRows();
347
+ measureLines();
348
+ retarget();
349
+ snapAll();
350
+ paint();
351
+ list.addEventListener("pointerover", onPointerOver);
352
+ root.addEventListener("pointermove", onPointerMove);
353
+ list.addEventListener("pointerleave", onPointerLeave);
354
+ list.addEventListener("focusin", onFocusIn);
355
+ list.addEventListener("focusout", onFocusOut);
356
+ return {
357
+ update(next) {
358
+ const reducedBefore = options.reducedMotion;
359
+ Object.assign(options, next);
360
+ if (options.reducedMotion && !reducedBefore) {
361
+ for (const line of lines) stopPluck(line);
362
+ }
363
+ retarget();
364
+ kick();
365
+ },
366
+ refresh() {
367
+ readRows();
368
+ measureLines();
369
+ lastY = null;
370
+ if (hovered >= rows.length) hovered = -1;
371
+ retarget();
372
+ kick();
373
+ paint();
374
+ },
375
+ measure() {
376
+ measureLines();
377
+ if (options.onFrame) paint();
378
+ },
379
+ destroy() {
380
+ destroyed = true;
381
+ if (frame) cancelAnimationFrame(frame);
382
+ frame = 0;
383
+ list.removeEventListener("pointerover", onPointerOver);
384
+ root.removeEventListener("pointermove", onPointerMove);
385
+ list.removeEventListener("pointerleave", onPointerLeave);
386
+ list.removeEventListener("focusin", onFocusIn);
387
+ list.removeEventListener("focusout", onFocusOut);
388
+ }
389
+ };
390
+ }
391
+ export {
392
+ TICK_NAV_DEFAULTS,
393
+ TICK_NAV_FLAT_PATH,
394
+ TICK_NAV_TICK_GROW,
395
+ TICK_NAV_TICK_REST,
396
+ createTickNavCore,
397
+ pluckPath
398
+ };
@@ -0,0 +1,60 @@
1
+ /**
2
+ * TickNav HDR light — framework-free, byte-identical in the Svelte, React and
3
+ * Vue trees (see shared-cores.json).
4
+ *
5
+ * CSS and SVG colours are clamped to SDR white, so a DOM glow can never be
6
+ * brighter than the page's white. This module draws the neon's light into a
7
+ * WebGPU canvas configured with `rgba16float` + `toneMapping: { mode:
8
+ * "extended" }`: on an HDR display, values above 1.0 render brighter than SDR
9
+ * white. 1.0 is the SDR reference white (~203 nits in BT.2408 terms), so the
10
+ * beam's peak of ~4.9 lands around 1000 nits on a display with the headroom.
11
+ *
12
+ * It only starts when the browser keeps extended tone mapping AND the display
13
+ * reports `(dynamic-range: high)`; otherwise `startTickNavHdr` resolves to
14
+ * null and the CSS glow carries the effect alone. No browser global is touched
15
+ * at import time.
16
+ */
17
+ import type { TickNavLineState } from "./tick-nav-core.js";
18
+ /** One glowing segment, in CSS px relative to the canvas's top-left corner. */
19
+ export interface TickNavLight {
20
+ x0: number;
21
+ x1: number;
22
+ y: number;
23
+ /** Tube radius, px (Gaussian core). */
24
+ radius: number;
25
+ /** Halo falloff, px (exponential skirt). */
26
+ halo: number;
27
+ /** Linear-light multiplier on the accent: 1 = SDR white level. */
28
+ intensity: number;
29
+ /** Mix toward white for the hot core of the light, 0..1. */
30
+ white: number;
31
+ }
32
+ export interface TickNavHdr {
33
+ /** Replaces everything drawn with these lights. */
34
+ render(lights: TickNavLight[]): void;
35
+ /** Canvas size in CSS px (the backing store follows devicePixelRatio). */
36
+ resize(width: number, height: number): void;
37
+ /** Accent colour as 8-bit sRGB. */
38
+ setAccent(rgb: [number, number, number]): void;
39
+ destroy(): void;
40
+ }
41
+ /** SDR white ≈ 203 nits; 1000 nits / 203 ≈ 4.9. */
42
+ export declare const TICK_NAV_HDR_PEAK = 4.9;
43
+ export declare function startTickNavHdr(canvas: HTMLCanvasElement): Promise<TickNavHdr | null>;
44
+ /** Margin, px, the HDR canvas extends past the nav on every side for the halo. */
45
+ export declare const TICK_NAV_HDR_PAD = 24;
46
+ /**
47
+ * Turns the core's per-line state into lights: a tube along every lit line
48
+ * (proximity, or the current row) and a hot spark on every running pluck's
49
+ * wave head, peaking at {@link TICK_NAV_HDR_PEAK}.
50
+ */
51
+ export declare function tickNavLights(lines: TickNavLineState[]): TickNavLight[];
52
+ /**
53
+ * Calls `onChange` with `el`'s computed `color` now, then again whenever it
54
+ * may have changed with the page's theme: a `class`, `style` or `data-theme`
55
+ * change on `<html>` or `<body>`, or a flip of the colour-scheme preference.
56
+ * Unchanged values are not reported. Returns a function that stops watching.
57
+ */
58
+ export declare function watchTickNavAccent(el: Element, onChange: (css: string) => void): () => void;
59
+ /** Resolves any CSS colour the browser understands to 8-bit sRGB. */
60
+ export declare function resolveCssColor(css: string): [number, number, number] | null;