@symbo.ls/scratch 0.3.19 → 0.3.22

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
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@symbo.ls/scratch",
3
3
  "description": "Φ / CSS framework and methodology.",
4
- "author": "Symbols",
5
- "version": "0.3.19",
4
+ "author": "symbo.ls",
5
+ "version": "0.3.22",
6
6
  "files": [
7
7
  "src"
8
8
  ],
9
- "repository": "https://github.com/rackai/scratch",
9
+ "repository": "https://github.com/symbo-ls/scratch",
10
+ "source": "src/index.js",
10
11
  "main": "src/index.js",
11
12
  "publishConfig": {},
12
13
  "dependencies": {
@@ -19,19 +20,21 @@
19
20
  "bump": "npx np"
20
21
  },
21
22
  "devDependencies": {
22
- "@babel/core": "^7.0.0-0",
23
23
  "@babel/preset-env": "^7.18.9",
24
- "babel-eslint": "^10.0.3",
25
24
  "babel-jest": "^27.0.2",
26
25
  "babel-preset-env": "^1.7.0",
27
26
  "coveralls": "^3.0.5",
28
- "eslint": "^7.12.1",
29
27
  "eslint-plugin-jest": "^24.1.0",
30
28
  "jest": "^27.0.6",
31
29
  "nodemon": "^2.0.6",
32
30
  "np": "^7.2.0",
33
- "parcel-bundler": "^1.12.4",
34
- "standard": "^16.0.1"
31
+ "@babel/core": "^7.11.5",
32
+ "@emotion/css": "^11.5.0",
33
+ "babel-eslint": "^10.0.3",
34
+ "eslint": "^6.1.0",
35
+ "parcel-bundler": "^1.12.3",
36
+ "parcel-plugin-svg-sprite": "^1.4.1",
37
+ "standard": "^13.1.0"
35
38
  },
36
39
  "jest": {
37
40
  "collectCoverageFrom": [
@@ -47,5 +50,10 @@
47
50
  "browserslist": [
48
51
  "> 1%",
49
52
  "ie >= 9"
50
- ]
53
+ ],
54
+ "targets": {
55
+ "context": "browser",
56
+ "outputFormat": "commonjs",
57
+ "includeNodeModules": true
58
+ }
51
59
  }
@@ -1,13 +1,13 @@
1
1
  'use strict'
2
2
 
3
3
  import { FONT_FAMILY, THEME, TYPOGRAPHY } from '.'
4
- import { merge } from '../utils'
4
+ import { getDefaultOrFirstKey, merge } from '../utils'
5
5
 
6
6
  export const DOCUMENT = {}
7
7
 
8
8
  export const applyDocument = () => merge(DOCUMENT, {
9
9
  theme: THEME.document,
10
- fontFamily: FONT_FAMILY[Object.keys(FONT_FAMILY)[0]],
10
+ fontFamily: getDefaultOrFirstKey(FONT_FAMILY),
11
11
  fontSize: TYPOGRAPHY.base,
12
12
  lineHeight: TYPOGRAPHY.styles.lineHeight
13
13
  })
@@ -13,3 +13,4 @@ export * from './icons'
13
13
  export * from './timing'
14
14
  export * from './document'
15
15
  export * from './cases'
