@symbo.ls/preview 0.0.23 → 0.0.25

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.25",
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
+ }
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { Text, Block, Link, SquareButton, Img, ClickableItem, SelectToolWithCaption, Grid, CheckButton } from '@symbo.ls/components'
3
+ import { Text, Block, Link, SquareButton, Img, ClickableItem, SelectFieldWithCaption, Grid, CheckButton } from '@symbo.ls/components'
4
4
  // import { account } from '../SignUp'
5
5
 
6
6
  import setUpProject from './setUpProject'
@@ -128,7 +128,7 @@ const fillFields = {
128
128
  rowGap: 'C2'
129
129
  },
130
130
  childExtend: {
131
- extend: SelectToolWithCaption,
131
+ extend: SelectFieldWithCaption,
132
132
  style: {
133
133
  '> input': { width: '270x', minWidth: '270px', height: '42px' }
134
134
  },
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { Text, Block, Img, SquareButton, SelectTool } from '@symbo.ls/components'
3
+ import { Text, Block, Img, SquareButton, SelectField } from '@symbo.ls/components'
4
4
  import { SetUp } from '..'
5
5
 
6
6
  export default {
@@ -126,7 +126,7 @@ export default {
126
126
  {
127
127
  caption: { props: { text: 'UI Framework' } },
128
128
  element: {
129
- extend: SelectTool,
129
+ extend: SelectField,
130
130
  title: {
131
131
  props: { text: 'React' },
132
132
  style: { color: 'white' }
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { CommonField, SelectTool } from '@symbo.ls/components'
3
+ import { CommonField, SelectField } from '@symbo.ls/components'
4
4
 
5
5
  export const friendTheme = {
6
6
  extend: CommonField,
@@ -11,7 +11,7 @@ export const friendTheme = {
11
11
  style: { opacity: 1, fontWeight: 'normal', margin: 0 }
12
12
  },
13
13
  element: {
14
- extend: SelectTool,
14
+ extend: SelectField,
15
15
  style: {
16
16
  background: 'transparent',
17
17
  paddingLeft: 0,
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { Block, Grid, Text, SelectTool, CommonField } from '@symbo.ls/components'
3
+ import { Block, Grid, Text, SelectField, CommonField } from '@symbo.ls/components'
4
4
 
5
5
  export const interactivity = {
6
6
  h6: {
@@ -21,7 +21,7 @@ export const interactivity = {
21
21
  extend: CommonField,
22
22
  props: { padding: 0 },
23
23
  element: {
24
- extend: SelectTool,
24
+ extend: SelectField,
25
25
  buttons: { ...[{ props: { icon: 'plus' } }] }
26
26
  }
27
27
  },
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { Grid, ColorSwitcher, CommonField, SelectTool, ButtonSet, ClickableItem } from '@symbo.ls/components'
3
+ import { Grid, ColorSwitcher, CommonField, SelectField, ButtonSet, ClickableItem } from '@symbo.ls/components'
4
4
 
5
5
 
6
6
  ColorSwitcher.props = (el, s) => {
@@ -72,7 +72,7 @@ export const themingTools = {
72
72
  props: { caption: 'Use as' },
73
73
  caption: {},
74
74
  element: {
75
- extend: SelectTool,
75
+ extend: SelectField,
76
76
  title: { props: { text: 'Background color' } },
77
77
  buttons: { ...[{ props: { icon: 'arrowAngleMirroringVertical', theme: 'transparent' } }] }
78
78
  }
@@ -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
  }),
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { stylePreview, styleScene } from './style'
4
4
 
5
- import { Block, Button, Flex, Text, ResponsiveToolBar, Scene, SequenceGraph, StaticSpacing, CommonField, SliderToolWithCaption, SelectToolWithCaption } from '@symbo.ls/components'
5
+ import { Block, Button, Flex, Text, ResponsiveToolBar, Scene, SequenceGraph, StaticSpacing, CommonField, RangeFieldWithCaption, SelectFieldWithCaption } from '@symbo.ls/components'
6
6
 
7
7
  const buttonDownload = {
8
8
  extend: Button,
@@ -56,7 +56,7 @@ export default {
56
56
  // },
57
57
 
58
58
  {
59
- extend: SelectToolWithCaption,
59
+ extend: SelectFieldWithCaption,
60
60
  style: { marginTop: `${26 / 16}em` },
61
61
  caption: { props: { text: 'Used for' } },
62
62
  element: {
@@ -76,7 +76,7 @@ export default {
76
76
  childExtend: CommonField,
77
77
  ...[
78
78
  {
79
- extend: SliderToolWithCaption,
79
+ extend: RangeFieldWithCaption,
80
80
  caption: { text: 'Base size' },
81
81
  element: {
82
82
  button0: {},
@@ -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, 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
+ }