@symbo.ls/scratch 0.3.0 → 0.3.1

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.0",
5
+ "version": "0.3.1",
6
6
  "files": [
7
7
  "src"
8
8
  ],
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',
@@ -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]