16
+ export const RESET = {}
@@ -7,7 +7,7 @@ const defaultProps = {
7
7
  base: TYPOGRAPHY.base,
8
8
  type: 'spacing',
9
9
  ratio: SEQUENCE.phi,
10
- range: [-5, +7],
10
+ range: [-5, +15],
11
11
  subSequence: true,
12
12
  sequence: {},
13
13
  scales: {}
package/src/index.js CHANGED
@@ -8,4 +8,4 @@ export * from './set'
8
8
  export * from './config'
9
9
  export * from './reset'
10
10
 
11
- export default CONFIG
11
+ export { CONFIG }
package/src/reset.js CHANGED
@@ -4,41 +4,45 @@ import * as CONFIG from './config'
4
4
  import { getTheme } from './set'
5
5
  import { deepMerge, merge } from './utils'
6
6
 
7
- export const RESET = {}
8
-
9
- export const applyReset = (reset = {}) => deepMerge(merge(RESET, reset), {
10
- html: {
11
- position: 'absolute',
12
- overflow: 'hidden',
13
- width: '100%',
14
- height: '100%',
15
- top: '0',
16
- left: '0',
17
- margin: '0',
18
- WebkitFontSmoothing: 'antialiased',
19
- transform: 'translate3d(0, 0, 1px)',
20
- scrollBehavior: 'smooth',
21
-
22
- fontFamily: CONFIG.DOCUMENT.fontFamily,
23
-
24
- fontSize: CONFIG.DOCUMENT.fontSize / CONFIG.TYPOGRAPHY.default + CONFIG.UNIT.default,
25
- lineHeight: CONFIG.DOCUMENT.lineHeight
26
- },
27
-
28
- body: {
29
- boxSizing: 'border-box',
30
- height: '100%',
31
- margin: 0,
32
-
33
- ...getTheme('document')
34
- },
35
-
36
- ...CONFIG.TYPOGRAPHY.styles,
37
-
38
- // form elements
39
- fieldset: {
40
- border: 0,
41
- padding: 0,
42
- margin: 0
43
- }
44
- })
7
+ export const applyReset = (reset = {}) => {
8
+ return deepMerge(merge(CONFIG.RESET, reset), {
9
+ html: {
10
+ position: 'absolute',
11
+ overflow: 'hidden',
12
+ width: '100%',
13
+ height: '100%',
14
+ top: '0',
15
+ left: '0',
16
+ margin: '0',
17
+ WebkitFontSmoothing: 'antialiased',
18
+ transform: 'translate3d(0, 0, 1px)',
19
+ scrollBehavior: 'smooth',
20
+
21
+ fontFamily: CONFIG.DOCUMENT.fontFamily,
22
+ fontSize: CONFIG.DOCUMENT.fontSize / CONFIG.TYPOGRAPHY.default + CONFIG.UNIT.default,
23
+ lineHeight: CONFIG.DOCUMENT.lineHeight
24
+ },
25
+
26
+ body: {
27
+ boxSizing: 'border-box',
28
+ height: '100%',
29
+ margin: 0,
30
+ fontFamily: CONFIG.DOCUMENT.fontFamily,
31
+
32
+ ...getTheme('document')
33
+ },
34
+
35
+ ...CONFIG.TYPOGRAPHY.styles,
36
+
37
+ // form elements
38
+ fieldset: {
39
+ border: 0,
40
+ padding: 0,
41
+ margin: 0
42
+ },
43
+
44
+ select: {
45
+ fontFamily: CONFIG.DOCUMENT.fontFamily
46
+ }
47
+ })
48
+ }
package/src/set.js CHANGED
@@ -221,7 +221,7 @@ export const getFontFamily = (LIBRARY, key) => {
221
221
  const setFontFamily = (val, key) => {
222
222
  const { FONT_FAMILY, FONT_FAMILY_TYPES } = CONFIG
223
223
  const { value, type } = val
224
- if (val.default) FONT_FAMILY.default = key
224
+ if (val.isDefault) FONT_FAMILY.default = key
225
225
 
226
226
  const CSSvar = `--font-family-${key}`
227
227
  const str = `${value.join(', ')}, ${FONT_FAMILY_TYPES[type]}`
@@ -296,8 +296,8 @@ export const set = recivedConfig => {
296
296
  // apply generic configs
297
297
  applyTypographySequence()
298
298
  applySpacingSequence()
299
- applyDocument()
300
299
  applyTimingSequence()
300
+ applyDocument()
301
301
  applyReset()
302
302
 
303
303
  CONFIG.VARS = CSS_VARS
package/src/utils/font.js CHANGED
@@ -3,30 +3,38 @@
3
3
  export const getDefaultOrFirstKey = (LIBRARY, key) => {
4
4
  if (LIBRARY[key]) return LIBRARY[key].value
5
5
  if (LIBRARY.default) return LIBRARY[LIBRARY.default].value
6
- return LIBRARY[Object.keys(LIBRARY)[0]].value
6
+ const hasValue = Object.keys(LIBRARY)[0]
7
+ return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value
7
8
  }
8
9
 
9
10
  export const getFontFormat = url => url.split(/[#?]/)[0].split('.').pop().trim()
10
11
 
11
- export const setCustomFont = (name, weight, url) => `@font-face {
12
+ export const setCustomFont = (name, weight, url) => `
12
13
  font-family: '${name}';
13
14
  font-style: normal;
14
15
  font-weight: ${weight};
15
- src: url('${url}') format('${getFontFormat(url)}');
16
+ src: url('${url}') format('${getFontFormat(url)}');`
17
+
18
+ export const setCustomFontMedia = (name, weight, url) => `@font-face {
19
+ ${setCustomFont((name, weight, url))}
16
20
  }`
17
21
  // src: url('${url}') format('${getFontFormat(url)}');
18
22
 
19
23
  export const getFontFaceEach = (name, weightsObject) => {
20
24
  const keys = Object.keys(weightsObject)
21
- const weightsJoint = keys.map(key => {
25
+ return keys.map(key => {
22
26
  const { fontWeight, url } = weightsObject[key]
23
27
  return setCustomFont(name, fontWeight, url)
24
28
  })
25
- return weightsJoint.join('\n')
29
+ }
30
+
31
+ export const getFontFaceEachString = (name, weightsObject) => {
32
+ return getFontFaceEach(name, weightsObject).join('\n')
26
33
  }
27
34
 
28
35
  export const getFontFace = LIBRARY => {
29
36
  const keys = Object.keys(LIBRARY)
30
- const fontsJoint = keys.map(key => getFontFaceEach(key, LIBRARY[key].value))
31
- return fontsJoint.join('\n')
37
+ return keys.map(key => getFontFaceEach(key, LIBRARY[key].value))
32
38
  }
39
+
40
+ export const getFontFaceString = LIBRARY => getFontFace(LIBRARY).join('\n')