@marianmeres/stuic 2.66.0 → 3.0.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 (208) hide show
  1. package/README.md +292 -4
  2. package/dist/README.md +41 -18
  3. package/dist/actions/index.d.ts +1 -0
  4. package/dist/actions/index.js +1 -0
  5. package/dist/actions/popover/README.md +19 -0
  6. package/dist/actions/popover/index.css +6 -9
  7. package/dist/actions/popover/popover.svelte.js +2 -2
  8. package/dist/actions/tooltip/README.md +18 -0
  9. package/dist/actions/tooltip/index.css +5 -8
  10. package/dist/actions/tooltip/tooltip.svelte.js +1 -1
  11. package/dist/actions/typeahead.svelte.d.ts +53 -0
  12. package/dist/actions/typeahead.svelte.js +328 -0
  13. package/dist/base.css +17 -0
  14. package/dist/components/AlertConfirmPrompt/AlertConfirmPrompt.svelte +10 -10
  15. package/dist/components/AlertConfirmPrompt/AlertConfirmPrompt.svelte.d.ts +4 -3
  16. package/dist/components/AlertConfirmPrompt/Current.svelte +15 -18
  17. package/dist/components/AlertConfirmPrompt/Current.svelte.d.ts +4 -3
  18. package/dist/components/AlertConfirmPrompt/acp-icons.js +5 -4
  19. package/dist/components/AlertConfirmPrompt/index.css +66 -0
  20. package/dist/components/AssetsPreview/AssetsPreview.svelte +91 -73
  21. package/dist/components/AssetsPreview/index.css +61 -0
  22. package/dist/components/Avatar/Avatar.svelte +31 -18
  23. package/dist/components/Avatar/README.md +166 -0
  24. package/dist/components/Avatar/index.css +130 -0
  25. package/dist/components/Backdrop/Backdrop.svelte +7 -2
  26. package/dist/components/Backdrop/README.md +71 -6
  27. package/dist/components/Backdrop/index.css +31 -0
  28. package/dist/components/Button/Button.svelte +116 -124
  29. package/dist/components/Button/Button.svelte.d.ts +35 -24
  30. package/dist/components/Button/README.md +87 -21
  31. package/dist/components/Button/index.css +475 -9
  32. package/dist/components/Button/index.d.ts +1 -1
  33. package/dist/components/Button/index.js +1 -1
  34. package/dist/components/ButtonGroupRadio/ButtonGroupRadio.svelte +7 -39
  35. package/dist/components/ButtonGroupRadio/ButtonGroupRadio.svelte.d.ts +0 -1
  36. package/dist/components/ButtonGroupRadio/README.md +82 -4
  37. package/dist/components/ButtonGroupRadio/index.css +158 -14
  38. package/dist/components/Collapsible/Collapsible.svelte +7 -7
  39. package/dist/components/Collapsible/Collapsible.svelte.d.ts +2 -2
  40. package/dist/components/Collapsible/README.md +34 -2
  41. package/dist/components/Collapsible/index.css +40 -0
  42. package/dist/components/CommandMenu/CommandMenu.svelte +18 -26
  43. package/dist/components/CommandMenu/CommandMenu.svelte.d.ts +0 -1
  44. package/dist/components/CommandMenu/README.md +39 -0
  45. package/dist/components/CommandMenu/index.css +47 -2
  46. package/dist/components/DismissibleMessage/DismissibleMessage.svelte +53 -51
  47. package/dist/components/DismissibleMessage/DismissibleMessage.svelte.d.ts +6 -6
  48. package/dist/components/DismissibleMessage/README.md +93 -11
  49. package/dist/components/DismissibleMessage/index.css +128 -8
  50. package/dist/components/DismissibleMessage/index.d.ts +1 -1
  51. package/dist/components/DropdownMenu/DropdownMenu.svelte +14 -51
  52. package/dist/components/DropdownMenu/DropdownMenu.svelte.d.ts +6 -7
  53. package/dist/components/DropdownMenu/README.md +132 -0
  54. package/dist/components/DropdownMenu/index.css +258 -52
  55. package/dist/components/Input/FieldAssets.svelte +8 -5
  56. package/dist/components/Input/FieldCheckbox.svelte +7 -44
  57. package/dist/components/Input/FieldFile.svelte +1 -6
  58. package/dist/components/Input/FieldInput.svelte +9 -1
  59. package/dist/components/Input/FieldInput.svelte.d.ts +2 -0
  60. package/dist/components/Input/FieldOptions.svelte +42 -39
  61. package/dist/components/Input/FieldRadios.svelte +7 -16
  62. package/dist/components/Input/FieldSelect.svelte +1 -1
  63. package/dist/components/Input/FieldSwitch.svelte +1 -5
  64. package/dist/components/Input/FieldTextarea.svelte +1 -1
  65. package/dist/components/Input/README.md +194 -0
  66. package/dist/components/Input/_internal/FieldRadioInternal.svelte +2 -40
  67. package/dist/components/Input/_internal/InputWrap.svelte +8 -48
  68. package/dist/components/Input/index.css +524 -116
  69. package/dist/components/KbdShortcut/KbdShortcut.svelte +4 -12
  70. package/dist/components/KbdShortcut/README.md +34 -0
  71. package/dist/components/KbdShortcut/index.css +55 -0
  72. package/dist/components/ListItemButton/ListItemButton.svelte +37 -74
  73. package/dist/components/ListItemButton/ListItemButton.svelte.d.ts +1 -10
  74. package/dist/components/ListItemButton/README.md +100 -45
  75. package/dist/components/ListItemButton/index.css +173 -52
  76. package/dist/components/ListItemButton/index.d.ts +1 -1
  77. package/dist/components/ListItemButton/index.js +1 -1
  78. package/dist/components/Modal/Modal.svelte +1 -8
  79. package/dist/components/Modal/README.md +29 -0
  80. package/dist/components/Modal/index.css +38 -0
  81. package/dist/components/ModalDialog/ModalDialog.svelte +2 -21
  82. package/dist/components/ModalDialog/README.md +35 -0
  83. package/dist/components/ModalDialog/index.css +59 -0
  84. package/dist/components/Nav/Nav.svelte +732 -0
  85. package/dist/components/Nav/Nav.svelte.d.ts +110 -0
  86. package/dist/components/Nav/README.md +334 -0
  87. package/dist/components/Nav/index.css +318 -0
  88. package/dist/components/Nav/index.d.ts +1 -0
  89. package/dist/components/Nav/index.js +1 -0
  90. package/dist/components/Notifications/Notifications.svelte +44 -129
  91. package/dist/components/Notifications/Notifications.svelte.d.ts +9 -18
  92. package/dist/components/Notifications/README.md +186 -70
  93. package/dist/components/Notifications/index.css +212 -15
  94. package/dist/components/Notifications/notifications-stack.svelte.d.ts +4 -0
  95. package/dist/components/Notifications/notifications-stack.svelte.js +8 -0
  96. package/dist/components/Progress/Progress.svelte +4 -2
  97. package/dist/components/Progress/Progress.svelte.d.ts +1 -0
  98. package/dist/components/Progress/README.md +97 -11
  99. package/dist/components/Progress/_internal/Bar.svelte +4 -15
  100. package/dist/components/Progress/_internal/Bar.svelte.d.ts +1 -1
  101. package/dist/components/Progress/_internal/Circle.svelte +30 -2
  102. package/dist/components/Progress/_internal/Circle.svelte.d.ts +1 -0
  103. package/dist/components/Progress/index.css +50 -4
  104. package/dist/components/Skeleton/README.md +152 -0
  105. package/dist/components/Skeleton/Skeleton.svelte +9 -9
  106. package/dist/components/Skeleton/Skeleton.svelte.d.ts +0 -1
  107. package/dist/components/Skeleton/index.css +72 -45
  108. package/dist/components/Spinner/README.md +149 -37
  109. package/dist/components/Spinner/Spinner.svelte +14 -38
  110. package/dist/components/Spinner/Spinner.svelte.d.ts +2 -1
  111. package/dist/components/Spinner/SpinnerCircle.svelte +6 -34
  112. package/dist/components/Spinner/SpinnerCircle.svelte.d.ts +1 -0
  113. package/dist/components/Spinner/SpinnerCircleOscillate.svelte +10 -5
  114. package/dist/components/Spinner/SpinnerUnicode.svelte +3 -1
  115. package/dist/components/Spinner/SpinnerUnicode.svelte.d.ts +1 -0
  116. package/dist/components/Spinner/index.css +104 -0
  117. package/dist/components/Switch/README.md +45 -14
  118. package/dist/components/Switch/Switch.svelte +23 -48
  119. package/dist/components/Switch/Switch.svelte.d.ts +4 -2
  120. package/dist/components/Switch/index.css +121 -4
  121. package/dist/components/Switch/index.d.ts +1 -2
  122. package/dist/components/Switch/index.js +1 -2
  123. package/dist/components/TabbedMenu/README.md +37 -21
  124. package/dist/components/TabbedMenu/TabbedMenu.svelte +5 -46
  125. package/dist/components/TabbedMenu/TabbedMenu.svelte.d.ts +0 -1
  126. package/dist/components/TabbedMenu/index.css +84 -17
  127. package/dist/components/ThemePreview/README.md +289 -0
  128. package/dist/components/ThemePreview/ThemePreview.svelte +394 -0
  129. package/dist/components/ThemePreview/ThemePreview.svelte.d.ts +35 -0
  130. package/dist/components/ThemePreview/index.css +509 -0
  131. package/dist/components/ThemePreview/index.d.ts +1 -0
  132. package/dist/components/ThemePreview/index.js +1 -0
  133. package/dist/components/TwCheck/README.md +32 -13
  134. package/dist/components/TwCheck/TwCheck.svelte +11 -9
  135. package/dist/components/TwCheck/TwCheck.svelte.d.ts +0 -1
  136. package/dist/components/TwCheck/index.css +17 -2
  137. package/dist/components/TypeaheadInput/TypeaheadInput.svelte +20 -188
  138. package/dist/components/TypeaheadInput/TypeaheadInput.svelte.d.ts +4 -2
  139. package/dist/components/X/X.svelte +12 -5
  140. package/dist/components/X/X.svelte.d.ts +1 -0
  141. package/dist/icons/index.d.ts +1 -0
  142. package/dist/icons/index.js +1 -0
  143. package/dist/index.css +46 -26
  144. package/dist/index.d.ts +2 -0
  145. package/dist/index.js +2 -0
  146. package/dist/themes/blue-orange.css +217 -0
  147. package/dist/themes/blue-orange.d.ts +6 -0
  148. package/dist/themes/blue-orange.js +175 -0
  149. package/dist/themes/cyan-red.css +217 -0
  150. package/dist/themes/cyan-red.d.ts +6 -0
  151. package/dist/themes/cyan-red.js +175 -0
  152. package/dist/themes/cyan-slate.css +217 -0
  153. package/dist/themes/cyan-slate.d.ts +6 -0
  154. package/dist/themes/cyan-slate.js +175 -0
  155. package/dist/themes/emerald-pink.css +217 -0
  156. package/dist/themes/emerald-pink.d.ts +6 -0
  157. package/dist/themes/emerald-pink.js +175 -0
  158. package/dist/themes/fuchsia-emerald.css +217 -0
  159. package/dist/themes/fuchsia-emerald.d.ts +6 -0
  160. package/dist/themes/fuchsia-emerald.js +175 -0
  161. package/dist/themes/gray.css +217 -0
  162. package/dist/themes/gray.d.ts +6 -0
  163. package/dist/themes/gray.js +175 -0
  164. package/dist/themes/indigo-amber.css +217 -0
  165. package/dist/themes/indigo-amber.d.ts +6 -0
  166. package/dist/themes/indigo-amber.js +175 -0
  167. package/dist/themes/neutral.css +217 -0
  168. package/dist/themes/neutral.d.ts +6 -0
  169. package/dist/themes/neutral.js +175 -0
  170. package/dist/themes/pink-emerald.css +217 -0
  171. package/dist/themes/pink-emerald.d.ts +6 -0
  172. package/dist/themes/pink-emerald.js +175 -0
  173. package/dist/themes/purple-yellow.css +217 -0
  174. package/dist/themes/purple-yellow.d.ts +6 -0
  175. package/dist/themes/purple-yellow.js +175 -0
  176. package/dist/themes/rainbow.css +217 -0
  177. package/dist/themes/rainbow.d.ts +6 -0
  178. package/dist/themes/rainbow.js +180 -0
  179. package/dist/themes/red-blue.css +217 -0
  180. package/dist/themes/red-blue.d.ts +6 -0
  181. package/dist/themes/red-blue.js +175 -0
  182. package/dist/themes/red-cyan.css +217 -0
  183. package/dist/themes/red-cyan.d.ts +6 -0
  184. package/dist/themes/red-cyan.js +175 -0
  185. package/dist/themes/rose-teal.css +217 -0
  186. package/dist/themes/rose-teal.d.ts +6 -0
  187. package/dist/themes/rose-teal.js +175 -0
  188. package/dist/themes/sky-amber.css +217 -0
  189. package/dist/themes/sky-amber.d.ts +6 -0
  190. package/dist/themes/sky-amber.js +175 -0
  191. package/dist/themes/slate-cyan.css +217 -0
  192. package/dist/themes/slate-cyan.d.ts +6 -0
  193. package/dist/themes/slate-cyan.js +175 -0
  194. package/dist/themes/tailwind-color-pairs.md +31 -0
  195. package/dist/themes/teal-rose.css +217 -0
  196. package/dist/themes/teal-rose.d.ts +6 -0
  197. package/dist/themes/teal-rose.js +175 -0
  198. package/dist/themes/violet-lime.css +217 -0
  199. package/dist/themes/violet-lime.d.ts +6 -0
  200. package/dist/themes/violet-lime.js +175 -0
  201. package/dist/utils/design-tokens.d.ts +43 -0
  202. package/dist/utils/design-tokens.js +127 -0
  203. package/dist/utils/index.d.ts +1 -0
  204. package/dist/utils/index.js +1 -0
  205. package/dist/utils/storage-abstraction.js +1 -1
  206. package/package.json +14 -11
  207. package/dist/components/Switch/SwitchButton.svelte +0 -135
  208. package/dist/components/Switch/SwitchButton.svelte.d.ts +0 -21
