@symbo.ls/scratch 0.3.2 → 0.3.3

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
@@ -2,7 +2,7 @@
2
2
  "name": "@symbo.ls/scratch",
3
3
  "description": "Φ / CSS framework and methodology.",
4
4
  "author": "Symbols",
5
- "version": "0.3.2",
5
+ "version": "0.3.3",
6
6
  "files": [
7
7
  "src"
8
8
  ],
@@ -15,6 +15,8 @@ import {
15
15
  getFontFaceEach
16
16
  } from '../utils'
17
17
 
18
+ const ENV = process.env.NODE_ENV
19
+
18
20
  const setColor = (val, key) => {
19
21
  const [r, g, b, a = 1] = colorStringToRgbaArray(val.value || val)
20
22
  const alpha = parseFloat(a.toFixed(2))
@@ -39,14 +41,17 @@ const setGradient = (val, key) => {
39
41
  }
40
42
 
41
43
  export const getColor = value => {
42
- if (!isString(value)) return console.warn(value, '- type for color is not valid')
44
+ if (!isString(value)) {
45
+ if (ENV === 'test' || ENV === 'development') console.warn(value, '- type for color is not valid')
46
+ return
47
+ }
43
48
 
44
49
  const [name, alpha, tone] = isArray(value) ? value : value.split(' ')
45
50
  const { COLOR, GRADIENT } = CONFIG
46
51
  const val = COLOR[name] || GRADIENT[name]
47
52
 
48
53
  if (!val) {
49
- console.warn('Can\'t find color', name)
54
+ if (ENV === 'test' || ENV === 'development') console.warn('Can\'t find color', name)
50
55
  return value
51
56
  }
52
57
 
@@ -97,7 +102,8 @@ export const getTheme = value => {
97
102
  if (state && state[subThemeName]) return getThemeValue(state[subThemeName])
98
103
  } else if (isObject(value)) return setThemeValue(value)
99
104
  else if (isString(value) && THEME[value]) return getThemeValue(THEME[value])
100
- console.warn('Can\'t find theme', value)
105
+
106
+ if (ENV === 'test' || ENV === 'development') console.warn('Can\'t find theme', value)
101
107
  }
102
108
 
103
109
  const setPrefersScheme = (theme, key, variant, themeValue) => {
@@ -2,6 +2,8 @@
2
2
 
3
3
  import { UNIT } from '../config'
4
4
 
5
+ const ENV = process.env.NODE_ENV
6
+
5
7
  export const isString = arg => typeof arg === 'string'
6
8
 
7
9
  export const isArray = arg => Array.isArray(arg)
@@ -153,7 +155,10 @@ export const mixTwoRgba = (colorA, colorB, range = 0.5) => {
153
155
 
154
156
  export const opacify = (color, opacity) => {
155
157
  const arr = colorStringToRgbaArray(color)
156
- if (!arr) return console.warn(color + 'color is not rgba')
158
+ if (!arr) {
159
+ if (ENV === 'test' || ENV === 'development') console.warn(color + 'color is not rgba')
160
+ return
161
+ }
157
162
  arr[3] = opacity
158
163
  return `rgba(${arr})`
159
164
  }