@finhay-pro/leaf-design-system 0.2.3 → 0.2.5

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 (722) hide show
  1. package/README.md +466 -182
  2. package/dist/accordion.css +142 -0
  3. package/dist/avatar.css +168 -0
  4. package/dist/badge.css +193 -0
  5. package/dist/breadcrumb.css +105 -0
  6. package/dist/button.css +221 -0
  7. package/dist/calendar.css +487 -0
  8. package/dist/carousel.css +165 -0
  9. package/dist/cdn/leaf-0.2.5.min.css +2 -0
  10. package/dist/cdn/leaf-0.2.5.min.js +177 -0
  11. package/dist/checkbox.css +140 -0
  12. package/dist/classes.css +7959 -0
  13. package/dist/color.css +260 -0
  14. package/dist/components/Accordion/Accordion.d.ts +43 -0
  15. package/dist/components/Accordion/Accordion.d.ts.map +1 -0
  16. package/dist/components/Accordion/Accordion.js +37 -0
  17. package/dist/components/Accordion/Accordion.js.map +1 -0
  18. package/dist/components/Accordion/index.d.ts +2 -0
  19. package/dist/components/Accordion/index.d.ts.map +1 -0
  20. package/dist/components/Accordion/index.js +2 -0
  21. package/dist/components/Accordion/index.js.map +1 -0
  22. package/dist/components/Avatar/Avatar.d.ts +32 -0
  23. package/dist/components/Avatar/Avatar.d.ts.map +1 -0
  24. package/dist/components/Avatar/Avatar.js +20 -0
  25. package/dist/components/Avatar/Avatar.js.map +1 -0
  26. package/dist/components/Avatar/index.d.ts +2 -0
  27. package/dist/components/Avatar/index.d.ts.map +1 -0
  28. package/dist/components/Avatar/index.js +2 -0
  29. package/dist/components/Avatar/index.js.map +1 -0
  30. package/dist/components/Badge/Badge.d.ts +44 -0
  31. package/dist/components/Badge/Badge.d.ts.map +1 -0
  32. package/dist/components/Badge/Badge.js +21 -0
  33. package/dist/components/Badge/Badge.js.map +1 -0
  34. package/dist/components/Badge/index.d.ts +2 -0
  35. package/dist/components/Badge/index.d.ts.map +1 -0
  36. package/dist/components/Badge/index.js +2 -0
  37. package/dist/components/Badge/index.js.map +1 -0
  38. package/dist/components/Breadcrumb/Breadcrumb.d.ts +33 -0
  39. package/dist/components/Breadcrumb/Breadcrumb.d.ts.map +1 -0
  40. package/dist/components/Breadcrumb/Breadcrumb.js +60 -0
  41. package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -0
  42. package/dist/components/Breadcrumb/index.d.ts +2 -0
  43. package/dist/components/Breadcrumb/index.d.ts.map +1 -0
  44. package/dist/components/Breadcrumb/index.js +2 -0
  45. package/dist/components/Breadcrumb/index.js.map +1 -0
  46. package/dist/components/Button/Button.js +1 -1
  47. package/dist/components/Calendar/Calendar.js +1 -1
  48. package/dist/components/CalendarRange/CalendarRange.d.ts +41 -0
  49. package/dist/components/CalendarRange/CalendarRange.d.ts.map +1 -0
  50. package/dist/components/CalendarRange/CalendarRange.js +74 -0
  51. package/dist/components/CalendarRange/CalendarRange.js.map +1 -0
  52. package/dist/components/CalendarRange/index.d.ts +2 -0
  53. package/dist/components/CalendarRange/index.d.ts.map +1 -0
  54. package/dist/components/CalendarRange/index.js +2 -0
  55. package/dist/components/CalendarRange/index.js.map +1 -0
  56. package/dist/components/Carousel/Carousel.d.ts +23 -3
  57. package/dist/components/Carousel/Carousel.d.ts.map +1 -1
  58. package/dist/components/Carousel/Carousel.js +30 -8
  59. package/dist/components/Carousel/Carousel.js.map +1 -1
  60. package/dist/components/Date/Date.d.ts +1 -1
  61. package/dist/components/Date/Date.d.ts.map +1 -1
  62. package/dist/components/Date/Date.js +2 -2
  63. package/dist/components/Date/Date.js.map +1 -1
  64. package/dist/components/Dialog/Dialog.d.ts +36 -3
  65. package/dist/components/Dialog/Dialog.d.ts.map +1 -1
  66. package/dist/components/Dialog/Dialog.js +42 -7
  67. package/dist/components/Dialog/Dialog.js.map +1 -1
  68. package/dist/components/Dialog/Drawer.d.ts +18 -0
  69. package/dist/components/Dialog/Drawer.d.ts.map +1 -0
  70. package/dist/components/Dialog/Drawer.js +12 -0
  71. package/dist/components/Dialog/Drawer.js.map +1 -0
  72. package/dist/components/Dialog/index.d.ts +2 -1
  73. package/dist/components/Dialog/index.d.ts.map +1 -1
  74. package/dist/components/Dialog/index.js +2 -1
  75. package/dist/components/Dialog/index.js.map +1 -1
  76. package/dist/components/Dropdown/Dropdown.d.ts +15 -1
  77. package/dist/components/Dropdown/Dropdown.d.ts.map +1 -1
  78. package/dist/components/Dropdown/Dropdown.js +106 -20
  79. package/dist/components/Dropdown/Dropdown.js.map +1 -1
  80. package/dist/components/FileViewer/FileViewer.d.ts +3 -1
  81. package/dist/components/FileViewer/FileViewer.d.ts.map +1 -1
  82. package/dist/components/FileViewer/FileViewer.js +2 -1
  83. package/dist/components/FileViewer/FileViewer.js.map +1 -1
  84. package/dist/components/Form/DynamicForm.js +1 -1
  85. package/dist/components/Form/Form.js +1 -1
  86. package/dist/components/Input/Input.d.ts.map +1 -1
  87. package/dist/components/Input/Input.js +3 -1
  88. package/dist/components/Input/Input.js.map +1 -1
  89. package/dist/components/Input/InputDate.d.ts +6 -1
  90. package/dist/components/Input/InputDate.d.ts.map +1 -1
  91. package/dist/components/Input/InputDate.js +36 -11
  92. package/dist/components/Input/InputDate.js.map +1 -1
  93. package/dist/components/Input/InputDateRange.d.ts +43 -0
  94. package/dist/components/Input/InputDateRange.d.ts.map +1 -0
  95. package/dist/components/Input/InputDateRange.js +86 -0
  96. package/dist/components/Input/InputDateRange.js.map +1 -0
  97. package/dist/components/Input/InputNumber.d.ts +28 -0
  98. package/dist/components/Input/InputNumber.d.ts.map +1 -0
  99. package/dist/components/Input/InputNumber.js +58 -0
  100. package/dist/components/Input/InputNumber.js.map +1 -0
  101. package/dist/components/Input/InputOtp.d.ts.map +1 -1
  102. package/dist/components/Input/InputOtp.js +2 -2
  103. package/dist/components/Input/InputOtp.js.map +1 -1
  104. package/dist/components/Input/InputStepper.d.ts +3 -1
  105. package/dist/components/Input/InputStepper.d.ts.map +1 -1
  106. package/dist/components/Input/InputStepper.js +32 -5
  107. package/dist/components/Input/InputStepper.js.map +1 -1
  108. package/dist/components/Input/index.d.ts +2 -0
  109. package/dist/components/Input/index.d.ts.map +1 -1
  110. package/dist/components/Input/index.js +2 -0
  111. package/dist/components/Input/index.js.map +1 -1
  112. package/dist/components/Menu/Menu.d.ts +69 -0
  113. package/dist/components/Menu/Menu.d.ts.map +1 -0
  114. package/dist/components/Menu/Menu.js +140 -0
  115. package/dist/components/Menu/Menu.js.map +1 -0
  116. package/dist/components/Menu/index.d.ts +2 -0
  117. package/dist/components/Menu/index.d.ts.map +1 -0
  118. package/dist/components/Menu/index.js +2 -0
  119. package/dist/components/Menu/index.js.map +1 -0
  120. package/dist/components/MultiSelect/MultiSelect.d.ts +6 -1
  121. package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
  122. package/dist/components/MultiSelect/MultiSelect.js +42 -23
  123. package/dist/components/MultiSelect/MultiSelect.js.map +1 -1
  124. package/dist/components/Number/Number.d.ts +4 -2
  125. package/dist/components/Number/Number.d.ts.map +1 -1
  126. package/dist/components/Number/Number.js +3 -1
  127. package/dist/components/Number/Number.js.map +1 -1
  128. package/dist/components/Pagination/Pagination.d.ts +35 -0
  129. package/dist/components/Pagination/Pagination.d.ts.map +1 -0
  130. package/dist/components/Pagination/Pagination.js +40 -0
  131. package/dist/components/Pagination/Pagination.js.map +1 -0
  132. package/dist/components/Pagination/index.d.ts +2 -0
  133. package/dist/components/Pagination/index.d.ts.map +1 -0
  134. package/dist/components/Pagination/index.js +2 -0
  135. package/dist/components/Pagination/index.js.map +1 -0
  136. package/dist/components/Popover/Popover.d.ts +51 -0
  137. package/dist/components/Popover/Popover.d.ts.map +1 -0
  138. package/dist/components/Popover/Popover.js +83 -0
  139. package/dist/components/Popover/Popover.js.map +1 -0
  140. package/dist/components/Popover/index.d.ts +2 -0
  141. package/dist/components/Popover/index.d.ts.map +1 -0
  142. package/dist/components/Popover/index.js +2 -0
  143. package/dist/components/Popover/index.js.map +1 -0
  144. package/dist/components/Progress/Progress.d.ts +30 -0
  145. package/dist/components/Progress/Progress.d.ts.map +1 -0
  146. package/dist/components/Progress/Progress.js +17 -0
  147. package/dist/components/Progress/Progress.js.map +1 -0
  148. package/dist/components/Progress/index.d.ts +2 -0
  149. package/dist/components/Progress/index.d.ts.map +1 -0
  150. package/dist/components/Progress/index.js +2 -0
  151. package/dist/components/Progress/index.js.map +1 -0
  152. package/dist/components/SafeHtml/SafeHtml.d.ts +326 -0
  153. package/dist/components/SafeHtml/SafeHtml.d.ts.map +1 -0
  154. package/dist/components/SafeHtml/SafeHtml.js +44 -0
  155. package/dist/components/SafeHtml/SafeHtml.js.map +1 -0
  156. package/dist/components/SafeHtml/index.d.ts +2 -0
  157. package/dist/components/SafeHtml/index.d.ts.map +1 -0
  158. package/dist/components/SafeHtml/index.js +2 -0
  159. package/dist/components/SafeHtml/index.js.map +1 -0
  160. package/dist/components/Sidebar/Sidebar.d.ts +50 -0
  161. package/dist/components/Sidebar/Sidebar.d.ts.map +1 -0
  162. package/dist/components/Sidebar/Sidebar.js +71 -0
  163. package/dist/components/Sidebar/Sidebar.js.map +1 -0
  164. package/dist/components/Sidebar/index.d.ts +2 -0
  165. package/dist/components/Sidebar/index.d.ts.map +1 -0
  166. package/dist/components/Sidebar/index.js +2 -0
  167. package/dist/components/Sidebar/index.js.map +1 -0
  168. package/dist/components/Slider/Slider.js +1 -4
  169. package/dist/components/Slider/Slider.js.map +1 -1
  170. package/dist/components/Spinner/Spinner.js +1 -1
  171. package/dist/components/Steps/Steps.d.ts +30 -0
  172. package/dist/components/Steps/Steps.d.ts.map +1 -0
  173. package/dist/components/Steps/Steps.js +26 -0
  174. package/dist/components/Steps/Steps.js.map +1 -0
  175. package/dist/components/Steps/index.d.ts +2 -0
  176. package/dist/components/Steps/index.d.ts.map +1 -0
  177. package/dist/components/Steps/index.js +2 -0
  178. package/dist/components/Steps/index.js.map +1 -0
  179. package/dist/components/Table/Table.d.ts +61 -3
  180. package/dist/components/Table/Table.d.ts.map +1 -1
  181. package/dist/components/Table/Table.js +176 -33
  182. package/dist/components/Table/Table.js.map +1 -1
  183. package/dist/components/Table/TableHeader.d.ts +8 -3
  184. package/dist/components/Table/TableHeader.d.ts.map +1 -1
  185. package/dist/components/Table/TableHeader.js +7 -5
  186. package/dist/components/Table/TableHeader.js.map +1 -1
  187. package/dist/components/Table/TableRow.d.ts +5 -1
  188. package/dist/components/Table/TableRow.d.ts.map +1 -1
  189. package/dist/components/Table/TableRow.js +2 -2
  190. package/dist/components/Table/TableRow.js.map +1 -1
  191. package/dist/components/Table/index.d.ts +1 -1
  192. package/dist/components/Table/index.d.ts.map +1 -1
  193. package/dist/components/Table/index.js +1 -1
  194. package/dist/components/Table/index.js.map +1 -1
  195. package/dist/components/Tabs/Tabs.d.ts +6 -1
  196. package/dist/components/Tabs/Tabs.d.ts.map +1 -1
  197. package/dist/components/Tabs/Tabs.js +2 -2
  198. package/dist/components/Tabs/Tabs.js.map +1 -1
  199. package/dist/components/Toast/Toast.d.ts +8 -4
  200. package/dist/components/Toast/Toast.d.ts.map +1 -1
  201. package/dist/components/Toast/Toast.js +15 -4
  202. package/dist/components/Toast/Toast.js.map +1 -1
  203. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
  204. package/dist/components/Tooltip/Tooltip.js +5 -2
  205. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  206. package/dist/components/VirtualList/VirtualList.d.ts +39 -0
  207. package/dist/components/VirtualList/VirtualList.d.ts.map +1 -0
  208. package/dist/components/VirtualList/VirtualList.js +113 -0
  209. package/dist/components/VirtualList/VirtualList.js.map +1 -0
  210. package/dist/components/VirtualList/index.d.ts +2 -0
  211. package/dist/components/VirtualList/index.d.ts.map +1 -0
  212. package/dist/components/VirtualList/index.js +2 -0
  213. package/dist/components/VirtualList/index.js.map +1 -0
  214. package/dist/core/accordion.d.ts +15 -0
  215. package/dist/core/accordion.d.ts.map +1 -0
  216. package/dist/core/accordion.js +37 -0
  217. package/dist/core/accordion.js.map +1 -0
  218. package/dist/core/avatar.d.ts +4 -0
  219. package/dist/core/avatar.d.ts.map +1 -0
  220. package/dist/core/avatar.js +12 -0
  221. package/dist/core/avatar.js.map +1 -0
  222. package/dist/core/calendar.d.ts +1 -2
  223. package/dist/core/calendar.d.ts.map +1 -1
  224. package/dist/core/calendar.js +2 -10
  225. package/dist/core/calendar.js.map +1 -1
  226. package/dist/core/carousel.d.ts +8 -0
  227. package/dist/core/carousel.d.ts.map +1 -1
  228. package/dist/core/carousel.js +27 -0
  229. package/dist/core/carousel.js.map +1 -1
  230. package/dist/core/css-gradient.d.ts +21 -0
  231. package/dist/core/css-gradient.d.ts.map +1 -0
  232. package/dist/core/css-gradient.js +54 -0
  233. package/dist/core/css-gradient.js.map +1 -0
  234. package/dist/core/date-math.d.ts +39 -0
  235. package/dist/core/date-math.d.ts.map +1 -0
  236. package/dist/core/date-math.js +82 -0
  237. package/dist/core/date-math.js.map +1 -0
  238. package/dist/core/date-range.d.ts +44 -0
  239. package/dist/core/date-range.d.ts.map +1 -0
  240. package/dist/core/date-range.js +88 -0
  241. package/dist/core/date-range.js.map +1 -0
  242. package/dist/core/date.d.ts +23 -4
  243. package/dist/core/date.d.ts.map +1 -1
  244. package/dist/core/date.js +114 -4
  245. package/dist/core/date.js.map +1 -1
  246. package/dist/core/dialog.d.ts +43 -5
  247. package/dist/core/dialog.d.ts.map +1 -1
  248. package/dist/core/dialog.js +85 -8
  249. package/dist/core/dialog.js.map +1 -1
  250. package/dist/core/file/csv.d.ts +10 -0
  251. package/dist/core/file/csv.d.ts.map +1 -1
  252. package/dist/core/file/csv.js +26 -3
  253. package/dist/core/file/csv.js.map +1 -1
  254. package/dist/core/file/detect.js.map +1 -1
  255. package/dist/core/file/docx-render.js.map +1 -1
  256. package/dist/core/file/docx.js.map +1 -1
  257. package/dist/core/file/dom.d.ts +1 -1
  258. package/dist/core/file/dom.d.ts.map +1 -1
  259. package/dist/core/file/dom.js +3 -3
  260. package/dist/core/file/dom.js.map +1 -1
  261. package/dist/core/file/download.d.ts +5 -0
  262. package/dist/core/file/download.d.ts.map +1 -1
  263. package/dist/core/file/download.js +10 -3
  264. package/dist/core/file/download.js.map +1 -1
  265. package/dist/core/file/error.d.ts.map +1 -1
  266. package/dist/core/file/error.js.map +1 -1
  267. package/dist/core/file/source.d.ts +15 -1
  268. package/dist/core/file/source.d.ts.map +1 -1
  269. package/dist/core/file/source.js +99 -6
  270. package/dist/core/file/source.js.map +1 -1
  271. package/dist/core/file/text.js.map +1 -1
  272. package/dist/core/file/viewer.d.ts +2 -0
  273. package/dist/core/file/viewer.d.ts.map +1 -1
  274. package/dist/core/file/viewer.js +3 -2
  275. package/dist/core/file/viewer.js.map +1 -1
  276. package/dist/core/file/xlsx-format.js.map +1 -1
  277. package/dist/core/file/xlsx-write.js.map +1 -1
  278. package/dist/core/file/xlsx.d.ts.map +1 -1
  279. package/dist/core/file/xlsx.js +4 -3
  280. package/dist/core/file/xlsx.js.map +1 -1
  281. package/dist/core/file/xml.d.ts.map +1 -1
  282. package/dist/core/file/xml.js +5 -0
  283. package/dist/core/file/xml.js.map +1 -1
  284. package/dist/core/file/zip-write.js.map +1 -1
  285. package/dist/core/file/zip.js.map +1 -1
  286. package/dist/core/floating.d.ts +69 -0
  287. package/dist/core/floating.d.ts.map +1 -0
  288. package/dist/core/floating.js +185 -0
  289. package/dist/core/floating.js.map +1 -0
  290. package/dist/core/html/css.d.ts +32 -0
  291. package/dist/core/html/css.d.ts.map +1 -0
  292. package/dist/core/html/css.js +222 -0
  293. package/dist/core/html/css.js.map +1 -0
  294. package/dist/core/html/entities.d.ts +19 -0
  295. package/dist/core/html/entities.d.ts.map +1 -0
  296. package/dist/core/html/entities.js +167 -0
  297. package/dist/core/html/entities.js.map +1 -0
  298. package/dist/core/html/entity-data.d.ts +14 -0
  299. package/dist/core/html/entity-data.d.ts.map +1 -0
  300. package/dist/core/html/entity-data.js +14 -0
  301. package/dist/core/html/entity-data.js.map +1 -0
  302. package/dist/core/html/props.d.ts +9 -0
  303. package/dist/core/html/props.d.ts.map +1 -0
  304. package/dist/core/html/props.js +98 -0
  305. package/dist/core/html/props.js.map +1 -0
  306. package/dist/core/html/sanitize.d.ts +150 -0
  307. package/dist/core/html/sanitize.d.ts.map +1 -0
  308. package/dist/core/html/sanitize.js +800 -0
  309. package/dist/core/html/sanitize.js.map +1 -0
  310. package/dist/core/html/tokenizer.d.ts +33 -0
  311. package/dist/core/html/tokenizer.d.ts.map +1 -0
  312. package/dist/core/html/tokenizer.js +306 -0
  313. package/dist/core/html/tokenizer.js.map +1 -0
  314. package/dist/core/html/tree.d.ts +35 -0
  315. package/dist/core/html/tree.d.ts.map +1 -0
  316. package/dist/core/html/tree.js +253 -0
  317. package/dist/core/html/tree.js.map +1 -0
  318. package/dist/core/icons.d.ts +8 -3
  319. package/dist/core/icons.d.ts.map +1 -1
  320. package/dist/core/icons.js +20 -5
  321. package/dist/core/icons.js.map +1 -1
  322. package/dist/core/language.d.ts.map +1 -1
  323. package/dist/core/menu.d.ts +22 -0
  324. package/dist/core/menu.d.ts.map +1 -0
  325. package/dist/core/menu.js +69 -0
  326. package/dist/core/menu.js.map +1 -0
  327. package/dist/core/motion.d.ts +12 -0
  328. package/dist/core/motion.d.ts.map +1 -0
  329. package/dist/core/motion.js +17 -0
  330. package/dist/core/motion.js.map +1 -0
  331. package/dist/core/number-input.d.ts +29 -0
  332. package/dist/core/number-input.d.ts.map +1 -0
  333. package/dist/core/number-input.js +92 -0
  334. package/dist/core/number-input.js.map +1 -0
  335. package/dist/core/number.d.ts +14 -0
  336. package/dist/core/number.d.ts.map +1 -1
  337. package/dist/core/number.js +48 -2
  338. package/dist/core/number.js.map +1 -1
  339. package/dist/core/otp.d.ts +2 -0
  340. package/dist/core/otp.d.ts.map +1 -1
  341. package/dist/core/otp.js +4 -0
  342. package/dist/core/otp.js.map +1 -1
  343. package/dist/core/pacer.d.ts +63 -0
  344. package/dist/core/pacer.d.ts.map +1 -0
  345. package/dist/core/pacer.js +129 -0
  346. package/dist/core/pacer.js.map +1 -0
  347. package/dist/core/pagination.d.ts +44 -0
  348. package/dist/core/pagination.d.ts.map +1 -0
  349. package/dist/core/pagination.js +78 -0
  350. package/dist/core/pagination.js.map +1 -0
  351. package/dist/core/popover.d.ts +6 -0
  352. package/dist/core/popover.d.ts.map +1 -0
  353. package/dist/core/popover.js +6 -0
  354. package/dist/core/popover.js.map +1 -0
  355. package/dist/core/progress.d.ts +3 -0
  356. package/dist/core/progress.d.ts.map +1 -0
  357. package/dist/core/progress.js +8 -0
  358. package/dist/core/progress.js.map +1 -0
  359. package/dist/core/qr-code.d.ts +7 -0
  360. package/dist/core/qr-code.d.ts.map +1 -1
  361. package/dist/core/qr-code.js +15 -9
  362. package/dist/core/qr-code.js.map +1 -1
  363. package/dist/core/roving.d.ts +19 -0
  364. package/dist/core/roving.d.ts.map +1 -0
  365. package/dist/core/roving.js +54 -0
  366. package/dist/core/roving.js.map +1 -0
  367. package/dist/core/safe-url.d.ts +37 -0
  368. package/dist/core/safe-url.d.ts.map +1 -0
  369. package/dist/core/safe-url.js +68 -0
  370. package/dist/core/safe-url.js.map +1 -0
  371. package/dist/core/sheet.d.ts +19 -0
  372. package/dist/core/sheet.d.ts.map +1 -0
  373. package/dist/core/sheet.js +54 -0
  374. package/dist/core/sheet.js.map +1 -0
  375. package/dist/core/spinner.d.ts +2 -2
  376. package/dist/core/spinner.d.ts.map +1 -1
  377. package/dist/core/spinner.js +22 -4
  378. package/dist/core/spinner.js.map +1 -1
  379. package/dist/core/status.d.ts +20 -0
  380. package/dist/core/status.d.ts.map +1 -0
  381. package/dist/core/status.js +30 -0
  382. package/dist/core/status.js.map +1 -0
  383. package/dist/core/stepper.js.map +1 -1
  384. package/dist/core/table/attrs.d.ts +8 -2
  385. package/dist/core/table/attrs.d.ts.map +1 -1
  386. package/dist/core/table/attrs.js +12 -3
  387. package/dist/core/table/attrs.js.map +1 -1
  388. package/dist/core/table/columns.d.ts +17 -0
  389. package/dist/core/table/columns.d.ts.map +1 -1
  390. package/dist/core/table/columns.js.map +1 -1
  391. package/dist/core/table/features.d.ts +72 -0
  392. package/dist/core/table/features.d.ts.map +1 -0
  393. package/dist/core/table/features.js +198 -0
  394. package/dist/core/table/features.js.map +1 -0
  395. package/dist/core/table/index.d.ts +2 -0
  396. package/dist/core/table/index.d.ts.map +1 -1
  397. package/dist/core/table/index.js +2 -0
  398. package/dist/core/table/index.js.map +1 -1
  399. package/dist/core/table/reorder.d.ts +21 -0
  400. package/dist/core/table/reorder.d.ts.map +1 -0
  401. package/dist/core/table/reorder.js +70 -0
  402. package/dist/core/table/reorder.js.map +1 -0
  403. package/dist/core/table/virtual.d.ts +5 -18
  404. package/dist/core/table/virtual.d.ts.map +1 -1
  405. package/dist/core/table/virtual.js +4 -15
  406. package/dist/core/table/virtual.js.map +1 -1
  407. package/dist/core/tabs.d.ts.map +1 -1
  408. package/dist/core/tabs.js +2 -15
  409. package/dist/core/tabs.js.map +1 -1
  410. package/dist/core/toast.d.ts +15 -3
  411. package/dist/core/toast.d.ts.map +1 -1
  412. package/dist/core/toast.js +9 -6
  413. package/dist/core/toast.js.map +1 -1
  414. package/dist/core/tooltip.d.ts +8 -7
  415. package/dist/core/tooltip.d.ts.map +1 -1
  416. package/dist/core/tooltip.js +14 -119
  417. package/dist/core/tooltip.js.map +1 -1
  418. package/dist/core/upload.d.ts +1 -0
  419. package/dist/core/upload.d.ts.map +1 -1
  420. package/dist/core/upload.js +6 -0
  421. package/dist/core/upload.js.map +1 -1
  422. package/dist/core/virtual.d.ts +76 -0
  423. package/dist/core/virtual.d.ts.map +1 -0
  424. package/dist/core/virtual.js +214 -0
  425. package/dist/core/virtual.js.map +1 -0
  426. package/dist/date.css +19 -0
  427. package/dist/dialog.css +413 -0
  428. package/dist/dropdown.css +514 -0
  429. package/dist/empty.css +82 -0
  430. package/dist/file-viewer.css +519 -0
  431. package/dist/fn/async.d.ts +39 -0
  432. package/dist/fn/async.d.ts.map +1 -0
  433. package/dist/fn/async.js +91 -0
  434. package/dist/fn/async.js.map +1 -0
  435. package/dist/fn/clipboard.d.ts +6 -0
  436. package/dist/fn/clipboard.d.ts.map +1 -0
  437. package/dist/fn/clipboard.js +35 -0
  438. package/dist/fn/clipboard.js.map +1 -0
  439. package/dist/fn/cookie.d.ts +7 -0
  440. package/dist/fn/cookie.d.ts.map +1 -0
  441. package/dist/fn/cookie.js +22 -0
  442. package/dist/fn/cookie.js.map +1 -0
  443. package/dist/fn/error.d.ts +24 -0
  444. package/dist/fn/error.d.ts.map +1 -0
  445. package/dist/fn/error.js +50 -0
  446. package/dist/fn/error.js.map +1 -0
  447. package/dist/fn/html.d.ts +34 -0
  448. package/dist/fn/html.d.ts.map +1 -0
  449. package/dist/fn/html.js +60 -0
  450. package/dist/fn/html.js.map +1 -0
  451. package/dist/fn/index.d.ts +39 -0
  452. package/dist/fn/index.d.ts.map +1 -0
  453. package/dist/fn/index.js +40 -0
  454. package/dist/fn/index.js.map +1 -0
  455. package/dist/fn/jwt.d.ts +12 -0
  456. package/dist/fn/jwt.d.ts.map +1 -0
  457. package/dist/fn/jwt.js +42 -0
  458. package/dist/fn/jwt.js.map +1 -0
  459. package/dist/fn/locale.d.ts +20 -0
  460. package/dist/fn/locale.d.ts.map +1 -0
  461. package/dist/fn/locale.js +33 -0
  462. package/dist/fn/locale.js.map +1 -0
  463. package/dist/fn/query.d.ts +11 -0
  464. package/dist/fn/query.d.ts.map +1 -0
  465. package/dist/fn/query.js +41 -0
  466. package/dist/fn/query.js.map +1 -0
  467. package/dist/fn/sanitize.d.ts +15 -0
  468. package/dist/fn/sanitize.d.ts.map +1 -0
  469. package/dist/fn/sanitize.js +15 -0
  470. package/dist/fn/sanitize.js.map +1 -0
  471. package/dist/fn/storage.d.ts +13 -0
  472. package/dist/fn/storage.d.ts.map +1 -0
  473. package/dist/fn/storage.js +69 -0
  474. package/dist/fn/storage.js.map +1 -0
  475. package/dist/fn/string.d.ts +13 -0
  476. package/dist/fn/string.d.ts.map +1 -0
  477. package/dist/fn/string.js +30 -0
  478. package/dist/fn/string.js.map +1 -0
  479. package/dist/fn/url.d.ts +27 -0
  480. package/dist/fn/url.d.ts.map +1 -0
  481. package/dist/fn/url.js +71 -0
  482. package/dist/fn/url.js.map +1 -0
  483. package/dist/fn/version.d.ts +5 -0
  484. package/dist/fn/version.d.ts.map +1 -0
  485. package/dist/fn/version.js +23 -0
  486. package/dist/fn/version.js.map +1 -0
  487. package/dist/focus.css +18 -0
  488. package/dist/form.css +64 -0
  489. package/dist/hooks/index.d.ts +43 -0
  490. package/dist/hooks/index.d.ts.map +1 -0
  491. package/dist/hooks/index.js +43 -0
  492. package/dist/hooks/index.js.map +1 -0
  493. package/dist/hooks/useAsync.d.ts +17 -0
  494. package/dist/hooks/useAsync.d.ts.map +1 -0
  495. package/dist/hooks/useAsync.js +38 -0
  496. package/dist/hooks/useAsync.js.map +1 -0
  497. package/dist/hooks/useAsyncCallback.d.ts +26 -0
  498. package/dist/hooks/useAsyncCallback.d.ts.map +1 -0
  499. package/dist/hooks/useAsyncCallback.js +57 -0
  500. package/dist/hooks/useAsyncCallback.js.map +1 -0
  501. package/dist/hooks/useBatcher.d.ts +11 -0
  502. package/dist/hooks/useBatcher.d.ts.map +1 -0
  503. package/dist/hooks/useBatcher.js +16 -0
  504. package/dist/hooks/useBatcher.js.map +1 -0
  505. package/dist/hooks/useClickOutside.d.ts +12 -0
  506. package/dist/hooks/useClickOutside.d.ts.map +1 -0
  507. package/dist/hooks/useClickOutside.js +29 -0
  508. package/dist/hooks/useClickOutside.js.map +1 -0
  509. package/dist/hooks/useControllableState.d.ts +2 -0
  510. package/dist/hooks/useControllableState.d.ts.map +1 -0
  511. package/dist/hooks/useControllableState.js +3 -0
  512. package/dist/hooks/useControllableState.js.map +1 -0
  513. package/dist/hooks/useCopyToClipboard.d.ts +9 -0
  514. package/dist/hooks/useCopyToClipboard.d.ts.map +1 -0
  515. package/dist/hooks/useCopyToClipboard.js +23 -0
  516. package/dist/hooks/useCopyToClipboard.js.map +1 -0
  517. package/dist/hooks/useCountdown.d.ts +24 -0
  518. package/dist/hooks/useCountdown.d.ts.map +1 -0
  519. package/dist/hooks/useCountdown.js +59 -0
  520. package/dist/hooks/useCountdown.js.map +1 -0
  521. package/dist/hooks/useDebouncedCallback.d.ts +7 -0
  522. package/dist/hooks/useDebouncedCallback.d.ts.map +1 -0
  523. package/dist/hooks/useDebouncedCallback.js +15 -0
  524. package/dist/hooks/useDebouncedCallback.js.map +1 -0
  525. package/dist/hooks/useDebouncedValue.d.ts +4 -0
  526. package/dist/hooks/useDebouncedValue.d.ts.map +1 -0
  527. package/dist/hooks/useDebouncedValue.js +19 -0
  528. package/dist/hooks/useDebouncedValue.js.map +1 -0
  529. package/dist/hooks/useDisclosure.d.ts +21 -0
  530. package/dist/hooks/useDisclosure.d.ts.map +1 -0
  531. package/dist/hooks/useDisclosure.js +20 -0
  532. package/dist/hooks/useDisclosure.js.map +1 -0
  533. package/dist/hooks/useDocumentTitle.d.ts +8 -0
  534. package/dist/hooks/useDocumentTitle.d.ts.map +1 -0
  535. package/dist/hooks/useDocumentTitle.js +18 -0
  536. package/dist/hooks/useDocumentTitle.js.map +1 -0
  537. package/dist/hooks/useElementSize.d.ts +13 -0
  538. package/dist/hooks/useElementSize.d.ts.map +1 -0
  539. package/dist/hooks/useElementSize.js +28 -0
  540. package/dist/hooks/useElementSize.js.map +1 -0
  541. package/dist/hooks/useEventListener.d.ts +10 -0
  542. package/dist/hooks/useEventListener.d.ts.map +1 -0
  543. package/dist/hooks/useEventListener.js +30 -0
  544. package/dist/hooks/useEventListener.js.map +1 -0
  545. package/dist/hooks/useHotkeys.d.ts +24 -0
  546. package/dist/hooks/useHotkeys.d.ts.map +1 -0
  547. package/dist/hooks/useHotkeys.js +69 -0
  548. package/dist/hooks/useHotkeys.js.map +1 -0
  549. package/dist/hooks/useIdle.d.ts +16 -0
  550. package/dist/hooks/useIdle.d.ts.map +1 -0
  551. package/dist/hooks/useIdle.js +63 -0
  552. package/dist/hooks/useIdle.js.map +1 -0
  553. package/dist/hooks/useInView.d.ts +13 -0
  554. package/dist/hooks/useInView.d.ts.map +1 -0
  555. package/dist/hooks/useInView.js +32 -0
  556. package/dist/hooks/useInView.js.map +1 -0
  557. package/dist/hooks/useInfiniteScroll.d.ts +20 -0
  558. package/dist/hooks/useInfiniteScroll.d.ts.map +1 -0
  559. package/dist/hooks/useInfiniteScroll.js +38 -0
  560. package/dist/hooks/useInfiniteScroll.js.map +1 -0
  561. package/dist/hooks/useInterval.d.ts +3 -0
  562. package/dist/hooks/useInterval.d.ts.map +1 -0
  563. package/dist/hooks/useInterval.js +15 -0
  564. package/dist/hooks/useInterval.js.map +1 -0
  565. package/dist/hooks/useIsClient.d.ts +6 -0
  566. package/dist/hooks/useIsClient.d.ts.map +1 -0
  567. package/dist/hooks/useIsClient.js +11 -0
  568. package/dist/hooks/useIsClient.js.map +1 -0
  569. package/dist/hooks/useLatest.d.ts +7 -0
  570. package/dist/hooks/useLatest.d.ts.map +1 -0
  571. package/dist/hooks/useLatest.js +14 -0
  572. package/dist/hooks/useLatest.js.map +1 -0
  573. package/dist/hooks/useMediaQuery.d.ts +6 -0
  574. package/dist/hooks/useMediaQuery.d.ts.map +1 -0
  575. package/dist/hooks/useMediaQuery.js +20 -0
  576. package/dist/hooks/useMediaQuery.js.map +1 -0
  577. package/dist/hooks/useMergedRefs.d.ts +6 -0
  578. package/dist/hooks/useMergedRefs.d.ts.map +1 -0
  579. package/dist/hooks/useMergedRefs.js +9 -0
  580. package/dist/hooks/useMergedRefs.js.map +1 -0
  581. package/dist/hooks/useObjectUrl.d.ts +7 -0
  582. package/dist/hooks/useObjectUrl.d.ts.map +1 -0
  583. package/dist/hooks/useObjectUrl.js +21 -0
  584. package/dist/hooks/useObjectUrl.js.map +1 -0
  585. package/dist/hooks/useOnlineStatus.d.ts +3 -0
  586. package/dist/hooks/useOnlineStatus.d.ts.map +1 -0
  587. package/dist/hooks/useOnlineStatus.js +15 -0
  588. package/dist/hooks/useOnlineStatus.js.map +1 -0
  589. package/dist/hooks/usePageVisibility.d.ts +3 -0
  590. package/dist/hooks/usePageVisibility.d.ts.map +1 -0
  591. package/dist/hooks/usePageVisibility.js +11 -0
  592. package/dist/hooks/usePageVisibility.js.map +1 -0
  593. package/dist/hooks/usePolling.d.ts +17 -0
  594. package/dist/hooks/usePolling.d.ts.map +1 -0
  595. package/dist/hooks/usePolling.js +46 -0
  596. package/dist/hooks/usePolling.js.map +1 -0
  597. package/dist/hooks/usePrefersReducedMotion.d.ts +3 -0
  598. package/dist/hooks/usePrefersReducedMotion.d.ts.map +1 -0
  599. package/dist/hooks/usePrefersReducedMotion.js +7 -0
  600. package/dist/hooks/usePrefersReducedMotion.js.map +1 -0
  601. package/dist/hooks/usePresence.d.ts +2 -0
  602. package/dist/hooks/usePresence.d.ts.map +1 -0
  603. package/dist/hooks/usePresence.js +3 -0
  604. package/dist/hooks/usePresence.js.map +1 -0
  605. package/dist/hooks/usePrevious.d.ts +3 -0
  606. package/dist/hooks/usePrevious.d.ts.map +1 -0
  607. package/dist/hooks/usePrevious.js +15 -0
  608. package/dist/hooks/usePrevious.js.map +1 -0
  609. package/dist/hooks/useScroll.d.ts +22 -0
  610. package/dist/hooks/useScroll.d.ts.map +1 -0
  611. package/dist/hooks/useScroll.js +73 -0
  612. package/dist/hooks/useScroll.js.map +1 -0
  613. package/dist/hooks/useScrollLock.d.ts +6 -0
  614. package/dist/hooks/useScrollLock.d.ts.map +1 -0
  615. package/dist/hooks/useScrollLock.js +17 -0
  616. package/dist/hooks/useScrollLock.js.map +1 -0
  617. package/dist/hooks/useStorageState.d.ts +14 -0
  618. package/dist/hooks/useStorageState.d.ts.map +1 -0
  619. package/dist/hooks/useStorageState.js +62 -0
  620. package/dist/hooks/useStorageState.js.map +1 -0
  621. package/dist/hooks/useSyncedState.d.ts +6 -0
  622. package/dist/hooks/useSyncedState.d.ts.map +1 -0
  623. package/dist/hooks/useSyncedState.js +16 -0
  624. package/dist/hooks/useSyncedState.js.map +1 -0
  625. package/dist/hooks/useThrottledCallback.d.ts +4 -0
  626. package/dist/hooks/useThrottledCallback.d.ts.map +1 -0
  627. package/dist/hooks/useThrottledCallback.js +12 -0
  628. package/dist/hooks/useThrottledCallback.js.map +1 -0
  629. package/dist/hooks/useThrottledValue.d.ts +4 -0
  630. package/dist/hooks/useThrottledValue.d.ts.map +1 -0
  631. package/dist/hooks/useThrottledValue.js +19 -0
  632. package/dist/hooks/useThrottledValue.js.map +1 -0
  633. package/dist/hooks/useTimeout.d.ts +9 -0
  634. package/dist/hooks/useTimeout.d.ts.map +1 -0
  635. package/dist/hooks/useTimeout.js +23 -0
  636. package/dist/hooks/useTimeout.js.map +1 -0
  637. package/dist/hooks/useWindowSize.d.ts +12 -0
  638. package/dist/hooks/useWindowSize.d.ts.map +1 -0
  639. package/dist/hooks/useWindowSize.js +38 -0
  640. package/dist/hooks/useWindowSize.js.map +1 -0
  641. package/dist/index.d.ts +26 -6
  642. package/dist/index.d.ts.map +1 -1
  643. package/dist/index.js +26 -6
  644. package/dist/index.js.map +1 -1
  645. package/dist/input-date.css +99 -0
  646. package/dist/input-otp.css +76 -0
  647. package/dist/input-stepper.css +179 -0
  648. package/dist/input.css +231 -0
  649. package/dist/logo-assets.css +81 -0
  650. package/dist/logo.css +59 -0
  651. package/dist/menu.css +198 -0
  652. package/dist/multiselect.css +147 -0
  653. package/dist/number.css +53 -0
  654. package/dist/pagination.css +140 -0
  655. package/dist/popover.css +106 -0
  656. package/dist/progress.css +187 -0
  657. package/dist/qr-code.css +28 -0
  658. package/dist/radio.css +124 -0
  659. package/dist/server/crypto.d.ts +26 -0
  660. package/dist/server/crypto.d.ts.map +1 -0
  661. package/dist/server/crypto.js +50 -0
  662. package/dist/server/crypto.js.map +1 -0
  663. package/dist/server/index.d.ts +9 -0
  664. package/dist/server/index.d.ts.map +1 -0
  665. package/dist/server/index.js +9 -0
  666. package/dist/server/index.js.map +1 -0
  667. package/dist/server/rate-limit.d.ts +20 -0
  668. package/dist/server/rate-limit.d.ts.map +1 -0
  669. package/dist/server/rate-limit.js +42 -0
  670. package/dist/server/rate-limit.js.map +1 -0
  671. package/dist/server/request.d.ts +42 -0
  672. package/dist/server/request.d.ts.map +1 -0
  673. package/dist/server/request.js +94 -0
  674. package/dist/server/request.js.map +1 -0
  675. package/dist/server/response.d.ts +19 -0
  676. package/dist/server/response.d.ts.map +1 -0
  677. package/dist/server/response.js +44 -0
  678. package/dist/server/response.js.map +1 -0
  679. package/dist/sidebar.css +271 -0
  680. package/dist/skeleton.css +57 -0
  681. package/dist/skill/leaf-design-system-0.2.5.zip +0 -0
  682. package/dist/slider.css +312 -0
  683. package/dist/spinner.css +132 -0
  684. package/dist/steps.css +211 -0
  685. package/dist/{leaf.css → styles.css} +4665 -2163
  686. package/dist/table.css +435 -0
  687. package/dist/tabs.css +270 -0
  688. package/dist/textarea.css +28 -0
  689. package/dist/toast.css +272 -0
  690. package/dist/toggle.css +123 -0
  691. package/dist/tokens.css +264 -0
  692. package/dist/tooltip.css +259 -0
  693. package/dist/typography.css +150 -0
  694. package/dist/upload.css +326 -0
  695. package/dist/utils/RemixGlyph.d.ts +1 -1
  696. package/dist/utils/RemixGlyph.d.ts.map +1 -1
  697. package/dist/utils/RemixGlyph.js +1 -1
  698. package/dist/utils/RemixGlyph.js.map +1 -1
  699. package/dist/utils/useFloating.d.ts +11 -0
  700. package/dist/utils/useFloating.d.ts.map +1 -0
  701. package/dist/utils/useFloating.js +34 -0
  702. package/dist/utils/useFloating.js.map +1 -0
  703. package/dist/utils/useFloatingLayer.d.ts +40 -0
  704. package/dist/utils/useFloatingLayer.d.ts.map +1 -0
  705. package/dist/utils/useFloatingLayer.js +95 -0
  706. package/dist/utils/useFloatingLayer.js.map +1 -0
  707. package/dist/utils/usePresence.d.ts +9 -0
  708. package/dist/utils/usePresence.d.ts.map +1 -0
  709. package/dist/utils/usePresence.js +25 -0
  710. package/dist/utils/usePresence.js.map +1 -0
  711. package/dist/virtual-list.css +60 -0
  712. package/package.json +82 -21
  713. package/dist/cdn/leaf-0.2.3.min.css +0 -8
  714. package/dist/cdn/leaf-0.2.3.min.js +0 -204
  715. package/dist/engine/assets.json +0 -1
  716. package/dist/engine/chunk-X2H56OKG.js +0 -4854
  717. package/dist/engine/cli.js +0 -8
  718. package/dist/engine/postcss.d.ts +0 -3
  719. package/dist/engine/postcss.js +0 -7
  720. package/dist/engine/vite.d.ts +0 -3
  721. package/dist/engine/vite.js +0 -7
  722. package/dist/skill/leaf-design-system-0.2.3.zip +0 -0
