@symbo.ls/preview 0.0.39 → 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.
@@ -58,7 +58,7 @@ const define = {
58
58
  },
59
59
  SearchHeader: {
60
60
  settings: {
61
- gridOptions: { colspan: 6, rowspan: 2 }
61
+ gridOptions: { colspan: 8, rowspan: 2 }
62
62
  }
63
63
  },
64
64
  Search: {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@symbo.ls/preview",
3
3
  "description": "",
4
4
  "author": "",
5
- "version": "0.0.39",
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,
@@ -68,17 +68,7 @@ export const Export = {
68
68
  flex: '1'
69
69
  },
70
70
 
71
- tools: {
72
- props: {
73
- padding: 'Z2 0 0 0',
74
- flexAlign: 'center space-between'
75
- },
76
-
77
- tools,
78
-
79
- ResponsiveToolBar: {}
80
- },
81
-
71
+ tools,
82
72
  description
83
73
  }
84
74
 
@@ -50,7 +50,8 @@ export default {
50
50
  el.comp.setProps({
51
51
  base: s.base,
52
52
  fontSize: s.base + 'px',
53
- spacingRatio: s.ratio
53
+ spacingRatio: s.ratio,
54
+ direction: s.direction
54
55
  }, { preventUpdate: true })
55
56
  updateReset()
56
57
  }
@@ -1,14 +1,53 @@
1
1
  'use strict'
2
2
 
3
- import { Flex, SequenceSliders } from '@symbo.ls/components'
3
+ import {
4
+ Flex,
5
+ SequenceSliders,
6
+ ClickableItem,
7
+ SquareButton
8
+ } from '@symbo.ls/components'
4
9
 