@@ -0,0 +1,509 @@
1
+ /* ============================================================================
2
+ THEME PREVIEW COMPONENT
3
+
4
+ This component serves as a reference implementation for stuic theming.
5
+ It demonstrates:
6
+ - Consuming theme tokens (--stuic-color-*)
7
+ - Component-level customization tokens (--stuic-theme-preview-*)
8
+ - Internal variable pattern (--_*)
9
+ - Proper state handling (hover, active, focus)
10
+ - Dark mode compatibility
11
+ ============================================================================ */
12
+
13
+ /* ============================================================================
14
+ COMPONENT TOKENS
15
+
16
+ Define component-level customization tokens in :root.
17
+ Users can override globally: :root { --stuic-theme-preview-radius: 0; }
18
+ Or locally: <ThemePreview style="--stuic-theme-preview-gap: 2rem;">
19
+ ============================================================================ */
20
+
21
+ /* prettier-ignore */
22
+ :root {
23
+ --stuic-theme-preview-radius: var(--radius-md);
24
+ --stuic-theme-preview-gap: 1rem;
25
+ --stuic-theme-preview-transition: 150ms;
26
+
27
+ /* Section-specific tokens that consume theme colors */
28
+ --stuic-theme-preview-header-bg: var(--stuic-color-surface);
29
+ --stuic-theme-preview-header-text: var(--stuic-color-surface-foreground);
30
+ --stuic-theme-preview-sidebar-bg: var(--stuic-color-muted);
31
+ --stuic-theme-preview-sidebar-text: var(--stuic-color-muted-foreground);
32
+ --stuic-theme-preview-sidebar-width: 200px;
33
+ --stuic-theme-preview-main-bg: var(--stuic-color-background);
34
+ --stuic-theme-preview-main-text: var(--stuic-color-foreground);
35
+ --stuic-theme-preview-footer-bg: var(--stuic-color-surface);
36
+ --stuic-theme-preview-footer-text: var(--stuic-color-muted-foreground);
37
+ }
38
+
39
+ /* ============================================================================
40
+ BASE CONTAINER
41
+ ============================================================================ */
42
+
43
+ .stuic-theme-preview {
44
+ display: flex;
45
+ flex-direction: column;
46
+ min-height: 400px;
47
+ border-radius: var(--stuic-theme-preview-radius);
48
+ border: 1px solid var(--stuic-color-border);
49
+ overflow: hidden;
50
+ background: var(--stuic-theme-preview-main-bg);
51
+ color: var(--stuic-theme-preview-main-text);
52
+ }
53
+
54
+ /* ============================================================================
55
+ HEADER
56
+
57
+ Demonstrates: surface, surface-foreground, muted-foreground tokens
58
+ ============================================================================ */
59
+
60
+ .stuic-theme-preview-header {
61
+ background: var(--stuic-theme-preview-header-bg);
62
+ color: var(--stuic-theme-preview-header-text);
63
+ padding: 1rem 1.5rem;
64
+ border-bottom: 1px solid var(--stuic-color-border);
65
+ }
66
+
67
+ .stuic-theme-preview-header .header-content {
68
+ display: flex;
69
+ flex-direction: column;
70
+ gap: 0.25rem;
71
+ }
72
+
73
+ .stuic-theme-preview-header .header-title {
74
+ font-size: 1.25rem;
75
+ font-weight: 600;
76
+ margin: 0;
77
+ color: var(--stuic-color-surface-foreground);
78
+ }
79
+
80
+ .stuic-theme-preview-header .header-subtitle {
81
+ font-size: 0.875rem;
82
+ margin: 0;
83
+ color: var(--stuic-color-muted-foreground);
84
+ }
85
+
86
+ /* ============================================================================
87
+ BODY LAYOUT
88
+ ============================================================================ */
89
+
90
+ .stuic-theme-preview-body {
91
+ display: flex;
92
+ flex: 1;
93
+ min-height: 0;
94
+ }
95
+
96
+ /* ============================================================================
97
+ SIDEBAR
98
+
99
+ Demonstrates: muted, muted-foreground, hover states, active state with primary
100
+ ============================================================================ */
101
+
102
+ .stuic-theme-preview-sidebar {
103
+ width: var(--stuic-theme-preview-sidebar-width);
104
+ background: var(--stuic-theme-preview-sidebar-bg);
105
+ color: var(--stuic-theme-preview-sidebar-text);
106
+ padding: 1rem;
107
+ border-right: 1px solid var(--stuic-color-border);
108
+ display: flex;
109
+ flex-direction: column;
110
+ justify-content: space-between;
111
+ }
112
+
113
+ .stuic-theme-preview-sidebar .sidebar-nav {
114
+ display: flex;
115
+ flex-direction: column;
116
+ gap: 0.5rem;
117
+ }
118
+
119
+ .stuic-theme-preview-sidebar .nav-list {
120
+ list-style: none;
121
+ padding: 0;
122
+ margin: 0;
123
+ display: flex;
124
+ flex-direction: column;
125
+ gap: 0.25rem;
126
+ }
127
+
128
+ .stuic-theme-preview-sidebar .nav-item {
129
+ padding: 0.5rem 0.75rem;
130
+ border-radius: calc(var(--stuic-theme-preview-radius) / 2);
131
+ cursor: pointer;
132
+ transition:
133
+ background var(--stuic-theme-preview-transition),
134
+ color var(--stuic-theme-preview-transition);
135
+ color: var(--stuic-color-foreground);
136
+ }
137
+
138
+ .stuic-theme-preview-sidebar .nav-item:hover {
139
+ background: var(--stuic-color-muted-hover);
140
+ }
141
+
142
+ /* Active state uses primary intent - demonstrates intent for emphasis */
143
+ .stuic-theme-preview-sidebar .nav-item.active {
144
+ background: var(--stuic-color-primary);
145
+ color: var(--stuic-color-primary-foreground);
146
+ }
147
+
148
+ .stuic-theme-preview-sidebar .nav-item.muted {
149
+ color: var(--stuic-color-muted-foreground);
150
+ }
151
+
152
+ .stuic-theme-preview-sidebar .sidebar-footer {
153
+ padding-top: 1rem;
154
+ border-top: 1px solid var(--stuic-color-border);
155
+ }
156
+
157
+ /* ============================================================================
158
+ MAIN CONTENT
159
+
160
+ Demonstrates: background, foreground tokens
161
+ ============================================================================ */
162
+
163
+ .stuic-theme-preview-main {
164
+ flex: 1;
165
+ padding: 1.5rem;
166
+ overflow-y: auto;
167
+ display: flex;
168
+ flex-direction: column;
169
+ gap: 1.5rem;
170
+ background: var(--stuic-theme-preview-main-bg);
171
+ color: var(--stuic-theme-preview-main-text);
172
+ }
173
+
174
+ /* ============================================================================
175
+ SECTIONS
176
+ ============================================================================ */
177
+
178
+ .stuic-theme-preview .preview-section {
179
+ display: flex;
180
+ flex-direction: column;
181
+ gap: 0.75rem;
182
+ }
183
+
184
+ .stuic-theme-preview .section-label {
185
+ font-size: 0.75rem;
186
+ font-weight: 600;
187
+ text-transform: uppercase;
188
+ letter-spacing: 0.05em;
189
+ color: var(--stuic-color-muted-foreground);
190
+ }
191
+
192
+ /* ============================================================================
193
+ BUTTON DEMONSTRATIONS
194
+
195
+ This section demonstrates the INTERNAL VARIABLE PATTERN used by the Button
196
+ component. This is the core theming technique in stuic:
197
+
198
+ 1. Intent selectors set the color palette via --_color, --_fg variables
199
+ 2. Variant selectors determine HOW colors are applied via --_bg, --_text, etc.
200
+ 3. Base styles consume the internal variables
201
+
202
+ This separation allows any intent + variant combination to work automatically.
203
+ ============================================================================ */
204
+
205
+ .stuic-theme-preview .button-grid {
206
+ display: grid;
207
+ grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
208
+ gap: 1rem;
209
+ }
210
+
211
+ .stuic-theme-preview .button-column {
212
+ display: flex;
213
+ flex-direction: column;
214
+ gap: 0.5rem;
215
+ }
216
+
217
+ .stuic-theme-preview .intent-label {
218
+ font-size: 0.75rem;
219
+ color: var(--stuic-color-muted-foreground);
220
+ text-align: center;
221
+ }
222
+
223
+ /* ============================================================================
224
+ ROLE COLOR SWATCHES
225
+
226
+ Demonstrates: background/surface/muted with their paired foregrounds
227
+ ============================================================================ */
228
+
229
+ .stuic-theme-preview .role-colors-grid {
230
+ display: grid;
231
+ grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
232
+ gap: 1rem;
233
+ }
234
+
235
+ .stuic-theme-preview .color-swatch {
236
+ padding: 1rem;
237
+ border-radius: var(--stuic-theme-preview-radius);
238
+ /* border: 1px solid var(--stuic-color-border); */
239
+ display: flex;
240
+ flex-direction: column;
241
+ gap: 0.5rem;
242
+ }
243
+
244
+ .stuic-theme-preview .color-swatch .swatch-label {
245
+ font-size: 0.75rem;
246
+ font-weight: 600;
247
+ opacity: 0.7;
248
+ }
249
+
250
+ /* Each swatch uses its role color as background */
251
+ .stuic-theme-preview .color-swatch.background {
252
+ background: var(--stuic-color-background);
253
+ }
254
+
255
+ .stuic-theme-preview .color-swatch.surface {
256
+ background: var(--stuic-color-surface);
257
+ }
258
+
259
+ .stuic-theme-preview .color-swatch.surface-1 {
260
+ background: var(--stuic-color-surface-1);
261
+ }
262
+
263
+ .stuic-theme-preview .color-swatch.surface-2 {
264
+ background: var(--stuic-color-surface-2);
265
+ }
266
+
267
+ .stuic-theme-preview .color-swatch.muted-bg {
268
+ background: var(--stuic-color-muted);
269
+ }
270
+
271
+ /* Text uses the paired foreground colors */
272
+ .stuic-theme-preview .foreground-text {
273
+ color: var(--stuic-color-foreground);
274
+ }
275
+
276
+ .stuic-theme-preview .surface-foreground-text {
277
+ color: var(--stuic-color-surface-foreground);
278
+ }
279
+
280
+ .stuic-theme-preview .surface-1-foreground-text {
281
+ color: var(--stuic-color-surface-1-foreground);
282
+ }
283
+
284
+ .stuic-theme-preview .surface-2-foreground-text {
285
+ color: var(--stuic-color-surface-2-foreground);
286
+ }
287
+
288
+ .stuic-theme-preview .muted-foreground-text {
289
+ color: var(--stuic-color-muted-foreground);
290
+ }
291
+
292
+ .stuic-theme-preview .muted-text {
293
+ color: var(--stuic-color-muted-foreground);
294
+ }
295
+
296
+ /* ============================================================================
297
+ BORDER DEMONSTRATIONS
298
+
299
+ Demonstrates: border, border-hover, border-active tokens
300
+ ============================================================================ */
301
+
302
+ .stuic-theme-preview .border-examples {
303
+ display: flex;
304
+ gap: 1rem;
305
+ flex-wrap: wrap;
306
+ }
307
+
308
+ .stuic-theme-preview .border-box {
309
+ padding: 1rem;
310
+ border-radius: var(--stuic-theme-preview-radius);
311
+ background: var(--stuic-color-surface);
312
+ transition: border-color var(--stuic-theme-preview-transition);
313
+ }
314
+
315
+ .stuic-theme-preview .border-box.default {
316
+ border: 2px solid var(--stuic-color-border);
317
+ }
318
+
319
+ .stuic-theme-preview .border-box.hover {
320
+ border: 2px solid var(--stuic-color-border);
321
+ }
322
+
323
+ .stuic-theme-preview .border-box.hover:hover {
324
+ border-color: var(--stuic-color-border-hover);
325
+ }
326
+
327
+ .stuic-theme-preview .border-box.active {
328
+ border: 2px solid var(--stuic-color-border-active);
329
+ }
330
+
331
+ /* ============================================================================
332
+ INPUT DEMONSTRATIONS
333
+
334
+ Demonstrates: input, ring tokens, focus states
335
+ ============================================================================ */
336
+
337
+ .stuic-theme-preview .input-examples {
338
+ display: flex;
339
+ gap: 1rem;
340
+ flex-wrap: wrap;
341
+ }
342
+
343
+ .stuic-theme-preview .input-wrapper {
344
+ flex: 1;
345
+ min-width: 200px;
346
+ }
347
+
348
+ .stuic-theme-preview .preview-input {
349
+ width: 100%;
350
+ padding: 0.625rem 0.75rem;
351
+ font-size: 1rem;
352
+ border-radius: var(--stuic-theme-preview-radius);
353
+ border: 1px solid var(--stuic-color-border);
354
+ background: var(--stuic-color-input);
355
+ color: var(--stuic-color-foreground);
356
+ transition:
357
+ border-color var(--stuic-theme-preview-transition),
358
+ background var(--stuic-theme-preview-transition);
359
+ }
360
+
361
+ .stuic-theme-preview .preview-input::placeholder {
362
+ color: var(--stuic-color-muted-foreground);
363
+ }
364
+
365
+ .stuic-theme-preview .preview-input:hover {
366
+ background: var(--stuic-color-input-hover);
367
+ border-color: var(--stuic-color-border-hover);
368
+ }
369
+
370
+ /* Focus state uses ring token */
371
+ .stuic-theme-preview .preview-input:focus,
372
+ .stuic-theme-preview .preview-input.focus {
373
+ outline: 3px solid var(--stuic-color-ring);
374
+ outline-offset: 0;
375
+ border-color: var(--stuic-color-primary);
376
+ }
377
+
378
+ /* ============================================================================
379
+ HIGHLIGHT BOXES
380
+
381
+ Demonstrates: using intent colors for content areas (soft variant pattern)
382
+ ============================================================================ */
383
+
384
+ .stuic-theme-preview .highlight-box {
385
+ padding: 1rem;
386
+ border-radius: var(--stuic-theme-preview-radius);
387
+ margin-bottom: 0.75rem;
388
+ }
389
+
390
+ .stuic-theme-preview .highlight-box:last-child {
391
+ margin-bottom: 0;
392
+ }
393
+
394
+ .stuic-theme-preview .highlight-box strong {
395
+ display: block;
396
+ margin-bottom: 0.25rem;
397
+ }
398
+
399
+ .stuic-theme-preview .highlight-box p {
400
+ margin: 0;
401
+ font-size: 0.875rem;
402
+ opacity: 0.9;
403
+ }
404
+
405
+ /* Using soft variant pattern for content boxes */
406
+ .stuic-theme-preview .highlight-box.primary {
407
+ background: color-mix(in srgb, var(--stuic-color-primary) 15%, transparent);
408
+ color: var(--stuic-color-primary);
409
+ border: 1px solid color-mix(in srgb, var(--stuic-color-primary) 30%, transparent);
410
+ }
411
+
412
+ .stuic-theme-preview .highlight-box.accent {
413
+ background: color-mix(in srgb, var(--stuic-color-accent) 15%, transparent);
414
+ color: var(--stuic-color-accent);
415
+ border: 1px solid color-mix(in srgb, var(--stuic-color-accent) 30%, transparent);
416
+ }
417
+
418
+ /* ============================================================================
419
+ TYPOGRAPHY SECTION
420
+ ============================================================================ */
421
+
422
+ .stuic-theme-preview .typography-demo {
423
+ display: flex;
424
+ flex-direction: column;
425
+ gap: 0.5rem;
426
+ }
427
+
428
+ .stuic-theme-preview .typography-demo p {
429
+ margin: 0;
430
+ }
431
+
432
+ .stuic-theme-preview .text-foreground {
433
+ color: var(--stuic-color-foreground);
434
+ }
435
+
436
+ .stuic-theme-preview .text-muted {
437
+ color: var(--stuic-color-muted-foreground);
438
+ }
439
+
440
+ .stuic-theme-preview .text-surface-foreground {
441
+ color: var(--stuic-color-surface-foreground);
442
+ }
443
+
444
+ /* ============================================================================
445
+ FOOTER
446
+ ============================================================================ */
447
+
448
+ .stuic-theme-preview-footer {
449
+ background: var(--stuic-theme-preview-footer-bg);
450
+ color: var(--stuic-theme-preview-footer-text);
451
+ padding: 0.75rem 1.5rem;
452
+ border-top: 1px solid var(--stuic-color-border);
453
+ }
454
+
455
+ .stuic-theme-preview-footer .footer-content {
456
+ display: flex;
457
+ align-items: center;
458
+ justify-content: center;
459
+ gap: 0.5rem;
460
+ font-size: 0.875rem;
461
+ }
462
+
463
+ .stuic-theme-preview-footer .footer-divider {
464
+ opacity: 0.3;
465
+ }
466
+
467
+ /* ============================================================================
468
+ DARK MODE COMPATIBILITY
469
+
470
+ The component inherits dark mode behavior from theme tokens automatically.
471
+ When using theme tokens properly (--stuic-color-*), no explicit .dark
472
+ overrides are needed - the theme handles it.
473
+ ============================================================================ */
474
+
475
+ /* ============================================================================
476
+ RESPONSIVE ADJUSTMENTS
477
+ ============================================================================ */
478
+
479
+ @media (max-width: 640px) {
480
+ .stuic-theme-preview-body {
481
+ flex-direction: column;
482
+ }
483
+
484
+ .stuic-theme-preview-sidebar {
485
+ width: 100%;
486
+ border-right: none;
487
+ border-bottom: 1px solid var(--stuic-color-border);
488
+ }
489
+
490
+ .stuic-theme-preview .button-grid {
491
+ grid-template-columns: repeat(2, 1fr);
492
+ }
493
+ }
494
+
495
+ /* ============================================================================
496
+ REDUCED MOTION
497
+
498
+ Respect user preferences for reduced motion.
499
+ ============================================================================ */
500
+
501
+ @media (prefers-reduced-motion: reduce) {
502
+ .stuic-theme-preview,
503
+ .stuic-theme-preview-button,
504
+ .stuic-theme-preview .border-box,
505
+ .stuic-theme-preview .preview-input,
506
+ .stuic-theme-preview-sidebar .nav-item {
507
+ transition: none;
508
+ }
509
+ }
@@ -0,0 +1 @@
1
+ export { default as ThemePreview, type Props as ThemePreviewProps, INTENT_COLORS, BUTTON_VARIANTS, } from "./ThemePreview.svelte";
@@ -0,0 +1 @@
1
+ export { default as ThemePreview, INTENT_COLORS, BUTTON_VARIANTS, } from "./ThemePreview.svelte";
@@ -1,43 +1,62 @@
1
1
  # TwCheck
