@zyncat/ui 0.20.0 → 0.22.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 (506) hide show
  1. package/dist/alert.js +11 -10
  2. package/dist/alert.js.map +1 -1
  3. package/dist/avatar.css +1 -1
  4. package/dist/badge.css +20 -11
  5. package/dist/badge.js +4 -1
  6. package/dist/{bloom-HV23M4AW.js → bloom-5MZXLNKG.js} +23 -5
  7. package/dist/bloom-5MZXLNKG.js.map +1 -0
  8. package/dist/button.css +24 -27
  9. package/dist/button.js +3 -3
  10. package/dist/checkbox.css +0 -1
  11. package/dist/chunk-2EPNCOLN.js +177 -0
  12. package/dist/chunk-2EPNCOLN.js.map +1 -0
  13. package/dist/{chunk-LNAV5E7S.js → chunk-2GYZ3HP3.js} +8 -4
  14. package/dist/chunk-2GYZ3HP3.js.map +1 -0
  15. package/dist/chunk-4M5FMCFJ.js +16 -0
  16. package/dist/chunk-4M5FMCFJ.js.map +1 -0
  17. package/dist/{chunk-ODRO3KS6.js → chunk-7GTACTZD.js} +8 -6
  18. package/dist/chunk-7GTACTZD.js.map +1 -0
  19. package/dist/{chunk-V6QAAOA5.js → chunk-AK2AXGEC.js} +38 -8
  20. package/dist/chunk-AK2AXGEC.js.map +1 -0
  21. package/dist/{chunk-5VC3TUZ2.js → chunk-BA4ALXQW.js} +2 -2
  22. package/dist/{chunk-5VC3TUZ2.js.map → chunk-BA4ALXQW.js.map} +1 -1
  23. package/dist/{chunk-N43NDSME.js → chunk-CF6ZFXRV.js} +19 -11
  24. package/dist/chunk-CF6ZFXRV.js.map +1 -0
  25. package/dist/{chunk-BRKGYLEQ.js → chunk-DOAR4PJ3.js} +9 -4
  26. package/dist/chunk-DOAR4PJ3.js.map +1 -0
  27. package/dist/{tide-DJZMDAFT.js → chunk-DVLKB3CZ.js} +15 -12
  28. package/dist/chunk-DVLKB3CZ.js.map +1 -0
  29. package/dist/chunk-EUAXI6OF.js +16 -0
  30. package/dist/chunk-EUAXI6OF.js.map +1 -0
  31. package/dist/{chunk-RLNCRDAL.js → chunk-G2TOUG2A.js} +7 -6
  32. package/dist/chunk-G2TOUG2A.js.map +1 -0
  33. package/dist/{chunk-VQFILXQN.js → chunk-HRP4UFWN.js} +70 -8
  34. package/dist/chunk-HRP4UFWN.js.map +1 -0
  35. package/dist/chunk-INK2GJTA.js +102 -0
  36. package/dist/chunk-INK2GJTA.js.map +1 -0
  37. package/dist/chunk-ITW5UCVU.js +24 -0
  38. package/dist/chunk-ITW5UCVU.js.map +1 -0
  39. package/dist/{chunk-F64Z42PJ.js → chunk-JJHEVW4M.js} +5 -6
  40. package/dist/chunk-JJHEVW4M.js.map +1 -0
  41. package/dist/{chunk-7NHY2CRA.js → chunk-JUC35N3C.js} +2 -2
  42. package/dist/chunk-JUC35N3C.js.map +1 -0
  43. package/dist/{chunk-PXQBJMPJ.js → chunk-LFJ4C7ZP.js} +7 -7
  44. package/dist/chunk-LFJ4C7ZP.js.map +1 -0
  45. package/dist/{chunk-TDHLZY6I.js → chunk-MCOIR3CK.js} +77 -18
  46. package/dist/chunk-MCOIR3CK.js.map +1 -0
  47. package/dist/chunk-NATK4DDW.js +108 -0
  48. package/dist/chunk-NATK4DDW.js.map +1 -0
  49. package/dist/{chunk-BIDVNLJO.js → chunk-O3RMSMBP.js} +8 -3
  50. package/dist/{chunk-BIDVNLJO.js.map → chunk-O3RMSMBP.js.map} +1 -1
  51. package/dist/{chunk-UKPX3RIP.js → chunk-ODO2TCTS.js} +27 -13
  52. package/dist/chunk-ODO2TCTS.js.map +1 -0
  53. package/dist/{chunk-M2KGLH2G.js → chunk-P3QSWNED.js} +11 -11
  54. package/dist/{chunk-M2KGLH2G.js.map → chunk-P3QSWNED.js.map} +1 -1
  55. package/dist/{chunk-QDAN43B6.js → chunk-Q4K337QY.js} +6 -6
  56. package/dist/chunk-Q4K337QY.js.map +1 -0
  57. package/dist/{chunk-2YGHPQ66.js → chunk-Q5N24VII.js} +2 -2
  58. package/dist/{chunk-2YGHPQ66.js.map → chunk-Q5N24VII.js.map} +1 -1
  59. package/dist/{chunk-VJXP256V.js → chunk-RLRZJAF7.js} +20 -8
  60. package/dist/chunk-RLRZJAF7.js.map +1 -0
  61. package/dist/{chunk-VZXML7EH.js → chunk-SY5UA6WS.js} +39 -10
  62. package/dist/chunk-SY5UA6WS.js.map +1 -0
  63. package/dist/{chunk-XKDR22VE.js → chunk-TFC5SCAB.js} +37 -14
  64. package/dist/chunk-TFC5SCAB.js.map +1 -0
  65. package/dist/{chunk-HBWRKEW4.js → chunk-VBALIMST.js} +3 -3
  66. package/dist/{chunk-HBWRKEW4.js.map → chunk-VBALIMST.js.map} +1 -1
  67. package/dist/{chunk-JINATP4N.js → chunk-VXQ7A6ZI.js} +8 -9
  68. package/dist/chunk-VXQ7A6ZI.js.map +1 -0
  69. package/dist/{chunk-TBLPZQSI.js → chunk-W7CHDHRV.js} +114 -42
  70. package/dist/chunk-W7CHDHRV.js.map +1 -0
  71. package/dist/{chunk-AIAPXRCI.js → chunk-WBWVOOKM.js} +201 -123
  72. package/dist/chunk-WBWVOOKM.js.map +1 -0
  73. package/dist/{chunk-6H3IJ752.js → chunk-WJEZWKEY.js} +20 -10
  74. package/dist/chunk-WJEZWKEY.js.map +1 -0
  75. package/dist/{chunk-TRPAKUIB.js → chunk-WMTOAYGP.js} +9 -9
  76. package/dist/{chunk-TRPAKUIB.js.map → chunk-WMTOAYGP.js.map} +1 -1
  77. package/dist/{chunk-C3D32LE3.js → chunk-WTHIUPVJ.js} +3 -3
  78. package/dist/{chunk-C3D32LE3.js.map → chunk-WTHIUPVJ.js.map} +1 -1
  79. package/dist/{chunk-F2TB3TT6.js → chunk-XCTMTOGT.js} +5 -5
  80. package/dist/{chunk-F2TB3TT6.js.map → chunk-XCTMTOGT.js.map} +1 -1
  81. package/dist/chunk-XMJ343KF.js +18 -0
  82. package/dist/chunk-XMJ343KF.js.map +1 -0
  83. package/dist/collapse.js +1 -1
  84. package/dist/combobox.css +7 -0
  85. package/dist/combobox.js +183 -0
  86. package/dist/combobox.js.map +1 -0
  87. package/dist/confetti.js +2 -2
  88. package/dist/crossfade-UHUQBUVG.js +133 -0
  89. package/dist/crossfade-UHUQBUVG.js.map +1 -0
  90. package/dist/date-field.js +27 -22
  91. package/dist/date-field.js.map +1 -1
  92. package/dist/date-picker.css +25 -41
  93. package/dist/date-range-field.js +463 -279
  94. package/dist/date-range-field.js.map +1 -1
  95. package/dist/datetime-field.js +28 -23
  96. package/dist/datetime-field.js.map +1 -1
  97. package/dist/dialog-sheet.css +31 -0
  98. package/dist/dialog.css +3 -0
  99. package/dist/dialog.js +44 -42
  100. package/dist/dialog.js.map +1 -1
  101. package/dist/dropdown.css +14 -11
  102. package/dist/dropdown.js +79 -37
  103. package/dist/dropdown.js.map +1 -1
  104. package/dist/emoji-picker.js +22 -21
  105. package/dist/emoji-picker.js.map +1 -1
  106. package/dist/flow-field.js +2 -2
  107. package/dist/glide.js +3 -3
  108. package/dist/input.css +54 -34
  109. package/dist/instagram-feed.js +3 -3
  110. package/dist/lens.js +184 -160
  111. package/dist/lens.js.map +1 -1
  112. package/dist/mcp.js +29 -22
  113. package/dist/menu-surface.css +81 -7
  114. package/dist/modal.js +11 -10
  115. package/dist/modal.js.map +1 -1
  116. package/dist/morphing-text.js +2 -2
  117. package/dist/motion-devtools.css +6 -5
  118. package/dist/motion-devtools.js +6 -6
  119. package/dist/motion-tokens.js +1 -1
  120. package/dist/motion.js +10 -0
  121. package/dist/motion.js.map +1 -0
  122. package/dist/multi-select.js +63 -24
  123. package/dist/multi-select.js.map +1 -1
  124. package/dist/number-field.js +122 -75
  125. package/dist/number-field.js.map +1 -1
  126. package/dist/odometer.css +27 -16
  127. package/dist/odometer.js +225 -73
  128. package/dist/odometer.js.map +1 -1
  129. package/dist/otp-field.js +49 -12
  130. package/dist/otp-field.js.map +1 -1
  131. package/dist/overlay.css +1 -0
  132. package/dist/pagination.css +1 -1
  133. package/dist/pagination.js +6 -6
  134. package/dist/{paint-CJQCM6ZO.js → paint-NLTI6TEF.js} +5 -3
  135. package/dist/paint-NLTI6TEF.js.map +1 -0
  136. package/dist/popover.js +12 -11
  137. package/dist/radio-group.css +9 -6
  138. package/dist/radio-group.js +9 -8
  139. package/dist/radio-group.js.map +1 -1
  140. package/dist/range-sheet-days.css +35 -0
  141. package/dist/range-sheet.css +80 -0
  142. package/dist/range-summary.css +67 -0
  143. package/dist/scroll-area.css +150 -0
  144. package/dist/scroll-area.js +85 -0
  145. package/dist/scroll-area.js.map +1 -0
  146. package/dist/select.css +55 -7
  147. package/dist/select.js +29 -15
  148. package/dist/select.js.map +1 -1
  149. package/dist/sheet.js +12 -11
  150. package/dist/support-rail.css +2 -2
  151. package/dist/support-rail.js +17 -15
  152. package/dist/support-rail.js.map +1 -1
  153. package/dist/table-detail.css +27 -0
  154. package/dist/table.css +41 -14
  155. package/dist/table.js +341 -172
  156. package/dist/table.js.map +1 -1
  157. package/dist/tabs.css +32 -13
  158. package/dist/tabs.js +69 -55
  159. package/dist/tabs.js.map +1 -1
  160. package/dist/tag.css +2 -4
  161. package/dist/tag.js +8 -7
  162. package/dist/tag.js.map +1 -1
  163. package/dist/text-field.js +4 -4
  164. package/dist/textarea.css +26 -41
  165. package/dist/textarea.js +43 -32
  166. package/dist/textarea.js.map +1 -1
  167. package/dist/theme-grid.js +8 -7
  168. package/dist/theme-switcher.js +19 -18
  169. package/dist/theme-switcher.js.map +1 -1
  170. package/dist/{theme-transition-VGLPZDJI.js → theme-transition-F3CBENM5.js} +29 -9
  171. package/dist/theme-transition-F3CBENM5.js.map +1 -0
  172. package/dist/theme-transition.css +49 -0
  173. package/dist/theme.js +5 -4
  174. package/dist/theme.js.map +1 -1
  175. package/dist/tide-AGGMQEJV.js +4 -0
  176. package/dist/tide-AGGMQEJV.js.map +1 -0
  177. package/dist/tiktok.js +3 -3
  178. package/dist/time-field.js +15 -8
  179. package/dist/time-field.js.map +1 -1
  180. package/dist/toast.css +1 -1
  181. package/dist/toast.js +11 -10
  182. package/dist/toast.js.map +1 -1
  183. package/dist/toggle-tag.js +2 -2
  184. package/dist/toggle-tag.js.map +1 -1
  185. package/dist/toggle.css +0 -1
  186. package/dist/toggle.js +4 -15
  187. package/dist/toggle.js.map +1 -1
  188. package/dist/tooltip.css +1 -1
  189. package/dist/tooltip.js +22 -17
  190. package/dist/tooltip.js.map +1 -1
  191. package/dist/trigger.css +0 -1
  192. package/dist/types/components/composites/combobox/Combobox.d.ts +51 -0
  193. package/dist/types/components/composites/combobox/caret.d.ts +8 -0
  194. package/dist/types/components/composites/combobox/use-combobox.d.ts +52 -0
  195. package/dist/types/components/composites/date-picker/DateField.d.ts +1 -1
  196. package/dist/types/components/composites/date-picker/DateRangeField.d.ts +6 -3
  197. package/dist/types/components/composites/date-picker/DateTimeField.d.ts +1 -1
  198. package/dist/types/components/composites/date-picker/TimeField.d.ts +1 -1
  199. package/dist/types/components/composites/date-picker/date-utils.d.ts +2 -0
  200. package/dist/types/components/composites/date-picker/field-shell.d.ts +8 -1
  201. package/dist/types/components/composites/date-picker/month-swipe.d.ts +3 -0
  202. package/dist/types/components/composites/date-picker/range-day.d.ts +11 -0
  203. package/dist/types/components/composites/date-picker/range-month.d.ts +14 -0
  204. package/dist/types/components/composites/date-picker/range-panel.d.ts +4 -18
  205. package/dist/types/components/composites/date-picker/range-presets.d.ts +24 -0
  206. package/dist/types/components/composites/date-picker/range-sheet.d.ts +12 -0
  207. package/dist/types/components/composites/date-picker/range-summary.d.ts +9 -0
  208. package/dist/types/components/composites/date-picker/typed-key.d.ts +3 -0
  209. package/dist/types/components/composites/date-picker/use-month-view.d.ts +14 -0
  210. package/dist/types/components/composites/date-picker/use-range-panel.d.ts +44 -0
  211. package/dist/types/components/composites/dialog/Dialog.d.ts +3 -2
  212. package/dist/types/components/composites/dialog/surface.d.ts +17 -0
  213. package/dist/types/components/composites/dropdown/Dropdown.d.ts +21 -4
  214. package/dist/types/components/composites/dropdown/types.d.ts +9 -3
  215. package/dist/types/components/composites/scroll-area/ScrollArea.d.ts +29 -0
  216. package/dist/types/components/composites/select/MultiSelect.d.ts +31 -5
  217. package/dist/types/components/composites/select/Select.d.ts +20 -4
  218. package/dist/types/components/composites/select/core/index.d.ts +2 -1
  219. package/dist/types/components/composites/select/core/menu.d.ts +10 -5
  220. package/dist/types/components/composites/select/core/panel.d.ts +7 -4
  221. package/dist/types/components/composites/select/core/trigger.d.ts +7 -2
  222. package/dist/types/components/composites/select/core/types.d.ts +9 -0
  223. package/dist/types/components/composites/select/core/use-listbox.d.ts +8 -6
  224. package/dist/types/components/composites/select/presets.d.ts +17 -0
  225. package/dist/types/components/composites/table/Table.d.ts +3 -74
  226. package/dist/types/components/composites/table/body.d.ts +15 -0
  227. package/dist/types/components/composites/table/detail.d.ts +24 -0
  228. package/dist/types/components/composites/table/head.d.ts +16 -0
  229. package/dist/types/components/composites/table/types.d.ts +86 -0
  230. package/dist/types/components/composites/table/use-scroller.d.ts +12 -0
  231. package/dist/types/components/composites/table/use-table-state.d.ts +16 -0
  232. package/dist/types/components/composites/tabs/Tabs.d.ts +4 -69
  233. package/dist/types/components/composites/tabs/tab-panel.d.ts +26 -0
  234. package/dist/types/components/composites/tabs/types.d.ts +48 -0
  235. package/dist/types/components/composites/tabs/use-ink.d.ts +5 -0
  236. package/dist/types/components/composites/tooltip/Tooltip.d.ts +1 -1
  237. package/dist/types/components/compound/support-rail/SupportRail.d.ts +1 -1
  238. package/dist/types/components/expressive/lens/Lens.d.ts +1 -1
  239. package/dist/types/components/expressive/lens/input.d.ts +2 -0
  240. package/dist/types/components/expressive/lens/optics.d.ts +37 -0
  241. package/dist/types/components/expressive/lens/paint.d.ts +2 -0
  242. package/dist/types/components/expressive/lens/use-lens.d.ts +10 -0
  243. package/dist/types/components/expressive/odometer/Odometer.d.ts +1 -1
  244. package/dist/types/components/expressive/odometer/roll.d.ts +18 -0
  245. package/dist/types/components/expressive/odometer/spring.d.ts +11 -0
  246. package/dist/types/components/expressive/theme-transition/scene.d.ts +3 -0
  247. package/dist/types/components/internal/hooks/use-hold-repeat.d.ts +8 -0
  248. package/dist/types/components/internal/icon/Icon.d.ts +2 -0
  249. package/dist/types/components/internal/menu/highlight.d.ts +9 -1
  250. package/dist/types/components/internal/menu/menu-row.d.ts +4 -0
  251. package/dist/types/components/internal/menu/use-anchor-width.d.ts +2 -0
  252. package/dist/types/components/internal/overlay/layer.d.ts +5 -8
  253. package/dist/types/components/internal/overlay/track-anchor.d.ts +5 -0
  254. package/dist/types/components/internal/support/types.d.ts +1 -1
  255. package/dist/types/components/internal/utils/activation.d.ts +1 -0
  256. package/dist/types/components/primitives/badge/Badge.d.ts +17 -8
  257. package/dist/types/components/primitives/badge/morph-label.d.ts +3 -0
  258. package/dist/types/components/primitives/badge/use-glint-on-change.d.ts +2 -0
  259. package/dist/types/components/primitives/button/Button.d.ts +4 -8
  260. package/dist/types/components/primitives/button/button-style.d.ts +8 -4
  261. package/dist/types/components/primitives/collapse/Collapse.d.ts +3 -2
  262. package/dist/types/components/primitives/input/NumberField.d.ts +1 -1
  263. package/dist/types/components/primitives/input/OtpField.d.ts +7 -3
  264. package/dist/types/components/primitives/input/TextField.d.ts +1 -1
  265. package/dist/types/components/primitives/input/field-chrome.d.ts +2 -1
  266. package/dist/types/components/primitives/input/use-number-value.d.ts +16 -0
  267. package/dist/types/components/primitives/tag/Tag.d.ts +1 -1
  268. package/dist/types/components/primitives/tag/ToggleTag.d.ts +2 -2
  269. package/dist/types/components/primitives/textarea/Textarea.d.ts +5 -3
  270. package/dist/types/components/primitives/textarea/char-meter.d.ts +6 -0
  271. package/dist/types/components/primitives/toggle/switch-glyph.d.ts +6 -0
  272. package/dist/types/engine/flip.d.ts +3 -1
  273. package/dist/types/engine/index.d.ts +2 -2
  274. package/dist/types/engine/loop.d.ts +5 -2
  275. package/dist/types/motion/before-paint.d.ts +4 -0
  276. package/dist/types/motion/crossfade.d.ts +4 -0
  277. package/dist/types/motion/element.d.ts +16 -4
  278. package/dist/types/motion/flip.d.ts +12 -3
  279. package/dist/types/motion/holders.d.ts +4 -0
  280. package/dist/types/motion/motion.d.ts +7 -0
  281. package/dist/types/motion/use-motion.d.ts +3 -1
  282. package/dist/types/theme-scope.d.ts +5 -0
  283. package/dist/types/tokens/component-styles.generated.d.ts +0 -2
  284. package/dist/types/tokens/motion-defaults.generated.d.ts +2 -0
  285. package/dist/types/tokens/motion-scale.d.ts +18 -15
  286. package/dist/types/tokens/motion-tokens.d.ts +1 -1
  287. package/dist/types/tokens/theme-store.d.ts +4 -4
  288. package/dist/types/tokens/theme-tokens.generated.d.ts +77 -59
  289. package/dist/types/tokens/theme.d.ts +1 -1
  290. package/dist/typing-lines.js +2 -2
  291. package/dist/youtube.js +3 -3
  292. package/package.json +16 -11
  293. package/skills/zyncat-ui/SKILL.md +8 -8
  294. package/skills/zyncat-ui/references/components.md +6 -5
  295. package/skills/zyncat-ui/references/recipes.md +1 -1
  296. package/skills/zyncat-ui/references/theming.md +3 -3
  297. package/src/components/composites/combobox/Combobox.tsx +100 -0
  298. package/src/components/composites/combobox/Combobox.usage.md +32 -0
  299. package/src/components/composites/combobox/caret.ts +41 -0
  300. package/src/components/composites/combobox/combobox.css +7 -0
  301. package/src/components/composites/combobox/use-combobox.ts +112 -0
  302. package/src/components/composites/date-picker/DateField.tsx +4 -0
  303. package/src/components/composites/date-picker/DateRangeField.tsx +15 -18
  304. package/src/components/composites/date-picker/DateTimeField.tsx +4 -0
  305. package/src/components/composites/date-picker/TimeField.tsx +12 -4
  306. package/src/components/composites/date-picker/date-picker.css +25 -41
  307. package/src/components/composites/date-picker/date-utils.ts +4 -0
  308. package/src/components/composites/date-picker/field-shell.tsx +45 -8
  309. package/src/components/composites/date-picker/month-swipe.ts +41 -0
  310. package/src/components/composites/date-picker/range-day.tsx +112 -0
  311. package/src/components/composites/date-picker/range-month.tsx +79 -0
  312. package/src/components/composites/date-picker/range-panel.tsx +30 -356
  313. package/src/components/composites/date-picker/range-presets.tsx +104 -0
  314. package/src/components/composites/date-picker/range-sheet-days.css +35 -0
  315. package/src/components/composites/date-picker/range-sheet.css +80 -0
  316. package/src/components/composites/date-picker/range-sheet.tsx +72 -0
  317. package/src/components/composites/date-picker/range-summary.css +67 -0
  318. package/src/components/composites/date-picker/range-summary.tsx +69 -0
  319. package/src/components/composites/date-picker/time-core.tsx +23 -17
  320. package/src/components/composites/date-picker/typed-key.ts +9 -0
  321. package/src/components/composites/date-picker/use-month-view.ts +32 -0
  322. package/src/components/composites/date-picker/use-range-panel.ts +145 -0
  323. package/src/components/composites/dialog/Dialog.tsx +28 -110
  324. package/src/components/composites/dialog/dialog-sheet.css +31 -0
  325. package/src/components/composites/dialog/dialog.css +3 -0
  326. package/src/components/composites/dialog/surface.tsx +93 -0
  327. package/src/components/composites/dropdown/Dropdown.tsx +49 -7
  328. package/src/components/composites/dropdown/Dropdown.usage.md +2 -0
  329. package/src/components/composites/dropdown/dropdown.css +14 -11
  330. package/src/components/composites/dropdown/menu-panel.tsx +49 -26
  331. package/src/components/composites/dropdown/types.ts +9 -3
  332. package/src/components/composites/pagination/pagination.css +1 -1
  333. package/src/components/composites/scroll-area/ScrollArea.tsx +114 -0
  334. package/src/components/composites/scroll-area/ScrollArea.usage.md +28 -0
  335. package/src/components/composites/scroll-area/scroll-area.css +150 -0
  336. package/src/components/composites/select/MultiSelect.tsx +71 -12
  337. package/src/components/composites/select/MultiSelect.usage.md +10 -0
  338. package/src/components/composites/select/Select.tsx +32 -2
  339. package/src/components/composites/select/Select.usage.md +13 -1
  340. package/src/components/composites/select/core/index.ts +2 -1
  341. package/src/components/composites/select/core/menu.tsx +34 -17
  342. package/src/components/composites/select/core/panel.tsx +62 -55
  343. package/src/components/composites/select/core/trigger.tsx +44 -13
  344. package/src/components/composites/select/core/types.ts +10 -0
  345. package/src/components/composites/select/core/use-listbox.ts +91 -38
  346. package/src/components/composites/select/presets.tsx +47 -0
  347. package/src/components/composites/select/select.css +55 -7
  348. package/src/components/composites/sheet/use-sheet-drag.ts +13 -0
  349. package/src/components/composites/table/Table.tsx +65 -305
  350. package/src/components/composites/table/Table.usage.md +19 -2
  351. package/src/components/composites/table/body.tsx +147 -0
  352. package/src/components/composites/table/detail.tsx +76 -0
  353. package/src/components/composites/table/head.tsx +90 -0
  354. package/src/components/composites/table/table-detail.css +27 -0
  355. package/src/components/composites/table/table.css +41 -14
  356. package/src/components/composites/table/types.ts +97 -0
  357. package/src/components/composites/table/use-scroller.ts +53 -0
  358. package/src/components/composites/table/use-table-state.ts +98 -0
  359. package/src/components/composites/tabs/Tabs.tsx +23 -188
  360. package/src/components/composites/tabs/tab-panel.tsx +63 -0
  361. package/src/components/composites/tabs/tabs.css +32 -13
  362. package/src/components/composites/tabs/types.ts +51 -0
  363. package/src/components/composites/tabs/use-ink.ts +87 -0
  364. package/src/components/composites/toast/toast.css +1 -1
  365. package/src/components/composites/tooltip/Tooltip.tsx +6 -5
  366. package/src/components/composites/tooltip/tooltip-host.tsx +10 -6
  367. package/src/components/composites/tooltip/tooltip.css +1 -1
  368. package/src/components/compound/support-rail/SupportRail.tsx +3 -2
  369. package/src/components/compound/support-rail/support-rail.css +2 -2
  370. package/src/components/dev/motion-devtools.css +6 -5
  371. package/src/components/expressive/lens/Lens.tsx +11 -368
  372. package/src/components/expressive/lens/input.ts +91 -0
  373. package/src/components/expressive/lens/optics.ts +119 -0
  374. package/src/components/expressive/lens/paint.ts +60 -0
  375. package/src/components/expressive/lens/use-lens.ts +121 -0
  376. package/src/components/expressive/odometer/Odometer.tsx +78 -99
  377. package/src/components/expressive/odometer/Odometer.usage.md +2 -2
  378. package/src/components/expressive/odometer/odometer.css +27 -16
  379. package/src/components/expressive/odometer/roll.ts +139 -0
  380. package/src/components/expressive/odometer/spring.ts +86 -0
  381. package/src/components/expressive/theme-transition/bloom.ts +22 -2
  382. package/src/components/expressive/theme-transition/paint.ts +2 -0
  383. package/src/components/expressive/theme-transition/scene.ts +3 -0
  384. package/src/components/expressive/theme-transition/theme-transition.css +49 -0
  385. package/src/components/expressive/theme-transition/theme-transition.ts +21 -1
  386. package/src/components/expressive/theme-transition/tide.ts +15 -10
  387. package/src/components/internal/hooks/use-hold-repeat.ts +43 -0
  388. package/src/components/internal/hooks/use-scroll-edges.ts +6 -1
  389. package/src/components/internal/icon/Icon.tsx +4 -0
  390. package/src/components/internal/menu/highlight.ts +20 -2
  391. package/src/components/internal/menu/menu-row.tsx +36 -8
  392. package/src/components/internal/menu/menu-surface.css +81 -7
  393. package/src/components/internal/menu/use-anchor-width.ts +26 -0
  394. package/src/components/internal/overlay/layer.tsx +11 -23
  395. package/src/components/internal/overlay/overlay.css +1 -0
  396. package/src/components/internal/overlay/position.ts +17 -6
  397. package/src/components/internal/overlay/track-anchor.ts +69 -0
  398. package/src/components/internal/overlay/trigger.css +0 -1
  399. package/src/components/internal/support/types.ts +1 -1
  400. package/src/components/internal/utils/activation.ts +7 -2
  401. package/src/components/primitives/avatar/avatar.css +1 -1
  402. package/src/components/primitives/badge/Badge.tsx +38 -15
  403. package/src/components/primitives/badge/Badge.usage.md +12 -5
  404. package/src/components/primitives/badge/badge.css +20 -11
  405. package/src/components/primitives/badge/morph-label.tsx +71 -0
  406. package/src/components/primitives/badge/use-glint-on-change.ts +16 -0
  407. package/src/components/primitives/button/Button.tsx +5 -8
  408. package/src/components/primitives/button/Button.usage.md +5 -4
  409. package/src/components/primitives/button/button-style.ts +11 -5
  410. package/src/components/primitives/button/button.css +24 -27
  411. package/src/components/primitives/checkbox/checkbox.css +0 -1
  412. package/src/components/primitives/collapse/Collapse.tsx +3 -2
  413. package/src/components/primitives/input/NumberField.tsx +38 -46
  414. package/src/components/primitives/input/OtpField.tsx +52 -11
  415. package/src/components/primitives/input/OtpField.usage.md +2 -1
  416. package/src/components/primitives/input/TextField.tsx +5 -3
  417. package/src/components/primitives/input/field-chrome.tsx +3 -2
  418. package/src/components/primitives/input/input.css +54 -34
  419. package/src/components/primitives/input/use-number-value.ts +38 -0
  420. package/src/components/primitives/radio-group/radio-group.css +9 -6
  421. package/src/components/primitives/tag/Tag.tsx +1 -1
  422. package/src/components/primitives/tag/ToggleTag.tsx +2 -2
  423. package/src/components/primitives/tag/tag.css +2 -4
  424. package/src/components/primitives/textarea/Textarea.tsx +44 -30
  425. package/src/components/primitives/textarea/char-meter.tsx +19 -0
  426. package/src/components/primitives/textarea/textarea.css +26 -41
  427. package/src/components/primitives/toggle/Toggle.tsx +3 -12
  428. package/src/components/primitives/toggle/switch-glyph.tsx +25 -0
  429. package/src/components/primitives/toggle/toggle.css +0 -1
  430. package/src/engine/animate.ts +5 -3
  431. package/src/engine/flip.ts +28 -4
  432. package/src/engine/index.ts +2 -2
  433. package/src/engine/loop.ts +17 -6
  434. package/src/mcp/server.ts +30 -20
  435. package/src/motion/before-paint.ts +15 -0
  436. package/src/motion/crossfade.ts +143 -0
  437. package/src/motion/element.tsx +29 -8
  438. package/src/motion/flip.ts +102 -31
  439. package/src/motion/glide.tsx +5 -0
  440. package/src/motion/holders.ts +10 -0
  441. package/src/motion/motion.ts +7 -0
  442. package/src/motion/motion.usage.md +34 -0
  443. package/src/motion/presence.tsx +22 -9
  444. package/src/motion/use-motion.ts +45 -6
  445. package/src/theme-scope.ts +19 -0
  446. package/src/tokens/base.css +7 -5
  447. package/src/tokens/color.css +17 -15
  448. package/src/tokens/component-styles.generated.ts +0 -2
  449. package/src/tokens/dark.css +8 -5
  450. package/src/tokens/decisions.css +5 -3
  451. package/src/tokens/motion-defaults.generated.ts +15 -8
  452. package/src/tokens/motion-scale.ts +18 -15
  453. package/src/tokens/motion-tokens.ts +4 -4
  454. package/src/tokens/motion.css +19 -11
  455. package/src/tokens/reset.css +1 -0
  456. package/src/tokens/semantic.css +20 -14
  457. package/src/tokens/spacing.css +5 -3
  458. package/src/tokens/theme-store.ts +4 -4
  459. package/src/tokens/theme-sync.tsx +4 -2
  460. package/src/tokens/theme-tokens.generated.ts +78 -59
  461. package/src/tokens/theme.tsx +1 -1
  462. package/tailwind.css +6 -0
  463. package/dist/bloom-HV23M4AW.js.map +0 -1
  464. package/dist/chunk-2DNKZ57E.js +0 -72
  465. package/dist/chunk-2DNKZ57E.js.map +0 -1
  466. package/dist/chunk-6H3IJ752.js.map +0 -1
  467. package/dist/chunk-7NHY2CRA.js.map +0 -1
  468. package/dist/chunk-AIAPXRCI.js.map +0 -1
  469. package/dist/chunk-BRKGYLEQ.js.map +0 -1
  470. package/dist/chunk-F64Z42PJ.js.map +0 -1
  471. package/dist/chunk-JINATP4N.js.map +0 -1
  472. package/dist/chunk-KSAJ6DED.js +0 -16
  473. package/dist/chunk-KSAJ6DED.js.map +0 -1
  474. package/dist/chunk-LNAV5E7S.js.map +0 -1
  475. package/dist/chunk-N43NDSME.js.map +0 -1
  476. package/dist/chunk-ODRO3KS6.js.map +0 -1
  477. package/dist/chunk-PXQBJMPJ.js.map +0 -1
  478. package/dist/chunk-QDAN43B6.js.map +0 -1
  479. package/dist/chunk-RJENXXTI.js +0 -93
  480. package/dist/chunk-RJENXXTI.js.map +0 -1
  481. package/dist/chunk-RLNCRDAL.js.map +0 -1
  482. package/dist/chunk-RW2A4M2Q.js +0 -57
  483. package/dist/chunk-RW2A4M2Q.js.map +0 -1
  484. package/dist/chunk-TBLPZQSI.js.map +0 -1
  485. package/dist/chunk-TDHLZY6I.js.map +0 -1
  486. package/dist/chunk-UKPX3RIP.js.map +0 -1
  487. package/dist/chunk-V6QAAOA5.js.map +0 -1
  488. package/dist/chunk-VDOBLABP.js +0 -38
  489. package/dist/chunk-VDOBLABP.js.map +0 -1
  490. package/dist/chunk-VJXP256V.js.map +0 -1
  491. package/dist/chunk-VQFILXQN.js.map +0 -1
  492. package/dist/chunk-VZXML7EH.js.map +0 -1
  493. package/dist/chunk-XKDR22VE.js.map +0 -1
  494. package/dist/count-badge.js +0 -13
  495. package/dist/count-badge.js.map +0 -1
  496. package/dist/paint-CJQCM6ZO.js.map +0 -1
  497. package/dist/status-badge.js +0 -72
  498. package/dist/status-badge.js.map +0 -1
  499. package/dist/theme-transition-VGLPZDJI.js.map +0 -1
  500. package/dist/tide-DJZMDAFT.js.map +0 -1
  501. package/dist/types/components/primitives/badge/CountBadge.d.ts +0 -8
  502. package/dist/types/components/primitives/badge/StatusBadge.d.ts +0 -15
  503. package/src/components/primitives/badge/CountBadge.tsx +0 -20
  504. package/src/components/primitives/badge/CountBadge.usage.md +0 -13
  505. package/src/components/primitives/badge/StatusBadge.tsx +0 -113
  506. package/src/components/primitives/badge/StatusBadge.usage.md +0 -14
