@rokkit/core 1.11.0 → 1.12.0
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/dist/theme.d.ts +2 -0
- package/package.json +2 -2
- package/src/theme.ts +9 -1
package/dist/theme.d.ts
CHANGED
|
@@ -36,6 +36,8 @@ export declare function themeRules(mapping?: Mapping, colors?: Colors, colorSpac
|
|
|
36
36
|
*
|
|
37
37
|
* - `text-on-{name}` → readable text on a z5+ fill
|
|
38
38
|
* - `text-on-{name}-muted` → same on-color (kept for back-compat callers)
|
|
39
|
+
* - `text-on-{name}-soft` → readable text on the role's `-soft` tint: the role darkened toward
|
|
40
|
+
* black (base/message.css's status copy), since the tint stays light in both modes
|
|
39
41
|
*
|
|
40
42
|
* @param {string} name - Color name (e.g., 'primary', 'accent', 'danger')
|
|
41
43
|
* @param {string} [onColor='#fafafa'] - resolved on-color hex for this role
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rokkit/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "Contains core utility functions and classes that can be used in various components.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -47,6 +47,6 @@
|
|
|
47
47
|
"ramda": "^0.32.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@rokkit/icons": "1.
|
|
50
|
+
"@rokkit/icons": "1.12.0"
|
|
51
51
|
}
|
|
52
52
|
}
|
package/src/theme.ts
CHANGED
|
@@ -100,6 +100,8 @@ export function themeRules(
|
|
|
100
100
|
*
|
|
101
101
|
* - `text-on-{name}` → readable text on a z5+ fill
|
|
102
102
|
* - `text-on-{name}-muted` → same on-color (kept for back-compat callers)
|
|
103
|
+
* - `text-on-{name}-soft` → readable text on the role's `-soft` tint: the role darkened toward
|
|
104
|
+
* black (base/message.css's status copy), since the tint stays light in both modes
|
|
103
105
|
*
|
|
104
106
|
* @param {string} name - Color name (e.g., 'primary', 'accent', 'danger')
|
|
105
107
|
* @param {string} [onColor='#fafafa'] - resolved on-color hex for this role
|
|
@@ -107,11 +109,17 @@ export function themeRules(
|
|
|
107
109
|
*/
|
|
108
110
|
export function contrastShortcuts(name: string, onColor = '#fafafa') {
|
|
109
111
|
const color = `var(--on-${name},${onColor})`
|
|
112
|
+
// An app's UnoCSS scans this file; without the skip it extracts the template below as a
|
|
113
|
+
// class and emits its placeholder text as CSS, which postcss rejects (scanned-sources.spec).
|
|
114
|
+
// @unocss-skip-start
|
|
110
115
|
const text = ([, end]: string[]) =>
|
|
111
116
|
end ? `text-[color-mix(in_srgb,${color}_${end.slice(1)}%,transparent)]` : `text-[${color}]`
|
|
117
|
+
const onSoft = () => `text-[color-mix(in_oklch,var(--${name})_55%,black)]`
|
|
118
|
+
// @unocss-skip-end
|
|
112
119
|
return [
|
|
113
120
|
[new RegExp(`^text-on-${name}(\\/\\d+)?$`), text],
|
|
114
|
-
[new RegExp(`^text-on-${name}-muted(\\/\\d+)?$`), text]
|
|
121
|
+
[new RegExp(`^text-on-${name}-muted(\\/\\d+)?$`), text],
|
|
122
|
+
[new RegExp(`^text-on-${name}-soft$`), onSoft]
|
|
115
123
|
]
|
|
116
124
|
}
|
|
117
125
|
|