@panneau/ui 5.0.0-alpha.2 → 5.0.0-alpha.21

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 (398) hide show
  1. package/README.md +144 -15
  2. package/dist/alert/Alert.d.ts +2 -2
  3. package/dist/alert/Alert.js +108 -40
  4. package/dist/alert/Alert.js.map +1 -1
  5. package/dist/alert/tokens.d.ts +1 -1
  6. package/dist/alert/tokens.js.map +1 -1
  7. package/dist/badge/Badge.d.ts +1 -1
  8. package/dist/badge/Badge.js +34 -6
  9. package/dist/badge/Badge.js.map +1 -1
  10. package/dist/badge/tokens.d.ts +1 -1
  11. package/dist/badge/tokens.js.map +1 -1
  12. package/dist/button/Button.d.ts +20 -6
  13. package/dist/button/Button.d.ts.map +1 -1
  14. package/dist/button/Button.js +169 -22
  15. package/dist/button/Button.js.map +1 -1
  16. package/dist/button/LinkButton.d.ts +22 -0
  17. package/dist/button/LinkButton.d.ts.map +1 -0
  18. package/dist/button/LinkButton.js +113 -0
  19. package/dist/button/LinkButton.js.map +1 -0
  20. package/dist/button/tokens.d.ts +1 -1
  21. package/dist/button/tokens.js.map +1 -1
  22. package/dist/card/Card.js +76 -23
  23. package/dist/card/Card.js.map +1 -1
  24. package/dist/card/tokens.d.ts +1 -1
  25. package/dist/card/tokens.js.map +1 -1
  26. package/dist/checkbox/Checkbox.css +9 -9
  27. package/dist/checkbox/Checkbox.d.ts +1 -1
  28. package/dist/checkbox/Checkbox.js +87 -26
  29. package/dist/checkbox/Checkbox.js.map +1 -1
  30. package/dist/checkbox/Checkbox.module.js +3 -3
  31. package/dist/checkbox/Checkbox.module.js.map +1 -1
  32. package/dist/checkbox/ChoiceChrome.js +82 -21
  33. package/dist/checkbox/ChoiceChrome.js.map +1 -1
  34. package/dist/checkbox/tokens.d.ts +1 -1
  35. package/dist/checkbox/tokens.js.map +1 -1
  36. package/dist/combo-box/ComboBox.css +10 -0
  37. package/dist/combo-box/ComboBox.d.ts +7 -2
  38. package/dist/combo-box/ComboBox.d.ts.map +1 -1
  39. package/dist/combo-box/ComboBox.js +310 -78
  40. package/dist/combo-box/ComboBox.js.map +1 -1
  41. package/dist/combo-box/ComboBox.module.js +4 -2
  42. package/dist/combo-box/ComboBox.module.js.map +1 -1
  43. package/dist/command-palette/CommandPalette.css +299 -0
  44. package/dist/command-palette/CommandPalette.d.ts +37 -0
  45. package/dist/command-palette/CommandPalette.d.ts.map +1 -0
  46. package/dist/command-palette/CommandPalette.js +497 -0
  47. package/dist/command-palette/CommandPalette.js.map +1 -0
  48. package/dist/command-palette/CommandPalette.module.js +62 -0
  49. package/dist/command-palette/CommandPalette.module.js.map +1 -0
  50. package/dist/command-palette/match.d.ts +39 -0
  51. package/dist/command-palette/match.d.ts.map +1 -0
  52. package/dist/command-palette/match.js +44 -0
  53. package/dist/command-palette/match.js.map +1 -0
  54. package/dist/command-palette/tokens.d.ts +3 -0
  55. package/dist/command-palette/tokens.d.ts.map +1 -0
  56. package/dist/command-palette/tokens.js +23 -0
  57. package/dist/command-palette/tokens.js.map +1 -0
  58. package/dist/command-palette/useCommandShortcut.d.ts +12 -0
  59. package/dist/command-palette/useCommandShortcut.d.ts.map +1 -0
  60. package/dist/command-palette/useCommandShortcut.js +48 -0
  61. package/dist/command-palette/useCommandShortcut.js.map +1 -0
  62. package/dist/container/Container.js +48 -5
  63. package/dist/container/Container.js.map +1 -1
  64. package/dist/container/tokens.d.ts +1 -1
  65. package/dist/container/tokens.js.map +1 -1
  66. package/dist/date-picker/DatePicker.css +40 -0
  67. package/dist/date-picker/DatePicker.d.ts +3 -2
  68. package/dist/date-picker/DatePicker.d.ts.map +1 -1
  69. package/dist/date-picker/DatePicker.js +279 -72
  70. package/dist/date-picker/DatePicker.js.map +1 -1
  71. package/dist/date-picker/DatePicker.module.js +5 -1
  72. package/dist/date-picker/DatePicker.module.js.map +1 -1
  73. package/dist/date-picker/calendarTokens.d.ts +1 -1
  74. package/dist/date-picker/calendarTokens.js.map +1 -1
  75. package/dist/date-range-picker/DateRangePicker.css +37 -0
  76. package/dist/date-range-picker/DateRangePicker.d.ts +41 -0
  77. package/dist/date-range-picker/DateRangePicker.d.ts.map +1 -0
  78. package/dist/date-range-picker/DateRangePicker.js +438 -0
  79. package/dist/date-range-picker/DateRangePicker.js.map +1 -0
  80. package/dist/date-range-picker/DateRangePicker.module.js +20 -0
  81. package/dist/date-range-picker/DateRangePicker.module.js.map +1 -0
  82. package/dist/dialog/Dialog.css +41 -2
  83. package/dist/dialog/Dialog.d.ts +15 -3
  84. package/dist/dialog/Dialog.d.ts.map +1 -1
  85. package/dist/dialog/Dialog.js +161 -32
  86. package/dist/dialog/Dialog.js.map +1 -1
  87. package/dist/dialog/Dialog.module.js +10 -2
  88. package/dist/dialog/Dialog.module.js.map +1 -1
  89. package/dist/dialog/tokens.d.ts +1 -1
  90. package/dist/dialog/tokens.d.ts.map +1 -1
  91. package/dist/dialog/tokens.js +2 -0
  92. package/dist/dialog/tokens.js.map +1 -1
  93. package/dist/disclosure/Disclosure.js +132 -28
  94. package/dist/disclosure/Disclosure.js.map +1 -1
  95. package/dist/disclosure/tokens.d.ts +1 -1
  96. package/dist/disclosure/tokens.js.map +1 -1
  97. package/dist/divider/Divider.js +55 -11
  98. package/dist/divider/Divider.js.map +1 -1
  99. package/dist/divider/tokens.d.ts +1 -1
  100. package/dist/divider/tokens.js.map +1 -1
  101. package/dist/field/Field.css +26 -0
  102. package/dist/field/Field.module.js +6 -2
  103. package/dist/field/Field.module.js.map +1 -1
  104. package/dist/field/FieldParts.d.ts +1 -1
  105. package/dist/field/FieldParts.js +69 -15
  106. package/dist/field/FieldParts.js.map +1 -1
  107. package/dist/field/Fieldset.d.ts +6 -1
  108. package/dist/field/Fieldset.d.ts.map +1 -1
  109. package/dist/field/Fieldset.js +132 -33
  110. package/dist/field/Fieldset.js.map +1 -1
  111. package/dist/field/inputTokens.d.ts +1 -1
  112. package/dist/field/inputTokens.js.map +1 -1
  113. package/dist/field/tokens.d.ts +1 -1
  114. package/dist/field/tokens.js.map +1 -1
  115. package/dist/grid/Grid.d.ts +1 -1
  116. package/dist/grid/Grid.js +123 -14
  117. package/dist/grid/Grid.js.map +1 -1
  118. package/dist/grid/tokens.d.ts +1 -1
  119. package/dist/grid/tokens.js.map +1 -1
  120. package/dist/heading/Heading.js +41 -6
  121. package/dist/heading/Heading.js.map +1 -1
  122. package/dist/heading/tokens.d.ts +1 -1
  123. package/dist/heading/tokens.js.map +1 -1
  124. package/dist/icon/Icon.js +36 -11
  125. package/dist/icon/Icon.js.map +1 -1
  126. package/dist/icon/lucideIconLoader.d.ts +9 -0
  127. package/dist/icon/lucideIconLoader.d.ts.map +1 -0
  128. package/dist/icon/lucideIconLoader.js +22 -0
  129. package/dist/icon/lucideIconLoader.js.map +1 -0
  130. package/dist/icon/namedIcons.d.ts +16 -9
  131. package/dist/icon/namedIcons.d.ts.map +1 -1
  132. package/dist/icon/namedIcons.js +121 -46
  133. package/dist/icon/namedIcons.js.map +1 -1
  134. package/dist/icon-button/IconButton.d.ts +2 -2
  135. package/dist/icon-button/IconButton.js +70 -13
  136. package/dist/icon-button/IconButton.js.map +1 -1
  137. package/dist/index.d.ts +65 -52
  138. package/dist/index.d.ts.map +1 -1
  139. package/dist/index.js +19 -6
  140. package/dist/inline/Inline.d.ts +1 -1
  141. package/dist/inline/Inline.js +65 -7
  142. package/dist/inline/Inline.js.map +1 -1
  143. package/dist/inline/tokens.d.ts +1 -1
  144. package/dist/inline/tokens.js.map +1 -1
  145. package/dist/intl/usePanneauIntl.js.map +1 -1
  146. package/dist/layout/responsive.js.map +1 -1
  147. package/dist/line-chart/LineChart.css +84 -0
  148. package/dist/line-chart/LineChart.d.ts +26 -0
  149. package/dist/line-chart/LineChart.d.ts.map +1 -0
  150. package/dist/line-chart/LineChart.js +327 -0
  151. package/dist/line-chart/LineChart.js.map +1 -0
  152. package/dist/line-chart/LineChart.module.js +28 -0
  153. package/dist/line-chart/LineChart.module.js.map +1 -0
  154. package/dist/line-chart/tokens.d.ts +3 -0
  155. package/dist/line-chart/tokens.d.ts.map +1 -0
  156. package/dist/line-chart/tokens.js +19 -0
  157. package/dist/line-chart/tokens.js.map +1 -0
  158. package/dist/locales/index.js.map +1 -1
  159. package/dist/menu/Menu.css +84 -0
  160. package/dist/menu/Menu.d.ts +34 -7
  161. package/dist/menu/Menu.d.ts.map +1 -1
  162. package/dist/menu/Menu.js +243 -32
  163. package/dist/menu/Menu.js.map +1 -1
  164. package/dist/menu/Menu.module.js +22 -0
  165. package/dist/menu/Menu.module.js.map +1 -0
  166. package/dist/menu/tokens.d.ts +3 -0
  167. package/dist/menu/tokens.d.ts.map +1 -0
  168. package/dist/menu/tokens.js +31 -0
  169. package/dist/menu/tokens.js.map +1 -0
  170. package/dist/named-icons/index.d.ts +2 -0
  171. package/dist/named-icons/index.d.ts.map +1 -0
  172. package/dist/named-icons/index.js +1 -0
  173. package/dist/node_modules/@internationalized/date/dist/private/CalendarDate.js +136 -0
  174. package/dist/node_modules/@internationalized/date/dist/private/CalendarDate.js.map +1 -0
  175. package/dist/node_modules/@internationalized/date/dist/private/calendars/GregorianCalendar.js +117 -0
  176. package/dist/node_modules/@internationalized/date/dist/private/calendars/GregorianCalendar.js.map +1 -0
  177. package/dist/node_modules/@internationalized/date/dist/private/conversion.js +116 -0
  178. package/dist/node_modules/@internationalized/date/dist/private/conversion.js.map +1 -0
  179. package/dist/node_modules/@internationalized/date/dist/private/manipulation.js +206 -0
  180. package/dist/node_modules/@internationalized/date/dist/private/manipulation.js.map +1 -0
  181. package/dist/node_modules/@internationalized/date/dist/private/queries.js +26 -0
  182. package/dist/node_modules/@internationalized/date/dist/private/queries.js.map +1 -0
  183. package/dist/node_modules/@internationalized/date/dist/private/string.js +19 -0
  184. package/dist/node_modules/@internationalized/date/dist/private/string.js.map +1 -0
  185. package/dist/node_modules/@internationalized/date/dist/private/utils.js +8 -0
  186. package/dist/node_modules/@internationalized/date/dist/private/utils.js.map +1 -0
  187. package/dist/number-input/NumberInput.css +18 -0
  188. package/dist/number-input/NumberInput.d.ts +1 -1
  189. package/dist/number-input/NumberInput.js +232 -60
  190. package/dist/number-input/NumberInput.js.map +1 -1
  191. package/dist/number-input/NumberInput.module.js +3 -1
  192. package/dist/number-input/NumberInput.module.js.map +1 -1
  193. package/dist/number-input/tokens.d.ts +1 -1
  194. package/dist/number-input/tokens.js.map +1 -1
  195. package/dist/pill-trigger/PillTrigger.css +104 -0
  196. package/dist/pill-trigger/PillTrigger.d.ts +20 -0
  197. package/dist/pill-trigger/PillTrigger.d.ts.map +1 -0
  198. package/dist/pill-trigger/PillTrigger.js +94 -0
  199. package/dist/pill-trigger/PillTrigger.js.map +1 -0
  200. package/dist/pill-trigger/PillTrigger.module.js +18 -0
  201. package/dist/pill-trigger/PillTrigger.module.js.map +1 -0
  202. package/dist/pill-trigger/tokens.d.ts +3 -0
  203. package/dist/pill-trigger/tokens.d.ts.map +1 -0
  204. package/dist/pill-trigger/tokens.js +37 -0
  205. package/dist/pill-trigger/tokens.js.map +1 -0
  206. package/dist/popover/Popover.css +5 -0
  207. package/dist/popover/Popover.d.ts.map +1 -1
  208. package/dist/popover/Popover.js +116 -20
  209. package/dist/popover/Popover.js.map +1 -1
  210. package/dist/popover/Popover.module.js +4 -2
  211. package/dist/popover/Popover.module.js.map +1 -1
  212. package/dist/popover/tokens.d.ts +1 -1
  213. package/dist/popover/tokens.js.map +1 -1
  214. package/dist/prose/Prose.js +36 -5
  215. package/dist/prose/Prose.js.map +1 -1
  216. package/dist/prose/tokens.d.ts +1 -1
  217. package/dist/prose/tokens.js.map +1 -1
  218. package/dist/radio-group/RadioGroup.css +90 -0
  219. package/dist/radio-group/RadioGroup.d.ts +24 -5
  220. package/dist/radio-group/RadioGroup.d.ts.map +1 -1
  221. package/dist/radio-group/RadioGroup.js +214 -43
  222. package/dist/radio-group/RadioGroup.js.map +1 -1
  223. package/dist/radio-group/RadioGroup.module.js +12 -2
  224. package/dist/radio-group/RadioGroup.module.js.map +1 -1
  225. package/dist/radio-group/tokens.d.ts +2 -2
  226. package/dist/radio-group/tokens.d.ts.map +1 -1
  227. package/dist/radio-group/tokens.js +22 -2
  228. package/dist/radio-group/tokens.js.map +1 -1
  229. package/dist/root/PanneauRoot.css +24 -0
  230. package/dist/root/PanneauRoot.d.ts +40 -4
  231. package/dist/root/PanneauRoot.d.ts.map +1 -1
  232. package/dist/root/PanneauRoot.js +284 -82
  233. package/dist/root/PanneauRoot.js.map +1 -1
  234. package/dist/root/PanneauRoot.module.js.map +1 -1
  235. package/dist/root/ThemeScope.d.ts +1 -1
  236. package/dist/root/ThemeScope.d.ts.map +1 -1
  237. package/dist/root/ThemeScope.js +110 -27
  238. package/dist/root/ThemeScope.js.map +1 -1
  239. package/dist/segmented-control/SegmentedControl.css +83 -0
  240. package/dist/segmented-control/SegmentedControl.d.ts +35 -0
  241. package/dist/segmented-control/SegmentedControl.d.ts.map +1 -0
  242. package/dist/segmented-control/SegmentedControl.js +142 -0
  243. package/dist/segmented-control/SegmentedControl.js.map +1 -0
  244. package/dist/segmented-control/SegmentedControl.module.js +16 -0
  245. package/dist/segmented-control/SegmentedControl.module.js.map +1 -0
  246. package/dist/segmented-control/tokens.d.ts +3 -0
  247. package/dist/segmented-control/tokens.d.ts.map +1 -0
  248. package/dist/segmented-control/tokens.js +29 -0
  249. package/dist/segmented-control/tokens.js.map +1 -0
  250. package/dist/select/ListBox.css +75 -1
  251. package/dist/select/ListBox.module.js +9 -3
  252. package/dist/select/ListBox.module.js.map +1 -1
  253. package/dist/select/Select.d.ts +14 -1
  254. package/dist/select/Select.d.ts.map +1 -1
  255. package/dist/select/Select.js +335 -92
  256. package/dist/select/Select.js.map +1 -1
  257. package/dist/select/listBoxTokens.d.ts +1 -1
  258. package/dist/select/listBoxTokens.d.ts.map +1 -1
  259. package/dist/select/listBoxTokens.js +2 -0
  260. package/dist/select/listBoxTokens.js.map +1 -1
  261. package/dist/skeleton/LoadingRegion.d.ts +16 -0
  262. package/dist/skeleton/LoadingRegion.d.ts.map +1 -0
  263. package/dist/skeleton/LoadingRegion.js +65 -0
  264. package/dist/skeleton/LoadingRegion.js.map +1 -0
  265. package/dist/skeleton/Skeleton.css +62 -0
  266. package/dist/skeleton/Skeleton.d.ts +25 -0
  267. package/dist/skeleton/Skeleton.d.ts.map +1 -0
  268. package/dist/skeleton/Skeleton.js +106 -0
  269. package/dist/skeleton/Skeleton.js.map +1 -0
  270. package/dist/skeleton/Skeleton.module.js +22 -0
  271. package/dist/skeleton/Skeleton.module.js.map +1 -0
  272. package/dist/skeleton/tokens.d.ts +3 -0
  273. package/dist/skeleton/tokens.d.ts.map +1 -0
  274. package/dist/skeleton/tokens.js +15 -0
  275. package/dist/skeleton/tokens.js.map +1 -0
  276. package/dist/slider/Slider.css +84 -0
  277. package/dist/slider/Slider.d.ts +20 -0
  278. package/dist/slider/Slider.d.ts.map +1 -0
  279. package/dist/slider/Slider.js +248 -0
  280. package/dist/slider/Slider.js.map +1 -0
  281. package/dist/slider/Slider.module.js +20 -0
  282. package/dist/slider/Slider.module.js.map +1 -0
  283. package/dist/spinner/Spinner.js +49 -9
  284. package/dist/spinner/Spinner.js.map +1 -1
  285. package/dist/spinner/tokens.d.ts +1 -1
  286. package/dist/spinner/tokens.js.map +1 -1
  287. package/dist/stack/Stack.d.ts +1 -1
  288. package/dist/stack/Stack.js +60 -7
  289. package/dist/stack/Stack.js.map +1 -1
  290. package/dist/stack/tokens.d.ts +1 -1
  291. package/dist/stack/tokens.js.map +1 -1
  292. package/dist/stat/Stat.css +45 -0
  293. package/dist/stat/Stat.d.ts +27 -0
  294. package/dist/stat/Stat.d.ts.map +1 -0
  295. package/dist/stat/Stat.js +87 -0
  296. package/dist/stat/Stat.js.map +1 -0
  297. package/dist/stat/Stat.module.js +18 -0
  298. package/dist/stat/Stat.module.js.map +1 -0
  299. package/dist/stat/tokens.d.ts +3 -0
  300. package/dist/stat/tokens.d.ts.map +1 -0
  301. package/dist/stat/tokens.js +21 -0
  302. package/dist/stat/tokens.js.map +1 -0
  303. package/dist/switch/Switch.css +8 -8
  304. package/dist/switch/Switch.d.ts +1 -1
  305. package/dist/switch/Switch.js +69 -12
  306. package/dist/switch/Switch.js.map +1 -1
  307. package/dist/switch/Switch.module.js +3 -2
  308. package/dist/switch/Switch.module.js.map +1 -1
  309. package/dist/switch/tokens.d.ts +1 -1
  310. package/dist/switch/tokens.js.map +1 -1
  311. package/dist/tabs/Tabs.js +1 -1
  312. package/dist/tabs/Tabs.js.map +1 -1
  313. package/dist/tabs/tokens.d.ts +1 -1
  314. package/dist/tabs/tokens.js.map +1 -1
  315. package/dist/tags-input/TagsInput.css +60 -0
  316. package/dist/tags-input/TagsInput.d.ts +32 -0
  317. package/dist/tags-input/TagsInput.d.ts.map +1 -0
  318. package/dist/tags-input/TagsInput.js +316 -0
  319. package/dist/tags-input/TagsInput.js.map +1 -0
  320. package/dist/tags-input/TagsInput.module.js +20 -0
  321. package/dist/tags-input/TagsInput.module.js.map +1 -0
  322. package/dist/text/Text.d.ts +1 -1
  323. package/dist/text/Text.js +70 -5
  324. package/dist/text/Text.js.map +1 -1
  325. package/dist/text/tokens.d.ts +1 -1
  326. package/dist/text/tokens.js.map +1 -1
  327. package/dist/text-area/TextArea.css +1 -1
  328. package/dist/text-area/TextArea.d.ts +1 -1
  329. package/dist/text-area/TextArea.js +135 -28
  330. package/dist/text-area/TextArea.js.map +1 -1
  331. package/dist/text-area/TextArea.module.js +3 -3
  332. package/dist/text-area/TextArea.module.js.map +1 -1
  333. package/dist/text-input/TextInput.d.ts +7 -3
  334. package/dist/text-input/TextInput.d.ts.map +1 -1
  335. package/dist/text-input/TextInput.js +164 -47
  336. package/dist/text-input/TextInput.js.map +1 -1
  337. package/dist/theme/Tone.css +14 -0
  338. package/dist/theme/Tone.module.js +4 -2
  339. package/dist/theme/Tone.module.js.map +1 -1
  340. package/dist/theme/bootstrap.d.ts +2 -2
  341. package/dist/theme/bootstrap.d.ts.map +1 -1
  342. package/dist/theme/bootstrap.js +6 -0
  343. package/dist/theme/bootstrap.js.map +1 -1
  344. package/dist/theme/chartColors.js.map +1 -1
  345. package/dist/theme/checkTheme.d.ts +2 -2
  346. package/dist/theme/checkTheme.d.ts.map +1 -1
  347. package/dist/theme/checkTheme.js +24 -0
  348. package/dist/theme/checkTheme.js.map +1 -1
  349. package/dist/theme/cli.d.ts +2 -2
  350. package/dist/theme/cli.js.map +1 -1
  351. package/dist/theme/color.js.map +1 -1
  352. package/dist/theme/colorVision.d.ts +1 -1
  353. package/dist/theme/colorVision.js.map +1 -1
  354. package/dist/theme/componentTokens.js.map +1 -1
  355. package/dist/theme/components.d.ts +10 -3
  356. package/dist/theme/components.d.ts.map +1 -1
  357. package/dist/theme/components.js +14 -0
  358. package/dist/theme/components.js.map +1 -1
  359. package/dist/theme/defineTheme.d.ts +5 -5
  360. package/dist/theme/defineTheme.js.map +1 -1
  361. package/dist/theme/fonts.js.map +1 -1
  362. package/dist/theme/index.d.ts +12 -12
  363. package/dist/theme/index.js +1 -1
  364. package/dist/theme/semanticTokens.d.ts +1 -1
  365. package/dist/theme/semanticTokens.d.ts.map +1 -1
  366. package/dist/theme/semanticTokens.js +6 -0
  367. package/dist/theme/semanticTokens.js.map +1 -1
  368. package/dist/theme/theme.d.ts +2 -2
  369. package/dist/theme/theme.js.map +1 -1
  370. package/dist/theme/toneClass.d.ts +1 -1
  371. package/dist/theme/toneClass.js.map +1 -1
  372. package/dist/theme/tones.d.ts +15 -3
  373. package/dist/theme/tones.d.ts.map +1 -1
  374. package/dist/theme/tones.js +14 -2
  375. package/dist/theme/tones.js.map +1 -1
  376. package/dist/time-input/TimeInput.d.ts +1 -1
  377. package/dist/time-input/TimeInput.js +138 -31
  378. package/dist/time-input/TimeInput.js.map +1 -1
  379. package/dist/toast/Toast.css +131 -15
  380. package/dist/toast/Toast.d.ts +47 -10
  381. package/dist/toast/Toast.d.ts.map +1 -1
  382. package/dist/toast/Toast.js +191 -66
  383. package/dist/toast/Toast.js.map +1 -1
  384. package/dist/toast/Toast.module.js +5 -3
  385. package/dist/toast/Toast.module.js.map +1 -1
  386. package/dist/toast/tokens.d.ts +1 -1
  387. package/dist/toast/tokens.js +1 -1
  388. package/dist/toast/tokens.js.map +1 -1
  389. package/dist/tooltip/Tooltip.js +38 -8
  390. package/dist/tooltip/Tooltip.js.map +1 -1
  391. package/dist/tooltip/tokens.d.ts +1 -1
  392. package/dist/tooltip/tokens.js.map +1 -1
  393. package/dist/utils/cx.js.map +1 -1
  394. package/dist/utils/events.d.ts +4 -0
  395. package/dist/utils/events.d.ts.map +1 -0
  396. package/dist/utils/events.js +9 -0
  397. package/dist/utils/events.js.map +1 -0
  398. package/package.json +10 -5
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.js","names":[],"sources":["../../src/theme/bootstrap.ts"],"sourcesContent":["import type { ThemeDefinition } from './defineTheme';\nimport type { Theme } from './theme';\nimport type { ToneValues } from './tones';\n\n/**\n * A tone from one of Bootstrap's theme colors, read from its CSS variables (`--bs-<color>`,\n * `-text-emphasis`, `-bg-subtle`, `-border-subtle`), so that a site's custom colors carry over:\n * `tones: { brand: bootstrapTone('brand') }`. Text on the subtle background uses the emphasis\n * color, as Bootstrap's alerts do. Light colors need dark solid text: `{ solidText: 'var(--bs-dark)' }`.\n */\nexport function bootstrapTone(\n color: string,\n { solidText = 'var(--bs-white)' }: { solidText?: string } = {},\n): ToneValues {\n return {\n text: `var(--bs-${color}-text-emphasis)`,\n subtle: `var(--bs-${color}-bg-subtle)`,\n border: `var(--bs-${color}-border-subtle)`,\n outline: `var(--bs-${color})`,\n solid: `var(--bs-${color})`,\n solidHover: `color-mix(in srgb, var(--bs-${color}), #000 15%)`,\n solidText,\n };\n}\n\n/**\n * Maps Panneau's tokens to the CSS variables of Bootstrap 5.3, for sites that use Bootstrap: Panneau\n * then follows the site's colors, fonts and radii, and its color mode (`data-bs-theme`), without\n * using any Bootstrap class. Bootstrap's CSS must be loaded by the site.\n */\nexport const bootstrapTheme: Theme = {\n label: 'Bootstrap',\n tokens: {\n 'panneau-color-bg': 'var(--bs-body-bg)',\n 'panneau-color-surface': 'var(--bs-body-bg)',\n 'panneau-color-surface-sunken': 'var(--bs-tertiary-bg)',\n 'panneau-color-surface-raised': 'var(--bs-body-bg)',\n 'panneau-color-hover': 'rgba(var(--bs-emphasis-color-rgb), 0.06)',\n 'panneau-color-pressed': 'rgba(var(--bs-emphasis-color-rgb), 0.1)',\n 'panneau-color-text': 'var(--bs-body-color)',\n 'panneau-color-text-muted': 'var(--bs-secondary-color)',\n 'panneau-color-link': 'var(--bs-link-color)',\n 'panneau-color-border': 'var(--bs-border-color)',\n 'panneau-color-border-control': 'var(--bs-border-color)',\n 'panneau-color-accent': 'var(--bs-primary)',\n 'panneau-color-accent-hover': 'color-mix(in srgb, var(--bs-primary), #000 15%)',\n 'panneau-color-accent-text': 'var(--bs-white)',\n 'panneau-color-accent-subtle': 'var(--bs-primary-bg-subtle)',\n 'panneau-color-focus': 'rgba(var(--bs-primary-rgb), 0.5)',\n 'panneau-color-danger': 'var(--bs-danger-text-emphasis)',\n 'panneau-color-danger-subtle': 'var(--bs-danger-bg-subtle)',\n 'panneau-color-danger-border': 'var(--bs-danger-border-subtle)',\n 'panneau-color-danger-solid': 'var(--bs-danger)',\n 'panneau-color-danger-solid-hover': 'color-mix(in srgb, var(--bs-danger), #000 15%)',\n 'panneau-color-danger-solid-text': 'var(--bs-white)',\n 'panneau-color-success': 'var(--bs-success-text-emphasis)',\n 'panneau-color-success-subtle': 'var(--bs-success-bg-subtle)',\n 'panneau-color-success-border': 'var(--bs-success-border-subtle)',\n 'panneau-color-success-solid': 'var(--bs-success)',\n 'panneau-color-success-solid-hover': 'color-mix(in srgb, var(--bs-success), #000 15%)',\n 'panneau-color-success-solid-text': 'var(--bs-white)',\n 'panneau-color-warning': 'var(--bs-warning-text-emphasis)',\n 'panneau-color-warning-subtle': 'var(--bs-warning-bg-subtle)',\n 'panneau-color-warning-border': 'var(--bs-warning-border-subtle)',\n 'panneau-color-warning-solid': 'var(--bs-warning)',\n 'panneau-color-warning-solid-hover': 'color-mix(in srgb, var(--bs-warning), #000 10%)',\n // Like Bootstrap's .btn-warning and .text-bg-warning: dark text on yellow.\n 'panneau-color-warning-solid-text': 'var(--bs-dark)',\n 'panneau-color-info': 'var(--bs-info-text-emphasis)',\n 'panneau-color-info-subtle': 'var(--bs-info-bg-subtle)',\n 'panneau-color-info-border': 'var(--bs-info-border-subtle)',\n 'panneau-color-info-solid': 'var(--bs-info)',\n 'panneau-color-info-solid-hover': 'color-mix(in srgb, var(--bs-info), #000 10%)',\n 'panneau-color-info-solid-text': 'var(--bs-dark)',\n 'panneau-font-family-body': 'var(--bs-body-font-family)',\n 'panneau-font-family-mono': 'var(--bs-font-monospace)',\n 'panneau-font-size-md': 'var(--bs-body-font-size)',\n 'panneau-line-height': 'var(--bs-body-line-height)',\n 'panneau-radius-sm': 'var(--bs-border-radius-sm)',\n 'panneau-radius-md': 'var(--bs-border-radius)',\n 'panneau-radius-lg': 'var(--bs-border-radius-lg)',\n 'panneau-radius-full': 'var(--bs-border-radius-pill)',\n 'panneau-border-width': 'var(--bs-border-width)',\n 'panneau-shadow-sm': 'var(--bs-box-shadow-sm)',\n 'panneau-shadow-md': 'var(--bs-box-shadow)',\n 'panneau-shadow-lg': 'var(--bs-box-shadow-lg)',\n // Bootstrap 5.3 declares its component variables (--bs-btn-*, --bs-card-*) on the classes\n // of its components, out of reach: components map to the root variables those default to.\n 'panneau-heading-color': 'var(--bs-heading-color)',\n 'panneau-badge-radius': 'var(--bs-border-radius)',\n 'panneau-card-radius': 'var(--bs-border-radius)',\n 'panneau-card-border-color': 'var(--bs-border-color-translucent)',\n 'panneau-popover-radius': 'var(--bs-border-radius)',\n 'panneau-popover-border-color': 'var(--bs-border-color-translucent)',\n 'panneau-tooltip-bg': 'var(--bs-emphasis-color)',\n 'panneau-tooltip-color': 'var(--bs-body-bg)',\n 'panneau-tooltip-radius': 'var(--bs-border-radius)',\n },\n // Bootstrap's theme colors as tones: accent is primary, and primary and secondary are there by\n // their Bootstrap names (declare them in PanneauTones to use them).\n tones: {\n accent: bootstrapTone('primary'),\n primary: bootstrapTone('primary'),\n secondary: bootstrapTone('secondary'),\n },\n // Bootstrap's sizes of controls are those of the comfortable density: the others keep Panneau's.\n densities: {\n comfortable: {\n 'panneau-font-size-control': 'var(--bs-body-font-size)',\n 'panneau-control-height': 'calc(1.5em + 0.75rem + 2 * var(--bs-border-width))',\n 'panneau-control-height-sm': 'calc(1.5em + 0.5rem + 2 * var(--bs-border-width))',\n 'panneau-control-padding-x': '0.75rem',\n },\n },\n} satisfies ThemeDefinition;\n"],"mappings":";;;;;;;AAUA,SAAgB,cACZ,OACA,EAAE,YAAY,sBAA8C,CAAC,GACnD;CACV,OAAO;EACH,MAAM,YAAY,MAAK;EACvB,QAAQ,YAAY,MAAK;EACzB,QAAQ,YAAY,MAAK;EACzB,SAAS,YAAY,MAAK;EAC1B,OAAO,YAAY,MAAK;EACxB,YAAY,+BAA+B,MAAK;EAChD;CACJ;AACJ;;;;;;AAOA,IAAa,iBAAwB;CACjC,OAAO;CACP,QAAQ;EACJ,oBAAoB;EACpB,yBAAyB;EACzB,gCAAgC;EAChC,gCAAgC;EAChC,uBAAuB;EACvB,yBAAyB;EACzB,sBAAsB;EACtB,4BAA4B;EAC5B,sBAAsB;EACtB,wBAAwB;EACxB,gCAAgC;EAChC,wBAAwB;EACxB,8BAA8B;EAC9B,6BAA6B;EAC7B,+BAA+B;EAC/B,uBAAuB;EACvB,wBAAwB;EACxB,+BAA+B;EAC/B,+BAA+B;EAC/B,8BAA8B;EAC9B,oCAAoC;EACpC,mCAAmC;EACnC,yBAAyB;EACzB,gCAAgC;EAChC,gCAAgC;EAChC,+BAA+B;EAC/B,qCAAqC;EACrC,oCAAoC;EACpC,yBAAyB;EACzB,gCAAgC;EAChC,gCAAgC;EAChC,+BAA+B;EAC/B,qCAAqC;EAErC,oCAAoC;EACpC,sBAAsB;EACtB,6BAA6B;EAC7B,6BAA6B;EAC7B,4BAA4B;EAC5B,kCAAkC;EAClC,iCAAiC;EACjC,4BAA4B;EAC5B,4BAA4B;EAC5B,wBAAwB;EACxB,uBAAuB;EACvB,qBAAqB;EACrB,qBAAqB;EACrB,qBAAqB;EACrB,uBAAuB;EACvB,wBAAwB;EACxB,qBAAqB;EACrB,qBAAqB;EACrB,qBAAqB;EAGrB,yBAAyB;EACzB,wBAAwB;EACxB,uBAAuB;EACvB,6BAA6B;EAC7B,0BAA0B;EAC1B,gCAAgC;EAChC,sBAAsB;EACtB,yBAAyB;EACzB,0BAA0B;CAC9B;CAGA,OAAO;EACH,QAAQ,cAAc,SAAS;EAC/B,SAAS,cAAc,SAAS;EAChC,WAAW,cAAc,WAAW;CACxC;CAEA,WAAW,EACP,aAAa;EACT,6BAA6B;EAC7B,0BAA0B;EAC1B,6BAA6B;EAC7B,6BAA6B;CACjC,EACJ;AACJ"}
1
+ {"version":3,"file":"bootstrap.js","names":["ThemeDefinition","Theme","ToneValues","bootstrapTone","color","solidText","text","subtle","border","outline","solid","solidHover","bootstrapTheme","label","tokens","tones","accent","primary","secondary","densities","comfortable"],"sources":["../../src/theme/bootstrap.ts"],"sourcesContent":["import type { ThemeDefinition } from './defineTheme';\nimport type { Theme } from './theme';\nimport type { ToneValues } from './tones';\n\n/**\n * A tone from one of Bootstrap's theme colors, read from its CSS variables (`--bs-<color>`,\n * `-text-emphasis`, `-bg-subtle`, `-border-subtle`), so that a site's custom colors carry over:\n * `tones: { brand: bootstrapTone('brand') }`. Text on the subtle background uses the emphasis\n * color, as Bootstrap's alerts do. Light colors need dark solid text: `{ solidText: 'var(--bs-dark)' }`.\n */\nexport function bootstrapTone(\n color: string,\n { solidText = 'var(--bs-white)' }: { solidText?: string } = {},\n): ToneValues {\n return {\n text: `var(--bs-${color}-text-emphasis)`,\n subtle: `var(--bs-${color}-bg-subtle)`,\n border: `var(--bs-${color}-border-subtle)`,\n outline: `var(--bs-${color})`,\n solid: `var(--bs-${color})`,\n solidHover: `color-mix(in srgb, var(--bs-${color}), #000 15%)`,\n solidText,\n };\n}\n\n/**\n * Maps Panneau's tokens to the CSS variables of Bootstrap 5.3, for sites that use Bootstrap: Panneau\n * then follows the site's colors, fonts and radii, and its color mode (`data-bs-theme`), without\n * using any Bootstrap class. Bootstrap's CSS must be loaded by the site.\n */\nexport const bootstrapTheme: Theme = {\n label: 'Bootstrap',\n tokens: {\n 'panneau-color-bg': 'var(--bs-body-bg)',\n 'panneau-color-surface': 'var(--bs-body-bg)',\n 'panneau-color-surface-sunken': 'var(--bs-tertiary-bg)',\n 'panneau-color-surface-raised': 'var(--bs-body-bg)',\n 'panneau-color-hover': 'rgba(var(--bs-emphasis-color-rgb), 0.06)',\n 'panneau-color-pressed': 'rgba(var(--bs-emphasis-color-rgb), 0.1)',\n 'panneau-color-text': 'var(--bs-body-color)',\n 'panneau-color-text-muted': 'var(--bs-secondary-color)',\n 'panneau-color-link': 'var(--bs-link-color)',\n 'panneau-color-border': 'var(--bs-border-color)',\n 'panneau-color-border-control': 'var(--bs-border-color)',\n 'panneau-color-accent': 'var(--bs-primary)',\n 'panneau-color-accent-hover': 'color-mix(in srgb, var(--bs-primary), #000 15%)',\n 'panneau-color-accent-text': 'var(--bs-white)',\n 'panneau-color-accent-subtle': 'var(--bs-primary-bg-subtle)',\n 'panneau-color-focus': 'rgba(var(--bs-primary-rgb), 0.5)',\n 'panneau-color-danger': 'var(--bs-danger-text-emphasis)',\n 'panneau-color-danger-subtle': 'var(--bs-danger-bg-subtle)',\n 'panneau-color-danger-border': 'var(--bs-danger-border-subtle)',\n 'panneau-color-danger-solid': 'var(--bs-danger)',\n 'panneau-color-danger-solid-hover': 'color-mix(in srgb, var(--bs-danger), #000 15%)',\n 'panneau-color-danger-solid-text': 'var(--bs-white)',\n 'panneau-color-success': 'var(--bs-success-text-emphasis)',\n 'panneau-color-success-subtle': 'var(--bs-success-bg-subtle)',\n 'panneau-color-success-border': 'var(--bs-success-border-subtle)',\n 'panneau-color-success-solid': 'var(--bs-success)',\n 'panneau-color-success-solid-hover': 'color-mix(in srgb, var(--bs-success), #000 15%)',\n 'panneau-color-success-solid-text': 'var(--bs-white)',\n 'panneau-color-warning': 'var(--bs-warning-text-emphasis)',\n 'panneau-color-warning-subtle': 'var(--bs-warning-bg-subtle)',\n 'panneau-color-warning-border': 'var(--bs-warning-border-subtle)',\n 'panneau-color-warning-solid': 'var(--bs-warning)',\n 'panneau-color-warning-solid-hover': 'color-mix(in srgb, var(--bs-warning), #000 10%)',\n // Like Bootstrap's .btn-warning and .text-bg-warning: dark text on yellow.\n 'panneau-color-warning-solid-text': 'var(--bs-dark)',\n 'panneau-color-info': 'var(--bs-info-text-emphasis)',\n 'panneau-color-info-subtle': 'var(--bs-info-bg-subtle)',\n 'panneau-color-info-border': 'var(--bs-info-border-subtle)',\n 'panneau-color-info-solid': 'var(--bs-info)',\n 'panneau-color-info-solid-hover': 'color-mix(in srgb, var(--bs-info), #000 10%)',\n 'panneau-color-info-solid-text': 'var(--bs-dark)',\n // What is over: Bootstrap's secondary text, without a fill (Panneau 4's `dark`).\n 'panneau-color-muted': 'var(--bs-secondary-color)',\n 'panneau-color-muted-subtle': 'transparent',\n 'panneau-color-muted-border': 'var(--bs-border-color)',\n 'panneau-color-muted-solid': 'var(--bs-secondary)',\n 'panneau-color-muted-solid-hover': 'color-mix(in srgb, var(--bs-secondary), #000 15%)',\n 'panneau-color-muted-solid-text': 'var(--bs-white)',\n 'panneau-font-family-body': 'var(--bs-body-font-family)',\n 'panneau-font-family-mono': 'var(--bs-font-monospace)',\n 'panneau-font-size-md': 'var(--bs-body-font-size)',\n 'panneau-line-height': 'var(--bs-body-line-height)',\n 'panneau-radius-sm': 'var(--bs-border-radius-sm)',\n 'panneau-radius-md': 'var(--bs-border-radius)',\n 'panneau-radius-lg': 'var(--bs-border-radius-lg)',\n 'panneau-radius-full': 'var(--bs-border-radius-pill)',\n 'panneau-border-width': 'var(--bs-border-width)',\n 'panneau-shadow-sm': 'var(--bs-box-shadow-sm)',\n 'panneau-shadow-md': 'var(--bs-box-shadow)',\n 'panneau-shadow-lg': 'var(--bs-box-shadow-lg)',\n // Bootstrap 5.3 declares its component variables (--bs-btn-*, --bs-card-*) on the classes\n // of its components, out of reach: components map to the root variables those default to.\n 'panneau-heading-color': 'var(--bs-heading-color)',\n 'panneau-badge-radius': 'var(--bs-border-radius)',\n 'panneau-card-radius': 'var(--bs-border-radius)',\n 'panneau-card-border-color': 'var(--bs-border-color-translucent)',\n 'panneau-popover-radius': 'var(--bs-border-radius)',\n 'panneau-popover-border-color': 'var(--bs-border-color-translucent)',\n 'panneau-tooltip-bg': 'var(--bs-emphasis-color)',\n 'panneau-tooltip-color': 'var(--bs-body-bg)',\n 'panneau-tooltip-radius': 'var(--bs-border-radius)',\n },\n // Bootstrap's theme colors as tones: accent is primary, and primary and secondary are there by\n // their Bootstrap names (declare them in PanneauTones to use them).\n tones: {\n accent: bootstrapTone('primary'),\n primary: bootstrapTone('primary'),\n secondary: bootstrapTone('secondary'),\n },\n // Bootstrap's sizes of controls are those of the comfortable density: the others keep Panneau's.\n densities: {\n comfortable: {\n 'panneau-font-size-control': 'var(--bs-body-font-size)',\n 'panneau-control-height': 'calc(1.5em + 0.75rem + 2 * var(--bs-border-width))',\n 'panneau-control-height-sm': 'calc(1.5em + 0.5rem + 2 * var(--bs-border-width))',\n 'panneau-control-padding-x': '0.75rem',\n },\n },\n} satisfies ThemeDefinition;\n"],"mappings":";;;;;;;AAUA,SAAgBG,cACZC,OACA,EAAEC,YAAY,sBAA8C,CAAC,GACnD;CACV,OAAO;EACHC,MAAM,YAAYF,MAAK;EACvBG,QAAQ,YAAYH,MAAK;EACzBI,QAAQ,YAAYJ,MAAK;EACzBK,SAAS,YAAYL,MAAK;EAC1BM,OAAO,YAAYN,MAAK;EACxBO,YAAY,+BAA+BP,MAAK;EAChDC;CACJ;AACJ;;;;;;AAOA,IAAaO,iBAAwB;CACjCC,OAAO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@
1
- {"version":3,"file":"chartColors.js","names":[],"sources":["../../src/theme/chartColors.ts"],"sourcesContent":["/** The number of categorical chart colors: series beyond it reuse them in order. */\nexport const CHART_CATEGORICAL_COUNT = 8;\n\n/** The number of steps of the sequential chart ramp. */\nexport const CHART_SEQUENTIAL_COUNT = 5;\n\n/**\n * The colors of charts, as CSS variables for `fill` and `stroke`: they follow the theme, the color\n * scheme and the scope of the chart. Dashboard charts use only these.\n *\n * - `categorical(index)`: the color of a series, in a fixed order (`index` from 0), repeating after\n * 8. Each one reaches 3:1 against the surface and stays distinct with color vision deficiencies.\n * - `sequential(step)`: a step from 1 (low) to 5 (high) of a ramp, for quantities.\n * - `diverging`: two colors around a neutral midpoint, for values above and below a reference.\n */\nexport const chartColors = Object.freeze({\n categorical: (index: number): string =>\n `var(--panneau-chart-categorical-${(((Math.floor(index) % CHART_CATEGORICAL_COUNT) + CHART_CATEGORICAL_COUNT) % CHART_CATEGORICAL_COUNT) + 1})`,\n sequential: (step: 1 | 2 | 3 | 4 | 5): string => `var(--panneau-chart-sequential-${step})`,\n diverging: Object.freeze({\n negative: 'var(--panneau-chart-diverging-negative)',\n neutral: 'var(--panneau-chart-diverging-neutral)',\n positive: 'var(--panneau-chart-diverging-positive)',\n }),\n});\n"],"mappings":";;AACA,IAAa,0BAA0B;;AAGvC,IAAa,yBAAyB;;;;;;;;;;AAWtC,IAAa,cAAc,OAAO,OAAO;CACrC,cAAc,UACV,oCAAsC,KAAK,MAAM,KAAK,IAAA,IAAA,KAAA,IAAqF,EAAC;CAChJ,aAAa,SAAoC,kCAAkC,KAAI;CACvF,WAAW,OAAO,OAAO;EACrB,UAAU;EACV,SAAS;EACT,UAAU;CACd,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"chartColors.js","names":["CHART_CATEGORICAL_COUNT","CHART_SEQUENTIAL_COUNT","chartColors","Object","freeze","categorical","index","Math","floor","sequential","step","diverging","negative","neutral","positive"],"sources":["../../src/theme/chartColors.ts"],"sourcesContent":["/** The number of categorical chart colors: series beyond it reuse them in order. */\nexport const CHART_CATEGORICAL_COUNT = 8;\n\n/** The number of steps of the sequential chart ramp. */\nexport const CHART_SEQUENTIAL_COUNT = 5;\n\n/**\n * The colors of charts, as CSS variables for `fill` and `stroke`: they follow the theme, the color\n * scheme and the scope of the chart. Dashboard charts use only these.\n *\n * - `categorical(index)`: the color of a series, in a fixed order (`index` from 0), repeating after\n * 8. Each one reaches 3:1 against the surface and stays distinct with color vision deficiencies.\n * - `sequential(step)`: a step from 1 (low) to 5 (high) of a ramp, for quantities.\n * - `diverging`: two colors around a neutral midpoint, for values above and below a reference.\n */\nexport const chartColors = Object.freeze({\n categorical: (index: number): string =>\n `var(--panneau-chart-categorical-${(((Math.floor(index) % CHART_CATEGORICAL_COUNT) + CHART_CATEGORICAL_COUNT) % CHART_CATEGORICAL_COUNT) + 1})`,\n sequential: (step: 1 | 2 | 3 | 4 | 5): string => `var(--panneau-chart-sequential-${step})`,\n diverging: Object.freeze({\n negative: 'var(--panneau-chart-diverging-negative)',\n neutral: 'var(--panneau-chart-diverging-neutral)',\n positive: 'var(--panneau-chart-diverging-positive)',\n }),\n});\n"],"mappings":";;AACA,IAAaA,0BAA0B;;AAGvC,IAAaC,yBAAyB;;;;;;;;;;AAWtC,IAAaC,cAAcC,OAAOC,OAAO;CACrCC,cAAcC,UACV,oCAAsCC,KAAKC,MAAMF,KAAK,IAAA,IAAA,KAAA,IAAqF,EAAC;CAChJG,aAAaC,SAAoC,kCAAkCA,KAAI;CACvFC,WAAWR,OAAOC,OAAO;EACrBQ,UAAU;EACVC,SAAS;EACTC,UAAU;CACd,CAAC;AACL,CAAC"}
@@ -1,5 +1,5 @@
1
- import { type ColorDifferenceCheck } from './colorVision';
2
- import { type Theme } from './theme';
1
+ import { type ColorDifferenceCheck } from './colorVision.js';
2
+ import { type Theme } from './theme.js';
3
3
  /** A pair of colors that a theme must keep readable. */
4
4
  export interface ThemeContrastCheck {
5
5
  scheme: 'light' | 'dark';
@@ -1 +1 @@
1
- {"version":3,"file":"checkTheme.d.ts","sourceRoot":"","sources":["../../src/theme/checkTheme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,oBAAoB,EAAyB,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,KAAK,KAAK,EAAqD,MAAM,SAAS,CAAC;AAGxF,wDAAwD;AACxD,MAAM,WAAW,kBAAkB;IAC/B,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,gGAAgG;IAChG,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IACxB,0BAA0B;IAC1B,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,uCAAuC;IACvC,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B,sEAAsE;IACtE,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAChC;;;OAGG;IACH,gBAAgB,EAAE,CAAC,oBAAoB,GAAG;QAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;CAC7E;AA2CD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,CAgHpD"}
1
+ {"version":3,"file":"checkTheme.d.ts","sourceRoot":"","sources":["../../src/theme/checkTheme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,oBAAoB,EAAyB,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,KAAK,KAAK,EAAqD,MAAM,SAAS,CAAC;AAGxF,wDAAwD;AACxD,MAAM,WAAW,kBAAkB;IAC/B,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,gGAAgG;IAChG,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IACxB,0BAA0B;IAC1B,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,uCAAuC;IACvC,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B,sEAAsE;IACtE,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAChC;;;OAGG;IACH,gBAAgB,EAAE,CAAC,oBAAoB,GAAG;QAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;CAC7E;AAoED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,CAgHpD"}
@@ -57,6 +57,30 @@ var TOKEN_PAIRS = [
57
57
  "panneau-color-border-control",
58
58
  "panneau-color-surface",
59
59
  MIN_NON_TEXT_RATIO
60
+ ],
61
+ [
62
+ "muted tone text on surface",
63
+ "panneau-color-muted",
64
+ "panneau-color-surface",
65
+ MIN_CONTRAST_RATIO
66
+ ],
67
+ [
68
+ "muted tone border on surface",
69
+ "panneau-color-muted-border",
70
+ "panneau-color-surface",
71
+ MIN_NON_TEXT_RATIO
72
+ ],
73
+ [
74
+ "muted tone solid text on solid",
75
+ "panneau-color-muted-solid-text",
76
+ "panneau-color-muted-solid",
77
+ MIN_CONTRAST_RATIO
78
+ ],
79
+ [
80
+ "muted tone solid text on hover",
81
+ "panneau-color-muted-solid-text",
82
+ "panneau-color-muted-solid-hover",
83
+ MIN_CONTRAST_RATIO
60
84
  ]
61
85
  ];
62
86
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"checkTheme.js","names":[],"sources":["../../src/theme/checkTheme.ts"],"sourcesContent":["import { type Rgb, WHITE, contrastRatio, mixColors, parseColor } from './color';\nimport { type ColorDifferenceCheck, checkColorDifferences } from './colorVision';\nimport { type Theme, paletteVariables, resolveReference, themeSurfaces } from './theme';\nimport { MIN_CONTRAST_RATIO, SUBTLE_AMOUNTS, resolveTone } from './tones';\n\n/** A pair of colors that a theme must keep readable. */\nexport interface ThemeContrastCheck {\n scheme: 'light' | 'dark';\n /** What is checked: `tone signal: text on surface`, `tokens: text on bg`. */\n name: string;\n foreground: string;\n background: string;\n /** The contrast ratio, or `null` when a color can't be read (a CSS variable, `color-mix()`). */\n ratio: number | null;\n minimum: number;\n}\n\nexport interface ThemeReport {\n /** Every pair checked. */\n checks: ThemeContrastCheck[];\n /** Pairs below their minimum ratio. */\n failures: ThemeContrastCheck[];\n /** Pairs with a color Panneau can't read: check them in a browser. */\n unchecked: ThemeContrastCheck[];\n /**\n * Categorical chart colors of the theme that look too alike, for typical vision or with a\n * color vision deficiency.\n */\n colorDifferences: (ColorDifferenceCheck & { scheme: 'light' | 'dark' })[];\n}\n\n/** Surfaces of the default theme, used when a theme doesn't set its own. */\nconst DEFAULT_SURFACES: Record<'light' | 'dark', Rgb> = {\n light: WHITE,\n dark: { r: 24, g: 24, b: 27 },\n};\n\n/** Chart colors that must stand out from the surface: series, the high step and diverging ends. */\nconst CHART_TOKENS = [\n ...Array.from({ length: 8 }, (_, index) => `panneau-chart-categorical-${index + 1}`),\n 'panneau-chart-sequential-5',\n 'panneau-chart-diverging-negative',\n 'panneau-chart-diverging-positive',\n];\n\n/** Non-text elements (borders of controls, outlines) need 3:1 (WCAG 2 non-text contrast). */\nconst MIN_NON_TEXT_RATIO = 3;\n\nconst TOKEN_PAIRS: [name: string, foreground: string, background: string, minimum: number][] = [\n ['text on bg', 'panneau-color-text', 'panneau-color-bg', MIN_CONTRAST_RATIO],\n ['text on surface', 'panneau-color-text', 'panneau-color-surface', MIN_CONTRAST_RATIO],\n [\n 'muted text on surface',\n 'panneau-color-text-muted',\n 'panneau-color-surface',\n MIN_CONTRAST_RATIO,\n ],\n ['link on surface', 'panneau-color-link', 'panneau-color-surface', MIN_CONTRAST_RATIO],\n [\n 'accent text on accent',\n 'panneau-color-accent-text',\n 'panneau-color-accent',\n MIN_CONTRAST_RATIO,\n ],\n [\n 'control border on surface',\n 'panneau-color-border-control',\n 'panneau-color-surface',\n MIN_NON_TEXT_RATIO,\n ],\n];\n\n/**\n * Checks the contrast of a theme, like Bootstrap's `$min-contrast-ratio`, but as a report: text\n * tokens against backgrounds (4.5:1), control borders (3:1), and every tone of the theme (its text\n * on the surface, its solid text on the solid background and its hover), and chart colors (3:1\n * against the surface, and categorical colors distinct with color vision deficiencies). Pairs where a color comes\n * from the default theme and is not set by the theme are skipped, except the surface, which falls\n * back to the default one. Values that refer to the theme's palette or tokens with `var()` are\n * checked as what they refer to; colors Panneau can't read are listed as unchecked.\n */\nexport function checkTheme(theme: Theme): ThemeReport {\n const checks: ThemeContrastCheck[] = [];\n const colorDifferences: ThemeReport['colorDifferences'] = [];\n const palette = paletteVariables(theme.palette);\n const surfaces = themeSurfaces(theme);\n (['light', 'dark'] as const).forEach((scheme) => {\n const variables = {\n ...palette,\n ...theme.tokens,\n ...(scheme === 'dark' ? theme.dark : undefined),\n };\n const tokens = Object.fromEntries(\n Object.entries(variables).map(([name, value]) => [\n name,\n resolveReference(value, variables),\n ]),\n );\n const surface = tokens['panneau-color-surface'];\n const surfaceColor = surface !== undefined ? parseColor(surface) : DEFAULT_SURFACES[scheme];\n const add = (\n name: string,\n foreground: string,\n background: string,\n minimum: number,\n backgroundColor: Rgb | null = parseColor(background),\n ) => {\n const foregroundColor = parseColor(foreground);\n checks.push({\n scheme,\n name,\n foreground,\n background,\n ratio:\n foregroundColor !== null && backgroundColor !== null\n ? Math.round(contrastRatio(foregroundColor, backgroundColor) * 100) / 100\n : null,\n minimum,\n });\n };\n TOKEN_PAIRS.forEach(([name, foreground, background, minimum]) => {\n const foregroundValue = tokens[foreground];\n const backgroundValue = tokens[background];\n if (foregroundValue !== undefined && backgroundValue !== undefined) {\n add(`tokens: ${name}`, foregroundValue, backgroundValue, minimum);\n }\n });\n // Chart colors are graphics: 3:1 against the surface, and distinct from each other.\n const surfaceValue = surface ?? (scheme === 'light' ? '#ffffff' : '#18181b');\n CHART_TOKENS.forEach((token) => {\n const value = tokens[token];\n if (value !== undefined) {\n add(\n `chart: ${token.replace('panneau-chart-', '')} on surface`,\n value,\n surfaceValue,\n MIN_NON_TEXT_RATIO,\n surfaceColor,\n );\n }\n });\n const categorical = CHART_TOKENS.filter((token) => token.includes('categorical')).flatMap(\n (token) => (tokens[token] !== undefined ? [tokens[token]] : []),\n );\n colorDifferences.push(\n ...checkColorDifferences(categorical).map((check) => ({ ...check, scheme })),\n );\n Object.entries(theme.tones ?? {}).forEach(([tone, toneInput]) => {\n const input =\n typeof toneInput === 'string' ? resolveReference(toneInput, palette) : toneInput;\n const values = resolveTone(input, surfaces)[scheme];\n add(\n `tone ${tone}: text on surface`,\n values.text,\n surface ?? (scheme === 'light' ? '#ffffff' : '#18181b'),\n MIN_CONTRAST_RATIO,\n surfaceColor,\n );\n // The subtle background of a tone is often mixed with the surface in CSS: compute it\n // against the surface of the scheme when it can't be read directly.\n const color = typeof input === 'string' ? parseColor(input) : null;\n const subtleColor =\n parseColor(values.subtle) ??\n (color !== null && surfaceColor !== null\n ? mixColors(surfaceColor, color, SUBTLE_AMOUNTS[scheme])\n : null);\n add(\n `tone ${tone}: text on subtle`,\n values.text,\n values.subtle,\n MIN_CONTRAST_RATIO,\n subtleColor,\n );\n add(\n `tone ${tone}: solid text on solid`,\n values.solidText,\n values.solid,\n MIN_CONTRAST_RATIO,\n );\n add(\n `tone ${tone}: solid text on hover`,\n values.solidText,\n values.solidHover,\n MIN_CONTRAST_RATIO,\n );\n });\n });\n return {\n checks,\n failures: checks.filter((check) => check.ratio !== null && check.ratio < check.minimum),\n unchecked: checks.filter((check) => check.ratio === null),\n colorDifferences,\n };\n}\n"],"mappings":";;;;;;AAgCA,IAAM,mBAAkD;CACpD,OAAO;CACP,MAAM;EAAE,GAAG;EAAI,GAAG;EAAI,GAAG;C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ACJ,CAAC;CACL,CAAC;CACD,OAAO;EACH;EACA,UAAU,OAAO,QAAQ,UAAU,MAAM,UAAU,QAAQ,MAAM,QAAQ,MAAM,OAAO;EACtF,WAAW,OAAO,QAAQ,UAAU,MAAM,UAAU,IAAI;EACxD;CACJ;AACJ"}
1
+ {"version":3,"file":"checkTheme.js","names":["Rgb","WHITE","contrastRatio","mixColors","parseColor","ColorDifferenceCheck","checkColorDifferences","Theme","paletteVariables","resolveReference","themeSurfaces","MIN_CONTRAST_RATIO","SUBTLE_AMOUNTS","resolveTone","ThemeContrastCheck","scheme","name","foreground","background","ratio","minimum","ThemeReport","checks","failures","unchecked","colorDifferences","DEFAULT_SURFACES","Record","light","dark","r","g","b","CHART_TOKENS","Array","from","length","_","index","MIN_NON_TEXT_RATIO","TOKEN_PAIRS","checkTheme","theme","palette","surfaces","const","forEach","variables","tokens","undefined","Object","fromEntries","entries","map","value","surface","surfaceColor","add","backgroundColor","foregroundColor","push","Math","round","foregroundValue","backgroundValue","surfaceValue","token","replace","categorical","filter","includes","flatMap","check","tones","tone","toneInput","input","values","text","color","subtleColor","subtle","solidText","solid","solidHover"],"sources":["../../src/theme/checkTheme.ts"],"sourcesContent":["import { type Rgb, WHITE, contrastRatio, mixColors, parseColor } from './color';\nimport { type ColorDifferenceCheck, checkColorDifferences } from './colorVision';\nimport { type Theme, paletteVariables, resolveReference, themeSurfaces } from './theme';\nimport { MIN_CONTRAST_RATIO, SUBTLE_AMOUNTS, resolveTone } from './tones';\n\n/** A pair of colors that a theme must keep readable. */\nexport interface ThemeContrastCheck {\n scheme: 'light' | 'dark';\n /** What is checked: `tone signal: text on surface`, `tokens: text on bg`. */\n name: string;\n foreground: string;\n background: string;\n /** The contrast ratio, or `null` when a color can't be read (a CSS variable, `color-mix()`). */\n ratio: number | null;\n minimum: number;\n}\n\nexport interface ThemeReport {\n /** Every pair checked. */\n checks: ThemeContrastCheck[];\n /** Pairs below their minimum ratio. */\n failures: ThemeContrastCheck[];\n /** Pairs with a color Panneau can't read: check them in a browser. */\n unchecked: ThemeContrastCheck[];\n /**\n * Categorical chart colors of the theme that look too alike, for typical vision or with a\n * color vision deficiency.\n */\n colorDifferences: (ColorDifferenceCheck & { scheme: 'light' | 'dark' })[];\n}\n\n/** Surfaces of the default theme, used when a theme doesn't set its own. */\nconst DEFAULT_SURFACES: Record<'light' | 'dark', Rgb> = {\n light: WHITE,\n dark: { r: 24, g: 24, b: 27 },\n};\n\n/** Chart colors that must stand out from the surface: series, the high step and diverging ends. */\nconst CHART_TOKENS = [\n ...Array.from({ length: 8 }, (_, index) => `panneau-chart-categorical-${index + 1}`),\n 'panneau-chart-sequential-5',\n 'panneau-chart-diverging-negative',\n 'panneau-chart-diverging-positive',\n];\n\n/** Non-text elements (borders of controls, outlines) need 3:1 (WCAG 2 non-text contrast). */\nconst MIN_NON_TEXT_RATIO = 3;\n\nconst TOKEN_PAIRS: [name: string, foreground: string, background: string, minimum: number][] = [\n ['text on bg', 'panneau-color-text', 'panneau-color-bg', MIN_CONTRAST_RATIO],\n ['text on surface', 'panneau-color-text', 'panneau-color-surface', MIN_CONTRAST_RATIO],\n [\n 'muted text on surface',\n 'panneau-color-text-muted',\n 'panneau-color-surface',\n MIN_CONTRAST_RATIO,\n ],\n ['link on surface', 'panneau-color-link', 'panneau-color-surface', MIN_CONTRAST_RATIO],\n [\n 'accent text on accent',\n 'panneau-color-accent-text',\n 'panneau-color-accent',\n MIN_CONTRAST_RATIO,\n ],\n [\n 'control border on surface',\n 'panneau-color-border-control',\n 'panneau-color-surface',\n MIN_NON_TEXT_RATIO,\n ],\n // The muted tone has no fill: its text and its outline sit on the surface.\n [\n 'muted tone text on surface',\n 'panneau-color-muted',\n 'panneau-color-surface',\n MIN_CONTRAST_RATIO,\n ],\n [\n 'muted tone border on surface',\n 'panneau-color-muted-border',\n 'panneau-color-surface',\n MIN_NON_TEXT_RATIO,\n ],\n [\n 'muted tone solid text on solid',\n 'panneau-color-muted-solid-text',\n 'panneau-color-muted-solid',\n MIN_CONTRAST_RATIO,\n ],\n [\n 'muted tone solid text on hover',\n 'panneau-color-muted-solid-text',\n 'panneau-color-muted-solid-hover',\n MIN_CONTRAST_RATIO,\n ],\n];\n\n/**\n * Checks the contrast of a theme, like Bootstrap's `$min-contrast-ratio`, but as a report: text\n * tokens against backgrounds (4.5:1), control borders (3:1), and every tone of the theme (its text\n * on the surface, its solid text on the solid background and its hover), and chart colors (3:1\n * against the surface, and categorical colors distinct with color vision deficiencies). Pairs where a color comes\n * from the default theme and is not set by the theme are skipped, except the surface, which falls\n * back to the default one. Values that refer to the theme's palette or tokens with `var()` are\n * checked as what they refer to; colors Panneau can't read are listed as unchecked.\n */\nexport function checkTheme(theme: Theme): ThemeReport {\n const checks: ThemeContrastCheck[] = [];\n const colorDifferences: ThemeReport['colorDifferences'] = [];\n const palette = paletteVariables(theme.palette);\n const surfaces = themeSurfaces(theme);\n (['light', 'dark'] as const).forEach((scheme) => {\n const variables = {\n ...palette,\n ...theme.tokens,\n ...(scheme === 'dark' ? theme.dark : undefined),\n };\n const tokens = Object.fromEntries(\n Object.entries(variables).map(([name, value]) => [\n name,\n resolveReference(value, variables),\n ]),\n );\n const surface = tokens['panneau-color-surface'];\n const surfaceColor = surface !== undefined ? parseColor(surface) : DEFAULT_SURFACES[scheme];\n const add = (\n name: string,\n foreground: string,\n background: string,\n minimum: number,\n backgroundColor: Rgb | null = parseColor(background),\n ) => {\n const foregroundColor = parseColor(foreground);\n checks.push({\n scheme,\n name,\n foreground,\n background,\n ratio:\n foregroundColor !== null && backgroundColor !== null\n ? Math.round(contrastRatio(foregroundColor, backgroundColor) * 100) / 100\n : null,\n minimum,\n });\n };\n TOKEN_PAIRS.forEach(([name, foreground, background, minimum]) => {\n const foregroundValue = tokens[foreground];\n const backgroundValue = tokens[background];\n if (foregroundValue !== undefined && backgroundValue !== undefined) {\n add(`tokens: ${name}`, foregroundValue, backgroundValue, minimum);\n }\n });\n // Chart colors are graphics: 3:1 against the surface, and distinct from each other.\n const surfaceValue = surface ?? (scheme === 'light' ? '#ffffff' : '#18181b');\n CHART_TOKENS.forEach((token) => {\n const value = tokens[token];\n if (value !== undefined) {\n add(\n `chart: ${token.replace('panneau-chart-', '')} on surface`,\n value,\n surfaceValue,\n MIN_NON_TEXT_RATIO,\n surfaceColor,\n );\n }\n });\n const categorical = CHART_TOKENS.filter((token) => token.includes('categorical')).flatMap(\n (token) => (tokens[token] !== undefined ? [tokens[token]] : []),\n );\n colorDifferences.push(\n ...checkColorDifferences(categorical).map((check) => ({ ...check, scheme })),\n );\n Object.entries(theme.tones ?? {}).forEach(([tone, toneInput]) => {\n const input =\n typeof toneInput === 'string' ? resolveReference(toneInput, palette) : toneInput;\n const values = resolveTone(input, surfaces)[scheme];\n add(\n `tone ${tone}: text on surface`,\n values.text,\n surface ?? (scheme === 'light' ? '#ffffff' : '#18181b'),\n MIN_CONTRAST_RATIO,\n surfaceColor,\n );\n // The subtle background of a tone is often mixed with the surface in CSS: compute it\n // against the surface of the scheme when it can't be read directly.\n const color = typeof input === 'string' ? parseColor(input) : null;\n const subtleColor =\n parseColor(values.subtle) ??\n (color !== null && surfaceColor !== null\n ? mixColors(surfaceColor, color, SUBTLE_AMOUNTS[scheme])\n : null);\n add(\n `tone ${tone}: text on subtle`,\n values.text,\n values.subtle,\n MIN_CONTRAST_RATIO,\n subtleColor,\n );\n add(\n `tone ${tone}: solid text on solid`,\n values.solidText,\n values.solid,\n MIN_CONTRAST_RATIO,\n );\n add(\n `tone ${tone}: solid text on hover`,\n values.solidText,\n values.solidHover,\n MIN_CONTRAST_RATIO,\n );\n });\n });\n return {\n checks,\n failures: checks.filter((check) => check.ratio !== null && check.ratio < check.minimum),\n unchecked: checks.filter((check) => check.ratio === null),\n colorDifferences,\n };\n}\n"],"mappings":";;;;;;AAgCA,IAAM0B,mBAAkD;CACpDE,OAAO3B;CACP4B,MAAM;EAAEC,GAAG;EAAIC,GAAG;EAAIC,GAAG;CAAG;AAChC;;AAGA,IAAMC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oBACZG,OAAOC,MACPvB,YAAYxC,WAAW,UAAU,YAAY,YAC7CJ,oBACA6C,YACJ;GAGA,MAAMuB,QAAQ,OAAOH,UAAU,WAAWxE,WAAWwE,KAAK,IAAI;GAC9D,MAAMI,cACF5E,WAAWyE,OAAOI,MAAM,MACvBF,UAAU,QAAQvB,iBAAiB,OAC9BrD,UAAUqD,cAAcuB,OAAOnE,eAAeG,OAAO,IACrD;GACV0C,IACI,QAAQiB,KAAI,mBACZG,OAAOC,MACPD,OAAOI,QACPtE,oBACAqE,WACJ;GACAvB,IACI,QAAQiB,KAAI,wBACZG,OAAOK,WACPL,OAAOM,OACPxE,kBACJ;GACA8C,IACI,QAAQiB,KAAI,wBACZG,OAAOK,WACPL,OAAOO,YACPzE,kBACJ;EACJ,CAAC;CACL,CAAC;CACD,OAAO;EACHW;EACAC,UAAUD,OAAO+C,QAAQG,UAAUA,MAAMrD,UAAU,QAAQqD,MAAMrD,QAAQqD,MAAMpD,OAAO;EACtFI,WAAWF,OAAO+C,QAAQG,UAAUA,MAAMrD,UAAU,IAAI;EACxDM;CACJ;AACJ"}
@@ -1,5 +1,5 @@
1
- import { type ThemeReport } from './checkTheme';
2
- import type { Theme } from './theme';
1
+ import { type ThemeReport } from './checkTheme.js';
2
+ import type { Theme } from './theme.js';
3
3
  /** Loads a module from its URL: `import()`, replaced in tests. */
4
4
  export type ModuleImporter = (url: string) => Promise<Record<string, unknown>>;
5
5
  /** Reads a theme from a JSON file or from an export of a module. */
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","names":[],"sources":["../../src/theme/cli.ts"],"sourcesContent":["// The `panneau-check-theme` command, for Node only: it is not part of the exports.\n/// <reference types=\"node\" />\nimport { readFile } from 'node:fs/promises';\nimport { extname, resolve } from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\nimport { type ThemeReport, checkTheme } from './checkTheme';\nimport type { Theme } from './theme';\n\nconst USAGE = `Usage: panneau-check-theme <file> [--export <name>] [--json]\n\nChecks the contrast of a theme, and the differences between its chart colors with color vision\ndeficiencies. <file> is a JSON file (the Theme schema of @panneau/protocol), or a module whose\ndefault export, or the export named by --export, is a theme. Exits with 1 when a check fails.`;\n\nfunction isTheme(value: unknown): value is Theme {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'tokens' in value &&\n typeof value.tokens === 'object' &&\n value.tokens !== null\n );\n}\n\n/** Loads a module from its URL: `import()`, replaced in tests. */\nexport type ModuleImporter = (url: string) => Promise<Record<string, unknown>>;\n\nconst importModule: ModuleImporter = (url) => import(url) as Promise<Record<string, unknown>>;\n\n/** Reads a theme from a JSON file or from an export of a module. */\nexport async function loadTheme(\n path: string,\n exportName = 'default',\n load: ModuleImporter = importModule,\n): Promise<Theme> {\n const file = resolve(path);\n const value: unknown =\n extname(file) === '.json'\n ? JSON.parse(await readFile(file, 'utf8'))\n : (await load(pathToFileURL(file).href))[exportName];\n if (!isTheme(value)) {\n throw new Error(\n extname(file) === '.json'\n ? `${path} is not a theme: it has no tokens.`\n : `The export \"${exportName}\" of ${path} is not a theme.`,\n );\n }\n return value;\n}\n\n/** A report as text, one line per check that failed or that Panneau couldn't read. */\nexport function formatThemeReport(report: ThemeReport, label = 'Theme'): string {\n const lines = [\n `${label}: ${report.checks.length} contrast checks, ${report.failures.length} failed, ` +\n `${report.unchecked.length} unchecked, ${report.colorDifferences.length} similar chart colors.`,\n ];\n report.failures.forEach((check) => {\n lines.push(\n ` fail ${check.scheme.padEnd(5)} ${check.name}: ${check.foreground} on ` +\n `${check.background}, ${String(check.ratio)}:1 < ${String(check.minimum)}:1`,\n );\n });\n report.colorDifferences.forEach((check) => {\n lines.push(\n ` similar ${check.scheme.padEnd(5)} chart colors ${check.first} and ` +\n `${check.second} with ${check.vision}: ${String(check.difference)} < ${String(check.minimum)}`,\n );\n });\n report.unchecked.forEach((check) => {\n lines.push(\n ` unchecked ${check.scheme.padEnd(5)} ${check.name}: ${check.foreground} on ` +\n `${check.background} (check it in a browser)`,\n );\n });\n return lines.join('\\n');\n}\n\n/** Runs `panneau-check-theme` with its arguments, and returns the exit code. */\nexport async function runCheckTheme(\n args: readonly string[],\n output: { log: (text: string) => void; error: (text: string) => void } = console,\n load: ModuleImporter = importModule,\n): Promise<number> {\n const json = args.includes('--json');\n const exportIndex = args.indexOf('--export');\n const exportName = exportIndex >= 0 ? args[exportIndex + 1] : undefined;\n const files = args.filter(\n (arg, index) => !arg.startsWith('--') && (exportIndex < 0 || index !== exportIndex + 1),\n );\n const [file] = files;\n if (file === undefined || files.length > 1 || args.includes('--help')) {\n output.error(USAGE);\n return args.includes('--help') ? 0 : 2;\n }\n let theme: Theme;\n try {\n theme = await loadTheme(file, exportName, load);\n } catch (error) {\n output.error(error instanceof Error ? error.message : String(error));\n return 2;\n }\n const report = checkTheme(theme);\n output.log(json ? JSON.stringify(report, null, 2) : formatThemeReport(report, theme.label));\n return report.failures.length > 0 || report.colorDifferences.length > 0 ? 1 : 0;\n}\n"],"mappings":";;;;;AASA,IAAM,QAAQ;;;;;AAMd,SAAS,QAAQ,OAAgC;CAC7C,OACI,OAAO,UAAU,YACjB,UAAU,QACV,YAAY,SACZ,OAAO,MAAM,WAAW,YACxB,MAAM,WAAW;AAEzB;AAKA,IAAM,gBAAgC,QAAQ,OAAO;;AAGrD,eAAsB,UAClB,MACA,aAAa,WACb,OAAuB,cACT;CACd,MAAM,OAAO,QAAQ,IAAI;CACzB,MAAM,QACF,QAAQ,IAAI,MAAM,UACZ,KAAK,MAAM,MAAM,SAAS,MAAM,MAAM,CAAC,KACtC,MAAM,KAAK,cAAc,IAAI,CAAC,CAAC,IAAI,EAAA,CAAG;CACjD,IAAI,CAAC,QAAQ,KAAK,GACd,MAAM,IAAI,MACN,QAAQ,IAAI,MAAM,UACZ,GAAG,KAAI,sCACP,eAAe,WAAU,OAAQ,KAAI,iBAC/C;CAEJ,OAAO;AACX;;AAGA,SAAgB,kBAAkB,QAAqB,QAAQ,SAAiB;CAC5E,MAAM,QAAQ,CACV,GAAG,MAAK,IAAK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AAU,MAAM,YAAY,IAAI;CAClD,SAAS,OAAO;EACZ,OAAO,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;EACnE,OAAO;CACX;CACA,MAAM,SAAS,WAAW,KAAK;CAC/B,OAAO,IAAI,OAAO,KAAK,UAAU,QAAQ,MAAM,CAAC,IAAI,kBAAkB,QAAQ,MAAM,KAAK,CAAC;CAC1F,OAAO,OAAO,SAAS,SAAS,KAAK,OAAO,iBAAiB,SAAS,IAAI,IAAI;AAClF"}
1
+ {"version":3,"file":"cli.js","names":["readFile","extname","resolve","pathToFileURL","ThemeReport","checkTheme","Theme","USAGE","isTheme","value","tokens","ModuleImporter","url","Promise","Record","importModule","loadTheme","path","exportName","load","file","JSON","parse","href","Error","formatThemeReport","report","label","lines","checks","length","failures","unchecked","colorDifferences","forEach","check","push","scheme","padEnd","name","foreground","background","String","ratio","minimum","first","second","vision","difference","join","runCheckTheme","args","output","log","text","error","console","json","includes","exportIndex","indexOf","undefined","files","filter","arg","index","startsWith","theme","message","stringify"],"sources":["../../src/theme/cli.ts"],"sourcesContent":["// The `panneau-check-theme` command, for Node only: it is not part of the exports.\n/// <reference types=\"node\" />\nimport { readFile } from 'node:fs/promises';\nimport { extname, resolve } from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\nimport { type ThemeReport, checkTheme } from './checkTheme';\nimport type { Theme } from './theme';\n\nconst USAGE = `Usage: panneau-check-theme <file> [--export <name>] [--json]\n\nChecks the contrast of a theme, and the differences between its chart colors with color vision\ndeficiencies. <file> is a JSON file (the Theme schema of @panneau/protocol), or a module whose\ndefault export, or the export named by --export, is a theme. Exits with 1 when a check fails.`;\n\nfunction isTheme(value: unknown): value is Theme {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'tokens' in value &&\n typeof value.tokens === 'object' &&\n value.tokens !== null\n );\n}\n\n/** Loads a module from its URL: `import()`, replaced in tests. */\nexport type ModuleImporter = (url: string) => Promise<Record<string, unknown>>;\n\nconst importModule: ModuleImporter = (url) => import(url) as Promise<Record<string, unknown>>;\n\n/** Reads a theme from a JSON file or from an export of a module. */\nexport async function loadTheme(\n path: string,\n exportName = 'default',\n load: ModuleImporter = importModule,\n): Promise<Theme> {\n const file = resolve(path);\n const value: unknown =\n extname(file) === '.json'\n ? JSON.parse(await readFile(file, 'utf8'))\n : (await load(pathToFileURL(file).href))[exportName];\n if (!isTheme(value)) {\n throw new Error(\n extname(file) === '.json'\n ? `${path} is not a theme: it has no tokens.`\n : `The export \"${exportName}\" of ${path} is not a theme.`,\n );\n }\n return value;\n}\n\n/** A report as text, one line per check that failed or that Panneau couldn't read. */\nexport function formatThemeReport(report: ThemeReport, label = 'Theme'): string {\n const lines = [\n `${label}: ${report.checks.length} contrast checks, ${report.failures.length} failed, ` +\n `${report.unchecked.length} unchecked, ${report.colorDifferences.length} similar chart colors.`,\n ];\n report.failures.forEach((check) => {\n lines.push(\n ` fail ${check.scheme.padEnd(5)} ${check.name}: ${check.foreground} on ` +\n `${check.background}, ${String(check.ratio)}:1 < ${String(check.minimum)}:1`,\n );\n });\n report.colorDifferences.forEach((check) => {\n lines.push(\n ` similar ${check.scheme.padEnd(5)} chart colors ${check.first} and ` +\n `${check.second} with ${check.vision}: ${String(check.difference)} < ${String(check.minimum)}`,\n );\n });\n report.unchecked.forEach((check) => {\n lines.push(\n ` unchecked ${check.scheme.padEnd(5)} ${check.name}: ${check.foreground} on ` +\n `${check.background} (check it in a browser)`,\n );\n });\n return lines.join('\\n');\n}\n\n/** Runs `panneau-check-theme` with its arguments, and returns the exit code. */\nexport async function runCheckTheme(\n args: readonly string[],\n output: { log: (text: string) => void; error: (text: string) => void } = console,\n load: ModuleImporter = importModule,\n): Promise<number> {\n const json = args.includes('--json');\n const exportIndex = args.indexOf('--export');\n const exportName = exportIndex >= 0 ? args[exportIndex + 1] : undefined;\n const files = args.filter(\n (arg, index) => !arg.startsWith('--') && (exportIndex < 0 || index !== exportIndex + 1),\n );\n const [file] = files;\n if (file === undefined || files.length > 1 || args.includes('--help')) {\n output.error(USAGE);\n return args.includes('--help') ? 0 : 2;\n }\n let theme: Theme;\n try {\n theme = await loadTheme(file, exportName, load);\n } catch (error) {\n output.error(error instanceof Error ? error.message : String(error));\n return 2;\n }\n const report = checkTheme(theme);\n output.log(json ? JSON.stringify(report, null, 2) : formatThemeReport(report, theme.label));\n return report.failures.length > 0 || report.colorDifferences.length > 0 ? 1 : 0;\n}\n"],"mappings":";;;;;AASA,IAAMO,QAAQ;;;;;AAMd,SAASC,QAAQC,OAAgC;CAC7C,OACI,OAAOA,UAAU,YACjBA,UAAU,QACV,YAAYA,SACZ,OAAOA,MAAMC,WAAW,YACxBD,MAAMC,WAAW;AAEzB;AAKA,IAAMK,gBAAgCH,QAAQ,OAAOA;;AAGrD,eAAsBI,UAClBC,MACAC,aAAa,WACbC,OAAuBJ,cACT;CACd,MAAMK,OAAOlB,QAAQe,IAAI;CACzB,MAAMR,QACFR,QAAQmB,IAAI,MAAM,UACZC,KAAKC,MAAM,MAAMtB,SAASoB,MAAM,MAAM,CAAC,KACtC,MAAMD,KAAKhB,cAAciB,IAAI,CAAC,CAACG,IAAI,EAAA,CAAGL;CACjD,IAAI,CAACV,QAAQC,KAAK,GACd,MAAM,IAAIe,MACNvB,QAAQmB,IAAI,MAAM,UACZ,GAAGH,KAAI,sCACP,eAAeC,WAAU,OAAQD,KAAI,iBAC/C;CAEJ,OAAOR;AACX;;AAGA,SAAgBgB,kBAAkBC,QAAqBC,QAAQ,SAAiB;CAC5E,MAAMC,QAAQ,CACV,GAAGD,MAAK,IAAKD,OAAOG,OAAOC,OAAM,oBAAqBJ,OAAOK,SAASD,OAAM,WACrEJ,OAAOM,UAAUF,OAAM,cAAeJ,OAAOO,iBAAiBH,OAAM,uBAAwB;CAEvGJ,OAAOK,SAASG,SAASC,UAAU;EAC/BP,MAAMQ,KACF,gBAAgBD,MAAME,OAAOC,OAAO,CAAC,EAAC,IAAKH,MAAMI,KAAI,IAAKJ,MAAMK,WA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AOa,KAAK,CAAC;EACnE,OAAO;CACX;CACA,MAAM7B,SAASrB,WAAW8D,KAAK;CAC/Bf,OAAOC,IAAII,OAAOpC,KAAKgD,UAAU3C,QAAQ,MAAM,CAAC,IAAID,kBAAkBC,QAAQyC,MAAMxC,KAAK,CAAC;CAC1F,OAAOD,OAAOK,SAASD,SAAS,KAAKJ,OAAOO,iBAAiBH,SAAS,IAAI,IAAI;AAClF"}
@@ -1 +1 @@
1
- {"version":3,"file":"color.js","names":[],"sources":["../../src/theme/color.ts"],"sourcesContent":["/** An sRGB color, with channels from 0 to 255. */\nexport interface Rgb {\n r: number;\n g: number;\n b: number;\n}\n\nconst HEX = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;\nconst RGB =\n /^rgba?\\(\\s*(\\d+(?:\\.\\d+)?)[\\s,]+(\\d+(?:\\.\\d+)?)[\\s,]+(\\d+(?:\\.\\d+)?)\\s*(?:[,/]\\s*[\\d.]+%?\\s*)?\\)$/i;\n\n/**\n * Reads a hex (`#05f`, `#0055ff`) or `rgb()` color. Returns `null` for anything else (a CSS\n * variable, a named color, `color-mix()`), which Panneau can't compute with.\n */\nexport function parseColor(value: string): Rgb | null {\n const color = value.trim();\n const hex = HEX.exec(color);\n if (hex?.[1] !== undefined) {\n const digits =\n hex[1].length === 3 ? [...hex[1]].map((digit) => digit + digit).join('') : hex[1];\n return {\n r: Number.parseInt(digits.slice(0, 2), 16),\n g: Number.parseInt(digits.slice(2, 4), 16),\n b: Number.parseInt(digits.slice(4, 6), 16),\n };\n }\n const rgb = RGB.exec(color);\n if (rgb !== null) {\n const [r, g, b] = [rgb[1], rgb[2], rgb[3]].map((channel) =>\n Math.min(255, Math.max(0, Number(channel))),\n );\n return { r: r ?? 0, g: g ?? 0, b: b ?? 0 };\n }\n return null;\n}\n\n/** A color as `#rrggbb`. */\nexport function toHex({ r, g, b }: Rgb): string {\n return `#${[r, g, b]\n .map((channel) => Math.round(channel).toString(16).padStart(2, '0'))\n .join('')}`;\n}\n\n/** Mixes two colors in sRGB, like `color-mix(in srgb, a, b <amount>)`: 0 gives `a`, 1 gives `b`. */\nexport function mixColors(a: Rgb, b: Rgb, amount: number): Rgb {\n return {\n r: a.r + (b.r - a.r) * amount,\n g: a.g + (b.g - a.g) * amount,\n b: a.b + (b.b - a.b) * amount,\n };\n}\n\nfunction linear(channel: number): number {\n const value = channel / 255;\n return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;\n}\n\n/** Relative luminance, as defined by WCAG 2. */\nexport function luminance({ r, g, b }: Rgb): number {\n return 0.2126 * linear(r) + 0.7152 * linear(g) + 0.0722 * linear(b);\n}\n\n/** Contrast ratio between two colors, from 1 to 21 (WCAG 2). */\nexport function contrastRatio(a: Rgb, b: Rgb): number {\n const [light, dark] = [luminance(a), luminance(b)].sort((x, y) => y - x) as [number, number];\n return (light + 0.05) / (dark + 0.05);\n}\n\nexport const WHITE: Rgb = { r: 255, g: 255, b: 255 };\nexport const BLACK: Rgb = { r: 0, g: 0, b: 0 };\n\n/**\n * The closest color to `color` that reaches `ratio` against `background`, by mixing it with black\n * or white (whichever moves away from the background), like Bootstrap's shade and tint. Returns\n * the color itself when it already passes.\n */\nexport function ensureContrast(color: Rgb, background: Rgb, ratio: number): Rgb {\n if (contrastRatio(color, background) >= ratio) {\n return color;\n }\n const target = luminance(background) > 0.18 ? BLACK : WHITE;\n for (let step = 1; step <= 20; step += 1) {\n const mixed = mixColors(color, target, step / 20);\n if (contrastRatio(mixed, background) >= ratio) {\n return mixed;\n }\n }\n return target;\n}\n\n/** White or black, whichever reads better on `background`, like Bootstrap's `color-contrast()`. */\nexport function readableTextColor(background: Rgb): Rgb {\n return contrastRatio(WHITE, background) >= contrastRatio(BLACK, background) ? WHITE : BLACK;\n}\n"],"mappings":";AAOA,IAAM,MAAM;AACZ,IAAM,MACF;;;;;AAMJ,SAAgB,WAAW,OAA2B;CAClD,MAAM,QAAQ,MAAM,KAAK;CACzB,MAAM,MAAM,IAAI,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AQ,UAAU,QAAQ,QAAS,UAAU;AAC3E;;AAGA,SAAgB,UAAU,EAAE,GAAG,GAAG,KAAkB;CAChD,OAAO,QAAS,OAAO,CAAC,IAAI,QAAS,OAAO,CAAC,IAAI,QAAS,OAAO,CAAC;AACtE;;AAGA,SAAgB,cAAc,GAAQ,GAAgB;CAClD,MAAM,CAAC,OAAO,QAAQ,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC;CACvE,QAAQ,QAAQ,QAAS,OAAO;AACpC;AAEA,IAAa,QAAa;CAAE,GAAG;CAAK,GAAG;CAAK,GAAG;AAAI;AACnD,IAAa,QAAa;CAAE,GAAG;CAAG,GAAG;CAAG,GAAG;AAAE;;;;;;AAO7C,SAAgB,eAAe,OAAY,YAAiB,OAAoB;CAC5E,IAAI,cAAc,OAAO,UAAU,KAAK,OACpC,OAAO;CAEX,MAAM,SAAS,UAAU,UAAU,IAAI,MAAO,QAAQ;CACtD,KAAK,IAAI,OAAO,GAAG,QAAQ,IAAI,QAAQ,GAAG;EACtC,MAAM,QAAQ,UAAU,OAAO,QAAQ,OAAO,EAAE;EAChD,IAAI,cAAc,OAAO,UAAU,KAAK,OACpC,OAAO;CAEf;CACA,OAAO;AACX;;AAGA,SAAgB,kBAAkB,YAAsB;CACpD,OAAO,cAAc,OAAO,UAAU,KAAK,cAAc,OAAO,UAAU,IAAI,QAAQ;AAC1F"}
1
+ {"version":3,"file":"color.js","names":["Rgb","r","g","b","HEX","RGB","parseColor","value","color","trim","hex","exec","undefined","digits","length","map","digit","join","Number","parseInt","slice","rgb","channel","Math","min","max","toHex","round","toString","padStart","mixColors","a","amount","linear","luminance","contrastRatio","light","dark","sort","x","y","WHITE","BLACK","ensureContrast","background","ratio","target","step","mixed","readableTextColor"],"sources":["../../src/theme/color.ts"],"sourcesContent":["/** An sRGB color, with channels from 0 to 255. */\nexport interface Rgb {\n r: number;\n g: number;\n b: number;\n}\n\nconst HEX = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;\nconst RGB =\n /^rgba?\\(\\s*(\\d+(?:\\.\\d+)?)[\\s,]+(\\d+(?:\\.\\d+)?)[\\s,]+(\\d+(?:\\.\\d+)?)\\s*(?:[,/]\\s*[\\d.]+%?\\s*)?\\)$/i;\n\n/**\n * Reads a hex (`#05f`, `#0055ff`) or `rgb()` color. Returns `null` for anything else (a CSS\n * variable, a named color, `color-mix()`), which Panneau can't compute with.\n */\nexport function parseColor(value: string): Rgb | null {\n const color = value.trim();\n const hex = HEX.exec(color);\n if (hex?.[1] !== undefined) {\n const digits =\n hex[1].length === 3 ? [...hex[1]].map((digit) => digit + digit).join('') : hex[1];\n return {\n r: Number.parseInt(digits.slice(0, 2), 16),\n g: Number.parseInt(digits.slice(2, 4), 16),\n b: Number.parseInt(digits.slice(4, 6), 16),\n };\n }\n const rgb = RGB.exec(color);\n if (rgb !== null) {\n const [r, g, b] = [rgb[1], rgb[2], rgb[3]].map((channel) =>\n Math.min(255, Math.max(0, Number(channel))),\n );\n return { r: r ?? 0, g: g ?? 0, b: b ?? 0 };\n }\n return null;\n}\n\n/** A color as `#rrggbb`. */\nexport function toHex({ r, g, b }: Rgb): string {\n return `#${[r, g, b]\n .map((channel) => Math.round(channel).toString(16).padStart(2, '0'))\n .join('')}`;\n}\n\n/** Mixes two colors in sRGB, like `color-mix(in srgb, a, b <amount>)`: 0 gives `a`, 1 gives `b`. */\nexport function mixColors(a: Rgb, b: Rgb, amount: number): Rgb {\n return {\n r: a.r + (b.r - a.r) * amount,\n g: a.g + (b.g - a.g) * amount,\n b: a.b + (b.b - a.b) * amount,\n };\n}\n\nfunction linear(channel: number): number {\n const value = channel / 255;\n return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;\n}\n\n/** Relative luminance, as defined by WCAG 2. */\nexport function luminance({ r, g, b }: Rgb): number {\n return 0.2126 * linear(r) + 0.7152 * linear(g) + 0.0722 * linear(b);\n}\n\n/** Contrast ratio between two colors, from 1 to 21 (WCAG 2). */\nexport function contrastRatio(a: Rgb, b: Rgb): number {\n const [light, dark] = [luminance(a), luminance(b)].sort((x, y) => y - x) as [number, number];\n return (light + 0.05) / (dark + 0.05);\n}\n\nexport const WHITE: Rgb = { r: 255, g: 255, b: 255 };\nexport const BLACK: Rgb = { r: 0, g: 0, b: 0 };\n\n/**\n * The closest color to `color` that reaches `ratio` against `background`, by mixing it with black\n * or white (whichever moves away from the background), like Bootstrap's shade and tint. Returns\n * the color itself when it already passes.\n */\nexport function ensureContrast(color: Rgb, background: Rgb, ratio: number): Rgb {\n if (contrastRatio(color, background) >= ratio) {\n return color;\n }\n const target = luminance(background) > 0.18 ? BLACK : WHITE;\n for (let step = 1; step <= 20; step += 1) {\n const mixed = mixColors(color, target, step / 20);\n if (contrastRatio(mixed, background) >= ratio) {\n return mixed;\n }\n }\n return target;\n}\n\n/** White or black, whichever reads better on `background`, like Bootstrap's `color-contrast()`. */\nexport function readableTextColor(background: Rgb): Rgb {\n return contrastRatio(WHITE, background) >= contrastRatio(BLACK, background) ? WHITE : BLACK;\n}\n"],"mappings":";AAOA,IAAMI,MAAM;AACZ,IAAMC,MACF;;;;;AAMJ,SAAgBC,WAAWC,OAA2B;CAClD,MAAMC,QAAQD,MAAME,KAAK;CACzB,MAAMC,MAAMN,IAAIO,KAAKH,KAAK;CAC1B,IAAIE,MAAM,OAAOE,KAAAA,GAAW;EACxB,MAAMC,SACFH,IAAI,EAAE,CAACI,WAAW,IAAI,CAAC,GAAGJ,IAAI,EAAE,CAAC,CAACK,KAAKC,UAAUA,QAAQA,KAAK,CAAC,CAACC,KAAK,EAAE,IAAIP,IAAI;EACnF,OAAO;GACHT,GAAGiB,OAAOC,SAASN,OAAOO,MAAM,GAAG,CAAC,GAAG,EAAE;GACzClB,GAAGgB,OAAOC,SAASN,OAAOO,MAAM,GAAG,CAAC,GAAG,EAAE;GACzCjB,GAAGe,OAAOC,SAASN,OAAOO,MAAM,GAAG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QAAQ,CAACH,UAAUH,CAAC,GAAGG,UAAU/B,CAAC,CAAC,CAAC,CAACmC,MAAMC,GAAGC,MAAMA,IAAID,CAAC;CACvE,QAAQH,QAAQ,QAASC,OAAO;AACpC;AAEA,IAAaI,QAAa;CAAExC,GAAG;CAAKC,GAAG;CAAKC,GAAG;AAAI;AACnD,IAAauC,QAAa;CAAEzC,GAAG;CAAGC,GAAG;CAAGC,GAAG;AAAE;;;;;;AAO7C,SAAgBwC,eAAenC,OAAYoC,YAAiBC,OAAoB;CAC5E,IAAIV,cAAc3B,OAAOoC,UAAU,KAAKC,OACpC,OAAOrC;CAEX,MAAMsC,SAASZ,UAAUU,UAAU,IAAI,MAAOF,QAAQD;CACtD,KAAK,IAAIM,OAAO,GAAGA,QAAQ,IAAIA,QAAQ,GAAG;EACtC,MAAMC,QAAQlB,UAAUtB,OAAOsC,QAAQC,OAAO,EAAE;EAChD,IAAIZ,cAAca,OAAOJ,UAAU,KAAKC,OACpC,OAAOG;CAEf;CACA,OAAOF;AACX;;AAGA,SAAgBG,kBAAkBL,YAAsB;CACpD,OAAOT,cAAcM,OAAOG,UAAU,KAAKT,cAAcO,OAAOE,UAAU,IAAIH,QAAQC;AAC1F"}
@@ -1,4 +1,4 @@
1
- import { type Rgb } from './color';
1
+ import { type Rgb } from './color.js';
2
2
  /** A color vision deficiency, at full severity: red-blind, green-blind or blue-blind. */
3
3
  export type ColorVisionDeficiency = 'protanopia' | 'deuteranopia' | 'tritanopia';
4
4
  /** A color as a person with a color vision deficiency sees it. */
@@ -1 +1 @@
1
- {"version":3,"file":"colorVision.js","names":[],"sources":["../../src/theme/colorVision.ts"],"sourcesContent":["import { type Rgb, parseColor } from './color';\n\n/** A color vision deficiency, at full severity: red-blind, green-blind or blue-blind. */\nexport type ColorVisionDeficiency = 'protanopia' | 'deuteranopia' | 'tritanopia';\n\n/** Simulation matrices of Machado, Oliveira and Fernandes (2009), severity 1, on linear RGB. */\nconst MATRICES: Record<ColorVisionDeficiency, readonly (readonly number[])[]> = {\n protanopia: [\n [0.152286, 1.052583, -0.204868],\n [0.114503, 0.786281, 0.099216],\n [-0.003882, -0.048116, 1.051998],\n ],\n deuteranopia: [\n [0.367322, 0.860646, -0.227968],\n [0.280085, 0.672501, 0.047413],\n [-0.01182, 0.04294, 0.968881],\n ],\n tritanopia: [\n [1.255528, -0.076749, -0.178779],\n [-0.078411, 0.930809, 0.147602],\n [0.004733, 0.691367, 0.3039],\n ],\n};\n\nconst toLinear = (channel: number) => {\n const value = channel / 255;\n return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;\n};\n\nconst fromLinear = (value: number) => {\n const clamped = Math.min(1, Math.max(0, value));\n return (clamped <= 0.0031308 ? clamped * 12.92 : 1.055 * clamped ** (1 / 2.4) - 0.055) * 255;\n};\n\n/** A color as a person with a color vision deficiency sees it. */\nexport function simulateColorVision(color: Rgb, deficiency: ColorVisionDeficiency): Rgb {\n const linear = [toLinear(color.r), toLinear(color.g), toLinear(color.b)];\n const [r = 0, g = 0, b = 0] = MATRICES[deficiency].map((row) =>\n fromLinear(row.reduce((sum, weight, index) => sum + weight * (linear[index] ?? 0), 0)),\n );\n return { r, g, b };\n}\n\nfunction toLab(color: Rgb): [number, number, number] {\n const [r, g, b] = [toLinear(color.r), toLinear(color.g), toLinear(color.b)];\n const f = (t: number) => (t > 0.008856 ? Math.cbrt(t) : 7.787 * t + 16 / 116);\n const x = f((0.4124 * r + 0.3576 * g + 0.1805 * b) / 0.95047);\n const y = f(0.2126 * r + 0.7152 * g + 0.0722 * b);\n const z = f((0.0193 * r + 0.1192 * g + 0.9505 * b) / 1.08883);\n return [116 * y - 16, 500 * (x - y), 200 * (y - z)];\n}\n\n/** The perceived difference between two colors: the CIE76 distance in CIELAB. */\nexport function colorDifference(first: Rgb, second: Rgb): number {\n const [l1, a1, b1] = toLab(first);\n const [l2, a2, b2] = toLab(second);\n return Math.hypot(l1 - l2, a1 - a2, b1 - b2);\n}\n\n/** Two colors of a palette that look too alike, for everyone or with a deficiency. */\nexport interface ColorDifferenceCheck {\n vision: 'typical' | ColorVisionDeficiency;\n first: string;\n second: string;\n difference: number;\n minimum: number;\n}\n\n/**\n * Checks that the colors of a palette (the categorical colors of charts) stay distinct, for\n * typical vision and under protanopia, deuteranopia and tritanopia: every pair must differ by at\n * least `minimum` (CIE76, 10 by default, a difference anyone notices side by side). Colors Panneau\n * can't read are skipped. Returns the pairs below the minimum.\n */\nexport function checkColorDifferences(\n colors: readonly string[],\n minimum = 10,\n): ColorDifferenceCheck[] {\n const parsed = colors.flatMap((color) => {\n const rgb = parseColor(color);\n return rgb !== null ? [{ color, rgb }] : [];\n });\n const visions = ['typical', 'protanopia', 'deuteranopia', 'tritanopia'] as const;\n return visions.flatMap((vision) => {\n const seen = parsed.map(({ color, rgb }) => ({\n color,\n rgb: vision === 'typical' ? rgb : simulateColorVision(rgb, vision),\n }));\n return seen.flatMap((first, index) =>\n seen.slice(index + 1).flatMap((second) => {\n const difference = Math.round(colorDifference(first.rgb, second.rgb) * 10) / 10;\n return difference < minimum\n ? [{ vision, first: first.color, second: second.color, difference, minimum }]\n : [];\n }),\n );\n });\n}\n"],"mappings":";;;AAMA,IAAM,WAA0E;CAC5E,YAAY;EACR;GAAC;GAAU;GAAU;EAAS;EAC9B;GAAC;GAAU;GAAU;EAAQ;EAC7B;GAAC;GAAW;GAAW;EAAQ;CAAC;CAEpC,cAAc;EACV;GAAC;GAAU;GAAU;EAAS;EAC9B;GAAC;GAAU;GAAU;EAAQ;EAC7B;GAAC;GAAU;GAAS;EAAQ;CAAC;CAEjC,YAAY;EACR;GAAC;GAAU;GAAW;EAAS;EAC/B;GAAC;GAAW;GAAU;EAAQ;EAC9B;GAAC;GAAU;GAAU;EAAM;CAAC;AAEpC;AAEA,IAAM,YAAY,YAAoB;CAClC,MAAM,QAAQ,UAAU;CACxB,OAAO,SAAS,SAAU,QAAQ,UAAU,QAAQ,QAAS,UAAU;AAC3E;AAEA,IAAM,cAAc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ACY;CACtB,MAAM,SAAS,OAAO,SAAS,UAAU;EACrC,MAAM,MAAM,WAAW,KAAK;EAC5B,OAAO,QAAQ,OAAO,CAAC;GAAE;GAAO;EAAI,CAAC,IAAI,CAAA;CAC7C,CAAC;CAED,OAAO;EADU;EAAW;EAAc;EAAgB;CACnD,CAAA,CAAQ,SAAS,WAAW;EAC/B,MAAM,OAAO,OAAO,KAAK,EAAE,OAAO,WAAW;GACzC;GACA,KAAK,WAAW,YAAY,MAAM,oBAAoB,KAAK,MAAM;EACrE,EAAE;EACF,OAAO,KAAK,SAAS,OAAO,UACxB,KAAK,MAAM,QAAQ,CAAC,CAAC,CAAC,SAAS,WAAW;GACtC,MAAM,aAAa,KAAK,MAAM,gBAAgB,MAAM,KAAK,OAAO,GAAG,IAAI,EAAE,IAAI;GAC7E,OAAO,aAAa,UACd,CAAC;IAAE;IAAQ,OAAO,MAAM;IAAO,QAAQ,OAAO;IAAO;IAAY;GAAQ,CAAC,IAC1E,CAAA;EACV,CAAC,CACL;CACJ,CAAC;AACL"}
1
+ {"version":3,"file":"colorVision.js","names":["Rgb","parseColor","ColorVisionDeficiency","MATRICES","Record","protanopia","deuteranopia","tritanopia","toLinear","channel","value","fromLinear","clamped","Math","min","max","simulateColorVision","color","deficiency","linear","r","g","b","map","row","reduce","sum","weight","index","toLab","f","t","cbrt","x","y","z","colorDifference","first","second","l1","a1","b1","l2","a2","b2","hypot","ColorDifferenceCheck","vision","difference","minimum","checkColorDifferences","colors","parsed","flatMap","rgb","visions","const","seen","slice","round"],"sources":["../../src/theme/colorVision.ts"],"sourcesContent":["import { type Rgb, parseColor } from './color';\n\n/** A color vision deficiency, at full severity: red-blind, green-blind or blue-blind. */\nexport type ColorVisionDeficiency = 'protanopia' | 'deuteranopia' | 'tritanopia';\n\n/** Simulation matrices of Machado, Oliveira and Fernandes (2009), severity 1, on linear RGB. */\nconst MATRICES: Record<ColorVisionDeficiency, readonly (readonly number[])[]> = {\n protanopia: [\n [0.152286, 1.052583, -0.204868],\n [0.114503, 0.786281, 0.099216],\n [-0.003882, -0.048116, 1.051998],\n ],\n deuteranopia: [\n [0.367322, 0.860646, -0.227968],\n [0.280085, 0.672501, 0.047413],\n [-0.01182, 0.04294, 0.968881],\n ],\n tritanopia: [\n [1.255528, -0.076749, -0.178779],\n [-0.078411, 0.930809, 0.147602],\n [0.004733, 0.691367, 0.3039],\n ],\n};\n\nconst toLinear = (channel: number) => {\n const value = channel / 255;\n return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;\n};\n\nconst fromLinear = (value: number) => {\n const clamped = Math.min(1, Math.max(0, value));\n return (clamped <= 0.0031308 ? clamped * 12.92 : 1.055 * clamped ** (1 / 2.4) - 0.055) * 255;\n};\n\n/** A color as a person with a color vision deficiency sees it. */\nexport function simulateColorVision(color: Rgb, deficiency: ColorVisionDeficiency): Rgb {\n const linear = [toLinear(color.r), toLinear(color.g), toLinear(color.b)];\n const [r = 0, g = 0, b = 0] = MATRICES[deficiency].map((row) =>\n fromLinear(row.reduce((sum, weight, index) => sum + weight * (linear[index] ?? 0), 0)),\n );\n return { r, g, b };\n}\n\nfunction toLab(color: Rgb): [number, number, number] {\n const [r, g, b] = [toLinear(color.r), toLinear(color.g), toLinear(color.b)];\n const f = (t: number) => (t > 0.008856 ? Math.cbrt(t) : 7.787 * t + 16 / 116);\n const x = f((0.4124 * r + 0.3576 * g + 0.1805 * b) / 0.95047);\n const y = f(0.2126 * r + 0.7152 * g + 0.0722 * b);\n const z = f((0.0193 * r + 0.1192 * g + 0.9505 * b) / 1.08883);\n return [116 * y - 16, 500 * (x - y), 200 * (y - z)];\n}\n\n/** The perceived difference between two colors: the CIE76 distance in CIELAB. */\nexport function colorDifference(first: Rgb, second: Rgb): number {\n const [l1, a1, b1] = toLab(first);\n const [l2, a2, b2] = toLab(second);\n return Math.hypot(l1 - l2, a1 - a2, b1 - b2);\n}\n\n/** Two colors of a palette that look too alike, for everyone or with a deficiency. */\nexport interface ColorDifferenceCheck {\n vision: 'typical' | ColorVisionDeficiency;\n first: string;\n second: string;\n difference: number;\n minimum: number;\n}\n\n/**\n * Checks that the colors of a palette (the categorical colors of charts) stay distinct, for\n * typical vision and under protanopia, deuteranopia and tritanopia: every pair must differ by at\n * least `minimum` (CIE76, 10 by default, a difference anyone notices side by side). Colors Panneau\n * can't read are skipped. Returns the pairs below the minimum.\n */\nexport function checkColorDifferences(\n colors: readonly string[],\n minimum = 10,\n): ColorDifferenceCheck[] {\n const parsed = colors.flatMap((color) => {\n const rgb = parseColor(color);\n return rgb !== null ? [{ color, rgb }] : [];\n });\n const visions = ['typical', 'protanopia', 'deuteranopia', 'tritanopia'] as const;\n return visions.flatMap((vision) => {\n const seen = parsed.map(({ color, rgb }) => ({\n color,\n rgb: vision === 'typical' ? rgb : simulateColorVision(rgb, vision),\n }));\n return seen.flatMap((first, index) =>\n seen.slice(index + 1).flatMap((second) => {\n const difference = Math.round(colorDifference(first.rgb, second.rgb) * 10) / 10;\n return difference < minimum\n ? [{ vision, first: first.color, second: second.color, difference, minimum }]\n : [];\n }),\n );\n });\n}\n"],"mappings":";;;AAMA,IAAMG,WAA0E;CAC5EE,YAAY;EACR;GAAC;GAAU;GAAU;EAAS;EAC9B;GAAC;GAAU;GAAU;EAAQ;EAC7B;GAAC;GAAW;GAAW;EAAQ;CAAC;CAEpCC,cAAc;EACV;GAAC;GAAU;GAAU;EAAS;EAC9B;GAAC;GAAU;GAAU;EAAQ;EAC7B;GAAC;GAAU;GAAS;EAAQ;CAAC;CAEjCC,YAAY;EACR;GAAC;GAAU;GAAW;EAAS;EAC/B;GAAC;GAAW;GAAU;EAAQ;EAC9B;GAAC;GAAU;GAAU;EAAM;CAAC;AAEpC;AAEA,IAAMC,YAAYC,YAAoB;CAClC,MAAMC,QAAQD,UAAU;CACxB,OAAOC,SAAS,SAAUA,QAAQ,UAAUA,QAAQ,QAAS,UAAU;AAC3E;AAEA,IAAMC,cAAcD,UAAkB;CAClC,MAAME,UAAUC,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AKG,IAAIF,KAAKG,EAAE;AAC/C;;;;;;;AAiBA,SAAgBM,sBACZC,QACAF,UAAU,IACY;CACtB,MAAMG,SAASD,OAAOE,SAASpC,UAAU;EACrC,MAAMqC,MAAMrD,WAAWgB,KAAK;EAC5B,OAAOqC,QAAQ,OAAO,CAAC;GAAErC;GAAOqC;EAAI,CAAC,IAAI,CAAA;CAC7C,CAAC;CAED,OAAOC;EADU;EAAW;EAAc;EAAgB;CACnDA,CAAAA,CAAQF,SAASN,WAAW;EAC/B,MAAMU,OAAOL,OAAO7B,KAAK,EAAEN,OAAOqC,WAAW;GACzCrC;GACAqC,KAAKP,WAAW,YAAYO,MAAMtC,oBAAoBsC,KAAKP,MAAM;EACrE,EAAE;EACF,OAAOU,KAAKJ,SAAShB,OAAOT,UACxB6B,KAAKC,MAAM9B,QAAQ,CAAC,CAAC,CAACyB,SAASf,WAAW;GACtC,MAAMU,aAAanC,KAAK8C,MAAMvB,gBAAgBC,MAAMiB,KAAKhB,OAAOgB,GAAG,IAAI,EAAE,IAAI;GAC7E,OAAON,aAAaC,UACd,CAAC;IAAEF;IAAQV,OAAOA,MAAMpB;IAAOqB,QAAQA,OAAOrB;IAAO+B;IAAYC;GAAQ,CAAC,IAC1E,CAAA;EACV,CAAC,CACL;CACJ,CAAC;AACL"}
@@ -1 +1 @@
1
- {"version":3,"file":"componentTokens.js","names":[],"sources":["../../src/theme/componentTokens.ts"],"sourcesContent":["/**\n * The tokens of one component: CSS variables named `--panneau-<component>-<token>`, with their\n * default values (decision 0024).\n */\nexport interface ComponentTokens<Component extends string = string, Name extends string = string> {\n /**\n * The component or the part it styles, as in its `panneau-<component>` class (`button`,\n * `badge`), or a part shared by several components (`input`, `field`, `list-box`, `calendar`).\n */\n readonly component: Component;\n /** Default values, keyed by token name without the leading `--`: `panneau-button-radius`. */\n readonly tokens: Readonly<Record<Name, string>>;\n}\n\n/**\n * Declares the tokens of a component, as `{ <token>: <default> }`. Each token becomes the CSS\n * variable `--panneau-<component>-<token>`.\n *\n * The component's CSS reads every token with its default as the fallback,\n * `var(--panneau-button-radius, var(--panneau-radius-md))`, and never declares it: a value set by a\n * theme, a scope or any ancestor element then reaches the component, and semantic tokens resolve\n * where the component is. A test checks that the CSS and this declaration agree.\n */\nexport function defineComponentTokens<\n const Component extends string,\n const Tokens extends Record<string, string>,\n>(\n component: Component,\n tokens: Tokens,\n): ComponentTokens<Component, `panneau-${Component}-${keyof Tokens & string}`> {\n return {\n component,\n tokens: Object.freeze(\n Object.fromEntries(\n Object.entries(tokens).map(([name, value]) => [\n `panneau-${component}-${name}`,\n value,\n ]),\n ),\n ) as Record<`panneau-${Component}-${keyof Tokens & string}`, string>,\n };\n}\n"],"mappings":";;;;;;;;;;AAuBA,SAAgB,sBAIZ,WACA,QAC2E;CAC3E,OAAO;EACH;EACA,QAAQ,OAAO,OACX,OAAO,YACH,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,WAAW,CAC1C,WAAW,UAAS,GAAI,QACxB,KAAK,CACR,CACL,CACJ;CACJ;AACJ"}
1
+ {"version":3,"file":"componentTokens.js","names":["ComponentTokens","component","Component","tokens","Readonly","Record","Name","defineComponentTokens","Tokens","Object","freeze","fromEntries","entries","map","name","value"],"sources":["../../src/theme/componentTokens.ts"],"sourcesContent":["/**\n * The tokens of one component: CSS variables named `--panneau-<component>-<token>`, with their\n * default values (decision 0024).\n */\nexport interface ComponentTokens<Component extends string = string, Name extends string = string> {\n /**\n * The component or the part it styles, as in its `panneau-<component>` class (`button`,\n * `badge`), or a part shared by several components (`input`, `field`, `list-box`, `calendar`).\n */\n readonly component: Component;\n /** Default values, keyed by token name without the leading `--`: `panneau-button-radius`. */\n readonly tokens: Readonly<Record<Name, string>>;\n}\n\n/**\n * Declares the tokens of a component, as `{ <token>: <default> }`. Each token becomes the CSS\n * variable `--panneau-<component>-<token>`.\n *\n * The component's CSS reads every token with its default as the fallback,\n * `var(--panneau-button-radius, var(--panneau-radius-md))`, and never declares it: a value set by a\n * theme, a scope or any ancestor element then reaches the component, and semantic tokens resolve\n * where the component is. A test checks that the CSS and this declaration agree.\n */\nexport function defineComponentTokens<\n const Component extends string,\n const Tokens extends Record<string, string>,\n>(\n component: Component,\n tokens: Tokens,\n): ComponentTokens<Component, `panneau-${Component}-${keyof Tokens & string}`> {\n return {\n component,\n tokens: Object.freeze(\n Object.fromEntries(\n Object.entries(tokens).map(([name, value]) => [\n `panneau-${component}-${name}`,\n value,\n ]),\n ),\n ) as Record<`panneau-${Component}-${keyof Tokens & string}`, string>,\n };\n}\n"],"mappings":";;;;;;;;;;AAuBA,SAAgBO,sBAIZN,WACAE,QAC2E;CAC3E,OAAO;EACHF;EACAE,QAAQM,OAAOC,OACXD,OAAOE,YACHF,OAAOG,QAAQT,MAAM,CAAC,CAACU,KAAK,CAACC,MAAMC,WAAW,CAC1C,WAAWd,UAAS,GAAIa,QACxBC,KAAK,CACR,CACL,CACJ;CACJ;AACJ"}
@@ -9,8 +9,9 @@ export declare const componentTokens: Readonly<{
9
9
  calendar: Readonly<Record<"panneau-calendar-cell-size" | "panneau-calendar-cell-radius" | "panneau-calendar-selected-color" | "panneau-calendar-selected-bg", string>>;
10
10
  card: Readonly<Record<"panneau-card-radius" | "panneau-card-gap" | "panneau-card-padding-y" | "panneau-card-padding-x" | "panneau-card-border-width" | "panneau-card-title-font-weight" | "panneau-card-bg" | "panneau-card-border-color" | "panneau-card-shadow" | "panneau-card-header-padding-y" | "panneau-card-title-font-size", string>>;
11
11
  checkbox: Readonly<Record<"panneau-checkbox-size" | "panneau-checkbox-radius" | "panneau-checkbox-bg" | "panneau-checkbox-border-color" | "panneau-checkbox-checked-color" | "panneau-checkbox-checked-bg", string>>;
12
+ 'command-palette': Readonly<Record<"panneau-command-palette-width" | "panneau-command-palette-radius" | "panneau-command-palette-bg" | "panneau-command-palette-offset-top" | "panneau-command-palette-list-max-height" | "panneau-command-palette-item-radius" | "panneau-command-palette-item-active-bg", string>>;
12
13
  container: Readonly<Record<"panneau-container-padding-x" | "panneau-container-width-sm" | "panneau-container-width-md" | "panneau-container-width-lg" | "panneau-container-width-xl", string>>;
13
- dialog: Readonly<Record<"panneau-dialog-width" | "panneau-dialog-radius" | "panneau-dialog-padding-x" | "panneau-dialog-title-font-weight" | "panneau-dialog-bg" | "panneau-dialog-shadow" | "panneau-dialog-title-font-size" | "panneau-dialog-width-sm" | "panneau-dialog-width-lg" | "panneau-dialog-backdrop", string>>;
14
+ dialog: Readonly<Record<"panneau-dialog-width" | "panneau-dialog-radius" | "panneau-dialog-padding-x" | "panneau-dialog-title-font-weight" | "panneau-dialog-bg" | "panneau-dialog-shadow" | "panneau-dialog-title-font-size" | "panneau-dialog-width-sm" | "panneau-dialog-width-lg" | "panneau-dialog-width-xl" | "panneau-dialog-backdrop", string>>;
14
15
  disclosure: Readonly<Record<"panneau-disclosure-gap" | "panneau-disclosure-title-font-weight" | "panneau-disclosure-title-font-size", string>>;
15
16
  divider: Readonly<Record<"panneau-divider-color" | "panneau-divider-width", string>>;
16
17
  field: Readonly<Record<"panneau-field-gap" | "panneau-field-label-font-size" | "panneau-field-label-font-weight", string>>;
@@ -18,13 +19,19 @@ export declare const componentTokens: Readonly<{
18
19
  heading: Readonly<Record<"panneau-heading-color" | "panneau-heading-font-family" | "panneau-heading-display-font-family" | "panneau-heading-1-font-size" | "panneau-heading-1-font-weight" | "panneau-heading-1-line-height" | "panneau-heading-1-letter-spacing" | "panneau-heading-2-font-size" | "panneau-heading-2-font-weight" | "panneau-heading-2-line-height" | "panneau-heading-2-letter-spacing" | "panneau-heading-3-font-size" | "panneau-heading-3-font-weight" | "panneau-heading-3-line-height" | "panneau-heading-3-letter-spacing" | "panneau-heading-4-font-size" | "panneau-heading-4-font-weight" | "panneau-heading-4-line-height" | "panneau-heading-4-letter-spacing" | "panneau-heading-display-1-font-size" | "panneau-heading-display-1-font-weight" | "panneau-heading-display-1-line-height" | "panneau-heading-display-1-letter-spacing" | "panneau-heading-display-2-font-size" | "panneau-heading-display-2-font-weight" | "panneau-heading-display-2-line-height" | "panneau-heading-display-2-letter-spacing", string>>;
19
20
  inline: Readonly<Record<"panneau-inline-gap", string>>;
20
21
  input: Readonly<Record<"panneau-input-radius" | "panneau-input-padding-x" | "panneau-input-border-width" | "panneau-input-bg" | "panneau-input-border-color" | "panneau-input-border-color-hover", string>>;
21
- 'list-box': Readonly<Record<"panneau-list-box-padding" | "panneau-list-box-item-padding-y" | "panneau-list-box-item-padding-x" | "panneau-list-box-item-radius" | "panneau-list-box-item-bg-hover", string>>;
22
+ 'line-chart': Readonly<Record<"panneau-line-chart-height" | "panneau-line-chart-label-font-size" | "panneau-line-chart-line-width" | "panneau-line-chart-dot-size" | "panneau-line-chart-area-opacity", string>>;
23
+ 'list-box': Readonly<Record<"panneau-list-box-padding" | "panneau-list-box-item-radius" | "panneau-list-box-item-padding-y" | "panneau-list-box-item-padding-y-described" | "panneau-list-box-item-padding-x" | "panneau-list-box-item-bg-hover", string>>;
24
+ menu: Readonly<Record<"panneau-menu-header-font-size" | "panneau-menu-header-font-weight" | "panneau-menu-header-color" | "panneau-menu-header-text-transform" | "panneau-menu-header-letter-spacing" | "panneau-menu-footer-font-size" | "panneau-menu-footer-color" | "panneau-menu-media-size" | "panneau-menu-media-size-described" | "panneau-menu-media-radius" | "panneau-menu-item-bg-selected", string>>;
22
25
  'number-input': Readonly<Record<"panneau-number-input-stepper-width", string>>;
26
+ 'pill-trigger': Readonly<Record<"panneau-pill-trigger-color" | "panneau-pill-trigger-radius" | "panneau-pill-trigger-gap" | "panneau-pill-trigger-padding-x" | "panneau-pill-trigger-font-size" | "panneau-pill-trigger-font-weight" | "panneau-pill-trigger-padding-x-sm" | "panneau-pill-trigger-font-size-sm" | "panneau-pill-trigger-bg" | "panneau-pill-trigger-border-color" | "panneau-pill-trigger-media-size" | "panneau-pill-trigger-media-radius" | "panneau-pill-trigger-bg-hover" | "panneau-pill-trigger-media-size-sm", string>>;
23
27
  popover: Readonly<Record<"panneau-popover-radius" | "panneau-popover-padding" | "panneau-popover-bg" | "panneau-popover-border-color" | "panneau-popover-shadow", string>>;
24
28
  prose: Readonly<Record<"panneau-prose-gap" | "panneau-prose-border-color" | "panneau-prose-line-height" | "panneau-prose-heading-gap" | "panneau-prose-list-indent" | "panneau-prose-link-color" | "panneau-prose-code-font-size" | "panneau-prose-code-color" | "panneau-prose-code-bg" | "panneau-prose-code-radius" | "panneau-prose-quote-border-color" | "panneau-prose-quote-color", string>>;
25
- radio: Readonly<Record<"panneau-radio-size" | "panneau-radio-bg" | "panneau-radio-border-color" | "panneau-radio-checked-color" | "panneau-radio-checked-border-width", string>>;
29
+ radio: Readonly<Record<"panneau-radio-size" | "panneau-radio-bg" | "panneau-radio-border-color" | "panneau-radio-checked-color" | "panneau-radio-media-size" | "panneau-radio-media-radius" | "panneau-radio-checked-border-width" | "panneau-radio-card-gap" | "panneau-radio-card-padding" | "panneau-radio-card-bg" | "panneau-radio-card-border-color" | "panneau-radio-card-border-color-hover" | "panneau-radio-card-border-color-selected" | "panneau-radio-card-radius" | "panneau-radio-card-label-font-weight", string>>;
30
+ 'segmented-control': Readonly<Record<"panneau-segmented-control-radius" | "panneau-segmented-control-padding" | "panneau-segmented-control-bg" | "panneau-segmented-control-border-color" | "panneau-segmented-control-segment-padding-x" | "panneau-segmented-control-segment-font-weight" | "panneau-segmented-control-segment-color" | "panneau-segmented-control-segment-color-selected" | "panneau-segmented-control-segment-bg-selected" | "panneau-segmented-control-segment-shadow-selected", string>>;
31
+ skeleton: Readonly<Record<"panneau-skeleton-color" | "panneau-skeleton-radius" | "panneau-skeleton-duration", string>>;
26
32
  spinner: Readonly<Record<"panneau-spinner-border-width", string>>;
27
33
  stack: Readonly<Record<"panneau-stack-gap", string>>;
34
+ stat: Readonly<Record<"panneau-stat-gap" | "panneau-stat-label-font-size" | "panneau-stat-value-font-family" | "panneau-stat-value-font-size" | "panneau-stat-value-font-weight" | "panneau-stat-help-font-size", string>>;
28
35
  switch: Readonly<Record<"panneau-switch-height" | "panneau-switch-width" | "panneau-switch-radius" | "panneau-switch-checked-bg" | "panneau-switch-track-bg" | "panneau-switch-thumb-size" | "panneau-switch-thumb-bg" | "panneau-switch-checked-thumb-bg", string>>;
29
36
  tabs: Readonly<Record<"panneau-tabs-gap" | "panneau-tabs-border-color" | "panneau-tabs-tab-padding-x" | "panneau-tabs-tab-font-weight" | "panneau-tabs-tab-color" | "panneau-tabs-indicator-height" | "panneau-tabs-tab-color-selected" | "panneau-tabs-indicator-color", string>>;
30
37
  text: Readonly<Record<"panneau-text-muted-color", string>>;
@@ -1 +1 @@
1
- {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/theme/components.ts"],"names":[],"mappings":"AA4BA;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4B1B,CAAC;AAEH,gFAAgF;AAChF,MAAM,MAAM,kBAAkB,GAAG;KAC5B,SAAS,IAAI,MAAM,OAAO,eAAe,GAAG,MAAM,CAAC,OAAO,eAAe,CAAC,CAAC,SAAS,CAAC;CACzF,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC"}
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/theme/components.ts"],"names":[],"mappings":"AAmCA;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmC1B,CAAC;AAEH,gFAAgF;AAChF,MAAM,MAAM,kBAAkB,GAAG;KAC5B,SAAS,IAAI,MAAM,OAAO,eAAe,GAAG,MAAM,CAAC,OAAO,eAAe,CAAC,CAAC,SAAS,CAAC;CACzF,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC"}
@@ -3,6 +3,7 @@ import { badgeTokens } from "../badge/tokens.js";
3
3
  import { buttonTokens } from "../button/tokens.js";
4
4
  import { cardTokens } from "../card/tokens.js";
5
5
  import { checkboxTokens } from "../checkbox/tokens.js";
6
+ import { commandPaletteTokens } from "../command-palette/tokens.js";
6
7
  import { containerTokens } from "../container/tokens.js";
7
8
  import { calendarTokens } from "../date-picker/calendarTokens.js";
8
9
  import { dialogTokens } from "../dialog/tokens.js";
@@ -13,13 +14,19 @@ import { fieldTokens } from "../field/tokens.js";
13
14
  import { gridTokens } from "../grid/tokens.js";
14
15
  import { headingTokens } from "../heading/tokens.js";
15
16
  import { inlineTokens } from "../inline/tokens.js";
17
+ import { lineChartTokens } from "../line-chart/tokens.js";
18
+ import { menuTokens } from "../menu/tokens.js";
16
19
  import { numberInputTokens } from "../number-input/tokens.js";
20
+ import { pillTriggerTokens } from "../pill-trigger/tokens.js";
17
21
  import { popoverTokens } from "../popover/tokens.js";
18
22
  import { proseTokens } from "../prose/tokens.js";
19
23
  import { radioTokens } from "../radio-group/tokens.js";
24
+ import { segmentedControlTokens } from "../segmented-control/tokens.js";
20
25
  import { listBoxTokens } from "../select/listBoxTokens.js";
26
+ import { skeletonTokens } from "../skeleton/tokens.js";
21
27
  import { spinnerTokens } from "../spinner/tokens.js";
22
28
  import { stackTokens } from "../stack/tokens.js";
29
+ import { statTokens } from "../stat/tokens.js";
23
30
  import { switchTokens } from "../switch/tokens.js";
24
31
  import { tabsTokens } from "../tabs/tokens.js";
25
32
  import { textTokens } from "../text/tokens.js";
@@ -37,6 +44,7 @@ var componentTokens = Object.freeze({
37
44
  calendar: calendarTokens.tokens,
38
45
  card: cardTokens.tokens,
39
46
  checkbox: checkboxTokens.tokens,
47
+ "command-palette": commandPaletteTokens.tokens,
40
48
  container: containerTokens.tokens,
41
49
  dialog: dialogTokens.tokens,
42
50
  disclosure: disclosureTokens.tokens,
@@ -46,13 +54,19 @@ var componentTokens = Object.freeze({
46
54
  heading: headingTokens.tokens,
47
55
  inline: inlineTokens.tokens,
48
56
  input: inputTokens.tokens,
57
+ "line-chart": lineChartTokens.tokens,
49
58
  "list-box": listBoxTokens.tokens,
59
+ menu: menuTokens.tokens,
50
60
  "number-input": numberInputTokens.tokens,
61
+ "pill-trigger": pillTriggerTokens.tokens,
51
62
  popover: popoverTokens.tokens,
52
63
  prose: proseTokens.tokens,
53
64
  radio: radioTokens.tokens,
65
+ "segmented-control": segmentedControlTokens.tokens,
66
+ skeleton: skeletonTokens.tokens,
54
67
  spinner: spinnerTokens.tokens,
55
68
  stack: stackTokens.tokens,
69
+ stat: statTokens.tokens,
56
70
  switch: switchTokens.tokens,
57
71
  tabs: tabsTokens.tokens,
58
72
  text: textTokens.tokens,
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","names":[],"sources":["../../src/theme/components.ts"],"sourcesContent":["import { alertTokens } from '../alert/tokens';\nimport { badgeTokens } from '../badge/tokens';\nimport { buttonTokens } from '../button/tokens';\nimport { cardTokens } from '../card/tokens';\nimport { checkboxTokens } from '../checkbox/tokens';\nimport { containerTokens } from '../container/tokens';\nimport { calendarTokens } from '../date-picker/calendarTokens';\nimport { dialogTokens } from '../dialog/tokens';\nimport { disclosureTokens } from '../disclosure/tokens';\nimport { dividerTokens } from '../divider/tokens';\nimport { inputTokens } from '../field/inputTokens';\nimport { fieldTokens } from '../field/tokens';\nimport { gridTokens } from '../grid/tokens';\nimport { headingTokens } from '../heading/tokens';\nimport { inlineTokens } from '../inline/tokens';\nimport { numberInputTokens } from '../number-input/tokens';\nimport { popoverTokens } from '../popover/tokens';\nimport { proseTokens } from '../prose/tokens';\nimport { radioTokens } from '../radio-group/tokens';\nimport { listBoxTokens } from '../select/listBoxTokens';\nimport { spinnerTokens } from '../spinner/tokens';\nimport { stackTokens } from '../stack/tokens';\nimport { switchTokens } from '../switch/tokens';\nimport { tabsTokens } from '../tabs/tokens';\nimport { textTokens } from '../text/tokens';\nimport { toastTokens } from '../toast/tokens';\nimport { tooltipTokens } from '../tooltip/tokens';\n\n/**\n * The component tokens of `@panneau/ui` and their defaults, by component: what a theme, a scope or\n * a project's CSS can set to restyle one component without touching the others (decision 0024).\n */\nexport const componentTokens = Object.freeze({\n alert: alertTokens.tokens,\n badge: badgeTokens.tokens,\n button: buttonTokens.tokens,\n calendar: calendarTokens.tokens,\n card: cardTokens.tokens,\n checkbox: checkboxTokens.tokens,\n container: containerTokens.tokens,\n dialog: dialogTokens.tokens,\n disclosure: disclosureTokens.tokens,\n divider: dividerTokens.tokens,\n field: fieldTokens.tokens,\n grid: gridTokens.tokens,\n heading: headingTokens.tokens,\n inline: inlineTokens.tokens,\n input: inputTokens.tokens,\n 'list-box': listBoxTokens.tokens,\n 'number-input': numberInputTokens.tokens,\n popover: popoverTokens.tokens,\n prose: proseTokens.tokens,\n radio: radioTokens.tokens,\n spinner: spinnerTokens.tokens,\n stack: stackTokens.tokens,\n switch: switchTokens.tokens,\n tabs: tabsTokens.tokens,\n text: textTokens.tokens,\n toast: toastTokens.tokens,\n tooltip: tooltipTokens.tokens,\n});\n\n/** The name of a component token of `@panneau/ui`, without the leading `--`. */\nexport type ComponentTokenName = {\n [Component in keyof typeof componentTokens]: keyof (typeof componentTokens)[Component];\n}[keyof typeof componentTokens];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAa,kBAAkB,OAAO,OAAO;CACzC,OAAO,YAAY;CACnB,OAAO,YAAY;CACnB,QAAQ,aAAa;CACrB,UAAU,eAAe;CACzB,MAAM,WAAW;CACjB,UAAU,eAAe;CACzB,WAAW,gBAAgB;CAC3B,QAAQ,aAAa;CACrB,YAAY,iBAAiB;CAC7B,SAAS,cAAc;CACvB,OAAO,YAAY;CACnB,MAAM,WAAW;CACjB,SAAS,cAAc;CACvB,QAAQ,aAAa;CACrB,OAAO,YAAY;CACnB,YAAY,cAAc;CAC1B,gBAAgB,kBAAkB;CAClC,SAAS,cAAc;CACvB,OAAO,YAAY;CACnB,OAAO,YAAY;CACnB,SAAS,cAAc;CACvB,OAAO,YAAY;CACnB,QAAQ,aAAa;CACrB,MAAM,WAAW;CACjB,MAAM,WAAW;CACjB,OAAO,YAAY;CACnB,SAAS,cAAc;AAC3B,CAAC"}
1
+ {"version":3,"file":"components.js","names":["alertTokens","badgeTokens","buttonTokens","cardTokens","checkboxTokens","commandPaletteTokens","containerTokens","calendarTokens","dialogTokens","disclosureTokens","dividerTokens","inputTokens","fieldTokens","gridTokens","headingTokens","inlineTokens","lineChartTokens","menuTokens","numberInputTokens","pillTriggerTokens","popoverTokens","proseTokens","radioTokens","segmentedControlTokens","listBoxTokens","skeletonTokens","spinnerTokens","stackTokens","statTokens","switchTokens","tabsTokens","textTokens","toastTokens","tooltipTokens","componentTokens","Object","freeze","alert","tokens","badge","button","calendar","card","checkbox","container","dialog","disclosure","divider","field","grid","heading","inline","input","menu","popover","prose","radio","skeleton","spinner","stack","stat","switch","tabs","text","toast","tooltip","ComponentTokenName","Component"],"sources":["../../src/theme/components.ts"],"sourcesContent":["import { alertTokens } from '../alert/tokens';\nimport { badgeTokens } from '../badge/tokens';\nimport { buttonTokens } from '../button/tokens';\nimport { cardTokens } from '../card/tokens';\nimport { checkboxTokens } from '../checkbox/tokens';\nimport { commandPaletteTokens } from '../command-palette/tokens';\nimport { containerTokens } from '../container/tokens';\nimport { calendarTokens } from '../date-picker/calendarTokens';\nimport { dialogTokens } from '../dialog/tokens';\nimport { disclosureTokens } from '../disclosure/tokens';\nimport { dividerTokens } from '../divider/tokens';\nimport { inputTokens } from '../field/inputTokens';\nimport { fieldTokens } from '../field/tokens';\nimport { gridTokens } from '../grid/tokens';\nimport { headingTokens } from '../heading/tokens';\nimport { inlineTokens } from '../inline/tokens';\nimport { lineChartTokens } from '../line-chart/tokens';\nimport { menuTokens } from '../menu/tokens';\nimport { numberInputTokens } from '../number-input/tokens';\nimport { pillTriggerTokens } from '../pill-trigger/tokens';\nimport { popoverTokens } from '../popover/tokens';\nimport { proseTokens } from '../prose/tokens';\nimport { radioTokens } from '../radio-group/tokens';\nimport { segmentedControlTokens } from '../segmented-control/tokens';\nimport { listBoxTokens } from '../select/listBoxTokens';\nimport { skeletonTokens } from '../skeleton/tokens';\nimport { spinnerTokens } from '../spinner/tokens';\nimport { stackTokens } from '../stack/tokens';\nimport { statTokens } from '../stat/tokens';\nimport { switchTokens } from '../switch/tokens';\nimport { tabsTokens } from '../tabs/tokens';\nimport { textTokens } from '../text/tokens';\nimport { toastTokens } from '../toast/tokens';\nimport { tooltipTokens } from '../tooltip/tokens';\n\n/**\n * The component tokens of `@panneau/ui` and their defaults, by component: what a theme, a scope or\n * a project's CSS can set to restyle one component without touching the others (decision 0024).\n */\nexport const componentTokens = Object.freeze({\n alert: alertTokens.tokens,\n badge: badgeTokens.tokens,\n button: buttonTokens.tokens,\n calendar: calendarTokens.tokens,\n card: cardTokens.tokens,\n checkbox: checkboxTokens.tokens,\n 'command-palette': commandPaletteTokens.tokens,\n container: containerTokens.tokens,\n dialog: dialogTokens.tokens,\n disclosure: disclosureTokens.tokens,\n divider: dividerTokens.tokens,\n field: fieldTokens.tokens,\n grid: gridTokens.tokens,\n heading: headingTokens.tokens,\n inline: inlineTokens.tokens,\n input: inputTokens.tokens,\n 'line-chart': lineChartTokens.tokens,\n 'list-box': listBoxTokens.tokens,\n menu: menuTokens.tokens,\n 'number-input': numberInputTokens.tokens,\n 'pill-trigger': pillTriggerTokens.tokens,\n popover: popoverTokens.tokens,\n prose: proseTokens.tokens,\n radio: radioTokens.tokens,\n 'segmented-control': segmentedControlTokens.tokens,\n skeleton: skeletonTokens.tokens,\n spinner: spinnerTokens.tokens,\n stack: stackTokens.tokens,\n stat: statTokens.tokens,\n switch: switchTokens.tokens,\n tabs: tabsTokens.tokens,\n text: textTokens.tokens,\n toast: toastTokens.tokens,\n tooltip: tooltipTokens.tokens,\n});\n\n/** The name of a component token of `@panneau/ui`, without the leading `--`. */\nexport type ComponentTokenName = {\n [Component in keyof typeof componentTokens]: keyof (typeof componentTokens)[Component];\n}[keyof typeof componentTokens];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,IAAakC,kBAAkBC,OAAOC,OAAO;CACzCC,OAAOrC,YAAYsC;CACnBC,OAAOtC,YAAYqC;CACnBE,QAAQtC,aAAaoC;CACrBG,UAAUlC,eAAe+B;CACzBI,MAAMvC,WAAWmC;CACjBK,UAAUvC,eAAekC;CACzB,mBAAmBjC,qBAAqBiC;CACxCM,WAAWtC,gBAAgBgC;CAC3BO,QAAQrC,aAAa8B;CACrBQ,YAAYrC,iBAAiB6B;CAC7BS,SAASrC,cAAc4B;CACvBU,OAAOpC,YAAY0B;CACnBW,MAAMpC,WAAWyB;CACjBY,SAASpC,cAAcwB;CACvBa,QAAQpC,aAAauB;CACrBc,OAAOzC,YAAY2B;CACnB,cAActB,gBAAgBsB;CAC9B,YAAYd,cAAcc;CAC1Be,MAAMpC,WAAWqB;CACjB,gBAAgBpB,kBAAkBoB;CAClC,gBAAgBnB,kBAAkBmB;CAClCgB,SAASlC,cAAckB;CACvBiB,OAAOlC,YAAYiB;CACnBkB,OAAOlC,YAAYgB;CACnB,qBAAqBf,uBAAuBe;CAC5CmB,UAAUhC,eAAea;CACzBoB,SAAShC,cAAcY;CACvBqB,OAAOhC,YAAYW;CACnBsB,MAAMhC,WAAWU;CACjBuB,QAAQhC,aAAaS;CACrBwB,MAAMhC,WAAWQ;CACjByB,MAAMhC,WAAWO;CACjB0B,OAAOhC,YAAYM;CACnB2B,SAAShC,cAAcK;AAC3B,CAAC"}
@@ -1,8 +1,8 @@
1
- import { type ComponentTokenName } from './components';
2
- import type { ThemeFont } from './fonts';
3
- import { type SemanticTokenName } from './semanticTokens';
4
- import type { Density, Theme } from './theme';
5
- import type { ToneInput } from './tones';
1
+ import { type ComponentTokenName } from './components.js';
2
+ import type { ThemeFont } from './fonts.js';
3
+ import { type SemanticTokenName } from './semanticTokens.js';
4
+ import type { Density, Theme } from './theme.js';
5
+ import type { ToneInput } from './tones.js';
6
6
  /**
7
7
  * Tokens that a project adds, such as those of its own components: declare them here so that
8
8
  * `defineTheme()` accepts them.
@@ -1 +1 @@
1
- {"version":3,"file":"defineTheme.js","names":[],"sources":["../../src/theme/defineTheme.ts"],"sourcesContent":["import { type ComponentTokenName, componentTokens } from './components';\nimport type { ThemeFont } from './fonts';\nimport { SEMANTIC_TOKENS, type SemanticTokenName } from './semanticTokens';\nimport type { Density, Theme } from './theme';\nimport type { ToneInput } from './tones';\n\n/**\n * Tokens that a project adds, such as those of its own components: declare them here so that\n * `defineTheme()` accepts them.\n *\n * ```ts\n * declare module '@panneau/ui' {\n * interface PanneauTokens {\n * 'panneau-map-marker-color': true;\n * }\n * }\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- extended by projects\nexport interface PanneauTokens {}\n\n/** The variable of a palette color: `panneau-palette-orange`. */\nexport type PaletteTokenName = `panneau-palette-${string}`;\n\n/**\n * The name of a token a theme can set, without the leading `--`: a semantic token, a component\n * token, a palette color, or a token declared in `PanneauTokens`.\n */\nexport type TokenName =\n SemanticTokenName | ComponentTokenName | PaletteTokenName | (keyof PanneauTokens & string);\n\n/** Values of tokens, keyed by their name: only known names type-check. */\nexport type ThemeTokens = {\n [Name in SemanticTokenName | ComponentTokenName | (keyof PanneauTokens & string)]?: string;\n} & { [Name in PaletteTokenName]?: string };\n\n/** A theme as `defineTheme()` takes it: like `Theme`, with typed tokens and `extends`. */\nexport interface ThemeDefinition {\n /** A name for theme pickers. */\n label?: string;\n /** Themes this one builds on, in order: its own values override theirs. */\n extends?: Theme | readonly Theme[];\n /** Tokens of the light scheme, or of both schemes when `dark` does not set them. */\n tokens?: ThemeTokens;\n /** Tokens that change in the dark scheme. */\n dark?: ThemeTokens;\n /** Raw colors, used with `var(--panneau-palette-<name>)`. */\n palette?: Record<string, string>;\n /** Tones added or redefined by the theme. Declare added tones in `PanneauTones`. */\n tones?: Record<string, ToneInput>;\n /** Named variants of components. Declare them in `BadgeVariants` (and the like). */\n components?: Record<string, { variants?: Record<string, ThemeTokens> }>;\n /** Tokens of each density, which change with the density of the root. */\n densities?: Partial<Record<Exclude<Density, 'auto'>, ThemeTokens>>;\n /** Font faces and font stylesheets. */\n fonts?: ThemeFont[];\n}\n\nfunction mergeRecords<T>(\n first: Readonly<Record<string, T>> | undefined,\n second: Readonly<Record<string, T>> | undefined,\n): Record<string, T> | undefined {\n return first === undefined && second === undefined ? undefined : { ...first, ...second };\n}\n\nfunction mergeComponents(\n first: Theme['components'],\n second: Theme['components'],\n): Theme['components'] {\n const components = mergeRecords(first, second);\n if (components === undefined) {\n return undefined;\n }\n return Object.fromEntries(\n Object.keys(components).map((component) => {\n const before = first?.[component];\n const after = second?.[component];\n const variants = mergeRecords(before?.variants, after?.variants);\n return [\n component,\n {\n ...before,\n ...after,\n ...(variants !== undefined && {\n variants: Object.fromEntries(\n Object.keys(variants).map((name) => [\n name,\n { ...before?.variants?.[name], ...after?.variants?.[name] },\n ]),\n ),\n }),\n },\n ];\n }),\n );\n}\n\nconst DENSITIES = ['compact', 'comfortable', 'touch'] as const;\n\nfunction mergeDensities(first: Theme['densities'], second: Theme['densities']): Theme['densities'] {\n if (first === undefined && second === undefined) {\n return undefined;\n }\n const densities = { ...first, ...second };\n DENSITIES.forEach((density) => {\n if (first?.[density] !== undefined && second?.[density] !== undefined) {\n densities[density] = { ...first[density], ...second[density] };\n }\n });\n return densities;\n}\n\nfunction mergeFonts(first: Theme['fonts'], second: Theme['fonts']): Theme['fonts'] {\n if (first === undefined && second === undefined) {\n return undefined;\n }\n const fonts = [...(first ?? []), ...(second ?? [])];\n return fonts.filter(\n (font, index) =>\n fonts.findIndex((other) => JSON.stringify(other) === JSON.stringify(font)) === index,\n );\n}\n\n/**\n * Merges themes, in order: each one overrides the tokens, palette colors, tones and variants of\n * those before it. A token a theme sets in `tokens` but not in `dark` applies to both schemes, so it\n * also replaces the dark value of earlier themes. Variants merge token by token; tones are replaced\n * whole; densities merge token by token; fonts add up. The label is the last one set. Same as `mergeThemes()` of `@panneau/protocol`.\n */\nexport function mergeThemes(...themes: readonly Partial<Theme>[]): Theme {\n return themes.reduce<Theme>(\n (merged, theme) => {\n const tokens = theme.tokens ?? {};\n const dark = mergeRecords(\n merged.dark !== undefined\n ? Object.fromEntries(\n Object.entries(merged.dark).filter(\n ([name]) => !Object.hasOwn(tokens, name),\n ),\n )\n : undefined,\n theme.dark,\n );\n const result: Theme = {\n ...merged,\n ...theme,\n label: theme.label ?? merged.label,\n tokens: { ...merged.tokens, ...tokens },\n dark: dark !== undefined && Object.keys(dark).length > 0 ? dark : undefined,\n palette: mergeRecords(merged.palette, theme.palette),\n tones: mergeRecords(merged.tones, theme.tones),\n components: mergeComponents(merged.components, theme.components),\n densities: mergeDensities(merged.densities, theme.densities),\n fonts: mergeFonts(merged.fonts, theme.fonts),\n };\n return Object.fromEntries(\n Object.entries(result).filter(([, value]) => value !== undefined),\n ) as unknown as Theme;\n },\n { tokens: {} },\n );\n}\n\n/** The first segments of the semantic tokens, and the components: names Panneau owns. */\nconst NAMESPACES = [\n ...new Set([\n ...SEMANTIC_TOKENS.map((name) => name.split('-')[1]),\n ...Object.keys(componentTokens),\n 'tone',\n ]),\n];\n\nconst KNOWN_TOKENS = new Set<string>([\n ...SEMANTIC_TOKENS,\n ...Object.values(componentTokens).flatMap((tokens) => Object.keys(tokens)),\n]);\n\n/**\n * Tokens of a theme (in its tokens, dark tokens, densities and variants) that Panneau doesn't know although they are in its namespaces\n * (`panneau-color-*`, `panneau-button-*`…): most likely typos. Tokens of a project's own components\n * are outside these namespaces, and palette colors are always accepted.\n */\nexport function findUnknownTokens(theme: Theme): string[] {\n const names = [\n ...Object.keys(theme.tokens),\n ...Object.keys(theme.dark ?? {}),\n ...Object.values(theme.densities ?? {}).flatMap((tokens) => Object.keys(tokens)),\n ...Object.values(theme.components ?? {}).flatMap(({ variants = {} }) =>\n Object.values(variants).flatMap((tokens) => Object.keys(tokens)),\n ),\n ];\n return [\n ...new Set(\n names.filter(\n (name) =>\n !KNOWN_TOKENS.has(name) &&\n !name.startsWith('panneau-palette-') &&\n NAMESPACES.some((namespace) => name.startsWith(`panneau-${namespace}-`)),\n ),\n ),\n ];\n}\n\n/**\n * Declares a theme: TypeScript checks the names of its tokens, and `extends` builds it on other\n * themes (`bootstrapTheme`, a shared brand theme), whose values its own override. It returns a\n * plain `Theme`, which `PanneauRoot`, plugins and JSON files all take. Tokens that Panneau doesn't\n * know in its own namespaces, most likely typos, are reported in the console.\n *\n * ```ts\n * const brand = defineTheme({\n * palette: { orange: '#f25c05' },\n * tokens: { 'panneau-color-accent': 'var(--panneau-palette-orange)' },\n * tones: { signal: 'var(--panneau-palette-orange)' },\n * });\n * const compact = defineTheme({ extends: brand, tokens: { 'panneau-control-height': '2rem' } });\n * ```\n */\nexport function defineTheme(definition: ThemeDefinition): Theme {\n const { extends: extended = [], ...own } = definition;\n const bases: readonly Theme[] = Array.isArray(extended) ? extended : [extended as Theme];\n const ownTheme = { ...own, tokens: own.tokens ?? {} } as Theme;\n const theme = mergeThemes(...bases, ownTheme);\n const unknown = findUnknownTokens(ownTheme);\n if (unknown.length > 0) {\n console.warn(\n `[panneau] Unknown tokens in theme${theme.label !== undefined ? ` \"${theme.label}\"` : ''}: ${unknown.join(', ')}.`,\n );\n }\n return theme;\n}\n"],"mappings":";;;AA0DA,SAAS,aACL,OACA,QAC6B;CAC7B,OAAO,UAAU,KAAA,KAAa,WAAW,KAAA,IAAY,KAAA,IAAY;EAAE,GAAG;EAAO,GAAG;CAAO;AAC3F;AAEA,SAAS,gBACL,OACA,QACmB;CACnB,MAAM,aAAa,aAAa,OAAO,MAAM;CAC7C,IAAI,eAAe,KAAA,GACf;CAEJ,OAAO,OAAO,YACV,OAAO,KAAK,UAAU,CAAC,CAAC,KAAK,cAAc;EACvC,MAAM,SAAS,QAAQ;EACvB,MAAM,QAAQ,SAAS;EACvB,MAAM,WAAW,aAAa,QAAQ,UAAU,OAAO,QAAQ;EAC/D,OAAO,CACH,WACA;GACI,GAAG;GACH,GAAG;GACH,GAAI,aAAa,KAAA,KAAa,EAC1B,UAAU,OAAO,YACb,OAAO,KAAK,QAAQ,CAAC,CAAC,KAAK,SAAS,CAChC,MACA;IAAE,GAAG,QAAQ,WAAW;IAA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AET;;;;;;;;;;;;;;;;AAiBA,SAAgB,YAAY,YAAoC;CAC5D,MAAM,EAAE,SAAS,WAAW,CAAA,GAAI,GAAG,QAAQ;CAC3C,MAAM,QAA0B,MAAM,QAAQ,QAAQ,IAAI,WAAW,CAAC,QAAiB;CACvF,MAAM,WAAW;EAAE,GAAG;EAAK,QAAQ,IAAI,UAAU,CAAC;CAAE;CACpD,MAAM,QAAQ,YAAY,GAAG,OAAO,QAAQ;CAC5C,MAAM,UAAU,kBAAkB,QAAQ;CAC1C,IAAI,QAAQ,SAAS,GACjB,QAAQ,KACJ,oCAAoC,MAAM,UAAU,KAAA,IAAY,KAAK,MAAM,MAAK,KAAM,GAAE,IAAK,QAAQ,KAAK,IAAI,EAAC,EACnH;CAEJ,OAAO;AACX"}
1
+ {"version":3,"file":"defineTheme.js","names":["ComponentTokenName","componentTokens","ThemeFont","SEMANTIC_TOKENS","SemanticTokenName","Density","Theme","ToneInput","PanneauTokens","PaletteTokenName","TokenName","ThemeTokens","ThemeDefinition","label","extends","tokens","dark","palette","Record","tones","components","variants","densities","Partial","Exclude","fonts","mergeRecords","first","Readonly","T","second","undefined","mergeComponents","Object","fromEntries","keys","map","component","before","after","name","DENSITIES","const","mergeDensities","forEach","density","mergeFonts","filter","font","index","findIndex","other","JSON","stringify","mergeThemes","themes","reduce","merged","theme","entries","hasOwn","result","length","value","NAMESPACES","Set","split","KNOWN_TOKENS","values","flatMap","findUnknownTokens","names","has","startsWith","some","namespace","defineTheme","definition","extended","own","bases","Array","isArray","ownTheme","unknown","console","warn","join"],"sources":["../../src/theme/defineTheme.ts"],"sourcesContent":["import { type ComponentTokenName, componentTokens } from './components';\nimport type { ThemeFont } from './fonts';\nimport { SEMANTIC_TOKENS, type SemanticTokenName } from './semanticTokens';\nimport type { Density, Theme } from './theme';\nimport type { ToneInput } from './tones';\n\n/**\n * Tokens that a project adds, such as those of its own components: declare them here so that\n * `defineTheme()` accepts them.\n *\n * ```ts\n * declare module '@panneau/ui' {\n * interface PanneauTokens {\n * 'panneau-map-marker-color': true;\n * }\n * }\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- extended by projects\nexport interface PanneauTokens {}\n\n/** The variable of a palette color: `panneau-palette-orange`. */\nexport type PaletteTokenName = `panneau-palette-${string}`;\n\n/**\n * The name of a token a theme can set, without the leading `--`: a semantic token, a component\n * token, a palette color, or a token declared in `PanneauTokens`.\n */\nexport type TokenName =\n SemanticTokenName | ComponentTokenName | PaletteTokenName | (keyof PanneauTokens & string);\n\n/** Values of tokens, keyed by their name: only known names type-check. */\nexport type ThemeTokens = {\n [Name in SemanticTokenName | ComponentTokenName | (keyof PanneauTokens & string)]?: string;\n} & { [Name in PaletteTokenName]?: string };\n\n/** A theme as `defineTheme()` takes it: like `Theme`, with typed tokens and `extends`. */\nexport interface ThemeDefinition {\n /** A name for theme pickers. */\n label?: string;\n /** Themes this one builds on, in order: its own values override theirs. */\n extends?: Theme | readonly Theme[];\n /** Tokens of the light scheme, or of both schemes when `dark` does not set them. */\n tokens?: ThemeTokens;\n /** Tokens that change in the dark scheme. */\n dark?: ThemeTokens;\n /** Raw colors, used with `var(--panneau-palette-<name>)`. */\n palette?: Record<string, string>;\n /** Tones added or redefined by the theme. Declare added tones in `PanneauTones`. */\n tones?: Record<string, ToneInput>;\n /** Named variants of components. Declare them in `BadgeVariants` (and the like). */\n components?: Record<string, { variants?: Record<string, ThemeTokens> }>;\n /** Tokens of each density, which change with the density of the root. */\n densities?: Partial<Record<Exclude<Density, 'auto'>, ThemeTokens>>;\n /** Font faces and font stylesheets. */\n fonts?: ThemeFont[];\n}\n\nfunction mergeRecords<T>(\n first: Readonly<Record<string, T>> | undefined,\n second: Readonly<Record<string, T>> | undefined,\n): Record<string, T> | undefined {\n return first === undefined && second === undefined ? undefined : { ...first, ...second };\n}\n\nfunction mergeComponents(\n first: Theme['components'],\n second: Theme['components'],\n): Theme['components'] {\n const components = mergeRecords(first, second);\n if (components === undefined) {\n return undefined;\n }\n return Object.fromEntries(\n Object.keys(components).map((component) => {\n const before = first?.[component];\n const after = second?.[component];\n const variants = mergeRecords(before?.variants, after?.variants);\n return [\n component,\n {\n ...before,\n ...after,\n ...(variants !== undefined && {\n variants: Object.fromEntries(\n Object.keys(variants).map((name) => [\n name,\n { ...before?.variants?.[name], ...after?.variants?.[name] },\n ]),\n ),\n }),\n },\n ];\n }),\n );\n}\n\nconst DENSITIES = ['compact', 'comfortable', 'touch'] as const;\n\nfunction mergeDensities(first: Theme['densities'], second: Theme['densities']): Theme['densities'] {\n if (first === undefined && second === undefined) {\n return undefined;\n }\n const densities = { ...first, ...second };\n DENSITIES.forEach((density) => {\n if (first?.[density] !== undefined && second?.[density] !== undefined) {\n densities[density] = { ...first[density], ...second[density] };\n }\n });\n return densities;\n}\n\nfunction mergeFonts(first: Theme['fonts'], second: Theme['fonts']): Theme['fonts'] {\n if (first === undefined && second === undefined) {\n return undefined;\n }\n const fonts = [...(first ?? []), ...(second ?? [])];\n return fonts.filter(\n (font, index) =>\n fonts.findIndex((other) => JSON.stringify(other) === JSON.stringify(font)) === index,\n );\n}\n\n/**\n * Merges themes, in order: each one overrides the tokens, palette colors, tones and variants of\n * those before it. A token a theme sets in `tokens` but not in `dark` applies to both schemes, so it\n * also replaces the dark value of earlier themes. Variants merge token by token; tones are replaced\n * whole; densities merge token by token; fonts add up. The label is the last one set. Same as `mergeThemes()` of `@panneau/protocol`.\n */\nexport function mergeThemes(...themes: readonly Partial<Theme>[]): Theme {\n return themes.reduce<Theme>(\n (merged, theme) => {\n const tokens = theme.tokens ?? {};\n const dark = mergeRecords(\n merged.dark !== undefined\n ? Object.fromEntries(\n Object.entries(merged.dark).filter(\n ([name]) => !Object.hasOwn(tokens, name),\n ),\n )\n : undefined,\n theme.dark,\n );\n const result: Theme = {\n ...merged,\n ...theme,\n label: theme.label ?? merged.label,\n tokens: { ...merged.tokens, ...tokens },\n dark: dark !== undefined && Object.keys(dark).length > 0 ? dark : undefined,\n palette: mergeRecords(merged.palette, theme.palette),\n tones: mergeRecords(merged.tones, theme.tones),\n components: mergeComponents(merged.components, theme.components),\n densities: mergeDensities(merged.densities, theme.densities),\n fonts: mergeFonts(merged.fonts, theme.fonts),\n };\n return Object.fromEntries(\n Object.entries(result).filter(([, value]) => value !== undefined),\n ) as unknown as Theme;\n },\n { tokens: {} },\n );\n}\n\n/** The first segments of the semantic tokens, and the components: names Panneau owns. */\nconst NAMESPACES = [\n ...new Set([\n ...SEMANTIC_TOKENS.map((name) => name.split('-')[1]),\n ...Object.keys(componentTokens),\n 'tone',\n ]),\n];\n\nconst KNOWN_TOKENS = new Set<string>([\n ...SEMANTIC_TOKENS,\n ...Object.values(componentTokens).flatMap((tokens) => Object.keys(tokens)),\n]);\n\n/**\n * Tokens of a theme (in its tokens, dark tokens, densities and variants) that Panneau doesn't know although they are in its namespaces\n * (`panneau-color-*`, `panneau-button-*`…): most likely typos. Tokens of a project's own components\n * are outside these namespaces, and palette colors are always accepted.\n */\nexport function findUnknownTokens(theme: Theme): string[] {\n const names = [\n ...Object.keys(theme.tokens),\n ...Object.keys(theme.dark ?? {}),\n ...Object.values(theme.densities ?? {}).flatMap((tokens) => Object.keys(tokens)),\n ...Object.values(theme.components ?? {}).flatMap(({ variants = {} }) =>\n Object.values(variants).flatMap((tokens) => Object.keys(tokens)),\n ),\n ];\n return [\n ...new Set(\n names.filter(\n (name) =>\n !KNOWN_TOKENS.has(name) &&\n !name.startsWith('panneau-palette-') &&\n NAMESPACES.some((namespace) => name.startsWith(`panneau-${namespace}-`)),\n ),\n ),\n ];\n}\n\n/**\n * Declares a theme: TypeScript checks the names of its tokens, and `extends` builds it on other\n * themes (`bootstrapTheme`, a shared brand theme), whose values its own override. It returns a\n * plain `Theme`, which `PanneauRoot`, plugins and JSON files all take. Tokens that Panneau doesn't\n * know in its own namespaces, most likely typos, are reported in the console.\n *\n * ```ts\n * const brand = defineTheme({\n * palette: { orange: '#f25c05' },\n * tokens: { 'panneau-color-accent': 'var(--panneau-palette-orange)' },\n * tones: { signal: 'var(--panneau-palette-orange)' },\n * });\n * const compact = defineTheme({ extends: brand, tokens: { 'panneau-control-height': '2rem' } });\n * ```\n */\nexport function defineTheme(definition: ThemeDefinition): Theme {\n const { extends: extended = [], ...own } = definition;\n const bases: readonly Theme[] = Array.isArray(extended) ? extended : [extended as Theme];\n const ownTheme = { ...own, tokens: own.tokens ?? {} } as Theme;\n const theme = mergeThemes(...bases, ownTheme);\n const unknown = findUnknownTokens(ownTheme);\n if (unknown.length > 0) {\n console.warn(\n `[panneau] Unknown tokens in theme${theme.label !== undefined ? ` \"${theme.label}\"` : ''}: ${unknown.join(', ')}.`,\n );\n }\n return theme;\n}\n"],"mappings":";;;AA0DA,SAAS0B,aACLC,OACAG,QAC6B;CAC7B,OAAOH,UAAUI,KAAAA,KAAaD,WAAWC,KAAAA,IAAYA,KAAAA,IAAY;EAAE,GAAGJ;EAAO,GAAGG;CAAO;AAC3F;AAEA,SAASE,gBACLL,OACAG,QACmB;CACnB,MAAMV,aAAaM,aAAaC,OAAOG,MAAM;CAC7C,IAAIV,eAAeW,KAAAA,GACf;CAEJ,OAAOE,OAAOC,YACVD,OAAOE,KAAKf,UAAU,CAAC,CAACgB,KAAKC,cAAc;EACvC,MAAMC,SAASX,QAAQU;EACvB,MAAME,QAAQT,SAASO;EACvB,MAAMhB,WAAWK,aAAaY,QAAQjB,UAAUkB,OAAOlB,QAAQ;EAC/D,OAAO,CACHgB,WACA;GACI,GAAGC;GACH,GAAGC;GACH,GAAIlB,aAAaU,KAAAA,KAAa,EAC1BV,UAAUY,OAAOC,YACbD,OAAOE,KAAKd,QAAQ,CAAC,CAACe,KAAKI,SAAS,CAChCA,MACA;IAAE,GAAGF,QAAQjB,WAAWmB;IAAO,GAAGD,OAAOlB,WAAWmB;GAAM,CAAC,CAC9D,CACL,EACJ;EACJ,CAAC;CAET,CAAC,CACL;AACJ;AAEA,IAAMC,YAAY;CAAC;CAAW;CAAe;AAAO;AAEpD,SAASE,e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