@askrjs/themes 0.0.2 → 0.0.4

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 (605) hide show
  1. package/README.md +78 -0
  2. package/THEMING.md +50 -8
  3. package/dist/{_internal → components/_internal}/box-layout.js +4 -3
  4. package/dist/components/_internal/box-layout.js.map +1 -0
  5. package/dist/components/_internal/classes.js.map +1 -0
  6. package/dist/components/_internal/jsx.js.map +1 -0
  7. package/dist/components/_internal/layout.d.ts +6 -28
  8. package/dist/{_internal → components/_internal}/layout.js +5 -15
  9. package/dist/components/_internal/layout.js.map +1 -0
  10. package/dist/{_internal → components/_internal}/merge-props.js +5 -0
  11. package/dist/components/_internal/merge-props.js.map +1 -0
  12. package/dist/components/_internal/pathname.js +39 -0
  13. package/dist/components/_internal/pathname.js.map +1 -0
  14. package/dist/components/_internal/style.js +41 -0
  15. package/dist/components/_internal/style.js.map +1 -0
  16. package/dist/components/alert/alert.d.ts +7 -0
  17. package/dist/components/alert/alert.js +65 -0
  18. package/dist/components/alert/alert.js.map +1 -0
  19. package/dist/components/alert/alert.types.d.ts +22 -0
  20. package/dist/components/alert/index.d.ts +2 -0
  21. package/dist/components/aspect-ratio/aspect-ratio.d.ts +8 -3
  22. package/dist/components/aspect-ratio/aspect-ratio.js +33 -0
  23. package/dist/components/aspect-ratio/aspect-ratio.js.map +1 -0
  24. package/dist/components/aspect-ratio/aspect-ratio.types.d.ts +18 -12
  25. package/dist/components/aspect-ratio/index.d.ts +2 -2
  26. package/dist/components/badge/badge.a11y.d.ts +13 -9
  27. package/dist/components/badge/badge.d.ts +8 -3
  28. package/dist/{badge → components/badge}/badge.js +5 -0
  29. package/dist/components/badge/badge.js.map +1 -0
  30. package/dist/components/badge/badge.types.d.ts +18 -12
  31. package/dist/components/badge/index.d.ts +3 -3
  32. package/dist/components/block/block.a11y.d.ts +20 -0
  33. package/dist/components/block/block.d.ts +9 -0
  34. package/dist/components/block/block.js +66 -0
  35. package/dist/components/block/block.js.map +1 -0
  36. package/dist/components/block/block.types.d.ts +38 -0
  37. package/dist/components/block/index.d.ts +3 -0
  38. package/dist/components/box/box.a11y.d.ts +13 -9
  39. package/dist/components/box/box.d.ts +9 -4
  40. package/dist/{box → components/box}/box.js +3 -2
  41. package/dist/components/box/box.js.map +1 -0
  42. package/dist/components/box/box.types.d.ts +67 -61
  43. package/dist/components/box/index.d.ts +3 -3
  44. package/dist/components/breadcrumb/breadcrumb.a11y.d.ts +13 -9
  45. package/dist/components/breadcrumb/breadcrumb.a11y.js +15 -0
  46. package/dist/components/breadcrumb/breadcrumb.a11y.js.map +1 -0
  47. package/dist/components/breadcrumb/breadcrumb.d.ts +18 -13
  48. package/dist/components/breadcrumb/breadcrumb.js.map +1 -0
  49. package/dist/components/breadcrumb/breadcrumb.types.d.ts +64 -58
  50. package/dist/components/breadcrumb/index.d.ts +3 -3
  51. package/dist/components/button-group/button-group.d.ts +7 -0
  52. package/dist/components/button-group/button-group.js +20 -0
  53. package/dist/components/button-group/button-group.js.map +1 -0
  54. package/dist/components/button-group/button-group.types.d.ts +14 -0
  55. package/dist/components/button-group/index.d.ts +2 -0
  56. package/dist/components/card/card.d.ts +13 -7
  57. package/dist/components/card/card.js +95 -0
  58. package/dist/components/card/card.js.map +1 -0
  59. package/dist/components/card/card.types.d.ts +32 -24
  60. package/dist/components/card/index.d.ts +2 -2
  61. package/dist/components/close/close.d.ts +7 -0
  62. package/dist/components/close/close.js +22 -0
  63. package/dist/components/close/close.js.map +1 -0
  64. package/dist/components/close/close.types.d.ts +10 -0
  65. package/dist/components/close/index.d.ts +2 -0
  66. package/dist/components/container/container.a11y.d.ts +19 -15
  67. package/dist/components/container/container.d.ts +8 -3
  68. package/dist/{container → components/container}/container.js +3 -3
  69. package/dist/components/container/container.js.map +1 -0
  70. package/dist/components/container/container.types.d.ts +26 -26
  71. package/dist/components/container/index.d.ts +3 -3
  72. package/dist/components/empty-state/empty-state.d.ts +7 -2
  73. package/dist/components/empty-state/empty-state.js.map +1 -0
  74. package/dist/components/empty-state/empty-state.types.d.ts +15 -8
  75. package/dist/components/empty-state/index.d.ts +2 -2
  76. package/dist/components/field/field.d.ts +9 -0
  77. package/dist/components/field/field.js +41 -0
  78. package/dist/components/field/field.js.map +1 -0
  79. package/dist/components/field/field.types.d.ts +20 -0
  80. package/dist/components/field/index.d.ts +2 -0
  81. package/dist/components/flex/flex.a11y.d.ts +21 -17
  82. package/dist/components/flex/flex.d.ts +9 -4
  83. package/dist/{flex → components/flex}/flex.js +3 -2
  84. package/dist/components/flex/flex.js.map +1 -0
  85. package/dist/components/flex/flex.types.d.ts +38 -37
  86. package/dist/components/flex/index.d.ts +3 -3
  87. package/dist/components/header/header.a11y.d.ts +13 -9
  88. package/dist/components/header/header.a11y.js +12 -0
  89. package/dist/components/header/header.a11y.js.map +1 -0
  90. package/dist/components/header/header.d.ts +7 -2
  91. package/dist/components/header/header.js.map +1 -0
  92. package/dist/components/header/header.types.d.ts +8 -4
  93. package/dist/components/inline/index.d.ts +8 -6
  94. package/dist/components/inline/index.js.map +1 -0
  95. package/dist/components/input-group/index.d.ts +2 -0
  96. package/dist/components/input-group/input-group.d.ts +9 -0
  97. package/dist/components/input-group/input-group.js +39 -0
  98. package/dist/components/input-group/input-group.js.map +1 -0
  99. package/dist/components/input-group/input-group.types.d.ts +26 -0
  100. package/dist/components/list-group/index.d.ts +2 -0
  101. package/dist/components/list-group/list-group.d.ts +9 -0
  102. package/dist/components/list-group/list-group.js +43 -0
  103. package/dist/components/list-group/list-group.js.map +1 -0
  104. package/dist/components/list-group/list-group.types.d.ts +32 -0
  105. package/dist/components/nav/index.d.ts +2 -0
  106. package/dist/components/nav/nav.d.ts +13 -0
  107. package/dist/components/nav/nav.js +113 -0
  108. package/dist/components/nav/nav.js.map +1 -0
  109. package/dist/components/nav/nav.types.d.ts +56 -0
  110. package/dist/components/navbar/index.d.ts +5 -2
  111. package/dist/components/navbar/navbar-panel.js +48 -0
  112. package/dist/components/navbar/navbar-panel.js.map +1 -0
  113. package/dist/components/navbar/navbar.context.js +13 -0
  114. package/dist/components/navbar/navbar.context.js.map +1 -0
  115. package/dist/components/navbar/navbar.d.ts +45 -7
  116. package/dist/components/navbar/navbar.js +221 -0
  117. package/dist/components/navbar/navbar.js.map +1 -0
  118. package/dist/components/navbar/navbar.render.js +26 -0
  119. package/dist/components/navbar/navbar.render.js.map +1 -0
  120. package/dist/components/navbar/navbar.shared.js +18 -0
  121. package/dist/components/navbar/navbar.shared.js.map +1 -0
  122. package/dist/components/navbar/navbar.types.d.ts +29 -22
  123. package/dist/components/overlays/dropdown-content.d.ts +8 -0
  124. package/dist/components/overlays/dropdown-content.js +18 -0
  125. package/dist/components/overlays/dropdown-content.js.map +1 -0
  126. package/dist/components/pagination/index.d.ts +2 -0
  127. package/dist/components/pagination/pagination.d.ts +11 -0
  128. package/dist/components/pagination/pagination.js +95 -0
  129. package/dist/components/pagination/pagination.js.map +1 -0
  130. package/dist/components/pagination/pagination.types.d.ts +40 -0
  131. package/dist/components/section/index.d.ts +3 -3
  132. package/dist/components/section/section.a11y.d.ts +14 -10
  133. package/dist/components/section/section.d.ts +8 -3
  134. package/dist/{section → components/section}/section.js +3 -2
  135. package/dist/components/section/section.js.map +1 -0
  136. package/dist/components/section/section.types.d.ts +20 -14
  137. package/dist/components/separator/index.d.ts +3 -3
  138. package/dist/components/separator/separator.a11y.d.ts +13 -9
  139. package/dist/components/separator/separator.a11y.js +15 -0
  140. package/dist/components/separator/separator.a11y.js.map +1 -0
  141. package/dist/components/separator/separator.d.ts +8 -3
  142. package/dist/components/separator/separator.js.map +1 -0
  143. package/dist/components/separator/separator.types.d.ts +19 -13
  144. package/dist/components/shell/index.d.ts +3 -0
  145. package/dist/components/shell/shell-nav.types.d.ts +7 -0
  146. package/dist/components/shell/shell-panel.js +54 -0
  147. package/dist/components/shell/shell-panel.js.map +1 -0
  148. package/dist/components/shell/shell-responsive.js +110 -0
  149. package/dist/components/shell/shell-responsive.js.map +1 -0
  150. package/dist/components/shell/shell.a11y.d.ts +23 -0
  151. package/dist/components/shell/shell.a11y.js +23 -0
  152. package/dist/components/shell/shell.a11y.js.map +1 -0
  153. package/dist/components/shell/shell.d.ts +13 -0
  154. package/dist/components/shell/shell.js +69 -0
  155. package/dist/components/shell/shell.js.map +1 -0
  156. package/dist/components/shell/shell.types.d.ts +58 -0
  157. package/dist/components/sidebar/sidebar-panel.d.ts +7 -0
  158. package/dist/components/sidebar/sidebar-panel.js +59 -0
  159. package/dist/components/sidebar/sidebar-panel.js.map +1 -0
  160. package/dist/components/sidebar/sidebar-toggle.d.ts +7 -0
  161. package/dist/components/sidebar/sidebar-toggle.js +8 -0
  162. package/dist/components/sidebar/sidebar-toggle.js.map +1 -0
  163. package/dist/components/sidebar/sidebar.context.js +21 -0
  164. package/dist/components/sidebar/sidebar.context.js.map +1 -0
  165. package/dist/components/sidebar/sidebar.d.ts +7 -0
  166. package/dist/components/sidebar/sidebar.js +228 -0
  167. package/dist/components/sidebar/sidebar.js.map +1 -0
  168. package/dist/components/sidebar/sidebar.shared.js +12 -0
  169. package/dist/components/sidebar/sidebar.shared.js.map +1 -0
  170. package/dist/components/sidebar/sidebar.types.d.ts +30 -0
  171. package/dist/components/skeleton/index.d.ts +3 -3
  172. package/dist/components/skeleton/skeleton.a11y.d.ts +12 -8
  173. package/dist/components/skeleton/skeleton.d.ts +8 -3
  174. package/dist/components/skeleton/skeleton.js.map +1 -0
  175. package/dist/components/skeleton/skeleton.types.d.ts +16 -10
  176. package/dist/components/spacer/index.d.ts +3 -3
  177. package/dist/components/spacer/spacer.a11y.d.ts +16 -12
  178. package/dist/components/spacer/spacer.d.ts +8 -3
  179. package/dist/{spacer → components/spacer}/spacer.js +3 -1
  180. package/dist/components/spacer/spacer.js.map +1 -0
  181. package/dist/components/spacer/spacer.types.d.ts +23 -21
  182. package/dist/components/spinner/index.d.ts +2 -2
  183. package/dist/components/spinner/spinner.d.ts +7 -2
  184. package/dist/components/spinner/spinner.js.map +1 -0
  185. package/dist/components/spinner/spinner.types.d.ts +9 -4
  186. package/dist/components/stack/index.d.ts +3 -3
  187. package/dist/components/stack/stack.a11y.d.ts +17 -13
  188. package/dist/components/stack/stack.d.ts +8 -3
  189. package/dist/components/stack/stack.js.map +1 -0
  190. package/dist/components/stack/stack.types.d.ts +19 -13
  191. package/dist/components/theme/index.d.ts +1 -2
  192. package/dist/components/theme/theme.d.ts +41 -34
  193. package/dist/{theme → components/theme}/theme.js +33 -4
  194. package/dist/components/theme/theme.js.map +1 -0
  195. package/dist/controls.d.ts +10 -0
  196. package/dist/controls.js +7 -0
  197. package/dist/feedback.d.ts +5 -0
  198. package/dist/feedback.js +4 -0
  199. package/dist/layouts.d.ts +25 -0
  200. package/dist/layouts.js +11 -0
  201. package/dist/navs.d.ts +15 -0
  202. package/dist/navs.js +9 -0
  203. package/dist/overlays.d.ts +3 -0
  204. package/dist/overlays.js +4 -0
  205. package/dist/shells.d.ts +16 -0
  206. package/dist/shells.js +11 -0
  207. package/dist/surfaces.d.ts +16 -0
  208. package/dist/surfaces.js +9 -0
  209. package/dist/theme.d.ts +2 -0
  210. package/dist/theme.js +3 -0
  211. package/dist/themes/default/index.css +3132 -832
  212. package/package.json +65 -25
  213. package/src/components/_internal/box-layout.ts +8 -0
  214. package/src/components/_internal/jsx.ts +91 -16
  215. package/src/components/_internal/layout.ts +4 -17
  216. package/src/components/_internal/merge-props.ts +9 -0
  217. package/src/components/_internal/pathname.ts +67 -0
  218. package/src/components/_internal/style.ts +51 -0
  219. package/src/components/alert/alert.tsx +84 -0
  220. package/src/components/alert/alert.types.ts +20 -0
  221. package/src/components/alert/index.ts +2 -0
  222. package/src/components/aspect-ratio/aspect-ratio.tsx +10 -24
  223. package/src/components/aspect-ratio/aspect-ratio.types.ts +2 -1
  224. package/src/components/badge/badge.tsx +6 -0
  225. package/src/components/badge/badge.types.ts +2 -1
  226. package/src/components/block/block.a11y.ts +17 -0
  227. package/src/components/block/block.tsx +71 -0
  228. package/src/components/block/block.types.ts +60 -0
  229. package/src/components/block/index.ts +11 -0
  230. package/src/components/box/box.tsx +3 -2
  231. package/src/components/box/box.types.ts +2 -1
  232. package/src/components/breadcrumb/breadcrumb.types.ts +2 -1
  233. package/src/components/button-group/button-group.tsx +32 -0
  234. package/src/components/button-group/button-group.types.ts +12 -0
  235. package/src/components/button-group/index.ts +2 -0
  236. package/src/components/card/card.tsx +72 -43
  237. package/src/components/card/card.types.ts +6 -1
  238. package/src/components/card/index.ts +10 -1
  239. package/src/components/close/close.tsx +19 -0
  240. package/src/components/close/close.types.ts +7 -0
  241. package/src/components/close/index.ts +2 -0
  242. package/src/components/container/container.tsx +4 -4
  243. package/src/components/container/container.types.ts +2 -1
  244. package/src/components/empty-state/empty-state.types.ts +3 -0
  245. package/src/components/field/field.tsx +36 -0
  246. package/src/components/field/field.types.ts +19 -0
  247. package/src/components/field/index.ts +2 -0
  248. package/src/components/flex/flex.tsx +4 -2
  249. package/src/components/flex/flex.types.ts +2 -1
  250. package/src/components/input-group/index.ts +7 -0
  251. package/src/components/input-group/input-group.tsx +57 -0
  252. package/src/components/input-group/input-group.types.ts +26 -0
  253. package/src/components/list-group/index.ts +7 -0
  254. package/src/components/list-group/list-group.tsx +74 -0
  255. package/src/components/list-group/list-group.types.ts +32 -0
  256. package/src/components/nav/index.ts +14 -0
  257. package/src/components/nav/nav.tsx +203 -0
  258. package/src/components/nav/nav.types.ts +68 -0
  259. package/src/components/navbar/index.ts +9 -2
  260. package/src/components/navbar/navbar-panel.tsx +67 -0
  261. package/src/components/navbar/navbar.context.ts +22 -0
  262. package/src/components/navbar/navbar.render.tsx +32 -0
  263. package/src/components/navbar/navbar.shared.ts +21 -0
  264. package/src/components/navbar/navbar.tsx +262 -53
  265. package/src/components/navbar/navbar.types.ts +36 -22
  266. package/src/components/overlays/dropdown-content.tsx +28 -0
  267. package/src/components/pagination/index.ts +8 -0
  268. package/src/components/pagination/pagination.tsx +158 -0
  269. package/src/components/pagination/pagination.types.ts +41 -0
  270. package/src/components/section/section.tsx +3 -2
  271. package/src/components/section/section.types.ts +2 -1
  272. package/src/components/separator/separator.types.ts +2 -1
  273. package/src/components/shell/index.ts +16 -0
  274. package/src/components/shell/shell-nav.types.ts +3 -0
  275. package/src/components/shell/shell-panel.tsx +85 -0
  276. package/src/components/shell/shell-responsive.tsx +212 -0
  277. package/src/components/shell/shell.a11y.ts +20 -0
  278. package/src/components/shell/shell.tsx +74 -0
  279. package/src/components/shell/shell.types.ts +71 -0
  280. package/src/components/sidebar/index.ts +5 -0
  281. package/src/components/sidebar/sidebar-panel.tsx +76 -0
  282. package/src/components/sidebar/sidebar-toggle.tsx +5 -0
  283. package/src/components/sidebar/sidebar.context.ts +40 -0
  284. package/src/components/sidebar/sidebar.shared.ts +12 -0
  285. package/src/components/sidebar/sidebar.tsx +355 -0
  286. package/src/components/sidebar/sidebar.types.ts +35 -0
  287. package/src/components/skeleton/skeleton.types.ts +2 -1
  288. package/src/components/spacer/spacer.tsx +4 -1
  289. package/src/components/spacer/spacer.types.ts +3 -2
  290. package/src/components/stack/stack.types.ts +2 -1
  291. package/src/components/theme/index.ts +10 -1
  292. package/src/components/theme/theme.tsx +15 -4
  293. package/src/controls.ts +18 -0
  294. package/src/feedback.ts +6 -0
  295. package/src/layouts.ts +19 -0
  296. package/src/navs.ts +26 -0
  297. package/src/overlays.ts +90 -0
  298. package/src/shells.ts +13 -0
  299. package/src/surfaces.ts +23 -0
  300. package/src/theme.ts +21 -0
  301. package/src/themes/default/index.css +13 -3
  302. package/src/themes/default/styles/actions/button-group.css +74 -0
  303. package/src/themes/default/styles/actions/button.css +48 -8
  304. package/src/themes/default/styles/actions/toggle-group.css +19 -12
  305. package/src/themes/default/styles/actions/toggle.css +16 -10
  306. package/src/themes/default/styles/base/icon.css +2 -0
  307. package/src/themes/default/styles/base/reset.css +28 -0
  308. package/src/themes/default/styles/base/typography.css +37 -17
  309. package/src/themes/default/styles/base/utilities.css +56 -39
  310. package/src/themes/default/styles/disclosure/accordion.css +22 -14
  311. package/src/themes/default/styles/disclosure/collapsible.css +22 -11
  312. package/src/themes/default/styles/display/alert.css +109 -0
  313. package/src/themes/default/styles/display/avatar.css +9 -4
  314. package/src/themes/default/styles/display/badge.css +12 -3
  315. package/src/themes/default/styles/display/card.css +16 -4
  316. package/src/themes/default/styles/display/coverage.css +2 -14
  317. package/src/themes/default/styles/display/list-group.css +84 -0
  318. package/src/themes/default/styles/display/progress-circle.css +3 -2
  319. package/src/themes/default/styles/display/progress.css +8 -5
  320. package/src/themes/default/styles/display/scroll-area.css +15 -0
  321. package/src/themes/default/styles/display/separator.css +4 -4
  322. package/src/themes/default/styles/display/skeleton.css +25 -2
  323. package/src/themes/default/styles/display/spinner.css +1 -1
  324. package/src/themes/default/styles/display/table.css +7 -4
  325. package/src/themes/default/styles/display/virtual-list.css +29 -0
  326. package/src/themes/default/styles/display/virtual-table.css +68 -0
  327. package/src/themes/default/styles/forms/checkbox.css +2 -1
  328. package/src/themes/default/styles/forms/field.css +22 -0
  329. package/src/themes/default/styles/forms/form.css +1 -1
  330. package/src/themes/default/styles/forms/input-group.css +202 -0
  331. package/src/themes/default/styles/forms/input.css +22 -6
  332. package/src/themes/default/styles/forms/label.css +2 -0
  333. package/src/themes/default/styles/forms/radio-group.css +22 -13
  334. package/src/themes/default/styles/forms/select.css +71 -26
  335. package/src/themes/default/styles/forms/slider.css +32 -16
  336. package/src/themes/default/styles/forms/switch.css +2 -1
  337. package/src/themes/default/styles/forms/textarea.css +35 -6
  338. package/src/themes/default/styles/layout/aspect-ratio.css +3 -1
  339. package/src/themes/default/styles/layout/block.css +23 -0
  340. package/src/themes/default/styles/layout/patterns.css +155 -3
  341. package/src/themes/default/styles/layout/responsive-layout.css +140 -121
  342. package/src/themes/default/styles/navigation/breadcrumb.css +7 -1
  343. package/src/themes/default/styles/navigation/menu.css +150 -7
  344. package/src/themes/default/styles/navigation/menubar.css +194 -28
  345. package/src/themes/default/styles/navigation/nav.css +231 -0
  346. package/src/themes/default/styles/navigation/pagination.css +91 -0
  347. package/src/themes/default/styles/overlays/alert-dialog.css +1 -1
  348. package/src/themes/default/styles/overlays/dialog.css +42 -10
  349. package/src/themes/default/styles/overlays/dropdown.css +160 -0
  350. package/src/themes/default/styles/overlays/hover-card.css +28 -3
  351. package/src/themes/default/styles/overlays/popover.css +50 -6
  352. package/src/themes/default/styles/overlays/toast.css +66 -17
  353. package/src/themes/default/styles/overlays/tooltip.css +45 -18
  354. package/src/themes/default/styles/shell/header.css +18 -3
  355. package/src/themes/default/styles/shell/navbar.css +434 -73
  356. package/src/themes/default/styles/shell/sidebar.css +809 -0
  357. package/src/themes/default/styles/shell/theme.css +7 -5
  358. package/src/themes/default/tokens.css +186 -123
  359. package/src/themes/presets/calico.css +46 -0
  360. package/src/themes/presets/ginger.css +46 -0
  361. package/src/themes/presets/index.css +5 -0
  362. package/src/themes/presets/tabby.css +46 -0
  363. package/src/themes/presets/torty.css +49 -0
  364. package/src/themes/presets/tuxedo.css +49 -0
  365. package/templates/theme/index.css +14 -4
  366. package/templates/theme/styles/actions/button-group.css +74 -0
  367. package/templates/theme/styles/actions/button.css +48 -8
  368. package/templates/theme/styles/actions/toggle-group.css +19 -12
  369. package/templates/theme/styles/actions/toggle.css +16 -10
  370. package/templates/theme/styles/base/icon.css +2 -0
  371. package/templates/theme/styles/base/reset.css +28 -0
  372. package/templates/theme/styles/base/typography.css +37 -17
  373. package/templates/theme/styles/disclosure/accordion.css +22 -14
  374. package/templates/theme/styles/disclosure/collapsible.css +22 -11
  375. package/templates/theme/styles/display/alert.css +109 -0
  376. package/templates/theme/styles/display/avatar.css +9 -4
  377. package/templates/theme/styles/display/badge.css +12 -3
  378. package/templates/theme/styles/display/card.css +16 -4
  379. package/templates/theme/styles/display/coverage.css +105 -15
  380. package/templates/theme/styles/display/list-group.css +84 -0
  381. package/templates/theme/styles/display/progress-circle.css +3 -2
  382. package/templates/theme/styles/display/progress.css +8 -5
  383. package/templates/theme/styles/display/scroll-area.css +15 -0
  384. package/templates/theme/styles/display/separator.css +4 -4
  385. package/templates/theme/styles/display/skeleton.css +25 -2
  386. package/templates/theme/styles/display/spinner.css +1 -1
  387. package/templates/theme/styles/display/table.css +7 -4
  388. package/templates/theme/styles/display/virtual-list.css +29 -0
  389. package/templates/theme/styles/display/virtual-table.css +68 -0
  390. package/templates/theme/styles/forms/checkbox.css +2 -1
  391. package/templates/theme/styles/forms/field.css +22 -0
  392. package/templates/theme/styles/forms/form.css +1 -1
  393. package/templates/theme/styles/forms/input-group.css +202 -0
  394. package/templates/theme/styles/forms/input.css +22 -6
  395. package/templates/theme/styles/forms/label.css +2 -0
  396. package/templates/theme/styles/forms/radio-group.css +22 -13
  397. package/templates/theme/styles/forms/select.css +71 -26
  398. package/templates/theme/styles/forms/slider.css +32 -16
  399. package/templates/theme/styles/forms/switch.css +2 -1
  400. package/templates/theme/styles/forms/textarea.css +35 -6
  401. package/templates/theme/styles/layout/aspect-ratio.css +3 -1
  402. package/templates/theme/styles/layout/block.css +23 -0
  403. package/templates/theme/styles/layout/patterns.css +155 -3
  404. package/templates/theme/styles/layout/responsive-layout.css +140 -121
  405. package/templates/theme/styles/navigation/breadcrumb.css +22 -8
  406. package/templates/theme/styles/navigation/menu.css +150 -7
  407. package/templates/theme/styles/navigation/menubar.css +194 -28
  408. package/templates/theme/styles/navigation/nav.css +231 -0
  409. package/templates/theme/styles/navigation/pagination.css +91 -0
  410. package/templates/theme/styles/overlays/alert-dialog.css +1 -1
  411. package/templates/theme/styles/overlays/dialog.css +42 -10
  412. package/templates/theme/styles/overlays/dropdown.css +160 -0
  413. package/templates/theme/styles/overlays/hover-card.css +28 -3
  414. package/templates/theme/styles/overlays/popover.css +50 -6
  415. package/templates/theme/styles/overlays/toast.css +66 -17
  416. package/templates/theme/styles/overlays/tooltip.css +45 -18
  417. package/templates/theme/styles/shell/header.css +18 -3
  418. package/templates/theme/styles/shell/navbar.css +434 -73
  419. package/templates/theme/styles/shell/sidebar.css +809 -0
  420. package/templates/theme/styles/shell/theme.css +7 -5
  421. package/templates/theme/tokens.css +186 -123
  422. package/dist/_internal/box-layout.js.map +0 -1
  423. package/dist/_internal/classes.js.map +0 -1
  424. package/dist/_internal/jsx.js.map +0 -1
  425. package/dist/_internal/layout.d.ts +0 -9
  426. package/dist/_internal/layout.js.map +0 -1
  427. package/dist/_internal/merge-props.js.map +0 -1
  428. package/dist/accessible-icon/accessible-icon.d.ts +0 -7
  429. package/dist/accessible-icon/accessible-icon.js +0 -20
  430. package/dist/accessible-icon/accessible-icon.js.map +0 -1
  431. package/dist/accessible-icon/accessible-icon.types.d.ts +0 -9
  432. package/dist/aspect-ratio/aspect-ratio.d.ts +0 -8
  433. package/dist/aspect-ratio/aspect-ratio.js +0 -36
  434. package/dist/aspect-ratio/aspect-ratio.js.map +0 -1
  435. package/dist/aspect-ratio/aspect-ratio.types.d.ts +0 -20
  436. package/dist/aspect-ratio/index.d.ts +0 -2
  437. package/dist/badge/badge.d.ts +0 -8
  438. package/dist/badge/badge.js.map +0 -1
  439. package/dist/badge/badge.types.d.ts +0 -20
  440. package/dist/badge/index.d.ts +0 -2
  441. package/dist/box/box.d.ts +0 -9
  442. package/dist/box/box.js.map +0 -1
  443. package/dist/box/box.types.d.ts +0 -71
  444. package/dist/box/index.d.ts +0 -2
  445. package/dist/breadcrumb/breadcrumb.d.ts +0 -18
  446. package/dist/breadcrumb/breadcrumb.js.map +0 -1
  447. package/dist/breadcrumb/breadcrumb.types.d.ts +0 -64
  448. package/dist/breadcrumb/index.d.ts +0 -2
  449. package/dist/card/card.d.ts +0 -12
  450. package/dist/card/card.js +0 -68
  451. package/dist/card/card.js.map +0 -1
  452. package/dist/card/card.types.d.ts +0 -37
  453. package/dist/card/index.d.ts +0 -2
  454. package/dist/components/_internal/box-layout.d.ts +0 -7
  455. package/dist/components/_internal/classes.d.ts +0 -1
  456. package/dist/components/_internal/jsx.d.ts +0 -8
  457. package/dist/components/_internal/merge-props.d.ts +0 -1
  458. package/dist/components/_internal/style.d.ts +0 -1
  459. package/dist/components/accessible-icon/accessible-icon.d.ts +0 -2
  460. package/dist/components/accessible-icon/accessible-icon.types.d.ts +0 -5
  461. package/dist/components/accessible-icon/index.d.ts +0 -2
  462. package/dist/components/grid/grid.a11y.d.ts +0 -21
  463. package/dist/components/grid/grid.d.ts +0 -4
  464. package/dist/components/grid/grid.types.d.ts +0 -37
  465. package/dist/components/grid/index.d.ts +0 -3
  466. package/dist/components/header/index.d.ts +0 -3
  467. package/dist/components/index.d.ts +0 -49
  468. package/dist/components/index.js +0 -28
  469. package/dist/components/logos/create-logo.d.ts +0 -5
  470. package/dist/components/logos/github-logo.d.ts +0 -4
  471. package/dist/components/logos/google-logo.d.ts +0 -4
  472. package/dist/components/logos/index.d.ts +0 -5
  473. package/dist/components/logos/microsoft-logo.d.ts +0 -4
  474. package/dist/components/logos/types.d.ts +0 -14
  475. package/dist/components/sidebar-layout/index.d.ts +0 -3
  476. package/dist/components/sidebar-layout/sidebar-layout.a11y.d.ts +0 -15
  477. package/dist/components/sidebar-layout/sidebar-layout.d.ts +0 -2
  478. package/dist/components/sidebar-layout/sidebar-layout.types.d.ts +0 -20
  479. package/dist/components/topbar-layout/index.d.ts +0 -3
  480. package/dist/components/topbar-layout/topbar-layout.a11y.d.ts +0 -13
  481. package/dist/components/topbar-layout/topbar-layout.d.ts +0 -2
  482. package/dist/components/topbar-layout/topbar-layout.types.d.ts +0 -12
  483. package/dist/container/container.d.ts +0 -8
  484. package/dist/container/container.js.map +0 -1
  485. package/dist/container/container.types.d.ts +0 -28
  486. package/dist/container/index.d.ts +0 -2
  487. package/dist/empty-state/empty-state.d.ts +0 -7
  488. package/dist/empty-state/empty-state.js.map +0 -1
  489. package/dist/empty-state/empty-state.types.d.ts +0 -13
  490. package/dist/flex/flex.d.ts +0 -9
  491. package/dist/flex/flex.js.map +0 -1
  492. package/dist/flex/flex.types.d.ts +0 -41
  493. package/dist/flex/index.d.ts +0 -2
  494. package/dist/grid/grid.d.ts +0 -9
  495. package/dist/grid/grid.js +0 -115
  496. package/dist/grid/grid.js.map +0 -1
  497. package/dist/grid/grid.types.d.ts +0 -40
  498. package/dist/grid/index.d.ts +0 -2
  499. package/dist/header/header.d.ts +0 -7
  500. package/dist/header/header.js.map +0 -1
  501. package/dist/header/header.types.d.ts +0 -9
  502. package/dist/inline/index.d.ts +0 -7
  503. package/dist/inline/index.js.map +0 -1
  504. package/dist/logos/create-logo.d.ts +0 -1
  505. package/dist/logos/create-logo.js +0 -75
  506. package/dist/logos/create-logo.js.map +0 -1
  507. package/dist/logos/github-logo.d.ts +0 -18
  508. package/dist/logos/github-logo.js +0 -9
  509. package/dist/logos/github-logo.js.map +0 -1
  510. package/dist/logos/google-logo.d.ts +0 -18
  511. package/dist/logos/google-logo.js +0 -23
  512. package/dist/logos/google-logo.js.map +0 -1
  513. package/dist/logos/index.d.ts +0 -4
  514. package/dist/logos/microsoft-logo.d.ts +0 -18
  515. package/dist/logos/microsoft-logo.js +0 -35
  516. package/dist/logos/microsoft-logo.js.map +0 -1
  517. package/dist/logos/types.d.ts +0 -16
  518. package/dist/navbar/index.d.ts +0 -2
  519. package/dist/navbar/navbar.d.ts +0 -12
  520. package/dist/navbar/navbar.js +0 -73
  521. package/dist/navbar/navbar.js.map +0 -1
  522. package/dist/navbar/navbar.types.d.ts +0 -31
  523. package/dist/section/index.d.ts +0 -2
  524. package/dist/section/section.d.ts +0 -8
  525. package/dist/section/section.js.map +0 -1
  526. package/dist/section/section.types.d.ts +0 -22
  527. package/dist/separator/index.d.ts +0 -2
  528. package/dist/separator/separator.d.ts +0 -8
  529. package/dist/separator/separator.js.map +0 -1
  530. package/dist/separator/separator.types.d.ts +0 -21
  531. package/dist/sidebar-layout/index.d.ts +0 -2
  532. package/dist/sidebar-layout/sidebar-layout.d.ts +0 -7
  533. package/dist/sidebar-layout/sidebar-layout.js +0 -51
  534. package/dist/sidebar-layout/sidebar-layout.js.map +0 -1
  535. package/dist/sidebar-layout/sidebar-layout.types.d.ts +0 -20
  536. package/dist/skeleton/index.d.ts +0 -2
  537. package/dist/skeleton/skeleton.d.ts +0 -8
  538. package/dist/skeleton/skeleton.js.map +0 -1
  539. package/dist/skeleton/skeleton.types.d.ts +0 -18
  540. package/dist/spacer/index.d.ts +0 -2
  541. package/dist/spacer/spacer.d.ts +0 -8
  542. package/dist/spacer/spacer.js.map +0 -1
  543. package/dist/spacer/spacer.types.d.ts +0 -25
  544. package/dist/spinner/index.d.ts +0 -2
  545. package/dist/spinner/spinner.d.ts +0 -7
  546. package/dist/spinner/spinner.js.map +0 -1
  547. package/dist/spinner/spinner.types.d.ts +0 -10
  548. package/dist/stack/index.d.ts +0 -2
  549. package/dist/stack/stack.d.ts +0 -8
  550. package/dist/stack/stack.js.map +0 -1
  551. package/dist/stack/stack.types.d.ts +0 -21
  552. package/dist/theme/index.d.ts +0 -1
  553. package/dist/theme/theme.d.ts +0 -44
  554. package/dist/theme/theme.js.map +0 -1
  555. package/dist/topbar-layout/index.d.ts +0 -2
  556. package/dist/topbar-layout/topbar-layout.d.ts +0 -7
  557. package/dist/topbar-layout/topbar-layout.js +0 -37
  558. package/dist/topbar-layout/topbar-layout.js.map +0 -1
  559. package/dist/topbar-layout/topbar-layout.types.d.ts +0 -13
  560. package/src/askr-compat.d.ts +0 -110
  561. package/src/askr-router.d.ts +0 -16
  562. package/src/components/accessible-icon/accessible-icon.tsx +0 -18
  563. package/src/components/accessible-icon/accessible-icon.types.ts +0 -5
  564. package/src/components/accessible-icon/index.ts +0 -2
  565. package/src/components/grid/grid.a11y.ts +0 -22
  566. package/src/components/grid/grid.tsx +0 -172
  567. package/src/components/grid/grid.types.ts +0 -45
  568. package/src/components/grid/index.ts +0 -10
  569. package/src/components/index.ts +0 -108
  570. package/src/components/logos/create-logo.tsx +0 -103
  571. package/src/components/logos/github-logo.tsx +0 -13
  572. package/src/components/logos/google-logo.tsx +0 -34
  573. package/src/components/logos/index.ts +0 -5
  574. package/src/components/logos/microsoft-logo.tsx +0 -10
  575. package/src/components/logos/types.ts +0 -24
  576. package/src/components/sidebar-layout/index.ts +0 -6
  577. package/src/components/sidebar-layout/sidebar-layout.a11y.ts +0 -16
  578. package/src/components/sidebar-layout/sidebar-layout.tsx +0 -59
  579. package/src/components/sidebar-layout/sidebar-layout.types.ts +0 -22
  580. package/src/components/topbar-layout/index.ts +0 -3
  581. package/src/components/topbar-layout/topbar-layout.a11y.ts +0 -14
  582. package/src/components/topbar-layout/topbar-layout.tsx +0 -39
  583. package/src/components/topbar-layout/topbar-layout.types.ts +0 -13
  584. package/src/themes/default/styles/layout/dashboard-layout.css +0 -15
  585. package/src/themes/default/styles/layout/docs-layout.css +0 -10
  586. package/src/themes/default/styles/layout/sidebar.css +0 -10
  587. package/src/themes/default/styles/navigation/navigation-menu.css +0 -90
  588. package/src/themes/default/styles/navigation/tabs.css +0 -61
  589. package/src/themes/default/styles/overlays/dropdown-menu.css +0 -109
  590. package/templates/theme/styles/layout/dashboard-layout.css +0 -16
  591. package/templates/theme/styles/layout/docs-layout.css +0 -11
  592. package/templates/theme/styles/layout/sidebar.css +0 -11
  593. package/templates/theme/styles/navigation/navigation-menu.css +0 -90
  594. package/templates/theme/styles/navigation/tabs.css +0 -61
  595. package/templates/theme/styles/overlays/dropdown-menu.css +0 -109
  596. /package/dist/{_internal → components/_internal}/classes.js +0 -0
  597. /package/dist/{_internal → components/_internal}/jsx.js +0 -0
  598. /package/dist/{breadcrumb → components/breadcrumb}/breadcrumb.js +0 -0
  599. /package/dist/{empty-state → components/empty-state}/empty-state.js +0 -0
  600. /package/dist/{header → components/header}/header.js +0 -0
  601. /package/dist/{inline → components/inline}/index.js +0 -0
  602. /package/dist/{separator → components/separator}/separator.js +0 -0
  603. /package/dist/{skeleton → components/skeleton}/skeleton.js +0 -0
  604. /package/dist/{spinner → components/spinner}/spinner.js +0 -0
  605. /package/dist/{stack → components/stack}/stack.js +0 -0
