@spaethtech/svelte-ui 0.1.10 → 0.3.1-dev.10.ff03a8d

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 (218) hide show
  1. package/.claude/skills/svelte-ui/SKILL.md +118 -0
  2. package/.claude/skills/themes/SKILL.md +303 -0
  3. package/CLAUDE.md +248 -0
  4. package/README.md +180 -42
  5. package/dist/components/Alert.svelte +119 -0
  6. package/dist/components/Alert.svelte.d.ts +29 -0
  7. package/dist/components/Badge/Badge.svelte +142 -69
  8. package/dist/components/Badge/Badge.svelte.d.ts +26 -6
  9. package/dist/components/Badge/index.d.ts +1 -1
  10. package/dist/components/Badge/index.js +1 -1
  11. package/dist/components/Banner.svelte +133 -0
  12. package/dist/components/Banner.svelte.d.ts +31 -0
  13. package/dist/components/Button.svelte +240 -0
  14. package/dist/components/Button.svelte.d.ts +33 -0
  15. package/dist/components/ButtonDropdown.svelte +145 -0
  16. package/dist/components/ButtonDropdown.svelte.d.ts +31 -0
  17. package/dist/components/Calendar.svelte +259 -0
  18. package/dist/components/Calendar.svelte.d.ts +27 -0
  19. package/dist/components/Card.svelte +79 -0
  20. package/dist/components/Card.svelte.d.ts +17 -0
  21. package/dist/components/CardBody.svelte +41 -0
  22. package/dist/components/CardBody.svelte.d.ts +17 -0
  23. package/dist/components/CardFooter.svelte +51 -0
  24. package/dist/components/CardFooter.svelte.d.ts +16 -0
  25. package/dist/components/CardHeader.svelte +51 -0
  26. package/dist/components/CardHeader.svelte.d.ts +16 -0
  27. package/dist/components/Checkbox.svelte +131 -0
  28. package/dist/components/Checkbox.svelte.d.ts +16 -0
  29. package/dist/components/ConfirmDialog.svelte +103 -0
  30. package/dist/components/ConfirmDialog.svelte.d.ts +33 -0
  31. package/dist/components/DataTable.svelte +518 -0
  32. package/dist/components/DataTable.svelte.d.ts +74 -0
  33. package/dist/components/DatePicker.svelte +312 -0
  34. package/dist/components/DatePicker.svelte.d.ts +32 -0
  35. package/dist/components/DateTimeInput.svelte +93 -0
  36. package/dist/components/DateTimeInput.svelte.d.ts +20 -0
  37. package/dist/components/Dialog.svelte +151 -0
  38. package/dist/components/Dialog.svelte.d.ts +30 -0
  39. package/dist/components/{EmailInput/EmailInput.svelte → EmailInput.svelte} +17 -8
  40. package/dist/components/EmailInput.svelte.d.ts +21 -0
  41. package/dist/components/Input.svelte +369 -0
  42. package/dist/components/Input.svelte.d.ts +35 -0
  43. package/dist/components/{List/List.svelte → List.svelte} +194 -133
  44. package/dist/components/{List/List.svelte.d.ts → List.svelte.d.ts} +9 -1
  45. package/dist/components/Menu.svelte +117 -0
  46. package/dist/components/Menu.svelte.d.ts +20 -0
  47. package/dist/components/NotesEditor.svelte +127 -0
  48. package/dist/components/NotesEditor.svelte.d.ts +17 -0
  49. package/dist/components/{NumberInput/NumberInput.svelte → NumberInput.svelte} +146 -105
  50. package/dist/components/{NumberInput/NumberInput.svelte.d.ts → NumberInput.svelte.d.ts} +11 -4
  51. package/dist/components/PasswordInput.svelte +52 -0
  52. package/dist/components/PasswordInput.svelte.d.ts +20 -0
  53. package/dist/components/Popup.svelte +140 -0
  54. package/dist/components/Popup.svelte.d.ts +31 -0
  55. package/dist/components/Query.svelte +284 -0
  56. package/dist/components/Query.svelte.d.ts +15 -0
  57. package/dist/components/{Rating/Rating.svelte → Rating.svelte} +19 -10
  58. package/dist/components/Rating.svelte.d.ts +13 -0
  59. package/dist/components/{SearchInput/SearchInput.svelte → SearchInput.svelte} +19 -8
  60. package/dist/components/{SearchInput/SearchInput.svelte.d.ts → SearchInput.svelte.d.ts} +9 -2
  61. package/dist/components/{Select/Select.svelte → Select.svelte} +48 -76
  62. package/dist/components/{Select/Select.svelte.d.ts → Select.svelte.d.ts} +11 -1
  63. package/dist/components/SideBarMenu/SideBarMenu.svelte +724 -0
  64. package/dist/components/SideBarMenu/SideBarMenu.svelte.d.ts +109 -0
  65. package/dist/components/SideBarMenu/index.d.ts +2 -0
  66. package/dist/components/SideBarMenu/index.js +1 -0
  67. package/dist/components/TabStrip/TabStrip.svelte +384 -0
  68. package/dist/components/TabStrip/TabStrip.svelte.d.ts +50 -0
  69. package/dist/components/TabStrip/index.d.ts +3 -0
  70. package/dist/components/TabStrip/index.js +2 -0
  71. package/dist/components/{TextArea/TextArea.svelte → TextArea.svelte} +143 -112
  72. package/dist/components/TextArea.svelte.d.ts +38 -0
  73. package/dist/components/ThemeSelector.svelte +81 -0
  74. package/dist/components/ThemeSelector.svelte.d.ts +10 -0
  75. package/dist/components/TimePicker.svelte +148 -0
  76. package/dist/components/TimePicker.svelte.d.ts +28 -0
  77. package/dist/components/TimeRangeInput.svelte +203 -0
  78. package/dist/components/TimeRangeInput.svelte.d.ts +29 -0
  79. package/dist/components/TimeSpinner.svelte +202 -0
  80. package/dist/components/TimeSpinner.svelte.d.ts +26 -0
  81. package/dist/components/Toast/Toaster.svelte +51 -0
  82. package/dist/components/Toast/Toaster.svelte.d.ts +12 -0
  83. package/dist/components/Toast/toast.svelte.d.ts +29 -0
  84. package/dist/components/Toast/toast.svelte.js +27 -0
  85. package/dist/components/Toggle.svelte +93 -0
  86. package/dist/components/Toggle.svelte.d.ts +15 -0
  87. package/dist/data/dataset.d.ts +42 -0
  88. package/dist/data/dataset.js +3 -0
  89. package/dist/data/index.d.ts +3 -0
  90. package/dist/data/index.js +3 -0
  91. package/dist/data/query/ast.d.ts +62 -0
  92. package/dist/data/query/ast.js +12 -0
  93. package/dist/data/query/index.d.ts +3 -0
  94. package/dist/data/query/index.js +3 -0
  95. package/dist/data/query/lexer.d.ts +33 -0
  96. package/dist/data/query/lexer.js +225 -0
  97. package/dist/data/query/parser.d.ts +11 -0
  98. package/dist/data/query/parser.js +252 -0
  99. package/dist/data/table/grid.svelte.d.ts +57 -0
  100. package/dist/data/table/grid.svelte.js +139 -0
  101. package/dist/data/table/index.d.ts +2 -0
  102. package/dist/data/table/index.js +2 -0
  103. package/dist/data/table/types.d.ts +79 -0
  104. package/dist/index.d.ts +49 -22
  105. package/dist/index.js +46 -21
  106. package/dist/positioning/anchored.d.ts +61 -0
  107. package/dist/positioning/anchored.js +122 -0
  108. package/dist/positioning/tooltip.d.ts +41 -0
  109. package/dist/positioning/tooltip.js +147 -0
  110. package/dist/theme.css +205 -0
  111. package/dist/types/breakpoints.d.ts +24 -0
  112. package/dist/types/breakpoints.js +13 -0
  113. package/dist/types/responsive.d.ts +32 -0
  114. package/dist/types/responsive.js +54 -0
  115. package/dist/types/sizes.d.ts +10 -3
  116. package/dist/types/time.d.ts +19 -0
  117. package/dist/types/time.js +10 -0
  118. package/dist/types/variants.d.ts +8 -1
  119. package/dist/types/variants.js +16 -1
  120. package/docs/components.md +255 -0
  121. package/docs/examples.md +323 -0
  122. package/docs/paradigm.md +240 -0
  123. package/docs/themes.md +170 -0
  124. package/docs/usage.md +450 -0
  125. package/package.json +97 -63
  126. package/dist/components/Button/Button.svelte +0 -172
  127. package/dist/components/Button/Button.svelte.d.ts +0 -32
  128. package/dist/components/Button/index.d.ts +0 -1
  129. package/dist/components/Button/index.js +0 -1
  130. package/dist/components/Dialog/Dialog.svelte +0 -101
  131. package/dist/components/Dialog/Dialog.svelte.d.ts +0 -18
  132. package/dist/components/Dialog/index.d.ts +0 -1
  133. package/dist/components/Dialog/index.js +0 -1
  134. package/dist/components/ElementManager/ElementManager.svelte +0 -397
  135. package/dist/components/ElementManager/ElementManager.svelte.d.ts +0 -43
  136. package/dist/components/ElementManager/index.d.ts +0 -1
  137. package/dist/components/ElementManager/index.js +0 -1
  138. package/dist/components/EmailInput/EmailInput.svelte.d.ts +0 -14
  139. package/dist/components/EmailInput/index.d.ts +0 -1
  140. package/dist/components/EmailInput/index.js +0 -1
  141. package/dist/components/Icon/Icon.svelte +0 -74
  142. package/dist/components/Icon/Icon.svelte.d.ts +0 -13
  143. package/dist/components/Icon/index.d.ts +0 -1
  144. package/dist/components/Icon/index.js +0 -1
  145. package/dist/components/Input/Input.svelte +0 -268
  146. package/dist/components/Input/Input.svelte.d.ts +0 -18
  147. package/dist/components/Input/index.d.ts +0 -1
  148. package/dist/components/Input/index.js +0 -1
  149. package/dist/components/List/index.d.ts +0 -1
  150. package/dist/components/List/index.js +0 -1
  151. package/dist/components/ListItem/ListItem.svelte +0 -175
  152. package/dist/components/ListItem/ListItem.svelte.d.ts +0 -24
  153. package/dist/components/ListItem/index.d.ts +0 -2
  154. package/dist/components/ListItem/index.js +0 -2
  155. package/dist/components/ListView/ListView.svelte +0 -463
  156. package/dist/components/ListView/ListView.svelte.d.ts +0 -37
  157. package/dist/components/ListView/index.d.ts +0 -2
  158. package/dist/components/ListView/index.js +0 -2
  159. package/dist/components/NodeGraph/BaseNode.d.ts +0 -57
  160. package/dist/components/NodeGraph/BaseNode.js +0 -30
  161. package/dist/components/NodeGraph/Edge.svelte +0 -60
  162. package/dist/components/NodeGraph/Edge.svelte.d.ts +0 -16
  163. package/dist/components/NodeGraph/ExpressionEvaluator.d.ts +0 -82
  164. package/dist/components/NodeGraph/ExpressionEvaluator.js +0 -152
  165. package/dist/components/NodeGraph/Node.svelte +0 -100
  166. package/dist/components/NodeGraph/Node.svelte.d.ts +0 -10
  167. package/dist/components/NodeGraph/NodeGraph.svelte +0 -52
  168. package/dist/components/NodeGraph/NodeGraph.svelte.d.ts +0 -14
  169. package/dist/components/NodeGraph/NodeInstance.svelte.d.ts +0 -80
  170. package/dist/components/NodeGraph/NodeInstance.svelte.js +0 -241
  171. package/dist/components/NodeGraph/NodePort.svelte +0 -75
  172. package/dist/components/NodeGraph/NodePort.svelte.d.ts +0 -11
  173. package/dist/components/NodeGraph/decorators.d.ts +0 -81
  174. package/dist/components/NodeGraph/decorators.js +0 -148
  175. package/dist/components/NodeGraph/index.d.ts +0 -9
  176. package/dist/components/NodeGraph/index.js +0 -9
  177. package/dist/components/NodeGraph/types.d.ts +0 -94
  178. package/dist/components/NodeGraph/types.js +0 -33
  179. package/dist/components/NotesEditor/NotesEditor.svelte +0 -203
  180. package/dist/components/NotesEditor/NotesEditor.svelte.d.ts +0 -9
  181. package/dist/components/NotesEditor/index.d.ts +0 -1
  182. package/dist/components/NotesEditor/index.js +0 -1
  183. package/dist/components/NumberInput/index.d.ts +0 -1
  184. package/dist/components/NumberInput/index.js +0 -1
  185. package/dist/components/PasswordInput/PasswordInput.svelte +0 -41
  186. package/dist/components/PasswordInput/PasswordInput.svelte.d.ts +0 -13
  187. package/dist/components/PasswordInput/index.d.ts +0 -1
  188. package/dist/components/PasswordInput/index.js +0 -1
  189. package/dist/components/Popup/index.d.ts +0 -1
  190. package/dist/components/Popup/index.js +0 -1
  191. package/dist/components/Rating/Rating.svelte.d.ts +0 -7
  192. package/dist/components/Rating/index.d.ts +0 -1
  193. package/dist/components/Rating/index.js +0 -1
  194. package/dist/components/ScrollView/ScrollView.svelte +0 -285
  195. package/dist/components/ScrollView/ScrollView.svelte.d.ts +0 -19
  196. package/dist/components/ScrollView/index.d.ts +0 -1
  197. package/dist/components/ScrollView/index.js +0 -1
  198. package/dist/components/SearchInput/index.d.ts +0 -1
  199. package/dist/components/SearchInput/index.js +0 -1
  200. package/dist/components/Select/index.d.ts +0 -1
  201. package/dist/components/Select/index.js +0 -1
  202. package/dist/components/TextArea/TextArea.svelte.d.ts +0 -19
  203. package/dist/components/TextArea/index.d.ts +0 -1
  204. package/dist/components/TextArea/index.js +0 -1
  205. package/dist/components/ThemeSelector/ThemeSelector.svelte +0 -64
  206. package/dist/components/ThemeSelector/ThemeSelector.svelte.d.ts +0 -3
  207. package/dist/components/ThemeSelector/index.d.ts +0 -1
  208. package/dist/components/ThemeSelector/index.js +0 -1
  209. package/dist/components/TooltipHandler/TooltipHandler.svelte +0 -593
  210. package/dist/components/TooltipHandler/TooltipHandler.svelte.d.ts +0 -10
  211. package/dist/components/TooltipHandler/index.d.ts +0 -1
  212. package/dist/components/TooltipHandler/index.js +0 -1
  213. package/dist/styles/sizes.d.ts +0 -78
  214. package/dist/styles/sizes.js +0 -120
  215. package/dist/styles/variants.d.ts +0 -106
  216. package/dist/styles/variants.js +0 -194
  217. package/dist/types/ManagerTypes.d.ts +0 -42
  218. /package/dist/{types/ManagerTypes.js → data/table/types.js} +0 -0
