@panneau/ui 5.0.0-alpha.4 → 5.0.0-alpha.42

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 (485) hide show
  1. package/README.md +138 -4
  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/aside/Aside.css +255 -0
  8. package/dist/aside/Aside.d.ts +86 -0
  9. package/dist/aside/Aside.d.ts.map +1 -0
  10. package/dist/aside/Aside.js +403 -0
  11. package/dist/aside/Aside.js.map +1 -0
  12. package/dist/aside/Aside.module.js +46 -0
  13. package/dist/aside/Aside.module.js.map +1 -0
  14. package/dist/aside/tokens.d.ts +3 -0
  15. package/dist/aside/tokens.d.ts.map +1 -0
  16. package/dist/aside/tokens.js +23 -0
  17. package/dist/aside/tokens.js.map +1 -0
  18. package/dist/badge/Badge.d.ts +1 -1
  19. package/dist/badge/Badge.js +34 -6
  20. package/dist/badge/Badge.js.map +1 -1
  21. package/dist/badge/tokens.d.ts +1 -1
  22. package/dist/badge/tokens.js.map +1 -1
  23. package/dist/bar-chart/BarChart.css +76 -0
  24. package/dist/bar-chart/BarChart.d.ts +33 -0
  25. package/dist/bar-chart/BarChart.d.ts.map +1 -0
  26. package/dist/bar-chart/BarChart.js +151 -0
  27. package/dist/bar-chart/BarChart.js.map +1 -0
  28. package/dist/bar-chart/BarChart.module.js +26 -0
  29. package/dist/bar-chart/BarChart.module.js.map +1 -0
  30. package/dist/bar-chart/tokens.d.ts +3 -0
  31. package/dist/bar-chart/tokens.d.ts.map +1 -0
  32. package/dist/bar-chart/tokens.js +17 -0
  33. package/dist/bar-chart/tokens.js.map +1 -0
  34. package/dist/button/Button.css +13 -1
  35. package/dist/button/Button.d.ts +20 -6
  36. package/dist/button/Button.d.ts.map +1 -1
  37. package/dist/button/Button.js +169 -22
  38. package/dist/button/Button.js.map +1 -1
  39. package/dist/button/Button.module.js.map +1 -1
  40. package/dist/button/LinkButton.d.ts +22 -0
  41. package/dist/button/LinkButton.d.ts.map +1 -0
  42. package/dist/button/LinkButton.js +113 -0
  43. package/dist/button/LinkButton.js.map +1 -0
  44. package/dist/button/tokens.d.ts +1 -1
  45. package/dist/button/tokens.d.ts.map +1 -1
  46. package/dist/button/tokens.js +4 -0
  47. package/dist/button/tokens.js.map +1 -1
  48. package/dist/card/Card.css +1 -0
  49. package/dist/card/Card.js +76 -23
  50. package/dist/card/Card.js.map +1 -1
  51. package/dist/card/Card.module.js.map +1 -1
  52. package/dist/card/tokens.d.ts +1 -1
  53. package/dist/card/tokens.js.map +1 -1
  54. package/dist/chart-legend/ChartLegend.css +73 -0
  55. package/dist/chart-legend/ChartLegend.d.ts +32 -0
  56. package/dist/chart-legend/ChartLegend.d.ts.map +1 -0
  57. package/dist/chart-legend/ChartLegend.js +76 -0
  58. package/dist/chart-legend/ChartLegend.js.map +1 -0
  59. package/dist/chart-legend/ChartLegend.module.js +26 -0
  60. package/dist/chart-legend/ChartLegend.module.js.map +1 -0
  61. package/dist/checkbox/Checkbox.css +15 -16
  62. package/dist/checkbox/Checkbox.d.ts +1 -1
  63. package/dist/checkbox/Checkbox.js +86 -25
  64. package/dist/checkbox/Checkbox.js.map +1 -1
  65. package/dist/checkbox/Checkbox.module.js.map +1 -1
  66. package/dist/checkbox/ChoiceChrome.js +82 -21
  67. package/dist/checkbox/ChoiceChrome.js.map +1 -1
  68. package/dist/checkbox/tokens.d.ts +1 -1
  69. package/dist/checkbox/tokens.js +2 -2
  70. package/dist/checkbox/tokens.js.map +1 -1
  71. package/dist/combo-box/ComboBox.css +10 -0
  72. package/dist/combo-box/ComboBox.d.ts +7 -2
  73. package/dist/combo-box/ComboBox.d.ts.map +1 -1
  74. package/dist/combo-box/ComboBox.js +310 -78
  75. package/dist/combo-box/ComboBox.js.map +1 -1
  76. package/dist/combo-box/ComboBox.module.js +4 -2
  77. package/dist/combo-box/ComboBox.module.js.map +1 -1
  78. package/dist/command-palette/CommandPalette.css +299 -0
  79. package/dist/command-palette/CommandPalette.d.ts +37 -0
  80. package/dist/command-palette/CommandPalette.d.ts.map +1 -0
  81. package/dist/command-palette/CommandPalette.js +497 -0
  82. package/dist/command-palette/CommandPalette.js.map +1 -0
  83. package/dist/command-palette/CommandPalette.module.js +62 -0
  84. package/dist/command-palette/CommandPalette.module.js.map +1 -0
  85. package/dist/command-palette/match.d.ts +39 -0
  86. package/dist/command-palette/match.d.ts.map +1 -0
  87. package/dist/command-palette/match.js +44 -0
  88. package/dist/command-palette/match.js.map +1 -0
  89. package/dist/command-palette/tokens.d.ts +3 -0
  90. package/dist/command-palette/tokens.d.ts.map +1 -0
  91. package/dist/command-palette/tokens.js +23 -0
  92. package/dist/command-palette/tokens.js.map +1 -0
  93. package/dist/command-palette/useCommandShortcut.d.ts +12 -0
  94. package/dist/command-palette/useCommandShortcut.d.ts.map +1 -0
  95. package/dist/command-palette/useCommandShortcut.js +48 -0
  96. package/dist/command-palette/useCommandShortcut.js.map +1 -0
  97. package/dist/container/Container.js +48 -5
  98. package/dist/container/Container.js.map +1 -1
  99. package/dist/container/tokens.d.ts +1 -1
  100. package/dist/container/tokens.js.map +1 -1
  101. package/dist/date-picker/DatePicker.css +56 -4
  102. package/dist/date-picker/DatePicker.d.ts +16 -3
  103. package/dist/date-picker/DatePicker.d.ts.map +1 -1
  104. package/dist/date-picker/DatePicker.js +359 -72
  105. package/dist/date-picker/DatePicker.js.map +1 -1
  106. package/dist/date-picker/DatePicker.module.js +8 -2
  107. package/dist/date-picker/DatePicker.module.js.map +1 -1
  108. package/dist/date-picker/calendarTokens.d.ts +1 -1
  109. package/dist/date-picker/calendarTokens.js +2 -2
  110. package/dist/date-picker/calendarTokens.js.map +1 -1
  111. package/dist/date-range-picker/DateRangePicker.css +37 -0
  112. package/dist/date-range-picker/DateRangePicker.d.ts +41 -0
  113. package/dist/date-range-picker/DateRangePicker.d.ts.map +1 -0
  114. package/dist/date-range-picker/DateRangePicker.js +438 -0
  115. package/dist/date-range-picker/DateRangePicker.js.map +1 -0
  116. package/dist/date-range-picker/DateRangePicker.module.js +20 -0
  117. package/dist/date-range-picker/DateRangePicker.module.js.map +1 -0
  118. package/dist/dialog/Dialog.css +44 -5
  119. package/dist/dialog/Dialog.d.ts +15 -3
  120. package/dist/dialog/Dialog.d.ts.map +1 -1
  121. package/dist/dialog/Dialog.js +161 -32
  122. package/dist/dialog/Dialog.js.map +1 -1
  123. package/dist/dialog/Dialog.module.js +10 -2
  124. package/dist/dialog/Dialog.module.js.map +1 -1
  125. package/dist/dialog/tokens.d.ts +1 -1
  126. package/dist/dialog/tokens.d.ts.map +1 -1
  127. package/dist/dialog/tokens.js +2 -0
  128. package/dist/dialog/tokens.js.map +1 -1
  129. package/dist/disclosure/Disclosure.js +132 -28
  130. package/dist/disclosure/Disclosure.js.map +1 -1
  131. package/dist/disclosure/tokens.d.ts +1 -1
  132. package/dist/disclosure/tokens.js.map +1 -1
  133. package/dist/divider/Divider.js +55 -11
  134. package/dist/divider/Divider.js.map +1 -1
  135. package/dist/divider/tokens.d.ts +1 -1
  136. package/dist/divider/tokens.js.map +1 -1
  137. package/dist/field/Field.css +30 -4
  138. package/dist/field/Field.module.js +6 -2
  139. package/dist/field/Field.module.js.map +1 -1
  140. package/dist/field/FieldParts.d.ts +1 -1
  141. package/dist/field/FieldParts.js +69 -15
  142. package/dist/field/FieldParts.js.map +1 -1
  143. package/dist/field/Fieldset.d.ts +6 -1
  144. package/dist/field/Fieldset.d.ts.map +1 -1
  145. package/dist/field/Fieldset.js +132 -33
  146. package/dist/field/Fieldset.js.map +1 -1
  147. package/dist/field/inputTokens.d.ts +1 -1
  148. package/dist/field/inputTokens.d.ts.map +1 -1
  149. package/dist/field/inputTokens.js +7 -1
  150. package/dist/field/inputTokens.js.map +1 -1
  151. package/dist/field/tokens.d.ts +1 -1
  152. package/dist/field/tokens.d.ts.map +1 -1
  153. package/dist/field/tokens.js +3 -1
  154. package/dist/field/tokens.js.map +1 -1
  155. package/dist/grid/Grid.d.ts +1 -1
  156. package/dist/grid/Grid.js +123 -14
  157. package/dist/grid/Grid.js.map +1 -1
  158. package/dist/grid/tokens.d.ts +1 -1
  159. package/dist/grid/tokens.js.map +1 -1
  160. package/dist/heading/Heading.js +41 -6
  161. package/dist/heading/Heading.js.map +1 -1
  162. package/dist/heading/tokens.d.ts +1 -1
  163. package/dist/heading/tokens.js.map +1 -1
  164. package/dist/icon/Icon.css +5 -0
  165. package/dist/icon/Icon.d.ts +5 -1
  166. package/dist/icon/Icon.d.ts.map +1 -1
  167. package/dist/icon/Icon.js +38 -12
  168. package/dist/icon/Icon.js.map +1 -1
  169. package/dist/icon/Icon.module.js.map +1 -1
  170. package/dist/icon/lucideIconLoader.d.ts +1 -1
  171. package/dist/icon/lucideIconLoader.js.map +1 -1
  172. package/dist/icon/namedIcons.d.ts +1 -1
  173. package/dist/icon/namedIcons.js +87 -26
  174. package/dist/icon/namedIcons.js.map +1 -1
  175. package/dist/icon/tokens.d.ts +3 -0
  176. package/dist/icon/tokens.d.ts.map +1 -0
  177. package/dist/icon/tokens.js +13 -0
  178. package/dist/icon/tokens.js.map +1 -0
  179. package/dist/icon-button/IconButton.d.ts +2 -2
  180. package/dist/icon-button/IconButton.js +70 -13
  181. package/dist/icon-button/IconButton.js.map +1 -1
  182. package/dist/index.d.ts +71 -52
  183. package/dist/index.d.ts.map +1 -1
  184. package/dist/index.js +25 -6
  185. package/dist/inline/Inline.d.ts +1 -1
  186. package/dist/inline/Inline.js +65 -7
  187. package/dist/inline/Inline.js.map +1 -1
  188. package/dist/inline/tokens.d.ts +1 -1
  189. package/dist/inline/tokens.js.map +1 -1
  190. package/dist/intl/usePanneauIntl.js.map +1 -1
  191. package/dist/layout/responsive.js.map +1 -1
  192. package/dist/line-chart/LineChart.css +314 -0
  193. package/dist/line-chart/LineChart.d.ts +84 -0
  194. package/dist/line-chart/LineChart.d.ts.map +1 -0
  195. package/dist/line-chart/LineChart.js +626 -0
  196. package/dist/line-chart/LineChart.js.map +1 -0
  197. package/dist/line-chart/LineChart.module.js +73 -0
  198. package/dist/line-chart/LineChart.module.js.map +1 -0
  199. package/dist/line-chart/geometry.d.ts +37 -0
  200. package/dist/line-chart/geometry.d.ts.map +1 -0
  201. package/dist/line-chart/geometry.js +115 -0
  202. package/dist/line-chart/geometry.js.map +1 -0
  203. package/dist/line-chart/tokens.d.ts +3 -0
  204. package/dist/line-chart/tokens.d.ts.map +1 -0
  205. package/dist/line-chart/tokens.js +23 -0
  206. package/dist/line-chart/tokens.js.map +1 -0
  207. package/dist/locales/index.js.map +1 -1
  208. package/dist/menu/Menu.css +84 -0
  209. package/dist/menu/Menu.d.ts +34 -7
  210. package/dist/menu/Menu.d.ts.map +1 -1
  211. package/dist/menu/Menu.js +243 -32
  212. package/dist/menu/Menu.js.map +1 -1
  213. package/dist/menu/Menu.module.js +22 -0
  214. package/dist/menu/Menu.module.js.map +1 -0
  215. package/dist/menu/tokens.d.ts +3 -0
  216. package/dist/menu/tokens.d.ts.map +1 -0
  217. package/dist/menu/tokens.js +31 -0
  218. package/dist/menu/tokens.js.map +1 -0
  219. package/dist/meter/Meter.css +23 -0
  220. package/dist/meter/Meter.d.ts +26 -0
  221. package/dist/meter/Meter.d.ts.map +1 -0
  222. package/dist/meter/Meter.js +99 -0
  223. package/dist/meter/Meter.js.map +1 -0
  224. package/dist/meter/Meter.module.js +16 -0
  225. package/dist/meter/Meter.module.js.map +1 -0
  226. package/dist/meter/tokens.d.ts +3 -0
  227. package/dist/meter/tokens.d.ts.map +1 -0
  228. package/dist/meter/tokens.js +15 -0
  229. package/dist/meter/tokens.js.map +1 -0
  230. package/dist/named-icons/index.d.ts +1 -1
  231. package/dist/node_modules/@internationalized/date/dist/private/CalendarDate.js +136 -0
  232. package/dist/node_modules/@internationalized/date/dist/private/CalendarDate.js.map +1 -0
  233. package/dist/node_modules/@internationalized/date/dist/private/calendars/GregorianCalendar.js +117 -0
  234. package/dist/node_modules/@internationalized/date/dist/private/calendars/GregorianCalendar.js.map +1 -0
  235. package/dist/node_modules/@internationalized/date/dist/private/conversion.js +116 -0
  236. package/dist/node_modules/@internationalized/date/dist/private/conversion.js.map +1 -0
  237. package/dist/node_modules/@internationalized/date/dist/private/manipulation.js +206 -0
  238. package/dist/node_modules/@internationalized/date/dist/private/manipulation.js.map +1 -0
  239. package/dist/node_modules/@internationalized/date/dist/private/queries.js +26 -0
  240. package/dist/node_modules/@internationalized/date/dist/private/queries.js.map +1 -0
  241. package/dist/node_modules/@internationalized/date/dist/private/string.js +19 -0
  242. package/dist/node_modules/@internationalized/date/dist/private/string.js.map +1 -0
  243. package/dist/node_modules/@internationalized/date/dist/private/utils.js +8 -0
  244. package/dist/node_modules/@internationalized/date/dist/private/utils.js.map +1 -0
  245. package/dist/number-input/NumberInput.css +18 -0
  246. package/dist/number-input/NumberInput.d.ts +1 -1
  247. package/dist/number-input/NumberInput.js +232 -60
  248. package/dist/number-input/NumberInput.js.map +1 -1
  249. package/dist/number-input/NumberInput.module.js +3 -1
  250. package/dist/number-input/NumberInput.module.js.map +1 -1
  251. package/dist/number-input/tokens.d.ts +1 -1
  252. package/dist/number-input/tokens.js.map +1 -1
  253. package/dist/pill-trigger/PillTrigger.css +104 -0
  254. package/dist/pill-trigger/PillTrigger.d.ts +20 -0
  255. package/dist/pill-trigger/PillTrigger.d.ts.map +1 -0
  256. package/dist/pill-trigger/PillTrigger.js +94 -0
  257. package/dist/pill-trigger/PillTrigger.js.map +1 -0
  258. package/dist/pill-trigger/PillTrigger.module.js +18 -0
  259. package/dist/pill-trigger/PillTrigger.module.js.map +1 -0
  260. package/dist/pill-trigger/tokens.d.ts +3 -0
  261. package/dist/pill-trigger/tokens.d.ts.map +1 -0
  262. package/dist/pill-trigger/tokens.js +37 -0
  263. package/dist/pill-trigger/tokens.js.map +1 -0
  264. package/dist/popover/Popover.css +7 -2
  265. package/dist/popover/Popover.d.ts.map +1 -1
  266. package/dist/popover/Popover.js +116 -20
  267. package/dist/popover/Popover.js.map +1 -1
  268. package/dist/popover/Popover.module.js +4 -2
  269. package/dist/popover/Popover.module.js.map +1 -1
  270. package/dist/popover/tokens.d.ts +1 -1
  271. package/dist/popover/tokens.js.map +1 -1
  272. package/dist/prose/Prose.js +36 -5
  273. package/dist/prose/Prose.js.map +1 -1
  274. package/dist/prose/tokens.d.ts +1 -1
  275. package/dist/prose/tokens.js.map +1 -1
  276. package/dist/radio-group/RadioGroup.css +214 -9
  277. package/dist/radio-group/RadioGroup.d.ts +34 -5
  278. package/dist/radio-group/RadioGroup.d.ts.map +1 -1
  279. package/dist/radio-group/RadioGroup.js +258 -43
  280. package/dist/radio-group/RadioGroup.js.map +1 -1
  281. package/dist/radio-group/RadioGroup.module.js +22 -2
  282. package/dist/radio-group/RadioGroup.module.js.map +1 -1
  283. package/dist/radio-group/tokens.d.ts +2 -2
  284. package/dist/radio-group/tokens.d.ts.map +1 -1
  285. package/dist/radio-group/tokens.js +31 -3
  286. package/dist/radio-group/tokens.js.map +1 -1
  287. package/dist/root/PanneauRoot.css +35 -0
  288. package/dist/root/PanneauRoot.d.ts +37 -6
  289. package/dist/root/PanneauRoot.d.ts.map +1 -1
  290. package/dist/root/PanneauRoot.js +283 -85
  291. package/dist/root/PanneauRoot.js.map +1 -1
  292. package/dist/root/PanneauRoot.module.js.map +1 -1
  293. package/dist/root/ThemeScope.d.ts +1 -1
  294. package/dist/root/ThemeScope.d.ts.map +1 -1
  295. package/dist/root/ThemeScope.js +110 -27
  296. package/dist/root/ThemeScope.js.map +1 -1
  297. package/dist/segmented-control/SegmentedControl.css +87 -0
  298. package/dist/segmented-control/SegmentedControl.d.ts +35 -0
  299. package/dist/segmented-control/SegmentedControl.d.ts.map +1 -0
  300. package/dist/segmented-control/SegmentedControl.js +142 -0
  301. package/dist/segmented-control/SegmentedControl.js.map +1 -0
  302. package/dist/segmented-control/SegmentedControl.module.js +16 -0
  303. package/dist/segmented-control/SegmentedControl.module.js.map +1 -0
  304. package/dist/segmented-control/tokens.d.ts +3 -0
  305. package/dist/segmented-control/tokens.d.ts.map +1 -0
  306. package/dist/segmented-control/tokens.js +33 -0
  307. package/dist/segmented-control/tokens.js.map +1 -0
  308. package/dist/select/ListBox.css +86 -1
  309. package/dist/select/ListBox.module.js +11 -3
  310. package/dist/select/ListBox.module.js.map +1 -1
  311. package/dist/select/Select.d.ts +14 -1
  312. package/dist/select/Select.d.ts.map +1 -1
  313. package/dist/select/Select.js +352 -92
  314. package/dist/select/Select.js.map +1 -1
  315. package/dist/select/listBoxTokens.d.ts +1 -1
  316. package/dist/select/listBoxTokens.d.ts.map +1 -1
  317. package/dist/select/listBoxTokens.js +2 -0
  318. package/dist/select/listBoxTokens.js.map +1 -1
  319. package/dist/skeleton/LoadingRegion.d.ts +16 -0
  320. package/dist/skeleton/LoadingRegion.d.ts.map +1 -0
  321. package/dist/skeleton/LoadingRegion.js +65 -0
  322. package/dist/skeleton/LoadingRegion.js.map +1 -0
  323. package/dist/skeleton/Skeleton.css +62 -0
  324. package/dist/skeleton/Skeleton.d.ts +25 -0
  325. package/dist/skeleton/Skeleton.d.ts.map +1 -0
  326. package/dist/skeleton/Skeleton.js +106 -0
  327. package/dist/skeleton/Skeleton.js.map +1 -0
  328. package/dist/skeleton/Skeleton.module.js +22 -0
  329. package/dist/skeleton/Skeleton.module.js.map +1 -0
  330. package/dist/skeleton/tokens.d.ts +3 -0
  331. package/dist/skeleton/tokens.d.ts.map +1 -0
  332. package/dist/skeleton/tokens.js +15 -0
  333. package/dist/skeleton/tokens.js.map +1 -0
  334. package/dist/slider/Slider.css +94 -0
  335. package/dist/slider/Slider.d.ts +20 -0
  336. package/dist/slider/Slider.d.ts.map +1 -0
  337. package/dist/slider/Slider.js +248 -0
  338. package/dist/slider/Slider.js.map +1 -0
  339. package/dist/slider/Slider.module.js +20 -0
  340. package/dist/slider/Slider.module.js.map +1 -0
  341. package/dist/sparkline/Sparkline.css +44 -0
  342. package/dist/sparkline/Sparkline.d.ts +23 -0
  343. package/dist/sparkline/Sparkline.d.ts.map +1 -0
  344. package/dist/sparkline/Sparkline.js +164 -0
  345. package/dist/sparkline/Sparkline.js.map +1 -0
  346. package/dist/sparkline/Sparkline.module.js +20 -0
  347. package/dist/sparkline/Sparkline.module.js.map +1 -0
  348. package/dist/sparkline/tokens.d.ts +3 -0
  349. package/dist/sparkline/tokens.d.ts.map +1 -0
  350. package/dist/sparkline/tokens.js +17 -0
  351. package/dist/sparkline/tokens.js.map +1 -0
  352. package/dist/spinner/Spinner.css +21 -6
  353. package/dist/spinner/Spinner.d.ts.map +1 -1
  354. package/dist/spinner/Spinner.js +60 -10
  355. package/dist/spinner/Spinner.js.map +1 -1
  356. package/dist/spinner/Spinner.module.js +5 -1
  357. package/dist/spinner/Spinner.module.js.map +1 -1
  358. package/dist/spinner/tokens.d.ts +1 -1
  359. package/dist/spinner/tokens.js.map +1 -1
  360. package/dist/stack/Stack.d.ts +1 -1
  361. package/dist/stack/Stack.js +60 -7
  362. package/dist/stack/Stack.js.map +1 -1
  363. package/dist/stack/tokens.d.ts +1 -1
  364. package/dist/stack/tokens.js.map +1 -1
  365. package/dist/stat/Stat.css +79 -0
  366. package/dist/stat/Stat.d.ts +49 -0
  367. package/dist/stat/Stat.d.ts.map +1 -0
  368. package/dist/stat/Stat.js +127 -0
  369. package/dist/stat/Stat.js.map +1 -0
  370. package/dist/stat/Stat.module.js +28 -0
  371. package/dist/stat/Stat.module.js.map +1 -0
  372. package/dist/stat/tokens.d.ts +3 -0
  373. package/dist/stat/tokens.d.ts.map +1 -0
  374. package/dist/stat/tokens.js +21 -0
  375. package/dist/stat/tokens.js.map +1 -0
  376. package/dist/switch/Switch.css +16 -10
  377. package/dist/switch/Switch.d.ts +1 -1
  378. package/dist/switch/Switch.js +68 -11
  379. package/dist/switch/Switch.js.map +1 -1
  380. package/dist/switch/Switch.module.js.map +1 -1
  381. package/dist/switch/tokens.d.ts +1 -1
  382. package/dist/switch/tokens.d.ts.map +1 -1
  383. package/dist/switch/tokens.js +4 -2
  384. package/dist/switch/tokens.js.map +1 -1
  385. package/dist/tabs/Tabs.css +11 -4
  386. package/dist/tabs/Tabs.js +1 -1
  387. package/dist/tabs/Tabs.js.map +1 -1
  388. package/dist/tabs/Tabs.module.js.map +1 -1
  389. package/dist/tabs/tokens.d.ts +1 -1
  390. package/dist/tabs/tokens.js +1 -1
  391. package/dist/tabs/tokens.js.map +1 -1
  392. package/dist/tags-input/TagsInput.css +73 -0
  393. package/dist/tags-input/TagsInput.d.ts +32 -0
  394. package/dist/tags-input/TagsInput.d.ts.map +1 -0
  395. package/dist/tags-input/TagsInput.js +316 -0
  396. package/dist/tags-input/TagsInput.js.map +1 -0
  397. package/dist/tags-input/TagsInput.module.js +20 -0
  398. package/dist/tags-input/TagsInput.module.js.map +1 -0
  399. package/dist/text/Text.d.ts +1 -1
  400. package/dist/text/Text.js +70 -5
  401. package/dist/text/Text.js.map +1 -1
  402. package/dist/text/tokens.d.ts +1 -1
  403. package/dist/text/tokens.js.map +1 -1
  404. package/dist/text-area/TextArea.d.ts +1 -1
  405. package/dist/text-area/TextArea.js +135 -28
  406. package/dist/text-area/TextArea.js.map +1 -1
  407. package/dist/text-input/TextInput.d.ts +7 -3
  408. package/dist/text-input/TextInput.d.ts.map +1 -1
  409. package/dist/text-input/TextInput.js +164 -47
  410. package/dist/text-input/TextInput.js.map +1 -1
  411. package/dist/theme/Tone.css +14 -0
  412. package/dist/theme/Tone.module.js +4 -2
  413. package/dist/theme/Tone.module.js.map +1 -1
  414. package/dist/theme/bootstrap.d.ts +2 -2
  415. package/dist/theme/bootstrap.d.ts.map +1 -1
  416. package/dist/theme/bootstrap.js +6 -0
  417. package/dist/theme/bootstrap.js.map +1 -1
  418. package/dist/theme/chartColors.js.map +1 -1
  419. package/dist/theme/checkTheme.d.ts +6 -4
  420. package/dist/theme/checkTheme.d.ts.map +1 -1
  421. package/dist/theme/checkTheme.js +54 -7
  422. package/dist/theme/checkTheme.js.map +1 -1
  423. package/dist/theme/cli.d.ts +2 -2
  424. package/dist/theme/cli.js.map +1 -1
  425. package/dist/theme/color.d.ts +13 -0
  426. package/dist/theme/color.d.ts.map +1 -1
  427. package/dist/theme/color.js +41 -1
  428. package/dist/theme/color.js.map +1 -1
  429. package/dist/theme/colorVision.d.ts +1 -1
  430. package/dist/theme/colorVision.js.map +1 -1
  431. package/dist/theme/componentTokens.js.map +1 -1
  432. package/dist/theme/components.d.ts +24 -11
  433. package/dist/theme/components.d.ts.map +1 -1
  434. package/dist/theme/components.js +26 -0
  435. package/dist/theme/components.js.map +1 -1
  436. package/dist/theme/defineTheme.d.ts +5 -5
  437. package/dist/theme/defineTheme.js.map +1 -1
  438. package/dist/theme/fonts.js.map +1 -1
  439. package/dist/theme/index.d.ts +12 -12
  440. package/dist/theme/index.js +1 -1
  441. package/dist/theme/selectedTokens.d.ts +11 -0
  442. package/dist/theme/selectedTokens.d.ts.map +1 -0
  443. package/dist/theme/selectedTokens.js +23 -0
  444. package/dist/theme/selectedTokens.js.map +1 -0
  445. package/dist/theme/semanticTokens.d.ts +1 -1
  446. package/dist/theme/semanticTokens.d.ts.map +1 -1
  447. package/dist/theme/semanticTokens.js +10 -0
  448. package/dist/theme/semanticTokens.js.map +1 -1
  449. package/dist/theme/theme.d.ts +2 -2
  450. package/dist/theme/theme.js.map +1 -1
  451. package/dist/theme/toneClass.d.ts +1 -1
  452. package/dist/theme/toneClass.js.map +1 -1
  453. package/dist/theme/tones.d.ts +15 -3
  454. package/dist/theme/tones.d.ts.map +1 -1
  455. package/dist/theme/tones.js +14 -2
  456. package/dist/theme/tones.js.map +1 -1
  457. package/dist/time-input/TimeInput.d.ts +1 -1
  458. package/dist/time-input/TimeInput.js +138 -31
  459. package/dist/time-input/TimeInput.js.map +1 -1
  460. package/dist/toast/Toast.css +180 -19
  461. package/dist/toast/Toast.d.ts +61 -10
  462. package/dist/toast/Toast.d.ts.map +1 -1
  463. package/dist/toast/Toast.js +246 -70
  464. package/dist/toast/Toast.js.map +1 -1
  465. package/dist/toast/Toast.module.js +6 -3
  466. package/dist/toast/Toast.module.js.map +1 -1
  467. package/dist/toast/tokens.d.ts +1 -1
  468. package/dist/toast/tokens.js +1 -1
  469. package/dist/toast/tokens.js.map +1 -1
  470. package/dist/tooltip/Tooltip.css +1 -1
  471. package/dist/tooltip/Tooltip.js +38 -8
  472. package/dist/tooltip/Tooltip.js.map +1 -1
  473. package/dist/tooltip/Tooltip.module.js.map +1 -1
  474. package/dist/tooltip/tokens.d.ts +1 -1
  475. package/dist/tooltip/tokens.js.map +1 -1
  476. package/dist/utils/cx.js.map +1 -1
  477. package/dist/utils/events.d.ts +4 -0
  478. package/dist/utils/events.d.ts.map +1 -0
  479. package/dist/utils/events.js +9 -0
  480. package/dist/utils/events.js.map +1 -0
  481. package/dist/utils/preference.d.ts +7 -0
  482. package/dist/utils/preference.d.ts.map +1 -0
  483. package/dist/utils/preference.js +54 -0
  484. package/dist/utils/preference.js.map +1 -0
  485. package/package.json +5 -5
