@symbo.ls/scratch 0.7.11 → 0.7.13
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/defaultConfig/responsive.js +15 -1
- package/src/system/spacing.js +20 -16
- package/src/utils/object.js +1 -2
- package/src/utils/sequence.js +9 -4
- package/src/utils/var.js +1 -1
package/package.json
CHANGED
|
@@ -9,5 +9,19 @@ export const BREAKPOINTS = {
|
|
|
9
9
|
tabletS: 1024,
|
|
10
10
|
mobileL: 768,
|
|
11
11
|
mobileM: 560,
|
|
12
|
-
mobileS: 480
|
|
12
|
+
mobileS: 480,
|
|
13
|
+
mobileXS: 375
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const DEVICES = {
|
|
17
|
+
screenL: [1920, 1024],
|
|
18
|
+
screenM: [1680, 1024],
|
|
19
|
+
screenS: [1440, 978],
|
|
20
|
+
tabletL: [1366, 926],
|
|
21
|
+
tabletM: [1280, 768],
|
|
22
|
+
tabletS: [1024, 768],
|
|
23
|
+
mobileL: [768, 375],
|
|
24
|
+
mobileM: [560, 768],
|
|
25
|
+
mobileS: [480, 768],
|
|
26
|
+
mobileXS: [375, 768]
|
|
13
27
|
}
|
package/src/system/spacing.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import { SPACING } from '../defaultConfig'
|
|
4
|
-
import { applySequenceVars, arrayze, generateSequence, getSequenceValuePropertyPair, merge } from '../utils'
|
|
4
|
+
import { applySequenceVars, arrayze, generateSequence, getSequenceValuePropertyPair, isString, merge } from '../utils'
|
|
5
5
|
|
|
6
6
|
const runThroughMedia = sequenceProps => {
|
|
7
7
|
for (const prop in sequenceProps) {
|
|
@@ -53,25 +53,29 @@ export const getSpacingByKey = (
|
|
|
53
53
|
const stack = arrayze(value)
|
|
54
54
|
if (!stack) return
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
propertyName = 'border'
|
|
59
|
-
suffix = 'Width'
|
|
56
|
+
if (isString(value) && value.includes('calc')) {
|
|
57
|
+
return { [propertyName]: value }
|
|
60
58
|
}
|
|
61
59
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
if (stack.length > 1) {
|
|
61
|
+
let suffix = ''
|
|
62
|
+
if (propertyName === 'borderWidth') {
|
|
63
|
+
propertyName = 'border'
|
|
64
|
+
suffix = 'Width'
|
|
65
|
+
}
|
|
67
66
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
const directions = {
|
|
68
|
+
2: ['Block', 'Inline'],
|
|
69
|
+
3: ['BlockStart', 'Inline', 'BlockEnd'],
|
|
70
|
+
4: ['BlockStart', 'InlineEnd', 'BlockEnd', 'InlineStart']
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const wrapSequenceValueByDirection = (direction, i) => getSequenceValuePropertyPair(
|
|
74
|
+
stack[i],
|
|
75
|
+
propertyName + direction + suffix,
|
|
76
|
+
sequence
|
|
77
|
+
)
|
|
73
78
|
|
|
74
|
-
if (stack.length > 1) {
|
|
75
79
|
return directions[stack.length].map((dir, key) => wrapSequenceValueByDirection(dir, key))
|
|
76
80
|
}
|
|
77
81
|
|
package/src/utils/object.js
CHANGED
|
@@ -39,8 +39,7 @@ export const deepMerge = (obj, obj2) => {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export const arrayze = val => {
|
|
42
|
-
|
|
43
|
-
if (isString) return val.split(' ')
|
|
42
|
+
if (isString(val)) return val.split(' ')
|
|
44
43
|
if (isObject(val)) return Object.keys(val).map(v => val[v])
|
|
45
44
|
if (isArray(val)) return val
|
|
46
45
|
}
|
package/src/utils/sequence.js
CHANGED
|
@@ -118,9 +118,7 @@ export const getSequenceValue = (value = 'A', sequenceProps) => {
|
|
|
118
118
|
useVariable
|
|
119
119
|
} = sequenceProps
|
|
120
120
|
|
|
121
|
-
if (isString(value) && value.slice(0, 2) === '--') {
|
|
122
|
-
return `var(${value})`
|
|
123
|
-
}
|
|
121
|
+
if (isString(value) && value.slice(0, 2) === '--') return `var(${value})`
|
|
124
122
|
|
|
125
123
|
const prefix = `--${toDashCase(sequenceProps.type.replace('.', '-'))}-`
|
|
126
124
|
|
|
@@ -130,9 +128,11 @@ export const getSequenceValue = (value = 'A', sequenceProps) => {
|
|
|
130
128
|
if (
|
|
131
129
|
value === 'none' ||
|
|
132
130
|
value === 'auto' ||
|
|
131
|
+
value === 'unset' ||
|
|
133
132
|
value === 'fit-content' ||
|
|
134
133
|
value === 'min-content' ||
|
|
135
134
|
value === 'max-content' ||
|
|
135
|
+
value.includes('calc') ||
|
|
136
136
|
!startsWithDashOrLetter
|
|
137
137
|
) return value
|
|
138
138
|
|
|
@@ -146,12 +146,17 @@ export const getSequenceValue = (value = 'A', sequenceProps) => {
|
|
|
146
146
|
absValue = absValue.split('-')[0]
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
const varValue = v => `var(${prefix}${v}${mediaName})`
|
|
149
150
|
if (absValue.includes('+')) {
|
|
150
151
|
const args = absValue.split('+')
|
|
151
|
-
const varValue = v => `var(${prefix}${v}${mediaName})`
|
|
152
152
|
const [first, second] = args
|
|
153
153
|
const joint = `${varValue(first)} + ${varValue(second)}`
|
|
154
154
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`
|
|
155
|
+
} else if (absValue.includes('-')) {
|
|
156
|
+
const args = absValue.split('-')
|
|
157
|
+
const [first, second] = args
|
|
158
|
+
const joint = `${varValue(first)} - ${varValue(second)}`
|
|
159
|
+
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`
|
|
155
160
|
}
|
|
156
161
|
|
|
157
162
|
// if subsequence is not set but value is applied
|
package/src/utils/var.js
CHANGED
|
@@ -4,7 +4,7 @@ import { MEDIA, TIMING } from '../defaultConfig'
|
|
|
4
4
|
import { CONFIG, CSS_VARS } from '../factory'
|
|
5
5
|
import { isObjectLike } from './object'
|
|
6
6
|
|
|
7
|
-
const ENV = process.env.NODE_ENV
|
|
7
|
+
const ENV = process.env.NODE_ENV // eslint-disable-line no-undef
|
|
8
8
|
|
|
9
9
|
export const setVariables = (result, key) => {
|
|
10
10
|
// CSS_VARS[result.var] =
|