@react-spectrum/s2 3.0.0-nightly-5ae234603-240925 → 3.0.0-nightly-d57bd8d90-240927

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 (445) hide show
  1. package/dist/Accordion.cjs.map +1 -1
  2. package/dist/Accordion.css.map +1 -1
  3. package/dist/Accordion.mjs.map +1 -1
  4. package/dist/ActionButton.cjs.map +1 -1
  5. package/dist/ActionButton.css.map +1 -1
  6. package/dist/ActionButton.mjs.map +1 -1
  7. package/dist/AlertDialog.cjs.map +1 -1
  8. package/dist/AlertDialog.css.map +1 -1
  9. package/dist/AlertDialog.mjs.map +1 -1
  10. package/dist/Avatar.cjs.map +1 -1
  11. package/dist/Avatar.css.map +1 -1
  12. package/dist/Avatar.mjs.map +1 -1
  13. package/dist/AvatarGroup.cjs.map +1 -1
  14. package/dist/AvatarGroup.css.map +1 -1
  15. package/dist/AvatarGroup.mjs.map +1 -1
  16. package/dist/Badge.cjs.map +1 -1
  17. package/dist/Badge.css.map +1 -1
  18. package/dist/Badge.mjs.map +1 -1
  19. package/dist/Breadcrumbs.cjs.map +1 -1
  20. package/dist/Breadcrumbs.css.map +1 -1
  21. package/dist/Breadcrumbs.mjs.map +1 -1
  22. package/dist/Button.cjs +39 -5
  23. package/dist/Button.cjs.map +1 -1
  24. package/dist/Button.css +64 -0
  25. package/dist/Button.css.map +1 -1
  26. package/dist/Button.mjs +39 -5
  27. package/dist/Button.mjs.map +1 -1
  28. package/dist/ButtonGroup.cjs.map +1 -1
  29. package/dist/ButtonGroup.css.map +1 -1
  30. package/dist/ButtonGroup.mjs.map +1 -1
  31. package/dist/Card.cjs +2 -2
  32. package/dist/Card.cjs.map +1 -1
  33. package/dist/Card.css.map +1 -1
  34. package/dist/Card.mjs +2 -2
  35. package/dist/Card.mjs.map +1 -1
  36. package/dist/CardView.cjs.map +1 -1
  37. package/dist/CardView.css.map +1 -1
  38. package/dist/CardView.mjs.map +1 -1
  39. package/dist/CenterBaseline.cjs.map +1 -1
  40. package/dist/CenterBaseline.css.map +1 -1
  41. package/dist/CenterBaseline.mjs.map +1 -1
  42. package/dist/Checkbox.cjs +4 -1
  43. package/dist/Checkbox.cjs.map +1 -1
  44. package/dist/Checkbox.css +4 -0
  45. package/dist/Checkbox.css.map +1 -1
  46. package/dist/Checkbox.mjs +4 -1
  47. package/dist/Checkbox.mjs.map +1 -1
  48. package/dist/CheckboxGroup.cjs.map +1 -1
  49. package/dist/CheckboxGroup.css.map +1 -1
  50. package/dist/CheckboxGroup.mjs.map +1 -1
  51. package/dist/ClearButton.cjs.map +1 -1
  52. package/dist/ClearButton.css.map +1 -1
  53. package/dist/ClearButton.mjs.map +1 -1
  54. package/dist/CloseButton.cjs.map +1 -1
  55. package/dist/CloseButton.css.map +1 -1
  56. package/dist/CloseButton.mjs.map +1 -1
  57. package/dist/ColorArea.cjs.map +1 -1
  58. package/dist/ColorArea.css.map +1 -1
  59. package/dist/ColorArea.mjs.map +1 -1
  60. package/dist/ColorField.cjs.map +1 -1
  61. package/dist/ColorField.css.map +1 -1
  62. package/dist/ColorField.mjs.map +1 -1
  63. package/dist/ColorHandle.cjs.map +1 -1
  64. package/dist/ColorHandle.css.map +1 -1
  65. package/dist/ColorHandle.mjs.map +1 -1
  66. package/dist/ColorSlider.cjs.map +1 -1
  67. package/dist/ColorSlider.css.map +1 -1
  68. package/dist/ColorSlider.mjs.map +1 -1
  69. package/dist/ColorSwatch.cjs.map +1 -1
  70. package/dist/ColorSwatch.css.map +1 -1
  71. package/dist/ColorSwatch.mjs.map +1 -1
  72. package/dist/ColorSwatchPicker.cjs.map +1 -1
  73. package/dist/ColorSwatchPicker.css.map +1 -1
  74. package/dist/ColorSwatchPicker.mjs.map +1 -1
  75. package/dist/ColorWheel.cjs.map +1 -1
  76. package/dist/ColorWheel.css.map +1 -1
  77. package/dist/ColorWheel.mjs.map +1 -1
  78. package/dist/ComboBox.cjs +3 -0
  79. package/dist/ComboBox.cjs.map +1 -1
  80. package/dist/ComboBox.css.map +1 -1
  81. package/dist/ComboBox.mjs +3 -0
  82. package/dist/ComboBox.mjs.map +1 -1
  83. package/dist/Content.cjs +0 -2
  84. package/dist/Content.cjs.map +1 -1
  85. package/dist/Content.mjs +1 -2
  86. package/dist/Content.mjs.map +1 -1
  87. package/dist/ContextualHelp.cjs.map +1 -1
  88. package/dist/ContextualHelp.css.map +1 -1
  89. package/dist/ContextualHelp.mjs.map +1 -1
  90. package/dist/Dialog.cjs +7 -5
  91. package/dist/Dialog.cjs.map +1 -1
  92. package/dist/Dialog.css.map +1 -1
  93. package/dist/Dialog.mjs +8 -6
  94. package/dist/Dialog.mjs.map +1 -1
  95. package/dist/Disclosure.cjs.map +1 -1
  96. package/dist/Disclosure.css.map +1 -1
  97. package/dist/Disclosure.mjs.map +1 -1
  98. package/dist/Divider.cjs.map +1 -1
  99. package/dist/Divider.css.map +1 -1
  100. package/dist/Divider.mjs.map +1 -1
  101. package/dist/DropZone.cjs.map +1 -1
  102. package/dist/DropZone.css.map +1 -1
  103. package/dist/DropZone.mjs.map +1 -1
  104. package/dist/Field.cjs.map +1 -1
  105. package/dist/Field.css.map +1 -1
  106. package/dist/Field.mjs.map +1 -1
  107. package/dist/Form.cjs.map +1 -1
  108. package/dist/Form.css.map +1 -1
  109. package/dist/Form.mjs.map +1 -1
  110. package/dist/IllustratedMessage.cjs.map +1 -1
  111. package/dist/IllustratedMessage.css.map +1 -1
  112. package/dist/IllustratedMessage.mjs.map +1 -1
  113. package/dist/Image.cjs.map +1 -1
  114. package/dist/Image.css.map +1 -1
  115. package/dist/Image.mjs.map +1 -1
  116. package/dist/InlineAlert.cjs.map +1 -1
  117. package/dist/InlineAlert.css.map +1 -1
  118. package/dist/InlineAlert.mjs.map +1 -1
  119. package/dist/Link.cjs.map +1 -1
  120. package/dist/Link.css.map +1 -1
  121. package/dist/Link.mjs.map +1 -1
  122. package/dist/Menu.cjs.map +1 -1
  123. package/dist/Menu.css.map +1 -1
  124. package/dist/Menu.mjs.map +1 -1
  125. package/dist/Meter.cjs.map +1 -1
  126. package/dist/Meter.css.map +1 -1
  127. package/dist/Meter.mjs.map +1 -1
  128. package/dist/Modal.cjs.map +1 -1
  129. package/dist/Modal.css.map +1 -1
  130. package/dist/Modal.mjs.map +1 -1
  131. package/dist/MoveHorizontalCircleTableWidget.cjs +33 -0
  132. package/dist/MoveHorizontalCircleTableWidget.cjs.map +1 -0
  133. package/dist/MoveHorizontalCircleTableWidget.mjs +28 -0
  134. package/dist/MoveHorizontalCircleTableWidget.mjs.map +1 -0
  135. package/dist/NumberField.cjs.map +1 -1
  136. package/dist/NumberField.css.map +1 -1
  137. package/dist/NumberField.mjs.map +1 -1
  138. package/dist/Picker.cjs +3 -0
  139. package/dist/Picker.cjs.map +1 -1
  140. package/dist/Picker.css.map +1 -1
  141. package/dist/Picker.mjs +3 -0
  142. package/dist/Picker.mjs.map +1 -1
  143. package/dist/Popover.cjs +1 -0
  144. package/dist/Popover.cjs.map +1 -1
  145. package/dist/Popover.css +4 -0
  146. package/dist/Popover.css.map +1 -1
  147. package/dist/Popover.mjs +1 -0
  148. package/dist/Popover.mjs.map +1 -1
  149. package/dist/ProgressBar.cjs.map +1 -1
  150. package/dist/ProgressBar.css.map +1 -1
  151. package/dist/ProgressBar.mjs.map +1 -1
  152. package/dist/ProgressCircle.cjs +0 -1
  153. package/dist/ProgressCircle.cjs.map +1 -1
  154. package/dist/ProgressCircle.css +0 -4
  155. package/dist/ProgressCircle.css.map +1 -1
  156. package/dist/ProgressCircle.mjs +0 -1
  157. package/dist/ProgressCircle.mjs.map +1 -1
  158. package/dist/Provider.cjs.map +1 -1
  159. package/dist/Provider.css.map +1 -1
  160. package/dist/Provider.mjs.map +1 -1
  161. package/dist/Radio.cjs.map +1 -1
  162. package/dist/Radio.css.map +1 -1
  163. package/dist/Radio.mjs.map +1 -1
  164. package/dist/RadioGroup.cjs.map +1 -1
  165. package/dist/RadioGroup.css.map +1 -1
  166. package/dist/RadioGroup.mjs.map +1 -1
  167. package/dist/SearchField.cjs.map +1 -1
  168. package/dist/SearchField.css.map +1 -1
  169. package/dist/SearchField.mjs.map +1 -1
  170. package/dist/SegmentedControl.cjs +11 -8
  171. package/dist/SegmentedControl.cjs.map +1 -1
  172. package/dist/SegmentedControl.css.map +1 -1
  173. package/dist/SegmentedControl.mjs +11 -8
  174. package/dist/SegmentedControl.mjs.map +1 -1
  175. package/dist/SkeletonCollection.cjs.map +1 -1
  176. package/dist/SkeletonCollection.mjs.map +1 -1
  177. package/dist/Slider.cjs.map +1 -1
  178. package/dist/Slider.css.map +1 -1
  179. package/dist/Slider.mjs.map +1 -1
  180. package/dist/StatusLight.cjs.map +1 -1
  181. package/dist/StatusLight.css.map +1 -1
  182. package/dist/StatusLight.mjs.map +1 -1
  183. package/dist/Switch.cjs.map +1 -1
  184. package/dist/Switch.css.map +1 -1
  185. package/dist/Switch.mjs.map +1 -1
  186. package/dist/Table.cjs +1064 -0
  187. package/dist/Table.cjs.map +1 -0
  188. package/dist/Table.css +801 -0
  189. package/dist/Table.css.map +1 -0
  190. package/dist/Table.mjs +1054 -0
  191. package/dist/Table.mjs.map +1 -0
  192. package/dist/Tabs.cjs.map +1 -1
  193. package/dist/Tabs.css.map +1 -1
  194. package/dist/Tabs.mjs.map +1 -1
  195. package/dist/TagGroup.cjs +5 -3
  196. package/dist/TagGroup.cjs.map +1 -1
  197. package/dist/TagGroup.css.map +1 -1
  198. package/dist/TagGroup.mjs +5 -3
  199. package/dist/TagGroup.mjs.map +1 -1
  200. package/dist/TextField.cjs.map +1 -1
  201. package/dist/TextField.css.map +1 -1
  202. package/dist/TextField.mjs.map +1 -1
  203. package/dist/ToggleButton.cjs +2 -1
  204. package/dist/ToggleButton.cjs.map +1 -1
  205. package/dist/ToggleButton.css.map +1 -1
  206. package/dist/ToggleButton.mjs +2 -1
  207. package/dist/ToggleButton.mjs.map +1 -1
  208. package/dist/Tooltip.cjs.map +1 -1
  209. package/dist/Tooltip.css.map +1 -1
  210. package/dist/Tooltip.mjs.map +1 -1
  211. package/dist/ar-AE.cjs +5 -0
  212. package/dist/ar-AE.cjs.map +1 -1
  213. package/dist/ar-AE.mjs +5 -0
  214. package/dist/ar-AE.mjs.map +1 -1
  215. package/dist/bg-BG.cjs +5 -0
  216. package/dist/bg-BG.cjs.map +1 -1
  217. package/dist/bg-BG.mjs +5 -0
  218. package/dist/bg-BG.mjs.map +1 -1
  219. package/dist/cs-CZ.cjs +5 -0
  220. package/dist/cs-CZ.cjs.map +1 -1
  221. package/dist/cs-CZ.mjs +5 -0
  222. package/dist/cs-CZ.mjs.map +1 -1
  223. package/dist/da-DK.cjs +5 -0
  224. package/dist/da-DK.cjs.map +1 -1
  225. package/dist/da-DK.mjs +5 -0
  226. package/dist/da-DK.mjs.map +1 -1
  227. package/dist/de-DE.cjs +5 -0
  228. package/dist/de-DE.cjs.map +1 -1
  229. package/dist/de-DE.mjs +5 -0
  230. package/dist/de-DE.mjs.map +1 -1
  231. package/dist/el-GR.cjs +5 -0
  232. package/dist/el-GR.cjs.map +1 -1
  233. package/dist/el-GR.mjs +5 -0
  234. package/dist/el-GR.mjs.map +1 -1
  235. package/dist/en-US.cjs +5 -0
  236. package/dist/en-US.cjs.map +1 -1
  237. package/dist/en-US.mjs +5 -0
  238. package/dist/en-US.mjs.map +1 -1
  239. package/dist/es-ES.cjs +5 -0
  240. package/dist/es-ES.cjs.map +1 -1
  241. package/dist/es-ES.mjs +5 -0
  242. package/dist/es-ES.mjs.map +1 -1
  243. package/dist/et-EE.cjs +5 -0
  244. package/dist/et-EE.cjs.map +1 -1
  245. package/dist/et-EE.mjs +5 -0
  246. package/dist/et-EE.mjs.map +1 -1
  247. package/dist/fi-FI.cjs +5 -0
  248. package/dist/fi-FI.cjs.map +1 -1
  249. package/dist/fi-FI.mjs +5 -0
  250. package/dist/fi-FI.mjs.map +1 -1
  251. package/dist/fr-FR.cjs +5 -0
  252. package/dist/fr-FR.cjs.map +1 -1
  253. package/dist/fr-FR.mjs +5 -0
  254. package/dist/fr-FR.mjs.map +1 -1
  255. package/dist/he-IL.cjs +5 -0
  256. package/dist/he-IL.cjs.map +1 -1
  257. package/dist/he-IL.mjs +5 -0
  258. package/dist/he-IL.mjs.map +1 -1
  259. package/dist/hr-HR.cjs +5 -0
  260. package/dist/hr-HR.cjs.map +1 -1
  261. package/dist/hr-HR.mjs +5 -0
  262. package/dist/hr-HR.mjs.map +1 -1
  263. package/dist/hu-HU.cjs +5 -0
  264. package/dist/hu-HU.cjs.map +1 -1
  265. package/dist/hu-HU.mjs +5 -0
  266. package/dist/hu-HU.mjs.map +1 -1
  267. package/dist/it-IT.cjs +5 -0
  268. package/dist/it-IT.cjs.map +1 -1
  269. package/dist/it-IT.mjs +5 -0
  270. package/dist/it-IT.mjs.map +1 -1
  271. package/dist/ja-JP.cjs +5 -0
  272. package/dist/ja-JP.cjs.map +1 -1
  273. package/dist/ja-JP.mjs +5 -0
  274. package/dist/ja-JP.mjs.map +1 -1
  275. package/dist/ko-KR.cjs +5 -0
  276. package/dist/ko-KR.cjs.map +1 -1
  277. package/dist/ko-KR.mjs +5 -0
  278. package/dist/ko-KR.mjs.map +1 -1
  279. package/dist/lt-LT.cjs +5 -0
  280. package/dist/lt-LT.cjs.map +1 -1
  281. package/dist/lt-LT.mjs +5 -0
  282. package/dist/lt-LT.mjs.map +1 -1
  283. package/dist/lv-LV.cjs +5 -0
  284. package/dist/lv-LV.cjs.map +1 -1
  285. package/dist/lv-LV.mjs +5 -0
  286. package/dist/lv-LV.mjs.map +1 -1
  287. package/dist/main.cjs +11 -0
  288. package/dist/main.cjs.map +1 -1
  289. package/dist/module.mjs +5 -1
  290. package/dist/module.mjs.map +1 -1
  291. package/dist/nb-NO.cjs +5 -0
  292. package/dist/nb-NO.cjs.map +1 -1
  293. package/dist/nb-NO.mjs +5 -0
  294. package/dist/nb-NO.mjs.map +1 -1
  295. package/dist/nl-NL.cjs +5 -0
  296. package/dist/nl-NL.cjs.map +1 -1
  297. package/dist/nl-NL.mjs +5 -0
  298. package/dist/nl-NL.mjs.map +1 -1
  299. package/dist/pl-PL.cjs +5 -0
  300. package/dist/pl-PL.cjs.map +1 -1
  301. package/dist/pl-PL.mjs +5 -0
  302. package/dist/pl-PL.mjs.map +1 -1
  303. package/dist/pt-BR.cjs +5 -0
  304. package/dist/pt-BR.cjs.map +1 -1
  305. package/dist/pt-BR.mjs +5 -0
  306. package/dist/pt-BR.mjs.map +1 -1
  307. package/dist/pt-PT.cjs +5 -0
  308. package/dist/pt-PT.cjs.map +1 -1
  309. package/dist/pt-PT.mjs +5 -0
  310. package/dist/pt-PT.mjs.map +1 -1
  311. package/dist/ro-RO.cjs +5 -0
  312. package/dist/ro-RO.cjs.map +1 -1
  313. package/dist/ro-RO.mjs +5 -0
  314. package/dist/ro-RO.mjs.map +1 -1
  315. package/dist/ru-RU.cjs +5 -0
  316. package/dist/ru-RU.cjs.map +1 -1
  317. package/dist/ru-RU.mjs +5 -0
  318. package/dist/ru-RU.mjs.map +1 -1
  319. package/dist/sk-SK.cjs +5 -0
  320. package/dist/sk-SK.cjs.map +1 -1
  321. package/dist/sk-SK.mjs +5 -0
  322. package/dist/sk-SK.mjs.map +1 -1
  323. package/dist/sl-SI.cjs +5 -0
  324. package/dist/sl-SI.cjs.map +1 -1
  325. package/dist/sl-SI.mjs +5 -0
  326. package/dist/sl-SI.mjs.map +1 -1
  327. package/dist/sr-SP.cjs +5 -0
  328. package/dist/sr-SP.cjs.map +1 -1
  329. package/dist/sr-SP.mjs +5 -0
  330. package/dist/sr-SP.mjs.map +1 -1
  331. package/dist/sv-SE.cjs +5 -0
  332. package/dist/sv-SE.cjs.map +1 -1
  333. package/dist/sv-SE.mjs +5 -0
  334. package/dist/sv-SE.mjs.map +1 -1
  335. package/dist/tr-TR.cjs +5 -0
  336. package/dist/tr-TR.cjs.map +1 -1
  337. package/dist/tr-TR.mjs +5 -0
  338. package/dist/tr-TR.mjs.map +1 -1
  339. package/dist/types.d.ts +136 -30
  340. package/dist/types.d.ts.map +1 -1
  341. package/dist/uk-UA.cjs +5 -0
  342. package/dist/uk-UA.cjs.map +1 -1
  343. package/dist/uk-UA.mjs +5 -0
  344. package/dist/uk-UA.mjs.map +1 -1
  345. package/dist/utils.cjs +30 -0
  346. package/dist/utils.cjs.map +1 -0
  347. package/dist/utils.mjs +25 -0
  348. package/dist/utils.mjs.map +1 -0
  349. package/dist/zh-CN.cjs +5 -0
  350. package/dist/zh-CN.cjs.map +1 -1
  351. package/dist/zh-CN.mjs +5 -0
  352. package/dist/zh-CN.mjs.map +1 -1
  353. package/dist/zh-TW.cjs +5 -0
  354. package/dist/zh-TW.cjs.map +1 -1
  355. package/dist/zh-TW.mjs +5 -0
  356. package/dist/zh-TW.mjs.map +1 -1
  357. package/icons/Skeleton.cjs.map +1 -1
  358. package/icons/Skeleton.css.map +1 -1
  359. package/icons/Skeleton.mjs.map +1 -1
  360. package/package.json +18 -16
  361. package/src/Accordion.tsx +2 -2
  362. package/src/ActionButton.tsx +3 -3
  363. package/src/AlertDialog.tsx +1 -1
  364. package/src/Avatar.tsx +1 -1
  365. package/src/AvatarGroup.tsx +1 -1
  366. package/src/Badge.tsx +1 -1
  367. package/src/Breadcrumbs.tsx +2 -2
  368. package/src/Button.tsx +41 -19
  369. package/src/ButtonGroup.tsx +1 -1
  370. package/src/Card.tsx +7 -7
  371. package/src/CardView.tsx +2 -2
  372. package/src/CenterBaseline.tsx +1 -1
  373. package/src/Checkbox.tsx +3 -2
  374. package/src/CheckboxGroup.tsx +1 -1
  375. package/src/ClearButton.tsx +1 -1
  376. package/src/CloseButton.tsx +2 -2
  377. package/src/ColorArea.tsx +1 -1
  378. package/src/ColorField.tsx +1 -1
  379. package/src/ColorHandle.tsx +1 -1
  380. package/src/ColorSlider.tsx +1 -1
  381. package/src/ColorSwatch.tsx +3 -3
  382. package/src/ColorSwatchPicker.tsx +5 -5
  383. package/src/ColorWheel.tsx +1 -1
  384. package/src/ComboBox.tsx +7 -4
  385. package/src/Content.tsx +1 -3
  386. package/src/ContextualHelp.tsx +1 -1
  387. package/src/Dialog.tsx +4 -3
  388. package/src/Disclosure.tsx +4 -4
  389. package/src/Divider.tsx +1 -1
  390. package/src/DropZone.tsx +1 -1
  391. package/src/Field.tsx +2 -2
  392. package/src/Form.tsx +1 -1
  393. package/src/IllustratedMessage.tsx +1 -1
  394. package/src/Image.tsx +1 -1
  395. package/src/InlineAlert.tsx +2 -2
  396. package/src/Link.tsx +2 -2
  397. package/src/Menu.tsx +2 -2
  398. package/src/Meter.tsx +1 -1
  399. package/src/Modal.tsx +1 -1
  400. package/src/NumberField.tsx +2 -2
  401. package/src/Picker.tsx +7 -4
  402. package/src/Popover.tsx +5 -2
  403. package/src/ProgressBar.tsx +1 -1
  404. package/src/ProgressCircle.tsx +7 -5
  405. package/src/Provider.tsx +1 -1
  406. package/src/Radio.tsx +2 -2
  407. package/src/RadioGroup.tsx +1 -1
  408. package/src/SearchField.tsx +1 -1
  409. package/src/SegmentedControl.tsx +32 -22
  410. package/src/Skeleton.tsx +4 -1
  411. package/src/SkeletonCollection.tsx +4 -0
  412. package/src/Slider.tsx +2 -2
  413. package/src/StatusLight.tsx +1 -1
  414. package/src/Switch.tsx +2 -2
  415. package/src/Table.tsx +1063 -48
  416. package/src/Tabs.tsx +3 -3
  417. package/src/TagGroup.tsx +5 -4
  418. package/src/TextField.tsx +1 -1
  419. package/src/ToggleButton.tsx +3 -2
  420. package/src/Tooltip.tsx +1 -1
  421. package/src/index.ts +4 -0
  422. package/src/style-utils.ts +0 -10
  423. package/src/utils.ts +28 -0
  424. package/style/__tests__/mergeStyles.test.js +32 -0
  425. package/style/__tests__/style-macro.test.js +128 -0
  426. package/style/dist/main.cjs +38 -0
  427. package/style/dist/main.cjs.map +1 -0
  428. package/style/dist/module.mjs +26 -0
  429. package/style/dist/module.mjs.map +1 -0
  430. package/style/dist/spectrum-theme.cjs +1989 -0
  431. package/style/dist/spectrum-theme.cjs.map +1 -0
  432. package/style/dist/spectrum-theme.mjs +1978 -0
  433. package/style/dist/spectrum-theme.mjs.map +1 -0
  434. package/style/dist/style-macro.cjs +544 -0
  435. package/style/dist/style-macro.cjs.map +1 -0
  436. package/style/dist/style-macro.mjs +534 -0
  437. package/style/dist/style-macro.mjs.map +1 -0
  438. package/style/dist/types.d.ts +791 -0
  439. package/style/dist/types.d.ts.map +1 -0
  440. package/style/index.ts +24 -0
  441. package/style/runtime.ts +103 -0
  442. package/style/spectrum-theme.ts +980 -0
  443. package/style/style-macro.ts +638 -0
  444. package/style/tokens.ts +68 -0
  445. package/style/types.ts +178 -0