@@ -1,8 +1,11 @@
1
1
  import { alertTokens } from "../alert/tokens.js";
2
+ import { asideTokens } from "../aside/tokens.js";
2
3
  import { badgeTokens } from "../badge/tokens.js";
4
+ import { barChartTokens } from "../bar-chart/tokens.js";
3
5
  import { buttonTokens } from "../button/tokens.js";
4
6
  import { cardTokens } from "../card/tokens.js";
5
7
  import { checkboxTokens } from "../checkbox/tokens.js";
8
+ import { commandPaletteTokens } from "../command-palette/tokens.js";
6
9
  import { containerTokens } from "../container/tokens.js";
7
10
  import { calendarTokens } from "../date-picker/calendarTokens.js";
8
11
  import { dialogTokens } from "../dialog/tokens.js";
@@ -12,19 +15,29 @@ import { inputTokens } from "../field/inputTokens.js";
12
15
  import { fieldTokens } from "../field/tokens.js";
13
16
  import { gridTokens } from "../grid/tokens.js";
14
17
  import { headingTokens } from "../heading/tokens.js";
18
+ import { iconTokens } from "../icon/tokens.js";
15
19
  import { inlineTokens } from "../inline/tokens.js";
20
+ import { lineChartTokens } from "../line-chart/tokens.js";
21
+ import { menuTokens } from "../menu/tokens.js";
22
+ import { meterTokens } from "../meter/tokens.js";
16
23
  import { numberInputTokens } from "../number-input/tokens.js";