@@ -1,79 +1,150 @@
1
1
  'use client';
2
2
 
3
- import { useLayoutEffect, useRef, type RefObject } from 'react';
3
+ import { useLayoutEffect, useRef, type EffectCallback, type RefObject } from 'react';
4
4
 
5
5
  import {
6
+ animate,
6
7
  dropShared,
7
- flip,
8
8
  keepShared,
9
9
  measure,
10
+ offscreen,
10
11
  readShared,
11
12
  type Box,
12
13
  type FlipOptions,
13
14
  type Playback,
14
15
  } from '../engine';
15
- import { sharedSlot } from '../shared-slot';
16
+ import { flipLayers } from '../engine/flip';
16
17
  import { UIMotion } from '../tokens/motion-tokens';
18
+ import { beforePaint } from './before-paint';
19
+ import { leaving, measureHolders, sharedOwner } from './holders';
17
20
 
18
- export type FlipTuning = FlipOptions;
21
+ export interface FlipTuning extends FlipOptions {
22
+ /** 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. */
23
+ crossfade?: boolean;
24
+ }
25
+
26
+ const SAME_BOX_PX = 0.5;
27
+
28
+ let loadedCrossfade: typeof import('./crossfade') | null = null;
19
29
 
20
- const sharedOwner = sharedSlot('motion.flip-owner@1', () => new Map<string, HTMLElement>());
30
+ const loadCrossfade = (): void => {
31
+ if (!loadedCrossfade) void import('./crossfade').then((module) => (loadedCrossfade = module));
32
+ };
21
33
 
