@symbo.ls/preview 0.0.87 → 0.0.89

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.87",
5
+ "version": "0.0.89",
6
6
  "repository": "https://github.com/rackai/editor",
7
7
  "main": "src/index.js",
8
8
  "scripts": {
@@ -6,7 +6,7 @@ import { Flex, SquareButton } from 'smbls'
6
6
  const setTooltipPosition = (el, s, options = {}) => {
7
7
  const key = parseInt(el.key)
8
8
  const rowHeight = `(var(--spacing-C) + var(--spacing-B1) + ${key}%)`
9
- const translateY = `calc(${rowHeight} * ${key} + var(--spacing-X))`
9
+ const translateY = `calc(${rowHeight} * ${key} + var(--spacing-Y2))`
10
10
  const transform = `translate3d(0%, ${translateY}, 1px)`
11
11
  const Tooltip = el.lookup('Tooltip')
12
12
  if (Tooltip.setProps) {
@@ -31,16 +31,24 @@ export const NavbarButton = {
31
31
  }),
32
32
 
33
33
  on: {
34
- initUpdate: (el, s) => {
34
+ update: (el, s) => {
35
35
  const active = window.location.pathname.includes(s.href)
36
36
  if (active) setTooltipPosition(el, s)
37
37
  },
38
- mouseover: (ev, el, s) => setTooltipPosition(el, s, { visible: true }),
38
+ mouseover: (ev, el, s) => {
39
+ if (!s.hover) {
40
+ s.hover = true
41
+ setTooltipPosition(el, s, { visible: true })
42
+ }
43
+ },
39
44
  mouseleave: (ev, el, s) => {
40
- el.lookup('Tooltip').setProps({
41
- opacity: '0',
42
- visibility: 'hidden'
43
- })
45
+ if (s.hover) {
46
+ s.hover = false
47
+ el.lookup('Tooltip').setProps({
48
+ opacity: '0',
49
+ visibility: 'hidden'
50
+ })
51
+ }
44
52
  }
45
53
  }
46
54
  }
@@ -87,6 +95,7 @@ export const DesignSystemNavbar = {
87
95
  lineHeight: 1,
88
96
  title: { fontSize: 'Z' }
89
97
  },
98
+ title: null,
90
99
  p: null
91
100
  }
92
101
  }
@@ -0,0 +1,41 @@
1
+ 'use strict'
2
+
3
+ import { Flex } from '@symbo.ls/components'
4
+ import { SpacingButton } from '..'
5
+ import { SPACING_BUTTONS } from './props'
6
+
7
+ export const setTableButtons = ({ state }) =>
8
+ Object.keys(SPACING_BUTTONS).filter(v => {
9
+ const rowState = state.sequence[state.selectedKey]
10
+ const { maxValue } = SPACING_BUTTONS[v]
11
+ return maxValue ? maxValue > (rowState && rowState.val) : true
12
+ })
13
+
14
+ export const setRowButtons = ({ state }) =>
15
+ Object.keys(SPACING_BUTTONS).filter(v => {
16
+ const { maxValue } = SPACING_BUTTONS[v]
17
+ return maxValue ? maxValue > state.val : true
18
+ })
19
+
20
+ export default {
21
+ extend: Flex,
22
+
23
+ props: {
24
+ position: 'absolute',
25
+ left: 'G3',
26
+ gap: 'X',
27
+ top: 'Y',
28
+ height: 'B2',
29
+ zIndex: 99,
30
+ boxSizing: 'content-box',
31
+ padding: '- - E',
32
+ transition: 'C ease-out',
33
+ transitionProperty: 'transform, opacity',
34
+ opacity: '0',
35
+
36
+ ':hover': { opacity: '1' }
37
+ },
38
+
39
+ childExtend: SpacingButton,
40
+ $setStateCollection: setTableButtons
41
+ }
@@ -11,9 +11,9 @@ import {
11
11
  diffPropPosition,
12
12
  diffPropValue,
13
13
  getStateTree,
14
- keysOf,
15
- SPACING_BUTTONS
14
+ keysOf
16
15
  } from '.'
16
+ import { SPACING_BUTTONS } from './props'
17
17
 
