@symbo.ls/preview 0.0.40 → 0.0.41

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/preview",
3
3
  "description": "",
4
4
  "author": "",
5
- "version": "0.0.40",
5
+ "version": "0.0.41",
6
6
  "repository": "https://github.com/rackai/editor",
7
7
  "main": "src/index.js",
8
8
  "scripts": {
@@ -43,11 +43,6 @@ const NAV = [{
43
43
  icon: 'icons colored'
44
44
  }
45
45
  }
46
- }, {
47
- props: {
48
- icon: 'fontFace colored',
49
- href: '/fonts'
50
- }
51
46
  }, {
52
47
  props: {
53
48
  icon: 'device mobile half fill',
@@ -81,7 +76,6 @@ export const DesignSystem = {
81
76
  '/colors': Color,
82
77
  '/theme': Theme,
83
78
  '/typography': Typography,
84
- '/fonts': Fonts,
85
79
  '/space': Spaces,
86
80
  '/shape': Shapes,
87
81
  '/icons': Icons,
@@ -9,7 +9,6 @@ import {
9
9
  SequenceSliders,
10
10
  DeviceButtonSet
11
11
  } from '@symbo.ls/components'
12
- import stylesHelpers from './stylesHelpers'
13
12
 
14
13
  import { HTML_TAGS } from '@domql/tags' // eslint-disable-line no-unused-vars
15
14
 
@@ -224,10 +223,6 @@ export default {
224
223
  }
225
224
  },
226
225
 
227
- Line: {},
228
-
229
- stylesHelpers,
230
-
231
226
  on: {
232
227
  init: (el, s) => {
233
228
  if (!el.context.SYSTEM) return
@@ -0,0 +1,50 @@
1
+ 'use strict'
2
+
3
+ import { Grid, Hoverable, FontObject } from '@symbo.ls/components'
4
+ import { TypeSection } from './shared'
5
+
6
+ const mapFonts = (el, s) => {
7
+ if (!el.context.SYSTEM) return
8
+ const { FONT } = el.context.SYSTEM
9
+ const fontKeys = Object.keys(FONT)
10
+
11
+ return fontKeys.map(v => {
12
+ const font = FONT[v]
13
+ const weights = Object.keys(font)
14
+ const weightsLength = weights.length
15
+ const fontWeightCaption = weights[0] === 'variable' ? 'variable' : `${weightsLength} style${weightsLength > 1 ? 's' : ''}`
16
+
17
+ return {
18
+ title: v,
19
+ href: `/fonts/font-settings/${v}`,
20
+ labels: [
21
+ { icon: 'fontVariable', text: fontWeightCaption }
22
+ ]
23
+ }
24
+ })
25
+ }
26
+
27
+ export default {
28
+ extend: TypeSection,
29
+ header: {
30
+ state: {
31
+ title: 'Document Fonts',
32
+ p: 'Document @font-face, default and backup fonts',
33
+ nav: [{
34
+ icon: 'plus',
35
+ href: '/fonts/upload-font'
36
+ }]
37
+ }
38
+ },
39
+
40
+ content: {
41
+ extend: Grid,
42
+ props: {
43
+ columns: 'repeat(2, 1fr)',
44
+ gap: 'A',
45
+ margin: '0 -Z'
46
+ },
47
+ childExtend: [FontObject, Hoverable],
48
+ $setStateCollection: mapFonts
49
+ }
50
+ }
@@ -0,0 +1,45 @@
1
+ 'use strict'
2
+
3
+ import { Grid, Hoverable, FontFamilyObject } from '@symbo.ls/components'
4
+ import { TypeSection } from './shared'
5
+
6
+ const mapFontFamilies = (el, s) => {
7
+ if (!el.context.SYSTEM) return
8
+ const { FONT_FAMILY } = el.context.SYSTEM
9
+ const fontFamilyKeys = Object.keys(FONT_FAMILY)
10
+
11
+ return fontFamilyKeys.map(v => {
12
+ const val = FONT_FAMILY[v]
13
+ if (v === 'default') return
14
+ return {
15
+ title: v,
16
+ href: `/fonts/font-family/${v}`,
17
+ val
18
+ }
19
+ }).filter(v => v)
20
+ }
21
+
22
+ export default {
23
+ extend: TypeSection,
24
+ header: {
25
+ state: {
26
+ title: 'Font Families',
27
+ p: 'Setup a set and fallback fonts as font families',
28
+ nav: [{
29
+ icon: 'plus',
30
+ href: '/fonts/add-font-family'
31
+ }]
32
+ }
33
+ },
34
+ content: {
35
+ extend: Grid,
36
+ props: {
37
+ columns: 'repeat(4, 1fr)',
38
+ gap: 'A',
39
+ margin: '0 -Z'
40
+ },
41
+
42
+ childExtend: [FontFamilyObject, Hoverable],
43
+ $setStateCollection: mapFontFamilies
44
+ }
45
+ }
@@ -2,8 +2,12 @@
2
2
 
3
3
  import state from './state'
4
4
 
5
+ import fontFaces from './fontFaces'
5
6
  import typeScale from './typeScale'
7
+ import fontFamilies from './fontFamilies'
6
8
  import documentStyles from './documentStyles'
9
+ import stylesHelpers from './stylesHelpers'
10
+ import { mapSequence, sortSequence } from '@symbo.ls/components'
7
11
 
8
12
  export const Typography = {
9
13
  state,
@@ -13,7 +17,25 @@ export const Typography = {
13
17
  p: 'A general configuration of type properties on the document.'
14
18
  },
15
19
 
20
+ line: { extend: 'Line' },
21
+
22
+ documentStyles,
23
+ line1: { extend: 'Line' },
24
+
25
+ stylesHelpers,
26
+ line2: { extend: 'Line' },
27
+
28
+ fontFaces,
29
+ line3: { extend: 'Line' },
30
+
31
+ fontFamilies,
32
+ line4: { extend: 'Line' },
33
+
16
34
  typeScale,
17
- Line: {},
18
- documentStyles
35
+
36
+ on: {
37
+ init: (el, s) => {
38
+ mapSequence(s, sortSequence)
39
+ }
40
+ }
19
41
  }
@@ -5,6 +5,7 @@ import {
5
5
  SectionHeader,
6
6
  TypeHelperObject
7
7
  } from '@symbo.ls/components'
8
+ import { findHeadingLetter, getFontFamily } from '@symbo.ls/scratch'
8
9
 
9
10
  export default {
10
11
  header: {
@@ -23,32 +24,39 @@ export default {
23
24
  extend: Grid,
24
25
  props: { columns: 'repeat(3, 1fr)' },
25
26
 
26
- childProto: TypeHelperObject,
27
+ childExtend: TypeHelperObject,
27
28
 
28
- $setStateCollection: () => [{
29
- p: {
30
- text: 'Headline',
31
- style: { fontSize: `${48 / 16}em` }
32
- }
33
- }, {
34
- p: {
35
- text: 'Headline 2',
36
- style: { fontSize: `${40 / 16}em` }
29
+ $setStateCollection: (el) => {
30
+ const { state, context } = el // eslint-disable-line no-unused-vars
31
+ const { TYPOGRAPHY, FONT_FAMILY } = context.SYSTEM
32
+ const { styles } = TYPOGRAPHY
33
+ el.removeContent()
37
34
 
38
- }
39
- }, {
40
- p: '',
41
- span: {
42
- props: {
43
- fontSize: 'Y',
44
- padding: 'B 0 0 0'
35
+ const family = FONT_FAMILY[FONT_FAMILY.default]
36
+ const familyValue = getFontFamily()
37
+ const lineHeight = TYPOGRAPHY.lineHeight
38
+ const font = family.arr[0]
39
+
40
+ const HELPERS = Object.keys(styles).filter(v => v.slice(0, 1) === '.')
41
+ console.log(HELPERS)
42
+ return HELPERS.map((v, k) => ({
43
+ key: v,
44
+ value: {
45
+ font,
46
+ fontFamily: familyValue,
47
+ fontWeight: 900 - (k * 100),
48
+ lineHeight,
49
+ ...styles[v]
45
50
  },
46
- text: 'Fontnote'
47
- }
48
- // p: {
49
- // text: 'Footnote',
50
- // style: { fontSize: `${12 / 16}em` }
51
- // }
52
- }]
51
+ labels: [
52
+ { icon: 'fontFace', text: font },
53
+ { icon: 'fontVariable', text: 900 - (k * 100) },
54
+ { icon: 'textLineHeight', text: lineHeight }
55
+ ],
56
+ sequenceValue: state.sequence[
57
+ findHeadingLetter(state.h1Matches, k)
58
+ ]
59
+ }))
60
+ }
53
61
  }
54
62
  }
package/src/state.js CHANGED
@@ -1,5 +1,6 @@
1
1
  'use strict'
2
2
 
3
+ import SYMBOLS_CONF from '@symbo.ls/config'
3
4
  import SYSTEM from './config'
4
5
  import { LIBRARY, COMPONENTS } from '../.symbols'
5
6
 
@@ -8,6 +9,7 @@ export const state = {
8
9
  }
9
10
 
10
11
  export const context = {
12
+ CONFIG: SYMBOLS_CONF,
11
13
  LIBRARY,
12
14
  SYSTEM,
13
15
  COMPONENTS