22
34
  const usable = (box: Box | null): box is Box => !!box && box.width > 0 && box.height > 0;
23
35
 
36
+ const sameBox = (a: Box, b: Box): boolean =>
37
+ (['left', 'top', 'width', 'height'] as const).every((side) => Math.abs(a[side] - b[side]) < SAME_BOX_PX);
38
+
24
39
  export function useFlip<T extends HTMLElement>(
25
40
  sharedId: string | null,
26
- tuning: FlipTuning = {},
27
- enabled = true,
28
- ): RefObject<T | null> {
41
+ tuning: FlipTuning & { offscreenMargin?: number } = {},
42
+ inPlace: boolean,
43
+ ): { ref: RefObject<T | null>; play: EffectCallback; snapshot: () => void } {
29
44
  const ref = useRef<T | null>(null);
45
+ const lastCommitted = useRef<Box | null>(null);
30
46
  const playing = useRef<{ play: Playback; el: T } | null>(null);
47
+ const superseded = useRef<Playback | null>(null);
48
+ const queued = useRef<object | null>(null);
49
+ const held = useRef<string | null>(null);
31
50
  const interrupted = useRef<Box | null>(null);
32
- const { size, timing } = tuning;
33
- const lastCommitted = enabled && sharedId === null && ref.current ? measure(ref.current) : null;
51
+ const origin = useRef<Box | null>(null);
52
+ const latest = useRef(tuning);
53
+ latest.current = tuning;
54
+ const { size, timing, crossfade, offscreenMargin } = tuning;
55
+ const enabled = inPlace || sharedId !== null;
56
+ if (enabled) measureHolders();
57
+ const holder = sharedId === null ? undefined : sharedOwner.get(sharedId);
58
+ if (holder && holder !== ref.current && holder.isConnected) leaving.set(holder, measure(holder));
34
59
 
35
60
  useLayoutEffect(() => {
36
61
  const el = ref.current;
37
62
  if (!el || !enabled) return;
63
+ leaving.clear();
64
+ if (crossfade) loadCrossfade();
38
65
  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);
44
- live?.play.stop();
66
+ const midFlight = live?.el === el;
67
+ const moved = !!lastCommitted.current && !sameBox(lastCommitted.current, measure(el));
68
+ if (midFlight && !moved) return;
69
+ let from = moved ? lastCommitted.current : null;
70
+ if (sharedId !== null && !midFlight) {
71
+ if (interrupted.current) from = interrupted.current;
72
+ else if (sharedOwner.get(sharedId) !== el) from = readShared(sharedId);
73
+ }
74
+ superseded.current = live?.play ?? null;
75
+ playing.current = null;
76
+ interrupted.current = null;
45
77
  if (sharedId !== null) {
46
78
  keepShared(sharedId, measure(el));
47
79
  sharedOwner.set(sharedId, el);
48
80
  }
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
- });
81
+ origin.current ??= from;
58
82
  });
