@symbo.ls/preview 0.0.10 → 0.0.12

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,7 +2,7 @@
2
2
  "name": "@symbo.ls/preview",
3
3
  "description": "",
4
4
  "author": "",
5
- "version": "0.0.10",
5
+ "version": "0.0.12",
6
6
  "repository": "https://github.com/rackai/editor",
7
7
  "main": "src/index.js",
8
8
  "scripts": {
package/src/app.js CHANGED
@@ -30,6 +30,7 @@ const App = {
30
30
  key: 'app',
31
31
 
32
32
  state,
33
+
33
34
  props: {
34
35
  theme: 'document',
35
36
  boxSize: '100% 100%',
@@ -0,0 +1,45 @@
1
+ 'use strict'
2
+
3
+ import { Link, Flex, ClickableItem } from '@symbo.ls/components'
4
+
5
+ const ShapeItem = {
6
+ extend: [ClickableItem, Link, Flex],
7
+
8
+ props: el => ({
9
+ href: `/shapes/${el.parent.parent.key}-${el.key}`,
10
+ padding: 'B',
11
+ round: 'Z',
12
+ background: 'white .05',
13
+ alignItems: 'center',
14
+ justifyContent: 'center',
15
+
16
+ _shape: {
17
+ theme: 'quaternary',
18
+ width: 'C',
19
+ height: 'C'
20
+ }
21
+ }),
22
+
23
+ _shape: {}
24
+ }
25
+
26
+ export const ShapeSet = {
27
+ props: {
28
+ label: {
29
+ display: 'block',
30
+ size: 'Y',
31
+ opacity: '.65',
32
+ padding: '0 0 Z 0'
33
+ },
34
+ nav: {
35
+ gap: 'A',
36
+ flexWrap: 'wrap'
37
+ }
38
+ },
39
+
40
+ label: {},
41
+ nav: {
42
+ extend: Flex,
43
+ childExtend: ShapeItem
44
+ }
45
+ }
@@ -1,3 +1,4 @@
1
1
  'use strict'
2
2
 
3
3
  export * from './Header'
4
+ export * from './ShapeSet'
@@ -16,4 +16,4 @@ const PREVIEW_CONF = {
16
16
  }
17
17
  }
18
18
 
19
- init({ verbose: false, ...PREVIEW_CONF })
19
+ export default init({ verbose: false, ...PREVIEW_CONF })
package/src/index.js CHANGED
@@ -11,6 +11,8 @@ import App from './app'
11
11
  import { Header } from './components'
12
12
  import { Library } from './pages'
13
13
 
14
+ import { context } from './state'
15
+
14
16
  smbls.init({ verbose: false, ...SYMBOLS_CONF })
15
17
 
16
18
  DOM.define({
@@ -29,5 +31,6 @@ export default DOM.create({
29
31
  }
30
32
  }, undefined, 'app', {
31
33
  extend: [smbls.Box],
32
- components: { ...smbls }
34
+ components: { ...smbls },
35
+ context
33
36
  })
@@ -1,58 +1,42 @@
1
1
  'use strict'
2
2
 
3
- import { Button, SectionHeader, ColorTemplate } from '@symbo.ls/components'
3
+ import { SectionHeader, ColorTemplate, Flex } from '@symbo.ls/components'
4
+
5
+ const mapColors = (el, s) => {
6
+ if (!el.context.SYSTEM) return
7
+ const { COLOR } = el.context.SYSTEM
8
+ const colorKeys = Object.keys(COLOR)
9
+ return colorKeys.map(v => COLOR[v])
10
+ }
4
11
 
5
12
  export default {
6
- tag: 'section',
7
13
  header: {
8
14
  extend: SectionHeader,
9
- props: { padding: 'C 0 0 0' },
10
- heading: {
11
- caption: 'Color Palette',
12
- p: { text: 'Document styling and theming' }
15
+ state: {
16
+ title: 'Color Palette',
17
+ p: 'Document styling and theming',
18
+ nav: [{
19
+ icon: 'plus',
20
+ href: '/colors/add-color'
21
+ }]
13
22
  }
14
23
  },
15
- nav: {
16
- style: {
17
- display: 'flex',
18
- gap: '1.2em',
24
+
25
+ content: {
26
+ extend: Flex,
27
+ props: {
28
+ gap: 'A1',
19
29
  alignItems: 'center'
20
30
  },
21
31
  colors: {
22
- style: {
23
- display: 'flex',
24
- gap: '12px'
25
- },
26
-
27
- content: (el, s) => {
28
- if (!el.__root.state.CONFIG) return
29
- const { COLOR } = el.__root.state.CONFIG
30
-
31
- const Colors = {}
32
- Object.keys(COLOR).map(v => {
33
- Colors[v] = { state: COLOR[v] }
34
- })
35
-
36
- return {
37
- childExtend: ColorTemplate,
38
- tag: 'fragment',
39
-
40
- ...Colors
41
- }
42
- }
43
- },
44
- plus: {
45
- extend: Button,
32
+ extend: Flex,
46
33
  props: {
47
- round: 8,
48
- icon: 'plus'
34
+ flow: 'row wrap',
35
+ gap: 'Z2'
49
36
  },
50
- style: {
51
- height: `26px`,
52
- width: `26px`,
53
- background: 'rgba(255, 255, 255, .06)',
54
- color: 'white'
55
- }
37
+
38
+ childExtend: ColorTemplate,
39
+ $setCollection: mapColors
56
40
  }
57
41
  }
58
42
  }
@@ -1,101 +1,80 @@
1
1
  'use strict'
2
2
 
3
- import { Notification, Flex, ClickableItem, SectionHeader, Shape, Block, IconText, Link } from '@symbo.ls/components'
3
+ import { Notification, Flex, ClickableItem, SectionHeader, IconText, Link } from '@symbo.ls/components'
4
4
 
5
- // import { SectionHeader } from 'components/Header'
5
+ const ThemeItem = {
6
+ extend: [Notification, ClickableItem],
7
+
8
+ // if: ({ context, state }) => {
9
+ // if (!context?.SYSTEM) return
10
+ // const { THEME } = context.SYSTEM
11
+ // console.log(!!THEME.document[`@${state.key}`])
12
+ // return !!THEME.document[`@${state.key}`]
13
+ // },
14
+
15
+ props: ({ state }) => ({
16
+ opacity: '.5',
17
+ textDecoration: 'none',
18
+ gap: 'Z',
19
+ round: 'Z',
20
+ padding: 'Z1 D2 A A1',
21
+ theme: `document @${state.key}`,
22
+ fontWeight: '400',
23
+ href: `/colors/document-theme/${state.key}`,
24
+
25
+ icon: {
26
+ size: 'Z',
27
+ padding: 'Z',
28
+ round: 'Z',
29
+ theme: `sepia @${state.key}`,
30
+ icon: state.icon
31
+ },
32
+ article: {
33
+ gap: 'X',
34
+ title: {
35
+ size: 'B'
36
+ },
37
+ p: {
38
+ fontSize: 'Y',
39
+ text: state.key
40
+ }
41
+ }
42
+ }),
43
+
44
+ icon: { extend: IconText },
45
+ article: {
46
+ title: {
47
+ text: ({ state }) => state.title
48
+ },
49
+ p: {
50
+ span: ({ state }) => 'prefers-color-scheme: '
51
+ }
52
+ }
53
+ }
6
54
 
7
55
  export default {
8
- tag: 'section',
9
56
  header: {
10
57
  extend: SectionHeader,
11
- props: { padding: 'C 0 0 0' },
12
- heading: {
13
- caption: 'Document',
14
- p: { text: 'Document styling and theming provides global themes of the entire app, imagine it as a <body> styling' }
58
+ state: {
59
+ title: 'Global Themes',
60
+ p: 'Document styling and theming provides global themes of the entire app, imagine it as a <body> styling'
15
61
  }
16
62
  },
17
63
 
18
- mode: {
64
+ modes: {
19
65
  extend: Flex,
20
- tag: 'nav',
66
+ props: { gap: 'A' },
21
67
 
22
- style: {
23
- gap: 16
24
- },
25
-
26
- childExtend: {
27
- extend: [Notification, ClickableItem, Link],
28
- style: {
29
- opacity: '.5',
30
- textDecoration: 'none'
31
- },
32
- props: {
33
- gap: 'Z',
34
- round: 'Z',
35
- padding: 'Z1 D2 A A1',
36
- href: '/colors/documentThemes/addit-theme'
37
- },
38
- icon: {
39
- extend: [Shape, Block, IconText],
40
- props: {
41
- size: 'Z',
42
- padding: 'Z',
43
- round: 'Z'
44
- }
45
- },
46
- article: {
47
- props: { gap: 'X' },
48
- caption: {
49
- style: { fontWeight: 'bold' },
50
- props: { size: 'B' }
51
- },
52
- p: {
53
- props: { size: 'Y' },
54
- style: { '> span': { fontWeight: 'bold' } }
55
- }
56
- }
57
- },
68
+ childExtend: [ThemeItem, Link],
58
69
 
59
- ...[
60
- {
61
- props: el => {
62
- if (!el.__root.state.CONFIG) return
63
- const { THEME } = el.__root.state.CONFIG
64
- return { theme: THEME.document.value }
65
- },
66
- icon: {
67
- props: { theme: 'lightMode', icon: 'sun' }
68
- },
69
- article: {
70
- caption: { text: 'Light' },
71
- p: {
72
- text: 'prefers-color-scheme:',
73
- span: ' Light'
74
- }
75
- }
76
- }, {
77
- if: el => {
78
- if (!el.__root.state.CONFIG) return
79
- const { THEME } = el.__root.state.CONFIG
80
- return THEME.document.variants && THEME.document.variants.dark
81
- },
82
- props: el => {
83
- if (!el.__root.state.CONFIG) return
84
- const { THEME } = el.__root.state.CONFIG
85
- return { theme: THEME.document.value }
86
- },
87
- style: { color: 'white' },
88
- icon: {
89
- props: { theme: 'darkMode', icon: 'moon' }
90
- },
91
- article: {
92
- caption: { text: 'Dark' },
93
- p: {
94
- text: 'prefers-color-scheme:',
95
- span: ' Dark'
96
- }
97
- }
98
- }
99
- ]
70
+ $setCollection: () => [{
71
+ title: 'Light',
72
+ key: 'light',
73
+ icon: 'sun'
74
+ }, {
75
+ title: 'Dark',
76
+ key: 'dark',
77
+ icon: 'moon'
78
+ }]
100
79
  }
101
80
  }
@@ -1,20 +1,20 @@
1
1
  'use strict'
2
2
 
3
- import style from './style'
3
+ import { Line } from '@symbo.ls/components'
4
4
 
5
- import { PageExtend } from '..'
6
-
7
- import palette from './colors'
8
5
  import documentThemes from './documentThemes'
6
+ import palette from './colors'
9
7
  import themes from './themes'
10
8
 
11
9
  export const Color = {
12
- style,
13
10
  key: 'colors',
14
-
15
- extend: [PageExtend],
11
+ props: {
12
+ gap: '68px'
13
+ },
16
14
 
17
15
  documentThemes,
16
+ line: { extend: Line },
18
17
  palette,
18
+ line2: { extend: Line },
19
19
  themes
20
20
  }
@@ -1,19 +1,9 @@
1
1
  'use strict'
2
2
 
3
- import { COLOR, opacify } from '@symbo.ls/scratch'
4
- import { Block, IconText, Link, Shape, Text, Flex, SectionHeader } from '@symbo.ls/components'
3
+ import { IconText, Link, Flex, SectionHeader, Grid } from '@symbo.ls/components'
5
4
 
6
5
  const style = {
7
- width: '100%',
8
- maxWidth: '25%',
9
- flex: '.25 .3333 25%',
10
6
  cursor: 'pointer',
11
- color: 'white',
12
- textDecoration: 'none',
13
- boxSizing: 'border-box',
14
- caption: {
15
- marginTop: `${12 / 13}em`
16
- },
17
7
 
18
8
  '> *': {
19
9
  transition: '350ms',
@@ -28,104 +18,103 @@ const style = {
28
18
  }
29
19
 
30
20
  export const ThemeTemplate = {
31
- extend: [Link, Block],
32
- style,
21
+ extend: [Link, Flex],
33
22
 
34
- props: (el) => ({
35
- href: `/theme/${el.key}`,
36
- padding: 'A Z1'
37
- }),
23
+ props: (el, s) => ({
24
+ flow: 'column',
25
+ href: `/theme/${s.key}`,
26
+ padding: 'A Z1',
27
+ fontWeight: '400',
28
+ color: 'white',
38
29
 
39
- theme: {
40
30
  colors: {
41
- extend: [Block, Text, Shape, Flex],
31
+ margin: '0 -Z',
32
+ round: 'A2',
33
+ overflow: 'hidden'
34
+ },
35
+
36
+ title: {
37
+ size: 'Y',
38
+ margin: 'Z 0 0 0'
39
+ },
40
+
41
+ style
42
+ }),
43
+
44
+ colors: {
45
+ extend: Flex,
46
+
47
+ childExtend: {
48
+ extend: [IconText, Flex],
42
49
  props: {
43
- round: 'Z1'
44
- },
45
-
46
- style: {
47
- boxShadow: `${COLOR.blue && opacify(COLOR.blue.value, 0.2)} 0 2px 35px`,
48
- overflow: 'hidden',
49
- div: {
50
- flex: 1,
51
- display: 'flex',
52
- alignItems: 'center'
53
- }
54
- },
55
- _icon: '',
56
- sun: {
57
- extend: [Shape, Block, IconText, Flex],
58
- props: {
59
- icon: 'sun',
60
- size: 'Z',
61
- padding: 'Z1 0 Z1 A',
62
- round: 'Z1 0 0 Z1'
63
- },
64
- style: (element, state) => ({
65
- background: state.background,
66
- color: state.color,
67
- borderBottomLeftRadius: '12px',
68
- '&:only-child': {
69
- borderRadius: 12
70
- }
71
- })
72
- },
73
- moon: {
74
- if: (el, state) => state.themes,
75
- extend: [Shape, Block, IconText, Flex],
76
- props: {
77
- theme: 'secondary',
78
- padding: 'Z1 0 Z1 A',
79
- icon: 'moon',
80
- round: '0 Z1 Z1 0'
81
- },
82
- style: (element, state) => ({
83
- background: '', // state.themes.dark.backgroundColor,
84
- color: '' // state.themes.dark.color
85
- })
50
+ align: 'center flex-start',
51
+ flex: 1,
52
+ padding: 'Z1 A'
86
53
  }
54
+ },
55
+
56
+ just: {
57
+ if: (el, s) => !s['@dark'] && !s['@light'],
58
+ props: (el, s) => ({
59
+ theme: s.key,
60
+ height: 'A',
61
+ boxSizing: 'content-box',
62
+ padding: 'Z1 A'
63
+ })
64
+ },
65
+
66
+ sun: {
67
+ if: (el, s) => s['@light'],
68
+ props: (el, s) => ({
69
+ icon: { name: 'sun' },
70
+ theme: `${s.key} @light`
71
+ })
72
+ },
73
+
74
+ moon: {
75
+ if: (el, s) => s['@dark'],
76
+ props: (el, s) => ({
77
+ theme: `${s.key} @dark`,
78
+ icon: { name: 'moon' }
79
+ })
87
80
  }
88
81
  },
89
- caption: {
90
- extend: [Block, Text],
91
- props: {
92
- size: 'Y',
93
- padding: 'Z 0 0 0'
94
- },
95
- text: (el, state) => el.parent.key
96
- }
82
+ title: { text: (el, state) => state.key }
83
+ }
84
+
85
+ const mapThemes = (el, s) => {
86
+ if (!el.context.SYSTEM) return
87
+ const { THEME } = el.context.SYSTEM
88
+ const themeKeys = Object.keys(THEME)
89
+ return themeKeys.map(v => ({ ...THEME[v], key: v }))
97
90
  }
98
91
 
99
92
  export default {
100
- tag: 'section',
101
93
  header: {
102
94
  extend: SectionHeader,
103
- props: { padding: 'C 0 0 0' },
104
- heading: {
105
- caption: 'Theme',
106
- p: { text: 'Themes are used to prepare color setting abstractly and apply it to any component' }
95
+ state: {
96
+ title: 'Themes',
97
+ p: 'Themes are used to prepare color setting abstractly and apply it to any component',
98
+ nav: [{
99
+ icon: 'plus',
100
+ href: '/colors/add-color'
101
+ }]
107
102
  }
108
103
  },
109
- colors: {
110
- style: {
111
- display: 'flex',
112
- flexWrap: 'wrap',
113
- margin: '0 -16px'
114
- },
115
-
116
- content: (el, s) => {
117
- if (!el.__root.state.CONFIG) return
118
- const { THEME } = el.__root.state.CONFIG
119
-
120
- const Themes = {}
121
- Object.keys(THEME).map(v => (Themes[v] = { state: THEME[v].value }))
122
104
 
123
- return {
124
- childExtend: ThemeTemplate,
125
- tag: 'fragment',
105
+ content: {
106
+ extend: Grid,
107
+ props: {
108
+ columns: 'repeat(6, 1fr)',
109
+ gap: 'A',
110
+ margin: '0 -Z'
111
+ },
126
112
 
127
- ...Themes
128
- }
113
+ childExtend: ThemeTemplate,
114
+ $setCollection: (el, s) => {
115
+ const c = mapThemes(el, s)
116
+ console.log(c)
117
+ return c
129
118
  }
130
119
  }
131
120
  }
@@ -127,13 +127,13 @@ export const ColorEditor = {
127
127
 
128
128
  on: {
129
129
  init: (el, s) => {
130
- if (!el.__root || !el.__root.state.CONFIG) return
130
+ if (!el.context.SYSTEM) return
131
131
 
132
132
  var route = window.location.pathname
133
133
  var routes = route.slice(1).split('/')
134
134
  var param = routes[1]
135
135
 
136
- const { THEME } = el.__root.state.CONFIG
136
+ const { THEME } = el.context.SYSTEM
137
137
  var content = THEME[`${param}`].value
138
138
  content.title = param
139
139
  el.state.value = content
@@ -1,121 +1,19 @@
1
1
  'use strict'
2
2
 
3
- import { styleShapeSet } from './style'
3
+ import { Flex, SectionHeader, Line } from '@symbo.ls/components'
4
4
 
5
- import { Link, Flex, SectionHeader, ClickableItem } from '@symbo.ls/components'
6
-
7
- const ShapeItem = {
8
- extend: [ClickableItem, Link, Flex],
9
-
10
- props: el => ({
11
- href: `/shapes/${el.parent.parent.key}-${el.key}`,
12
- padding: 'B',
13
- round: 'Z'
14
- }),
15
-
16
- _shape: {
17
- props: {
18
- theme: 'quaternary',
19
- width: 'C',
20
- height: 'C'
21
- }
22
- }
23
- }
24
-
25
- const ShapeSet = {
26
- style: styleShapeSet,
27
- label: {
28
- props: {
29
- display: 'block',
30
- size: 'Y',
31
- padding: '0 0 Z 0'
32
- }
33
- },
34
- nav: {
35
- extend: Flex,
36
- props: { gap: 'Z1' },
37
- childExtend: ShapeItem
38
- }
39
- }
40
-
41
- const rectangle = {
42
- extend: ShapeSet,
43
- label: {
44
- text: 'Rectangle ',
45
- span: 'with rounds'
46
- },
47
- nav: [
48
- {},
49
- { _shape: { props: { round: 4 } } },
50
- { _shape: { props: { round: 6 } } },
51
- { _shape: { props: { round: 10 } } },
52
- { _shape: { props: { round: 12 } } },
53
- { _shape: { props: { round: 16 } } },
54
- { _shape: { props: { round: 26 } } }
55
- ]
56
- }
57
-
58
- const circle = {
59
- extend: ShapeSet,
60
- label: { text: 'Circle' },
61
- nav: [{
62
- _shape: { props: { shape: 'circle' } }
63
- }]
64
- }
65
-
66
- const toolTip = {
67
- extend: ShapeSet,
68
- label: { text: 'Tooltip' },
69
- nav: {
70
- childExtend: {
71
- childExtend: { props: { round: 'Y1' } }
72
- },
73
-
74
- ...[
75
- { _shape: { props: { shape: 'tooltip', shapeDirection: 'top left' } } },
76
- { _shape: { props: { shape: 'tooltip', shapeDirection: 'top center' } } },
77
- { _shape: { props: { shape: 'tooltip', shapeDirection: 'right' } } },
78
- { _shape: { props: { shape: 'tooltip', shapeDirection: 'bottom' } } }
79
- ]
80
- }
81
- }
82
-
83
- const tagShape = {
84
- extend: ShapeSet,
85
- label: { text: 'Tag' },
86
- nav: {
87
- childExtend: {
88
- childExtend: { props: { round: 6 } }
89
- },
90
- ...[
91
- { _shape: { props: { shape: 'tag', shapeDirection: 'left' } } },
92
- { _shape: { props: { shape: 'tag', shapeDirection: 'top' } } },
93
- { _shape: { props: { shape: 'tag', shapeDirection: 'right' } } },
94
- { _shape: { props: { shape: 'tag', shapeDirection: 'bottom' } } }
95
- ]
96
- }
97
- }
98
-
99
- const bubble = {
100
- extend: ShapeSet,
101
- label: { text: 'Bubble' },
102
- nav: [
103
- { _shape: { props: { round: 'X B B X' } } },
104
- { _shape: { props: { round: 'B X X B' } } },
105
- { _shape: { props: { round: 'X X B B' } } },
106
- { _shape: { props: { round: 'B B X X' } } },
107
- { _shape: { props: { round: 'B X X X' } } },
108
- { _shape: { props: { round: 'X B X X' } } },
109
- { _shape: { props: { round: 'X X B X' } } },
110
- { _shape: { props: { round: 'X X X B' } } }
111
- ]
112
- }
5
+ import {
6
+ rectangle,
7
+ circle,
8
+ toolTip,
9
+ tagShape,
10
+ bubble
11
+ } from './shapeSet'
113
12
 
114
13
  export const Shapes = {
115
14
  extend: Flex,
116
15
  props: {
117
- flow: 'column',
118
- gap: 'F'
16
+ flow: 'column'
119
17
  },
120
18
 
121
19
  childExtend: {
@@ -123,9 +21,12 @@ export const Shapes = {
123
21
  props: {
124
22
  gap: 'A',
125
23
  flow: 'column',
24
+ header: {
25
+ margin: '- - A2'
26
+ },
126
27
  section: {
127
28
  flow: 'row wrap',
128
- gap: 'A'
29
+ gap: 'A2'
129
30
  }
130
31
  },
131
32
  section: { extend: Flex }
@@ -149,12 +50,14 @@ export const Shapes = {
149
50
  }
150
51
  },
151
52
 
53
+ line: { extend: Line },
54
+
152
55
  svgShapes: {
153
56
  header: {
154
57
  extend: SectionHeader,
155
58
  heading: {
156
59
  title: 'SVG Shapes',
157
- p: 'TBA...'
60
+ p: 'TBA'
158
61
  }
159
62
  }
160
63
  }
@@ -0,0 +1,76 @@
1
+ 'use strict'
2
+
3
+ import { ShapeSet } from '../../components'
4
+
5
+ export const rectangle = {
6
+ extend: ShapeSet,
7
+ label: {
8
+ text: 'Rectangle ',
9
+ span: 'with rounds'
10
+ },
11
+ nav: [
12
+ {},
13
+ { _shape: { props: { round: 4 } } },
14
+ { _shape: { props: { round: 6 } } },
15
+ { _shape: { props: { round: 10 } } },
16
+ { _shape: { props: { round: 12 } } },
17
+ { _shape: { props: { round: 16 } } },
18
+ { _shape: { props: { round: 26 } } }
19
+ ]
20
+ }
21
+
22
+ export const circle = {
23
+ extend: ShapeSet,
24
+ label: { text: 'Circle' },
25
+ nav: [{
26
+ _shape: { props: { shape: 'circle' } }
27
+ }]
28
+ }
29
+
30
+ export const toolTip = {
31
+ extend: ShapeSet,
32
+ label: { text: 'Tooltip' },
33
+ nav: {
34
+ childExtend: {
35
+ childExtend: { props: { round: 'Y1' } }
36
+ },
37
+
38
+ ...[
39
+ { _shape: { props: { shape: 'tooltip', shapeDirection: 'top left' } } },
40
+ { _shape: { props: { shape: 'tooltip', shapeDirection: 'top center' } } },
41
+ { _shape: { props: { shape: 'tooltip', shapeDirection: 'right' } } },
42
+ { _shape: { props: { shape: 'tooltip', shapeDirection: 'bottom' } } }
43
+ ]
44
+ }
45
+ }
46
+
47
+ export const tagShape = {
48
+ extend: ShapeSet,
49
+ label: { text: 'Tag' },
50
+ nav: {
51
+ childExtend: {
52
+ childExtend: { props: { round: 6 } }
53
+ },
54
+ ...[
55
+ { _shape: { props: { shape: 'tag', shapeDirection: 'left' } } },
56
+ { _shape: { props: { shape: 'tag', shapeDirection: 'top' } } },
57
+ { _shape: { props: { shape: 'tag', shapeDirection: 'right' } } },
58
+ { _shape: { props: { shape: 'tag', shapeDirection: 'bottom' } } }
59
+ ]
60
+ }
61
+ }
62
+
63
+ export const bubble = {
64
+ extend: ShapeSet,
65
+ label: { text: 'Bubble' },
66
+ nav: [
67
+ { _shape: { props: { round: 'X B B X' } } },
68
+ { _shape: { props: { round: 'B X X B' } } },
69
+ { _shape: { props: { round: 'X X B B' } } },
70
+ { _shape: { props: { round: 'B B X X' } } },
71
+ { _shape: { props: { round: 'B X X X' } } },
72
+ { _shape: { props: { round: 'X B X X' } } },
73
+ { _shape: { props: { round: 'X X B X' } } },
74
+ { _shape: { props: { round: 'X X X B' } } }
75
+ ]
76
+ }
@@ -1,22 +1,5 @@
1
1
  'use strict'
2
2
 
3
- export const styleShapeSet = {
4
- label: {
5
- display: 'block',
6
- opacity: '.65',
7
- span: { opacity: '.2' }
8
- },
9
- nav: {
10
- flexWrap: 'wrap',
11
- a: {
12
- cursor: 'pointer',
13
- background: 'rgba(255, 255, 255, .05)',
14
- alignItems: 'center',
15
- justifyContent: 'center'
16
- }
17
- }
18
- }
19
-
20
3
  export const styleUploadSVG = {
21
4
  div: {
22
5
  background: 'rgba(255, 255, 255, .05)',
@@ -1,7 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { Link, TabHeader } from '@symbo.ls/components'
4
- import { PageExtend } from '..'
3
+ import { SectionHeader } from '@symbo.ls/components'
5
4
 
6
5
  import preview from './preview'
7
6
  import sequence from './sequence'
@@ -10,11 +9,12 @@ import boxModel from './boxModel'
10
9
  export const Spaces = {
11
10
  key: 'spaces',
12
11
 
13
- extend: PageExtend,
14
-
15
12
  state: {
16
13
  activePage: 'spaces',
17
- activeTab: 'preview'
14
+ activeTab: 'preview',
15
+
16
+ title: 'Spacing',
17
+ p: 'Unlike typography, component may has the properties of padding, gap, width and rest.'
18
18
  },
19
19
 
20
20
  define: { routes: param => param },
@@ -34,20 +34,7 @@ export const Spaces = {
34
34
  },
35
35
 
36
36
  header: {
37
- extend: TabHeader,
38
- style: {
39
- margin: `${42 / 16}em -2em 2em -2em`,
40
- paddingLeft: '2em'
41
- },
42
- tabs: {
43
- childExtend: {
44
- extend: [Link]
45
- },
46
-
47
- preview: { props: { text: 'Spacing Preview' } }
48
- // sequence: { props: { text: 'Sequence' } },
49
- // boxModel: { props: { text: 'Box Model' } }
50
- }
37
+ extend: SectionHeader
51
38
  },
52
39
 
53
40
  preview
@@ -1,12 +1,11 @@
1
1
  'use strict'
2
2
 
3
- import { Block, Grid, FontObject, Link, SectionHeader, FontFamilyObject } from '@symbo.ls/components'
3
+ import { Grid, FontObject, FontFamilyObject, Line } from '@symbo.ls/components'
4
4
  import { TypeSection } from './shared'
5
5
 
6
6
  const mapFonts = (el, s) => {
7
- if (!el.__root.state.CONFIG) return
8
- const { FONT } = el.__root.state.CONFIG
9
-
7
+ if (!el.context.SYSTEM) return
8
+ const { FONT } = el.context.SYSTEM
10
9
  const fontKeys = Object.keys(FONT)
11
10
 
12
11
  return fontKeys.map(v => {
@@ -16,113 +15,84 @@ const mapFonts = (el, s) => {
16
15
  const fontWeightCaption = weights[0] === 'variable' ? 'variable' : `${weightsLength} style${weightsLength > 1 ? 's' : ''}`
17
16
 
18
17
  return {
19
- props: {
20
- href: `/typography/document-fonts/font-settings/${v}`,
21
- fontTitle: v
22
- },
23
-
24
- caption: {},
25
- p: {},
26
- description: [
27
- { props: { icon: 'variableFont', text: fontWeightCaption } }
18
+ title: v,
19
+ href: `/typography/document-fonts/font-settings/${v}`,
20
+ labels: [
21
+ { icon: 'variableFont', text: fontWeightCaption }
28
22
  ]
29
23
  }
30
24
  })
31
25
  }
32
26
 
33
- const line = {
34
- extend: Block,
35
- props: {
36
- margin: 'D 0'
37
- },
38
- style: {
39
- height: '.2px',
40
- background: 'rgba(255, 255, 255, .1)',
41
- marginLeft: '-100%',
42
- marginRight: '-100%'
43
- }
27
+ const mapFontFamilies = (el, s) => {
28
+ if (!el.context.SYSTEM) return
29
+ const { FONT_FAMILY } = el.context.SYSTEM
30
+ const fontFamilyKeys = Object.keys(FONT_FAMILY)
31
+
32
+ return fontFamilyKeys.map(v => {
33
+ const val = FONT_FAMILY[v]
34
+ if (v === 'default') return
35
+ return {
36
+ title: v,
37
+ href: `/typography/font-family/${v}`,
38
+ val
39
+ }
40
+ }).filter(v => v)
44
41
  }
45
42
 
46
- const fontFamilies = {
47
- extend: Block,
48
- props: { padding: '0 0 E 0' },
43
+ const Fonts = {
44
+ extend: TypeSection,
49
45
  header: {
50
- extend: SectionHeader,
51
- heading: {
52
- caption: { props: { text: 'Font Families' } },
53
- p: { props: { text: 'Setup a set and fallback fonts as font FAMILIES' } }
46
+ state: {
47
+ title: 'Document Fonts',
48
+ p: 'Document @font-face, default and backup fonts',
49
+ nav: [{
50
+ icon: 'plus',
51
+ href: '/typography/upload-font'
52
+ }]
54
53
  }
55
54
  },
55
+
56
56
  content: {
57
57
  extend: Grid,
58
58
  props: {
59
- flexAlign: 'center space-between',
60
- columns: 'repeat(3, 1fr)',
61
- gap: 'Z'
62
- },
63
- childExtend: {
64
- extend: [FontFamilyObject, Link],
65
- props: { href: '/typography/document-fonts/font-family' },
66
- style: { textDecoration: 'none' }
59
+ columns: 'repeat(2, 1fr)',
60
+ gap: 'A',
61
+ margin: '0 -Z'
67
62
  },
68
-
69
- content: el => {
70
- if (!el.__root.state.CONFIG) return
71
- const { FONT_FAMILY } = el.__root.state.CONFIG
72
-
73
- const FAMILIES = Object.keys(FONT_FAMILY).map(v => {
74
- const val = FONT_FAMILY[v]
75
- if (v === 'default') return null
76
- return {
77
- caption: { props: { text: v } },
78
- p: { props: { text: val.value } }
79
- }
80
- })
81
-
82
- return {
83
- tag: 'fragment',
84
- ...FAMILIES
85
- }
86
- }
63
+ childExtend: FontObject,
64
+ $setCollection: mapFonts
87
65
  }
88
66
  }
89
67
 
90
- export default {
68
+ const FontFamilies = {
91
69
  extend: TypeSection,
70
+ props: { padding: '0 0 E 0' },
92
71
  header: {
93
- extend: Block,
94
- heading: {
95
- p: { props: { text: 'Document @font-face, default and backup fonts' } }
96
- },
97
- nav: {
98
- add: {
99
- extend: Link,
100
- props: {
101
- icon: 'plus',
102
- href: '/typography/document-fonts/upload-font'
103
- }
104
- }
72
+ state: {
73
+ title: 'Font Families',
74
+ p: 'Setup a set and fallback fonts as font families',
75
+ nav: [{
76
+ icon: 'plus',
77
+ href: '/typography/add-font-family'
78
+ }]
105
79
  }
106
80
  },
107
-
108
- wrapper: {
109
- fonts: {
110
- extend: Grid,
111
- props: {
112
- columns: 'repeat(2, 1fr)',
113
- gap: 'A'
114
- },
115
-
116
- childExtend: FontObject,
117
-
118
- content: (el, s) => {
119
- return {
120
- tag: 'fragment',
121
- ...mapFonts(el, s)
122
- }
123
- }
81
+ content: {
82
+ extend: Grid,
83
+ props: {
84
+ columns: 'repeat(3, 1fr)',
85
+ gap: 'A',
86
+ margin: '0 -Z'
124
87
  },
125
- line,
126
- fontFamilies
88
+
89
+ childExtend: FontFamilyObject,
90
+ $setCollection: mapFontFamilies
127
91
  }
128
92
  }
93
+
94
+ export default {
95
+ Fonts,
96
+ line: { extend: Line },
97
+ FontFamilies
98
+ }
@@ -13,8 +13,11 @@ export default {
13
13
  extend: TypeSection,
14
14
 
15
15
  header: {
16
+ state: {
17
+ p: 'Document styling and theming provides global themes of the entire app, imagine it as a :root styling'
18
+ },
16
19
  heading: {
17
- p: { props: { text: 'Document styling and theming provides global themes of the entire app, imagine it as a :root styling' } }
20
+ title: null
18
21
  },
19
22
  nav: {
20
23
  add: {
@@ -1,10 +1,7 @@
1
1
  'use strict'
2
2
 
3
- import PageExtend from '../PageExtend'
3
+ import { SectionHeader } from '@symbo.ls/components'
4
4
 
5
- import { Link, TabHeader } from '@symbo.ls/components'
6
-
7
- import style from './style'
8
5
  import state from './state'
9
6
 
10
7
  import documentFonts from './docFonts'
@@ -12,41 +9,33 @@ import documentStyle from './docStyles'
12
9
  import typeScale from './typeScale'
13
10
 
14
11
  export const Typography = {
15
- extend: PageExtend,
16
-
17
- on: {
18
- init: (el, s) => {
19
- const route = window.location.pathname
20
- const routes = route.slice(1).split('/')
21
- s.activeTab = routes[1] || state.activeTab
22
- }
23
- },
24
-
25
12
  define: { routes: param => param },
26
13
 
27
- style,
28
14
  state,
29
15
 
30
16
  routes: {
31
- 'document-fonts': documentFonts,
32
- 'type-scale': typeScale,
33
- 'document-styles': documentStyle
17
+ '/': documentFonts,
18
+ '/document-fonts': documentFonts,
19
+ '/type-scale': typeScale,
20
+ '/document-styles': documentStyle
34
21
  },
35
22
 
36
23
  header: {
37
- extend: TabHeader,
38
- style: {
39
- paddingLeft: '2em'
40
- },
41
- tabs: {
42
- childExtend: { extend: [Link] },
43
- 'document-fonts': { props: { text: 'Document Fonts' } },
44
- 'type-scale': { props: { text: 'Type Scale' } },
45
- 'document-styles': { props: { text: 'Document Styles' } }
46
- }
24
+ extend: SectionHeader
47
25
  },
48
26
 
49
27
  page: {
50
- content: (el, s) => ({ extend: el.parent.routes[s.activeTab] })
28
+ content: (el, s) => {
29
+ const content = el.parent?.routes['/' + s.activeTab]
30
+ return { extend: content }
31
+ }
32
+ },
33
+
34
+ on: {
35
+ init: (el, s) => {
36
+ const route = window.location.pathname
37
+ const routes = route.slice(1).split('/')
38
+ s.activeTab = routes[1] || state.activeTab
39
+ }
51
40
  }
52
41
  }
@@ -4,7 +4,6 @@ import { SectionHeader } from '@symbo.ls/components'
4
4
 
5
5
  export const TypeSection = {
6
6
  header: {
7
- extend: SectionHeader,
8
- heading: { caption: null }
7
+ extend: SectionHeader
9
8
  }
10
9
  }
@@ -9,7 +9,9 @@ export default {
9
9
  sequence: {},
10
10
  type: 'font-size',
11
11
 
12
+ title: 'Typography',
13
+ p: 'A general configuration of type properties on the document.',
14
+
12
15
  sampleText: 'Today is a big day for our tribe. The year ends.',
13
- activePage: 'typography',
14
- activeTab: 'documentFonts'
16
+ activeTab: ''
15
17
  }
@@ -1,7 +1,5 @@
1
1
  'use strict'
2
2
 
3
- import { styleTypeScale } from './style'
4
-
5
3
  import {
6
4
  Flex, Block, Text, Grid,
7
5
  SequenceGraph,
@@ -49,7 +47,6 @@ const ScalingTools = {
49
47
  }
50
48
 
51
49
  export default {
52
- style: styleTypeScale,
53
50
  extend: TypeSection,
54
51
 
55
52
  header: {
package/src/state.js CHANGED
@@ -1,7 +1,13 @@
1
1
  'use strict'
2
2
 
3
+ import SYSTEM from './config'
3
4
  import { LIBRARY } from '../.symbols'
4
5
 
5
6
  export const state = {
6
- LIBRARY
7
+ globalTheme: 'dark'
8
+ }
9
+
10
+ export const context = {
11
+ LIBRARY,
12
+ SYSTEM
7
13
  }
@@ -1,7 +0,0 @@
1
- 'use strict'
2
-
3
- export default {
4
- display: 'flex',
5
- flexDirection: 'column',
6
- gap: '68px',
7
- }
@@ -1,11 +0,0 @@
1
- 'use strict'
2
-
3
- export const styleTypeScale = {
4
- }
5
-
6
- export default {
7
- '> div header': {
8
- lineHeight: '2em'
9
- },
10
- p: { margin: 0 }
11
- }