@symbo.ls/scratch 0.2.28 → 0.3.2
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/methods/set.js +4 -2
- package/src/reset.js +2 -2
- package/src/utils/index.js +15 -0
package/package.json
CHANGED
package/src/methods/set.js
CHANGED
|
@@ -196,7 +196,7 @@ const setFontFamily = (val, key) => {
|
|
|
196
196
|
return { var: CSSvar, value: str, arr: value, type }
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
const
|
|
199
|
+
const setSameValue = (val, key) => {
|
|
200
200
|
return val
|
|
201
201
|
}
|
|
202
202
|
|
|
@@ -206,7 +206,9 @@ export const SETTERS = {
|
|
|
206
206
|
font: setFont,
|
|
207
207
|
font_family: setFontFamily,
|
|
208
208
|
theme: setTheme,
|
|
209
|
-
typography:
|
|
209
|
+
typography: setSameValue,
|
|
210
|
+
spacing: setSameValue,
|
|
211
|
+
responsive: setSameValue
|
|
210
212
|
}
|
|
211
213
|
|
|
212
214
|
/**
|
package/src/reset.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import * as CONFIG from './config'
|
|
4
|
-
import { merge } from './utils'
|
|
4
|
+
import { deepMerge, merge } from './utils'
|
|
5
5
|
|
|
6
6
|
export const RESET = {}
|
|
7
7
|
|
|
8
|
-
export const applyReset = () => merge(RESET, {
|
|
8
|
+
export const applyReset = (reset = {}) => deepMerge(merge(RESET, reset), {
|
|
9
9
|
html: {
|
|
10
10
|
position: 'absolute',
|
|
11
11
|
overflow: 'hidden',
|
package/src/utils/index.js
CHANGED
|
@@ -27,6 +27,19 @@ export const merge = (obj, original) => {
|
|
|
27
27
|
return obj
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
export const deepMerge = (obj, obj2) => {
|
|
31
|
+
for (const e in obj2) {
|
|
32
|
+
const objProp = obj[e]
|
|
33
|
+
const obj2Prop = obj2[e]
|
|
34
|
+
if (objProp === undefined) {
|
|
35
|
+
obj[e] = obj2Prop
|
|
36
|
+
} else if (isObjectLike(objProp) && isObject(obj2Prop)) {
|
|
37
|
+
deepMerge(objProp, obj2Prop)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return obj
|
|
41
|
+
}
|
|
42
|
+
|
|
30
43
|
export const colorStringToRgbaArray = color => {
|
|
31
44
|
if (color === '') return
|
|
32
45
|
if (color.toLowerCase() === 'transparent') return [0, 0, 0, 0]
|
|
@@ -257,6 +270,8 @@ export const generateSequence = ({ type, base, ratio, range, subSequence, ...sta
|
|
|
257
270
|
export const fallBack = ({ type, prop, val = 'A', prefix = '--font-size-' }) => {
|
|
258
271
|
if (typeof val !== 'string') console.warn(prop, val, 'is not a string')
|
|
259
272
|
|
|
273
|
+
if (val === 'auto') return ({ [prop]: val })
|
|
274
|
+
|
|
260
275
|
// const startsWithLetterRegex = /^[a-zA-Z]/i
|
|
261
276
|
const startsWithLetterRegex = /^-?[a-zA-Z]/i
|
|
262
277
|
// const hasLetter = /[A-Za-z]+/.test(val)
|