24
+ import { pillTriggerTokens } from "../pill-trigger/tokens.js";
17
25
  import { popoverTokens } from "../popover/tokens.js";
18
26
  import { proseTokens } from "../prose/tokens.js";
19
27
  import { radioTokens } from "../radio-group/tokens.js";
28
+ import { segmentedControlTokens } from "../segmented-control/tokens.js";
20
29
  import { listBoxTokens } from "../select/listBoxTokens.js";
30
+ import { skeletonTokens } from "../skeleton/tokens.js";
31
+ import { sparklineTokens } from "../sparkline/tokens.js";
21
32
  import { spinnerTokens } from "../spinner/tokens.js";
22
33
  import { stackTokens } from "../stack/tokens.js";
34
+ import { statTokens } from "../stat/tokens.js";
23
35
  import { switchTokens } from "../switch/tokens.js";
24
36
  import { tabsTokens } from "../tabs/tokens.js";
25
37
  import { textTokens } from "../text/tokens.js";
26
38
  import { toastTokens } from "../toast/tokens.js";
27
39
  import { tooltipTokens } from "../tooltip/tokens.js";
40
+ import { selectedTokens } from "./selectedTokens.js";
28
41
  //#region src/theme/components.ts
29
42
  /**
30
43
  * The component tokens of `@panneau/ui` and their defaults, by component: what a theme, a scope or
@@ -32,11 +45,14 @@ import { tooltipTokens } from "../tooltip/tokens.js";
32
45
  */
