@placeholderco/placeholder-ui 2.6.7 → 2.7.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.
- package/README.md +58 -10
- package/dist/app.css +67 -33
- package/dist/cards/GitCard.svelte +1 -1
- package/dist/display/Avatar.svelte +2 -2
- package/dist/display/LinkCollection.svelte +1 -1
- package/dist/display/alert/Alert.svelte +1 -1
- package/dist/display/filetree/FileTreeItem.svelte +1 -1
- package/dist/editors/tiptap/LinkActionMenu.svelte +11 -6
- package/dist/editors/tiptap/TipTap.svelte +3 -3
- package/dist/editors/tiptap/TipTapBubble.svelte +5 -5
- package/dist/editors/tiptap/buttonLink.d.ts +1 -1
- package/dist/editors/tiptap/buttonLink.js +3 -1
- package/dist/editors/tiptap/toolbar/AlertButton.svelte +2 -2
- package/dist/editors/tiptap/toolbar/ButtonLinkButton.svelte +5 -3
- package/dist/editors/tiptap/toolbar/ColorButton.svelte +6 -6
- package/dist/editors/tiptap/toolbar/LinkButton.svelte +9 -9
- package/dist/editors/tiptap/toolbar/TableButton.svelte +2 -2
- package/dist/editors/tiptap/toolbar/ToolbarButton.svelte +3 -3
- package/dist/form/CronBuilder.svelte +3 -3
- package/dist/form/DatePicker.svelte +8 -8
- package/dist/form/DateRangePicker.svelte +9 -9
- package/dist/form/DateTimePicker.svelte +8 -8
- package/dist/layout/Navbar.svelte +5 -5
- package/dist/layout/NavbarItemView.svelte +4 -4
- package/dist/ui/AccordionItem.svelte +20 -14
- package/dist/ui/Badge.svelte +69 -41
- package/dist/ui/Button.svelte +72 -64
- package/dist/ui/ButtonVariant.d.ts +1 -1
- package/dist/ui/Dropdown.svelte +1 -1
- package/dist/ui/Loader.svelte +1 -1
- package/dist/ui/ProgressBar.svelte +3 -3
- package/dist/ui/Tabs.svelte +1 -1
- package/dist/uiTheme.svelte.d.ts +39 -25
- package/dist/uiTheme.svelte.js +39 -45
- package/package.json +7 -7
package/dist/ui/Button.svelte
CHANGED
|
@@ -145,12 +145,14 @@
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
.white {
|
|
148
|
-
--button-text-color: var(--ui-primary);
|
|
148
|
+
--button-text-color: var(--ui-primary-text-color);
|
|
149
149
|
--button-bg-color: white;
|
|
150
150
|
--button-border: 0;
|
|
151
|
-
--button-hover-bg-color: var(--ui-
|
|
152
|
-
--button-
|
|
153
|
-
--button-
|
|
151
|
+
--button-hover-bg-color: var(--ui-accent-hover-color);
|
|
152
|
+
--button-hover-text-color: var(--ui-accent-contrast-color);
|
|
153
|
+
--button-active-bg-color: var(--ui-tertiary-pressed-color);
|
|
154
|
+
--button-active-text-color: var(--ui-tertiary-contrast-color);
|
|
155
|
+
--button-outline-color: var(--ui-focus-color);
|
|
154
156
|
}
|
|
155
157
|
|
|
156
158
|
.secondary {
|
|
@@ -180,13 +182,13 @@
|
|
|
180
182
|
}
|
|
181
183
|
|
|
182
184
|
.auto-subtle {
|
|
183
|
-
--button-text-color: var(--ui-primary);
|
|
185
|
+
--button-text-color: var(--ui-primary-text-color);
|
|
184
186
|
--button-bg-color: initial;
|
|
185
187
|
--button-hover-bg-color: var(--ui-accent);
|
|
186
|
-
--button-hover-text-color: var(--ui-
|
|
188
|
+
--button-hover-text-color: var(--ui-accent-contrast-color);
|
|
187
189
|
--button-active-bg-color: var(--ui-primary);
|
|
188
|
-
--button-active-text-color: var(--ui-
|
|
189
|
-
--button-outline-color: var(--ui-
|
|
190
|
+
--button-active-text-color: var(--ui-primary-contrast-color);
|
|
191
|
+
--button-outline-color: var(--ui-focus-color);
|
|
190
192
|
}
|
|
191
193
|
|
|
192
194
|
.danger {
|
|
@@ -197,7 +199,7 @@
|
|
|
197
199
|
|
|
198
200
|
--button-active-bg-color: #b02a37;
|
|
199
201
|
|
|
200
|
-
--button-outline-color: var(--ui-
|
|
202
|
+
--button-outline-color: var(--ui-focus-color);
|
|
201
203
|
|
|
202
204
|
:global(.loader) {
|
|
203
205
|
color: white;
|
|
@@ -205,96 +207,102 @@
|
|
|
205
207
|
}
|
|
206
208
|
|
|
207
209
|
.danger-subtle {
|
|
208
|
-
|
|
209
|
-
color:
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
:global(.loader) {
|
|
216
|
-
color: var(--danger-text);
|
|
217
|
-
}
|
|
210
|
+
--button-text-color: var(--danger-bg);
|
|
211
|
+
--button-bg-color: initial;
|
|
212
|
+
--button-hover-text-color: white;
|
|
213
|
+
--button-hover-bg-color: var(--danger-bg);
|
|
214
|
+
--button-active-text-color: white;
|
|
215
|
+
--button-active-bg-color: #b02a37;
|
|
216
|
+
--button-outline-color: var(--ui-focus-color);
|
|
218
217
|
}
|
|
219
218
|
|
|
220
219
|
.accent {
|
|
221
|
-
--button-text-color: var(--ui-
|
|
220
|
+
--button-text-color: var(--ui-accent-contrast-color);
|
|
222
221
|
--button-bg-color: var(--ui-accent);
|
|
223
|
-
--button-hover-bg-color: var(--ui-
|
|
224
|
-
--button-active-bg-color: var(--ui-
|
|
225
|
-
--button-outline-color: var(--ui-
|
|
222
|
+
--button-hover-bg-color: var(--ui-accent-hover-color);
|
|
223
|
+
--button-active-bg-color: var(--ui-accent-pressed-color);
|
|
224
|
+
--button-outline-color: var(--ui-focus-color);
|
|
226
225
|
}
|
|
227
226
|
|
|
228
227
|
.accent-outline {
|
|
229
228
|
--button-text-color: var(--ui-accent);
|
|
230
229
|
--button-bg-color: initial;
|
|
231
230
|
--button-border: 1px solid var(--ui-accent);
|
|
232
|
-
--button-hover-text-color: var(--ui-
|
|
233
|
-
--button-hover-
|
|
234
|
-
--button-active-text-color: var(--ui-
|
|
235
|
-
--button-active-
|
|
236
|
-
--button-
|
|
231
|
+
--button-hover-text-color: var(--ui-accent-contrast-color);
|
|
232
|
+
--button-hover-bg-color: var(--ui-accent);
|
|
233
|
+
--button-active-text-color: var(--ui-accent-contrast-color);
|
|
234
|
+
--button-active-bg-color: var(--ui-accent-pressed-color);
|
|
235
|
+
--button-active-border: 1px solid var(--ui-accent-pressed-color);
|
|
236
|
+
--button-outline-color: var(--ui-focus-color);
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
.accent-subtle {
|
|
240
240
|
--button-text-color: var(--ui-accent);
|
|
241
241
|
--button-bg-color: initial;
|
|
242
|
-
--button-hover-text-color: var(--ui-
|
|
242
|
+
--button-hover-text-color: var(--ui-accent-contrast-color);
|
|
243
243
|
--button-hover-bg-color: var(--ui-accent);
|
|
244
|
-
--button-active-text-color:
|
|
245
|
-
--button-active-bg-color: var(--ui-accent-
|
|
246
|
-
--button-outline-color: var(--ui-
|
|
244
|
+
--button-active-text-color: var(--ui-accent-contrast-color);
|
|
245
|
+
--button-active-bg-color: var(--ui-accent-pressed-color);
|
|
246
|
+
--button-outline-color: var(--ui-focus-color);
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
.primary {
|
|
250
250
|
--button-bg-color: var(--ui-primary);
|
|
251
|
-
--button-text-color:
|
|
252
|
-
--button-hover-bg-color: var(--ui-
|
|
253
|
-
--button-active-bg-color: var(--ui-primary-
|
|
251
|
+
--button-text-color: var(--ui-primary-contrast-color);
|
|
252
|
+
--button-hover-bg-color: var(--ui-primary-hover-color);
|
|
253
|
+
--button-active-bg-color: var(--ui-primary-pressed-color);
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
.primary-outline {
|
|
257
257
|
--button-text-color: var(--ui-primary);
|
|
258
258
|
--button-bg-color: initial;
|
|
259
259
|
--button-border: 1px solid var(--ui-primary);
|
|
260
|
-
--button-hover-text-color: var(--ui-
|
|
261
|
-
--button-hover-
|
|
262
|
-
--button-active-text-color: var(--ui-primary-
|
|
263
|
-
--button-active-
|
|
260
|
+
--button-hover-text-color: var(--ui-primary-contrast-color);
|
|
261
|
+
--button-hover-bg-color: var(--ui-primary);
|
|
262
|
+
--button-active-text-color: var(--ui-primary-contrast-color);
|
|
263
|
+
--button-active-bg-color: var(--ui-primary-pressed-color);
|
|
264
|
+
--button-active-border: 1px solid var(--ui-primary-pressed-color);
|
|
265
|
+
--button-outline-color: var(--ui-focus-color);
|
|
264
266
|
}
|
|
265
267
|
|
|
266
268
|
.primary-subtle {
|
|
267
269
|
--button-text-color: var(--ui-primary);
|
|
268
270
|
--button-bg-color: initial;
|
|
269
|
-
--button-hover-text-color:
|
|
271
|
+
--button-hover-text-color: var(--ui-primary-contrast-color);
|
|
270
272
|
--button-hover-bg-color: var(--ui-primary);
|
|
271
|
-
--button-active-text-color:
|
|
272
|
-
--button-active-bg-color: var(--ui-primary-
|
|
273
|
+
--button-active-text-color: var(--ui-primary-contrast-color);
|
|
274
|
+
--button-active-bg-color: var(--ui-primary-pressed-color);
|
|
275
|
+
--button-outline-color: var(--ui-focus-color);
|
|
273
276
|
}
|
|
274
277
|
|
|
275
278
|
.tertiary {
|
|
276
|
-
--button-text-color: var(--ui-
|
|
279
|
+
--button-text-color: var(--ui-tertiary-contrast-color);
|
|
277
280
|
--button-bg-color: var(--ui-tertiary);
|
|
278
|
-
--button-hover-bg-color: var(--ui-
|
|
279
|
-
--button-active-bg-color: var(--ui-tertiary-
|
|
280
|
-
--button-outline-color: var(--ui-
|
|
281
|
+
--button-hover-bg-color: var(--ui-tertiary-hover-color);
|
|
282
|
+
--button-active-bg-color: var(--ui-tertiary-pressed-color);
|
|
283
|
+
--button-outline-color: var(--ui-focus-color);
|
|
281
284
|
}
|
|
282
285
|
|
|
283
|
-
.tertiary-
|
|
284
|
-
|
|
285
|
-
color:
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
286
|
+
.tertiary-outline {
|
|
287
|
+
--button-text-color: var(--ui-tertiary);
|
|
288
|
+
--button-bg-color: initial;
|
|
289
|
+
--button-border: 1px solid var(--ui-tertiary);
|
|
290
|
+
--button-hover-text-color: var(--ui-tertiary-contrast-color);
|
|
291
|
+
--button-hover-bg-color: var(--ui-tertiary);
|
|
292
|
+
--button-active-text-color: var(--ui-tertiary-contrast-color);
|
|
293
|
+
--button-active-bg-color: var(--ui-tertiary-pressed-color);
|
|
294
|
+
--button-active-border: 1px solid var(--ui-tertiary-pressed-color);
|
|
295
|
+
--button-outline-color: var(--ui-focus-color);
|
|
296
|
+
}
|
|
294
297
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
+
.tertiary-subtle {
|
|
299
|
+
--button-text-color: var(--ui-tertiary);
|
|
300
|
+
--button-bg-color: initial;
|
|
301
|
+
--button-hover-text-color: var(--ui-tertiary-contrast-color);
|
|
302
|
+
--button-hover-bg-color: var(--ui-tertiary);
|
|
303
|
+
--button-active-text-color: var(--ui-tertiary-contrast-color);
|
|
304
|
+
--button-active-bg-color: var(--ui-tertiary-pressed-color);
|
|
305
|
+
--button-outline-color: var(--ui-focus-color);
|
|
298
306
|
}
|
|
299
307
|
|
|
300
308
|
button,
|
|
@@ -327,7 +335,7 @@
|
|
|
327
335
|
}
|
|
328
336
|
|
|
329
337
|
&:focus-visible {
|
|
330
|
-
outline: solid 0.125rem var(--button-outline-color, var(--ui-
|
|
338
|
+
outline: solid 0.125rem var(--button-outline-color, var(--ui-focus-color));
|
|
331
339
|
outline-offset: 0.125rem;
|
|
332
340
|
}
|
|
333
341
|
|
|
@@ -352,11 +360,11 @@
|
|
|
352
360
|
|
|
353
361
|
.auto-subtle {
|
|
354
362
|
--button-text-color: white;
|
|
355
|
-
--button-hover-text-color:
|
|
363
|
+
--button-hover-text-color: var(--ui-primary-contrast-color);
|
|
356
364
|
--button-hover-bg-color: var(--ui-primary);
|
|
357
|
-
--button-active-text-color: var(--ui-
|
|
365
|
+
--button-active-text-color: var(--ui-primary-contrast-color);
|
|
358
366
|
--button-active-bg-color: var(--ui-primary);
|
|
359
|
-
--button-outline-color: var(--ui-
|
|
367
|
+
--button-outline-color: var(--ui-focus-color);
|
|
360
368
|
}
|
|
361
369
|
}
|
|
362
370
|
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* - `accent` → `--ui-accent` (light brand colour)
|
|
7
7
|
* - `tertiary` → `--ui-tertiary` (supporting colour)
|
|
8
8
|
*/
|
|
9
|
-
export type ButtonVariant = 'white' | 'secondary' | 'secondary-subtle' | 'secondary-selected' | 'danger' | 'danger-subtle' | 'auto-subtle' | 'auto-outline' | 'primary' | 'primary-outline' | 'primary-subtle' | 'accent' | 'accent-outline' | 'accent-subtle' | 'tertiary' | 'tertiary-subtle' | 'shaded';
|
|
9
|
+
export type ButtonVariant = 'white' | 'secondary' | 'secondary-subtle' | 'secondary-selected' | 'danger' | 'danger-subtle' | 'auto-subtle' | 'auto-outline' | 'primary' | 'primary-outline' | 'primary-subtle' | 'accent' | 'accent-outline' | 'accent-subtle' | 'tertiary' | 'tertiary-outline' | 'tertiary-subtle' | 'shaded';
|
package/dist/ui/Dropdown.svelte
CHANGED
package/dist/ui/Loader.svelte
CHANGED
|
@@ -134,17 +134,17 @@
|
|
|
134
134
|
/* Variant colors */
|
|
135
135
|
.primary {
|
|
136
136
|
background-color: var(--ui-primary);
|
|
137
|
-
color:
|
|
137
|
+
color: var(--ui-primary-contrast-color);
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
.accent {
|
|
141
141
|
background-color: var(--ui-accent);
|
|
142
|
-
color: var(--ui-
|
|
142
|
+
color: var(--ui-accent-contrast-color);
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
.tertiary {
|
|
146
146
|
background-color: var(--ui-tertiary);
|
|
147
|
-
color: var(--ui-
|
|
147
|
+
color: var(--ui-tertiary-contrast-color);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
.danger {
|
package/dist/ui/Tabs.svelte
CHANGED
package/dist/uiTheme.svelte.d.ts
CHANGED
|
@@ -1,34 +1,48 @@
|
|
|
1
|
-
/** Brand
|
|
1
|
+
/** Brand colors. Accepts `#rgb`, `#rrggbb` or `rgb(r, g, b)` strings. */
|
|
2
2
|
export interface ThemeColors {
|
|
3
|
-
/**
|
|
3
|
+
/** Primary fill color for solid controls and active backgrounds. */
|
|
4
4
|
primary: string;
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
/**
|
|
5
|
+
/** Hover color for primary controls. Defaults to the accent text color. */
|
|
6
|
+
primaryHoverColor?: string;
|
|
7
|
+
/** Pressed color for primary controls. Darkened from `primary` when omitted. */
|
|
8
|
+
primaryPressedColor?: string;
|
|
9
|
+
/** Primary-colored text on page/paper surfaces and unfilled controls. Defaults to `primary`. */
|
|
10
|
+
primaryTextColor?: string;
|
|
11
|
+
/** Foreground on primary-filled controls, including hover/pressed fills. Defaults to white. */
|
|
12
|
+
primaryContrastColor?: string;
|
|
13
|
+
/** Accent fill color for solid controls and highlights. */
|
|
10
14
|
accent: string;
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
/**
|
|
15
|
+
/** Hover color for accent controls. Defaults to `tertiary`. */
|
|
16
|
+
accentHoverColor?: string;
|
|
17
|
+
/** Pressed color for accent controls. Lightened from `tertiary` (or `accent`) when omitted. */
|
|
18
|
+
accentPressedColor?: string;
|
|
19
|
+
/** Accent-colored text on page/paper surfaces and unfilled controls. Darkened from `accent` by default. */
|
|
20
|
+
accentTextColor?: string;
|
|
21
|
+
/** Foreground on accent-filled controls, including hover/pressed fills. Defaults to `primary`. */
|
|
22
|
+
accentContrastColor?: string;
|
|
23
|
+
/** Tertiary fill color for solid controls. Defaults to `accent` when omitted. */
|
|
16
24
|
tertiary?: string;
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
/**
|
|
25
|
+
/** Hover color for tertiary controls. Defaults to `accent`. */
|
|
26
|
+
tertiaryHoverColor?: string;
|
|
27
|
+
/** Pressed color for tertiary and white controls. Lightened from `tertiary` when omitted. */
|
|
28
|
+
tertiaryPressedColor?: string;
|
|
29
|
+
/** Tertiary-colored text on page/paper surfaces and unfilled controls. Darkened from `tertiary` by default. */
|
|
30
|
+
tertiaryTextColor?: string;
|
|
31
|
+
/** Foreground on tertiary-filled controls, including hover/pressed fills. Defaults to `primary`. */
|
|
32
|
+
tertiaryContrastColor?: string;
|
|
33
|
+
/** Keyboard focus ring color. Defaults to the accent text color. */
|
|
34
|
+
focusColor?: string;
|
|
35
|
+
/** Link color. Defaults to `tertiaryTextColor`. */
|
|
22
36
|
link?: string;
|
|
23
|
-
/** Link hover
|
|
37
|
+
/** Link hover color. Defaults to `accentTextColor`. */
|
|
24
38
|
linkHover?: string;
|
|
25
39
|
}
|
|
26
40
|
/**
|
|
27
|
-
* Settings that can be given per
|
|
41
|
+
* Settings that can be given per color mode. Used as the base (light) config and,
|
|
28
42
|
* with every field optional, as the `dark` override block.
|
|
29
43
|
*/
|
|
30
44
|
export interface ThemeModeConfig {
|
|
31
|
-
/** Brand
|
|
45
|
+
/** Brand colors. In the `dark` block any subset may be given; shades are derived per color. */
|
|
32
46
|
colors?: Partial<ThemeColors>;
|
|
33
47
|
/**
|
|
34
48
|
* CSS `font-family` value applied to the whole UI, e.g. `"'Inter', system-ui, sans-serif"`.
|
|
@@ -44,7 +58,7 @@ export interface ThemeModeConfig {
|
|
|
44
58
|
variables?: Record<string, string>;
|
|
45
59
|
}
|
|
46
60
|
export interface ThemeConfig extends ThemeModeConfig {
|
|
47
|
-
/** Brand
|
|
61
|
+
/** Brand colors for light mode (and dark mode unless overridden in `dark`). */
|
|
48
62
|
colors?: ThemeColors;
|
|
49
63
|
/**
|
|
50
64
|
* Overrides applied while dark mode is active (`.dark` on `<html>`). Anything not
|
|
@@ -54,7 +68,7 @@ export interface ThemeConfig extends ThemeModeConfig {
|
|
|
54
68
|
}
|
|
55
69
|
/** Reactive brand state consumed by components such as `Logo`. */
|
|
56
70
|
export declare const brandState: {
|
|
57
|
-
/** Logo for the active
|
|
71
|
+
/** Logo for the active color mode: the dark logo when set and dark mode is on, else the light one. */
|
|
58
72
|
readonly logo: string | undefined;
|
|
59
73
|
};
|
|
60
74
|
/**
|
|
@@ -63,9 +77,9 @@ export declare const brandState: {
|
|
|
63
77
|
*/
|
|
64
78
|
export declare function setLogo(svg: string | undefined, darkSvg?: string): void;
|
|
65
79
|
/**
|
|
66
|
-
* Build the `--ui-*` custom property map for one
|
|
67
|
-
* base
|
|
68
|
-
* it names. Unknown
|
|
80
|
+
* Build the `--ui-*` custom property map for one color mode. Only the groups whose
|
|
81
|
+
* base color is present are emitted, so a partial `dark` block overrides just what
|
|
82
|
+
* it names. Unknown color formats are passed through unchanged (their `-rgb`
|
|
69
83
|
* variants are skipped).
|
|
70
84
|
*/
|
|
71
85
|
export declare function themeToVariables(config: ThemeModeConfig): Record<string, string>;
|
package/dist/uiTheme.svelte.js
CHANGED
|
@@ -29,7 +29,7 @@ let lightLogo = $state(undefined);
|
|
|
29
29
|
let darkLogo = $state(undefined);
|
|
30
30
|
/** Reactive brand state consumed by components such as `Logo`. */
|
|
31
31
|
export const brandState = {
|
|
32
|
-
/** Logo for the active
|
|
32
|
+
/** Logo for the active color mode: the dark logo when set and dark mode is on, else the light one. */
|
|
33
33
|
get logo() {
|
|
34
34
|
return themeState.isDarkMode ? (darkLogo ?? lightLogo) : lightLogo;
|
|
35
35
|
}
|
|
@@ -66,11 +66,11 @@ function toHex([r, g, b]) {
|
|
|
66
66
|
function clamp(n) {
|
|
67
67
|
return Math.min(255, Math.max(0, n));
|
|
68
68
|
}
|
|
69
|
-
/** Mix a
|
|
69
|
+
/** Mix a color towards black (`amount` 0..1). */
|
|
70
70
|
function darken(rgb, amount) {
|
|
71
71
|
return rgb.map((c) => c * (1 - amount));
|
|
72
72
|
}
|
|
73
|
-
/** Mix a
|
|
73
|
+
/** Mix a color towards white (`amount` 0..1). */
|
|
74
74
|
function lighten(rgb, amount) {
|
|
75
75
|
return rgb.map((c) => c + (255 - c) * amount);
|
|
76
76
|
}
|
|
@@ -78,9 +78,9 @@ function lighten(rgb, amount) {
|
|
|
78
78
|
// Config -> CSS variables
|
|
79
79
|
// ============================================
|
|
80
80
|
/**
|
|
81
|
-
* Build the `--ui-*` custom property map for one
|
|
82
|
-
* base
|
|
83
|
-
* it names. Unknown
|
|
81
|
+
* Build the `--ui-*` custom property map for one color mode. Only the groups whose
|
|
82
|
+
* base color is present are emitted, so a partial `dark` block overrides just what
|
|
83
|
+
* it names. Unknown color formats are passed through unchanged (their `-rgb`
|
|
84
84
|
* variants are skipped).
|
|
85
85
|
*/
|
|
86
86
|
export function themeToVariables(config) {
|
|
@@ -90,46 +90,50 @@ export function themeToVariables(config) {
|
|
|
90
90
|
if (c.primary) {
|
|
91
91
|
const primary = parseColor(c.primary);
|
|
92
92
|
setColor(vars, 'primary', c.primary, primary);
|
|
93
|
-
vars['--ui-primary-
|
|
94
|
-
|
|
95
|
-
vars['--ui-primary-contrast'] =
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
if (c.primaryDark)
|
|
99
|
-
vars['--ui-primary-dark'] = c.primaryDark;
|
|
100
|
-
if (c.primaryContrast)
|
|
101
|
-
vars['--ui-primary-contrast'] = c.primaryContrast;
|
|
93
|
+
vars['--ui-primary-pressed-color'] = primary ? toHex(darken(primary, 0.35)) : c.primary;
|
|
94
|
+
vars['--ui-primary-text-color'] = 'var(--ui-primary)';
|
|
95
|
+
vars['--ui-primary-contrast-color'] = '#ffffff';
|
|
102
96
|
}
|
|
103
97
|
if (c.accent) {
|
|
104
98
|
const accent = parseColor(c.accent);
|
|
105
99
|
setColor(vars, 'accent', c.accent, accent);
|
|
106
|
-
vars['--ui-accent-
|
|
107
|
-
vars['--ui-accent-contrast'] =
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
if (c.accentDark)
|
|
111
|
-
vars['--ui-accent-dark'] = c.accentDark;
|
|
112
|
-
if (c.accentContrast)
|
|
113
|
-
vars['--ui-accent-contrast'] = c.accentContrast;
|
|
100
|
+
vars['--ui-accent-text-color'] = accent ? toHex(darken(accent, 0.5)) : c.accent;
|
|
101
|
+
vars['--ui-accent-contrast-color'] = 'var(--ui-primary)';
|
|
114
102
|
}
|
|
115
103
|
const tertiarySource = c.tertiary ?? c.accent;
|
|
116
104
|
if (tertiarySource) {
|
|
117
105
|
const tertiary = parseColor(tertiarySource);
|
|
118
106
|
setColor(vars, 'tertiary', tertiarySource, tertiary);
|
|
119
|
-
|
|
120
|
-
vars['--ui-tertiary-
|
|
121
|
-
|
|
107
|
+
vars['--ui-tertiary-text-color'] = tertiary ? toHex(darken(tertiary, 0.45)) : tertiarySource;
|
|
108
|
+
vars['--ui-tertiary-contrast-color'] = 'var(--ui-primary)';
|
|
109
|
+
const pressedColor = tertiary ? toHex(lighten(tertiary, 0.5)) : tertiarySource;
|
|
110
|
+
vars['--ui-accent-pressed-color'] = pressedColor;
|
|
111
|
+
vars['--ui-tertiary-pressed-color'] = pressedColor;
|
|
122
112
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
113
|
+
// Explicit role overrides work independently, including in partial dark-mode configs.
|
|
114
|
+
// Hover defaults live in app.css so they follow the current palette without
|
|
115
|
+
// coupling text, borders, links or focus rings to a custom hover color.
|
|
116
|
+
const overrides = {
|
|
117
|
+
primaryHoverColor: '--ui-primary-hover-color',
|
|
118
|
+
primaryPressedColor: '--ui-primary-pressed-color',
|
|
119
|
+
primaryTextColor: '--ui-primary-text-color',
|
|
120
|
+
primaryContrastColor: '--ui-primary-contrast-color',
|
|
121
|
+
accentHoverColor: '--ui-accent-hover-color',
|
|
122
|
+
accentPressedColor: '--ui-accent-pressed-color',
|
|
123
|
+
accentTextColor: '--ui-accent-text-color',
|
|
124
|
+
accentContrastColor: '--ui-accent-contrast-color',
|
|
125
|
+
tertiaryHoverColor: '--ui-tertiary-hover-color',
|
|
126
|
+
tertiaryPressedColor: '--ui-tertiary-pressed-color',
|
|
127
|
+
tertiaryTextColor: '--ui-tertiary-text-color',
|
|
128
|
+
tertiaryContrastColor: '--ui-tertiary-contrast-color',
|
|
129
|
+
focusColor: '--ui-focus-color',
|
|
130
|
+
link: '--ui-link-color',
|
|
131
|
+
linkHover: '--ui-link-hover-color'
|
|
132
|
+
};
|
|
133
|
+
for (const key of Object.keys(overrides)) {
|
|
134
|
+
if (c[key])
|
|
135
|
+
vars[overrides[key]] = c[key];
|
|
128
136
|
}
|
|
129
|
-
if (c.link)
|
|
130
|
-
vars['--ui-link-color'] = c.link;
|
|
131
|
-
if (c.linkHover)
|
|
132
|
-
vars['--ui-link-hover-color'] = c.linkHover;
|
|
133
137
|
}
|
|
134
138
|
if (config.fontFamily)
|
|
135
139
|
vars['--ui-font-family'] = config.fontFamily;
|
|
@@ -147,16 +151,6 @@ function setColor(vars, name, raw, rgb) {
|
|
|
147
151
|
vars[`--ui-${name}`] = raw;
|
|
148
152
|
}
|
|
149
153
|
}
|
|
150
|
-
function setTertiaryDark(vars, value) {
|
|
151
|
-
const rgb = parseColor(value);
|
|
152
|
-
if (rgb) {
|
|
153
|
-
vars['--ui-tertiary-dark-rgbc'] = rgb.join(', ');
|
|
154
|
-
vars['--ui-tertiary-dark'] = 'rgb(var(--ui-tertiary-dark-rgbc))';
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
vars['--ui-tertiary-dark'] = value;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
154
|
function toRule(selector, vars) {
|
|
161
155
|
const body = Object.entries(vars)
|
|
162
156
|
.map(([k, v]) => `\t${k}: ${v};`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@placeholderco/placeholder-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"description": "A modern, customizable Svelte 5 UI component library with comprehensive theming support. Re-brand it with a single config object.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Placeholderco",
|
|
@@ -56,20 +56,20 @@
|
|
|
56
56
|
"@sveltejs/kit": "^2.70.3",
|
|
57
57
|
"@sveltejs/package": "^2.5.8",
|
|
58
58
|
"@sveltejs/vite-plugin-svelte": "^7.3.0",
|
|
59
|
-
"@types/node": "^26.
|
|
59
|
+
"@types/node": "^26.6.2",
|
|
60
60
|
"globals": "^17.12.0",
|
|
61
|
-
"prettier": "^3.9.
|
|
61
|
+
"prettier": "^3.9.8",
|
|
62
62
|
"prettier-plugin-svelte": "^4.1.1",
|
|
63
63
|
"publint": "^0.3.24",
|
|
64
64
|
"rimraf": "^6.1.3",
|
|
65
|
-
"svelte": "^5.57.
|
|
65
|
+
"svelte": "^5.57.1",
|
|
66
66
|
"svelte-check": "^4.7.6",
|
|
67
67
|
"typescript": "^6.0.3",
|
|
68
68
|
"vite": "^8.3.0"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"@codemirror/autocomplete": "^6.20.3",
|
|
72
|
-
"@codemirror/commands": "^6.11.
|
|
72
|
+
"@codemirror/commands": "^6.11.1",
|
|
73
73
|
"@codemirror/lang-css": "^6.3.1",
|
|
74
74
|
"@codemirror/lang-html": "^6.4.12",
|
|
75
75
|
"@codemirror/lang-javascript": "^6.2.5",
|
|
@@ -80,9 +80,9 @@
|
|
|
80
80
|
"@codemirror/legacy-modes": "^6.5.4",
|
|
81
81
|
"@codemirror/lint": "^6.9.7",
|
|
82
82
|
"@codemirror/search": "^6.7.2",
|
|
83
|
-
"@codemirror/state": "^6.7.
|
|
83
|
+
"@codemirror/state": "^6.7.5",
|
|
84
84
|
"@codemirror/theme-one-dark": "^6.1.3",
|
|
85
|
-
"@codemirror/view": "^6.43.
|
|
85
|
+
"@codemirror/view": "^6.43.12",
|
|
86
86
|
"@lezer/highlight": "^1.2.3",
|
|
87
87
|
"@tiptap/core": "^3.31.3",
|
|
88
88
|
"@tiptap/extension-bubble-menu": "^3.31.3",
|