package/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # @askrjs/themes
2
+
3
+ CSS tokens, shell chrome, and styled composition helpers for Askr apps.
4
+
5
+ `@askrjs/themes` is the visual companion to `@askrjs/ui` and
6
+ `@askrjs/charts`. It owns the default theme, shared layout wrappers, and
7
+ theme-aware component styling while behavior and data contracts stay in the
8
+ other packages.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ npm install @askrjs/themes @askrjs/ui
14
+ ```
15
+
16
+ ## Quick Start
17
+
18
+ Import the default theme CSS in your app stylesheet:
19
+
20
+ ```css
21
+ @import "@askrjs/themes/default";
22
+ ```
23
+
24
+ Add the optional cat preset layer after the default theme when you want the
25
+ curated preset family:
26
+
27
+ ```css
28
+ @import "@askrjs/themes/default";
29
+ @import "@askrjs/themes/presets";
30
+ ```
31
+
32
+ Then set `data-theme` to `tabby`, `ginger`, `tuxedo`, `calico`, or `torty`.
33
+ For picker/toggle composition, import `CAT_THEME_OPTIONS` and `CAT_THEME_NAMES`
34
+ from `@askrjs/themes/theme`.
35
+
36
+ Then use the theme helpers and curated component surfaces:
37
+
38
+ ```tsx
39
+ import { ThemeProvider, ThemeToggle } from "@askrjs/themes/theme";
40
+ import { Button, ButtonGroup, Field, InputGroup } from "@askrjs/themes/controls";
41
+
42
+ export function AppShell() {
43
+ return (
44
+ <ThemeProvider>
45
+ <ButtonGroup>
46
+ <Button variant="primary">Save</Button>
47
+ <ThemeToggle>{({ nextTheme }) => nextTheme}</ThemeToggle>
48
+ </ButtonGroup>
49
+
50
+ <Field>
51
+ <InputGroup>
52
+ <input />
53
+ </InputGroup>
54
+ </Field>
55
+ </ThemeProvider>
56
+ );
57
+ }
58
+ ```
59
+
60
+ ## What To Import
61
+
62
+ - `@askrjs/themes/theme` for `ThemeProvider`, `ThemePicker`, `ThemeToggle`,
63
+ and `useTheme`
64
+ - `@askrjs/themes/controls` for theme-styled controls such as `Button`,
65
+ `ButtonGroup`, `Close`, `Field`, and `InputGroup`
66
+ - `@askrjs/themes/layouts`, `@askrjs/themes/shells`, `@askrjs/themes/navs`,
67
+ `@askrjs/themes/surfaces`, `@askrjs/themes/feedback`, and
68
+ `@askrjs/themes/overlays` for the curated visual composition surfaces
69
+
70
+ ## Theme Contract
71
+
72
+ - Style public `data-*` hooks and token variables, not internal DOM structure.
73
+ - Prefer token overrides before component overrides.
74
+ - Keep selectors low specificity so downstream apps can customize them cleanly.
75
+ - Use [THEMING.md](./THEMING.md) and [docs/architecture.md](./docs/architecture.md)
76
+ for the full contract and package boundaries.
77
+
78
+ - Use `visual-check.html` for manual QA across light and dark modes.
package/THEMING.md CHANGED
@@ -4,6 +4,9 @@
4
4
  `@askrjs/charts`. It owns the app frame and shared visual language, while chart
5
5
  rendering stays in the chart package.
6
6
 
7
+ See [docs/architecture.md](./docs/architecture.md) for the package boundary
8
+ between `@askrjs/askr`, `@askrjs/ui`, and `@askrjs/themes`.
9
+
7
10
  Import a theme:
8
11
 
9
12
  ```css
