@symbo.ls/preview 0.0.23 → 0.0.24

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,12 +2,14 @@
2
2
  "name": "@symbo.ls/preview",
3
3
  "description": "",
4
4
  "author": "",
5
- "version": "0.0.23",
5
+ "version": "0.0.24",
6
6
  "repository": "https://github.com/rackai/editor",
7
7
  "main": "src/index.js",
8
8
  "scripts": {
9
9
  "link:all": "yarn link smbls domql css-in-props @symbo.ls/icons @symbo.ls/config @symbo.ls/components @symbo.ls/scratch @symbo.ls/playground @symbo.ls/utils @symbo.ls/init @symbo.ls/config-default @domql/router @domql/utils @domql/router",
10
- "prestart": "rm -rf .cache dist",
10
+ "clean": "rm -rf .cache dist",
11
+ "clean:modules": "rm -rf node_modules/**/node_modules/@symbo.ls node_modules/**/node_modules/@domql node_modules/**/node_modules/domql node_modules/**/node_modules/smbls",
12
+ "prestart": "yarn clean && yarn clean:modules",
11
13
  "start": "parcel src/dev.html --port 1200 --no-cache",
12
14
  "prebuild": "rm -rf .cache dist",
13
15
  "build": "parcel build src/dev.html",
package/src/app.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import './config'
4
4
 
5
5
  import 'domql/packages/emotion'
6
- import { router, lastLevel } from '@domql/router'
6
+ import { router } from '@domql/router'
7
7
 
8
8
  import { state } from './state'
9
9
  import {
@@ -74,10 +74,4 @@ const App = {
74
74
  }
75
75
  }
76
76
 
77
- window.onpopstate = e => {
78
- const { pathname, hash } = window.location
79
- const url = pathname + hash
80
- router(App, url, {}, lastLevel, true)
81
- }
82
-
83
77
  export default App
package/src/index.js CHANGED
@@ -11,6 +11,7 @@ import * as smbls from '@symbo.ls/components'
11
11
  import App from './app'
12
12
  import { Header } from './components'
13
13
  import { Library } from './pages'
14
+ import { router, lastLevel } from '@domql/router'
14
15
 
15
16
  import { context } from './state'
16
17
 
@@ -22,7 +23,7 @@ DOM.define({
22
23
  })
23
24
 
24
25
  // export default DOM.create(App, DevFocus, 'app', { TODO: try this
25
- export default DOM.create({
26
+ const app = DOM.create({
26
27
  extend: App,
27
28
  style,
28
29
 
@@ -35,3 +36,12 @@ export default DOM.create({
35
36
  components: { ...smbls },
36
37
  context
37
38
  })
39
+
40
+ window.onpopstate = e => {
41
+ const { pathname, hash } = window.location
42
+ const url = pathname + hash
43
+ router(app, url, {}, {
44
+ level: lastLevel,
45
+ pushState: false
46
+ })
47
+ }
@@ -17,13 +17,14 @@ export default {
17
17
  header: {
18
18
  extend: SectionHeader,
19
19
 
20
- props: { margin: '0 0 X2' },
21
-
22
- heading: {
20
+ props: {
21
+ margin: '0 0 X2',
23
22
  title: null,
24
23
  p: 'All Categories'
25
24
  },
26
25
 
26
+ heading: {},
27
+
27
28
  nav: {
28
29
  childExtend: {
29
30
  props: {
@@ -54,7 +55,6 @@ export default {
54
55
  on: {
55
56
  click: (ev, el, s) => {
56
57
  s.update({ view: 'grid' })
57
- // debugger
58
58
  }
59
59
  }
60
60
  }, {
@@ -3,7 +3,7 @@
3
3
  import { ClickableItem, Flex, Link, SquareButton } from '@symbo.ls/components'
4
4
  import { PageExtend,
5
5
  Color,
6
- ColorEditor,
6
+ Theme,
7
7
  Shapes,
8
8
  Spaces,
9
9
  Icons,
@@ -79,15 +79,14 @@ export const DesignSystem = {
79
79
  define: { routes: param => param },
80
80
  routes: {
81
81
  '/colors': Color,
82
- '/theme': ColorEditor,
83
- // '/theme': Theme,
82
+ '/theme': Theme,
84
83
  '/typography': Typography,
85
84
  '/fonts': Fonts,
86
85
  '/space': Spaces,
87
- // '/sequence': Sequence,
88
86
  '/shape': Shapes,
89
- // '/timing': Timing,
90
87
  '/icons': Icons
88
+ // '/sequence': Sequence,
89
+ // '/timing': Timing,
91
90
  // '/media-query': MediaQuery
92
91
  },
93
92
 
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { Grid, Hoverable, FontObject, FontFamilyObject, Line } from '@symbo.ls/components'
3
+ import { Grid, Hoverable, FontObject, FontFamilyObject } from '@symbo.ls/components'
4
4
  import { TypeSection } from '../Typography/shared'
5
5
 
6
6
  import { state } from './state'
@@ -97,6 +97,6 @@ export const Fonts = {
97
97
  state,
98
98
 
99
99
  FontFaces,
100
- line: { extend: Line },
100
+ Line: {},
101
101
  FontFamilies
102
102
  }
@@ -32,6 +32,7 @@ const IconItem = {
32
32
  on: {
33
33
  click: (event, element, state) => {
34
34
  copyStringToClipboard(state.name)
35
+ Link.on.click(event, element, state)
35
36
  }
36
37
  }
37
38
  }
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { Flex, SectionHeader, Line } from '@symbo.ls/components'
3
+ import { Flex, Line } from '@symbo.ls/components'
4
4
 
5
5
  import {
6
6
  rectangle,
@@ -33,12 +33,9 @@ export const Shapes = {
33
33
  },
34
34
 
35
35
  htmlShapes: {
36
- header: {
37
- extend: SectionHeader,
38
- heading: {
39
- title: 'HTML Shapes',
40
- p: 'All ungrouped document icons'
41
- }
36
+ SectionHeader: {
37
+ title: 'HTML Shapes',
38
+ p: 'All ungrouped document icons'
42
39
  },
43
40
 
44
41
  section: {
@@ -53,12 +50,9 @@ export const Shapes = {
53
50
  line: { extend: Line },
54
51
 
55
52
  svgShapes: {
56
- header: {
57
- extend: SectionHeader,
58
- heading: {
59
- title: 'SVG Shapes',
60
- p: 'TBA'
61
- }
53
+ SectionHeader: {
54
+ title: 'SVG Shapes',
55
+ p: 'TBA'
62
56
  }
63
57
  }
64
58
  }
@@ -1,29 +1,32 @@
1
1
  'use strict'
2
2
 
3
- import { SequenceSliders, Flex } from '@symbo.ls/components'
3
+ import { Flex } from '@symbo.ls/components'
4
4
  import { Preview } from './Preview'
5
5
  import { Table } from './Table'
6
6
 
7
7
  export const SpacingScale = {
8
- extend: Flex,
8
+ extend: [Flex],
9
9
 
10
10
  props: {
11
11
  flow: 'column',
12
12
  gap: 'C1'
13
13
  },
14
14
 
15
- sliders: {
16
- extend: SequenceSliders,
17
- props: {
18
- position: 'sticky',
19
- top: 'D',
20
- background: 'black .5',
21
- zIndex: '2',
22
- margin: '-B2 -B -B',
23
- padding: 'B2 B B',
24
- style: {
25
- backdropFilter: 'blur(15px)'
26
- }
15
+ SectionHeader: {
16
+ title: 'The Sequence',
17
+ p: 'Spacing scale is a set of values that are used to define the padding, margin, gap and width of components.',
18
+ margin: '0'
19
+ },
20
+
21
+ SequenceSliders: {
22
+ position: 'sticky',
23
+ top: 'D',
24
+ background: 'black .5',
25
+ zIndex: '2',
26
+ margin: '-B2 -B -B',
27
+ padding: 'B2 B B',
28
+ style: {
29
+ backdropFilter: 'blur(15px)'
27
30
  }
28
31
  },
29
32
 
@@ -124,10 +124,14 @@ const Row = {
124
124
  graph: {
125
125
  margin: '0 0 0 -B2',
126
126
  line: {
127
+ isBase: state.index === 0,
127
128
  widthRange: `${state.val}px` || 0,
128
129
  height: '2px',
129
130
  background: 'blue',
130
- borderRadius: '2px'
131
+ borderRadius: 'A',
132
+ '.isBase': {
133
+ height: '5px'
134
+ }
131
135
  }
132
136
  }
133
137
  }),
@@ -5,17 +5,19 @@ import { SpacingScale } from './SpacingScale'
5
5
  import { state } from './state'
6
6
 
7
7
  export const Spaces = {
8
- extend: TypeSection,
9
8
  state,
10
9
 
11
- header: {
10
+ spaces: {
11
+ extend: TypeSection,
12
12
  state: {
13
13
  title: 'Spacing',
14
14
  p: 'Unlike typography, component may has the properties of padding, gap, width and rest.'
15
15
  }
16
16
  },
17
17
 
18
- SpacingScale
18
+ Line: {},
19
+
20
+ scale: SpacingScale
19
21
  }
20
22
 
21
23
  // preview,
@@ -0,0 +1,163 @@
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
+ }
@@ -0,0 +1,30 @@
1
+ 'use strict'
2
+
3
+ import { CommonField, SelectTool } 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: SelectTool,
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
+ }
@@ -0,0 +1,185 @@
1
+ 'use strict'
2
+
3
+ import {
4
+ PageTemplate,
5
+ Button,
6
+ Flex,
7
+ SectionHeader,
8
+ AccessibilityCheck,
9
+ SceneThemingBar
10
+ } from '@symbo.ls/components'
11
+
12
+ import { colorTones } from './colorTone'
13
+ import { themingTools } from './themingTools'
14
+ import { interactivity } from './interactivity'
15
+ import { friendTheme } from './friendTheme'
16
+
17
+ import style, { styleLabel } from './style'
18
+
19
+ // import ntc from './ntc'
20
+
21
+ // const returnColor = element => element.lookup('ColorEditor').state.color
22
+ // const setBackground = (element, opacity = 1) => `background: ${opacify(returnColor(element), opacity)}`
23
+
24
+ const nameTheTheme = {
25
+ tag: 'label',
26
+ style: styleLabel,
27
+ attr: { for: 'name-it' },
28
+ caption: {
29
+ props: {
30
+ text: 'Name the theme',
31
+ padding: '0 0 Y1 0',
32
+ size: 'Z'
33
+ }
34
+ },
35
+ span: {
36
+ tag: 'span',
37
+ props: {
38
+ text: (el, s) => s.value,
39
+ size: 'E'
40
+ },
41
+ attr: { contentEditable: true, placeholder: 'you name it', id: 'name-it' }
42
+ }
43
+ }
44
+
45
+ const footer = { //eslint-disable-line
46
+ extend: [Flex],
47
+ props: {
48
+ height: 'C2',
49
+ padding: '0 A'
50
+ },
51
+ style: {
52
+ margin: 'auto -80px 0',
53
+ justifyContent: 'space-between',
54
+ alignItems: 'center'
55
+ },
56
+ nav: {
57
+ extend: [Flex],
58
+ props: { gap: 'A' },
59
+ childExtend: {
60
+ extend: [Button],
61
+ props: {
62
+ size: 'Z',
63
+ width: 'B2',
64
+ height: 'B2',
65
+ theme: 'transparent'
66
+ }
67
+ },
68
+ ...[
69
+ { props: { icon: 'starOutline' } },
70
+ { props: { icon: 'copyOutline' } },
71
+ { props: { icon: 'share' } }
72
+ ]
73
+ },
74
+ span: {
75
+ props: {
76
+ text: 'Autosaved 1 second ago',
77
+ size: 'Y'
78
+ },
79
+ style: { opacity: '.35' }
80
+ },
81
+
82
+ export: {
83
+ extend: Flex,
84
+ style: {
85
+ alignItems: 'center'
86
+ },
87
+ span: {
88
+ props: {
89
+ text: 'Export:',
90
+ size: 'Y',
91
+ padding: '0 B1 0 0'
92
+ },
93
+ style: { opacity: '.35' }
94
+ },
95
+ nav: {
96
+ extend: [Flex],
97
+ props: { gap: 'Y2' },
98
+ childExtend: {
99
+ extend: [Button],
100
+ props: {
101
+ size: 'Z',
102
+ width: 'B2',
103
+ height: 'B2',
104
+ theme: 'transparent'
105
+ },
106
+ style: {
107
+ color: 'white'
108
+ }
109
+ },
110
+ ...[
111
+ { props: { icon: 'themeOutline' } },
112
+ { props: { icon: 'sketch' } },
113
+ { props: { icon: 'arrowAngleMirroringHorizontal' } }
114
+ ]
115
+ }
116
+ }
117
+ }
118
+
119
+ export const Theme = {
120
+ key: 'ColorEditor',
121
+
122
+ extend: PageTemplate,
123
+
124
+ style,
125
+
126
+ state: {
127
+ sceneTheme: 'dark',
128
+ title: 'Typography',
129
+ p: 'A general configuration of type properties on the document.'
130
+ },
131
+
132
+ on: {
133
+ init: (el, s) => {
134
+ if (!el.context.SYSTEM) return
135
+ const path = window.location.pathname
136
+ const pathArray = path.split('edit-icon/')
137
+ if (!el.context.SYSTEM) return
138
+ const { THEME } = el.context.SYSTEM
139
+ const themeName = pathArray[1]
140
+ var theme = THEME[themeName]
141
+
142
+ if (themeName && theme) {
143
+ s.update({
144
+ themeName: themeName,
145
+ value: theme
146
+ }, { preventUpdate: true })
147
+ }
148
+ }
149
+ },
150
+
151
+ header: {
152
+ extend: SectionHeader,
153
+ props: {
154
+ padding: 'C 0 B2 0',
155
+ margin: '0'
156
+ },
157
+ heading: '',
158
+ label: nameTheTheme,
159
+ nav: { extend: SceneThemingBar }
160
+ },
161
+
162
+ cnt: {
163
+ extend: [Flex],
164
+ props: {
165
+ gap: 'D'
166
+ },
167
+
168
+ aside: colorTones,
169
+ colorEdit: {
170
+ props: { gap: 'C2', flexFlow: 'column' },
171
+ themingTools,
172
+ interactivity,
173
+ friendTheme
174
+ }
175
+ },
176
+
177
+ check: {
178
+ extend: AccessibilityCheck,
179
+ props: {
180
+ padding: 'E 0 F'
181
+ }
182
+ }
183
+
184
+ // footer
185
+ }