@zyncat/ui 0.19.0 → 0.21.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 (355) hide show
  1. package/dist/alert.css +1 -2
  2. package/dist/alert.js +6 -6
  3. package/dist/avatar.css +1 -1
  4. package/dist/badge.css +21 -12
  5. package/dist/badge.js +100 -2
  6. package/dist/badge.js.map +1 -1
  7. package/dist/{bloom-HV23M4AW.js → bloom-5MZXLNKG.js} +23 -5
  8. package/dist/bloom-5MZXLNKG.js.map +1 -0
  9. package/dist/button.css +1 -2
  10. package/dist/button.js +2 -2
  11. package/dist/checkbox.css +1 -1
  12. package/dist/{chunk-JINATP4N.js → chunk-2W7FOMWE.js} +7 -8
  13. package/dist/chunk-2W7FOMWE.js.map +1 -0
  14. package/dist/{chunk-LNAV5E7S.js → chunk-3HE7N3UK.js} +7 -3
  15. package/dist/chunk-3HE7N3UK.js.map +1 -0
  16. package/dist/{chunk-UKPX3RIP.js → chunk-47OMFFIB.js} +3 -3
  17. package/dist/{chunk-UKPX3RIP.js.map → chunk-47OMFFIB.js.map} +1 -1
  18. package/dist/chunk-4M5FMCFJ.js +16 -0
  19. package/dist/chunk-4M5FMCFJ.js.map +1 -0
  20. package/dist/chunk-6BY5G7BI.js +122 -0
  21. package/dist/chunk-6BY5G7BI.js.map +1 -0
  22. package/dist/{chunk-RLNCRDAL.js → chunk-AOEO2LCZ.js} +4 -4
  23. package/dist/{chunk-RLNCRDAL.js.map → chunk-AOEO2LCZ.js.map} +1 -1
  24. package/dist/{chunk-BRKGYLEQ.js → chunk-AQMR7ZYO.js} +8 -3
  25. package/dist/chunk-AQMR7ZYO.js.map +1 -0
  26. package/dist/{chunk-N43NDSME.js → chunk-AXZBD7LY.js} +6 -3
  27. package/dist/chunk-AXZBD7LY.js.map +1 -0
  28. package/dist/{chunk-V6QAAOA5.js → chunk-BWGK3OD6.js} +9 -6
  29. package/dist/chunk-BWGK3OD6.js.map +1 -0
  30. package/dist/{chunk-VQFILXQN.js → chunk-CYZKPUCG.js} +70 -8
  31. package/dist/chunk-CYZKPUCG.js.map +1 -0
  32. package/dist/{chunk-AIAPXRCI.js → chunk-DEZIQTBW.js} +176 -103
  33. package/dist/chunk-DEZIQTBW.js.map +1 -0
  34. package/dist/{tide-DJZMDAFT.js → chunk-DVLKB3CZ.js} +15 -12
  35. package/dist/chunk-DVLKB3CZ.js.map +1 -0
  36. package/dist/{chunk-F64Z42PJ.js → chunk-GM7IPTTT.js} +5 -6
  37. package/dist/chunk-GM7IPTTT.js.map +1 -0
  38. package/dist/chunk-ITW5UCVU.js +24 -0
  39. package/dist/chunk-ITW5UCVU.js.map +1 -0
  40. package/dist/{chunk-TDHLZY6I.js → chunk-JQZ3FTHP.js} +77 -18
  41. package/dist/chunk-JQZ3FTHP.js.map +1 -0
  42. package/dist/{chunk-PXQBJMPJ.js → chunk-LC6NQQER.js} +3 -3
  43. package/dist/{chunk-PXQBJMPJ.js.map → chunk-LC6NQQER.js.map} +1 -1
  44. package/dist/{chunk-M2KGLH2G.js → chunk-LV442ZOR.js} +10 -10
  45. package/dist/{chunk-M2KGLH2G.js.map → chunk-LV442ZOR.js.map} +1 -1
  46. package/dist/{chunk-F2TB3TT6.js → chunk-PNFFK5HY.js} +4 -4
  47. package/dist/{chunk-F2TB3TT6.js.map → chunk-PNFFK5HY.js.map} +1 -1
  48. package/dist/{chunk-2YGHPQ66.js → chunk-Q5N24VII.js} +2 -2
  49. package/dist/{chunk-2YGHPQ66.js.map → chunk-Q5N24VII.js.map} +1 -1
  50. package/dist/{chunk-XKDR22VE.js → chunk-SPFHWHJ6.js} +8 -4
  51. package/dist/chunk-SPFHWHJ6.js.map +1 -0
  52. package/dist/{chunk-TRPAKUIB.js → chunk-TBIY5YR5.js} +8 -8
  53. package/dist/{chunk-TRPAKUIB.js.map → chunk-TBIY5YR5.js.map} +1 -1
  54. package/dist/chunk-TXJQUN7C.js +108 -0
  55. package/dist/chunk-TXJQUN7C.js.map +1 -0
  56. package/dist/{chunk-VZXML7EH.js → chunk-V4ZN5RD4.js} +12 -3
  57. package/dist/chunk-V4ZN5RD4.js.map +1 -0
  58. package/dist/{chunk-VJXP256V.js → chunk-ZSP4ZTII.js} +7 -7
  59. package/dist/{chunk-VJXP256V.js.map → chunk-ZSP4ZTII.js.map} +1 -1
  60. package/dist/collapse.css +1 -1
  61. package/dist/confetti.css +1 -1
  62. package/dist/confetti.js +1 -1
  63. package/dist/crossfade-XFZLFLT7.js +91 -0
  64. package/dist/crossfade-XFZLFLT7.js.map +1 -0
  65. package/dist/date-field.js +20 -18
  66. package/dist/date-field.js.map +1 -1
  67. package/dist/date-picker.css +7 -8
  68. package/dist/date-range-field.js +22 -20
  69. package/dist/date-range-field.js.map +1 -1
  70. package/dist/datetime-field.js +21 -19
  71. package/dist/datetime-field.js.map +1 -1
  72. package/dist/dialog.css +1 -2
  73. package/dist/dialog.js +9 -9
  74. package/dist/digit-strip.css +1 -1
  75. package/dist/dropdown.css +13 -10
  76. package/dist/dropdown.js +37 -20
  77. package/dist/dropdown.js.map +1 -1
  78. package/dist/emoji-picker.js +14 -14
  79. package/dist/facebook-feed.css +1 -1
  80. package/dist/flow-field.css +1 -1
  81. package/dist/flow-field.js +1 -1
  82. package/dist/glide.js +2 -2
  83. package/dist/icon.css +1 -1
  84. package/dist/input.css +1 -4
  85. package/dist/instagram-feed.css +1 -1
  86. package/dist/instagram-feed.js +2 -2
  87. package/dist/lens.css +1 -1
  88. package/dist/lens.js +1 -1
  89. package/dist/menu-surface.css +82 -8
  90. package/dist/modal.css +1 -1
  91. package/dist/modal.js +8 -8
  92. package/dist/morphing-text.css +1 -1
  93. package/dist/morphing-text.js +1 -1
  94. package/dist/motion-devtools.css +1 -1
  95. package/dist/motion-devtools.js +3 -3
  96. package/dist/motion.js +9 -0
  97. package/dist/motion.js.map +1 -0
  98. package/dist/multi-select.js +34 -16
  99. package/dist/multi-select.js.map +1 -1
  100. package/dist/number-field.js +2 -2
  101. package/dist/odometer.css +17 -11
  102. package/dist/odometer.js +105 -72
  103. package/dist/odometer.js.map +1 -1
  104. package/dist/otp-field.js +17 -9
  105. package/dist/otp-field.js.map +1 -1
  106. package/dist/overlay.css +1 -1
  107. package/dist/pagination.css +1 -1
  108. package/dist/pagination.js +4 -4
  109. package/dist/{paint-CJQCM6ZO.js → paint-NLTI6TEF.js} +5 -3
  110. package/dist/paint-NLTI6TEF.js.map +1 -0
  111. package/dist/popover.css +1 -1
  112. package/dist/popover.js +9 -9
  113. package/dist/radio-group.css +11 -5
  114. package/dist/radio-group.js +5 -5
  115. package/dist/select.css +34 -8
  116. package/dist/select.js +25 -12
  117. package/dist/select.js.map +1 -1
  118. package/dist/sheet.css +1 -1
  119. package/dist/sheet.js +9 -9
  120. package/dist/spinner.css +1 -1
  121. package/dist/styles.css +1 -1
  122. package/dist/support-rail.css +7 -2
  123. package/dist/support-rail.js +11 -11
  124. package/dist/table.css +10 -5
  125. package/dist/table.js +7 -7
  126. package/dist/tabs.css +32 -7
  127. package/dist/tabs.js +55 -44
  128. package/dist/tabs.js.map +1 -1
  129. package/dist/tag.css +1 -1
  130. package/dist/tag.js +4 -4
  131. package/dist/textarea.css +14 -2
  132. package/dist/textarea.js +36 -23
  133. package/dist/textarea.js.map +1 -1
  134. package/dist/theme-grid.js +5 -5
  135. package/dist/theme-switcher.css +1 -2
  136. package/dist/theme-switcher.js +14 -14
  137. package/dist/{theme-transition-VGLPZDJI.js → theme-transition-FDF2REFD.js} +27 -7
  138. package/dist/theme-transition-FDF2REFD.js.map +1 -0
  139. package/dist/theme-transition.css +50 -1
  140. package/dist/theme.js +2 -2
  141. package/dist/theme.js.map +1 -1
  142. package/dist/tide-AGGMQEJV.js +4 -0
  143. package/dist/tide-AGGMQEJV.js.map +1 -0
  144. package/dist/tiktok.css +1 -1
  145. package/dist/tiktok.js +2 -2
  146. package/dist/time-field.js +5 -3
  147. package/dist/time-field.js.map +1 -1
  148. package/dist/toast.css +1 -1
  149. package/dist/toast.js +7 -7
  150. package/dist/toggle-tag.js +2 -2
  151. package/dist/toggle.css +1 -1
  152. package/dist/toggle.js +4 -15
  153. package/dist/toggle.js.map +1 -1
  154. package/dist/tooltip.css +1 -1
  155. package/dist/tooltip.js +6 -7
  156. package/dist/tooltip.js.map +1 -1
  157. package/dist/trigger.css +1 -2
  158. package/dist/types/components/composites/date-picker/DateField.d.ts +1 -1
  159. package/dist/types/components/composites/date-picker/DateRangeField.d.ts +1 -1
  160. package/dist/types/components/composites/date-picker/DateTimeField.d.ts +1 -1
  161. package/dist/types/components/composites/date-picker/TimeField.d.ts +1 -1
  162. package/dist/types/components/composites/date-picker/field-shell.d.ts +5 -1
  163. package/dist/types/components/composites/dropdown/Dropdown.d.ts +13 -2
  164. package/dist/types/components/composites/dropdown/types.d.ts +5 -2
  165. package/dist/types/components/composites/select/MultiSelect.d.ts +23 -3
  166. package/dist/types/components/composites/select/Select.d.ts +20 -4
  167. package/dist/types/components/composites/select/core/index.d.ts +2 -1
  168. package/dist/types/components/composites/select/core/menu.d.ts +8 -5
  169. package/dist/types/components/composites/select/core/panel.d.ts +6 -4
  170. package/dist/types/components/composites/select/core/trigger.d.ts +7 -2
  171. package/dist/types/components/composites/select/core/types.d.ts +9 -0
  172. package/dist/types/components/composites/select/core/use-listbox.d.ts +5 -3
  173. package/dist/types/components/composites/tabs/Tabs.d.ts +6 -1
  174. package/dist/types/components/expressive/odometer/Odometer.d.ts +1 -1
  175. package/dist/types/components/expressive/odometer/roll.d.ts +20 -0
  176. package/dist/types/components/expressive/theme-transition/scene.d.ts +3 -0
  177. package/dist/types/components/internal/menu/highlight.d.ts +9 -1
  178. package/dist/types/components/internal/menu/menu-row.d.ts +4 -0
  179. package/dist/types/components/internal/menu/use-anchor-width.d.ts +2 -0
  180. package/dist/types/components/internal/overlay/layer.d.ts +5 -8
  181. package/dist/types/components/internal/overlay/track-anchor.d.ts +5 -0
  182. package/dist/types/components/internal/utils/activation.d.ts +1 -0
  183. package/dist/types/components/primitives/badge/Badge.d.ts +17 -8
  184. package/dist/types/components/primitives/badge/morph-label.d.ts +3 -0
  185. package/dist/types/components/primitives/badge/use-glint-on-change.d.ts +2 -0
  186. package/dist/types/components/primitives/input/OtpField.d.ts +2 -2
  187. package/dist/types/components/primitives/textarea/Textarea.d.ts +2 -2
  188. package/dist/types/components/primitives/textarea/char-meter.d.ts +6 -0
  189. package/dist/types/components/primitives/toggle/switch-glyph.d.ts +6 -0
  190. package/dist/types/motion/crossfade.d.ts +3 -0
  191. package/dist/types/motion/element.d.ts +6 -3
  192. package/dist/types/motion/flip.d.ts +8 -2
  193. package/dist/types/motion/motion.d.ts +7 -0
  194. package/dist/types/theme-scope.d.ts +5 -0
  195. package/dist/types/tokens/component-styles.generated.d.ts +0 -2
  196. package/dist/types/tokens/theme-tokens.generated.d.ts +38 -32
  197. package/dist/typing-lines.css +1 -1
  198. package/dist/typing-lines.js +1 -1
  199. package/dist/weight-field.css +1 -1
  200. package/dist/youtube.css +1 -1
  201. package/dist/youtube.js +2 -2
  202. package/package.json +6 -11
  203. package/skills/zyncat-ui/SKILL.md +2 -2
  204. package/skills/zyncat-ui/references/components.md +3 -4
  205. package/skills/zyncat-ui/references/theming.md +3 -3
  206. package/src/components/composites/alert/alert.css +1 -2
  207. package/src/components/composites/date-picker/DateField.tsx +2 -0
  208. package/src/components/composites/date-picker/DateRangeField.tsx +2 -0
  209. package/src/components/composites/date-picker/DateTimeField.tsx +2 -0
  210. package/src/components/composites/date-picker/TimeField.tsx +2 -0
  211. package/src/components/composites/date-picker/date-picker.css +7 -8
  212. package/src/components/composites/date-picker/field-shell.tsx +14 -1
  213. package/src/components/composites/dialog/dialog.css +1 -2
  214. package/src/components/composites/dropdown/Dropdown.tsx +20 -3
  215. package/src/components/composites/dropdown/Dropdown.usage.md +2 -0
  216. package/src/components/composites/dropdown/dropdown.css +13 -10
  217. package/src/components/composites/dropdown/menu-panel.tsx +28 -13
  218. package/src/components/composites/dropdown/types.ts +5 -2
  219. package/src/components/composites/emoji-picker/styles.css +1 -1
  220. package/src/components/composites/modal/modal.css +1 -1
  221. package/src/components/composites/pagination/pagination.css +1 -1
  222. package/src/components/composites/popover/popover.css +1 -1
  223. package/src/components/composites/select/MultiSelect.tsx +56 -5
  224. package/src/components/composites/select/MultiSelect.usage.md +10 -0
  225. package/src/components/composites/select/Select.tsx +32 -2
  226. package/src/components/composites/select/Select.usage.md +13 -1
  227. package/src/components/composites/select/core/index.ts +2 -1
  228. package/src/components/composites/select/core/menu.tsx +28 -15
  229. package/src/components/composites/select/core/panel.tsx +57 -52
  230. package/src/components/composites/select/core/trigger.tsx +44 -11
  231. package/src/components/composites/select/core/types.ts +10 -0
  232. package/src/components/composites/select/core/use-listbox.ts +77 -31
  233. package/src/components/composites/select/select.css +34 -8
  234. package/src/components/composites/sheet/sheet.css +1 -1
  235. package/src/components/composites/table/table.css +10 -5
  236. package/src/components/composites/tabs/Tabs.tsx +13 -1
  237. package/src/components/composites/tabs/tabs.css +32 -7
  238. package/src/components/composites/theme-switcher/theme-switcher.css +1 -2
  239. package/src/components/composites/toast/toast.css +1 -1
  240. package/src/components/composites/tooltip/tooltip-host.tsx +1 -1
  241. package/src/components/composites/tooltip/tooltip.css +1 -1
  242. package/src/components/compound/support-rail/support-rail.css +7 -2
  243. package/src/components/dev/motion-devtools.css +1 -1
  244. package/src/components/expressive/confetti/confetti.css +1 -1
  245. package/src/components/expressive/facebook-feed/facebook-feed.css +1 -1
  246. package/src/components/expressive/flow-field/flow-field.css +1 -1
  247. package/src/components/expressive/instagram-feed/instagram-feed.css +1 -1
  248. package/src/components/expressive/lens/lens.css +1 -1
  249. package/src/components/expressive/morphing-text/morphing-text.css +1 -1
  250. package/src/components/expressive/odometer/Odometer.tsx +45 -92
  251. package/src/components/expressive/odometer/Odometer.usage.md +2 -2
  252. package/src/components/expressive/odometer/odometer.css +17 -11
  253. package/src/components/expressive/odometer/roll.ts +94 -0
  254. package/src/components/expressive/theme-transition/bloom.ts +22 -2
  255. package/src/components/expressive/theme-transition/paint.ts +2 -0
  256. package/src/components/expressive/theme-transition/scene.ts +3 -0
  257. package/src/components/expressive/theme-transition/theme-transition.css +50 -1
  258. package/src/components/expressive/theme-transition/theme-transition.ts +21 -1
  259. package/src/components/expressive/theme-transition/tide.ts +15 -10
  260. package/src/components/expressive/tiktok/tiktok.css +1 -1
  261. package/src/components/expressive/typing-lines/typing-lines.css +1 -1
  262. package/src/components/expressive/weight-field/weight-field.css +1 -1
  263. package/src/components/expressive/youtube/youtube.css +1 -1
  264. package/src/components/internal/glass/glass.css +1 -1
  265. package/src/components/internal/icon/icon.css +1 -1
  266. package/src/components/internal/menu/highlight.ts +20 -2
  267. package/src/components/internal/menu/menu-row.tsx +36 -8
  268. package/src/components/internal/menu/menu-surface.css +82 -8
  269. package/src/components/internal/menu/use-anchor-width.ts +26 -0
  270. package/src/components/internal/overlay/layer.tsx +11 -23
  271. package/src/components/internal/overlay/overlay.css +1 -1
  272. package/src/components/internal/overlay/position.ts +17 -6
  273. package/src/components/internal/overlay/track-anchor.ts +69 -0
  274. package/src/components/internal/overlay/trigger.css +1 -2
  275. package/src/components/internal/utils/activation.ts +5 -0
  276. package/src/components/primitives/avatar/avatar.css +1 -1
  277. package/src/components/primitives/badge/Badge.tsx +38 -15
  278. package/src/components/primitives/badge/Badge.usage.md +12 -5
  279. package/src/components/primitives/badge/badge.css +21 -12
  280. package/src/components/primitives/badge/digit-strip.css +1 -1
  281. package/src/components/primitives/badge/morph-label.tsx +71 -0
  282. package/src/components/primitives/badge/use-glint-on-change.ts +16 -0
  283. package/src/components/primitives/button/button.css +1 -2
  284. package/src/components/primitives/checkbox/checkbox.css +1 -1
  285. package/src/components/primitives/collapse/collapse.css +1 -1
  286. package/src/components/primitives/input/OtpField.tsx +17 -9
  287. package/src/components/primitives/input/input.css +1 -4
  288. package/src/components/primitives/radio-group/radio-group.css +11 -5
  289. package/src/components/primitives/spinner/spinner.css +1 -1
  290. package/src/components/primitives/tag/tag.css +1 -1
  291. package/src/components/primitives/textarea/Textarea.tsx +20 -24
  292. package/src/components/primitives/textarea/char-meter.tsx +34 -0
  293. package/src/components/primitives/textarea/textarea.css +14 -2
  294. package/src/components/primitives/toggle/Toggle.tsx +3 -12
  295. package/src/components/primitives/toggle/switch-glyph.tsx +25 -0
  296. package/src/components/primitives/toggle/toggle.css +1 -1
  297. package/src/engine/flip.ts +5 -1
  298. package/src/motion/crossfade.ts +97 -0
  299. package/src/motion/element.tsx +10 -7
  300. package/src/motion/flip.ts +62 -23
  301. package/src/motion/glide.tsx +5 -0
  302. package/src/motion/motion.ts +7 -0
  303. package/src/motion/motion.usage.md +34 -0
  304. package/src/motion/presence.tsx +4 -0
  305. package/src/motion/use-motion.ts +8 -3
  306. package/src/styles.css +1 -1
  307. package/src/theme-scope.ts +19 -0
  308. package/src/tokens/base.css +62 -13
  309. package/src/tokens/color.css +18 -16
  310. package/src/tokens/component-styles.generated.ts +0 -2
  311. package/src/tokens/dark.css +4 -1
  312. package/src/tokens/decisions.css +6 -4
  313. package/src/tokens/elevation.css +1 -1
  314. package/src/tokens/glass.css +1 -1
  315. package/src/tokens/motion.css +4 -4
  316. package/src/tokens/radius.css +1 -1
  317. package/src/tokens/reset.css +17 -45
  318. package/src/tokens/semantic.css +13 -7
  319. package/src/tokens/spacing.css +4 -4
  320. package/src/tokens/theme-tokens.generated.ts +38 -32
  321. package/src/tokens/typography.css +1 -1
  322. package/tailwind.css +3 -1
  323. package/dist/bloom-HV23M4AW.js.map +0 -1
  324. package/dist/chunk-2DNKZ57E.js +0 -72
  325. package/dist/chunk-2DNKZ57E.js.map +0 -1
  326. package/dist/chunk-AIAPXRCI.js.map +0 -1
  327. package/dist/chunk-BRKGYLEQ.js.map +0 -1
  328. package/dist/chunk-F64Z42PJ.js.map +0 -1
  329. package/dist/chunk-JINATP4N.js.map +0 -1
  330. package/dist/chunk-LNAV5E7S.js.map +0 -1
  331. package/dist/chunk-N43NDSME.js.map +0 -1
  332. package/dist/chunk-RJENXXTI.js +0 -93
  333. package/dist/chunk-RJENXXTI.js.map +0 -1
  334. package/dist/chunk-RW2A4M2Q.js +0 -57
  335. package/dist/chunk-RW2A4M2Q.js.map +0 -1
  336. package/dist/chunk-TDHLZY6I.js.map +0 -1
  337. package/dist/chunk-V6QAAOA5.js.map +0 -1
  338. package/dist/chunk-VDOBLABP.js +0 -38
  339. package/dist/chunk-VDOBLABP.js.map +0 -1
  340. package/dist/chunk-VQFILXQN.js.map +0 -1
  341. package/dist/chunk-VZXML7EH.js.map +0 -1
  342. package/dist/chunk-XKDR22VE.js.map +0 -1
  343. package/dist/count-badge.js +0 -13
  344. package/dist/count-badge.js.map +0 -1
  345. package/dist/paint-CJQCM6ZO.js.map +0 -1
  346. package/dist/status-badge.js +0 -72
  347. package/dist/status-badge.js.map +0 -1
  348. package/dist/theme-transition-VGLPZDJI.js.map +0 -1
  349. package/dist/tide-DJZMDAFT.js.map +0 -1
  350. package/dist/types/components/primitives/badge/CountBadge.d.ts +0 -8
  351. package/dist/types/components/primitives/badge/StatusBadge.d.ts +0 -15
  352. package/src/components/primitives/badge/CountBadge.tsx +0 -20
  353. package/src/components/primitives/badge/CountBadge.usage.md +0 -13
  354. package/src/components/primitives/badge/StatusBadge.tsx +0 -113
  355. package/src/components/primitives/badge/StatusBadge.usage.md +0 -14
