@symbo.ls/scratch 0.3.13 → 0.3.16
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 +1 -1
- package/src/config/icons.js +3 -0
- package/src/config/index.js +3 -1
- package/src/config/media.js +15 -0
- package/src/config/responsive.js +1 -1
- package/src/config/spacing.js +15 -9
- package/src/methods/set.js +3 -2
- package/src/utils/index.js +2 -2
package/package.json
CHANGED
package/src/config/index.js
CHANGED
package/src/config/media.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
export const MEDIA = {
|
|
4
|
+
screenL: '(max-width: 1920px)',
|
|
5
|
+
screenD: '(max-width: 1680px)',
|
|
6
|
+
screenS: '(max-width: 1440px)',
|
|
7
|
+
tabletL: '(max-width: 1366px)',
|
|
8
|
+
tabletM: '(max-width: 1280px)',
|
|
9
|
+
tabletS: '(max-width: 1024px)',
|
|
10
|
+
mobileL: '(max-width: 768px)',
|
|
11
|
+
mobileM: '(max-width: 560px)',
|
|
12
|
+
mobileS: '(max-width: 480px)',
|
|
13
|
+
|
|
14
|
+
light: '(prefers-color-scheme: light)'
|
|
15
|
+
}
|
package/src/config/responsive.js
CHANGED
package/src/config/spacing.js
CHANGED
|
@@ -42,24 +42,30 @@ export const mapSpacing = (val, property = 'padding', props, unit) => {
|
|
|
42
42
|
unit
|
|
43
43
|
})
|
|
44
44
|
|
|
45
|
+
let suffix = ''
|
|
46
|
+
if (property === 'borderWidth') {
|
|
47
|
+
property = 'border'
|
|
48
|
+
suffix = 'Width'
|
|
49
|
+
}
|
|
50
|
+
|
|
45
51
|
if (length === 2) {
|
|
46
52
|
return [
|
|
47
|
-
wrapFallBack(property + 'Block', 0),
|
|
48
|
-
wrapFallBack(property + 'Inline', 1)
|
|
53
|
+
wrapFallBack(property + 'Block' + suffix, 0),
|
|
54
|
+
wrapFallBack(property + 'Inline' + suffix, 1)
|
|
49
55
|
]
|
|
50
56
|
}
|
|
51
57
|
if (length === 3) {
|
|
52
58
|
return [
|
|
53
|
-
wrapFallBack(property + 'BlockStart', 0),
|
|
54
|
-
wrapFallBack(property + 'Inline', 1),
|
|
55
|
-
wrapFallBack(property + 'BlockEnd', 2)
|
|
59
|
+
wrapFallBack(property + 'BlockStart' + suffix, 0),
|
|
60
|
+
wrapFallBack(property + 'Inline' + suffix, 1),
|
|
61
|
+
wrapFallBack(property + 'BlockEnd' + suffix, 2)
|
|
56
62
|
]
|
|
57
63
|
} else if (length === 4) {
|
|
58
64
|
return [
|
|
59
|
-
wrapFallBack(property + 'BlockStart', 0),
|
|
60
|
-
wrapFallBack(property + 'InlineStart', 3),
|
|
61
|
-
wrapFallBack(property + 'BlockEnd', 2),
|
|
62
|
-
wrapFallBack(property + 'InlineEnd', 1)
|
|
65
|
+
wrapFallBack(property + 'BlockStart' + suffix, 0),
|
|
66
|
+
wrapFallBack(property + 'InlineStart' + suffix, 3),
|
|
67
|
+
wrapFallBack(property + 'BlockEnd' + suffix, 2),
|
|
68
|
+
wrapFallBack(property + 'InlineEnd' + suffix, 1)
|
|
63
69
|
]
|
|
64
70
|
}
|
|
65
71
|
|
package/src/methods/set.js
CHANGED
|
@@ -224,7 +224,8 @@ export const SETTERS = {
|
|
|
224
224
|
theme: setTheme,
|
|
225
225
|
typography: setSameValue,
|
|
226
226
|
spacing: setSameValue,
|
|
227
|
-
|
|
227
|
+
media: setSameValue,
|
|
228
|
+
icons: setSameValue
|
|
228
229
|
}
|
|
229
230
|
|
|
230
231
|
/**
|
|
@@ -262,8 +263,8 @@ export const set = recivedConfig => {
|
|
|
262
263
|
applyDocument()
|
|
263
264
|
|
|
264
265
|
CONFIG.verbose = verbose
|
|
266
|
+
if ((ENV === 'test' || ENV === 'development') && CONFIG.verbose) console.log(CONFIG)
|
|
265
267
|
|
|
266
|
-
console.log(CONFIG)
|
|
267
268
|
return CONFIG
|
|
268
269
|
}
|
|
269
270
|
|
package/src/utils/index.js
CHANGED
|
@@ -160,7 +160,7 @@ export const changeLightness = (delta, hsl) => {
|
|
|
160
160
|
|
|
161
161
|
export const rgbToHSL = (r, g, b) => {
|
|
162
162
|
const a = Math.max(r, g, b); const n = a - Math.min(r, g, b); const f = (1 - Math.abs(a + a - n - 1))
|
|
163
|
-
const h = n && ((a == r) ? (g - b) / n : ((a == g) ? 2 + (b - r) / n : 4 + (r - g) / n))
|
|
163
|
+
const h = n && ((a == r) ? (g - b) / n : ((a == g) ? 2 + (b - r) / n : 4 + (r - g) / n)) //eslint-disable-line
|
|
164
164
|
return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2]
|
|
165
165
|
}
|
|
166
166
|
|
|
@@ -328,7 +328,7 @@ export const fallBack = ({ type, prop, val = 'A', prefix = '--font-size-', unit
|
|
|
328
328
|
if (typeof val !== 'string') console.warn(prop, val, 'is not a string')
|
|
329
329
|
|
|
330
330
|
if (val === '-' || val === '') return ({ })
|
|
331
|
-
if (val === 'auto' || val === 'fit-content' || val === 'min-content' || val === 'max-content') return ({ [prop]: val })
|
|
331
|
+
if (val === 'none' || val === 'auto' || val === 'fit-content' || val === 'min-content' || val === 'max-content') return ({ [prop]: val })
|
|
332
332
|
|
|
333
333
|
// const startsWithLetterRegex = /^[a-zA-Z]/i
|
|
334
334
|
const startsWithLetterRegex = /^-?[a-zA-Z]/i
|