@raintonic/formaui 0.2.0

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 (240) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +145 -0
  3. package/fesm2022/raintonic-formaui-cdk-drag-drop.mjs +806 -0
  4. package/fesm2022/raintonic-formaui-cdk-drag-drop.mjs.map +1 -0
  5. package/fesm2022/raintonic-formaui-cdk-form-field.mjs +86 -0
  6. package/fesm2022/raintonic-formaui-cdk-form-field.mjs.map +1 -0
  7. package/fesm2022/raintonic-formaui-cdk-overlay.mjs +1757 -0
  8. package/fesm2022/raintonic-formaui-cdk-overlay.mjs.map +1 -0
  9. package/fesm2022/raintonic-formaui-cdk-virtual-scroll.mjs +287 -0
  10. package/fesm2022/raintonic-formaui-cdk-virtual-scroll.mjs.map +1 -0
  11. package/fesm2022/raintonic-formaui-components-accordion.mjs +217 -0
  12. package/fesm2022/raintonic-formaui-components-accordion.mjs.map +1 -0
  13. package/fesm2022/raintonic-formaui-components-alert.mjs +161 -0
  14. package/fesm2022/raintonic-formaui-components-alert.mjs.map +1 -0
  15. package/fesm2022/raintonic-formaui-components-autocomplete.mjs +726 -0
  16. package/fesm2022/raintonic-formaui-components-autocomplete.mjs.map +1 -0
  17. package/fesm2022/raintonic-formaui-components-avatar.mjs +92 -0
  18. package/fesm2022/raintonic-formaui-components-avatar.mjs.map +1 -0
  19. package/fesm2022/raintonic-formaui-components-badge.mjs +107 -0
  20. package/fesm2022/raintonic-formaui-components-badge.mjs.map +1 -0
  21. package/fesm2022/raintonic-formaui-components-big-menu.mjs +68 -0
  22. package/fesm2022/raintonic-formaui-components-big-menu.mjs.map +1 -0
  23. package/fesm2022/raintonic-formaui-components-breadcrumb.mjs +55 -0
  24. package/fesm2022/raintonic-formaui-components-breadcrumb.mjs.map +1 -0
  25. package/fesm2022/raintonic-formaui-components-button-group.mjs +103 -0
  26. package/fesm2022/raintonic-formaui-components-button-group.mjs.map +1 -0
  27. package/fesm2022/raintonic-formaui-components-button.mjs +241 -0
  28. package/fesm2022/raintonic-formaui-components-button.mjs.map +1 -0
  29. package/fesm2022/raintonic-formaui-components-card.mjs +270 -0
  30. package/fesm2022/raintonic-formaui-components-card.mjs.map +1 -0
  31. package/fesm2022/raintonic-formaui-components-checkbox.mjs +295 -0
  32. package/fesm2022/raintonic-formaui-components-checkbox.mjs.map +1 -0
  33. package/fesm2022/raintonic-formaui-components-data-table.mjs +631 -0
  34. package/fesm2022/raintonic-formaui-components-data-table.mjs.map +1 -0
  35. package/fesm2022/raintonic-formaui-components-date-picker.mjs +1331 -0
  36. package/fesm2022/raintonic-formaui-components-date-picker.mjs.map +1 -0
  37. package/fesm2022/raintonic-formaui-components-divider.mjs +41 -0
  38. package/fesm2022/raintonic-formaui-components-divider.mjs.map +1 -0
  39. package/fesm2022/raintonic-formaui-components-drawer.mjs +190 -0
  40. package/fesm2022/raintonic-formaui-components-drawer.mjs.map +1 -0
  41. package/fesm2022/raintonic-formaui-components-dynamic-form.mjs +266 -0
  42. package/fesm2022/raintonic-formaui-components-dynamic-form.mjs.map +1 -0
  43. package/fesm2022/raintonic-formaui-components-empty-state.mjs +33 -0
  44. package/fesm2022/raintonic-formaui-components-empty-state.mjs.map +1 -0
  45. package/fesm2022/raintonic-formaui-components-file-upload.mjs +246 -0
  46. package/fesm2022/raintonic-formaui-components-file-upload.mjs.map +1 -0
  47. package/fesm2022/raintonic-formaui-components-form-field.mjs +482 -0
  48. package/fesm2022/raintonic-formaui-components-form-field.mjs.map +1 -0
  49. package/fesm2022/raintonic-formaui-components-icon.mjs +117 -0
  50. package/fesm2022/raintonic-formaui-components-icon.mjs.map +1 -0
  51. package/fesm2022/raintonic-formaui-components-input.mjs +327 -0
  52. package/fesm2022/raintonic-formaui-components-input.mjs.map +1 -0
  53. package/fesm2022/raintonic-formaui-components-list.mjs +149 -0
  54. package/fesm2022/raintonic-formaui-components-list.mjs.map +1 -0
  55. package/fesm2022/raintonic-formaui-components-menu.mjs +896 -0
  56. package/fesm2022/raintonic-formaui-components-menu.mjs.map +1 -0
  57. package/fesm2022/raintonic-formaui-components-number-input.mjs +345 -0
  58. package/fesm2022/raintonic-formaui-components-number-input.mjs.map +1 -0
  59. package/fesm2022/raintonic-formaui-components-paginator.mjs +139 -0
  60. package/fesm2022/raintonic-formaui-components-paginator.mjs.map +1 -0
  61. package/fesm2022/raintonic-formaui-components-password-input.mjs +306 -0
  62. package/fesm2022/raintonic-formaui-components-password-input.mjs.map +1 -0
  63. package/fesm2022/raintonic-formaui-components-popover.mjs +451 -0
  64. package/fesm2022/raintonic-formaui-components-popover.mjs.map +1 -0
  65. package/fesm2022/raintonic-formaui-components-progressbar.mjs +148 -0
  66. package/fesm2022/raintonic-formaui-components-progressbar.mjs.map +1 -0
  67. package/fesm2022/raintonic-formaui-components-radio.mjs +260 -0
  68. package/fesm2022/raintonic-formaui-components-radio.mjs.map +1 -0
  69. package/fesm2022/raintonic-formaui-components-select.mjs +1011 -0
  70. package/fesm2022/raintonic-formaui-components-select.mjs.map +1 -0
  71. package/fesm2022/raintonic-formaui-components-side-panel.mjs +150 -0
  72. package/fesm2022/raintonic-formaui-components-side-panel.mjs.map +1 -0
  73. package/fesm2022/raintonic-formaui-components-sidebar.mjs +257 -0
  74. package/fesm2022/raintonic-formaui-components-sidebar.mjs.map +1 -0
  75. package/fesm2022/raintonic-formaui-components-skeleton.mjs +50 -0
  76. package/fesm2022/raintonic-formaui-components-skeleton.mjs.map +1 -0
  77. package/fesm2022/raintonic-formaui-components-slider.mjs +347 -0
  78. package/fesm2022/raintonic-formaui-components-slider.mjs.map +1 -0
  79. package/fesm2022/raintonic-formaui-components-spinner.mjs +63 -0
  80. package/fesm2022/raintonic-formaui-components-spinner.mjs.map +1 -0
  81. package/fesm2022/raintonic-formaui-components-stepper.mjs +317 -0
  82. package/fesm2022/raintonic-formaui-components-stepper.mjs.map +1 -0
  83. package/fesm2022/raintonic-formaui-components-tab.mjs +197 -0
  84. package/fesm2022/raintonic-formaui-components-tab.mjs.map +1 -0
  85. package/fesm2022/raintonic-formaui-components-tag.mjs +78 -0
  86. package/fesm2022/raintonic-formaui-components-tag.mjs.map +1 -0
  87. package/fesm2022/raintonic-formaui-components-time-picker.mjs +644 -0
  88. package/fesm2022/raintonic-formaui-components-time-picker.mjs.map +1 -0
  89. package/fesm2022/raintonic-formaui-components-toggle.mjs +171 -0
  90. package/fesm2022/raintonic-formaui-components-toggle.mjs.map +1 -0
  91. package/fesm2022/raintonic-formaui-components-toolbar.mjs +140 -0
  92. package/fesm2022/raintonic-formaui-components-toolbar.mjs.map +1 -0
  93. package/fesm2022/raintonic-formaui-components-tooltip.mjs +555 -0
  94. package/fesm2022/raintonic-formaui-components-tooltip.mjs.map +1 -0
  95. package/fesm2022/raintonic-formaui-components-tree-select.mjs +314 -0
  96. package/fesm2022/raintonic-formaui-components-tree-select.mjs.map +1 -0
  97. package/fesm2022/raintonic-formaui-components-tree-table.mjs +103 -0
  98. package/fesm2022/raintonic-formaui-components-tree-table.mjs.map +1 -0
  99. package/fesm2022/raintonic-formaui-components-tree.mjs +430 -0
  100. package/fesm2022/raintonic-formaui-components-tree.mjs.map +1 -0
  101. package/fesm2022/raintonic-formaui-core.mjs +62 -0
  102. package/fesm2022/raintonic-formaui-core.mjs.map +1 -0
  103. package/fesm2022/raintonic-formaui-services-dialog.mjs +798 -0
  104. package/fesm2022/raintonic-formaui-services-dialog.mjs.map +1 -0
  105. package/fesm2022/raintonic-formaui-services-notification.mjs +391 -0
  106. package/fesm2022/raintonic-formaui-services-notification.mjs.map +1 -0
  107. package/fesm2022/raintonic-formaui-services-theme.mjs +248 -0
  108. package/fesm2022/raintonic-formaui-services-theme.mjs.map +1 -0
  109. package/fesm2022/raintonic-formaui-test-utils.mjs +66 -0
  110. package/fesm2022/raintonic-formaui-test-utils.mjs.map +1 -0
  111. package/fesm2022/raintonic-formaui.mjs +15 -0
  112. package/fesm2022/raintonic-formaui.mjs.map +1 -0
  113. package/llms-full.txt +1627 -0
  114. package/llms.txt +60 -0
  115. package/package.json +251 -0
  116. package/styles/_fonts-entry.scss +3 -0
  117. package/styles/fonts/dm-mono-400-latin.woff2 +0 -0
  118. package/styles/fonts/inter-tight-latin-italic.woff2 +0 -0
  119. package/styles/fonts/inter-tight-latin.woff2 +0 -0
  120. package/styles/index.scss +127 -0
  121. package/styles/partials/_constants.scss +29 -0
  122. package/styles/partials/_fonts.scss +36 -0
  123. package/styles/partials/_grid.scss +171 -0
  124. package/styles/partials/_mixins.scss +145 -0
  125. package/styles/partials/_motion.scss +252 -0
  126. package/styles/partials/_theme.scss +275 -0
  127. package/styles/partials/_typography.scss +112 -0
  128. package/styles/partials/_utilities.scss +480 -0
  129. package/styles/partials/themes/_dark.scss +254 -0
  130. package/styles/partials/themes/_light.scss +254 -0
  131. package/types/raintonic-formaui-cdk-drag-drop.d.ts +196 -0
  132. package/types/raintonic-formaui-cdk-drag-drop.d.ts.map +1 -0
  133. package/types/raintonic-formaui-cdk-form-field.d.ts +62 -0
  134. package/types/raintonic-formaui-cdk-form-field.d.ts.map +1 -0
  135. package/types/raintonic-formaui-cdk-overlay.d.ts +843 -0
  136. package/types/raintonic-formaui-cdk-overlay.d.ts.map +1 -0
  137. package/types/raintonic-formaui-cdk-virtual-scroll.d.ts +112 -0
  138. package/types/raintonic-formaui-cdk-virtual-scroll.d.ts.map +1 -0
  139. package/types/raintonic-formaui-components-accordion.d.ts +124 -0
  140. package/types/raintonic-formaui-components-accordion.d.ts.map +1 -0
  141. package/types/raintonic-formaui-components-alert.d.ts +143 -0
  142. package/types/raintonic-formaui-components-alert.d.ts.map +1 -0
  143. package/types/raintonic-formaui-components-autocomplete.d.ts +193 -0
  144. package/types/raintonic-formaui-components-autocomplete.d.ts.map +1 -0
  145. package/types/raintonic-formaui-components-avatar.d.ts +52 -0
  146. package/types/raintonic-formaui-components-avatar.d.ts.map +1 -0
  147. package/types/raintonic-formaui-components-badge.d.ts +47 -0
  148. package/types/raintonic-formaui-components-badge.d.ts.map +1 -0
  149. package/types/raintonic-formaui-components-big-menu.d.ts +62 -0
  150. package/types/raintonic-formaui-components-big-menu.d.ts.map +1 -0
  151. package/types/raintonic-formaui-components-breadcrumb.d.ts +26 -0
  152. package/types/raintonic-formaui-components-breadcrumb.d.ts.map +1 -0
  153. package/types/raintonic-formaui-components-button-group.d.ts +61 -0
  154. package/types/raintonic-formaui-components-button-group.d.ts.map +1 -0
  155. package/types/raintonic-formaui-components-button.d.ts +116 -0
  156. package/types/raintonic-formaui-components-button.d.ts.map +1 -0
  157. package/types/raintonic-formaui-components-card.d.ts +191 -0
  158. package/types/raintonic-formaui-components-card.d.ts.map +1 -0
  159. package/types/raintonic-formaui-components-checkbox.d.ts +132 -0
  160. package/types/raintonic-formaui-components-checkbox.d.ts.map +1 -0
  161. package/types/raintonic-formaui-components-data-table.d.ts +368 -0
  162. package/types/raintonic-formaui-components-data-table.d.ts.map +1 -0
  163. package/types/raintonic-formaui-components-date-picker.d.ts +341 -0
  164. package/types/raintonic-formaui-components-date-picker.d.ts.map +1 -0
  165. package/types/raintonic-formaui-components-divider.d.ts +21 -0
  166. package/types/raintonic-formaui-components-divider.d.ts.map +1 -0
  167. package/types/raintonic-formaui-components-drawer.d.ts +48 -0
  168. package/types/raintonic-formaui-components-drawer.d.ts.map +1 -0
  169. package/types/raintonic-formaui-components-dynamic-form.d.ts +412 -0
  170. package/types/raintonic-formaui-components-dynamic-form.d.ts.map +1 -0
  171. package/types/raintonic-formaui-components-empty-state.d.ts +14 -0
  172. package/types/raintonic-formaui-components-empty-state.d.ts.map +1 -0
  173. package/types/raintonic-formaui-components-file-upload.d.ts +77 -0
  174. package/types/raintonic-formaui-components-file-upload.d.ts.map +1 -0
  175. package/types/raintonic-formaui-components-form-field.d.ts +271 -0
  176. package/types/raintonic-formaui-components-form-field.d.ts.map +1 -0
  177. package/types/raintonic-formaui-components-icon.d.ts +61 -0
  178. package/types/raintonic-formaui-components-icon.d.ts.map +1 -0
  179. package/types/raintonic-formaui-components-input.d.ts +149 -0
  180. package/types/raintonic-formaui-components-input.d.ts.map +1 -0
  181. package/types/raintonic-formaui-components-list.d.ts +48 -0
  182. package/types/raintonic-formaui-components-list.d.ts.map +1 -0
  183. package/types/raintonic-formaui-components-menu.d.ts +403 -0
  184. package/types/raintonic-formaui-components-menu.d.ts.map +1 -0
  185. package/types/raintonic-formaui-components-number-input.d.ts +127 -0
  186. package/types/raintonic-formaui-components-number-input.d.ts.map +1 -0
  187. package/types/raintonic-formaui-components-paginator.d.ts +37 -0
  188. package/types/raintonic-formaui-components-paginator.d.ts.map +1 -0
  189. package/types/raintonic-formaui-components-password-input.d.ts +111 -0
  190. package/types/raintonic-formaui-components-password-input.d.ts.map +1 -0
  191. package/types/raintonic-formaui-components-popover.d.ts +131 -0
  192. package/types/raintonic-formaui-components-popover.d.ts.map +1 -0
  193. package/types/raintonic-formaui-components-progressbar.d.ts +111 -0
  194. package/types/raintonic-formaui-components-progressbar.d.ts.map +1 -0
  195. package/types/raintonic-formaui-components-radio.d.ts +95 -0
  196. package/types/raintonic-formaui-components-radio.d.ts.map +1 -0
  197. package/types/raintonic-formaui-components-select.d.ts +307 -0
  198. package/types/raintonic-formaui-components-select.d.ts.map +1 -0
  199. package/types/raintonic-formaui-components-side-panel.d.ts +51 -0
  200. package/types/raintonic-formaui-components-side-panel.d.ts.map +1 -0
  201. package/types/raintonic-formaui-components-sidebar.d.ts +174 -0
  202. package/types/raintonic-formaui-components-sidebar.d.ts.map +1 -0
  203. package/types/raintonic-formaui-components-skeleton.d.ts +20 -0
  204. package/types/raintonic-formaui-components-skeleton.d.ts.map +1 -0
  205. package/types/raintonic-formaui-components-slider.d.ts +108 -0
  206. package/types/raintonic-formaui-components-slider.d.ts.map +1 -0
  207. package/types/raintonic-formaui-components-spinner.d.ts +42 -0
  208. package/types/raintonic-formaui-components-spinner.d.ts.map +1 -0
  209. package/types/raintonic-formaui-components-stepper.d.ts +126 -0
  210. package/types/raintonic-formaui-components-stepper.d.ts.map +1 -0
  211. package/types/raintonic-formaui-components-tab.d.ts +96 -0
  212. package/types/raintonic-formaui-components-tab.d.ts.map +1 -0
  213. package/types/raintonic-formaui-components-tag.d.ts +34 -0
  214. package/types/raintonic-formaui-components-tag.d.ts.map +1 -0
  215. package/types/raintonic-formaui-components-time-picker.d.ts +172 -0
  216. package/types/raintonic-formaui-components-time-picker.d.ts.map +1 -0
  217. package/types/raintonic-formaui-components-toggle.d.ts +70 -0
  218. package/types/raintonic-formaui-components-toggle.d.ts.map +1 -0
  219. package/types/raintonic-formaui-components-toolbar.d.ts +128 -0
  220. package/types/raintonic-formaui-components-toolbar.d.ts.map +1 -0
  221. package/types/raintonic-formaui-components-tooltip.d.ts +268 -0
  222. package/types/raintonic-formaui-components-tooltip.d.ts.map +1 -0
  223. package/types/raintonic-formaui-components-tree-select.d.ts +80 -0
  224. package/types/raintonic-formaui-components-tree-select.d.ts.map +1 -0
  225. package/types/raintonic-formaui-components-tree-table.d.ts +90 -0
  226. package/types/raintonic-formaui-components-tree-table.d.ts.map +1 -0
  227. package/types/raintonic-formaui-components-tree.d.ts +104 -0
  228. package/types/raintonic-formaui-components-tree.d.ts.map +1 -0
  229. package/types/raintonic-formaui-core.d.ts +115 -0
  230. package/types/raintonic-formaui-core.d.ts.map +1 -0
  231. package/types/raintonic-formaui-services-dialog.d.ts +451 -0
  232. package/types/raintonic-formaui-services-dialog.d.ts.map +1 -0
  233. package/types/raintonic-formaui-services-notification.d.ts +221 -0
  234. package/types/raintonic-formaui-services-notification.d.ts.map +1 -0
  235. package/types/raintonic-formaui-services-theme.d.ts +126 -0
  236. package/types/raintonic-formaui-services-theme.d.ts.map +1 -0
  237. package/types/raintonic-formaui-test-utils.d.ts +24 -0
  238. package/types/raintonic-formaui-test-utils.d.ts.map +1 -0
  239. package/types/raintonic-formaui.d.ts +4 -0
  240. package/types/raintonic-formaui.d.ts.map +1 -0
