@symbo.ls/preview 0.0.47 → 0.0.49

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.
@@ -1,7 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { Code, Flex } from '@symbo.ls/components'
4
- import { Preview } from './Preview'
3
+ import { Flex } from '@symbo.ls/components'
5
4
  import { Table } from './Table'
6
5
 
7
6
  export const SpacingScale = {
@@ -20,7 +19,7 @@ export const SpacingScale = {
20
19
 
21
20
  SequenceSliders: {
22
21
  position: 'sticky',
23
- top: 'D',
22
+ top: 'C2',
24
23
  background: 'black .5',
25
24
  zIndex: '9999',
26
25
  margin: '-B2 -B -B',
@@ -33,6 +32,7 @@ export const SpacingScale = {
33
32
  scale: {
34
33
  extend: Flex,
35
34
  props: {
35
+ lazyLoad: true,
36
36
  flow: 'column',
37
37
  gap: 'B1',
38
38
  margin: '0 0 C2',
@@ -41,44 +41,6 @@ export const SpacingScale = {
41
41
  preview: { flex: 1 }
42
42
  },
43
43
 
44
- table: { extend: Table },
45
-
46
- preview: {
47
- extend: Flex,
48
- props: {
49
- position: 'sticky',
50
- margin: '0 -Z1',
51
- maxHeight: '25vh',
52
- bottom: 'Z',
53
- zIndex: '9999',
54
- gap: 'A',
55
-
56
- scene: { flex: 1 },
57
-
58
- style: {
59
- backdropFilter: 'blur(15px)'
60
- }
61
- },
62
-
63
- scene: { extend: Preview },
64
- code: {
65
- extend: Code,
66
- props: ({ state }) => ({
67
- hide: Object.keys(state.props).length === 0,
68
- flex: '0 0 360px',
69
- margin: '0',
70
- code: {
71
- margin: '0'
72
- },
73
- buttons: { marginInline: 'X2' }
74
- }),
75
- title: null,
76
- code: {
77
- props: {
78
- text: ({ state }) => 'const props = ' + JSON.stringify(state.props, null, 2)
79
- }
80
- }
81
- }
82
- }
44
+ table: { extend: Table }
83
45
  }
84
46
  }
@@ -72,7 +72,7 @@ const Row = {
72
72
  display: 'flex',
73
73
  gap: '.2em',
74
74
  opacity: '1',
75
- ':empty': { padding: '0' }
75
+ boxSizing: 'content-box'
76
76
  },
77
77
  graph: {
78
78
  margin: '0 0 0 -B2',
@@ -123,6 +123,7 @@ export const Table = {
123
123
  tag: 'section',
124
124
 
125
125
  props: {
126
+ lazyLoad: true,
126
127
  overflow: 'hidden',
127
128
  position: 'relative',
128
129
  header: {
@@ -55,6 +55,7 @@ const diffIconTypes = (parentKey, key) => {
55
55
 
56
56
  const BUTTONS = {
57
57
  margin: {
58
+ maxValue: 3000,
58
59
  blockStart: {},
59
60
  inlineEnd: {},
60
61
  blockEnd: {},
@@ -69,22 +70,26 @@ const BUTTONS = {
69
70
  maxWidth: {}
70
71
  },
71
72
  borderWidth: {
73
+ maxValue: 1280,
72
74
  blockStartWidth: {},
73
75
  inlineEndWidth: {},
74
76
  blockEndWidth: {},
75
77
  inlineStartWidth: {}
76
78
  },
77
79
  padding: {
80
+ maxValue: 3000,
78
81
  blockStart: {},
79
82
  inlineEnd: {},
80
83
  blockEnd: {},
81
84
  inlineStart: {}
82
85
  },
83
86
  gap: {
87
+ maxValue: 3000,
84
88
  Horizontal: {},
85
89
  Vertical: {}
86
90
  },
87
91
  borderRadius: {
92
+ maxValue: 1280,
88
93
  endStart: {},
89
94
  startEnd: {},
90
95
  endEnd: {},
@@ -92,13 +97,27 @@ const BUTTONS = {
92
97
  }
93
98
  }
94
99
 
100
+ let keys
101
+ const cachedKeys = state => {
102
+ if (!keys) keys = Object.keys(BUTTONS[state.value]).filter(v => v !== 'maxValue')
103
+ return keys
104
+ }
105
+
95
106
  export default {
107
+ props: {
108
+ lazyLoad: true,
109
+ height: 'B2',
110
+ boxSizing: 'content-box'
111
+ },
112
+
96
113
  childExtend: {
97
114
  extend: [ChoosableButton, DropdownParent, WiderButton],
98
115
 
99
116
  props: ({ key, state, parent }) => ({
100
117
  active: state.parent.parent.props[state.value] === state.parent.key,
101
118
  icon: { name: state.value },
119
+ lazyLoad: true,
120
+
102
121
  '.active': {
103
122
  color: 'blue',
104
123
  ':hover': {
@@ -111,6 +130,7 @@ export default {
111
130
  extend: Dropdown,
112
131
 
113
132
  props: {
133
+ lazyLoad: true,
114
134
  minWidth: 'none',
115
135
  grid: { gap: '0' }
116
136
  },
@@ -120,9 +140,10 @@ export default {
120
140
  grid: {
121
141
  extend: GridInDropdown,
122
142
  props: ({ state }) => {
123
- const keys = Object.keys(BUTTONS[state.value])
143
+ const keys = cachedKeys(state)
124
144
  if (keys.length < 4) {
125
145
  return {
146
+ lazyLoad: true,
126
147
  columns: 'repeat(4, 1fr)'
127
148
  }
128
149
  }
@@ -146,6 +167,7 @@ export default {
146
167
  const iconKey = diffIconTypes(propState.value, state.value)
147
168
  const active = tableState.props[propKey] === rowState.key
148
169
  return {
170
+ lazyLoad: true,
149
171
  active,
150
172
  icon: {
151
173
  name: iconKey
@@ -179,7 +201,7 @@ export default {
179
201
  }
180
202
  },
181
203
 
182
- $setStateCollection: ({ state }) => Object.keys(BUTTONS[state.value])
204
+ $setStateCollection: ({ state, props }) => cachedKeys(state)
183
205
  }
184
206
  },
185
207
 
@@ -196,20 +218,20 @@ export default {
196
218
  const tableState = rowState.parent
197
219
  const propKey = state.value
198
220
  const active = tableState.props[propKey] === rowState.key
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
- })
221
+ if (active) {
222
+ console.log('clicked')
223
+ delete tableState.props[propKey] && tableState.update()
224
+ } else {
225
+ const allKeys = Object.keys(tableState.props)
226
+ allKeys.filter(v => {
227
+ const splitInWords = propKey.split(/(?=[A-Z])/)
228
+ return v.includes(splitInWords[0]) && v.includes(splitInWords[1])
229
+ })
230
+ .forEach(v => delete tableState.props[v])
231
+ console.log('clicked2')
232
+
233
+ tableState.update({ props: { [propKey]: rowState.key } })
234
+ }
213
235
  }
214
236
  },
215
237
 
@@ -227,6 +249,7 @@ export default {
227
249
  round: '100%',
228
250
  background: 'blue',
229
251
  boxSize: 'W2',
252
+ lazyLoad: true,
230
253
 
231
254
  hide: !active,
232
255
 
@@ -238,9 +261,15 @@ export default {
238
261
  }
239
262
  },
240
263
 
241
- $setStateCollection: ({ state }) => Object.keys(BUTTONS[state.value])
264
+ $setStateCollection: ({ state }) => {
265
+ const buttonsByProperty = cachedKeys(state)
266
+ return buttonsByProperty
267
+ }
242
268
  }
243
269
  },
244
270
 
245
- $setStateCollection: ({ state }) => Object.keys(BUTTONS)
271
+ $setStateCollection: ({ state }) => Object.keys(BUTTONS).filter(v => {
272
+ const { maxValue } = BUTTONS[v]
273
+ return maxValue ? maxValue > state.val : true
274
+ })
246
275
  }
@@ -2,9 +2,7 @@
2
2
 
3
3
  import state from './state'
4
4
 
5
- import fontFaces from './fontFaces'
6
5
  import typeScale from './typeScale'
7
- import fontFamilies from './fontFamilies'
8
6
  import documentStyles from './documentStyles'
9
7
  import stylesHelpers from './stylesHelpers'
10
8
  import { mapSequence, sortSequence } from '@symbo.ls/components'
@@ -25,12 +23,6 @@ export const Typography = {
25
23
  stylesHelpers,
26
24
  line2: { extend: 'Line' },
27
25
 
28
- fontFaces,
29
- line3: { extend: 'Line' },
30
-
31
- fontFamilies,
32
- line4: { extend: 'Line' },
33
-
34
26
  typeScale,
35
27
 
36
28
  on: {
@@ -38,7 +38,6 @@ export default {
38
38
  const font = family.arr[0]
39
39
 
40
40
  const HELPERS = Object.keys(styles).filter(v => v.slice(0, 1) === '.')
41
- console.log(HELPERS)
42
41
  return HELPERS.map((v, k) => ({
43
42
  key: v,
44
43
  value: {