@symbo.ls/scratch 0.3.12 → 0.3.15
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/config/spacing.js +15 -9
- package/src/utils/index.js +5 -5
package/package.json
CHANGED
package/src/config/spacing.js
CHANGED
|
@@ -42,24 +42,30 @@ export const mapSpacing = (val, property = 'padding', props, unit) => {
|
|
|
42
42
|
unit
|
|
43
43
|
})
|
|
44
44
|
|
|
45
|
+
let suffix = ''
|
|
46
|
+
if (property === 'borderWidth') {
|
|
47
|
+
property = 'border'
|
|
48
|
+
suffix = 'Width'
|
|
49
|
+
}
|
|
50
|
+
|
|
45
51
|
if (length === 2) {
|
|
46
52
|
return [
|
|
47
|
-
wrapFallBack(property + 'Block', 0),
|
|
48
|
-
wrapFallBack(property + 'Inline', 1)
|
|
53
|
+
wrapFallBack(property + 'Block' + suffix, 0),
|
|
54
|
+
wrapFallBack(property + 'Inline' + suffix, 1)
|
|
49
55
|
]
|
|
50
56
|
}
|
|
51
57
|
if (length === 3) {
|
|
52
58
|
return [
|
|
53
|
-
wrapFallBack(property + 'BlockStart', 0),
|
|
54
|
-
wrapFallBack(property + 'Inline', 1),
|
|
55
|
-
wrapFallBack(property + 'BlockEnd', 2)
|
|
59
|
+
wrapFallBack(property + 'BlockStart' + suffix, 0),
|
|
60
|
+
wrapFallBack(property + 'Inline' + suffix, 1),
|
|
61
|
+
wrapFallBack(property + 'BlockEnd' + suffix, 2)
|
|
56
62
|
]
|
|
57
63
|
} else if (length === 4) {
|
|
58
64
|
return [
|
|
59
|
-
wrapFallBack(property + 'BlockStart', 0),
|
|
60
|
-
wrapFallBack(property + 'InlineStart', 3),
|
|
61
|
-
wrapFallBack(property + 'BlockEnd', 2),
|
|
62
|
-
wrapFallBack(property + 'InlineEnd', 1)
|
|
65
|
+
wrapFallBack(property + 'BlockStart' + suffix, 0),
|
|
66
|
+
wrapFallBack(property + 'InlineStart' + suffix, 3),
|
|
67
|
+
wrapFallBack(property + 'BlockEnd' + suffix, 2),
|
|
68
|
+
wrapFallBack(property + 'InlineEnd' + suffix, 1)
|
|
63
69
|
]
|
|
64
70
|
}
|
|
65
71
|
|
package/src/utils/index.js
CHANGED
|
@@ -160,7 +160,7 @@ export const changeLightness = (delta, hsl) => {
|
|
|
160
160
|
|
|
161
161
|
export const rgbToHSL = (r, g, b) => {
|
|
162
162
|
const a = Math.max(r, g, b); const n = a - Math.min(r, g, b); const f = (1 - Math.abs(a + a - n - 1))
|
|
163
|
-
const h = n && ((a == r) ? (g - b) / n : ((a == g) ? 2 + (b - r) / n : 4 + (r - g) / n))
|
|
163
|
+
const h = n && ((a == r) ? (g - b) / n : ((a == g) ? 2 + (b - r) / n : 4 + (r - g) / n)) //eslint-disable-line
|
|
164
164
|
return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2]
|
|
165
165
|
}
|
|
166
166
|
|
|
@@ -282,7 +282,7 @@ const setSequenceValue = ({ key, variable, value, scaling, state, index }) => {
|
|
|
282
282
|
state.scales[variable] = scaling
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
export const generateSubSequence = ({ key, base, value, ratio, variable, state }) => {
|
|
285
|
+
export const generateSubSequence = ({ key, base, value, ratio, variable, state, index }) => {
|
|
286
286
|
const next = value * ratio
|
|
287
287
|
const smallscale = (next - value) / ratio
|
|
288
288
|
|
|
@@ -303,7 +303,7 @@ export const generateSubSequence = ({ key, base, value, ratio, variable, state }
|
|
|
303
303
|
const scaling = Math.round(v / base * 1000) / 1000
|
|
304
304
|
const newVar = variable + (k + 1)
|
|
305
305
|
|
|
306
|
-
return setSequenceValue({ key: key + (k + 1), variable: newVar, value: v, scaling, state })
|
|
306
|
+
return setSequenceValue({ key: key + (k + 1), variable: newVar, value: v, scaling, state, index: index + (k + 1) / 10 })
|
|
307
307
|
})
|
|
308
308
|
}
|
|
309
309
|
|
|
@@ -319,7 +319,7 @@ export const generateSequence = ({ type, base, ratio, range, subSequence, ...sta
|
|
|
319
319
|
|
|
320
320
|
setSequenceValue({ key: letterKey, variable, value, scaling, state, index: key })
|
|
321
321
|
|
|
322
|
-
if (subSequence) generateSubSequence({ key: letterKey, base, value, ratio, variable, state })
|
|
322
|
+
if (subSequence) generateSubSequence({ key: letterKey, base, value, ratio, variable, state, index: key })
|
|
323
323
|
}
|
|
324
324
|
return state
|
|
325
325
|
}
|
|
@@ -328,7 +328,7 @@ export const fallBack = ({ type, prop, val = 'A', prefix = '--font-size-', unit
|
|
|
328
328
|
if (typeof val !== 'string') console.warn(prop, val, 'is not a string')
|
|
329
329
|
|
|
330
330
|
if (val === '-' || val === '') return ({ })
|
|
331
|
-
if (val === 'auto' || val === 'fit-content' || val === 'min-content' || val === 'max-content') return ({ [prop]: val })
|
|
331
|
+
if (val === 'none' || val === 'auto' || val === 'fit-content' || val === 'min-content' || val === 'max-content') return ({ [prop]: val })
|
|
332
332
|
|
|
333
333
|
// const startsWithLetterRegex = /^[a-zA-Z]/i
|
|
334
334
|
const startsWithLetterRegex = /^-?[a-zA-Z]/i
|