@symbo.ls/preview 0.0.46 → 0.0.48

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.46",
5
+ "version": "0.0.48",
6
6
  "repository": "https://github.com/rackai/editor",
7
7
  "main": "src/index.js",
8
8
  "scripts": {
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@domql/router": "latest",
27
- "@domql/tags": "^2.2.1",
27
+ "@domql/tags": "latest",
28
28
  "@symbo.ls/components": "latest",
29
29
  "@symbo.ls/config": "latest",
30
30
  "@symbo.ls/icons": "latest",
@@ -0,0 +1,48 @@
1
+ 'use strict'
2
+
3
+ import { Flex, ResponsiveToolBar, ResponsiveSreensPreview } from '@symbo.ls/components'
4
+
5
+ const footer = {
6
+ extend: Flex,
7
+ props: {
8
+ gap: 'A1',
9
+ align: 'center space-between',
10
+
11
+ title: {
12
+ text: 'For the best experience, check it out from screens larger than 1980px',
13
+ color: 'gray6'
14
+ }
15
+ },
16
+
17
+ title: {
18
+ extend: 'Paragraph',
19
+ props: { margin: '0' }
20
+ },
21
+
22
+ screenButtons: {
23
+ extend: ResponsiveToolBar,
24
+ devices: {
25
+ childExtend: {
26
+ on: {
27
+ click: (ev, el, s) => {
28
+ const previewSize = s.parent.previewSize !== s.key ? s.key : 'mobileS'
29
+ s.parent.update({ previewSize })
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
35
+ }
36
+
37
+ export const ResponsivePreview = {
38
+ extend: ResponsiveSreensPreview,
39
+
40
+ props: {
41
+ position: 'absolute',
42
+ left: 'B',
43
+ right: 'B',
44
+ padding: '0 0 B'
45
+ },
46
+
47
+ footer
48
+ }
@@ -0,0 +1,63 @@
1
+ 'use strict'
2
+
3
+ import { Scene, Flex, Code } from '@symbo.ls/components'
4
+
5
+ const scene = {
6
+ extend: Scene,
7
+
8
+ scene: {
9
+ props: {
10
+ content: {
11
+ background: 'shape 1',
12
+ color: 'gray11',
13
+ padding: 'Z A1',
14
+ text: 'Shape Preview'
15
+ }
16
+ },
17
+
18
+ on: {
19
+ update: (el, s) => {
20
+ el.set({
21
+ props: s.props
22
+ })
23
+ }
24
+ }
25
+ }
26
+ }
27
+
28
+ export const ShapePreview = {
29
+ extend: Flex,
30
+ props: {
31
+ height: 'E3',
32
+ zIndex: '9999',
33
+ gap: 'A',
34
+ alignItems: 'stretch ',
35
+
36
+ scene: { flex: 1 },
37
+
38
+ style: {
39
+ backdropFilter: 'blur(15px)'
40
+ }
41
+ },
42
+
43
+ scene,
44
+ code: {
45
+ extend: Code,
46
+ props: ({ state }) => ({
47
+ hide: Object.keys(state.props).length === 0,
48
+ flex: '0 0 360px',
49
+ margin: '0',
50
+ code: {
51
+ height: '100%',
52
+ margin: '0'
53
+ },
54
+ buttons: { marginInline: 'X2' }
55
+ }),
56
+ title: null,
57
+ code: {
58
+ props: {
59
+ text: ({ state }) => 'const props = ' + JSON.stringify(state.props, null, 2)
60
+ }
61
+ }
62
+ }
63
+ }
@@ -1,46 +1,85 @@
1
1
  'use strict'
2
2
 
3
- import { Link, Flex, ClickableItem } from '@symbo.ls/components'
3
+ import { ClickableItem, Flex } from '@symbo.ls/components'
4
+
5
+ const isActive = (el, s) => s.parent.active === `${el.parent.parent.parent.key}-${el.key}`
4
6
 
5
7
  const ShapeItem = {
6
- extend: [ClickableItem, Link, Flex],
8
+ extend: [ClickableItem, Flex],
7
9
 
8
- props: el => ({
9
- href: `/shapes/${el.parent.parent.key}-${el.key}`,
10
+ props: (el, s) => ({
10
11
  padding: 'B',
11
12
  round: 'Z',
12
- background: 'white .05',
13
13
  alignItems: 'center',
14
14
  justifyContent: 'center',
15
- theme: 'tertiary',
15
+ outline: '0, shape, solid',
16
+ background: 'gray1',
17
+ theme: null,
18
+ cursor: 'pointer',
19
+
20
+ active: isActive(el, s),
21
+
22
+ '.active': {
23
+ outline: 'X, shape, solid',
24
+ opacity: '1',
25
+ background: 'gray2'
26
+ },
16
27
 
17
28
  _shape: {
18
- theme: 'quinary',
19
- width: 'C',
20
- height: 'C'
29
+ transition: 'A default-bezier',
30
+ transitionProperty: 'background',
31
+ width: 'C1',
32
+ height: 'C1',
33
+ background: 'gray5'
21
34
  }
22
35
  }),
23
36
 
24
- _shape: {}
37
+ _shape: {},
38
+
39
+ on: {
40
+ click: (ev, el, s) => {
41
+ const active = `${el.parent.parent.parent.key}-${el.key}`
42
+ s.parent.props = s.parse()
43
+ s.parent.update({ active })
44
+ },
45
+ mouseover: (ev, el, s) => {
46
+ el._shape.setProps({ background: 'gray5' })
47
+ },
48
+ mouseleave: (ev, el, s) => {
49
+ const active = isActive(el, s)
50
+ if (!active) el._shape.setProps({ background: 'gray3' })
51
+ },
52
+ update: (el, s) => {
53
+ const active = isActive(el, s)
54
+ el._shape.setProps({ background: active ? 'gray5' : 'gray3' })
55
+ }
56
+ }
25
57
  }
26
58
 
27
59
  export const ShapeSet = {
28
60
  props: {
29
61
  label: {
30
62
  display: 'block',
31
- size: 'Y',
32
63
  opacity: '.65',
33
- padding: '0 0 Z 0'
34
- },
35
- nav: {
36
- gap: 'A',
37
- flexWrap: 'wrap'
64
+ padding: '0 0 Z 0',
65
+ span: {
66
+ opacity: '.65'
67
+ }
38
68
  }
39
69
  },
40
70
 
41
71
  label: {},
42
- nav: {
72
+ list: {
43
73
  extend: Flex,
44
- childExtend: ShapeItem
74
+ props: {
75
+ gap: 'A2',
76
+ wrap: 'wrap'
77
+ },
78
+ childExtend: {
79
+ extend: ShapeItem,
80
+ _shape: {
81
+ props: ({ state }) => state
82
+ }
83
+ }
45
84
  }
46
85
  }
@@ -1,19 +1,19 @@
1
1
  'use strict'
2
2
 
3
- import { Grid, Scene, Flex } from '@symbo.ls/components'
3
+ import { Grid, Scene, Flex, Code } from '@symbo.ls/components'
4
4
 
5
5
  const returnScale = (state, key, fallback) => {
6
6
  const { scales } = state
7
7
  return (scales[state.props[key] || state.props[fallback]] || 0) + 'em'
8
8
  }
9
9
 
10
- export const Preview = {
10
+ const scene = {
11
11
  extend: Scene,
12
12
 
13
13
  scene: {
14
14
  boxModel: {
15
15
  extend: Grid,
16
- props: {
16
+ props: ({ state }) => ({
17
17
  color: 'gray5',
18
18
  fontSize: 'Z',
19
19
  columns: '30px auto 30px',
@@ -23,7 +23,7 @@ export const Preview = {
23
23
  "x3 b x4"`,
24
24
  alignItems: 'center',
25
25
  textAlign: 'center'
26
- },
26
+ }),
27
27
 
28
28
  ...[
29
29
  ...['', { text: (el, s) => s.props.paddingTop || '', style: { gridArea: 't' } }, ''],
@@ -112,3 +112,39 @@ export const Preview = {
112
112
  }
113
113
  }
114
114
  }
115
+
116
+ export const SpacingPreview = {
117
+ extend: Flex,
118
+
119
+ props: {
120
+ maxHeight: '25vh',
121
+ zIndex: '9999',
122
+ gap: 'A',
123
+
124
+ scene: { flex: 1 },
125
+
126
+ style: {
127
+ backdropFilter: 'blur(15px)'
128
+ }
129
+ },
130
+
131
+ scene,
132
+ code: {
133
+ extend: Code,
134
+ props: ({ state }) => ({
135
+ hide: Object.keys(state.props).length === 0,
136
+ flex: '0 0 360px',
137
+ margin: '0',
138
+ code: {
139
+ margin: '0'
140
+ },
141
+ buttons: { marginInline: 'X2' }
142
+ }),
143
+ title: null,
144
+ code: {
145
+ props: {
146
+ text: ({ state }) => 'const props = ' + JSON.stringify(state.props, null, 2)
147
+ }
148
+ }
149
+ }
150
+ }
@@ -2,3 +2,6 @@
2
2
 
3
3
  export * from './Header'
4
4
  export * from './ShapeSet'
5
+ export * from './ShapePreview'
6
+ export * from './SpacingPreview'
7
+ export * from './ResponsivePreview'
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { Flex, Link, ArticleMedium } from '@symbo.ls/components'
3
+ import { Flex, Link, ArticleMedium, QuickStart } from '@symbo.ls/components'
4
4
 
5
5
  const Banner = {
6
6
  extend: [Link, Flex, ArticleMedium],
@@ -43,27 +43,59 @@ const banners = {
43
43
  }]
44
44
  }
45
45
 
46
- const summary = {
47
- extend: Flex,
46
+ const header = {
47
+ extend: ArticleMedium,
48
48
  props: {
49
- align: 'stretch space-between',
50
- margin: 'C1 -Z2',
51
- gap: 'B1'
49
+ '@mobileS': { padding: '- - - A' },
50
+ title: {
51
+ fontWeight: '600',
52
+ text: 'Design System takeaways'
53
+ },
54
+
55
+ p: { text: `Your tokens in the system`
56
+ },
57
+
58
+ p2: {
59
+ display: 'none',
60
+ color: 'gray6',
61
+ margin: '0'
62
+ }
52
63
  },
53
64
 
54
- childExtend: Banner,
65
+ title: {},
66
+ p: {},
67
+ p2: {
68
+ tag: 'p',
69
+ ...[
70
+ 'Welcome to the Symbols documentation page.',
71
+ { text: `Here you'll learn everything…` }
72
+ ]
73
+ }
74
+ }
55
75
 
56
- $setStateCollection: ({ state }) => [{
57
- title: 'Setting up a dark theme',
58
- p: '5 mins tutorial',
59
- background: 'https://p194.p3.n0.cdn.getcloudapp.com/items/eDu7le4P/ef9249a0-c522-49a7-8a0e-d7152b2e73a1.png?v=c4c8cd49408f26a6046b11f35d7b0656',
60
- href: ''
61
- }, {
62
- title: 'Learn typography scaling',
63
- p: '5 mins tutorial',
64
- background: '',
65
- href: ''
66
- }]
76
+ const summary = {
77
+ header,
78
+
79
+ grid: {
80
+ extend: Flex,
81
+ props: {
82
+ align: 'stretch space-between',
83
+ margin: 'C1 -Z2',
84
+ gap: 'B1'
85
+ },
86
+
87
+ $setStateCollection: ({ state }) => [{
88
+ title: 'Setting up a dark theme',
89
+ p: '5 mins tutorial',
90
+ background: 'https://p194.p3.n0.cdn.getcloudapp.com/items/eDu7le4P/ef9249a0-c522-49a7-8a0e-d7152b2e73a1.png?v=c4c8cd49408f26a6046b11f35d7b0656',
91
+ href: ''
92
+ }, {
93
+ title: 'Learn typography scaling',
94
+ p: '5 mins tutorial',
95
+ background: '',
96
+ href: ''
97
+ }]
98
+ }
67
99
  }
68
100
 
69
101
  export const Main = {
@@ -73,5 +105,6 @@ export const Main = {
73
105
  },
74
106
 
75
107
  banners,
108
+ quickStart: { extend: QuickStart },
76
109
  summary
77
110
  }
@@ -1,16 +1,31 @@
1
1
  'use strict'
2
2
 
3
3
  import { router } from '@domql/router'
4
- import { ClickableItem, Flex, Link, ResponsivePreview, SquareButton, TooltipParent } from '@symbo.ls/components'
4
+
5
5
  import { Main } from './Main'
6
- import { PageExtend,
6
+ import {
7
+ ClickableItem,
8
+ Flex,
9
+ Link,
10
+ SquareButton,
11
+ TooltipParent
12
+ } from '@symbo.ls/components'
13
+
14
+ import {
15
+ ShapePreview,
16
+ ResponsivePreview,
17
+ SpacingPreview
18
+ } from '../../components'
19
+
20
+ import {
21
+ PageExtend,
7
22
  Color,
8
23
  Theme,
9
24
  Shapes,
10
25
  Spaces,
11
26
  Icons,
12
27
  Typography,
13
- Fonts, // eslint-disable-line
28
+ Fonts,
14
29
  MediaQuery
15
30
  } from '..'
16
31
 
@@ -70,28 +85,41 @@ const NAV = [{
70
85
  }
71
86
  }, {
72
87
  state: {
73
- href: '/timing',
74
- tooltip: 'Timing'
88
+ href: '/fonts',
89
+ tooltip: 'Fonts'
75
90
  },
76
91
  props: {
77
- icon: { name: 'clock colored' }
78
- }
79
- }, {
80
- state: {
81
- href: '/sequence',
82
- tooltip: 'Sequence'
83
- },
84
- props: {
85
- icon: { name: 'sequence colored' }
92
+ icon: { name: 'fontFace colored' },
93
+ opacity: '.7'
86
94
  }
95
+ // }, {
96
+ // state: {
97
+ // href: '/timing',
98
+ // tooltip: 'Timing'
99
+ // },
100
+ // props: {
101
+ // icon: { name: 'clock colored' }
102
+ // }
103
+ // }, {
104
+ // state: {
105
+ // href: '/sequence',
106
+ // tooltip: 'Sequence'
107
+ // },
108
+ // props: {
109
+ // icon: { name: 'sequence colored' }
110
+ // }
87
111
  }]
88
112
 
89
113
  export const DesignSystem = {
114
+ extend: Flex,
115
+
90
116
  props: {
117
+ margin: '-C2+X2 - -',
118
+ padding: 'C2+X2 - -',
119
+ minHeight: '100%',
91
120
  maxWidth: '100%',
92
121
  width: '100%',
93
122
  flow: 'column',
94
- padding: '- - C1',
95
123
  gap: 'B1'
96
124
  },
97
125
 
@@ -103,6 +131,7 @@ export const DesignSystem = {
103
131
  '/typography': Typography,
104
132
  '/space': Spaces,
105
133
  '/shape': Shapes,
134
+ '/fonts': Fonts,
106
135
  '/icons': Icons,
107
136
  '/media-query': MediaQuery
108
137
  // '/sequence': Sequence,
@@ -116,16 +145,12 @@ export const DesignSystem = {
116
145
  maxWidth: '100%',
117
146
  width: '100%',
118
147
  flow: 'row',
148
+ flex: 1,
119
149
  align: 'flex-start flex-start',
120
150
  gap: 'B1',
121
- padding: 'D2 A B1'
122
- },
123
-
124
- sidebar: {
125
- tag: 'nav',
126
- extend: Flex,
151
+ padding: 'D2 A C1',
127
152
 
128
- props: {
153
+ sidebar: {
129
154
  gap: 'B1',
130
155
  flow: 'column',
131
156
  background: 'transparent',
@@ -135,6 +160,15 @@ export const DesignSystem = {
135
160
  top: 'E'
136
161
  },
137
162
 
163
+ main: {
164
+ flex: 1
165
+ }
166
+ },
167
+
168
+ sidebar: {
169
+ tag: 'nav',
170
+ extend: Flex,
171
+
138
172
  childExtend: {
139
173
  extend: [ClickableItem, Link, SquareButton, TooltipParent],
140
174
  props: ({ state }) => ({
@@ -181,22 +215,28 @@ export const DesignSystem = {
181
215
  main: {
182
216
  tag: 'section',
183
217
  extend: PageExtend,
184
-
185
218
  props: {
186
- flex: 1,
187
- padding: '0 C1 B1'
219
+ padding: 'X2 C1 B1'
188
220
  }
189
221
  }
190
222
  },
191
223
 
192
224
  widget: {
193
225
  props: {
194
- padding: 'C B1 - B1'
226
+ padding: 'A',
227
+ position: 'sticky',
228
+ width: '100%',
229
+ zIndex: 9999,
230
+ bottom: '0'
195
231
  },
196
232
 
233
+ state: ({ parent }) => ({ __ref: parent.page.main.state }),
234
+
197
235
  define: { routes: param => param },
198
236
  routes: {
199
- '/media-query': ResponsivePreview
237
+ '/media-query': ResponsivePreview,
238
+ '/space': SpacingPreview,
239
+ '/shape': ShapePreview
200
240
  },
201
241
 
202
242
  on: {
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  import { Grid, Hoverable, FontObject } from '@symbo.ls/components'
4
- import { TypeSection } from './shared'
4
+ import { TypeSection } from '../Typography/shared'
5
5
 
6
6
  const mapFonts = (el, s) => {
7
7
  if (!el.context.SYSTEM) return
@@ -16,8 +16,7 @@ const mapFonts = (el, s) => {
16
16
 
17
17
  return {
18
18
  title: v,
19
- href: `/typography/font-settings/${v}`,
20
- scrollToTop: false,
19
+ href: `/fonts/font-settings/${v}`,
21
20
  labels: [
22
21
  { icon: 'fontVariable', text: fontWeightCaption }
23
22
  ]
@@ -33,7 +32,7 @@ export default {
33
32
  p: 'Document @font-face, default and backup fonts',
34
33
  nav: [{
35
34
  icon: 'plus',
36
- href: '/typography/upload-font'
35
+ href: '/fonts/upload-font'
37
36
  }]
38
37
  }
39
38
  },
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  import { Grid, Hoverable, FontFamilyObject } from '@symbo.ls/components'
4
- import { TypeSection } from './shared'
4
+ import { TypeSection } from '../Typography/shared'
5
5
 
6
6
  const mapFontFamilies = (el, s) => {
7
7
  if (!el.context.SYSTEM) return
@@ -13,8 +13,7 @@ const mapFontFamilies = (el, s) => {
13
13
  if (v === 'default') return
14
14
  return {
15
15
  title: v,
16
- href: `/typography/font-family/${v}`,
17
- scrollToTop: false,
16
+ href: `/fonts/font-family/${v}`,
18
17
  val
19
18
  }
20
19
  }).filter(v => v)
@@ -28,11 +27,12 @@ export default {
28
27
  p: 'Setup a set and fallback fonts as font families',
29
28
  nav: [{
30
29
  icon: 'plus',
31
- href: '/typography/add-font-family',
30
+ href: '/fonts/add-font-family',
32
31
  scrollToTop: false
33
32
  }]
34
33
  }
35
34
  },
35
+
36
36
  content: {
37
37
  extend: Grid,
38
38
  props: {