59
83
 
60
84
  useLayoutEffect(() => {
61
- if (!enabled || sharedId === null) return;
85
+ if (sharedId === null) return;
86
+ held.current = sharedId;
62
87
  return () => {
88
+ held.current = null;
63
89
  const live = playing.current;
64
- let box: Box | null = live ? measure(live.el) : null;
65
- live?.play.stop();
66
- playing.current = null;
90
+ measureHolders();
91
+ let box: Box | null = (ref.current && leaving.get(ref.current)) ?? (live ? measure(live.el) : null);
67
92
  if (!usable(box)) box = ref.current ? measure(ref.current) : null;
93
+ const painted = !origin.current;
94
+ if (painted && latest.current.crossfade && loadedCrossfade && ref.current && usable(box) && !UIMotion.reduced)
95
+ loadedCrossfade.keep(sharedId, ref.current, box, latest.current.timing, latest.current.offscreenMargin);
68
96
  if (usable(box)) keepShared(sharedId, box);
69
97
  const mine = readShared(sharedId);
70
98
  queueMicrotask(() => {
99
+ if (held.current === sharedId) return;
100
+ if (live && !live.el.isConnected) live.play.stop();
71
101
  if (readShared(sharedId) === mine) dropShared(sharedId);
72
102
  const owner = sharedOwner.get(sharedId);
73
103
  if (owner && !owner.isConnected) sharedOwner.delete(sharedId);
74
104
  });
75
105
  };
76
- }, [sharedId, enabled]);
106
+ }, [sharedId]);
107
+
108
+ const play = () => {
109
+ const stale = superseded.current;
110
+ superseded.current = null;
111
+ if (!origin.current && !stale) return;
112
+ const job = {};
113
+ queued.current = job;
114
+ beforePaint(() => {
115
+ if (queued.current !== job) return;
116
+ const el = ref.current;
117
+ const from = origin.current;
118
+ origin.current = null;
119
+ if (!el || !usable(from) || UIMotion.reduced) return;
120
+ const to = measure(el);
121
+ if (offscreen(offscreenMargin, from, to)) return;
122
+ const layers = flipLayers(el, from, to, { size, timing });
123
+ return () => {
124
+ const handoff =
125
+ sharedId !== null && crossfade && loadedCrossfade
126
+ ? loadedCrossfade.play(sharedId, el, from, { timing })
127
+ : undefined;
128
+ const next = handoff === undefined ? layers && animate(el, ...layers) : handoff;
129
+ if (!next) return;
130
+ playing.current = { play: next, el };
131
+ interrupted.current = from;
132
+ next.finished.then(() => {
133
+ if (playing.current?.play === next) {
134
+ playing.current = null;
135
+ interrupted.current = null;
136
+ }
137
+ });
138
+ };
139
+ }, stale?.stop);
140
+ return () => {
141
+ queued.current = null;
142
+ };
143
+ };
144
+
145
+ const snapshot = () => {
146
+ lastCommitted.current = ref.current && (inPlace || playing.current) ? measure(ref.current) : null;
147
+ };
77
148
 
