@rokkit/themes 1.0.0-next.37 → 1.0.0-next.38

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/themes",
3
- "version": "1.0.0-next.37",
3
+ "version": "1.0.0-next.38",
4
4
  "description": "Themes for use with rokkit components.",
5
5
  "author": "Jerry Thomas <me@jerrythomas.name>",
6
6
  "license": "MIT",
@@ -15,14 +15,13 @@
15
15
  "@sveltejs/vite-plugin-svelte": "^2.4.3",
16
16
  "@vitest/coverage-v8": "^0.33.0",
17
17
  "@vitest/ui": "~0.33.0",
18
- "c8": "^8.0.1",
19
18
  "jsdom": "^22.1.0",
20
19
  "svelte": "^4.1.1",
21
20
  "typescript": "^5.1.6",
22
21
  "vite": "^4.4.7",
23
22
  "vitest": "~0.33.0",
24
- "@rokkit/core": "1.0.0-next.37",
25
- "shared-config": "1.0.0-next.37"
23
+ "@rokkit/core": "1.0.0-next.38",
24
+ "shared-config": "1.0.0-next.38"
26
25
  },
27
26
  "files": [
28
27
  "src/**/*.js",
package/src/index.js CHANGED
@@ -1,3 +1,2 @@
1
- // export * from './utils'
2
1
  export { iconShortcuts, themeColors } from '@rokkit/core'
3
2
  export * from './constants'
package/src/utils.js DELETED
@@ -1,82 +0,0 @@
1
- const modifiers = {
2
- hsl: (value) => `hsl(${value})`,
3
- rgb: (value) => `rgb(${value})`,
4
- none: (value) => value
5
- }
6
-
7
- /**
8
- * Generate shades for a color using css varuable
9
- *
10
- * @param {string} name
11
- * @returns
12
- */
13
- export function shadesOf(name, modifier = 'none') {
14
- const shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900]
15
- const fn = modifier in modifiers ? modifiers[modifier] : modifiers.none
16
-
17
- return shades.reduce(
18
- (result, shade) => ({
19
- ...result,
20
- [shade]: fn(`var(--${name}-${shade})`)
21
- }),
22
- {
23
- DEFAULT: fn(`var(--${name}-500)`),
24
- inset: fn(`var(--${name}-50)`),
25
- sunken: fn(`var(--${name}-50)`),
26
- recessed: fn(`var(--${name}-50)`),
27
- base: fn(`var(--${name}-100)`),
28
- subtle: fn(`var(--${name}-200)`),
29
- muted: fn(`var(--${name}-300)`),
30
- raised: fn(`var(--${name}-400)`),
31
- elevated: fn(`var(--${name}-500)`),
32
- floating: fn(`var(--${name}-600)`),
33
- contrast: fn(`var(--${name}-700)`)
34
- }
35
- )
36
- }
37
-
38
- export function stateColors(name, modifier = 'none') {
39
- const fn = modifier in modifiers ? modifiers[modifier] : modifiers.none
40
- return {
41
- DEFAULT: fn(`var(--${name}-500)`),
42
- light: fn(`var(--${name}-100)`),
43
- dark: fn(`var(--${name}-800)`)
44
- }
45
- }
46
-
47
- export function themeColors(modifier = 'none') {
48
- const fn = modifier in modifiers ? modifiers[modifier] : modifiers.none
49
-
50
- let states = ['info', 'error', 'warn', 'pass']
51
- let variants = ['skin', 'primary', 'secondary', 'accent']
52
- let colors = states.reduce(
53
- (acc, state) => ({ ...acc, [state]: stateColors(state, modifier) }),
54
- {}
55
- )
56
- colors = variants.reduce(
57
- (acc, variant) => ({ ...acc, [variant]: shadesOf(variant, modifier) }),
58
- colors
59
- )
60
- colors.skin = {
61
- ...colors.skin,
62
- contrast: fn(`var(--skin-800)`),
63
- zebra: fn(`var(--skin-zebra)`)
64
- }
65
-
66
- return colors
67
- }
68
-
69
- export function iconShortcuts(icons, collection, variants) {
70
- const suffix = variants ? `-${variants}` : ''
71
- const shortcuts = !collection
72
- ? {}
73
- : icons.reduce(
74
- (acc, name) => ({
75
- ...acc,
76
- [name]: [collection, name].join(':') + suffix
77
- }),
78
- {}
79
- )
80
-
81
- return shortcuts
82
- }