2
2
 
3
- A development utility component to verify that Tailwind CSS is properly loaded and working. Displays differently styled content at different breakpoints.
3
+ A development utility component to verify that Tailwind CSS is properly loaded and working. Displays different styles at different breakpoints.
4
4
 
5
5
  ## Props
6
6
 
7
7
  | Prop | Type | Default | Description |
8
8
  |------|------|---------|-------------|
9
- | `theme` | `string` | - | Tailwind color theme for background |
9
+ | `theme` | `string` | - | Tailwind color palette name (e.g., "blue", "amber") |
10
10
  | `class` | `string` | - | Additional CSS classes |
11
11
 
12
+ ## Component Tokens
13
+
14
+ Override to customize appearance:
15
+
16
+ ```css
17
+ :root {
18
+ --stuic-twcheck-bg: var(--stuic-color-primary);
19
+ --stuic-twcheck-text: var(--stuic-color-primary-foreground);
20
+ --stuic-twcheck-border-color: var(--stuic-color-accent);
21
+ --stuic-twcheck-padding-x: calc(var(--spacing) * 2);
22
+ }
23
+ ```
24
+
12
25
  ## Usage
13
26
 
14
27
  ### Basic Check
15
28
 
16
29
  ```svelte
17
30
  <script lang="ts">
18
- import { TwCheck } from 'stuic';
31
+ import { TwCheck } from '@marianmeres/stuic';
19
32
  </script>
20
33
 
21
- <TwCheck>
22
- TW Check
23
- </TwCheck>
34
+ <TwCheck>TW Check</TwCheck>
24
35
  ```