@@ -45,6 +48,38 @@ Icon override:
45
48
 
46
49
  Rules: style only public data-\* hooks, never internal DOM, no deep selectors, no !important.
47
50
 
51
+ ## Visual Quality Standard
52
+
53
+ The default theme is optimized for quiet SaaS products: dense enough for repeated daily use,
54
+ restrained enough for application chrome, and polished enough that downstream apps should not
55
+ need to fix basic spacing or type rhythm.
56
+
57
+ Use `visual-check.html` as the manual audit surface before shipping theme changes. Review every
58
+ component family in light and dark mode at desktop, tablet, and mobile widths.
59
+ Use `320`, `390`, `768`, `1024`, and desktop widths as the standard responsive
60
+ manual pass.
61
+
62
+ Manual acceptance criteria:
63
+
64
+ - No clipped text, awkward wrapping, accidental overflow, collapsed gaps, or misaligned icons.
65
+ - Interactive controls share height, padding, radius, typography, and focus treatment.
66
+ - Headings and body text use deliberate hierarchy, readable line lengths, and calm letter spacing.
67
+ - Dark mode has equal polish and contrast, not just inverted colors.
68
+ - Dense SaaS compositions scan cleanly without feeling cramped.
69
+ - Overlays, menus, and popups use the shared elevated surface language.
70
+ - Long labels and realistic enterprise copy remain legible without breaking layout.
71
+
72
+ ## Template Sync
73
+
74
+ - When changing `src/themes/default/styles/**`, update the matching
75
+ `templates/theme/styles/**` file in the same change unless a test documents
76
+ an intentional template difference.
77
+ - Keep generated theme templates visually aligned with the default theme so
78
+ scaffolded themes inherit the same density, spacing, typography, and
79
+ responsive behavior.
80
+ - `visual-check.html` is the primary manual audit surface; browser tests should
81
+ assert stable computed-style contracts and no page-level overflow.
82
+
48
83
  Selector contract:
