asheeui 0.6.2 → 0.6.3

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 (281) hide show
  1. package/dist/AsheeUIProvider.d.ts +34 -0
  2. package/dist/AsheeUIProvider.d.ts.map +1 -1
  3. package/dist/components/accordion/Accordion.d.ts +55 -44
  4. package/dist/components/accordion/Accordion.d.ts.map +1 -1
  5. package/dist/components/accordion/Accordion.js +27 -27
  6. package/dist/components/accordion/accordion-config.d.ts +41 -12
  7. package/dist/components/accordion/accordion-config.d.ts.map +1 -1
  8. package/dist/components/accordion/accordion-styles.d.ts +20 -0
  9. package/dist/components/accordion/accordion-styles.d.ts.map +1 -1
  10. package/dist/components/accordion/accordion-styles.js +1 -1
  11. package/dist/components/autocomplete/Autocomplete.d.ts +59 -39
  12. package/dist/components/autocomplete/Autocomplete.d.ts.map +1 -1
  13. package/dist/components/autocomplete/Autocomplete.js +98 -91
  14. package/dist/components/autocomplete/autocomplete-config.d.ts +9 -62
  15. package/dist/components/autocomplete/autocomplete-config.d.ts.map +1 -1
  16. package/dist/components/autocomplete/autocomplete-config.js +6 -21
  17. package/dist/components/button/Button.d.ts +50 -51
  18. package/dist/components/button/Button.d.ts.map +1 -1
  19. package/dist/components/button/Button.js +19 -19
  20. package/dist/components/button/button-config.d.ts +23 -15
  21. package/dist/components/button/button-config.d.ts.map +1 -1
  22. package/dist/components/button/button-styles.d.ts +11 -1
  23. package/dist/components/button/button-styles.d.ts.map +1 -1
  24. package/dist/components/card/Card.d.ts +85 -43
  25. package/dist/components/card/Card.d.ts.map +1 -1
  26. package/dist/components/card/Card.js +49 -49
  27. package/dist/components/card/card-config.d.ts +35 -18
  28. package/dist/components/card/card-config.d.ts.map +1 -1
  29. package/dist/components/card/card-config.js +0 -2
  30. package/dist/components/card/card-styles.d.ts +17 -1
  31. package/dist/components/card/card-styles.d.ts.map +1 -1
  32. package/dist/components/carousel/Carousel.d.ts +107 -12
  33. package/dist/components/carousel/Carousel.d.ts.map +1 -1
  34. package/dist/components/carousel/Carousel.js +63 -64
  35. package/dist/components/carousel/carousel-config.d.ts +94 -7
  36. package/dist/components/carousel/carousel-config.d.ts.map +1 -1
  37. package/dist/components/carousel/carousel-config.js +6 -4
  38. package/dist/components/carousel/carousel-styles.d.ts +32 -1
  39. package/dist/components/carousel/carousel-styles.d.ts.map +1 -1
  40. package/dist/components/chip/Chip.d.ts +55 -34
  41. package/dist/components/chip/Chip.d.ts.map +1 -1
  42. package/dist/components/chip/Chip.js +71 -72
  43. package/dist/components/chip/chip-config.d.ts +29 -15
  44. package/dist/components/chip/chip-config.d.ts.map +1 -1
  45. package/dist/components/chip/chip-config.js +5 -6
  46. package/dist/components/chip/chip-styles.d.ts +21 -1
  47. package/dist/components/chip/chip-styles.d.ts.map +1 -1
  48. package/dist/components/date-picker/DatePicker.d.ts +166 -2
  49. package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
  50. package/dist/components/date-picker/DatePicker.js +110 -99
  51. package/dist/components/date-picker/date-picker-config.d.ts +31 -0
  52. package/dist/components/date-picker/date-picker-config.d.ts.map +1 -1
  53. package/dist/components/date-picker/date-picker-config.js +8 -16
  54. package/dist/components/date-picker/date-picker-styles.d.ts +21 -1
  55. package/dist/components/date-picker/date-picker-styles.d.ts.map +1 -1
  56. package/dist/components/date-picker/date-picker-styles.js +7 -11
  57. package/dist/components/drawer/Drawer.d.ts +97 -7
  58. package/dist/components/drawer/Drawer.d.ts.map +1 -1
  59. package/dist/components/drawer/Drawer.js +9 -9
  60. package/dist/components/drawer/drawer-config.d.ts +54 -1
  61. package/dist/components/drawer/drawer-config.d.ts.map +1 -1
  62. package/dist/components/drawer/drawer-styles.d.ts +21 -0
  63. package/dist/components/drawer/drawer-styles.d.ts.map +1 -1
  64. package/dist/components/field/FieldShell.d.ts +86 -0
  65. package/dist/components/field/FieldShell.d.ts.map +1 -1
  66. package/dist/components/field/field-config.d.ts +66 -3
  67. package/dist/components/field/field-config.d.ts.map +1 -1
  68. package/dist/components/field/field-config.js +2 -1
  69. package/dist/components/field/field-styles.d.ts +22 -0
  70. package/dist/components/field/field-styles.d.ts.map +1 -1
  71. package/dist/components/field/field-styles.js +10 -0
  72. package/dist/components/field/index.js +1 -0
  73. package/dist/components/image/Image.d.ts +35 -28
  74. package/dist/components/image/Image.d.ts.map +1 -1
  75. package/dist/components/image/Image.js +7 -7
  76. package/dist/components/image/image-config.d.ts +25 -7
  77. package/dist/components/image/image-config.d.ts.map +1 -1
  78. package/dist/components/image/image-styles.d.ts +9 -0
  79. package/dist/components/image/image-styles.d.ts.map +1 -1
  80. package/dist/components/input/Input.d.ts +117 -10
  81. package/dist/components/input/Input.d.ts.map +1 -1
  82. package/dist/components/input/Input.js +20 -20
  83. package/dist/components/input/PasswordInput.d.ts +48 -0
  84. package/dist/components/input/PasswordInput.d.ts.map +1 -1
  85. package/dist/components/input/input-config.d.ts +10 -1
  86. package/dist/components/input/input-config.d.ts.map +1 -1
  87. package/dist/components/input/input-config.js +5 -8
  88. package/dist/components/input/input-styles.d.ts +10 -0
  89. package/dist/components/input/input-styles.d.ts.map +1 -1
  90. package/dist/components/input/input-styles.js +5 -9
  91. package/dist/components/keyboard/OnScreenKeyboard.d.ts +58 -8
  92. package/dist/components/keyboard/OnScreenKeyboard.d.ts.map +1 -1
  93. package/dist/components/keyboard/OnScreenKeyboard.js +49 -48
  94. package/dist/components/keyboard/index.js +1 -1
  95. package/dist/components/keyboard/keyboard-config.d.ts +88 -3
  96. package/dist/components/keyboard/keyboard-config.d.ts.map +1 -1
  97. package/dist/components/keyboard/{default-keyboard-config.js → keyboard-config.js} +7 -1
  98. package/dist/components/keyboard/keyboard-context.d.ts +103 -13
  99. package/dist/components/keyboard/keyboard-context.d.ts.map +1 -1
  100. package/dist/components/keyboard/keyboard-context.js +66 -68
  101. package/dist/components/keyboard/use-keyboard-field.d.ts +37 -0
  102. package/dist/components/keyboard/use-keyboard-field.d.ts.map +1 -1
  103. package/dist/components/link/Link.d.ts +118 -9
  104. package/dist/components/link/Link.d.ts.map +1 -1
  105. package/dist/components/link/Link.js +29 -30
  106. package/dist/components/link/link-config.d.ts +58 -5
  107. package/dist/components/link/link-config.d.ts.map +1 -1
  108. package/dist/components/link/link-styles.d.ts +24 -4
  109. package/dist/components/link/link-styles.d.ts.map +1 -1
  110. package/dist/components/marquee/Marquee.d.ts +77 -8
  111. package/dist/components/marquee/Marquee.d.ts.map +1 -1
  112. package/dist/components/marquee/Marquee.js +5 -5
  113. package/dist/components/marquee/marquee-config.d.ts +74 -0
  114. package/dist/components/marquee/marquee-config.d.ts.map +1 -1
  115. package/dist/components/marquee/marquee-styles.d.ts +12 -0
  116. package/dist/components/marquee/marquee-styles.d.ts.map +1 -1
  117. package/dist/components/modal/Modal.d.ts +113 -25
  118. package/dist/components/modal/Modal.d.ts.map +1 -1
  119. package/dist/components/modal/Modal.js +75 -82
  120. package/dist/components/modal/modal-config.d.ts +59 -1
  121. package/dist/components/modal/modal-config.d.ts.map +1 -1
  122. package/dist/components/modal/modal-styles.d.ts +8 -1
  123. package/dist/components/modal/modal-styles.d.ts.map +1 -1
  124. package/dist/components/modal/modal-styles.js +4 -11
  125. package/dist/components/multi-select/MultiSelect.d.ts +152 -23
  126. package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
  127. package/dist/components/multi-select/MultiSelect.js +195 -217
  128. package/dist/components/multi-select/multi-select-config.d.ts +61 -23
  129. package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
  130. package/dist/components/multi-select/multi-select-config.js +16 -25
  131. package/dist/components/multi-select/multi-select-styles.d.ts +17 -0
  132. package/dist/components/multi-select/multi-select-styles.d.ts.map +1 -1
  133. package/dist/components/multi-select/multi-select-styles.js +9 -13
  134. package/dist/components/radio/Radio.d.ts +137 -13
  135. package/dist/components/radio/Radio.d.ts.map +1 -1
  136. package/dist/components/radio/Radio.js +66 -141
  137. package/dist/components/radio/RadioGroup.d.ts +88 -23
  138. package/dist/components/radio/RadioGroup.d.ts.map +1 -1
  139. package/dist/components/radio/RadioGroup.js +141 -66
  140. package/dist/components/radio/radio-config.d.ts +36 -11
  141. package/dist/components/radio/radio-config.d.ts.map +1 -1
  142. package/dist/components/radio/radio-config.js +9 -11
  143. package/dist/components/radio/radio-context.d.ts +44 -1
  144. package/dist/components/radio/radio-context.d.ts.map +1 -1
  145. package/dist/components/radio/radio-styles.d.ts +24 -1
  146. package/dist/components/radio/radio-styles.d.ts.map +1 -1
  147. package/dist/components/resizable-screen/ResizableScreen.d.ts +79 -32
  148. package/dist/components/resizable-screen/ResizableScreen.d.ts.map +1 -1
  149. package/dist/components/resizable-screen/ResizableScreen.js +77 -72
  150. package/dist/components/resizable-screen/resizable-screen-config.d.ts +62 -0
  151. package/dist/components/resizable-screen/resizable-screen-config.d.ts.map +1 -1
  152. package/dist/components/scrollbar/scrollbar-config.d.ts +44 -9
  153. package/dist/components/scrollbar/scrollbar-config.d.ts.map +1 -1
  154. package/dist/components/select/Select.d.ts +157 -17
  155. package/dist/components/select/Select.d.ts.map +1 -1
  156. package/dist/components/select/Select.js +141 -152
  157. package/dist/components/select/select-config.d.ts +26 -19
  158. package/dist/components/select/select-config.d.ts.map +1 -1
  159. package/dist/components/select/select-config.js +5 -21
  160. package/dist/components/select/select-styles.d.ts +10 -0
  161. package/dist/components/select/select-styles.d.ts.map +1 -1
  162. package/dist/components/select/select-styles.js +5 -9
  163. package/dist/components/select-menu/SelectMenu.d.ts +125 -8
  164. package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
  165. package/dist/components/select-menu/SelectMenu.js +107 -79
  166. package/dist/components/select-menu/index.d.ts +2 -0
  167. package/dist/components/select-menu/index.d.ts.map +1 -1
  168. package/dist/components/select-menu/index.js +1 -0
  169. package/dist/components/select-menu/select-menu-config.d.ts +82 -0
  170. package/dist/components/select-menu/select-menu-config.d.ts.map +1 -0
  171. package/dist/components/select-menu/select-menu-config.js +12 -0
  172. package/dist/components/sidebar/Sidebar.d.ts +151 -51
  173. package/dist/components/sidebar/Sidebar.d.ts.map +1 -1
  174. package/dist/components/sidebar/Sidebar.js +211 -232
  175. package/dist/components/sidebar/sidebar-config.d.ts +140 -21
  176. package/dist/components/sidebar/sidebar-config.d.ts.map +1 -1
  177. package/dist/components/sidebar/sidebar-config.js +9 -12
  178. package/dist/components/sidebar/sidebar-styles.d.ts +24 -0
  179. package/dist/components/sidebar/sidebar-styles.d.ts.map +1 -1
  180. package/dist/components/spinner/spinner-config.d.ts +15 -9
  181. package/dist/components/spinner/spinner-config.d.ts.map +1 -1
  182. package/dist/components/spinner/spinner-styles.d.ts +10 -3
  183. package/dist/components/spinner/spinner-styles.d.ts.map +1 -1
  184. package/dist/components/spinner/spinner.d.ts +27 -20
  185. package/dist/components/spinner/spinner.d.ts.map +1 -1
  186. package/dist/components/spinner/spinner.js +18 -18
  187. package/dist/components/switch/Switch.d.ts +109 -9
  188. package/dist/components/switch/Switch.d.ts.map +1 -1
  189. package/dist/components/switch/Switch.js +19 -19
  190. package/dist/components/switch/switch-config.d.ts +20 -6
  191. package/dist/components/switch/switch-config.d.ts.map +1 -1
  192. package/dist/components/switch/switch-config.js +8 -16
  193. package/dist/components/switch/switch-styles.d.ts +17 -0
  194. package/dist/components/switch/switch-styles.d.ts.map +1 -1
  195. package/dist/components/table/Table.d.ts +101 -28
  196. package/dist/components/table/Table.d.ts.map +1 -1
  197. package/dist/components/table/Table.js +56 -56
  198. package/dist/components/table/table-config.d.ts +75 -8
  199. package/dist/components/table/table-config.d.ts.map +1 -1
  200. package/dist/components/table/table-styles.d.ts +25 -6
  201. package/dist/components/table/table-styles.d.ts.map +1 -1
  202. package/dist/components/tabs/Tabs.d.ts +84 -31
  203. package/dist/components/tabs/Tabs.d.ts.map +1 -1
  204. package/dist/components/tabs/Tabs.js +44 -44
  205. package/dist/components/tabs/tabs-config.d.ts +102 -9
  206. package/dist/components/tabs/tabs-config.d.ts.map +1 -1
  207. package/dist/components/tabs/tabs-styles.d.ts +16 -4
  208. package/dist/components/tabs/tabs-styles.d.ts.map +1 -1
  209. package/dist/components/textarea/Textarea.d.ts +105 -11
  210. package/dist/components/textarea/Textarea.d.ts.map +1 -1
  211. package/dist/components/textarea/Textarea.js +27 -24
  212. package/dist/components/textarea/textarea-config.d.ts +21 -0
  213. package/dist/components/textarea/textarea-config.d.ts.map +1 -1
  214. package/dist/components/textarea/textarea-config.js +8 -16
  215. package/dist/components/textarea/textarea-styles.d.ts +9 -0
  216. package/dist/components/textarea/textarea-styles.d.ts.map +1 -1
  217. package/dist/components/textarea/textarea-styles.js +5 -9
  218. package/dist/components/toast/ToastItem.d.ts +58 -4
  219. package/dist/components/toast/ToastItem.d.ts.map +1 -1
  220. package/dist/components/toast/ToastItem.js +18 -18
  221. package/dist/components/toast/toast-config.d.ts +104 -6
  222. package/dist/components/toast/toast-config.d.ts.map +1 -1
  223. package/dist/components/toast/toast-context.d.ts +123 -11
  224. package/dist/components/toast/toast-context.d.ts.map +1 -1
  225. package/dist/components/toast/toast-context.js +19 -19
  226. package/dist/components/toast/toast-styles.d.ts +27 -5
  227. package/dist/components/toast/toast-styles.d.ts.map +1 -1
  228. package/dist/components/toast/use-pausable-timeout.d.ts +29 -0
  229. package/dist/components/toast/use-pausable-timeout.d.ts.map +1 -1
  230. package/dist/components/tooltip/Tooltip.d.ts +76 -16
  231. package/dist/components/tooltip/Tooltip.d.ts.map +1 -1
  232. package/dist/components/tooltip/Tooltip.js +25 -25
  233. package/dist/components/tooltip/tooltip-config.d.ts +73 -3
  234. package/dist/components/tooltip/tooltip-config.d.ts.map +1 -1
  235. package/dist/components/tooltip/tooltip-styles.d.ts +12 -0
  236. package/dist/components/tooltip/tooltip-styles.d.ts.map +1 -1
  237. package/dist/config/config.d.ts +50 -2
  238. package/dist/config/config.d.ts.map +1 -1
  239. package/dist/config/default-config.d.ts +5 -0
  240. package/dist/config/default-config.d.ts.map +1 -1
  241. package/dist/config/default-config.js +23 -0
  242. package/dist/config/define-config.d.ts +23 -0
  243. package/dist/config/define-config.d.ts.map +1 -1
  244. package/dist/config/resolve-color.d.ts +25 -0
  245. package/dist/config/resolve-color.d.ts.map +1 -1
  246. package/dist/config/resolve-config.d.ts +23 -0
  247. package/dist/config/resolve-config.d.ts.map +1 -1
  248. package/dist/index.css +43 -7
  249. package/dist/index.d.ts +30 -2
  250. package/dist/index.d.ts.map +1 -1
  251. package/dist/index.js +120 -115
  252. package/dist/libs/context.d.ts +50 -1
  253. package/dist/libs/context.d.ts.map +1 -1
  254. package/dist/libs/registry.d.ts +61 -5
  255. package/dist/libs/registry.d.ts.map +1 -1
  256. package/dist/libs/use-isomorphic-layout-effect.d.ts +18 -0
  257. package/dist/libs/use-isomorphic-layout-effect.d.ts.map +1 -1
  258. package/dist/shared/index.d.ts +3 -0
  259. package/dist/shared/index.d.ts.map +1 -0
  260. package/dist/shared/radius.d.ts +37 -1
  261. package/dist/shared/radius.d.ts.map +1 -1
  262. package/dist/shared/variant.d.ts +31 -0
  263. package/dist/shared/variant.d.ts.map +1 -1
  264. package/dist/shared/variant.js +132 -45
  265. package/dist/theme/color.d.ts +89 -1
  266. package/dist/theme/color.d.ts.map +1 -1
  267. package/dist/theme/controller.d.ts +121 -0
  268. package/dist/theme/controller.d.ts.map +1 -1
  269. package/dist/theme/controller.js +84 -0
  270. package/dist/theme/useTheme.d.ts +68 -0
  271. package/dist/theme/useTheme.d.ts.map +1 -1
  272. package/dist/theme/useTheme.js +23 -0
  273. package/dist/utils/index.d.ts +0 -7
  274. package/dist/utils/index.d.ts.map +1 -1
  275. package/dist/utils/resolve-token.d.ts +101 -0
  276. package/dist/utils/resolve-token.d.ts.map +1 -1
  277. package/package.json +1 -1
  278. package/dist/components/keyboard/default-keyboard-config.d.ts +0 -10
  279. package/dist/components/keyboard/default-keyboard-config.d.ts.map +0 -1
  280. package/dist/shared/size.d.ts +0 -2
  281. package/dist/shared/size.d.ts.map +0 -1
