@rokkit/core 1.0.0-next.78 → 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 +24 -13
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
|
@@ -32,7 +32,7 @@ export function isObject(val) {
|
|
|
32
32
|
* @returns
|
|
33
33
|
*/
|
|
34
34
|
export function shadesOf(name, modifier = 'none') {
|
|
35
|
-
const shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900]
|
|
35
|
+
const shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]
|
|
36
36
|
const fn = modifier in modifiers ? modifiers[modifier] : modifiers.none
|
|
37
37
|
|
|
38
38
|
return shades.reduce(
|
|
@@ -42,16 +42,15 @@ export function shadesOf(name, modifier = 'none') {
|
|
|
42
42
|
}),
|
|
43
43
|
{
|
|
44
44
|
DEFAULT: fn(`var(--${name}-500)`),
|
|
45
|
-
inset: fn(`var(--${name}-50)`),
|
|
46
45
|
sunken: fn(`var(--${name}-50)`),
|
|
47
|
-
|
|
48
|
-
base: fn(`var(--${name}-
|
|
49
|
-
subtle: fn(`var(--${name}-
|
|
50
|
-
muted: fn(`var(--${name}-
|
|
51
|
-
raised: fn(`var(--${name}-
|
|
52
|
-
elevated: fn(`var(--${name}-
|
|
53
|
-
floating: fn(`var(--${name}-
|
|
54
|
-
contrast: fn(`var(--${name}-
|
|
46
|
+
inset: fn(`var(--${name}-100)`),
|
|
47
|
+
base: fn(`var(--${name}-200)`),
|
|
48
|
+
subtle: fn(`var(--${name}-300)`),
|
|
49
|
+
muted: fn(`var(--${name}-400)`),
|
|
50
|
+
raised: fn(`var(--${name}-500)`),
|
|
51
|
+
elevated: fn(`var(--${name}-600)`),
|
|
52
|
+
floating: fn(`var(--${name}-700)`),
|
|
53
|
+
contrast: fn(`var(--${name}-800)`)
|
|
55
54
|
}
|
|
56
55
|
)
|
|
57
56
|
}
|
|
@@ -106,12 +105,24 @@ export function scaledPath(size, x) {
|
|
|
106
105
|
if (Array.isArray(x)) return x.map((x) => scaledPath(size, x)).join(' ')
|
|
107
106
|
return typeof x === 'number' ? x * size : x
|
|
108
107
|
}
|
|
109
|
-
|
|
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
|
+
}
|
|
110
122
|
export function themeRules(name = 'rokkit', mapping = defaultThemeMapping, colors = defaultColors) {
|
|
111
|
-
const shades = [
|
|
123
|
+
const shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]
|
|
112
124
|
mapping = { ...defaultThemeMapping, ...mapping }
|
|
113
125
|
const variants = Object.keys(mapping)
|
|
114
|
-
|
|
115
126
|
const rules = variants
|
|
116
127
|
.flatMap((variant) => [
|
|
117
128
|
shades.map((shade) => ({
|