@@ -1,4854 +0,0 @@
1
- /* @finhay-pro/leaf-design-system — Leaf CSS engine */
2
-
3
- // ../css/src/integrations/cli.ts
4
- import { watch } from "node:fs";
5
- import { mkdirSync, readFileSync as readFileSync2, writeFileSync } from "node:fs";
6
- import { dirname as dirname2, relative as relative2, resolve as resolve2 } from "node:path";
7
- import { parseArgs } from "node:util";
8
-
9
- // ../css/src/value.ts
10
- function splitTopLevel(input, separator) {
11
- const parts = [];
12
- let depth = 0;
13
- let quote = null;
14
- let start = 0;
15
- for (let index = 0; index < input.length; index++) {
16
- const char = input[index];
17
- if (char === "\\") {
18
- index++;
19
- continue;
20
- }
21
- if (quote) {
22
- if (char === quote) quote = null;
23
- continue;
24
- }
25
- if (char === '"' || char === "'") {
26
- quote = char;
27
- } else if (char === "[" || char === "(") {
28
- depth++;
29
- } else if (char === "]" || char === ")") {
30
- depth--;
31
- } else if (char === separator && depth === 0) {
32
- parts.push(input.slice(start, index));
33
- start = index + 1;
34
- }
35
- }
36
- parts.push(input.slice(start));
37
- return parts;
38
- }
39
- function lastTopLevelIndex(input, separator) {
40
- let depth = 0;
41
- let quote = null;
42
- let found = -1;
43
- for (let index = 0; index < input.length; index++) {
44
- const char = input[index];
45
- if (char === "\\") {
46
- index++;
47
- continue;
48
- }
49
- if (quote) {
50
- if (char === quote) quote = null;
51
- continue;
52
- }
53
- if (char === '"' || char === "'") {
54
- quote = char;
55
- } else if (char === "[" || char === "(") {
56
- depth++;
57
- } else if (char === "]" || char === ")") {
58
- depth--;
59
- } else if (char === separator && depth === 0) {
60
- found = index;
61
- }
62
- }
63
- return found;
64
- }
65
- function isBracketed(input) {
66
- if (!input.startsWith("[") || !input.endsWith("]")) return false;
67
- let depth = 0;
68
- for (let index = 0; index < input.length; index++) {
69
- const char = input[index];
70
- if (char === "\\") {
71
- index++;
72
- continue;
73
- }
74
- if (char === "[") depth++;
75
- else if (char === "]") {
76
- depth--;
77
- if (depth === 0 && index !== input.length - 1) return false;
78
- }
79
- }
80
- return depth === 0;
81
- }
82
- var MATH_FUNCTIONS = /* @__PURE__ */ new Set(["calc", "min", "max", "clamp", "mod", "rem", "round", "abs"]);
83
- function normalizeMath(input) {
84
- let out = "";
85
- const stack = [];
86
- for (let index = 0; index < input.length; index++) {
87
- const char = input[index];
88
- if (char === "(") {
89
- const name = /([a-zA-Z-]*)$/.exec(input.slice(0, index))?.[1] ?? "";
90
- stack.push(name.toLowerCase());
91
- out += char;
92
- continue;
93
- }
94
- if (char === ")") {
95
- stack.pop();
96
- out += char;
97
- continue;
98
- }
99
- const inMath = stack.length > 0 && MATH_FUNCTIONS.has(stack[stack.length - 1]);
100
- if (inMath && (char === "+" || char === "-")) {
101
- const prev = input[index - 1] ?? "";
102
- const next = input[index + 1] ?? "";
103
- const exponent = /\d[eE]$/.test(out) && /\d/.test(next);
104
- const unit = /\d[a-zA-Z]+$/.test(out) && !exponent;
105
- const prevEndsOperand = /[0-9%)]/.test(prev) || unit;
106
- if (prevEndsOperand && next !== "" && next !== " " && next !== ")") {
107
- out += ` ${char} `;
108
- continue;
109
- }
110
- }
111
- out += char;
112
- }
113
- return out;
114
- }
115
- function decodeArbitrary(input) {
116
- let out = "";
117
- let urlDepth = 0;
118
- for (let index = 0; index < input.length; index++) {
119
- const char = input[index];
120
- if (char === "\\" && input[index + 1] === "_") {
121
- out += "_";
122
- index++;
123
- continue;
124
- }
125
- if (input.startsWith("url(", index)) {
126
- urlDepth++;
127
- out += "url(";
128
- index += 3;
129
- continue;
130
- }
131
- if (urlDepth > 0) {
132
- if (char === ")") urlDepth--;
133
- out += char;
134
- continue;
135
- }
136
- out += char === "_" ? " " : char;
137
- }
138
- return normalizeMath(out);
139
- }
140
- function findForbiddenUnit(value) {
141
- const match = /(?:^|[^a-zA-Z0-9_-])-?(?:\d+\.?\d*|\.\d+)(rem|em)(?![a-zA-Z0-9_-])/.exec(value);
142
- return match ? match[1] : null;
143
- }
144
- function isPositiveInteger(value) {
145
- return /^\d+$/.test(value);
146
- }
147
- function isNumber(value) {
148
- return /^\d+(?:\.\d+)?$/.test(value) || /^\.\d+$/.test(value);
149
- }
150
- function fractionToPercent(fraction) {
151
- const [top, bottom] = fraction.split("/");
152
- if (!top || !bottom || !isPositiveInteger(top) || !isPositiveInteger(bottom)) return null;
153
- const divisor = Number(bottom);
154
- if (divisor === 0) return null;
155
- const percent = Number(top) / divisor * 100;
156
- return `${Number(percent.toFixed(6))}%`;
157
- }
158
- function negate(value) {
159
- return `calc(${value} * -1)`;
160
- }
161
- function looksLikeColor(value) {
162
- return /^#[0-9a-fA-F]{3,8}$/.test(value) || /^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|light-dark)\(/i.test(
163
- value
164
- ) || /^(?:transparent|currentcolor|black|white|red|green|blue|yellow|orange|purple|gray|grey|pink)$/i.test(
165
- value
166
- );
167
- }
168
- var NAMED_COLORS = /(?:^|[\s,(/])(?:transparent|currentcolor|black|white|red|green|blue|yellow|orange|purple|gray|grey|pink)(?=$|[\s,)/])/i;
169
- function containsColor(value) {
170
- const text = value.replace(/url\([^)]*\)/gi, "url()");
171
- return /var\(/.test(text) || /#[0-9a-fA-F]{3,8}(?![\w-])/.test(text) || /(?:^|[^\w-])(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color|color-mix|light-dark)\(/i.test(
172
- text
173
- ) || NAMED_COLORS.test(text);
174
- }
175
-
176
- // ../css/src/candidate.ts
177
- function splitCandidate(raw) {
178
- if (!raw || raw.length > 400 || /[{};]/.test(raw)) return null;
179
- const segments = splitTopLevel(raw, ":");
180
- let base = segments.pop();
181
- if (!base || segments.some((segment) => segment === "")) return null;
182
- let important = false;
183
- if (base.endsWith("!")) {
184
- important = true;
185
- base = base.slice(0, -1);
186
- } else if (base.startsWith("!")) {
187
- important = true;
188
- base = base.slice(1);
189
- }
190
- if (!base) return null;
191
- return { raw, variants: segments, important, base };
192
- }
193
- function parseArbitraryProperty(base) {
194
- let body = base;
195
- let modifier = null;
196
- if (!isBracketed(body)) {
197
- const slash = lastTopLevelIndex(body, "/");
198
- if (slash === -1) return null;
199
- modifier = parseModifier(body.slice(slash + 1));
200
- body = body.slice(0, slash);
201
- if (!isBracketed(body)) return null;
202
- }
203
- const inner = body.slice(1, -1);
204
- const colon = inner.indexOf(":");
205
- if (colon <= 0) return null;
206
- const property = inner.slice(0, colon);
207
- const value = decodeArbitrary(inner.slice(colon + 1));
208
- if (!/^(?:--[a-zA-Z0-9_-]+|-?[a-z][a-z-]*)$/.test(property) || !value) return null;
209
- return { property, value, modifier };
210
- }
211
- function parseModifier(raw) {
212
- if (!raw) return null;
213
- if (isBracketed(raw)) {
214
- const value = decodeArbitrary(raw.slice(1, -1));
215
- return value ? { kind: "arbitrary", value } : null;
216
- }
217
- return /^[a-zA-Z0-9_.-]+$/.test(raw) ? { kind: "named", value: raw } : null;
218
- }
219
- var DATA_TYPES = /* @__PURE__ */ new Set([
220
- "length",
221
- "percentage",
222
- "number",
223
- "integer",
224
- "color",
225
- "url",
226
- "image",
227
- "position",
228
- "bg-size",
229
- "line-width",
230
- "angle",
231
- "shadow",
232
- "family-name",
233
- "absolute-size",
234
- "relative-size",
235
- "vector"
236
- ]);
237
- function parseValue(raw) {
238
- if (!raw) return null;
239
- if (isBracketed(raw)) {
240
- let inner = raw.slice(1, -1);
241
- let dataType = null;
242
- const typed = /^([a-z-]+):(.+)$/s.exec(inner);
243
- if (typed && DATA_TYPES.has(typed[1])) {
244
- dataType = typed[1];
245
- inner = typed[2];
246
- }
247
- const value = decodeArbitrary(inner);
248
- return value ? { kind: "arbitrary", value, dataType } : null;
249
- }
250
- if (/[[\]()]/.test(raw)) return null;
251
- return /^[a-zA-Z0-9_.%-]+$/.test(raw) ? { kind: "named", value: raw } : null;
252
- }
253
- function isVariableShorthand(base) {
254
- return /-\((?:[a-z-]+:)?--[a-zA-Z0-9_-]+\)(?:\/.*)?$/.test(base);
255
- }
256
-
257
- // ../css/src/css.ts
258
- function parseCss(input) {
259
- let index = 0;
260
- function readUntil(stops) {
261
- let text = "";
262
- let depth = 0;
263
- while (index < input.length) {
264
- const char = input[index];
265
- if (char === "\\") {
266
- text += input.slice(index, index + 2);
267
- index += 2;
268
- continue;
269
- }
270
- if (char === "/" && input[index + 1] === "*") {
271
- const end = input.indexOf("*/", index + 2);
272
- index = end === -1 ? input.length : end + 2;
273
- text += " ";
274
- continue;
275
- }
276
- if (char === '"' || char === "'") {
277
- let end = index + 1;
278
- while (end < input.length && input[end] !== char) {
279
- if (input[end] === "\\") end++;
280
- end++;
281
- }
282
- text += input.slice(index, end + 1);
283
- index = end + 1;
284
- continue;
285
- }
286
- if (char === "(" || char === "[") depth++;
287
- else if (char === ")" || char === "]") depth--;
288
- else if (depth === 0 && stops.includes(char)) {
289
- index++;
290
- return { text, stop: char };
291
- }
292
- text += char;
293
- index++;
294
- }
295
- return { text, stop: "" };
296
- }
297
- function parseBlock() {
298
- const nodes = [];
299
- while (index < input.length) {
300
- const { text, stop } = readUntil("{};");
301
- const prelude = text.trim();
302
- if (stop === "}" || stop === "") {
303
- if (prelude) pushDeclaration(nodes, prelude);
304
- return nodes;
305
- }
306
- if (stop === ";") {
307
- if (prelude.startsWith("@")) {
308
- const { name, params } = splitAtRule(prelude);
309
- nodes.push({ type: "atrule", name, params, children: null });
310
- } else if (prelude) {
311
- pushDeclaration(nodes, prelude);
312
- }
313
- continue;
314
- }
315
- const children = parseBlock();
316
- if (prelude.startsWith("@")) {
317
- const { name, params } = splitAtRule(prelude);
318
- nodes.push({ type: "atrule", name, params, children });
319
- } else {
320
- nodes.push({ type: "rule", selector: collapse(prelude), children });
321
- }
322
- }
323
- return nodes;
324
- }
325
- return parseBlock();
326
- }
327
- function splitAtRule(prelude) {
328
- const match = /^@([a-zA-Z-]+)\s*([\s\S]*)$/.exec(prelude);
329
- return { name: match?.[1] ?? "", params: collapse(match?.[2] ?? "") };
330
- }
331
- function pushDeclaration(nodes, text) {
332
- const colon = text.indexOf(":");
333
- if (colon <= 0) return;
334
- const property = text.slice(0, colon).trim();
335
- let value = text.slice(colon + 1).trim();
336
- let important = false;
337
- const bang = /\s*!\s*important\s*$/i.exec(value);
338
- if (bang) {
339
- important = true;
340
- value = value.slice(0, bang.index);
341
- }
342
- nodes.push({
343
- type: "decl",
344
- property,
345
- value: property.startsWith("--") ? value : collapse(value),
346
- important
347
- });
348
- }
349
- function collapse(text) {
350
- let out = "";
351
- let quote = null;
352
- for (let index = 0; index < text.length; index++) {
353
- const char = text[index];
354
- if (quote) {
355
- out += char;
356
- if (char === "\\") out += text[++index] ?? "";
357
- else if (char === quote) quote = null;
358
- continue;
359
- }
360
- if (char === "\\") {
361
- out += char + (text[++index] ?? "");
362
- continue;
363
- }
364
- if (char === '"' || char === "'") {
365
- quote = char;
366
- out += char;
367
- continue;
368
- }
369
- if (/\s/.test(char)) {
370
- if (!out.endsWith(" ")) out += " ";
371
- continue;
372
- }
373
- out += char;
374
- }
375
- return out.trim();
376
- }
377
- function splitSelectorList(selector) {
378
- const parts = [];
379
- let depth = 0;
380
- let start = 0;
381
- for (let index = 0; index < selector.length; index++) {
382
- const char = selector[index];
383
- if (char === "\\") {
384
- index++;
385
- } else if (char === "(" || char === "[") {
386
- depth++;
387
- } else if (char === ")" || char === "]") {
388
- depth--;
389
- } else if (char === "," && depth === 0) {
390
- parts.push(selector.slice(start, index).trim());
391
- start = index + 1;
392
- }
393
- }
394
- parts.push(selector.slice(start).trim());
395
- return parts;
396
- }
397
- function tighten(text, kind) {
398
- let out = "";
399
- let quote = null;
400
- let depth = 0;
401
- const separators = kind === "selector" ? ",>~+" : ",";
402
- for (let index = 0; index < text.length; index++) {
403
- const char = text[index];
404
- if (quote) {
405
- out += char;
406
- if (char === "\\") out += text[++index] ?? "";
407
- else if (char === quote) quote = null;
408
- continue;
409
- }
410
- if (char === '"' || char === "'") {
411
- quote = char;
412
- out += char;
413
- continue;
414
- }
415
- if (char === "\\") {
416
- out += char + (text[++index] ?? "");
417
- continue;
418
- }
419
- if (char === "(" || char === "[") depth++;
420
- if (char === ")" || char === "]") depth--;
421
- const isSeparator = separators.includes(char) && (kind === "selector" ? depth === 0 || char === "," : true);
422
- if (isSeparator) {
423
- out = out.replace(/ $/, "") + char;
424
- while (text[index + 1] === " ") index++;
425
- continue;
426
- }
427
- out += char;
428
- }
429
- return out;
430
- }
431
- function printCss(nodes, options = {}) {
432
- return options.minify ? printMinified(nodes) : printPretty(nodes, 0).trimEnd() + "\n";
433
- }
434
- function printDeclaration(node, minify) {
435
- const important = node.important ? minify ? "!important" : " !important" : "";
436
- if (minify) {
437
- const value = node.property.startsWith("--") ? node.value : tighten(node.value, "value");
438
- return `${node.property}:${value}${important}`;
439
- }
440
- return `${node.property}: ${node.value}${important};`;
441
- }
442
- function printPretty(nodes, depth) {
443
- const indent = " ".repeat(depth);
444
- const blocks = [];
445
- for (const node of nodes) {
446
- if (node.type === "decl") {
447
- blocks.push(`${indent}${printDeclaration(node, false)}
448
- `);
449
- } else if (node.type === "rule") {
450
- const selector = splitSelectorList(node.selector).join(`,
451
- ${indent}`);
452
- blocks.push(
453
- `${indent}${selector} {
454
- ${printPretty(node.children, depth + 1)}${indent}}
455
- `
456
- );
457
- } else if (node.children === null) {
458
- blocks.push(`${indent}@${node.name}${node.params ? ` ${node.params}` : ""};
459
- `);
460
- } else {
461
- blocks.push(
462
- `${indent}@${node.name}${node.params ? ` ${node.params}` : ""} {
463
- ${printPretty(node.children, depth + 1)}${indent}}
464
- `
465
- );
466
- }
467
- }
468
- let out = "";
469
- for (let index = 0; index < blocks.length; index++) {
470
- const isDecl = nodes[index].type === "decl";
471
- if (index > 0 && !isDecl) out += "\n";
472
- out += blocks[index];
473
- }
474
- return out;
475
- }
476
- function printMinified(nodes) {
477
- const parts = [];
478
- for (const node of nodes) {
479
- if (node.type === "decl") {
480
- parts.push(printDeclaration(node, true));
481
- continue;
482
- }
483
- const head = node.type === "rule" ? tighten(node.selector, "selector") : `@${node.name}${node.params ? ` ${tighten(node.params, "params")}` : ""}`;
484
- if (node.type === "atrule" && node.children === null) {
485
- parts.push(`${head};`);
486
- continue;
487
- }
488
- const children = node.children;
489
- if (children.length === 0) continue;
490
- parts.push(`${head}{${printMinified(children)}}`);
491
- }
492
- return parts.reduce(
493
- (out, part, index) => index > 0 && parts[index - 1].endsWith("}") === false && !parts[index - 1].endsWith(";") ? `${out};${part}` : out + part,
494
- ""
495
- );
496
- }
497
- function minifyCss(input) {
498
- return printCss(parseCss(input), { minify: true });
499
- }
500
-
501
- // ../css/src/escape.ts
502
- function escapeClass(name) {
503
- let out = "";
504
- const length2 = name.length;
505
- for (let index = 0; index < length2; index++) {
506
- const code = name.charCodeAt(index);
507
- if (code === 0) {
508
- out += "\uFFFD";
509
- continue;
510
- }
511
- const isDigit = code >= 48 && code <= 57;
512
- if (code >= 1 && code <= 31 || code === 127 || index === 0 && isDigit || index === 1 && isDigit && name.charCodeAt(0) === 45) {
513
- out += `\\${code.toString(16)} `;
514
- continue;
515
- }
516
- if (index === 0 && code === 45 && length2 === 1) {
517
- out += `\\${name.charAt(index)}`;
518
- continue;
519
- }
520
- if (code >= 128 || code === 45 || code === 95 || isDigit || code >= 65 && code <= 90 || code >= 97 && code <= 122) {
521
- out += name.charAt(index);
522
- continue;
523
- }
524
- out += `\\${name.charAt(index)}`;
525
- }
526
- return out;
527
- }
528
-
529
- // ../css/src/properties.ts
530
- var any = (initial = null, inherits = false) => ({
531
- syntax: "*",
532
- inherits,
533
- initial
534
- });
535
- var color = (initial = "#0000") => ({
536
- syntax: "<color>",
537
- inherits: false,
538
- initial
539
- });
540
- var lengthPercentage = (initial) => ({
541
- syntax: "<length-percentage>",
542
- inherits: false,
543
- initial
544
- });
545
- var length = (initial) => ({
546
- syntax: "<length>",
547
- inherits: false,
548
- initial
549
- });
550
- var EMPTY_SHADOW = "0 0 #0000";
551
- var PROPERTIES = {
552
- "--tw-border-style": any("solid"),
553
- "--tw-outline-style": any("solid"),
554
- "--tw-content": any('""', true),
555
- "--tw-space-x-reverse": any("0"),
556
- "--tw-space-y-reverse": any("0"),
557
- "--tw-divide-x-reverse": any("0"),
558
- "--tw-divide-y-reverse": any("0"),
559
- "--tw-border-spacing-x": length("0"),
560
- "--tw-border-spacing-y": length("0"),
561
- "--tw-translate-x": any("0"),
562
- "--tw-translate-y": any("0"),
563
- "--tw-translate-z": any("0"),
564
- "--tw-scale-x": any("1"),
565
- "--tw-scale-y": any("1"),
566
- "--tw-scale-z": any("1"),
567
- "--tw-rotate-x": any(),
568
- "--tw-rotate-y": any(),
569
- "--tw-rotate-z": any(),
570
- "--tw-skew-x": any(),
571
- "--tw-skew-y": any(),
572
- "--tw-ordinal": any(),
573
- "--tw-slashed-zero": any(),
574
- "--tw-numeric-figure": any(),
575
- "--tw-numeric-spacing": any(),
576
- "--tw-numeric-fraction": any(),
577
- "--tw-shadow": any(EMPTY_SHADOW),
578
- "--tw-shadow-color": any(),
579
- "--tw-inset-shadow": any(EMPTY_SHADOW),
580
- "--tw-inset-shadow-color": any(),
581
- "--tw-ring-color": any(),
582
- "--tw-ring-shadow": any(EMPTY_SHADOW),
583
- "--tw-inset-ring-color": any(),
584
- "--tw-inset-ring-shadow": any(EMPTY_SHADOW),
585
- "--tw-ring-inset": any(),
586
- "--tw-ring-offset-width": length("0px"),
587
- "--tw-ring-offset-color": any("#fff"),
588
- "--tw-ring-offset-shadow": any(EMPTY_SHADOW),
589
- "--tw-text-shadow-color": any(),
590
- "--tw-drop-shadow-color": any(),
591
- "--tw-blur": any(),
592
- "--tw-brightness": any(),
593
- "--tw-contrast": any(),
594
- "--tw-grayscale": any(),
595
- "--tw-hue-rotate": any(),
596
- "--tw-invert": any(),
597
- "--tw-saturate": any(),
598
- "--tw-sepia": any(),
599
- "--tw-drop-shadow": any(),
600
- "--tw-backdrop-blur": any(),
601
- "--tw-backdrop-brightness": any(),
602
- "--tw-backdrop-contrast": any(),
603
- "--tw-backdrop-grayscale": any(),
604
- "--tw-backdrop-hue-rotate": any(),
605
- "--tw-backdrop-invert": any(),
606
- "--tw-backdrop-opacity": any(),
607
- "--tw-backdrop-saturate": any(),
608
- "--tw-backdrop-sepia": any(),
609
- "--tw-gradient-position": any(),
610
- "--tw-gradient-from": color(),
611
- "--tw-gradient-via": color(),
612
- "--tw-gradient-to": color(),
613
- "--tw-gradient-stops": any(),
614
- "--tw-gradient-via-stops": any(),
615
- "--tw-gradient-from-position": lengthPercentage("0%"),
616
- "--tw-gradient-via-position": lengthPercentage("50%"),
617
- "--tw-gradient-to-position": lengthPercentage("100%"),
618
- "--tw-contain-size": any(),
619
- "--tw-contain-layout": any(),
620
- "--tw-contain-paint": any(),
621
- "--tw-contain-style": any(),
622
- "--tw-ease": any(),
623
- "--tw-duration": any(),
624
- "--tw-scroll-snap-strictness": any("proximity"),
625
- "--tw-pan-x": any(),
626
- "--tw-pan-y": any(),
627
- "--tw-pinch-zoom": any(),
628
- "--tw-mask-linear": any("linear-gradient(#fff, #fff)"),
629
- "--tw-mask-radial": any("linear-gradient(#fff, #fff)"),
630
- "--tw-mask-conic": any("linear-gradient(#fff, #fff)"),
631
- "--tw-mask-linear-position": any("0deg"),
632
- "--tw-mask-linear-stops": any(),
633
- "--tw-mask-linear-from-position": lengthPercentage("0%"),
634
- "--tw-mask-linear-to-position": lengthPercentage("100%"),
635
- "--tw-mask-linear-from-color": color("black"),
636
- "--tw-mask-linear-to-color": color("transparent")
637
- };
638
- for (const side of ["top", "right", "bottom", "left"]) {
639
- PROPERTIES[`--tw-mask-${side}`] = any("linear-gradient(#fff, #fff)");
640
- PROPERTIES[`--tw-mask-${side}-from-position`] = lengthPercentage("0%");
641
- PROPERTIES[`--tw-mask-${side}-to-position`] = lengthPercentage("100%");
642
- PROPERTIES[`--tw-mask-${side}-from-color`] = color("black");
643
- PROPERTIES[`--tw-mask-${side}-to-color`] = color("transparent");
644
- }
645
- function collectProperties(text, into) {
646
- for (const match of text.matchAll(/--tw-[a-z0-9-]+/g)) {
647
- if (Object.hasOwn(PROPERTIES, match[0])) into.add(match[0]);
648
- }
649
- }
650
-
651
- // ../css/src/sort.ts
652
- var ORDER = [
653
- "container-type",
654
- "pointer-events",
655
- "visibility",
656
- "position",
657
- "inset",
658
- "inset-inline",
659
- "inset-block",
660
- "inset-inline-start",
661
- "inset-inline-end",
662
- "top",
663
- "right",
664
- "bottom",
665
- "left",
666
- "isolation",
667
- "z-index",
668
- "order",
669
- "grid-column",
670
- "grid-column-start",
671
- "grid-column-end",
672
- "grid-row",
673
- "grid-row-start",
674
- "grid-row-end",
675
- "float",
676
- "clear",
677
- "--tw-container-component",
678
- "margin",
679
- "margin-inline",
680
- "margin-block",
681
- "margin-inline-start",
682
- "margin-inline-end",
683
- "margin-top",
684
- "margin-right",
685
- "margin-bottom",
686
- "margin-left",
687
- "box-sizing",
688
- "display",
689
- "field-sizing",
690
- "aspect-ratio",
691
- "height",
692
- "max-height",
693
- "min-height",
694
- "width",
695
- "max-width",
696
- "min-width",
697
- "flex",
698
- "flex-shrink",
699
- "flex-grow",
700
- "flex-basis",
701
- "table-layout",
702
- "caption-side",
703
- "border-collapse",
704
- "border-spacing",
705
- "transform-origin",
706
- "translate",
707
- "--tw-translate-x",
708
- "--tw-translate-y",
709
- "--tw-translate-z",
710
- "scale",
711
- "--tw-scale-x",
712
- "--tw-scale-y",
713
- "--tw-scale-z",
714
- "rotate",
715
- "--tw-rotate-x",
716
- "--tw-rotate-y",
717
- "--tw-rotate-z",
718
- "--tw-skew-x",
719
- "--tw-skew-y",
720
- "transform",
721
- "animation",
722
- "cursor",
723
- "touch-action",
724
- "--tw-pan-x",
725
- "--tw-pan-y",
726
- "--tw-pinch-zoom",
727
- "resize",
728
- "scroll-snap-type",
729
- "--tw-scroll-snap-strictness",
730
- "scroll-snap-align",
731
- "scroll-snap-stop",
732
- "scroll-margin",
733
- "scroll-margin-inline",
734
- "scroll-margin-block",
735
- "scroll-margin-inline-start",
736
- "scroll-margin-inline-end",
737
- "scroll-margin-top",
738
- "scroll-margin-right",
739
- "scroll-margin-bottom",
740
- "scroll-margin-left",
741
- "scroll-padding",
742
- "scroll-padding-inline",
743
- "scroll-padding-block",
744
- "scroll-padding-inline-start",
745
- "scroll-padding-inline-end",
746
- "scroll-padding-top",
747
- "scroll-padding-right",
748
- "scroll-padding-bottom",
749
- "scroll-padding-left",
750
- "list-style-position",
751
- "list-style-type",
752
- "list-style-image",
753
- "appearance",
754
- "columns",
755
- "break-before",
756
- "break-inside",
757
- "break-after",
758
- "grid-auto-columns",
759
- "grid-template-columns",
760
- "grid-auto-flow",
761
- "grid-auto-rows",
762
- "grid-template-rows",
763
- "flex-direction",
764
- "flex-wrap",
765
- "place-content",
766
- "place-items",
767
- "align-content",
768
- "align-items",
769
- "justify-content",
770
- "justify-items",
771
- "gap",
772
- "column-gap",
773
- "row-gap",
774
- "--tw-space-x-reverse",
775
- "--tw-space-y-reverse",
776
- "--tw-divide-x-reverse",
777
- "--tw-divide-y-reverse",
778
- "place-self",
779
- "align-self",
780
- "justify-self",
781
- "overflow",
782
- "overflow-x",
783
- "overflow-y",
784
- "overscroll-behavior",
785
- "overscroll-behavior-x",
786
- "overscroll-behavior-y",
787
- "scroll-behavior",
788
- "border-radius",
789
- "border-start-start-radius",
790
- "border-start-end-radius",
791
- "border-end-end-radius",
792
- "border-end-start-radius",
793
- "border-top-left-radius",
794
- "border-top-right-radius",
795
- "border-bottom-right-radius",
796
- "border-bottom-left-radius",
797
- "border-style",
798
- "border-inline-style",
799
- "border-block-style",
800
- "border-inline-start-style",
801
- "border-inline-end-style",
802
- "border-top-style",
803
- "border-right-style",
804
- "border-bottom-style",
805
- "border-left-style",
806
- "border-width",
807
- "border-inline-width",
808
- "border-block-width",
809
- "border-inline-start-width",
810
- "border-inline-end-width",
811
- "border-top-width",
812
- "border-right-width",
813
- "border-bottom-width",
814
- "border-left-width",
815
- "--tw-border-style",
816
- "border-color",
817
- "border-inline-color",
818
- "border-block-color",
819
- "border-inline-start-color",
820
- "border-inline-end-color",
821
- "border-top-color",
822
- "border-right-color",
823
- "border-bottom-color",
824
- "border-left-color",
825
- "background-color",
826
- "background-image",
827
- "--tw-gradient-position",
828
- "--tw-gradient-stops",
829
- "--tw-gradient-via-stops",
830
- "--tw-gradient-from",
831
- "--tw-gradient-from-position",
832
- "--tw-gradient-via",
833
- "--tw-gradient-via-position",
834
- "--tw-gradient-to",
835
- "--tw-gradient-to-position",
836
- "mask-image",
837
- "--tw-mask-linear",
838
- "--tw-mask-top",
839
- "--tw-mask-right",
840
- "--tw-mask-bottom",
841
- "--tw-mask-left",
842
- "box-decoration-break",
843
- "background-size",
844
- "background-attachment",
845
- "background-clip",
846
- "background-position",
847
- "background-repeat",
848
- "background-origin",
849
- "mask-composite",
850
- "mask-mode",
851
- "mask-type",
852
- "mask-size",
853
- "mask-clip",
854
- "mask-position",
855
- "mask-repeat",
856
- "mask-origin",
857
- "object-fit",
858
- "object-position",
859
- "padding",
860
- "padding-inline",
861
- "padding-block",
862
- "padding-inline-start",
863
- "padding-inline-end",
864
- "padding-top",
865
- "padding-right",
866
- "padding-bottom",
867
- "padding-left",
868
- "text-align",
869
- "text-indent",
870
- "vertical-align",
871
- "font-family",
872
- "font-size",
873
- "line-height",
874
- "font-weight",
875
- "letter-spacing",
876
- "text-wrap",
877
- "overflow-wrap",
878
- "word-break",
879
- "text-overflow",
880
- "hyphens",
881
- "white-space",
882
- "color",
883
- "text-transform",
884
- "font-style",
885
- "font-variant-numeric",
886
- "text-decoration-line",
887
- "text-decoration-color",
888
- "text-decoration-style",
889
- "text-decoration-thickness",
890
- "text-underline-offset",
891
- "caret-color",
892
- "accent-color",
893
- "color-scheme",
894
- "opacity",
895
- "background-blend-mode",
896
- "mix-blend-mode",
897
- "box-shadow",
898
- "--tw-shadow",
899
- "--tw-shadow-color",
900
- "--tw-ring-shadow",
901
- "--tw-ring-color",
902
- "--tw-inset-shadow",
903
- "--tw-inset-shadow-color",
904
- "--tw-inset-ring-shadow",
905
- "--tw-inset-ring-color",
906
- "--tw-ring-offset-width",
907
- "--tw-ring-offset-color",
908
- "text-shadow",
909
- "--tw-text-shadow-color",
910
- "outline",
911
- "outline-width",
912
- "outline-offset",
913
- "outline-color",
914
- "--tw-blur",
915
- "--tw-brightness",
916
- "--tw-contrast",
917
- "--tw-drop-shadow",
918
- "--tw-grayscale",
919
- "--tw-hue-rotate",
920
- "--tw-invert",
921
- "--tw-saturate",
922
- "--tw-sepia",
923
- "filter",
924
- "--tw-backdrop-blur",
925
- "--tw-backdrop-brightness",
926
- "--tw-backdrop-contrast",
927
- "--tw-backdrop-grayscale",
928
- "--tw-backdrop-hue-rotate",
929
- "--tw-backdrop-invert",
930
- "--tw-backdrop-opacity",
931
- "--tw-backdrop-saturate",
932
- "--tw-backdrop-sepia",
933
- "backdrop-filter",
934
- "transition-property",
935
- "transition-behavior",
936
- "transition-delay",
937
- "transition-duration",
938
- "transition-timing-function",
939
- "will-change",
940
- "--tw-contain-size",
941
- "--tw-contain-layout",
942
- "--tw-contain-paint",
943
- "--tw-contain-style",
944
- "contain",
945
- "content",
946
- "forced-color-adjust"
947
- ];
948
- var INDEX = new Map(ORDER.map((property, index) => [property, index]));
949
- function propertyIndex(property) {
950
- const direct = INDEX.get(property);
951
- if (direct !== void 0) return direct;
952
- const unprefixed = property.replace(/^-(?:webkit|moz|ms)-/, "");
953
- return INDEX.get(unprefixed) ?? ORDER.length;
954
- }
955
-
956
- // ../css/src/theme.ts
957
- var BREAKPOINTS = [
958
- ["sm", 768],
959
- ["md", 1024],
960
- ["lg", 1280],
961
- ["xl", 1600],
962
- ["2xl", 1920]
963
- ];
964
- var XS_MAX = 767;
965
- var CONTAINERS = [
966
- ["3xs", 256],
967
- ["2xs", 288],
968
- ["xs", 320],
969
- ["sm", 384],
970
- ["md", 448],
971
- ["lg", 512],
972
- ["xl", 576],
973
- ["2xl", 672],
974
- ["3xl", 768],
975
- ["4xl", 896],
976
- ["5xl", 1024],
977
- ["6xl", 1152],
978
- ["7xl", 1280]
979
- ];
980
- var RADIUS = {
981
- xs: "2px",
982
- sm: "4px",
983
- md: "6px",
984
- lg: "8px",
985
- xl: "12px",
986
- "2xl": "16px",
987
- "3xl": "24px",
988
- "4xl": "32px"
989
- };
990
- var RADIUS_DEFAULT = "4px";
991
- var shadowColor = (fallback) => `var(--tw-shadow-color, ${fallback})`;
992
- var SHADOWS = {
993
- "2xs": `0 1px ${shadowColor("rgb(0 0 0 / 0.05)")}`,
994
- xs: `0 1px 2px 0 ${shadowColor("rgb(0 0 0 / 0.05)")}`,
995
- sm: `0 1px 3px 0 ${shadowColor("rgb(0 0 0 / 0.1)")}, 0 1px 2px -1px ${shadowColor("rgb(0 0 0 / 0.1)")}`,
996
- md: `0 4px 6px -1px ${shadowColor("rgb(0 0 0 / 0.1)")}, 0 2px 4px -2px ${shadowColor("rgb(0 0 0 / 0.1)")}`,
997
- lg: `0 10px 15px -3px ${shadowColor("rgb(0 0 0 / 0.1)")}, 0 4px 6px -4px ${shadowColor("rgb(0 0 0 / 0.1)")}`,
998
- xl: `0 20px 25px -5px ${shadowColor("rgb(0 0 0 / 0.1)")}, 0 8px 10px -6px ${shadowColor("rgb(0 0 0 / 0.1)")}`,
999
- "2xl": `0 25px 50px -12px ${shadowColor("rgb(0 0 0 / 0.25)")}`
1000
- };
1001
- var insetShadowColor = (fallback) => `var(--tw-inset-shadow-color, ${fallback})`;
1002
- var INSET_SHADOWS = {
1003
- "2xs": `inset 0 1px ${insetShadowColor("rgb(0 0 0 / 0.05)")}`,
1004
- xs: `inset 0 1px 1px ${insetShadowColor("rgb(0 0 0 / 0.05)")}`,
1005
- sm: `inset 0 2px 4px ${insetShadowColor("rgb(0 0 0 / 0.05)")}`
1006
- };
1007
- var dropShadowColor = (fallback) => `var(--tw-drop-shadow-color, ${fallback})`;
1008
- var DROP_SHADOWS = {
1009
- xs: [`0 1px 1px ${dropShadowColor("rgb(0 0 0 / 0.05)")}`],
1010
- sm: [`0 1px 2px ${dropShadowColor("rgb(0 0 0 / 0.15)")}`],
1011
- md: [`0 3px 3px ${dropShadowColor("rgb(0 0 0 / 0.12)")}`],
1012
- lg: [`0 4px 4px ${dropShadowColor("rgb(0 0 0 / 0.15)")}`],
1013
- xl: [`0 9px 7px ${dropShadowColor("rgb(0 0 0 / 0.1)")}`],
1014
- "2xl": [`0 25px 25px ${dropShadowColor("rgb(0 0 0 / 0.15)")}`]
1015
- };
1016
- var textShadowColor = (fallback) => `var(--tw-text-shadow-color, ${fallback})`;
1017
- var TEXT_SHADOWS = {
1018
- "2xs": `0px 1px 0px ${textShadowColor("rgb(0 0 0 / 0.15)")}`,
1019
- xs: `0px 1px 1px ${textShadowColor("rgb(0 0 0 / 0.2)")}`,
1020
- sm: `0px 1px 0px ${textShadowColor("rgb(0 0 0 / 0.075)")}, 0px 1px 1px ${textShadowColor("rgb(0 0 0 / 0.075)")}, 0px 2px 2px ${textShadowColor("rgb(0 0 0 / 0.075)")}`,
1021
- md: `0px 1px 1px ${textShadowColor("rgb(0 0 0 / 0.1)")}, 0px 1px 2px ${textShadowColor("rgb(0 0 0 / 0.1)")}, 0px 2px 4px ${textShadowColor("rgb(0 0 0 / 0.1)")}`,
1022
- lg: `0px 1px 2px ${textShadowColor("rgb(0 0 0 / 0.1)")}, 0px 3px 2px ${textShadowColor("rgb(0 0 0 / 0.1)")}, 0px 4px 8px ${textShadowColor("rgb(0 0 0 / 0.1)")}`
1023
- };
1024
- var BLUR = {
1025
- xs: "4px",
1026
- sm: "8px",
1027
- md: "12px",
1028
- lg: "16px",
1029
- xl: "24px",
1030
- "2xl": "40px",
1031
- "3xl": "64px"
1032
- };
1033
- var PERSPECTIVE = {
1034
- dramatic: "100px",
1035
- near: "300px",
1036
- normal: "500px",
1037
- midrange: "800px",
1038
- distant: "1200px"
1039
- };
1040
- var ASPECT = {
1041
- square: "1 / 1",
1042
- video: "16 / 9",
1043
- auto: "auto"
1044
- };
1045
- var EASE = {
1046
- linear: "linear",
1047
- in: "cubic-bezier(0.4, 0, 1, 1)",
1048
- out: "cubic-bezier(0, 0, 0.2, 1)",
1049
- "in-out": "cubic-bezier(0.4, 0, 0.2, 1)"
1050
- };
1051
- var DEFAULT_TRANSITION_DURATION = "150ms";
1052
- var DEFAULT_TRANSITION_EASE = "cubic-bezier(0.4, 0, 0.2, 1)";
1053
- var ANIMATIONS = {
1054
- none: { value: "none", keyframes: null },
1055
- spin: { value: "spin 1s linear infinite", keyframes: "spin" },
1056
- ping: { value: "ping 1s cubic-bezier(0, 0, 0.2, 1) infinite", keyframes: "ping" },
1057
- pulse: { value: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite", keyframes: "pulse" },
1058
- bounce: { value: "bounce 1s infinite", keyframes: "bounce" }
1059
- };
1060
- var KEYFRAMES = {
1061
- spin: "@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}",
1062
- ping: "@keyframes ping {\n 75%,\n 100% {\n transform: scale(2);\n opacity: 0;\n }\n}",
1063
- pulse: "@keyframes pulse {\n 50% {\n opacity: 0.5;\n }\n}",
1064
- bounce: "@keyframes bounce {\n 0%,\n 100% {\n transform: translateY(-25%);\n animation-timing-function: cubic-bezier(0.8, 0, 1, 1);\n }\n\n 50% {\n transform: none;\n animation-timing-function: cubic-bezier(0, 0, 0.2, 1);\n }\n}"
1065
- };
1066
-
1067
- // ../css/src/utilities/registry.ts
1068
- var Registry = class {
1069
- statics = /* @__PURE__ */ new Map();
1070
- functionals = /* @__PURE__ */ new Map();
1071
- palette;
1072
- constructor(palette) {
1073
- this.palette = palette;
1074
- }
1075
- static(name, value) {
1076
- this.statics.set(
1077
- name,
1078
- Array.isArray(value) ? { rules: [{ decls: toDecls(value) }] } : value
1079
- );
1080
- }
1081
- /** Nhiều class cùng một thuộc tính: `staticGroup("display", { flex: "flex", … })`. */
1082
- staticGroup(property, map, prefix = "") {
1083
- for (const [name, value] of Object.entries(map)) {
1084
- this.static(prefix ? name ? `${prefix}-${name}` : prefix : name, [[property, value]]);
1085
- }
1086
- }
1087
- functional(root, handler) {
1088
- this.functionals.set(root, handler);
1089
- }
1090
- };
1091
- function toDecls(entries) {
1092
- return entries.map(([property, value]) => ({ property, value }));
1093
- }
1094
- function decl(property, value) {
1095
- return { property, value };
1096
- }
1097
- function reject(message) {
1098
- return { reject: message };
1099
- }
1100
- function arbitraryValue(ctx) {
1101
- return ctx.value?.kind === "arbitrary" ? ctx.value.value : null;
1102
- }
1103
- function namedValue(ctx) {
1104
- return ctx.value?.kind === "named" ? ctx.value.value : null;
1105
- }
1106
- function isBare(ctx) {
1107
- return ctx.value === null && ctx.modifier === null;
1108
- }
1109
- var CONTAINER_PX = new Map(CONTAINERS.map(([name, width]) => [name, width]));
1110
- function lengthValue(ctx, root, options = {}) {
1111
- if (ctx.negative && !options.negative) return null;
1112
- let value = null;
1113
- if (ctx.fraction) {
1114
- if (!options.fractions) return null;
1115
- value = fractionToPercent(ctx.fraction);
1116
- } else if (ctx.modifier) {
1117
- return null;
1118
- } else if (ctx.value?.kind === "arbitrary") {
1119
- const { dataType } = ctx.value;
1120
- if (dataType && dataType !== "length" && dataType !== "percentage") return null;
1121
- if (looksLikeColor(ctx.value.value)) return null;
1122
- value = ctx.value.value;
1123
- } else if (ctx.value?.kind === "named") {
1124
- const name = ctx.value.value;
1125
- const keywords = { 0: "0px", px: "1px", ...options.keywords };
1126
- if (Object.hasOwn(keywords, name)) {
1127
- value = keywords[name];
1128
- } else if (isNumber(name)) {
1129
- const px = Number(name) * 4;
1130
- return reject(
1131
- `Leaf kh\xF4ng c\xF3 thang s\u1ED1 cho \`${root}-*\` \u2014 ghi gi\xE1 tr\u1ECB px: \`${ctx.negative ? "-" : ""}${root}-[${px}px]\``
1132
- );
1133
- } else if (CONTAINER_PX.has(name) || name === "prose") {
1134
- const px = CONTAINER_PX.get(name);
1135
- return reject(
1136
- `Leaf kh\xF4ng c\xF3 thang k\xEDch th\u01B0\u1EDBc \u0111\u1EB7t t\xEAn \u2014 ghi gi\xE1 tr\u1ECB px${px ? `: \`${root}-[${px}px]\`` : ""}`
1137
- );
1138
- }
1139
- }
1140
- if (value === null) return null;
1141
- return ctx.negative ? negate(value) : value;
1142
- }
1143
- var COLOR_HINT = "M\xE0u ch\u1EC9 l\u1EA5y t\u1EEB class Leaf (h\u1EADu t\u1ED1 vai tr\xF2: `primary`, `secondary`, `highlight`, `red`\u2026 \u2014 vd. `border-secondary`, `bg-tertiary`, `ring-highlight`), kh\xF4ng d\xF9ng `[var(--\u2026)]` hay m\xE3 m\xE0u";
1144
- var TAILWIND_PALETTE = /^(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose|mauve|olive|mist|taupe)-\d{2,3}$|^(?:black|white)$/;
1145
- function colorValue(ctx, role, palette) {
1146
- if (ctx.negative || !ctx.value) return null;
1147
- if (ctx.value.kind === "arbitrary") {
1148
- if (ctx.value.dataType === "color" || containsColor(ctx.value.value)) {
1149
- return reject(COLOR_HINT);
1150
- }
1151
- return null;
1152
- }
1153
- const name = ctx.value.value;
1154
- let color2 = null;
1155
- if (name === "transparent") color2 = "transparent";
1156
- else if (name === "current") color2 = "currentcolor";
1157
- else if (name === "inherit") color2 = "inherit";
1158
- else color2 = palette[role].get(name) ?? null;
1159
- if (color2 === null) {
1160
- if (TAILWIND_PALETTE.test(name)) {
1161
- return reject(
1162
- `Leaf kh\xF4ng d\xF9ng b\u1EA3ng m\xE0u Tailwind (\`${name}\`) \u2014 d\xF9ng token Leaf (\`primary\`, \`red\`, \`red-secondary\`\u2026)`
1163
- );
1164
- }
1165
- return null;
1166
- }
1167
- if (!ctx.modifier) return color2;
1168
- const alpha = opacityValue(ctx.modifier.value, ctx.modifier.kind === "arbitrary");
1169
- if (alpha === null || color2 === "inherit") return null;
1170
- return `color-mix(in oklab, ${color2} ${alpha}, transparent)`;
1171
- }
1172
- function opacityValue(raw, arbitrary) {
1173
- if (arbitrary) {
1174
- if (/^\d+(?:\.\d+)?%$/.test(raw)) return raw;
1175
- if (isNumber(raw)) {
1176
- const number = Number(raw);
1177
- return number <= 1 ? `${Number((number * 100).toFixed(4))}%` : `${number}%`;
1178
- }
1179
- return raw.startsWith("var(") ? raw : null;
1180
- }
1181
- return isNumber(raw) && Number(raw) <= 100 ? `${raw}%` : null;
1182
- }
1183
- function integerValue(ctx) {
1184
- const name = namedValue(ctx);
1185
- return name !== null && isPositiveInteger(name) && !ctx.modifier ? name : null;
1186
- }
1187
- function plainArbitrary(ctx) {
1188
- const value = arbitraryValue(ctx);
1189
- return value !== null && !ctx.modifier ? value : null;
1190
- }
1191
- function single(decls, extra = {}) {
1192
- return { rules: [{ decls: toDecls(decls) }], ...extra };
1193
- }
1194
-
1195
- // ../css/src/utilities/backgrounds.ts
1196
- var STOPS = "var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))";
1197
- var VIA_STOPS = "var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position)";
1198
- var DIRECTIONS = {
1199
- t: "to top",
1200
- tr: "to top right",
1201
- r: "to right",
1202
- br: "to bottom right",
1203
- b: "to bottom",
1204
- bl: "to bottom left",
1205
- l: "to left",
1206
- tl: "to top left"
1207
- };
1208
- var INTERPOLATIONS = /* @__PURE__ */ new Set([
1209
- "srgb",
1210
- "srgb-linear",
1211
- "display-p3",
1212
- "a98-rgb",
1213
- "prophoto-rgb",
1214
- "rec2020",
1215
- "lab",
1216
- "oklab",
1217
- "lch",
1218
- "oklch",
1219
- "xyz",
1220
- "xyz-d50",
1221
- "xyz-d65",
1222
- "hsl",
1223
- "hwb"
1224
- ]);
1225
- function interpolation(modifier) {
1226
- if (!modifier) return "in oklab";
1227
- if (INTERPOLATIONS.has(modifier)) return `in ${modifier}`;
1228
- const hue = /^(shorter|longer|increasing|decreasing)$/.exec(modifier);
1229
- return hue ? `in oklch ${hue[1]} hue` : null;
1230
- }
1231
- function linear(position, mode) {
1232
- return {
1233
- rules: [
1234
- {
1235
- decls: [
1236
- decl("--tw-gradient-position", position),
1237
- decl("background-image", "linear-gradient(var(--tw-gradient-stops))")
1238
- ]
1239
- },
1240
- {
1241
- decls: [decl("--tw-gradient-position", `${position} ${mode}`)],
1242
- atRules: ["@supports (background-image: linear-gradient(in lab, red, red))"]
1243
- }
1244
- ]
1245
- };
1246
- }
1247
- var IMAGE = /^(?:url\(|image\(|image-set\(|cross-fade\(|element\(|(?:repeating-)?(?:linear|radial|conic)-gradient\()/;
1248
- function registerBackgroundUtilities(registry) {
1249
- registry.staticGroup(
1250
- "background-attachment",
1251
- { fixed: "fixed", local: "local", scroll: "scroll" },
1252
- "bg"
1253
- );
1254
- for (const [name, value] of [
1255
- ["border", "border-box"],
1256
- ["padding", "padding-box"],
1257
- ["content", "content-box"]
1258
- ]) {
1259
- registry.static(`bg-clip-${name}`, [["background-clip", value]]);
1260
- registry.static(`bg-origin-${name}`, [["background-origin", value]]);
1261
- }
1262
- registry.static("bg-clip-text", [
1263
- ["-webkit-background-clip", "text"],
1264
- ["background-clip", "text"]
1265
- ]);
1266
- registry.staticGroup(
1267
- "background-position",
1268
- {
1269
- bottom: "bottom",
1270
- center: "center",
1271
- left: "left",
1272
- "left-bottom": "left bottom",
1273
- "left-top": "left top",
1274
- right: "right",
1275
- "right-bottom": "right bottom",
1276
- "right-top": "right top",
1277
- top: "top",
1278
- "top-left": "left top",
1279
- "top-right": "right top",
1280
- "bottom-left": "left bottom",
1281
- "bottom-right": "right bottom"
1282
- },
1283
- "bg"
1284
- );
1285
- registry.staticGroup(
1286
- "background-repeat",
1287
- {
1288
- repeat: "repeat",
1289
- "no-repeat": "no-repeat",
1290
- "repeat-x": "repeat-x",
1291
- "repeat-y": "repeat-y",
1292
- "repeat-round": "round",
1293
- "repeat-space": "space"
1294
- },
1295
- "bg"
1296
- );
1297
- registry.staticGroup(
1298
- "background-size",
1299
- { auto: "auto", cover: "cover", contain: "contain" },
1300
- "bg"
1301
- );
1302
- registry.static("bg-none", [["background-image", "none"]]);
1303
- for (const [root, property] of [
1304
- ["bg-position", "background-position"],
1305
- ["bg-size", "background-size"]
1306
- ]) {
1307
- registry.functional(root, (ctx) => {
1308
- if (ctx.value?.kind !== "arbitrary" || ctx.modifier || ctx.negative) return null;
1309
- return [decl(property, ctx.value.value)];
1310
- });
1311
- }
1312
- registry.functional("bg", (ctx) => {
1313
- if (ctx.value?.kind === "arbitrary" && !ctx.modifier) {
1314
- const { value, dataType } = ctx.value;
1315
- if (containsColor(value)) return reject(COLOR_HINT);
1316
- if (dataType === "image" || dataType === "url" || IMAGE.test(value)) {
1317
- return [decl("background-image", value)];
1318
- }
1319
- if (dataType === "position") return [decl("background-position", value)];
1320
- if (dataType === "bg-size" || dataType === "length")
1321
- return [decl("background-size", value)];
1322
- return reject(
1323
- "`bg-[..]` ch\u1EC9 nh\u1EADn \u1EA3nh / gradient (`url(..)`, `linear-gradient(..)`) \u2014 m\xE0u n\u1EC1n d\xF9ng class Leaf (`bg-primary`\u2026)"
1324
- );
1325
- }
1326
- const color2 = colorValue(ctx, "surface", registry.palette);
1327
- if (color2 === null || typeof color2 !== "string") return color2;
1328
- return [decl("background-color", color2)];
1329
- });
1330
- registry.functional("bg-linear-to", (ctx) => {
1331
- const name = namedValue(ctx);
1332
- if (name === null || ctx.negative || !Object.hasOwn(DIRECTIONS, name)) return null;
1333
- const mode = interpolation(ctx.modifier?.value ?? null);
1334
- return mode ? linear(DIRECTIONS[name], mode) : null;
1335
- });
1336
- registry.functional("bg-gradient-to", (ctx) => {
1337
- const name = namedValue(ctx);
1338
- if (name === null || ctx.negative || !Object.hasOwn(DIRECTIONS, name)) return null;
1339
- const mode = interpolation(ctx.modifier?.value ?? null);
1340
- if (!mode) return null;
1341
- return [
1342
- decl("--tw-gradient-position", `${DIRECTIONS[name]} ${mode}`),
1343
- decl("background-image", "linear-gradient(var(--tw-gradient-stops))")
1344
- ];
1345
- });
1346
- registry.functional("bg-linear", (ctx) => {
1347
- if (ctx.value?.kind === "arbitrary") {
1348
- if (ctx.modifier || ctx.negative) return null;
1349
- const { value } = ctx.value;
1350
- if (containsColor(value)) return reject(COLOR_HINT);
1351
- return [
1352
- decl("--tw-gradient-position", value),
1353
- decl("background-image", `linear-gradient(var(--tw-gradient-stops,${value}))`)
1354
- ];
1355
- }
1356
- const name = namedValue(ctx);
1357
- if (name === null || !/^\d+$/.test(name)) return null;
1358
- const mode = interpolation(ctx.modifier?.value ?? null);
1359
- if (!mode) return null;
1360
- return linear(ctx.negative ? negate(`${name}deg`) : `${name}deg`, mode);
1361
- });
1362
- for (const [root, fn] of [
1363
- ["bg-radial", "radial-gradient"],
1364
- ["bg-conic", "conic-gradient"]
1365
- ]) {
1366
- registry.functional(root, (ctx) => {
1367
- if (ctx.negative && root === "bg-radial") return null;
1368
- if (ctx.value?.kind === "arbitrary") {
1369
- if (ctx.modifier || ctx.negative) return null;
1370
- const { value } = ctx.value;
1371
- if (containsColor(value)) return reject(COLOR_HINT);
1372
- return [
1373
- decl("--tw-gradient-position", value),
1374
- decl("background-image", `${fn}(var(--tw-gradient-stops,${value}))`)
1375
- ];
1376
- }
1377
- const mode = interpolation(ctx.modifier?.value ?? null);
1378
- if (!mode) return null;
1379
- const name = namedValue(ctx);
1380
- let position = mode;
1381
- if (name !== null) {
1382
- if (root !== "bg-conic" || !/^\d+$/.test(name)) return null;
1383
- position = `from ${ctx.negative ? negate(`${name}deg`) : `${name}deg`} ${mode}`;
1384
- } else if (ctx.negative) {
1385
- return null;
1386
- }
1387
- return [
1388
- decl("--tw-gradient-position", position),
1389
- decl("background-image", `${fn}(var(--tw-gradient-stops))`)
1390
- ];
1391
- });
1392
- }
1393
- for (const stop of ["from", "via", "to"]) {
1394
- registry.functional(stop, (ctx) => {
1395
- if (ctx.negative) return null;
1396
- const name = namedValue(ctx);
1397
- let position = null;
1398
- if (name !== null && /^\d+(?:\.\d+)?%$/.test(name) && !ctx.modifier) position = name;
1399
- if (ctx.value?.kind === "arbitrary" && !ctx.modifier) {
1400
- const { value, dataType } = ctx.value;
1401
- if (dataType === "length" || dataType === "percentage" || /^-?[\d.]+(?:px|%)$/.test(value)) {
1402
- position = value;
1403
- }
1404
- }
1405
- if (position !== null) return [decl(`--tw-gradient-${stop}-position`, position)];
1406
- const color2 = colorValue(ctx, "surface", registry.palette);
1407
- if (color2 === null || typeof color2 !== "string") return color2;
1408
- if (stop === "via") {
1409
- return [
1410
- decl("--tw-gradient-via", color2),
1411
- decl("--tw-gradient-via-stops", VIA_STOPS),
1412
- decl("--tw-gradient-stops", "var(--tw-gradient-via-stops)")
1413
- ];
1414
- }
1415
- return [decl(`--tw-gradient-${stop}`, color2), decl("--tw-gradient-stops", STOPS)];
1416
- });
1417
- }
1418
- }
1419
-
1420
- // ../css/src/utilities/borders.ts
1421
- var BOX_SHADOW = "var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)";
1422
- var RADIUS_SIDES = [
1423
- ["", ["border-radius"]],
1424
- ["s", ["border-start-start-radius", "border-end-start-radius"]],
1425
- ["e", ["border-start-end-radius", "border-end-end-radius"]],
1426
- ["t", ["border-top-left-radius", "border-top-right-radius"]],
1427
- ["r", ["border-top-right-radius", "border-bottom-right-radius"]],
1428
- ["b", ["border-bottom-right-radius", "border-bottom-left-radius"]],
1429
- ["l", ["border-top-left-radius", "border-bottom-left-radius"]],
1430
- ["ss", ["border-start-start-radius"]],
1431
- ["se", ["border-start-end-radius"]],
1432
- ["ee", ["border-end-end-radius"]],
1433
- ["es", ["border-end-start-radius"]],
1434
- ["tl", ["border-top-left-radius"]],
1435
- ["tr", ["border-top-right-radius"]],
1436
- ["br", ["border-bottom-right-radius"]],
1437
- ["bl", ["border-bottom-left-radius"]]
1438
- ];
1439
- var BORDER_SIDES = [
1440
- ["", "border"],
1441
- ["x", "border-inline"],
1442
- ["y", "border-block"],
1443
- ["s", "border-inline-start"],
1444
- ["e", "border-inline-end"],
1445
- ["t", "border-top"],
1446
- ["r", "border-right"],
1447
- ["b", "border-bottom"],
1448
- ["l", "border-left"]
1449
- ];
1450
- var STYLES = ["solid", "dashed", "dotted", "double", "hidden", "none"];
1451
- function widthValue(ctx, root) {
1452
- if (ctx.negative) return null;
1453
- if (isBare(ctx)) return "1px";
1454
- const name = namedValue(ctx);
1455
- if (name !== null && isPositiveInteger(name) && !ctx.modifier) return `${name}px`;
1456
- if (ctx.value?.kind === "arbitrary" && !containsColor(ctx.value.value)) {
1457
- const value = lengthValue(ctx, root);
1458
- return typeof value === "string" ? value : null;
1459
- }
1460
- return null;
1461
- }
1462
- function registerBorderUtilities(registry) {
1463
- for (const [side, properties] of RADIUS_SIDES) {
1464
- const root = side ? `rounded-${side}` : "rounded";
1465
- registry.functional(root, (ctx) => {
1466
- if (ctx.negative) return null;
1467
- let value = null;
1468
- const name = namedValue(ctx);
1469
- if (isBare(ctx)) value = RADIUS_DEFAULT;
1470
- else if (name === "none" && !ctx.modifier) value = "0";
1471
- else if (name === "full" && !ctx.modifier) value = "calc(infinity * 1px)";
1472
- else if (name !== null && !ctx.modifier && Object.hasOwn(RADIUS, name))
1473
- value = RADIUS[name];
1474
- else if (ctx.value?.kind === "arbitrary") {
1475
- const length2 = lengthValue(ctx, root);
1476
- if (typeof length2 === "string") value = length2;
1477
- }
1478
- if (value === null) return null;
1479
- const radius = value;
1480
- return properties.map((property) => decl(property, radius));
1481
- });
1482
- }
1483
- for (const [side, prefix] of BORDER_SIDES) {
1484
- const root = side ? `border-${side}` : "border";
1485
- registry.functional(root, (ctx) => {
1486
- const width = widthValue(ctx, root);
1487
- if (width !== null) {
1488
- return [
1489
- decl(`${prefix}-style`, "var(--tw-border-style)"),
1490
- decl(`${prefix}-width`, width)
1491
- ];
1492
- }
1493
- const color2 = colorValue(ctx, "surface", registry.palette);
1494
- if (color2 === null || typeof color2 !== "string") return color2;
1495
- return [decl(`${prefix}-color`, color2)];
1496
- });
1497
- }
1498
- for (const style of STYLES) {
1499
- registry.static(`border-${style}`, [
1500
- ["--tw-border-style", style],
1501
- ["border-style", style]
1502
- ]);
1503
- }
1504
- const children = (self) => `:where(${self} > :not(:last-child))`;
1505
- registry.functional("divide-x", (ctx) => {
1506
- const width = widthValue(ctx, "divide-x");
1507
- if (width === null) return null;
1508
- return {
1509
- rules: [
1510
- {
1511
- selector: children,
1512
- decls: [
1513
- decl("--tw-divide-x-reverse", "0"),
1514
- decl("border-inline-style", "var(--tw-border-style)"),
1515
- decl(
1516
- "border-inline-start-width",
1517
- `calc(${width} * var(--tw-divide-x-reverse))`
1518
- ),
1519
- decl(
1520
- "border-inline-end-width",
1521
- `calc(${width} * calc(1 - var(--tw-divide-x-reverse)))`
1522
- )
1523
- ]
1524
- }
1525
- ]
1526
- };
1527
- });
1528
- registry.functional("divide-y", (ctx) => {
1529
- const width = widthValue(ctx, "divide-y");
1530
- if (width === null) return null;
1531
- return {
1532
- rules: [
1533
- {
1534
- selector: children,
1535
- decls: [
1536
- decl("--tw-divide-y-reverse", "0"),
1537
- decl("border-bottom-style", "var(--tw-border-style)"),
1538
- decl("border-top-style", "var(--tw-border-style)"),
1539
- decl("border-top-width", `calc(${width} * var(--tw-divide-y-reverse))`),
1540
- decl(
1541
- "border-bottom-width",
1542
- `calc(${width} * calc(1 - var(--tw-divide-y-reverse)))`
1543
- )
1544
- ]
1545
- }
1546
- ]
1547
- };
1548
- });
1549
- for (const axis of ["x", "y"]) {
1550
- registry.static(`divide-${axis}-reverse`, {
1551
- rules: [{ selector: children, decls: [decl(`--tw-divide-${axis}-reverse`, "1")] }]
1552
- });
1553
- }
1554
- for (const style of STYLES) {
1555
- registry.static(`divide-${style}`, {
1556
- rules: [
1557
- {
1558
- selector: children,
1559
- decls: [decl("--tw-border-style", style), decl("border-style", style)]
1560
- }
1561
- ]
1562
- });
1563
- }
1564
- registry.functional("divide", (ctx) => {
1565
- const color2 = colorValue(ctx, "surface", registry.palette);
1566
- if (color2 === null || typeof color2 !== "string") return color2;
1567
- return { rules: [{ selector: children, decls: [decl("border-color", color2)] }] };
1568
- });
1569
- registry.static("outline-hidden", {
1570
- rules: [
1571
- { decls: [decl("--tw-outline-style", "none"), decl("outline-style", "none")] },
1572
- {
1573
- decls: [decl("outline", "2px solid transparent"), decl("outline-offset", "2px")],
1574
- atRules: ["@media (forced-colors: active)"]
1575
- }
1576
- ]
1577
- });
1578
- for (const style of ["none", "solid", "dashed", "dotted", "double"]) {
1579
- registry.static(`outline-${style}`, [
1580
- ["--tw-outline-style", style],
1581
- ["outline-style", style]
1582
- ]);
1583
- }
1584
- registry.functional("outline", (ctx) => {
1585
- const width = widthValue(ctx, "outline");
1586
- if (width !== null) {
1587
- return [decl("outline-style", "var(--tw-outline-style)"), decl("outline-width", width)];
1588
- }
1589
- const color2 = colorValue(ctx, "surface", registry.palette);
1590
- if (color2 === null || typeof color2 !== "string") return color2;
1591
- return [decl("outline-color", color2)];
1592
- });
1593
- registry.functional("outline-offset", (ctx) => {
1594
- const name = namedValue(ctx);
1595
- if (name !== null && isPositiveInteger(name) && !ctx.modifier) {
1596
- return [decl("outline-offset", ctx.negative ? negate(`${name}px`) : `${name}px`)];
1597
- }
1598
- const value = lengthValue(ctx, "outline-offset", { negative: true });
1599
- if (value === null || typeof value !== "string") return value;
1600
- return [decl("outline-offset", value)];
1601
- });
1602
- const ringShadow = (width) => [
1603
- decl(
1604
- "--tw-ring-shadow",
1605
- `var(--tw-ring-inset,) 0 0 0 calc(${width} + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor)`
1606
- ),
1607
- decl("box-shadow", BOX_SHADOW)
1608
- ];
1609
- registry.functional("ring", (ctx) => {
1610
- const width = widthValue(ctx, "ring");
1611
- if (width !== null) return ringShadow(width);
1612
- const color2 = colorValue(ctx, "surface", registry.palette);
1613
- if (color2 === null || typeof color2 !== "string") return color2;
1614
- return [decl("--tw-ring-color", color2)];
1615
- });
1616
- registry.static("ring-inset", [["--tw-ring-inset", "inset"]]);
1617
- registry.functional("inset-ring", (ctx) => {
1618
- const width = widthValue(ctx, "inset-ring");
1619
- if (width !== null) {
1620
- return [
1621
- decl(
1622
- "--tw-inset-ring-shadow",
1623
- `inset 0 0 0 ${width} var(--tw-inset-ring-color, currentcolor)`
1624
- ),
1625
- decl("box-shadow", BOX_SHADOW)
1626
- ];
1627
- }
1628
- const color2 = colorValue(ctx, "surface", registry.palette);
1629
- if (color2 === null || typeof color2 !== "string") return color2;
1630
- return [decl("--tw-inset-ring-color", color2)];
1631
- });
1632
- registry.functional("ring-offset", (ctx) => {
1633
- const name = namedValue(ctx);
1634
- let width = null;
1635
- if (name !== null && isPositiveInteger(name) && !ctx.modifier && !ctx.negative)
1636
- width = `${name}px`;
1637
- else if (ctx.value?.kind === "arbitrary" && !containsColor(ctx.value.value)) {
1638
- const value = lengthValue(ctx, "ring-offset");
1639
- if (typeof value === "string") width = value;
1640
- }
1641
- if (width !== null) {
1642
- return [
1643
- decl("--tw-ring-offset-width", width),
1644
- decl(
1645
- "--tw-ring-offset-shadow",
1646
- "var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)"
1647
- )
1648
- ];
1649
- }
1650
- const color2 = colorValue(ctx, "surface", registry.palette);
1651
- if (color2 === null || typeof color2 !== "string") return color2;
1652
- return [decl("--tw-ring-offset-color", color2)];
1653
- });
1654
- }
1655
-
1656
- // ../css/src/utilities/effects.ts
1657
- var BLEND_MODES = [
1658
- "normal",
1659
- "multiply",
1660
- "screen",
1661
- "overlay",
1662
- "darken",
1663
- "lighten",
1664
- "color-dodge",
1665
- "color-burn",
1666
- "hard-light",
1667
- "soft-light",
1668
- "difference",
1669
- "exclusion",
1670
- "hue",
1671
- "saturation",
1672
- "color",
1673
- "luminosity",
1674
- "plus-darker",
1675
- "plus-lighter"
1676
- ];
1677
- function registerShadows(registry) {
1678
- registry.functional("shadow", (ctx) => {
1679
- if (ctx.negative) return null;
1680
- const name = namedValue(ctx);
1681
- let value = null;
1682
- if (isBare(ctx)) value = SHADOWS.sm;
1683
- else if (name === "none" && !ctx.modifier) value = "0 0 #0000";
1684
- else if (name !== null && !ctx.modifier && Object.hasOwn(SHADOWS, name))
1685
- value = SHADOWS[name];
1686
- if (value !== null) return [decl("--tw-shadow", value), decl("box-shadow", BOX_SHADOW)];
1687
- const color2 = colorValue(ctx, "surface", registry.palette);
1688
- if (color2 === null && ctx.value?.kind === "arbitrary") {
1689
- const arbitrary = plainArbitrary(ctx);
1690
- return arbitrary ? [decl("--tw-shadow", arbitrary), decl("box-shadow", BOX_SHADOW)] : null;
1691
- }
1692
- if (color2 === null || typeof color2 !== "string") return color2;
1693
- return [decl("--tw-shadow-color", color2)];
1694
- });
1695
- registry.functional("inset-shadow", (ctx) => {
1696
- if (ctx.negative) return null;
1697
- const name = namedValue(ctx);
1698
- let value = null;
1699
- if (isBare(ctx)) value = INSET_SHADOWS.sm;
1700
- else if (name === "none" && !ctx.modifier) value = "0 0 #0000";
1701
- else if (name !== null && !ctx.modifier && Object.hasOwn(INSET_SHADOWS, name)) {
1702
- value = INSET_SHADOWS[name];
1703
- }
1704
- if (value !== null)
1705
- return [decl("--tw-inset-shadow", value), decl("box-shadow", BOX_SHADOW)];
1706
- const color2 = colorValue(ctx, "surface", registry.palette);
1707
- if (color2 === null && ctx.value?.kind === "arbitrary") {
1708
- const arbitrary = plainArbitrary(ctx);
1709
- return arbitrary ? [decl("--tw-inset-shadow", `inset ${arbitrary}`), decl("box-shadow", BOX_SHADOW)] : null;
1710
- }
1711
- if (color2 === null || typeof color2 !== "string") return color2;
1712
- return [decl("--tw-inset-shadow-color", color2)];
1713
- });
1714
- registry.functional("opacity", (ctx) => {
1715
- if (ctx.negative || ctx.modifier) return null;
1716
- const name = namedValue(ctx);
1717
- if (name !== null) {
1718
- const value2 = opacityValue(name, false);
1719
- return value2 ? [decl("opacity", value2)] : null;
1720
- }
1721
- const value = plainArbitrary(ctx);
1722
- return value ? [decl("opacity", value)] : null;
1723
- });
1724
- for (const mode of BLEND_MODES) {
1725
- registry.static(`mix-blend-${mode}`, [["mix-blend-mode", mode]]);
1726
- registry.static(`bg-blend-${mode}`, [["background-blend-mode", mode]]);
1727
- }
1728
- }
1729
- var MASK_IMAGE = [
1730
- decl("mask-image", "var(--tw-mask-linear), var(--tw-mask-radial), var(--tw-mask-conic)"),
1731
- decl("mask-composite", "intersect")
1732
- ];
1733
- var MASK_EDGES = {
1734
- t: ["top"],
1735
- r: ["right"],
1736
- b: ["bottom"],
1737
- l: ["left"],
1738
- x: ["left", "right"],
1739
- y: ["top", "bottom"]
1740
- };
1741
- function maskStop(ctx, registry, root) {
1742
- if (ctx.negative) return null;
1743
- const name = namedValue(ctx);
1744
- if (name !== null && /^\d+(?:\.\d+)?%$/.test(name) && !ctx.modifier) return { position: name };
1745
- if (ctx.value?.kind === "arbitrary" && !ctx.modifier) {
1746
- const value = lengthValue(ctx, root);
1747
- if (typeof value === "string") return { position: value };
1748
- }
1749
- const color2 = colorValue(ctx, "surface", registry.palette);
1750
- return typeof color2 === "string" ? { color: color2 } : null;
1751
- }
1752
- function registerMasks(registry) {
1753
- registry.static("mask-none", [["mask-image", "none"]]);
1754
- registry.functional("mask", (ctx) => {
1755
- const value = plainArbitrary(ctx);
1756
- return value && !ctx.negative ? [decl("mask-image", value)] : null;
1757
- });
1758
- for (const value of ["border", "padding", "content", "fill", "stroke", "view"]) {
1759
- registry.static(`mask-clip-${value}`, [["mask-clip", `${value}-box`]]);
1760
- registry.static(`mask-origin-${value}`, [["mask-origin", `${value}-box`]]);
1761
- }
1762
- registry.static("mask-no-clip", [["mask-clip", "no-clip"]]);
1763
- for (const value of ["add", "subtract", "intersect", "exclude"]) {
1764
- registry.static(`mask-${value}`, [["mask-composite", value]]);
1765
- }
1766
- registry.staticGroup(
1767
- "mask-mode",
1768
- { alpha: "alpha", luminance: "luminance", match: "match-source" },
1769
- "mask"
1770
- );
1771
- registry.staticGroup("mask-type", { alpha: "alpha", luminance: "luminance" }, "mask-type");
1772
- registry.staticGroup(
1773
- "mask-position",
1774
- {
1775
- "top-left": "top left",
1776
- top: "top",
1777
- "top-right": "top right",
1778
- left: "left",
1779
- center: "center",
1780
- right: "right",
1781
- "bottom-left": "bottom left",
1782
- bottom: "bottom",
1783
- "bottom-right": "bottom right"
1784
- },
1785
- "mask"
1786
- );
1787
- registry.staticGroup(
1788
- "mask-repeat",
1789
- {
1790
- repeat: "repeat",
1791
- "no-repeat": "no-repeat",
1792
- "repeat-x": "repeat-x",
1793
- "repeat-y": "repeat-y",
1794
- "repeat-round": "round",
1795
- "repeat-space": "space"
1796
- },
1797
- "mask"
1798
- );
1799
- registry.staticGroup("mask-size", { auto: "auto", cover: "cover", contain: "contain" }, "mask");
1800
- for (const [root, property] of [
1801
- ["mask-position", "mask-position"],
1802
- ["mask-size", "mask-size"]
1803
- ]) {
1804
- registry.functional(root, (ctx) => {
1805
- const value = plainArbitrary(ctx);
1806
- return value && !ctx.negative ? [decl(property, value)] : null;
1807
- });
1808
- }
1809
- for (const [edge, sides] of Object.entries(MASK_EDGES)) {
1810
- for (const stop of ["from", "to"]) {
1811
- const root = `mask-${edge}-${stop}`;
1812
- registry.functional(root, (ctx) => {
1813
- const resolved = maskStop(ctx, registry, root);
1814
- if (!resolved) return null;
1815
- const decls = [
1816
- ...MASK_IMAGE,
1817
- decl(
1818
- "--tw-mask-linear",
1819
- "var(--tw-mask-left), var(--tw-mask-right), var(--tw-mask-bottom), var(--tw-mask-top)"
1820
- )
1821
- ];
1822
- for (const side of sides) {
1823
- decls.push(
1824
- decl(
1825
- `--tw-mask-${side}`,
1826
- `linear-gradient(to ${side}, var(--tw-mask-${side}-from-color) var(--tw-mask-${side}-from-position), var(--tw-mask-${side}-to-color) var(--tw-mask-${side}-to-position))`
1827
- ),
1828
- "position" in resolved ? decl(`--tw-mask-${side}-${stop}-position`, resolved.position) : decl(`--tw-mask-${side}-${stop}-color`, resolved.color)
1829
- );
1830
- }
1831
- return decls;
1832
- });
1833
- }
1834
- }
1835
- registry.functional("mask-linear", (ctx) => {
1836
- const name = namedValue(ctx);
1837
- let angle = null;
1838
- if (name !== null && isPositiveInteger(name) && !ctx.modifier) angle = `${name}deg`;
1839
- else angle = plainArbitrary(ctx);
1840
- if (angle === null) return null;
1841
- return [
1842
- ...MASK_IMAGE,
1843
- decl(
1844
- "--tw-mask-linear",
1845
- "linear-gradient(var(--tw-mask-linear-stops, var(--tw-mask-linear-position)))"
1846
- ),
1847
- decl("--tw-mask-linear-position", ctx.negative ? negate(angle) : angle)
1848
- ];
1849
- });
1850
- for (const stop of ["from", "to"]) {
1851
- const root = `mask-linear-${stop}`;
1852
- registry.functional(root, (ctx) => {
1853
- const resolved = maskStop(ctx, registry, root);
1854
- if (!resolved) return null;
1855
- return [
1856
- ...MASK_IMAGE,
1857
- decl(
1858
- "--tw-mask-linear-stops",
1859
- "var(--tw-mask-linear-position), var(--tw-mask-linear-from-color) var(--tw-mask-linear-from-position), var(--tw-mask-linear-to-color) var(--tw-mask-linear-to-position)"
1860
- ),
1861
- decl("--tw-mask-linear", "linear-gradient(var(--tw-mask-linear-stops))"),
1862
- "position" in resolved ? decl(`--tw-mask-linear-${stop}-position`, resolved.position) : decl(`--tw-mask-linear-${stop}-color`, resolved.color)
1863
- ];
1864
- });
1865
- }
1866
- }
1867
- var FILTER = "var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)";
1868
- var BACKDROP = "var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)";
1869
- var FILTERS = [
1870
- ["blur", "blur", BLUR.sm],
1871
- ["brightness", "percent", null],
1872
- ["contrast", "percent", null],
1873
- ["grayscale", "percent", "100%"],
1874
- ["hue-rotate", "angle", null],
1875
- ["invert", "percent", "100%"],
1876
- ["saturate", "percent", null],
1877
- ["sepia", "percent", "100%"]
1878
- ];
1879
- function filterArgument(ctx, kind, bare) {
1880
- if (ctx.modifier) return null;
1881
- if (ctx.value === null) return bare && !ctx.negative ? bare : null;
1882
- if (ctx.value.kind === "arbitrary") return ctx.negative ? null : ctx.value.value;
1883
- const name = ctx.value.value;
1884
- if (kind === "blur") return !ctx.negative && Object.hasOwn(BLUR, name) ? BLUR[name] : null;
1885
- if (!isNumber(name)) return null;
1886
- if (kind === "angle") return ctx.negative ? negate(`${name}deg`) : `${name}deg`;
1887
- return ctx.negative ? null : `${name}%`;
1888
- }
1889
- function registerFilters(registry) {
1890
- registry.static("filter", [["filter", FILTER]]);
1891
- registry.static("filter-none", [["filter", "none"]]);
1892
- registry.functional("filter", (ctx) => {
1893
- const value = plainArbitrary(ctx);
1894
- return value && !ctx.negative ? [decl("filter", value)] : null;
1895
- });
1896
- const backdrop = (value) => [
1897
- decl("-webkit-backdrop-filter", value),
1898
- decl("backdrop-filter", value)
1899
- ];
1900
- registry.static("backdrop-filter", { rules: [{ decls: backdrop(BACKDROP) }] });
1901
- registry.static("backdrop-filter-none", { rules: [{ decls: backdrop("none") }] });
1902
- registry.functional("backdrop-filter", (ctx) => {
1903
- const value = plainArbitrary(ctx);
1904
- return value && !ctx.negative ? backdrop(value) : null;
1905
- });
1906
- for (const [name, kind, bare] of FILTERS) {
1907
- registry.functional(name, (ctx) => {
1908
- if (name === "blur" && namedValue(ctx) === "none" && !ctx.modifier) {
1909
- return [decl("--tw-blur", " "), decl("filter", FILTER)];
1910
- }
1911
- const argument = filterArgument(ctx, kind, bare);
1912
- if (argument === null) return null;
1913
- return [decl(`--tw-${name}`, `${name}(${argument})`), decl("filter", FILTER)];
1914
- });
1915
- registry.functional(`backdrop-${name}`, (ctx) => {
1916
- if (name === "blur" && namedValue(ctx) === "none" && !ctx.modifier) {
1917
- return [decl("--tw-backdrop-blur", " "), ...backdrop(BACKDROP)];
1918
- }
1919
- const argument = filterArgument(ctx, kind, bare);
1920
- if (argument === null) return null;
1921
- return [decl(`--tw-backdrop-${name}`, `${name}(${argument})`), ...backdrop(BACKDROP)];
1922
- });
1923
- }
1924
- registry.functional("backdrop-opacity", (ctx) => {
1925
- const argument = filterArgument(ctx, "percent", null);
1926
- if (argument === null) return null;
1927
- return [decl("--tw-backdrop-opacity", `opacity(${argument})`), ...backdrop(BACKDROP)];
1928
- });
1929
- registry.functional("drop-shadow", (ctx) => {
1930
- if (ctx.negative) return null;
1931
- const name = namedValue(ctx);
1932
- if (name === "none" && !ctx.modifier)
1933
- return [decl("--tw-drop-shadow", " "), decl("filter", FILTER)];
1934
- let shadows = null;
1935
- if (isBare(ctx)) shadows = DROP_SHADOWS.sm;
1936
- else if (name !== null && !ctx.modifier && Object.hasOwn(DROP_SHADOWS, name))
1937
- shadows = DROP_SHADOWS[name];
1938
- if (shadows) {
1939
- return [
1940
- decl(
1941
- "--tw-drop-shadow",
1942
- shadows.map((shadow) => `drop-shadow(${shadow})`).join(" ")
1943
- ),
1944
- decl("filter", FILTER)
1945
- ];
1946
- }
1947
- const color2 = colorValue(ctx, "surface", registry.palette);
1948
- if (color2 === null && ctx.value?.kind === "arbitrary") {
1949
- const arbitrary = plainArbitrary(ctx);
1950
- return arbitrary ? [decl("--tw-drop-shadow", `drop-shadow(${arbitrary})`), decl("filter", FILTER)] : null;
1951
- }
1952
- if (color2 === null || typeof color2 !== "string") return color2;
1953
- return [decl("--tw-drop-shadow-color", color2)];
1954
- });
1955
- }
1956
- function registerEffectUtilities(registry) {
1957
- registerShadows(registry);
1958
- registerMasks(registry);
1959
- registerFilters(registry);
1960
- }
1961
-
1962
- // ../css/src/utilities/interaction.ts
1963
- function registerTables(registry) {
1964
- registry.staticGroup(
1965
- "border-collapse",
1966
- { collapse: "collapse", separate: "separate" },
1967
- "border"
1968
- );
1969
- const spacing = "var(--tw-border-spacing-x) var(--tw-border-spacing-y)";
1970
- for (const [root, axes] of [
1971
- ["border-spacing", ["x", "y"]],
1972
- ["border-spacing-x", ["x"]],
1973
- ["border-spacing-y", ["y"]]
1974
- ]) {
1975
- registry.functional(root, (ctx) => {
1976
- const value = lengthValue(ctx, root);
1977
- if (value === null || typeof value !== "string") return value;
1978
- return [
1979
- ...axes.map((axis) => decl(`--tw-border-spacing-${axis}`, value)),
1980
- decl("border-spacing", spacing)
1981
- ];
1982
- });
1983
- }
1984
- registry.staticGroup("table-layout", { auto: "auto", fixed: "fixed" }, "table");
1985
- registry.staticGroup("caption-side", { top: "top", bottom: "bottom" }, "caption");
1986
- }
1987
- var TRANSITION_DEFAULT = "color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, content-visibility, overlay, pointer-events";
1988
- var TRANSITION_COLORS = "color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to";
1989
- function transition(property) {
1990
- return [
1991
- decl("transition-property", property),
1992
- decl("transition-timing-function", `var(--tw-ease, ${DEFAULT_TRANSITION_EASE})`),
1993
- decl("transition-duration", `var(--tw-duration, ${DEFAULT_TRANSITION_DURATION})`)
1994
- ];
1995
- }
1996
- function registerTransitions(registry) {
1997
- const properties = {
1998
- all: "all",
1999
- colors: TRANSITION_COLORS,
2000
- opacity: "opacity",
2001
- shadow: "box-shadow",
2002
- transform: "transform, translate, scale, rotate"
2003
- };
2004
- registry.static("transition-none", [["transition-property", "none"]]);
2005
- registry.static("transition-discrete", [["transition-behavior", "allow-discrete"]]);
2006
- registry.static("transition-normal", [["transition-behavior", "normal"]]);
2007
- registry.functional("transition", (ctx) => {
2008
- if (ctx.negative || ctx.modifier) return null;
2009
- if (isBare(ctx)) return transition(TRANSITION_DEFAULT);
2010
- const name = namedValue(ctx);
2011
- if (name !== null && Object.hasOwn(properties, name)) return transition(properties[name]);
2012
- const value = plainArbitrary(ctx);
2013
- return value ? transition(value) : null;
2014
- });
2015
- for (const [root, property, variable] of [
2016
- ["duration", "transition-duration", "--tw-duration"],
2017
- ["delay", "transition-delay", null]
2018
- ]) {
2019
- registry.functional(root, (ctx) => {
2020
- if (ctx.negative || ctx.modifier) return null;
2021
- const name = namedValue(ctx);
2022
- let value = null;
2023
- if (name === "initial" && variable) value = "initial";
2024
- else if (name !== null && isNumber(name)) value = `${name}ms`;
2025
- else value = plainArbitrary(ctx);
2026
- if (value === null) return null;
2027
- return variable ? [decl(variable, value), decl(property, value)] : [decl(property, value)];
2028
- });
2029
- }
2030
- registry.functional("ease", (ctx) => {
2031
- if (ctx.negative || ctx.modifier) return null;
2032
- const name = namedValue(ctx);
2033
- let value = null;
2034
- if (name === "initial") value = "initial";
2035
- else if (name !== null && Object.hasOwn(EASE, name)) value = EASE[name];
2036
- else value = plainArbitrary(ctx);
2037
- if (value === null) return null;
2038
- return [decl("--tw-ease", value), decl("transition-timing-function", value)];
2039
- });
2040
- registry.functional("animate", (ctx) => {
2041
- if (ctx.negative || ctx.modifier) return null;
2042
- const name = namedValue(ctx);
2043
- if (name !== null && Object.hasOwn(ANIMATIONS, name)) {
2044
- const animation = ANIMATIONS[name];
2045
- return {
2046
- rules: [{ decls: [decl("animation", animation.value)] }],
2047
- keyframes: animation.keyframes ? [animation.keyframes] : []
2048
- };
2049
- }
2050
- const value = plainArbitrary(ctx);
2051
- return value ? [decl("animation", value)] : null;
2052
- });
2053
- }
2054
- var TRANSFORM = "var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)";
2055
- var ORIGINS = {
2056
- center: "center",
2057
- top: "top",
2058
- "top-right": "top right",
2059
- right: "right",
2060
- "bottom-right": "bottom right",
2061
- bottom: "bottom",
2062
- "bottom-left": "bottom left",
2063
- left: "left",
2064
- "top-left": "top left"
2065
- };
2066
- function angleValue(ctx) {
2067
- if (ctx.modifier) return null;
2068
- const name = namedValue(ctx);
2069
- let value = null;
2070
- if (name !== null && isNumber(name)) value = `${name}deg`;
2071
- else value = plainArbitrary(ctx);
2072
- if (value === null) return null;
2073
- return ctx.negative ? negate(value) : value;
2074
- }
2075
- function registerTransforms(registry) {
2076
- registry.staticGroup(
2077
- "backface-visibility",
2078
- { visible: "visible", hidden: "hidden" },
2079
- "backface"
2080
- );
2081
- registry.functional("perspective", (ctx) => {
2082
- if (ctx.negative || ctx.modifier) return null;
2083
- const name = namedValue(ctx);
2084
- if (name === "none") return [decl("perspective", "none")];
2085
- if (name !== null && Object.hasOwn(PERSPECTIVE, name))
2086
- return [decl("perspective", PERSPECTIVE[name])];
2087
- const value = lengthValue(ctx, "perspective");
2088
- if (value === null || typeof value !== "string") return value;
2089
- return [decl("perspective", value)];
2090
- });
2091
- registry.staticGroup("perspective-origin", ORIGINS, "perspective-origin");
2092
- registry.functional("perspective-origin", (ctx) => {
2093
- const value = plainArbitrary(ctx);
2094
- return value && !ctx.negative ? [decl("perspective-origin", value)] : null;
2095
- });
2096
- registry.static("rotate-none", [["rotate", "none"]]);
2097
- registry.functional("rotate", (ctx) => {
2098
- const value = angleValue(ctx);
2099
- return value ? [decl("rotate", value)] : null;
2100
- });
2101
- for (const axis of ["x", "y", "z"]) {
2102
- registry.functional(`rotate-${axis}`, (ctx) => {
2103
- const value = angleValue(ctx);
2104
- if (!value) return null;
2105
- return [
2106
- decl(`--tw-rotate-${axis}`, `rotate${axis.toUpperCase()}(${value})`),
2107
- decl("transform", TRANSFORM)
2108
- ];
2109
- });
2110
- }
2111
- registry.functional("skew", (ctx) => {
2112
- const value = angleValue(ctx);
2113
- if (!value) return null;
2114
- return [
2115
- decl("--tw-skew-x", `skewX(${value})`),
2116
- decl("--tw-skew-y", `skewY(${value})`),
2117
- decl("transform", TRANSFORM)
2118
- ];
2119
- });
2120
- for (const axis of ["x", "y"]) {
2121
- registry.functional(`skew-${axis}`, (ctx) => {
2122
- const value = angleValue(ctx);
2123
- if (!value) return null;
2124
- return [
2125
- decl(`--tw-skew-${axis}`, `skew${axis.toUpperCase()}(${value})`),
2126
- decl("transform", TRANSFORM)
2127
- ];
2128
- });
2129
- }
2130
- const scaleValue = (ctx) => {
2131
- if (ctx.modifier) return null;
2132
- const name = namedValue(ctx);
2133
- let value = null;
2134
- if (name !== null && isNumber(name)) value = `${name}%`;
2135
- else value = plainArbitrary(ctx);
2136
- if (value === null) return null;
2137
- return ctx.negative ? negate(value) : value;
2138
- };
2139
- registry.static("scale-none", [["scale", "none"]]);
2140
- registry.static("scale-3d", [
2141
- ["scale", "var(--tw-scale-x) var(--tw-scale-y) var(--tw-scale-z)"]
2142
- ]);
2143
- registry.functional("scale", (ctx) => {
2144
- if (ctx.value?.kind === "arbitrary" && !ctx.negative) {
2145
- const value2 = plainArbitrary(ctx);
2146
- return value2 ? [decl("scale", value2)] : null;
2147
- }
2148
- const value = scaleValue(ctx);
2149
- if (!value) return null;
2150
- return [
2151
- decl("--tw-scale-x", value),
2152
- decl("--tw-scale-y", value),
2153
- decl("--tw-scale-z", value),
2154
- decl("scale", "var(--tw-scale-x) var(--tw-scale-y)")
2155
- ];
2156
- });
2157
- for (const axis of ["x", "y", "z"]) {
2158
- registry.functional(`scale-${axis}`, (ctx) => {
2159
- const value = scaleValue(ctx);
2160
- if (!value) return null;
2161
- return [
2162
- decl(`--tw-scale-${axis}`, value),
2163
- decl(
2164
- "scale",
2165
- axis === "z" ? "var(--tw-scale-x) var(--tw-scale-y) var(--tw-scale-z)" : "var(--tw-scale-x) var(--tw-scale-y)"
2166
- )
2167
- ];
2168
- });
2169
- }
2170
- registry.static("transform", [["transform", TRANSFORM]]);
2171
- registry.static("transform-cpu", [["transform", TRANSFORM]]);
2172
- registry.static("transform-gpu", [["transform", `translateZ(0) ${TRANSFORM}`]]);
2173
- registry.static("transform-none", [["transform", "none"]]);
2174
- registry.functional("transform", (ctx) => {
2175
- const value = plainArbitrary(ctx);
2176
- return value && !ctx.negative ? [decl("transform", value)] : null;
2177
- });
2178
- registry.staticGroup("transform-style", { "3d": "preserve-3d", flat: "flat" }, "transform");
2179
- registry.staticGroup("transform-origin", ORIGINS, "origin");
2180
- registry.functional("origin", (ctx) => {
2181
- const value = plainArbitrary(ctx);
2182
- return value && !ctx.negative ? [decl("transform-origin", value)] : null;
2183
- });
2184
- const translateOptions = {
2185
- keywords: { full: "100%" },
2186
- fractions: true,
2187
- negative: true
2188
- };
2189
- registry.static("translate-none", [["translate", "none"]]);
2190
- registry.static("translate-3d", [
2191
- ["translate", "var(--tw-translate-x) var(--tw-translate-y) var(--tw-translate-z)"]
2192
- ]);
2193
- registry.functional("translate", (ctx) => {
2194
- const value = lengthValue(ctx, "translate", translateOptions);
2195
- if (value === null || typeof value !== "string") return value;
2196
- return [
2197
- decl("--tw-translate-x", value),
2198
- decl("--tw-translate-y", value),
2199
- decl("translate", "var(--tw-translate-x) var(--tw-translate-y)")
2200
- ];
2201
- });
2202
- for (const axis of ["x", "y", "z"]) {
2203
- registry.functional(`translate-${axis}`, (ctx) => {
2204
- const value = lengthValue(ctx, `translate-${axis}`, translateOptions);
2205
- if (value === null || typeof value !== "string") return value;
2206
- return [
2207
- decl(`--tw-translate-${axis}`, value),
2208
- decl(
2209
- "translate",
2210
- axis === "z" ? "var(--tw-translate-x) var(--tw-translate-y) var(--tw-translate-z)" : "var(--tw-translate-x) var(--tw-translate-y)"
2211
- )
2212
- ];
2213
- });
2214
- }
2215
- }
2216
- var CURSORS = [
2217
- "auto",
2218
- "default",
2219
- "pointer",
2220
- "wait",
2221
- "text",
2222
- "move",
2223
- "help",
2224
- "not-allowed",
2225
- "none",
2226
- "context-menu",
2227
- "progress",
2228
- "cell",
2229
- "crosshair",
2230
- "vertical-text",
2231
- "alias",
2232
- "copy",
2233
- "no-drop",
2234
- "grab",
2235
- "grabbing",
2236
- "all-scroll",
2237
- "col-resize",
2238
- "row-resize",
2239
- "n-resize",
2240
- "e-resize",
2241
- "s-resize",
2242
- "w-resize",
2243
- "ne-resize",
2244
- "nw-resize",
2245
- "se-resize",
2246
- "sw-resize",
2247
- "ew-resize",
2248
- "ns-resize",
2249
- "nesw-resize",
2250
- "nwse-resize",
2251
- "zoom-in",
2252
- "zoom-out"
2253
- ];
2254
- var SCROLL_SIDES = [
2255
- ["", ""],
2256
- ["x", "-inline"],
2257
- ["y", "-block"],
2258
- ["s", "-inline-start"],
2259
- ["e", "-inline-end"],
2260
- ["t", "-top"],
2261
- ["r", "-right"],
2262
- ["b", "-bottom"],
2263
- ["l", "-left"]
2264
- ];
2265
- function registerInteractivity(registry) {
2266
- for (const [root, property] of [
2267
- ["accent", "accent-color"],
2268
- ["caret", "caret-color"]
2269
- ]) {
2270
- registry.functional(root, (ctx) => {
2271
- if (root === "accent" && namedValue(ctx) === "auto" && !ctx.modifier) {
2272
- return [decl(property, "auto")];
2273
- }
2274
- const color2 = colorValue(ctx, "text", registry.palette);
2275
- if (color2 === null || typeof color2 !== "string") return color2;
2276
- return [decl(property, color2)];
2277
- });
2278
- }
2279
- registry.staticGroup("appearance", { none: "none", auto: "auto" }, "appearance");
2280
- registry.staticGroup(
2281
- "color-scheme",
2282
- {
2283
- normal: "normal",
2284
- dark: "dark",
2285
- light: "light",
2286
- "light-dark": "light dark",
2287
- "only-dark": "only dark",
2288
- "only-light": "only light"
2289
- },
2290
- "scheme"
2291
- );
2292
- for (const cursor of CURSORS) registry.static(`cursor-${cursor}`, [["cursor", cursor]]);
2293
- registry.functional("cursor", (ctx) => {
2294
- const value = plainArbitrary(ctx);
2295
- return value && !ctx.negative ? [decl("cursor", value)] : null;
2296
- });
2297
- registry.staticGroup("field-sizing", { fixed: "fixed", content: "content" }, "field-sizing");
2298
- registry.staticGroup("pointer-events", { none: "none", auto: "auto" }, "pointer-events");
2299
- registry.static("resize", [["resize", "both"]]);
2300
- registry.staticGroup("resize", { none: "none", x: "horizontal", y: "vertical" }, "resize");
2301
- registry.staticGroup("scroll-behavior", { auto: "auto", smooth: "smooth" }, "scroll");
2302
- for (const [side, suffix] of SCROLL_SIDES) {
2303
- for (const [prefix, property, negative] of [
2304
- ["scroll-m", "scroll-margin", true],
2305
- ["scroll-p", "scroll-padding", false]
2306
- ]) {
2307
- const root = `${prefix}${side}`;
2308
- registry.functional(root, (ctx) => {
2309
- const value = lengthValue(ctx, root, { negative });
2310
- if (value === null || typeof value !== "string") return value;
2311
- return [decl(`${property}${suffix}`, value)];
2312
- });
2313
- }
2314
- }
2315
- registry.staticGroup(
2316
- "scroll-snap-align",
2317
- { start: "start", end: "end", center: "center", "align-none": "none" },
2318
- "snap"
2319
- );
2320
- registry.staticGroup("scroll-snap-stop", { normal: "normal", always: "always" }, "snap");
2321
- registry.static("snap-none", [["scroll-snap-type", "none"]]);
2322
- for (const axis of ["x", "y", "both"]) {
2323
- registry.static(`snap-${axis}`, [
2324
- ["scroll-snap-type", `${axis} var(--tw-scroll-snap-strictness)`]
2325
- ]);
2326
- }
2327
- for (const strictness of ["mandatory", "proximity"]) {
2328
- registry.static(`snap-${strictness}`, [["--tw-scroll-snap-strictness", strictness]]);
2329
- }
2330
- registry.staticGroup(
2331
- "touch-action",
2332
- { auto: "auto", none: "none", manipulation: "manipulation" },
2333
- "touch"
2334
- );
2335
- const touch = "var(--tw-pan-x,) var(--tw-pan-y,) var(--tw-pinch-zoom,)";
2336
- for (const [name, variable] of [
2337
- ["pan-x", "--tw-pan-x"],
2338
- ["pan-left", "--tw-pan-x"],
2339
- ["pan-right", "--tw-pan-x"],
2340
- ["pan-y", "--tw-pan-y"],
2341
- ["pan-up", "--tw-pan-y"],
2342
- ["pan-down", "--tw-pan-y"],
2343
- ["pinch-zoom", "--tw-pinch-zoom"]
2344
- ]) {
2345
- registry.static(`touch-${name}`, [
2346
- [variable, name],
2347
- ["touch-action", touch]
2348
- ]);
2349
- }
2350
- for (const value of ["none", "text", "all", "auto"]) {
2351
- registry.static(`select-${value}`, [
2352
- ["-webkit-user-select", value],
2353
- ["user-select", value]
2354
- ]);
2355
- }
2356
- registry.staticGroup(
2357
- "will-change",
2358
- { auto: "auto", scroll: "scroll-position", contents: "contents", transform: "transform" },
2359
- "will-change"
2360
- );
2361
- registry.functional("will-change", (ctx) => {
2362
- const value = plainArbitrary(ctx);
2363
- return value && !ctx.negative ? [decl("will-change", value)] : null;
2364
- });
2365
- }
2366
- var CONTAIN = "var(--tw-contain-size,) var(--tw-contain-layout,) var(--tw-contain-paint,) var(--tw-contain-style,)";
2367
- function registerContain(registry) {
2368
- registry.staticGroup(
2369
- "contain",
2370
- { none: "none", content: "content", strict: "strict" },
2371
- "contain"
2372
- );
2373
- for (const [name, variable] of [
2374
- ["size", "--tw-contain-size"],
2375
- ["inline-size", "--tw-contain-size"],
2376
- ["layout", "--tw-contain-layout"],
2377
- ["paint", "--tw-contain-paint"],
2378
- ["style", "--tw-contain-style"]
2379
- ]) {
2380
- registry.static(`contain-${name}`, [
2381
- [variable, name],
2382
- ["contain", CONTAIN]
2383
- ]);
2384
- }
2385
- registry.functional("contain", (ctx) => {
2386
- const value = plainArbitrary(ctx);
2387
- return value && !ctx.negative ? [decl("contain", value)] : null;
2388
- });
2389
- }
2390
- function registerAccessibility(registry) {
2391
- registry.static("sr-only", [
2392
- ["position", "absolute"],
2393
- ["width", "1px"],
2394
- ["height", "1px"],
2395
- ["padding", "0"],
2396
- ["margin", "-1px"],
2397
- ["overflow", "hidden"],
2398
- ["clip-path", "inset(50%)"],
2399
- ["white-space", "nowrap"],
2400
- ["border-width", "0"]
2401
- ]);
2402
- registry.static("not-sr-only", [
2403
- ["position", "static"],
2404
- ["width", "auto"],
2405
- ["height", "auto"],
2406
- ["padding", "0"],
2407
- ["margin", "0"],
2408
- ["overflow", "visible"],
2409
- ["clip-path", "none"],
2410
- ["white-space", "normal"]
2411
- ]);
2412
- registry.staticGroup(
2413
- "forced-color-adjust",
2414
- { auto: "auto", none: "none" },
2415
- "forced-color-adjust"
2416
- );
2417
- }
2418
- function registerContainer(registry) {
2419
- registry.static("@container-normal", [["container-type", "normal"]]);
2420
- registry.functional("@container", (ctx) => {
2421
- if (ctx.negative || ctx.value) return null;
2422
- if (!ctx.modifier) return [decl("container-type", "inline-size")];
2423
- if (ctx.modifier.kind !== "named" || !/^[a-zA-Z0-9_-]+$/.test(ctx.modifier.value))
2424
- return null;
2425
- return [decl("container-type", "inline-size"), decl("container-name", ctx.modifier.value)];
2426
- });
2427
- }
2428
- function registerInteractionUtilities(registry) {
2429
- registerTables(registry);
2430
- registerTransitions(registry);
2431
- registerTransforms(registry);
2432
- registerInteractivity(registry);
2433
- registerContain(registry);
2434
- registerAccessibility(registry);
2435
- registerContainer(registry);
2436
- }
2437
-
2438
- // ../css/src/utilities/layout.ts
2439
- function lengthUtility(registry, root, properties, options = {}) {
2440
- registry.functional(root, (ctx) => {
2441
- const value = lengthValue(ctx, root, options);
2442
- if (value === null || typeof value !== "string") return value;
2443
- return properties.map((property) => decl(property, value));
2444
- });
2445
- }
2446
- function registerLayout(registry) {
2447
- registry.functional("aspect", (ctx) => {
2448
- if (ctx.fraction) return [decl("aspect-ratio", ctx.fraction.replace("/", " / "))];
2449
- const name = namedValue(ctx);
2450
- if (name !== null && !ctx.modifier && Object.hasOwn(ASPECT, name)) {
2451
- return [decl("aspect-ratio", ASPECT[name])];
2452
- }
2453
- const value = plainArbitrary(ctx);
2454
- return value ? [decl("aspect-ratio", value)] : null;
2455
- });
2456
- registry.functional("columns", (ctx) => {
2457
- const count = integerValue(ctx);
2458
- if (count) return [decl("columns", count)];
2459
- if (namedValue(ctx) === "auto" && !ctx.modifier) return [decl("columns", "auto")];
2460
- const value = lengthValue(ctx, "columns");
2461
- if (value === null || typeof value !== "string") return value;
2462
- return [decl("columns", value)];
2463
- });
2464
- const breaks = {
2465
- auto: "auto",
2466
- avoid: "avoid",
2467
- all: "all",
2468
- "avoid-page": "avoid-page",
2469
- page: "page",
2470
- left: "left",
2471
- right: "right",
2472
- column: "column"
2473
- };
2474
- registry.staticGroup("break-after", breaks, "break-after");
2475
- registry.staticGroup("break-before", breaks, "break-before");
2476
- registry.staticGroup(
2477
- "break-inside",
2478
- {
2479
- auto: "auto",
2480
- avoid: "avoid",
2481
- "avoid-page": "avoid-page",
2482
- "avoid-column": "avoid-column"
2483
- },
2484
- "break-inside"
2485
- );
2486
- for (const value of ["clone", "slice"]) {
2487
- registry.static(`box-decoration-${value}`, [
2488
- ["-webkit-box-decoration-break", value],
2489
- ["box-decoration-break", value]
2490
- ]);
2491
- }
2492
- registry.staticGroup("box-sizing", { border: "border-box", content: "content-box" }, "box");
2493
- registry.staticGroup("display", {
2494
- inline: "inline",
2495
- block: "block",
2496
- "inline-block": "inline-block",
2497
- "flow-root": "flow-root",
2498
- flex: "flex",
2499
- "inline-flex": "inline-flex",
2500
- grid: "grid",
2501
- "inline-grid": "inline-grid",
2502
- contents: "contents",
2503
- table: "table",
2504
- "inline-table": "inline-table",
2505
- "table-caption": "table-caption",
2506
- "table-cell": "table-cell",
2507
- "table-column": "table-column",
2508
- "table-column-group": "table-column-group",
2509
- "table-footer-group": "table-footer-group",
2510
- "table-header-group": "table-header-group",
2511
- "table-row-group": "table-row-group",
2512
- "table-row": "table-row",
2513
- "list-item": "list-item",
2514
- hidden: "none"
2515
- });
2516
- registry.staticGroup(
2517
- "float",
2518
- { right: "right", left: "left", start: "inline-start", end: "inline-end", none: "none" },
2519
- "float"
2520
- );
2521
- registry.staticGroup(
2522
- "clear",
2523
- {
2524
- left: "left",
2525
- right: "right",
2526
- both: "both",
2527
- none: "none",
2528
- start: "inline-start",
2529
- end: "inline-end"
2530
- },
2531
- "clear"
2532
- );
2533
- registry.static("isolate", [["isolation", "isolate"]]);
2534
- registry.static("isolation-auto", [["isolation", "auto"]]);
2535
- registry.staticGroup(
2536
- "object-fit",
2537
- {
2538
- contain: "contain",
2539
- cover: "cover",
2540
- fill: "fill",
2541
- none: "none",
2542
- "scale-down": "scale-down"
2543
- },
2544
- "object"
2545
- );
2546
- const objectPositions = {
2547
- bottom: "bottom",
2548
- center: "center",
2549
- left: "left",
2550
- "left-bottom": "left bottom",
2551
- "left-top": "left top",
2552
- right: "right",
2553
- "right-bottom": "right bottom",
2554
- "right-top": "right top",
2555
- top: "top",
2556
- "top-left": "left top",
2557
- "top-right": "right top",
2558
- "bottom-left": "left bottom",
2559
- "bottom-right": "right bottom"
2560
- };
2561
- registry.staticGroup("object-position", objectPositions, "object");
2562
- registry.functional("object", (ctx) => {
2563
- const value = plainArbitrary(ctx);
2564
- return value ? [decl("object-position", value)] : null;
2565
- });
2566
- const overflows = {
2567
- auto: "auto",
2568
- hidden: "hidden",
2569
- clip: "clip",
2570
- visible: "visible",
2571
- scroll: "scroll"
2572
- };
2573
- registry.staticGroup("overflow", overflows, "overflow");
2574
- registry.staticGroup("overflow-x", overflows, "overflow-x");
2575
- registry.staticGroup("overflow-y", overflows, "overflow-y");
2576
- const overscrolls = { auto: "auto", contain: "contain", none: "none" };
2577
- registry.staticGroup("overscroll-behavior", overscrolls, "overscroll");
2578
- registry.staticGroup("overscroll-behavior-x", overscrolls, "overscroll-x");
2579
- registry.staticGroup("overscroll-behavior-y", overscrolls, "overscroll-y");
2580
- registry.staticGroup("position", {
2581
- static: "static",
2582
- fixed: "fixed",
2583
- absolute: "absolute",
2584
- relative: "relative",
2585
- sticky: "sticky"
2586
- });
2587
- const insetOptions = {
2588
- keywords: { auto: "auto", full: "100%" },
2589
- fractions: true,
2590
- negative: true
2591
- };
2592
- lengthUtility(registry, "inset", ["inset"], insetOptions);
2593
- lengthUtility(registry, "inset-x", ["inset-inline"], insetOptions);
2594
- lengthUtility(registry, "inset-y", ["inset-block"], insetOptions);
2595
- lengthUtility(registry, "start", ["inset-inline-start"], insetOptions);
2596
- lengthUtility(registry, "end", ["inset-inline-end"], insetOptions);
2597
- lengthUtility(registry, "top", ["top"], insetOptions);
2598
- lengthUtility(registry, "right", ["right"], insetOptions);
2599
- lengthUtility(registry, "bottom", ["bottom"], insetOptions);
2600
- lengthUtility(registry, "left", ["left"], insetOptions);
2601
- registry.staticGroup("visibility", {
2602
- visible: "visible",
2603
- invisible: "hidden",
2604
- collapse: "collapse"
2605
- });
2606
- registry.functional("z", (ctx) => {
2607
- if (namedValue(ctx) === "auto" && !ctx.negative && !ctx.modifier)
2608
- return [decl("z-index", "auto")];
2609
- const value = integerValue(ctx) ?? plainArbitrary(ctx);
2610
- if (value === null) return null;
2611
- return [decl("z-index", ctx.negative ? negate(value) : value)];
2612
- });
2613
- }
2614
- function registerFlexGrid(registry) {
2615
- lengthUtility(registry, "basis", ["flex-basis"], {
2616
- keywords: { auto: "auto", full: "100%" },
2617
- fractions: true
2618
- });
2619
- registry.staticGroup(
2620
- "flex-direction",
2621
- {
2622
- row: "row",
2623
- "row-reverse": "row-reverse",
2624
- col: "column",
2625
- "col-reverse": "column-reverse"
2626
- },
2627
- "flex"
2628
- );
2629
- registry.staticGroup(
2630
- "flex-wrap",
2631
- { wrap: "wrap", "wrap-reverse": "wrap-reverse", nowrap: "nowrap" },
2632
- "flex"
2633
- );
2634
- registry.functional("flex", (ctx) => {
2635
- if (ctx.negative) return null;
2636
- if (ctx.fraction) {
2637
- const percent = fractionToPercent(ctx.fraction);
2638
- return percent ? [decl("flex", percent)] : null;
2639
- }
2640
- const name = namedValue(ctx);
2641
- const keywords = {
2642
- auto: "1 1 auto",
2643
- initial: "0 1 auto",
2644
- none: "none"
2645
- };
2646
- if (name !== null && !ctx.modifier && Object.hasOwn(keywords, name)) {
2647
- return [decl("flex", keywords[name])];
2648
- }
2649
- const value = integerValue(ctx) ?? plainArbitrary(ctx);
2650
- return value ? [decl("flex", value)] : null;
2651
- });
2652
- for (const [root, property] of [
2653
- ["grow", "flex-grow"],
2654
- ["shrink", "flex-shrink"],
2655
- ["flex-grow", "flex-grow"],
2656
- ["flex-shrink", "flex-shrink"]
2657
- ]) {
2658
- registry.functional(root, (ctx) => {
2659
- if (ctx.negative) return null;
2660
- if (isBare(ctx)) return [decl(property, "1")];
2661
- const value = integerValue(ctx) ?? plainArbitrary(ctx);
2662
- return value ? [decl(property, value)] : null;
2663
- });
2664
- }
2665
- registry.functional("order", (ctx) => {
2666
- const keywords = {
2667
- first: "-9999",
2668
- last: "9999",
2669
- none: "0"
2670
- };
2671
- const name = namedValue(ctx);
2672
- if (name !== null && !ctx.negative && Object.hasOwn(keywords, name)) {
2673
- return [decl("order", keywords[name])];
2674
- }
2675
- const value = integerValue(ctx) ?? plainArbitrary(ctx);
2676
- if (value === null) return null;
2677
- return [decl("order", ctx.negative ? negate(value) : value)];
2678
- });
2679
- for (const [root, property] of [
2680
- ["grid-cols", "grid-template-columns"],
2681
- ["grid-rows", "grid-template-rows"]
2682
- ]) {
2683
- registry.functional(root, (ctx) => {
2684
- if (ctx.negative) return null;
2685
- const name = namedValue(ctx);
2686
- if ((name === "none" || name === "subgrid") && !ctx.modifier)
2687
- return [decl(property, name)];
2688
- const count = integerValue(ctx);
2689
- if (count) return [decl(property, `repeat(${count}, minmax(0, 1fr))`)];
2690
- const value = plainArbitrary(ctx);
2691
- return value ? [decl(property, value)] : null;
2692
- });
2693
- }
2694
- for (const [root, property] of [
2695
- ["col", "grid-column"],
2696
- ["row", "grid-row"]
2697
- ]) {
2698
- registry.functional(root, (ctx) => {
2699
- const name = namedValue(ctx);
2700
- if (name === "auto" && !ctx.negative && !ctx.modifier) return [decl(property, "auto")];
2701
- const value = integerValue(ctx) ?? plainArbitrary(ctx);
2702
- if (value === null) return null;
2703
- return [decl(property, ctx.negative ? negate(value) : value)];
2704
- });
2705
- registry.functional(`${root}-span`, (ctx) => {
2706
- if (ctx.negative) return null;
2707
- if (namedValue(ctx) === "full" && !ctx.modifier) return [decl(property, "1 / -1")];
2708
- const value = integerValue(ctx) ?? plainArbitrary(ctx);
2709
- return value ? [decl(property, `span ${value} / span ${value}`)] : null;
2710
- });
2711
- for (const edge of ["start", "end"]) {
2712
- registry.functional(`${root}-${edge}`, (ctx) => {
2713
- const name = namedValue(ctx);
2714
- if (name === "auto" && !ctx.negative && !ctx.modifier) {
2715
- return [decl(`${property}-${edge}`, "auto")];
2716
- }
2717
- const value = integerValue(ctx) ?? plainArbitrary(ctx);
2718
- if (value === null) return null;
2719
- return [decl(`${property}-${edge}`, ctx.negative ? negate(value) : value)];
2720
- });
2721
- }
2722
- }
2723
- registry.staticGroup(
2724
- "grid-auto-flow",
2725
- {
2726
- row: "row",
2727
- col: "column",
2728
- dense: "dense",
2729
- "row-dense": "row dense",
2730
- "col-dense": "column dense"
2731
- },
2732
- "grid-flow"
2733
- );
2734
- for (const [root, property] of [
2735
- ["auto-cols", "grid-auto-columns"],
2736
- ["auto-rows", "grid-auto-rows"]
2737
- ]) {
2738
- registry.functional(root, (ctx) => {
2739
- if (ctx.negative) return null;
2740
- const keywords = {
2741
- auto: "auto",
2742
- min: "min-content",
2743
- max: "max-content",
2744
- fr: "minmax(0, 1fr)"
2745
- };
2746
- const name = namedValue(ctx);
2747
- if (name !== null && !ctx.modifier && Object.hasOwn(keywords, name)) {
2748
- return [decl(property, keywords[name])];
2749
- }
2750
- const value = plainArbitrary(ctx);
2751
- return value ? [decl(property, value)] : null;
2752
- });
2753
- }
2754
- lengthUtility(registry, "gap", ["gap"]);
2755
- lengthUtility(registry, "gap-x", ["column-gap"]);
2756
- lengthUtility(registry, "gap-y", ["row-gap"]);
2757
- registry.staticGroup(
2758
- "justify-content",
2759
- {
2760
- normal: "normal",
2761
- start: "flex-start",
2762
- end: "flex-end",
2763
- "end-safe": "safe flex-end",
2764
- center: "center",
2765
- "center-safe": "safe center",
2766
- between: "space-between",
2767
- around: "space-around",
2768
- evenly: "space-evenly",
2769
- stretch: "stretch",
2770
- baseline: "baseline"
2771
- },
2772
- "justify"
2773
- );
2774
- registry.staticGroup(
2775
- "justify-items",
2776
- {
2777
- start: "start",
2778
- end: "end",
2779
- "end-safe": "safe end",
2780
- center: "center",
2781
- "center-safe": "safe center",
2782
- stretch: "stretch",
2783
- normal: "normal"
2784
- },
2785
- "justify-items"
2786
- );
2787
- registry.staticGroup(
2788
- "justify-self",
2789
- {
2790
- auto: "auto",
2791
- start: "start",
2792
- end: "end",
2793
- "end-safe": "safe end",
2794
- center: "center",
2795
- "center-safe": "safe center",
2796
- stretch: "stretch"
2797
- },
2798
- "justify-self"
2799
- );
2800
- registry.staticGroup(
2801
- "align-content",
2802
- {
2803
- normal: "normal",
2804
- center: "center",
2805
- start: "flex-start",
2806
- end: "flex-end",
2807
- between: "space-between",
2808
- around: "space-around",
2809
- evenly: "space-evenly",
2810
- baseline: "baseline",
2811
- stretch: "stretch"
2812
- },
2813
- "content"
2814
- );
2815
- registry.staticGroup(
2816
- "align-items",
2817
- {
2818
- start: "flex-start",
2819
- end: "flex-end",
2820
- "end-safe": "safe flex-end",
2821
- center: "center",
2822
- "center-safe": "safe center",
2823
- baseline: "baseline",
2824
- "baseline-last": "last baseline",
2825
- stretch: "stretch"
2826
- },
2827
- "items"
2828
- );
2829
- registry.staticGroup(
2830
- "align-self",
2831
- {
2832
- auto: "auto",
2833
- start: "flex-start",
2834
- end: "flex-end",
2835
- "end-safe": "safe flex-end",
2836
- center: "center",
2837
- "center-safe": "safe center",
2838
- stretch: "stretch",
2839
- baseline: "baseline",
2840
- "baseline-last": "last baseline"
2841
- },
2842
- "self"
2843
- );
2844
- registry.staticGroup(
2845
- "place-content",
2846
- {
2847
- center: "center",
2848
- "center-safe": "safe center",
2849
- start: "start",
2850
- end: "end",
2851
- "end-safe": "safe end",
2852
- between: "space-between",
2853
- around: "space-around",
2854
- evenly: "space-evenly",
2855
- baseline: "baseline",
2856
- stretch: "stretch"
2857
- },
2858
- "place-content"
2859
- );
2860
- registry.staticGroup(
2861
- "place-items",
2862
- {
2863
- start: "start",
2864
- end: "end",
2865
- "end-safe": "safe end",
2866
- center: "center",
2867
- "center-safe": "safe center",
2868
- baseline: "baseline",
2869
- stretch: "stretch"
2870
- },
2871
- "place-items"
2872
- );
2873
- registry.staticGroup(
2874
- "place-self",
2875
- {
2876
- auto: "auto",
2877
- start: "start",
2878
- end: "end",
2879
- "end-safe": "safe end",
2880
- center: "center",
2881
- "center-safe": "safe center",
2882
- stretch: "stretch"
2883
- },
2884
- "place-self"
2885
- );
2886
- }
2887
- var SIDES = [
2888
- ["", ""],
2889
- ["x", "-inline"],
2890
- ["y", "-block"],
2891
- ["s", "-inline-start"],
2892
- ["e", "-inline-end"],
2893
- ["t", "-top"],
2894
- ["r", "-right"],
2895
- ["b", "-bottom"],
2896
- ["l", "-left"]
2897
- ];
2898
- function registerSpacing(registry) {
2899
- for (const [side, suffix] of SIDES) {
2900
- lengthUtility(registry, `p${side}`, [`padding${suffix}`]);
2901
- lengthUtility(registry, `m${side}`, [`margin${suffix}`], {
2902
- keywords: { auto: "auto" },
2903
- negative: true
2904
- });
2905
- }
2906
- for (const axis of ["x", "y"]) {
2907
- const [start, end] = axis === "x" ? ["margin-inline-start", "margin-inline-end"] : ["margin-block-start", "margin-block-end"];
2908
- const reverse = `--tw-space-${axis}-reverse`;
2909
- const children = (self) => `:where(${self} > :not(:last-child))`;
2910
- registry.functional(`space-${axis}`, (ctx) => {
2911
- const value = lengthValue(ctx, `space-${axis}`, { negative: true });
2912
- if (value === null || typeof value !== "string") return value;
2913
- return {
2914
- rules: [
2915
- {
2916
- selector: children,
2917
- decls: [
2918
- decl(reverse, "0"),
2919
- decl(start, `calc(${value} * var(${reverse}))`),
2920
- decl(end, `calc(${value} * calc(1 - var(${reverse})))`)
2921
- ]
2922
- }
2923
- ]
2924
- };
2925
- });
2926
- registry.static(`space-${axis}-reverse`, {
2927
- rules: [{ selector: children, decls: [decl(reverse, "1")] }]
2928
- });
2929
- }
2930
- }
2931
- function registerSizing(registry) {
2932
- const common = {
2933
- auto: "auto",
2934
- full: "100%",
2935
- min: "min-content",
2936
- max: "max-content",
2937
- fit: "fit-content"
2938
- };
2939
- lengthUtility(registry, "w", ["width"], {
2940
- keywords: { ...common, screen: "100vw", dvw: "100dvw", svw: "100svw", lvw: "100lvw" },
2941
- fractions: true
2942
- });
2943
- lengthUtility(registry, "min-w", ["min-width"], {
2944
- keywords: { ...common, screen: "100vw" },
2945
- fractions: true
2946
- });
2947
- lengthUtility(registry, "max-w", ["max-width"], {
2948
- keywords: {
2949
- none: "none",
2950
- full: "100%",
2951
- min: "min-content",
2952
- max: "max-content",
2953
- fit: "fit-content",
2954
- screen: "100vw"
2955
- },
2956
- fractions: true
2957
- });
2958
- const heights = { screen: "100vh", dvh: "100dvh", svh: "100svh", lvh: "100lvh", lh: "1lh" };
2959
- lengthUtility(registry, "h", ["height"], {
2960
- keywords: { ...common, ...heights },
2961
- fractions: true
2962
- });
2963
- lengthUtility(registry, "min-h", ["min-height"], {
2964
- keywords: { ...common, ...heights },
2965
- fractions: true
2966
- });
2967
- lengthUtility(registry, "max-h", ["max-height"], {
2968
- keywords: {
2969
- none: "none",
2970
- full: "100%",
2971
- min: "min-content",
2972
- max: "max-content",
2973
- fit: "fit-content",
2974
- ...heights
2975
- },
2976
- fractions: true
2977
- });
2978
- lengthUtility(registry, "size", ["width", "height"], { keywords: common, fractions: true });
2979
- registry.static("container", {
2980
- rules: [
2981
- { decls: [decl("width", "100%")] },
2982
- ...BREAKPOINTS.map(([, width]) => ({
2983
- decls: [decl("max-width", `${width}px`)],
2984
- atRules: [`@media (width >= ${width}px)`]
2985
- }))
2986
- ]
2987
- });
2988
- }
2989
- function registerLayoutUtilities(registry) {
2990
- registerLayout(registry);
2991
- registerFlexGrid(registry);
2992
- registerSpacing(registry);
2993
- registerSizing(registry);
2994
- }
2995
-
2996
- // ../css/src/utilities/typography.ts
2997
- var TYPO_HINT = "d\xF9ng class typo Leaf (`display-*`, `heading-*`, `body-*`, `body-*-highlight`)";
2998
- var FONT_SIZES = /* @__PURE__ */ new Set([
2999
- "xs",
3000
- "sm",
3001
- "base",
3002
- "lg",
3003
- "xl",
3004
- "2xl",
3005
- "3xl",
3006
- "4xl",
3007
- "5xl",
3008
- "6xl",
3009
- "7xl",
3010
- "8xl",
3011
- "9xl"
3012
- ]);
3013
- function registerForbidden(registry) {
3014
- const forbid = (message, names) => (ctx) => {
3015
- if (!ctx.value || ctx.negative) return null;
3016
- if (ctx.value.kind === "arbitrary" || names.test(ctx.value.value)) return reject(message);
3017
- return null;
3018
- };
3019
- registry.functional(
3020
- "font",
3021
- forbid(
3022
- `Font (weight / family / stretch) \u2014 ${TYPO_HINT}`,
3023
- /^(?:thin|extralight|light|normal|medium|semibold|bold|extrabold|black|sans|serif|mono|stretch-.+|features-.+)$/
3024
- )
3025
- );
3026
- registry.functional(
3027
- "leading",
3028
- forbid(
3029
- `Line-height \u2014 ${TYPO_HINT}`,
3030
- /^(?:none|tight|snug|normal|relaxed|loose|\d+(?:\.\d+)?)$/
3031
- )
3032
- );
3033
- registry.functional(
3034
- "tracking",
3035
- forbid(`Letter-spacing \u2014 ${TYPO_HINT}`, /^(?:tighter|tight|normal|wide|wider|widest)$/)
3036
- );
3037
- for (const name of ["italic", "not-italic"]) {
3038
- registry.functional(
3039
- name,
3040
- (ctx) => isBare(ctx) ? reject(`Font-style \u2014 ${TYPO_HINT}`) : null
3041
- );
3042
- }
3043
- for (const name of ["antialiased", "subpixel-antialiased"]) {
3044
- registry.functional(
3045
- name,
3046
- (ctx) => isBare(ctx) ? reject(`Font-smoothing \u0111\xE3 \u0111\u1EB7t s\u1EB5n trong Leaf \u2014 ${TYPO_HINT}`) : null
3047
- );
3048
- }
3049
- }
3050
- function registerTypographyUtilities(registry) {
3051
- registerForbidden(registry);
3052
- registry.functional("text", (ctx) => {
3053
- const name = namedValue(ctx);
3054
- if (name !== null && FONT_SIZES.has(name)) return reject(`C\u1EE1 ch\u1EEF \u2014 ${TYPO_HINT}`);
3055
- if (ctx.value?.kind === "arbitrary") {
3056
- return reject(
3057
- `\`text-[..]\` kh\xF4ng d\xF9ng \u0111\u01B0\u1EE3c \u2014 c\u1EE1 ch\u1EEF: ${TYPO_HINT}; m\xE0u: class m\xE0u Leaf`
3058
- );
3059
- }
3060
- const color2 = colorValue(ctx, "text", registry.palette);
3061
- if (color2 === null || typeof color2 !== "string") return color2;
3062
- return [decl("color", color2)];
3063
- });
3064
- registry.staticGroup(
3065
- "text-align",
3066
- {
3067
- left: "left",
3068
- center: "center",
3069
- right: "right",
3070
- justify: "justify",
3071
- start: "start",
3072
- end: "end"
3073
- },
3074
- "text"
3075
- );
3076
- registry.static("truncate", [
3077
- ["overflow", "hidden"],
3078
- ["text-overflow", "ellipsis"],
3079
- ["white-space", "nowrap"]
3080
- ]);
3081
- registry.staticGroup("text-overflow", { ellipsis: "ellipsis", clip: "clip" }, "text");
3082
- registry.staticGroup(
3083
- "text-wrap",
3084
- { wrap: "wrap", nowrap: "nowrap", balance: "balance", pretty: "pretty" },
3085
- "text"
3086
- );
3087
- registry.staticGroup(
3088
- "white-space",
3089
- {
3090
- normal: "normal",
3091
- nowrap: "nowrap",
3092
- pre: "pre",
3093
- "pre-line": "pre-line",
3094
- "pre-wrap": "pre-wrap",
3095
- "break-spaces": "break-spaces"
3096
- },
3097
- "whitespace"
3098
- );
3099
- registry.static("break-normal", [
3100
- ["overflow-wrap", "normal"],
3101
- ["word-break", "normal"]
3102
- ]);
3103
- registry.static("break-words", [["overflow-wrap", "break-word"]]);
3104
- registry.static("break-all", [["word-break", "break-all"]]);
3105
- registry.static("break-keep", [["word-break", "keep-all"]]);
3106
- registry.staticGroup(
3107
- "overflow-wrap",
3108
- { "break-word": "break-word", anywhere: "anywhere", normal: "normal" },
3109
- "wrap"
3110
- );
3111
- for (const value of ["none", "manual", "auto"]) {
3112
- registry.static(`hyphens-${value}`, [
3113
- ["-webkit-hyphens", value],
3114
- ["hyphens", value]
3115
- ]);
3116
- }
3117
- registry.functional("indent", (ctx) => {
3118
- const value = lengthValue(ctx, "indent", { negative: true });
3119
- if (value === null || typeof value !== "string") return value;
3120
- return [decl("text-indent", value)];
3121
- });
3122
- registry.staticGroup(
3123
- "vertical-align",
3124
- {
3125
- baseline: "baseline",
3126
- top: "top",
3127
- middle: "middle",
3128
- bottom: "bottom",
3129
- "text-top": "text-top",
3130
- "text-bottom": "text-bottom",
3131
- sub: "sub",
3132
- super: "super"
3133
- },
3134
- "align"
3135
- );
3136
- registry.functional("align", (ctx) => {
3137
- const value = plainArbitrary(ctx);
3138
- return value ? [decl("vertical-align", value)] : null;
3139
- });
3140
- registry.staticGroup("list-style-position", { inside: "inside", outside: "outside" }, "list");
3141
- registry.staticGroup(
3142
- "list-style-type",
3143
- { disc: "disc", decimal: "decimal", none: "none" },
3144
- "list"
3145
- );
3146
- registry.functional("list", (ctx) => {
3147
- const value = plainArbitrary(ctx);
3148
- return value ? [decl("list-style-type", value)] : null;
3149
- });
3150
- registry.static("list-image-none", [["list-style-image", "none"]]);
3151
- registry.functional("list-image", (ctx) => {
3152
- const value = plainArbitrary(ctx);
3153
- return value ? [decl("list-style-image", value)] : null;
3154
- });
3155
- registry.staticGroup("text-decoration-line", {
3156
- underline: "underline",
3157
- overline: "overline",
3158
- "line-through": "line-through",
3159
- "no-underline": "none"
3160
- });
3161
- registry.staticGroup(
3162
- "text-decoration-style",
3163
- { solid: "solid", double: "double", dotted: "dotted", dashed: "dashed", wavy: "wavy" },
3164
- "decoration"
3165
- );
3166
- registry.functional("decoration", (ctx) => {
3167
- if (ctx.negative) return null;
3168
- const name = namedValue(ctx);
3169
- if ((name === "auto" || name === "from-font") && !ctx.modifier) {
3170
- return [decl("text-decoration-thickness", name)];
3171
- }
3172
- const thickness = integerValue(ctx);
3173
- if (thickness) return [decl("text-decoration-thickness", `${thickness}px`)];
3174
- const arbitrary = arbitraryValue(ctx);
3175
- if (arbitrary !== null && !containsColor(arbitrary)) {
3176
- const length2 = lengthValue(ctx, "decoration");
3177
- if (typeof length2 === "string") return [decl("text-decoration-thickness", length2)];
3178
- }
3179
- const color2 = colorValue(ctx, "text", registry.palette);
3180
- if (color2 === null || typeof color2 !== "string") return color2;
3181
- return [decl("text-decoration-color", color2)];
3182
- });
3183
- registry.functional("underline-offset", (ctx) => {
3184
- const name = namedValue(ctx);
3185
- if (name === "auto" && !ctx.negative && !ctx.modifier) {
3186
- return [decl("text-underline-offset", "auto")];
3187
- }
3188
- if (name !== null && isPositiveInteger(name) && !ctx.modifier) {
3189
- const value2 = `${name}px`;
3190
- return [decl("text-underline-offset", ctx.negative ? negate(value2) : value2)];
3191
- }
3192
- const value = lengthValue(ctx, "underline-offset", { negative: true });
3193
- if (value === null || typeof value !== "string") return value;
3194
- return [decl("text-underline-offset", value)];
3195
- });
3196
- registry.staticGroup("text-transform", {
3197
- uppercase: "uppercase",
3198
- lowercase: "lowercase",
3199
- capitalize: "capitalize",
3200
- "normal-case": "none"
3201
- });
3202
- const numeric = "var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)";
3203
- registry.static("normal-nums", [["font-variant-numeric", "normal"]]);
3204
- for (const [name, variable] of [
3205
- ["ordinal", "--tw-ordinal"],
3206
- ["slashed-zero", "--tw-slashed-zero"],
3207
- ["lining-nums", "--tw-numeric-figure"],
3208
- ["oldstyle-nums", "--tw-numeric-figure"],
3209
- ["proportional-nums", "--tw-numeric-spacing"],
3210
- ["tabular-nums", "--tw-numeric-spacing"],
3211
- ["diagonal-fractions", "--tw-numeric-fraction"],
3212
- ["stacked-fractions", "--tw-numeric-fraction"]
3213
- ]) {
3214
- registry.static(name, [
3215
- [variable, name],
3216
- ["font-variant-numeric", numeric]
3217
- ]);
3218
- }
3219
- registry.static("line-clamp-none", [
3220
- ["overflow", "visible"],
3221
- ["display", "block"],
3222
- ["-webkit-box-orient", "horizontal"],
3223
- ["-webkit-line-clamp", "unset"]
3224
- ]);
3225
- registry.functional("line-clamp", (ctx) => {
3226
- const value = integerValue(ctx) ?? plainArbitrary(ctx);
3227
- if (value === null || ctx.negative) return null;
3228
- return [
3229
- decl("overflow", "hidden"),
3230
- decl("display", "-webkit-box"),
3231
- decl("-webkit-box-orient", "vertical"),
3232
- decl("-webkit-line-clamp", value)
3233
- ];
3234
- });
3235
- registry.static("content-none", [
3236
- ["--tw-content", "none"],
3237
- ["content", "none"]
3238
- ]);
3239
- registry.functional("content", (ctx) => {
3240
- const value = plainArbitrary(ctx);
3241
- if (value === null || ctx.negative) return null;
3242
- return [decl("--tw-content", value), decl("content", "var(--tw-content)")];
3243
- });
3244
- registry.functional("text-shadow", (ctx) => {
3245
- if (ctx.negative) return null;
3246
- const name = namedValue(ctx);
3247
- if (name === "none" && !ctx.modifier) return [decl("text-shadow", "none")];
3248
- if (name !== null && Object.hasOwn(TEXT_SHADOWS, name) && !ctx.modifier) {
3249
- return single([["text-shadow", TEXT_SHADOWS[name]]]);
3250
- }
3251
- const color2 = colorValue(ctx, "surface", registry.palette);
3252
- if (color2 === null && ctx.value?.kind === "arbitrary") {
3253
- const value = plainArbitrary(ctx);
3254
- return value ? [decl("text-shadow", value)] : null;
3255
- }
3256
- if (color2 === null || typeof color2 !== "string") return color2;
3257
- return [decl("--tw-text-shadow-color", color2)];
3258
- });
3259
- }
3260
-
3261
- // ../css/src/utilities/index.ts
3262
- function createRegistry(palette) {
3263
- const registry = new Registry(palette);
3264
- registerLayoutUtilities(registry);
3265
- registerTypographyUtilities(registry);
3266
- registerBackgroundUtilities(registry);
3267
- registerBorderUtilities(registry);
3268
- registerEffectUtilities(registry);
3269
- registerInteractionUtilities(registry);
3270
- for (const root of ["fill", "stroke"]) {
3271
- registry.functional(
3272
- root,
3273
- (ctx) => ctx.value && !ctx.negative ? reject(
3274
- `Leaf kh\xF4ng c\xF3 utility SVG (\`${root}-*\`) \u2014 vi\u1EBFt trong CSS c\u1EE7a component / page`
3275
- ) : null
3276
- );
3277
- }
3278
- return registry;
3279
- }
3280
-
3281
- // ../css/src/variants.ts
3282
- var orders = /* @__PURE__ */ new Map();
3283
- var statics = /* @__PURE__ */ new Map();
3284
- function register(key) {
3285
- const order = orders.size;
3286
- orders.set(key, order);
3287
- return order;
3288
- }
3289
- function staticVariant(name, application) {
3290
- register(name);
3291
- statics.set(name, application);
3292
- }
3293
- var pseudo = (suffix) => ({ selector: (self) => `${self}${suffix}` });
3294
- var media = (query) => ({ atRule: `@media ${query}` });
3295
- staticVariant("*", { selector: (self) => `:is(${self} > *)` });
3296
- staticVariant("**", { selector: (self) => `:is(${self} *)` });
3297
- register("not");
3298
- register("group");
3299
- register("peer");
3300
- register("in");
3301
- register("has");
3302
- register("arbitrary");
3303
- var CONTENT = [{ property: "content", value: "var(--tw-content)" }];
3304
- staticVariant("first-letter", pseudo("::first-letter"));
3305
- staticVariant("first-line", pseudo("::first-line"));
3306
- staticVariant("marker", { selector: (self) => `${self} *::marker, ${self}::marker` });
3307
- staticVariant("selection", { selector: (self) => `${self} *::selection, ${self}::selection` });
3308
- staticVariant("file", pseudo("::file-selector-button"));
3309
- staticVariant("placeholder", pseudo("::placeholder"));
3310
- staticVariant("backdrop", pseudo("::backdrop"));
3311
- staticVariant("details-content", pseudo("::details-content"));
3312
- staticVariant("before", { selector: (self) => `${self}::before`, decls: CONTENT });
3313
- staticVariant("after", { selector: (self) => `${self}::after`, decls: CONTENT });
3314
- var PSEUDO_CLASSES = [
3315
- ["first", ":first-child"],
3316
- ["last", ":last-child"],
3317
- ["only", ":only-child"],
3318
- ["odd", ":nth-child(odd)"],
3319
- ["even", ":nth-child(even)"],
3320
- ["first-of-type", ":first-of-type"],
3321
- ["last-of-type", ":last-of-type"],
3322
- ["only-of-type", ":only-of-type"],
3323
- ["visited", ":visited"],
3324
- ["target", ":target"],
3325
- ["open", ":is([open], :popover-open, :open)"],
3326
- ["default", ":default"],
3327
- ["checked", ":checked"],
3328
- ["indeterminate", ":indeterminate"],
3329
- ["placeholder-shown", ":placeholder-shown"],
3330
- ["autofill", ":autofill"],
3331
- ["optional", ":optional"],
3332
- ["required", ":required"],
3333
- ["valid", ":valid"],
3334
- ["invalid", ":invalid"],
3335
- ["user-valid", ":user-valid"],
3336
- ["user-invalid", ":user-invalid"],
3337
- ["in-range", ":in-range"],
3338
- ["out-of-range", ":out-of-range"],
3339
- ["read-only", ":read-only"],
3340
- ["empty", ":empty"],
3341
- ["focus-within", ":focus-within"],
3342
- ["hover", ":hover"],
3343
- ["focus", ":focus"],
3344
- ["focus-visible", ":focus-visible"],
3345
- ["active", ":active"],
3346
- ["enabled", ":enabled"],
3347
- ["disabled", ":disabled"],
3348
- ["inert", ":is([inert], [inert] *)"]
3349
- ];
3350
- for (const [name, selector] of PSEUDO_CLASSES) {
3351
- staticVariant(name, pseudo(selector));
3352
- }
3353
- register("aria");
3354
- register("data");
3355
- register("nth");
3356
- register("nth-last");
3357
- register("nth-of-type");
3358
- register("nth-last-of-type");
3359
- register("supports");
3360
- staticVariant("motion-safe", media("(prefers-reduced-motion: no-preference)"));
3361
- staticVariant("motion-reduce", media("(prefers-reduced-motion: reduce)"));
3362
- staticVariant("contrast-more", media("(prefers-contrast: more)"));
3363
- staticVariant("contrast-less", media("(prefers-contrast: less)"));
3364
- var ORDER_MAX = register("max");
3365
- var ORDER_MIN = register("min");
3366
- var ORDER_CONTAINER_MAX = register("@max");
3367
- var ORDER_CONTAINER_MIN = register("@min");
3368
- staticVariant("portrait", media("(orientation: portrait)"));
3369
- staticVariant("landscape", media("(orientation: landscape)"));
3370
- staticVariant("ltr", {
3371
- selector: (self) => `${self}:where(:dir(ltr), [dir="ltr"], [dir="ltr"] *)`
3372
- });
3373
- staticVariant("rtl", {
3374
- selector: (self) => `${self}:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *)`
3375
- });
3376
- staticVariant("starting", { atRule: "@starting-style" });
3377
- staticVariant("print", media("print"));
3378
- staticVariant("forced-colors", media("(forced-colors: active)"));
3379
- staticVariant("inverted-colors", media("(inverted-colors: inverted)"));
3380
- staticVariant("pointer-none", media("(pointer: none)"));
3381
- staticVariant("pointer-coarse", media("(pointer: coarse)"));
3382
- staticVariant("pointer-fine", media("(pointer: fine)"));
3383
- staticVariant("any-pointer-none", media("(any-pointer: none)"));
3384
- staticVariant("any-pointer-coarse", media("(any-pointer: coarse)"));
3385
- staticVariant("any-pointer-fine", media("(any-pointer: fine)"));
3386
- staticVariant("noscript", media("(scripting: none)"));
3387
- var ARIA_STATES = /* @__PURE__ */ new Set([
3388
- "busy",
3389
- "checked",
3390
- "disabled",
3391
- "expanded",
3392
- "hidden",
3393
- "pressed",
3394
- "readonly",
3395
- "required",
3396
- "selected"
3397
- ]);
3398
- function decodeBracket(raw) {
3399
- if (!isBracketed(raw)) return null;
3400
- const value = decodeArbitrary(raw.slice(1, -1));
3401
- return value || null;
3402
- }
3403
- function attributeSelector(prefix, body) {
3404
- const match = /^([a-zA-Z0-9_-]+)\s*([~|^$*]?=)\s*(.+?)(\s+[iIsS])?$/.exec(body);
3405
- if (!match) return `[${prefix}${body}]`;
3406
- const [, name, operator, rawValue, flag = ""] = match;
3407
- const value = /^(["']).*\1$/.test(rawValue) ? rawValue : `"${rawValue}"`;
3408
- return `[${prefix}${name}${operator}${value}${flag}]`;
3409
- }
3410
- function lengthPx(value) {
3411
- const match = /^(-?\d+(?:\.\d+)?)px$/.exec(value);
3412
- return match ? Number(match[1]) : null;
3413
- }
3414
- function rejectUnit(value) {
3415
- const unit = findForbiddenUnit(value);
3416
- return unit ? { reject: `Leaf ch\u1EC9 d\xF9ng \u0111\u01A1n v\u1ECB px \u2014 kh\xF4ng d\xF9ng ${unit}` } : null;
3417
- }
3418
- function relativeSelector(raw) {
3419
- if (isBracketed(raw)) {
3420
- const inner = decodeBracket(raw);
3421
- if (!inner || inner.startsWith("@")) return null;
3422
- return inner.includes("&") ? inner : `&:is(${inner})`;
3423
- }
3424
- const resolved = resolveVariantInner(raw);
3425
- if (!resolved || "reject" in resolved) return null;
3426
- const { application } = resolved;
3427
- if (!application.selector || application.atRule || application.decls) return null;
3428
- const selector = application.selector("&");
3429
- return selector.includes("::") ? null : selector;
3430
- }
3431
- function compound(raw, root) {
3432
- const rest = raw.slice(root.length + 1);
3433
- let target = rest;
3434
- let name = null;
3435
- const slash = rest.lastIndexOf("/");
3436
- if (slash > 0 && !rest.slice(slash).includes("]")) {
3437
- target = rest.slice(0, slash);
3438
- name = rest.slice(slash + 1);
3439
- if (!/^[a-zA-Z0-9_-]+$/.test(name)) return null;
3440
- }
3441
- const marker = `:where(.${escapeClass(name ? `${root}/${name}` : root)})`;
3442
- const relative3 = relativeSelector(target);
3443
- if (!relative3) return null;
3444
- const condition = relative3.replaceAll("&", marker);
3445
- const combinator = root === "group" ? " *" : " ~ *";
3446
- return { selector: (self) => `${self}:is(${condition}${combinator})` };
3447
- }
3448
- function nth(selectorName, value) {
3449
- const arbitrary = decodeBracket(value);
3450
- const body = arbitrary ?? (isPositiveInteger(value) ? value : null);
3451
- return body ? pseudo(`:${selectorName}(${body})`) : null;
3452
- }
3453
- function breakpointMin(raw) {
3454
- for (const [name, width] of BREAKPOINTS) if (raw === name) return width;
3455
- return null;
3456
- }
3457
- function containerSize(name) {
3458
- for (const [key, width] of CONTAINERS) if (key === name) return width;
3459
- return null;
3460
- }
3461
- function containerVariant(raw) {
3462
- let body = raw.slice(1);
3463
- let name = "";
3464
- const slash = body.lastIndexOf("/");
3465
- if (slash > 0 && !body.slice(slash).includes("]")) {
3466
- name = body.slice(slash + 1);
3467
- body = body.slice(0, slash);
3468
- if (!/^[a-zA-Z0-9_-]+$/.test(name)) return null;
3469
- }
3470
- let kind = "min";
3471
- if (body.startsWith("max-")) {
3472
- kind = "max";
3473
- body = body.slice(4);
3474
- } else if (body.startsWith("min-")) {
3475
- body = body.slice(4);
3476
- }
3477
- let width = null;
3478
- let sortValue = 0;
3479
- const arbitrary = decodeBracket(body);
3480
- if (arbitrary) {
3481
- const rejection = rejectUnit(arbitrary);
3482
- if (rejection) return rejection;
3483
- width = arbitrary;
3484
- sortValue = lengthPx(arbitrary) ?? 0;
3485
- } else {
3486
- const size = containerSize(body);
3487
- if (size === null) return null;
3488
- width = `${size}px`;
3489
- sortValue = size;
3490
- }
3491
- const query = kind === "max" ? `(width < ${width})` : `(width >= ${width})`;
3492
- return {
3493
- application: { atRule: `@container ${name ? `${name} ` : ""}${query}` },
3494
- order: kind === "max" ? ORDER_CONTAINER_MAX : ORDER_CONTAINER_MIN,
3495
- sortValue: kind === "max" ? -sortValue : sortValue
3496
- };
3497
- }
3498
- function resolveVariantInner(raw) {
3499
- const fixed = statics.get(raw);
3500
- if (fixed) return { application: fixed, order: orders.get(raw), sortValue: 0 };
3501
- if (raw === "dark" || raw === "light") {
3502
- return {
3503
- reject: `Leaf kh\xF4ng c\xF3 variant \`${raw}:\` \u2014 m\xE0u \u0111\u1ED5i theo theme qua token v\xE0 data-theme`
3504
- };
3505
- }
3506
- const min = breakpointMin(raw);
3507
- if (min !== null) {
3508
- return { application: media(`(width >= ${min}px)`), order: ORDER_MIN, sortValue: min };
3509
- }
3510
- if (raw === "xs") {
3511
- return {
3512
- application: media(`(width <= ${XS_MAX}px)`),
3513
- order: ORDER_MAX,
3514
- sortValue: -XS_MAX
3515
- };
3516
- }
3517
- if (raw.startsWith("@")) return containerVariant(raw);
3518
- if (isBracketed(raw)) {
3519
- const inner = decodeBracket(raw);
3520
- if (!inner) return null;
3521
- const order = orders.get("arbitrary");
3522
- if (inner.startsWith("@"))
3523
- return { application: { atRule: inner }, order, sortValue: inner };
3524
- if (!inner.includes("&")) return null;
3525
- return {
3526
- application: { selector: (self) => inner.replaceAll("&", self) },
3527
- order,
3528
- sortValue: inner
3529
- };
3530
- }
3531
- if (!raw.includes("-")) return null;
3532
- for (const resolver of FUNCTIONAL) {
3533
- const result = resolver(raw);
3534
- if (result) return result;
3535
- }
3536
- return null;
3537
- }
3538
- var FUNCTIONAL = [
3539
- (raw) => {
3540
- if (!raw.startsWith("max-")) return null;
3541
- const value = raw.slice(4);
3542
- const named = breakpointMin(value);
3543
- if (named !== null) {
3544
- return {
3545
- application: media(`(width < ${named}px)`),
3546
- order: ORDER_MAX,
3547
- sortValue: -named
3548
- };
3549
- }
3550
- const arbitrary = decodeBracket(value);
3551
- if (!arbitrary) return null;
3552
- const rejection = rejectUnit(arbitrary);
3553
- if (rejection) return rejection;
3554
- return {
3555
- application: media(`(width < ${arbitrary})`),
3556
- order: ORDER_MAX,
3557
- sortValue: -(lengthPx(arbitrary) ?? 0)
3558
- };
3559
- },
3560
- (raw) => {
3561
- if (!raw.startsWith("min-")) return null;
3562
- const arbitrary = decodeBracket(raw.slice(4));
3563
- if (!arbitrary) return null;
3564
- const rejection = rejectUnit(arbitrary);
3565
- if (rejection) return rejection;
3566
- return {
3567
- application: media(`(width >= ${arbitrary})`),
3568
- order: ORDER_MIN,
3569
- sortValue: lengthPx(arbitrary) ?? 0
3570
- };
3571
- },
3572
- (raw) => {
3573
- for (const root of ["group", "peer"]) {
3574
- if (raw.startsWith(`${root}-`)) {
3575
- const application = compound(raw, root);
3576
- return application ? { application, order: orders.get(root), sortValue: raw } : null;
3577
- }
3578
- }
3579
- return null;
3580
- },
3581
- (raw) => {
3582
- if (!raw.startsWith("not-")) return null;
3583
- const relative3 = relativeSelector(raw.slice(4));
3584
- if (!relative3?.startsWith("&")) return null;
3585
- const condition = relative3.slice(1);
3586
- return {
3587
- application: {
3588
- selector: (self) => `${self}:not(${condition.replace(/^:is\((.*)\)$/, "$1")})`
3589
- },
3590
- order: orders.get("not"),
3591
- sortValue: raw
3592
- };
3593
- },
3594
- (raw) => {
3595
- if (!raw.startsWith("has-")) return null;
3596
- const target = raw.slice(4);
3597
- const arbitrary = isBracketed(target) ? decodeBracket(target) : null;
3598
- let condition;
3599
- if (arbitrary) {
3600
- condition = arbitrary.includes("&") ? null : arbitrary;
3601
- } else {
3602
- const relative3 = relativeSelector(target);
3603
- condition = relative3?.startsWith("&") ? `*${relative3.slice(1)}` : null;
3604
- }
3605
- if (!condition) return null;
3606
- return {
3607
- application: { selector: (self) => `${self}:has(${condition})` },
3608
- order: orders.get("has"),
3609
- sortValue: raw
3610
- };
3611
- },
3612
- (raw) => {
3613
- if (!raw.startsWith("in-")) return null;
3614
- const target = raw.slice(3);
3615
- const arbitrary = isBracketed(target) ? decodeBracket(target) : null;
3616
- let condition;
3617
- if (arbitrary) {
3618
- condition = arbitrary.includes("&") ? null : arbitrary;
3619
- } else {
3620
- const relative3 = relativeSelector(target);
3621
- condition = relative3?.startsWith("&") ? `*${relative3.slice(1)}` : null;
3622
- }
3623
- if (!condition) return null;
3624
- return {
3625
- application: { selector: (self) => `:where(${condition}) ${self}` },
3626
- order: orders.get("in"),
3627
- sortValue: raw
3628
- };
3629
- },
3630
- (raw) => {
3631
- if (!raw.startsWith("aria-")) return null;
3632
- const value = raw.slice(5);
3633
- const arbitrary = decodeBracket(value);
3634
- let selector = null;
3635
- if (arbitrary) selector = attributeSelector("aria-", arbitrary);
3636
- else if (ARIA_STATES.has(value)) selector = `[aria-${value}="true"]`;
3637
- if (!selector) return null;
3638
- const attribute = selector;
3639
- return {
3640
- application: { selector: (self) => `${self}${attribute}` },
3641
- order: orders.get("aria"),
3642
- sortValue: raw
3643
- };
3644
- },
3645
- (raw) => {
3646
- if (!raw.startsWith("data-")) return null;
3647
- const value = raw.slice(5);
3648
- const arbitrary = decodeBracket(value);
3649
- let selector = null;
3650
- if (arbitrary) selector = attributeSelector("data-", arbitrary);
3651
- else if (/^[a-zA-Z0-9_-]+$/.test(value)) selector = `[data-${value}]`;
3652
- if (!selector) return null;
3653
- const attribute = selector;
3654
- return {
3655
- application: { selector: (self) => `${self}${attribute}` },
3656
- order: orders.get("data"),
3657
- sortValue: raw
3658
- };
3659
- },
3660
- (raw) => {
3661
- const match = /^(nth-last-of-type|nth-of-type|nth-last|nth)-(.+)$/.exec(raw);
3662
- if (!match) return null;
3663
- const [, root, value] = match;
3664
- const names = {
3665
- nth: "nth-child",
3666
- "nth-last": "nth-last-child",
3667
- "nth-of-type": "nth-of-type",
3668
- "nth-last-of-type": "nth-last-of-type"
3669
- };
3670
- const application = nth(names[root], value);
3671
- return application ? { application, order: orders.get(root), sortValue: raw } : null;
3672
- },
3673
- (raw) => {
3674
- if (!raw.startsWith("supports-")) return null;
3675
- const value = raw.slice(9);
3676
- const arbitrary = decodeBracket(value);
3677
- let query = null;
3678
- if (arbitrary) {
3679
- query = /^(?:not\s|selector\(|font-|\()/.test(arbitrary) ? arbitrary : arbitrary.includes(":") ? `(${arbitrary.replace(/\s*:\s*/, ": ")})` : `(${arbitrary}: var(--tw))`;
3680
- } else if (/^[a-z-]+$/.test(value)) {
3681
- query = `(${value}: var(--tw))`;
3682
- }
3683
- if (!query) return null;
3684
- return {
3685
- application: { atRule: `@supports ${query}` },
3686
- order: orders.get("supports"),
3687
- sortValue: raw
3688
- };
3689
- }
3690
- ];
3691
- function resolveVariant(raw) {
3692
- return resolveVariantInner(raw);
3693
- }
3694
-
3695
- // ../css/src/compile.ts
3696
- var FORBIDDEN_PROPERTIES = /^(?:color|background-color|border(?:-[a-z]+)*-color|outline-color|text-decoration-color|caret-color|accent-color|fill|stroke|font|font-(?:family|size|weight|style|stretch)|line-height|letter-spacing)$/;
3697
- var COLOR_SHORTHANDS = /^(?:background|border(?:-(?:top|right|bottom|left|inline|block)(?:-(?:start|end))?)?|outline|box-shadow|text-shadow|text-decoration|column-rule|filter|backdrop-filter)$/;
3698
- function paletteFrom(leafClasses) {
3699
- const text = /* @__PURE__ */ new Map();
3700
- const surface = /* @__PURE__ */ new Map();
3701
- for (const [name, decls] of leafClasses) {
3702
- const [first] = decls;
3703
- if (decls.length !== 1 || !first) continue;
3704
- if (name.startsWith("text-") && first.property === "color")
3705
- text.set(name.slice(5), first.value);
3706
- if (name.startsWith("bg-") && first.property === "background-color") {
3707
- surface.set(name.slice(3), first.value);
3708
- }
3709
- }
3710
- return { text, surface };
3711
- }
3712
- var Compiler = class {
3713
- registry;
3714
- cache = /* @__PURE__ */ new Map();
3715
- leafClasses;
3716
- constructor(input) {
3717
- this.leafClasses = input.leafClasses;
3718
- this.registry = createRegistry(paletteFrom(input.leafClasses));
3719
- }
3720
- /** Phân loại một class — dùng cho check lint (`check:classes`). */
3721
- classify(candidate) {
3722
- const result = this.compileCandidate(candidate);
3723
- if (result === null) return { kind: "unknown" };
3724
- if ("leaf" in result) return { kind: "leaf" };
3725
- if ("reject" in result) return { kind: "rejected", message: result.reject };
3726
- return { kind: "utility" };
3727
- }
3728
- generate(candidates, options = {}) {
3729
- const compiled = [];
3730
- const diagnostics = [];
3731
- for (const candidate of new Set(candidates)) {
3732
- const result = this.compileCandidate(candidate);
3733
- if (result === null || "leaf" in result) continue;
3734
- if ("reject" in result) {
3735
- diagnostics.push({ candidate, message: result.reject });
3736
- continue;
3737
- }
3738
- compiled.push(result);
3739
- }
3740
- compiled.sort((a, b) => compareSort(a.sort, b.sort));
3741
- return {
3742
- css: render(compiled, options.minify ?? false),
3743
- diagnostics: diagnostics.sort((a, b) => a.candidate.localeCompare(b.candidate)),
3744
- used: compiled.map((entry) => entry.candidate)
3745
- };
3746
- }
3747
- compileCandidate(raw) {
3748
- if (this.cache.has(raw)) return this.cache.get(raw);
3749
- const result = this.compileUncached(raw);
3750
- this.cache.set(raw, result);
3751
- return result;
3752
- }
3753
- compileUncached(raw) {
3754
- const split = splitCandidate(raw);
3755
- if (!split) return null;
3756
- const variants = [];
3757
- for (const variant of split.variants) {
3758
- const resolved = resolveVariant(variant);
3759
- if (resolved === null) return null;
3760
- if ("reject" in resolved) return resolved;
3761
- variants.push(resolved);
3762
- }
3763
- const output = this.resolveBase(split.base, split.variants.length > 0 || split.important);
3764
- if (output === null) return null;
3765
- if (!Array.isArray(output) && ("reject" in output || "leaf" in output)) return output;
3766
- return build(raw, variants, output, split.important);
3767
- }
3768
- resolveBase(base, decorated) {
3769
- if (base.startsWith("[") || /^\[.*\]\//.test(base)) {
3770
- const property = parseArbitraryProperty(base);
3771
- if (!property) return null;
3772
- if (FORBIDDEN_PROPERTIES.test(property.property)) {
3773
- return {
3774
- reject: `\`[${property.property}:..]\` \u2014 m\xE0u v\xE0 ch\u1EEF ch\u1EC9 l\u1EA5y t\u1EEB class / token Leaf`
3775
- };
3776
- }
3777
- if (COLOR_SHORTHANDS.test(property.property) && containsColor(property.value)) {
3778
- return { reject: COLOR_HINT };
3779
- }
3780
- const unit = findForbiddenUnit(property.value);
3781
- if (unit) return { reject: `Leaf ch\u1EC9 d\xF9ng \u0111\u01A1n v\u1ECB px \u2014 kh\xF4ng d\xF9ng ${unit}` };
3782
- return { rules: [{ decls: [{ property: property.property, value: property.value }] }] };
3783
- }
3784
- const leaf = this.leafClasses.get(base);
3785
- if (leaf) {
3786
- if (!decorated) return { leaf: true };
3787
- return { rules: [{ decls: leaf.map((entry) => ({ ...entry })) }] };
3788
- }
3789
- const fixed = this.registry.statics.get(base);
3790
- if (fixed) return fixed;
3791
- if (isVariableShorthand(base)) {
3792
- const root = base.slice(0, base.indexOf("-("));
3793
- if (this.registry.functionals.has(root.replace(/^-/, ""))) {
3794
- return {
3795
- reject: "Leaf kh\xF4ng d\xF9ng c\xFA ph\xE1p `(--bi\u1EBFn)` \u2014 layout: `[var(--x)]`; m\xE0u / ch\u1EEF: class Leaf"
3796
- };
3797
- }
3798
- return null;
3799
- }
3800
- return this.resolveFunctional(base);
3801
- }
3802
- resolveFunctional(input) {
3803
- let base = input;
3804
- let negative = false;
3805
- if (base.startsWith("-")) {
3806
- negative = true;
3807
- base = base.slice(1);
3808
- }
3809
- let modifierRaw = null;
3810
- const slash = lastTopLevelIndex(base, "/");
3811
- if (slash > 0) {
3812
- modifierRaw = base.slice(slash + 1);
3813
- base = base.slice(0, slash);
3814
- if (!modifierRaw) return null;
3815
- }
3816
- const modifier = modifierRaw === null ? null : parseModifier(modifierRaw);
3817
- if (modifierRaw !== null && modifier === null) return null;
3818
- const attempts = [[base, null]];
3819
- for (let index = base.length - 1; index > 0; index--) {
3820
- if (base[index] !== "-") continue;
3821
- const root = base.slice(0, index);
3822
- if (root.split("[").length !== root.split("]").length) continue;
3823
- attempts.push([root, base.slice(index + 1)]);
3824
- }
3825
- for (const [root, rawValue] of attempts) {
3826
- const handler = this.registry.functionals.get(root);
3827
- if (!handler) continue;
3828
- const value = rawValue === null ? null : parseValue(rawValue);
3829
- if (rawValue !== null && value === null) continue;
3830
- if (value?.kind === "arbitrary" || modifier?.kind === "arbitrary") {
3831
- const unit = findForbiddenUnit(`${value?.value ?? ""} ${modifier?.value ?? ""}`);
3832
- if (unit) return { reject: `Leaf ch\u1EC9 d\xF9ng \u0111\u01A1n v\u1ECB px \u2014 kh\xF4ng d\xF9ng ${unit}` };
3833
- }
3834
- const fraction = value?.kind === "named" && modifier?.kind === "named" && isPositiveInteger(value.value) && isPositiveInteger(modifier.value) ? `${value.value}/${modifier.value}` : null;
3835
- const ctx = { candidate: input, value, modifier, negative, fraction };
3836
- const result = handler(ctx);
3837
- if (result !== null) return result;
3838
- }
3839
- return null;
3840
- }
3841
- };
3842
- function toOutput(result) {
3843
- if (result === null) return null;
3844
- if (Array.isArray(result)) return { rules: [{ decls: result }] };
3845
- return result;
3846
- }
3847
- function build(candidate, variants, result, important) {
3848
- const output = toOutput(result);
3849
- if (output === null || "reject" in output) return output;
3850
- const self = `.${escapeClass(candidate)}`;
3851
- const rules = [];
3852
- for (const fragment of output.rules) {
3853
- let selector = self;
3854
- const atRules = [];
3855
- const extra = [];
3856
- for (const { application } of variants) {
3857
- if (application.selector) selector = application.selector(selector);
3858
- if (application.atRule) atRules.push(application.atRule);
3859
- if (application.decls) extra.push(...application.decls);
3860
- }
3861
- if (fragment.selector) selector = fragment.selector(selector);
3862
- if (fragment.atRules) atRules.push(...fragment.atRules);
3863
- const own = new Set(fragment.decls.map((entry) => entry.property));
3864
- const added = extra.filter((entry) => !own.has(entry.property));
3865
- const decls = [...added, ...fragment.decls].map(
3866
- (entry) => important ? { property: entry.property, value: `${entry.value} !important` } : entry
3867
- );
3868
- rules.push({ selector, atRules, decls });
3869
- }
3870
- const groups = [...new Set(variants.map((variant) => variant.order))].sort((a, b) => b - a);
3871
- const variantValues = [...variants].sort((a, b) => b.order - a.order).map((variant) => variant.sortValue);
3872
- const properties = output.rules.flatMap((fragment) => fragment.decls.map((entry) => propertyIndex(entry.property))).sort((a, b) => a - b);
3873
- return {
3874
- candidate,
3875
- rules,
3876
- keyframes: output.keyframes ?? [],
3877
- sort: { variants: groups, variantValues, properties, candidate }
3878
- };
3879
- }
3880
- function compareSort(a, b) {
3881
- for (let index = 0; index < Math.max(a.variants.length, b.variants.length); index++) {
3882
- const left = a.variants[index];
3883
- const right = b.variants[index];
3884
- if (left === right) continue;
3885
- if (left === void 0) return -1;
3886
- if (right === void 0) return 1;
3887
- return left - right;
3888
- }
3889
- for (let index = 0; index < Math.max(a.variantValues.length, b.variantValues.length); index++) {
3890
- const left = a.variantValues[index] ?? 0;
3891
- const right = b.variantValues[index] ?? 0;
3892
- if (left === right) continue;
3893
- if (typeof left === "number" && typeof right === "number") return left - right;
3894
- return String(left) < String(right) ? -1 : 1;
3895
- }
3896
- const first = (a.properties[0] ?? Infinity) - (b.properties[0] ?? Infinity);
3897
- if (first !== 0 && Number.isFinite(first)) return first;
3898
- if (a.properties.length !== b.properties.length)
3899
- return b.properties.length - a.properties.length;
3900
- return a.candidate < b.candidate ? -1 : a.candidate > b.candidate ? 1 : 0;
3901
- }
3902
- function render(compiled, minify) {
3903
- if (compiled.length === 0) return "";
3904
- const root = [];
3905
- const stack = [];
3906
- const usedProperties = /* @__PURE__ */ new Set();
3907
- const keyframes = /* @__PURE__ */ new Set();
3908
- for (const entry of compiled) {
3909
- for (const name of entry.keyframes) keyframes.add(name);
3910
- for (const rule of entry.rules) {
3911
- let depth = 0;
3912
- while (depth < stack.length && depth < rule.atRules.length && stack[depth].atRule === rule.atRules[depth]) {
3913
- depth++;
3914
- }
3915
- stack.length = depth;
3916
- for (let index = depth; index < rule.atRules.length; index++) {
3917
- const atRule = rule.atRules[index];
3918
- const match = /^@([a-zA-Z-]+)\s*(.*)$/.exec(atRule);
3919
- const children = [];
3920
- const parent = index === 0 ? root : stack[index - 1].children;
3921
- parent.push({ type: "atrule", name: match[1], params: match[2], children });
3922
- stack.push({ atRule, children });
3923
- }
3924
- const target = rule.atRules.length === 0 ? root : stack[rule.atRules.length - 1].children;
3925
- const last = target[target.length - 1];
3926
- const decls = rule.decls.map((entry2) => {
3927
- collectProperties(`${entry2.property}:${entry2.value}`, usedProperties);
3928
- const important = entry2.value.endsWith(" !important");
3929
- return {
3930
- type: "decl",
3931
- property: entry2.property,
3932
- value: important ? entry2.value.slice(0, -11) : entry2.value,
3933
- important
3934
- };
3935
- });
3936
- if (last?.type === "rule" && last.selector === rule.selector) {
3937
- last.children.push(...decls);
3938
- } else {
3939
- target.push({ type: "rule", selector: rule.selector, children: decls });
3940
- }
3941
- if (rule.atRules.length === 0) stack.length = 0;
3942
- }
3943
- }
3944
- const nodes = [
3945
- { type: "atrule", name: "layer", params: "utilities", children: root }
3946
- ];
3947
- const properties = [...usedProperties].sort();
3948
- for (const name of properties) {
3949
- const definition = PROPERTIES[name];
3950
- const children = [
3951
- { type: "decl", property: "syntax", value: `"${definition.syntax}"`, important: false },
3952
- {
3953
- type: "decl",
3954
- property: "inherits",
3955
- value: String(definition.inherits),
3956
- important: false
3957
- }
3958
- ];
3959
- if (definition.initial !== null) {
3960
- children.push({
3961
- type: "decl",
3962
- property: "initial-value",
3963
- value: definition.initial,
3964
- important: false
3965
- });
3966
- }
3967
- nodes.push({ type: "atrule", name: "property", params: name, children });
3968
- }
3969
- let css = printCss(nodes, { minify });
3970
- for (const name of [...keyframes].sort()) {
3971
- const frames = KEYFRAMES[name];
3972
- if (frames) css += minify ? minifyCss(frames) : `
3973
- ${frames}
3974
- `;
3975
- }
3976
- if (properties.length > 0) {
3977
- const fallback = [
3978
- {
3979
- type: "atrule",
3980
- name: "layer",
3981
- params: "properties",
3982
- children: [
3983
- {
3984
- type: "atrule",
3985
- name: "supports",
3986
- params: "((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color: rgb(from red r g b))))",
3987
- children: [
3988
- {
3989
- type: "rule",
3990
- selector: "*, ::before, ::after, ::backdrop",
3991
- children: properties.map((name) => ({
3992
- type: "decl",
3993
- property: name,
3994
- value: PROPERTIES[name].initial ?? "initial",
3995
- important: false
3996
- }))
3997
- }
3998
- ]
3999
- }
4000
- ]
4001
- }
4002
- ];
4003
- css += (minify ? "" : "\n") + printCss(fallback, { minify });
4004
- }
4005
- return css;
4006
- }
4007
-
4008
- // ../css/src/assets.ts
4009
- var LAYER_ORDER = "@layer properties, theme, base, components, utilities;";
4010
- function createCompiler(assets) {
4011
- return new Compiler({ leafClasses: new Map(Object.entries(assets.leafClasses)) });
4012
- }
4013
- function selectComponents(assets, usage) {
4014
- const wanted = /* @__PURE__ */ new Set();
4015
- for (const name of usage.exports) {
4016
- for (const component of assets.exports[name] ?? []) wanted.add(component);
4017
- }
4018
- return assets.components.filter((component) => {
4019
- if (component.htmlOnly)
4020
- return component.blocks.some((block) => usage.htmlBlocks.has(block));
4021
- if (usage.all || wanted.has(component.name)) return true;
4022
- return component.blocks.some((block) => usage.blocks.has(block));
4023
- });
4024
- }
4025
- function buildStylesheet(assets, compiler, candidates, usage, options = {}) {
4026
- const components = selectComponents(assets, usage);
4027
- const utilities = compiler.generate(candidates, options);
4028
- const banner = `/*! @finhay-pro/leaf-design-system v${assets.version} */`;
4029
- const parts = [
4030
- assets.foundation,
4031
- ...components.map((component) => component.css),
4032
- assets.classes
4033
- ];
4034
- const body = options.minify ? parts.map(minifyCss).join("") : parts.join("\n");
4035
- const css = options.minify ? `${banner}
4036
- ${LAYER_ORDER}${body}${utilities.css}` : `${banner}
4037
- ${LAYER_ORDER}
4038
-
4039
- ${body}
4040
- ${utilities.css}`;
4041
- return {
4042
- css,
4043
- diagnostics: utilities.diagnostics,
4044
- components: components.map((component) => component.name)
4045
- };
4046
- }
4047
-
4048
- // ../css/src/stylesheet.ts
4049
- var LEAF_CSS_SPECIFIER = "@finhay-pro/leaf-design-system/css";
4050
- var LEAF_IMPORT = /@import\s+(?:url\(\s*)?(["'])@finhay-pro\/leaf-design-system\/css\1\s*\)?[^;]*;/;
4051
- var FORBIDDEN_AT_RULES = [
4052
- "theme",
4053
- "utility",
4054
- "variant",
4055
- "custom-variant",
4056
- "plugin",
4057
- "config",
4058
- "apply",
4059
- "source",
4060
- "tailwind",
4061
- "reference"
4062
- ];
4063
- var FORBIDDEN_FUNCTIONS = ["--value", "--modifier", "--spacing", "--alpha", "--theme", "theme"];
4064
- function stripComments(css) {
4065
- return css.replace(/\/\*[\s\S]*?\*\//g, "");
4066
- }
4067
- function hasLeafImport(css) {
4068
- return LEAF_IMPORT.test(stripComments(css));
4069
- }
4070
- var LeafConfigError = class extends Error {
4071
- constructor(message) {
4072
- super(message);
4073
- this.name = "LeafConfigError";
4074
- }
4075
- };
4076
- function assertNoConfiguration(css, file) {
4077
- const source = stripComments(css);
4078
- if (/@import\s+(?:url\(\s*)?["'](?:tailwindcss|@tailwindcss\/[^"']*)(?:\/[^"']*)?["']/.test(
4079
- source
4080
- )) {
4081
- throw new LeafConfigError(
4082
- `${file}: Leaf \u0111\xE3 thay Tailwind \u2014 xo\xE1 \`@import "tailwindcss"\`, ch\u1EC9 c\u1EA7n \`@import "${LEAF_CSS_SPECIFIER}";\``
4083
- );
4084
- }
4085
- for (const name of FORBIDDEN_AT_RULES) {
4086
- if (new RegExp(`@${name}(?![a-zA-Z0-9_-])`).test(source)) {
4087
- throw new LeafConfigError(
4088
- `${file}: \`@${name}\` kh\xF4ng \u0111\u01B0\u1EE3c h\u1ED7 tr\u1EE3 \u2014 Leaf kh\xF4ng cho c\u1EA5u h\xECnh th\xEAm theme / utility / variant. D\xF9ng class c\xF3 s\u1EB5n, layout tu\u1EF3 \xFD qua \`[..]\` (vd. \`w-[300px]\`).`
4089
- );
4090
- }
4091
- }
4092
- for (const name of FORBIDDEN_FUNCTIONS) {
4093
- if (new RegExp(`(?<![a-zA-Z0-9_-])${name.replace(/-/g, "\\-")}\\(`).test(source)) {
4094
- throw new LeafConfigError(`${file}: h\xE0m \`${name}()\` kh\xF4ng \u0111\u01B0\u1EE3c h\u1ED7 tr\u1EE3 trong Leaf.`);
4095
- }
4096
- }
4097
- }
4098
- function preludeEnd(css) {
4099
- let index = 0;
4100
- let end = 0;
4101
- while (index < css.length) {
4102
- const rest = css.slice(index);
4103
- const space = /^\s+/.exec(rest);
4104
- if (space) {
4105
- index += space[0].length;
4106
- continue;
4107
- }
4108
- if (rest.startsWith("/*")) {
4109
- const close = css.indexOf("*/", index + 2);
4110
- index = close === -1 ? css.length : close + 2;
4111
- continue;
4112
- }
4113
- const statement = /^@(?:charset|import|layer)\b(?:[^;{"']|"[^"]*"|'[^']*')*;/.exec(rest);
4114
- if (!statement) break;
4115
- index += statement[0].length;
4116
- end = index;
4117
- }
4118
- return end;
4119
- }
4120
- function replaceLeafImport(css, generated) {
4121
- const without = css.replace(new RegExp(LEAF_IMPORT.source, "g"), "");
4122
- const end = preludeEnd(without);
4123
- const before = without.slice(0, end);
4124
- const after = without.slice(end);
4125
- return `${before}${before ? "\n" : ""}${generated}
4126
- ${after.replace(/^\s*\n/, "")}`;
4127
- }
4128
-
4129
- // ../css/src/node/scanner.ts
4130
- import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
4131
- import { dirname, extname, join, relative, resolve, sep } from "node:path";
4132
-
4133
- // ../css/src/extract.ts
4134
- var KIND = new Uint8Array(128);
4135
- for (const char of `"'\`{};<>=,()\\$`) KIND[char.charCodeAt(0)] = 1;
4136
- for (const char of " \n\r\f") KIND[char.charCodeAt(0)] = 2;
4137
- var OPEN = 91;
4138
- var CLOSE = 93;
4139
- var DOT = 46;
4140
- var COLON = 58;
4141
- function isLetter(code) {
4142
- return code >= 65 && code <= 90 || code >= 97 && code <= 122;
4143
- }
4144
- function extractCandidates(text, into) {
4145
- const length2 = text.length;
4146
- let index = 0;
4147
- while (index < length2) {
4148
- let code = text.charCodeAt(index);
4149
- if (code < 128 && KIND[code] !== 0) {
4150
- index++;
4151
- continue;
4152
- }
4153
- const start = index;
4154
- let depth = 0;
4155
- let valid = true;
4156
- let letter = false;
4157
- while (index < length2) {
4158
- code = text.charCodeAt(index);
4159
- if (code === OPEN) {
4160
- depth++;
4161
- } else if (code === CLOSE) {
4162
- if (--depth < 0) {
4163
- valid = false;
4164
- break;
4165
- }
4166
- } else if (code < 128 && KIND[code] !== 0) {
4167
- if (depth === 0) break;
4168
- if (KIND[code] === 2) {
4169
- valid = false;
4170
- break;
4171
- }
4172
- } else if (!letter && isLetter(code)) {
4173
- letter = true;
4174
- }
4175
- index++;
4176
- }
4177
- if (!valid || depth !== 0) {
4178
- if (index === start) index++;
4179
- continue;
4180
- }
4181
- let end = index;
4182
- while (end > start && (text.charCodeAt(end - 1) === DOT || text.charCodeAt(end - 1) === COLON))
4183
- end--;
4184
- if (letter && end - start <= 400) into.add(text.slice(start, end));
4185
- }
4186
- }
4187
- var LEAF_PACKAGE = "@finhay-pro/leaf-design-system";
4188
- function emptyUsage() {
4189
- return { exports: /* @__PURE__ */ new Set(), all: false, blocks: /* @__PURE__ */ new Set(), htmlBlocks: /* @__PURE__ */ new Set() };
4190
- }
4191
- var PACKAGE_PATTERN = LEAF_PACKAGE.replace(/[/-]/g, "\\$&");
4192
- var NAMED_IMPORT = new RegExp(
4193
- `\\b(?:import|export)\\s+(?:type\\s+)?(?:[\\w$]+\\s*,\\s*)?\\{([^}]*)\\}\\s*from\\s*["']${PACKAGE_PATTERN}["']`,
4194
- "g"
4195
- );
4196
- var TYPE_ONLY = new RegExp(
4197
- `\\b(?:import|export)\\s+type\\s+(?:[\\w$]+\\s*,\\s*)?\\{[^}]*\\}\\s*from\\s*["']${PACKAGE_PATTERN}["']`,
4198
- "g"
4199
- );
4200
- var WHOLE_MODULE = new RegExp(
4201
- `\\bimport\\s*\\*\\s*as\\s+[\\w$]+\\s+from\\s*["']${PACKAGE_PATTERN}["']|\\bexport\\s*\\*\\s*(?:as\\s+[\\w$]+\\s+)?from\\s*["']${PACKAGE_PATTERN}["']|\\b(?:import|require)\\s*\\(\\s*["']${PACKAGE_PATTERN}["']\\s*\\)|\\bimport\\s+[\\w$]+\\s+from\\s*["']${PACKAGE_PATTERN}["']`
4202
- );
4203
- function detectImports(text, usage) {
4204
- if (!text.includes(LEAF_PACKAGE)) return;
4205
- if (WHOLE_MODULE.test(text)) usage.all = true;
4206
- const typeOnly = /* @__PURE__ */ new Set();
4207
- for (const match of text.matchAll(TYPE_ONLY)) typeOnly.add(match.index);
4208
- for (const match of text.matchAll(NAMED_IMPORT)) {
4209
- if (typeOnly.has(match.index)) continue;
4210
- for (const raw of match[1].split(",")) {
4211
- const specifier = raw.trim();
4212
- if (!specifier || specifier.startsWith("type ")) continue;
4213
- const name = specifier.split(/\s+as\s+/)[0].trim();
4214
- if (/^[\w$]+$/.test(name)) usage.exports.add(name);
4215
- }
4216
- }
4217
- }
4218
- function blockOf(className) {
4219
- if (!className.startsWith("leaf-")) return null;
4220
- const block = className.split("__")[0].split("--")[0];
4221
- return /^leaf-[a-z0-9]+(?:-[a-z0-9]+)*$/.test(block) ? block : null;
4222
- }
4223
- function detectBlocks(candidates, into) {
4224
- for (const candidate of candidates) {
4225
- const block = blockOf(candidate);
4226
- if (block) into.add(block);
4227
- }
4228
- }
4229
-
4230
- // ../css/src/node/gitignore.ts
4231
- function globToRegex(glob) {
4232
- let out = "";
4233
- for (let index = 0; index < glob.length; index++) {
4234
- const char = glob[index];
4235
- if (char === "*") {
4236
- if (glob[index + 1] === "*") {
4237
- const before = glob[index - 1];
4238
- const after = glob[index + 2];
4239
- if ((before === void 0 || before === "/") && (after === void 0 || after === "/")) {
4240
- out += after === "/" ? "(?:.*/)?" : ".*";
4241
- index += after === "/" ? 2 : 1;
4242
- continue;
4243
- }
4244
- out += "[^/]*";
4245
- index++;
4246
- continue;
4247
- }
4248
- out += "[^/]*";
4249
- } else if (char === "?") {
4250
- out += "[^/]";
4251
- } else if (char === "[") {
4252
- const end = glob.indexOf("]", index + 1);
4253
- if (end === -1) {
4254
- out += "\\[";
4255
- } else {
4256
- const body = glob.slice(index + 1, end).replace(/^!/, "^").replace(/\\/g, "\\\\");
4257
- out += `[${body}]`;
4258
- index = end;
4259
- }
4260
- } else if (char === "\\" && index + 1 < glob.length) {
4261
- out += glob[index + 1].replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
4262
- index++;
4263
- } else {
4264
- out += char.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
4265
- }
4266
- }
4267
- return out;
4268
- }
4269
- function parseGitignore(content, base) {
4270
- const rules = [];
4271
- for (const rawLine of content.split(/\r?\n/)) {
4272
- let line = rawLine.replace(/(?<!\\)\s+$/, "");
4273
- if (!line || line.startsWith("#")) continue;
4274
- let negate2 = false;
4275
- if (line.startsWith("!")) {
4276
- negate2 = true;
4277
- line = line.slice(1);
4278
- } else if (line.startsWith("\\!") || line.startsWith("\\#")) {
4279
- line = line.slice(1);
4280
- }
4281
- let directoryOnly = false;
4282
- if (line.endsWith("/")) {
4283
- directoryOnly = true;
4284
- line = line.slice(0, -1);
4285
- }
4286
- if (!line) continue;
4287
- const anchored = line.includes("/");
4288
- if (line.startsWith("/")) line = line.slice(1);
4289
- const pattern = globToRegex(line);
4290
- const prefix = anchored ? "^" : "^(?:.*/)?";
4291
- rules.push({ regex: new RegExp(`${prefix}${pattern}(?:/.*)?$`), negate: negate2, directoryOnly });
4292
- }
4293
- return { base, rules };
4294
- }
4295
- function matchIgnore(file, relative3, isDirectory) {
4296
- let result = null;
4297
- for (const rule of file.rules) {
4298
- if (rule.directoryOnly && !isDirectory) {
4299
- const parent = relative3.includes("/") ? relative3.slice(0, relative3.lastIndexOf("/")) : "";
4300
- if (!parent || !rule.regex.test(parent)) continue;
4301
- } else if (!rule.regex.test(relative3)) {
4302
- continue;
4303
- }
4304
- result = !rule.negate;
4305
- }
4306
- return result;
4307
- }
4308
-
4309
- // ../css/src/node/scanner.ts
4310
- var ALWAYS_IGNORED_DIRECTORIES = /* @__PURE__ */ new Set([
4311
- "node_modules",
4312
- ".git",
4313
- ".hg",
4314
- ".svn",
4315
- ".next",
4316
- ".nuxt",
4317
- ".output",
4318
- ".svelte-kit",
4319
- ".turbo",
4320
- ".vercel",
4321
- ".netlify",
4322
- ".cache",
4323
- ".parcel-cache",
4324
- ".pnpm-store",
4325
- ".yarn",
4326
- "coverage"
4327
- ]);
4328
- var IGNORED_FILES = /* @__PURE__ */ new Set([
4329
- "package-lock.json",
4330
- "pnpm-lock.yaml",
4331
- "yarn.lock",
4332
- "bun.lock",
4333
- "bun.lockb",
4334
- "npm-shrinkwrap.json"
4335
- ]);
4336
- var IGNORED_EXTENSIONS = /* @__PURE__ */ new Set([
4337
- ".css",
4338
- ".scss",
4339
- ".sass",
4340
- ".less",
4341
- ".styl",
4342
- ".map",
4343
- ".lock",
4344
- ".log",
4345
- ".png",
4346
- ".jpg",
4347
- ".jpeg",
4348
- ".gif",
4349
- ".webp",
4350
- ".avif",
4351
- ".ico",
4352
- ".bmp",
4353
- ".tiff",
4354
- ".svg",
4355
- ".woff",
4356
- ".woff2",
4357
- ".ttf",
4358
- ".otf",
4359
- ".eot",
4360
- ".mp3",
4361
- ".mp4",
4362
- ".webm",
4363
- ".wav",
4364
- ".ogg",
4365
- ".mov",
4366
- ".avi",
4367
- ".pdf",
4368
- ".zip",
4369
- ".gz",
4370
- ".tgz",
4371
- ".tar",
4372
- ".rar",
4373
- ".7z",
4374
- ".wasm",
4375
- ".node",
4376
- ".exe",
4377
- ".dll",
4378
- ".so",
4379
- ".dylib",
4380
- ".bin",
4381
- ".psd",
4382
- ".sketch",
4383
- ".fig",
4384
- ".xlsx",
4385
- ".xls",
4386
- ".docx",
4387
- ".pptx",
4388
- ".db",
4389
- ".sqlite",
4390
- ".tsbuildinfo"
4391
- ]);
4392
- var MAX_FILE_SIZE = 2 * 1024 * 1024;
4393
- var JS_LIKE = /\.(?:[cm]?[jt]sx?|vue|svelte|astro|mdx)$/;
4394
- function toPosix(path) {
4395
- return sep === "/" ? path : path.split(sep).join("/");
4396
- }
4397
- function findGitRoot(start) {
4398
- let current = start;
4399
- while (true) {
4400
- if (existsSync(join(current, ".git"))) return current;
4401
- const parent = dirname(current);
4402
- if (parent === current) return null;
4403
- current = parent;
4404
- }
4405
- }
4406
- function readIgnoreFile(directory) {
4407
- const path = join(directory, ".gitignore");
4408
- if (!existsSync(path)) return null;
4409
- try {
4410
- return parseGitignore(readFileSync(path, "utf8"), toPosix(directory));
4411
- } catch {
4412
- return null;
4413
- }
4414
- }
4415
- function isScannableFile(file) {
4416
- const name = file.slice(Math.max(file.lastIndexOf("/"), file.lastIndexOf("\\")) + 1);
4417
- if (IGNORED_FILES.has(name)) return false;
4418
- const extension = extname(name).toLowerCase();
4419
- return !IGNORED_EXTENSIONS.has(extension);
4420
- }
4421
- function analyzeContent(file, content) {
4422
- const candidates = /* @__PURE__ */ new Set();
4423
- const usage = emptyUsage();
4424
- extractCandidates(content, candidates);
4425
- detectBlocks(candidates, usage.blocks);
4426
- if (/\.html?$/i.test(file)) detectBlocks(candidates, usage.htmlBlocks);
4427
- if (JS_LIKE.test(file)) detectImports(content, usage);
4428
- return { candidates, usage };
4429
- }
4430
- var ProjectScanner = class {
4431
- root;
4432
- entries = /* @__PURE__ */ new Map();
4433
- ancestorIgnores;
4434
- aggregate = null;
4435
- constructor(root) {
4436
- this.root = resolve(root);
4437
- const gitRoot = findGitRoot(this.root);
4438
- this.ancestorIgnores = [];
4439
- if (gitRoot) {
4440
- const chain = [];
4441
- let current = dirname(this.root);
4442
- while (current.length >= gitRoot.length && this.root !== gitRoot) {
4443
- chain.unshift(current);
4444
- if (current === gitRoot) break;
4445
- current = dirname(current);
4446
- }
4447
- for (const directory of chain) {
4448
- const file = readIgnoreFile(directory);
4449
- if (file) this.ancestorIgnores.push(file);
4450
- }
4451
- }
4452
- }
4453
- isIgnored(path, isDirectory, scoped) {
4454
- let ignored = false;
4455
- const posix = toPosix(path);
4456
- for (const file of [...this.ancestorIgnores, ...scoped]) {
4457
- if (!posix.startsWith(`${file.base}/`)) continue;
4458
- const result = matchIgnore(file, posix.slice(file.base.length + 1), isDirectory);
4459
- if (result !== null) ignored = result;
4460
- }
4461
- return ignored;
4462
- }
4463
- /** Quét toàn bộ (file không đổi lấy từ cache). */
4464
- scan() {
4465
- const seen = /* @__PURE__ */ new Set();
4466
- let changed = false;
4467
- const walk = (directory, scoped) => {
4468
- const own = readIgnoreFile(directory);
4469
- const ignores = own ? [...scoped, own] : scoped;
4470
- let entries;
4471
- try {
4472
- entries = readdirSync(directory, { withFileTypes: true });
4473
- } catch {
4474
- return;
4475
- }
4476
- for (const entry of entries) {
4477
- const path = join(directory, entry.name);
4478
- if (entry.isDirectory()) {
4479
- if (ALWAYS_IGNORED_DIRECTORIES.has(entry.name)) continue;
4480
- if (this.isIgnored(path, true, ignores)) continue;
4481
- walk(path, ignores);
4482
- continue;
4483
- }
4484
- if (!entry.isFile() || !isScannableFile(entry.name)) continue;
4485
- if (this.isIgnored(path, false, ignores)) continue;
4486
- seen.add(path);
4487
- if (this.refresh(path)) changed = true;
4488
- }
4489
- };
4490
- walk(this.root, []);
4491
- for (const path of [...this.entries.keys()]) {
4492
- if (!seen.has(path)) {
4493
- this.entries.delete(path);
4494
- changed = true;
4495
- }
4496
- }
4497
- if (changed || !this.aggregate) this.aggregate = null;
4498
- return this.result();
4499
- }
4500
- /** Đọc lại file nếu `mtime` đổi. Trả true nếu nội dung cache thay đổi. */
4501
- refresh(path) {
4502
- let stats;
4503
- try {
4504
- stats = statSync(path);
4505
- } catch {
4506
- return this.entries.delete(path);
4507
- }
4508
- if (stats.size > MAX_FILE_SIZE) return false;
4509
- const cached2 = this.entries.get(path);
4510
- if (cached2 && cached2.mtimeMs === stats.mtimeMs) return false;
4511
- let content;
4512
- try {
4513
- content = readFileSync(path, "utf8");
4514
- } catch {
4515
- return false;
4516
- }
4517
- this.entries.set(path, { mtimeMs: stats.mtimeMs, ...analyzeContent(path, content) });
4518
- return true;
4519
- }
4520
- /**
4521
- * Cập nhật một file từ nội dung đã có (HMR / transform của bundler). Trả true nếu xuất hiện
4522
- * candidate hoặc component Leaf mới — tức stylesheet cần sinh lại.
4523
- */
4524
- update(path, content) {
4525
- const absolute = resolve(path);
4526
- const before = this.result();
4527
- const analyzed = analyzeContent(absolute, content);
4528
- this.entries.set(absolute, {
4529
- mtimeMs: this.entries.get(absolute)?.mtimeMs ?? 0,
4530
- ...analyzed
4531
- });
4532
- const grew = [...analyzed.candidates].some((candidate) => !before.candidates.has(candidate)) || [...analyzed.usage.exports].some((name) => !before.usage.exports.has(name)) || [...analyzed.usage.blocks].some((block) => !before.usage.blocks.has(block)) || [...analyzed.usage.htmlBlocks].some((block) => !before.usage.htmlBlocks.has(block)) || analyzed.usage.all && !before.usage.all;
4533
- this.aggregate = null;
4534
- return grew;
4535
- }
4536
- /** File nằm trong phạm vi quét (không bị ignore). */
4537
- covers(path) {
4538
- const absolute = resolve(path);
4539
- const inside = relative(this.root, absolute);
4540
- if (inside.startsWith("..") || inside === "" || !isScannableFile(absolute)) return false;
4541
- const parts = toPosix(inside).split("/");
4542
- if (parts.some((part) => ALWAYS_IGNORED_DIRECTORIES.has(part))) return false;
4543
- const scoped = [];
4544
- let directory = this.root;
4545
- const own = readIgnoreFile(directory);
4546
- if (own) scoped.push(own);
4547
- for (const part of parts.slice(0, -1)) {
4548
- directory = join(directory, part);
4549
- if (this.isIgnored(directory, true, scoped)) return false;
4550
- const file = readIgnoreFile(directory);
4551
- if (file) scoped.push(file);
4552
- }
4553
- return !this.isIgnored(absolute, false, scoped);
4554
- }
4555
- /** Kết quả hiện tại (không đọc lại ổ đĩa) — dùng sau `update()` trong HMR. */
4556
- snapshot() {
4557
- return this.result();
4558
- }
4559
- result() {
4560
- if (this.aggregate) return this.aggregate;
4561
- const candidates = /* @__PURE__ */ new Set();
4562
- const usage = emptyUsage();
4563
- for (const entry of this.entries.values()) {
4564
- for (const candidate of entry.candidates) candidates.add(candidate);
4565
- for (const name of entry.usage.exports) usage.exports.add(name);
4566
- for (const block of entry.usage.blocks) usage.blocks.add(block);
4567
- for (const block of entry.usage.htmlBlocks) usage.htmlBlocks.add(block);
4568
- if (entry.usage.all) usage.all = true;
4569
- }
4570
- this.aggregate = { candidates, usage, files: [...this.entries.keys()].sort() };
4571
- return this.aggregate;
4572
- }
4573
- };
4574
-
4575
- // ../css/src/node/engine.ts
4576
- var LeafEngine = class {
4577
- scanner;
4578
- compiler;
4579
- assets;
4580
- constructor(options) {
4581
- this.assets = options.assets;
4582
- this.compiler = createCompiler(options.assets);
4583
- this.scanner = new ProjectScanner(options.root);
4584
- }
4585
- /** Kiểm tra cấu hình cấm, trả null nếu file không import Leaf. */
4586
- /**
4587
- * `rescan: false` — dùng kết quả quét hiện có (HMR: file đổi đã được `update()`), bỏ lượt
4588
- * duyệt thư mục. Mặc định quét lại (file không đổi lấy từ cache mtime) để bắt cả file mới.
4589
- */
4590
- process(source, file, options = {}) {
4591
- assertNoConfiguration(source, file);
4592
- if (!hasLeafImport(source)) return null;
4593
- const scan = options.rescan === false ? this.scanner.snapshot() : this.scanner.scan();
4594
- const stylesheet = buildStylesheet(
4595
- this.assets,
4596
- this.compiler,
4597
- scan.candidates,
4598
- scan.usage,
4599
- {
4600
- minify: options.minify
4601
- }
4602
- );
4603
- return {
4604
- css: replaceLeafImport(source, stylesheet.css),
4605
- diagnostics: stylesheet.diagnostics,
4606
- files: scan.files
4607
- };
4608
- }
4609
- /** Cập nhật một file source (HMR). True nếu stylesheet cần sinh lại. */
4610
- update(file, content) {
4611
- if (!this.scanner.covers(file)) return false;
4612
- return this.scanner.update(file, content);
4613
- }
4614
- };
4615
- function createDiagnosticReporter(log) {
4616
- const reported = /* @__PURE__ */ new Set();
4617
- return (diagnostics) => {
4618
- for (const { candidate, message } of diagnostics) {
4619
- if (reported.has(candidate)) continue;
4620
- reported.add(candidate);
4621
- log(`[leaf-css] \`${candidate}\`: ${message}`);
4622
- }
4623
- };
4624
- }
4625
-
4626
- // ../css/src/integrations/cli.ts
4627
- var HELP = `leaf-css \u2014 sinh CSS Leaf (foundation + component + utility \u0111\xE3 tree-shake)
4628
-
4629
- C\xE1ch d\xF9ng:
4630
- leaf-css -i <input.css> -o <output.css> [--watch] [--minify]
4631
-
4632
- -i, --input File CSS c\xF3 @import "@finhay-pro/leaf-design-system/css";
4633
- -o, --output File CSS ghi ra
4634
- -w, --watch Theo d\xF5i source, \u0111\u1ED5i l\xE0 build l\u1EA1i
4635
- -m, --minify Minify output
4636
- -h, --help H\u01B0\u1EDBng d\u1EABn`;
4637
- function runCli(argv, getAssets, io = { cwd: process.cwd(), log: console.log, error: console.error }) {
4638
- let args;
4639
- try {
4640
- args = parseArgs({
4641
- args: argv,
4642
- options: {
4643
- input: { type: "string", short: "i" },
4644
- output: { type: "string", short: "o" },
4645
- watch: { type: "boolean", short: "w" },
4646
- minify: { type: "boolean", short: "m" },
4647
- help: { type: "boolean", short: "h" }
4648
- },
4649
- strict: true
4650
- }).values;
4651
- } catch (error) {
4652
- io.error(`${error.message}
4653
-
4654
- ${HELP}`);
4655
- return { code: 1 };
4656
- }
4657
- if (args.help) {
4658
- io.log(HELP);
4659
- return { code: 0 };
4660
- }
4661
- if (!args.input || !args.output) {
4662
- io.error(`Thi\u1EBFu --input / --output.
4663
-
4664
- ${HELP}`);
4665
- return { code: 1 };
4666
- }
4667
- const input = resolve2(io.cwd, args.input);
4668
- const output = resolve2(io.cwd, args.output);
4669
- const engine = new LeafEngine({ root: io.cwd, assets: getAssets() });
4670
- const report = createDiagnosticReporter(io.error);
4671
- const build2 = () => {
4672
- const started = performance.now();
4673
- let source;
4674
- try {
4675
- source = readFileSync2(input, "utf8");
4676
- } catch {
4677
- io.error(`Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c ${relative2(io.cwd, input)}`);
4678
- return false;
4679
- }
4680
- let result;
4681
- try {
4682
- result = engine.process(source, input, { minify: args.minify });
4683
- } catch (error) {
4684
- io.error(error.message);
4685
- return false;
4686
- }
4687
- if (!result) {
4688
- io.error(
4689
- `${relative2(io.cwd, input)} ch\u01B0a c\xF3 @import "@finhay-pro/leaf-design-system/css";`
4690
- );
4691
- return false;
4692
- }
4693
- mkdirSync(dirname2(output), { recursive: true });
4694
- writeFileSync(output, result.css, "utf8");
4695
- report(result.diagnostics);
4696
- io.log(
4697
- `leaf-css: ${relative2(io.cwd, output)} (${Math.round(performance.now() - started)}ms)`
4698
- );
4699
- return true;
4700
- };
4701
- const ok = build2();
4702
- if (!args.watch) return { code: ok ? 0 : 1 };
4703
- let timer = null;
4704
- const watcher = watch(io.cwd, { recursive: true }, (_event, name) => {
4705
- if (!name) return;
4706
- const changed = resolve2(io.cwd, name.toString());
4707
- if (changed === output || /(?:^|[\\/])(?:node_modules|\.git)(?:[\\/]|$)/.test(name.toString()))
4708
- return;
4709
- if (timer) clearTimeout(timer);
4710
- timer = setTimeout(build2, 30);
4711
- });
4712
- io.log("leaf-css: \u0111ang theo d\xF5i thay \u0111\u1ED5i\u2026");
4713
- return {
4714
- code: 0,
4715
- stop: () => {
4716
- if (timer) clearTimeout(timer);
4717
- watcher.close();
4718
- }
4719
- };
4720
- }
4721
-
4722
- // ../css/src/integrations/postcss.ts
4723
- function createPostcssPlugin(getAssets, getRoot = () => process.cwd()) {
4724
- const engines = /* @__PURE__ */ new Map();
4725
- const creator = (() => ({
4726
- postcssPlugin: "leaf-css",
4727
- Once(root, { result, postcss: postcss2 }) {
4728
- const file = result.opts.from ?? "<stylesheet>";
4729
- if (file.includes("/node_modules/") || file.includes("\\node_modules\\")) return;
4730
- const projectRoot = getRoot();
4731
- let engine = engines.get(projectRoot);
4732
- if (!engine) {
4733
- engine = new LeafEngine({ root: projectRoot, assets: getAssets() });
4734
- engines.set(projectRoot, engine);
4735
- }
4736
- const processed = engine.process(root.toString(), file);
4737
- if (!processed) return;
4738
- const parsed = postcss2.parse(processed.css, { from: file });
4739
- root.removeAll();
4740
- root.append(parsed.nodes);
4741
- result.messages.push({
4742
- type: "dir-dependency",
4743
- plugin: "leaf-css",
4744
- dir: engine.scanner.root,
4745
- glob: "**/*",
4746
- parent: file
4747
- });
4748
- for (const { candidate, message } of processed.diagnostics) {
4749
- result.warn(`\`${candidate}\`: ${message}`, { plugin: "leaf-css" });
4750
- }
4751
- }
4752
- }));
4753
- creator.postcss = true;
4754
- return creator;
4755
- }
4756
-
4757
- // ../css/src/integrations/vite.ts
4758
- var CSS_FILE = /\.(?:css|pcss|postcss)$/;
4759
- var SKIPPED_QUERY = /[?&](?:raw|url|worker|sharedworker)\b/;
4760
- function cleanId(id) {
4761
- return id.replace(/[?#].*$/, "");
4762
- }
4763
- function createVitePlugin(getAssets) {
4764
- let root = process.cwd();
4765
- let isBuild = false;
4766
- let warn = (message) => console.warn(message);
4767
- let engine = null;
4768
- let server = null;
4769
- const stylesheets = /* @__PURE__ */ new Set();
4770
- let updated = false;
4771
- const getEngine = () => engine ??= new LeafEngine({ root, assets: getAssets() });
4772
- const report = createDiagnosticReporter((message) => warn(message));
4773
- function invalidateStylesheets() {
4774
- const modules = [];
4775
- if (!server) return modules;
4776
- updated = true;
4777
- for (const id of stylesheets) {
4778
- const module = server.moduleGraph.getModuleById(id);
4779
- if (!module) continue;
4780
- server.moduleGraph.invalidateModule(module);
4781
- modules.push(module);
4782
- }
4783
- return modules;
4784
- }
4785
- return {
4786
- name: "leaf-css",
4787
- enforce: "pre",
4788
- configResolved(config) {
4789
- root = config.root;
4790
- isBuild = config.command === "build";
4791
- warn = (message) => config.logger.warn(message);
4792
- },
4793
- configureServer(devServer) {
4794
- server = devServer;
4795
- },
4796
- transform(code, id) {
4797
- if (SKIPPED_QUERY.test(id)) return null;
4798
- const file = cleanId(id);
4799
- if (file.includes("/node_modules/") || file.startsWith("\0")) return null;
4800
- if (CSS_FILE.test(file)) {
4801
- const result = getEngine().process(code, file, { rescan: !updated });
4802
- updated = false;
4803
- if (!result) return null;
4804
- stylesheets.add(id);
4805
- if (isBuild) for (const source of result.files) this.addWatchFile(source);
4806
- report(result.diagnostics);
4807
- return { code: result.css, map: null };
4808
- }
4809
- if (server && stylesheets.size > 0 && isScannableFile(file) && getEngine().update(file, code)) {
4810
- for (const module of invalidateStylesheets()) void server.reloadModule(module);
4811
- }
4812
- return null;
4813
- },
4814
- async handleHotUpdate({ file, modules, read }) {
4815
- if (CSS_FILE.test(file) || stylesheets.size === 0) return;
4816
- const content = await read();
4817
- if (!getEngine().update(file, content)) return;
4818
- return [...modules, ...invalidateStylesheets()];
4819
- }
4820
- };
4821
- }
4822
-
4823
- // ../css/src/node/load.ts
4824
- import { readFileSync as readFileSync3 } from "node:fs";
4825
- import { fileURLToPath } from "node:url";
4826
- var cached = null;
4827
- function loadAssets(url = new URL("./assets.json", import.meta.url)) {
4828
- if (cached) return cached;
4829
- try {
4830
- cached = JSON.parse(readFileSync3(fileURLToPath(url), "utf8"));
4831
- } catch {
4832
- throw new Error(
4833
- `Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c ${fileURLToPath(url)} \u2014 c\xE0i l\u1EA1i / build l\u1EA1i @finhay-pro/leaf-design-system.`
4834
- );
4835
- }
4836
- return cached;
4837
- }
4838
-
4839
- // ../css/src/entries.ts
4840
- function vite() {
4841
- return createVitePlugin(() => loadAssets());
4842
- }
4843
- var postcss = createPostcssPlugin(() => loadAssets());
4844
- function cli(argv) {
4845
- const { code, stop } = runCli(argv, () => loadAssets());
4846
- if (!stop) process.exitCode = code;
4847
- return stop;
4848
- }
4849
-
4850
- export {
4851
- vite,
4852
- postcss,
4853
- cli
4854
- };