@@ -1,51 +1,138 @@
1
1
  "use client";
2
2
  import { cn as r } from "../utils/cn.js";
3
- const t = {
4
- none: "bg-background text-foreground",
5
- primary: "bg-primary text-secondary",
6
- secondary: "bg-secondary text-foreground",
7
- danger: "bg-danger text-secondary",
8
- warning: "bg-warning text-secondary",
9
- success: "bg-success text-secondary"
10
- }, e = {
11
- none: "bg-transparent text-foreground hover:bg-foreground/10",
12
- primary: "bg-transparent text-primary hover:bg-primary/10",
13
- secondary: "bg-transparent text-foreground hover:bg-secondary/10",
14
- danger: "bg-transparent text-danger hover:bg-danger/10",
15
- warning: "bg-transparent text-warning hover:bg-warning/10",
16
- success: "bg-transparent text-success hover:bg-success/10"
17
- }, g = {
18
- none: r(e.primary, "border-2 border-background"),
19
- primary: r(e.primary, "border-2 border-primary"),
20
- secondary: r(e.secondary, "border-2 border-border"),
21
- danger: r(e.danger, "border-2 border-danger"),
22
- warning: r(e.warning, "border-2 border-warning"),
23
- success: r(e.success, "border-2 border-success")
24
- }, b = {
25
- none: "bg-secondary/40 text-foreground border-2 border-transparent",
26
- primary: "bg-primary/10 text-primary border-2 border-primary/20",
27
- secondary: "bg-secondary/15 text-foreground border-2 border-secondary/30",
28
- danger: "bg-danger/10 text-danger border-2 border-danger/20",
29
- warning: "bg-warning/10 text-warning border-2 border-warning/20",
30
- success: "bg-success/10 text-success border-2 border-success/20"
31
- }, n = "border-b-2 border-t-0 border-x-0 rounded-none bg-transparent shadow-none", c = {
32
- none: r(n, "border-background text-foreground"),
33
- primary: r(n, "border-primary text-primary"),
34
- secondary: r(n, "border-secondary text-secondary"),
35
- danger: r(n, "border-danger text-danger"),
36
- warning: r(n, "border-warning text-warning"),
37
- success: r(n, "border-success text-success")
38
- }, d = {
39
- solid: t,
40
- ghost: e,
41
- bordered: g,
42
- faded: b,
43
- underlined: c
3
+ const e = "transition-all duration-200 ease-in-out", b = {
4
+ none: r(e, "bg-background text-foreground hover:bg-background/80"),
5
+ primary: r(e, "bg-primary text-foreground hover:bg-primary/80"),
6
+ secondary: r(
7
+ e,
8
+ "bg-secondary text-foreground hover:bg-secondary/80"
9
+ ),
10
+ danger: r(e, "bg-danger text-foreground hover:bg-danger/80"),
11
+ warning: r(e, "bg-warning text-foreground hover:bg-warning/80"),
12
+ success: r(e, "bg-success text-foreground hover:bg-success/80")
13
+ }, o = {
14
+ none: r(
15
+ e,
16
+ "bg-transparent text-foreground hover:bg-foreground/20 hover:text-foreground"
17
+ ),
18
+ primary: r(
19
+ e,
20
+ "bg-transparent text-primary hover:bg-primary/20 hover:text-primary"
21
+ ),
22
+ secondary: r(
23
+ e,
24
+ "bg-transparent text-foreground hover:bg-secondary/20 hover:text-foreground"
25
+ ),
26
+ danger: r(
27
+ e,
28
+ "bg-transparent text-danger hover:bg-danger/20 hover:text-danger"
29
+ ),
30
+ warning: r(
31
+ e,
32
+ "bg-transparent text-warning hover:bg-warning/20 hover:text-warning"
33
+ ),
34
+ success: r(
35
+ e,
36
+ "bg-transparent text-success hover:bg-success/20 hover:text-success"
37
+ )
38
+ }, t = {
39
+ none: r(
40
+ e,
41
+ o.primary,
42
+ "border-2 border-background hover:border-background/60"
43
+ ),
44
+ primary: r(
45
+ e,
46
+ o.primary,
47
+ "border-2 border-primary hover:border-primary/60"
48
+ ),
49
+ secondary: r(
50
+ e,
51
+ o.secondary,
52
+ "border-2 border-border hover:border-border/60"
53
+ ),
54
+ danger: r(
55
+ e,
56
+ o.danger,
57
+ "border-2 border-danger hover:border-danger/60"
58
+ ),
59
+ warning: r(
60
+ e,
61
+ o.warning,
62
+ "border-2 border-warning hover:border-warning/60"
63
+ ),
64
+ success: r(
65
+ e,
66
+ o.success,
67
+ "border-2 border-success hover:border-success/60"
68
+ )
69
+ }, c = {
70
+ none: r(
71
+ e,
72
+ "bg-secondary/40 text-foreground border-2 border-transparent hover:bg-secondary/60 hover:border-secondary/40"
73
+ ),
74
+ primary: r(
75
+ e,
76
+ "bg-primary/10 text-primary border-2 border-primary/20 hover:bg-primary/20 hover:border-primary/40"
77
+ ),
78
+ secondary: r(
79
+ e,
80
+ "bg-secondary/15 text-foreground border-2 border-secondary/30 hover:bg-secondary/25 hover:border-secondary/50"
81
+ ),
82
+ danger: r(
83
+ e,
84
+ "bg-danger/10 text-danger border-2 border-danger/20 hover:bg-danger/20 hover:border-danger/40"
85
+ ),
86
+ warning: r(
87
+ e,
88
+ "bg-warning/10 text-warning border-2 border-warning/20 hover:bg-warning/20 hover:border-warning/40"
89
+ ),
90
+ success: r(
91
+ e,
92
+ "bg-success/10 text-success border-2 border-success/20 hover:bg-success/20 hover:border-success/40"
93
+ )
94
+ }, n = "border-b-2 border-t-0 border-x-0 rounded-none bg-transparent shadow-none", i = {
95
+ none: r(
96
+ e,
97
+ n,
98
+ "border-background text-foreground hover:border-background/80"
99
+ ),
100
+ primary: r(
101
+ e,
102
+ n,
103
+ "border-primary text-primary hover:border-primary/80"
104
+ ),
105
+ secondary: r(
106
+ e,
107
+ n,
108
+ "border-secondary text-secondary hover:border-secondary/80"
109
+ ),
110
+ danger: r(
111
+ e,
112
+ n,
113
+ "border-danger text-danger hover:border-danger/80"
114
+ ),
115
+ warning: r(
116
+ e,
117
+ n,
118
+ "border-warning text-warning hover:border-warning/80"
119
+ ),
120
+ success: r(
121
+ e,
122
+ n,
123
+ "border-success text-success hover:border-success/80"
124
+ )
125
+ }, a = {
126
+ solid: b,
127
+ ghost: o,
128
+ bordered: t,
129
+ faded: c,
130
+ underlined: i
44
131
  };
45
- function y(a, s) {
46
- var o;
47
- return ((o = d[a]) == null ? void 0 : o[s]) ?? d.bordered.secondary;
132
+ function h(s, g) {
133
+ var d;
134
+ return ((d = a[s]) == null ? void 0 : d[g]) ?? a.bordered.secondary;
48
135
  }
49
136
  export {
50
- y as resolveVariantClass
137
+ h as resolveVariantClass
51
138
  };
@@ -1,22 +1,91 @@
1
+ /**
2
+ * Color configuration types for AsheeUI's theming system.
3
+ * This file defines the structure of theme color palettes, including
4
+ * the required built-in themes (light and dark) and optional custom
5
+ * theme extensions. It provides the type foundation for the color
6
+ * configuration that powers the component library's visual system.
7
+ */
8
+ /**
9
+ * The built-in theme names that are always available in AsheeUI.
10
+ * "light" and "dark" are the core themes that every installation provides.
11
+ */
1
12
  export type KnownThemeName = "light" | "dark";
13
+ /**
14
+ * Registry of available color themes in AsheeUI.
15
+ * Currently supports the built-in "light" and "dark" themes.
16
+ * This interface serves as the constraint for theme name resolution.
17
+ */
2
18
  export interface AsheeColorRegistry {
3
19
  light: true;
4
20
  dark: true;
5
21
  }
22
+ /**
23
+ * All available theme names in AsheeUI.
24
+ * This is derived from the AsheeColorRegistry and includes both
25
+ * built-in themes and any custom themes defined by the user.
26
+ */
6
27
  export type ThemeName = keyof AsheeColorRegistry;
28
+ /**
29
+ * The complete set of color variables required for a single theme.
30
+ * These colors are used throughout the component library for
31
+ * backgrounds, text, borders, interactive elements, and status indicators.
32
+ */
7
33
  export interface ColorVariant {
34
+ /**
35
+ * The main background color of the application.
36
+ * Used for page backgrounds and container surfaces.
37
+ */
8
38
  background: string;
39
+ /**
40
+ * The primary text color.
41
+ * Used for body text and other foreground content.
42
+ */
9
43
  foreground: string;
44
+ /**
45
+ * The primary brand or interactive color.
46
+ * Used for buttons, links, and other interactive elements.
47
+ */
10
48
  primary: string;
49
+ /**
50
+ * The secondary surface color.
51
+ * Used for cards, panels, and other elevated surfaces.
52
+ */
11
53
  secondary: string;
54
+ /**
55
+ * The border color.
56
+ * Used for separators, input borders, and dividing lines.
57
+ */
12
58
  border: string;
59
+ /**
60
+ * The danger or error color.
61
+ * Used for destructive actions and error states.
62
+ */
13
63
  danger: string;
64
+ /**
65
+ * The warning color.
66
+ * Used for cautionary states and warnings.
67
+ */
14
68
  warning: string;
69
+ /**
70
+ * The success color.
71
+ * Used for success states and positive feedback.
72
+ */
15
73
  success: string;
74
+ /**
75
+ * The scrollbar thumb color.
76
+ * Used for the draggable handle of scrollbars.
77
+ */
16
78
  scrollbarThumb: string;
79
+ /**
80
+ * The scrollbar track color.
81
+ * Used for the background track of scrollbars.
82
+ */
17
83
  scrollbarTrack: string;
18
84
  }
19
- /** Built-in colors map required by the core library */
85
+ /**
86
+ * Built-in colors map required by the core library.
87
+ * Both "light" and "dark" themes must be fully defined.
88
+ */
20
89
  export type DefaultColorConfig = Record<KnownThemeName, ColorVariant>;
21
90
  /**
22
91
  * Full color configuration.
@@ -24,11 +93,30 @@ export type DefaultColorConfig = Record<KnownThemeName, ColorVariant>;
24
93
  * on default/unmerged configs, but enforced via ExternalColorConfig.
25
94
  */
26
95
  export type ColorConfig = Record<KnownThemeName, ColorVariant> & Partial<Record<Exclude<ThemeName, KnownThemeName>, ColorVariant>>;
96
+ /**
97
+ * A color variant that can be partially defined.
98
+ * Custom themes can extend a known theme to inherit its colors.
99
+ */
27
100
  export type ExternalColorVariant = Partial<ColorVariant> & {
101
+ /**
102
+ * Optional theme to extend.
103
+ * When provided, the custom theme will inherit colors from the specified
104
+ * built-in theme, with any explicitly defined colors overriding the inherited values.
105
+ */
28
106
  extends?: KnownThemeName;
29
107
  };
30
108
  type CustomThemeName = Exclude<ThemeName, KnownThemeName>;
109
+ /**
110
+ * External color configuration format.
111
+ * Built-in themes can be partially overridden, while custom themes
112
+ * must provide at least a partial color variant (with optional extension).
113
+ */
31
114
  export type ExternalColorConfig = Partial<Record<KnownThemeName, Partial<ColorVariant>>> & Record<CustomThemeName, ExternalColorVariant>;
115
+ /**
116
+ * The default color configuration for AsheeUI.
117
+ * Provides complete color variants for both light and dark themes
118
+ * with carefully chosen default values that work out of the box.
119
+ */
32
120
  export declare const defaultColorConfig: DefaultColorConfig;
33
121
  export {};
34
122
  //# sourceMappingURL=color.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/theme/color.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,CAAC;AAE9C,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,IAAI,CAAC;IACZ,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,kB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;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAyBhC,CAAC"}
@@ -1,17 +1,72 @@
1
1
  import { ThemeName } from './color';
2
+ /**
3
+ * A theme selection that can be either a specific theme name or the special
4
+ * "system" value, which resolves to either light or dark based on the user's
5
+ * system preference.
6
+ */
2
7
  export type ThemeSelection = ThemeName | "system";
8
+ /**
9
+ * Local storage key used to persist the user's theme preference.
10
+ */
3
11
  export declare const THEME_STORAGE_KEY = "ashee-theme";
12
+ /**
13
+ * Function type for theme change listeners.
14
+ */
4
15
  type Listener = () => void;
16
+ /**
17
+ * Input configuration required to initialize the theme controller.
18
+ * Provides the default theme and the list of available themes.
19
+ */
5
20
  export interface ThemeConfigInput {
21
+ /**
22
+ * The default theme to use when no user preference is stored or when
23
+ * the stored preference is invalid. This can be a specific theme name
24
+ * or "system" to follow the system preference.
25
+ */
6
26
  defaultTheme: ThemeSelection;
27
+ /**
28
+ * The list of theme names that are available in the application.
29
+ * This is used to validate stored preferences and to determine
30
+ * which themes can be toggled through the toggleTheme method.
31
+ */
7
32
  themes: readonly string[];
8
33
  }
34
+ /**
35
+ * Manages theme state, persistence, and system preference detection.
36
+ * This class handles the core logic of selecting, resolving, and applying
37
+ * themes, including storing preferences in localStorage and responding to
38
+ * system dark mode changes. It follows the observer pattern to notify
39
+ * subscribers when the theme changes.
40
+ */
9
41
  declare class ThemeController {
42
+ /**
43
+ * The user's selected theme preference, which may be "system"
44
+ * or a specific theme name.
45
+ */
10
46
  private selection;
47
+ /**
48
+ * The final resolved theme name after applying the selection
49
+ * and resolving "system" to either "light" or "dark".
50
+ */
11
51
  private resolved;
52
+ /**
53
+ * The default theme configured when the controller was initialized.
54
+ * Used as a fallback when the stored preference is invalid.
55
+ */
12
56
  private defaultTheme;
57
+ /**
58
+ * The list of available themes in the application.
59
+ * Used for validation and cycling through themes.
60
+ */
13
61
  private availableThemes;
62
+ /**
63
+ * Set of listener functions that are called when the theme changes.
64
+ */
14
65
  private listeners;
66
+ /**
67
+ * MediaQueryList for detecting system dark mode preference.
68
+ * Null when running in a non-browser environment.
69
+ */
15
70
  private mediaQuery;
16
71
  constructor();
17
72
  /**
@@ -27,24 +82,90 @@ declare class ThemeController {
27
82
  * Seeds the default theme. Kept for backward compatibility - prefer
28
83
  * `configure()`, which also validates the stored selection against the
29
84
  * available theme map.
85
+ *
86
+ * @deprecated Use `configure()` instead for complete initialization.
30
87
  */
31
88
  setDefault: (theme: ThemeSelection) => void;
89
+ /**
90
+ * Returns the current theme selection.
91
+ * @returns The current selected theme, which may be "system" or a specific theme name.
92
+ */
32
93
  getSelection: () => ThemeSelection;
94
+ /**
95
+ * Returns the resolved theme name after applying the selection.
96
+ * If the selection is "system", this will resolve to either "light" or "dark"
97
+ * based on the system preference.
98
+ * @returns The resolved theme name.
99
+ */
33
100
  getResolvedTheme: () => ThemeName;
101
+ /**
102
+ * Sets the theme selection and persists it to localStorage.
103
+ * The provided selection is validated and sanitized before applying.
104
+ * @param selection - The theme to select, either "system" or a theme name.
105
+ */
34
106
  setTheme: (selection: ThemeSelection) => void;
107
+ /**
108
+ * Subscribes a listener to theme changes.
109
+ * The listener will be called whenever the theme selection or resolved theme changes.
110
+ * @param listener - The function to call when the theme changes.
111
+ * @returns An unsubscribe function that removes the listener.
112
+ */
35
113
  subscribe: (listener: Listener) => (() => void);
114
+ /**
115
+ * Returns the list of available theme names.
116
+ * @returns The list of available themes configured in the controller.
117
+ */
36
118
  getAvailableThemes: () => readonly string[];
37
119
  /**
38
120
  * Cycles to the next theme in sequence (including "system" mode by default).
39
121
  * Loops back to the start when reaching the end of the available themes list.
122
+ * The "system" option is not included in the toggle sequence; only specific
123
+ * theme names are cycled through.
40
124
  */
41
125
  toggleTheme: () => void;
126
+ /**
127
+ * Handles system dark mode preference changes.
128
+ * Only re-applies the theme if the current selection is "system",
129
+ * ensuring the resolved theme stays in sync with system changes.
130
+ */
42
131
  private handleSystemChange;
132
+ /**
133
+ * Validates a theme selection and returns a valid fallback if necessary.
134
+ * @param selection - The theme selection to sanitize.
135
+ * @returns A valid theme selection, falling back to the default theme
136
+ * if the provided selection is invalid.
137
+ */
43
138
  private sanitize;
139
+ /**
140
+ * Checks whether a theme selection is valid.
141
+ * "system" is always valid. Other theme names are valid if they exist
142
+ * in the available themes list. If no available themes are configured,
143
+ * any selection is considered valid.
144
+ * @param selection - The theme selection to validate.
145
+ * @returns True if the selection is valid, false otherwise.
146
+ */
44
147
  private isValid;
148
+ /**
149
+ * Resolves a theme selection to an actual theme name.
150
+ * If the selection is "system", resolves based on the system preference.
151
+ * @param selection - The theme selection to resolve.
152
+ * @returns The resolved theme name.
153
+ */
45
154
  private resolve;
155
+ /**
156
+ * Applies the current theme selection by updating the DOM.
157
+ * This method sanitizes the selection, resolves it to a theme name,
158
+ * and applies the appropriate CSS class to the document root.
159
+ * It ensures that only valid theme classes are applied and removes
160
+ * any previously applied theme classes.
161
+ */
46
162
  private applySelection;
47
163
  }
164
+ /**
165
+ * Singleton instance of the theme controller.
166
+ * This instance manages the global theme state and should be used
167
+ * throughout the application for theme operations.
168
+ */
48
169
  export declare const themeController: ThemeController;
49
170
  export {};
50
171
  //# sourceMappingURL=controller.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/theme/controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,QAAQ,CAAC;AAElD,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAI/C,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAC;AAE3B,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,cAAc,CAAC;IAC7B,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B;AAED,cAAM,eAAe;IACnB,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,YAAY,CAA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AAC,SAAS,CAA2B;IAE5C;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAsB;IAEtC;;;OAGG;IACH,OAAO,CAAC,YAAY,CAA2B;IAE/C;;;OAGG;IACH,OAAO,CAAC,eAAe,CAAyB;IAEhD;;OAEG;IACH,OAAO,CAAC,SAAS,CAAuB;IAExC;;;OAGG;IACH,OAAO,CAAC,UAAU,CAA+B;;IASjD;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,gBAAgB,GAAG,IAAI;IAwC3D;;;;;;OAMG;IACH,UAAU,UAAW,cAAc,KAAG,IAAI,CAExC;IAEF;;;OAGG;IACH,YAAY,QAAO,cAAc,CAAmB;IAEpD;;;;;OAKG;IACH,gBAAgB,QAAO,SAAS,CAAkB;IAElD;;;;OAIG;IACH,QAAQ,cAAe,cAAc,KAAG,IAAI,CAS1C;IAEF;;;;;OAKG;IACH,SAAS,aAAc,QAAQ,KAAG,CAAC,MAAM,IAAI,CAAC,CAG5C;IAEF;;;OAGG;IACH,kBAAkB,QAAO,SAAS,MAAM,EAAE,CAAyB;IAEnE;;;;;OAKG;IACH,WAAW,QAAO,IAAI,CAWpB;IAEF;;;;OAIG;IACH,OAAO,CAAC,kBAAkB,CAMxB;IAEF;;;;;OAKG;IACH,OAAO,CAAC,QAAQ;IAKhB;;;;;;;OAOG;IACH,OAAO,CAAC,OAAO;IAOf;;;;;OAKG;IACH,OAAO,CAAC,OAAO;IAKf;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;CA+BvB;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,iBAAwB,CAAC"}
@@ -5,33 +5,85 @@ var s = (n, e, t) => c(n, typeof e != "symbol" ? e + "" : e, t);
5
5
  const a = "ashee-theme", d = "(prefers-color-scheme: dark)", h = "theme-";
6
6
  class m {
7
7
  constructor() {
8
+ /**
9
+ * The user's selected theme preference, which may be "system"
10
+ * or a specific theme name.
11
+ */
8
12
  s(this, "selection", "light");
13
+ /**
14
+ * The final resolved theme name after applying the selection
15
+ * and resolving "system" to either "light" or "dark".
16
+ */
9
17
  s(this, "resolved", "light");
18
+ /**
19
+ * The default theme configured when the controller was initialized.
20
+ * Used as a fallback when the stored preference is invalid.
21
+ */
10
22
  s(this, "defaultTheme", "light");
23
+ /**
24
+ * The list of available themes in the application.
25
+ * Used for validation and cycling through themes.
26
+ */
11
27
  s(this, "availableThemes", []);
28
+ /**
29
+ * Set of listener functions that are called when the theme changes.
30
+ */
12
31
  s(this, "listeners", /* @__PURE__ */ new Set());
32
+ /**
33
+ * MediaQueryList for detecting system dark mode preference.
34
+ * Null when running in a non-browser environment.
35
+ */
13
36
  s(this, "mediaQuery", null);
14
37
  /**
15
38
  * Seeds the default theme. Kept for backward compatibility - prefer
16
39
  * `configure()`, which also validates the stored selection against the
17
40
  * available theme map.
41
+ *
42
+ * @deprecated Use `configure()` instead for complete initialization.
18
43
  */
19
44
  s(this, "setDefault", (e) => {
20
45
  this.configure({ defaultTheme: e, themes: this.availableThemes });
21
46
  });
47
+ /**
48
+ * Returns the current theme selection.
49
+ * @returns The current selected theme, which may be "system" or a specific theme name.
50
+ */
22
51
  s(this, "getSelection", () => this.selection);
52
+ /**
53
+ * Returns the resolved theme name after applying the selection.
54
+ * If the selection is "system", this will resolve to either "light" or "dark"
55
+ * based on the system preference.
56
+ * @returns The resolved theme name.
57
+ */
23
58
  s(this, "getResolvedTheme", () => this.resolved);
59
+ /**
60
+ * Sets the theme selection and persists it to localStorage.
61
+ * The provided selection is validated and sanitized before applying.
62
+ * @param selection - The theme to select, either "system" or a theme name.
63
+ */
24
64
  s(this, "setTheme", (e) => {
25
65
  const t = this.sanitize(e);
26
66
  this.selection = t, typeof window < "u" && window.localStorage.setItem(a, t), this.applySelection(), this.listeners.forEach((i) => {
27
67
  i();
28
68
  });
29
69
  });
70
+ /**
71
+ * Subscribes a listener to theme changes.
72
+ * The listener will be called whenever the theme selection or resolved theme changes.
73
+ * @param listener - The function to call when the theme changes.
74
+ * @returns An unsubscribe function that removes the listener.
75
+ */
30
76
  s(this, "subscribe", (e) => (this.listeners.add(e), () => this.listeners.delete(e)));
77
+ /**
78
+ * Returns the list of available theme names.
79
+ * @returns The list of available themes configured in the controller.
80
+ */
31
81
  s(this, "getAvailableThemes", () => this.availableThemes);
32
82
  /**
33
83
  * Cycles to the next theme in sequence (including "system" mode by default).
34
84
  * Loops back to the start when reaching the end of the available themes list.
85
+ * The "system" option is not included in the toggle sequence; only specific
86
+ * theme names are cycled through.
35
87
  */
36
88
  s(this, "toggleTheme", () => {
37
89
  const e = Array.from(new Set(this.availableThemes)).filter(
@@ -39,6 +91,11 @@ class m {
39
91
  ), t = e.indexOf(this.selection), i = t === -1 ? 0 : (t + 1) % e.length;
40
92
  this.setTheme(e[i]);
41
93
  });
94
+ /**
95
+ * Handles system dark mode preference changes.
96
+ * Only re-applies the theme if the current selection is "system",
97
+ * ensuring the resolved theme stays in sync with system changes.
98
+ */
42
99
  s(this, "handleSystemChange", () => {
43
100
  this.selection === "system" && (this.applySelection(), this.listeners.forEach((e) => {
44
101
  e();
@@ -70,16 +127,43 @@ class m {
70
127
  o();
71
128
  }), console.log("[Theme] Notified all listeners.");
72
129
  }
130
+ /**
131
+ * Validates a theme selection and returns a valid fallback if necessary.
132
+ * @param selection - The theme selection to sanitize.
133
+ * @returns A valid theme selection, falling back to the default theme
134
+ * if the provided selection is invalid.
135
+ */
73
136
  sanitize(e) {
74
137
  return this.isValid(e) ? e : this.defaultTheme;
75
138
  }
139
+ /**
140
+ * Checks whether a theme selection is valid.
141
+ * "system" is always valid. Other theme names are valid if they exist
142
+ * in the available themes list. If no available themes are configured,
143
+ * any selection is considered valid.
144
+ * @param selection - The theme selection to validate.
145
+ * @returns True if the selection is valid, false otherwise.
146
+ */
76
147
  isValid(e) {
77
148
  return e === "system" ? !0 : this.availableThemes.length > 0 ? this.availableThemes.includes(e) : !0;
78
149
  }
150
+ /**
151
+ * Resolves a theme selection to an actual theme name.
152
+ * If the selection is "system", resolves based on the system preference.
153
+ * @param selection - The theme selection to resolve.
154
+ * @returns The resolved theme name.
155
+ */
79
156
  resolve(e) {
80
157
  var t;
81
158
  return e !== "system" ? e : (t = this.mediaQuery) != null && t.matches ? "dark" : "light";
82
159
  }
160
+ /**
161
+ * Applies the current theme selection by updating the DOM.
162
+ * This method sanitizes the selection, resolves it to a theme name,
163
+ * and applies the appropriate CSS class to the document root.
164
+ * It ensures that only valid theme classes are applied and removes
165
+ * any previously applied theme classes.
166
+ */
83
167
  applySelection() {
84
168
  const e = this.sanitize(this.selection);
85
169
  let t = this.resolve(e);