@symbo.ls/preview 0.0.17 → 0.0.18

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.
@@ -18,7 +18,7 @@ const component = {
18
18
  text: 'Download',
19
19
  // padding: 'Z2 B2',
20
20
  border: '.2em, solid, blue .2',
21
- padding: 'A B2',
21
+ padding: 'A1 B2',
22
22
  round: 'C'
23
23
  }
24
24
  }
@@ -14,12 +14,6 @@ const component = {
14
14
  props: {
15
15
  theme: 'quaternary', round: 'A'
16
16
  },
17
- // props: (el, s) => {
18
- // return {
19
- // round: 'Z',
20
- // depth: '16',
21
- // }
22
- // },
23
17
 
24
18
  ...[
25
19
  { span: { props: { text: 'Today' } } },
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@symbo.ls/preview",
3
3
  "description": "",
4
4
  "author": "",
5
- "version": "0.0.17",
5
+ "version": "0.0.18",
6
6
  "repository": "https://github.com/rackai/editor",
7
7
  "main": "src/index.js",
8
8
  "scripts": {
@@ -12,9 +12,10 @@ const ShapeItem = {
12
12
  background: 'white .05',
13
13
  alignItems: 'center',
14
14
  justifyContent: 'center',
15
+ theme: 'tertiary',
15
16
 
16
17
  _shape: {
17
- theme: 'quaternary',
18
+ theme: 'quinary',
18
19
  width: 'C',
19
20
  height: 'C'
20
21
  }
package/src/index.js CHANGED
@@ -5,6 +5,7 @@ import DOM from 'domql'
5
5
  import SYMBOLS_CONF from '@symbo.ls/config'
6
6
  import style from './style'
7
7
 
8
+ import 'smbls'
8
9
  import * as smbls from '@symbo.ls/components'
9
10
 
10
11
  import App from './app'
@@ -9,14 +9,14 @@ export const rectangle = {
9
9
  span: 'with rounds'
10
10
  },
11
11
  nav: [
12
- {},
13
- { _shape: { props: { round: 4 } } },
14
- { _shape: { props: { round: 6 } } },
15
- { _shape: { props: { round: 10 } } },
16
- { _shape: { props: { round: 12 } } },
17
- { _shape: { props: { round: 16 } } },
18
- { _shape: { props: { round: 26 } } }
19
- ]
12
+ { _shape: { round: '0' } },
13
+ { _shape: { round: 'X' } },
14
+ { _shape: { round: 'Y' } },
15
+ { _shape: { round: 'Z' } },
16
+ { _shape: { round: 'A' } },
17
+ { _shape: { round: 'B' } },
18
+ { _shape: { round: 'C' } }
19
+ ].map(props => ({ props }))
20
20
  }
21
21
 
22
22
  export const circle = {
@@ -36,11 +36,11 @@ export const toolTip = {
36
36
  },
37
37
 
38
38
  ...[
39
- { _shape: { props: { shape: 'tooltip', shapeDirection: 'top left' } } },
40
- { _shape: { props: { shape: 'tooltip', shapeDirection: 'top center' } } },
41
- { _shape: { props: { shape: 'tooltip', shapeDirection: 'right' } } },
42
- { _shape: { props: { shape: 'tooltip', shapeDirection: 'bottom' } } }
43
- ]
39
+ { _shape: { shape: 'tooltip', shapeDirection: 'top' } },
40
+ { _shape: { shape: 'tooltip', shapeDirection: 'right' } },
41
+ { _shape: { shape: 'tooltip', shapeDirection: 'bottom' } },
42
+ { _shape: { shape: 'tooltip', shapeDirection: 'left' } }
43
+ ].map(props => ({ props }))
44
44
  }
45
45
  }
46
46
 
@@ -52,11 +52,11 @@ export const tagShape = {
52
52
  childExtend: { props: { round: 6 } }
53
53
  },
