@symbo.ls/preview 0.0.24 → 0.0.26

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/.symbols/index.js CHANGED
@@ -15,6 +15,8 @@ import field from './field'
15
15
  import tooltip from './tooltip'
16
16
  import pills from './pills'
17
17
 
18
+ import * as smbls from '@symbo.ls/components/src/Fields'
19
+
18
20
  export const LIBRARY = [
19
21
  circleButton,
20
22
  buttonDownload,
@@ -31,3 +33,15 @@ export const LIBRARY = [
31
33
  tooltip,
32
34
  pills
33
35
  ]
36
+
37
+ export const COMPONENTS = Object.keys(smbls).map(key => {
38
+ const component = smbls[key]
39
+ return {
40
+ key,
41
+ component: { extend: component },
42
+ code: JSON.stringify(component, null, 2),
43
+ settings: {
44
+ gridOptions: { colspan: 3, rowspan: 2 }
45
+ }
46
+ }
47
+ })
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@symbo.ls/preview",
3
3
  "description": "",
4
4
  "author": "",
5
- "version": "0.0.24",
5
+ "version": "0.0.26",
6
6
  "repository": "https://github.com/rackai/editor",
7
7
  "main": "src/index.js",
8
8
  "scripts": {
package/src/index.js CHANGED
@@ -19,7 +19,8 @@ smbls.init({ verbose: false, ...SYMBOLS_CONF })
19
19
 
20
20
  DOM.define({
21
21
  __filepath: param => param,
22
- $setCollection: smbls.Collection.define.$setCollection
22
+ $setCollection: smbls.Collection.define.$setCollection,
23
+ $setStateCollection: smbls.Collection.define.$setStateCollection
23
24
  })
24
25
 
25
26
  // export default DOM.create(App, DevFocus, 'app', { TODO: try this
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { Text, Block, Link, SquareButton, Img, ClickableItem, SelectToolWithCaption, Grid, CheckButton } from '@symbo.ls/components'
3
+ import { Text, Block, Link, SquareButton, Img, ClickableItem, SelectFieldWithCaption, Grid, CheckButton } from '@symbo.ls/components'
4
4
  // import { account } from '../SignUp'
5
5
 
6
6
  import setUpProject from './setUpProject'
@@ -128,7 +128,7 @@ const fillFields = {
128
128
  rowGap: 'C2'
129
129
  },
130
130
  childExtend: {
131
- extend: SelectToolWithCaption,
131
+ extend: SelectFieldWithCaption,
132
132
  style: {
133
133
  '> input': { width: '270x', minWidth: '270px', height: '42px' }
134
134
  },
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { Text, Block, Img, SquareButton, SelectTool } from '@symbo.ls/components'
3
+ import { Text, Block, Img, SquareButton, SelectField } from '@symbo.ls/components'
4
4
  import { SetUp } from '..'
5
5
 
6
6
  export default {
@@ -126,7 +126,7 @@ export default {
126
126
  {
127
127
  caption: { props: { text: 'UI Framework' } },
128
128
  element: {
129
- extend: SelectTool,
129
+ extend: SelectField,
130
130
  title: {
131
131
  props: { text: 'React' },
132
132
  style: { color: 'white' }
@@ -17,7 +17,7 @@ export default {
17
17
 
18
18
  childExtend: [GlobalThemeTemplate, Link],
19
19
 
20
- $setCollection: () => [{
20
+ $setStateCollection: () => [{
21
21
  title: 'Light',
22
22
  key: 'light',
23
23
  icon: 'sun'
@@ -36,7 +36,7 @@ export default {
36
36
  },
37
37
 
38
38
  childExtend: ColorTemplate,
39
- $setCollection: mapColors
39
+ $setStateCollection: mapColors
40
40
  }
41
41
  }
42
42
  }
@@ -31,6 +31,6 @@ export default {
31
31
  },
32
32
 
33
33
  childExtend: ThemeTemplate,
34
- $setCollection: (el, s) => mapThemes(el, s)
34
+ $setStateCollection: (el, s) => mapThemes(el, s)
35
35
  }
36
36
  }
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { CommonField, SelectTool } from '@symbo.ls/components'
3
+ import { CommonField, SelectField } from '@symbo.ls/components'
4
4
 
5
5
  export const friendTheme = {
6
6
  extend: CommonField,
@@ -11,7 +11,7 @@ export const friendTheme = {
11
11
  style: { opacity: 1, fontWeight: 'normal', margin: 0 }
12
12
  },
13
13
  element: {
14
- extend: SelectTool,
14
+ extend: SelectField,
15
15
  style: {
16
16
  background: 'transparent',
17
17
  paddingLeft: 0,
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { Block, Grid, Text, SelectTool, CommonField } from '@symbo.ls/components'
3
+ import { Block, Grid, Text, SelectField, CommonField } from '@symbo.ls/components'
4
4
 
5
5
  export const interactivity = {
6
6
  h6: {
@@ -21,7 +21,7 @@ export const interactivity = {
21
21
  extend: CommonField,
22
22
  props: { padding: 0 },
23
23
  element: {
24
- extend: SelectTool,
24
+ extend: SelectField,
25
25
  buttons: { ...[{ props: { icon: 'plus' } }] }
26
26
  }
27
27
  },
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { Grid, ColorSwitcher, CommonField, SelectTool, ButtonSet, ClickableItem } from '@symbo.ls/components'
3
+ import { Grid, ColorSwitcher, CommonField, SelectField, ButtonSet, ClickableItem } from '@symbo.ls/components'
4
4
 
5
5
 
6
6
  ColorSwitcher.props = (el, s) => {
@@ -72,7 +72,7 @@ export const themingTools = {
72
72
  props: { caption: 'Use as' },
73
73
  caption: {},
74
74
  element: {
75
- extend: SelectTool,
75
+ extend: SelectField,
76
76
  title: { props: { text: 'Background color' } },
77
77
  buttons: { ...[{ props: { icon: 'arrowAngleMirroringVertical', theme: 'transparent' } }] }
78
78
  }
@@ -5,7 +5,7 @@ import {
5
5
  Grid,
6
6
  SectionHeader
7
7
  } from '@symbo.ls/components'
8
- import { LIBRARY } from '../../../.symbols'
8
+ import { COMPONENTS } from '../../../.symbols'
9
9
  import { gridStyle, rowStyle } from './style'
10
10
 
11
11
  export default {
@@ -86,7 +86,7 @@ export default {
86
86
  }),
87
87
 
88
88
  childExtend: ComponentTemplate,
89
- $setCollection: ({ state }) => LIBRARY.filter(v => {
89
+ $setStateCollection: ({ state }) => COMPONENTS.filter(v => {
90
90
  if (!state.category) return true
91
91
  return state.category === v.category.key
92
92
  })
@@ -1,10 +1,11 @@
1
1
  'use strict'
2
2
 
3
3
  import { SEQUENCE, TYPOGRAPHY } from '@symbo.ls/scratch'
4
- import { LIBRARY } from '../../../.symbols'
4
+ import { LIBRARY, COMPONENTS } from '../../../.symbols'
5
5
 
6
6
  const COMPONENT_ROUTES = {}
7
7
  LIBRARY.map(v => (COMPONENT_ROUTES[`/${v.key}`] = v))
8
+ COMPONENTS.map(v => (COMPONENT_ROUTES[`/${v.key}`] = v))
8
9
 
9
10
  // const SEQUENCE = [8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 32, 36, 42, 48, 56, 62, 68, 76, 84, 92, 100, 110]
10
11
 
@@ -39,7 +39,7 @@ export default {
39
39
 
40
40
  title: {},
41
41
  list: {
42
- $setCollection: ({ state }) => state.props
42
+ $setStateCollection: ({ state }) => state.props
43
43
  }
44
44
  },
45
45
 
@@ -12,10 +12,13 @@ import description from './description'
12
12
 
13
13
  import { COMPONENT_ROUTES } from './const'
14
14
 
15
- const componentState = (context) => context.LIBRARY.filter(v => {
16
- const key = window.location.pathname.split('component/')[1]
17
- return v.key === key
18
- })
15
+ const componentState = (context) => {
16
+ const arr = [...context.LIBRARY, ...context.COMPONENTS]
17
+ return arr.filter(v => {
18
+ const key = window.location.pathname.split('component/')[1]
19
+ return v.key === key
20
+ })
21
+ }
19
22
 
20
23
  export const Export = {
21
24
  key: 'export',
@@ -47,7 +47,7 @@ const FontFaces = {
47
47
  margin: '0 -Z'
48
48
  },
49
49
  childExtend: [FontObject, Hoverable],
50
- $setCollection: mapFonts
50
+ $setStateCollection: mapFonts
51
51
  }
52
52
  }
53
53
 
@@ -89,7 +89,7 @@ const FontFamilies = {
89
89
  },
90
90
 
91
91
  childExtend: [FontFamilyObject, Hoverable],
92
- $setCollection: mapFontFamilies
92
+ $setStateCollection: mapFontFamilies
93
93
  }
94
94
  }
95
95
 
@@ -56,7 +56,7 @@ const IconsGroup = {
56
56
  }),
57
57
 
58
58
  childExtend: IconItem,
59
- $setCollection: ({ state }) => state.list
59
+ $setStateCollection: ({ state }) => state.list
60
60
  }
61
61
  }
62
62
 
@@ -110,5 +110,5 @@ export const Icons = {
110
110
  },
111
111
 
112
112
  childExtend: IconsGroup,
113
- $setCollection: () => ICON_GROUPS
113
+ $setStateCollection: () => ICON_GROUPS
114
114
  }
@@ -27,6 +27,6 @@ export const Library = {
27
27
  },
28
28
 
29
29
  childExtend: ComponentTemplate,
30
- $setCollection: () => LIBRARY
30
+ $setStateCollection: () => LIBRARY
31
31
  }
32
32
  }
@@ -205,6 +205,6 @@ export const Table = {
205
205
 
206
206
  cnt: {
207
207
  childExtend: Row,
208
- $setCollection: (el) => mapSequence(el.state, sortSequence)
208
+ $setStateCollection: (el) => mapSequence(el.state, sortSequence)
209
209
  }
210
210
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { stylePreview, styleScene } from './style'
4
4
 
5
- import { Block, Button, Flex, Text, ResponsiveToolBar, Scene, SequenceGraph, StaticSpacing, CommonField, SliderToolWithCaption, SelectToolWithCaption } from '@symbo.ls/components'
5
+ import { Block, Button, Flex, Text, ResponsiveToolBar, Scene, SequenceGraph, StaticSpacing, CommonField, RangeFieldWithCaption, SelectFieldWithCaption } from '@symbo.ls/components'
6
6
 
7
7
  const buttonDownload = {
8
8
  extend: Button,
@@ -56,7 +56,7 @@ export default {
56
56
  // },
57
57
 
58
58
  {
59
- extend: SelectToolWithCaption,
59
+ extend: SelectFieldWithCaption,
60
60
  style: { marginTop: `${26 / 16}em` },
61
61
  caption: { props: { text: 'Used for' } },
62
62
  element: {
@@ -76,7 +76,7 @@ export default {
76
76
  childExtend: CommonField,
77
77
  ...[
78
78
  {
79
- extend: SliderToolWithCaption,
79
+ extend: RangeFieldWithCaption,
80
80
  caption: { text: 'Base size' },
81
81
  element: {
82
82
  button0: {},
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { CommonField, SelectTool } from '@symbo.ls/components'
3
+ import { CommonField, SelectField } from '@symbo.ls/components'
4
4
 
5
5
  export const friendTheme = {
6
6
  extend: CommonField,
@@ -11,7 +11,7 @@ export const friendTheme = {
11
11
  style: { opacity: 1, fontWeight: 'normal', margin: 0 }
12
12
  },
13
13
  element: {
14
- extend: SelectTool,
14
+ extend: SelectField,
15
15
  style: {
16
16
  background: 'transparent',
17
17
  paddingLeft: 0,
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { Grid, ColorSwitcher, CommonField, SelectTool, ButtonSet, ClickableItem } from '@symbo.ls/components'
3
+ import { Grid, ColorSwitcher, CommonField, SelectField, ButtonSet, ClickableItem } from '@symbo.ls/components'
4
4
 
5
5
 
6
6
  ColorSwitcher.props = (el, s) => {
@@ -72,7 +72,7 @@ export const themingTools = {
72
72
  props: { caption: 'Use as' },
73
73
  caption: {},
74
74
  element: {
75
- extend: SelectTool,
75
+ extend: SelectField,
76
76
  title: { props: { text: 'Background color' } },
77
77
  buttons: { ...[{ props: { icon: 'arrowAngleMirroringVertical', theme: 'transparent' } }] }
78
78
  }
@@ -1,6 +1,14 @@
1
1
  'use strict'
2
2
 
3
- import { Flex, SectionHeader, SelectField, IconButton } from '@symbo.ls/components'
3
+ import { findHeadingLetter, getFontFamily } from '@symbo.ls/scratch'
4
+ import {
5
+ DocumentStylesSequence,
6
+ Flex,
7
+ SectionHeader,
8
+ SelectField,
9
+ SequenceSliders,
10
+ DeviceButtonSet
11
+ } from '@symbo.ls/components'
4
12
  import stylesHelpers from './stylesHelpers'
5
13
 
6
14
  export default {
@@ -12,15 +20,138 @@ export default {
12
20
  }
13
21
  },
14
22
 
23
+ styles: {
24
+ extend: Flex,
25
+
26
+ props: {
27
+ flow: 'column',
28
+ gap: 'C',
29
+ align: 'flex-start flex-start',
30
+ header: {
31
+ width: '100%',
32
+ align: 'center space-between'
33
+ }
34
+ },
35
+
36
+ header: {
37
+ extend: Flex,
38
+ SequenceSliders,
39
+ DeviceButtonSet
40
+ },
41
+
42
+ headings: {
43
+ extend: DocumentStylesSequence,
44
+ $setStateCollection: (el) => {
45
+ const { state, context } = el // eslint-disable-line no-unused-vars
46
+ const { TYPOGRAPHY, FONT_FAMILY } = context.SYSTEM
47
+ const { styles } = TYPOGRAPHY
48
+ el.removeContent()
49
+
50
+ const family = FONT_FAMILY[FONT_FAMILY.default]
51
+ const familyValue = getFontFamily()
52
+ const lineHeight = TYPOGRAPHY.lineHeight
53
+ const font = family.arr[0]
54
+
55
+ const HEADINGS = new Array(6).fill(null).map((_, i) => 'h' + (i + 1))
56
+
57
+ return HEADINGS.map((v, k) => ({
58
+ key: v,
59
+ value: {
60
+ font,
61
+ fontFamily: familyValue,
62
+ fontWeight: 900 - (k * 100),
63
+ lineHeight,
64
+ ...styles[v]
65
+ },
66
+ labels: [
67
+ { icon: 'fontFace', text: font },
68
+ { icon: 'fontVariable', text: 900 - (k * 100) },
69
+ { icon: 'textLineHeight', text: lineHeight }
70
+ ],
71
+ sequenceValue: state.sequence[
72
+ findHeadingLetter(state.h1Matches, k)
73
+ ]
74
+ }))
75
+ }
76
+ },
77
+
78
+ doc: {
79
+ extend: DocumentStylesSequence,
80
+ $setStateCollection: (el) => {
81
+ const { state, context } = el // eslint-disable-line no-unused-vars
82
+ const { DOCUMENT, FONT_FAMILY } = context.SYSTEM
83
+ el.removeContent()
84
+
85
+ const family = FONT_FAMILY[FONT_FAMILY.default]
86
+ const familyValue = getFontFamily()
87
+ const font = family.arr[0]
88
+ const { fontWeight, lineHeight } = DOCUMENT
89
+
90
+ return [{
91
+ key: 'body',
92
+ value: {
93
+ font,
94
+ fontFamily: familyValue,
95
+ fontWeight: fontWeight || 400,
96
+ lineHeight
97
+ },
98
+ labels: [
99
+ { icon: 'fontFace', text: font },
100
+ { icon: 'fontVariable', text: fontWeight || 400 },
101
+ { icon: 'textLineHeight', text: lineHeight }
102
+ ],
103
+ sequenceValue: state.sequence['A']
104
+ }]
105
+ }
106
+ },
107
+
108
+ helpers: {
109
+ $setStateCollection: (el) => {
110
+ const { state, context } = el // eslint-disable-line no-unused-vars
111
+ const { TYPOGRAPHY, FONT_FAMILY } = context.SYSTEM
112
+ const { styles } = TYPOGRAPHY
113
+ el.removeContent()
114
+
115
+ const family = FONT_FAMILY[FONT_FAMILY.default]
116
+ const familyValue = getFontFamily()
117
+ const lineHeight = TYPOGRAPHY.lineHeight
118
+ const font = family.arr[0]
119
+
120
+ return Object.keys(styles).filter(v => v.slice(0, 1) === '.').map((v, k) => ({
121
+ key: v,
122
+ value: {
123
+ font,
124
+ fontFamily: familyValue,
125
+ fontWeight: 900 - (k * 100),
126
+ lineHeight,
127
+ ...styles[v]
128
+ },
129
+ labels: [
130
+ { icon: 'fontFace', text: font },
131
+ { icon: 'fontVariable', text: 900 - (k * 100) },
132
+ { icon: 'textLineHeight', text: lineHeight }
133
+ ],
134
+ sequenceValue: state.sequence[
135
+ findHeadingLetter(state.h1Matches, k)
136
+ ]
137
+ }))
138
+ }
139
+ },
140
+
141
+ footer: {}
142
+ },
143
+
15
144
  fields: {
16
145
  extend: Flex,
17
- props: { gap: 'A' },
146
+ props: {
147
+ gap: 'A',
148
+ margin: '0 0 0 E2+B',
149
+ align: 'center flex-start'
150
+ },
18
151
 
19
152
  interactivities: {
20
153
  extend: Flex,
21
- props: {
22
- gap: 'A'
23
- },
154
+ props: { gap: 'A' },
24
155
  childExtend: {
25
156
  extend: SelectField,
26
157
  props: {
@@ -56,13 +187,15 @@ export default {
56
187
  }]
57
188
  },
58
189
 
59
- plus: {
60
- extend: IconButton,
61
- props: {
62
- theme: 'quaternary',
63
- position: 'relative',
64
- icon: 'plus'
65
- }
190
+ VerticalLine: {
191
+ height: 'B',
192
+ margin: '0 Z1'
193
+ },
194
+
195
+ IconButton: {
196
+ theme: 'quinary',
197
+ position: 'relative',
198
+ icon: 'plus'
66
199
  },
67
200
 
68
201
  addsomething: {
@@ -74,17 +207,29 @@ export default {
74
207
  }
75
208
  },
76
209
  title: {},
77
- buttons: {
78
- ...[{
79
- props: { icon: 'plus' }
80
- }, {
81
- props: { icon: 'arrowAngleDown' }
82
- }]
83
- }
210
+ buttons: [{
211
+ props: { icon: 'plus' }
212
+ }, {
213
+ props: { icon: 'arrowAngleMirroringVertical' }
214
+ }]
84
215
  }
85
216
  },
86
217
 
87
218
  Line: {},
88
219
 
89
- stylesHelpers
220
+ stylesHelpers,
221
+
222
+ on: {
223
+ init: (el, s) => {
224
+ if (!el.context.SYSTEM) return
225
+ const { context } = el // eslint-disable-line no-unused-vars
226
+ const { TYPOGRAPHY } = context.SYSTEM
227
+ const { styles } = TYPOGRAPHY
228
+ if (styles) {
229
+ s.update({
230
+ styles
231
+ }, { preventUpdate: true })
232
+ }
233
+ }
234
+ }
90
235
  }
@@ -2,8 +2,8 @@
2
2
 
3
3
  import state from './state'
4
4
 
5
+ import typeScale from './typeScale' // eslint-disable-line no-unused-vars
5
6
  import documentStyles from './documentStyles'
6
- import typeScale from './typeScale'
7
7
 
8
8
  export const Typography = {
9
9
  state,
@@ -13,7 +13,7 @@ export const Typography = {
13
13
  p: 'A general configuration of type properties on the document.'
14
14
  },
15
15
 
16
- // typeScale,
16
+ typeScale,
17
17
  Line: {},
18
18
  documentStyles
19
19
  }
@@ -25,7 +25,7 @@ export default {
25
25
 
26
26
  childProto: TypeHelperObject,
27
27
 
28
- $setCollection: () => [{
28
+ $setStateCollection: () => [{
29
29
  p: {
30
30
  text: 'Headline',
31
31
  style: { fontSize: `${48 / 16}em` }
@@ -70,9 +70,10 @@ export default {
70
70
 
71
71
  sequence: {
72
72
  extend: TypeScaleSequence,
73
- $setCollection: (el) => {
73
+ $setStateCollection: (el) => {
74
74
  const { state } = el
75
75
  state.sequence = {}
76
+ el.removeContent()
76
77
  return mapSequence(state, sortSequence)
77
78
  }
78
79
  },
package/src/state.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  import SYSTEM from './config'
4
- import { LIBRARY } from '../.symbols'
4
+ import { LIBRARY, COMPONENTS } from '../.symbols'
5
5
 
6
6
  export const state = {
7
7
  globalTheme: 'dark'
@@ -9,5 +9,6 @@ export const state = {
9
9
 
10
10
  export const context = {
11
11
  LIBRARY,
12
- SYSTEM
12
+ SYSTEM,
13
+ COMPONENTS
13
14
  }