@symbo.ls/scratch 0.4.1 → 0.4.4

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": "symbo.ls",
5
- "version": "0.4.1",
5
+ "version": "0.4.4",
6
6
  "files": [
7
7
  "src"
8
8
  ],
@@ -63,16 +63,23 @@ export const getSequenceValue = ({ type, prop, val = 'A', prefix = '--font-size-
63
63
 
64
64
  const letterVal = val.toUpperCase()
65
65
  const isNegative = letterVal.slice(0, 1) === '-' ? '-' : ''
66
- const simplyLetterVal = isNegative ? letterVal.slice(1) : letterVal
66
+ let pureVal = isNegative ? letterVal.slice(1) : letterVal
67
67
 
68
- const value = type ? type[simplyLetterVal] : null
69
- if (!value) return console.warn('can\'t find', type, simplyLetterVal)
68
+ let mediaName = ''
69
+ if (pureVal.includes('-')) {
70
+ mediaName = '-' + pureVal.split('-')[1].toLowerCase()
71
+ pureVal = pureVal.split('-')[0]
72
+ }
73
+
74
+ const value = type ? type[pureVal] : null
75
+ if (!value) return console.warn('can\'t find', type, pureVal)
70
76
 
71
77
  if (CONFIG.useVariable) {
78
+ const varVal = `var(${prefix}${pureVal}${mediaName})`
72
79
  return isNegative ? {
73
- [prop]: `calc(var(${prefix}${simplyLetterVal}) * -1)`
80
+ [prop]: `calc(${varVal} * -1)`
74
81
  } : {
75
- [prop]: `var(${prefix}${simplyLetterVal})`
82
+ [prop]: varVal
76
83
  }
77
84
  }
78
85
 
package/src/utils/var.js CHANGED
@@ -30,9 +30,11 @@ export const applySequenceVars = (props, mediaName) => {
30
30
  if (mediaName) {
31
31
  let underMediaQuery = CSS_VARS[`@media ${query}`]
32
32
  if (!underMediaQuery) underMediaQuery = CSS_VARS[`@media ${query}`] = {}
33
- underMediaQuery[item.variable] = value
33
+ underMediaQuery[item.variable] = `var(${item.variable + '-' + mediaName})`
34
+ CSS_VARS[item.variable + '-' + mediaName] = value
34
35
  } else {
35
- CSS_VARS[item.variable] = value
36
+ CSS_VARS[item.variable + '-default'] = value
37
+ CSS_VARS[item.variable] = `var(${item.variable + '-default'})`
36
38
  }
37
39
  }
38
40
  }