25
36
 
26
- ### With Theme
37
+ ### Customization Strategies
27
38
 
28
39
  ```svelte
29
- <TwCheck theme="blue">
30
- Tailwind is working!
31
- </TwCheck>
40
+ <!-- 1. Default styles (uses theme tokens) -->
41
+ <TwCheck>default</TwCheck>
42
+
43
+ <!-- 2. Tailwind class override -->
44
+ <TwCheck class="bg-green-600 text-white">green</TwCheck>
45
+
46
+ <!-- 3. CSS variable override -->
47
+ <TwCheck --stuic-twcheck-bg="var(--color-blue-600)">blue</TwCheck>
48
+
49
+ <!-- 4. Theme prop shorthand -->
50
+ <TwCheck theme="amber">amber</TwCheck>
32
51
  ```
33
52
 
34
53
  ## Visual Indicators
35
54
 
36
55
  When Tailwind CSS is properly loaded:
37
- - **Mobile**: Yellow text, no border
38
- - **Desktop (sm+)**: White text, teal border, larger font
56
+ - **Mobile**: Smaller text (text-base), no border
57
+ - **Desktop (sm+)**: Larger text (text-2xl), visible border
39
58
 
40
- If the component appears unstyled (plain text), Tailwind CSS is not loading correctly.
59
+ If the component appears unstyled (no size change, no border at wider viewports), Tailwind CSS is not loading correctly.
41
60
 