49
84
 
50
85
  - Tokens keep the `--ak-*` prefix because they are global.
@@ -53,6 +88,7 @@ Selector contract:
53
88
  - Alias selectors must be grouped with canonical selectors in the same low-specificity rule. Classes are convenience API, not a replacement source of truth.
54
89
  - Theme-owned pattern components use plain kebab-case classes such as `.page-header`, and public pattern parts should emit matching `data-slot` hooks so the same grouped selector pattern applies there as well.
55
90
  - Semantic `askr-ui` table primitives are styled from `styles/display/table.css` using their `data-slot` hooks only; keep the surface semantic and avoid restoring data-grid behavior in themes.
91
+ - `Button` comes from `@askrjs/ui`; `@askrjs/themes` re-exports and styles it. `ButtonGroup`, `Close`, `Field`, and `InputGroup` stay in themes because they are visual composition wrappers.
56
92
 
57
93
  Example:
58
94
 
@@ -73,24 +109,30 @@ Package boundaries:
73
109
  - `@askrjs/themes` owns visual-only components, layout composition, and
74
110
  default styling.
75
111
 
76
- Use `@askrjs/themes/components` for styled components such as Button, Box,
77
- Stack, Inline, Flex, Grid, Container, Section, Spacer, Badge, Skeleton,
78
- Separator/Divider, SidebarLayout, TopbarLayout, and EmptyState.
112
+ Use the curated theme entrypoints such as `@askrjs/themes/controls`,
113
+ `@askrjs/themes/surfaces`, `@askrjs/themes/navs`, and `@askrjs/themes/shells`
114
+ for styled components such as Button, ButtonGroup, Close, InputGroup, Alert,
115
+ Badge, Box, Block, ListGroup, Pagination, Skeleton, Separator/Divider, Shell,
116
+ ShellNav, ShellMain, and EmptyState.
79
117
 
80
118
  Theme state helpers also live there: `ThemeProvider`, `ThemePicker`,
81
119
  `ThemeToggle`, and `useTheme`. `ThemeToggle` intentionally has no built-in
82
120
  icons; applications pass their own icon/content props.
121
+ The common wrapper components also emit familiar alias classes such as
122
+ `alert`, `btn-group`, `btn-close`, `input-group`, `list-group`, and
123
+ `pagination` so app-level CSS can stay close to the Bootstrap mental model
124
+ without giving up the canonical `data-slot` contract.
83
125
 
84
126
  Responsive rules:
85
127
 
86
128
  - Build mobile first. Base selectors must work on narrow screens; larger layouts are additive via `min-width` media queries.
87
129
  - The default theme uses semantic breakpoints `sm`, `md`, `lg`, and `xl` for `data-collapse-below`.
88
130
  - Keep breakpoint values centralized in theme tokens so the default theme and generated themes stay aligned.
89
- - Responsive behavior must target only public hooks such as `data-collapse-below`, `data-columns`, `data-min-item-width`, `data-gap`, `data-sidebar-position`, and `data-sidebar-width`.
131
+ - Responsive behavior must target only public hooks such as `data-collapse-below`, `data-columns`, `data-min-item-width`, `data-gap`, `data-size`, and `data-variant`.
90
132
  - Prefer token overrides first. Reach for component CSS overrides only when tokens are insufficient.
91
133
  - Keep selectors low-specificity so a custom theme can override a rule with one equally specific selector. `:where(...)` is preferred for the default theme baseline.
92
- - Broad layout slots like `main`, `sidebar`, and `navbar` must always be anchored to a public layout root such as `topbar-layout` or `sidebar-layout`.
93
- - Named layout hooks such as `data-size`, `data-max-width`, `data-padding`, `data-gap`, and `data-sidebar-width` are part of the public theme contract and should resolve through theme tokens rather than hard-coded values.
134
+ - Broad layout slots like `main`, `sidebar`, and `navbar` must always be anchored to a public layout root such as `shell`.
135
+ - Named layout hooks such as `data-size`, `data-max-width`, `data-padding`, and `data-gap` are part of the public theme contract and should resolve through theme tokens rather than hard-coded values.
94
136
  - Icons are part of the public theme contract. `@askrjs/ui` owns the canonical icon hooks, and official icon wrappers should implement that contract by emitting `data-slot="icon"`, `data-icon`, semantic `data-size`, and `data-decorative` so themes can style them uniformly across icon sets.
95
137
  - Icon size and stroke defaults should resolve through the shared icon tokens: `--ak-icon-size-sm|md|lg|xl` and `--ak-icon-stroke-width-sm|md|lg|xl`.
96
138
  - Product SaaS scaffolds should compose broad visual primitives first. Keep first-class pattern exports general; put narrow dashboard, auth, or table-page recipes in docs/examples unless they prove reusable across apps. Recipe shells such as product-style or marketing-style page wrappers belong in userland composition, not the shipped theme package.
@@ -563,7 +605,7 @@ Generic interaction overlays for neutral interactive surfaces.
563
605
 
564
606
  ### Selected
565
607
 
566
- Selection state for tabs, nav items, rows, or toggles.
608
+ Selection state for nav items, rows, or toggles.
567
609
 
568
610
  ### Disabled
569
611
 
@@ -925,7 +967,7 @@ All official themes are tested for WCAG AA compliance:
925
967
  - Status ink on soft backgrounds: 3:1 minimum
926
968
  - Inverse text on primary: 4.5:1 minimum
927
969
 
928
- The automated test suite (`tests/contrast.test.ts`) validates these pairs across all themes in both light and dark modes.
970
+ The automated test suite (`tests/unit/contrast.test.ts`) validates these pairs across all themes in both light and dark modes.
929
971
 
930
972
  ---
931
973
 
@@ -1,4 +1,5 @@
1
1
  import { mergeLayoutStyles, resolveSpaceValue, setResponsiveStyleVar } from "./layout.js";
2
+ import { styleDeclarationsToClass } from "./style.js";
2
3
  //#region src/components/_internal/box-layout.ts
