@symbo.ls/preview 0.0.45 → 0.0.47

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.45",
5
+ "version": "0.0.47",
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",
@@ -1,12 +1,45 @@
1
1
  'use strict'
2
2
 
3
- import state from './state'
3
+ import { Flex } from '@symbo.ls/components'
4
4
 
5
- export const MediaQuery = {
6
- state,
5
+ import { mediaValuesList, screenSizingList } from './lists'
6
+
7
+ const content = {
8
+ extend: Flex,
9
+ childExtend: {
10
+ props: {
11
+ heading: {
12
+ color: 'white',
13
+ padding: '0 0 A1 Z1',
14
+ fontWeight: '700'
15
+ }
16
+ }
17
+ },
7
18
 
19
+ ...[{
20
+ heading: { props: { text: 'Media Value' } },
21
+ mediaValuesList
22
+ }, {
23
+ heading: { props: { text: 'Screen Sizing Sheet' } },
24
+ screenSizingList
25
+ }]
26
+ }
27
+
28
+ const props = {
8
29
  SectionHeader: {
9
30
  title: 'Responsive',
10
31
  p: 'A Design System is the single source of truth that defines all design elements and allows the crews to assemble components and compose them into more complex apps.'
32
+ },
33
+
34
+ content: {
35
+ justifyContent: 'space-between',
36
+ gap: 'A2'
11
37
  }
12
38
  }
39
+
40
+ export const MediaQuery = {
41
+ props,
42
+
43
+ SectionHeader: {},
44
+ content
45
+ }
@@ -0,0 +1,312 @@
1
+ 'use strict'
2
+
3
+ import { IconText, Flex, SquareButton, Grid, Select, Input } from '@symbo.ls/components'
4
+ import style from '@symbo.ls/components/src/UserAccount/style'
5
+ import { state } from '@symbo.ls/icons'
6
+ import { BREAKPOINTS_DATA, DEVICE_SIZE_DATA } from './state'
7
+
8
+ const stateCom = {
9
+ activeScreen: false
10
+ }
11
+
12
+ const listProps = {
13
+ background: 'gray1',
14
+ round: 'A',
15
+ fontSize: 'Z1',
16
+ style: { overflow: 'hidden' }
17
+ // padding: '- - - A'
18
+ // border: '2px solid red'
19
+ }
20
+
21
+ const valueItemProps = {
22
+ height: 'B',
23
+ theme: 'quaternary',
24
+ round: 'Y',
25
+ align: 'center center',
26
+ minWidth: 'C2'
27
+ }
28
+
29
+ const MEDIA_TYPES = [{
30
+ text: 'min-width',
31
+ value: 'minWidth'
32
+ }, {
33
+ text: 'max-width',
34
+ value: 'maxWidth'
35
+ }, {
36
+ text: 'min-height',
37
+ value: 'minHeight'
38
+ }, {
39
+ text: 'max-height',
40
+ value: 'maxHeight'
41
+ }, {
42
+ text: 'exact',
43
+ value: 'exact'
44
+ }]
45
+
46
+ const BreakpointItem = {
47
+ extend: Flex,
48
+ state: stateCom,
49
+ props: {
50
+ gap: 'X',
51
+ alignItems: 'center'
52
+ },
53
+
54
+ childExtend: {
55
+ extend: Flex,
56
+ props: valueItemProps
57
+ },
58
+
59
+ container: {
60
+ props: {
61
+ padding: '0 X2',
62
+ background: 'gray1'
63
+ },
64
+ property: {
65
+ extend: Select,
66
+ props: ({ state }) => ({
67
+ background: 'transparent',
68
+ color: 'white'
69
+ }),
70
+
71
+ // on: {
72
+ // click: (event, element, state) => {
73
+ // state.offers
74
+ // ? state.update({ offers: false })
75
+ // : state.update({ offers: true })
76
+ // }
77
+ // }
78
+
79
+ on: {
80
+ change: (ev, el, s) => {
81
+ s.update({ value: el.node.value })
82
+ }
83
+ },
84
+ $setCollection: () => MEDIA_TYPES.map(props => ({ props }))
85
+ }
86
+ },
87
+
88
+ value: {
89
+ extend: Input,
90
+ props: ({ state }) => ({
91
+ placeholder: state.placeholder,
92
+ round: 'Y',
93
+ maxWidth: 'C2',
94
+ padding: '0',
95
+ style: { textAlign: 'center' }
96
+ })
97
+ },
98
+ value2: {
99
+ extend: Input,
100
+ props: ({ state }) => ({
101
+ hide: state.value !== 'exact',
102
+ // value: state.value,
103
+ placeholder: '728px',
104
+ round: 'Y',
105
+ maxWidth: 'C1',
106
+ padding: '0',
107
+ textAlign: 'center'
108
+ })
109
+ }
110
+ }
111
+
112
+ const screenIconText = {
113
+ extend: [IconText, Flex],
114
+ props: ({ state }) => ({
115
+ text: state.name,
116
+ gap: 'Z1',
117
+ align: 'center flex-start',
118
+ whiteSpace: 'nowrap',
119
+ icon: {
120
+ name: state.icon,
121
+ opacity: '.5'
122
+ }
123
+ })
124
+ }
125
+
126
+ const MediaValuesRow = {
127
+ extend: Flex,
128
+ props: {
129
+ gap: 'D',
130
+ align: 'center',
131
+ minHeight: 'C2',
132
+ padding: '- - - A',
133
+ childProps: { minWidth: 'E' },
134
+ ':not(:last-child)': {
135
+ border: 'dashed, white 0.05',
136
+ borderWidth: '0 0 1.5px'
137
+ },
138
+ ':hover': {
139
+ background: 'gray2',
140
+ cursor: 'pointer'
141
+ },
142
+ ':hover > div > button': { opacity: 1 }
143
+ },
144
+
145
+ screen: { extend: screenIconText },
146
+
147
+ columnBreakPoints: {
148
+ extend: Flex,
149
+ props: { gap: 'A2' },
150
+ childExtend: BreakpointItem,
151
+ $setStateCollection: ({ state }) => state.breakpoints
152
+ },
153
+
154
+ plusButtonContainer: {
155
+ // props: { style: { border: '2px solid red' } },
156
+ button: {
157
+ extend: SquareButton,
158
+ props: {
159
+ style: {
160
+ border: '1px solid rgba(255, 255, 255, .1)'
161
+ },
162
+
163
+ icon: { name: 'plus' },
164
+ padding: 'X2',
165
+ round: '100%',
166
+ border: 'solid, gray4',
167
+ borderWidth: '1px',
168
+ color: 'gray6',
169
+ background: 'transparent'
170
+ },
171
+
172
+ on: {
173
+ click: (ev, el, s) => {
174
+ const length = Object.keys(s.breakpoints).length
175
+ if (!s.breakpoints || length > 2) return
176
+ s.update({
177
+ breakpoints: { [length]: {} }
178
+ })
179
+ }
180
+ }
181
+ }
182
+ },
183
+
184
+ hoverButtons: {
185
+ extend: Flex,
186
+ props: {
187
+ margin: '- - - auto'
188
+ },
189
+ childExtend: {
190
+ extend: SquareButton,
191
+ props: {
192
+ background: 'transparent',
193
+ color: 'gray5',
194
+ style: { opacity: '0' }
195
+ }
196
+ },
197
+ ...[
198
+ { props: { icon: 'eyeOpen' } },
199
+ { props: { icon: 'arrowAngleMirroringHorizontal' } },
200
+ {
201
+ props: { icon: 'trashAlt' },
202
+ on: {
203
+ click: (event, element, state) => {
204
+ const { key } = element.parent.parent
205
+ state.parent.update({
206
+ data: {
207
+ [key]: { name: 'asd' }
208
+ }
209
+ })
210
+ }
211
+ }
212
+ }
213
+ ]
214
+ }
215
+ }
216
+
217
+ export const mediaValuesList = {
218
+ state: BREAKPOINTS_DATA,
219
+ props: {
220
+ ...listProps,
221
+ minWidth: 'I2'
222
+ },
223
+
224
+ childExtend: MediaValuesRow,
225
+ $setStateCollection: ({ state }) => state.data
226
+ }
227
+
228
+ const DefaultScreensRow = {
229
+ extend: Flex,
230
+ state: stateCom,
231
+ // state: MEDIA_TYPES,
232
+ class: {
233
+ show: (element, state) => state.activeScreen
234
+ ? { opacity: 1 } : { opacity: 0.45 }
235
+ },
236
+ props: ({ el, state }) => ({
237
+ // if () {},
238
+ // hide: state.value !== 'exact' ? el.update({ style: { opacity: '.3' } }) : 'center',
239
+ // hide: state.value !== 'exact',
240
+ // text.
241
+
242
+ minHeight: 'C2',
243
+ padding: '- A - A',
244
+ gap: 'C',
245
+ ':not(:last-child)': {
246
+ border: 'solid, white .05',
247
+ borderWidth: '0 0 1px'
248
+ }
249
+ }),
250
+ // class: {
251
+ // show: (element, state) => MEDIA_TYPES.value === 'match'
252
+ // ? { opacity: 0 } : { opacity: 1 }
253
+ // },
254
+ // props: {
255
+
256
+ // // on: {
257
+ // // click: (event, element, state) => {
258
+ // // state.offers
259
+ // // ? state.update({ offers: false })
260
+ // // : state.update({ offers: true })
261
+ // // }
262
+ // // }
263
+ // },
264
+ // on: {
265
+ // change: (ev, el, s) => {
266
+ // s.update({ value: el.node.value })
267
+ // s.stateCom.update({ activeScreen: true })
268
+ // }
269
+ // // click: (ev, el, s) => {
270
+ // // s.update({ activeScreen: true })
271
+ // // }
272
+ // },
273
+
274
+ screen: { extend: screenIconText, style: { minWidth: '150px' } },
275
+ values: {
276
+ extend: Flex,
277
+ props: {
278
+ // minWidth: '100px',
279
+ alignItems: 'center',
280
+ gap: 'X1'
281
+ // maxWidth: 'fit-content',
282
+ // border: '2px solid green'
283
+ },
284
+
285
+ valueX: {
286
+ extend: Flex,
287
+ props: valueItemProps,
288
+ text: ({ state }) => state.xValue
289
+ },
290
+ x: { props: { text: 'x' } },
291
+ valueY: {
292
+ extend: Flex,
293
+ props: valueItemProps,
294
+ text: ({ state }) => state.yValue
295
+ }
296
+ }
297
+ }
298
+
299
+ export const screenSizingList = {
300
+ state: DEVICE_SIZE_DATA,
301
+ props: {
302
+ ...listProps,
303
+ minWidth: '300px'
304
+
305
+ // padding: 'A 0 A A'
306
+ // border: '2px solid yellow'
307
+ },
308
+
309
+ childExtend: DefaultScreensRow,
310
+
311
+ $setStateCollection: ({ state }) => state.data
312
+ }
@@ -1,5 +1,150 @@
1
1
  'use strict'
2
2
 
3
- export default {
4
- //
3
+ export const BREAKPOINTS_DATA = {
4
+ data: [{
5
+ icon: 'deviceBigScreenOutline',
6
+ name: 'iMac',
7
+ breakpoints: [{
8
+ type: 'minWidth',
9
+ value: '2780',
10
+ placeholder: '2780'
11
+ }]
12
+ }, {
13
+ icon: 'deviceSmallScreenOutline',
14
+ name: 'screenLg',
15
+ breakpoints: [{
16
+ type: 'minWidth',
17
+ value: '1920',
18
+ placeholder: '1920'
19
+ }]
20
+ }, {
21
+ icon: 'deviceSmallScreenOutline',
22
+ name: 'screebMd',
23
+ breakpoints: [{
24
+ type: 'minWidth',
25
+ value: '1680',
26
+ placeholder: '1680'
27
+ }]
28
+ }, {
29
+ icon: 'deviceSmallScreenOutline',
30
+ name: 'screebSm',
31
+ breakpoints: [{
32
+ type: 'minWidth',
33
+ value: '1440',
34
+ placeholder: '1440'
35
+ }]
36
+ }, {
37
+ icon: 'deviceTabletLandscapeOutline',
38
+ name: 'tabletLg',
39
+ breakpoints: [{
40
+ type: 'minWidth',
41
+ value: '1366',
42
+ placeholder: '1440'
43
+ }]
44
+ }, {
45
+ icon: 'deviceTabletLandscapeOutline',
46
+ name: 'tabletMd',
47
+ breakpoints: [{
48
+ type: 'minWidth',
49
+ value: '280',
50
+ placeholder: '1440'
51
+ }]
52
+ }, {
53
+ icon: 'deviceTabletLandscapeOutline',
54
+ name: 'tabletSm',
55
+ breakpoints: [{
56
+ type: 'minWidth',
57
+ value: '1024',
58
+ placeholder: '1440'
59
+ }]
60
+ }, {
61
+ icon: 'deviceMobileOutline',
62
+ name: 'mobileLg',
63
+ breakpoints: [{
64
+ type: 'minWidth',
65
+ value: '768',
66
+ value2: '657',
67
+ placeholder: '768'
68
+ }]
69
+ }, {
70
+ icon: 'deviceMobileOutline',
71
+ name: 'mobileMd',
72
+ breakpoints: [{
73
+ type: 'minWidth',
74
+ value: '560',
75
+ placeholder: '560'
76
+ }]
77
+ }, {
78
+ icon: 'deviceMobileOutline',
79
+ name: 'mobileSm',
80
+ breakpoints: [{
81
+ type: 'minWidth',
82
+ value: '480',
83
+ placeholder: '480'
84
+ }]
85
+
86
+ }, {
87
+ icon: 'deviceMobileOutline',
88
+ name: 'mobileXs',
89
+ breakpoints: [{
90
+ type: 'minWidth',
91
+ value: '375',
92
+ placeholder: '375'
93
+ }]
94
+
95
+ }]
96
+ }
97
+
98
+ export const DEVICE_SIZE_DATA = {
99
+ data: [{
100
+ icon: 'deviceBigScreenOutline',
101
+ name: 'Apple XDR',
102
+ xValue: '3008',
103
+ yValue: '1692'
104
+ }, {
105
+ icon: 'deviceBigScreenOutline',
106
+ name: `iMac 27''`,
107
+ xValue: '2560',
108
+ yValue: '1440'
109
+ }, {
110
+ icon: 'deviceBigScreenOutline',
111
+ name: `iMac 24''`,
112
+ xValue: '2240',
113
+ yValue: '1260'
114
+ }, {
115
+ icon: 'deviceBigScreenOutline',
116
+ name: 'Full HD',
117
+ xValue: '1920',
118
+ yValue: '1080'
119
+ }, {
120
+ icon: 'deviceSmallScreenOutline',
121
+ name: `MacBook Pro 16''`,
122
+ xValue: '1728',
123
+ yValue: '1117'
124
+ }, {
125
+ icon: 'deviceSmallScreenOutline',
126
+ name: `MacBook Pro 14''`,
127
+ xValue: '1512',
128
+ yValue: '982'
129
+ }, {
130
+ icon: 'deviceSmallScreenOutline',
131
+ name: `MacBook Pro 13''`,
132
+ xValue: '1470',
133
+ yValue: '956'
134
+ }, {
135
+ icon: 'deviceTabletLandscapeOutline',
136
+ name: `iPad Pro 12.9''`,
137
+ xValue: '1024',
138
+ yValue: '1366'
139
+ }, {
140
+ icon: 'deviceTabletLandscapeOutline',
141
+ name: `iPad Air 10.9''`,
142
+ xValue: '820',
143
+ yValue: '1180'
144
+ }, {
145
+ icon: 'deviceTabletLandscapeOutline',
146
+ name: `iPad Mini 8.3''`,
147
+ xValue: '744',
148
+ yValue: '1133'
149
+ }]
5
150
  }
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { Flex } from '@symbo.ls/components'
3
+ import { Code, Flex } from '@symbo.ls/components'
4
4
  import { Preview } from './Preview'
5
5
  import { Table } from './Table'
6
6
 
@@ -59,21 +59,24 @@ export const SpacingScale = {
59
59
  backdropFilter: 'blur(15px)'
60
60
  }
61
61
  },
62
- scene: {
63
- extend: Preview
64
- },
62
+
63
+ scene: { extend: Preview },
65
64
  code: {
66
- extend: 'Code',
65
+ extend: Code,
67
66
  props: ({ state }) => ({
68
67
  hide: Object.keys(state.props).length === 0,
69
68
  flex: '0 0 360px',
70
69
  margin: '0',
71
- code: { margin: '0' },
70
+ code: {
71
+ margin: '0'
72
+ },
72
73
  buttons: { marginInline: 'X2' }
73
74
  }),
74
75
  title: null,
75
76
  code: {
76
- text: ({ state }) => JSON.stringify(state.props, null, 2)
77
+ props: {
78
+ text: ({ state }) => 'const props = ' + JSON.stringify(state.props, null, 2)
79
+ }
77
80
  }
78
81
  }
79
82
  }
