@fleetia/components 1.1.1

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 (245) hide show
  1. package/dist/Badge/Badge.css.d.ts +1 -0
  2. package/dist/Badge/Badge.d.ts +7 -0
  3. package/dist/Badge/Badge.js +9 -0
  4. package/dist/Badge/Badge.styles.js +6 -0
  5. package/dist/Badge/index.d.ts +1 -0
  6. package/dist/Badge/index.js +1 -0
  7. package/dist/Box/Box.css.d.ts +4 -0
  8. package/dist/Box/Box.d.ts +8 -0
  9. package/dist/Box/Box.js +14 -0
  10. package/dist/Box/Box.styles.js +9 -0
  11. package/dist/Box/index.d.ts +1 -0
  12. package/dist/Box/index.js +1 -0
  13. package/dist/Breadcrumb/Breadcrumb.css.d.ts +4 -0
  14. package/dist/Breadcrumb/Breadcrumb.d.ts +11 -0
  15. package/dist/Breadcrumb/Breadcrumb.js +10 -0
  16. package/dist/Breadcrumb/Breadcrumb.styles.js +9 -0
  17. package/dist/Breadcrumb/index.d.ts +1 -0
  18. package/dist/Breadcrumb/index.js +1 -0
  19. package/dist/Button/Button.css.d.ts +2 -0
  20. package/dist/Button/Button.d.ts +12 -0
  21. package/dist/Button/Button.js +9 -0
  22. package/dist/Button/Button.styles.js +7 -0
  23. package/dist/Button/index.d.ts +1 -0
  24. package/dist/Button/index.js +1 -0
  25. package/dist/CardPagination/CardPagination.css.d.ts +3 -0
  26. package/dist/CardPagination/CardPagination.d.ts +9 -0
  27. package/dist/CardPagination/CardPagination.js +15 -0
  28. package/dist/CardPagination/CardPagination.styles.js +8 -0
  29. package/dist/CardPagination/index.d.ts +1 -0
  30. package/dist/CardPagination/index.js +1 -0
  31. package/dist/Checkbox/Checkbox.css.d.ts +3 -0
  32. package/dist/Checkbox/Checkbox.d.ts +9 -0
  33. package/dist/Checkbox/Checkbox.js +11 -0
  34. package/dist/Checkbox/Checkbox.styles.js +8 -0
  35. package/dist/Checkbox/index.d.ts +1 -0
  36. package/dist/Checkbox/index.js +1 -0
  37. package/dist/CollapsibleSection/CollapsibleSection.css.d.ts +3 -0
  38. package/dist/CollapsibleSection/CollapsibleSection.d.ts +8 -0
  39. package/dist/CollapsibleSection/CollapsibleSection.js +11 -0
  40. package/dist/CollapsibleSection/CollapsibleSection.styles.js +8 -0
  41. package/dist/CollapsibleSection/index.d.ts +1 -0
  42. package/dist/CollapsibleSection/index.js +1 -0
  43. package/dist/ColorPicker/ColorPicker.constants.d.ts +5 -0
  44. package/dist/ColorPicker/ColorPicker.constants.js +8 -0
  45. package/dist/ColorPicker/ColorPicker.css.d.ts +19 -0
  46. package/dist/ColorPicker/ColorPicker.d.ts +6 -0
  47. package/dist/ColorPicker/ColorPicker.js +55 -0
  48. package/dist/ColorPicker/ColorPicker.styles.js +24 -0
  49. package/dist/ColorPicker/ColorPicker.type.d.ts +8 -0
  50. package/dist/ColorPicker/ColorPicker.utils.d.ts +6 -0
  51. package/dist/ColorPicker/ColorPicker.utils.js +49 -0
  52. package/dist/ColorPicker/NativeColorPicker.d.ts +2 -0
  53. package/dist/ColorPicker/NativeColorPicker.js +13 -0
  54. package/dist/ColorPicker/index.d.ts +1 -0
  55. package/dist/ColorPicker/index.js +1 -0
  56. package/dist/ColorPicker/useColorPanel.d.ts +11 -0
  57. package/dist/ColorPicker/useColorPanel.js +38 -0
  58. package/dist/ColorPicker/useColorWheel.d.ts +18 -0
  59. package/dist/ColorPicker/useColorWheel.js +232 -0
  60. package/dist/ColorRow/ColorRow.css.d.ts +1 -0
  61. package/dist/ColorRow/ColorRow.d.ts +9 -0
  62. package/dist/ColorRow/ColorRow.js +9 -0
  63. package/dist/ColorRow/ColorRow.styles.js +5 -0
  64. package/dist/ColorRow/index.d.ts +1 -0
  65. package/dist/ColorRow/index.js +1 -0
  66. package/dist/ConfirmDialog/ConfirmDialog.css.d.ts +7 -0
  67. package/dist/ConfirmDialog/ConfirmDialog.d.ts +4 -0
  68. package/dist/ConfirmDialog/ConfirmDialog.js +22 -0
  69. package/dist/ConfirmDialog/ConfirmDialog.styles.js +12 -0
  70. package/dist/ConfirmDialog/ConfirmDialog.type.d.ts +9 -0
  71. package/dist/ConfirmDialog/index.d.ts +1 -0
  72. package/dist/ConfirmDialog/index.js +1 -0
  73. package/dist/ContextMenu/ContextMenu.css.d.ts +3 -0
  74. package/dist/ContextMenu/ContextMenu.d.ts +5 -0
  75. package/dist/ContextMenu/ContextMenu.js +16 -0
  76. package/dist/ContextMenu/ContextMenu.styles.js +8 -0
  77. package/dist/ContextMenu/ContextMenu.type.d.ts +11 -0
  78. package/dist/ContextMenu/index.d.ts +1 -0
  79. package/dist/ContextMenu/index.js +1 -0
  80. package/dist/ContextMenu/useContextMenuKeyboard.d.ts +5 -0
  81. package/dist/ContextMenu/useContextMenuKeyboard.js +63 -0
  82. package/dist/ContextMenu/useViewportClamp.d.ts +2 -0
  83. package/dist/ContextMenu/useViewportClamp.js +18 -0
  84. package/dist/DateInput/DateInput.css.d.ts +5 -0
  85. package/dist/DateInput/DateInput.d.ts +11 -0
  86. package/dist/DateInput/DateInput.js +23 -0
  87. package/dist/DateInput/DateInput.styles.js +10 -0
  88. package/dist/DateInput/index.d.ts +1 -0
  89. package/dist/DateInput/index.js +1 -0
  90. package/dist/IconButton/IconButton.css.d.ts +7 -0
  91. package/dist/IconButton/IconButton.d.ts +5 -0
  92. package/dist/IconButton/IconButton.js +22 -0
  93. package/dist/IconButton/IconButton.styles.js +12 -0
  94. package/dist/IconButton/IconButton.type.d.ts +27 -0
  95. package/dist/IconButton/index.d.ts +1 -0
  96. package/dist/IconButton/index.js +1 -0
  97. package/dist/Modal/Modal.css.d.ts +6 -0
  98. package/dist/Modal/Modal.d.ts +4 -0
  99. package/dist/Modal/Modal.js +19 -0
  100. package/dist/Modal/Modal.styles.js +11 -0
  101. package/dist/Modal/Modal.type.d.ts +9 -0
  102. package/dist/Modal/index.d.ts +1 -0
  103. package/dist/Modal/index.js +1 -0
  104. package/dist/NavigationButton/NavigationButton.css.d.ts +1 -0
  105. package/dist/NavigationButton/NavigationButton.d.ts +8 -0
  106. package/dist/NavigationButton/NavigationButton.js +14 -0
  107. package/dist/NavigationButton/NavigationButton.styles.js +6 -0
  108. package/dist/NavigationButton/index.d.ts +1 -0
  109. package/dist/NavigationButton/index.js +1 -0
  110. package/dist/PositionGrid/PositionGrid.css.d.ts +10 -0
  111. package/dist/PositionGrid/PositionGrid.d.ts +5 -0
  112. package/dist/PositionGrid/PositionGrid.js +17 -0
  113. package/dist/PositionGrid/PositionGrid.styles.js +15 -0
  114. package/dist/PositionGrid/PositionGrid.type.d.ts +13 -0
  115. package/dist/PositionGrid/index.d.ts +1 -0
  116. package/dist/PositionGrid/index.js +1 -0
  117. package/dist/RadioGroup/RadioGroup.css.d.ts +3 -0
  118. package/dist/RadioGroup/RadioGroup.d.ts +15 -0
  119. package/dist/RadioGroup/RadioGroup.js +15 -0
  120. package/dist/RadioGroup/RadioGroup.styles.js +8 -0
  121. package/dist/RadioGroup/index.d.ts +1 -0
  122. package/dist/RadioGroup/index.js +1 -0
  123. package/dist/RangeInput/RangeInput.css.d.ts +4 -0
  124. package/dist/RangeInput/RangeInput.d.ts +12 -0
  125. package/dist/RangeInput/RangeInput.js +10 -0
  126. package/dist/RangeInput/RangeInput.styles.js +9 -0
  127. package/dist/RangeInput/index.d.ts +1 -0
  128. package/dist/RangeInput/index.js +1 -0
  129. package/dist/Select/Select.css.d.ts +4 -0
  130. package/dist/Select/Select.d.ts +20 -0
  131. package/dist/Select/Select.js +15 -0
  132. package/dist/Select/Select.styles.js +8 -0
  133. package/dist/Select/index.d.ts +1 -0
  134. package/dist/Select/index.js +1 -0
  135. package/dist/Sidebar/Sidebar.css.d.ts +3 -0
  136. package/dist/Sidebar/Sidebar.d.ts +10 -0
  137. package/dist/Sidebar/Sidebar.js +9 -0
  138. package/dist/Sidebar/Sidebar.styles.js +8 -0
  139. package/dist/Sidebar/index.d.ts +1 -0
  140. package/dist/Sidebar/index.js +1 -0
  141. package/dist/Tabs/Tabs.css.d.ts +5 -0
  142. package/dist/Tabs/Tabs.d.ts +14 -0
  143. package/dist/Tabs/Tabs.js +33 -0
  144. package/dist/Tabs/Tabs.styles.js +10 -0
  145. package/dist/Tabs/index.d.ts +1 -0
  146. package/dist/Tabs/index.js +1 -0
  147. package/dist/TextInput/TextInput.css.d.ts +5 -0
  148. package/dist/TextInput/TextInput.d.ts +17 -0
  149. package/dist/TextInput/TextInput.js +14 -0
  150. package/dist/TextInput/TextInput.styles.js +10 -0
  151. package/dist/TextInput/index.d.ts +1 -0
  152. package/dist/TextInput/index.js +1 -0
  153. package/dist/Toggle/Toggle.css.d.ts +4 -0
  154. package/dist/Toggle/Toggle.d.ts +9 -0
  155. package/dist/Toggle/Toggle.js +14 -0
  156. package/dist/Toggle/Toggle.styles.js +9 -0
  157. package/dist/Toggle/index.d.ts +1 -0
  158. package/dist/Toggle/index.js +1 -0
  159. package/dist/Tree/Tree.css.d.ts +10 -0
  160. package/dist/Tree/Tree.d.ts +4 -0
  161. package/dist/Tree/Tree.js +72 -0
  162. package/dist/Tree/Tree.styles.js +15 -0
  163. package/dist/Tree/Tree.type.d.ts +26 -0
  164. package/dist/Tree/TreeLevel.d.ts +3 -0
  165. package/dist/Tree/TreeLevel.js +42 -0
  166. package/dist/Tree/index.d.ts +1 -0
  167. package/dist/Tree/index.js +1 -0
  168. package/dist/hooks/index.d.ts +2 -0
  169. package/dist/hooks/index.js +2 -0
  170. package/dist/hooks/useBodyScrollLock.d.ts +1 -0
  171. package/dist/hooks/useBodyScrollLock.js +15 -0
  172. package/dist/hooks/useFocusTrap.d.ts +7 -0
  173. package/dist/hooks/useFocusTrap.js +59 -0
  174. package/dist/i18n/I18nProvider.d.ts +8 -0
  175. package/dist/i18n/I18nProvider.js +13 -0
  176. package/dist/i18n/context.d.ts +9 -0
  177. package/dist/i18n/context.js +15 -0
  178. package/dist/i18n/index.d.ts +3 -0
  179. package/dist/i18n/index.js +2 -0
  180. package/dist/i18n/locales/en.d.ts +3 -0
  181. package/dist/i18n/locales/en.js +152 -0
  182. package/dist/i18n/locales/ja.d.ts +3 -0
  183. package/dist/i18n/locales/ja.js +152 -0
  184. package/dist/i18n/locales/ko.d.ts +3 -0
  185. package/dist/i18n/locales/ko.js +152 -0
  186. package/dist/i18n/types.d.ts +3 -0
  187. package/dist/icons/ChevronLeftIcon.d.ts +7 -0
  188. package/dist/icons/ChevronLeftIcon.js +7 -0
  189. package/dist/icons/ChevronRightIcon.d.ts +7 -0
  190. package/dist/icons/ChevronRightIcon.js +7 -0
  191. package/dist/icons/DragHandleIcon.d.ts +7 -0
  192. package/dist/icons/DragHandleIcon.js +7 -0
  193. package/dist/icons/EyeIcon.d.ts +8 -0
  194. package/dist/icons/EyeIcon.js +10 -0
  195. package/dist/icons/FolderIcon.d.ts +7 -0
  196. package/dist/icons/FolderIcon.js +7 -0
  197. package/dist/icons/GearIcon.d.ts +7 -0
  198. package/dist/icons/GearIcon.js +7 -0
  199. package/dist/icons/TriangleDownIcon.d.ts +7 -0
  200. package/dist/icons/TriangleDownIcon.js +7 -0
  201. package/dist/icons/TriangleUpIcon.d.ts +7 -0
  202. package/dist/icons/TriangleUpIcon.js +7 -0
  203. package/dist/icons/index.d.ts +8 -0
  204. package/dist/icons/index.js +8 -0
  205. package/dist/index.d.ts +5 -0
  206. package/dist/index.js +6 -0
  207. package/dist/styles/Badge/Badge.css +22 -0
  208. package/dist/styles/Box/Box.css +20 -0
  209. package/dist/styles/Breadcrumb/Breadcrumb.css +28 -0
  210. package/dist/styles/Button/Button.css +51 -0
  211. package/dist/styles/CardPagination/CardPagination.css +29 -0
  212. package/dist/styles/Checkbox/Checkbox.css +22 -0
  213. package/dist/styles/CollapsibleSection/CollapsibleSection.css +21 -0
  214. package/dist/styles/ColorPicker/ColorPicker.css +153 -0
  215. package/dist/styles/ColorRow/ColorRow.css +9 -0
  216. package/dist/styles/ConfirmDialog/ConfirmDialog.css +52 -0
  217. package/dist/styles/ContextMenu/ContextMenu.css +34 -0
  218. package/dist/styles/DateInput/DateInput.css +47 -0
  219. package/dist/styles/IconButton/IconButton.css +79 -0
  220. package/dist/styles/Modal/Modal.css +58 -0
  221. package/dist/styles/NavigationButton/NavigationButton.css +13 -0
  222. package/dist/styles/PositionGrid/PositionGrid.css +70 -0
  223. package/dist/styles/RadioGroup/RadioGroup.css +26 -0
  224. package/dist/styles/RangeInput/RangeInput.css +33 -0
  225. package/dist/styles/Select/Select.css +39 -0
  226. package/dist/styles/Sidebar/Sidebar.css +18 -0
  227. package/dist/styles/Tabs/Tabs.css +61 -0
  228. package/dist/styles/TextInput/TextInput.css +37 -0
  229. package/dist/styles/Toggle/Toggle.css +46 -0
  230. package/dist/styles/Tree/Tree.css +89 -0
  231. package/dist/styles/tokens.css +13 -0
  232. package/dist/styles/tokens.css.d.ts +15 -0
  233. package/dist/styles/tokens.styles.js +5 -0
  234. package/dist/theme/index.d.ts +2 -0
  235. package/dist/theme/index.js +1 -0
  236. package/dist/theme/presets.d.ts +3 -0
  237. package/dist/theme/presets.js +22 -0
  238. package/dist/theme/types.d.ts +10 -0
  239. package/dist/utils/colorUtils.d.ts +32 -0
  240. package/dist/utils/colorUtils.js +227 -0
  241. package/dist/utils/cssVariable.d.ts +2 -0
  242. package/dist/utils/cssVariable.js +11 -0
  243. package/dist/utils/index.d.ts +2 -0
  244. package/dist/utils/index.js +2 -0
  245. package/package.json +191 -0