@@ -0,0 +1,248 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, DestroyRef, PLATFORM_ID, signal, Injectable } from '@angular/core';
3
+ import { DOCUMENT, isPlatformBrowser } from '@angular/common';
4
+
5
+ /**
6
+ * # FuiTheme Service
7
+ *
8
+ * Central service for managing theme configuration and mode switching.
9
+ * Provides runtime theme customization with CSS variables and automatic palette generation.
10
+ *
11
+ * ## Features
12
+ * - Runtime theme customization
13
+ * - Light/dark/auto mode switching
14
+ * - Automatic color palette generation
15
+ * - CSS variables-based theming
16
+ * - Persistent theme preferences
17
+ * - System theme detection
18
+ *
19
+ * ## Usage
20
+ *
21
+ * ### Basic Theme Setup
22
+ * ```typescript
23
+ * import { FuiThemeService } from '@raintonic/formaui/services/theme';
24
+ *
25
+ * constructor(private themeService: FuiThemeService) {
26
+ * // Set custom theme colors
27
+ * this.themeService.setTheme({
28
+ * primary: '#007bff',
29
+ * secondary: '#6c757d',
30
+ * tertiary: '#28a745'
31
+ * });
32
+ * }
33
+ * ```
34
+ *
35
+ * ### Theme Mode Switching
36
+ * ```typescript
37
+ * // Switch to dark mode
38
+ * this.themeService.setMode('dark');
39
+ *
40
+ * // Switch to auto (follows system preference)
41
+ * this.themeService.setMode('auto');
42
+ *
43
+ * // Get current mode
44
+ * const currentMode = this.themeService.currentMode();
45
+ * const isDark = this.themeService.isDark();
46
+ * ```
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * import { Component, effect } from '@angular/core';
51
+ * import { FuiThemeService } from '@raintonic/formaui/services/theme';
52
+ *
53
+ * @Component({
54
+ * template: `
55
+ * <div class="theme-controls">
56
+ * <button rtButton (click)="setLightMode()">Light</button>
57
+ * <button rtButton (click)="setDarkMode()">Dark</button>
58
+ * <button rtButton (click)="setAutoMode()">Auto</button>
59
+ * </div>
60
+ * `
61
+ * })
62
+ * export class ThemeControlsComponent {
63
+ * constructor(public themeService: FuiThemeService) {}
64
+ *
65
+ * setLightMode() { this.themeService.setMode('light'); }
66
+ * setDarkMode() { this.themeService.setMode('dark'); }
67
+ * setAutoMode() { this.themeService.setMode('auto'); }
68
+ * }
69
+ * ```
70
+ */
71
+ class FuiThemeService {
72
+ _destroyRef = inject(DestroyRef);
73
+ _document = inject(DOCUMENT);
74
+ _platformId = inject(PLATFORM_ID);
75
+ _currentMode = signal('dark', ...(ngDevMode ? [{ debugName: "_currentMode" }] : /* istanbul ignore next */ []));
76
+ _isDark = signal(false, ...(ngDevMode ? [{ debugName: "_isDark" }] : /* istanbul ignore next */ []));
77
+ currentMode = this._currentMode.asReadonly();
78
+ isDark = this._isDark.asReadonly();
79
+ constructor() {
80
+ this._initializeTheme();
81
+ this._setupMediaQueryListener();
82
+ }
83
+ /**
84
+ * Initialize theme with custom colors
85
+ */
86
+ initTheme(config = {}) {
87
+ this.setTheme(config);
88
+ }
89
+ /**
90
+ * Set theme colors dynamically
91
+ */
92
+ setTheme(config = {}) {
93
+ const root = this._document.documentElement;
94
+ if (config.primary) {
95
+ this._setColorPalette(root, 'primary', config.primary);
96
+ }
97
+ if (config.secondary) {
98
+ this._setColorPalette(root, 'secondary', config.secondary);
99
+ }
100
+ if (config.tertiary) {
101
+ this._setColorPalette(root, 'tertiary', config.tertiary);
102
+ }
103
+ }
104
+ /**
105
+ * Set theme mode
106
+ */
107
+ setThemeMode(mode) {
108
+ this.setMode(mode);
109
+ }
110
+ /**
111
+ * Set theme mode (preferred method)
112
+ */
113
+ setMode(mode) {
114
+ this._currentMode.set(mode);
115
+ this._applyThemeMode(mode);
116
+ }
117
+ /**
118
+ * Toggle between light and dark themes
119
+ */
120
+ toggleTheme() {
121
+ const newMode = this._isDark() ? 'light' : 'dark';
122
+ this.setMode(newMode);
123
+ }
124
+ _initializeTheme() {
125
+ if (!isPlatformBrowser(this._platformId)) {
126
+ return;
127
+ }
128
+ const win = this._document.defaultView;
129
+ try {
130
+ const savedMode = win?.localStorage.getItem('fui-theme-mode');
131
+ if (savedMode && ['light', 'dark', 'auto'].includes(savedMode)) {
132
+ this.setMode(savedMode);
133
+ return;
134
+ }
135
+ }
136
+ catch {
137
+ // localStorage may be unavailable (e.g., privacy mode)
138
+ }
139
+ const mediaQuery = win?.matchMedia('(prefers-color-scheme: dark)');
140
+ this._updateDarkMode(mediaQuery?.matches ?? false);
141
+ }
142
+ _setupMediaQueryListener() {
143
+ if (!isPlatformBrowser(this._platformId)) {
144
+ return;
145
+ }
146
+ const win = this._document.defaultView;
147
+ if (!win) {
148
+ return;
149
+ }
150
+ const mediaQuery = win.matchMedia('(prefers-color-scheme: dark)');
151
+ const handleChange = (e) => {
152
+ if (this._currentMode() === 'auto') {
153
+ this._updateDarkMode(e.matches);
154
+ }
155
+ };
156
+ mediaQuery.addEventListener('change', handleChange);
157
+ // Clean up listener when service is destroyed
158
+ this._destroyRef.onDestroy(() => {
159
+ mediaQuery.removeEventListener('change', handleChange);
160
+ });
161
+ // Initial check
162
+ if (this._currentMode() === 'auto') {
163
+ this._updateDarkMode(mediaQuery.matches);
164
+ }
165
+ }
166
+ _applyThemeMode(mode) {
167
+ const root = this._document.documentElement;
168
+ // Save to localStorage
169
+ try {
170
+ this._document.defaultView?.localStorage.setItem('fui-theme-mode', mode);
171
+ }
172
+ catch {
173
+ // localStorage may be unavailable
174
+ }
175
+ // Remove existing theme classes
176
+ root.classList.remove('fui-theme-light', 'fui-theme-dark');
177
+ switch (mode) {
178
+ case 'light':
179
+ root.classList.add('fui-theme-light');
180
+ this._updateDarkMode(false);
181
+ break;
182
+ case 'dark':
183
+ root.classList.add('fui-theme-dark');
184
+ this._updateDarkMode(true);
185
+ break;
186
+ case 'auto': {
187
+ const win = this._document.defaultView;
188
+ const _isDarkPreferred = win?.matchMedia('(prefers-color-scheme: dark)').matches ?? false;
189
+ this._updateDarkMode(_isDarkPreferred);
190
+ break;
191
+ }
192
+ }
193
+ }
194
+ _updateDarkMode(isDark) {
195
+ this._isDark.set(isDark);
196
+ this._document.documentElement.classList.toggle('fui-theme-dark', isDark);
197
+ }
198
+ _setColorPalette(root, colorName, baseColor) {
199
+ const palette = this._generateColorPalette(baseColor);
200
+ Object.entries(palette).forEach(([shade, color]) => {
201
+ root.style.setProperty(`--fui-${colorName}-${shade}`, color);
202
+ });
203
+ // Update semantic color
204
+ root.style.setProperty(`--fui-${colorName}-color`, `var(--fui-${colorName}-60)`);
205
+ }
206
+ _generateColorPalette(baseColor) {
207
+ // Convert hex to RGB
208
+ const hex = baseColor.replace('#', '');
209
+ const r = parseInt(hex.substr(0, 2), 16);
210
+ const g = parseInt(hex.substr(2, 2), 16);
211
+ const b = parseInt(hex.substr(4, 2), 16);
212
+ const palette = {};
213
+ // Generate lighter shades (10-50)
214
+ for (let i = 10; i <= 50; i += 10) {
215
+ const factor = (60 - i) / 60; // More white for lower numbers
216
+ const newR = Math.round(r + (255 - r) * (1 - factor));
217
+ const newG = Math.round(g + (255 - g) * (1 - factor));
218
+ const newB = Math.round(b + (255 - b) * (1 - factor));
219
+ palette[i.toString()] = `rgb(${newR}, ${newG}, ${newB})`;
220
+ }
221
+ // Base color (60)
222
+ palette['60'] = baseColor;
223
+ // Generate darker shades (70-100)
224
+ for (let i = 70; i <= 100; i += 10) {
225
+ const factor = (i - 60) / 40; // More black for higher numbers
226
+ const newR = Math.round(r * (1 - factor));
227
+ const newG = Math.round(g * (1 - factor));
228
+ const newB = Math.round(b * (1 - factor));
229
+ palette[i.toString()] = `rgb(${newR}, ${newG}, ${newB})`;
230
+ }
231
+ return palette;
232
+ }
233
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: FuiThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
234
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: FuiThemeService, providedIn: 'root' });
235
+ }
236
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: FuiThemeService, decorators: [{
237
+ type: Injectable,
238
+ args: [{
239
+ providedIn: 'root',
240
+ }]
241
+ }], ctorParameters: () => [] });
242
+
243
+ /**
244
+ * Generated bundle index. Do not edit.
245
+ */
246
+
247
+ export { FuiThemeService };
248
+ //# sourceMappingURL=raintonic-formaui-services-theme.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"raintonic-formaui-services-theme.mjs","sources":["../../../lib/services/theme/theme.service.ts","../../../lib/services/theme/raintonic-formaui-services-theme.ts"],"sourcesContent":["import { DestroyRef, inject, Injectable, PLATFORM_ID, signal, Signal, WritableSignal } from '@angular/core';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\n\n/**\n * Configuration interface for theme customization\n */\nexport interface FuiThemeConfig {\n /** Primary color for the theme (hex, rgb, hsl) */\n primary?: string;\n /** Secondary color for the theme (hex, rgb, hsl) */\n secondary?: string;\n /** Tertiary color for the theme (hex, rgb, hsl) */\n tertiary?: string;\n}\n\n/**\n * Available theme modes\n */\nexport type FuiThemeMode = 'light' | 'dark' | 'auto';\n\n/**\n * # FuiTheme Service\n *\n * Central service for managing theme configuration and mode switching.\n * Provides runtime theme customization with CSS variables and automatic palette generation.\n *\n * ## Features\n * - Runtime theme customization\n * - Light/dark/auto mode switching\n * - Automatic color palette generation\n * - CSS variables-based theming\n * - Persistent theme preferences\n * - System theme detection\n *\n * ## Usage\n *\n * ### Basic Theme Setup\n * ```typescript\n * import { FuiThemeService } from '@raintonic/formaui/services/theme';\n *\n * constructor(private themeService: FuiThemeService) {\n * // Set custom theme colors\n * this.themeService.setTheme({\n * primary: '#007bff',\n * secondary: '#6c757d',\n * tertiary: '#28a745'\n * });\n * }\n * ```\n *\n * ### Theme Mode Switching\n * ```typescript\n * // Switch to dark mode\n * this.themeService.setMode('dark');\n *\n * // Switch to auto (follows system preference)\n * this.themeService.setMode('auto');\n *\n * // Get current mode\n * const currentMode = this.themeService.currentMode();\n * const isDark = this.themeService.isDark();\n * ```\n *\n * @example\n * ```typescript\n * import { Component, effect } from '@angular/core';\n * import { FuiThemeService } from '@raintonic/formaui/services/theme';\n *\n * @Component({\n * template: `\n * <div class=\"theme-controls\">\n * <button rtButton (click)=\"setLightMode()\">Light</button>\n * <button rtButton (click)=\"setDarkMode()\">Dark</button>\n * <button rtButton (click)=\"setAutoMode()\">Auto</button>\n * </div>\n * `\n * })\n * export class ThemeControlsComponent {\n * constructor(public themeService: FuiThemeService) {}\n *\n * setLightMode() { this.themeService.setMode('light'); }\n * setDarkMode() { this.themeService.setMode('dark'); }\n * setAutoMode() { this.themeService.setMode('auto'); }\n * }\n * ```\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class FuiThemeService {\n private readonly _destroyRef = inject(DestroyRef);\n private readonly _document = inject(DOCUMENT);\n private readonly _platformId = inject(PLATFORM_ID);\n private readonly _currentMode: WritableSignal<FuiThemeMode> = signal<FuiThemeMode>('dark');\n private readonly _isDark: WritableSignal<boolean> = signal(false);\n\n readonly currentMode: Signal<FuiThemeMode> = this._currentMode.asReadonly();\n readonly isDark: Signal<boolean> = this._isDark.asReadonly();\n\n constructor() {\n this._initializeTheme();\n this._setupMediaQueryListener();\n }\n\n /**\n * Initialize theme with custom colors\n */\n initTheme(config: FuiThemeConfig = {}): void {\n this.setTheme(config);\n }\n\n /**\n * Set theme colors dynamically\n */\n setTheme(config: FuiThemeConfig = {}): void {\n const root: HTMLElement = this._document.documentElement;\n\n if (config.primary) {\n this._setColorPalette(root, 'primary', config.primary);\n }\n\n if (config.secondary) {\n this._setColorPalette(root, 'secondary', config.secondary);\n }\n\n if (config.tertiary) {\n this._setColorPalette(root, 'tertiary', config.tertiary);\n }\n }\n\n /**\n * Set theme mode\n */\n setThemeMode(mode: FuiThemeMode): void {\n this.setMode(mode);\n }\n\n /**\n * Set theme mode (preferred method)\n */\n setMode(mode: FuiThemeMode): void {\n this._currentMode.set(mode);\n this._applyThemeMode(mode);\n }\n\n /**\n * Toggle between light and dark themes\n */\n toggleTheme(): void {\n const newMode: FuiThemeMode = this._isDark() ? 'light' : 'dark';\n this.setMode(newMode);\n }\n\n private _initializeTheme(): void {\n if (!isPlatformBrowser(this._platformId)) {\n return;\n }\n\n const win = this._document.defaultView;\n try {\n const savedMode: FuiThemeMode | null = win?.localStorage.getItem('fui-theme-mode') as FuiThemeMode;\n if (savedMode && ['light', 'dark', 'auto'].includes(savedMode)) {\n this.setMode(savedMode);\n return;\n }\n } catch {\n // localStorage may be unavailable (e.g., privacy mode)\n }\n\n const mediaQuery: MediaQueryList | undefined = win?.matchMedia('(prefers-color-scheme: dark)');\n this._updateDarkMode(mediaQuery?.matches ?? false);\n }\n\n private _setupMediaQueryListener(): void {\n if (!isPlatformBrowser(this._platformId)) {\n return;\n }\n\n const win = this._document.defaultView;\n if (!win) {\n return;\n }\n\n const mediaQuery: MediaQueryList = win.matchMedia('(prefers-color-scheme: dark)');\n\n const handleChange = (e: MediaQueryListEvent): void => {\n if (this._currentMode() === 'auto') {\n this._updateDarkMode(e.matches);\n }\n };\n\n mediaQuery.addEventListener('change', handleChange);\n\n // Clean up listener when service is destroyed\n this._destroyRef.onDestroy(() => {\n mediaQuery.removeEventListener('change', handleChange);\n });\n\n // Initial check\n if (this._currentMode() === 'auto') {\n this._updateDarkMode(mediaQuery.matches);\n }\n }\n\n private _applyThemeMode(mode: FuiThemeMode): void {\n const root: HTMLElement = this._document.documentElement;\n\n // Save to localStorage\n try {\n this._document.defaultView?.localStorage.setItem('fui-theme-mode', mode);\n } catch {\n // localStorage may be unavailable\n }\n\n // Remove existing theme classes\n root.classList.remove('fui-theme-light', 'fui-theme-dark');\n\n switch (mode) {\n case 'light':\n root.classList.add('fui-theme-light');\n this._updateDarkMode(false);\n break;\n case 'dark':\n root.classList.add('fui-theme-dark');\n this._updateDarkMode(true);\n break;\n case 'auto': {\n const win = this._document.defaultView;\n const _isDarkPreferred: boolean = win?.matchMedia('(prefers-color-scheme: dark)').matches ?? false;\n this._updateDarkMode(_isDarkPreferred);\n break;\n }\n }\n }\n\n private _updateDarkMode(isDark: boolean): void {\n this._isDark.set(isDark);\n this._document.documentElement.classList.toggle('fui-theme-dark', isDark);\n }\n\n private _setColorPalette(root: HTMLElement, colorName: string, baseColor: string): void {\n const palette: Record<string, string> = this._generateColorPalette(baseColor);\n\n Object.entries(palette).forEach(([shade, color]) => {\n root.style.setProperty(`--fui-${colorName}-${shade}`, color);\n });\n\n // Update semantic color\n root.style.setProperty(`--fui-${colorName}-color`, `var(--fui-${colorName}-60)`);\n }\n\n private _generateColorPalette(baseColor: string): Record<string, string> {\n // Convert hex to RGB\n const hex: string = baseColor.replace('#', '');\n const r: number = parseInt(hex.substr(0, 2), 16);\n const g: number = parseInt(hex.substr(2, 2), 16);\n const b: number = parseInt(hex.substr(4, 2), 16);\n\n const palette: Record<string, string> = {};\n\n // Generate lighter shades (10-50)\n for (let i = 10; i <= 50; i += 10) {\n const factor: number = (60 - i) / 60; // More white for lower numbers\n const newR: number = Math.round(r + (255 - r) * (1 - factor));\n const newG: number = Math.round(g + (255 - g) * (1 - factor));\n const newB: number = Math.round(b + (255 - b) * (1 - factor));\n palette[i.toString()] = `rgb(${newR}, ${newG}, ${newB})`;\n }\n\n // Base color (60)\n palette['60'] = baseColor;\n\n // Generate darker shades (70-100)\n for (let i = 70; i <= 100; i += 10) {\n const factor: number = (i - 60) / 40; // More black for higher numbers\n const newR: number = Math.round(r * (1 - factor));\n const newG: number = Math.round(g * (1 - factor));\n const newB: number = Math.round(b * (1 - factor));\n palette[i.toString()] = `rgb(${newR}, ${newG}, ${newB})`;\n }\n\n return palette;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAoBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEG;MAIU,eAAe,CAAA;AACT,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;AAChC,IAAA,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC5B,IAAA,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;AACjC,IAAA,YAAY,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1D;AAEA,QAAA,OAAO,OAAO;IAChB;uGAjMW,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAf,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,cAFd,MAAM,EAAA,CAAA;;2FAEP,eAAe,EAAA,UAAA,EAAA,CAAA;kBAH3B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACxFD;;AAEG;;;;"}
@@ -0,0 +1,66 @@
1
+ import axe from 'axe-core';
2
+
3
+ /**
4
+ * Runs axe-core accessibility audit on the given element.
5
+ * Returns violations array. Empty array means no violations.
6
+ */
7
+ async function runA11yAudit(element) {
8
+ const results = await axe.run(element, {
9
+ rules: {
10
+ 'color-contrast': { enabled: true },
11
+ 'keyboard-access': { enabled: true },
12
+ 'aria-roles': { enabled: true },
13
+ 'aria-required-attr': { enabled: true },
14
+ 'aria-valid-attr': { enabled: true },
15
+ 'aria-valid-attr-value': { enabled: true },
16
+ 'button-name': { enabled: true },
17
+ 'image-alt': { enabled: true },
18
+ label: { enabled: true },
19
+ 'link-name': { enabled: true },
20
+ },
21
+ });
22
+ return results.violations;
23
+ }
24
+
25
+ function pressKey(element, key, modifiers) {
26
+ const event = new KeyboardEvent('keydown', {
27
+ key,
28
+ bubbles: true,
29
+ cancelable: true,
30
+ shiftKey: modifiers?.shift ?? false,
31
+ ctrlKey: modifiers?.ctrl ?? false,
32
+ altKey: modifiers?.alt ?? false,
33
+ });
34
+ element.dispatchEvent(event);
35
+ }
36
+ function pressTab(element, shift = false) {
37
+ pressKey(element, 'Tab', { shift });
38
+ }
39
+ function pressArrowDown(element) {
40
+ pressKey(element, 'ArrowDown');
41
+ }
42
+ function pressArrowUp(element) {
43
+ pressKey(element, 'ArrowUp');
44
+ }
45
+ function pressEnter(element) {
46
+ pressKey(element, 'Enter');
47
+ }
48
+ function pressSpace(element) {
49
+ pressKey(element, ' ');
50
+ }
51
+ function pressEscape(element) {
52
+ pressKey(element, 'Escape');
53
+ }
54
+ function pressHome(element) {
55
+ pressKey(element, 'Home');
56
+ }
57
+ function pressEnd(element) {
58
+ pressKey(element, 'End');
59
+ }
60
+
61
+ /**
62
+ * Generated bundle index. Do not edit.
63
+ */
64
+
65
+ export { pressArrowDown, pressArrowUp, pressEnd, pressEnter, pressEscape, pressHome, pressKey, pressSpace, pressTab, runA11yAudit };
66
+ //# sourceMappingURL=raintonic-formaui-test-utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"raintonic-formaui-test-utils.mjs","sources":["../../../lib/test-utils/a11y-test.util.ts","../../../lib/test-utils/keyboard-test.util.ts","../../../lib/test-utils/raintonic-formaui-test-utils.ts"],"sourcesContent":["import axe from 'axe-core';\n\n/**\n * Runs axe-core accessibility audit on the given element.\n * Returns violations array. Empty array means no violations.\n */\nexport async function runA11yAudit(element: HTMLElement): Promise<axe.Result[]> {\n const results = await axe.run(element, {\n rules: {\n 'color-contrast': { enabled: true },\n 'keyboard-access': { enabled: true },\n 'aria-roles': { enabled: true },\n 'aria-required-attr': { enabled: true },\n 'aria-valid-attr': { enabled: true },\n 'aria-valid-attr-value': { enabled: true },\n 'button-name': { enabled: true },\n 'image-alt': { enabled: true },\n label: { enabled: true },\n 'link-name': { enabled: true },\n },\n });\n return results.violations;\n}\n","export function pressKey(\n element: HTMLElement,\n key: string,\n modifiers?: { shift?: boolean; ctrl?: boolean; alt?: boolean },\n): void {\n const event = new KeyboardEvent('keydown', {\n key,\n bubbles: true,\n cancelable: true,\n shiftKey: modifiers?.shift ?? false,\n ctrlKey: modifiers?.ctrl ?? false,\n altKey: modifiers?.alt ?? false,\n });\n element.dispatchEvent(event);\n}\n\nexport function pressTab(element: HTMLElement, shift = false): void {\n pressKey(element, 'Tab', { shift });\n}\n\nexport function pressArrowDown(element: HTMLElement): void {\n pressKey(element, 'ArrowDown');\n}\n\nexport function pressArrowUp(element: HTMLElement): void {\n pressKey(element, 'ArrowUp');\n}\n\nexport function pressEnter(element: HTMLElement): void {\n pressKey(element, 'Enter');\n}\n\nexport function pressSpace(element: HTMLElement): void {\n pressKey(element, ' ');\n}\n\nexport function pressEscape(element: HTMLElement): void {\n pressKey(element, 'Escape');\n}\n\nexport function pressHome(element: HTMLElement): void {\n pressKey(element, 'Home');\n}\n\nexport function pressEnd(element: HTMLElement): void {\n pressKey(element, 'End');\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAEA;;;AAGG;AACI,eAAe,YAAY,CAAC,OAAoB,EAAA;IACrD,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE;AACrC,QAAA,KAAK,EAAE;AACL,YAAA,gBAAgB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AACnC,YAAA,iBAAiB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AACpC,YAAA,YAAY,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AAC/B,YAAA,oBAAoB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AACvC,YAAA,iBAAiB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AACpC,YAAA,uBAAuB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AAC1C,YAAA,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AAChC,YAAA,WAAW,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AAC9B,YAAA,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AACxB,YAAA,WAAW,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AAC/B,SAAA;AACF,KAAA,CAAC;IACF,OAAO,OAAO,CAAC,UAAU;AAC3B;;SCtBgB,Q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"}
@@ -0,0 +1,15 @@
1
+ const FORMAUI_VERSION = '0.1.0';
2
+ // FormaUI - Primary entry point
3
+ // Secondary entry points are imported directly, e.g.:
4
+ // import { FuiButtonDirective } from '@raintonic/formaui/components/button';
5
+ // import { FuiIconComponent } from '@raintonic/formaui/components/icon';
6
+ // import { ThemeService } from '@raintonic/formaui/services/theme';
7
+ // import { FuiOverlayService } from '@raintonic/formaui/cdk/overlay';
8
+ // import { FuiCoreModule } from '@raintonic/formaui/core';
9
+
10
+ /**
11
+ * Generated bundle index. Do not edit.
12
+ */
13
+
14
+ export { FORMAUI_VERSION };
15
+ //# sourceMappingURL=raintonic-formaui.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"raintonic-formaui.mjs","sources":["../../../lib/src/public-api.ts","../../../lib/src/raintonic-formaui.ts"],"sourcesContent":["export const FORMAUI_VERSION = '0.1.0';\n\n// FormaUI - Primary entry point\n// Secondary entry points are imported directly, e.g.:\n// import { FuiButtonDirective } from '@raintonic/formaui/components/button';\n// import { FuiIconComponent } from '@raintonic/formaui/components/icon';\n// import { ThemeService } from '@raintonic/formaui/services/theme';\n// import { FuiOverlayService } from '@raintonic/formaui/cdk/overlay';\n// import { FuiCoreModule } from '@raintonic/formaui/core';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAO,MAAM,eAAe,GAAG;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;;AAEG;;;;"}