@stagewise/ui 0.1.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 (266) hide show
  1. package/README.md +135 -0
  2. package/package.json +80 -0
  3. package/src/components/ui/accordion.tsx +66 -0
  4. package/src/components/ui/alert-dialog.tsx +185 -0
  5. package/src/components/ui/alert.tsx +76 -0
  6. package/src/components/ui/aspect-ratio.tsx +22 -0
  7. package/src/components/ui/avatar.tsx +107 -0
  8. package/src/components/ui/badge.tsx +52 -0
  9. package/src/components/ui/breadcrumb.tsx +125 -0
  10. package/src/components/ui/bubble.tsx +128 -0
  11. package/src/components/ui/button-group.tsx +87 -0
  12. package/src/components/ui/button.tsx +58 -0
  13. package/src/components/ui/calendar.tsx +221 -0
  14. package/src/components/ui/card.tsx +103 -0
  15. package/src/components/ui/carousel.tsx +240 -0
  16. package/src/components/ui/chart.tsx +371 -0
  17. package/src/components/ui/checkbox.tsx +30 -0
  18. package/src/components/ui/collapsible.tsx +19 -0
  19. package/src/components/ui/combobox.tsx +295 -0
  20. package/src/components/ui/command.tsx +348 -0
  21. package/src/components/ui/context-menu.tsx +271 -0
  22. package/src/components/ui/dialog.tsx +160 -0
  23. package/src/components/ui/direction.tsx +4 -0
  24. package/src/components/ui/drawer.tsx +228 -0
  25. package/src/components/ui/dropdown-menu.tsx +266 -0
  26. package/src/components/ui/empty.tsx +104 -0
  27. package/src/components/ui/field.tsx +236 -0
  28. package/src/components/ui/hover-card.tsx +51 -0
  29. package/src/components/ui/input-group.tsx +158 -0
  30. package/src/components/ui/input-otp.tsx +85 -0
  31. package/src/components/ui/input.tsx +20 -0
  32. package/src/components/ui/item.tsx +201 -0
  33. package/src/components/ui/kbd.tsx +26 -0
  34. package/src/components/ui/label.tsx +20 -0
  35. package/src/components/ui/marker.tsx +71 -0
  36. package/src/components/ui/menubar.tsx +280 -0
  37. package/src/components/ui/message.tsx +92 -0
  38. package/src/components/ui/native-select.tsx +61 -0
  39. package/src/components/ui/navigation-menu.tsx +168 -0
  40. package/src/components/ui/pagination.tsx +130 -0
  41. package/src/components/ui/popover.tsx +88 -0
  42. package/src/components/ui/progress.tsx +83 -0
  43. package/src/components/ui/questionnaire.tsx +324 -0
  44. package/src/components/ui/radio-group.tsx +36 -0
  45. package/src/components/ui/resizable.tsx +50 -0
  46. package/src/components/ui/scroll-area.tsx +53 -0
  47. package/src/components/ui/select.tsx +201 -0
  48. package/src/components/ui/separator.tsx +23 -0
  49. package/src/components/ui/sheet.tsx +136 -0
  50. package/src/components/ui/sidebar.tsx +723 -0
  51. package/src/components/ui/skeleton.tsx +13 -0
  52. package/src/components/ui/slider.tsx +52 -0
  53. package/src/components/ui/spinner.tsx +10 -0
  54. package/src/components/ui/switch.tsx +32 -0
  55. package/src/components/ui/table.tsx +114 -0
  56. package/src/components/ui/tabs.tsx +82 -0
  57. package/src/components/ui/textarea.tsx +18 -0
  58. package/src/components/ui/toast.tsx +234 -0
  59. package/src/components/ui/toggle-group.tsx +87 -0
  60. package/src/components/ui/toggle.tsx +43 -0
  61. package/src/components/ui/tooltip.tsx +66 -0
  62. package/src/fonts/OFL.txt +92 -0
  63. package/src/fonts/geist-variable-italic.woff2 +0 -0
  64. package/src/fonts/geist-variable.woff2 +0 -0
  65. package/src/hooks/use-mobile.ts +19 -0
  66. package/src/icons/custom/index.ts +1 -0
  67. package/src/icons/custom/ui-outline-18/Icon.tsx +28 -0
  68. package/src/icons/custom/ui-outline-18/IconBrowserTab.tsx +40 -0
  69. package/src/icons/custom/ui-outline-18/IconNewTerminal.tsx +77 -0
  70. package/src/icons/custom/ui-outline-18/index.ts +3 -0
  71. package/src/icons/index.ts +52 -0
  72. package/src/icons/nucleo/LICENSE.md +29 -0
  73. package/src/icons/nucleo/core-outline-24/Icon.tsx +27 -0
  74. package/src/icons/nucleo/core-outline-24/IconArrowUpOutline24.tsx +36 -0
  75. package/src/icons/nucleo/core-outline-24/IconBluetoothOutline24.tsx +26 -0
  76. package/src/icons/nucleo/core-outline-24/IconTrash2Outline24.tsx +76 -0
  77. package/src/icons/nucleo/core-outline-24/IconUsbOutline24.tsx +64 -0
  78. package/src/icons/nucleo/core-outline-24/index.ts +5 -0
  79. package/src/icons/nucleo/index.ts +48 -0
  80. package/src/icons/nucleo/micro-bold/Icon.tsx +27 -0
  81. package/src/icons/nucleo/micro-bold/IconArrowLeft.tsx +28 -0
  82. package/src/icons/nucleo/micro-bold/IconArrowRight.tsx +28 -0
  83. package/src/icons/nucleo/micro-bold/IconArrowRotateAnticlockwise.tsx +27 -0
  84. package/src/icons/nucleo/micro-bold/IconChevronLeft.tsx +16 -0
  85. package/src/icons/nucleo/micro-bold/IconChevronRight.tsx +16 -0
  86. package/src/icons/nucleo/micro-bold/IconClipboardContent.tsx +59 -0
  87. package/src/icons/nucleo/micro-bold/IconMagicWandSparkle.tsx +44 -0
  88. package/src/icons/nucleo/micro-bold/IconTriangleWarning.tsx +30 -0
  89. package/src/icons/nucleo/micro-bold/IconXmark.tsx +31 -0
  90. package/src/icons/nucleo/micro-bold/index.ts +10 -0
  91. package/src/icons/nucleo/social-media/Icon.tsx +27 -0
  92. package/src/icons/nucleo/social-media/IconApple.tsx +12 -0
  93. package/src/icons/nucleo/social-media/IconGithub.tsx +11 -0
  94. package/src/icons/nucleo/social-media/IconGoogle.tsx +20 -0
  95. package/src/icons/nucleo/social-media/index.ts +4 -0
  96. package/src/icons/nucleo/ui-fill-18/Icon.tsx +27 -0
  97. package/src/icons/nucleo/ui-fill-18/IconArrowLeftFill18.tsx +17 -0
  98. package/src/icons/nucleo/ui-fill-18/IconArrowRightFill18.tsx +17 -0
  99. package/src/icons/nucleo/ui-fill-18/IconCheckFill18.tsx +12 -0
  100. package/src/icons/nucleo/ui-fill-18/IconChevronDownFill18.tsx +12 -0
  101. package/src/icons/nucleo/ui-fill-18/IconGlobe2Fill18.tsx +17 -0
  102. package/src/icons/nucleo/ui-fill-18/IconLinkFill18.tsx +21 -0
  103. package/src/icons/nucleo/ui-fill-18/IconMediaStopFill18.tsx +17 -0
  104. package/src/icons/nucleo/ui-fill-18/IconPinTackFill18.tsx +17 -0
  105. package/src/icons/nucleo/ui-fill-18/IconPlusFill18.tsx +17 -0
  106. package/src/icons/nucleo/ui-fill-18/IconVolumeUpFill18.tsx +22 -0
  107. package/src/icons/nucleo/ui-fill-18/IconVolumeXmarkFill18.tsx +17 -0
  108. package/src/icons/nucleo/ui-fill-18/IconXmarkFill18.tsx +17 -0
  109. package/src/icons/nucleo/ui-fill-18/index.ts +13 -0
  110. package/src/icons/nucleo/ui-fill-duo-18/Icon.tsx +27 -0
  111. package/src/icons/nucleo/ui-fill-duo-18/IconBrainNodesFillDuo18.tsx +32 -0
  112. package/src/icons/nucleo/ui-fill-duo-18/IconCloudeCodeFillDuo18.tsx +25 -0
  113. package/src/icons/nucleo/ui-fill-duo-18/IconDatabaseFillDuo18.tsx +24 -0
  114. package/src/icons/nucleo/ui-fill-duo-18/IconDownload4FillDuo18.tsx +18 -0
  115. package/src/icons/nucleo/ui-fill-duo-18/IconEarthFillDuo18.tsx +20 -0
  116. package/src/icons/nucleo/ui-fill-duo-18/IconFinderFillDuo18.tsx +36 -0
  117. package/src/icons/nucleo/ui-fill-duo-18/IconFolderContent2FillDuo18.tsx +22 -0
  118. package/src/icons/nucleo/ui-fill-duo-18/IconGear3FillDuo18.tsx +18 -0
  119. package/src/icons/nucleo/ui-fill-duo-18/IconHistoryFillDuo18.tsx +20 -0
  120. package/src/icons/nucleo/ui-fill-duo-18/IconLockKeyFillDuo18.tsx +24 -0
  121. package/src/icons/nucleo/ui-fill-duo-18/IconNoteFillDuo18.tsx +34 -0
  122. package/src/icons/nucleo/ui-fill-duo-18/IconPenDrawSparkleFillDuo18.tsx +34 -0
  123. package/src/icons/nucleo/ui-fill-duo-18/IconServerFillDuo18.tsx +22 -0
  124. package/src/icons/nucleo/ui-fill-duo-18/IconSpace3dFillDuo18.tsx +24 -0
  125. package/src/icons/nucleo/ui-fill-duo-18/IconTriangleWarningFillDuo18.tsx +24 -0
  126. package/src/icons/nucleo/ui-fill-duo-18/index.ts +16 -0
  127. package/src/icons/nucleo/ui-outline-18/Icon.tsx +27 -0
  128. package/src/icons/nucleo/ui-outline-18/IconArrowDownOutline18.tsx +33 -0
  129. package/src/icons/nucleo/ui-outline-18/IconArrowRightOutline18.tsx +34 -0
  130. package/src/icons/nucleo/ui-outline-18/IconArrowUpRightOutline18.tsx +34 -0
  131. package/src/icons/nucleo/ui-outline-18/IconArrowsOppositeDirectionXOutline18.tsx +54 -0
  132. package/src/icons/nucleo/ui-outline-18/IconArrowsToCenterOutline18.tsx +101 -0
  133. package/src/icons/nucleo/ui-outline-18/IconBanOutline18.tsx +37 -0
  134. package/src/icons/nucleo/ui-outline-18/IconBellDotOutline18.tsx +43 -0
  135. package/src/icons/nucleo/ui-outline-18/IconBookOpen5Outline18.tsx +40 -0
  136. package/src/icons/nucleo/ui-outline-18/IconBookOpenOutline18.tsx +32 -0
  137. package/src/icons/nucleo/ui-outline-18/IconBooks2Outline18.tsx +100 -0
  138. package/src/icons/nucleo/ui-outline-18/IconBoxSparkleOutline18.tsx +75 -0
  139. package/src/icons/nucleo/ui-outline-18/IconBrainOutline18.tsx +57 -0
  140. package/src/icons/nucleo/ui-outline-18/IconBranchOutOutline18.tsx +52 -0
  141. package/src/icons/nucleo/ui-outline-18/IconBugOutline18.tsx +98 -0
  142. package/src/icons/nucleo/ui-outline-18/IconCameraOutline18.tsx +42 -0
  143. package/src/icons/nucleo/ui-outline-18/IconChartPieOutline18.tsx +30 -0
  144. package/src/icons/nucleo/ui-outline-18/IconCheck2Outline18.tsx +23 -0
  145. package/src/icons/nucleo/ui-outline-18/IconCheckOutline18.tsx +23 -0
  146. package/src/icons/nucleo/ui-outline-18/IconChevronDownOutline18.tsx +22 -0
  147. package/src/icons/nucleo/ui-outline-18/IconChevronExpandYOutline18.tsx +31 -0
  148. package/src/icons/nucleo/ui-outline-18/IconChevronLeftOutline18.tsx +22 -0
  149. package/src/icons/nucleo/ui-outline-18/IconChevronReduceYOutline18.tsx +31 -0
  150. package/src/icons/nucleo/ui-outline-18/IconChevronRightOutline18.tsx +22 -0
  151. package/src/icons/nucleo/ui-outline-18/IconChevronUpOutline18.tsx +22 -0
  152. package/src/icons/nucleo/ui-outline-18/IconCircleCheckOutline18.tsx +32 -0
  153. package/src/icons/nucleo/ui-outline-18/IconCircleInfoOutline18.tsx +37 -0
  154. package/src/icons/nucleo/ui-outline-18/IconCircleQuestionOutline18.tsx +39 -0
  155. package/src/icons/nucleo/ui-outline-18/IconClipboardContentOutline18.tsx +60 -0
  156. package/src/icons/nucleo/ui-outline-18/IconClipboardOutline18.tsx +37 -0
  157. package/src/icons/nucleo/ui-outline-18/IconClone2Outline18.tsx +32 -0
  158. package/src/icons/nucleo/ui-outline-18/IconCloneDashed2Outline18.tsx +49 -0
  159. package/src/icons/nucleo/ui-outline-18/IconCodeBranchOutline18.tsx +65 -0
  160. package/src/icons/nucleo/ui-outline-18/IconCodeCommitOutline18.tsx +48 -0
  161. package/src/icons/nucleo/ui-outline-18/IconColorPaletteOutline18.tsx +56 -0
  162. package/src/icons/nucleo/ui-outline-18/IconConnection2Outline18.tsx +43 -0
  163. package/src/icons/nucleo/ui-outline-18/IconCopyIdOutline18.tsx +52 -0
  164. package/src/icons/nucleo/ui-outline-18/IconCopyOutline18.tsx +32 -0
  165. package/src/icons/nucleo/ui-outline-18/IconCreditCardOutline18.tsx +61 -0
  166. package/src/icons/nucleo/ui-outline-18/IconDatabaseSearchOutline18.tsx +64 -0
  167. package/src/icons/nucleo/ui-outline-18/IconDotsOutline18.tsx +46 -0
  168. package/src/icons/nucleo/ui-outline-18/IconDownload4Outline18.tsx +43 -0
  169. package/src/icons/nucleo/ui-outline-18/IconEarthOutline18.tsx +47 -0
  170. package/src/icons/nucleo/ui-outline-18/IconEarthSearchOutline18.tsx +61 -0
  171. package/src/icons/nucleo/ui-outline-18/IconEnvelopeOutline18.tsx +38 -0
  172. package/src/icons/nucleo/ui-outline-18/IconEye2Outline18.tsx +34 -0
  173. package/src/icons/nucleo/ui-outline-18/IconEyeOutline18.tsx +32 -0
  174. package/src/icons/nucleo/ui-outline-18/IconFilePenOutline18.tsx +56 -0
  175. package/src/icons/nucleo/ui-outline-18/IconFileSearchOutline18.tsx +64 -0
  176. package/src/icons/nucleo/ui-outline-18/IconFloppyDiskOutline18.tsx +40 -0
  177. package/src/icons/nucleo/ui-outline-18/IconFolder5Outline18.tsx +37 -0
  178. package/src/icons/nucleo/ui-outline-18/IconFolderCloudOutline18.tsx +39 -0
  179. package/src/icons/nucleo/ui-outline-18/IconFolderOpenOutline18.tsx +31 -0
  180. package/src/icons/nucleo/ui-outline-18/IconFolderOutline18.tsx +32 -0
  181. package/src/icons/nucleo/ui-outline-18/IconFolderPenOutline18.tsx +40 -0
  182. package/src/icons/nucleo/ui-outline-18/IconFolderPlusOutline18.tsx +48 -0
  183. package/src/icons/nucleo/ui-outline-18/IconFolderSearchOutline18.tsx +48 -0
  184. package/src/icons/nucleo/ui-outline-18/IconGear2Outline18.tsx +193 -0
  185. package/src/icons/nucleo/ui-outline-18/IconGear3Outline18.tsx +32 -0
  186. package/src/icons/nucleo/ui-outline-18/IconGlobe3Outline18.tsx +61 -0
  187. package/src/icons/nucleo/ui-outline-18/IconGripDotsVerticalOutline18.tsx +74 -0
  188. package/src/icons/nucleo/ui-outline-18/IconHardDriveOutline18.tsx +40 -0
  189. package/src/icons/nucleo/ui-outline-18/IconHelpChatOutline18.tsx +47 -0
  190. package/src/icons/nucleo/ui-outline-18/IconHotDrinkOutline18.tsx +60 -0
  191. package/src/icons/nucleo/ui-outline-18/IconImageSparkle3Outline18.tsx +41 -0
  192. package/src/icons/nucleo/ui-outline-18/IconKey2Outline18.tsx +61 -0
  193. package/src/icons/nucleo/ui-outline-18/IconLoader6Outline18.tsx +23 -0
  194. package/src/icons/nucleo/ui-outline-18/IconLocation2Outline18.tsx +45 -0
  195. package/src/icons/nucleo/ui-outline-18/IconLockKeyOutline18.tsx +58 -0
  196. package/src/icons/nucleo/ui-outline-18/IconMagicWandOutline18.tsx +32 -0
  197. package/src/icons/nucleo/ui-outline-18/IconMagnifierMinusOutline18.tsx +39 -0
  198. package/src/icons/nucleo/ui-outline-18/IconMagnifierOutline18.tsx +32 -0
  199. package/src/icons/nucleo/ui-outline-18/IconMagnifierPlusOutline18.tsx +48 -0
  200. package/src/icons/nucleo/ui-outline-18/IconMicrophone3Outline18.tsx +57 -0
  201. package/src/icons/nucleo/ui-outline-18/IconMinusOutline18.tsx +25 -0
  202. package/src/icons/nucleo/ui-outline-18/IconMoonOutline18.tsx +23 -0
  203. package/src/icons/nucleo/ui-outline-18/IconMsgSleepOutline18.tsx +41 -0
  204. package/src/icons/nucleo/ui-outline-18/IconMsgWritingOutline18.tsx +42 -0
  205. package/src/icons/nucleo/ui-outline-18/IconMusicOutline18.tsx +67 -0
  206. package/src/icons/nucleo/ui-outline-18/IconOctagonWarningOutline18.tsx +35 -0
  207. package/src/icons/nucleo/ui-outline-18/IconOpenExternalOutline18.tsx +51 -0
  208. package/src/icons/nucleo/ui-outline-18/IconOpenRectArrowInOutline18.tsx +43 -0
  209. package/src/icons/nucleo/ui-outline-18/IconPanelLeftOutline18.tsx +39 -0
  210. package/src/icons/nucleo/ui-outline-18/IconPaperclip2Outline18.tsx +22 -0
  211. package/src/icons/nucleo/ui-outline-18/IconPen2Outline18.tsx +35 -0
  212. package/src/icons/nucleo/ui-outline-18/IconPenDrawSparkleOutline18.tsx +46 -0
  213. package/src/icons/nucleo/ui-outline-18/IconPenOutline18.tsx +23 -0
  214. package/src/icons/nucleo/ui-outline-18/IconPenPlusOutline18.tsx +47 -0
  215. package/src/icons/nucleo/ui-outline-18/IconPenWriting3Outline18.tsx +31 -0
  216. package/src/icons/nucleo/ui-outline-18/IconPhoneOutline18.tsx +23 -0
  217. package/src/icons/nucleo/ui-outline-18/IconPinTackOutline18.tsx +35 -0
  218. package/src/icons/nucleo/ui-outline-18/IconPinTackSlashOutline18.tsx +47 -0
  219. package/src/icons/nucleo/ui-outline-18/IconPlusOutline18.tsx +38 -0
  220. package/src/icons/nucleo/ui-outline-18/IconPowerOffOutline18.tsx +36 -0
  221. package/src/icons/nucleo/ui-outline-18/IconPresentationScreenVideoOutline18.tsx +55 -0
  222. package/src/icons/nucleo/ui-outline-18/IconPuzzlePieceOutline18.tsx +22 -0
  223. package/src/icons/nucleo/ui-outline-18/IconRedoOutline18.tsx +32 -0
  224. package/src/icons/nucleo/ui-outline-18/IconRefreshAnticlockwiseOutline18.tsx +48 -0
  225. package/src/icons/nucleo/ui-outline-18/IconReuseOutline18.tsx +50 -0
  226. package/src/icons/nucleo/ui-outline-18/IconSearchContentOutline18.tsx +81 -0
  227. package/src/icons/nucleo/ui-outline-18/IconServerOutline18.tsx +73 -0
  228. package/src/icons/nucleo/ui-outline-18/IconSideProfileSparkleOutline18.tsx +28 -0
  229. package/src/icons/nucleo/ui-outline-18/IconSidebarLeftHideOutline18.tsx +49 -0
  230. package/src/icons/nucleo/ui-outline-18/IconSidebarLeftShowOutline18.tsx +49 -0
  231. package/src/icons/nucleo/ui-outline-18/IconSidebarRightHideOutline18.tsx +48 -0
  232. package/src/icons/nucleo/ui-outline-18/IconSidebarRightShowOutline18.tsx +48 -0
  233. package/src/icons/nucleo/ui-outline-18/IconSparkleOutline18.tsx +43 -0
  234. package/src/icons/nucleo/ui-outline-18/IconSpeakerOutline18.tsx +47 -0
  235. package/src/icons/nucleo/ui-outline-18/IconSplitViewOutline18.tsx +32 -0
  236. package/src/icons/nucleo/ui-outline-18/IconSquareCodeOutline18.tsx +40 -0
  237. package/src/icons/nucleo/ui-outline-18/IconSquareDashedOutline18.tsx +94 -0
  238. package/src/icons/nucleo/ui-outline-18/IconSquareTerminalOutline18.tsx +48 -0
  239. package/src/icons/nucleo/ui-outline-18/IconSunOutline18.tsx +121 -0
  240. package/src/icons/nucleo/ui-outline-18/IconTerminalOutline18.tsx +35 -0
  241. package/src/icons/nucleo/ui-outline-18/IconTextAlignLeft2Outline18.tsx +60 -0
  242. package/src/icons/nucleo/ui-outline-18/IconTextBgColorOutline18.tsx +48 -0
  243. package/src/icons/nucleo/ui-outline-18/IconTextColorOutline18.tsx +48 -0
  244. package/src/icons/nucleo/ui-outline-18/IconThumbsDownOutline18.tsx +36 -0
  245. package/src/icons/nucleo/ui-outline-18/IconThumbsUpOutline18.tsx +37 -0
  246. package/src/icons/nucleo/ui-outline-18/IconTrashOutline18.tsx +41 -0
  247. package/src/icons/nucleo/ui-outline-18/IconTriangleWarningOutline18.tsx +37 -0
  248. package/src/icons/nucleo/ui-outline-18/IconUndoOutline18.tsx +32 -0
  249. package/src/icons/nucleo/ui-outline-18/IconVersionsOutline18.tsx +46 -0
  250. package/src/icons/nucleo/ui-outline-18/IconVideoOutline18.tsx +45 -0
  251. package/src/icons/nucleo/ui-outline-18/IconWaveformLinesOutline18.tsx +80 -0
  252. package/src/icons/nucleo/ui-outline-18/IconWindowCodeOutline18.tsx +62 -0
  253. package/src/icons/nucleo/ui-outline-18/IconWindowPointerOutline18.tsx +51 -0
  254. package/src/icons/nucleo/ui-outline-18/IconXmarkOutline18.tsx +38 -0
  255. package/src/icons/nucleo/ui-outline-18/index.ts +128 -0
  256. package/src/index.ts +66 -0
  257. package/src/lib/utils.ts +6 -0
  258. package/src/plugin/index.ts +611 -0
  259. package/src/styles/animations.css +59 -0
  260. package/src/styles/bridge.css +117 -0
  261. package/src/styles/derived-utilities.css +179 -0
  262. package/src/styles/fonts.css +23 -0
  263. package/src/styles/index.css +72 -0
  264. package/src/styles/palette.css +189 -0
  265. package/src/styles/tailwind-tokens.css +56 -0
  266. package/src/styles/theme.css +103 -0