@@ -0,0 +1,97 @@
1
+ import { animate, measure, type Box, type FlipOptions, type Playback } from '../engine';
2
+ import { claim } from '../engine/animate';
3
+ import { sharedSlot } from '../shared-slot';
4
+ import { inheritedThemeAttrs } from '../theme-scope';
5
+
6
+ const SHOWN_BY = 0.45;
7
+ const GONE_BY = 0.5;
8
+
9
+ interface Copy {
10
+ el: HTMLElement;
11
+ box: Box;
12
+ of: HTMLElement;
13
+ play?: Playback;
14
+ }
15
+
16
+ const kept = sharedSlot('motion.crossfade@2', () => new Map<string, Copy>());
17
+ const riding = new WeakMap<HTMLElement, Copy>();
18
+
19
+ function onto(el: HTMLElement, box: Box, target: Box): { x: number; y: number; scale: number } {
20
+ const [px, py] = getComputedStyle(el).transformOrigin.split(' ').map(parseFloat);
21
+ const scale = target.width / box.width;
22
+ return {
23
+ x: target.left - box.left + (target.width - box.width) / 2 + (box.width / 2 - px) * (1 - scale),
24
+ y: target.top - box.top + (target.height - box.height) / 2 + (box.height / 2 - py) * (1 - scale),
25
+ scale,
26
+ };
27
+ }
28
+
29
+ export function keep(id: string, el: HTMLElement, box: Box, { timing }: FlipOptions): void {
30
+ const copy = el.cloneNode(true) as HTMLElement;
31
+ for (const node of [copy, ...copy.querySelectorAll('[id]')]) node.removeAttribute('id');
32
+ for (const [name, value] of Object.entries(inheritedThemeAttrs(el))) if (value) copy.setAttribute(name, value);
33
+ const { font, color, opacity } = getComputedStyle(el);
34
+ Object.assign(copy.style, {
35
+ position: 'fixed',
36
+ left: `${box.left - window.scrollX}px`,
37
+ top: `${box.top - window.scrollY}px`,
38
+ width: `${box.width}px`,
39
+ height: `${box.height}px`,
40
+ boxSizing: 'border-box',
41
+ margin: '0',
42
+ pointerEvents: 'none',
43
+ translate: 'none',
44
+ scale: 'none',
45
+ transform: 'none',
46
+ font,
47
+ color,
48
+ opacity,
49
+ });
50
+ copy.inert = true;
51
+ copy.setAttribute('aria-hidden', 'true');
52
+ document.body.append(copy);
53
+ const entry: Copy = { el: copy, box, of: el };
54
+ kept.set(id, entry);
55
+ queueMicrotask(() => {
56
+ if (kept.get(id) !== entry) return;
57
+ kept.delete(id);
58
+ if (el.isConnected) copy.remove();
59
+ else animate(copy, { opacity: [0], timing }).finished.then(() => copy.remove());
60
+ });
61
+ }
62
+
63
+ export function play(id: string, el: HTMLElement, from: Box, { timing }: FlipOptions): Playback | undefined {
64
+ const next = kept.get(id);
65
+ if (!next) return undefined;
66
+ const replay = next.of === el;
67
+ const copy = replay ? riding.get(el) : next;
68
+ if (!copy) return undefined;
69
+ claim(el, ['translate', 'scale', 'opacity'], null);
70
+ const to = measure(el);
71
+ if (!to.width || !to.height) return undefined;
72
+ kept.delete(id);
73
+ if (replay) next.el.remove();
74
+ copy.play?.stop();
75
+ const rest = Number(getComputedStyle(el).opacity);
76
+ const out = onto(copy.el, copy.box, to);
77
+ const back = onto(el, to, from);
78
+ const run = animate(copy.el, {
79
+ x: [0, out.x],
80
+ y: [0, out.y],
81
+ scale: [1, out.scale],
82
+ opacity: [Number(copy.el.style.opacity), 0, 0],
83
+ timing: { fill: 'backwards', ...timing, times: [0, GONE_BY, 1] },
84
+ });
85
+ copy.play = run;
86
+ riding.set(el, copy);
87
+ run.finished.then(() => {
88
+ if (copy.play === run) copy.el.remove();
89
+ });
90
+ return animate(el, {
91
+ x: [back.x, 0],
92
+ y: [back.y, 0],
93
+ scale: [back.scale, 1],
94
+ opacity: [0, rest, rest],
95
+ timing: { fill: 'backwards', ...timing, times: [0, SHOWN_BY, 1] },
96
+ });
97
+ }
@@ -1,16 +1,17 @@
1
1
  'use client';