78
- return ref;
149
+ return { ref, play, snapshot };
79
150
  }
@@ -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,10 @@
1
+ import { measure, type Box } from '../engine';
2
+ import { sharedSlot } from '../shared-slot';
3
+
4
+ export const sharedOwner = sharedSlot('motion.flip-owner@1', () => new Map<string, HTMLElement>());
5
+ export const leaving = sharedSlot('motion.flip-leaving@1', () => new Map<HTMLElement, Box>());
6
+
7
+ export function measureHolders(): void {
8
+ if (leaving.size || !sharedOwner.size) return;
9
+ for (const holder of sharedOwner.values()) if (holder.isConnected) leaving.set(holder, measure(holder));
10
+ }
@@ -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
+ ```
@@ -12,7 +12,7 @@ import {
12
12
  type ReactNode,
13
13
  } from 'react';
14
14
 
15
- import { PresenceContext } from './presence-context';
15
+ import { PresenceContext, type PresenceState } from './presence-context';
16
16
 
17
17
  interface Entry {
18
18
  key: string;
@@ -64,6 +64,7 @@ export function Presence({ children, initial = true, mode = 'sync', onExitComple
64
64
  const signature = incoming.map((entry) => entry.key).join('|');
65
65
  const claims = useRef<Claims>(new Map());
66
66
  const latest = useRef<Latest>(new Map());
67
+ const values = useRef({ membership: '', byKey: new Map<string, PresenceState>() });
67
68
  for (const entry of incoming) latest.current.set(entry.key, entry.node);
68
69
  const [tracked, setTracked] = useState<Tracked>({ shown: incoming, signature });
69
70
  const bornAtMount = useRef(new Set(incoming.map((entry) => entry.key)));
@@ -103,6 +104,10 @@ export function Presence({ children, initial = true, mode = 'sync', onExitComple
103
104
 
104
105
  const leaving = shown.some((entry) => entry.exiting);
105
106
 
107
+ useEffect(() => {
108
+ bornAtMount.current.clear();
109
+ }, []);
110
+
106
111
  useEffect(() => {
107
112
  if (wasExiting.current && !leaving) complete.current?.();
108
113
  wasExiting.current = leaving;
@@ -111,20 +116,28 @@ export function Presence({ children, initial = true, mode = 'sync', onExitComple
111
116
  const fresh = new Map(incoming.map((entry) => [entry.key, entry.node]));
112
117
  const visible = mode === 'wait' && leaving ? shown.filter((entry) => entry.exiting) : shown;
113
118
 
119
+ const membership = visible.map((entry) => entry.key).join('|');
120
+ const reflowed = values.current.membership !== membership;
121
+ const priorValues = values.current.byKey;
122
+ values.current = { membership, byKey: new Map() };
123
+ const valueFor = ({ key, exiting }: Entry): PresenceState => {
124
+ const born = initial || !bornAtMount.current.has(key);
125
+ const kept = reflowed ? undefined : priorValues.get(key);
126
+ const value =
127
+ kept?.isPresent === !exiting && kept.initial === born
128
+ ? kept
129
+ : { isPresent: !exiting, initial: born, claimExit: claimExit(key) };
130
+ values.current.byKey.set(key, value);
131
+ return value;
132
+ };
133
+
114
134
  return createElement(
115
135
  Fragment,
116
136
  null,
117
137
  visible.map((entry) =>
118
138
  createElement(
119
139
  PresenceContext.Provider,
120
- {
121
- key: entry.key,
122
- value: {
123
- isPresent: !entry.exiting,
124
- initial: initial || !bornAtMount.current.has(entry.key),
125
- claimExit: claimExit(entry.key),
126
- },
127
- },
140
+ { key: entry.key, value: valueFor(entry) },
128
141
  fresh.get(entry.key) ?? entry.node,
129
142
  ),
130
143
  ),
@@ -2,7 +2,8 @@
2
2
 
3
3
  import { useLayoutEffect, useRef, type RefObject } from 'react';
4
4
 
5
- import { animate, type Layer, type Playback } from '../engine';
5
+ import { animate, measure, offscreen, type Layer, type Playback } from '../engine';
6
+ import { beforePaint } from './before-paint';
6
7
  import { usePresence } from './presence-context';
7
8
 
8
9
  export type Plays = Playback | Playback[] | null | undefined | void;
@@ -16,6 +17,12 @@ export function run(spec: MotionSpec | undefined, el: HTMLElement): Playback[] {
16
17
  return [Array.isArray(spec) ? animate(el, ...spec) : animate(el, spec)];
17
18
  }
18
19
 
20
+ const landed = (layers: Layer[]): Layer[] =>
21
+ layers.map((layer) => ({ ...layer, timing: { duration: 0, fill: layer.timing?.fill } }));
22
+
23
+ const sameDeps = (a: unknown[], b: unknown[]): boolean =>
24
+ a.length === b.length && a.every((v, i) => Object.is(v, b[i]));
25
+
19
26
  const allSettled = (plays: Playback[]): Promise<void> =>
20
27
  plays.length ? Promise.all(plays.map((play) => play.finished)).then((): void => {}) : Promise.resolve();
21
28
 
@@ -28,13 +35,20 @@ export interface MotionSpecs {
28
35
  initial?: boolean;
29
36
  /** Replay `animate` when these change. Must keep a stable length. @default [] */
30
37
  deps?: unknown[];
38
+ /** How far outside the viewport, in px, this element still animates; further out, `animate` and layout moves land on their end state at once. `Infinity` always animates. @default 100 */
39
+ offscreenMargin?: number;
31
40
  }
32
41
 
33
42
  /** Drives `<Motion>`; use it directly on elements you hold a ref to but do not render. */
34
- export function useMotion(ref: RefObject<HTMLElement | null>, { animate, exit, initial, deps }: MotionSpecs): void {
43
+ export function useMotion(
44
+ ref: RefObject<HTMLElement | null>,
45
+ { animate, exit, initial, deps, offscreenMargin }: MotionSpecs,
46
+ ): void {
35
47
  const presence = usePresence();
36
48
  const playing = useRef<Playback[]>([]);
49
+ const pending = useRef<object | null>(null);
37
50
  const mounted = useRef(false);
51
+ const ran = useRef<unknown[] | null>(null);
38
52
  const exiting = useRef(false);
39
53
  const spec = useRef({ animate, exit, initial });
40
54
  spec.current = { animate, exit, initial };
@@ -42,6 +56,7 @@ export function useMotion(ref: RefObject<HTMLElement | null>, { animate, exit, i
42
56
  const ownsExit = !!exit;
43
57
 
44
58
  const stop = () => {
59
+ pending.current = null;
45
60
  for (const play of playing.current) play.stop();
46
61
  playing.current = [];
47
62
  };
@@ -57,12 +72,28 @@ export function useMotion(ref: RefObject<HTMLElement | null>, { animate, exit, i
57
72
 
58
73
  useLayoutEffect(() => {
59
74
  const el = ref.current;
60
- const atMount = !mounted.current;
61
- mounted.current = true;
62
75
  if (!el) return;
76
+ const current = deps ?? [];
77
+ const previous = ran.current;
78
+ ran.current = current;
79
+ const atMount = !previous || sameDeps(previous, current);
80
+ if (previous && atMount && (pending.current || playing.current.length)) return;
63
81
  if (atMount && (spec.current.initial ?? presence.initial) === false) return;
64
82
  stop();
65
- playing.current = run(spec.current.animate, el);
83
+ const animation = spec.current.animate;
84
+ if (!animation || typeof animation === 'function') {
85
+ playing.current = run(animation, el);
86
+ return;
87
+ }
88
+ const token = {};
89
+ pending.current = token;
90
+ beforePaint(() => {
91
+ if (pending.current !== token) return;
92
+ const layers = offscreen(offscreenMargin, measure(el)) ? landed([animation].flat()) : animation;
93
+ return () => {
94
+ playing.current = run(layers, el);
95
+ };
96
+ });
66
97
  }, deps ?? []); // eslint-disable-line react-hooks/exhaustive-deps
67
98
 
68
99
  useLayoutEffect(() => {
@@ -84,5 +115,13 @@ export function useMotion(ref: RefObject<HTMLElement | null>, { animate, exit, i
84
115
  });
85
116
  }, [presence.isPresent]); // eslint-disable-line react-hooks/exhaustive-deps
86
117
 
87
- useLayoutEffect(() => stop, []);
118
+ useLayoutEffect(() => {
119
+ mounted.current = true;
120
+ return () => {
121
+ mounted.current = false;
122
+ queueMicrotask(() => {
123
+ if (!mounted.current) stop();
124
+ });
125
+ };
126
+ }, []);
88
127
  }
@@ -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,11 +1,6 @@
1
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
4
  /* Only reaches these four; scoped so it stops inheriting everywhere. */
10
5
  :where(input[type='checkbox'], input[type='radio'], input[type='range'], progress) {
11
6
  accent-color: var(--accent);
@@ -63,6 +58,13 @@
63
58
  outline-color: var(--ring-color-accent);
64
59
  }
65
60
 
61
+ /* Both rules above skip tabindex="-1", so a programmatic focus target - a listbox scroller, a menu
62
+ surface, a modal panel - would otherwise fall through to the UA outline. Its indicator is the
63
+ active descendant, not the container. */
64
+ :where([tabindex='-1']):focus {
65
+ outline: none;
66
+ }
67
+
66
68
  /* Chrome forces both at paint time, so neither color nor background-color reaches them. */
67
69
  :is(:autofill, :-webkit-autofill) {
68
70
  -webkit-text-fill-color: var(--text-strong);
@@ -4,25 +4,27 @@
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)`. */
@@ -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;
@@ -31,15 +34,15 @@
31
34
 
