@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 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.11",
5
+ "version": "0.7.13",
6
6
  "files": [
7
7
  "src"
8
8
  ],
@@ -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
  }
@@ -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
- let suffix = ''
57
- if (propertyName === 'borderWidth') {
58
- propertyName = 'border'
59
- suffix = 'Width'
56
+ if (isString(value) && value.includes('calc')) {
57
+ return { [propertyName]: value }
60
58
  }
61
59
 
62
- const directions = {
63
- 2: ['Block', 'Inline'],
64
- 3: ['BlockStart', 'Inline', 'BlockEnd'],
65
- 4: ['BlockStart', 'InlineEnd', 'BlockEnd', 'InlineStart']
66
- }
60
+ if (stack.length > 1) {
61
+ let suffix = ''
62
+ if (propertyName === 'borderWidth') {
63
+ propertyName = 'border'
64
+ suffix = 'Width'
65
+ }
67
66
 
68
- const wrapSequenceValueByDirection = (direction, i) => getSequenceValuePropertyPair(
69
- stack[i],
70
- propertyName + direction + suffix,
71
- sequence
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
 
@@ -39,8 +39,7 @@ export const deepMerge = (obj, obj2) => {
39
39
  }
40
40
 
41
41
  export const arrayze = val => {
42
- const isString = typeof val === 'string'
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
  }
@@ -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] =