42
61
  ## Development Use
43
62
 
@@ -9,24 +9,26 @@
9
9
  </script>
10
10
 
11
11
  <script lang="ts">
12
- import "./index.css";
13
- import { twMerge } from "tailwind-merge";
12
+ import { twMerge } from "../../utils/index.js";
14
13
 
15
14
  let { class: classProp, children, theme }: Props = $props();
16
15
 
16
+ // Responsive classes demonstrate Tailwind is working:
17
+ // - Font size changes: text-base -> sm:text-2xl
18
+ // Note: border styles are in component CSS to avoid Vite HMR timing issues
17
19
  const _default = `
18
- stuic-twcheck bg-twcheck-bg
19
- inline-block px-2
20
- text-yellow-300 sm:text-white
20
+ stuic-twcheck
21
+ inline-block
21
22
  text-base sm:text-2xl
22
23
  sm:border-2 border-teal-400
23
24
  `;
24
25
 
25
26
  const _buildTheme = (theme?: string) => {
26
- // simulating missing css var
27
- return theme
28
- ? `--color-twcheck-bg: var(--color-foo-bar-baz, var(--color-${theme}-600));`
29
- : "";
27
+ if (!theme) return "";
28
+ return [
29
+ `--stuic-twcheck-bg: var(--color-${theme}-600)`,
30
+ `--stuic-twcheck-text: var(--color-${theme}-100, var(--color-white))`,
31
+ ].join(";");
30
32
  };
