@symbo.ls/scratch 0.7.8 → 0.7.9
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 +7 -5
- package/src/utils/sequence.js +10 -5
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.7.
|
|
5
|
+
"version": "0.7.9",
|
|
6
6
|
"files": [
|
|
7
7
|
"src"
|
|
8
8
|
],
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
"main": "src/index.js",
|
|
12
12
|
"publishConfig": {},
|
|
13
13
|
"dependencies": {
|
|
14
|
+
"@domql/utils": "latest",
|
|
15
|
+
"@symbo.ls/utils": "latest",
|
|
14
16
|
"color-contrast-checker": "^1.5.0"
|
|
15
17
|
},
|
|
16
18
|
"scripts": {
|
|
@@ -20,18 +22,18 @@
|
|
|
20
22
|
"bump": "npx np"
|
|
21
23
|
},
|
|
22
24
|
"devDependencies": {
|
|
25
|
+
"@babel/core": "^7.11.5",
|
|
23
26
|
"@babel/preset-env": "^7.18.9",
|
|
27
|
+
"@emotion/css": "^11.5.0",
|
|
28
|
+
"babel-eslint": "^10.0.3",
|
|
24
29
|
"babel-jest": "^27.0.2",
|
|
25
30
|
"babel-preset-env": "^1.7.0",
|
|
26
31
|
"coveralls": "^3.0.5",
|
|
32
|
+
"eslint": "^6.1.0",
|
|
27
33
|
"eslint-plugin-jest": "^24.1.0",
|
|
28
34
|
"jest": "^27.0.6",
|
|
29
35
|
"nodemon": "^2.0.6",
|
|
30
36
|
"np": "^7.2.0",
|
|
31
|
-
"@babel/core": "^7.11.5",
|
|
32
|
-
"@emotion/css": "^11.5.0",
|
|
33
|
-
"babel-eslint": "^10.0.3",
|
|
34
|
-
"eslint": "^6.1.0",
|
|
35
37
|
"parcel-bundler": "^1.12.3",
|
|
36
38
|
"parcel-plugin-svg-sprite": "^1.4.1",
|
|
37
39
|
"standard": "^13.1.0"
|
package/src/utils/sequence.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
import { toDashCase } from '@symbo.ls/utils'
|
|
3
4
|
import { UNIT } from '../defaultConfig'
|
|
4
5
|
import { CONFIG } from '../factory'
|
|
5
6
|
import { isString } from './object'
|
|
@@ -47,10 +48,6 @@ const setSequenceValue = (props, sequenceProps) => {
|
|
|
47
48
|
sequenceProps.vars[variable] = scaling + sequenceProps.unit
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
const dashize = val => val
|
|
51
|
-
.replace(/[A-Z]/g, (match, offset) => (offset > 0 ? '-' : '') + match.toLowerCase())
|
|
52
|
-
.replace('.', '-')
|
|
53
|
-
|
|
54
51
|
export const generateSubSequence = (props, sequenceProps) => {
|
|
55
52
|
const { key, base, value, ratio, variable, index } = props
|
|
56
53
|
|
|
@@ -125,7 +122,7 @@ export const getSequenceValue = (value = 'A', sequenceProps) => {
|
|
|
125
122
|
return `var(${value})`
|
|
126
123
|
}
|
|
127
124
|
|
|
128
|
-
const prefix = `--${
|
|
125
|
+
const prefix = `--${toDashCase(sequenceProps.type.replace('.', '-'))}-`
|
|
129
126
|
|
|
130
127
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i
|
|
131
128
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value)
|
|
@@ -149,6 +146,14 @@ export const getSequenceValue = (value = 'A', sequenceProps) => {
|
|
|
149
146
|
absValue = absValue.split('-')[0]
|
|
150
147
|
}
|
|
151
148
|
|
|
149
|
+
if (absValue.includes('+')) {
|
|
150
|
+
const args = absValue.split('+')
|
|
151
|
+
const varValue = v => `var(${prefix}${v}${mediaName})`
|
|
152
|
+
const [first, second] = args
|
|
153
|
+
const joint = `${varValue(first)} + ${varValue(second)}`
|
|
154
|
+
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`
|
|
155
|
+
}
|
|
156
|
+
|
|
152
157
|
// if subsequence is not set but value is applied
|
|
153
158
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
154
159
|
if (CONFIG.verbose) console.warn(absValue, '- value is not found because `subSequence` is set to false')
|