@@ -0,0 +1,37 @@
1
+ .TextInput_wrapper__164di2t0 {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 0.25em;
5
+ }
6
+ .TextInput_label__164di2t1 {
7
+ font-size: 0.8rem;
8
+ font-weight: 500;
9
+ color: var(--c-text);
10
+ }
11
+ .TextInput_input__164di2t2 {
12
+ width: 100%;
13
+ padding: 0.4em 0.5em;
14
+ border: 1px solid var(--c-border);
15
+ border-radius: 4px;
16
+ background: var(--c-surface);
17
+ font-size: 0.8rem;
18
+ color: var(--c-text);
19
+ box-sizing: border-box;
20
+ }
21
+ .TextInput_input__164di2t2:focus {
22
+ outline: none;
23
+ box-shadow: 0 0 0 1px var(--c-accent);
24
+ }
25
+ .TextInput_input__164di2t2::placeholder {
26
+ color: var(--c-muted);
27
+ }
28
+ .TextInput_inputError__164di2t3 {
29
+ border-color: #dc3545;
30
+ }
31
+ .TextInput_inputError__164di2t3:focus {
32
+ box-shadow: 0 0 0 1px #dc3545;
33
+ }
34
+ .TextInput_error__164di2t4 {
35
+ font-size: 0.75rem;
36
+ color: #dc3545;
37
+ }
@@ -0,0 +1,46 @@
1
+ .Toggle_wrapper__npa7nv0 {
2
+ display: flex;
3
+ align-items: center;
4
+ gap: 0.5em;
5
+ cursor: pointer;
6
+ }
7
+ .Toggle_wrapper__npa7nv0[data-disabled] {
8
+ opacity: 0.5;
9
+ cursor: default;
10
+ }
11
+ .Toggle_track__npa7nv1 {
12
+ position: relative;
13
+ width: 36px;
14
+ height: 20px;
15
+ border-radius: 10px;
16
+ background: var(--c-muted);
17
+ border: none;
18
+ cursor: pointer;
19
+ padding: 0;
20
+ transition: background 0.2s;
21
+ flex-shrink: 0;
22
+ }
23
+ .Toggle_track__npa7nv1[data-checked] {
24
+ background: var(--c-accent);
25
+ }
26
+ .Toggle_wrapper__npa7nv0[data-disabled] .Toggle_track__npa7nv1 {
27
+ cursor: default;
28
+ }
29
+ .Toggle_thumb__npa7nv2 {
30
+ position: absolute;
31
+ top: 2px;
32
+ left: 2px;
33
+ width: 16px;
34
+ height: 16px;
35
+ border-radius: 50%;
36
+ background: var(--c-surface);
37
+ transition: transform 0.2s;
38
+ }
39
+ .Toggle_track__npa7nv1[data-checked] .Toggle_thumb__npa7nv2 {
40
+ transform: translateX(16px);
41
+ }
42
+ .Toggle_label__npa7nv3 {
43
+ font-size: 0.8rem;
44
+ color: var(--c-text);
45
+ user-select: none;
46
+ }
@@ -0,0 +1,89 @@
1
+ .Tree_tree__1urdps60 {
2
+ border: 1px solid var(--c-border);
3
+ background: var(--c-surface);
4
+ min-height: 112px;
5
+ max-height: 400px;
6
+ overflow-y: auto;
7
+ }
8
+ .Tree_row__1urdps61 {
9
+ display: flex;
10
+ align-items: center;
11
+ gap: 2px;
12
+ padding: 4px 8px;
13
+ width: 100%;
14
+ border: none;
15
+ border-bottom: 1px solid transparent;
16
+ background: none;
17
+ cursor: default;
18
+ font-size: 0.8rem;
19
+ color: var(--c-text);
20
+ transition: background 0.1s, opacity 0.15s;
21
+ }
22
+ .Tree_row__1urdps61:hover {
23
+ background: var(--c-hover-bg);
24
+ color: var(--c-hover-text);
25
+ }
26
+ .Tree_rowDraggable__1urdps62 {
27
+ cursor: grab;
28
+ }
29
+ .Tree_rowDraggable__1urdps62:active {
30
+ cursor: grabbing;
31
+ }
32
+ .Tree_rowDragOver__1urdps63 {
33
+ border-bottom-color: var(--c-accent);
34
+ }
35
+ .Tree_rowHidden__1urdps64 {
36
+ opacity: 0.45;
37
+ }
38
+ .Tree_expandButton__1urdps65 {
39
+ background: none;
40
+ border: none;
41
+ cursor: pointer;
42
+ font-size: 0.55rem;
43
+ width: 16px;
44
+ text-align: center;
45
+ padding: 0;
46
+ color: var(--c-muted);
47
+ flex-shrink: 0;
48
+ line-height: 1;
49
+ }
50
+ .Tree_expandPlaceholder__1urdps66 {
51
+ width: 16px;
52
+ flex-shrink: 0;
53
+ }
54
+ .Tree_itemLabel__1urdps67 {
55
+ flex: 1;
56
+ overflow: hidden;
57
+ text-overflow: ellipsis;
58
+ white-space: nowrap;
59
+ text-align: left;
60
+ font-size: inherit;
61
+ color: inherit;
62
+ }
63
+ .Tree_actionButton__1urdps68 {
64
+ flex-shrink: 0;
65
+ display: flex;
66
+ align-items: center;
67
+ justify-content: center;
68
+ background: none;
69
+ border: none;
70
+ cursor: pointer;
71
+ padding: 2px;
72
+ color: var(--c-muted);
73
+ transition: color 0.15s;
74
+ }
75
+ .Tree_actionButton__1urdps68:hover {
76
+ color: var(--c-text);
77
+ }
78
+ .Tree_dragHandle__1urdps69 {
79
+ flex-shrink: 0;
80
+ display: flex;
81
+ align-items: center;
82
+ justify-content: center;
83
+ color: var(--c-muted);
84
+ cursor: grab;
85
+ padding: 0 2px;
86
+ }
87
+ .Tree_dragHandle__1urdps69:active {
88
+ cursor: grabbing;
89
+ }
@@ -0,0 +1,13 @@
1
+ :root {
2
+ --em: 16px;
3
+ --icon-size: 32px;
4
+ --gap: 1em;
5
+ --c-accent: #000000;
6
+ --c-accent-text: #ffffff;
7
+ --c-surface: #ffffff;
8
+ --c-text: #000000;
9
+ --c-border: #000000;
10
+ --c-hover-bg: #000000;
11
+ --c-hover-text: #ffffff;
12
+ --c-muted: #999999;
13
+ }
@@ -0,0 +1,15 @@
1
+ export declare const vars: {
2
+ em: `var(--${string})`;
3
+ iconSize: `var(--${string})`;
4
+ gap: `var(--${string})`;
5
+ color: {
6
+ accent: `var(--${string})`;
7
+ accentText: `var(--${string})`;
8
+ surface: `var(--${string})`;
9
+ text: `var(--${string})`;
10
+ border: `var(--${string})`;
11
+ hoverBg: `var(--${string})`;
12
+ hoverText: `var(--${string})`;
13
+ muted: `var(--${string})`;
14
+ };
15
+ };
@@ -0,0 +1,5 @@
1
+ import './tokens.css';
2
+
3
+ var vars = {em:'var(--em)',iconSize:'var(--icon-size)',gap:'var(--gap)',color:{accent:'var(--c-accent)',accentText:'var(--c-accent-text)',surface:'var(--c-surface)',text:'var(--c-text)',border:'var(--c-border)',hoverBg:'var(--c-hover-bg)',hoverText:'var(--c-hover-text)',muted:'var(--c-muted)'}};
4
+
5
+ export { vars };
@@ -0,0 +1,2 @@
1
+ export type { ColorTheme } from "./types";
2
+ export { lightTheme, darkTheme } from "./presets";
@@ -0,0 +1 @@
1
+ export { darkTheme, lightTheme } from './presets.js';
@@ -0,0 +1,3 @@
1
+ import type { ColorTheme } from "./types";
2
+ export declare const lightTheme: ColorTheme;
3
+ export declare const darkTheme: ColorTheme;
@@ -0,0 +1,22 @@
1
+ const lightTheme = {
2
+ accent: "#000000",
3
+ accentText: "#ffffff",
4
+ surface: "#ffffff",
5
+ text: "#000000",
6
+ border: "#000000",
7
+ hoverBg: "#000000",
8
+ hoverText: "#ffffff",
9
+ muted: "#999999"
10
+ };
11
+ const darkTheme = {
12
+ accent: "#ffffff",
13
+ accentText: "#000000",
14
+ surface: "#1a1a1a",
15
+ text: "#ffffff",
16
+ border: "#333333",
17
+ hoverBg: "#ffffff",
18
+ hoverText: "#000000",
19
+ muted: "#888888"
20
+ };
21
+
22
+ export { darkTheme, lightTheme };
@@ -0,0 +1,10 @@
1
+ export type ColorTheme = {
2
+ accent: string;
3
+ accentText: string;
4
+ surface: string;
5
+ text: string;
6
+ border: string;
7
+ hoverBg: string;
8
+ hoverText: string;
9
+ muted: string;
10
+ };
@@ -0,0 +1,32 @@
1
+ export type HSLA = {
2
+ h: number;
3
+ s: number;
4
+ l: number;
5
+ a: number;
6
+ };
7
+ export type ColorFormat = "hex" | "rgba" | "hsla";
8
+ export declare function hslToRgb(h: number, s: number, l: number): [number, number, number];
9
+ export declare function rgbToHsl(r: number, g: number, b: number): [number, number, number];
10
+ export declare function rgbToHex(r: number, g: number, b: number): string;
11
+ export declare function hexToRgb(hex: string): [number, number, number];
12
+ export declare function parseColor(str: string): HSLA;
13
+ export declare function formatColor(hsla: HSLA, format: ColorFormat): string;
14
+ export type Point = {
15
+ x: number;
16
+ y: number;
17
+ };
18
+ export declare function cartesianToAngle(x: number, y: number): number;
19
+ export declare function polarToCartesian(cx: number, cy: number, r: number, angleDeg: number): Point;
20
+ /** Barycentric hit-test */
21
+ export declare function pointInTriangle(p: Point, a: Point, b: Point, c: Point): boolean;
22
+ /** Clamp a point to the nearest point inside the triangle */
23
+ export declare function clampToTriangle(p: Point, a: Point, b: Point, c: Point): Point;
24
+ /** Get triangle vertices for the current hue, given center and radius */
25
+ export declare function getTriangleVertices(cx: number, cy: number, radius: number, hueDeg: number): [Point, Point, Point];
26
+ /** Convert S/L to a point inside the triangle (v0=pure hue, v1=white, v2=black) */
27
+ export declare function slToTrianglePoint(s: number, l: number, v0: Point, v1: Point, v2: Point): Point;
28
+ /** Convert a point inside the triangle back to S/L */
29
+ export declare function trianglePointToSL(p: Point, v0: Point, v1: Point, v2: Point): {
30
+ s: number;
31
+ l: number;
32
+ };
@@ -0,0 +1,227 @@
1
+ // --- Color conversion ---
2
+ function hslToRgb(h, s, l) {
3
+ const s1 = s / 100;
4
+ const l1 = l / 100;
5
+ const c = (1 - Math.abs(2 * l1 - 1)) * s1;
6
+ const x = c * (1 - Math.abs(((h / 60) % 2) - 1));
7
+ const m = l1 - c / 2;
8
+ let r = 0, g = 0, b = 0;
9
+ if (h < 60) {
10
+ r = c;
11
+ g = x;
12
+ }
13
+ else if (h < 120) {
14
+ r = x;
15
+ g = c;
16
+ }
17
+ else if (h < 180) {
18
+ g = c;
19
+ b = x;
20
+ }
21
+ else if (h < 240) {
22
+ g = x;
23
+ b = c;
24
+ }
25
+ else if (h < 300) {
26
+ r = x;
27
+ b = c;
28
+ }
29
+ else {
30
+ r = c;
31
+ b = x;
32
+ }
33
+ return [
34
+ Math.round((r + m) * 255),
35
+ Math.round((g + m) * 255),
36
+ Math.round((b + m) * 255)
37
+ ];
38
+ }
39
+ function rgbToHsl(r, g, b) {
40
+ const r1 = r / 255, g1 = g / 255, b1 = b / 255;
41
+ const max = Math.max(r1, g1, b1), min = Math.min(r1, g1, b1);
42
+ const l = (max + min) / 2;
43
+ if (max === min)
44
+ return [0, 0, Math.round(l * 100)];
45
+ const d = max - min;
46
+ const s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
47
+ let h = 0;
48
+ if (max === r1)
49
+ h = ((g1 - b1) / d + (g1 < b1 ? 6 : 0)) * 60;
50
+ else if (max === g1)
51
+ h = ((b1 - r1) / d + 2) * 60;
52
+ else
53
+ h = ((r1 - g1) / d + 4) * 60;
54
+ return [Math.round(h), Math.round(s * 100), Math.round(l * 100)];
55
+ }
56
+ function rgbToHex(r, g, b) {
57
+ return `#${[r, g, b].map(v => v.toString(16).padStart(2, "0")).join("")}`;
58
+ }
59
+ function hexToRgb(hex) {
60
+ if (!hex || typeof hex !== "string") {
61
+ return [0, 0, 0];
62
+ }
63
+ const h = hex.replace("#", "");
64
+ let full;
65
+ if (h.length === 3) {
66
+ // #RGB -> #RRGGBB
67
+ full = h
68
+ .split("")
69
+ .map(c => c + c)
70
+ .join("");
71
+ }
72
+ else if (h.length === 4) {
73
+ // #RGBA -> #RRGGBB (ignore alpha)
74
+ full = h
75
+ .slice(0, 3)
76
+ .split("")
77
+ .map(c => c + c)
78
+ .join("");
79
+ }
80
+ else if (h.length === 6) {
81
+ full = h;
82
+ }
83
+ else if (h.length === 8) {
84
+ // #RRGGBBAA -> #RRGGBB (ignore alpha)
85
+ full = h.slice(0, 6);
86
+ }
87
+ else {
88
+ throw new Error(`Unsupported hex format: "${hex}". Expected 3, 4, 6, or 8 hex digits.`);
89
+ }
90
+ if (!/^[0-9a-fA-F]{6}$/.test(full)) {
91
+ return [0, 0, 0];
92
+ }
93
+ return [
94
+ parseInt(full.substring(0, 2), 16),
95
+ parseInt(full.substring(2, 4), 16),
96
+ parseInt(full.substring(4, 6), 16)
97
+ ];
98
+ }
99
+ // --- Parsing ---
100
+ function parseColor(str) {
101
+ if (!str)
102
+ return { h: 0, s: 0, l: 100, a: 1 };
103
+ // rgba / rgb
104
+ const rgbaMatch = str.match(/rgba?\(\s*([\d.]+),\s*([\d.]+),\s*([\d.]+)(?:,\s*([\d.]+))?\s*\)/);
105
+ if (rgbaMatch) {
106
+ const [, r, g, b, a] = rgbaMatch;
107
+ const [h, s, l] = rgbToHsl(+r, +g, +b);
108
+ return { h, s, l, a: a != null ? +a : 1 };
109
+ }
110
+ // hsla / hsl
111
+ const hslaMatch = str.match(/hsla?\(\s*([\d.]+),\s*([\d.]+)%?,\s*([\d.]+)%?(?:,\s*([\d.]+))?\s*\)/);
112
+ if (hslaMatch) {
113
+ const [, h, s, l, a] = hslaMatch;
114
+ return { h: +h, s: +s, l: +l, a: a != null ? +a : 1 };
115
+ }
116
+ // hex
117
+ if (str.startsWith("#")) {
118
+ const [r, g, b] = hexToRgb(str);
119
+ const [h, s, l] = rgbToHsl(r, g, b);
120
+ return { h, s, l, a: 1 };
121
+ }
122
+ return { h: 0, s: 0, l: 100, a: 1 };
123
+ }
124
+ function formatColor(hsla, format) {
125
+ const { h, s, l, a } = hsla;
126
+ if (format === "hsla") {
127
+ return a < 1
128
+ ? `hsla(${h}, ${s}%, ${l}%, ${round2(a)})`
129
+ : `hsl(${h}, ${s}%, ${l}%)`;
130
+ }
131
+ const [r, g, b] = hslToRgb(h, s, l);
132
+ if (format === "rgba") {
133
+ return a < 1
134
+ ? `rgba(${r}, ${g}, ${b}, ${round2(a)})`
135
+ : `rgb(${r}, ${g}, ${b})`;
136
+ }
137
+ // hex — no alpha support, just rgb
138
+ return rgbToHex(r, g, b);
139
+ }
140
+ function round2(n) {
141
+ return Math.round(n * 100) / 100;
142
+ }
143
+ function cartesianToAngle(x, y) {
144
+ const rad = Math.atan2(y, x);
145
+ let deg = (rad * 180) / Math.PI;
146
+ if (deg < 0)
147
+ deg += 360;
148
+ return deg;
149
+ }
150
+ function polarToCartesian(cx, cy, r, angleDeg) {
151
+ const rad = (angleDeg * Math.PI) / 180;
152
+ return { x: cx + r * Math.cos(rad), y: cy + r * Math.sin(rad) };
153
+ }
154
+ /** Barycentric hit-test */
155
+ function pointInTriangle(p, a, b, c) {
156
+ const d = (b.y - c.y) * (a.x - c.x) + (c.x - b.x) * (a.y - c.y);
157
+ const u = ((b.y - c.y) * (p.x - c.x) + (c.x - b.x) * (p.y - c.y)) / d;
158
+ const v = ((c.y - a.y) * (p.x - c.x) + (a.x - c.x) * (p.y - c.y)) / d;
159
+ const w = 1 - u - v;
160
+ return u >= -0.01 && v >= -0.01 && w >= -0.01;
161
+ }
162
+ /** Clamp a point to the nearest point inside the triangle */
163
+ function clampToTriangle(p, a, b, c) {
164
+ if (pointInTriangle(p, a, b, c))
165
+ return p;
166
+ const edges = [
167
+ [a, b],
168
+ [b, c],
169
+ [c, a]
170
+ ];
171
+ let best = a;
172
+ let bestDist = Infinity;
173
+ for (const [e0, e1] of edges) {
174
+ const pt = closestPointOnSegment(p, e0, e1);
175
+ const dx = pt.x - p.x, dy = pt.y - p.y;
176
+ const dist = dx * dx + dy * dy;
177
+ if (dist < bestDist) {
178
+ bestDist = dist;
179
+ best = pt;
180
+ }
181
+ }
182
+ return best;
183
+ }
184
+ function closestPointOnSegment(p, a, b) {
185
+ const dx = b.x - a.x, dy = b.y - a.y;
186
+ const len2 = dx * dx + dy * dy;
187
+ if (len2 === 0)
188
+ return a;
189
+ const t = Math.max(0, Math.min(1, ((p.x - a.x) * dx + (p.y - a.y) * dy) / len2));
190
+ return { x: a.x + t * dx, y: a.y + t * dy };
191
+ }
192
+ /** Get triangle vertices for the current hue, given center and radius */
193
+ function getTriangleVertices(cx, cy, radius, hueDeg) {
194
+ const v0 = polarToCartesian(cx, cy, radius, hueDeg - 90);
195
+ const v1 = polarToCartesian(cx, cy, radius, hueDeg + 30);
196
+ const v2 = polarToCartesian(cx, cy, radius, hueDeg + 150);
197
+ return [v0, v1, v2];
198
+ }
199
+ /** Convert S/L to a point inside the triangle (v0=pure hue, v1=white, v2=black) */
200
+ function slToTrianglePoint(s, l, v0, v1, v2) {
201
+ const s1 = s / 100;
202
+ const l1 = l / 100;
203
+ const wWhite = (1 - s1) * l1;
204
+ const wBlack = (1 - s1) * (1 - l1);
205
+ const wHue = s1;
206
+ const total = wWhite + wBlack + wHue || 1;
207
+ return {
208
+ x: (v1.x * wWhite + v2.x * wBlack + v0.x * wHue) / total,
209
+ y: (v1.y * wWhite + v2.y * wBlack + v0.y * wHue) / total
210
+ };
211
+ }
212
+ /** Convert a point inside the triangle back to S/L */
213
+ function trianglePointToSL(p, v0, v1, v2) {
214
+ const d = (v1.y - v2.y) * (v0.x - v2.x) + (v2.x - v1.x) * (v0.y - v2.y);
215
+ if (Math.abs(d) < 0.001)
216
+ return { s: 0, l: 50 };
217
+ const wHue = ((v1.y - v2.y) * (p.x - v2.x) + (v2.x - v1.x) * (p.y - v2.y)) / d;
218
+ const wWhite = ((v2.y - v0.y) * (p.x - v2.x) + (v0.x - v2.x) * (p.y - v2.y)) / d;
219
+ const wBlack = 1 - wHue - wWhite;
220
+ const total = wWhite + wBlack + wHue || 1;
221
+ const s = Math.round(Math.max(0, Math.min(100, (wHue / total) * 100)));
222
+ const l1 = (wWhite + wHue * 0.5) / total;
223
+ const l = Math.round(Math.max(0, Math.min(100, l1 * 100)));
224
+ return { s, l };
225
+ }
226
+
227
+ export { cartesianToAngle, clampToTriangle, formatColor, getTriangleVertices, hexToRgb, hslToRgb, parseColor, pointInTriangle, polarToCartesian, rgbToHex, rgbToHsl, slToTrianglePoint, trianglePointToSL };
@@ -0,0 +1,2 @@
1
+ export declare function setCSSVariable(key: string, value: string): void;
2
+ export declare function setCSSVariables(variables: Record<string, string>): void;
@@ -0,0 +1,11 @@
1
+ function setCSSVariable(key, value) {
2
+ document.documentElement.style.setProperty(key, value);
3
+ }
4
+ function setCSSVariables(variables) {
5
+ const root = document.documentElement;
6
+ Object.entries(variables).forEach(([key, value]) => {
7
+ root.style.setProperty(key, value);
8
+ });
9
+ }
10
+
11
+ export { setCSSVariable, setCSSVariables };
@@ -0,0 +1,2 @@
1
+ export { type HSLA, type ColorFormat, type Point, hslToRgb, rgbToHsl, rgbToHex, hexToRgb, parseColor, formatColor, cartesianToAngle, polarToCartesian, pointInTriangle, clampToTriangle, getTriangleVertices, slToTrianglePoint, trianglePointToSL } from "./colorUtils";
2
+ export { setCSSVariable, setCSSVariables } from "./cssVariable";
@@ -0,0 +1,2 @@
1
+ export { cartesianToAngle, clampToTriangle, formatColor, getTriangleVertices, hexToRgb, hslToRgb, parseColor, pointInTriangle, polarToCartesian, rgbToHex, rgbToHsl, slToTrianglePoint, trianglePointToSL } from './colorUtils.js';
2
+ export { setCSSVariable, setCSSVariables } from './cssVariable.js';