@askrjs/themes 0.0.8 → 0.0.10

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 (479) hide show
  1. package/README.md +19 -13
  2. package/THEMING.md +24 -18
  3. package/dist/components/_internal/block-layout.d.ts +49 -0
  4. package/dist/components/_internal/block-layout.js +210 -0
  5. package/dist/components/_internal/block-layout.js.map +1 -0
  6. package/dist/components/_internal/jsx.js.map +1 -1
  7. package/dist/components/_internal/style.js +25 -1
  8. package/dist/components/_internal/style.js.map +1 -1
  9. package/dist/components/alert/alert.js +2 -2
  10. package/dist/components/alert/alert.js.map +1 -1
  11. package/dist/components/alert/alert.types.d.ts +0 -1
  12. package/dist/components/aside/aside.d.ts +7 -0
  13. package/dist/components/aside/aside.js +16 -0
  14. package/dist/components/aside/aside.js.map +1 -0
  15. package/dist/components/aside/aside.types.d.ts +6 -0
  16. package/dist/components/aside/index.d.ts +2 -0
  17. package/dist/components/aspect-ratio/aspect-ratio.js +1 -1
  18. package/dist/components/aspect-ratio/aspect-ratio.js.map +1 -1
  19. package/dist/components/badge/index.d.ts +1 -2
  20. package/dist/components/block/block.d.ts +2 -3
  21. package/dist/components/block/block.js +16 -46
  22. package/dist/components/block/block.js.map +1 -1
  23. package/dist/components/block/block.types.d.ts +13 -23
  24. package/dist/components/block/index.d.ts +3 -3
  25. package/dist/components/brand/brand.d.ts +9 -0
  26. package/dist/components/brand/brand.js +49 -0
  27. package/dist/components/brand/brand.js.map +1 -0
  28. package/dist/components/brand/brand.types.d.ts +31 -0
  29. package/dist/components/brand/index.d.ts +2 -0
  30. package/dist/components/card/card.d.ts +3 -3
  31. package/dist/components/card/card.js +6 -11
  32. package/dist/components/card/card.js.map +1 -1
  33. package/dist/components/card/card.types.d.ts +10 -12
  34. package/dist/components/card/index.d.ts +2 -2
  35. package/dist/components/catalog.d.ts +156 -0
  36. package/dist/components/catalog.js +723 -0
  37. package/dist/components/catalog.js.map +1 -0
  38. package/dist/components/container/container.d.ts +2 -3
  39. package/dist/components/container/container.js +8 -71
  40. package/dist/components/container/container.js.map +1 -1
  41. package/dist/components/container/container.types.d.ts +5 -24
  42. package/dist/components/container/index.d.ts +2 -3
  43. package/dist/components/empty-state/empty-state.js +34 -28
  44. package/dist/components/empty-state/empty-state.js.map +1 -1
  45. package/dist/components/empty-state/empty-state.types.d.ts +3 -6
  46. package/dist/components/field/field.js +4 -2
  47. package/dist/components/field/field.js.map +1 -1
  48. package/dist/components/field/field.types.d.ts +1 -0
  49. package/dist/components/footer/footer.d.ts +13 -0
  50. package/dist/components/footer/footer.js +86 -0
  51. package/dist/components/footer/footer.js.map +1 -0
  52. package/dist/components/footer/footer.types.d.ts +37 -0
  53. package/dist/components/footer/index.d.ts +2 -0
  54. package/dist/components/grid/grid.d.ts +7 -0
  55. package/dist/components/grid/grid.js +76 -0
  56. package/dist/components/grid/grid.js.map +1 -0
  57. package/dist/components/grid/grid.types.d.ts +19 -0
  58. package/dist/components/grid/index.d.ts +2 -0
  59. package/dist/components/header/header.js +9 -6
  60. package/dist/components/header/header.js.map +1 -1
  61. package/dist/components/header/header.types.d.ts +5 -5
  62. package/dist/components/header/index.d.ts +2 -0
  63. package/dist/components/main/index.d.ts +2 -0
  64. package/dist/components/main/main.d.ts +7 -0
  65. package/dist/components/main/main.js +17 -0
  66. package/dist/components/main/main.js.map +1 -0
  67. package/dist/components/main/main.types.d.ts +6 -0
  68. package/dist/components/nav/index.d.ts +2 -2
  69. package/dist/components/nav/nav.d.ts +8 -6
  70. package/dist/components/nav/nav.js +93 -58
  71. package/dist/components/nav/nav.js.map +1 -1
  72. package/dist/components/nav/nav.types.d.ts +16 -20
  73. package/dist/components/navbar/index.d.ts +4 -5
  74. package/dist/components/navbar/navbar.d.ts +3 -38
  75. package/dist/components/navbar/navbar.js +102 -198
  76. package/dist/components/navbar/navbar.js.map +1 -1
  77. package/dist/components/navbar/navbar.types.d.ts +14 -24
  78. package/dist/components/page/index.d.ts +2 -0
  79. package/dist/components/page/page.d.ts +7 -0
  80. package/dist/components/page/page.js +22 -0
  81. package/dist/components/page/page.js.map +1 -0
  82. package/dist/components/page/page.types.d.ts +6 -0
  83. package/dist/components/page-header/index.d.ts +2 -0
  84. package/dist/components/page-header/page-header.d.ts +7 -0
  85. package/dist/components/page-header/page-header.js +37 -0
  86. package/dist/components/page-header/page-header.js.map +1 -0
  87. package/dist/components/page-header/page-header.types.d.ts +10 -0
  88. package/dist/components/section/index.d.ts +2 -3
  89. package/dist/components/section/section.d.ts +2 -3
  90. package/dist/components/section/section.js +7 -30
  91. package/dist/components/section/section.js.map +1 -1
  92. package/dist/components/section/section.types.d.ts +3 -20
  93. package/dist/components/separator/index.d.ts +1 -2
  94. package/dist/components/sidebar/index.d.ts +2 -0
  95. package/dist/components/sidebar/sidebar.d.ts +17 -2
  96. package/dist/components/sidebar/sidebar.js +115 -211
  97. package/dist/components/sidebar/sidebar.js.map +1 -1
  98. package/dist/components/sidebar/sidebar.types.d.ts +21 -23
  99. package/dist/components/skeleton/index.d.ts +1 -2
  100. package/dist/components/skeleton/skeleton.js +12 -1
  101. package/dist/components/skeleton/skeleton.js.map +1 -1
  102. package/dist/components/skeleton/skeleton.types.d.ts +2 -0
  103. package/dist/components/spinner/index.d.ts +1 -1
  104. package/dist/components/spinner/spinner.js +6 -3
  105. package/dist/components/spinner/spinner.js.map +1 -1
  106. package/dist/components/spinner/spinner.types.d.ts +3 -1
  107. package/dist/components/stat/index.d.ts +2 -0
  108. package/dist/components/stat/stat.d.ts +10 -0
  109. package/dist/components/stat/stat.js +52 -0
  110. package/dist/components/stat/stat.js.map +1 -0
  111. package/dist/components/stat/stat.types.d.ts +24 -0
  112. package/dist/components/text/index.d.ts +2 -0
  113. package/dist/components/text/text.d.ts +7 -0
  114. package/dist/components/text/text.js +28 -0
  115. package/dist/components/text/text.js.map +1 -0
  116. package/dist/components/text/text.types.d.ts +26 -0
  117. package/dist/components/theme/theme.js +97 -18
  118. package/dist/components/theme/theme.js.map +1 -1
  119. package/dist/components/toolbar/index.d.ts +2 -0
  120. package/dist/components/toolbar/toolbar.d.ts +7 -0
  121. package/dist/components/toolbar/toolbar.js +30 -0
  122. package/dist/components/toolbar/toolbar.js.map +1 -0
  123. package/dist/components/toolbar/toolbar.types.d.ts +9 -0
  124. package/dist/components.d.ts +60 -0
  125. package/dist/components.js +35 -0
  126. package/dist/controls.d.ts +2 -2
  127. package/dist/controls.js +3 -3
  128. package/dist/core.d.ts +36 -0
  129. package/dist/core.js +19 -0
  130. package/dist/navs.d.ts +3 -15
  131. package/dist/navs.js +2 -8
  132. package/dist/overlays.d.ts +2 -2
  133. package/dist/overlays.js +2 -2
  134. package/dist/surfaces.d.ts +10 -8
  135. package/dist/surfaces.js +6 -4
  136. package/dist/themes/default/index.css +3691 -3959
  137. package/package.json +239 -73
  138. package/src/components/_internal/block-layout.ts +354 -0
  139. package/src/components/_internal/jsx.ts +18 -6
  140. package/src/components/_internal/style.ts +42 -4
  141. package/src/components/alert/alert.tsx +1 -2
  142. package/src/components/alert/alert.types.ts +0 -1
  143. package/src/components/aside/aside.tsx +12 -0
  144. package/src/components/aside/aside.types.ts +3 -0
  145. package/src/components/aside/index.ts +2 -0
  146. package/src/components/aspect-ratio/aspect-ratio.tsx +1 -1
  147. package/src/components/badge/index.ts +0 -1
  148. package/src/components/block/block.a11y.ts +0 -6
  149. package/src/components/block/block.tsx +40 -56
  150. package/src/components/block/block.types.ts +59 -41
  151. package/src/components/block/index.ts +1 -10
  152. package/src/components/brand/brand.tsx +61 -0
  153. package/src/components/brand/brand.types.ts +39 -0
  154. package/src/components/brand/index.ts +2 -0
  155. package/src/components/card/card.tsx +6 -18
  156. package/src/components/card/card.types.ts +9 -11
  157. package/src/components/card/index.ts +2 -3
  158. package/src/components/catalog.tsx +713 -0
  159. package/src/components/container/container.a11y.ts +0 -5
  160. package/src/components/container/container.tsx +18 -128
  161. package/src/components/container/container.types.ts +3 -32
  162. package/src/components/container/index.ts +1 -8
  163. package/src/components/empty-state/empty-state.tsx +17 -35
  164. package/src/components/empty-state/empty-state.types.ts +3 -5
  165. package/src/components/field/field.tsx +3 -1
  166. package/src/components/field/field.types.ts +1 -0
  167. package/src/components/footer/footer.tsx +88 -0
  168. package/src/components/footer/footer.types.ts +40 -0
  169. package/src/components/footer/index.ts +10 -0
  170. package/src/components/grid/grid.tsx +113 -0
  171. package/src/components/grid/grid.types.ts +20 -0
  172. package/src/components/grid/index.ts +2 -0
  173. package/src/components/header/header.tsx +10 -7
  174. package/src/components/header/header.types.ts +4 -4
  175. package/src/components/header/index.ts +1 -2
  176. package/src/components/main/index.ts +2 -0
  177. package/src/components/main/main.tsx +12 -0
  178. package/src/components/main/main.types.ts +3 -0
  179. package/src/components/nav/index.ts +7 -9
  180. package/src/components/nav/nav.tsx +153 -110
  181. package/src/components/nav/nav.types.ts +26 -27
  182. package/src/components/navbar/index.ts +4 -11
  183. package/src/components/navbar/navbar.tsx +104 -251
  184. package/src/components/navbar/navbar.types.ts +16 -42
  185. package/src/components/page/index.ts +2 -0
  186. package/src/components/page/page.tsx +17 -0
  187. package/src/components/page/page.types.ts +3 -0
  188. package/src/components/page-header/index.ts +2 -0
  189. package/src/components/page-header/page-header.tsx +29 -0
  190. package/src/components/page-header/page-header.types.ts +7 -0
  191. package/src/components/section/index.ts +1 -7
  192. package/src/components/section/section.a11y.ts +0 -1
  193. package/src/components/section/section.tsx +9 -35
  194. package/src/components/section/section.types.ts +2 -22
  195. package/src/components/separator/index.ts +4 -9
  196. package/src/components/sidebar/index.ts +27 -5
  197. package/src/components/sidebar/sidebar.tsx +145 -317
  198. package/src/components/sidebar/sidebar.types.ts +21 -28
  199. package/src/components/skeleton/index.ts +1 -2
  200. package/src/components/skeleton/skeleton.tsx +33 -1
  201. package/src/components/skeleton/skeleton.types.ts +2 -0
  202. package/src/components/spinner/index.ts +1 -1
  203. package/src/components/spinner/spinner.tsx +7 -2
  204. package/src/components/spinner/spinner.types.ts +3 -0
  205. package/src/components/stat/index.ts +2 -0
  206. package/src/components/stat/stat.tsx +47 -0
  207. package/src/components/stat/stat.types.ts +24 -0
  208. package/src/components/text/index.ts +2 -0
  209. package/src/components/text/text.tsx +39 -0
  210. package/src/components/text/text.types.ts +35 -0
  211. package/src/components/theme/theme.tsx +163 -21
  212. package/src/components/toolbar/index.ts +2 -0
  213. package/src/components/toolbar/toolbar.tsx +24 -0
  214. package/src/components/toolbar/toolbar.types.ts +6 -0
  215. package/src/components.ts +289 -0
  216. package/src/controls.ts +69 -2
  217. package/src/core.ts +42 -0
  218. package/src/navs.ts +9 -24
  219. package/src/overlays.ts +101 -59
  220. package/src/parity.ts +125 -0
  221. package/src/surfaces.ts +60 -13
  222. package/src/themes/default/index.css +11 -14
  223. package/src/themes/default/styles/actions/button-group.css +6 -6
  224. package/src/themes/default/styles/actions/button.css +98 -60
  225. package/src/themes/default/styles/actions/toggle-group.css +61 -25
  226. package/src/themes/default/styles/base/text.css +87 -0
  227. package/src/themes/default/styles/base/typography.css +24 -117
  228. package/src/themes/default/styles/base/utilities.css +0 -250
  229. package/src/themes/default/styles/disclosure/accordion.css +35 -28
  230. package/src/themes/default/styles/display/alert.css +7 -7
  231. package/src/themes/default/styles/display/avatar.css +7 -1
  232. package/src/themes/default/styles/display/badge.css +10 -10
  233. package/src/themes/default/styles/display/card.css +10 -47
  234. package/src/themes/default/styles/display/catalog.css +753 -0
  235. package/src/themes/default/styles/display/coverage.css +30 -305
  236. package/src/themes/default/styles/display/progress-circle.css +2 -0
  237. package/src/themes/default/styles/display/scroll-area.css +29 -24
  238. package/src/themes/default/styles/display/spinner.css +38 -1
  239. package/src/themes/default/styles/display/stat.css +21 -0
  240. package/src/themes/default/styles/display/table.css +39 -12
  241. package/src/themes/default/styles/display/virtual-list.css +24 -13
  242. package/src/themes/default/styles/display/virtual-table.css +58 -36
  243. package/src/themes/default/styles/forms/checkbox.css +12 -21
  244. package/src/themes/default/styles/forms/input-group.css +2 -1
  245. package/src/themes/default/styles/forms/input.css +11 -12
  246. package/src/themes/default/styles/forms/radio-group.css +44 -27
  247. package/src/themes/default/styles/forms/select.css +33 -35
  248. package/src/themes/default/styles/forms/slider.css +61 -47
  249. package/src/themes/default/styles/forms/switch.css +18 -23
  250. package/src/themes/default/styles/forms/textarea.css +12 -12
  251. package/src/themes/default/styles/layout/block.css +96 -12
  252. package/src/themes/default/styles/layout/grid.css +78 -0
  253. package/src/themes/default/styles/layout/layout.css +502 -772
  254. package/src/themes/default/styles/layout/patterns.css +0 -155
  255. package/src/themes/default/styles/navigation/nav.css +104 -154
  256. package/src/themes/default/styles/overlays/alert-dialog.css +2 -2
  257. package/src/themes/default/styles/overlays/dialog.css +76 -22
  258. package/src/themes/default/styles/overlays/dropdown.css +108 -31
  259. package/src/themes/default/styles/overlays/hover-card.css +39 -17
  260. package/src/themes/default/styles/overlays/menubar.css +223 -0
  261. package/src/themes/default/styles/overlays/popover.css +69 -23
  262. package/src/themes/default/styles/overlays/toast.css +91 -33
  263. package/src/themes/default/styles/overlays/tooltip.css +88 -14
  264. package/src/themes/default/styles/shell/brand.css +48 -0
  265. package/src/themes/default/styles/shell/footer.css +72 -0
  266. package/src/themes/default/styles/shell/header.css +7 -50
  267. package/src/themes/default/styles/shell/navbar.css +226 -453
  268. package/src/themes/default/styles/shell/sidebar.css +243 -829
  269. package/src/themes/default/tokens.css +145 -98
  270. package/templates/theme/index.css +11 -14
  271. package/templates/theme/styles/actions/button-group.css +6 -6
  272. package/templates/theme/styles/actions/button.css +98 -60
  273. package/templates/theme/styles/actions/toggle-group.css +61 -25
  274. package/templates/theme/styles/base/text.css +87 -0
  275. package/templates/theme/styles/base/typography.css +24 -117
  276. package/templates/theme/styles/disclosure/accordion.css +35 -28
  277. package/templates/theme/styles/display/alert.css +7 -7
  278. package/templates/theme/styles/display/avatar.css +7 -1
  279. package/templates/theme/styles/display/badge.css +10 -10
  280. package/templates/theme/styles/display/card.css +10 -47
  281. package/templates/theme/styles/display/catalog.css +753 -0
  282. package/templates/theme/styles/display/coverage.css +30 -305
  283. package/templates/theme/styles/display/scroll-area.css +29 -24
  284. package/templates/theme/styles/display/spinner.css +38 -1
  285. package/templates/theme/styles/display/stat.css +21 -0
  286. package/templates/theme/styles/display/table.css +39 -12
  287. package/templates/theme/styles/display/virtual-list.css +24 -13
  288. package/templates/theme/styles/display/virtual-table.css +58 -36
  289. package/templates/theme/styles/forms/checkbox.css +12 -21
  290. package/templates/theme/styles/forms/input.css +11 -12
  291. package/templates/theme/styles/forms/radio-group.css +44 -27
  292. package/templates/theme/styles/forms/select.css +33 -35
  293. package/templates/theme/styles/forms/slider.css +61 -47
  294. package/templates/theme/styles/forms/switch.css +18 -23
  295. package/templates/theme/styles/forms/textarea.css +12 -12
  296. package/templates/theme/styles/layout/block.css +96 -12
  297. package/templates/theme/styles/layout/grid.css +78 -0
  298. package/templates/theme/styles/layout/layout.css +676 -1
  299. package/templates/theme/styles/layout/patterns.css +0 -155
  300. package/templates/theme/styles/navigation/nav.css +104 -154
  301. package/templates/theme/styles/overlays/alert-dialog.css +2 -2
  302. package/templates/theme/styles/overlays/dialog.css +76 -22
  303. package/templates/theme/styles/overlays/dropdown.css +108 -31
  304. package/templates/theme/styles/overlays/hover-card.css +39 -17
  305. package/templates/theme/styles/overlays/menubar.css +223 -0
  306. package/templates/theme/styles/overlays/popover.css +69 -23
  307. package/templates/theme/styles/overlays/toast.css +80 -33
  308. package/templates/theme/styles/overlays/tooltip.css +88 -14
  309. package/templates/theme/styles/shell/brand.css +48 -0
  310. package/templates/theme/styles/shell/footer.css +72 -0
  311. package/templates/theme/styles/shell/header.css +7 -50
  312. package/templates/theme/styles/shell/navbar.css +226 -453
  313. package/templates/theme/styles/shell/sidebar.css +197 -779
  314. package/templates/theme/tokens.css +145 -98
  315. package/dist/components/_internal/box-layout.js +0 -116
  316. package/dist/components/_internal/box-layout.js.map +0 -1
  317. package/dist/components/_internal/layout.d.ts +0 -9
  318. package/dist/components/_internal/layout.js +0 -147
  319. package/dist/components/_internal/layout.js.map +0 -1
  320. package/dist/components/badge/badge.a11y.d.ts +0 -17
  321. package/dist/components/block/block.a11y.d.ts +0 -20
  322. package/dist/components/box/box.a11y.d.ts +0 -14
  323. package/dist/components/box/box.d.ts +0 -9
  324. package/dist/components/box/box.js +0 -36
  325. package/dist/components/box/box.js.map +0 -1
  326. package/dist/components/box/box.types.d.ts +0 -72
  327. package/dist/components/box/index.d.ts +0 -3
  328. package/dist/components/breadcrumb/breadcrumb.a11y.d.ts +0 -17
  329. package/dist/components/breadcrumb/breadcrumb.a11y.js +0 -15
  330. package/dist/components/breadcrumb/breadcrumb.a11y.js.map +0 -1
  331. package/dist/components/breadcrumb/breadcrumb.d.ts +0 -18
  332. package/dist/components/breadcrumb/breadcrumb.js +0 -113
  333. package/dist/components/breadcrumb/breadcrumb.js.map +0 -1
  334. package/dist/components/breadcrumb/breadcrumb.types.d.ts +0 -65
  335. package/dist/components/breadcrumb/index.d.ts +0 -3
  336. package/dist/components/container/container.a11y.d.ts +0 -19
  337. package/dist/components/flex/flex.a11y.d.ts +0 -22
  338. package/dist/components/flex/flex.d.ts +0 -9
  339. package/dist/components/flex/flex.js +0 -115
  340. package/dist/components/flex/flex.js.map +0 -1
  341. package/dist/components/flex/flex.types.d.ts +0 -42
  342. package/dist/components/flex/index.d.ts +0 -3
  343. package/dist/components/header/header.a11y.d.ts +0 -14
  344. package/dist/components/header/header.a11y.js +0 -12
  345. package/dist/components/header/header.a11y.js.map +0 -1
  346. package/dist/components/inline/index.d.ts +0 -8
  347. package/dist/components/inline/index.js +0 -13
  348. package/dist/components/inline/index.js.map +0 -1
  349. package/dist/components/list-group/index.d.ts +0 -2
  350. package/dist/components/list-group/list-group.d.ts +0 -9
  351. package/dist/components/list-group/list-group.js +0 -43
  352. package/dist/components/list-group/list-group.js.map +0 -1
  353. package/dist/components/list-group/list-group.types.d.ts +0 -32
  354. package/dist/components/navbar/navbar-panel.js +0 -42
  355. package/dist/components/navbar/navbar-panel.js.map +0 -1
  356. package/dist/components/navbar/navbar.context.js +0 -13
  357. package/dist/components/navbar/navbar.context.js.map +0 -1
  358. package/dist/components/navbar/navbar.render.js +0 -26
  359. package/dist/components/navbar/navbar.render.js.map +0 -1
  360. package/dist/components/navbar/navbar.shared.js +0 -18
  361. package/dist/components/navbar/navbar.shared.js.map +0 -1
  362. package/dist/components/pagination/index.d.ts +0 -2
  363. package/dist/components/pagination/pagination.d.ts +0 -11
  364. package/dist/components/pagination/pagination.js +0 -95
  365. package/dist/components/pagination/pagination.js.map +0 -1
  366. package/dist/components/pagination/pagination.types.d.ts +0 -40
  367. package/dist/components/section/section.a11y.d.ts +0 -15
  368. package/dist/components/separator/separator.a11y.d.ts +0 -17
  369. package/dist/components/separator/separator.a11y.js +0 -15
  370. package/dist/components/separator/separator.a11y.js.map +0 -1
  371. package/dist/components/shell/index.d.ts +0 -3
  372. package/dist/components/shell/shell-nav.types.d.ts +0 -7
  373. package/dist/components/shell/shell-panel.js +0 -54
  374. package/dist/components/shell/shell-panel.js.map +0 -1
  375. package/dist/components/shell/shell-responsive.js +0 -118
  376. package/dist/components/shell/shell-responsive.js.map +0 -1
  377. package/dist/components/shell/shell.a11y.d.ts +0 -23
  378. package/dist/components/shell/shell.a11y.js +0 -23
  379. package/dist/components/shell/shell.a11y.js.map +0 -1
  380. package/dist/components/shell/shell.d.ts +0 -13
  381. package/dist/components/shell/shell.js +0 -69
  382. package/dist/components/shell/shell.js.map +0 -1
  383. package/dist/components/shell/shell.types.d.ts +0 -58
  384. package/dist/components/sidebar/sidebar-panel.d.ts +0 -7
  385. package/dist/components/sidebar/sidebar-panel.js +0 -49
  386. package/dist/components/sidebar/sidebar-panel.js.map +0 -1
  387. package/dist/components/sidebar/sidebar-toggle.d.ts +0 -7
  388. package/dist/components/sidebar/sidebar-toggle.js +0 -8
  389. package/dist/components/sidebar/sidebar-toggle.js.map +0 -1
  390. package/dist/components/sidebar/sidebar.context.js +0 -21
  391. package/dist/components/sidebar/sidebar.context.js.map +0 -1
  392. package/dist/components/sidebar/sidebar.shared.js +0 -12
  393. package/dist/components/sidebar/sidebar.shared.js.map +0 -1
  394. package/dist/components/skeleton/skeleton.a11y.d.ts +0 -16
  395. package/dist/components/spacer/index.d.ts +0 -3
  396. package/dist/components/spacer/spacer.a11y.d.ts +0 -17
  397. package/dist/components/spacer/spacer.d.ts +0 -8
  398. package/dist/components/spacer/spacer.js +0 -49
  399. package/dist/components/spacer/spacer.js.map +0 -1
  400. package/dist/components/spacer/spacer.types.d.ts +0 -26
  401. package/dist/components/stack/index.d.ts +0 -3
  402. package/dist/components/stack/stack.a11y.d.ts +0 -18
  403. package/dist/components/stack/stack.d.ts +0 -8
  404. package/dist/components/stack/stack.js +0 -16
  405. package/dist/components/stack/stack.js.map +0 -1
  406. package/dist/components/stack/stack.types.d.ts +0 -22
  407. package/dist/feedback.d.ts +0 -5
  408. package/dist/feedback.js +0 -4
  409. package/dist/layouts.d.ts +0 -25
  410. package/dist/layouts.js +0 -11
  411. package/dist/shells.d.ts +0 -16
  412. package/dist/shells.js +0 -11
  413. package/src/components/_internal/box-layout.ts +0 -164
  414. package/src/components/_internal/layout.ts +0 -211
  415. package/src/components/box/box.a11y.ts +0 -11
  416. package/src/components/box/box.tsx +0 -38
  417. package/src/components/box/box.types.ts +0 -76
  418. package/src/components/box/index.ts +0 -11
  419. package/src/components/breadcrumb/breadcrumb.a11y.ts +0 -15
  420. package/src/components/breadcrumb/breadcrumb.tsx +0 -123
  421. package/src/components/breadcrumb/breadcrumb.types.ts +0 -74
  422. package/src/components/breadcrumb/index.ts +0 -24
  423. package/src/components/flex/flex.a11y.ts +0 -19
  424. package/src/components/flex/flex.tsx +0 -162
  425. package/src/components/flex/flex.types.ts +0 -51
  426. package/src/components/flex/index.ts +0 -16
  427. package/src/components/inline/index.tsx +0 -28
  428. package/src/components/list-group/index.ts +0 -7
  429. package/src/components/list-group/list-group.tsx +0 -74
  430. package/src/components/list-group/list-group.types.ts +0 -32
  431. package/src/components/navbar/navbar-panel.tsx +0 -62
  432. package/src/components/navbar/navbar.context.ts +0 -22
  433. package/src/components/navbar/navbar.render.tsx +0 -32
  434. package/src/components/navbar/navbar.shared.ts +0 -21
  435. package/src/components/pagination/index.ts +0 -8
  436. package/src/components/pagination/pagination.tsx +0 -158
  437. package/src/components/pagination/pagination.types.ts +0 -41
  438. package/src/components/shell/index.ts +0 -16
  439. package/src/components/shell/shell-nav.types.ts +0 -3
  440. package/src/components/shell/shell-panel.tsx +0 -85
  441. package/src/components/shell/shell-responsive.tsx +0 -246
  442. package/src/components/shell/shell.a11y.ts +0 -20
  443. package/src/components/shell/shell.tsx +0 -74
  444. package/src/components/shell/shell.types.ts +0 -71
  445. package/src/components/sidebar/sidebar-panel.tsx +0 -67
  446. package/src/components/sidebar/sidebar-toggle.tsx +0 -5
  447. package/src/components/sidebar/sidebar.context.ts +0 -40
  448. package/src/components/sidebar/sidebar.shared.ts +0 -12
  449. package/src/components/spacer/index.ts +0 -9
  450. package/src/components/spacer/spacer.a11y.ts +0 -14
  451. package/src/components/spacer/spacer.tsx +0 -61
  452. package/src/components/spacer/spacer.types.ts +0 -31
  453. package/src/components/stack/index.ts +0 -3
  454. package/src/components/stack/stack.a11y.ts +0 -15
  455. package/src/components/stack/stack.tsx +0 -13
  456. package/src/components/stack/stack.types.ts +0 -22
  457. package/src/feedback.ts +0 -6
  458. package/src/layouts.ts +0 -19
  459. package/src/shells.ts +0 -13
  460. package/src/themes/default/styles/actions/toggle.css +0 -50
  461. package/src/themes/default/styles/disclosure/collapsible.css +0 -58
  462. package/src/themes/default/styles/display/list-group.css +0 -84
  463. package/src/themes/default/styles/forms/form.css +0 -5
  464. package/src/themes/default/styles/layout/responsive-layout.css +0 -230
  465. package/src/themes/default/styles/navigation/breadcrumb.css +0 -45
  466. package/src/themes/default/styles/navigation/menu.css +0 -203
  467. package/src/themes/default/styles/navigation/menubar.css +0 -255
  468. package/src/themes/default/styles/navigation/pagination.css +0 -91
  469. package/src/themes/default/styles/shell/theme.css +0 -37
  470. package/templates/theme/styles/actions/toggle.css +0 -50
  471. package/templates/theme/styles/disclosure/collapsible.css +0 -58
  472. package/templates/theme/styles/display/list-group.css +0 -84
  473. package/templates/theme/styles/forms/form.css +0 -5
  474. package/templates/theme/styles/layout/responsive-layout.css +0 -230
  475. package/templates/theme/styles/navigation/breadcrumb.css +0 -45
  476. package/templates/theme/styles/navigation/menu.css +0 -203
  477. package/templates/theme/styles/navigation/menubar.css +0 -255
  478. package/templates/theme/styles/navigation/pagination.css +0 -91
  479. package/templates/theme/styles/shell/theme.css +0 -37