54
54
  ...[
55
- { _shape: { props: { shape: 'tag', shapeDirection: 'left' } } },
56
- { _shape: { props: { shape: 'tag', shapeDirection: 'top' } } },
57
- { _shape: { props: { shape: 'tag', shapeDirection: 'right' } } },
58
- { _shape: { props: { shape: 'tag', shapeDirection: 'bottom' } } }
59
- ]
55
+ { _shape: { shape: 'tag', shapeDirection: 'left' } },
56
+ { _shape: { shape: 'tag', shapeDirection: 'top' } },
57
+ { _shape: { shape: 'tag', shapeDirection: 'right' } },
58
+ { _shape: { shape: 'tag', shapeDirection: 'bottom' } }
59
+ ].map(props => ({ props }))
60
60
  }
61
61
  }
62
62
 
@@ -64,13 +64,13 @@ export const bubble = {
64
64
  extend: ShapeSet,
65
65
  label: { text: 'Bubble' },
66
66
  nav: [
67
- { _shape: { props: { round: 'X B B X' } } },
68
- { _shape: { props: { round: 'B X X B' } } },
69
- { _shape: { props: { round: 'X X B B' } } },
70
- { _shape: { props: { round: 'B B X X' } } },
71
- { _shape: { props: { round: 'B X X X' } } },
72
- { _shape: { props: { round: 'X B X X' } } },
73
- { _shape: { props: { round: 'X X B X' } } },
74
- { _shape: { props: { round: 'X X X B' } } }
75
- ]
67
+ { _shape: { round: 'X B B X' } },
68
+ { _shape: { round: 'B X X B' } },
69
+ { _shape: { round: 'X X B B' } },
70
+ { _shape: { round: 'B B X X' } },
71
+ { _shape: { round: 'B X X X' } },
72
+ { _shape: { round: 'X B X X' } },
73
+ { _shape: { round: 'X X B X' } },
74
+ { _shape: { round: 'X X X B' } }
75
+ ].map(props => ({ props }))
76
76
  }
