@symbo.ls/preview 0.0.39 → 0.0.41

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,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
- }
@@ -1,178 +0,0 @@
1
- 'use strict'
2
-
3
- import { Block, Text, Button, Flex, SectionHeader, AccessibilityCheck, SceneThemingBar } from '@symbo.ls/components'
4
-
5
- import { PageExtend } from '..'
6
- import { colorTones } from './colorTone'
7
- import { themingTools } from './themingTools'
8
- import { interactivity } from './interactivity'
9
- import { friendTheme } from './friendTheme'
10
-
11
- import style, { styleLabel } from './style'
12
-
13
- // import ntc from './ntc'
14
-
15
- // const returnColor = element => element.lookup('ColorEditor').state.color
16
- // const setBackground = (element, opacity = 1) => `background: ${opacify(returnColor(element), opacity)}`
17
-
18
- const nameTheTheme = {
19
- tag: 'label',
20
- style: styleLabel,
21
- attr: { for: 'name-it' },
22
- caption: {
23
- extend: [Block, Text],
24
- props: {
25
- text: 'Name the theme',
26
- padding: '0 0 Y1 0',
27
- size: 'Z'
28
- }
29
- },
30
- span: {
31
- tag: 'span',
32
- extend: Text,
33
- props: {
34
- text: (el, s) => s.value,
35
- size: 'E'
36
- },
37
- attr: { contentEditable: true, placeholder: 'you name it', id: 'name-it' }
38
- }
39
- }
40
-
41
- const footer = { //eslint-disable-line
42
- extend: [Flex, Block],
43
- props: {
44
- height: 'C2',
45
- padding: '0 A'
46
- },
47
- style: {
48
- margin: 'auto -80px 0',
49
- justifyContent: 'space-between',
50
- alignItems: 'center'
51
- },
52
- nav: {
53
- extend: [Flex, Block],
54
- props: { gap: 'A' },
55
- childExtend: {
56
- extend: [Button, Text],
57
- props: {
58
- size: 'Z',
59
- width: 'B2',
60
- height: 'B2',
61
- theme: 'transparent'
62
- }
63
- },
64
- ...[
65
- { props: { icon: 'starOutline' } },
66
- { props: { icon: 'copyOutline' } },
67
- { props: { icon: 'share' } }
68
- ]
69
- },
70
- span: {
71
- extend: Text,
72
- props: {
73
- text: 'Autosaved 1 second ago',
74
- size: 'Y'
75
- },
76
- style: { opacity: '.35' }
77
- },
78
-
79
- export: {
80
- extend: Flex,
81
- style: {
82
- alignItems: 'center'
83
- },
84
- span: {
85
- extend: [Text, Block],
86
- props: {
87
- text: 'Export:',
88
- size: 'Y',
89
- padding: '0 B1 0 0'
90
- },
91
- style: { opacity: '.35' }
92
- },
93
- nav: {
94
- extend: [Flex, Block],
95
- props: { gap: 'Y2' },
96
- childExtend: {
97
- extend: [Button, Text],
98
- props: {
99
- size: 'Z',
100
- width: 'B2',
101
- height: 'B2',
102
- theme: 'transparent'
103
- },
104
- style: {
105
- color: 'white'
106
- }
107
- },
108
- ...[
109
- { props: { icon: 'themeOutline' } },
110
- { props: { icon: 'sketch' } },
111
- { props: { icon: 'arrowAngleMirroringHorizontal' } }
112
- ]
113
- }
114
- }
115
- }
116
-
117
- export const ColorEditor = {
118
- key: 'ColorEditor',
119
-
120
- extend: PageExtend,
121
-
122
- style,
123
-
124
- state: {
125
- sceneTheme: 'dark'
126
- },
127
-
128
- on: {
129
- init: (el, s) => {
130
- if (!el.context.SYSTEM) return
131
-
132
- var route = window.location.pathname
133
- var routes = route.slice(1).split('/')
134
- var param = routes[1]
135
-
136
- const { THEME } = el.context.SYSTEM
137
- var content = THEME[`${param}`].value
138
- content.title = param
139
- el.state.value = content
140
- }
141
- },
142
-
143
- header: {
144
- extend: SectionHeader,
145
- props: {
146
- padding: 'C 0 B2 0',
147
- margin: '0'
148
- },
149
- heading: '',
150
- label: nameTheTheme,
151
- nav: { extend: SceneThemingBar }
152
- },
153
-
154
- cnt: {
155
- extend: [Flex],
156
- props: {
157
- gap: 'D'
158
- },
159
-
160
- aside: colorTones,
161
- colorEdit: {
162
- extend: Block,
163
- props: { gap: 'C2', flexFlow: 'column' },
164
- themingTools,
165
- interactivity,
166
- friendTheme
167
- }
168
- },
169
-
170
- check: {
171
- extend: AccessibilityCheck,
172
- props: {
173
- padding: 'E 0 F'
174
- }
175
- }
176
-
177
- // footer
178
- }
@@ -1,116 +0,0 @@
1
- 'use strict'
2
-
3
- import { Block, Grid, Text, SelectField, CommonField } from '@symbo.ls/components'
4
-
5
- export const interactivity = {
6
- h6: {
7
- extend: [Text, Block],
8
- props: { text: 'Interactivity', padding: '0 0 Z2 0', size: 'B' },
9
- style: { fontWeight: 'normal', margin: 0 }
10
- },
11
- interactivitySet: {
12
- extend: Grid,
13
- props: {
14
- columns: 'repeat(4, 1fr)',
15
- rows: 'repear(2, 1fr)',
16
- columnGap: 'C',
17
- rowGap: 'A2'
18
- },
19
- style: { width: 'fit-content' },
20
- childExtend: {
21
- extend: CommonField,
22
- props: { padding: 0 },
23
- element: {
24
- extend: SelectField,
25
- buttons: { ...[{ props: { icon: 'plus' } }] }
26
- }
27
- },
28
- ...[
29
- {
30
- caption: { props: { text: ':hover' } },
31
- element: {
32
- title: {
33
- props: { icon: 'hoverOutline', text: 'none' }
34
- }
35
- }
36
- },
37
- {
38
- caption: { props: { text: ':focus' } },
39
- element: {
40
- title: {
41
- props: { icon: 'focusOutline', text: 'none' }
42
- }
43
- }
44
- },
45
- {
46
- caption: { props: { text: ':active' } },
47
- element: {
48
- title: {
49
- props: { icon: 'clickOutline', text: 'none' }
50
- }
51
- }
52
- },
53
- {
54
- caption: { props: { text: ':selection' } },
55
- element: {
56
- title: {
57
- props: { icon: 'selection', text: 'none' }
58
- }
59
- }
60
- },
61
- {
62
- caption: { props: { text: ':link' } },
63
- element: {
64
- title: {
65
- props: { icon: 'clickOutline', text: 'none' }
66
- }
67
- }
68
- },
69
- {
70
- caption: { props: { text: ':visited' } },
71
- element: {
72
- title: {
73
- props: { icon: 'focusOutline', text: 'none' }
74
- }
75
- }
76
- },
77
- {
78
- caption: { props: { text: ':disabled' } },
79
- element: {
80
- title: {
81
- props: { icon: 'disabled', text: 'none' }
82
- }
83
- }
84
- },
85
-
86
- {
87
- caption: null,
88
- style: {
89
- display: 'flex',
90
- alignItems: 'flex-end'
91
- },
92
- element: {
93
- title: {
94
- props: { text: 'Add :pseudo' }
95
- },
96
- buttons: {
97
- style: {
98
- button: {
99
- background: 'transparent',
100
- borderRadius: 0,
101
- '&:first-child': { borderRight: '.1px solid rgba(255, 255, 255, .1)' },
102
- '&:hover': { background: 'transparent' }
103
- }
104
- },
105
- ...[
106
- { props: { icon: 'arrowAngleDown' } },
107
- { props: { icon: 'plus' } }
108
-
109
- ]
110
- }
111
- }
112
- }
113
- ]
114
- }
115
-
116
- }