@@ -0,0 +1,980 @@
1
+ /*
2
+ * Copyright 2024 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ import {ArbitraryValue} from './types';
14
+ import {Color, createArbitraryProperty, createColorProperty, createMappedProperty, createRenamedProperty, createTheme, parseArbitraryValue} from './style-macro';
15
+ import {colorScale, colorToken, fontSizeToken, getToken, simpleColorScale, weirdColorToken} from './tokens' with {type: 'macro'};
16
+ import type * as CSS from 'csstype';
17
+
18
+ interface MacroContext {
19
+ addAsset(asset: {type: string, content: string}): void
20
+ }
21
+
22
+ function pxToRem(px: string | number) {
23
+ if (typeof px === 'string') {
24
+ px = parseFloat(px);
25
+ }
26
+ return px / 16 + 'rem';
27
+ }
28
+
29
+ const color = {
30
+ transparent: 'transparent',
31
+ black: 'black',
32
+ white: 'white',
33
+
34
+ ...colorScale('gray'),
35
+ ...colorScale('blue'),
36
+ ...colorScale('red'),
37
+ ...colorScale('orange'),
38
+ ...colorScale('yellow'),
39
+ ...colorScale('chartreuse'),
40
+ ...colorScale('celery'),
41
+ ...colorScale('green'),
42
+ ...colorScale('seafoam'),
43
+ ...colorScale('cyan'),
44
+ ...colorScale('indigo'),
45
+ ...colorScale('purple'),
46
+ ...colorScale('fuchsia'),
47
+ ...colorScale('magenta'),
48
+ ...colorScale('pink'),
49
+ ...colorScale('turquoise'),
50
+ ...colorScale('brown'),
51
+ ...colorScale('silver'),
52
+ ...colorScale('cinnamon'),
53
+
54
+ ...colorScale('accent-color'),
55
+ ...colorScale('informative-color'),
56
+ ...colorScale('negative-color'),
57
+ ...colorScale('notice-color'),
58
+ ...colorScale('positive-color'),
59
+
60
+ ...simpleColorScale('transparent-white'),
61
+ ...simpleColorScale('transparent-black'),
62
+
63
+ // High contrast mode.
64
+ Background: 'Background',
65
+ ButtonBorder: 'ButtonBorder',
66
+ ButtonFace: 'ButtonFace',
67
+ ButtonText: 'ButtonText',
68
+ Field: 'Field',
69
+ Highlight: 'Highlight',
70
+ HighlightText: 'HighlightText',
71
+ GrayText: 'GrayText',
72
+ Mark: 'Mark',
73
+ LinkText: 'LinkText'
74
+ };
75
+
76
+ export function baseColor(base: keyof typeof color) {
77
+ let keys = Object.keys(color) as (keyof typeof color)[];
78
+ let index = keys.indexOf(base);
79
+ if (index === -1) {
80
+ throw new Error('Invalid base color ' + base);
81
+ }
82
+
83
+ return {
84
+ default: base,
85
+ isHovered: keys[index + 1],
86
+ isFocusVisible: keys[index + 1],
87
+ isPressed: keys[index + 1]
88
+ };
89
+ }
90
+
91
+ type SpectrumColor = Color<keyof typeof color> | ArbitraryValue;
92
+ function parseColor(value: SpectrumColor) {
93
+ let arbitrary = parseArbitraryValue(value);
94
+ if (arbitrary) {
95
+ return arbitrary[0];
96
+ }
97
+ let [colorValue, opacity] = value.split('/');
98
+ colorValue = color[colorValue];
99
+ if (opacity) {
100
+ colorValue = `rgb(from ${colorValue} r g b / ${opacity}%)`;
101
+ }
102
+ return colorValue;
103
+ }
104
+
105
+ export function lightDark(light: SpectrumColor, dark: SpectrumColor): `[${string}]` {
106
+ return `[light-dark(${parseColor(light)}, ${parseColor(dark)})]`;
107
+ }
108
+
109
+ export function colorMix(a: SpectrumColor, b: SpectrumColor, percent: number): `[${string}]` {
110
+ return `[color-mix(in srgb, ${parseColor(a)}, ${parseColor(b)} ${percent}%)]`;
111
+ }
112
+
113
+ function generateSpacing<K extends number[]>(px: K): {[P in K[number]]: string} {
114
+ let res: any = {};
115
+ for (let p of px) {
116
+ res[p] = pxToRem(p);
117
+ }
118
+ return res;
119
+ }
120
+
121
+ const baseSpacing = generateSpacing([
122
+ 0,
123
+ 2, // spacing-50
124
+ 4, // spacing-75
125
+ 8, // spacing-100
126
+ 12, // spacing-200
127
+ 16, // spacing-300
128
+ 20,
129
+ 24, // spacing-400
130
+ 28,
131
+ 32, // spacing-500
132
+ 36,
133
+ 40, // spacing-600
134
+ 44,
135
+ 48, // spacing-700
136
+ 56,
137
+ // From here onward the values are mostly spaced by 1rem (16px)
138
+ 64, // spacing-800
139
+ 80, // spacing-900
140
+ 96, // spacing-1000
141
+ // TODO: should these only be available as sizes rather than spacing?
142
+ 112,
143
+ 128,
144
+ 144,
145
+ 160,
146
+ 176,
147
+ 192,
148
+ 208,
149
+ 224,
150
+ 240,
151
+ 256,
152
+ 288,
153
+ 320,
154
+ 384
155
+ ] as const);
156
+
157
+ // This should match the above, but negative. There's no way to negate a number
158
+ // type in typescript so this has to be done manually for now.
159
+ const negativeSpacing = generateSpacing([
160
+ // -2, // spacing-50 !! TODO: should we support this?
161
+ -4, // spacing-75
162
+ -8, // spacing-100
163
+ -12, // spacing-200
164
+ -16, // spacing-300
165
+ -20,
166
+ -24, // spacing-400
167
+ -28,
168
+ -32, // spacing-500
169
+ -36,
170
+ -40, // spacing-600
171
+ -44,
172
+ -48, // spacing-700
173
+ -56,
174
+ // From here onward the values are mostly spaced by 1rem (16px)
175
+ -64, // spacing-800
176
+ -80, // spacing-900
177
+ -96, // spacing-1000
178
+ // TODO: should these only be available as sizes rather than spacing?
179
+ -112,
180
+ -128,
181
+ -144,
182
+ -160,
183
+ -176,
184
+ -192,
185
+ -208,
186
+ -224,
187
+ -240,
188
+ -256,
189
+ -288,
190
+ -320,
191
+ -384
192
+ ] as const);
193
+
194
+ function arbitrary(ctx: MacroContext | void, value: string): `[${string}]` {
195
+ return ctx ? `[${value}]` : value as any;
196
+ }
197
+
198
+ export function fontRelative(this: MacroContext | void, base: number, baseFontSize = 14) {
199
+ return arbitrary(this, (base / baseFontSize) + 'em');
200
+ }
201
+
202
+ export function edgeToText(this: MacroContext | void, height: keyof typeof baseSpacing) {
203
+ return `calc(${baseSpacing[height]} * 3 / 8)`;
204
+ }
205
+
206
+ export function space(this: MacroContext | void, px: number) {
207
+ return arbitrary(this, pxToRem(px));
208
+ }
209
+
210
+ const spacing = {
211
+ ...baseSpacing,
212
+
213
+ // font-size relative values
214
+ 'text-to-control': fontRelative(10),
215
+ 'text-to-visual': {
216
+ default: fontRelative(6), // -> 5px, 5px, 6px, 7px, 8px
217
+ touch: fontRelative(8, 17) // -> 6px, 7px, 8px, 9px, 10px, should be 7px, 7px, 8px, 9px, 11px
218
+ },
219
+ // height relative values
220
+ 'edge-to-text': 'calc(self(height, self(minHeight)) * 3 / 8)',
221
+ 'pill': 'calc(self(height, self(minHeight)) / 2)'
222
+ };
223
+
224
+ export function size(this: MacroContext | void, px: number) {
225
+ return {default: arbitrary(this, pxToRem(px)), touch: arbitrary(this, pxToRem(px * 1.25))};
226
+ }
227
+
228
+ const scaledSpacing: {[key in keyof typeof baseSpacing]: {default: string, touch: string}} =
229
+ Object.fromEntries(Object.entries(baseSpacing).map(([k, v]) =>
230
+ [k, {default: v, touch: parseFloat(v) * 1.25 + v.match(/[^0-9.]+/)![0]}])
231
+ ) as any;
232
+
233
+ const sizing = {
234
+ ...scaledSpacing,
235
+ auto: 'auto',
236
+ full: '100%',
237
+ min: 'min-content',
238
+ max: 'max-content',
239
+ fit: 'fit-content',
240
+
241
+ control: {
242
+ default: size(32),
243
+ size: {
244
+ XS: size(20),
245
+ S: size(24),
246
+ L: size(40),
247
+ XL: size(48)
248
+ }
249
+ },
250
+ // With browser support for round() we could do this:
251
+ // 'control-sm': `round(${16 / 14}em, 2px)`
252
+ 'control-sm': {
253
+ default: size(16),
254
+ size: {
255
+ S: size(14),
256
+ L: size(18),
257
+ XL: size(20)
258
+ }
259
+ }
260
+ };
261
+
262
+ const height = {
263
+ ...sizing,
264
+ screen: '100vh'
265
+ };
266
+
267
+ const width = {
268
+ ...sizing,
269
+ screen: '100vw'
270
+ };
271
+
272
+ const margin = {
273
+ ...spacing,
274
+ ...negativeSpacing,
275
+ auto: 'auto'
276
+ };
277
+
278
+ const inset = {
279
+ ...baseSpacing,
280
+ auto: 'auto',
281
+ full: '100%'
282
+ };
283
+
284
+ const translate = {
285
+ ...baseSpacing,
286
+ ...negativeSpacing,
287
+ full: '100%'
288
+ };
289
+
290
+ const borderWidth = {
291
+ 0: '0px',
292
+ 1: getToken('border-width-100'),
293
+ 2: getToken('border-width-200'),
294
+ 4: getToken('border-width-400')
295
+ };
296
+
297
+ const radius = {
298
+ none: getToken('corner-radius-none'), // 0px
299
+ sm: pxToRem(getToken('corner-radius-small-default')), // 4px
300
+ default: pxToRem(getToken('corner-radius-medium-default')), // 8px
301
+ lg: pxToRem(getToken('corner-radius-large-default')), // 10px
302
+ xl: pxToRem(getToken('corner-radius-extra-large-default')), // 16px
303
+ full: '9999px',
304
+ pill: 'calc(self(height, self(minHeight, 9999px)) / 2)',
305
+ control: fontRelative(8), // automatic based on font size (e.g. t-shirt size logarithmic scale)
306
+ 'control-sm': fontRelative(4)
307
+ };
308
+
309
+ type GridTrack = 'none' | 'subgrid' | (string & {}) | readonly GridTrackSize[];
310
+ type GridTrackSize = 'auto' | 'min-content' | 'max-content' | `${number}fr` | `minmax(${string}, ${string})` | keyof typeof baseSpacing | (string & {});
311
+
312
+ let gridTrack = (value: GridTrack) => {
313
+ if (typeof value === 'string') {
314
+ return value;
315
+ }
316
+ return value.map(v => gridTrackSize(v)).join(' ');
317
+ };
318
+
319
+ let gridTrackSize = (value: GridTrackSize) => {
320
+ // @ts-ignore
321
+ return value in baseSpacing ? baseSpacing[value] : value;
322
+ };
323
+
324
+ const transitionProperty = {
325
+ default: 'color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, translate, scale, rotate, filter, backdrop-filter',
326
+ colors: 'color, background-color, border-color, text-decoration-color, fill, stroke',
327
+ opacity: 'opacity',
328
+ shadow: 'box-shadow',
329
+ transform: 'transform, translate, scale, rotate',
330
+ all: 'all',
331
+ none: 'none'
332
+ };
333
+
334
+ // TODO
335
+ const timingFunction = {
336
+ default: 'cubic-bezier(0.45, 0, 0.4, 1)',
337
+ linear: 'linear',
338
+ in: 'cubic-bezier(0.5, 0, 1, 1)',
339
+ out: 'cubic-bezier(0, 0, 0.40, 1)',
340
+ 'in-out': 'cubic-bezier(0.45, 0, 0.4, 1)'
341
+ };
342
+
343
+ // TODO: do these need tokens or are arbitrary values ok?
344
+ let durationProperty = createArbitraryProperty((value: number | string, property) => ({[property]: typeof value === 'number' ? value + 'ms' : value}));
345
+
346
+ // const colorWithAlpha = createColorProperty(color);
347
+
348
+ const fontWeightBase = {
349
+ light: '300',
350
+ // TODO: spectrum calls this "regular" but CSS calls it "normal". We also call other properties "default". What do we want to match?
351
+ normal: '400',
352
+ medium: '500',
353
+ bold: '700',
354
+ 'extra-bold': '800',
355
+ black: '900'
356
+ } as const;
357
+
358
+ const i18nFonts = {
359
+ ':lang(ar)': 'myriad-arabic, ui-sans-serif, system-ui, sans-serif',
360
+ ':lang(he)': 'myriad-hebrew, ui-sans-serif, system-ui, sans-serif',
361
+ ':lang(ja)': "adobe-clean-han-japanese, 'Hiragino Kaku Gothic ProN', 'ヒラギノ角ゴ ProN W3', Osaka, YuGothic, 'Yu Gothic', 'メイリオ', Meiryo, 'MS Pゴシック', 'MS PGothic', sans-serif",
362
+ ':lang(ko)': "adobe-clean-han-korean, source-han-korean, 'Malgun Gothic', 'Apple Gothic', sans-serif",
363
+ ':lang(zh)': "adobe-clean-han-traditional, source-han-traditional, 'MingLiu', 'Heiti TC Light', sans-serif",
364
+ // TODO: are these fallbacks supposed to be different than above?
365
+ ':lang(zh-hant)': "adobe-clean-han-traditional, source-han-traditional, 'MingLiu', 'Microsoft JhengHei UI', 'Microsoft JhengHei', 'Heiti TC Light', sans-serif",
366
+ ':lang(zh-Hans, zh-CN, zh-SG)': "adobe-clean-han-simplified-c, source-han-simplified-c, 'SimSun', 'Heiti SC Light', sans-serif"
367
+ } as const;
368
+
369
+ const fontSize = {
370
+ // The default font size scale is for use within UI components.
371
+ 'ui-xs': fontSizeToken('font-size-50'),
372
+ 'ui-sm': fontSizeToken('font-size-75'),
373
+ ui: fontSizeToken('font-size-100'),
374
+ 'ui-lg': fontSizeToken('font-size-200'),
375
+ 'ui-xl': fontSizeToken('font-size-300'),
376
+ 'ui-2xl': fontSizeToken('font-size-400'),
377
+ 'ui-3xl': fontSizeToken('font-size-500'),
378
+
379
+ control: {
380
+ default: fontSizeToken('font-size-100'),
381
+ size: {
382
+ XS: fontSizeToken('font-size-50'),
383
+ S: fontSizeToken('font-size-75'),
384
+ L: fontSizeToken('font-size-200'),
385
+ XL: fontSizeToken('font-size-300')
386
+ }
387
+ },
388
+
389
+ 'heading-2xs': fontSizeToken('heading-size-xxs'),
390
+ 'heading-xs': fontSizeToken('heading-size-xs'),
391
+ 'heading-sm': fontSizeToken('heading-size-s'),
392
+ heading: fontSizeToken('heading-size-m'),
393
+ 'heading-lg': fontSizeToken('heading-size-l'),
394
+ 'heading-xl': fontSizeToken('heading-size-xl'),
395
+ 'heading-2xl': fontSizeToken('heading-size-xxl'),
396
+ 'heading-3xl': fontSizeToken('heading-size-xxxl'),
397
+
398
+ 'title-xs': fontSizeToken('title-size-xs'),
399
+ 'title-sm': fontSizeToken('title-size-s'),
400
+ title: fontSizeToken('title-size-m'),
401
+ 'title-lg': fontSizeToken('title-size-l'),
402
+ 'title-xl': fontSizeToken('title-size-xl'),
403
+ 'title-2xl': fontSizeToken('title-size-xxl'),
404
+ 'title-3xl': fontSizeToken('title-size-xxxl'),
405
+
406
+ // Body is for large blocks of text, e.g. paragraphs, not in UI components.
407
+ 'body-2xs': fontSizeToken('font-size-50'), // TODO: seems like there is no token for this
408
+ 'body-xs': fontSizeToken('body-size-xs'),
409
+ 'body-sm': fontSizeToken('body-size-s'),
410
+ body: fontSizeToken('body-size-m'),
411
+ 'body-lg': fontSizeToken('body-size-l'),
412
+ 'body-xl': fontSizeToken('body-size-xl'),
413
+ 'body-2xl': fontSizeToken('body-size-xxl'),
414
+ 'body-3xl': fontSizeToken('body-size-xxxl'),
415
+
416
+ 'detail-sm': fontSizeToken('detail-size-s'),
417
+ detail: fontSizeToken('detail-size-m'),
418
+ 'detail-lg': fontSizeToken('detail-size-l'),
419
+ 'detail-xl': fontSizeToken('detail-size-xl'),
420
+
421
+ 'code-xs': fontSizeToken('code-size-xs'),
422
+ 'code-sm': fontSizeToken('code-size-s'),
423
+ code: fontSizeToken('code-size-m'),
424
+ 'code-lg': fontSizeToken('code-size-l'),
425
+ 'code-xl': fontSizeToken('code-size-xl')
426
+ } as const;
427
+
428
+ export const style = createTheme({
429
+ properties: {
430
+ // colors
431
+ color: createColorProperty({
432
+ ...color,
433
+ accent: {
434
+ default: colorToken('accent-content-color-default'),
435
+ isHovered: colorToken('accent-content-color-hover'),
436
+ isFocusVisible: colorToken('accent-content-color-key-focus'),
437
+ isPressed: colorToken('accent-content-color-down')
438
+ // isSelected: colorToken('accent-content-color-selected'), // same as pressed
439
+ },
440
+ neutral: {
441
+ default: colorToken('neutral-content-color-default'),
442
+ isHovered: colorToken('neutral-content-color-hover'),
443
+ isFocusVisible: colorToken('neutral-content-color-key-focus'),
444
+ isPressed: colorToken('neutral-content-color-down')
445
+ // isSelected: colorToken('neutral-subdued-content-color-selected'),
446
+ },
447
+ 'neutral-subdued': {
448
+ default: colorToken('neutral-subdued-content-color-default'),
449
+ isHovered: colorToken('neutral-subdued-content-color-hover'),
450
+ isFocusVisible: colorToken('neutral-subdued-content-color-key-focus'),
451
+ isPressed: colorToken('neutral-subdued-content-color-down')
452
+ // isSelected: colorToken('neutral-subdued-content-color-selected'),
453
+ },
454
+ negative: {
455
+ default: colorToken('negative-content-color-default'),
456
+ isHovered: colorToken('negative-content-color-hover'),
457
+ isFocusVisible: colorToken('negative-content-color-key-focus'),
458
+ isPressed: colorToken('negative-content-color-down')
459
+ },
460
+ disabled: {
461
+ default: colorToken('disabled-content-color')
462
+ // forcedColors: 'GrayText'
463
+ },
464
+ heading: colorToken('heading-color'),
465
+ title: colorToken('title-color'),
466
+ body: colorToken('body-color'),
467
+ detail: colorToken('detail-color'),
468
+ code: colorToken('code-color')
469
+ }),
470
+ backgroundColor: createColorProperty({
471
+ ...color,
472
+ accent: {
473
+ default: weirdColorToken('accent-background-color-default'),
474
+ isHovered: weirdColorToken('accent-background-color-hover'),
475
+ isFocusVisible: weirdColorToken('accent-background-color-key-focus'),
476
+ isPressed: weirdColorToken('accent-background-color-down')
477
+ },
478
+ neutral: {
479
+ default: colorToken('neutral-background-color-default'),
480
+ isHovered: colorToken('neutral-background-color-hover'),
481
+ isFocusVisible: colorToken('neutral-background-color-key-focus'),
482
+ isPressed: colorToken('neutral-background-color-down')
483
+ },
484
+ 'neutral-subdued': {
485
+ default: weirdColorToken('neutral-subdued-background-color-default'),
486
+ isHovered: weirdColorToken('neutral-subdued-background-color-hover'),
487
+ isFocusVisible: weirdColorToken('neutral-subdued-background-color-key-focus'),
488
+ isPressed: weirdColorToken('neutral-subdued-background-color-down')
489
+ },
490
+ 'neutral-subtle': colorToken('neutral-subtle-background-color-default'),
491
+ negative: {
492
+ default: weirdColorToken('negative-background-color-default'),
493
+ isHovered: weirdColorToken('negative-background-color-hover'),
494
+ isFocusVisible: weirdColorToken('negative-background-color-key-focus'),
495
+ isPressed: weirdColorToken('negative-background-color-down')
496
+ },
497
+ 'negative-subtle': colorToken('negative-subtle-background-color-default'),
498
+ informative: {
499
+ default: weirdColorToken('informative-background-color-default'),
500
+ isHovered: weirdColorToken('informative-background-color-hover'),
501
+ isFocusVisible: weirdColorToken('informative-background-color-key-focus'),
502
+ isPressed: weirdColorToken('informative-background-color-down')
503
+ },
504
+ 'informative-subtle': colorToken('informative-subtle-background-color-default'),
505
+ positive: {
506
+ default: weirdColorToken('positive-background-color-default'),
507
+ isHovered: weirdColorToken('positive-background-color-hover'),
508
+ isFocusVisible: weirdColorToken('positive-background-color-key-focus'),
509
+ isPressed: weirdColorToken('positive-background-color-down')
510
+ },
511
+ 'positive-subtle': colorToken('positive-subtle-background-color-default'),
512
+ notice: weirdColorToken('notice-background-color-default'),
513
+ 'notice-subtle': colorToken('notice-subtle-background-color-default'),
514
+ gray: weirdColorToken('gray-background-color-default'),
515
+ red: weirdColorToken('red-background-color-default'),
516
+ orange: weirdColorToken('orange-background-color-default'),
517
+ yellow: weirdColorToken('yellow-background-color-default'),
518
+ chartreuse: weirdColorToken('chartreuse-background-color-default'),
519
+ celery: weirdColorToken('celery-background-color-default'),
520
+ green: weirdColorToken('green-background-color-default'),
521
+ seafoam: weirdColorToken('seafoam-background-color-default'),
522
+ cyan: weirdColorToken('cyan-background-color-default'),
523
+ blue: weirdColorToken('blue-background-color-default'),
524
+ indigo: weirdColorToken('indigo-background-color-default'),
525
+ purple: weirdColorToken('purple-background-color-default'),
526
+ fuchsia: weirdColorToken('fuchsia-background-color-default'),
527
+ magenta: weirdColorToken('magenta-background-color-default'),
528
+ pink: weirdColorToken('pink-background-color-default'),
529
+ turquoise: weirdColorToken('turquoise-background-color-default'),
530
+ cinnamon: weirdColorToken('cinnamon-background-color-default'),
531
+ brown: weirdColorToken('brown-background-color-default'),
532
+ silver: weirdColorToken('silver-background-color-default'),
533
+ disabled: colorToken('disabled-background-color'),
534
+ base: colorToken('background-base-color'),
535
+ 'layer-1': colorToken('background-layer-1-color'),
536
+ 'layer-2': weirdColorToken('background-layer-2-color'),
537
+ pasteboard: weirdColorToken('background-pasteboard-color'),
538
+ elevated: weirdColorToken('background-elevated-color')
539
+ }),
540
+ borderColor: createColorProperty({
541
+ ...color,
542
+ negative: {
543
+ default: colorToken('negative-border-color-default'),
544
+ isHovered: colorToken('negative-border-color-hover'),
545
+ isFocusVisible: colorToken('negative-border-color-key-focus'),
546
+ isPressed: colorToken('negative-border-color-down')
547
+ },
548
+ disabled: colorToken('disabled-border-color')
549
+ // forcedColors: 'GrayText'
550
+
551
+ }),
552
+ outlineColor: createColorProperty({
553
+ ...color,
554
+ 'focus-ring': {
555
+ default: colorToken('focus-indicator-color'),
556
+ forcedColors: 'Highlight'
557
+ }
558
+ }),
559
+ // textDecorationColor: colorWithAlpha,
560
+ // accentColor: colorWithAlpha,
561
+ // caretColor: colorWithAlpha,
562
+ fill: createColorProperty({
563
+ none: 'none',
564
+ currentColor: 'currentColor',
565
+ accent: weirdColorToken('accent-visual-color'),
566
+ neutral: weirdColorToken('neutral-visual-color'),
567
+ negative: weirdColorToken('negative-visual-color'),
568
+ informative: weirdColorToken('informative-visual-color'),
569
+ positive: weirdColorToken('positive-visual-color'),
570
+ notice: weirdColorToken('notice-visual-color'),
571
+ gray: weirdColorToken('gray-visual-color'),
572
+ red: weirdColorToken('red-visual-color'),
573
+ orange: weirdColorToken('orange-visual-color'),
574
+ yellow: weirdColorToken('yellow-visual-color'),
575
+ chartreuse: weirdColorToken('chartreuse-visual-color'),
576
+ celery: weirdColorToken('celery-visual-color'),
577
+ green: weirdColorToken('green-visual-color'),
578
+ seafoam: weirdColorToken('seafoam-visual-color'),
579
+ cyan: weirdColorToken('cyan-visual-color'),
580
+ blue: weirdColorToken('blue-visual-color'),
581
+ indigo: weirdColorToken('indigo-visual-color'),
582
+ purple: weirdColorToken('purple-visual-color'),
583
+ fuchsia: weirdColorToken('fuchsia-visual-color'),
584
+ magenta: weirdColorToken('magenta-visual-color'),
585
+ pink: weirdColorToken('pink-visual-color'),
586
+ turquoise: weirdColorToken('turquoise-visual-color'),
587
+ cinnamon: weirdColorToken('cinnamon-visual-color'),
588
+ brown: weirdColorToken('brown-visual-color'),
589
+ silver: weirdColorToken('silver-visual-color'),
590
+ ...color
591
+ }),
592
+ stroke: createColorProperty({
593
+ none: 'none',
594
+ currentColor: 'currentColor',
595
+ ...color
596
+ }),
597
+
598
+ // dimensions
599
+ borderSpacing: baseSpacing, // TODO: separate x and y
600
+ flexBasis: {
601
+ auto: 'auto',
602
+ full: '100%',
603
+ ...baseSpacing
604
+ },
605
+ rowGap: spacing,
606
+ columnGap: spacing,
607
+ height,
608
+ width,
609
+ containIntrinsicWidth: width,
610
+ containIntrinsicHeight: height,
611
+ minHeight: height,
612
+ maxHeight: {
613
+ ...height,
614
+ none: 'none'
615
+ },
616
+ minWidth: width,
617
+ maxWidth: {
618
+ ...width,
619
+ none: 'none'
620
+ },
621
+ borderStartWidth: createRenamedProperty('borderInlineStartWidth', borderWidth),
622
+ borderEndWidth: createRenamedProperty('borderInlineEndWidth', borderWidth),
623
+ borderTopWidth: borderWidth,
624
+ borderBottomWidth: borderWidth,
625
+ borderStyle: ['solid', 'dashed', 'dotted', 'double', 'hidden', 'none'] as const,
626
+ strokeWidth: {
627
+ 0: '0',
628
+ 1: '1',
629
+ 2: '2'
630
+ },
631
+ marginStart: createRenamedProperty('marginInlineStart', margin),
632
+ marginEnd: createRenamedProperty('marginInlineEnd', margin),
633
+ marginTop: margin,
634
+ marginBottom: margin,
635
+ paddingStart: createRenamedProperty('paddingInlineStart', spacing),
636
+ paddingEnd: createRenamedProperty('paddingInlineEnd', spacing),
637
+ paddingTop: spacing,
638
+ paddingBottom: spacing,
639
+ scrollMarginStart: createRenamedProperty('scrollMarginInlineStart', baseSpacing),
640
+ scrollMarginEnd: createRenamedProperty('scrollMarginInlineEnd', baseSpacing),
641
+ scrollMarginTop: baseSpacing,
642
+ scrollMarginBottom: baseSpacing,
643
+ scrollPaddingStart: createRenamedProperty('scrollPaddingInlineStart', baseSpacing),
644
+ scrollPaddingEnd: createRenamedProperty('scrollPaddingInlineEnd', baseSpacing),
645
+ scrollPaddingTop: baseSpacing,
646
+ scrollPaddingBottom: baseSpacing,
647
+ textIndent: baseSpacing,
648
+ translateX: createMappedProperty(value => ({
649
+ '--translateX': value,
650
+ translate: 'var(--translateX, 0) var(--translateY, 0)'
651
+ }), translate),
652
+ translateY: createMappedProperty(value => ({
653
+ '--translateY': value,
654
+ translate: 'var(--translateX, 0) var(--translateY, 0)'
655
+ }), translate),
656
+ rotate: createArbitraryProperty((value: number | `${number}deg` | `${number}rad` | `${number}grad` | `${number}turn`, property) => ({[property]: typeof value === 'number' ? `${value}deg` : value})),
657
+ scale: createArbitraryProperty<number>(),
658
+ transform: createArbitraryProperty<string>(),
659
+ position: ['absolute', 'fixed', 'relative', 'sticky', 'static'] as const,
660
+ insetStart: createRenamedProperty('insetInlineStart', inset),
661
+ insetEnd: createRenamedProperty('insetInlineEnd', inset),
662
+ top: inset,
663
+ left: inset,
664
+ bottom: inset,
665
+ right: inset,
666
+ aspectRatio: {
667
+ auto: 'auto',
668
+ square: '1 / 1',
669
+ video: '16 / 9'
670
+ },
671
+
672
+ // text
673
+ fontFamily: {
674
+ sans: {
675
+ default: 'adobe-clean-variable, adobe-clean, ui-sans-serif, system-ui, sans-serif',
676
+ ...i18nFonts
677
+ },
678
+ serif: {
679
+ default: 'adobe-clean-serif, "Source Serif", Georgia, serif',
680
+ ...i18nFonts
681
+ },
682
+ code: 'source-code-pro, "Source Code Pro", Monaco, monospace'
683
+ },
684
+ fontSize,
685
+ fontWeight: createMappedProperty((value, property) => {
686
+ if (property === 'fontWeight') {
687
+ return {
688
+ // Set font-variation-settings in addition to font-weight to work around typekit issue.
689
+ fontVariationSettings: value === 'inherit' ? 'inherit' : `"wght" ${value}`,
690
+ fontWeight: value as any,
691
+ fontSynthesisWeight: 'none'
692
+ };
693
+ }
694
+
695
+ return {[property]: value};
696
+ }, {
697
+ ...fontWeightBase,
698
+ heading: {
699
+ default: fontWeightBase[getToken('heading-sans-serif-font-weight') as keyof typeof fontWeightBase],
700
+ ':lang(ja, ko, zh, zh-Hant, zh-Hans)': fontWeightBase[getToken('heading-cjk-font-weight') as keyof typeof fontWeightBase]
701
+ },
702
+ title: {
703
+ default: fontWeightBase[getToken('title-sans-serif-font-weight') as keyof typeof fontWeightBase],
704
+ ':lang(ja, ko, zh, zh-Hant, zh-Hans)': fontWeightBase[getToken('title-cjk-font-weight') as keyof typeof fontWeightBase]
705
+ },
706
+ detail: {
707
+ default: fontWeightBase[getToken('detail-sans-serif-font-weight') as keyof typeof fontWeightBase],
708
+ ':lang(ja, ko, zh, zh-Hant, zh-Hans)': fontWeightBase[getToken('detail-cjk-font-weight') as keyof typeof fontWeightBase]
709
+ }
710
+ }),
711
+ lineHeight: {
712
+ // See https://spectrum.corp.adobe.com/page/typography/#Line-height
713
+ ui: {
714
+ default: getToken('line-height-100'),
715
+ ':lang(ja, ko, zh, zh-Hant, zh-Hans)': getToken('line-height-200')
716
+ },
717
+ heading: {
718
+ default: getToken('heading-line-height'),
719
+ ':lang(ja, ko, zh, zh-Hant, zh-Hans)': getToken('heading-cjk-line-height')
720
+ },
721
+ title: {
722
+ default: getToken('title-line-height'),
723
+ ':lang(ja, ko, zh, zh-Hant, zh-Hans)': getToken('title-cjk-line-height')
724
+ },
725
+ body: {
726
+ default: getToken('body-line-height'),
727
+ ':lang(ja, ko, zh, zh-Hant, zh-Hans)': getToken('body-cjk-line-height')
728
+ },
729
+ detail: {
730
+ default: getToken('detail-line-height'),
731
+ ':lang(ja, ko, zh, zh-Hant, zh-Hans)': getToken('detail-cjk-line-height')
732
+ },
733
+ code: {
734
+ default: getToken('code-line-height'),
735
+ ':lang(ja, ko, zh, zh-Hant, zh-Hans)': getToken('code-cjk-line-height')
736
+ }
737
+ },
738
+ listStyleType: ['none', 'dist', 'decimal'] as const,
739
+ listStylePosition: ['inside', 'outside'] as const,
740
+ textTransform: ['uppercase', 'lowercase', 'capitalize', 'none'] as const,
741
+ textAlign: ['start', 'center', 'end', 'justify'] as const,
742
+ verticalAlign: ['baseline', 'top', 'middle', 'bottom', 'text-top', 'text-bottom', 'sub', 'super'] as const,
743
+ textDecoration: createMappedProperty((value) => ({
744
+ textDecoration: value === 'none' ? 'none' : `${value} ${getToken('text-underline-thickness')}`,
745
+ textUnderlineOffset: value === 'underline' ? getToken('text-underline-gap') : undefined
746
+ }), ['underline', 'overline', 'line-through', 'none'] as const),
747
+ textOverflow: ['ellipsis', 'clip'] as const,
748
+ lineClamp: createArbitraryProperty((value: number) => ({
749
+ overflow: 'hidden',
750
+ display: '-webkit-box',
751
+ '-webkit-box-orient': 'vertical',
752
+ '-webkit-line-clamp': value
753
+ })),
754
+ hyphens: ['none', 'manual', 'auto'] as const,
755
+ whiteSpace: ['normal', 'nowrap', 'pre', 'pre-line', 'pre-wrap', 'break-spaces'] as const,
756
+ textWrap: ['wrap', 'nowrap', 'balance', 'pretty'] as const,
757
+ wordBreak: ['normal', 'break-all', 'keep-all'] as const, // also overflowWrap??
758
+ boxDecorationBreak: ['slice', 'clone'] as const,
759
+
760
+ // effects
761
+ boxShadow: {
762
+ emphasized: `${getToken('drop-shadow-emphasized-default-x')} ${getToken('drop-shadow-emphasized-default-y')} ${getToken('drop-shadow-emphasized-default-blur')} ${colorToken('drop-shadow-emphasized-default-color')}`,
763
+ elevated: `${getToken('drop-shadow-elevated-x')} ${getToken('drop-shadow-elevated-y')} ${getToken('drop-shadow-elevated-blur')} ${colorToken('drop-shadow-elevated-color')}`,
764
+ dragged: `${getToken('drop-shadow-dragged-x')} ${getToken('drop-shadow-dragged-y')} ${getToken('drop-shadow-dragged-blur')} ${colorToken('drop-shadow-dragged-color')}`,
765
+ none: 'none'
766
+ },
767
+ filter: {
768
+ emphasized: `drop-shadow(${getToken('drop-shadow-emphasized-default-x')} ${getToken('drop-shadow-emphasized-default-y')} ${getToken('drop-shadow-emphasized-default-blur')} ${colorToken('drop-shadow-emphasized-default-color')})`,
769
+ elevated: `drop-shadow(${getToken('drop-shadow-elevated-x')} ${getToken('drop-shadow-elevated-y')} ${getToken('drop-shadow-elevated-blur')} ${colorToken('drop-shadow-elevated-color')})`,
770
+ dragged: `drop-shadow${getToken('drop-shadow-dragged-x')} ${getToken('drop-shadow-dragged-y')} ${getToken('drop-shadow-dragged-blur')} ${colorToken('drop-shadow-dragged-color')}`,
771
+ none: 'none'
772
+ },
773
+ borderTopStartRadius: createRenamedProperty('borderStartStartRadius', radius),
774
+ borderTopEndRadius: createRenamedProperty('borderStartEndRadius', radius),
775
+ borderBottomStartRadius: createRenamedProperty('borderEndStartRadius', radius),
776
+ borderBottomEndRadius: createRenamedProperty('borderEndEndRadius', radius),
777
+ forcedColorAdjust: ['auto', 'none'] as const,
778
+ colorScheme: ['light', 'dark', 'light dark'] as const,
779
+ backgroundImage: createArbitraryProperty<string>(),
780
+ // TODO: do we need separate x and y properties?
781
+ backgroundPosition: ['bottom', 'center', 'left', 'left bottom', 'left top', 'right', 'right bottom', 'right top', 'top'] as const,
782
+ backgroundSize: ['auto', 'cover', 'contain'] as const,
783
+ backgroundAttachment: ['fixed', 'local', 'scroll'] as const,
784
+ backgroundClip: ['border-box', 'padding-box', 'content-box', 'text'] as const,
785
+ backgroundRepeat: ['repeat', 'no-repeat', 'repeat-x', 'repeat-y', 'round', 'space'] as const,
786
+ backgroundOrigin: ['border-box', 'padding-box', 'content-box'] as const,
787
+ backgroundBlendMode: ['normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity'] as const,
788
+ mixBlendMode: ['normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity', 'plus-darker', 'plus-lighter'] as const,
789
+ opacity: createArbitraryProperty<number>(),
790
+
791
+ outlineStyle: ['none', 'solid', 'dashed', 'dotted', 'double', 'inset'] as const,
792
+ outlineOffset: createArbitraryProperty<number>((v, property) => ({[property]: `${v}px`})),
793
+ outlineWidth: borderWidth,
794
+
795
+ transition: createRenamedProperty('transitionProperty', transitionProperty),
796
+ transitionDelay: durationProperty,
797
+ transitionDuration: durationProperty,
798
+ transitionTimingFunction: timingFunction,
799
+ animation: createArbitraryProperty((value: string, property) => ({[property === 'animation' ? 'animationName' : property]: value})),
800
+ animationDuration: durationProperty,
801
+ animationDelay: durationProperty,
802
+ animationDirection: ['normal', 'reverse', 'alternate', 'alternate-reverse'] as const,
803
+ animationFillMode: ['none', 'forwards', 'backwards', 'both'] as const,
804
+ animationIterationCount: createArbitraryProperty<string>(),
805
+ animationTimingFunction: timingFunction,
806
+
807
+ // layout
808
+ display: ['block', 'inline-block', 'inline', 'flex', 'inline-flex', 'grid', 'inline-grid', 'contents', 'list-item', 'none'] as const, // tables?
809
+ alignContent: ['normal', 'center', 'start', 'end', 'space-between', 'space-around', 'space-evenly', 'baseline', 'stretch'] as const,
810
+ alignItems: ['start', 'end', 'center', 'baseline', 'stretch'] as const,
811
+ justifyContent: ['normal', 'start', 'end', 'center', 'space-between', 'space-around', 'space-evenly', 'stretch'] as const,
812
+ justifyItems: ['start', 'end', 'center', 'stretch'] as const,
813
+ alignSelf: ['auto', 'start', 'end', 'center', 'stretch', 'baseline'] as const,
814
+ justifySelf: ['auto', 'start', 'end', 'center', 'stretch'] as const,
815
+ flexDirection: ['row', 'column', 'row-reverse', 'column-reverse'] as const,
816
+ flexWrap: ['wrap', 'wrap-reverse', 'nowrap'] as const,
817
+ flexShrink: createArbitraryProperty<CSS.Property.FlexShrink>(),
818
+ flexGrow: createArbitraryProperty<CSS.Property.FlexGrow>(),
819
+ gridColumnStart: createArbitraryProperty<CSS.Property.GridColumnStart>(),
820
+ gridColumnEnd: createArbitraryProperty<CSS.Property.GridColumnEnd>(),
821
+ gridRowStart: createArbitraryProperty<CSS.Property.GridRowStart>(),
822
+ gridRowEnd: createArbitraryProperty<CSS.Property.GridRowEnd>(),
823
+ gridAutoFlow: ['row', 'column', 'dense', 'row dense', 'column dense'] as const,
824
+ gridAutoRows: createArbitraryProperty((value: GridTrackSize, property) => ({[property]: gridTrackSize(value)})),
825
+ gridAutoColumns: createArbitraryProperty((value: GridTrackSize, property) => ({[property]: gridTrackSize(value)})),
826
+ gridTemplateColumns: createArbitraryProperty((value: GridTrack, property) => ({[property]: gridTrack(value)})),
827
+ gridTemplateRows: createArbitraryProperty((value: GridTrack, property) => ({[property]: gridTrack(value)})),
828
+ gridTemplateAreas: createArbitraryProperty((value: readonly string[], property) => ({[property]: value.map(v => `"${v}"`).join('')})),
829
+ float: ['inline-start', 'inline-end', 'right', 'left', 'none'] as const,
830
+ clear: ['inline-start', 'inline-end', 'left', 'right', 'both', 'none'] as const,
831
+ contain: ['none', 'strict', 'content', 'size', 'inline-size', 'layout', 'style', 'paint'] as const,
832
+ boxSizing: ['border-box', 'content-box'] as const,
833
+ tableLayout: ['auto', 'fixed'] as const,
834
+ captionSide: ['top', 'bottom'] as const,
835
+ borderCollapse: ['collapse', 'separate'] as const,
836
+ columns: {
837
+ auto: 'auto',
838
+ 1: '1',
839
+ 2: '2',
840
+ 3: '3',
841
+ 4: '4',
842
+ 5: '5',
843
+ 6: '6',
844
+ 7: '7',
845
+ 8: '8',
846
+ 9: '9',
847
+ 10: '10',
848
+ 11: '11',
849
+ 12: '12',
850
+ // TODO: what should these sizes be?
851
+ '3xs': '16rem',
852
+ '2xs': '18rem',
853
+ xs: '20rem',
854
+ sm: '24rem',
855
+ md: '28rem',
856
+ lg: '32rem',
857
+ xl: '36rem',
858
+ '2xl': '42rem',
859
+ '3xl': '48rem',
860
+ '4xl': '56rem',
861
+ '5xl': '64rem',
862
+ '6xl': '72rem',
863
+ '7xl': '80rem'
864
+ },
865
+ breakBefore: ['auto', 'avoid', 'all', 'avoid-page', 'page', 'left', 'right', 'column'] as const,
866
+ breakInside: ['auto', 'avoid', 'avoid-page', 'avoid-column'] as const,
867
+ breakAfter: ['auto', 'avoid', 'all', 'avoid-page', 'page', 'left', 'right', 'column'] as const,
868
+ overflowX: ['auto', 'hidden', 'clip', 'visible', 'scroll'] as const,
869
+ overflowY: ['auto', 'hidden', 'clip', 'visible', 'scroll'] as const,
870
+ overscrollBehaviorX: ['auto', 'contain', 'none'] as const,
871
+ overscrollBehaviorY: ['auto', 'contain', 'none'] as const,
872
+ scrollBehavior: ['auto', 'smooth'] as const,
873
+ order: createArbitraryProperty<number>(),
874
+
875
+ pointerEvents: ['none', 'auto'] as const,
876
+ touchAction: ['auto', 'none', 'pan-x', 'pan-y', 'manipulation', 'pinch-zoom'] as const,
877
+ userSelect: ['none', 'text', 'all', 'auto'] as const,
878
+ visibility: ['visible', 'hidden', 'collapse'] as const,
879
+ isolation: ['isolate', 'auto'] as const,
880
+ transformOrigin: ['center', 'top', 'top right', 'right', 'bottom right', 'bottom', 'bottom left', 'left', 'top right'] as const,
881
+ cursor: ['auto', 'default', 'pointer', 'wait', 'text', 'move', 'help', 'not-allowed', 'none', 'context-menu', 'progress', 'cell', 'crosshair', 'vertical-text', 'alias', 'copy', 'no-drop', 'grab', 'grabbing', 'all-scroll', 'col-resize', 'row-resize', 'n-resize', 'e-resize', 's-resize', 'w-resize', 'ne-resize', 'nw-resize', 'se-resize', 'ew-resize', 'ns-resize', 'nesw-resize', 'nwse-resize', 'zoom-in', 'zoom-out'] as const,
882
+ resize: ['none', 'vertical', 'horizontal', 'both'] as const,
883
+ scrollSnapType: ['x', 'y', 'both', 'x mandatory', 'y mandatory', 'both mandatory'] as const,
884
+ scrollSnapAlign: ['start', 'end', 'center', 'none'] as const,
885
+ scrollSnapStop: ['normal', 'always'] as const,
886
+ appearance: ['none', 'auto'] as const,
887
+ objectFit: ['contain', 'cover', 'fill', 'none', 'scale-down'] as const,
888
+ objectPosition: ['bottom', 'center', 'left', 'left bottom', 'left top', 'right', 'right bottom', 'right top', 'top'] as const,
889
+ willChange: ['auto', 'scroll-position', 'contents', 'transform'] as const,
890
+ zIndex: createArbitraryProperty<number>(),
891
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
892
+ disableTapHighlight: createArbitraryProperty((_value: true) => ({
893
+ '-webkit-tap-highlight-color': 'rgba(0,0,0,0)'
894
+ }))
895
+ },
896
+ shorthands: {
897
+ padding: ['paddingTop', 'paddingBottom', 'paddingStart', 'paddingEnd'] as const,
898
+ paddingX: ['paddingStart', 'paddingEnd'] as const,
899
+ paddingY: ['paddingTop', 'paddingBottom'] as const,
900
+ margin: ['marginTop', 'marginBottom', 'marginStart', 'marginEnd'] as const,
901
+ marginX: ['marginStart', 'marginEnd'] as const,
902
+ marginY: ['marginTop', 'marginBottom'] as const,
903
+ scrollPadding: ['scrollPaddingTop', 'scrollPaddingBottom', 'scrollPaddingStart', 'scrollPaddingEnd'] as const,
904
+ scrollPaddingX: ['scrollPaddingStart', 'scrollPaddingEnd'] as const,
905
+ scrollPaddingY: ['scrollPaddingTop', 'scrollPaddingBottom'] as const,
906
+ scrollMargin: ['scrollMarginTop', 'scrollMarginBottom', 'scrollMarginStart', 'scrollMarginEnd'] as const,
907
+ scrollMarginX: ['scrollMarginStart', 'scrollMarginEnd'] as const,
908
+ scrollMarginY: ['scrollMarginTop', 'scrollMarginBottom'] as const,
909
+ borderWidth: ['borderTopWidth', 'borderBottomWidth', 'borderStartWidth', 'borderEndWidth'] as const,
910
+ borderXWidth: ['borderStartWidth', 'borderEndWidth'] as const,
911
+ borderYWidth: ['borderTopWidth', 'borderBottomWidth'] as const,
912
+ borderRadius: ['borderTopStartRadius', 'borderTopEndRadius', 'borderBottomStartRadius', 'borderBottomEndRadius'] as const,
913
+ borderTopRadius: ['borderTopStartRadius', 'borderTopEndRadius'] as const,
914
+ borderBottomRadius: ['borderBottomStartRadius', 'borderBottomEndRadius'] as const,
915
+ borderStartRadius: ['borderTopStartRadius', 'borderBottomStartRadius'] as const,
916
+ borderEndRadius: ['borderTopEndRadius', 'borderBottomEndRadius'] as const,
917
+ translate: ['translateX', 'translateY'] as const,
918
+ inset: ['top', 'bottom', 'insetStart', 'insetEnd'] as const,
919
+ insetX: ['insetStart', 'insetEnd'] as const,
920
+ insetY: ['top', 'bottom'] as const,
921
+ placeItems: ['alignItems', 'justifyItems'] as const,
922
+ placeContent: ['alignContent', 'justifyContent'] as const,
923
+ placeSelf: ['alignSelf', 'justifySelf'] as const,
924
+ gap: ['rowGap', 'columnGap'] as const,
925
+ size: ['width', 'height'] as const,
926
+ minSize: ['minWidth', 'minHeight'] as const,
927
+ maxSize: ['maxWidth', 'maxHeight'] as const,
928
+ overflow: ['overflowX', 'overflowY'] as const,
929
+ overscrollBehavior: ['overscrollBehaviorX', 'overscrollBehaviorY'] as const,
930
+ gridArea: ['gridColumnStart', 'gridColumnEnd', 'gridRowStart', 'gridRowEnd'] as const,
931
+ transition: (value: keyof typeof transitionProperty) => ({
932
+ transition: value,
933
+ transitionDuration: 150,
934
+ transitionTimingFunction: 'default'
935
+ }),
936
+ animation: (value: string) => ({
937
+ animation: value,
938
+ animationDuration: 150,
939
+ animationTimingFunction: 'default'
940
+ }),
941
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
942
+ truncate: (_value: true) => ({
943
+ overflowX: 'hidden',
944
+ overflowY: 'hidden',
945
+ textOverflow: 'ellipsis',
946
+ whiteSpace: 'nowrap'
947
+ }),
948
+ font: (value: keyof typeof fontSize) => {
949
+ let type = value.split('-')[0];
950
+ if (type === 'control') {
951
+ type = 'ui';
952
+ }
953
+ return {
954
+ fontFamily: type === 'code' ? 'code' : 'sans',
955
+ fontSize: value,
956
+ fontWeight: type === 'heading' || type === 'title' || type === 'detail' ? type : 'normal',
957
+ lineHeight: type,
958
+ color: type === 'ui' ? 'body' : type
959
+ };
960
+ }
961
+ },
962
+ conditions: {
963
+ forcedColors: '@media (forced-colors: active)',
964
+ // This detects touch primary devices as best as we can.
965
+ // Ideally we'd use (pointer: course) but browser/device support is inconsistent.
966
+ // Samsung Android devices claim to be mice at the hardware/OS level: (any-pointer: fine), (any-hover: hover), (hover: hover), and nothing for pointer.
967
+ // More details: https://www.ctrl.blog/entry/css-media-hover-samsung.html
968
+ // iPhone matches (any-hover: none), (hover: none), and nothing for any-pointer or pointer.
969
+ // If a trackpad or Apple Pencil is connected to iPad, it matches (any-pointer: fine), (any-hover: hover), (hover: none).
970
+ // Windows tablet matches the same as iPhone. No difference when a mouse is connected.
971
+ // Windows touch laptop matches same as macOS: (any-pointer: fine), (pointer: fine), (any-hover: hover), (hover: hover).
972
+ touch: '@media not ((hover: hover) and (pointer: fine))',
973
+ // TODO
974
+ sm: '@media (min-width: 640px)',
975
+ md: '@media (min-width: 768px)',
976
+ lg: '@media (min-width: 1024px)',
977
+ xl: '@media (min-width: 1280px)',
978
+ '2xl': '@media (min-width: 1536px)'
979
+ }
980
+ });