18
18
  const ButtonInDropdown = {
19
19
  extend: [ChoosableButton],
@@ -1,53 +1,10 @@
1
1
  'use strict'
2
2
 
3
- import { WiderButton, DropdownParent } from '@symbo.ls/components'
3
+ import { WiderButton, DropdownParent, Icon } from '@symbo.ls/components'
4
4
 
5
+ import { SPACING_BUTTONS } from './props'
5
6
  import dropdown from './dropdown'
6
7
 
7
- export const SPACING_BUTTONS = {
8
- margin: {
9
- maxValue: 3000,
10
- blockStart: {},
11
- inlineEnd: {},
12
- blockEnd: {},
13
- inlineStart: {}
14
- },
15
- height: {
16
- minWidth: {},
17
- maxWidth: {}
18
- },
19
- width: {
20
- minWidth: {},
21
- maxWidth: {}
22
- },
23
- borderWidth: {
24
- maxValue: 1280,
25
- blockStartWidth: {},
26
- inlineEndWidth: {},
27
- blockEndWidth: {},
28
- inlineStartWidth: {}
29
- },
30
- padding: {
31
- maxValue: 3000,
32
- blockStart: {},
33
- inlineEnd: {},
34
- blockEnd: {},
35
- inlineStart: {}
36
- },
37
- gap: {
38
- maxValue: 3000,
39
- Horizontal: {},
40
- Vertical: {}
41
- },
42
- borderRadius: {
43
- maxValue: 1280,
44
- endStart: {},
45
- startEnd: {},
46
- endEnd: {},
47
- startStart: {}
48
- }
49
- }
50
-
51
8
  export const ChoosableButton = {
52
9
  props: ({ key }) => ({
53
10
  padding: 'Z',
@@ -73,7 +30,7 @@ export const ChoosableButton = {
73
30
  })
74
31
  }
75
32
 
76
- const DotForPropButton = {
33
+ export const DotForPropButton = {
77
34
  props: (el) => {
78
35
  const { table, row, property: direction } = getStateTree(el)
79
36
  const property = direction.parent
@@ -94,10 +51,10 @@ const DotForPropButton = {
94
51
  isRadius,
95
52
 
96
53
  '!isRadius': {
97
- ':nth-child(1)': { left: '50%', top: 'W' },
98
- ':nth-child(2)': { right: 'W', top: '50%' },
99
- ':nth-child(3)': { left: '50%', bottom: 'W' },
100
- ':nth-child(4)': { left: 'W', top: '50%' }
54
+ ':nth-child(1)': { left: '45%', top: 'W' },
55
+ ':nth-child(2)': { right: 'W', top: '45%' },
56
+ ':nth-child(3)': { left: '45%', bottom: 'W' },
57
+ ':nth-child(4)': { left: 'W', top: '45%' }
101
58
  },
102
59
 
103
60
  '.isRadius': {
@@ -110,7 +67,25 @@ const DotForPropButton = {
110
67
  }
111
68
  }
112
69
 
113
- export const SpacingPropButton = {
70
+ export const DotForRowButton = {
71
+ extend: DotForPropButton,
72
+ props: ({ state }) => {
73
+ const direction = state
74
+ const property = direction.parent
75
+ const row = property.parent
76
+ const table = row.parent
77
+
78
+ const propKey = diffPropValue(property.value, direction.value)
79
+ const active = table.props[propKey] === row.key
80
+
81
+ return {
82
+ hide: !active,
83
+ background: 'blue .65'
84
+ }
85
+ }
86
+ }
87
+
88
+ export const SpacingButton = {
114
89
  extend: [ChoosableButton, DropdownParent, WiderButton],
115
90
 
116
91
  props: (element) => {
@@ -119,7 +94,6 @@ export const SpacingPropButton = {
119
94
  const active = table.props[propValue] === (row && row.key)
120
95
  return {
121
96
  active,
122
- lazyLoad: true,
123
97
  icon: { name: property.value },
124
98
 
125
99
  '.active': {
@@ -175,6 +149,72 @@ export const SpacingPropButton = {
175
149
  dropdown
176
150
  }
177
151
 
152
+ const DotsInButton = SpacingButton.dots
153
+
154
+ export const SpacingRowButton = {
155
+ props: ({ state }) => {
156
+ const property = state
157
+ const row = property.parent
158
+ const table = row.parent
159
+
160
+ const propKey = property.value
161
+
162
+ const active = Object.keys(table.props).filter(prop => {
163
+ const hasProp = prop.toLowerCase().includes(propKey.toLowerCase())
164
+ const keyMathes = table.props[prop] === row.key
165
+ return hasProp && keyMathes
166
+ }).length
167
+
168
+ return {
169
+ active: !!active,
170
+ position: 'relative',
171
+ round: 'Z',
172
+ display: 'flex',
173
+
174
+ icon: {
175
+ name: propKey,
176
+ opacity: '0',
177
+ color: 'gray5',
178
+ margin: 'auto'
179
+ },
180
+
181
+ '.active': {
182
+ boxShadow: '0, 0, 0, 3px, gray1, inset'
183
+ }
184
+ }
185
+ },
186
+
187
+ icon: {
188
+ extend: Icon,
189
+ props: ({ state }) => {
190
+ const property = state
191
+ const row = property.parent
192
+ const table = row.parent
193
+
194
+ const propKey = property.value
195
+ const middleActive = table.props[propKey] === row.key
196
+
197
+ const active = Object.keys(table.props).filter(prop => {
198
+ const hasProp = prop.toLowerCase().includes(propKey.toLowerCase())
199
+ const keyMathes = table.props[prop] === row.key
200
+ return hasProp && keyMathes
201
+ }).length
202
+
203
+ return {
204
+ active,
205
+ middleActive,
206
+ '.active': { opacity: '1' },
207
+ '.middleActive': { color: 'blue' }
208
+ }
209
+ }
210
+ },
211
+
212
+ dots: {
213
+ childExtend: DotForRowButton,
214
+ $setStateCollection: DotsInButton.$setStateCollection
215
+ }
216
+ }
217
+
178
218
  export const getStateTree = element => {
179
219
  const table = element.lookup('Page').state
180
220
  const row = table.sequence[table.selectedKey]
@@ -0,0 +1,45 @@
1
+ 'use strict'
2
+
3
+ export const SPACING_BUTTONS = {
4
+ margin: {
5
+ maxValue: 3000,
6
+ blockStart: {},
7
+ inlineEnd: {},
8
+ blockEnd: {},
9
+ inlineStart: {}
10
+ },
11
+ height: {
12
+ minWidth: {},
13
+ maxWidth: {}
14
+ },
15
+ width: {
16
+ minWidth: {},
17
+ maxWidth: {}
18
+ },
19
+ borderWidth: {
20
+ maxValue: 1280,
21
+ blockStartWidth: {},
22
+ inlineEndWidth: {},
23
+ blockEndWidth: {},
24
+ inlineStartWidth: {}
25
+ },
26
+ padding: {
27
+ maxValue: 3000,
28
+ blockStart: {},
29
+ inlineEnd: {},
30
+ blockEnd: {},
31
+ inlineStart: {}
32
+ },
33
+ gap: {
34
+ maxValue: 3000,
35
+ Horizontal: {},
36
+ Vertical: {}
37
+ },
38
+ borderRadius: {
39
+ maxValue: 1280,
40
+ endStart: {},
41
+ startEnd: {},
42
+ endEnd: {},
43
+ startStart: {}
44
+ }
45
+ }
@@ -7,7 +7,8 @@ import {
7
7
  sortSequence
8
8
  } from '@symbo.ls/components'
9
9
 
10
- import buttons from '../pages/Spaces/buttons'
10
+ import { SpacingRowButton } from '.'
11
+ import actionButtons, { setRowButtons } from './SpacingButton/actionButtons'
11
12
 
12
13
  const Cell = {
13
14
  tag: 'div',
@@ -85,10 +86,13 @@ const Row = {
85
86
  }
86
87
  },
87
88
  buttons: {
88
- display: 'flex',
89
+ columns: 'repeat(7, var(--spacing-B2))',
90
+ rows: 'var(--spacing-B2)',
91
+ position: 'relative',
89
92
  gap: '.2em',
90
93
  opacity: '1',
91
- boxSizing: 'content-box'
94
+ boxSizing: 'content-box',
95
+ margin: '0 0 0 -1.9em'
92
96
  }
93
97
  }),
94
98
 
@@ -98,7 +102,11 @@ const Row = {
98
102
  em: {},
99
103
  decimal: {},
100
104
  px: {},
101
- buttons: {},
105
+ buttons: {
106
+ extend: Grid,
107
+ childExtend: SpacingRowButton,
108
+ $setStateCollection: setRowButtons
109
+ },
102
110
  graph: { line: {} },
103
111
 
104
112
  overlay: {
@@ -198,5 +206,5 @@ export const SpacingTable = {
198
206
  $setStateCollection: ({ state }) => mapSequence(state, sortSequence)
199
207
  },
200
208
 
201
- actionButtons: buttons
209
+ actionButtons
202
210
  }
@@ -20,6 +20,6 @@ export * from './IconsGroup'
20
20
  export * from './FontText'
21
21
  export * from './DesignComponent'
22
22
  export * from './ColumnParagrphs'
23
- export * from './SpacingPropButton'
23
+ export * from './SpacingButton'
24
24
  export * from './UploadImage'
25
25
  export * from './SpacingTable'
@@ -55,7 +55,6 @@ const BreakpointItem = {
55
55
  select: {
56
56
  extend: Select,
57
57
  props: ({ state }) => ({
58
- background: 'transparent',
59
58
  color: 'white'
60
59
  }),
61
60
 
@@ -1,35 +0,0 @@
1
- 'use strict'
2
-
3
- import { Flex } from '@symbo.ls/components'
4
- import { SpacingPropButton, SPACING_BUTTONS } from '../../components'
5
-
6
- export default {
7
- extend: Flex,
8
-
9
- props: {
10
- position: 'absolute',
11
- left: 'G3',
12
- gap: 'X',
13
- top: 'Y',
14
- lazyLoad: true,
15
- height: 'B2',
16
- zIndex: 99,
17
- boxSizing: 'content-box',
18
- padding: '- - C2',
19
- transition: 'C ease-out',
20
- transitionProperty: 'transform, opacity',
21
- opacity: '0',
22
-
23
- ':hover': { opacity: '1' }
24
- },
25
-
26
- childExtend: SpacingPropButton,
27
-
28
- $setStateCollection: ({ props, state }) =>
29
- Object.keys(SPACING_BUTTONS).filter(v => {
30
- const rowState = state.sequence[state.selectedKey]
31
- const { maxValue } = SPACING_BUTTONS[v]
32
- return maxValue ? maxValue > rowState && rowState.val : true
33
- }
34
- )
35
- }