31
33
  </script>
32
34
 
@@ -4,7 +4,6 @@ export interface Props {
4
4
  children?: Snippet;
5
5
  theme?: string;
6
6
  }
7
- import "./index.css";
8
7
  declare const TwCheck: import("svelte").Component<Props, {}, "">;
9
8
  type TwCheck = ReturnType<typeof TwCheck>;
10
9
  export default TwCheck;
@@ -1,3 +1,18 @@
1
- @theme inline {
2
- --color-twcheck-bg: var(--color-twcheck-bg, var(--color-red-600));
1
+ /* TwCheck component tokens */
2
+ :root {
3
+ --stuic-twcheck-bg: var(--stuic-color-primary);
4
+ --stuic-twcheck-text: var(--stuic-color-primary-foreground);
5
+ --stuic-twcheck-border-color: var(--stuic-color-accent);
6
+ --stuic-twcheck-padding-x: calc(var(--spacing) * 2);
7
+ }
8
+
9
+ /* @layer components ensures Tailwind utilities (@layer utilities) win in the cascade */
10
+ @layer components {
11
+ .stuic-twcheck {
12
+ background: var(--stuic-twcheck-bg);
13
+ color: var(--stuic-twcheck-text);
14
+ border-color: var(--stuic-twcheck-border-color);
15
+ padding-left: var(--stuic-twcheck-padding-x);
16
+ padding-right: var(--stuic-twcheck-padding-x);
17
+ }
3
18
  }