@symbo.ls/preview 0.0.44 → 0.0.46

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.44",
5
+ "version": "0.0.46",
6
6
  "repository": "https://github.com/rackai/editor",
7
7
  "main": "src/index.js",
8
8
  "scripts": {
@@ -7,7 +7,7 @@ export const Header = {
7
7
  position: 'sticky',
8
8
  width: '100%',
9
9
  top: 0,
10
- zIndex: 1
10
+ zIndex: 99999
11
11
  },
12
12
 
13
13
  define: { isFloating: param => param },
@@ -0,0 +1,77 @@
1
+ 'use strict'
2
+
3
+ import { Flex, Link, ArticleMedium } from '@symbo.ls/components'
4
+
5
+ const Banner = {
6
+ extend: [Link, Flex, ArticleMedium],
7
+ props: ({ state }) => ({
8
+ flow: 'column',
9
+ round: 'A',
10
+ flex: '1',
11
+ height: 'F',
12
+ padding: 'A2 B',
13
+ backgroundImage: `url(${state.background})`,
14
+ backgroundSize: 'cover',
15
+ href: state.href,
16
+ gap: '0',
17
+
18
+ title: { margin: 'auto 0 0', text: state.title },
19
+ p: { text: state.p }
20
+ })
21
+ }
22
+
23
+ const banners = {
24
+ extend: Flex,
25
+ props: {
26
+ align: 'stretch space-between',
27
+ margin: 'C1 -Z2',
28
+ gap: 'B1'
29
+ },
30
+
31
+ childExtend: Banner,
32
+
33
+ $setStateCollection: ({ state }) => [{
34
+ title: 'Setting up a dark theme',
35
+ p: '5 mins tutorial',
36
+ background: 'https://p194.p3.n0.cdn.getcloudapp.com/items/eDu7le4P/ef9249a0-c522-49a7-8a0e-d7152b2e73a1.png?v=c4c8cd49408f26a6046b11f35d7b0656',
37
+ href: ''
38
+ }, {
39
+ title: 'Learn typography scaling',
40
+ p: '5 mins tutorial',
41
+ background: '',
42
+ href: ''
43
+ }]
44
+ }
45
+
46
+ const summary = {
47
+ extend: Flex,
48
+ props: {
49
+ align: 'stretch space-between',
50
+ margin: 'C1 -Z2',
51
+ gap: 'B1'
52
+ },
53
+
54
+ childExtend: Banner,
55
+
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
+ }]
67
+ }
68
+
69
+ export const Main = {
70
+ ArticleBig: {
71
+ title: { text: 'Design System' },
72
+ p: { text: 'Create your Design System guidelines' }
73
+ },
74
+
75
+ banners,
76
+ summary
77
+ }
@@ -0,0 +1,121 @@
1
+
2
+ import { DesignElement } from '@symbo.ls/components'
3
+
4
+ export default {
5
+ props: {
6
+ flexFlow: 'row wrap',
7
+ flexAlign: 'flex-start flex-start',
8
+ gap: 'C B2',
9
+ padding: 'B1 0 B2',
10
+ margin: '0 -Z2'
11
+ },
12
+
13
+ childExtend: {
14
+ extend: DesignElement,
15
+ props: {
16
+ flex: '1',
17
+ widthRange: 'F F'
18
+ }
19
+ },
20
+
21
+ ...[{
22
+ href: '/color',
23
+ button: {
24
+ theme: 'color',
25
+ icon: { name: 'color' }
26
+ },
27
+ heading: {
28
+ maxWidth: 'E1-default',
29
+ title: { text: 'Colors' },
30
+ p: { text: 'Colorize styles manually' }
31
+ }
32
+ }, {
33
+ href: '/theme',
34
+ button: {
35
+ theme: 'theme',
36
+ icon: { name: 'theme' }
37
+ },
38
+ heading: {
39
+ maxWidth: 'E1-default',
40
+ title: { text: 'Theming' },
41
+ p: { text: 'Color groups and states' }
42
+ }
43
+ }, {
44
+ href: '/typography',
45
+ button: {
46
+ theme: 'typography',
47
+ icon: { name: 'typography' }
48
+ },
49
+ heading: {
50
+ maxWidth: 'E-default',
51
+ title: { text: 'Typography' },
52
+ p: { text: 'Style a typed material' }
53
+ }
54
+ }, {
55
+ href: '/space',
56
+ button: {
57
+ theme: 'space',
58
+ icon: { name: 'space' }
59
+ },
60
+ heading: {
61
+ maxWidth: 'E1-default',
62
+ title: { text: 'Spacing' },
63
+ p: { text: 'Manage properties of a size' }
64
+ }
65
+ }, {
66
+ href: '/shape',
67
+ button: {
68
+ theme: 'shape',
69
+ icon: { name: 'shape' }
70
+ },
71
+ heading: {
72
+ maxWidth: 'E2-default',
73
+ title: { text: 'Shapes' },
74
+ p: { text: 'Design an outline to a component' }
75
+ }
76
+ }, {
77
+ href: '/icons',
78
+ button: {
79
+ theme: 'icons',
80
+ icon: { name: 'icons' }
81
+ },
82
+ heading: {
83
+ maxWidth: 'F-default',
84
+ title: { text: 'Icons' },
85
+ p: { text: 'Label a role of subject with glyphs' }
86
+ }
87
+ }, {
88
+ href: '/sequence',
89
+ button: {
90
+ theme: 'default',
91
+ icon: { name: 'state' }
92
+ },
93
+ heading: {
94
+ maxWidth: 'F-default',
95
+ title: { text: 'Sequence' },
96
+ p: { text: 'Generating set for measurable units' }
97
+ }
98
+ }, {
99
+ href: '/timing',
100
+ button: {
101
+ theme: 'default',
102
+ icon: { name: 'clock outline' }
103
+ },
104
+ heading: {
105
+ maxWidth: 'F-default',
106
+ title: { text: 'Timing' },
107
+ p: { text: 'Tokens for transitions and animations' }
108
+ }
109
+ }, {
110
+ href: '/media-query',
111
+ button: {
112
+ // theme: 'screen',
113
+ icon: { name: 'deviceSmallScreenOutline' }
114
+ },
115
+ heading: {
116
+ maxWidth: 'F-default',
117
+ title: { text: 'Media Query' },
118
+ p: { text: 'Frequently used media queries as variables' }
119
+ }
120
+ }].map(v => ({ props: v }))
121
+ }
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { router } from '@domql/router'
4
4
  import { ClickableItem, Flex, Link, ResponsivePreview, SquareButton, TooltipParent } from '@symbo.ls/components'