3
4
  const SPACE_PROP_KEYS = new Set([
4
5
  "m",
@@ -106,10 +107,10 @@ function applyBoxLayoutStyles(styles, boxProps) {
106
107
  setResponsiveStyleVar(styles, variable, value, (input) => input);
107
108
  }
108
109
  }
109
- function withBoxLayoutStyle(styles, userStyle) {
110
- return mergeLayoutStyles(styles, userStyle);
110
+ function withBoxLayoutClass(styles, userStyle) {
111
+ return styleDeclarationsToClass(mergeLayoutStyles(styles, userStyle));
111
112
  }
112
113
  //#endregion
113
- export { applyBoxLayoutStyles, splitBoxLayoutProps, withBoxLayoutStyle };
114
+ export { applyBoxLayoutStyles, splitBoxLayoutProps, withBoxLayoutClass };
114
115
 
115
116
  //# sourceMappingURL=box-layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"box-layout.js","names":[],"sources":["../../../src/components/_internal/box-layout.ts"],"sourcesContent":["import { mergeLayoutStyles, resolveSpaceValue, setResponsiveStyleVar } from \"./layout\";\nimport { styleDeclarationsToClass } from \"./style\";\nimport type { BoxLayoutOwnProps } from \"../box/box.types\";\n\nconst SPACE_PROP_KEYS = new Set([\n \"m\",\n \"mx\",\n \"my\",\n \"mt\",\n \"mr\",\n \"mb\",\n \"ml\",\n \"p\",\n \"px\",\n \"py\",\n \"pt\",\n \"pr\",\n \"pb\",\n \"pl\",\n \"inset\",\n \"top\",\n \"right\",\n \"bottom\",\n \"left\",\n]);\n\nconst BOX_PROP_KEYS = new Set<keyof BoxLayoutOwnProps>([\n \"display\",\n \"m\",\n \"mx\",\n \"my\",\n \"mt\",\n \"mr\",\n \"mb\",\n \"ml\",\n \"p\",\n \"px\",\n \"py\",\n \"pt\",\n \"pr\",\n \"pb\",\n \"pl\",\n \"width\",\n \"minWidth\",\n \"maxWidth\",\n \"height\",\n \"minHeight\",\n \"maxHeight\",\n \"position\",\n \"inset\",\n \"top\",\n \"right\",\n \"bottom\",\n \"left\",\n \"overflow\",\n \"overflowX\",\n \"overflowY\",\n \"flexBasis\",\n \"flexGrow\",\n \"flexShrink\",\n \"gridArea\",\n \"gridColumn\",\n \"gridColumnStart\",\n \"gridColumnEnd\",\n \"gridRow\",\n \"gridRowStart\",\n \"gridRowEnd\",\n]);\n\nfunction variableNameForProp(prop: keyof BoxLayoutOwnProps): string {\n switch (prop) {\n case \"overflowX\":\n return \"overflow-x\";\n case \"overflowY\":\n return \"overflow-y\";\n case \"minWidth\":\n return \"min-width\";\n case \"maxWidth\":\n return \"max-width\";\n case \"minHeight\":\n return \"min-height\";\n case \"maxHeight\":\n return \"max-height\";\n case \"flexBasis\":\n return \"flex-basis\";\n case \"flexGrow\":\n return \"flex-grow\";\n case \"flexShrink\":\n return \"flex-shrink\";\n case \"gridArea\":\n return \"grid-area\";\n case \"gridColumn\":\n return \"grid-column\";\n case \"gridColumnStart\":\n return \"grid-column-start\";\n case \"gridColumnEnd\":\n return \"grid-column-end\";\n case \"gridRow\":\n return \"grid-row\";\n case \"gridRowStart\":\n return \"grid-row-start\";\n case \"gridRowEnd\":\n return \"grid-row-end\";\n default:\n return prop;\n }\n}\n\nexport function splitBoxLayoutProps<T extends Record<string, unknown>>(\n props: T,\n): {\n boxProps: Partial<BoxLayoutOwnProps>;\n rest: Omit<T, keyof BoxLayoutOwnProps>;\n} {\n const boxProps: Partial<BoxLayoutOwnProps> = {};\n const rest: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(props)) {\n if (BOX_PROP_KEYS.has(key as keyof BoxLayoutOwnProps)) {\n (boxProps as Record<string, unknown>)[key] = value;\n } else {\n rest[key] = value;\n }\n }\n\n return { boxProps, rest: rest as Omit<T, keyof BoxLayoutOwnProps> };\n}\n\nexport function applyBoxLayoutStyles(\n styles: Record<string, string | number>,\n boxProps: Partial<BoxLayoutOwnProps>,\n) {\n for (const key of BOX_PROP_KEYS) {\n const value = boxProps[key];\n if (value === undefined) continue;\n\n const variable = variableNameForProp(key);\n if (SPACE_PROP_KEYS.has(key)) {\n setResponsiveStyleVar(styles, variable, value as string | number, resolveSpaceValue);\n continue;\n }\n\n setResponsiveStyleVar(\n styles,\n variable,\n value as string | number,\n (input) => input as string | number,\n );\n }\n}\n\nexport function withBoxLayoutStyle(\n styles: Record<string, string | number>,\n userStyle: unknown,\n): string | undefined {\n return mergeLayoutStyles(styles, userStyle);\n}\n\nexport function withBoxLayoutClass(\n styles: Record<string, string | number>,\n userStyle: unknown,\n): string | undefined {\n return styleDeclarationsToClass(mergeLayoutStyles(styles, userStyle));\n}\n"],"mappings":";;;AAIA,MAAM,kBAAkB,IAAI,IAAI;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,MAAM,gBAAgB,IAAI,IAA6B;CACrD;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;CACD,CAAC;AAEF,SAAS,oBAAoB,MAAuC;CAClE,QAAQ,MAAR;EACE,KAAK,aACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,KAAK,YACH,OAAO;EACT,KAAK,YACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,KAAK,YACH,OAAO;EACT,KAAK,cACH,OAAO;EACT,KAAK,YACH,OAAO;EACT,KAAK,cACH,OAAO;EACT,KAAK,mBACH,OAAO;EACT,KAAK,iBACH,OAAO;EACT,KAAK,WACH,OAAO;EACT,KAAK,gBACH,OAAO;EACT,KAAK,cACH,OAAO;EACT,SACE,OAAO;;;AAIb,SAAgB,oBACd,OAIA;CACA,MAAM,WAAuC,EAAE;CAC/C,MAAM,OAAgC,EAAE;CAExC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,EAC9C,IAAI,cAAc,IAAI,IAA+B,EACnD,SAAsC,OAAO;MAE7C,KAAK,OAAO;CAIhB,OAAO;EAAE;EAAgB;EAA0C;;AAGrE,SAAgB,qBACd,QACA,UACA;CACA,KAAK,MAAM,OAAO,eAAe;EAC/B,MAAM,QAAQ,SAAS;EACvB,IAAI,UAAU,KAAA,GAAW;EAEzB,MAAM,WAAW,oBAAoB,IAAI;EACzC,IAAI,gBAAgB,IAAI,IAAI,EAAE;GAC5B,sBAAsB,QAAQ,UAAU,OAA0B,kBAAkB;GACpF;;EAGF,sBACE,QACA,UACA,QACC,UAAU,MACZ;;;AAWL,SAAgB,mBACd,QACA,WACoB;CACpB,OAAO,yBAAyB,kBAAkB,QAAQ,UAAU,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classes.js","names":[],"sources":["../../../src/components/_internal/classes.ts"],"sourcesContent":["export function classes(...values: Array<unknown>): string | undefined {\n const value = values.filter((item) => typeof item === \"string\" && item.trim()).join(\" \");\n\n return value || undefined;\n}\n"],"mappings":";AAAA,SAAgB,QAAQ,GAAG,QAA4C;CAGrE,OAFc,OAAO,QAAQ,SAAS,OAAO,SAAS,YAAY,KAAK,MAAM,CAAC,CAAC,KAAK,IAExE,IAAI,KAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx.js","names":[],"sources":["../../../src/components/_internal/jsx.ts"],"sourcesContent":["import type { JSXElement } from \"@askrjs/askr/foundations\";\n\nexport function isJsxElement(value: unknown): value is JSXElement {\n return typeof value === \"object\" && value !== null && \"$$typeof\" in value && \"props\" in value;\n}\n\nexport function hasJsxIntrinsicType(value: unknown, expectedType: string): value is JSXElement {\n return isJsxElement(value) && value.type === expectedType;\n}\n\nexport function toChildArray(children: unknown): unknown[] {\n if (Array.isArray(children)) {\n return children;\n }\n\n return children === undefined || children === null ? [] : [children];\n}\n\nexport function mapJsxTree(children: unknown, mapper: (element: JSXElement) => unknown): unknown {\n if (Array.isArray(children)) {\n return children.map((child) => mapJsxTree(child, mapper));\n }\n\n if (!isJsxElement(children)) {\n return children;\n }\n\n const mapped = mapper(children);\n\n if (!isJsxElement(mapped)) {\n return mapped;\n }\n\n const currentChildren = mapped.props?.children;\n const nextChildren = mapJsxTree(currentChildren, mapper);\n\n if (nextChildren === currentChildren) {\n return mapped;\n }\n\n return {\n ...mapped,\n props: {\n ...mapped.props,\n children: nextChildren,\n },\n };\n}\n\nexport function collectJsxElements(\n children: unknown,\n predicate?: (element: JSXElement) => boolean,\n): JSXElement[] {\n const result: JSXElement[] = [];\n\n const visit = (value: unknown) => {\n if (Array.isArray(value)) {\n value.forEach(visit);\n return;\n }\n\n if (!isJsxElement(value)) {\n return;\n }\n\n if (!predicate || predicate(value)) {\n result.push(value);\n }\n\n visit(value.props?.children);\n };\n\n visit(children);\n\n return result;\n}\n\nfunction serializeArray(value: readonly unknown[]): string {\n if (value.length === 0) {\n return \"\";\n }\n\n if (value.length === 1) {\n return serializeForId(value[0]);\n }\n\n if (value.length === 2) {\n return `${serializeForId(value[0])}|${serializeForId(value[1])}`;\n }\n\n let result = serializeForId(value[0]);\n\n for (let index = 1; index < value.length; index += 1) {\n result += `|${serializeForId(value[index])}`;\n }\n\n return result;\n}\n\nfunction serializeSerializableProps(props: Record<string, unknown>): string {\n const keys: string[] = [];\n\n for (const key of Object.keys(props)) {\n if (key === \"children\" || key === \"ref\" || key.startsWith(\"on\")) {\n continue;\n }\n\n const entryValue = props[key];\n\n if (\n typeof entryValue === \"string\" ||\n typeof entryValue === \"number\" ||\n typeof entryValue === \"boolean\"\n ) {\n keys.push(key);\n }\n }\n\n if (keys.length === 0) {\n return \"\";\n }\n\n if (keys.length === 1) {\n const key = keys[0];\n\n return `${key}:${String(props[key])}`;\n }\n\n if (keys.length === 2) {\n if (keys[1].localeCompare(keys[0]) < 0) {\n [keys[0], keys[1]] = [keys[1], keys[0]];\n }\n\n return `${keys[0]}:${String(props[keys[0]])},${keys[1]}:${String(props[keys[1]])}`;\n }\n\n keys.sort((left, right) => left.localeCompare(right));\n\n let result = `${keys[0]}:${String(props[keys[0]])}`;\n\n for (let index = 1; index < keys.length; index += 1) {\n const key = keys[index];\n result += `,${key}:${String(props[key])}`;\n }\n\n return result;\n}\n\nfunction hasEmptyJsxChildren(children: unknown): boolean {\n return (\n children === undefined ||\n children === null ||\n typeof children === \"boolean\" ||\n (Array.isArray(children) && children.length === 0)\n );\n}\n\nexport function extractTextContent(value: unknown): string {\n if (Array.isArray(value)) {\n return value.map((entry) => extractTextContent(entry)).join(\"\");\n }\n\n if (\n value === undefined ||\n value === null ||\n typeof value === \"boolean\" ||\n typeof value === \"function\"\n ) {\n return \"\";\n }\n\n if (typeof value === \"string\" || typeof value === \"number\") {\n return String(value);\n }\n\n if (isJsxElement(value)) {\n return extractTextContent(value.props?.children);\n }\n\n return \"\";\n}\n\nexport function serializeForId(value: unknown): string {\n if (Array.isArray(value)) {\n return serializeArray(value);\n }\n\n if (value === undefined || value === null || typeof value === \"boolean\") {\n return \"\";\n }\n\n if (typeof value === \"string\" || typeof value === \"number\") {\n return String(value);\n }\n\n if (isJsxElement(value)) {\n const typeName =\n typeof value.type === \"string\"\n ? value.type\n : typeof value.type === \"function\"\n ? value.type.name || \"component\"\n : \"component\";\n const props = (value.props ?? {}) as Record<string, unknown>;\n const propEntries = serializeSerializableProps(props);\n const children = props.children;\n const propsPrefix = propEntries === \"\" ? `${typeName}[]` : `${typeName}[${propEntries}]`;\n\n if (hasEmptyJsxChildren(children)) {\n return `${propsPrefix}()`;\n }\n\n return `${propsPrefix}(${serializeForId(children)})`;\n }\n\n return typeof value;\n}\n"],"mappings":";AAEA,SAAgB,aAAa,OAAqC;CAChE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,cAAc,SAAS,WAAW;;AAO1F,SAAgB,aAAa,UAA8B;CACzD,IAAI,MAAM,QAAQ,SAAS,EACzB,OAAO;CAGT,OAAO,aAAa,KAAA,KAAa,aAAa,OAAO,EAAE,GAAG,CAAC,SAAS"}
@@ -1,31 +1,9 @@
1
+ //#region src/components/_internal/layout.d.ts
1
2
  /**
2
3
  * Layout helpers shared by headless layout primitives.
3
4
  */
4
- export type LayoutBreakpoint = "initial" | "sm" | "md" | "lg" | "xl";
5
- export type ResponsiveValue<T> = T | Partial<Record<LayoutBreakpoint, T>>;
6
- /**
7
- * Returns true when `value` is a concrete CSS length/size that can be applied
8
- * directly as an inline style.
9
- */
10
- export declare function isCssLength(value: unknown): value is string;
11
- export declare function isResponsiveValue<T>(value: ResponsiveValue<T> | undefined): value is Partial<Record<LayoutBreakpoint, T>>;
12
- export declare function normalizeResponsiveValue<T>(value: ResponsiveValue<T> | undefined): Partial<Record<LayoutBreakpoint, T>> | undefined;
13
- export declare function serializeResponsiveValue<T>(value: ResponsiveValue<T> | undefined): string | undefined;
14
- export declare function serializeResponsiveValueIf<T>(value: ResponsiveValue<T> | undefined, predicate: (value: T) => boolean): string | undefined;
15
- export declare function serializeValueIf<T>(value: T | undefined, predicate: (value: T) => boolean): string | undefined;
16
- export declare function setResponsiveStyleVar<T>(styles: Record<string, string | number>, variable: string, value: ResponsiveValue<T> | undefined, resolve?: (value: T) => string | number | undefined): void;
17
- export declare function resolveSpaceValue(value: string | number): string | number;
18
- export declare function resolveContainerSizeValue(value: string): string;
19
- export declare function resolveSectionSizeValue(value: string): string;
20
- export declare function resolveGridTrackValue(value: string | number): string;
21
- export declare function resolveJustifyValue(value: string): string;
22
- export declare function resolveAlignValue(value: string): string;
23
- export declare function resolveInlineAlignValue(value: "left" | "center" | "right"): {
24
- marginLeft?: string;
25
- marginRight?: string;
26
- };
27
- /**
28
- * Merges a record of computed layout styles with a user-supplied `style` prop.
29
- * The user's styles take precedence for conflicting keys.
30
- */
31
- export declare function mergeLayoutStyles(layout: Record<string, string | number>, user: unknown): string | undefined;
5
+ type LayoutBreakpoint = "initial" | "sm" | "md" | "lg" | "xl";
6
+ type ResponsiveValue<T> = T | Partial<Record<LayoutBreakpoint, T>>;
7
+ //#endregion
8
+ export { ResponsiveValue };
9
+ //# sourceMappingURL=layout.d.ts.map
@@ -37,8 +37,8 @@ const CONTAINER_SIZE_MAP = {
37
37
  xl: "var(--ak-container-4)"
38
38
  };
39
39
  /**
40
- * Returns true when `value` is a concrete CSS length/size that can be applied
41
- * directly as an inline style.
40
+ * Returns true when `value` is a concrete CSS length/size that can be serialized
41
+ * into a CSS declaration without token translation.
42
42
  */
43
43
  function isCssLength(value) {
44
44
  if (typeof value !== "string") return false;
@@ -76,10 +76,6 @@ function serializeResponsiveValueIf(value, predicate) {
76
76
  }
77
77
  return serializeResponsiveValue(value);
78
78
  }
79
- function serializeValueIf(value, predicate) {
80
- if (value === void 0 || !predicate(value)) return void 0;
81
- return String(value);
82
- }
83
79
  function setResponsiveStyleVar(styles, variable, value, resolve = (input) => input) {
84
80
  const normalized = normalizeResponsiveValue(value);
85
81
  if (!normalized) return;
@@ -100,12 +96,6 @@ function resolveContainerSizeValue(value) {
100
96
  const trimmed = value.trim();
101
97
  return CONTAINER_SIZE_MAP[trimmed] ?? trimmed;
102
98
  }
103
- function resolveGridTrackValue(value) {
104
- if (typeof value === "number") return `repeat(${value}, minmax(0, 1fr))`;
105
- const trimmed = value.trim();
106
- if (/^\d+$/.test(trimmed)) return `repeat(${trimmed}, minmax(0, 1fr))`;
107
- return trimmed;
108
- }
109
99
  function resolveJustifyValue(value) {
110
100
  const trimmed = value.trim();
111
101
  if (trimmed === "between") return "space-between";
@@ -134,8 +124,8 @@ function resolveInlineAlignValue(value) {
134
124
  };
135
125
  }
136
126
  /**
137
- * Merges a record of computed layout styles with a user-supplied `style` prop.
138
- * The user's styles take precedence for conflicting keys.
127
+ * Merges a record of computed layout declarations with a user-supplied style
128
+ * value. The user's declarations take precedence for conflicting keys.
139
129
  */
140
130
  function mergeLayoutStyles(layout, user) {
141
131
  const merged = { ...layout };
@@ -151,6 +141,6 @@ function objectToCssString(styles) {
151
141
  return Object.entries(styles).filter(([, value]) => value !== void 0 && value !== null).map(([key, value]) => `${camelToKebab(key)}:${String(value)}`).join(";");
152
142
  }
153
143
  //#endregion
154
- export { isCssLength, isResponsiveValue, mergeLayoutStyles, resolveAlignValue, resolveContainerSizeValue, resolveGridTrackValue, resolveInlineAlignValue, resolveJustifyValue, resolveSpaceValue, serializeResponsiveValueIf, serializeValueIf, setResponsiveStyleVar };
144
+ export { isCssLength, isResponsiveValue, mergeLayoutStyles, resolveAlignValue, resolveContainerSizeValue, resolveInlineAlignValue, resolveJustifyValue, resolveSpaceValue, serializeResponsiveValueIf, setResponsiveStyleVar };
155
145
 
156
146
  //# sourceMappingURL=layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.js","names":[],"sources":["../../../src/components/_internal/layout.ts"],"sourcesContent":["/**\n * Layout helpers shared by headless layout primitives.\n */\n\nexport type LayoutBreakpoint = \"initial\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type ResponsiveValue<T> = T | Partial<Record<LayoutBreakpoint, T>>;\n\nconst BREAKPOINTS: readonly LayoutBreakpoint[] = [\"initial\", \"sm\", \"md\", \"lg\", \"xl\"];\n\n/** Units and patterns that identify a concrete CSS length value. */\nconst CSS_UNIT_RE =\n /^-?[\\d.]+(%|px|em|rem|ex|ch|ic|lh|rlh|vw|vh|vmin|vmax|svw|svh|dvw|dvh|cqw|cqh|cqi|cqb|fr|cm|mm|in|pt|pc|Q)$/;\n\nconst SPACE_TOKEN_MAP: Record<string, string> = {\n \"1\": \"var(--ak-space-1)\",\n \"2\": \"var(--ak-space-2)\",\n \"3\": \"var(--ak-space-3)\",\n \"4\": \"var(--ak-space-4)\",\n \"5\": \"var(--ak-space-5)\",\n \"6\": \"var(--ak-space-6)\",\n \"7\": \"var(--ak-space-7)\",\n \"8\": \"var(--ak-space-8)\",\n \"9\": \"var(--ak-space-9)\",\n xs: \"var(--ak-space-xs)\",\n sm: \"var(--ak-space-sm)\",\n md: \"var(--ak-space-md)\",\n lg: \"var(--ak-space-lg)\",\n xl: \"var(--ak-space-xl)\",\n \"2xl\": \"var(--ak-space-2xl)\",\n \"3xl\": \"var(--ak-space-3xl)\",\n};\n\nconst CONTAINER_SIZE_MAP: Record<string, string> = {\n \"1\": \"var(--ak-container-1)\",\n \"2\": \"var(--ak-container-2)\",\n \"3\": \"var(--ak-container-3)\",\n \"4\": \"var(--ak-container-4)\",\n sm: \"var(--ak-container-1)\",\n md: \"var(--ak-container-2)\",\n lg: \"var(--ak-container-3)\",\n xl: \"var(--ak-container-4)\",\n};\n\nconst SECTION_SIZE_MAP: Record<string, string> = {\n \"1\": \"var(--ak-section-1)\",\n \"2\": \"var(--ak-section-2)\",\n \"3\": \"var(--ak-section-3)\",\n \"4\": \"var(--ak-section-4)\",\n};\n\n/**\n * Returns true when `value` is a concrete CSS length/size that can be serialized\n * into a CSS declaration without token translation.\n */\nexport function isCssLength(value: unknown): value is string {\n if (typeof value !== \"string\") return false;\n const v = value.trim();\n if (v === \"0\") return true;\n if (CSS_UNIT_RE.test(v)) return true;\n // CSS functions: calc(), min(), max(), clamp(), fit-content(), env(), var()\n if (/^[a-z][a-z-]*\\(/.test(v)) return true;\n return false;\n}\n\nexport function isResponsiveValue<T>(\n value: ResponsiveValue<T> | undefined,\n): value is Partial<Record<LayoutBreakpoint, T>> {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return false;\n return BREAKPOINTS.some((breakpoint) => breakpoint in value);\n}\n\nexport function normalizeResponsiveValue<T>(\n value: ResponsiveValue<T> | undefined,\n): Partial<Record<LayoutBreakpoint, T>> | undefined {\n if (value === undefined) return undefined;\n if (isResponsiveValue(value)) return value;\n return { initial: value };\n}\n\nexport function serializeResponsiveValue<T>(\n value: ResponsiveValue<T> | undefined,\n): string | undefined {\n const normalized = normalizeResponsiveValue(value);\n if (!normalized) return undefined;\n\n return BREAKPOINTS.map((breakpoint) => {\n const breakpointValue = normalized[breakpoint];\n if (breakpointValue === undefined) return \"\";\n return `${breakpoint}:${String(breakpointValue)}`;\n })\n .filter(Boolean)\n .join(\"|\");\n}\n\nexport function serializeResponsiveValueIf<T>(\n value: ResponsiveValue<T> | undefined,\n predicate: (value: T) => boolean,\n): string | undefined {\n const normalized = normalizeResponsiveValue(value);\n if (!normalized) return undefined;\n\n for (const breakpoint of BREAKPOINTS) {\n const breakpointValue = normalized[breakpoint];\n if (breakpointValue === undefined) continue;\n if (!predicate(breakpointValue)) return undefined;\n }\n\n return serializeResponsiveValue(value);\n}\n\nexport function serializeValueIf<T>(\n value: T | undefined,\n predicate: (value: T) => boolean,\n): string | undefined {\n if (value === undefined || !predicate(value)) return undefined;\n return String(value);\n}\n\nexport function setResponsiveStyleVar<T>(\n styles: Record<string, string | number>,\n variable: string,\n value: ResponsiveValue<T> | undefined,\n resolve: (value: T) => string | number | undefined = (input) =>\n input as string | number | undefined,\n) {\n const normalized = normalizeResponsiveValue(value);\n if (!normalized) return;\n\n for (const breakpoint of BREAKPOINTS) {\n const breakpointValue = normalized[breakpoint];\n if (breakpointValue === undefined) continue;\n const resolved = resolve(breakpointValue);\n if (resolved === undefined || resolved === null || resolved === \"\") continue;\n styles[`--ak-${variable}-${breakpoint}`] = resolved;\n }\n}\n\nexport function resolveSpaceValue(value: string | number): string | number {\n if (typeof value === \"number\") return String(value);\n const trimmed = value.trim();\n return SPACE_TOKEN_MAP[trimmed] ?? trimmed;\n}\n\nexport function resolveContainerSizeValue(value: string): string {\n const trimmed = value.trim();\n return CONTAINER_SIZE_MAP[trimmed] ?? trimmed;\n}\n\nexport function resolveSectionSizeValue(value: string): string {\n const trimmed = value.trim();\n return SECTION_SIZE_MAP[trimmed] ?? trimmed;\n}\n\nexport function resolveJustifyValue(value: string): string {\n const trimmed = value.trim();\n if (trimmed === \"between\") return \"space-between\";\n if (trimmed === \"start\") return \"flex-start\";\n if (trimmed === \"end\") return \"flex-end\";\n return trimmed;\n}\n\nexport function resolveAlignValue(value: string): string {\n const trimmed = value.trim();\n if (trimmed === \"start\") return \"flex-start\";\n if (trimmed === \"end\") return \"flex-end\";\n return trimmed;\n}\n\nexport function resolveInlineAlignValue(value: \"left\" | \"center\" | \"right\"): {\n marginLeft?: string;\n marginRight?: string;\n} {\n if (value === \"left\") return { marginLeft: \"0\", marginRight: \"auto\" };\n if (value === \"right\") return { marginLeft: \"auto\", marginRight: \"0\" };\n return { marginLeft: \"auto\", marginRight: \"auto\" };\n}\n\n/**\n * Merges a record of computed layout declarations with a user-supplied style\n * value. The user's declarations take precedence for conflicting keys.\n */\nexport function mergeLayoutStyles(\n layout: Record<string, string | number>,\n user: unknown,\n): string | undefined {\n const merged: Record<string, unknown> = { ...layout };\n\n if (user !== null && user !== undefined && typeof user === \"object\") {\n Object.assign(merged, user as Record<string, unknown>);\n }\n\n const mergedString = objectToCssString(merged);\n\n if (typeof user === \"string\" && user.trim()) {\n return mergedString ? `${mergedString};${user.trim()}` : user.trim();\n }\n\n return mergedString || undefined;\n}\n\nfunction camelToKebab(s: string): string {\n return s.replace(/([A-Z])/g, (c) => `-${c.toLowerCase()}`);\n}\n\nfunction objectToCssString(styles: Record<string, unknown>): string {\n return Object.entries(styles)\n .filter(([, value]) => value !== undefined && value !== null)\n .map(([key, value]) => `${camelToKebab(key)}:${String(value)}`)\n .join(\";\");\n}\n"],"mappings":";AAOA,MAAM,cAA2C;CAAC;CAAW;CAAM;CAAM;CAAM;CAAK;;AAGpF,MAAM,cACJ;AAEF,MAAM,kBAA0C;CAC9C,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACR;AAED,MAAM,qBAA6C;CACjD,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACL;;;;;AAaD,SAAgB,YAAY,OAAiC;CAC3D,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,MAAM,IAAI,MAAM,MAAM;CACtB,IAAI,MAAM,KAAK,OAAO;CACtB,IAAI,YAAY,KAAK,EAAE,EAAE,OAAO;CAEhC,IAAI,kBAAkB,KAAK,EAAE,EAAE,OAAO;CACtC,OAAO;;AAGT,SAAgB,kBACd,OAC+C;CAC/C,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,MAAM,EAAE,OAAO;CACxE,OAAO,YAAY,MAAM,eAAe,cAAc,MAAM;;AAG9D,SAAgB,yBACd,OACkD;CAClD,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;CAChC,IAAI,kBAAkB,MAAM,EAAE,OAAO;CACrC,OAAO,EAAE,SAAS,OAAO;;AAG3B,SAAgB,yBACd,OACoB;CACpB,MAAM,aAAa,yBAAyB,MAAM;CAClD,IAAI,CAAC,YAAY,OAAO,KAAA;CAExB,OAAO,YAAY,KAAK,eAAe;EACrC,MAAM,kBAAkB,WAAW;EACnC,IAAI,oBAAoB,KAAA,GAAW,OAAO;EAC1C,OAAO,GAAG,WAAW,GAAG,OAAO,gBAAgB;GAC/C,CACC,OAAO,QAAQ,CACf,KAAK,IAAI;;AAGd,SAAgB,2BACd,OACA,WACoB;CACpB,MAAM,aAAa,yBAAyB,MAAM;CAClD,IAAI,CAAC,YAAY,OAAO,KAAA;CAExB,KAAK,MAAM,cAAc,aAAa;EACpC,MAAM,kBAAkB,WAAW;EACnC,IAAI,oBAAoB,KAAA,GAAW;EACnC,IAAI,CAAC,UAAU,gBAAgB,EAAE,OAAO,KAAA;;CAG1C,OAAO,yBAAyB,MAAM;;AAWxC,SAAgB,sBACd,QACA,UACA,OACA,WAAsD,UACpD,OACF;CACA,MAAM,aAAa,yBAAyB,MAAM;CAClD,IAAI,CAAC,YAAY;CAEjB,KAAK,MAAM,cAAc,aAAa;EACpC,MAAM,kBAAkB,WAAW;EACnC,IAAI,oBAAoB,KAAA,GAAW;EACnC,MAAM,WAAW,QAAQ,gBAAgB;EACzC,IAAI,aAAa,KAAA,KAAa,aAAa,QAAQ,aAAa,IAAI;EACpE,OAAO,QAAQ,SAAS,GAAG,gBAAgB;;;AAI/C,SAAgB,kBAAkB,OAAyC;CACzE,IAAI,OAAO,UAAU,UAAU,OAAO,OAAO,MAAM;CACnD,MAAM,UAAU,MAAM,MAAM;CAC5B,OAAO,gBAAgB,YAAY;;AAGrC,SAAgB,0BAA0B,OAAuB;CAC/D,MAAM,UAAU,MAAM,MAAM;CAC5B,OAAO,mBAAmB,YAAY;;AAQxC,SAAgB,oBAAoB,OAAuB;CACzD,MAAM,UAAU,MAAM,MAAM;CAC5B,IAAI,YAAY,WAAW,OAAO;CAClC,IAAI,YAAY,SAAS,OAAO;CAChC,IAAI,YAAY,OAAO,OAAO;CAC9B,OAAO;;AAGT,SAAgB,kBAAkB,OAAuB;CACvD,MAAM,UAAU,MAAM,MAAM;CAC5B,IAAI,YAAY,SAAS,OAAO;CAChC,IAAI,YAAY,OAAO,OAAO;CAC9B,OAAO;;AAGT,SAAgB,wBAAwB,OAGtC;CACA,IAAI,UAAU,QAAQ,OAAO;EAAE,YAAY;EAAK,aAAa;EAAQ;CACrE,IAAI,UAAU,SAAS,OAAO;EAAE,YAAY;EAAQ,aAAa;EAAK;CACtE,OAAO;EAAE,YAAY;EAAQ,aAAa;EAAQ;;;;;;AAOpD,SAAgB,kBACd,QACA,MACoB;CACpB,MAAM,SAAkC,EAAE,GAAG,QAAQ;CAErD,IAAI,SAAS,QAAQ,SAAS,KAAA,KAAa,OAAO,SAAS,UACzD,OAAO,OAAO,QAAQ,KAAgC;CAGxD,MAAM,eAAe,kBAAkB,OAAO;CAE9C,IAAI,OAAO,SAAS,YAAY,KAAK,MAAM,EACzC,OAAO,eAAe,GAAG,aAAa,GAAG,KAAK,MAAM,KAAK,KAAK,MAAM;CAGtE,OAAO,gBAAgB,KAAA;;AAGzB,SAAS,aAAa,GAAmB;CACvC,OAAO,EAAE,QAAQ,aAAa,MAAM,IAAI,EAAE,aAAa,GAAG;;AAG5D,SAAS,kBAAkB,QAAyC;CAClE,OAAO,OAAO,QAAQ,OAAO,CAC1B,QAAQ,GAAG,WAAW,UAAU,KAAA,KAAa,UAAU,KAAK,CAC5D,KAAK,CAAC,KAAK,WAAW,GAAG,aAAa,IAAI,CAAC,GAAG,OAAO,MAAM,GAAG,CAC9D,KAAK,IAAI"}
@@ -1,3 +1,4 @@
1
+ import { classes } from "./classes.js";
1
2
  //#region src/components/_internal/merge-props.ts
2
3
  function isEventHandlerKey(key) {
3
4
  return key.startsWith("on");
@@ -40,6 +41,10 @@ function mergeProps(base, injected) {
40
41
  out[key] = composeHandlers(injectedValue, baseValue);
41
42
  continue;
42
43
  }
44
+ if (key === "class") {
45
+ out[key] = classes(injectedValue, baseValue);
46
+ continue;
47
+ }
43
48
  out[key] = baseValue;
44
49
  }
45
50
  return out;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge-props.js","names":[],"sources":["../../../src/components/_internal/merge-props.ts"],"sourcesContent":["import { classes } from \"./classes\";\n\ntype Handler = (...args: readonly unknown[]) => void;\ntype Ref<T> = { current: T | null } | ((value: T | null) => void) | null | undefined;\n\nfunction isEventHandlerKey(key: string): boolean {\n return key.startsWith(\"on\");\n}\n\nfunction isDefaultPrevented(value: unknown): value is { defaultPrevented: true } {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"defaultPrevented\" in value &&\n (value as { defaultPrevented?: boolean }).defaultPrevented === true\n );\n}\n\nfunction composeHandlers(first: Handler, second: Handler): Handler {\n return (...args) => {\n // Internal composition runs first so wrappers can normalize state or stop\n // follow-on handlers when the event has already been consumed.\n first(...args);\n\n if (isDefaultPrevented(args[0])) {\n return;\n }\n\n second(...args);\n };\n}\n\nfunction setRef<T>(ref: Ref<T>, value: T | null): void {\n if (!ref) return;\n\n if (typeof ref === \"function\") {\n ref(value);\n return;\n }\n\n if (Object.isExtensible(ref)) {\n (ref as { current: T | null }).current = value;\n }\n}\n\nfunction composeRefs<T>(...refs: Array<Ref<T>>): (value: T | null) => void {\n return (value: T | null) => {\n for (const ref of refs) {\n setRef(ref, value);\n }\n };\n}\n\nexport function mergeProps<TBase extends object, TInjected extends object>(\n base: TBase,\n injected: TInjected,\n): TInjected & TBase {\n const baseKeys = Object.keys(base);\n if (baseKeys.length === 0) {\n return injected as TInjected & TBase;\n }\n\n const out = { ...(injected as object) } as TInjected & TBase;\n\n for (const key of baseKeys as Array<Extract<keyof TBase, string>>) {\n const baseValue = (base as Record<string, unknown>)[key];\n const injectedValue = (injected as Record<string, unknown>)[key];\n\n if (key === \"ref\") {\n (out as Record<string, unknown>)[key] = composeRefs(\n injectedValue as Ref<unknown>,\n baseValue as Ref<unknown>,\n );\n continue;\n }\n\n if (\n isEventHandlerKey(key) &&\n typeof baseValue === \"function\" &&\n typeof injectedValue === \"function\"\n ) {\n (out as Record<string, unknown>)[key] = composeHandlers(\n injectedValue as Handler,\n baseValue as Handler,\n );\n continue;\n }\n\n if (key === \"class\") {\n (out as Record<string, unknown>)[key] = classes(injectedValue, baseValue);\n continue;\n }\n\n (out as Record<string, unknown>)[key] = baseValue;\n }\n\n return out;\n}\n"],"mappings":";;AAKA,SAAS,kBAAkB,KAAsB;CAC/C,OAAO,IAAI,WAAW,KAAK;;AAG7B,SAAS,mBAAmB,OAAqD;CAC/E,OACE,OAAO,UAAU,YACjB,UAAU,QACV,sBAAsB,SACrB,MAAyC,qBAAqB;;AAInE,SAAS,gBAAgB,OAAgB,QAA0B;CACjE,QAAQ,GAAG,SAAS;EAGlB,MAAM,GAAG,KAAK;EAEd,IAAI,mBAAmB,KAAK,GAAG,EAC7B;EAGF,OAAO,GAAG,KAAK;;;AAInB,SAAS,OAAU,KAAa,OAAuB;CACrD,IAAI,CAAC,KAAK;CAEV,IAAI,OAAO,QAAQ,YAAY;EAC7B,IAAI,MAAM;EACV;;CAGF,IAAI,OAAO,aAAa,IAAI,EAC1B,IAA+B,UAAU;;AAI7C,SAAS,YAAe,GAAG,MAAgD;CACzE,QAAQ,UAAoB;EAC1B,KAAK,MAAM,OAAO,MAChB,OAAO,KAAK,MAAM;;;AAKxB,SAAgB,WACd,MACA,UACmB;CACnB,MAAM,WAAW,OAAO,KAAK,KAAK;CAClC,IAAI,SAAS,WAAW,GACtB,OAAO;CAGT,MAAM,MAAM,EAAE,GAAI,UAAqB;CAEvC,KAAK,MAAM,OAAO,UAAiD;EACjE,MAAM,YAAa,KAAiC;EACpD,MAAM,gBAAiB,SAAqC;EAE5D,IAAI,QAAQ,OAAO;GACjB,IAAiC,OAAO,YACtC,eACA,UACD;GACD;;EAGF,IACE,kBAAkB,IAAI,IACtB,OAAO,cAAc,cACrB,OAAO,kBAAkB,YACzB;GACA,IAAiC,OAAO,gBACtC,eACA,UACD;GACD;;EAGF,IAAI,QAAQ,SAAS;GACnB,IAAiC,OAAO,QAAQ,eAAe,UAAU;GACzE;;EAGF,IAAiC,OAAO;;CAG1C,OAAO"}
@@ -0,0 +1,39 @@
1
+ //#region src/components/_internal/pathname.ts
2
+ function normalizePathname(pathname) {
3
+ return pathname.endsWith("/") && pathname !== "/" ? pathname.slice(0, -1) : pathname;
4
+ }
5
+ function getWindowLocation() {
6
+ return typeof window === "undefined" ? null : window.location;
7
+ }
8
+ function resolvePathname(href) {
9
+ if (href.startsWith("#")) return null;
10
+ const location = getWindowLocation();
11
+ if (href.startsWith("/") && !href.startsWith("//")) {
12
+ const queryIndex = href.indexOf("?");
13
+ const hashIndex = href.indexOf("#");
14
+ let pathEnd = href.length;
15
+ if (queryIndex !== -1) pathEnd = Math.min(pathEnd, queryIndex);
16
+ if (hashIndex !== -1) pathEnd = Math.min(pathEnd, hashIndex);
17
+ const pathname = normalizePathname(href.slice(0, pathEnd));
18
+ if (location && hashIndex !== -1) {
19
+ const searchEnd = hashIndex === -1 ? href.length : hashIndex;
20
+ const search = queryIndex === -1 ? "" : href.slice(queryIndex, searchEnd);
21
+ if (pathname === normalizePathname(location.pathname || "/") && search === location.search) return null;
22
+ }
23
+ return pathname;
24
+ }
25
+ const baseHref = location?.href ?? "http://localhost/";
26
+ const baseOrigin = location?.origin ?? "http://localhost";
27
+ try {
28
+ const target = new URL(href, baseHref);
29
+ if (target.origin !== baseOrigin) return null;
30
+ if (location && target.hash && normalizePathname(target.pathname) === normalizePathname(location.pathname || "/") && target.search === location.search) return null;
31
+ return normalizePathname(target.pathname);
32
+ } catch {
33
+ return null;
34
+ }
35
+ }
36
+ //#endregion
37
+ export { resolvePathname };
38
+
39
+ //# sourceMappingURL=pathname.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathname.js","names":[],"sources":["../../../src/components/_internal/pathname.ts"],"sourcesContent":["function normalizePathname(pathname: string): string {\n return pathname.endsWith(\"/\") && pathname !== \"/\" ? pathname.slice(0, -1) : pathname;\n}\n\nfunction getWindowLocation(): Location | null {\n return typeof window === \"undefined\" ? null : window.location;\n}\n\nexport function resolvePathname(href: string): string | null {\n if (href.startsWith(\"#\")) {\n return null;\n }\n\n const location = getWindowLocation();\n\n if (href.startsWith(\"/\") && !href.startsWith(\"//\")) {\n const queryIndex = href.indexOf(\"?\");\n const hashIndex = href.indexOf(\"#\");\n let pathEnd = href.length;\n\n if (queryIndex !== -1) {\n pathEnd = Math.min(pathEnd, queryIndex);\n }\n\n if (hashIndex !== -1) {\n pathEnd = Math.min(pathEnd, hashIndex);\n }\n\n const pathname = normalizePathname(href.slice(0, pathEnd));\n\n if (location && hashIndex !== -1) {\n const searchEnd = hashIndex === -1 ? href.length : hashIndex;\n const search = queryIndex === -1 ? \"\" : href.slice(queryIndex, searchEnd);\n const locationPathname = normalizePathname(location.pathname || \"/\");\n\n if (pathname === locationPathname && search === location.search) {\n return null;\n }\n }\n\n return pathname;\n }\n\n const baseHref = location?.href ?? \"http://localhost/\";\n const baseOrigin = location?.origin ?? \"http://localhost\";\n\n try {\n const target = new URL(href, baseHref);\n\n if (target.origin !== baseOrigin) {\n return null;\n }\n\n if (\n location &&\n target.hash &&\n normalizePathname(target.pathname) === normalizePathname(location.pathname || \"/\") &&\n target.search === location.search\n ) {\n return null;\n }\n\n return normalizePathname(target.pathname);\n } catch {\n return null;\n }\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,UAA0B;CACnD,OAAO,SAAS,SAAS,IAAI,IAAI,aAAa,MAAM,SAAS,MAAM,GAAG,GAAG,GAAG;;AAG9E,SAAS,oBAAqC;CAC5C,OAAO,OAAO,WAAW,cAAc,OAAO,OAAO;;AAGvD,SAAgB,gBAAgB,MAA6B;CAC3D,IAAI,KAAK,WAAW,IAAI,EACtB,OAAO;CAGT,MAAM,WAAW,mBAAmB;CAEpC,IAAI,KAAK,WAAW,IAAI,IAAI,CAAC,KAAK,WAAW,KAAK,EAAE;EAClD,MAAM,aAAa,KAAK,QAAQ,IAAI;EACpC,MAAM,YAAY,KAAK,QAAQ,IAAI;EACnC,IAAI,UAAU,KAAK;EAEnB,IAAI,eAAe,IACjB,UAAU,KAAK,IAAI,SAAS,WAAW;EAGzC,IAAI,cAAc,IAChB,UAAU,KAAK,IAAI,SAAS,UAAU;EAGxC,MAAM,WAAW,kBAAkB,KAAK,MAAM,GAAG,QAAQ,CAAC;EAE1D,IAAI,YAAY,cAAc,IAAI;GAChC,MAAM,YAAY,cAAc,KAAK,KAAK,SAAS;GACnD,MAAM,SAAS,eAAe,KAAK,KAAK,KAAK,MAAM,YAAY,UAAU;GAGzE,IAAI,aAFqB,kBAAkB,SAAS,YAAY,IAE/B,IAAI,WAAW,SAAS,QACvD,OAAO;;EAIX,OAAO;;CAGT,MAAM,WAAW,UAAU,QAAQ;CACnC,MAAM,aAAa,UAAU,UAAU;CAEvC,IAAI;EACF,MAAM,SAAS,IAAI,IAAI,MAAM,SAAS;EAEtC,IAAI,OAAO,WAAW,YACpB,OAAO;EAGT,IACE,YACA,OAAO,QACP,kBAAkB,OAAO,SAAS,KAAK,kBAAkB,SAAS,YAAY,IAAI,IAClF,OAAO,WAAW,SAAS,QAE3B,OAAO;EAGT,OAAO,kBAAkB,OAAO,SAAS;SACnC;EACN,OAAO"}
@@ -0,0 +1,41 @@
1
+ //#region src/components/_internal/style.ts
2
+ const STYLE_REGISTRY_ATTR = "data-askr-style-registry";
3
+ const STYLE_CLASS_PREFIX = "ak-style-";
4
+ const styleClassCache = /* @__PURE__ */ new Map();
5
+ const registeredDeclarations = /* @__PURE__ */ new Set();
6
+ let nextStyleClassId = 0;
7
+ function ensureStyleElement() {
8
+ if (typeof document === "undefined") return null;
9
+ const existing = document.querySelector(`style[${STYLE_REGISTRY_ATTR}]`);
10
+ if (existing instanceof HTMLStyleElement) return existing;
11
+ const styleElement = document.createElement("style");
12
+ styleElement.setAttribute(STYLE_REGISTRY_ATTR, "true");
13
+ (document.head ?? document.documentElement).append(styleElement);
14
+ return styleElement;
15
+ }
16
+ function normalizeDeclarations(declarations) {
17
+ return declarations.trim().replace(/;+\s*$/, "");
18
+ }
19
+ function styleDeclarationsToClass(declarations) {
20
+ if (typeof declarations !== "string") return void 0;
21
+ const normalized = normalizeDeclarations(declarations);
22
+ if (!normalized) return void 0;
23
+ let className = styleClassCache.get(normalized);
24
+ if (className === void 0) {
25
+ className = `${STYLE_CLASS_PREFIX}${++nextStyleClassId}`;
26
+ styleClassCache.set(normalized, className);
27
+ }
28
+ if (!registeredDeclarations.has(normalized)) {
29
+ const styleElement = ensureStyleElement();
30
+ if (styleElement) {
31
+ const rule = `.${className}{${normalized}}`;
32
+ styleElement.textContent = `${styleElement.textContent ?? ""}\n${rule}`;
33
+ registeredDeclarations.add(normalized);
34
+ }
35
+ }
36
+ return className;
37
+ }
38
+ //#endregion
39
+ export { styleDeclarationsToClass };
40
+
41
+ //# sourceMappingURL=style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/_internal/style.ts"],"sourcesContent":["export function mergeCssVar(style: unknown, name: string, value: string): string {\n const decl = `${name}:${value}`;\n\n if (typeof style === \"string\") {\n const trimmed = style.trim();\n return trimmed ? `${trimmed};${decl}` : decl;\n }\n\n if (style && typeof style === \"object\") {\n const entries = Object.entries(style as Record<string, unknown>)\n .filter(([, v]) => v !== undefined && v !== null)\n .map(([k, v]) => `${k.replace(/([A-Z])/g, (c) => `-${c.toLowerCase()}`)}:${String(v)}`)\n .join(\";\");\n return entries ? `${entries};${decl}` : decl;\n }\n\n return decl;\n}\n\nconst STYLE_REGISTRY_ATTR = \"data-askr-style-registry\";\nconst STYLE_CLASS_PREFIX = \"ak-style-\";\n\nconst styleClassCache = new Map<string, string>();\nconst registeredDeclarations = new Set<string>();\n\nlet nextStyleClassId = 0;\n\nfunction ensureStyleElement(): HTMLStyleElement | null {\n if (typeof document === \"undefined\") return null;\n\n const existing = document.querySelector(`style[${STYLE_REGISTRY_ATTR}]`);\n if (existing instanceof HTMLStyleElement) {\n return existing;\n }\n\n const styleElement = document.createElement(\"style\");\n styleElement.setAttribute(STYLE_REGISTRY_ATTR, \"true\");\n (document.head ?? document.documentElement).append(styleElement);\n\n return styleElement;\n}\n\nfunction normalizeDeclarations(declarations: string): string {\n return declarations.trim().replace(/;+\\s*$/, \"\");\n}\n\nexport function styleDeclarationsToClass(declarations: string | undefined): string | undefined {\n if (typeof declarations !== \"string\") return undefined;\n\n const normalized = normalizeDeclarations(declarations);\n if (!normalized) return undefined;\n\n let className = styleClassCache.get(normalized);\n if (className === undefined) {\n className = `${STYLE_CLASS_PREFIX}${++nextStyleClassId}`;\n styleClassCache.set(normalized, className);\n }\n\n if (!registeredDeclarations.has(normalized)) {\n const styleElement = ensureStyleElement();\n if (styleElement) {\n const rule = `.${className}{${normalized}}`;\n styleElement.textContent = `${styleElement.textContent ?? \"\"}\\n${rule}`;\n registeredDeclarations.add(normalized);\n }\n }\n\n return className;\n}\n"],"mappings":";AAmBA,MAAM,sBAAsB;AAC5B,MAAM,qBAAqB;AAE3B,MAAM,kCAAkB,IAAI,KAAqB;AACjD,MAAM,yCAAyB,IAAI,KAAa;AAEhD,IAAI,mBAAmB;AAEvB,SAAS,qBAA8C;CACrD,IAAI,OAAO,aAAa,aAAa,OAAO;CAE5C,MAAM,WAAW,SAAS,cAAc,SAAS,oBAAoB,GAAG;CACxE,IAAI,oBAAoB,kBACtB,OAAO;CAGT,MAAM,eAAe,SAAS,cAAc,QAAQ;CACpD,aAAa,aAAa,qBAAqB,OAAO;CACtD,CAAC,SAAS,QAAQ,SAAS,iBAAiB,OAAO,aAAa;CAEhE,OAAO;;AAGT,SAAS,sBAAsB,cAA8B;CAC3D,OAAO,aAAa,MAAM,CAAC,QAAQ,UAAU,GAAG;;AAGlD,SAAgB,yBAAyB,cAAsD;CAC7F,IAAI,OAAO,iBAAiB,UAAU,OAAO,KAAA;CAE7C,MAAM,aAAa,sBAAsB,aAAa;CACtD,IAAI,CAAC,YAAY,OAAO,KAAA;CAExB,IAAI,YAAY,gBAAgB,IAAI,WAAW;CAC/C,IAAI,cAAc,KAAA,GAAW;EAC3B,YAAY,GAAG,qBAAqB,EAAE;EACtC,gBAAgB,IAAI,YAAY,UAAU;;CAG5C,IAAI,CAAC,uBAAuB,IAAI,WAAW,EAAE;EAC3C,MAAM,eAAe,oBAAoB;EACzC,IAAI,cAAc;GAChB,MAAM,OAAO,IAAI,UAAU,GAAG,WAAW;GACzC,aAAa,cAAc,GAAG,aAAa,eAAe,GAAG,IAAI;GACjE,uBAAuB,IAAI,WAAW;;;CAI1C,OAAO"}
@@ -0,0 +1,7 @@
1
+ import { AlertProps } from "./alert.types.js";
2
+
3
+ //#region src/components/alert/alert.d.ts
4
+ declare function Alert(props: AlertProps): JSX.Element;
5
+ //#endregion
6
+ export { Alert };
7
+ //# sourceMappingURL=alert.d.ts.map
@@ -0,0 +1,65 @@
1
+ import { classes } from "../_internal/classes.js";
2
+ import { Close } from "../close/close.js";
3
+ import { jsx, jsxs } from "@askrjs/askr/jsx-runtime";
4
+ //#region src/components/alert/alert.tsx
5
+ function resolveAlertRole(variant) {
6
+ if (variant === "danger" || variant === "warning") return "alert";
7
+ return "status";
8
+ }
9
+ function Alert(props) {
10
+ const { actions, children, class: className, description, dismissLabel = "Dismiss alert", dismissible = false, icon, onDismiss, ref, title, titleAs: TitleTag = "h3", variant = "default", role, ...rest } = props;
11
+ const shouldRenderDismiss = dismissible && onDismiss !== void 0;
12
+ const resolvedRole = role ?? resolveAlertRole(variant);
13
+ const hasVariant = variant !== "default";
14
+ return /* @__PURE__ */ jsxs("div", {
15
+ ...rest,
16
+ ref,
17
+ class: classes("alert", hasVariant ? `alert-${variant}` : void 0, shouldRenderDismiss ? "alert-dismissible" : void 0, className),
18
+ "data-dismissible": shouldRenderDismiss ? "true" : void 0,
19
+ "data-slot": "alert",
20
+ "data-variant": hasVariant ? variant : void 0,
21
+ role: resolvedRole,
22
+ children: [
23
+ icon !== void 0 ? /* @__PURE__ */ jsx("div", {
24
+ "aria-hidden": "true",
25
+ class: "alert-icon",
26
+ "data-slot": "alert-icon",
27
+ children: icon
28
+ }) : null,
29
+ /* @__PURE__ */ jsxs("div", {
30
+ class: "alert-content",
31
+ "data-slot": "alert-content",
32
+ children: [
33
+ title !== void 0 ? /* @__PURE__ */ jsx(TitleTag, {
34
+ class: "alert-title",
35
+ "data-slot": "alert-title",
36
+ children: title
37
+ }) : null,
38
+ description !== void 0 ? /* @__PURE__ */ jsx("p", {
39
+ class: "alert-description",
40
+ "data-slot": "alert-description",
41
+ children: description
42
+ }) : null,
43
+ children,
44
+ actions !== void 0 ? /* @__PURE__ */ jsx("div", {
45
+ class: "alert-actions",
46
+ "data-slot": "alert-actions",
47
+ children: actions
48
+ }) : null
49
+ ]
50
+ }),
51
+ shouldRenderDismiss ? /* @__PURE__ */ jsx("div", {
52
+ class: "alert-close",
53
+ "data-slot": "alert-close",
54
+ children: /* @__PURE__ */ jsx(Close, {
55
+ label: dismissLabel,
56
+ onPress: onDismiss
57
+ })
58
+ }) : null
59
+ ]
60
+ });
61
+ }
62
+ //#endregion
63
+ export { Alert };
64
+
65
+ //# sourceMappingURL=alert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert.js","names":[],"sources":["../../../src/components/alert/alert.tsx"],"sourcesContent":["import { classes } from \"../_internal/classes\";\nimport { Close } from \"../close\";\nimport type { AlertProps } from \"./alert.types\";\n\nfunction resolveAlertRole(variant: AlertProps[\"variant\"] | undefined): \"alert\" | \"status\" {\n if (variant === \"danger\" || variant === \"warning\") {\n return \"alert\";\n }\n\n return \"status\";\n}\n\nexport function Alert(props: AlertProps): JSX.Element {\n const {\n actions,\n children,\n class: className,\n description,\n dismissLabel = \"Dismiss alert\",\n dismissible = false,\n icon,\n onDismiss,\n ref,\n title,\n titleAs: TitleTag = \"h3\",\n variant = \"default\",\n role,\n ...rest\n } = props;\n const shouldRenderDismiss = dismissible && onDismiss !== undefined;\n const resolvedRole = role ?? resolveAlertRole(variant);\n const hasVariant = variant !== \"default\";\n\n return (\n <div\n {...rest}\n ref={ref}\n class={classes(\n \"alert\",\n hasVariant ? `alert-${variant}` : undefined,\n shouldRenderDismiss ? \"alert-dismissible\" : undefined,\n className,\n )}\n data-dismissible={shouldRenderDismiss ? \"true\" : undefined}\n data-slot=\"alert\"\n data-variant={hasVariant ? variant : undefined}\n role={resolvedRole}\n >\n {icon !== undefined ? (\n <div aria-hidden=\"true\" class=\"alert-icon\" data-slot=\"alert-icon\">\n {icon}\n </div>\n ) : null}\n\n <div class=\"alert-content\" data-slot=\"alert-content\">\n {title !== undefined ? (\n <TitleTag class=\"alert-title\" data-slot=\"alert-title\">\n {title}\n </TitleTag>\n ) : null}\n\n {description !== undefined ? (\n <p class=\"alert-description\" data-slot=\"alert-description\">\n {description}\n </p>\n ) : null}\n\n {children}\n\n {actions !== undefined ? (\n <div class=\"alert-actions\" data-slot=\"alert-actions\">\n {actions}\n </div>\n ) : null}\n </div>\n\n {shouldRenderDismiss ? (\n <div class=\"alert-close\" data-slot=\"alert-close\">\n <Close label={dismissLabel} onPress={onDismiss} />\n </div>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;AAIA,SAAS,iBAAiB,SAAgE;CACxF,IAAI,YAAY,YAAY,YAAY,WACtC,OAAO;CAGT,OAAO;;AAGT,SAAgB,MAAM,OAAgC;CACpD,MAAM,EACJ,SACA,UACA,OAAO,WACP,aACA,eAAe,iBACf,cAAc,OACd,MACA,WACA,KACA,OACA,SAAS,WAAW,MACpB,UAAU,WACV,MACA,GAAG,SACD;CACJ,MAAM,sBAAsB,eAAe,cAAc,KAAA;CACzD,MAAM,eAAe,QAAQ,iBAAiB,QAAQ;CACtD,MAAM,aAAa,YAAY;CAE/B,OACE,qBAAC,OAAD;EACE,GAAI;EACC;EACL,OAAO,QACL,SACA,aAAa,SAAS,YAAY,KAAA,GAClC,sBAAsB,sBAAsB,KAAA,GAC5C,UACD;EACD,oBAAkB,sBAAsB,SAAS,KAAA;EACjD,aAAU;EACV,gBAAc,aAAa,UAAU,KAAA;EACrC,MAAM;YAZR;GAcG,SAAS,KAAA,IACR,oBAAC,OAAD;IAAK,eAAY;IAAO,OAAM;IAAa,aAAU;cAClD;IACG,CAAA,GACJ;GAEJ,qBAAC,OAAD;IAAK,OAAM;IAAgB,aAAU;cAArC;KACG,UAAU,KAAA,IACT,oBAAC,UAAD;MAAU,OAAM;MAAc,aAAU;gBACrC;MACQ,CAAA,GACT;KAEH,gBAAgB,KAAA,IACf,oBAAC,KAAD;MAAG,OAAM;MAAoB,aAAU;gBACpC;MACC,CAAA,GACF;KAEH;KAEA,YAAY,KAAA,IACX,oBAAC,OAAD;MAAK,OAAM;MAAgB,aAAU;gBAClC;MACG,CAAA,GACJ;KACA;;GAEL,sBACC,oBAAC,OAAD;IAAK,OAAM;IAAc,aAAU;cACjC,oBAAC,OAAD;KAAO,OAAO;KAAc,SAAS;KAAa,CAAA;IAC9C,CAAA,GACJ;GACA"}
@@ -0,0 +1,22 @@
1
+ import { Ref } from "@askrjs/askr/foundations/utilities";
2
+
3
+ //#region src/components/alert/alert.types.d.ts
4
+ type AlertVariant = "default" | "info" | "success" | "warning" | "danger";
5
+ type AlertHeadingTag = "h2" | "h3" | "h4" | "h5" | "h6";
6
+ type DivProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref">;
7
+ type AlertProps = DivProps & {
8
+ actions?: unknown;
9
+ children?: unknown;
10
+ description?: unknown;
11
+ dismissLabel?: string;
12
+ dismissible?: boolean;
13
+ icon?: unknown;
14
+ onDismiss?: () => void;
15
+ title?: unknown;
16
+ titleAs?: AlertHeadingTag;
17
+ variant?: AlertVariant;
18
+ ref?: Ref<HTMLDivElement>;
19
+ };
20
+ //#endregion
21
+ export { AlertHeadingTag, AlertProps, AlertVariant };
22
+ //# sourceMappingURL=alert.types.d.ts.map
@@ -0,0 +1,2 @@
1
+ import { AlertHeadingTag, AlertProps, AlertVariant } from "./alert.types.js";
2
+ import { Alert } from "./alert.js";
@@ -1,3 +1,8 @@
1
- import type { AspectRatioAsChildProps, AspectRatioProps } from "./aspect-ratio.types";
2
- export declare function AspectRatio(props: AspectRatioProps): JSX.Element;
3
- export declare function AspectRatio(props: AspectRatioAsChildProps): JSX.Element;
1
+ import { AspectRatioAsChildProps, AspectRatioProps } from "./aspect-ratio.types.js";
2
+
3
+ //#region src/components/aspect-ratio/aspect-ratio.d.ts
4
+ declare function AspectRatio(props: AspectRatioProps): JSX.Element;
5
+ declare function AspectRatio(props: AspectRatioAsChildProps): JSX.Element;
6
+ //#endregion
7
+ export { AspectRatio };
8
+ //# sourceMappingURL=aspect-ratio.d.ts.map