@rokkit/core 1.0.0-next.85 → 1.0.0-next.86
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/colors/index.js +11 -1
- package/src/constants.js +3 -3
- package/src/theme.js +2 -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.86",
|
|
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.1.4",
|
|
24
24
|
"vitest": "~1.3.1",
|
|
25
|
-
"shared-config": "1.0.0-next.
|
|
26
|
-
"validators": "1.0.0-next.
|
|
25
|
+
"shared-config": "1.0.0-next.86",
|
|
26
|
+
"validators": "1.0.0-next.86"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
29
|
"src/**/*.js",
|
package/src/colors/index.js
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { defaultTailwindColors } from './tailwind'
|
|
2
|
-
|
|
2
|
+
export const shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]
|
|
3
|
+
export const defaultPalette = [
|
|
4
|
+
'neutral',
|
|
5
|
+
'primary',
|
|
6
|
+
'secondary',
|
|
7
|
+
'accent',
|
|
8
|
+
'success',
|
|
9
|
+
'warning',
|
|
10
|
+
'danger',
|
|
11
|
+
'info'
|
|
12
|
+
]
|
|
3
13
|
export * from './syntax'
|
|
4
14
|
|
|
5
15
|
export const defaultColors = {
|
package/src/constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { defaultColors, syntaxColors } from './colors'
|
|
1
|
+
export { defaultColors, syntaxColors, shades, defaultPalette } from './colors'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @type {import('./types).FieldMapping} Fields
|
|
@@ -83,9 +83,9 @@ export const defaultThemeMapping = {
|
|
|
83
83
|
accent: 'sky',
|
|
84
84
|
success: 'green',
|
|
85
85
|
warning: 'yellow',
|
|
86
|
+
danger: 'red',
|
|
86
87
|
error: 'red',
|
|
87
|
-
info: 'cyan'
|
|
88
|
-
pass: 'green'
|
|
88
|
+
info: 'cyan'
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
export function stateIconsFromNames(icons) {
|
package/src/theme.js
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
import { defaultThemeMapping, defaultColors, syntaxColors } from './constants'
|
|
2
|
+
import { shades, defaultPalette } from './colors'
|
|
2
3
|
|
|
3
4
|
const modifiers = {
|
|
4
5
|
hsl: (value) => `hsl(${value})`,
|
|
5
6
|
rgb: (value) => `rgb(${value})`,
|
|
6
7
|
none: (value) => value
|
|
7
8
|
}
|
|
8
|
-
const shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]
|
|
9
|
-
const defaultPalette = [
|
|
10
|
-
'neutral',
|
|
11
|
-
'primary',
|
|
12
|
-
'secondary',
|
|
13
|
-
'accent',
|
|
14
|
-
'info',
|
|
15
|
-
'error',
|
|
16
|
-
'warn',
|
|
17
|
-
'pass'
|
|
18
|
-
]
|
|
19
9
|
|
|
20
10
|
/**
|
|
21
11
|
* Generate shades for a color using css varuable
|
|
@@ -58,7 +48,7 @@ export function stateColors(name, modifier = 'none') {
|
|
|
58
48
|
export function themeColors(modifier = 'none') {
|
|
59
49
|
const fn = modifier in modifiers ? modifiers[modifier] : modifiers.none
|
|
60
50
|
|
|
61
|
-
let states = ['info', '
|
|
51
|
+
let states = ['info', 'danger', 'warning', 'success', 'error']
|
|
62
52
|
let variants = ['neutral', 'primary', 'secondary', 'accent']
|
|
63
53
|
let colors = states.reduce(
|
|
64
54
|
(acc, state) => ({ ...acc, [state]: stateColors(state, modifier) }),
|
|
@@ -96,7 +86,6 @@ export function contrastColors(light = '#ffffff', dark = '#000000', palette = de
|
|
|
96
86
|
}
|
|
97
87
|
|
|
98
88
|
export function themeRules(name = 'rokkit', mapping = defaultThemeMapping, colors = defaultColors) {
|
|
99
|
-
// const shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]
|
|
100
89
|
mapping = { ...defaultThemeMapping, ...mapping }
|
|
101
90
|
const variants = Object.keys(mapping)
|
|
102
91
|
const rules = variants
|