5
+ import { Main } from './Main'
5
6
  import { PageExtend,
6
7
  Color,
7
8
  Theme,
@@ -96,7 +97,7 @@ export const DesignSystem = {
96
97
 
97
98
  define: { routes: param => param },
98
99
  routes: {
99
- '/design-system': Color,
100
+ '/design-system': Main,
100
101
  '/colors': Color,
101
102
  '/theme': Theme,
102
103
  '/typography': Typography,
@@ -11,6 +11,7 @@ import * as INTERACTIVE from '@symbo.ls/icons/src/interactive'
11
11
  import * as LOGOS from '@symbo.ls/icons/src/logos'
12
12
  import * as SIGNS from '@symbo.ls/icons/src/signs'
13
13
  import * as STYLE from '@symbo.ls/icons/src/style'
14
+ import * as KEYBOARD from '@symbo.ls/icons/src/keyboard'
14
15
  import * as SVG from '@symbo.ls/icons/src/svg'
15
16
  import * as TECH from '@symbo.ls/icons/src/tech'
16
17
  import * as TEXT from '@symbo.ls/icons/src/text'
@@ -93,6 +94,9 @@ const ICON_GROUPS = [{
93
94
  }, {
94
95
  title: 'Style',
95
96
  list: Object.keys(STYLE).map(name => ({ name }))
97
+ }, {
98
+ title: 'Keys',
99
+ list: Object.keys(KEYBOARD).map(name => ({ name }))
96
100
  }, {
97
101
  title: 'Tech',
98
102
  list: Object.keys(TECH).map(name => ({ name }))
@@ -1,20 +1,15 @@
1
1
  'use strict'
2
2
 
3
- import { Grid, Scene } from '@symbo.ls/components'
3
+ import { Grid, Scene, Flex } from '@symbo.ls/components'
4
4
 
5
- const returnScale = (state, key) => {
5
+ const returnScale = (state, key, fallback) => {
6
6
  const { scales } = state
7
- return (scales[state[key]] || 0) + 'em'
7
+ return (scales[state.props[key] || state.props[fallback]] || 0) + 'em'
8
8
  }
9
9
 
10
10
  export const Preview = {
11
11
  extend: Scene,
12
12
 
13
- props: {
14
- margin: '0 -Z1',
15
- maxHeight: '25vh'
16
- },
17
-
18
13
  scene: {
19
14
  boxModel: {
20
15
  extend: Grid,
@@ -31,28 +26,84 @@ export const Preview = {
31
26
  },
32
27
 
33
28
  ...[
34
- ...['', { text: (el, s) => s.paddingTop || '', style: { gridArea: 't' } }, ''],
29
+ ...['', { text: (el, s) => s.props.paddingTop || '', style: { gridArea: 't' } }, ''],
35
30
  ...[
36
- { text: (el, s) => s.paddingLeft || '', style: { gridArea: 'l' } },
31
+ { text: (el, s) => s.props.paddingLeft || '', style: { gridArea: 'l' } },
37
32
  {
38
33
  props: ({ state }) => ({
39
- fontSize: `${state.base}px`,
40
- borderRadius: state['borderRadius'],
41
- lineHeight: 1,
42
34
  gridArea: 'content',
43
35
  borderStyle: 'solid',
44
- theme: 'quaternary',
45
- padding: 'X2',
46
- borderColor: 'grassgreen 0.25',
36
+ borderColor: 'margin 0.15',
37
+
47
38
  borderWidth: [
48
- returnScale(state, 'paddingTop'),
49
- returnScale(state, 'paddingRight'),
50
- returnScale(state, 'paddingBottom'),
51
- returnScale(state, 'paddingLeft')
52
- ],
53
- style: { whiteSpace: 'nowrap' }
39
+ returnScale(state, 'marginBlockStart', 'margin'),
40
+ returnScale(state, 'marginInlineEnd', 'margin'),
41
+ returnScale(state, 'marginBlockEnd', 'margin'),
42
+ returnScale(state, 'marginInlineStart', 'margin')
43
+ ]
54
44
  }),
55
- text: (el, s) => `Base ${s.base}`
45
+ border: {
46
+ props: ({ state }) => ({
47
+ gridArea: 'content',
48
+ borderStyle: 'solid',
49
+ borderColor: 'border 0.65',
50
+ overflow: 'hidden',
51
+
52
+ round: [
53
+ returnScale(state, 'borderRadiusEndStart', 'borderRadius'),
54
+ returnScale(state, 'borderRadiusStartEnd', 'borderRadius'),
55
+ returnScale(state, 'borderRadiusEndEnd', 'borderRadius'),
56
+ returnScale(state, 'borderRadiusStartStart', 'borderRadius')
57
+ ].join(' '),
58
+
59
+ borderWidth: [
60
+ returnScale(state, 'borderBlockStartWidth', 'borderWidth'),
61
+ returnScale(state, 'borderInlineEndWidth', 'borderWidth'),
62
+ returnScale(state, 'borderBlockEndWidth', 'borderWidth'),
63
+ returnScale(state, 'borderInlineStartWidth', 'borderWidth')
64
+ ]
65
+ }),
66
+ padding: {
67
+ extend: Flex,
68
+ props: ({ state }) => ({
69
+ fontSize: `${state.base}px`,
70
+ lineHeight: 1,
71
+ borderStyle: 'solid',
72
+ theme: 'quaternary',
73
+ padding: 'X2',
74
+ borderColor: 'grassgreen 0.25',
75
+ overflow: 'hidden',
76
+ textOverflow: 'ellipsis',
77
+
78
+ width: state.props['width'],
79
+ height: state.props['height'],
80
+
81
+ minWidth: state.props['minWidth'],
82
+ maxWidth: state.props['maxWidth'],
83
+
84
+ minHeight: state.props['minHeight'],
85
+ maxHeight: state.props['maxHeight'],
86
+
87
+ borderWidth: [
88
+ returnScale(state, 'paddingBlockStart', 'padding'),
89
+ returnScale(state, 'paddingInlineEnd', 'padding'),
90
+ returnScale(state, 'paddingBlockEnd', 'padding'),
91
+ returnScale(state, 'paddingInlineStart', 'padding')
92
+ ],
93
+ style: { whiteSpace: 'nowrap' }
94
+ }),
95
+ span: (el, s) => `Base `,
96
+ gap: {
97
+ props: ({ state }) => ({
98
+ background: 'gap .15',
99
+ margin: '0 .1em',
100
+ height: '1em',
101
+ minWidth: state.props['gap']
102
+ })
103
+ },
104
+ base: (el, s) => s.base
105
+ }
106
+ }
56
107
  }, {
57
108
  text: (el, s) => s.paddingRight || '', style: { gridArea: 'r' }
58
109
  }],
@@ -22,7 +22,7 @@ export const SpacingScale = {
22
22
  position: 'sticky',
23
23
  top: 'D',
24
24
  background: 'black .5',
25
- zIndex: '2',
25
+ zIndex: '9999',
26
26
  margin: '-B2 -B -B',
27
27
  padding: 'B2 B B',
28
28
  style: {
@@ -42,14 +42,43 @@ export const SpacingScale = {
42
42
  },
43
43
 
44
44
  table: { extend: Table },
45
+
45
46
  preview: {
46
- extend: Preview,
47
+ extend: Flex,
47
48
  props: {
48
49
  position: 'sticky',
50
+ margin: '0 -Z1',
51
+ maxHeight: '25vh',
49
52
  bottom: 'Z',
53
+ zIndex: '9999',
54
+ gap: 'A',
55
+
56
+ scene: { flex: 1 },
57
+
50
58
  style: {
51
59
  backdropFilter: 'blur(15px)'
52
60
  }
61
+ },
62
+ scene: {
63
+ extend: Preview
64
+ },
65
+ code: {
66
+ extend: 'Code',
67
+ props: ({ state }) => ({
68
+ hide: Object.keys(state.props).length === 0,
69
+ flex: '0 0 360px',
70
+ margin: '0',
71
+ code: {
72
+ margin: '0'
73
+ },
74
+ buttons: { marginInline: 'X2' }
75
+ }),
76
+ title: null,
77
+ code: {
78
+ props: {
79
+ text: ({ state }) => 'const props = ' + JSON.stringify(state.props, null, 2)
80
+ }
81
+ }
53
82
  }
54
83
  }
55
84
  }
@@ -1,62 +1,13 @@
1
1
  'use strict'
2
2
 
3
3
  import {
4
- ClickableItem,
5
4
  Grid,
6
5
  Pseudo,
7
- WiderButton,
8
6
  mapSequence,
9
7
  sortSequence
10
8
  } from '@symbo.ls/components'
11
9
 
12
- const Buttons = {
13
- childExtend: {
14
- extend: [ClickableItem, WiderButton],
15
- props: ({ key, state, parent }) => ({
16
- isActive: parent.parent.parent.state[key] === state.key,
17
- padding: 'Z',
18
- icon: key,
19
- theme: null,
20
- '@dark': {
21
- background: 'gray1',
22
- color: 'gray5'
23
- },
24
- '@light': {
25
- background: 'white .5',
26
- color: 'gray7'
27
- },
28
- ':hover': {
29
- theme: 'quaternary'
30
- },
31
- '.isActive': {
32
- color: 'blue',
33
- ':hover': {
34
- color: 'blue'
35
- }
36
- }
37
- }),
38
-
39
- attr: { title: el => el.key },
40
-
41
- on: {
42
- click: (ev, { key, state, parent }) => {
43
- const parentState = parent.parent.parent.state
44
- const active = parentState[key] === state.key
45
- if (active) {
46
- delete parentState[key] && parentState.update()
47
- } else {
48
- parentState.update({ [key]: state.key })
49
- }
50
- }
51
- }
52
- },
53
-
54
- paddingTop: {},
55
- paddingRight: {},
56
- paddingBottom: {},
57
- paddingLeft: {},
58
- borderRadius: {}
59
- }
10
+ import buttons from './buttons'
60
11
 
61
12
  const Cell = {
62
13
  tag: 'div',
@@ -70,17 +21,15 @@ const Row = {
70
21
  key: state => state.key,
71
22
 
72
23
  props: ({ state }) => ({
73
- columns: '10ch 14ch 13ch 10ch 18em 1fr',
24
+ columns: '7ch 20em 14ch 12ch 12ch 1fr',
74
25
  alignItems: 'center',
75
26
  isBase: state.index === 0,
76
- isNotActive: (state.key && state.key.length) !== 1,
27
+ active: (state.key && state.key.length) === 1,
77
28
 
78
29
  margin: '0 -A',
79
30
  padding: '0 B',
31
+ position: 'relative',
80
32
 
81
- '.isNotActive': {
82
- opacity: 0.8
83
- },
84
33
  '.isBase': {
85
34
  opacity: 1,
86
35
  background: 'gray1 .5'
@@ -92,15 +41,14 @@ const Row = {
92
41
 
93
42
  i: {
94
43
  text: state.key,
95
- isActive: (state.key && state.key.length) === 1,
96
- isNotActive: (state.key && state.key.length) !== 1,
44
+ active: (state.key && state.key.length) === 1,
97
45
 
98
- '.isActive': {
46
+ '.active': {
99
47
  fontWeight: '600',
100
48
  '@dark': { color: 'gray9' },
101
49
  '@light': { color: 'gray3' }
102
50
  },
103
- '.isNotActive': {
51
+ '!active': {
104
52
  fontWeight: '400',
105
53
  '@dark': { color: 'gray6' },
106
54
  '@light': { color: 'gray7' }
@@ -144,10 +92,10 @@ const Row = {
144
92
  childExtend: Cell,
145
93
 
146
94
  i: {},
95
+ buttons,
147
96
  em: {},
148
97
  decimal: {},
149
98
  px: {},
150
- buttons: Buttons,
151
99
 
152
100
  graph: { line: {} }
153
101
  }
@@ -163,10 +111,10 @@ const HeaderRow = {
163
111
  },
164
112
 
165
113
  i: '#',
114
+ buttons: ' ',
166
115
  em: 'em',
167
116
  decimal: 'decimal',
168
117
  px: 'px',
169
- buttons: null,
170
118
  graph: null
171
119
  }
172
120
 
@@ -210,6 +158,7 @@ export const Table = {
210
158
 
211
159
  cnt: {
212
160
  childExtend: Row,
161
+ props: { lazyLoad: true },
213
162
  $setStateCollection: (el) => mapSequence(el.state, sortSequence)
214
163
  }
215
164
  }
@@ -0,0 +1,246 @@
1
+ 'use strict'
2
+
3
+ import {
4
+ ClickableItem,
5
+ WiderButton,
6
+ DropdownParent,
7
+ Dropdown,
8
+ GridInDropdown
9
+ } from '@symbo.ls/components'
10
+
11
+ const ChoosableButton = {
12
+ extend: [ClickableItem],
13
+
14
+ props: ({ key, state, parent }) => ({
15
+ padding: 'Z',
16
+ icon: key,
17
+ theme: null,
18
+ '@dark': {
19
+ background: 'gray1',
20
+ color: 'gray5'
21
+ },
22
+ '@light': {
23
+ background: 'white .5',
24
+ color: 'gray7'
25
+ },
26
+ ':hover': {
27
+ theme: 'quaternary'
28
+ },
29
+ '.active': {
30
+ theme: null
31
+ }
32
+ })
33
+
34
+ }
35
+
36
+ const jointPropDirection = (parentKey, key) => {
37
+ return parentKey + key.slice(0, 1).toUpperCase() + key.slice(1)
38
+ }
39
+
40
+ const diffPropPosition = (parentKey, key) => {
41
+ if (parentKey.includes('borderWidth')) return key.split('Width')[0]
42
+ return key
43
+ }
44
+
45
+ const diffPropValue = (parentKey, key) => {
46
+ if (parentKey.includes('borderWidth')) parentKey = 'border'
47
+ return jointPropDirection(parentKey, key)
48
+ }
49
+
50
+ const diffIconTypes = (parentKey, key) => {
51
+ if (parentKey.includes('borderWidth')) key = key.split('Width')[0]
52
+ if (parentKey.includes('margin') || parentKey === 'borderWidth') parentKey = 'padding'
53
+ return jointPropDirection(parentKey, key)
54
+ }
55
+
56
+ const BUTTONS = {
57
+ margin: {
58
+ blockStart: {},
59
+ inlineEnd: {},
60
+ blockEnd: {},
61
+ inlineStart: {}
62
+ },
63
+ height: {
64
+ minWidth: {},
65
+ maxWidth: {}
66
+ },
67
+ width: {
68
+ minWidth: {},
69
+ maxWidth: {}
70
+ },
71
+ borderWidth: {
72
+ blockStartWidth: {},
73
+ inlineEndWidth: {},
74
+ blockEndWidth: {},
75
+ inlineStartWidth: {}
76
+ },
77
+ padding: {
78
+ blockStart: {},
79
+ inlineEnd: {},
80
+ blockEnd: {},
81
+ inlineStart: {}
82
+ },
83
+ gap: {
84
+ Horizontal: {},
85
+ Vertical: {}
86
+ },
87
+ borderRadius: {
88
+ endStart: {},
89
+ startEnd: {},
90
+ endEnd: {},
91
+ startStart: {}
92
+ }
93
+ }
94
+
95
+ export default {
96
+ childExtend: {
97
+ extend: [ChoosableButton, DropdownParent, WiderButton],
98
+
99
+ props: ({ key, state, parent }) => ({
100
+ active: state.parent.parent.props[state.value] === state.parent.key,
101
+ icon: { name: state.value },
102
+ '.active': {
103
+ color: 'blue',
104
+ ':hover': {
105
+ color: 'blue'
106
+ }
107
+ }
108
+ }),
109
+
110
+ dropdown: {
111
+ extend: Dropdown,
112
+
113
+ props: {
114
+ minWidth: 'none',
115
+ grid: { gap: '0' }
116
+ },
117
+
118
+ header: { text: ({ state }) => state.value },
119
+
120
+ grid: {
121
+ extend: GridInDropdown,
122
+ props: ({ state }) => {
123
+ const keys = Object.keys(BUTTONS[state.value])
124
+ if (keys.length < 4) {
125
+ return {
126
+ columns: 'repeat(4, 1fr)'
127
+ }
128
+ }
129
+ return {
130
+ lazyLoad: true,
131
+ columns: 'auto 32px auto',
132
+ rows: 'auto 32px auto',
133
+ templateAreas: `"endStart blockStart startEnd"
134
+ "inlineStart content inlineEnd"
135
+ "startStart blockEnd endEnd"`
136
+ }
137
+ },
138
+ childExtend: {
139
+ extend: [ChoosableButton],
140
+ props: ({ key, parent, state }) => {
141
+ const propState = state.parent
142
+ const rowState = propState.parent
143
+ const keys = Object.keys(BUTTONS[propState.value])
144
+ const tableState = rowState.parent
145
+ const propKey = diffPropValue(propState.value, state.value)
146
+ const iconKey = diffIconTypes(propState.value, state.value)
147
+ const active = tableState.props[propKey] === rowState.key
148
+ return {
149
+ active,
150
+ icon: {
151
+ name: iconKey
152
+ },
153
+ gridArea: keys.length > 3 && diffPropPosition(propState.value, state.value),
154
+ theme: null,
155
+ background: 'transparent 0',
156
+ '.active': {
157
+ theme: null,
158
+ color: 'blue',
159
+ ':hover': {
160
+ color: 'blue'
161
+ }
162
+ }
163
+ }
164
+ },
165
+ attr: { title: ({ state }) => state.value },
166
+ on: {
167
+ click: (ev, { key, state, parent }) => {
168
+ const propState = state.parent
169
+ const rowState = propState.parent
170
+ const tableState = rowState.parent
171
+ const propKey = diffPropValue(propState.value, state.value)
172
+ const active = tableState.props[propKey] === rowState.key
173
+ if (active) {
174
+ delete tableState.props[propKey] && tableState.update()
175
+ } else {
176
+ tableState.update({ props: { [propKey]: rowState.key } })
177
+ }
178
+ }
179
+ }
180
+ },
181
+
182
+ $setStateCollection: ({ state }) => Object.keys(BUTTONS[state.value])
183
+ }
184
+ },
185
+
186
+ click: {
187
+ props: {
188
+ lazyLoad: true,
189
+ position: 'absolute',
190
+ inset: '0 0 0 0'
191
+ },
192
+
193
+ on: {
194
+ click: (ev, { state, parent }) => {
195
+ const rowState = state.parent
196
+ const tableState = rowState.parent
197
+ const propKey = state.value
198
+ 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
+ })
213
+ }
214
+ },
215
+
216
+ attr: { title: ({ state }) => state.value },
217
+
218
+ childExtend: {
219
+ props: ({ key, parent, state }) => {
220
+ const propState = state.parent
221
+ const rowState = propState.parent
222
+ const tableState = rowState.parent
223
+ const propKey = diffPropValue(propState.value, state.value)
224
+ const active = tableState.props[propKey] === rowState.key
225
+ return {
226
+ position: 'absolute',
227
+ round: '100%',
228
+ background: 'blue',
229
+ boxSize: 'W2',
230
+
231
+ hide: !active,
232
+
233
+ ':nth-child(1)': { left: '50%', top: 'W' },
234
+ ':nth-child(2)': { right: 'W', top: '50%' },
235
+ ':nth-child(3)': { left: '50%', bottom: 'W' },
236
+ ':nth-child(4)': { left: 'W', top: '50%' }
237
+ }
238
+ }
239
+ },
240
+
241
+ $setStateCollection: ({ state }) => Object.keys(BUTTONS[state.value])
242
+ }
243
+ },
244
+
245
+ $setStateCollection: ({ state }) => Object.keys(BUTTONS)
246
+ }
@@ -3,14 +3,6 @@
3
3
  import { SPACING } from '@symbo.ls/scratch'
4
4
 
5
5
  export const state = {
6
- tabs: [{
7
- key: 0,
8
- name: 'Default'
9
- }, {
10
- key: 1,
11
- name: 'Font Size'
12
- }],
13
-
14
6
  base: SPACING.base,
15
7
  ratio: SPACING.ratio,
16
8
  subSequence: true,
@@ -18,5 +10,7 @@ export const state = {
18
10
  scales: {},
19
11
  sequence: {},
20
12
  vars: {},
21
- type: 'spacing-scale'
13
+ type: 'spacing-scale',
14
+
15
+ props: {}
22
16
  }