5
10
  export default {
6
- extend: [Flex],
7
- props: { gap: 'B1' },
8
- // theme: { extend: ThemeSwitcher },
11
+ props: {
12
+ padding: 'Z2 0 0',
13
+ flexAlign: 'center space-between'
14
+ },
9
15
 
10
- sliders: {
11
- extend: SequenceSliders,
12
- childExtend: { title: null }
16
+ tools: {
17
+ extend: Flex,
18
+ props: { gap: 'B1' },
19
+ // theme: { extend: ThemeSwitcher },
20
+
21
+ sliders: {
22
+ extend: SequenceSliders,
23
+ childExtend: { title: null }
24
+ }
25
+ },
26
+
27
+ responsive: {
28
+ extend: Flex,
29
+ props: { gap: 'A2' },
30
+
31
+ direction: {
32
+ extend: [ClickableItem, SquareButton],
33
+ props: {
34
+ icon: 'languageDirection'
35
+ },
36
+ on: {
37
+ click: (ev, el, s) => {
38
+ console.log(s.direction)
39
+ s.update({
40
+ direction: s.direction === 'rtl' ? 'ltr' : 'rtl'
41
+ })
42
+ }
43
+ }
44
+ },
45
+
46
+ VerticalLine: {
47
+ margin: 'auto 0',
48
+ height: 'A2'
49
+ },
50
+
51
+ ResponsiveToolBar: {}
13
52
  }
14
53
  }
@@ -6,34 +6,53 @@ import {
6
6
  Flex,
7
7
  SectionHeader,
8
8
  AccessibilityCheck,
9
- SceneThemingBar
9
+ SceneThemingBar,
10
+ Pseudo,
11
+ CommonField
10
12
  } from '@symbo.ls/components'
11
13
 
12
- import { colorTones } from './colorTone'
13
- import { themingTools } from './themingTools'
14
- import { interactivity } from './interactivity'
15
- import { friendTheme } from './friendTheme'
14
+ import preview from './preview'
15
+ // import { themingTools } from './themingTools'
16
+ // import { interactivity } from './interactivity'
17
+ // import { friendTheme } from './friendTheme'
16
18
 
17
- import style, { styleLabel } from './style'
19
+ import style from './style'
18
20
 
19
- const nameTheTheme = {
21
+ const ThemeNameField = {
20
22
  tag: 'label',
21
- style: styleLabel,
22
23
  attr: { for: 'name-it' },
23
- caption: {
24
- props: {
25
- text: 'Name the theme',
26
- padding: '0 0 Y1 0',
27
- size: 'Z'
28
- }
29
- },
30
- span: {
31
- tag: 'span',
32
- props: {
33
- text: (el, s) => s.value,
34
- size: 'E'
24
+ extend: CommonField,
25
+
26
+ props: ({ state }) => ({
27
+ gap: '0',
28
+
29
+ caption: {
30
+ text: 'Name the theme'
35
31
  },
36
- attr: { contentEditable: true, placeholder: 'you name it', id: 'name-it' }
32
+
33
+ element: {
34
+ whiteSpace: 'nowrap',
35
+ minWidth: 'C1',
36
+ maxWidth: 'fit-content',
37
+ outline: 'none',
38
+ fontSize: 'E',
39
+
40
+ border: 'dashed, gray5',
41
+ borderWidth: '0 0 1px',
42
+
43
+ text: (el, s) => s.themeName,
44
+
45
+ ':empty::before': {
46
+ content: '"You name it"',
47
+ color: 'gray5'
48
+ }
49
+ }
50
+ }),
51
+
52
+ caption: {},
53
+ element: {
54
+ extend: Pseudo,
55
+ attr: { contentEditable: true, id: 'name-it' }
37
56
  }
38
57
  }
39
58
 
@@ -128,16 +147,16 @@ export const Theme = {
128
147
  init: (el, s) => {
129
148
  if (!el.context.SYSTEM) return
130
149
  const path = window.location.pathname
131
- const pathArray = path.split('edit-icon/')
150
+ const pathArray = path.split('theme/')
132
151
  if (!el.context.SYSTEM) return
133
152
  const { THEME } = el.context.SYSTEM
134
153
  const themeName = pathArray[1]
135
- var theme = THEME[themeName]
154
+ var value = THEME[themeName]
136
155
 
137
- if (themeName && theme) {
156
+ if (themeName && value) {
138
157
  s.update({
139
- themeName: themeName,
140
- value: theme
158
+ themeName,
159
+ value
141
160
  }, { preventUpdate: true })
142
161
  }
143
162
  }
@@ -146,26 +165,24 @@ export const Theme = {
146
165
  header: {
147
166
  extend: SectionHeader,
148
167
  props: {
149
- padding: 'C 0 B2 0',
150
- margin: '0'
168
+ margin: '0 0 B2'
151
169
  },
152
- heading: '',
153
- label: nameTheTheme,
170
+ heading: null,
171
+ ThemeNameField,
154
172
  nav: { extend: SceneThemingBar }
155
173
  },
156
174
 
157
175
  cnt: {
158
- extend: [Flex],
159
- props: {
160
- gap: 'D'
161
- },
176
+ extend: Flex,
177
+ props: { gap: 'D' },
178
+
179
+ preview,
162
180
 
163
- aside: colorTones,
164
181
  colorEdit: {
165
- props: { gap: 'C2', flexFlow: 'column' },
166
- themingTools,
167
- interactivity,
168
- friendTheme
182
+ props: { gap: 'C2', flexFlow: 'column' }
183
+ // themingTools,
184
+ // interactivity,
185
+ // friendTheme
169
186
  }
170
187
  },
171
188
 
@@ -0,0 +1,153 @@
1
+ 'use strict'
2
+
3
+ import { opacify } from '@symbo.ls/scratch'
4
+ import { Flex, Grid } from '@symbo.ls/components'
5
+
6
+ const classOpacify = (value, opacity) => {
7
+ const { background, backgroundColor, color } = value
8
+ const bg = background || backgroundColor || color
9
+ if (!bg) return
10
+ return { background: opacify(bg, opacity) }
11
+ }
12
+
13
+ const TONES_AMOUNT = 13
14
+ const TONES_ARR = new Array(TONES_AMOUNT).fill(0).map((_, i) => i)
15
+
16
+ const getThemeProperty = (property, value, mod) => {
17
+ const modifier = `@${mod}`
18
+ return value[modifier] && value[modifier][property] ? value[modifier][property] : value[property]
19
+ }
20
+
21
+ export const Tones = {
22
+ extend: Grid,
23
+ props: {
24
+ columns: `repeat(${TONES_AMOUNT}, 1fr)`,
25
+ height: 'B',
26
+ round: 'Z',
27
+ overflow: 'hidden'
28
+ },
29
+ childExtend: {
30
+ tag: 'span',
31
+ text: null,
32
+ props: ({ key, state }) => ({
33
+ round: '0',
34
+ transition: 'B default-bezier',
35
+ transitionProperty: 'color, background',
36
+ background: getThemeProperty('background', state.value, state.sceneTheme),
37
+ opacity: '' + (100 / TONES_AMOUNT * parseInt(key)) / 100
38
+ })
39
+ },
40
+ $setCollection: () => TONES_ARR
41
+ }
42
+
43
+ export default {
44
+ tag: 'aside',
45
+ extend: Flex,
46
+ props: {
47
+ flow: 'column'
48
+ },
49
+
50
+ preview: {
51
+ props: (el, s) => ({
52
+ padding: 'X1',
53
+ round: 'Z2',
54
+ theme: `scene @${s.sceneTheme}`,
55
+ style: {
56
+ '&, & *': {
57
+ transition: '165ms cubic-bezier(.29,.67,.51,.97)',
58
+ transitionProperty: 'color, background'
59
+ }
60
+ }
61
+ }),
62
+ scene: {
63
+ props: {
64
+ padding: 'A',
65
+ backgroundPosition: `center`,
66
+ backgroundRepeat: `repeat`,
67
+ backgroundSize: '100px 100px'
68
+ },
69
+ circle: {
70
+ props: (el, s) => ({
71
+ theme: `${s.themeName} @${s.sceneTheme}`,
72
+ flexFlow: 'column',
73
+ flexAlign: 'center center',
74
+ width: 'G',
75
+ aspectRatio: '1 / 1',
76
+ round: '100%',
77
+ position: 'relative',
78
+ borderWidth: '1px',
79
+ borderStyle: 'solid',
80
+ borderColor: 'transparent',
81
+
82
+ h6: {
83
+ fontSize: 'D',
84
+ fontWeight: 'bold',
85
+ gap: 'X'
86
+ }
87
+ }),
88
+ h6: {
89
+ extend: Flex,
90
+ Span: {
91
+ text: 'The',
92
+ fontWeight: 'normal',
93
+ marginRight: '6px'
94
+ },
95
+ text: 'Text Color'
96
+ },
97
+ Span: {
98
+ text: (el, s) => s.themeName,
99
+ position: 'absolute',
100
+ top: '86%',
101
+ left: '50%',
102
+ transform: 'translate(-50%, -50%)',
103
+ fontWeight: '600'
104
+ }
105
+ }
106
+ }
107
+ },
108
+
109
+ opacity: {
110
+ props: {
111
+ padding: 'B1 0 0 0'
112
+ },
113
+ caption: {
114
+ props: {
115
+ text: 'Opacity',
116
+ size: 'Z',
117
+ padding: '0 0 Z1 0',
118
+ opacity: '.65'
119
+ }
120
+ },
121
+ tones: { extend: Tones }
122
+ },
123
+
124
+ shades: {
125
+ if: () => false,
126
+ props: { padding: 'B 0 0 0' },
127
+ caption: {
128
+ props: {
129
+ text: 'Shades',
130
+ size: 'Z',
131
+ padding: '0 0 Z1 0'
132
+ },
133
+ style: { opacity: '.65' }
134
+ },
135
+
136
+ generate: {
137
+ props: { flexFlow: 'column', round: 'Z', gap: '2px' },
138
+
139
+ childExtend: {
140
+ extend: [Tones],
141
+ props: { round: 'X' },
142
+ ...TONES_ARR.map(v => ({
143
+ class: { background: el => classOpacify(el, (100 / TONES_AMOUNT * v) / 100) }
144
+ }))
145
+ },
146
+
147
+ dark: {},
148
+ light: {
149
+ props: { theme: 'lightScene' }
150
+ }
151
+ }
152
+ }
153
+ }
@@ -1,22 +1,11 @@
1
1
  'use strict'
2
2
 
3
- export const styleLabel = {
4
- caption: { whiteSpace: 'nowrap', opacity: 0.65 },
5
- span: {
6
- display: 'block',
7
- whiteSpace: 'nowrap',
8
- minWidth: `1.618em`,
9
- maxWidth: 'fit-content',
10
- borderBottom: '1px dashed rgba(255, 255, 255, .35)',
11
- outline: 'none'
12
- }
13
- }
14
-
15
3
  export const styleTool = {
16
4
  caption: { opacity: '.65' },
17
5
  '> div span': { opacity: '.5' },
18
6
  '> div > div': { gap: '1px' }
19
7
  }
8
+
20
9
  export const styleColorTones = {
21
10
  width: '22em',
22
11
  display: 'flex',
@@ -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