@@ -21,7 +21,7 @@ const Row = {
21
21
  key: state => state.key,
22
22
 
23
23
  props: ({ state }) => ({
24
- columns: '10ch 14ch 13ch 10ch 21em 1fr',
24
+ columns: '7ch 20em 14ch 12ch 12ch 1fr',
25
25
  alignItems: 'center',
26
26
  isBase: state.index === 0,
27
27
  active: (state.key && state.key.length) === 1,
@@ -92,10 +92,10 @@ const Row = {
92
92
  childExtend: Cell,
93
93
 
94
94
  i: {},
95
+ buttons,
95
96
  em: {},
96
97
  decimal: {},
97
98
  px: {},
98
- buttons,
99
99
 
100
100
  graph: { line: {} }
101
101
  }
@@ -111,10 +111,10 @@ const HeaderRow = {
111
111
  },
112
112
 
113
113
  i: '#',
114
+ buttons: ' ',
114
115
  em: 'em',
115
116
  decimal: 'decimal',
116
117
  px: 'px',
117
- buttons: null,
118
118
  graph: null
119
119
  }
120
120
 
@@ -158,6 +158,7 @@ export const Table = {
158
158
 
159
159
  cnt: {
160
160
  childExtend: Row,
161
+ props: { lazyLoad: true },
161
162
  $setStateCollection: (el) => mapSequence(el.state, sortSequence)
162
163
  }
163
164
  }
@@ -127,6 +127,7 @@ export default {
127
127
  }
128
128
  }
129
129
  return {
130
+ lazyLoad: true,
130
131
  columns: 'auto 32px auto',
131
132
  rows: 'auto 32px auto',
132
133
  templateAreas: `"endStart blockStart startEnd"
@@ -184,6 +185,7 @@ export default {
184
185
 
185
186
  click: {
186
187
  props: {
188
+ lazyLoad: true,
187
189
  position: 'absolute',
188
190
  inset: '0 0 0 0'
189
191
  },
@@ -194,17 +196,20 @@ export default {
194
196
  const tableState = rowState.parent
195
197
  const propKey = state.value
196
198
  const active = tableState.props[propKey] === rowState.key
197
- if (active) {
198
- delete tableState.props[propKey] && tableState.update()
199
- } else {
200
- const allKeys = Object.keys(tableState.props)
201
- allKeys.filter(v => {
202
- const splitInWords = propKey.split(/(?=[A-Z])/)
203
- return v.includes(splitInWords[0]) && v.includes(splitInWords[1])
204
- })
205
- .forEach(v => delete tableState.props[v])
206
- tableState.update({ props: { [propKey]: rowState.key } })
207
- }
199
+ const t = setTimeout(() => {
200
+ if (active) {
201
+ delete tableState.props[propKey] && tableState.update()
202
+ } else {
203
+ const allKeys = Object.keys(tableState.props)
204
+ allKeys.filter(v => {
205
+ const splitInWords = propKey.split(/(?=[A-Z])/)
206
+ return v.includes(splitInWords[0]) && v.includes(splitInWords[1])
207
+ })
208
+ .forEach(v => delete tableState.props[v])
209
+ tableState.update({ props: { [propKey]: rowState.key } })
210
+ }
211
+ clearTimeout(t)
212
+ })
208
213
  }
209
214
  },
210
215
 
@@ -17,7 +17,6 @@ const mapFonts = (el, s) => {
17
17
  return {
18
18
  title: v,
19
19
  href: `/typography/font-settings/${v}`,
20
- scrollToTop: false,
21
20
  labels: [
22
21
  { icon: 'fontVariable', text: fontWeightCaption }
23
22
  ]
@@ -14,7 +14,6 @@ const mapFontFamilies = (el, s) => {
14
14
  return {
15
15
  title: v,
16
16
  href: `/typography/font-family/${v}`,
17
- scrollToTop: false,
18
17
  val
19
18
  }
20
19
  }).filter(v => v)