@symbo.ls/preview 0.0.39 → 0.0.40

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.
@@ -58,7 +58,7 @@ const define = {
58
58
  },
59
59
  SearchHeader: {
60
60
  settings: {
61
- gridOptions: { colspan: 6, rowspan: 2 }
61
+ gridOptions: { colspan: 8, rowspan: 2 }
62
62
  }
63
63
  },
64
64
  Search: {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@symbo.ls/preview",
3
3
  "description": "",
4
4
  "author": "",
5
- "version": "0.0.39",
5
+ "version": "0.0.40",
6
6
  "repository": "https://github.com/rackai/editor",
7
7
  "main": "src/index.js",
8
8
  "scripts": {
@@ -68,17 +68,7 @@ export const Export = {
68
68
  flex: '1'
69
69
  },
70
70
 
71
- tools: {
72
- props: {
73
- padding: 'Z2 0 0 0',
74
- flexAlign: 'center space-between'
75
- },
76
-
77
- tools,
78
-
79
- ResponsiveToolBar: {}
80
- },
81
-
71
+ tools,
82
72
  description
83
73
  }
84
74
 
@@ -50,7 +50,8 @@ export default {
50
50
  el.comp.setProps({
51
51
  base: s.base,
52
52
  fontSize: s.base + 'px',
53
- spacingRatio: s.ratio
53
+ spacingRatio: s.ratio,
54
+ direction: s.direction
54
55
  }, { preventUpdate: true })
55
56
  updateReset()
56
57
  }
@@ -1,14 +1,53 @@
1
1
  'use strict'
2
2
 
3
- import { Flex, SequenceSliders } from '@symbo.ls/components'
3
+ import {
4
+ Flex,
5
+ SequenceSliders,
6
+ ClickableItem,
7
+ SquareButton
8
+ } from '@symbo.ls/components'
4
9
 
5
10
  export default {
6
- extend: [Flex],
7
- props: { gap: 'B1' },
8
- // theme: { extend: ThemeSwitcher },
11
+ props: {
12
+ padding: 'Z2 0 0',
13
+ flexAlign: 'center space-between'
14
+ },
9
15
 
10
- sliders: {
11
- extend: SequenceSliders,
12
- childExtend: { title: null }
16
+ tools: {
17
+ extend: Flex,
18
+ props: { gap: 'B1' },
19
+ // theme: { extend: ThemeSwitcher },
20
+
21
+ sliders: {
22
+ extend: SequenceSliders,
23
+ childExtend: { title: null }
24
+ }
25
+ },
26
+
27
+ responsive: {
28
+ extend: Flex,
29
+ props: { gap: 'A2' },
30
+
31
+ direction: {
32
+ extend: [ClickableItem, SquareButton],
33
+ props: {
34
+ icon: 'languageDirection'
35
+ },
36
+ on: {
37
+ click: (ev, el, s) => {
38
+ console.log(s.direction)
39
+ s.update({
40
+ direction: s.direction === 'rtl' ? 'ltr' : 'rtl'
41
+ })
42
+ }
43
+ }
44
+ },
45
+
46
+ VerticalLine: {
47
+ margin: 'auto 0',
48
+ height: 'A2'
49
+ },
50
+
51
+ ResponsiveToolBar: {}
13
52
  }
14
53
  }
@@ -6,34 +6,53 @@ import {
6
6
  Flex,
7
7
  SectionHeader,
8
8
  AccessibilityCheck,
9
- SceneThemingBar
9
+ SceneThemingBar,
10
+ Pseudo,
11
+ CommonField
10
12
  } from '@symbo.ls/components'
11
13
 
12
- import { colorTones } from './colorTone'
13
- import { themingTools } from './themingTools'
14
- import { interactivity } from './interactivity'
15
- import { friendTheme } from './friendTheme'
14
+ import preview from './preview'
15
+ // import { themingTools } from './themingTools'
16
+ // import { interactivity } from './interactivity'
17
+ // import { friendTheme } from './friendTheme'
16
18
 
17
- import style, { styleLabel } from './style'
19
+ import style from './style'
18
20
 
19
- const nameTheTheme = {
21
+ const ThemeNameField = {
20
22
  tag: 'label',
21
- style: styleLabel,
22
23
  attr: { for: 'name-it' },
23
- caption: {
24
- props: {
25
- text: 'Name the theme',
26
- padding: '0 0 Y1 0',
27
- size: 'Z'
28
- }
29
- },
30
- span: {
31
- tag: 'span',
32
- props: {
33
- text: (el, s) => s.value,
34
- size: 'E'
24
+ extend: CommonField,
25
+
26
+ props: ({ state }) => ({
27
+ gap: '0',
28
+
29
+ caption: {
30
+ text: 'Name the theme'
35
31
  },
36
- attr: { contentEditable: true, placeholder: 'you name it', id: 'name-it' }
32
+
33
+ element: {
34
+ whiteSpace: 'nowrap',
35
+ minWidth: 'C1',
36
+ maxWidth: 'fit-content',
37
+ outline: 'none',
38
+ fontSize: 'E',
39
+
40
+ border: 'dashed, gray5',
41
+ borderWidth: '0 0 1px',
42
+
43
+ text: (el, s) => s.themeName,
44
+
45
+ ':empty::before': {
46
+ content: '"You name it"',
47
+ color: 'gray5'
48
+ }
49
+ }
50
+ }),
51
+
52
+ caption: {},
53
+ element: {
54
+ extend: Pseudo,
55
+ attr: { contentEditable: true, id: 'name-it' }
37
56
  }
38
57
  }
39
58
 
@@ -128,16 +147,16 @@ export const Theme = {
128
147
  init: (el, s) => {
129
148
  if (!el.context.SYSTEM) return
130
149
  const path = window.location.pathname
131
- const pathArray = path.split('edit-icon/')
150
+ const pathArray = path.split('theme/')
132
151
  if (!el.context.SYSTEM) return
133
152
  const { THEME } = el.context.SYSTEM
134
153
  const themeName = pathArray[1]
135
- var theme = THEME[themeName]
154
+ var value = THEME[themeName]
136
155
 
137
- if (themeName && theme) {
156
+ if (themeName && value) {
138
157
  s.update({
139
- themeName: themeName,
140
- value: theme
158
+ themeName,
159
+ value
141
160
  }, { preventUpdate: true })
142
161
  }
143
162
  }
@@ -146,26 +165,24 @@ export const Theme = {
146
165
  header: {
147
166
  extend: SectionHeader,
148
167
  props: {
149
- padding: 'C 0 B2 0',
150
- margin: '0'
168
+ margin: '0 0 B2'
151
169
  },
152
- heading: '',
153
- label: nameTheTheme,
170
+ heading: null,
171
+ ThemeNameField,
154
172
  nav: { extend: SceneThemingBar }
155
173
  },
156
174
 
157
175
  cnt: {
158
- extend: [Flex],
159
- props: {
160
- gap: 'D'
161
- },
176
+ extend: Flex,
177
+ props: { gap: 'D' },
178
+
179
+ preview,
162
180
 
163
- aside: colorTones,
164
181
  colorEdit: {
165
- props: { gap: 'C2', flexFlow: 'column' },
166
- themingTools,
167
- interactivity,
168
- friendTheme
182
+ props: { gap: 'C2', flexFlow: 'column' }
183
+ // themingTools,
184
+ // interactivity,
185
+ // friendTheme
169
186
  }
170
187
  },
171
188
 
@@ -0,0 +1,153 @@
1
+ 'use strict'
2
+
3
+ import { opacify } from '@symbo.ls/scratch'
4
+ import { Flex, Grid } from '@symbo.ls/components'
5
+
6
+ const classOpacify = (value, opacity) => {
7
+ const { background, backgroundColor, color } = value
8
+ const bg = background || backgroundColor || color
9
+ if (!bg) return
10
+ return { background: opacify(bg, opacity) }
11
+ }
12
+
13
+ const TONES_AMOUNT = 13
14
+ const TONES_ARR = new Array(TONES_AMOUNT).fill(0).map((_, i) => i)
15
+
16
+ const getThemeProperty = (property, value, mod) => {
17
+ const modifier = `@${mod}`
18
+ return value[modifier] && value[modifier][property] ? value[modifier][property] : value[property]
19
+ }
20
+
21
+ export const Tones = {
22
+ extend: Grid,
23
+ props: {
24
+ columns: `repeat(${TONES_AMOUNT}, 1fr)`,
25
+ height: 'B',
26
+ round: 'Z',
27
+ overflow: 'hidden'
28
+ },
29
+ childExtend: {
30
+ tag: 'span',
31
+ text: null,
32
+ props: ({ key, state }) => ({
33
+ round: '0',
34
+ transition: 'B default-bezier',
35
+ transitionProperty: 'color, background',
36
+ background: getThemeProperty('background', state.value, state.sceneTheme),
37
+ opacity: '' + (100 / TONES_AMOUNT * parseInt(key)) / 100
38
+ })
39
+ },
40
+ $setCollection: () => TONES_ARR
41
+ }
42
+
43
+ export default {
44
+ tag: 'aside',
45
+ extend: Flex,
46
+ props: {
47
+ flow: 'column'
48
+ },
49
+
50
+ preview: {
51
+ props: (el, s) => ({
52
+ padding: 'X1',
53
+ round: 'Z2',
54
+ theme: `scene @${s.sceneTheme}`,
55
+ style: {
56
+ '&, & *': {
57
+ transition: '165ms cubic-bezier(.29,.67,.51,.97)',
58
+ transitionProperty: 'color, background'
59
+ }
60
+ }
61
+ }),
62
+ scene: {
63
+ props: {
64
+ padding: 'A',
65
+ backgroundPosition: `center`,
66
+ backgroundRepeat: `repeat`,
67
+ backgroundSize: '100px 100px'
68
+ },
69
+ circle: {
70
+ props: (el, s) => ({
71
+ theme: `${s.themeName} @${s.sceneTheme}`,
72
+ flexFlow: 'column',
73
+ flexAlign: 'center center',
74
+ width: 'G',
75
+ aspectRatio: '1 / 1',
76
+ round: '100%',
77
+ position: 'relative',
78
+ borderWidth: '1px',
79
+ borderStyle: 'solid',
80
+ borderColor: 'transparent',
81
+
82
+ h6: {
83
+ fontSize: 'D',
84
+ fontWeight: 'bold',
85
+ gap: 'X'
86
+ }
87
+ }),
88
+ h6: {
89
+ extend: Flex,
90
+ Span: {
91
+ text: 'The',
92
+ fontWeight: 'normal',
93
+ marginRight: '6px'
94
+ },
95
+ text: 'Text Color'
96
+ },
97
+ Span: {
98
+ text: (el, s) => s.themeName,
99
+ position: 'absolute',
100
+ top: '86%',
101
+ left: '50%',
102
+ transform: 'translate(-50%, -50%)',
103
+ fontWeight: '600'
104
+ }
105
+ }
106
+ }
107
+ },
108
+
109
+ opacity: {
110
+ props: {
111
+ padding: 'B1 0 0 0'
112
+ },
113
+ caption: {
114
+ props: {
115
+ text: 'Opacity',
116
+ size: 'Z',
117
+ padding: '0 0 Z1 0',
118
+ opacity: '.65'
119
+ }
120
+ },
121
+ tones: { extend: Tones }
122
+ },
123
+
124
+ shades: {
125
+ if: () => false,
126
+ props: { padding: 'B 0 0 0' },
127
+ caption: {
128
+ props: {
129
+ text: 'Shades',
130
+ size: 'Z',
131
+ padding: '0 0 Z1 0'
132
+ },
133
+ style: { opacity: '.65' }
134
+ },
135
+
136
+ generate: {
137
+ props: { flexFlow: 'column', round: 'Z', gap: '2px' },
138
+
139
+ childExtend: {
140
+ extend: [Tones],
141
+ props: { round: 'X' },
142
+ ...TONES_ARR.map(v => ({
143
+ class: { background: el => classOpacify(el, (100 / TONES_AMOUNT * v) / 100) }
144
+ }))
145
+ },
146
+
147
+ dark: {},
148
+ light: {
149
+ props: { theme: 'lightScene' }
150
+ }
151
+ }
152
+ }
153
+ }
@@ -1,22 +1,11 @@
1
1
  'use strict'
2
2
 
3
- export const styleLabel = {
4
- caption: { whiteSpace: 'nowrap', opacity: 0.65 },
5
- span: {
6
- display: 'block',
7
- whiteSpace: 'nowrap',
8
- minWidth: `1.618em`,
9
- maxWidth: 'fit-content',
10
- borderBottom: '1px dashed rgba(255, 255, 255, .35)',
11
- outline: 'none'
12
- }
13
- }
14
-
15
3
  export const styleTool = {
16
4
  caption: { opacity: '.65' },
17
5
  '> div span': { opacity: '.5' },
18
6
  '> div > div': { gap: '1px' }
19
7
  }
8
+
20
9
  export const styleColorTones = {
21
10
  width: '22em',
22
11
  display: 'flex',
@@ -1,163 +0,0 @@
1
- 'use strict'
2
-
3
- import { Block, Text, opacify, Shape, Grid, Overflow } from '@symbo.ls/components'
4
-
5
- const classOpacify = (el, opacity) => {
6
- if (!el.state.value) return
7
- const { background, backgroundColor, color } = el.state.value
8
- const bg = background || backgroundColor || color
9
- if (!bg) return
10
- return { background: opacify(bg, opacity) }
11
- }
12
-
13
- const TONES_AMOUNT = 13
14
- const TONES_ARR = new Array(TONES_AMOUNT).fill(0).map((_, i) => i)
15
-
16
- export const Tones = {
17
- extend: [Shape, Block, Grid, Overflow],
18
- props: {
19
- columns: `repeat(${TONES_AMOUNT}, 1fr)`,
20
- height: 'B',
21
- round: 'Z'
22
- },
23
- childExtend: {
24
- tag: 'span',
25
- extend: Shape,
26
- props: { round: 0 },
27
- class: {
28
- transition: {
29
- transition: '165ms cubic-bezier(.29,.67,.51,.97)',
30
- transitionProperty: 'color, background'
31
- }
32
- }
33
- },
34
- ...TONES_ARR.map(v => ({
35
- class: { background: el => classOpacify(el, (100 / TONES_AMOUNT * v) / 100) }
36
- }))
37
- }
38
-
39
- export const colorTones = {
40
- tag: 'aside',
41
- // extend: Block,
42
- // style: styleColorTones,
43
- props: { flexFlow: 'column' },
44
- span: {
45
- extend: [Text, Block],
46
- props: {
47
- text: 'Preview',
48
- size: 'Z'
49
- },
50
- style: {
51
- display: 'block',
52
- marginBottom: '8px',
53
- opacity: '.65'
54
- }
55
- },
56
-
57
- preview: {
58
- extend: [Shape, Block],
59
- style: {
60
- background: 'rgba(255, 255, 255, .06)',
61
- '&, & *': { transition: '165ms cubic-bezier(.29,.67,.51,.97)', transitionProperty: 'color, background' }
62
- },
63
- props: (el, s) => ({
64
- padding: 'X1',
65
- round: 'Z2',
66
- theme: `${s.sceneTheme || 'dark'}Scene`
67
- }),
68
- scene: {
69
- extend: [Block],
70
- props: { padding: 'A' },
71
- style: {
72
- boxSizing: 'border-box',
73
- backgroundPosition: `center`,
74
- backgroundRepeat: `repeat`,
75
- backgroundSize: '100px 100px'
76
- },
77
- circle: {
78
- extend: [Block, Shape],
79
- props: (el, s) => ({
80
- theme: s.value,
81
- flexFlow: 'column',
82
- flexAlign: 'center center',
83
- width: 'G',
84
- aspectRatio: '1 / 1',
85
- round: '100%'
86
- }),
87
- style: { position: 'relative', borderWidth: '1px', borderStyle: 'solid' },
88
- h6: {
89
- extend: Text,
90
- style: { fontSize: `${26 / 16}em`, fontWeight: 'Bold' },
91
- span: {
92
- text: 'The',
93
- style: {
94
- fontWeight: 'normal',
95
- marginRight: '6px'
96
- }
97
- },
98
- text: 'Text Color'
99
- },
100
- span: {
101
- extend: Text,
102
- props: { text: (el, s) => s.value },
103
- style: {
104
- position: 'absolute',
105
- top: '86%',
106
- left: '50%',
107
- transform: 'translate(-50%, -50%)',
108
- fontWeight: '600'
109
- }
110
- }
111
- }
112
- }
113
- },
114
-
115
- opacity: {
116
- extend: Block,
117
- props: {
118
- padding: 'B1 0 0 0'
119
- },
120
- caption: {
121
- extend: [Text, Block],
122
- props: {
123
- text: 'Opacity',
124
- size: 'Z',
125
- padding: '0 0 Z1 0'
126
- },
127
- style: { opacity: '.65' }
128
- },
129
- tones: { extend: Tones }
130
- },
131
-
132
- shades: {
133
- extend: [Block],
134
- props: { padding: 'B 0 0 0' },
135
- caption: {
136
- extend: [Text, Block],
137
- props: {
138
- text: 'Shades',
139
- size: 'Z',
140
- padding: '0 0 Z1 0'
141
- },
142
- style: { opacity: '.65' }
143
- },
144
-
145
- generate: {
146
- extend: [Block, Shape, Overflow],
147
- props: { flexFlow: 'column', round: 'Z', gap: '2px' },
148
-
149
- childExtend: {
150
- extend: [Tones],
151
- props: { round: 'X' },
152
- ...TONES_ARR.map(v => ({
153
- class: { background: el => classOpacify(el, (100 / TONES_AMOUNT * v) / 100) }
154
- }))
155
- },
156
-
157
- dark: {},
158
- light: {
159
- props: { theme: 'lightScene' }
160
- }
161
- }
162
- }
163
- }
@@ -1,30 +0,0 @@
1
- 'use strict'
2
-
3
- import { CommonField, SelectField } from '@symbo.ls/components'
4
-
5
- export const friendTheme = {
6
- extend: CommonField,
7
- style: { paddingBlock: 0 },
8
- caption: {
9
- tag: 'h6',
10
- props: { text: 'Friend themes', size: 'B' },
11
- style: { opacity: 1, fontWeight: 'normal', margin: 0 }
12
- },
13
- element: {
14
- extend: SelectField,
15
- style: {
16
- background: 'transparent',
17
- paddingLeft: 0,
18
- '&:hover': { background: 'transparent' }
19
- },
20
- title: null,
21
- buttons: {
22
- ...[
23
- {
24
- props: { icon: 'plus' },
25
- style: { padding: `${10 / 16}em` }
26
- }
27
- ]
28
- }
29
- }
30
- }