@@ -1,78 +0,0 @@
1
- import type { Size } from "../types/sizes.js";
2
- /**
3
- * Component height classes for consistent sizing across the library.
4
- * These ensure buttons, inputs, badges, and other form elements align properly.
5
- */
6
- export declare const componentHeights: Record<Size, string>;
7
- /**
8
- * Text size classes corresponding to component sizes.
9
- * Ensures text scaling is proportional to component size.
10
- */
11
- export declare const textSizes: Record<Size, string>;
12
- /**
13
- * Horizontal padding classes for components with text content.
14
- * Scales padding proportionally with component size.
15
- */
16
- export declare const horizontalPadding: Record<Size, string>;
17
- /**
18
- * Vertical padding classes for components (used less often due to fixed heights).
19
- */
20
- export declare const verticalPadding: Record<Size, string>;
21
- /**
22
- * Combined size classes for button-like components.
23
- * Includes height, text size, and padding.
24
- *
25
- * @example
26
- * // In a component
27
- * const classes = buttonSizeClasses[size];
28
- * // => "h-8 text-sm px-4 py-2"
29
- */
30
- export declare const buttonSizeClasses: Record<Size, string>;
31
- /**
32
- * Combined size classes for badge-like components.
33
- * Badges use the same padding as buttons for visual consistency.
34
- */
35
- export declare const badgeSizeClasses: Record<Size, string>;
36
- /**
37
- * Combined size classes for input-like components.
38
- * Inputs match button heights but may have different padding needs.
39
- */
40
- export declare const inputSizeClasses: Record<Size, string>;
41
- /**
42
- * Get component height class for a given size.
43
- * Useful when you only need the height without padding/text size.
44
- *
45
- * @param size - The size variant
46
- * @returns Tailwind height class (e.g., "h-8")
47
- */
48
- export declare function getComponentHeight(size: Size): string;
49
- /**
50
- * Get text size class for a given component size.
51
- *
52
- * @param size - The size variant
53
- * @returns Tailwind text size class (e.g., "text-sm")
54
- */
55
- export declare function getTextSize(size: Size): string;
56
- /**
57
- * Build custom size classes with specific options.
58
- *
59
- * @param size - The size variant
60
- * @param options - Customization options
61
- * @returns Space-separated string of size classes
62
- *
63
- * @example
64
- * // Button with full sizing
65
- * getSizeClasses('md', { includeHeight: true, includePadding: true, includeText: true })
66
- * // => "h-8 text-sm px-4 py-2"
67
- *
68
- * @example
69
- * // Input with only height and text
70
- * getSizeClasses('md', { includeHeight: true, includeText: true })
71
- * // => "h-8 text-sm"
72
- */
73
- export declare function getSizeClasses(size: Size, options?: {
74
- includeHeight?: boolean;
75
- includeText?: boolean;
76
- includeHorizontalPadding?: boolean;
77
- includeVerticalPadding?: boolean;
78
- }): string;
@@ -1,120 +0,0 @@
1
- /**
2
- * Component height classes for consistent sizing across the library.
3
- * These ensure buttons, inputs, badges, and other form elements align properly.
4
- */
5
- export const componentHeights = {
6
- sm: "h-7", // 28px
7
- md: "h-8", // 32px - default
8
- lg: "h-9", // 36px
9
- };
10
- /**
11
- * Text size classes corresponding to component sizes.
12
- * Ensures text scaling is proportional to component size.
13
- */
14
- export const textSizes = {
15
- sm: "text-xs", // 12px
16
- md: "text-sm", // 14px - default
17
- lg: "text-base", // 16px
18
- };
19
- /**
20
- * Horizontal padding classes for components with text content.
21
- * Scales padding proportionally with component size.
22
- */
23
- export const horizontalPadding = {
24
- sm: "px-3", // 12px
25
- md: "px-4", // 16px - default
26
- lg: "px-5", // 20px
27
- };
28
- /**
29
- * Vertical padding classes for components (used less often due to fixed heights).
30
- */
31
- export const verticalPadding = {
32
- sm: "py-1", // 4px
33
- md: "py-2", // 8px - default
34
- lg: "py-2.5", // 10px
35
- };
36
- /**
37
- * Combined size classes for button-like components.
38
- * Includes height, text size, and padding.
39
- *
40
- * @example
41
- * // In a component
42
- * const classes = buttonSizeClasses[size];
43
- * // => "h-8 text-sm px-4 py-2"
44
- */
45
- export const buttonSizeClasses = {
46
- sm: `${componentHeights.sm} ${textSizes.sm} ${horizontalPadding.sm} ${verticalPadding.sm}`,
47
- md: `${componentHeights.md} ${textSizes.md} ${horizontalPadding.md} ${verticalPadding.md}`,
48
- lg: `${componentHeights.lg} ${textSizes.lg} ${horizontalPadding.lg} ${verticalPadding.lg}`,
49
- };
50
- /**
51
- * Combined size classes for badge-like components.
52
- * Badges use the same padding as buttons for visual consistency.
53
- */
54
- export const badgeSizeClasses = {
55
- sm: `${componentHeights.sm} ${textSizes.sm} ${horizontalPadding.sm}`,
56
- md: `${componentHeights.md} ${textSizes.md} ${horizontalPadding.md}`,
57
- lg: `${componentHeights.lg} ${textSizes.lg} ${horizontalPadding.lg}`,
58
- };
59
- /**
60
- * Combined size classes for input-like components.
61
- * Inputs match button heights but may have different padding needs.
62
- */
63
- export const inputSizeClasses = {
64
- sm: `${componentHeights.sm} ${textSizes.sm}`,
65
- md: `${componentHeights.md} ${textSizes.md}`,
66
- lg: `${componentHeights.lg} ${textSizes.lg}`,
67
- };
68
- /**
69
- * Get component height class for a given size.
70
- * Useful when you only need the height without padding/text size.
71
- *
72
- * @param size - The size variant
73
- * @returns Tailwind height class (e.g., "h-8")
74
- */
75
- export function getComponentHeight(size) {
76
- return componentHeights[size];
77
- }
78
- /**
79
- * Get text size class for a given component size.
80
- *
81
- * @param size - The size variant
82
- * @returns Tailwind text size class (e.g., "text-sm")
83
- */
84
- export function getTextSize(size) {
85
- return textSizes[size];
86
- }
87
- /**
88
- * Build custom size classes with specific options.
89
- *
90
- * @param size - The size variant
91
- * @param options - Customization options
92
- * @returns Space-separated string of size classes
93
- *
94
- * @example
95
- * // Button with full sizing
96
- * getSizeClasses('md', { includeHeight: true, includePadding: true, includeText: true })
97
- * // => "h-8 text-sm px-4 py-2"
98
- *
99
- * @example
100
- * // Input with only height and text
101
- * getSizeClasses('md', { includeHeight: true, includeText: true })
102
- * // => "h-8 text-sm"
103
- */
104
- export function getSizeClasses(size, options = {}) {
105
- const { includeHeight = true, includeText = true, includeHorizontalPadding = false, includeVerticalPadding = false, } = options;
106
- const classes = [];
107
- if (includeHeight) {
108
- classes.push(componentHeights[size]);
109
- }
110
- if (includeText) {
111
- classes.push(textSizes[size]);
112
- }
113
- if (includeHorizontalPadding) {
114
- classes.push(horizontalPadding[size]);
115
- }
116
- if (includeVerticalPadding) {
117
- classes.push(verticalPadding[size]);
118
- }
119
- return classes.join(" ");
120
- }
@@ -1,106 +0,0 @@
1
- import type { Variant } from "../types/variants.js";
2
- /**
3
- * Structured variant style properties for consistent styling across components.
4
- * These use CSS variables for theming, allowing users to customize colors via CSS.
5
- */
6
- export interface VariantStyles {
7
- /** Background color */
8
- bg: string;
9
- /** Background color on hover */
10
- bgHover: string;
11
- /** Background color in active/pressed/checked state */
12
- bgActive: string;
13
- /** Border color */
14
- border: string;
15
- /** Border color on hover */
16
- borderHover: string;
17
- /** Border color in active/pressed/checked state */
18
- borderActive: string;
19
- /** Text color */
20
- text: string;
21
- /** Icon/SVG fill color */
22
- icon: string;
23
- /** Optical centering adjustment for text (e.g., '-mt-px' for warm colors) */
24
- textAdjustment: string;
25
- /** Optical centering adjustment for icons (e.g., '-mb-px' to shift down) */
26
- iconAdjustment: string;
27
- }
28
- /**
29
- * Variant style definitions for all standard variants.
30
- * Uses CSS variables (--color-*) for theme-aware styling.
31
- * Users customize by overriding CSS variables, not these definitions.
32
- */
33
- export declare const variantStyles: Record<Variant, VariantStyles>;
34
- /**
35
- * Options for customizing which variant styles to include
36
- */
37
- export interface VariantClassOptions {
38
- /** Include hover state styles (default: true) */
39
- includeHover?: boolean;
40
- /** Include active/pressed/checked state styles (default: false) */
41
- includeActive?: boolean;
42
- /** Include border styles (default: true) */
43
- includeBorder?: boolean;
44
- /** Include text color styles (default: true) */
45
- includeText?: boolean;
46
- /** Include icon/SVG styles (default: true) */
47
- includeIcon?: boolean;
48
- }
49
- /**
50
- * Get variant classes as a single space-separated string.
51
- * Combines background, border, text, and hover states based on options.
52
- *
53
- * @param variant - The variant to get classes for
54
- * @param options - Options to customize which styles to include
55
- * @returns Space-separated string of Tailwind classes
56
- *
57
- * @example
58
- * // Button with full styles
59
- * getVariantClasses('primary')
60
- * // => "[background-color:var(--color-primary)] text-white [border-color:var(--color-primary)] hover:[background-color:...] hover:[border-color:...] [&_svg]:fill-current"
61
- *
62
- * @example
63
- * // Input with only border styles
64
- * getVariantClasses('secondary', { includeBorder: true, includeText: false, includeIcon: false })
65
- * // => "[border-color:var(--color-secondary)] hover:[border-color:...]"
66
- */
67
- export declare function getVariantClasses(variant: Variant, options?: VariantClassOptions): string;
68
- /**
69
- * Get active/pressed/checked state classes for a variant.
70
- * Useful for toggle buttons, checkboxes styled as buttons, etc.
71
- *
72
- * @param variant - The variant to get active classes for
73
- * @returns Space-separated string of Tailwind classes for active state
74
- *
75
- * @example
76
- * // CheckButton checked state
77
- * const classes = checked ? getVariantActiveClasses('primary') : getVariantClasses('primary');
78
- */
79
- export declare function getVariantActiveClasses(variant: Variant): string;
80
- /**
81
- * Get only border-related classes for a variant.
82
- * Useful for input components that need variant-styled borders.
83
- *
84
- * @param variant - The variant to get border classes for
85
- * @param includeHover - Include hover state (default: true)
86
- * @returns Space-separated string of border-related Tailwind classes
87
- *
88
- * @example
89
- * // Input with variant border
90
- * getVariantBorderClasses('primary')
91
- * // => "[border-color:var(--color-primary)] hover:[border-color:color-mix(...)]"
92
- */
93
- export declare function getVariantBorderClasses(variant: Variant, includeHover?: boolean): string;
94
- /**
95
- * Get raw variant styles object for custom manipulation.
96
- * Use when helper functions don't provide enough flexibility.
97
- *
98
- * @param variant - The variant to get styles for
99
- * @returns VariantStyles object with individual style properties
100
- *
101
- * @example
102
- * // Custom combination
103
- * const styles = getVariantStyles('primary');
104
- * const customClasses = `${styles.bg} ${styles.text} custom-hover-class`;
105
- */
106
- export declare function getVariantStyles(variant: Variant): VariantStyles;
@@ -1,194 +0,0 @@
1
- /**
2
- * Variant style definitions for all standard variants.
3
- * Uses CSS variables (--color-*) for theme-aware styling.
4
- * Users customize by overriding CSS variables, not these definitions.
5
- */
6
- export const variantStyles = {
7
- primary: {
8
- bg: "[background-color:var(--color-primary)]",
9
- bgHover: "[background-color:color-mix(in_srgb,var(--color-primary)_90%,black)]",
10
- bgActive: "[background-color:color-mix(in_srgb,var(--color-primary)_85%,black)]",
11
- border: "[border-color:var(--color-primary)]",
12
- borderHover: "[border-color:color-mix(in_srgb,var(--color-primary)_90%,black)]",
13
- borderActive: "[border-color:color-mix(in_srgb,var(--color-primary)_85%,black)]",
14
- text: "text-white",
15
- icon: "fill-current",
16
- textAdjustment: "",
17
- iconAdjustment: "-mb-[2px]",
18
- },
19
- secondary: {
20
- bg: "[background-color:var(--color-secondary)]",
21
- bgHover: "[background-color:color-mix(in_srgb,var(--color-secondary)_90%,black)]",
22
- bgActive: "[background-color:color-mix(in_srgb,var(--color-secondary)_85%,black)]",
23
- border: "[border-color:var(--color-secondary)]",
24
- borderHover: "[border-color:color-mix(in_srgb,var(--color-secondary)_90%,black)]",
25
- borderActive: "[border-color:color-mix(in_srgb,var(--color-secondary)_85%,black)]",
26
- text: "text-white",
27
- icon: "fill-current",
28
- textAdjustment: "-mt-px",
29
- iconAdjustment: "",
30
- },
31
- danger: {
32
- bg: "[background-color:var(--color-danger)]",
33
- bgHover: "[background-color:color-mix(in_srgb,var(--color-danger)_90%,black)]",
34
- bgActive: "[background-color:color-mix(in_srgb,var(--color-danger)_85%,black)]",
35
- border: "[border-color:var(--color-danger)]",
36
- borderHover: "[border-color:color-mix(in_srgb,var(--color-danger)_90%,black)]",
37
- borderActive: "[border-color:color-mix(in_srgb,var(--color-danger)_85%,black)]",
38
- text: "text-white",
39
- icon: "fill-current",
40
- textAdjustment: "-mt-[2px]",
41
- iconAdjustment: "",
42
- },
43
- info: {
44
- bg: "[background-color:var(--color-info)]",
45
- bgHover: "[background-color:color-mix(in_srgb,var(--color-info)_90%,black)]",
46
- bgActive: "[background-color:color-mix(in_srgb,var(--color-info)_85%,black)]",
47
- border: "[border-color:var(--color-info)]",
48
- borderHover: "[border-color:color-mix(in_srgb,var(--color-info)_90%,black)]",
49
- borderActive: "[border-color:color-mix(in_srgb,var(--color-info)_85%,black)]",
50
- text: "text-white",
51
- icon: "fill-current",
52
- textAdjustment: "-mt-px",
53
- iconAdjustment: "",
54
- },
55
- success: {
56
- bg: "[background-color:var(--color-success)]",
57
- bgHover: "[background-color:color-mix(in_srgb,var(--color-success)_90%,black)]",
58
- bgActive: "[background-color:color-mix(in_srgb,var(--color-success)_85%,black)]",
59
- border: "[border-color:var(--color-success)]",
60
- borderHover: "[border-color:color-mix(in_srgb,var(--color-success)_90%,black)]",
61
- borderActive: "[border-color:color-mix(in_srgb,var(--color-success)_85%,black)]",
62
- text: "text-white",
63
- icon: "fill-current",
64
- textAdjustment: "-mt-px",
65
- iconAdjustment: "",
66
- },
67
- warning: {
68
- bg: "[background-color:var(--color-warning)]",
69
- bgHover: "[background-color:color-mix(in_srgb,var(--color-warning)_90%,black)]",
70
- bgActive: "[background-color:color-mix(in_srgb,var(--color-warning)_85%,black)]",
71
- border: "[border-color:var(--color-warning)]",
72
- borderHover: "[border-color:color-mix(in_srgb,var(--color-warning)_90%,black)]",
73
- borderActive: "[border-color:color-mix(in_srgb,var(--color-warning)_85%,black)]",
74
- text: "text-white",
75
- icon: "fill-current",
76
- textAdjustment: "-mt-[2px]",
77
- iconAdjustment: "-mt-px",
78
- },
79
- ghost: {
80
- bg: "bg-transparent",
81
- bgHover: "[background-color:color-mix(in_srgb,var(--color-text)_10%,transparent)]",
82
- bgActive: "[background-color:color-mix(in_srgb,var(--color-text)_15%,transparent)]",
83
- border: "",
84
- borderHover: "",
85
- borderActive: "",
86
- text: "[color:var(--color-text)]",
87
- icon: "fill-current",
88
- textAdjustment: "-mt-px",
89
- iconAdjustment: "",
90
- },
91
- };
92
- /**
93
- * Get variant classes as a single space-separated string.
94
- * Combines background, border, text, and hover states based on options.
95
- *
96
- * @param variant - The variant to get classes for
97
- * @param options - Options to customize which styles to include
98
- * @returns Space-separated string of Tailwind classes
99
- *
100
- * @example
101
- * // Button with full styles
102
- * getVariantClasses('primary')
103
- * // => "[background-color:var(--color-primary)] text-white [border-color:var(--color-primary)] hover:[background-color:...] hover:[border-color:...] [&_svg]:fill-current"
104
- *
105
- * @example
106
- * // Input with only border styles
107
- * getVariantClasses('secondary', { includeBorder: true, includeText: false, includeIcon: false })
108
- * // => "[border-color:var(--color-secondary)] hover:[border-color:...]"
109
- */
110
- export function getVariantClasses(variant, options = {}) {
111
- const { includeHover = true, includeActive = false, includeBorder = true, includeText = true, includeIcon = true, } = options;
112
- const styles = variantStyles[variant];
113
- const classes = [];
114
- // Base background
115
- classes.push(styles.bg);
116
- // Text color
117
- if (includeText) {
118
- classes.push(styles.text);
119
- }
120
- // Border
121
- if (includeBorder) {
122
- classes.push(styles.border);
123
- }
124
- // Icon/SVG
125
- if (includeIcon) {
126
- classes.push(`[&_svg]:${styles.icon}`);
127
- }
128
- // Hover states
129
- if (includeHover) {
130
- classes.push(`hover:${styles.bgHover}`);
131
- if (includeBorder) {
132
- classes.push(`hover:${styles.borderHover}`);
133
- }
134
- }
135
- // Active states (for pressed/checked components)
136
- if (includeActive) {
137
- classes.push(styles.bgActive);
138
- if (includeBorder) {
139
- classes.push(styles.borderActive);
140
- }
141
- }
142
- return classes.join(" ");
143
- }
144
- /**
145
- * Get active/pressed/checked state classes for a variant.
146
- * Useful for toggle buttons, checkboxes styled as buttons, etc.
147
- *
148
- * @param variant - The variant to get active classes for
149
- * @returns Space-separated string of Tailwind classes for active state
150
- *
151
- * @example
152
- * // CheckButton checked state
153
- * const classes = checked ? getVariantActiveClasses('primary') : getVariantClasses('primary');
154
- */
155
- export function getVariantActiveClasses(variant) {
156
- const styles = variantStyles[variant];
157
- return `${styles.bgActive} ${styles.borderActive} ${styles.text} [&_svg]:${styles.icon}`;
158
- }
159
- /**
160
- * Get only border-related classes for a variant.
161
- * Useful for input components that need variant-styled borders.
162
- *
163
- * @param variant - The variant to get border classes for
164
- * @param includeHover - Include hover state (default: true)
165
- * @returns Space-separated string of border-related Tailwind classes
166
- *
167
- * @example
168
- * // Input with variant border
169
- * getVariantBorderClasses('primary')
170
- * // => "[border-color:var(--color-primary)] hover:[border-color:color-mix(...)]"
171
- */
172
- export function getVariantBorderClasses(variant, includeHover = true) {
173
- const styles = variantStyles[variant];
174
- const classes = [styles.border];
175
- if (includeHover) {
176
- classes.push(`hover:${styles.borderHover}`);
177
- }
178
- return classes.join(" ");
179
- }
180
- /**
181
- * Get raw variant styles object for custom manipulation.
182
- * Use when helper functions don't provide enough flexibility.
183
- *
184
- * @param variant - The variant to get styles for
185
- * @returns VariantStyles object with individual style properties
186
- *
187
- * @example
188
- * // Custom combination
189
- * const styles = getVariantStyles('primary');
190
- * const customClasses = `${styles.bg} ${styles.text} custom-hover-class`;
191
- */
192
- export function getVariantStyles(variant) {
193
- return variantStyles[variant];
194
- }
@@ -1,42 +0,0 @@
1
- /**
2
- * Base interface that all handler components must implement
3
- * Enforces read-only elements pattern
4
- *
5
- * ⚠️ IMPORTANT: elements prop must NOT use $bindable()
6
- * Handlers should manage their own internal state
7
- *
8
- * @example
9
- * ```svelte
10
- * <script lang="ts">
11
- * import type { HandlerComponentProps } from 'svelte-ui';
12
- *
13
- * interface Props extends HandlerComponentProps {
14
- * myCustomProp?: string;
15
- * }
16
- *
17
- * // ✅ Correct: read-only elements
18
- * let { elements = new Map(), children, ...rest }: Props = $props();
19
- *
20
- * // ❌ Wrong: DO NOT do this
21
- * // let { elements = $bindable(new Map()) }: Props = $props();
22
- * </script>
23
- * ```
24
- */
25
- export interface HandlerProps {
26
- /** Read-only elements Map from ElementManager - DO NOT use $bindable() */
27
- elements: Map<HTMLElement, any>;
28
- /** Optional child content */
29
- children?: import('svelte').Snippet;
30
- }
31
- /**
32
- * Type guard to ensure elements prop is not bindable
33
- * This creates a compile-time error if someone tries to use $bindable
34
- */
35
- export type ReadOnlyElements<T extends Map<HTMLElement, any>> = T;
36
- /**
37
- * Utility type for handler components
38
- * Usage: let { elements, ...rest }: HandlerComponentProps = $props();
39
- */
40
- export interface HandlerComponentProps extends HandlerProps {
41
- [key: string]: any;
42
- }