@@ -0,0 +1,62 @@
1
+ 'use strict'
2
+
3
+ import { Grid, Scene } from '@symbo.ls/components'
4
+
5
+ const returnScale = (state, key) => {
6
+ const { scales } = state
7
+ return (scales[state[key]] || 0) + 'em'
8
+ }
9
+
10
+ export const Preview = {
11
+ extend: Scene,
12
+
13
+ props: {
14
+ margin: '0 -Z1'
15
+ },
16
+
17
+ scene: {
18
+ boxModel: {
19
+ extend: Grid,
20
+ props: {
21
+ color: 'gray5',
22
+ fontSize: 'Z',
23
+ columns: '30px auto 30px',
24
+ rows: '30px auto 30px',
25
+ templateAreas: `"x1 t x2"
26
+ "l content r"
27
+ "x3 b x4"`,
28
+ alignItems: 'center',
29
+ textAlign: 'center'
30
+ },
31
+
32
+ ...[
33
+ ...['', { text: (el, s) => s.paddingTop || '', style: { gridArea: 't' } }, ''],
34
+ ...[
35
+ { text: (el, s) => s.paddingLeft || '', style: { gridArea: 'l' } },
36
+ {
37
+ props: ({ state }) => ({
38
+ fontSize: `${state.base}px`,
39
+ borderRadius: state['borderRadius'],
40
+ lineHeight: 1,
41
+ gridArea: 'content',
42
+ borderStyle: 'solid',
43
+ theme: 'quaternary',
44
+ padding: 'X2',
45
+ borderColor: 'grassgreen 0.25',
46
+ borderWidth: [
47
+ returnScale(state, 'paddingTop'),
48
+ returnScale(state, 'paddingRight'),
49
+ returnScale(state, 'paddingBottom'),
50
+ returnScale(state, 'paddingLeft')
51
+ ],
52
+ style: { whiteSpace: 'nowrap' }
53
+ }),
54
+ text: (el, s) => `Base ${s.base}`
55
+ }, {
56
+ text: (el, s) => s.paddingRight || '', style: { gridArea: 'r' }
57
+ }],
58
+ ...['', { text: (el, s) => s.paddingBottom || '', style: { gridArea: 'b' } }, '']
59
+ ]
60
+ }
61
+ }
62
+ }
@@ -0,0 +1,53 @@
1
+ 'use strict'
2
+
3
+ import { SequenceSliders, Flex } from '@symbo.ls/components'
4
+ import { Preview } from './Preview'
5
+ import { Table } from './Table'
6
+
7
+ export const SpacingScale = {
8
+ extend: Flex,
9
+
10
+ props: {
11
+ flow: 'column',
12
+ gap: 'C1'
13
+ },
14
+
15
+ sliders: {
16
+ extend: SequenceSliders,
17
+ props: {
18
+ position: 'sticky',
19
+ top: 'D',
20
+ background: 'black .5',
21
+ zIndex: '2',
22
+ margin: '-C -B -B',
23
+ padding: 'C B B',
24
+ style: {
25
+ backdropFilter: 'blur(15px)'
26
+ }
27
+ }
28
+ },
29
+
30
+ scale: {
31
+ extend: Flex,
32
+ props: {
33
+ flow: 'column',
34
+ gap: 'B1',
35
+ margin: '0 0 C2',
36
+
37
+ table: { flex: 1 },
38
+ preview: { flex: 1 }
39
+ },
40
+
41
+ table: { extend: Table },
42
+ preview: {
43
+ extend: Preview,
44
+ props: {
45
+ position: 'sticky',
46
+ bottom: 'Z',
47
+ style: {
48
+ backdropFilter: 'blur(15px)'
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
@@ -0,0 +1,206 @@
1
+ 'use strict'
2
+
3
+ import { ClickableItem, Grid, Pseudo, WiderButton } from '@symbo.ls/components'
4
+
5
+ import { mapSequence, sortSequence } from '@symbo.ls/utils'
6
+
7
+ const Buttons = {
8
+ childExtend: {
9
+ extend: [ClickableItem, WiderButton],
10
+ props: ({ key, state, parent }) => ({
11
+ isActive: parent.parent.parent.state[key] === state.key,
12
+ padding: 'Z',
13
+ icon: key,
14
+ theme: null,
15
+ '@dark': {
16
+ background: 'gray1',
17
+ color: 'gray5'
18
+ },
19
+ '@light': {
20
+ background: 'white .5',
21
+ color: 'gray7'
22
+ },
23
+ ':hover': {
24
+ theme: 'quaternary'
25
+ },
26
+ '.isActive': {
27
+ color: 'blue',
28
+ ':hover': {
29
+ color: 'blue'
30
+ }
31
+ }
32
+ }),
33
+
34
+ attr: { title: el => el.key },
35
+
36
+ on: {
37
+ click: (ev, { key, state, parent }) => {
38
+ const parentState = parent.parent.parent.state
39
+ const active = parentState[key] === state.key
40
+ if (active) {
41
+ delete parentState[key] && parentState.update()
42
+ } else {
43
+ parentState.update({ [key]: state.key })
44
+ }
45
+ }
46
+ }
47
+ },
48
+
49
+ paddingTop: {},
50
+ paddingRight: {},
51
+ paddingBottom: {},
52
+ paddingLeft: {},
53
+ borderRadius: {}
54
+ }
55
+
56
+ const Cell = {
57
+ tag: 'div',
58
+ props: {
59
+ padding: 'X2 C2 X2 0'
60
+ }
61
+ }
62
+
63
+ const Row = {
64
+ extend: Grid,
65
+ key: state => state.key,
66
+
67
+ props: ({ state }) => ({
68
+ columns: '10ch 14ch 13ch 10ch 18em 1fr',
69
+ alignItems: 'center',
70
+ isBase: state.index === 0,
71
+ isNotActive: (state.key && state.key.length) !== 1,
72
+
73
+ margin: '0 -A',
74
+ padding: '0 B',
75
+
76
+ '.isNotActive': {
77
+ opacity: 0.8
78
+ },
79
+ '.isBase': {
80
+ opacity: 1,
81
+ background: 'gray1 .5'
82
+ },
83
+
84
+ ':hover': {
85
+ background: 'gray1 .65'
86
+ },
87
+
88
+ i: {
89
+ text: state.key,
90
+ isActive: (state.key && state.key.length) === 1,
91
+ isNotActive: (state.key && state.key.length) !== 1,
92
+
93
+ '.isActive': {
94
+ fontWeight: '600',
95
+ '@dark': { color: 'gray9' },
96
+ '@light': { color: 'gray3' }
97
+ },
98
+ '.isNotActive': {
99
+ fontWeight: '400',
100
+ '@dark': { color: 'gray6' },
101
+ '@light': { color: 'gray7' }
102
+ }
103
+ },
104
+ decimal: {
105
+ text: state.decimal,
106
+ color: 'gray6',
107
+ fontWeight: '300'
108
+ },
109
+ px: {
110
+ text: state.val,
111
+ '@dark': { color: 'gray9' },
112
+ '@light': { color: 'gray3' }
113
+ },
114
+ em: {
115
+ color: 'gray6',
116
+ text: state.scaling + 'em'
117
+ },
118
+ buttons: {
119
+ display: 'flex',
120
+ gap: '.2em',
121
+ opacity: '1',
122
+ ':empty': { padding: '0' }
123
+ },
124
+ graph: {
125
+ margin: '0 0 0 -B2',
126
+ line: {
127
+ widthRange: `${state.val}px` || 0,
128
+ height: '2px',
129
+ background: 'blue',
130
+ borderRadius: '2px'
131
+ }
132
+ }
133
+ }),
134
+
135
+ childExtend: Cell,
136
+
137
+ i: {},
138
+ em: {},
139
+ decimal: {},
140
+ px: {},
141
+ buttons: Buttons,
142
+
143
+ graph: { line: {} }
144
+ }
145
+
146
+ const HeaderRow = {
147
+ extend: Row,
148
+
149
+ childExtend: {
150
+ props: {
151
+ color: 'gray7',
152
+ style: { paddingBlock: '0 .618em' }
153
+ }
154
+ },
155
+
156
+ i: '#',
157
+ em: 'em',
158
+ decimal: 'decimal',
159
+ px: 'px',
160
+ buttons: null,
161
+ graph: null
162
+ }
163
+
164
+ export const Table = {
165
+ extend: Pseudo,
166
+ tag: 'section',
167
+
168
+ props: {
169
+ overflow: 'hidden',
170
+ position: 'relative',
171
+ header: {
172
+ '@dark': { color: 'gray6' },
173
+ '@light': { color: 'gray7' }
174
+ },
175
+
176
+ '::after': {
177
+ content: '""',
178
+ position: 'absolute',
179
+ width: '100%',
180
+ height: '100%',
181
+ top: '0',
182
+ left: '100%'
183
+ },
184
+ '@dark': {
185
+ color: 'gray8',
186
+ '::after': {
187
+ background: 'black',
188
+ boxShadow: 'black, 0 0px 50px 50px'
189
+ }
190
+ },
191
+ '@light': {
192
+ color: 'gray3',
193
+ '::after': {
194
+ background: 'gray12',
195
+ boxShadow: 'gray12, 0 0px 50px 50px'
196
+ }
197
+ }
198
+ },
199
+
200
+ header: HeaderRow,
201
+
202
+ cnt: {
203
+ childExtend: Row,
204
+ $setCollection: (el) => mapSequence(el.state, sortSequence)
205
+ }
206
+ }
@@ -0,0 +1,45 @@
1
+ 'use strict'
2
+
3
+ import { SectionHeader } from '@symbo.ls/components'
4
+
5
+ import preview from './preview'
6
+ import sequence from './sequence'
7
+ import boxModel from './boxModel'
8
+
9
+ export const Spaces = {
10
+ key: 'spaces',
11
+
12
+ state: {
13
+ activePage: 'spaces',
14
+ activeTab: 'preview',
15
+
16
+ title: 'Spacing',
17
+ p: 'Unlike typography, component may has the properties of padding, gap, width and rest.'
18
+ },
19
+
20
+ define: { routes: param => param },
21
+
22
+ routes: {
23
+ preview,
24
+ sequence,
25
+ boxModel
26
+ },
27
+
28
+ on: {
29
+ init: (el, s) => {
30
+ var route = window.location.pathname
31
+ var routes = route.slice(1).split('/')
32
+ s.activeTab = routes[1] || s.activeTab
33
+ }
34
+ },
35
+
36
+ header: {
37
+ extend: SectionHeader
38
+ },
39
+
40
+ preview
41
+
42
+ // page: {
43
+ // content: (el, s) => ({ extend: el.parent.routes[s.activeTab] })
44
+ // }
45
+ }
@@ -1,45 +1,23 @@
1
1
  'use strict'
2
2
 
3
- import { SectionHeader } from '@symbo.ls/components'
4
-
5
- import preview from './preview'
6
- import sequence from './sequence'
7
- import boxModel from './boxModel'
3
+ import { TypeSection } from '../Typography/shared'
4
+ import { SpacingScale } from './SpacingScale'
5
+ import { state } from './state'
8
6
 
9
7
  export const Spaces = {
10
- key: 'spaces',
11
-
12
- state: {
13
- activePage: 'spaces',
14
- activeTab: 'preview',
15
-
16
- title: 'Spacing',
17
- p: 'Unlike typography, component may has the properties of padding, gap, width and rest.'
18
- },
19
-
20
- define: { routes: param => param },
21
-
22
- routes: {
23
- preview,
24
- sequence,
25
- boxModel
26
- },
27
-
28
- on: {
29
- init: (el, s) => {
30
- var route = window.location.pathname
31
- var routes = route.slice(1).split('/')
32
- s.activeTab = routes[1] || s.activeTab
33
- }
34
- },
8
+ extend: TypeSection,
9
+ state,
35
10
 
36
11
  header: {
37
- extend: SectionHeader
12
+ state: {
13
+ title: 'Spacing',
14
+ p: 'Unlike typography, component may has the properties of padding, gap, width and rest.'
15
+ }
38
16
  },
39
17
 
40
- preview
41
-
42
- // page: {
43
- // content: (el, s) => ({ extend: el.parent.routes[s.activeTab] })
44
- // }
18
+ SpacingScale
45
19
  }
20
+
21
+ // preview,
22
+ // sequence,
23
+ // boxModel
@@ -1,9 +1,8 @@
1
1
  'use strict'
2
2
 
3
- import { SPACING } from '@symbo.ls/components'
4
- import { TYPOGRAPHY_SEQUENCE } from '../Export/const'
3
+ import { SPACING } from '@symbo.ls/scratch'
5
4
 
6
- export default {
5
+ export const state = {
7
6
  tabs: [{
8
7
  key: 0,
9
8
  name: 'Default'
@@ -11,8 +10,13 @@ export default {
11
10
  key: 1,
12
11
  name: 'Font Size'
13
12
  }],
14
- activeTab: '0',
15
- sequence: TYPOGRAPHY_SEQUENCE,
16
- spacingRatio: SPACING.ratio,
17
- currentFontSizeIndex: 3
13
+
14
+ base: SPACING.base,
15
+ ratio: SPACING.ratio,
16
+ subSequence: true,
17
+ range: [-5, +12],
18
+ scales: {},
19
+ sequence: {},
20
+ vars: {},
21
+ type: 'spacing-scale'
18
22
  }
File without changes
File without changes