32
35
  /* A light face reads as a light source on dark, so the fills drop a step while the lift stays put. */
33
36
  --accent-fill: oklch(from var(--accent) calc(l - 0.06) calc(c - 0.01) h);
34
- --accent-subtle: oklch(from var(--accent) 0.27 0.045 h);
35
- --accent-border: oklch(from var(--accent) 0.45 0.09 h);
36
- --accent-disabled: oklch(from var(--accent) 0.42 0.06 h);
37
+ --accent-subtle: oklch(from var(--accent) 0.27 min(c, 0.045) h);
38
+ --accent-border: oklch(from var(--accent) 0.45 min(c, 0.09) h);
39
+ --accent-disabled: oklch(from var(--accent) 0.42 min(c, 0.06) h);
37
40
  --accent-wash: oklch(from var(--accent) l c h / 0.14);
38
41
  --text-accent: oklch(from var(--accent) calc(l + 0.14) calc(c - 0.012) h);
39
42
 
40
- --info-subtle: oklch(from var(--info) 0.265 0.045 h);
43
+ --info-subtle: oklch(from var(--info) 0.265 min(c, 0.045) h);
41
44
  --info-text: oklch(from var(--info) calc(l + 0.22) calc(c - 0.014) h);
42
- --info-wash: oklch(from var(--info) 0.63 0.118 h / 0.14);
45
+ --info-wash: oklch(from var(--info) 0.63 min(c, 0.118) h / 0.14);
43
46
 