33
46
  var componentTokens = Object.freeze({
34
47
  alert: alertTokens.tokens,
48
+ aside: asideTokens.tokens,
35
49
  badge: badgeTokens.tokens,
50
+ "bar-chart": barChartTokens.tokens,
36
51
  button: buttonTokens.tokens,
37
52
  calendar: calendarTokens.tokens,
38
53
  card: cardTokens.tokens,
39
54
  checkbox: checkboxTokens.tokens,
55
+ "command-palette": commandPaletteTokens.tokens,
40
56
  container: containerTokens.tokens,
41
57
  dialog: dialogTokens.tokens,
42
58
  disclosure: disclosureTokens.tokens,
@@ -44,15 +60,25 @@ var componentTokens = Object.freeze({
44
60
  field: fieldTokens.tokens,
45
61
  grid: gridTokens.tokens,
46
62
  heading: headingTokens.tokens,
63
+ icon: iconTokens.tokens,
47
64
  inline: inlineTokens.tokens,
48
65
  input: inputTokens.tokens,
66
+ "line-chart": lineChartTokens.tokens,
49
67
  "list-box": listBoxTokens.tokens,
68
+ menu: menuTokens.tokens,
69
+ meter: meterTokens.tokens,
50
70
  "number-input": numberInputTokens.tokens,
71
+ "pill-trigger": pillTriggerTokens.tokens,
51
72
  popover: popoverTokens.tokens,
52
73
  prose: proseTokens.tokens,
53
74
  radio: radioTokens.tokens,
75
+ "segmented-control": segmentedControlTokens.tokens,
76
+ selected: selectedTokens.tokens,
77
+ skeleton: skeletonTokens.tokens,
78
+ sparkline: sparklineTokens.tokens,
54
79
  spinner: spinnerTokens.tokens,
55
80
  stack: stackTokens.tokens,
81
+ stat: statTokens.tokens,
56
82
  switch: switchTokens.tokens,
57
83
  tabs: tabsTokens.tokens,
58
84
  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","asideTokens","badgeTokens","barChartTokens","buttonTokens","cardTokens","checkboxTokens","commandPaletteTokens","containerTokens","calendarTokens","dialogTokens","disclosureTokens","dividerTokens","inputTokens","fieldTokens","gridTokens","headingTokens","iconTokens","inlineTokens","lineChartTokens","menuTokens","meterTokens","numberInputTokens","pillTriggerTokens","popoverTokens","proseTokens","radioTokens","segmentedControlTokens","listBoxTokens","skeletonTokens","sparklineTokens","spinnerTokens","stackTokens","statTokens","switchTokens","tabsTokens","textTokens","toastTokens","tooltipTokens","selectedTokens","componentTokens","Object","freeze","alert","tokens","aside","badge","button","calendar","card","checkbox","container","dialog","disclosure","divider","field","grid","heading","icon","inline","input","menu","meter","popover","prose","radio","selected","skeleton","sparkline","spinner","stack","stat","switch","tabs","text","toast","tooltip","ComponentTokenName","Component"],"sources":["../../src/theme/components.ts"],"sourcesContent":["import { alertTokens } from '../alert/tokens';\nimport { asideTokens } from '../aside/tokens';\nimport { badgeTokens } from '../badge/tokens';\nimport { barChartTokens } from '../bar-chart/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 { iconTokens } from '../icon/tokens';\nimport { inlineTokens } from '../inline/tokens';\nimport { lineChartTokens } from '../line-chart/tokens';\nimport { menuTokens } from '../menu/tokens';\nimport { meterTokens } from '../meter/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 { sparklineTokens } from '../sparkline/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';\nimport { selectedTokens } from './selectedTokens';\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 aside: asideTokens.tokens,\n badge: badgeTokens.tokens,\n 'bar-chart': barChartTokens.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 icon: iconTokens.tokens,\n inline: inlineTokens.tokens,\n input: inputTokens.tokens,\n 'line-chart': lineChartTokens.tokens,\n 'list-box': listBoxTokens.tokens,\n menu: menuTokens.tokens,\n meter: meterTokens.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 selected: selectedTokens.tokens,\n skeleton: skeletonTokens.tokens,\n sparkline: sparklineTokens.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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,IAAawC,kBAAkBC,OAAOC,OAAO;CACzCC,OAAO3C,YAAY4C;CACnBC,OAAO5C,YAAY2C;CACnBE,OAAO5C,YAAY0C;CACnB,aAAazC,eAAeyC;CAC5BG,QAAQ3C,aAAawC;CACrBI,UAAUvC,eAAemC;CACzBK,MAAM5C,WAAWuC;CACjBM,UAAU5C,eAAesC;CACzB,mBAAmBrC,qBAAqBqC;CACxCO,WAAW3C,gBAAgBoC;CAC3BQ,QAAQ1C,aAAakC;CACrBS,YAAY1C,iBAAiBiC;CAC7BU,SAAS1C,cAAcgC;CACvBW,OAAOzC,YAAY8B;CACnBY,MAAMzC,WAAW6B;CACjBa,SAASzC,cAAc4B;CACvBc,MAAMzC,WAAW2B;CACjBe,QAAQzC,aAAa0B;CACrBgB,OAAO/C,YAAY+B;CACnB,cAAczB,gBAAgByB;CAC9B,YAAYhB,cAAcgB;CAC1BiB,MAAMzC,WAAWwB;CACjBkB,OAAOzC,YAAYuB;CACnB,gBAAgBtB,kBAAkBsB;CAClC,gBAAgBrB,kBAAkBqB;CAClCmB,SAASvC,cAAcoB;CACvBoB,OAAOvC,YAAYmB;CACnBqB,OAAOvC,YAAYkB;CACnB,qBAAqBjB,uBAAuBiB;CAC5CsB,UAAU3B,eAAeK;CACzBuB,UAAUtC,eAAee;CACzBwB,WAAWtC,gBAAgBc;CAC3ByB,SAAStC,cAAca;CACvB0B,OAAOtC,YAAYY;CACnB2B,MAAMtC,WAAWW;CACjB4B,QAAQtC,aAAaU;CACrB6B,MAAMtC,WAAWS;CACjB8B,MAAMtC,WAAWQ;CACjB+B,OAAOtC,YAAYO;CACnBgC,SAAStC,cAAcM;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;IAAO,GAAG,OAAO,WAAW;GAAM,CAAC,CAC9D,CACL,EACJ;EACJ,CAAC;CAET,CAAC,CACL;AACJ;AAEA,IAAM,YAAY;CAAC;CAAW;CAAe;AAAO;AAEpD,SAAS,eAAe,OAA2B,QAAgD;CAC/F,IAAI,UAAU,KAAA,KAAa,WAAW,KAAA,GAClC;CAEJ,MAAM,YAAY;EAAE,GAAG;EAAO,GAAG;CAAO;CACxC,UAAU,SAAS,YAAY;EAC3B,IAAI,QAAQ,aAAa,KAAA,KAAa,SAAS,aAAa,KAAA,GACxD,UAAU,WAAW;GAAE,GAAG,MAAM;GAAU,GAAG,O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A,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}\"` : ''}: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WAAW,CAACA,QAAiB;CACvF,MAAMK,WAAW;EAAE,GAAGJ;EAAKhE,QAAQgE,IAAIhE,UAAU,CAAC;CAAE;CACpD,MAAM2C,QAAQJ,YAAY,GAAG0B,OAAOG,QAAQ;CAC5C,MAAMC,UAAUd,kBAAkBa,QAAQ;CAC1C,IAAIC,QAAQtB,SAAS,GACjBuB,QAAQC,KACJ,oCAAoC5B,MAAM7C,UAAUkB,KAAAA,IAAY,KAAK2B,MAAM7C,MAAK,KAAM,GAAE,IAAKuE,QAAQG,KAAK,IAAI,EAAC,EACnH;CAEJ,OAAO7B;AACX"}
@@ -1 +1 @@
1
- {"version":3,"file":"fonts.js","names":[],"sources":["../../src/theme/fonts.ts"],"sourcesContent":["/** A font face of a theme, written as an `@font-face` rule. */\nexport type ThemeFontFace = {\n /** The family name that font tokens use: `'Geist'`. */\n family: string;\n /** The `src` descriptor: `url(/fonts/geist.woff2) format('woff2')`. */\n src: string;\n /** A weight or a range of a variable font: `400`, `400 700`. */\n weight?: string;\n /** `normal` or `italic`. */\n style?: string;\n /** Defaults to `swap`. */\n display?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';\n unicodeRange?: string;\n};\n\n/** A hosted stylesheet that declares font faces: Google Fonts, Adobe Fonts, a site's own. */\nexport type ThemeFontStylesheet = {\n stylesheet: string;\n};\n\n/**\n * A font of a theme: a face, or a stylesheet that declares faces. `PanneauRoot` adds them to the\n * page once, however many roots use the theme. Font faces are global by nature, unlike tokens.\n */\nexport type ThemeFont = ThemeFontFace | ThemeFontStylesheet;\n\n/** Values that could break out of an `@font-face` rule, or out of the family name. */\nconst UNSAFE = /[{}<]/;\nconst UNSAFE_FAMILY = /[{}<;\"\\\\]/;\nconst UNSAFE_DESCRIPTOR = /[{}<;]/;\n\nfunction isFace(font: ThemeFont): font is ThemeFontFace {\n return 'family' in font && 'src' in font;\n}\n\n/**\n * The `@font-face` rules of the fonts of a theme. Faces with a value that could break out of the\n * rule are ignored: `{`, `}` or `<` anywhere, `;` outside of `src` (which can hold data URLs), and\n * quotes or backslashes in the family.\n */\nexport function getFontFaceCss(fonts: readonly ThemeFont[] = []): string {\n return fonts\n .filter(isFace)\n .filter(\n (face) =>\n !UNSAFE_FAMILY.test(face.family) &&\n !UNSAFE.test(face.src) &&\n [face.weight, face.style, face.display, face.unicodeRange].every(\n (value) => value === undefined || !UNSAFE_DESCRIPTOR.test(value),\n ),\n )\n .map((face) =>\n [\n `@font-face{font-family:\"${face.family}\";src:${face.src};`,\n face.weight !== undefined ? `font-weight:${face.weight};` : '',\n face.style !== undefined ? `font-style:${face.style};` : '',\n `font-display:${face.display ?? 'swap'};`,\n face.unicodeRange !== undefined ? `unicode-range:${face.unicodeRange};` : '',\n '}',\n ].join(''),\n )\n .join('');\n}\n\n/** The URLs of the font stylesheets of a theme, without duplicates. */\nexport function getFontStylesheets(fonts: readonly ThemeFont[] = []): string[] {\n return [\n ...new Set(\n fonts.flatMap((font) =>\n 'stylesheet' in font && typeof font.stylesheet === 'string'\n ? [font.stylesheet]\n : [],\n ),\n ),\n ];\n}\n"],"mappings":";;AA2BA,IAAM,SAAS;AACf,IAAM,gBAAgB;AACtB,IAAM,oBAAoB;AAE1B,SAAS,OAAO,MAAwC;CACpD,OAAO,YAAY,QAAQ,SAAS;AACxC;;;;;;AAOA,SAAgB,eAAe,QAA8B,CAAA,GAAY;CACrE,OAAO,MACF,OAAO,MAAM,CAAC,CACd,QACI,SACG,CAAC,cAAc,KAAK,KAAK,MAAM,KAC/B,CAAC,OAAO,KAAK,KAAK,GAAG,KACrB;EAAC,KAAK;EAAQ,KAAK;EAAO,KAAK;EAAS,KAAK;CAAY,CAAC,CAAC,OACtD,UAAU,UAAU,KAAA,KAAa,CAAC,kBAAkB,KAAK,KAAK,CACnE,CACR,CAAC,CACA,KAAK,SACF;EACI,2BAA2B,KAAK,OAAM,QAAS,KAAK,IAAG;EACvD,KAAK,WAAW,KAAA,IAAY,eAAe,KAAK,OAAM,KAAM;EAC5D,KAAK,UAAU,KAAA,IAAY,cAAc,KAAK,MAAK,KAAM;EACzD,gBAAgB,KAAK,WAAW,OAAM;EACtC,KAAK,iBAAiB,KAAA,IAAY,iBAAiB,KAAK,aAAY,KAAM;EAC1E;CAAG,CACN,CAAC,KAAK,EAAE,CACb,CAAC,CACA,KAAK,EAAE;AAChB;;AAGA,SAAgB,mBAAmB,QAA8B,CAAA,GAAc;CAC3E,OAAO,CACH,GAAG,IAAI,IACH,MAAM,SAAS,SACX,gBAAgB,QAAQ,OAAO,KAAK,eAAe,WAC7C,CAAC,KAAK,UAAU,IAChB,CAAA,CACV,CACJ,CAAC;AAET"}
1
+ {"version":3,"file":"fonts.js","names":["ThemeFontFace","family","src","weight","style","display","unicodeRange","ThemeFontStylesheet","stylesheet","ThemeFont","UNSAFE","UNSAFE_FAMILY","UNSAFE_DESCRIPTOR","isFace","font","getFontFaceCss","fonts","filter","face","test","every","value","undefined","map","join","getFontStylesheets","Set","flatMap"],"sources":["../../src/theme/fonts.ts"],"sourcesContent":["/** A font face of a theme, written as an `@font-face` rule. */\nexport type ThemeFontFace = {\n /** The family name that font tokens use: `'Geist'`. */\n family: string;\n /** The `src` descriptor: `url(/fonts/geist.woff2) format('woff2')`. */\n src: string;\n /** A weight or a range of a variable font: `400`, `400 700`. */\n weight?: string;\n /** `normal` or `italic`. */\n style?: string;\n /** Defaults to `swap`. */\n display?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';\n unicodeRange?: string;\n};\n\n/** A hosted stylesheet that declares font faces: Google Fonts, Adobe Fonts, a site's own. */\nexport type ThemeFontStylesheet = {\n stylesheet: string;\n};\n\n/**\n * A font of a theme: a face, or a stylesheet that declares faces. `PanneauRoot` adds them to the\n * page once, however many roots use the theme. Font faces are global by nature, unlike tokens.\n */\nexport type ThemeFont = ThemeFontFace | ThemeFontStylesheet;\n\n/** Values that could break out of an `@font-face` rule, or out of the family name. */\nconst UNSAFE = /[{}<]/;\nconst UNSAFE_FAMILY = /[{}<;\"\\\\]/;\nconst UNSAFE_DESCRIPTOR = /[{}<;]/;\n\nfunction isFace(font: ThemeFont): font is ThemeFontFace {\n return 'family' in font && 'src' in font;\n}\n\n/**\n * The `@font-face` rules of the fonts of a theme. Faces with a value that could break out of the\n * rule are ignored: `{`, `}` or `<` anywhere, `;` outside of `src` (which can hold data URLs), and\n * quotes or backslashes in the family.\n */\nexport function getFontFaceCss(fonts: readonly ThemeFont[] = []): string {\n return fonts\n .filter(isFace)\n .filter(\n (face) =>\n !UNSAFE_FAMILY.test(face.family) &&\n !UNSAFE.test(face.src) &&\n [face.weight, face.style, face.display, face.unicodeRange].every(\n (value) => value === undefined || !UNSAFE_DESCRIPTOR.test(value),\n ),\n )\n .map((face) =>\n [\n `@font-face{font-family:\"${face.family}\";src:${face.src};`,\n face.weight !== undefined ? `font-weight:${face.weight};` : '',\n face.style !== undefined ? `font-style:${face.style};` : '',\n `font-display:${face.display ?? 'swap'};`,\n face.unicodeRange !== undefined ? `unicode-range:${face.unicodeRange};` : '',\n '}',\n ].join(''),\n )\n .join('');\n}\n\n/** The URLs of the font stylesheets of a theme, without duplicates. */\nexport function getFontStylesheets(fonts: readonly ThemeFont[] = []): string[] {\n return [\n ...new Set(\n fonts.flatMap((font) =>\n 'stylesheet' in font && typeof font.stylesheet === 'string'\n ? [font.stylesheet]\n : [],\n ),\n ),\n ];\n}\n"],"mappings":";;AA2BA,IAAMU,SAAS;AACf,IAAMC,gBAAgB;AACtB,IAAMC,oBAAoB;AAE1B,SAASC,OAAOC,MAAwC;CACpD,OAAO,YAAYA,QAAQ,SAASA;AACxC;;;;;;AAOA,SAAgBC,eAAeC,QAA8B,CAAA,GAAY;CACrE,OAAOA,MACFC,OAAOJ,MAAM,CAAC,CACdI,QACIC,SACG,CAACP,cAAcQ,KAAKD,KAAKjB,MAAM,KAC/B,CAACS,OAAOS,KAAKD,KAAKhB,GAAG,KACrB;EAACgB,KAAKf;EAAQe,KAAKd;EAAOc,KAAKb;EAASa,KAAKZ;CAAY,CAAC,CAACc,OACtDC,UAAUA,UAAUC,KAAAA,KAAa,CAACV,kBAAkBO,KAAKE,KAAK,CACnE,CACR,CAAC,CACAE,KAAKL,SACF;EACI,2BAA2BA,KAAKjB,OAAM,QAASiB,KAAKhB,IAAG;EACvDgB,KAAKf,WAAWmB,KAAAA,IAAY,eAAeJ,KAAKf,OAAM,KAAM;EAC5De,KAAKd,UAAUkB,KAAAA,IAAY,cAAcJ,KAAKd,MAAK,KAAM;EACzD,gBAAgBc,KAAKb,WAAW,OAAM;EACtCa,KAAKZ,iBAAiBgB,KAAAA,IAAY,iBAAiBJ,KAAKZ,aAAY,KAAM;EAC1E;CAAG,CACN,CAACkB,KAAK,EAAE,CACb,CAAC,CACAA,KAAK,EAAE;AAChB;;AAGA,SAAgBC,mBAAmBT,QAA8B,CAAA,GAAc;CAC3E,OAAO,CACH,GAAG,IAAIU,IACHV,MAAMW,SAASb,SACX,gBAAgBA,QAAQ,OAAOA,KAAKN,eAAe,WAC7C,CAACM,KAAKN,UAAU,IAChB,CAAA,CACV,CACJ,CAAC;AAET"}
@@ -1,13 +1,13 @@
1
- export { bootstrapTheme, bootstrapTone } from './bootstrap';
2
- export { CHART_CATEGORICAL_COUNT, CHART_SEQUENTIAL_COUNT, chartColors } from './chartColors';
3
- export { type ThemeContrastCheck, type ThemeReport, checkTheme } from './checkTheme';
4
- export { type ColorDifferenceCheck, type ColorVisionDeficiency, checkColorDifferences, } from './colorVision';
5
- export { type Rgb } from './color';
6
- export { type ComponentTokens, defineComponentTokens } from './componentTokens';
7
- export { type ComponentTokenName, componentTokens } from './components';
8
- export { type PaletteTokenName, type PanneauTokens, type ThemeDefinition, type ThemeTokens, type TokenName, defineTheme, findUnknownTokens, mergeThemes, } from './defineTheme';
9
- export { type ThemeFont, type ThemeFontFace, type ThemeFontStylesheet } from './fonts';
10
- export { SEMANTIC_TOKENS, type SemanticTokenName } from './semanticTokens';
11
- export { type ColorScheme, type Density, type Theme } from './theme';
12
- export { BUILT_IN_TONES, type PanneauTones, type Tone, type ToneInput, type ToneSurfaces, type ToneValues, deriveTone, toneClassName, } from './tones';
1
+ export { bootstrapTheme, bootstrapTone } from './bootstrap.js';
2
+ export { CHART_CATEGORICAL_COUNT, CHART_SEQUENTIAL_COUNT, chartColors } from './chartColors.js';
3
+ export { type ThemeContrastCheck, type ThemeReport, checkTheme } from './checkTheme.js';
4
+ export { type ColorDifferenceCheck, type ColorVisionDeficiency, checkColorDifferences, } from './colorVision.js';
5
+ export { type Rgb } from './color.js';
6
+ export { type ComponentTokens, defineComponentTokens } from './componentTokens.js';
7
+ export { type ComponentTokenName, componentTokens } from './components.js';
8
+ export { type PaletteTokenName, type PanneauTokens, type ThemeDefinition, type ThemeTokens, type TokenName, defineTheme, findUnknownTokens, mergeThemes, } from './defineTheme.js';
9
+ export { type ThemeFont, type ThemeFontFace, type ThemeFontStylesheet } from './fonts.js';
10
+ export { SEMANTIC_TOKENS, type SemanticTokenName } from './semanticTokens.js';
11
+ export { type ColorScheme, type Density, type Theme } from './theme.js';
12
+ export { BUILT_IN_TONES, type PanneauTones, type Tone, type ToneInput, type ToneSurfaces, type ToneValues, deriveTone, toneClassName, } from './tones.js';
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { BUILT_IN_TONES, deriveTone, toneClassName } from "./tones.js";
2
- import { bootstrapTheme, bootstrapTone } from "./bootstrap.js";
3
2
  import { CHART_CATEGORICAL_COUNT, CHART_SEQUENTIAL_COUNT, chartColors } from "./chartColors.js";
3
+ import { bootstrapTheme, bootstrapTone } from "./bootstrap.js";
4
4
  import { checkColorDifferences } from "./colorVision.js";
5
5
  import { checkTheme } from "./checkTheme.js";
6
6
  import { defineComponentTokens } from "./componentTokens.js";
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Tokens of what is selected, checked or current: checked boxes, radios and switches, the selected
3
+ * day of a calendar, the current tab, the value of a slider, selected rows, cards and media.
4
+ *
5
+ * They default to the accent, which a theme can keep for its main action only, as Bootstrap does
6
+ * with `$component-active-bg` next to `$primary`: a yellow main action, and black selections.
7
+ * Like other component tokens they are read with their default as a fallback and never declared,
8
+ * so a scope that changes the accent changes the selections in it, unless a theme sets them.
9
+ */
10
+ export declare const selectedTokens: import("./componentTokens.js").ComponentTokens<"selected", "panneau-selected-text" | "panneau-selected-subtle" | "panneau-selected-bg">;
11
+ //# sourceMappingURL=selectedTokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectedTokens.d.ts","sourceRoot":"","sources":["../../src/theme/selectedTokens.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,sIAOzB,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { defineComponentTokens } from "./componentTokens.js";
2
+ //#region src/theme/selectedTokens.ts
3
+ /**
4
+ * Tokens of what is selected, checked or current: checked boxes, radios and switches, the selected
5
+ * day of a calendar, the current tab, the value of a slider, selected rows, cards and media.
6
+ *
7
+ * They default to the accent, which a theme can keep for its main action only, as Bootstrap does
8
+ * with `$component-active-bg` next to `$primary`: a yellow main action, and black selections.
9
+ * Like other component tokens they are read with their default as a fallback and never declared,
10
+ * so a scope that changes the accent changes the selections in it, unless a theme sets them.
11
+ */
12
+ var selectedTokens = defineComponentTokens("selected", {
13
+ /** Fill of what is selected or checked, and the border of a selected card or row. */
14
+ bg: "var(--panneau-color-accent)",
15
+ /** Text and icons on that fill: the check mark, the selected day. */
16
+ text: "var(--panneau-color-accent-text)",
17
+ /** Background of a selected row, card, or range of days. */
18
+ subtle: "var(--panneau-color-accent-subtle)"
19
+ });
20
+ //#endregion
21
+ export { selectedTokens };
22
+
23
+ //# sourceMappingURL=selectedTokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectedTokens.js","names":["defineComponentTokens","selectedTokens","bg","text","subtle"],"sources":["../../src/theme/selectedTokens.ts"],"sourcesContent":["import { defineComponentTokens } from './componentTokens';\n\n/**\n * Tokens of what is selected, checked or current: checked boxes, radios and switches, the selected\n * day of a calendar, the current tab, the value of a slider, selected rows, cards and media.\n *\n * They default to the accent, which a theme can keep for its main action only, as Bootstrap does\n * with `$component-active-bg` next to `$primary`: a yellow main action, and black selections.\n * Like other component tokens they are read with their default as a fallback and never declared,\n * so a scope that changes the accent changes the selections in it, unless a theme sets them.\n */\nexport const selectedTokens = defineComponentTokens('selected', {\n /** Fill of what is selected or checked, and the border of a selected card or row. */\n bg: 'var(--panneau-color-accent)',\n /** Text and icons on that fill: the check mark, the selected day. */\n text: 'var(--panneau-color-accent-text)',\n /** Background of a selected row, card, or range of days. */\n subtle: 'var(--panneau-color-accent-subtle)',\n});\n"],"mappings":";;;;;;;;;;;AAWA,IAAaC,iBAAiBD,sBAAsB,YAAY;;CAE5DE,IAAI;;CAEJC,MAAM;;CAENC,QAAQ;AACZ,CAAC"}
@@ -3,7 +3,7 @@
3
3
  * root (`PanneauRoot.module.css`), and what a theme sets to restyle every component at once
4
4
  * (decision 0024). A test keeps this list in sync with the stylesheet.
5
5
  */
6
- export declare const SEMANTIC_TOKENS: readonly ["panneau-color-bg", "panneau-color-surface", "panneau-color-surface-sunken", "panneau-color-surface-raised", "panneau-color-hover", "panneau-color-pressed", "panneau-color-backdrop", "panneau-color-text", "panneau-color-text-muted", "panneau-color-link", "panneau-color-border", "panneau-color-border-control", "panneau-color-accent", "panneau-color-accent-hover", "panneau-color-accent-text", "panneau-color-accent-subtle", "panneau-color-focus", "panneau-color-danger", "panneau-color-danger-subtle", "panneau-color-danger-border", "panneau-color-danger-solid", "panneau-color-danger-solid-hover", "panneau-color-danger-solid-text", "panneau-color-success", "panneau-color-success-subtle", "panneau-color-success-border", "panneau-color-success-solid", "panneau-color-success-solid-hover", "panneau-color-success-solid-text", "panneau-color-warning", "panneau-color-warning-subtle", "panneau-color-warning-border", "panneau-color-warning-solid", "panneau-color-warning-solid-hover", "panneau-color-warning-solid-text", "panneau-color-info", "panneau-color-info-subtle", "panneau-color-info-border", "panneau-color-info-solid", "panneau-color-info-solid-hover", "panneau-color-info-solid-text", "panneau-chart-categorical-1", "panneau-chart-categorical-2", "panneau-chart-categorical-3", "panneau-chart-categorical-4", "panneau-chart-categorical-5", "panneau-chart-categorical-6", "panneau-chart-categorical-7", "panneau-chart-categorical-8", "panneau-chart-sequential-1", "panneau-chart-sequential-2", "panneau-chart-sequential-3", "panneau-chart-sequential-4", "panneau-chart-sequential-5", "panneau-chart-diverging-negative", "panneau-chart-diverging-neutral", "panneau-chart-diverging-positive", "panneau-font-family-body", "panneau-font-family-heading", "panneau-font-family-display", "panneau-font-family-mono", "panneau-font-family", "panneau-font-numeric", "panneau-font-size-xs", "panneau-font-size-sm", "panneau-font-size-md", "panneau-font-size-lg", "panneau-font-size-xl", "panneau-font-size-control", "panneau-line-height", "panneau-line-height-tight", "panneau-font-weight-normal", "panneau-font-weight-medium", "panneau-font-weight-bold", "panneau-space-1", "panneau-space-2", "panneau-space-3", "panneau-space-4", "panneau-space-5", "panneau-space-6", "panneau-space-8", "panneau-space-10", "panneau-radius-sm", "panneau-radius-md", "panneau-radius-lg", "panneau-radius-full", "panneau-border-width", "panneau-shadow-sm", "panneau-shadow-md", "panneau-shadow-lg", "panneau-control-height", "panneau-control-height-sm", "panneau-control-padding-x", "panneau-row-padding-y", "panneau-focus-width", "panneau-duration", "panneau-z-overlay", "panneau-z-toast"];
6
+ export declare const SEMANTIC_TOKENS: readonly ["panneau-color-bg", "panneau-color-surface", "panneau-color-surface-sunken", "panneau-color-surface-raised", "panneau-color-hover", "panneau-color-pressed", "panneau-color-backdrop", "panneau-color-text", "panneau-color-text-muted", "panneau-color-link", "panneau-color-border", "panneau-color-border-control", "panneau-color-accent", "panneau-color-accent-hover", "panneau-color-accent-text", "panneau-color-accent-subtle", "panneau-color-focus", "panneau-color-danger", "panneau-color-danger-subtle", "panneau-color-danger-border", "panneau-color-danger-solid", "panneau-color-danger-solid-hover", "panneau-color-danger-solid-text", "panneau-color-success", "panneau-color-success-subtle", "panneau-color-success-border", "panneau-color-success-solid", "panneau-color-success-solid-hover", "panneau-color-success-solid-text", "panneau-color-warning", "panneau-color-warning-subtle", "panneau-color-warning-border", "panneau-color-warning-solid", "panneau-color-warning-solid-hover", "panneau-color-warning-solid-text", "panneau-color-info", "panneau-color-info-subtle", "panneau-color-info-border", "panneau-color-info-solid", "panneau-color-info-solid-hover", "panneau-color-info-solid-text", "panneau-color-muted", "panneau-color-muted-subtle", "panneau-color-muted-border", "panneau-color-muted-solid", "panneau-color-muted-solid-hover", "panneau-color-muted-solid-text", "panneau-chart-categorical-1", "panneau-chart-categorical-2", "panneau-chart-categorical-3", "panneau-chart-categorical-4", "panneau-chart-categorical-5", "panneau-chart-categorical-6", "panneau-chart-categorical-7", "panneau-chart-categorical-8", "panneau-chart-sequential-1", "panneau-chart-sequential-2", "panneau-chart-sequential-3", "panneau-chart-sequential-4", "panneau-chart-sequential-5", "panneau-chart-diverging-negative", "panneau-chart-diverging-neutral", "panneau-chart-diverging-positive", "panneau-font-family-body", "panneau-font-family-heading", "panneau-font-family-display", "panneau-font-family-mono", "panneau-font-family", "panneau-font-numeric", "panneau-font-size-xs", "panneau-font-size-sm", "panneau-font-size-md", "panneau-font-size-lg", "panneau-font-size-xl", "panneau-font-size-control", "panneau-line-height", "panneau-line-height-tight", "panneau-font-weight-normal", "panneau-font-weight-medium", "panneau-font-weight-bold", "panneau-space-1", "panneau-space-2", "panneau-space-3", "panneau-space-4", "panneau-space-5", "panneau-space-6", "panneau-space-8", "panneau-space-10", "panneau-radius-sm", "panneau-radius-md", "panneau-radius-lg", "panneau-radius-full", "panneau-border-width", "panneau-shadow-sm", "panneau-shadow-md", "panneau-shadow-lg", "panneau-control-height", "panneau-control-height-sm", "panneau-control-padding-x", "panneau-row-padding-y", "panneau-target-size", "panneau-focus-width", "panneau-duration", "panneau-duration-slow", "panneau-ease-out", "panneau-ease-in", "panneau-z-overlay", "panneau-z-toast"];
7
7
  /** The name of a semantic token, without the leading `--`. */
8
8
  export type SemanticTokenName = (typeof SEMANTIC_TOKENS)[number];
9
9
  //# sourceMappingURL=semanticTokens.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"semanticTokens.d.ts","sourceRoot":"","sources":["../../src/theme/semanticTokens.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,eAAe,4nFAmGlB,CAAC;AAEX,8DAA8D;AAC9D,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"semanticTokens.d.ts","sourceRoot":"","sources":["../../src/theme/semanticTokens.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,eAAe,w4FA6GlB,CAAC;AAEX,8DAA8D;AAC9D,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -46,6 +46,12 @@ var SEMANTIC_TOKENS = [
46
46
  "panneau-color-info-solid",
47
47
  "panneau-color-info-solid-hover",
48
48
  "panneau-color-info-solid-text",
49
+ "panneau-color-muted",
50
+ "panneau-color-muted-subtle",
51
+ "panneau-color-muted-border",
52
+ "panneau-color-muted-solid",
53
+ "panneau-color-muted-solid-hover",
54
+ "panneau-color-muted-solid-text",
49
55
  "panneau-chart-categorical-1",
50
56
  "panneau-chart-categorical-2",
51
57
  "panneau-chart-categorical-3",
@@ -99,8 +105,12 @@ var SEMANTIC_TOKENS = [
99
105
  "panneau-control-height-sm",
100
106
  "panneau-control-padding-x",
101
107
  "panneau-row-padding-y",
108
+ "panneau-target-size",
102
109
  "panneau-focus-width",
103
110
  "panneau-duration",
111
+ "panneau-duration-slow",
112
+ "panneau-ease-out",
113
+ "panneau-ease-in",
104
114
  "panneau-z-overlay",
105
115
  "panneau-z-toast"
106
116
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"semanticTokens.js","names":[],"sources":["../../src/theme/semanticTokens.ts"],"sourcesContent":["/**\n * The semantic tokens of Panneau, without the leading `--`: what the default theme defines on the\n * root (`PanneauRoot.module.css`), and what a theme sets to restyle every component at once\n * (decision 0024). A test keeps this list in sync with the stylesheet.\n */\nexport const SEMANTIC_TOKENS = [\n 'panneau-color-bg',\n 'panneau-color-surface',\n 'panneau-color-surface-sunken',\n 'panneau-color-surface-raised',\n 'panneau-color-hover',\n 'panneau-color-pressed',\n 'panneau-color-backdrop',\n 'panneau-color-text',\n 'panneau-color-text-muted',\n 'panneau-color-link',\n 'panneau-color-border',\n 'panneau-color-border-control',\n 'panneau-color-accent',\n 'panneau-color-accent-hover',\n 'panneau-color-accent-text',\n 'panneau-color-accent-subtle',\n 'panneau-color-focus',\n 'panneau-color-danger',\n 'panneau-color-danger-subtle',\n 'panneau-color-danger-border',\n 'panneau-color-danger-solid',\n 'panneau-color-danger-solid-hover',\n 'panneau-color-danger-solid-text',\n 'panneau-color-success',\n 'panneau-color-success-subtle',\n 'panneau-color-success-border',\n 'panneau-color-success-solid',\n 'panneau-color-success-solid-hover',\n 'panneau-color-success-solid-text',\n 'panneau-color-warning',\n 'panneau-color-warning-subtle',\n 'panneau-color-warning-border',\n 'panneau-color-warning-solid',\n 'panneau-color-warning-solid-hover',\n 'panneau-color-warning-solid-text',\n 'panneau-color-info',\n 'panneau-color-info-subtle',\n 'panneau-color-info-border',\n 'panneau-color-info-solid',\n 'panneau-color-info-solid-hover',\n 'panneau-color-info-solid-text',\n 'panneau-chart-categorical-1',\n 'panneau-chart-categorical-2',\n 'panneau-chart-categorical-3',\n 'panneau-chart-categorical-4',\n 'panneau-chart-categorical-5',\n 'panneau-chart-categorical-6',\n 'panneau-chart-categorical-7',\n 'panneau-chart-categorical-8',\n 'panneau-chart-sequential-1',\n 'panneau-chart-sequential-2',\n 'panneau-chart-sequential-3',\n 'panneau-chart-sequential-4',\n 'panneau-chart-sequential-5',\n 'panneau-chart-diverging-negative',\n 'panneau-chart-diverging-neutral',\n 'panneau-chart-diverging-positive',\n 'panneau-font-family-body',\n 'panneau-font-family-heading',\n 'panneau-font-family-display',\n 'panneau-font-family-mono',\n 'panneau-font-family',\n 'panneau-font-numeric',\n 'panneau-font-size-xs',\n 'panneau-font-size-sm',\n 'panneau-font-size-md',\n 'panneau-font-size-lg',\n 'panneau-font-size-xl',\n 'panneau-font-size-control',\n 'panneau-line-height',\n 'panneau-line-height-tight',\n 'panneau-font-weight-normal',\n 'panneau-font-weight-medium',\n 'panneau-font-weight-bold',\n 'panneau-space-1',\n 'panneau-space-2',\n 'panneau-space-3',\n 'panneau-space-4',\n 'panneau-space-5',\n 'panneau-space-6',\n 'panneau-space-8',\n 'panneau-space-10',\n 'panneau-radius-sm',\n 'panneau-radius-md',\n 'panneau-radius-lg',\n 'panneau-radius-full',\n 'panneau-border-width',\n 'panneau-shadow-sm',\n 'panneau-shadow-md',\n 'panneau-shadow-lg',\n 'panneau-control-height',\n 'panneau-control-height-sm',\n 'panneau-control-padding-x',\n 'panneau-row-padding-y',\n 'panneau-focus-width',\n 'panneau-duration',\n 'panneau-z-overlay',\n 'panneau-z-toast',\n] as const;\n\n/** The name of a semantic token, without the leading `--`. */\nexport type SemanticTokenName = (typeof SEMANTIC_TOKENS)[number];\n"],"mappings":";;;;;;AAKA,IAAa,kBAAkB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAAiB"}
1
+ {"version":3,"file":"semanticTokens.js","names":["SEMANTIC_TOKENS","const","SemanticTokenName"],"sources":["../../src/theme/semanticTokens.ts"],"sourcesContent":["/**\n * The semantic tokens of Panneau, without the leading `--`: what the default theme defines on the\n * root (`PanneauRoot.module.css`), and what a theme sets to restyle every component at once\n * (decision 0024). A test keeps this list in sync with the stylesheet.\n */\nexport const SEMANTIC_TOKENS = [\n 'panneau-color-bg',\n 'panneau-color-surface',\n 'panneau-color-surface-sunken',\n 'panneau-color-surface-raised',\n 'panneau-color-hover',\n 'panneau-color-pressed',\n 'panneau-color-backdrop',\n 'panneau-color-text',\n 'panneau-color-text-muted',\n 'panneau-color-link',\n 'panneau-color-border',\n 'panneau-color-border-control',\n 'panneau-color-accent',\n 'panneau-color-accent-hover',\n 'panneau-color-accent-text',\n 'panneau-color-accent-subtle',\n 'panneau-color-focus',\n 'panneau-color-danger',\n 'panneau-color-danger-subtle',\n 'panneau-color-danger-border',\n 'panneau-color-danger-solid',\n 'panneau-color-danger-solid-hover',\n 'panneau-color-danger-solid-text',\n 'panneau-color-success',\n 'panneau-color-success-subtle',\n 'panneau-color-success-border',\n 'panneau-color-success-solid',\n 'panneau-color-success-solid-hover',\n 'panneau-color-success-solid-text',\n 'panneau-color-warning',\n 'panneau-color-warning-subtle',\n 'panneau-color-warning-border',\n 'panneau-color-warning-solid',\n 'panneau-color-warning-solid-hover',\n 'panneau-color-warning-solid-text',\n 'panneau-color-info',\n 'panneau-color-info-subtle',\n 'panneau-color-info-border',\n 'panneau-color-info-solid',\n 'panneau-color-info-solid-hover',\n 'panneau-color-info-solid-text',\n 'panneau-color-muted',\n 'panneau-color-muted-subtle',\n 'panneau-color-muted-border',\n 'panneau-color-muted-solid',\n 'panneau-color-muted-solid-hover',\n 'panneau-color-muted-solid-text',\n 'panneau-chart-categorical-1',\n 'panneau-chart-categorical-2',\n 'panneau-chart-categorical-3',\n 'panneau-chart-categorical-4',\n 'panneau-chart-categorical-5',\n 'panneau-chart-categorical-6',\n 'panneau-chart-categorical-7',\n 'panneau-chart-categorical-8',\n 'panneau-chart-sequential-1',\n 'panneau-chart-sequential-2',\n 'panneau-chart-sequential-3',\n 'panneau-chart-sequential-4',\n 'panneau-chart-sequential-5',\n 'panneau-chart-diverging-negative',\n 'panneau-chart-diverging-neutral',\n 'panneau-chart-diverging-positive',\n 'panneau-font-family-body',\n 'panneau-font-family-heading',\n 'panneau-font-family-display',\n 'panneau-font-family-mono',\n 'panneau-font-family',\n 'panneau-font-numeric',\n 'panneau-font-size-xs',\n 'panneau-font-size-sm',\n 'panneau-font-size-md',\n 'panneau-font-size-lg',\n 'panneau-font-size-xl',\n 'panneau-font-size-control',\n 'panneau-line-height',\n 'panneau-line-height-tight',\n 'panneau-font-weight-normal',\n 'panneau-font-weight-medium',\n 'panneau-font-weight-bold',\n 'panneau-space-1',\n 'panneau-space-2',\n 'panneau-space-3',\n 'panneau-space-4',\n 'panneau-space-5',\n 'panneau-space-6',\n 'panneau-space-8',\n 'panneau-space-10',\n 'panneau-radius-sm',\n 'panneau-radius-md',\n 'panneau-radius-lg',\n 'panneau-radius-full',\n 'panneau-border-width',\n 'panneau-shadow-sm',\n 'panneau-shadow-md',\n 'panneau-shadow-lg',\n 'panneau-control-height',\n 'panneau-control-height-sm',\n 'panneau-control-padding-x',\n 'panneau-row-padding-y',\n 'panneau-target-size',\n 'panneau-focus-width',\n 'panneau-duration',\n 'panneau-duration-slow',\n 'panneau-ease-out',\n 'panneau-ease-in',\n 'panneau-z-overlay',\n 'panneau-z-toast',\n] as const;\n\n/** The name of a semantic token, without the leading `--`. */\nexport type SemanticTokenName = (typeof SEMANTIC_TOKENS)[number];\n"],"mappings":";;;;;;AAKA,IAAaA,kBAAkB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAAiB"}
@@ -1,5 +1,5 @@
1
- import type { ThemeFont } from './fonts';
2
- import { type ToneInput, type ToneSurfaces } from './tones';
1
+ import type { ThemeFont } from './fonts.js';
2
+ import { type ToneInput, type ToneSurfaces } from './tones.js';
3
3
  /**
4
4
  * A theme: design tokens, as CSS variables without the leading `--`, with optional overrides for
5
5
  * the dark scheme, raw palette colors, its own tones, and named variants of components (decision
@@ -1 +1 @@
1
- {"version":3,"file":"theme.js","names":[],"sources":["../../src/theme/theme.ts"],"sourcesContent":["import { parseColor } from './color';\nimport type { ThemeFont } from './fonts';\nimport {\n TONE_VARIABLES,\n type ToneInput,\n type ToneSurfaces,\n type ToneValues,\n resolveTone,\n toneClassName,\n} from './tones';\n\n/**\n * A theme: design tokens, as CSS variables without the leading `--`, with optional overrides for\n * the dark scheme, raw palette colors, its own tones, and named variants of components (decision\n * 0024). A theme is plain data: the `Theme` schema of `@panneau/protocol` validates it, and plugins\n * of `@panneau/core` register it. Write one with `defineTheme()` to check token names.\n *\n * It is a type rather than an interface so that it is assignable to the `Theme` of\n * `@panneau/protocol`, which accepts properties of later versions.\n */\nexport type Theme = {\n /** A name for theme pickers. */\n label?: string;\n /** Tokens of the light scheme, or of both schemes without `dark`: `{ 'panneau-color-accent': '#05f' }`. */\n tokens: Record<string, string>;\n /** Tokens that change in the dark scheme. */\n dark?: Record<string, string>;\n /**\n * Raw colors, written as `--panneau-palette-<name>`: tokens and tones use them with\n * `var(--panneau-palette-<name>)`, so that a theme names its brand colors once.\n */\n palette?: Record<string, string>;\n /**\n * Tones added or redefined by the theme: one color, from which Panneau derives the others,\n * or every value. Declare added tones in `PanneauTones` so that `tone=\"signal\"` type-checks.\n */\n tones?: Record<string, ToneInput>;\n /**\n * Named variants of components: token overrides that `<Badge variant=\"tag\">` applies through\n * its `panneau-badge-variant-tag` class. Declare them in `BadgeVariants` (and the like).\n */\n components?: Record<string, { variants?: Record<string, Record<string, string>> }>;\n /**\n * Tokens of each density, such as `panneau-control-height`: tokens set here change with the\n * density of the root, while the same tokens in `tokens` would apply to every density.\n */\n densities?: Partial<Record<Exclude<Density, 'auto'>, Record<string, string>>>;\n /**\n * Font faces and font stylesheets, which `PanneauRoot` adds to the page once. Font tokens\n * (`panneau-font-family-heading`) then use their families.\n */\n fonts?: ThemeFont[];\n};\n\n/** `auto` follows the system setting (`prefers-color-scheme`). */\nexport type ColorScheme = 'light' | 'dark' | 'auto';\n\n/**\n * How much room controls and rows take: `compact`, `comfortable`, or `touch`, with larger targets.\n * `auto` is `touch` on coarse pointers (touch screens) and `comfortable` otherwise.\n */\nexport type Density = 'compact' | 'comfortable' | 'touch' | 'auto';\n\nfunction declarations(tokens: Record<string, string>): string {\n return Object.entries(tokens)\n .filter(([name, value]) => /^[a-zA-Z0-9-_]+$/.test(name) && !/[{};<]/.test(value))\n .map(([name, value]) => `--${name}:${value};`)\n .join('');\n}\n\n/** A short, stable hash of a string, to scope the CSS of a theme. */\nexport function hashString(value: string): string {\n let hash = 5381;\n for (let index = 0; index < value.length; index += 1) {\n hash = (hash * 33) ^ value.charCodeAt(index);\n }\n return (hash >>> 0).toString(36);\n}\n\nconst NAME = /^[a-z0-9-]+$/;\n\nconst VARIABLE = /^var\\(--([a-zA-Z0-9_-]+)\\)$/;\n\n/** The palette of a theme, as variables: `{ 'panneau-palette-orange': '#f25c05' }`. */\nexport function paletteVariables(\n palette: Readonly<Record<string, string>> = {},\n): Record<string, string> {\n return Object.fromEntries(\n Object.entries(palette)\n .filter(([name]) => NAME.test(name))\n .map(([name, value]) => [`panneau-palette-${name}`, value]),\n );\n}\n\n/**\n * Follows `var(--name)` references through the given variables (tokens, palette colors), until a\n * value that is not one: `var(--panneau-palette-orange)` becomes `#f25c05`. A reference to a\n * variable that isn't given is returned as is.\n */\nexport function resolveReference(\n value: string,\n variables: Readonly<Record<string, string>>,\n): string {\n let current = value;\n for (let depth = 0; depth < 10; depth += 1) {\n const name = VARIABLE.exec(current.trim())?.[1];\n if (name === undefined || !Object.hasOwn(variables, name)) {\n return current;\n }\n current = variables[name] ?? current;\n }\n return current;\n}\n\nfunction toneDeclarations(values: ToneValues): string {\n return declarations(\n Object.fromEntries(\n (Object.keys(TONE_VARIABLES) as (keyof ToneValues)[]).map((key) => [\n TONE_VARIABLES[key],\n values[key],\n ]),\n ),\n );\n}\n\n/**\n * The surfaces of a theme in each scheme, when it sets ones Panneau can read: tones derived from\n * one color are made readable on them.\n */\nexport function themeSurfaces(theme: Theme): ToneSurfaces {\n const palette = paletteVariables(theme.palette);\n const surface = (tokens: Record<string, string>) => {\n const variables = { ...palette, ...tokens };\n const value = variables['panneau-color-surface'];\n return value !== undefined ? parseColor(resolveReference(value, variables)) : null;\n };\n const light = surface(theme.tokens);\n const dark =\n theme.dark?.['panneau-color-surface'] !== undefined\n ? surface({ ...theme.tokens, ...theme.dark })\n : null;\n return {\n ...(light !== null && { light }),\n ...(dark !== null && { dark }),\n };\n}\n\n/**\n * The rules of the densities of a theme. `auto` takes the comfortable values on fine pointers and\n * the touch ones on coarse pointers, like the default theme.\n */\nfunction densityCss(root: string, densities: Theme['densities'] = {}): string {\n const body = (density: Exclude<Density, 'auto'>) => declarations(densities[density] ?? {});\n const rule = (selector: string, css: string) => (css !== '' ? `${selector}{${css}}` : '');\n const media = (query: string, css: string) => (css !== '' ? `@media ${query}{${css}}` : '');\n const selector = (density: Density) => `${root}[data-density=\"${density}\"]`;\n return [\n rule(selector('compact'), body('compact')),\n rule(selector('comfortable'), body('comfortable')),\n media('not (pointer: coarse)', rule(selector('auto'), body('comfortable'))),\n rule(selector('touch'), body('touch')),\n media('(pointer: coarse)', rule(selector('auto'), body('touch'))),\n ].join('');\n}\n\n/**\n * The CSS of a theme, scoped to the roots that carry `data-panneau-theme=\"<scope>\"`: its palette and\n * tokens, its densities, its tones and the variants of components. Its rules are more specific than the default\n * tokens and the built-in tones, and dark overrides more specific than light ones. Token, tone,\n * component and variant names must be plain identifiers, and values can't contain `{`, `}`, `;` or\n * `<`: other entries are ignored.\n */\nexport function getThemeCss(theme: Theme, scope: string): string {\n const root = `[data-panneau-theme=\"${scope}\"]`;\n const dark = `${root}[data-color-scheme=\"dark\"]`;\n const auto = `${root}[data-color-scheme=\"auto\"]`;\n const light: string[] = [];\n const darkRules: string[] = [];\n const rule = (selector: string, body: string) => (body !== '' ? `${selector}{${body}}` : '');\n\n const palette = paletteVariables(theme.palette);\n const surfaces = themeSurfaces(theme);\n light.push(rule(root, declarations({ ...palette, ...theme.tokens })));\n light.push(densityCss(root, theme.densities));\n if (theme.dark !== undefined) {\n darkRules.push(rule('§', declarations(theme.dark)));\n }\n Object.entries(theme.tones ?? {})\n .filter(([name]) => NAME.test(name))\n .forEach(([name, input]) => {\n // A tone from a palette color derives from the color itself.\n const values = resolveTone(\n typeof input === 'string' ? resolveReference(input, palette) : input,\n surfaces,\n );\n const selector = `.${toneClassName(name)}`;\n light.push(rule(`${root} ${selector}`, toneDeclarations(values.light)));\n darkRules.push(rule(`§ ${selector}`, toneDeclarations(values.dark)));\n });\n Object.entries(theme.components ?? {})\n .filter(([component]) => NAME.test(component))\n .forEach(([component, { variants = {} }]) => {\n Object.entries(variants)\n .filter(([name]) => NAME.test(name))\n .forEach(([name, tokens]) => {\n light.push(\n rule(`${root} .panneau-${component}-variant-${name}`, declarations(tokens)),\n );\n });\n });\n\n const darkCss = darkRules.filter(Boolean);\n return [\n ...light,\n ...darkCss.map((css) => css.replaceAll('§',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Q,aAAa,MAAM,CAAC,CAC9E;EACJ,CAAC;CACT,CAAC;CAEL,MAAM,UAAU,UAAU,OAAO,OAAO;CACxC,OAAO;EACH,GAAG;EACH,GAAG,QAAQ,KAAK,QAAQ,IAAI,WAAW,KAAK,IAAI,CAAC;EACjD,QAAQ,SAAS,IACX,uCAAuC,QAAQ,KAAK,QAAQ,IAAI,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,EAAC,KAC/F;CAAE,CACX,CAAC,KAAK,EAAE;AACb"}
1
+ {"version":3,"file":"theme.js","names":["parseColor","ThemeFont","TONE_VARIABLES","ToneInput","ToneSurfaces","ToneValues","resolveTone","toneClassName","Theme","label","tokens","Record","dark","palette","tones","components","variants","densities","Partial","Exclude","Density","fonts","ColorScheme","declarations","Object","entries","filter","name","value","test","map","join","hashString","hash","index","length","charCodeAt","toString","NAME","VARIABLE","paletteVariables","Readonly","fromEntries","resolveReference","variables","current","depth","exec","trim","undefined","hasOwn","toneDeclarations","values","keys","key","themeSurfaces","theme","surface","light","densityCss","root","body","density","rule","selector","css","media","query","getThemeCss","scope","auto","darkRules","surfaces","push","forEach","input","component","darkCss","Boolean","replaceAll"],"sources":["../../src/theme/theme.ts"],"sourcesContent":["import { parseColor } from './color';\nimport type { ThemeFont } from './fonts';\nimport {\n TONE_VARIABLES,\n type ToneInput,\n type ToneSurfaces,\n type ToneValues,\n resolveTone,\n toneClassName,\n} from './tones';\n\n/**\n * A theme: design tokens, as CSS variables without the leading `--`, with optional overrides for\n * the dark scheme, raw palette colors, its own tones, and named variants of components (decision\n * 0024). A theme is plain data: the `Theme` schema of `@panneau/protocol` validates it, and plugins\n * of `@panneau/core` register it. Write one with `defineTheme()` to check token names.\n *\n * It is a type rather than an interface so that it is assignable to the `Theme` of\n * `@panneau/protocol`, which accepts properties of later versions.\n */\nexport type Theme = {\n /** A name for theme pickers. */\n label?: string;\n /** Tokens of the light scheme, or of both schemes without `dark`: `{ 'panneau-color-accent': '#05f' }`. */\n tokens: Record<string, string>;\n /** Tokens that change in the dark scheme. */\n dark?: Record<string, string>;\n /**\n * Raw colors, written as `--panneau-palette-<name>`: tokens and tones use them with\n * `var(--panneau-palette-<name>)`, so that a theme names its brand colors once.\n */\n palette?: Record<string, string>;\n /**\n * Tones added or redefined by the theme: one color, from which Panneau derives the others,\n * or every value. Declare added tones in `PanneauTones` so that `tone=\"signal\"` type-checks.\n */\n tones?: Record<string, ToneInput>;\n /**\n * Named variants of components: token overrides that `<Badge variant=\"tag\">` applies through\n * its `panneau-badge-variant-tag` class. Declare them in `BadgeVariants` (and the like).\n */\n components?: Record<string, { variants?: Record<string, Record<string, string>> }>;\n /**\n * Tokens of each density, such as `panneau-control-height`: tokens set here change with the\n * density of the root, while the same tokens in `tokens` would apply to every density.\n */\n densities?: Partial<Record<Exclude<Density, 'auto'>, Record<string, string>>>;\n /**\n * Font faces and font stylesheets, which `PanneauRoot` adds to the page once. Font tokens\n * (`panneau-font-family-heading`) then use their families.\n */\n fonts?: ThemeFont[];\n};\n\n/** `auto` follows the system setting (`prefers-color-scheme`). */\nexport type ColorScheme = 'light' | 'dark' | 'auto';\n\n/**\n * How much room controls and rows take: `compact`, `comfortable`, or `touch`, with larger targets.\n * `auto` is `touch` on coarse pointers (touch screens) and `comfortable` otherwise.\n */\nexport type Density = 'compact' | 'comfortable' | 'touch' | 'auto';\n\nfunction declarations(tokens: Record<string, string>): string {\n return Object.entries(tokens)\n .filter(([name, value]) => /^[a-zA-Z0-9-_]+$/.test(name) && !/[{};<]/.test(value))\n .map(([name, value]) => `--${name}:${value};`)\n .join('');\n}\n\n/** A short, stable hash of a string, to scope the CSS of a theme. */\nexport function hashString(value: string): string {\n let hash = 5381;\n for (let index = 0; index < value.length; index += 1) {\n hash = (hash * 33) ^ value.charCodeAt(index);\n }\n return (hash >>> 0).toString(36);\n}\n\nconst NAME = /^[a-z0-9-]+$/;\n\nconst VARIABLE = /^var\\(--([a-zA-Z0-9_-]+)\\)$/;\n\n/** The palette of a theme, as variables: `{ 'panneau-palette-orange': '#f25c05' }`. */\nexport function paletteVariables(\n palette: Readonly<Record<string, string>> = {},\n): Record<string, string> {\n return Object.fromEntries(\n Object.entries(palette)\n .filter(([name]) => NAME.test(name))\n .map(([name, value]) => [`panneau-palette-${name}`, value]),\n );\n}\n\n/**\n * Follows `var(--name)` references through the given variables (tokens, palette colors), until a\n * value that is not one: `var(--panneau-palette-orange)` becomes `#f25c05`. A reference to a\n * variable that isn't given is returned as is.\n */\nexport function resolveReference(\n value: string,\n variables: Readonly<Record<string, string>>,\n): string {\n let current = value;\n for (let depth = 0; depth < 10; depth += 1) {\n const name = VARIABLE.exec(current.trim())?.[1];\n if (name === undefined || !Object.hasOwn(variables, name)) {\n return current;\n }\n current = variables[name] ?? current;\n }\n return current;\n}\n\nfunction toneDeclarations(values: ToneValues): string {\n return declarations(\n Object.fromEntries(\n (Object.keys(TONE_VARIABLES) as (keyof ToneValues)[]).map((key) => [\n TONE_VARIABLES[key],\n values[key],\n ]),\n ),\n );\n}\n\n/**\n * The surfaces of a theme in each scheme, when it sets ones Panneau can read: tones derived from\n * one color are made readable on them.\n */\nexport function themeSurfaces(theme: Theme): ToneSurfaces {\n const palette = paletteVariables(theme.palette);\n const surface = (tokens: Record<string, string>) => {\n const variables = { ...palette, ...tokens };\n const value = variables['panneau-color-surface'];\n return value !== undefined ? parseColor(resolveReference(value, variables)) : null;\n };\n const light = surface(theme.tokens);\n const dark =\n theme.dark?.['panneau-color-surface'] !== undefined\n ? surface({ ...theme.tokens, ...theme.dark })\n : null;\n return {\n ...(light !== null && { light }),\n ...(dark !== null && { dark }),\n };\n}\n\n/**\n * The rules of the densities of a theme. `auto` takes the comfortable values on fine pointers and\n * the touch ones on coarse pointers, like the default theme.\n */\nfunction densityCss(root: string, densities: Theme['densities'] = {}): string {\n const body = (density: Exclude<Density, 'auto'>) => declarations(densities[density] ?? {});\n const rule = (selector: string, css: string) => (css !== '' ? `${selector}{${css}}` : '');\n const media = (query: string, css: string) => (css !== '' ? `@media ${query}{${css}}` : '');\n const selector = (density: Density) => `${root}[data-density=\"${density}\"]`;\n return [\n rule(selector('compact'), body('compact')),\n rule(selector('comfortable'), body('comfortable')),\n media('not (pointer: coarse)', rule(selector('auto'), body('comfortable'))),\n rule(selector('touch'), body('touch')),\n media('(pointer: coarse)', rule(selector('auto'), body('touch'))),\n ].join('');\n}\n\n/**\n * The CSS of a theme, scoped to the roots that carry `data-panneau-theme=\"<scope>\"`: its palette and\n * tokens, its densities, its tones and the variants of components. Its rules are more specific than the default\n * tokens and the built-in tones, and dark overrides more specific than light ones. Token, tone,\n * component and variant names must be plain identifiers, and values can't contain `{`, `}`, `;` or\n * `<`: other entries are ignored.\n */\nexport function getThemeCss(theme: Theme, scope: string): string {\n const root = `[data-panneau-theme=\"${scope}\"]`;\n const dark = `${root}[data-color-scheme=\"dark\"]`;\n const auto = `${root}[data-color-scheme=\"auto\"]`;\n const light: string[] = [];\n const darkRules: string[] = [];\n const rule = (selector: string, body: string) => (body !== '' ? `${selector}{${body}}` : '');\n\n const palette = paletteVariables(theme.palette);\n const surfaces = themeSurfaces(theme);\n light.push(rule(root, declarations({ ...palette, ...theme.tokens })));\n light.push(densityCss(root, theme.densities));\n if (theme.dark !== undefined) {\n darkRules.push(rule('§', declarations(theme.dark)));\n }\n Object.entries(theme.tones ?? {})\n .filter(([name]) => NAME.test(name))\n .forEach(([name, input]) => {\n // A tone from a palette color derives from the color itself.\n const values = resolveTone(\n typeof input === 'string' ? resolveReference(input, palette) : input,\n surfaces,\n );\n const selector = `.${toneClassName(name)}`;\n light.push(rule(`${root} ${selector}`, toneDeclarations(values.light)));\n darkRules.push(rule(`§ ${selector}`, toneDeclarations(values.dark)));\n });\n Object.entries(theme.components ?? {})\n .filter(([component]) => NAME.test(component))\n .forEach(([component, { variants = {} }]) => {\n Object.entries(variants)\n .filter(([name]) => NAME.test(name))\n .forEach(([name, tokens]) => {\n light.push(\n rule(`${root} .panneau-${component}-variant-${name}`, declarations(tokens)),\n );\n });\n });\n\n const darkCss = darkRules.filter(Boolean);\n return [\n ...light,\n ...darkCss.map((css) => css.replaceAll('§', dark)),\n darkCss.length > 0\n ? `@media (prefers-color-scheme: dark){${darkCss.map((css) => css.replaceAll('§', auto)).join('')}}`\n : '',\n ].join('');\n}\n"],"mappings":";;;AA+DA,SAASuB,aAAab,QAAwC;CAC1D,OAAOc,OAAOC,QAAQf,MAAM,CAAC,CACxBgB,QAAQ,CAACC,MAAMC,WAAW,mBAAmBC,KAAKF,IAAI,KAAK,CAAC,SAASE,KAAKD,KAAK,CAAC,CAAC,CACjFE,KAAK,CAACH,MAAMC,WAAW,KAAKD,KAAI,GAAIC,MAAK,EAAG,CAAC,CAC7CG,KAAK,EAAE;AAChB;;AAGA,SAAgBC,WAAWJ,OAAuB;CAC9C,IAAIK,OAAO;CACX,KAAK,IAAIC,QAAQ,GAAGA,QAAQN,MAAMO,QAAQD,SAAS,GAC/CD,OAAQA,OAAO,KAAML,MAAMQ,WAAWF,KAAK;CAE/C,QAAQD,SAAS,EAAA,CAAGI,SAAS,EAAE;AACnC;AAEA,IAAMC,OAAO;AAEb,IAAMC,WAAW;;AAGjB,SAAgBC,iBACZ3B,UAA4C,CAAC,GACvB;CACtB,OAAOW,OAAOkB,YACVlB,OAAOC,QAAQZ,OAAO,CAAC,CAClBa,QAAQ,CAACC,UAAUW,KAAKT,KAAKF,IAAI,CAAC,CAAC,CACnCG,KAAK,CAACH,MAAMC,WAAW,CAAC,mBAAmBD,QAAQC,KAAK,CAAC,CAClE;AACJ;;;;;;AAOA,SAAgBe,iBACZf,OACAgB,WACM;CACN,IAAIC,UAAUjB;CACd,KAAK,IAAIkB,QAAQ,GAAGA,QAAQ,IAAIA,SAAS,GAAG;EACxC,MAAMnB,OAAOY,SAASQ,KAAKF,QAAQG,KAAK,CAAC,CAAC,GAAG;EAC7C,IAAIrB,SAASsB,KAAAA,KAAa,CAACzB,OAAO0B,OAAON,WAAWjB,IAAI,GACpD,OAA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AAGH,KAAI,GAAII,YAAYb,iBAAiBC,OAAOM,KAAK,CAAC,CAAC;EACtEa,UAAUE,KAAKV,KAAK,KAAKC,YAAYb,iBAAiBC,OAAOxC,IAAI,CAAC,CAAC;CACvE,CAAC;CACLY,OAAOC,QAAQ+B,MAAMzC,cAAc,CAAC,CAAC,CAAC,CACjCW,QAAQ,CAACkD,eAAetC,KAAKT,KAAK+C,SAAS,CAAC,CAAC,CAC7CF,SAAS,CAACE,WAAW,EAAE5D,WAAW,CAAC,SAAS;EACzCQ,OAAOC,QAAQT,QAAQ,CAAC,CACnBU,QAAQ,CAACC,UAAUW,KAAKT,KAAKF,IAAI,CAAC,CAAC,CACnC+C,SAAS,CAAC/C,MAAMjB,YAAY;GACzBgD,MAAMe,KACFV,KAAK,GAAGH,KAAI,YAAagB,UAAS,WAAYjD,QAAQJ,aAAab,MAAM,CAAC,CAC9E;EACJ,CAAC;CACT,CAAC;CAEL,MAAMmE,UAAUN,UAAU7C,OAAOoD,OAAO;CACxC,OAAO;EACH,GAAGpB;EACH,GAAGmB,QAAQ/C,KAAKmC,QAAQA,IAAIc,WAAW,KAAKnE,IAAI,CAAC;EACjDiE,QAAQ1C,SAAS,IACX,uCAAuC0C,QAAQ/C,KAAKmC,QAAQA,IAAIc,WAAW,KAAKT,IAAI,CAAC,CAAC,CAACvC,KAAK,EAAE,EAAC,KAC/F;CAAE,CACX,CAACA,KAAK,EAAE;AACb"}
@@ -1,4 +1,4 @@
1
- import { type Tone } from './tones';
1
+ import { type Tone } from './tones.js';
2
2
  /**
3
3
  * The class of a tone, `panneau-tone-<tone>`. The built-in tones come from `Tone.module.css`, whose
4
4
  * classes get the same stable names, so using it includes their CSS; a theme's own tones get their
@@ -1 +1 @@
1
- {"version":3,"file":"toneClass.js","names":["styles"],"sources":["../../src/theme/toneClass.ts"],"sourcesContent":["import styles from './Tone.module.css';\nimport { type Tone, toneClassName } from './tones';\n\n/**\n * The class of a tone, `panneau-tone-<tone>`. The built-in tones come from `Tone.module.css`, whose\n * classes get the same stable names, so using it includes their CSS; a theme's own tones get their\n * rules from the theme.\n */\nexport function toneClass(tone: Tone): string {\n return (Object.hasOwn(styles, tone) ? styles[tone] : undefined) ?? toneClassName(tone);\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,UAAU,MAAoB;CAC1C,QAAQ,OAAO,OAAOA,qBAAQ,IAAI,IAAIA,oBAAO,QAAQ,KAAA,MAAc,cAAc,IAAI;AACzF"}
1
+ {"version":3,"file":"toneClass.js","names":["styles","Tone","toneClassName","toneClass","tone","Object","hasOwn","undefined","styles"],"sources":["../../src/theme/toneClass.ts"],"sourcesContent":["import styles from './Tone.module.css';\nimport { type Tone, toneClassName } from './tones';\n\n/**\n * The class of a tone, `panneau-tone-<tone>`. The built-in tones come from `Tone.module.css`, whose\n * classes get the same stable names, so using it includes their CSS; a theme's own tones get their\n * rules from the theme.\n */\nexport function toneClass(tone: Tone): string {\n return (Object.hasOwn(styles, tone) ? styles[tone] : undefined) ?? toneClassName(tone);\n}\n"],"mappings":";;;;;;;;AAQA,SAAgBG,UAAUC,MAAoB;CAC1C,QAAQC,OAAOC,OAAON,qBAAQI,IAAI,IAAIJ,oBAAOI,QAAQG,KAAAA,MAAcL,cAAcE,IAAI;AACzF"}
@@ -1,4 +1,4 @@
1
- import { type Rgb } from './color';
1
+ import { type Rgb } from './color.js';
2
2
  /**
3
3
  * The tones that components accept (`tone="success"`), like Bootstrap's `$theme-colors`. A theme
4
4
  * adds its own; declare them here so that `tone="signal"` type-checks:
@@ -18,11 +18,23 @@ export interface PanneauTones {
18
18
  warning: true;
19
19
  danger: true;
20
20
  info: true;
21
+ muted: true;
21
22
  }
22
23
  /** A tone name: a built-in tone, or one declared in `PanneauTones`. */
23
24
  export type Tone = keyof PanneauTones & string;
24
- /** The tones Panneau defines, from the semantic tokens of the theme. */
25
- export declare const BUILT_IN_TONES: readonly ["neutral", "accent", "success", "warning", "danger", "info"];
25
+ /**
26
+ * The tones Panneau defines, from the semantic tokens of the theme. What each one means for a state
27
+ * is written once, in the protocol's docs ("Tones"):
28
+ *
29
+ * - `neutral`: not started, waiting, a category (Draft, Pending);
30
+ * - `info`: in progress or coming (In progress, Scheduled);
31
+ * - `success`: done, live, in good shape (Published, Paid);
32
+ * - `warning`: needs attention soon (Expires soon, Low stock);
33
+ * - `danger`: a problem to fix now (Failed, Overdue);
34
+ * - `muted`: over, no longer active (Archived, Cancelled);
35
+ * - `accent`: never a state, the main action of a screen.
36
+ */
37
+ export declare const BUILT_IN_TONES: readonly ["neutral", "accent", "success", "warning", "danger", "info", "muted"];
26
38
  /** The colors of a tone, as CSS values. */
27
39
  export type ToneValues = {
28
40
  /** Text and icons on surfaces: the outline, subtle and ghost appearances. */
@@ -1 +1 @@
1
- {"version":3,"file":"tones.d.ts","sourceRoot":"","sources":["../../src/theme/tones.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,GAAG,EAQX,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,YAAY;IACzB,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,IAAI,CAAC;IACb,OAAO,EAAE,IAAI,CAAC;IACd,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,IAAI,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;CACd;AAED,uEAAuE;AACvE,MAAM,MAAM,IAAI,GAAG,MAAM,YAAY,GAAG,MAAM,CAAC;AAE/C,wEAAwE;AACxE,eAAO,MAAM,cAAc,wEAOjB,CAAC;AAEX,2CAA2C;AAC3C,MAAM,MAAM,UAAU,GAAG;IACrB,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7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;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CACtB,KAAK,EAAE,MAAM,EACb,QAAQ,GAAE,YAAiB,GAC5B;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAuDzC;AAED,qGAAqG;AACrG,wBAAgB,WAAW,CACvB,KAAK,EAAE,SAAS,EAChB,QAAQ,GAAE,YAAiB,GAC5B;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAMzC"}
@@ -1,13 +1,25 @@
1
1
  import { WHITE, contrastRatio, ensureContrast, mixColors, parseColor, readableTextColor, toHex } from "./color.js";
2
2
  //#region src/theme/tones.ts
3
- /** The tones Panneau defines, from the semantic tokens of the theme. */
3
+ /**
4
+ * The tones Panneau defines, from the semantic tokens of the theme. What each one means for a state
5
+ * is written once, in the protocol's docs ("Tones"):
6
+ *
7
+ * - `neutral`: not started, waiting, a category (Draft, Pending);
8
+ * - `info`: in progress or coming (In progress, Scheduled);
9
+ * - `success`: done, live, in good shape (Published, Paid);
10
+ * - `warning`: needs attention soon (Expires soon, Low stock);
11
+ * - `danger`: a problem to fix now (Failed, Overdue);
12
+ * - `muted`: over, no longer active (Archived, Cancelled);
13
+ * - `accent`: never a state, the main action of a screen.
14
+ */
4
15
  var BUILT_IN_TONES = [
5
16
  "neutral",
6
17
  "accent",
7
18
  "success",
8
19
  "warning",
9
20
  "danger",
10
- "info"
21
+ "info",
22
+ "muted"
11
23
  ];
12
24
  /** The local CSS variables of a tone, which components read. */
13
25
  var TONE_VARIABLES = {