package/README.md CHANGED
@@ -1,11 +1,10 @@
1
1
  # @askrjs/themes
2
2
 
3
- CSS tokens, shell chrome, and styled composition helpers for Askr apps.
3
+ CSS tokens and a shadcn-style styled component catalog for Askr apps.
4
4
 
5
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.
6
+ `@askrjs/charts`. It owns the default theme and styled component catalog while
7
+ behavior stays in `@askrjs/ui` and chart components stay in `@askrjs/charts`.
9
8
 
10
9
  ## Install
11
10
 
@@ -33,11 +32,11 @@ Then set `data-theme` to `tabby`, `ginger`, `tuxedo`, `calico`, or `torty`.
33
32
  For picker/toggle composition, import `CAT_THEME_OPTIONS` and `CAT_THEME_NAMES`
34
33
  from `@askrjs/themes/theme`.
35
34
 
36
- Then use the theme helpers and curated component surfaces:
35
+ Then use the theme helpers and component catalog:
37
36
 
38
37
  ```tsx
39
38
  import { ThemeProvider, ThemeToggle } from "@askrjs/themes/theme";
40
- import { Button, ButtonGroup, Field, InputGroup } from "@askrjs/themes/controls";
39
+ import { Button, ButtonGroup, Field, Input, InputGroup, Label } from "@askrjs/themes/components";
41
40
 
42
41
  export function AppShell() {
43
42
  return (
@@ -48,8 +47,9 @@ export function AppShell() {
48
47
  </ButtonGroup>
49
48
 
50
49
  <Field>
50
+ <Label for="workspace">Workspace</Label>
51
51
  <InputGroup>
52
- <input />
52
+ <Input id="workspace" name="workspace" />
53
53
  </InputGroup>
54
54
  </Field>
55
55
  </ThemeProvider>
@@ -59,13 +59,14 @@ export function AppShell() {
59
59
 
60
60
  ## What To Import
61
61
 
62
+ - `@askrjs/themes/components` for the styled component catalog.
63
+ - `@askrjs/themes/<component>` for package subpaths such as
64
+ `@askrjs/themes/button`, `@askrjs/themes/card`, and
65
+ `@askrjs/themes/dialog`.
62
66
  - `@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