44
47
  --success-subtle: oklch(from var(--success) 0.265 0.05 h);
45
48
  --success-text: oklch(from var(--success) calc(l + 0.23) calc(c - 0.02) h);
@@ -4,15 +4,17 @@
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. */
@@ -5,16 +5,23 @@
5
5
  * Generated from the token and component CSS by `scripts/gen-theme.mjs` - `pnpm sync` rebuilds it.
6
6
  */
7
7
  export const motionDefaults = {
8
- duration: { fast: 140, base: 200, slow: 300, slower: 450, slowest: 900, spin: 1000, pulse: 1600 } satisfies Record<
9
- string,
10
- number
11
- >,
8
+ duration: {
9
+ fast: 140,
10
+ base: 240,
11
+ moderate: 320,
12
+ slow: 420,
13
+ slower: 600,
14
+ slowest: 800,
15
+ spin: 1000,
16
+ pulse: 1600,
17
+ } satisfies Record<string, number>,
12
18
  ease: {
13
19
  standard: [0.2, 0, 0, 1],
14
- entrance: [0.25, 1, 0.4, 1],
15
- exit: [0.4, 0, 1, 1],
16
- spring: [0.34, 1.4, 0.5, 1],
17
- glide: [0.32, 0.55, 0, 1],
20
+ entrance: [0.22, 1, 0.36, 1],
21
+ exit: [0.3, 0, 0.3, 1],
22
+ spring: [0.3, 1.5, 0.5, 1],
23
+ glide: [0.22, 1, 0.36, 1],
24
+ move: [0.55, 0, 0.15, 1],
18
25
  } satisfies Record<string, [number, number, number, number]>,
19
26
  distance: { sm: 8, md: 16, lg: 24 } satisfies Record<string, number>,
20
27
  scale: { panel: 0.98, floating: 0.96, chip: 0.9 } satisfies Record<string, number>,