@rokkit/core 1.0.0-next.79 → 1.0.0-next.80
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/package.json +3 -3
- package/src/utils.js +14 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rokkit/core",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.80",
|
|
4
4
|
"description": "Core components, actions and stores for svelte apps.",
|
|
5
5
|
"author": "Jerry Thomas <me@jerrythomas.name>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"typescript": "^5.3.3",
|
|
23
23
|
"vite": "^5.0.12",
|
|
24
24
|
"vitest": "~1.2.2",
|
|
25
|
-
"shared-config": "1.0.0-next.
|
|
26
|
-
"validators": "1.0.0-next.
|
|
25
|
+
"shared-config": "1.0.0-next.80",
|
|
26
|
+
"validators": "1.0.0-next.80"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
29
|
"src/**/*.js",
|
package/src/utils.js
CHANGED
|
@@ -105,7 +105,20 @@ export function scaledPath(size, x) {
|
|
|
105
105
|
if (Array.isArray(x)) return x.map((x) => scaledPath(size, x)).join(' ')
|
|
106
106
|
return typeof x === 'number' ? x * size : x
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
export function contrastColors(light, dark, shades, mapping) {
|
|
109
|
+
Object.keys(mapping).flatMap((variant) => [
|
|
110
|
+
shades.map((shade) => ({
|
|
111
|
+
key: `--on-${variant}-${shade}`,
|
|
112
|
+
value: shade < 500 ? dark : light,
|
|
113
|
+
mode: 'light'
|
|
114
|
+
})),
|
|
115
|
+
shades.map((shade) => ({
|
|
116
|
+
key: `--on-${variant}-${shade}`,
|
|
117
|
+
value: shade > 500 ? dark : light,
|
|
118
|
+
mode: 'dark'
|
|
119
|
+
}))
|
|
120
|
+
])
|
|
121
|
+
}
|
|
109
122
|
export function themeRules(name = 'rokkit', mapping = defaultThemeMapping, colors = defaultColors) {
|
|
110
123
|
const shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]
|
|
111
124
|
mapping = { ...defaultThemeMapping, ...mapping }
|