67
+ and `useTheme`.
68
+ - `@askrjs/charts` for charts; chart components are intentionally not exported
69
+ from `@askrjs/themes`.
69
70
 
70
71
  ## Theme Contract
71
72
 
@@ -74,5 +75,10 @@ export function AppShell() {
74
75
  - Keep selectors low specificity so downstream apps can customize them cleanly.
75
76
  - Use [THEMING.md](./THEMING.md) and [docs/architecture.md](./docs/architecture.md)
76
77
  for the full contract and package boundaries.
78
+ - Use [docs/component-anatomy.md](./docs/component-anatomy.md) for stable slot
79
+ hooks and [docs/customization.md](./docs/customization.md) for the KISS
80
+ customization path.
81
+ - Use [docs/recipes.md](./docs/recipes.md) for copyable login, admin shell,
82
+ settings form, table, dropdown, and detail-page patterns.
77
83
 
78
84
  - Use `visual-check.html` for manual QA across light and dark modes.
package/THEMING.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Theming
2
2
 
3
- `@askrjs/themes` is the shell, token, and component styling companion to
4
- `@askrjs/charts`. It owns the app frame and shared visual language, while chart
5
- rendering stays in the chart package.
3
+ `@askrjs/themes` is the token, structural preset, and component styling
4
+ companion to `@askrjs/charts`. It owns the shared visual language while
5
+ product-specific app layouts stay in userland recipes.
6
6
 
7
7
  See [docs/architecture.md](./docs/architecture.md) for the package boundary
8
8
  between `@askrjs/askr`, `@askrjs/ui`, and `@askrjs/themes`.
@@ -106,14 +106,14 @@ Package boundaries:
106
106
 
107
107
  - `@askrjs/askr` owns what exists and when.
108
108
  - `@askrjs/ui` owns behavior, state, focus, and ARIA coordination.
109
- - `@askrjs/themes` owns visual-only components, layout composition, and
110
- default styling.
109
+ - `@askrjs/themes` owns visual-only components, Block-first structural
110
+ presets, and default styling.
111
111
 
112
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.
113
+ `@askrjs/themes/core`, `@askrjs/themes/surfaces`, and `@askrjs/themes/navs`
114
+ for styled components such as Button, ButtonGroup, Close, InputGroup, Block,
115
+ Container, Header, Main, Sidebar, Navbar, NavBrand, NavDropdown, Alert, Badge,
116
+ Tabs, Tab, Pills, Pill, Skeleton, Separator, and EmptyState.
117
117
 
118
118
  Theme state helpers also live there: `ThemeProvider`, `ThemePicker`,
119
119
  `ThemeToggle`, and `useTheme`. `ThemeToggle` intentionally has no built-in
@@ -123,23 +123,27 @@ be styled consistently across themes. If you use icon children, the direct child
123
123
  icon is sized from `var(--ak-theme-toggle-icon-size, var(--ak-icon-size, 1em))`,
124
124
  so apps can override `--ak-theme-toggle-icon-size` to fit custom icon dimensions.
125
125
  The common wrapper components also emit familiar alias classes such as
126
- `alert`, `btn-group`, `btn-close`, `input-group`, `list-group`, and
127
- `pagination` so app-level CSS can stay close to the Bootstrap mental model
128
- without giving up the canonical `data-slot` contract.
126
+ `alert`, `btn-group`, `btn-close`, `input-group`, `tabs`, and `pills` so
127
+ app-level CSS can stay close to familiar HTML authoring without
128
+ giving up the canonical `data-slot` contract.
129
129
 
130
130
  Responsive rules:
131
131
 
132
132
  - Build mobile first. Base selectors must work on narrow screens; larger layouts are additive via `min-width` media queries.
133
- - The default theme uses semantic breakpoints `sm`, `md`, `lg`, and `xl` for `data-collapse-below`.
133
+ - `Block` is the only layout engine. Responsive layout props use `base`, `sm`, `md`, `lg`, and `xl`.
134
+ - The default theme uses semantic breakpoints `sm`, `md`, `lg`, and `xl` for layout variables.
134
135
  - Keep breakpoint values centralized in theme tokens so the default theme and generated themes stay aligned.
135
- - 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`.
136
+ - Responsive behavior must target only public hooks and Block-owned CSS variables.
137
+ - Navbar collapse is a semantic preset: put `NavBrand` first, use `collapseAt`
138
+ for the single responsive pattern, and use `NavDropdown` for simple
139
+ single-level menus.
136
140
  - Prefer token overrides first. Reach for component CSS overrides only when tokens are insufficient.
137
141
  - 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.
138
- - Broad layout slots like `main`, `sidebar`, and `navbar` must always be anchored to a public layout root such as `shell`.
139
- - 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.
142
+ - Broad layout slots like `main`, `sidebar`, and `navbar` are semantic Block presets, not independent layout engines.
143
+ - Block-owned layout variables are part of the public theme contract and should resolve through theme tokens rather than hard-coded values.
140
144
  - 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.
141
145
  - 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`.
142
- - 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.
146
+ - 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. Product-style or marketing-style page layouts belong in userland composition, not the shipped theme package.
143
147
  - Comfortable density is tokenized through `--ak-density-control-height-*` and `--ak-density-control-padding-x-*`; apps should tune those before overriding component CSS.
144
148
  - Future class aliases must be added selectively with contract tests; do not mirror every internal slot as a class by default.
145
149
 
@@ -152,7 +156,7 @@ This document defines the default theme token contract for `askr-themes`.
152
156
  The purpose of this token set is to provide a stable, reusable semantic theming layer for:
153
157
 
154
158
  - `askr-ui` headless components
155
- - application shell layouts
159
+ - application layouts
156
160
  - docs layouts
157
161
  - admin dashboards
158
162
  - forms
@@ -326,6 +330,7 @@ These are required for the default theme and any future theme reintroduced to th
326
330
  Required:
327
331
 
328
332
  - `--ak-font-family-body`
333
+ - `--ak-font-family-display`
329
334
  - `--ak-font-family-mono`
330
335
  - `--ak-font-size-xs`
331
336
  - `--ak-font-size-sm`
@@ -662,6 +667,7 @@ These are recommended implementation defaults for component authors:
662
667
  :root {
663
668
  /* typography */
664
669
  --ak-font-family-body: system-ui, sans-serif;
670
+ --ak-font-family-display: system-ui, sans-serif;
665
671
  --ak-font-family-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
666
672
 
667
673
  --ak-font-size-xs: 0.75rem;
@@ -0,0 +1,49 @@
1
+ //#region src/components/_internal/block-layout.d.ts
2
+ type LayoutBreakpoint = "base" | "sm" | "md" | "lg" | "xl";
3
+ type ResponsiveValue<T> = T | Partial<Record<LayoutBreakpoint, T>>;
4
+ type BlockSpace = "0" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "page";
5
+ type BlockMargin = BlockSpace | "auto";
6
+ type BlockSize = "auto" | "full" | "screen" | "content" | "sidebar" | "page" | "sm" | "md" | "lg" | "xl";
7
+ type BlockDirection = "row" | "column" | "row-reverse" | "column-reverse";
8
+ type BlockRowFrom = Exclude<LayoutBreakpoint, "base">;
9
+ type BlockAlign = "start" | "end" | "center" | "stretch" | "baseline";
10
+ type BlockJustify = "start" | "end" | "center" | "between";
11
+ type BlockBackground = "surface" | "muted" | "selected" | "canvas" | "raised" | "overlay" | "transparent";
12
+ type BlockRadius = true | "sm" | "md" | "lg" | "xl" | "round";
13
+ type BlockShadow = true | "sm" | "md" | "lg";
14
+ type BlockZIndex = "header" | "sticky" | "fixed" | "dropdown" | "modal" | "popover" | "toast" | "tooltip";
15
+ type BlockLayoutProps = {
16
+ padding?: ResponsiveValue<BlockSpace>;
17
+ paddingX?: ResponsiveValue<BlockSpace>;
18
+ paddingY?: ResponsiveValue<BlockSpace>;
19
+ margin?: ResponsiveValue<BlockMargin>;
20
+ marginX?: ResponsiveValue<BlockMargin>;
21
+ marginY?: ResponsiveValue<BlockMargin>;
22
+ width?: ResponsiveValue<BlockSize>;
23
+ minWidth?: ResponsiveValue<BlockSize>;
24
+ maxWidth?: ResponsiveValue<BlockSize>;
25
+ height?: ResponsiveValue<BlockSize>;
26
+ minHeight?: ResponsiveValue<BlockSize>;
27
+ maxHeight?: ResponsiveValue<BlockSize>;
28
+ rowFrom?: BlockRowFrom;
29
+ direction?: ResponsiveValue<BlockDirection>;
30
+ align?: ResponsiveValue<BlockAlign>;
31
+ justify?: ResponsiveValue<BlockJustify>;
32
+ gap?: ResponsiveValue<BlockSpace>;
33
+ grow?: ResponsiveValue<boolean | number>;
34
+ shrink?: ResponsiveValue<boolean | number>;
35
+ center?: ResponsiveValue<boolean>;
36
+ sticky?: boolean;
37
+ top?: ResponsiveValue<BlockSpace>;
38
+ zIndex?: ResponsiveValue<BlockZIndex>;
39
+ background?: ResponsiveValue<BlockBackground>;
40
+ border?: ResponsiveValue<boolean>;
41
+ borderBottom?: ResponsiveValue<boolean>;
42
+ borderRight?: ResponsiveValue<boolean>;
43
+ radius?: ResponsiveValue<BlockRadius>;
44
+ shadow?: ResponsiveValue<BlockShadow>;
45
+ hide?: ResponsiveValue<boolean>;
46
+ };
47
+ //#endregion
48
+ export { BlockAlign, BlockBackground, BlockDirection, BlockJustify, BlockLayoutProps, BlockMargin, BlockRadius, BlockRowFrom, BlockShadow, BlockSize, BlockSpace, BlockZIndex, ResponsiveValue };
49
+ //# sourceMappingURL=block-layout.d.ts.map
@@ -0,0 +1,210 @@
1
+ import { serializeCssDeclarations } from "./style.js";
2
+ //#region src/components/_internal/block-layout.ts
3
+ const BREAKPOINTS = [
4
+ "base",
5
+ "sm",
6
+ "md",
7
+ "lg",
8
+ "xl"
9
+ ];
10
+ const SPACE_TOKEN_MAP = {
11
+ "0": "0",
12
+ xs: "var(--ak-space-xs)",
13
+ sm: "var(--ak-space-sm)",
14
+ md: "var(--ak-space-md)",
15
+ lg: "var(--ak-space-lg)",
16
+ xl: "var(--ak-space-xl)",
17
+ "2xl": "var(--ak-space-2xl)",
18
+ "3xl": "var(--ak-space-3xl)",
19
+ page: "var(--ak-layout-page-gutter)"
20
+ };
21
+ const SIZE_TOKEN_MAP = {
22
+ auto: "auto",
23
+ full: "100%",
24
+ screen: "100dvh",
25
+ content: "min(60vh, 36rem)",
26
+ sidebar: "var(--ak-layout-sidebar-width)",
27
+ page: "var(--ak-layout-content-max-width)",
28
+ sm: "var(--ak-container-1)",
29
+ md: "var(--ak-container-2)",
30
+ lg: "var(--ak-container-3)",
31
+ xl: "var(--ak-container-4)"
32
+ };
33
+ const BACKGROUND_TOKEN_MAP = {
34
+ canvas: "var(--ak-color-bg)",
35
+ surface: "var(--ak-color-surface)",
36
+ muted: "var(--ak-color-surface-muted)",
37
+ raised: "var(--ak-color-surface-raised)",
38
+ overlay: "var(--ak-color-surface-overlay)",
39
+ selected: "var(--ak-color-selected)",
40
+ transparent: "transparent"
41
+ };
42
+ const RADIUS_TOKEN_MAP = {
43
+ sm: "var(--ak-radius-sm)",
44
+ md: "var(--ak-radius-md)",
45
+ lg: "var(--ak-radius-lg)",
46
+ xl: "var(--ak-radius-xl)",
47
+ round: "var(--ak-radius-round)"
48
+ };
49
+ const SHADOW_TOKEN_MAP = {
50
+ sm: "var(--ak-shadow-sm)",
51
+ md: "var(--ak-shadow-md)",
52
+ lg: "var(--ak-shadow-lg)"
53
+ };
54
+ const Z_INDEX_TOKEN_MAP = {
55
+ header: "var(--ak-z-sticky)",
56
+ sticky: "var(--ak-z-sticky)",
57
+ fixed: "var(--ak-z-fixed)",
58
+ dropdown: "var(--ak-z-dropdown)",
59
+ modal: "var(--ak-z-modal)",
60
+ popover: "var(--ak-z-popover)",
61
+ toast: "var(--ak-z-toast)",
62
+ tooltip: "var(--ak-z-tooltip)"
63
+ };
64
+ const BORDER_VALUE = "1px solid var(--ak-color-border-subtle)";
65
+ const BLOCK_LAYOUT_KEYS = new Set([
66
+ "padding",
67
+ "paddingX",
68
+ "paddingY",
69
+ "margin",
70
+ "marginX",
71
+ "marginY",
72
+ "width",
73
+ "minWidth",
74
+ "maxWidth",
75
+ "height",
76
+ "minHeight",
77
+ "maxHeight",
78
+ "rowFrom",
79
+ "direction",
80
+ "align",
81
+ "justify",
82
+ "gap",
83
+ "grow",
84
+ "shrink",
85
+ "center",
86
+ "sticky",
87
+ "top",
88
+ "zIndex",
89
+ "background",
90
+ "border",
91
+ "borderBottom",
92
+ "borderRight",
93
+ "radius",
94
+ "shadow",
95
+ "hide"
96
+ ]);
97
+ function isResponsiveValue(value) {
98
+ return Boolean(value && typeof value === "object" && !Array.isArray(value) && BREAKPOINTS.some((breakpoint) => breakpoint in value));
99
+ }
100
+ function normalizeResponsiveValue(value) {
101
+ if (value === void 0) return void 0;
102
+ if (isResponsiveValue(value)) return value;
103
+ return { base: value };
104
+ }
105
+ function resolveTokenValue(value, tokens) {
106
+ if (typeof value === "number") return value;
107
+ const trimmed = value.trim();
108
+ return tokens[trimmed] ?? trimmed;
109
+ }
110
+ function resolveSpaceValue(value) {
111
+ return resolveTokenValue(value, SPACE_TOKEN_MAP);
112
+ }
113
+ function resolveSizeValue(value) {
114
+ return String(resolveTokenValue(value, SIZE_TOKEN_MAP));
115
+ }
116
+ function resolveAlignValue(value) {
117
+ if (value === "start") return "flex-start";
118
+ if (value === "end") return "flex-end";
119
+ return value;
120
+ }
121
+ function resolveJustifyValue(value) {
122
+ if (value === "start") return "flex-start";
123
+ if (value === "end") return "flex-end";
124
+ if (value === "between") return "space-between";
125
+ return value;
126
+ }
127
+ function resolveFlexFlag(value) {
128
+ if (value === true) return 1;
129
+ if (value === false) return 0;
130
+ return value;
131
+ }
132
+ function resolveBorderValue(value) {
133
+ if (value === false) return "0";
134
+ return BORDER_VALUE;
135
+ }
136
+ function resolveRadiusValue(value) {
137
+ if (value === true) return RADIUS_TOKEN_MAP.md;
138
+ return String(resolveTokenValue(value, RADIUS_TOKEN_MAP));
139
+ }
140
+ function resolveShadowValue(value) {
141
+ if (value === true) return SHADOW_TOKEN_MAP.sm;
142
+ return String(resolveTokenValue(value, SHADOW_TOKEN_MAP));
143
+ }
144
+ function setResponsiveVar(styles, property, value, resolve) {
145
+ const normalized = normalizeResponsiveValue(value);
146
+ if (!normalized) return;
147
+ for (const breakpoint of BREAKPOINTS) {
148
+ const breakpointValue = normalized[breakpoint];
149
+ if (breakpointValue === void 0) continue;
150
+ const resolved = resolve(breakpointValue);
151
+ if (resolved === void 0 || resolved === "") continue;
152
+ styles[`--ak-${property}-${breakpoint}`] = resolved;
153
+ }
154
+ }
155
+ function splitBlockLayoutProps(props) {
156
+ const blockProps = {};
157
+ const rest = {};
158
+ for (const [key, value] of Object.entries(props)) if (BLOCK_LAYOUT_KEYS.has(key)) blockProps[key] = value;
159
+ else rest[key] = value;
160
+ return {
161
+ blockProps,
162
+ rest
163
+ };
164
+ }
165
+ function applyBlockLayoutStyles(styles, props) {
166
+ setResponsiveVar(styles, "p", props.padding, resolveSpaceValue);
167
+ setResponsiveVar(styles, "px", props.paddingX, resolveSpaceValue);
168
+ setResponsiveVar(styles, "py", props.paddingY, resolveSpaceValue);
169
+ setResponsiveVar(styles, "m", props.margin, resolveSpaceValue);
170
+ setResponsiveVar(styles, "mx", props.marginX, resolveSpaceValue);
171
+ setResponsiveVar(styles, "my", props.marginY, resolveSpaceValue);
172
+ setResponsiveVar(styles, "width", props.width, resolveSizeValue);
173
+ setResponsiveVar(styles, "min-width", props.minWidth, resolveSizeValue);
174
+ setResponsiveVar(styles, "max-width", props.maxWidth, resolveSizeValue);
175
+ setResponsiveVar(styles, "height", props.height, resolveSizeValue);
176
+ setResponsiveVar(styles, "min-height", props.minHeight, resolveSizeValue);
177
+ setResponsiveVar(styles, "max-height", props.maxHeight, resolveSizeValue);
178
+ if (props.rowFrom !== void 0) styles[`--ak-flex-direction-${props.rowFrom}`] = "row";
179
+ setResponsiveVar(styles, "flex-direction", props.direction, (value) => value);
180
+ setResponsiveVar(styles, "align-items", props.align, resolveAlignValue);
181
+ setResponsiveVar(styles, "justify-content", props.justify, resolveJustifyValue);
182
+ setResponsiveVar(styles, "gap", props.gap, resolveSpaceValue);
183
+ setResponsiveVar(styles, "flex-grow", props.grow, resolveFlexFlag);
184
+ setResponsiveVar(styles, "flex-shrink", props.shrink, resolveFlexFlag);
185
+ if (props.center !== void 0) {
186
+ setResponsiveVar(styles, "align-items", props.center, (value) => value ? "center" : void 0);
187
+ setResponsiveVar(styles, "justify-content", props.center, (value) => value ? "center" : void 0);
188
+ }
189
+ if (props.sticky) styles["--ak-position-base"] = "sticky";
190
+ setResponsiveVar(styles, "top", props.top, resolveSpaceValue);
191
+ setResponsiveVar(styles, "z-index", props.zIndex, (value) => String(resolveTokenValue(value, Z_INDEX_TOKEN_MAP)));
192
+ setResponsiveVar(styles, "background", props.background, (value) => String(resolveTokenValue(value, BACKGROUND_TOKEN_MAP)));
193
+ setResponsiveVar(styles, "border", props.border, resolveBorderValue);
194
+ setResponsiveVar(styles, "border-bottom", props.borderBottom, resolveBorderValue);
195
+ setResponsiveVar(styles, "border-right", props.borderRight, resolveBorderValue);
196
+ setResponsiveVar(styles, "border-radius", props.radius, resolveRadiusValue);
197
+ setResponsiveVar(styles, "box-shadow", props.shadow, resolveShadowValue);
198
+ setResponsiveVar(styles, "display", props.hide, (value) => value ? "none" : "flex");
199
+ }
200
+ function mergeLayoutStyles(layout, user) {
201
+ const merged = { ...layout };
202
+ if (user !== null && user !== void 0 && typeof user === "object") Object.assign(merged, user);
203
+ const mergedString = serializeCssDeclarations(merged);
204
+ if (typeof user === "string" && user.trim()) return mergedString ? `${mergedString};${user.trim()}` : user.trim();
205
+ return mergedString || void 0;
206
+ }
207
+ //#endregion
208
+ export { applyBlockLayoutStyles, mergeLayoutStyles, splitBlockLayoutProps };
209
+
210
+ //# sourceMappingURL=block-layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block-layout.js","names":[],"sources":["../../../src/components/_internal/block-layout.ts"],"sourcesContent":["import { serializeCssDeclarations } from \"./style\";\n\nexport type LayoutBreakpoint = \"base\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type ResponsiveValue<T> = T | Partial<Record<LayoutBreakpoint, T>>;\n\nexport type BlockSpace = \"0\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\" | \"page\";\nexport type BlockMargin = BlockSpace | \"auto\";\nexport type BlockSize =\n | \"auto\"\n | \"full\"\n | \"screen\"\n | \"content\"\n | \"sidebar\"\n | \"page\"\n | \"sm\"\n | \"md\"\n | \"lg\"\n | \"xl\";\nexport type BlockDirection = \"row\" | \"column\" | \"row-reverse\" | \"column-reverse\";\nexport type BlockRowFrom = Exclude<LayoutBreakpoint, \"base\">;\nexport type BlockAlign = \"start\" | \"end\" | \"center\" | \"stretch\" | \"baseline\";\nexport type BlockJustify = \"start\" | \"end\" | \"center\" | \"between\";\nexport type BlockBackground =\n | \"surface\"\n | \"muted\"\n | \"selected\"\n | \"canvas\"\n | \"raised\"\n | \"overlay\"\n | \"transparent\";\nexport type BlockRadius = true | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"round\";\nexport type BlockShadow = true | \"sm\" | \"md\" | \"lg\";\nexport type BlockZIndex =\n | \"header\"\n | \"sticky\"\n | \"fixed\"\n | \"dropdown\"\n | \"modal\"\n | \"popover\"\n | \"toast\"\n | \"tooltip\";\n\nexport type BlockLayoutProps = {\n padding?: ResponsiveValue<BlockSpace>;\n paddingX?: ResponsiveValue<BlockSpace>;\n paddingY?: ResponsiveValue<BlockSpace>;\n margin?: ResponsiveValue<BlockMargin>;\n marginX?: ResponsiveValue<BlockMargin>;\n marginY?: ResponsiveValue<BlockMargin>;\n width?: ResponsiveValue<BlockSize>;\n minWidth?: ResponsiveValue<BlockSize>;\n maxWidth?: ResponsiveValue<BlockSize>;\n height?: ResponsiveValue<BlockSize>;\n minHeight?: ResponsiveValue<BlockSize>;\n maxHeight?: ResponsiveValue<BlockSize>;\n rowFrom?: BlockRowFrom;\n direction?: ResponsiveValue<BlockDirection>;\n align?: ResponsiveValue<BlockAlign>;\n justify?: ResponsiveValue<BlockJustify>;\n gap?: ResponsiveValue<BlockSpace>;\n grow?: ResponsiveValue<boolean | number>;\n shrink?: ResponsiveValue<boolean | number>;\n center?: ResponsiveValue<boolean>;\n sticky?: boolean;\n top?: ResponsiveValue<BlockSpace>;\n zIndex?: ResponsiveValue<BlockZIndex>;\n background?: ResponsiveValue<BlockBackground>;\n border?: ResponsiveValue<boolean>;\n borderBottom?: ResponsiveValue<boolean>;\n borderRight?: ResponsiveValue<boolean>;\n radius?: ResponsiveValue<BlockRadius>;\n shadow?: ResponsiveValue<BlockShadow>;\n hide?: ResponsiveValue<boolean>;\n};\n\nconst BREAKPOINTS: readonly LayoutBreakpoint[] = [\"base\", \"sm\", \"md\", \"lg\", \"xl\"];\n\nconst SPACE_TOKEN_MAP: Record<string, string> = {\n \"0\": \"0\",\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 page: \"var(--ak-layout-page-gutter)\",\n};\n\nconst SIZE_TOKEN_MAP: Record<string, string> = {\n auto: \"auto\",\n full: \"100%\",\n screen: \"100dvh\",\n content: \"min(60vh, 36rem)\",\n sidebar: \"var(--ak-layout-sidebar-width)\",\n page: \"var(--ak-layout-content-max-width)\",\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 BACKGROUND_TOKEN_MAP: Record<string, string> = {\n canvas: \"var(--ak-color-bg)\",\n surface: \"var(--ak-color-surface)\",\n muted: \"var(--ak-color-surface-muted)\",\n raised: \"var(--ak-color-surface-raised)\",\n overlay: \"var(--ak-color-surface-overlay)\",\n selected: \"var(--ak-color-selected)\",\n transparent: \"transparent\",\n};\n\nconst RADIUS_TOKEN_MAP: Record<string, string> = {\n sm: \"var(--ak-radius-sm)\",\n md: \"var(--ak-radius-md)\",\n lg: \"var(--ak-radius-lg)\",\n xl: \"var(--ak-radius-xl)\",\n round: \"var(--ak-radius-round)\",\n};\n\nconst SHADOW_TOKEN_MAP: Record<string, string> = {\n sm: \"var(--ak-shadow-sm)\",\n md: \"var(--ak-shadow-md)\",\n lg: \"var(--ak-shadow-lg)\",\n};\n\nconst Z_INDEX_TOKEN_MAP: Record<string, string> = {\n header: \"var(--ak-z-sticky)\",\n sticky: \"var(--ak-z-sticky)\",\n fixed: \"var(--ak-z-fixed)\",\n dropdown: \"var(--ak-z-dropdown)\",\n modal: \"var(--ak-z-modal)\",\n popover: \"var(--ak-z-popover)\",\n toast: \"var(--ak-z-toast)\",\n tooltip: \"var(--ak-z-tooltip)\",\n};\n\nconst BORDER_VALUE = \"1px solid var(--ak-color-border-subtle)\";\n\nconst BLOCK_LAYOUT_KEYS = new Set<keyof BlockLayoutProps>([\n \"padding\",\n \"paddingX\",\n \"paddingY\",\n \"margin\",\n \"marginX\",\n \"marginY\",\n \"width\",\n \"minWidth\",\n \"maxWidth\",\n \"height\",\n \"minHeight\",\n \"maxHeight\",\n \"rowFrom\",\n \"direction\",\n \"align\",\n \"justify\",\n \"gap\",\n \"grow\",\n \"shrink\",\n \"center\",\n \"sticky\",\n \"top\",\n \"zIndex\",\n \"background\",\n \"border\",\n \"borderBottom\",\n \"borderRight\",\n \"radius\",\n \"shadow\",\n \"hide\",\n]);\n\nfunction isResponsiveValue<T>(\n value: ResponsiveValue<T> | undefined,\n): value is Partial<Record<LayoutBreakpoint, T>> {\n return Boolean(\n value &&\n typeof value === \"object\" &&\n !Array.isArray(value) &&\n BREAKPOINTS.some((breakpoint) => breakpoint in value),\n );\n}\n\nfunction 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 { base: value };\n}\n\nfunction resolveTokenValue(\n value: string | number,\n tokens: Record<string, string>,\n): string | number {\n if (typeof value === \"number\") return value;\n const trimmed = value.trim();\n return tokens[trimmed] ?? trimmed;\n}\n\nfunction resolveSpaceValue(value: string | number): string | number {\n return resolveTokenValue(value, SPACE_TOKEN_MAP);\n}\n\nfunction resolveSizeValue(value: string): string {\n return String(resolveTokenValue(value, SIZE_TOKEN_MAP));\n}\n\nfunction resolveAlignValue(value: BlockAlign): string {\n if (value === \"start\") return \"flex-start\";\n if (value === \"end\") return \"flex-end\";\n return value;\n}\n\nfunction resolveJustifyValue(value: BlockJustify): string {\n if (value === \"start\") return \"flex-start\";\n if (value === \"end\") return \"flex-end\";\n if (value === \"between\") return \"space-between\";\n return value;\n}\n\nfunction resolveFlexFlag(value: boolean | number): string | number {\n if (value === true) return 1;\n if (value === false) return 0;\n return value;\n}\n\nfunction resolveBorderValue(value: boolean): string | undefined {\n if (value === false) return \"0\";\n return BORDER_VALUE;\n}\n\nfunction resolveRadiusValue(value: BlockRadius): string | undefined {\n if (value === true) return RADIUS_TOKEN_MAP.md;\n return String(resolveTokenValue(value, RADIUS_TOKEN_MAP));\n}\n\nfunction resolveShadowValue(value: BlockShadow): string | undefined {\n if (value === true) return SHADOW_TOKEN_MAP.sm;\n return String(resolveTokenValue(value, SHADOW_TOKEN_MAP));\n}\n\nfunction setResponsiveVar<T>(\n styles: Record<string, string | number>,\n property: string,\n value: ResponsiveValue<T> | undefined,\n resolve: (value: T) => 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 === \"\") continue;\n styles[`--ak-${property}-${breakpoint}`] = resolved;\n }\n}\n\nexport function splitBlockLayoutProps<T extends Record<string, unknown>>(\n props: T,\n): {\n blockProps: Partial<BlockLayoutProps>;\n rest: Omit<T, keyof BlockLayoutProps>;\n} {\n const blockProps: Partial<BlockLayoutProps> = {};\n const rest: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(props)) {\n if (BLOCK_LAYOUT_KEYS.has(key as keyof BlockLayoutProps)) {\n (blockProps as Record<string, unknown>)[key] = value;\n } else {\n rest[key] = value;\n }\n }\n\n return { blockProps, rest: rest as Omit<T, keyof BlockLayoutProps> };\n}\n\nexport function applyBlockLayoutStyles(\n styles: Record<string, string | number>,\n props: Partial<BlockLayoutProps>,\n) {\n setResponsiveVar(styles, \"p\", props.padding, resolveSpaceValue);\n setResponsiveVar(styles, \"px\", props.paddingX, resolveSpaceValue);\n setResponsiveVar(styles, \"py\", props.paddingY, resolveSpaceValue);\n setResponsiveVar(styles, \"m\", props.margin, resolveSpaceValue);\n setResponsiveVar(styles, \"mx\", props.marginX, resolveSpaceValue);\n setResponsiveVar(styles, \"my\", props.marginY, resolveSpaceValue);\n\n setResponsiveVar(styles, \"width\", props.width, resolveSizeValue);\n setResponsiveVar(styles, \"min-width\", props.minWidth, resolveSizeValue);\n setResponsiveVar(styles, \"max-width\", props.maxWidth, resolveSizeValue);\n setResponsiveVar(styles, \"height\", props.height, resolveSizeValue);\n setResponsiveVar(styles, \"min-height\", props.minHeight, resolveSizeValue);\n setResponsiveVar(styles, \"max-height\", props.maxHeight, resolveSizeValue);\n\n if (props.rowFrom !== undefined) {\n styles[`--ak-flex-direction-${props.rowFrom}`] = \"row\";\n }\n setResponsiveVar(styles, \"flex-direction\", props.direction, (value) => value);\n setResponsiveVar(styles, \"align-items\", props.align, resolveAlignValue);\n setResponsiveVar(styles, \"justify-content\", props.justify, resolveJustifyValue);\n setResponsiveVar(styles, \"gap\", props.gap, resolveSpaceValue);\n setResponsiveVar(styles, \"flex-grow\", props.grow, resolveFlexFlag);\n setResponsiveVar(styles, \"flex-shrink\", props.shrink, resolveFlexFlag);\n\n if (props.center !== undefined) {\n setResponsiveVar(styles, \"align-items\", props.center, (value) =>\n value ? \"center\" : undefined,\n );\n setResponsiveVar(styles, \"justify-content\", props.center, (value) =>\n value ? \"center\" : undefined,\n );\n }\n\n if (props.sticky) {\n styles[\"--ak-position-base\"] = \"sticky\";\n }\n setResponsiveVar(styles, \"top\", props.top, resolveSpaceValue);\n setResponsiveVar(styles, \"z-index\", props.zIndex, (value) =>\n String(resolveTokenValue(value, Z_INDEX_TOKEN_MAP)),\n );\n\n setResponsiveVar(styles, \"background\", props.background, (value) =>\n String(resolveTokenValue(value, BACKGROUND_TOKEN_MAP)),\n );\n setResponsiveVar(styles, \"border\", props.border, resolveBorderValue);\n setResponsiveVar(styles, \"border-bottom\", props.borderBottom, resolveBorderValue);\n setResponsiveVar(styles, \"border-right\", props.borderRight, resolveBorderValue);\n setResponsiveVar(styles, \"border-radius\", props.radius, resolveRadiusValue);\n setResponsiveVar(styles, \"box-shadow\", props.shadow, resolveShadowValue);\n setResponsiveVar(styles, \"display\", props.hide, (value) => (value ? \"none\" : \"flex\"));\n}\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 = serializeCssDeclarations(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"],"mappings":"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"}
@@ -1 +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;AAC1F;AAMA,SAAgB,aAAa,UAA8B;CACzD,IAAI,MAAM,QAAQ,QAAQ,GACxB,OAAO;CAGT,OAAO,aAAa,KAAA,KAAa,aAAa,OAAO,CAAC,IAAI,CAAC,QAAQ;AACrE"}
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 function visit(value: unknown): void {\n if (Array.isArray(value)) {\n for (let index = 0; index < value.length; index += 1) {\n visit(value[index]);\n }\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 isEventHandlerLikeKey(key: string): boolean {\n return key.length >= 2 && key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110;\n}\n\nfunction compareKeys(left: string, right: string): number {\n if (left < right) return -1;\n if (left > right) return 1;\n return 0;\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\" || isEventHandlerLikeKey(key)) {\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] < keys[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(compareKeys);\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;AAC1F;AAMA,SAAgB,aAAa,UAA8B;CACzD,IAAI,MAAM,QAAQ,QAAQ,GACxB,OAAO;CAGT,OAAO,aAAa,KAAA,KAAa,aAAa,OAAO,CAAC,IAAI,CAAC,QAAQ;AACrE"}
@@ -1,4 +1,28 @@
1
1
  //#region src/components/_internal/style.ts
2
+ const cssPropertyNameCache = /* @__PURE__ */ new Map();
3
+ function cssPropertyName(name) {
4
+ let cached = cssPropertyNameCache.get(name);
5
+ if (cached !== void 0) return cached;
6
+ let result = "";
7
+ for (let index = 0; index < name.length; index += 1) {
8
+ const code = name.charCodeAt(index);
9
+ if (code >= 65 && code <= 90) result += `-${String.fromCharCode(code + 32)}`;
10
+ else result += name[index];
11
+ }
12
+ cssPropertyNameCache.set(name, result);
13
+ return result;
14
+ }
15
+ function serializeCssDeclarations(styles) {
16
+ const keys = Object.keys(styles);
17
+ let result = "";
18
+ for (const key of keys) {
19
+ const value = styles[key];
20
+ if (value === void 0 || value === null) continue;
21
+ const declaration = `${cssPropertyName(key)}:${String(value)}`;
22
+ result = result ? `${result};${declaration}` : declaration;
23
+ }
24
+ return result;
25
+ }
2
26
  const STYLE_REGISTRY_ATTR = "data-askr-style-registry";
3
27
  const STYLE_CLASS_PREFIX = "ak-style-";
4
28
  const styleClassCache = /* @__PURE__ */ new Map();
@@ -36,6 +60,6 @@ function styleDeclarationsToClass(declarations) {
36
60
  return className;
37
61
  }
38
62
  //#endregion
39
- export { styleDeclarationsToClass };
63
+ export { serializeCssDeclarations, styleDeclarationsToClass };
40
64
 
41
65
  //# sourceMappingURL=style.js.map
@@ -1 +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,IAAoB;AAChD,MAAM,yCAAyB,IAAI,IAAY;AAE/C,IAAI,mBAAmB;AAEvB,SAAS,qBAA8C;CACrD,IAAI,OAAO,aAAa,aAAa,OAAO;CAE5C,MAAM,WAAW,SAAS,cAAc,SAAS,oBAAoB,EAAE;CACvE,IAAI,oBAAoB,kBACtB,OAAO;CAGT,MAAM,eAAe,SAAS,cAAc,OAAO;CACnD,aAAa,aAAa,qBAAqB,MAAM;CACrD,CAAC,SAAS,QAAQ,SAAS,gBAAA,CAAiB,OAAO,YAAY;CAE/D,OAAO;AACT;AAEA,SAAS,sBAAsB,cAA8B;CAC3D,OAAO,aAAa,KAAK,CAAC,CAAC,QAAQ,UAAU,EAAE;AACjD;AAEA,SAAgB,yBAAyB,cAAsD;CAC7F,IAAI,OAAO,iBAAiB,UAAU,OAAO,KAAA;CAE7C,MAAM,aAAa,sBAAsB,YAAY;CACrD,IAAI,CAAC,YAAY,OAAO,KAAA;CAExB,IAAI,YAAY,gBAAgB,IAAI,UAAU;CAC9C,IAAI,cAAc,KAAA,GAAW;EAC3B,YAAY,GAAG,qBAAqB,EAAE;EACtC,gBAAgB,IAAI,YAAY,SAAS;CAC3C;CAEA,IAAI,CAAC,uBAAuB,IAAI,UAAU,GAAG;EAC3C,MAAM,eAAe,mBAAmB;EACxC,IAAI,cAAc;GAChB,MAAM,OAAO,IAAI,UAAU,GAAG,WAAW;GACzC,aAAa,cAAc,GAAG,aAAa,eAAe,GAAG,IAAI;GACjE,uBAAuB,IAAI,UAAU;EACvC;CACF;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"style.js","names":[],"sources":["../../../src/components/_internal/style.ts"],"sourcesContent":["const cssPropertyNameCache = new Map<string, string>();\n\nfunction cssPropertyName(name: string): string {\n let cached = cssPropertyNameCache.get(name);\n if (cached !== undefined) {\n return cached;\n }\n\n let result = \"\";\n\n for (let index = 0; index < name.length; index += 1) {\n const code = name.charCodeAt(index);\n\n if (code >= 65 && code <= 90) {\n result += `-${String.fromCharCode(code + 32)}`;\n } else {\n result += name[index];\n }\n }\n\n cssPropertyNameCache.set(name, result);\n return result;\n}\n\nexport function serializeCssDeclarations(styles: Record<string, unknown>): string {\n const keys = Object.keys(styles);\n let result = \"\";\n\n for (const key of keys) {\n const value = styles[key];\n if (value === undefined || value === null) {\n continue;\n }\n\n const declaration = `${cssPropertyName(key)}:${String(value)}`;\n result = result ? `${result};${declaration}` : declaration;\n }\n\n return result;\n}\n\nexport 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 = serializeCssDeclarations(style as Record<string, unknown>);\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":";AAAA,MAAM,uCAAuB,IAAI,IAAoB;AAErD,SAAS,gBAAgB,MAAsB;CAC7C,IAAI,SAAS,qBAAqB,IAAI,IAAI;CAC1C,IAAI,WAAW,KAAA,GACb,OAAO;CAGT,IAAI,SAAS;CAEb,KAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,QAAQ,SAAS,GAAG;EACnD,MAAM,OAAO,KAAK,WAAW,KAAK;EAElC,IAAI,QAAQ,MAAM,QAAQ,IACxB,UAAU,IAAI,OAAO,aAAa,OAAO,EAAE;OAE3C,UAAU,KAAK;CAEnB;CAEA,qBAAqB,IAAI,MAAM,MAAM;CACrC,OAAO;AACT;AAEA,SAAgB,yBAAyB,QAAyC;CAChF,MAAM,OAAO,OAAO,KAAK,MAAM;CAC/B,IAAI,SAAS;CAEb,KAAK,MAAM,OAAO,MAAM;EACtB,MAAM,QAAQ,OAAO;EACrB,IAAI,UAAU,KAAA,KAAa,UAAU,MACnC;EAGF,MAAM,cAAc,GAAG,gBAAgB,GAAG,EAAE,GAAG,OAAO,KAAK;EAC3D,SAAS,SAAS,GAAG,OAAO,GAAG,gBAAgB;CACjD;CAEA,OAAO;AACT;AAkBA,MAAM,sBAAsB;AAC5B,MAAM,qBAAqB;AAE3B,MAAM,kCAAkB,IAAI,IAAoB;AAChD,MAAM,yCAAyB,IAAI,IAAY;AAE/C,IAAI,mBAAmB;AAEvB,SAAS,qBAA8C;CACrD,IAAI,OAAO,aAAa,aAAa,OAAO;CAE5C,MAAM,WAAW,SAAS,cAAc,SAAS,oBAAoB,EAAE;CACvE,IAAI,oBAAoB,kBACtB,OAAO;CAGT,MAAM,eAAe,SAAS,cAAc,OAAO;CACnD,aAAa,aAAa,qBAAqB,MAAM;CACrD,CAAC,SAAS,QAAQ,SAAS,gBAAA,CAAiB,OAAO,YAAY;CAE/D,OAAO;AACT;AAEA,SAAS,sBAAsB,cAA8B;CAC3D,OAAO,aAAa,KAAK,CAAC,CAAC,QAAQ,UAAU,EAAE;AACjD;AAEA,SAAgB,yBAAyB,cAAsD;CAC7F,IAAI,OAAO,iBAAiB,UAAU,OAAO,KAAA;CAE7C,MAAM,aAAa,sBAAsB,YAAY;CACrD,IAAI,CAAC,YAAY,OAAO,KAAA;CAExB,IAAI,YAAY,gBAAgB,IAAI,UAAU;CAC9C,IAAI,cAAc,KAAA,GAAW;EAC3B,YAAY,GAAG,qBAAqB,EAAE;EACtC,gBAAgB,IAAI,YAAY,SAAS;CAC3C;CAEA,IAAI,CAAC,uBAAuB,IAAI,UAAU,GAAG;EAC3C,MAAM,eAAe,mBAAmB;EACxC,IAAI,cAAc;GAChB,MAAM,OAAO,IAAI,UAAU,GAAG,WAAW;GACzC,aAAa,cAAc,GAAG,aAAa,eAAe,GAAG,IAAI;GACjE,uBAAuB,IAAI,UAAU;EACvC;CACF;CAEA,OAAO;AACT"}
@@ -7,8 +7,8 @@ function resolveAlertRole(variant) {
7
7
  return "status";
8
8
  }
9
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;
10
+ const { actions, children, class: className, description, dismissLabel = "Dismiss alert", icon, onDismiss, ref, title, titleAs: TitleTag = "h3", variant = "default", role, ...rest } = props;
11
+ const shouldRenderDismiss = onDismiss !== void 0;
12
12
  const resolvedRole = role ?? resolveAlertRole(variant);
13
13
  const hasVariant = variant !== "default";
14
14
  return /* @__PURE__ */ jsxs("div", {
@@ -1 +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;AACT;AAEA,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,OAAO;CACrD,MAAM,aAAa,YAAY;CAE/B,OACE,qBAAC,OAAD;EACE,GAAI;EACC;EACL,OAAO,QACL,SACA,aAAa,SAAS,YAAY,KAAA,GAClC,sBAAsB,sBAAsB,KAAA,GAC5C,SACF;EACA,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;GACE,CAAA,IACH;GAEJ,qBAAC,OAAD;IAAK,OAAM;IAAgB,aAAU;cAArC;KACG,UAAU,KAAA,IACT,oBAAC,UAAD;MAAU,OAAM;MAAc,aAAU;gBACrC;KACO,CAAA,IACR;KAEH,gBAAgB,KAAA,IACf,oBAAC,KAAD;MAAG,OAAM;MAAoB,aAAU;gBACpC;KACA,CAAA,IACD;KAEH;KAEA,YAAY,KAAA,IACX,oBAAC,OAAD;MAAK,OAAM;MAAgB,aAAU;gBAClC;KACE,CAAA,IACH;IACD;;GAEJ,sBACC,oBAAC,OAAD;IAAK,OAAM;IAAc,aAAU;cACjC,oBAAC,OAAD;KAAO,OAAO;KAAc,SAAS;IAAY,CAAA;GAC9C,CAAA,IACH;EACD;;AAET"}
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 icon,\n onDismiss,\n ref,\n title,\n titleAs: TitleTag = \"h3\",\n variant = \"default\",\n role,\n ...rest\n } = props;\n const shouldRenderDismiss = 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;AACT;AAEA,SAAgB,MAAM,OAAgC;CACpD,MAAM,EACJ,SACA,UACA,OAAO,WACP,aACA,eAAe,iBACf,MACA,WACA,KACA,OACA,SAAS,WAAW,MACpB,UAAU,WACV,MACA,GAAG,SACD;CACJ,MAAM,sBAAsB,cAAc,KAAA;CAC1C,MAAM,eAAe,QAAQ,iBAAiB,OAAO;CACrD,MAAM,aAAa,YAAY;CAE/B,OACE,qBAAC,OAAD;EACE,GAAI;EACC;EACL,OAAO,QACL,SACA,aAAa,SAAS,YAAY,KAAA,GAClC,sBAAsB,sBAAsB,KAAA,GAC5C,SACF;EACA,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;GACE,CAAA,IACH;GAEJ,qBAAC,OAAD;IAAK,OAAM;IAAgB,aAAU;cAArC;KACG,UAAU,KAAA,IACT,oBAAC,UAAD;MAAU,OAAM;MAAc,aAAU;gBACrC;KACO,CAAA,IACR;KAEH,gBAAgB,KAAA,IACf,oBAAC,KAAD;MAAG,OAAM;MAAoB,aAAU;gBACpC;KACA,CAAA,IACD;KAEH;KAEA,YAAY,KAAA,IACX,oBAAC,OAAD;MAAK,OAAM;MAAgB,aAAU;gBAClC;KACE,CAAA,IACH;IACD;;GAEJ,sBACC,oBAAC,OAAD;IAAK,OAAM;IAAc,aAAU;cACjC,oBAAC,OAAD;KAAO,OAAO;KAAc,SAAS;IAAY,CAAA;GAC9C,CAAA,IACH;EACD;;AAET"}
@@ -9,7 +9,6 @@ type AlertProps = DivProps & {
9
9
  children?: unknown;
10
10
  description?: unknown;
11
11
  dismissLabel?: string;
12
- dismissible?: boolean;
13
12
  icon?: unknown;
14
13
  onDismiss?: () => void;
15
14
  title?: unknown;
@@ -0,0 +1,7 @@
1
+ import { AsideProps } from "./aside.types.js";
2
+
3
+ //#region src/components/aside/aside.d.ts
4
+ declare function Aside(props: AsideProps): JSX.Element;
5
+ //#endregion
6
+ export { Aside };
7
+ //# sourceMappingURL=aside.d.ts.map
@@ -0,0 +1,16 @@
1
+ import { Block } from "../block/block.js";
2
+ import { jsx } from "@askrjs/askr/jsx-runtime";
3
+ //#region src/components/aside/aside.tsx
4
+ function Aside(props) {
5
+ const { children, ...rest } = props;
6
+ return /* @__PURE__ */ jsx(Block, {
7
+ as: "aside",
8
+ ...rest,
9
+ "data-slot": "aside",
10
+ children
11
+ });
12
+ }
13
+ //#endregion
14
+ export { Aside };
15
+
16
+ //# sourceMappingURL=aside.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aside.js","names":[],"sources":["../../../src/components/aside/aside.tsx"],"sourcesContent":["import { Block } from \"../block\";\nimport type { AsideProps } from \"./aside.types\";\n\nexport function Aside(props: AsideProps): JSX.Element {\n const { children, ...rest } = props;\n\n return (\n <Block as=\"aside\" {...rest} data-slot=\"aside\">\n {children}\n </Block>\n );\n}\n"],"mappings":";;;AAGA,SAAgB,MAAM,OAAgC;CACpD,MAAM,EAAE,UAAU,GAAG,SAAS;CAE9B,OACE,oBAAC,OAAD;EAAO,IAAG;EAAQ,GAAI;EAAM,aAAU;EACnC;CACI,CAAA;AAEX"}
@@ -0,0 +1,6 @@
1
+ import { BlockElementProps } from "../block/block.types.js";
2
+ //#region src/components/aside/aside.types.d.ts
3
+ type AsideProps = Omit<BlockElementProps<"aside">, "as">;
4
+ //#endregion
5
+ export { AsideProps };
6
+ //# sourceMappingURL=aside.types.d.ts.map