@moldea.ai/website-ui 1.2.0 → 1.2.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 +5 -1
- package/package.json +1 -1
- package/src/styles.css +52 -1
- package/src/tokens.css +18 -8
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ The package owns the reusable design tokens, global website primitives, interact
|
|
|
7
7
|
## Install after release
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
pnpm add @moldea.ai/website-ui@1.2.
|
|
10
|
+
pnpm add @moldea.ai/website-ui@1.2.1
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
The package currently supports Astro `7.2.2` and Tailwind CSS `4.3.3` exactly. Import the shared stylesheet once from the website's global stylesheet:
|
|
@@ -18,6 +18,10 @@ The package currently supports Astro `7.2.2` and Tailwind CSS `4.3.3` exactly. I
|
|
|
18
18
|
|
|
19
19
|
Tailwind scans the shipped Astro components through the package stylesheet's explicit source declaration.
|
|
20
20
|
|
|
21
|
+
## Surface-aware selection
|
|
22
|
+
|
|
23
|
+
Add `dark-surface-selection` to an intentionally dark surface and `light-surface-selection` to an intentionally light surface when it differs from the active theme. Use `theme-surface-selection` when a nested surface returns to the active website theme. These utilities keep ordinary and inline-code text selection legible across nested light and dark surfaces.
|
|
24
|
+
|
|
21
25
|
## Utilities
|
|
22
26
|
|
|
23
27
|
```typescript
|
package/package.json
CHANGED
package/src/styles.css
CHANGED
|
@@ -27,7 +27,26 @@
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
::selection {
|
|
30
|
-
|
|
30
|
+
color: var(--website-ui-selection-foreground, var(--primary-foreground));
|
|
31
|
+
background-color: var(--website-ui-selection-background, var(--primary));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
code::selection {
|
|
35
|
+
color: var(
|
|
36
|
+
--website-ui-code-selection-foreground,
|
|
37
|
+
var(--website-ui-selection-foreground, var(--primary-foreground))
|
|
38
|
+
);
|
|
39
|
+
background-color: var(
|
|
40
|
+
--website-ui-code-selection-background,
|
|
41
|
+
var(--website-ui-selection-background, var(--primary))
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.dark {
|
|
46
|
+
--website-ui-selection-background: color-mix(in oklab, var(--foreground) 40%, transparent);
|
|
47
|
+
--website-ui-selection-foreground: var(--primary-foreground);
|
|
48
|
+
--website-ui-code-selection-background: var(--website-ui-selection-background);
|
|
49
|
+
--website-ui-code-selection-foreground: var(--website-ui-selection-foreground);
|
|
31
50
|
}
|
|
32
51
|
|
|
33
52
|
a,
|
|
@@ -244,6 +263,38 @@
|
|
|
244
263
|
}
|
|
245
264
|
}
|
|
246
265
|
|
|
266
|
+
@layer utilities {
|
|
267
|
+
/* preserve legible selection colors when a surface differs from the active theme. */
|
|
268
|
+
.dark-surface-selection {
|
|
269
|
+
--website-ui-selection-background: color-mix(
|
|
270
|
+
in oklab,
|
|
271
|
+
var(--website-ui-dark-foreground) 40%,
|
|
272
|
+
transparent
|
|
273
|
+
);
|
|
274
|
+
--website-ui-selection-foreground: var(--website-ui-dark-primary-foreground);
|
|
275
|
+
--website-ui-code-selection-background: var(--website-ui-dark-secondary);
|
|
276
|
+
--website-ui-code-selection-foreground: var(--website-ui-dark-foreground);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.light-surface-selection {
|
|
280
|
+
--website-ui-selection-background: var(--website-ui-light-primary);
|
|
281
|
+
--website-ui-selection-foreground: var(--website-ui-light-primary-foreground);
|
|
282
|
+
--website-ui-code-selection-background: var(--website-ui-light-secondary);
|
|
283
|
+
--website-ui-code-selection-foreground: var(--website-ui-light-foreground);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.theme-surface-selection {
|
|
287
|
+
--website-ui-selection-background: var(--primary);
|
|
288
|
+
--website-ui-selection-foreground: var(--primary-foreground);
|
|
289
|
+
--website-ui-code-selection-background: var(--website-ui-selection-background);
|
|
290
|
+
--website-ui-code-selection-foreground: var(--website-ui-selection-foreground);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.dark .theme-surface-selection {
|
|
294
|
+
--website-ui-selection-background: color-mix(in oklab, var(--foreground) 40%, transparent);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
247
298
|
@media (prefers-color-scheme: dark) {
|
|
248
299
|
html:not(.light):not(.dark) {
|
|
249
300
|
color-scheme: dark;
|
package/src/tokens.css
CHANGED
|
@@ -78,6 +78,16 @@
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
:root {
|
|
81
|
+
/* stable theme values support surfaces that intentionally differ from the active theme. */
|
|
82
|
+
--website-ui-light-foreground: oklch(18.142% 0.01839 215.333);
|
|
83
|
+
--website-ui-light-primary: oklch(15.434% 0.00002 271.152);
|
|
84
|
+
--website-ui-light-primary-foreground: oklch(99.048% 0.00493 166.268);
|
|
85
|
+
--website-ui-light-secondary: oklch(96.563% 0.00641 197.995);
|
|
86
|
+
--website-ui-dark-foreground: oklch(97.024% 0.00684 124.958);
|
|
87
|
+
--website-ui-dark-primary: oklch(15.434% 0.00002 271.152);
|
|
88
|
+
--website-ui-dark-primary-foreground: oklch(99.048% 0.00493 166.268);
|
|
89
|
+
--website-ui-dark-secondary: oklch(37.306% 0.03436 260.191);
|
|
90
|
+
|
|
81
91
|
--shadow-xs-value: 0 1px 2px oklch(0.18 0.018 215 / 8%);
|
|
82
92
|
--shadow-sm-value:
|
|
83
93
|
0 1px 2px oklch(18.142% 0.01839 215.333 / 4%),
|
|
@@ -97,12 +107,12 @@
|
|
|
97
107
|
inset 0 1px 0 oklch(100% 0.00011 271.152 / 82%), 0 1px 2px oklch(18.142% 0.01839 215.333 / 6%);
|
|
98
108
|
|
|
99
109
|
--background: oklch(99.426% 0.00274 84.294);
|
|
100
|
-
--foreground:
|
|
110
|
+
--foreground: var(--website-ui-light-foreground);
|
|
101
111
|
--card: var(--background);
|
|
102
112
|
--elevated: oklch(100% 0.00011 271.152);
|
|
103
|
-
--primary:
|
|
104
|
-
--primary-foreground:
|
|
105
|
-
--secondary:
|
|
113
|
+
--primary: var(--website-ui-light-primary);
|
|
114
|
+
--primary-foreground: var(--website-ui-light-primary-foreground);
|
|
115
|
+
--secondary: var(--website-ui-light-secondary);
|
|
106
116
|
--secondary-foreground: oklch(48.046% 0.02817 216.324);
|
|
107
117
|
--muted: var(--secondary);
|
|
108
118
|
--muted-foreground: var(--secondary-foreground);
|
|
@@ -141,12 +151,12 @@
|
|
|
141
151
|
--shadow-inset-value: inset 0 0 oklch(0% 0 0 / 0%);
|
|
142
152
|
|
|
143
153
|
--background: oklch(27.837% 0.03355 257.693);
|
|
144
|
-
--foreground:
|
|
154
|
+
--foreground: var(--website-ui-dark-foreground);
|
|
145
155
|
--card: var(--background);
|
|
146
156
|
--elevated: oklch(31.5% 0.034 258);
|
|
147
|
-
--primary:
|
|
148
|
-
--primary-foreground:
|
|
149
|
-
--secondary:
|
|
157
|
+
--primary: var(--website-ui-dark-primary);
|
|
158
|
+
--primary-foreground: var(--website-ui-dark-primary-foreground);
|
|
159
|
+
--secondary: var(--website-ui-dark-secondary);
|
|
150
160
|
--secondary-foreground: oklch(83.038% 0.0135 209.117);
|
|
151
161
|
--muted: var(--secondary);
|
|
152
162
|
--muted-foreground: var(--secondary-foreground);
|