@@ -0,0 +1,611 @@
1
+ // src/index.ts
2
+ import plugin from 'tailwindcss/plugin';
3
+
4
+ export type ColorModifiersPluginOptions = {
5
+ /**
6
+ * When true, the plugin will emit console.warn messages for invalid modifiers.
7
+ * Defaults to false (silent).
8
+ */
9
+ warn?: boolean;
10
+ /**
11
+ * Extend the plugin to support custom color utilities.
12
+ * Maps utility prefixes to CSS variable names.
13
+ * Example: { 'shimmer-from': '--shimmer-color-1', 'shimmer-to': '--shimmer-color-2' }
14
+ */
15
+ extend?: Record<string, string>;
16
+ };
17
+
18
+ type Channel = 'l' | 'c' | 'h' | 'a';
19
+ type Operation = '+' | '-' | '*' | '/';
20
+
21
+ type ParsedOp = {
22
+ channel: Channel;
23
+ operation: Operation;
24
+ raw: string; // original token substring (for warnings)
25
+ // For add/subtract on l/c/a: unitless numeric delta (already scaled if integer or %)
26
+ // For multiply/divide: raw multiplier/divisor (NOT scaled)
27
+ // For h: degrees (add/subtract), or multiplier/divisor
28
+ value: number;
29
+ };
30
+
31
+ type ParsedModifier = {
32
+ ops: ParsedOp[];
33
+ // convenience: whether alpha is modified by any op
34
+ hasAlphaOp: boolean;
35
+ };
36
+
37
+ function flattenColors(input: unknown, prefix = ''): Record<string, string> {
38
+ const out: Record<string, string> = {};
39
+ if (!input) return out;
40
+
41
+ if (typeof input === 'string') {
42
+ if (prefix) out[prefix] = input;
43
+ return out;
44
+ }
45
+
46
+ if (typeof input !== 'object') return out;
47
+
48
+ const obj = input as Record<string, unknown>;
49
+ for (const [key, val] of Object.entries(obj)) {
50
+ const nextPrefix = prefix ? `${prefix}-${key}` : key;
51
+
52
+ if (typeof val === 'string') {
53
+ out[nextPrefix] = val;
54
+ continue;
55
+ }
56
+
57
+ // Special-case: { DEFAULT: "..." } should map to the parent key
58
+ if (val && typeof val === 'object') {
59
+ const maybeDefault = (val as Record<string, unknown>).DEFAULT;
60
+ if (typeof maybeDefault === 'string') {
61
+ out[nextPrefix] = maybeDefault;
62
+ }
63
+ }
64
+
65
+ Object.assign(out, flattenColors(val, nextPrefix));
66
+ }
67
+
68
+ return out;
69
+ }
70
+
71
+ function isIntegerString(num: string): boolean {
72
+ return /^[0-9]+$/.test(num);
73
+ }
74
+
75
+ function parseScaledLca(numStr: string): number | null {
76
+ const trimmed = numStr.trim();
77
+ const isPercent = trimmed.endsWith('%');
78
+ const core = isPercent ? trimmed.slice(0, -1) : trimmed;
79
+
80
+ // Must be a valid JS float (no exponent support needed for v1)
81
+ if (!/^[0-9]*\.?[0-9]+$/.test(core)) return null;
82
+
83
+ const n = Number(core);
84
+ if (!Number.isFinite(n)) return null;
85
+
86
+ if (isPercent) return n / 100;
87
+ if (isIntegerString(core)) return n / 100;
88
+
89
+ // decimal literal
90
+ return n;
91
+ }
92
+
93
+ function parseHueDegrees(numStr: string): number | null {
94
+ const trimmed = numStr.trim();
95
+ if (trimmed.endsWith('%')) return null; // disallow % for hue
96
+ if (!/^[0-9]*\.?[0-9]+$/.test(trimmed)) return null;
97
+
98
+ const n = Number(trimmed);
99
+ if (!Number.isFinite(n)) return null;
100
+ return n; // degrees
101
+ }
102
+
103
+ function normalizeModifier(mod: string): string {
104
+ let m = mod.trim();
105
+
106
+ // Strip surrounding brackets if present (e.g., "[l+2]" -> "l+2")
107
+ // Tailwind v4 may pass arbitrary modifiers with brackets intact
108
+ if (m.startsWith('[') && m.endsWith(']')) {
109
+ m = m.slice(1, -1);
110
+ }
111
+
112
+ // Allow optional separators "_", ",", and " " (space) anywhere between tokens
113
+ // Tailwind v4 may convert underscores to spaces, so we need to handle both
114
+ return m.replaceAll('_', '').replaceAll(',', '').replaceAll(' ', '');
115
+ }
116
+
117
+ function parseModifier(
118
+ modifierRaw: string,
119
+ warn: (msg: string) => void,
120
+ ): ParsedModifier | null {
121
+ const modifier = normalizeModifier(modifierRaw);
122
+
123
+ // quick reject: must start with a channel letter so we don't conflict with opacity modifiers like /50
124
+ if (!/^[lchaLHCA]/.test(modifier)) return null;
125
+
126
+ // reject unexpected characters early (helps avoid partial parsing surprises)
127
+ // Allowed: letters l c h a (any case), p m x d (operation aliases), digits, +, -, *, /, ., %, separators already removed
128
+ if (!/^[lchaLHCApmPMxdXD0-9+\-*/.%]+$/.test(modifier)) {
129
+ warn(
130
+ `[tailwindcss-color-modifiers] Ignoring invalid modifier "/${modifierRaw}" (unexpected characters).`,
131
+ );
132
+ return null;
133
+ }
134
+
135
+ // Token regex: <channel><operation?><number>
136
+ // Operation options:
137
+ // - '+' or 'p'/'P' = add (plus)
138
+ // - '-' or 'm'/'M' = subtract (minus)
139
+ // - '*' or 'x'/'X' = multiply (times)
140
+ // - '/' or 'd'/'D' = divide
141
+ // - omitted = defaults to '+' (add)
142
+ // This allows using l20, lp20, lx1.2, ld2, or bracket syntax [l+20], [l*1.2]
143
+ // number: digits with optional decimal, optional % (only valid for l/c/a with +/-)
144
+ const re = /([lchaLHCA])([+\-*/pmPMxdXD]?)([0-9]*\.?[0-9]+%?)/g;
145
+
146
+ const ops: ParsedOp[] = [];
147
+ let consumedUpto = 0;
148
+
149
+ while (true) {
150
+ const m = re.exec(modifier);
151
+ if (!m) break;
152
+
153
+ // Ensure contiguous consumption (no gaps)
154
+ if (m.index !== consumedUpto) {
155
+ warn(
156
+ `[tailwindcss-color-modifiers] Ignoring invalid modifier "/${modifierRaw}" (parse gap at index ${consumedUpto}).`,
157
+ );
158
+ return null;
159
+ }
160
+
161
+ const channel = m[1].toLowerCase() as Channel;
162
+ // Interpret operation: map letter aliases to symbols
163
+ const rawOp = m[2].toLowerCase();
164
+ let operation: Operation;
165
+ if (rawOp === '-' || rawOp === 'm') {
166
+ operation = '-';
167
+ } else if (rawOp === '*' || rawOp === 'x') {
168
+ operation = '*';
169
+ } else if (rawOp === '/' || rawOp === 'd') {
170
+ operation = '/';
171
+ } else {
172
+ operation = '+'; // default: +, p, or empty
173
+ }
174
+ const numStr = m[3];
175
+
176
+ let value: number | null = null;
177
+ const isMultiplyOrDivide = operation === '*' || operation === '/';
178
+
179
+ if (channel === 'h') {
180
+ value = parseHueDegrees(numStr);
181
+ if (value == null) {
182
+ warn(
183
+ `[tailwindcss-color-modifiers] Ignoring invalid modifier "/${modifierRaw}" (invalid hue value "${numStr}").`,
184
+ );
185
+ return null;
186
+ }
187
+ } else if (isMultiplyOrDivide) {
188
+ // For multiply/divide, don't auto-scale - use raw number
189
+ // This allows lx1.2 to mean "L * 1.2", not "L * 0.012"
190
+ const trimmed = numStr.trim();
191
+ if (trimmed.endsWith('%')) {
192
+ warn(
193
+ `[tailwindcss-color-modifiers] Ignoring invalid modifier "/${modifierRaw}" (% not allowed with multiply/divide).`,
194
+ );
195
+ return null;
196
+ }
197
+ if (!/^[0-9]*\.?[0-9]+$/.test(trimmed)) {
198
+ warn(
199
+ `[tailwindcss-color-modifiers] Ignoring invalid modifier "/${modifierRaw}" (invalid ${channel.toUpperCase()} value "${numStr}").`,
200
+ );
201
+ return null;
202
+ }
203
+ value = Number(trimmed);
204
+ if (!Number.isFinite(value)) {
205
+ warn(
206
+ `[tailwindcss-color-modifiers] Ignoring invalid modifier "/${modifierRaw}" (invalid ${channel.toUpperCase()} value "${numStr}").`,
207
+ );
208
+ return null;
209
+ }
210
+ } else {
211
+ value = parseScaledLca(numStr);
212
+ if (value == null) {
213
+ warn(
214
+ `[tailwindcss-color-modifiers] Ignoring invalid modifier "/${modifierRaw}" (invalid ${channel.toUpperCase()} value "${numStr}").`,
215
+ );
216
+ return null;
217
+ }
218
+ }
219
+
220
+ ops.push({
221
+ channel,
222
+ operation,
223
+ raw: m[0],
224
+ value,
225
+ });
226
+
227
+ consumedUpto = re.lastIndex;
228
+ }
229
+
230
+ // Must consume the entire string and must have at least one op
231
+ if (ops.length === 0 || consumedUpto !== modifier.length) {
232
+ warn(
233
+ `[tailwindcss-color-modifiers] Ignoring invalid modifier "/${modifierRaw}" (could not fully parse).`,
234
+ );
235
+ return null;
236
+ }
237
+
238
+ return {
239
+ ops,
240
+ hasAlphaOp: ops.some((o) => o.channel === 'a'),
241
+ };
242
+ }
243
+
244
+ type CalcTerm = { operation: Operation; value: string };
245
+
246
+ function buildCalc(base: string, terms: CalcTerm[]): string {
247
+ if (terms.length === 0) return base;
248
+
249
+ // Group terms by operation type for cleaner output
250
+ // Add/subtract can be chained: calc(L + 0.1 - 0.05)
251
+ // Multiply/divide need separate calc or nested: calc(L * 1.2)
252
+ // For simplicity, we'll build nested calcs for mixed operations
253
+ // or single calc for same-type operations
254
+
255
+ // If all operations are the same type and are +/-, we can chain them
256
+ const allAddSub = terms.every(
257
+ (t) => t.operation === '+' || t.operation === '-',
258
+ );
259
+ if (allAddSub) {
260
+ const parts = terms.map((t) => `${t.operation} ${t.value}`);
261
+ return `calc(${base} ${parts.join(' ')})`;
262
+ }
263
+
264
+ // For multiply/divide or mixed operations, apply them sequentially
265
+ // Each operation wraps the previous result
266
+ let result = base;
267
+ for (const term of terms) {
268
+ result = `calc(${result} ${term.operation} ${term.value})`;
269
+ }
270
+ return result;
271
+ }
272
+
273
+ function buildOklchFrom(baseColor: string, parsed: ParsedModifier): string {
274
+ const lTerms: CalcTerm[] = [];
275
+ const cTerms: CalcTerm[] = [];
276
+ const hTerms: CalcTerm[] = [];
277
+ const aTerms: CalcTerm[] = [];
278
+
279
+ for (const op of parsed.ops) {
280
+ const term: CalcTerm = { operation: op.operation, value: String(op.value) };
281
+ if (op.channel === 'l') lTerms.push(term);
282
+ if (op.channel === 'c') cTerms.push(term);
283
+ if (op.channel === 'h') hTerms.push(term); // h is unitless degrees in oklch relative syntax
284
+ if (op.channel === 'a') aTerms.push(term);
285
+ }
286
+
287
+ const L = buildCalc('L', lTerms);
288
+ const C = buildCalc('C', cTerms);
289
+ const H = buildCalc('h', hTerms);
290
+
291
+ // Preserve alpha by default
292
+ const A = aTerms.length === 0 ? 'alpha' : buildCalc('alpha', aTerms);
293
+
294
+ return `oklch(from ${baseColor} ${L} ${C} ${H} / ${A})`;
295
+ }
296
+
297
+ function makeWarnFn(enabled: boolean): (msg: string) => void {
298
+ if (!enabled) return () => {};
299
+ return (msg: string) => {
300
+ // eslint-disable-next-line no-console
301
+ console.warn(msg);
302
+ };
303
+ }
304
+
305
+ type Rule =
306
+ | 'backgroundColor'
307
+ | 'color'
308
+ | 'borderColor'
309
+ | 'outlineColor'
310
+ | 'caretColor'
311
+ | 'accentColor'
312
+ | 'fill'
313
+ | 'stroke'
314
+ | 'textDecorationColor'
315
+ | '--tw-ring-color'
316
+ | '--tw-ring-offset-color'
317
+ | '--tw-shadow-color'
318
+ | '--tw-gradient-from'
319
+ | '--tw-gradient-via'
320
+ | '--tw-gradient-to';
321
+
322
+ // Use plugin.withOptions for proper @plugin directive support in Tailwind v4
323
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
324
+ const colorModifiers: any = plugin.withOptions<ColorModifiersPluginOptions>(
325
+ (options = {}) =>
326
+ ({ matchUtilities, theme, addUtilities }) => {
327
+ const warn = makeWarnFn(!!options.warn);
328
+ const colors = flattenColors(theme('colors'));
329
+ const colorKeys = Object.keys(colors);
330
+
331
+ // Build semantic color variable mapping for --cm-bg-color and --cm-text-color
332
+ // This uses var(--color-{key}) format to preserve theme-aware values
333
+ const semanticBgColorUtilities: Record<
334
+ string,
335
+ Record<string, string>
336
+ > = {};
337
+ const semanticTextColorUtilities: Record<
338
+ string,
339
+ Record<string, string>
340
+ > = {};
341
+
342
+ // Also build semantic colors for matchUtilities (used with modifiers)
343
+ // Maps color keys to semantic var(--color-{key}) format
344
+ const semanticColors: Record<string, string> = {};
345
+
346
+ for (const key of colorKeys) {
347
+ const value = colors[key];
348
+
349
+ // Use var(--color-{key}) for:
350
+ // 1. Existing var() references
351
+ // 2. color-mix() expressions (need runtime evaluation for dark mode)
352
+ // For everything else (hex, oklch, rgb, etc.), use the value as-is
353
+ // so Tailwind can process it normally
354
+ const needsVarReference =
355
+ value.startsWith('var(') || value.startsWith('color-mix(');
356
+
357
+ const semanticVar = needsVarReference ? `var(--color-${key})` : value;
358
+
359
+ semanticBgColorUtilities[`.bg-${key}`] = {
360
+ '--cm-bg-color': semanticVar,
361
+ };
362
+
363
+ semanticTextColorUtilities[`.text-${key}`] = {
364
+ '--cm-text-color': semanticVar,
365
+ };
366
+
367
+ semanticColors[key] = semanticVar;
368
+ }
369
+
370
+ // Add --cm-bg-color and --cm-text-color utilities that use semantic variable names
371
+ addUtilities(semanticBgColorUtilities);
372
+ addUtilities(semanticTextColorUtilities);
373
+
374
+ /**
375
+ * Extract the actual color from a value that may be wrapped in color-mix().
376
+ * In Tailwind v4, when using arbitrary modifiers like [l+2], the value comes
377
+ * preprocessed as: color-mix(in <colorspace>, <color> <modifier-or-percent>, <fallback>)
378
+ * We need to extract <color> to use with our oklch(from ...) syntax.
379
+ *
380
+ * This implementation is intentionally lenient to handle variations in:
381
+ * - Color space (oklab, oklch, srgb, etc.)
382
+ * - Trailing percentages or modifier strings
383
+ * - Spacing variations
384
+ *
385
+ * @param value The value from Tailwind (may be wrapped in color-mix)
386
+ */
387
+ function extractColorFromValue(value: string): string | null {
388
+ // Check if value is wrapped in color-mix()
389
+ // Format: color-mix(in <colorspace>, <first-arg>, <second-arg>)
390
+ const colorMixMatch = value.match(
391
+ /^color-mix\(\s*in\s+\w+\s*,\s*(.+?)\s*,\s*.+\)$/,
392
+ );
393
+
394
+ if (colorMixMatch) {
395
+ const firstArg = colorMixMatch[1].trim();
396
+
397
+ // The first argument is "<color> <percentage-or-modifier>"
398
+ // We need to extract just the color part.
399
+ // Colors can be: #hex, rgb(...), oklch(...), color names, css vars, etc.
400
+
401
+ // Strategy: find the last space-separated token that looks like a
402
+ // modifier/percentage and remove it. Otherwise return as-is.
403
+
404
+ // Handle oklch(...) or rgb(...) etc. by finding matching parens
405
+ if (/^(?:oklch|rgb|hsl|lab|lch|color)\s*\(/.test(firstArg)) {
406
+ // Find the closing paren of the color function
407
+ let depth = 0;
408
+ let colorEnd = 0;
409
+ for (let i = 0; i < firstArg.length; i++) {
410
+ if (firstArg[i] === '(') depth++;
411
+ if (firstArg[i] === ')') {
412
+ depth--;
413
+ if (depth === 0) {
414
+ colorEnd = i + 1;
415
+ break;
416
+ }
417
+ }
418
+ }
419
+ if (colorEnd > 0) return firstArg.slice(0, colorEnd).trim();
420
+ }
421
+
422
+ // Handle hex colors or simple color names: strip trailing tokens
423
+ // e.g., "#86efac l+2" -> "#86efac", "#000 50%" -> "#000"
424
+ const parts = firstArg.split(/\s+/);
425
+ if (parts.length > 1) {
426
+ // Remove the last part (modifier or percentage)
427
+ parts.pop();
428
+ return parts.join(' ');
429
+ }
430
+
431
+ return firstArg;
432
+ }
433
+
434
+ // Return as-is if not wrapped in color-mix
435
+ return value;
436
+ }
437
+
438
+ function buildRule(property: Rule) {
439
+ return (
440
+ value: string,
441
+ ctx: { modifier: string | null },
442
+ ): Record<string, string> => {
443
+ const modifier = ctx.modifier;
444
+ if (!modifier) return {};
445
+
446
+ const parsed = parseModifier(modifier, warn);
447
+ if (!parsed) return {};
448
+
449
+ // Extract the actual color from v4's color-mix() wrapper
450
+ const actualColor = extractColorFromValue(value);
451
+ if (!actualColor) {
452
+ warn(
453
+ `[tailwindcss-color-modifiers] Could not extract color from value: ${value}`,
454
+ );
455
+ return {};
456
+ }
457
+
458
+ const adjusted = buildOklchFrom(actualColor, parsed);
459
+
460
+ // For backgroundColor, also emit --cm-bg-color for derived utilities
461
+ if (property === 'backgroundColor')
462
+ return {
463
+ '--cm-bg-color': actualColor,
464
+ [property]: adjusted,
465
+ };
466
+
467
+ // For text color, also emit --cm-text-color for derived utilities
468
+ if (property === 'color')
469
+ return {
470
+ '--cm-text-color': actualColor,
471
+ [property]: adjusted,
472
+ };
473
+
474
+ return { [property]: adjusted };
475
+ };
476
+ }
477
+
478
+ // Core
479
+ // Note: modifiers: 'any' enables modifier support (e.g., bg-red-500/l+2)
480
+ // For bg WITHOUT modifier: --cm-bg-color is handled by addUtilities above with semantic vars
481
+ // For bg WITH modifier: we handle the color transformation here using semantic colors
482
+ matchUtilities(
483
+ {
484
+ bg: (value: string, ctx: { modifier: string | null }) => {
485
+ // Only process if there's a modifier (color transformation)
486
+ // Without modifier, let Tailwind core handle bg and our addUtilities handle --cm-bg-color
487
+ if (!ctx.modifier) {
488
+ return {};
489
+ }
490
+ return buildRule('backgroundColor')(value, ctx);
491
+ },
492
+ },
493
+ { values: semanticColors, type: ['color'], modifiers: 'any' },
494
+ );
495
+ matchUtilities(
496
+ {
497
+ text: (value: string, ctx: { modifier: string | null }) => {
498
+ // Only process if there's a modifier (color transformation)
499
+ // Without modifier, let Tailwind core handle text and our addUtilities handle --cm-text-color
500
+ if (!ctx.modifier) return {};
501
+
502
+ return buildRule('color')(value, ctx);
503
+ },
504
+ },
505
+ { values: semanticColors, type: ['color'], modifiers: 'any' },
506
+ );
507
+ matchUtilities(
508
+ { border: buildRule('borderColor') },
509
+ { values: semanticColors, type: ['color'], modifiers: 'any' },
510
+ );
511
+ matchUtilities(
512
+ { ring: buildRule('--tw-ring-color') },
513
+ { values: semanticColors, type: ['color'], modifiers: 'any' },
514
+ );
515
+
516
+ // Additional common color utilities
517
+ matchUtilities(
518
+ { outline: buildRule('outlineColor') },
519
+ { values: semanticColors, type: ['color'], modifiers: 'any' },
520
+ );
521
+ matchUtilities(
522
+ { 'ring-offset': buildRule('--tw-ring-offset-color') },
523
+ { values: semanticColors, type: ['color'], modifiers: 'any' },
524
+ );
525
+
526
+ // Shadow color utility (Tailwind uses a var pipeline; setting --tw-shadow-color is enough)
527
+ matchUtilities(
528
+ { shadow: buildRule('--tw-shadow-color') },
529
+ { values: semanticColors, type: ['color'], modifiers: 'any' },
530
+ );
531
+
532
+ // Text decoration color
533
+ matchUtilities(
534
+ { decoration: buildRule('textDecorationColor') },
535
+ { values: semanticColors, type: ['color'], modifiers: 'any' },
536
+ );
537
+
538
+ // Form/UI related
539
+ matchUtilities(
540
+ { caret: buildRule('caretColor') },
541
+ { values: semanticColors, type: ['color'], modifiers: 'any' },
542
+ );
543
+ matchUtilities(
544
+ { accent: buildRule('accentColor') },
545
+ { values: semanticColors, type: ['color'], modifiers: 'any' },
546
+ );
547
+
548
+ // SVG
549
+ matchUtilities(
550
+ { fill: buildRule('fill') },
551
+ { values: semanticColors, type: ['color'], modifiers: 'any' },
552
+ );
553
+ matchUtilities(
554
+ { stroke: buildRule('stroke') },
555
+ { values: semanticColors, type: ['color'], modifiers: 'any' },
556
+ );
557
+
558
+ // Gradient stops
559
+ // Tailwind expects these CSS variables for gradient stops; emitting them preserves composition
560
+ matchUtilities(
561
+ { from: buildRule('--tw-gradient-from') },
562
+ { values: semanticColors, type: ['color'], modifiers: 'any' },
563
+ );
564
+ matchUtilities(
565
+ { via: buildRule('--tw-gradient-via') },
566
+ { values: semanticColors, type: ['color'], modifiers: 'any' },
567
+ );
568
+ matchUtilities(
569
+ { to: buildRule('--tw-gradient-to') },
570
+ { values: semanticColors, type: ['color'], modifiers: 'any' },
571
+ );
572
+
573
+ // Process custom utilities from extend option
574
+ if (options.extend) {
575
+ for (const [utilityPrefix, cssVariable] of Object.entries(
576
+ options.extend,
577
+ )) {
578
+ matchUtilities(
579
+ {
580
+ [utilityPrefix]: (
581
+ value: string,
582
+ ctx: { modifier: string | null },
583
+ ) => {
584
+ // Only handle modifier case - base utility handled by user's @utility
585
+ if (!ctx.modifier) return {};
586
+
587
+ const parsed = parseModifier(ctx.modifier, warn);
588
+ if (!parsed) return {};
589
+
590
+ const actualColor = extractColorFromValue(value);
591
+ if (!actualColor) {
592
+ warn(
593
+ `[tailwindcss-color-modifiers] Could not extract color from value: ${value}`,
594
+ );
595
+ return {};
596
+ }
597
+
598
+ const adjusted = buildOklchFrom(actualColor, parsed);
599
+ return { [cssVariable]: adjusted };
600
+ },
601
+ },
602
+ { values: semanticColors, type: ['color'], modifiers: 'any' },
603
+ );
604
+ }
605
+ }
606
+ },
607
+ );
608
+
609
+ export default colorModifiers;
610
+
611
+ export const __test__ = { parseModifier, buildOklchFrom, normalizeModifier };
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Shared animations and animation utilities
3
+ * Only includes animations actively used by components.
4
+ */
5
+
6
+ @theme default {
7
+ /* Caret blink for text inputs (input-otp) */
8
+ --animate-caret-blink: caret-blink 1.25s ease-out infinite;
9
+ @keyframes caret-blink {
10
+ 0%,
11
+ 70%,
12
+ 100% {
13
+ opacity: 1;
14
+ }
15
+ 20%,
16
+ 50% {
17
+ opacity: 0;
18
+ }
19
+ }
20
+
21
+ /* Switch knob morph — stretches the knob into a pill shape at the
22
+ midpoint of its travel, then settles back to round. Animates `width`
23
+ (not `scale`) so border-radius: 9999px produces semicircular ends
24
+ (stadium shape) instead of an ellipse.
25
+ `transform` counteracts the instant `translate` jump from the
26
+ data-checked class so the thumb stays visually pinned during phase 1.
27
+ Two separate keyframe names so the browser re-triggers the
28
+ animation when toggling between checked and unchecked. */
29
+ --animate-switch-knob-on: switch-knob-on 150ms ease-out backwards;
30
+ --animate-switch-knob-off: switch-knob-off 150ms ease-out backwards;
31
+ @keyframes switch-knob-on {
32
+ 0% {
33
+ width: var(--knob-w);
34
+ transform: translateX(calc(-1 * var(--knob-travel)));
35
+ }
36
+ 50% {
37
+ width: var(--track-w);
38
+ transform: translateX(calc(-1 * var(--knob-travel)));
39
+ }
40
+ 100% {
41
+ width: var(--knob-w);
42
+ transform: translateX(0);
43
+ }
44
+ }
45
+ @keyframes switch-knob-off {
46
+ 0% {
47
+ width: var(--knob-w);
48
+ transform: translateX(var(--knob-travel));
49
+ }
50
+ 50% {
51
+ width: var(--track-w);
52
+ transform: translateX(0);
53
+ }
54
+ 100% {
55
+ width: var(--knob-w);
56
+ transform: translateX(0);
57
+ }
58
+ }
59
+ }