2
2
 
3
- import { createElement, useCallback, useRef, type ReactNode, type Ref } from 'react';
3
+ import { createElement, useCallback, useLayoutEffect, useRef, type ReactNode, type Ref } from 'react';
4
4
 
5
5
  import { useFlip, type FlipTuning } from './flip';
6
+ import { usePresence } from './presence-context';
6
7
  import { useMotion, type MotionSpecs } from './use-motion';
7
8
 
8
9
  export interface MotionProps extends MotionSpecs {
9
10
  /** Tag for the element this renders. @default 'div' */
10
11
  as?: string;
11
- /** FLIP this element from its previous box on every render. Implied by `layoutId`. */
12
+ /** FLIP this element from its previous box whenever a render moves it. */
12
13
  layout?: boolean;
13
- /** FLIP from whatever element last held this id, so the box travels between nodes. */
14
+ /** FLIP from whatever element last held this id, so the box travels between nodes. Add `layout` to FLIP its own moves too. */
14
15
  layoutId?: string;
15
16
  /** Tunes whichever layout animation is active; ignored without `layout` or `layoutId`. */
16
17
  layoutTransition?: FlipTuning;
@@ -32,23 +33,25 @@ export function Motion({
32
33
  children,
33
34
  ...rest
34
35
  }: MotionProps) {
35
- const flipRef = useFlip<HTMLElement>(layoutId ?? null, layoutTransition, !!layoutId || !!layout);
36
+ const { isPresent } = usePresence();
37
+ const flip = useFlip<HTMLElement>(layoutId ?? null, layoutTransition, !!layout);
36
38
  const host = useRef<HTMLElement | null>(null);
37
39
  const forwarded = useRef(ref);
38
40
  forwarded.current = ref;
39
41
 
40
42
  useMotion(host, { animate, exit, initial, deps });
43
+ useLayoutEffect(flip.play);
41
44
 
42
45
  const attach = useCallback(
43
46
  (el: HTMLElement | null) => {
44
47
  host.current = el;
45
- flipRef.current = el;
48
+ flip.ref.current = el;
46
49
  const outer = forwarded.current;
47
50
  if (typeof outer === 'function') outer(el);
48
51
  else if (outer) outer.current = el;
49
52
  },
50
- [flipRef],
53
+ [flip.ref],
51
54
  );
52
55
 
53
- return createElement(as, { ...rest, ref: attach }, children);
56
+ return createElement(as, { ...rest, 'data-exiting': isPresent ? undefined : 'true', ref: attach }, children);
54
57
  }
@@ -15,56 +15,74 @@ import {
15
15
  import { sharedSlot } from '../shared-slot';
16
16
  import { UIMotion } from '../tokens/motion-tokens';
17
17
 
18
- export type FlipTuning = FlipOptions;
18
+ export interface FlipTuning extends FlipOptions {
19
+ /** Keep the element that last held the `layoutId` on screen through the handoff: a copy of it takes the same path and fades out while this one fades in. */
20
+ crossfade?: boolean;
21
+ }
22
+
23
+ const SAME_BOX_PX = 0.5;
19
24
 
20
25
  const sharedOwner = sharedSlot('motion.flip-owner@1', () => new Map<string, HTMLElement>());
21
26
 
27
+ let loadedCrossfade: typeof import('./crossfade') | null = null;
28
+
29
+ const loadCrossfade = (): void => {
30
+ if (!loadedCrossfade) void import('./crossfade').then((module) => (loadedCrossfade = module));
31
+ };
32
+
22
33
  const usable = (box: Box | null): box is Box => !!box && box.width > 0 && box.height > 0;
23
34
 
35
+ const sameBox = (a: Box, b: Box): boolean =>
36
+ (['left', 'top', 'width', 'height'] as const).every((side) => Math.abs(a[side] - b[side]) < SAME_BOX_PX);
37
+
24
38
  export function useFlip<T extends HTMLElement>(
25
39
  sharedId: string | null,
26
40
  tuning: FlipTuning = {},
27
- enabled = true,
28
- ): RefObject<T | null> {
41
+ inPlace: boolean,
42
+ ): { ref: RefObject<T | null>; play: () => void } {
29
43
  const ref = useRef<T | null>(null);
30
44
  const playing = useRef<{ play: Playback; el: T } | null>(null);
31
45
  const interrupted = useRef<Box | null>(null);
32
- const { size, timing } = tuning;
33
- const lastCommitted = enabled && sharedId === null && ref.current ? measure(ref.current) : null;
46
+ const origin = useRef<Box | null>(null);
47
+ const latest = useRef(tuning);
48
+ latest.current = tuning;
49
+ const { size, timing, crossfade } = tuning;
50
+ const enabled = inPlace || sharedId !== null;
51
+ const lastCommitted = ref.current && (inPlace || playing.current) ? measure(ref.current) : null;
34
52
 
35
53
  useLayoutEffect(() => {
36
54
  const el = ref.current;
37
55
  if (!el || !enabled) return;
56
+ if (crossfade) loadCrossfade();
38
57
  const live = playing.current;
39
- let from: Box | null;
40
- if (sharedId === null) from = lastCommitted;
41
- else if (live && live.el === el) from = measure(el);
42
- else if (interrupted.current) from = interrupted.current;
43
- else from = sharedOwner.get(sharedId) === el ? null : readShared(sharedId);
58
+ const midFlight = live?.el === el;
59
+ const moved = !!lastCommitted && !sameBox(lastCommitted, measure(el));
60
+ if (midFlight && !moved) return;
61
+ let from = moved ? lastCommitted : null;
62
+ if (sharedId !== null && !midFlight) {
63
+ if (interrupted.current) from = interrupted.current;
64
+ else if (sharedOwner.get(sharedId) !== el) from = readShared(sharedId);
65
+ }
44
66
  live?.play.stop();
67
+ playing.current = null;
68
+ interrupted.current = null;
45
69
  if (sharedId !== null) {
46
70
  keepShared(sharedId, measure(el));
47
71
  sharedOwner.set(sharedId, el);
48
72
  }
49
- const next = usable(from) && !UIMotion.reduced ? flip(el, from, { size, timing }) : null;
50
- playing.current = next ? { play: next, el } : null;
51
- interrupted.current = next ? from : null;
52
- next?.finished.then(() => {
53
- if (playing.current?.play === next) {
54
- playing.current = null;
55
- interrupted.current = null;
56
- }
57
- });
73
+ origin.current = from;
58
74
  });
59
75
 
60
76
  useLayoutEffect(() => {
61
- if (!enabled || sharedId === null) return;
77
+ if (sharedId === null) return;
62
78
  return () => {
63
79
  const live = playing.current;
64
80
  let box: Box | null = live ? measure(live.el) : null;
81
+ if (!usable(box)) box = ref.current ? measure(ref.current) : null;
82
+ if (latest.current.crossfade && loadedCrossfade && ref.current && usable(box) && !UIMotion.reduced)
83
+ loadedCrossfade.keep(sharedId, ref.current, box, latest.current);
65
84
  live?.play.stop();
66
85
  playing.current = null;
67
- if (!usable(box)) box = ref.current ? measure(ref.current) : null;
68
86
  if (usable(box)) keepShared(sharedId, box);
69
87
  const mine = readShared(sharedId);
70
88
  queueMicrotask(() => {
@@ -73,7 +91,28 @@ export function useFlip<T extends HTMLElement>(
73
91
  if (owner && !owner.isConnected) sharedOwner.delete(sharedId);
74
92
  });
75
93
  };
76
- }, [sharedId, enabled]);
94
+ }, [sharedId]);
95
+
96
+ const play = () => {
97
+ const el = ref.current;
98
+ const from = origin.current;
99
+ origin.current = null;
100
+ if (!el || !usable(from) || UIMotion.reduced) return;
101
+ const handoff =
102
+ sharedId !== null && crossfade && loadedCrossfade
103
+ ? loadedCrossfade.play(sharedId, el, from, { timing })
104
+ : undefined;
105
+ const next = handoff === undefined ? flip(el, from, { size, timing }) : handoff;
106
+ if (!next) return;
107
+ playing.current = { play: next, el };
108
+ interrupted.current = from;
109
+ next.finished.then(() => {
110
+ if (playing.current?.play === next) {
111
+ playing.current = null;
112
+ interrupted.current = null;
113
+ }
114
+ });
115
+ };
77
116
 
78
- return ref;
117
+ return { ref, play };
79
118
  }
@@ -28,6 +28,7 @@ function layoutBox(target: HTMLElement, container: HTMLElement): Box | null {
28
28
  export function useGlide<T extends HTMLElement>(containerRef: RefObject<T | null>) {
29
29
  const ref = useRef<HTMLSpanElement | null>(null);
30
30
  const visible = useRef(false);
31
+ const tracked = useRef<HTMLElement | null>(null);
31
32
 
32
33
  const enter = useCallback(
33
34
  (target: HTMLElement | null) => {
@@ -38,7 +39,10 @@ export function useGlide<T extends HTMLElement>(containerRef: RefObject<T | null
38
39
  if (!at) return;
39
40
  const motion = motionFor(box);
40
41
  const was = measure(pill);
42
+ const arrived = tracked.current !== target;
43
+ tracked.current = target;
41
44
  set(pill, { x: [at.left], y: [at.top], width: [at.width], height: [at.height] });
45
+ if (!arrived) return;
42
46
  animate(pill, { opacity: [1], timing: { duration: motion.dur.fast, ease: motion.ease.standard } });
43
47
  const glided = visible.current && !motion.reduced && was.width > 0 && was.height > 0;
44
48
  visible.current = true;
@@ -49,6 +53,7 @@ export function useGlide<T extends HTMLElement>(containerRef: RefObject<T | null
49
53
 
50
54
  const leave = useCallback(() => {
51
55
  visible.current = false;
56
+ tracked.current = null;
52
57
  if (!ref.current) return;
53
58
  const motion = motionFor(containerRef.current);
54
59
  animate(ref.current, { opacity: [0], timing: { duration: motion.dur.fast, ease: motion.ease.exit } });
@@ -0,0 +1,7 @@
1
+ export type { Layer, Playback } from '../engine';
2
+ export { Motion, type MotionProps } from './element';
3
+ export type { FlipTuning } from './flip';
4
+ export { usePresence, type PresenceState } from './presence-context';
5
+ export { Presence, type PresenceProps } from './presence';
6
+ export { popIn, popOut, slideIn } from './presets';
7
+ export { useMotion, type MotionSpec, type MotionSpecs, type Plays } from './use-motion';
@@ -0,0 +1,34 @@
1
+ # Motion / Presence - @zyncat/ui/motion
2
+
3
+ Group: primitives
4
+
5
+ The React layer over the engine: animate an element you render, and hold a leaving one mounted until its exit finishes.
6
+
7
+ `<Motion>` renders the tag in `as` and plays `animate` on mount, then again whenever `deps` change.
8
+ `exit` plays when a parent `<Presence>` drops the child, which stays mounted until it finishes - a
9
+ child with no `exit` is dropped at once. `layout` and `layoutId` FLIP the box from where it last was
10
+ instead of animating a value. Every spec is a `Layer`, a `Layer[]`, or a function returning the
11
+ `Playback`s to wait on.
12
+
13
+ `<Presence>` needs keyed children; `mode="wait"` holds the entering child back until the outgoing one
14
+ has left, and `initial={false}` skips the entrance for children present at its own first paint.
15
+
16
+ `useMotion(ref, specs)` is the same machinery for an element you hold a ref to but do not render.
17
+ `usePresence()` reads whether the current child is leaving. `popIn` / `popOut` / `slideIn` are the
18
+ named presets - feed them `UIMotion.scale` and `UIMotion.dist` from `@zyncat/ui/motion-tokens`, never
19
+ literals.
20
+
21
+ ```tsx
22
+ <Presence mode="wait" onExitComplete={clearStep}>
23
+ {step && (
24
+ <Motion
25
+ key={step.id}
26
+ animate={popIn(UIMotion.scale.panel, UIMotion.t.enter)}
27
+ exit={popOut(UIMotion.scale.panel, UIMotion.t.exit)}
28
+ deps={[step.id]}
29
+ >
30
+ {step.body}
31
+ </Motion>
32
+ )}
33
+ </Presence>
34
+ ```
@@ -103,6 +103,10 @@ export function Presence({ children, initial = true, mode = 'sync', onExitComple
103
103
 
104
104
  const leaving = shown.some((entry) => entry.exiting);
105
105
 
106
+ useEffect(() => {
107
+ bornAtMount.current.clear();
108
+ }, []);
109
+
106
110
  useEffect(() => {
107
111
  if (wasExiting.current && !leaving) complete.current?.();
108
112
  wasExiting.current = leaving;
@@ -16,6 +16,9 @@ export function run(spec: MotionSpec | undefined, el: HTMLElement): Playback[] {
16
16
  return [Array.isArray(spec) ? animate(el, ...spec) : animate(el, spec)];
17
17
  }
18
18
 
19
+ const sameDeps = (a: unknown[], b: unknown[]): boolean =>
20
+ a.length === b.length && a.every((v, i) => Object.is(v, b[i]));
21
+
19
22
  const allSettled = (plays: Playback[]): Promise<void> =>
20
23
  plays.length ? Promise.all(plays.map((play) => play.finished)).then((): void => {}) : Promise.resolve();
21
24
 
@@ -34,7 +37,7 @@ export interface MotionSpecs {
34
37
  export function useMotion(ref: RefObject<HTMLElement | null>, { animate, exit, initial, deps }: MotionSpecs): void {
35
38
  const presence = usePresence();
36
39
  const playing = useRef<Playback[]>([]);
37
- const mounted = useRef(false);
40
+ const ran = useRef<unknown[] | null>(null);
38
41
  const exiting = useRef(false);
39
42
  const spec = useRef({ animate, exit, initial });
40
43
  spec.current = { animate, exit, initial };
@@ -57,9 +60,11 @@ export function useMotion(ref: RefObject<HTMLElement | null>, { animate, exit, i
57
60
 
58
61
  useLayoutEffect(() => {
59
62
  const el = ref.current;
60
- const atMount = !mounted.current;
61
- mounted.current = true;
62
63
  if (!el) return;
64
+ const current = deps ?? [];
65
+ const previous = ran.current;
66
+ ran.current = current;
67
+ const atMount = !previous || sameDeps(previous, current);
63
68
  if (atMount && (spec.current.initial ?? presence.initial) === false) return;
64
69
  stop();
65
70
  playing.current = run(spec.current.animate, el);
package/src/styles.css CHANGED
@@ -1,7 +1,7 @@
1
1
  /* Zyncat UI global layer - import ONCE at your app root: import '@zyncat/ui/styles.css'.
2
2
  The reset layer is first, so everything else outranks it. Component CSS ships per component. */
3
3
 
4
- @layer zyncat.reset, zyncat.tokens, zyncat.components;
4
+ @layer zyncat.reset, zyncat.tokens, zyncat.base, zyncat.components;
5
5
 
6
6
  @import './tokens/reset.css';
7
7
  @import './tokens/decisions.css';
@@ -0,0 +1,19 @@
1
+ const nearestTheme = (el: Element | null | undefined, attr: string): string | null =>
2
+ el?.closest(`[${attr}]`)?.getAttribute(attr) ?? null;
3
+
4
+ const themeDifferingFromPage = (scope: Element | null | undefined, attr: string): string | undefined => {
5
+ const own = nearestTheme(scope, attr);
6
+ return own !== null && own !== nearestTheme(document.body, attr) ? own : undefined;
7
+ };
8
+
9
+ export interface InheritedThemeAttrs {
10
+ 'data-theme'?: string;
11
+ 'data-polarity'?: string;
12
+ }
13
+
14
+ export function inheritedThemeAttrs(scope: Element | null | undefined): InheritedThemeAttrs {
15
+ return {
16
+ 'data-theme': themeDifferingFromPage(scope, 'data-theme'),
17
+ 'data-polarity': themeDifferingFromPage(scope, 'data-polarity'),
18
+ };
19
+ }
@@ -1,29 +1,78 @@
1
- @layer zyncat.reset, zyncat.tokens, zyncat.components;
1
+ @layer zyncat.reset, zyncat.tokens, zyncat.base, zyncat.components;
2
2
 
3
3
  @layer zyncat.base {
4
+ /* Drives native scrollbars, caret, select popups, and autofill background. */
5
+ :root {
6
+ color-scheme: light dark;
7
+ }
8
+
9
+ /* Only reaches these four; scoped so it stops inheriting everywhere. */
10
+ :where(input[type='checkbox'], input[type='radio'], input[type='range'], progress) {
11
+ accent-color: var(--accent);
12
+ }
13
+
4
14
  body {
5
15
  background: var(--bg-app);
6
16
  color: var(--text-body);
7
17
  font: var(--type-body);
8
- -webkit-font-smoothing: antialiased;
9
- -moz-osx-font-smoothing: grayscale;
18
+ }
19
+
20
+ b,
21
+ strong {
22
+ font-weight: var(--weight-semibold);
23
+ }
24
+
25
+ code,
26
+ kbd,
27
+ pre,
28
+ samp {
29
+ font-family: var(--font-code);
30
+ }
31
+
32
+ button,
33
+ [type='button'],
34
+ [type='reset'],
35
+ [type='submit'] {
36
+ cursor: pointer;
37
+ }
38
+
39
+ :where(button, [type='button'], [type='reset'], [type='submit']):disabled {
40
+ cursor: not-allowed;
41
+ }
42
+
43
+ /* Horizontal drag reflows the page around the field; only the vertical axis is safe. */
44
+ textarea {
45
+ resize: vertical;
46
+ }
47
+
48
+ ::placeholder {
49
+ color: var(--text-subtle);
10
50
  }
11
51
 
12
52
  ::selection {
13
53
  background-color: color-mix(in oklab, var(--accent) 30%, transparent);
14
54
  }
15
55
 
16
- /* Chrome paints an autofilled control from an internal rule that no selector outranks, so the
17
- field arrives yellow with near-black ink and ignores the polarity. The paint is reached
18
- through a transition, which author CSS does control: deferring it past any session leaves
19
- the control's own surface showing, and the ink is set through -webkit-text-fill-color
20
- because the forced colour is applied at paint time rather than as a beatable declaration. */
21
- :-webkit-autofill,
22
- :-webkit-autofill:hover,
23
- :-webkit-autofill:focus,
24
- :-webkit-autofill:active {
56
+ /* outline-style is discrete, so only outline-color can animate from here. */
57
+ :where(a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex='-1'])) {
58
+ outline: var(--ring-rest);
59
+ }
60
+
61
+ /* Without this, unskinned focusables lose the ring the rule above displaced. */
62
+ :where(a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex='-1'])):focus-visible {
63
+ outline-color: var(--ring-color-accent);
64
+ }
65
+
66
+ /* Both rules above skip tabindex="-1", so a programmatic focus target - a listbox scroller, a menu
67
+ surface, a modal panel - would otherwise fall through to the UA outline. Its indicator is the
68
+ active descendant, not the container. */
69
+ :where([tabindex='-1']):focus {
70
+ outline: none;
71
+ }
72
+
73
+ /* Chrome forces both at paint time, so neither color nor background-color reaches them. */
74
+ :is(:autofill, :-webkit-autofill) {
25
75
  -webkit-text-fill-color: var(--text-strong);
26
76
  caret-color: var(--text-strong);
27
- transition: background-color 0s 8000000s;
28
77
  }
29
78
  }
@@ -1,28 +1,30 @@
1
- @layer zyncat.reset, zyncat.tokens, zyncat.components;
1
+ @layer zyncat.reset, zyncat.tokens, zyncat.base, zyncat.components;
2
2
 
3
3
  @layer zyncat.tokens {
4
4
  :root,
5
5
  [data-theme],
6
6
  [data-polarity] {
7
- /* The top of the ramp, not pure white: it carries --neutral like every rung below it. */
8
- --gray-0: oklch(from var(--neutral) 0.995 0.002 h);
9
- --gray-50: oklch(from var(--neutral) 0.984 0.003 h);
10
- --gray-100: oklch(from var(--neutral) 0.97 0.004 h);
11
- --gray-150: oklch(from var(--neutral) 0.954 0.005 h);
12
- --gray-200: oklch(from var(--neutral) 0.924 0.006 h);
13
- --gray-300: oklch(from var(--neutral) 0.874 0.007 h);
14
- --gray-400: oklch(from var(--neutral) 0.765 0.009 h);
15
- --gray-500: oklch(from var(--neutral) 0.642 0.011 h);
16
- --gray-600: oklch(from var(--neutral) 0.532 0.012 h);
17
- --gray-700: oklch(from var(--neutral) 0.422 0.012 h);
18
- --gray-800: oklch(from var(--neutral) 0.305 0.01 h);
19
- --gray-900: oklch(from var(--neutral) 0.225 0.008 h);
20
- --gray-950: oklch(from var(--neutral) 0.165 0.007 h);
7
+ /* Stripe's neutral ramp, rung for rung: --neutral is its midpoint, and every step holds that
8
+ hue's distance from it, so a new --neutral carries the whole ramp with it. The top rung is
9
+ pure white - the only rung Stripe leaves untinted. */
10
+ --gray-0: oklch(from var(--neutral) 1 0 h);
11
+ --gray-50: oklch(from var(--neutral) 0.978 0.0034 calc(h - 12.4));
12
+ --gray-100: oklch(from var(--neutral) 0.948 0.0052 calc(h - 12.4));
13
+ --gray-150: oklch(from var(--neutral) 0.889 0.0105 calc(h - 12.3));
14
+ --gray-200: oklch(from var(--neutral) 0.83 0.0165 calc(h - 6.4));
15
+ --gray-300: oklch(from var(--neutral) 0.742 0.0226 calc(h - 1.1));
16
+ --gray-400: oklch(from var(--neutral) 0.651 0.0247 calc(h + 0.4));
17
+ --gray-500: oklch(from var(--neutral) 0.553 0.031 h);
18
+ --gray-600: oklch(from var(--neutral) 0.466 0.0267 calc(h + 11.4));
19
+ --gray-700: oklch(from var(--neutral) 0.392 0.0226 calc(h + 11.6));
20
+ --gray-800: oklch(from var(--neutral) 0.317 0.0214 calc(h + 21.1));
21
+ --gray-900: oklch(from var(--neutral) 0.226 0.0194 calc(h + 20));
22
+ --gray-950: oklch(from var(--neutral) 0.181 0.0185 calc(h + 19.2));
21
23
  }
22
24
 
23
25
  :root,
24
26
  [data-polarity='light'] {
25
27
  /* Cool near-black on the white canvas. */
26
- --shadow-rgb: 15 22 25;
28
+ --shadow-rgb: 16 17 26;
27
29
  }
28
30
  }
@@ -109,8 +109,6 @@ export interface OdometerStyle extends CSSProperties {
109
109
  '--odometer-gap'?: string | number;
110
110
  /** `--odometer-ink` - Digit ink. Default: `var(--text-strong)`. */
111
111
  '--odometer-ink'?: string | number;
112
- /** `--odometer-accent` - The tint digits take while they roll fast. Default: `var(--accent)`. */
113
- '--odometer-accent'?: string | number;
114
112
  /** `--odometer-separator-ink` - The thousands separator. Default: `var(--text-muted)`. */
115
113
  '--odometer-separator-ink'?: string | number;
116
114
  /** `--odometer-size` - Digit size. Default: `var(--size-display)`. */
@@ -1,4 +1,4 @@
1
- @layer zyncat.reset, zyncat.tokens, zyncat.components;
1
+ @layer zyncat.reset, zyncat.tokens, zyncat.base, zyncat.components;
2
2
 
3
3
  @layer zyncat.tokens {
4
4
  [data-polarity='dark'] {
@@ -24,6 +24,9 @@
24
24
  --border-default: oklch(from var(--neutral) 0.315 0.009 h);
25
25
  --border-strong: oklch(from var(--neutral) 0.4 0.011 h);
26
26
 
27
+ --bg-hover: color-mix(in oklab, var(--text-secondary) 6%, transparent);
28
+ --bg-press: color-mix(in oklab, var(--text-secondary) 10%, transparent);
29
+
27
30
  --shadow-rgb: 0 0 0;
28
31
  --shadow-strength: 3.5;
29
32
  --sheen-strength: 0.2;
@@ -1,18 +1,20 @@
1
- @layer zyncat.reset, zyncat.tokens, zyncat.components;
1
+ @layer zyncat.reset, zyncat.tokens, zyncat.base, zyncat.components;
2
2
 
3
3
  @layer zyncat.tokens {
4
4
  :root,
5
5
  [data-theme='default'] {
6
6
  /* The brand hue - hover, active, lift, subtle, border, wash, the focus ring and info follow. */
7
- --accent: oklch(0.63 0.118 198);
7
+ --accent: oklch(0.7 0.118 198);
8
8
  /* Positive status - its subtle, text and wash follow. */
9
9
  --success: oklch(0.548 0.122 152);
10
10
  /* Caution - its subtle, text and wash follow. */
11
11
  --warning: oklch(0.7 0.142 75);
12
12
  /* Destructive actions and errors - the danger button ladder, ring, subtle, text and wash follow. */
13
13
  --danger: oklch(0.545 0.196 27);
14
- /* The gray ramp's hue - the accent by default, so chrome shares its temperature. */
15
- --neutral: var(--accent);
14
+ /* The middle of the gray ramp - every rung holds its hue distance from this one, so moving it
15
+ retints the whole ramp. Stripe's gray-500 lightness and chroma over the accent's hue, so the
16
+ grays carry the brand temperature; give it a literal hue for a ramp that does not follow. */
17
+ --neutral: oklch(from var(--accent) 0.553 0.031 h);
16
18
  /* Roundness - every --radius-<step> is a fixed ratio of it, 0 squaring every corner. */
17
19
  --radius: 0.5rem;
18
20
  /* The body face - every --type-* bundle follows. The package loads no webfont; point this at yours. */
@@ -1,4 +1,4 @@
1
- @layer zyncat.reset, zyncat.tokens, zyncat.components;
1
+ @layer zyncat.reset, zyncat.tokens, zyncat.base, zyncat.components;
2
2
 
3
3
  @layer zyncat.tokens {
4
4
  :root {
@@ -1,4 +1,4 @@
1
- @layer zyncat.reset, zyncat.tokens, zyncat.components;
1
+ @layer zyncat.reset, zyncat.tokens, zyncat.base, zyncat.components;
2
2
 
3
3
  @layer zyncat.tokens {
4
4
  :root {
@@ -1,4 +1,4 @@
1
- @layer zyncat.reset, zyncat.tokens, zyncat.components;
1
+ @layer zyncat.reset, zyncat.tokens, zyncat.base, zyncat.components;
2
2
 
3
3
  @layer zyncat.tokens {
4
4
  :root {
@@ -35,9 +35,9 @@
35
35
  [data-theme],
36
36
  [data-polarity] {
37
37
  --transition-control:
38
- color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard),
39
- border-color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard),
40
- outline-color var(--duration-fast) var(--ease-standard);
38
+ color var(--duration-base) var(--ease-standard), background-color var(--duration-base) var(--ease-standard),
39
+ border-color var(--duration-base) var(--ease-standard), box-shadow var(--duration-base) var(--ease-standard),
40
+ outline-color var(--duration-base) var(--ease-standard);
41
41
  --transition-colors:
42
42
  color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard),
43
43
  border-color var(--duration-fast) var(--ease-standard);
@@ -1,4 +1,4 @@
1
- @layer zyncat.reset, zyncat.tokens, zyncat.components;
1
+ @layer zyncat.reset, zyncat.tokens, zyncat.base, zyncat.components;
2
2
 
3
3
  @layer zyncat.tokens {
4
4
  :root {