@symbo.ls/preview 0.0.22 → 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.
@@ -2,8 +2,7 @@
2
2
 
3
3
  import { CATEGORIES } from '../categories'
4
4
 
5
- import style from './style'
6
- import { Notification } from '@symbo.ls/components'
5
+ import { Notification } from 'smbls'
7
6
 
8
7
  const key = 'notification'
9
8
  const title = 'Notification'
@@ -11,11 +10,8 @@ const description = ''
11
10
  const category = CATEGORIES[4]
12
11
 
13
12
  const component = {
14
- style,
15
13
  extend: Notification,
16
- props: {
17
- theme: 'alert'
18
- }
14
+ props: { theme: 'alert' }
19
15
  }
20
16
 
21
17
  const code = `{
@@ -10,7 +10,9 @@ const description = ''
10
10
  const category = CATEGORIES[CATEGORIES.length - 1]
11
11
 
12
12
  const component = {
13
- extend: Pills
13
+ extend: Pills,
14
+ state: { active: 1 },
15
+ ...[{}, {}, {}, {}, {}]
14
16
  }
15
17
 
16
18
  const code = `{}`
package/package.json CHANGED
@@ -2,12 +2,14 @@
2
2
  "name": "@symbo.ls/preview",
3
3
  "description": "",
4
4
  "author": "",
5
- "version": "0.0.22",
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 {
@@ -51,10 +51,10 @@ const App = {
51
51
  },
52
52
 
53
53
  content: {
54
- style: { position: 'relative' }
54
+ props: { position: 'relative' }
55
55
  },
56
56
 
57
- Modal,
57
+ modal: Modal,
58
58
 
59
59
  on: {
60
60
  render: element => {
@@ -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,11 +23,11 @@ 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
 
29
- Header,
30
+ header: Header,
30
31
  routes: {
31
32
  '/': Library
32
33
  }
@@ -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
 
@@ -10,10 +10,9 @@ import scene from './scene'
10
10
  import tools from './tools'
11
11
  import description from './description'
12
12
 
13
- import { LIBRARY } from '../../../.symbols'
14
13
  import { COMPONENT_ROUTES } from './const'
15
14
 
16
- const componentState = () => LIBRARY.filter(v => {
15
+ const componentState = (context) => context.LIBRARY.filter(v => {
17
16
  const key = window.location.pathname.split('component/')[1]
18
17
  return v.key === key
19
18
  })
@@ -28,8 +27,8 @@ export const Export = {
28
27
  padding: '0 Y2'
29
28
  },
30
29
 
31
- state: () => ({
32
- ...componentState()[0],
30
+ state: ({ context }) => ({
31
+ ...componentState(context)[0],
33
32
  ...state
34
33
  }),
35
34
 
@@ -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
+ }