@symbo.ls/preview 0.0.12 → 0.0.14

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.12",
5
+ "version": "0.0.14",
6
6
  "repository": "https://github.com/rackai/editor",
7
7
  "main": "src/index.js",
8
8
  "scripts": {
package/src/app.js CHANGED
@@ -13,6 +13,7 @@ import {
13
13
  Export,
14
14
  Library
15
15
  } from './pages'
16
+ import { Modal, openModal } from '@symbo.ls/components'
16
17
 
17
18
  const SUB_ROUTES = {}
18
19
  Object.keys(DesignSystem.routes).map(route => {
@@ -54,12 +55,15 @@ const App = {
54
55
  style: { position: 'relative' }
55
56
  },
56
57
 
58
+ Modal,
59
+
57
60
  on: {
58
61
  render: element => {
59
62
  const { pathname, hash } = window.location
60
63
  const url = pathname + hash
61
64
  router(element, url, {})
62
65
  },
66
+ update: (el, s) => openModal(el, s),
63
67
  scroll: (ev, el) => {
64
68
  const { scrollTop } = el.node
65
69
  const isFloating = scrollTop > 0
@@ -0,0 +1,30 @@
1
+ 'use strict'
2
+
3
+ import { GlobalThemeTemplate, Flex, SectionHeader, Link } from '@symbo.ls/components'
4
+
5
+ export default {
6
+ header: {
7
+ extend: SectionHeader,
8
+ state: {
9
+ title: 'Global Themes',
10
+ p: 'Document styling and theming provides global themes of the entire app, imagine it as a <body> styling'
11
+ }
12
+ },
13
+
14
+ modes: {
15
+ extend: Flex,
16
+ props: { gap: 'A' },
17
+
18
+ childExtend: [GlobalThemeTemplate, Link],
19
+
20
+ $setCollection: () => [{
21
+ title: 'Light',
22
+ key: 'light',
23
+ icon: 'sun'
24
+ }, {
25
+ title: 'Dark',
26
+ key: 'dark',
27
+ icon: 'moon'
28
+ }]
29
+ }
30
+ }
@@ -2,8 +2,8 @@
2
2
 
3
3
  import { Line } from '@symbo.ls/components'
4
4
 
5
- import documentThemes from './documentThemes'
6
- import palette from './colors'
5
+ import globalThemes from './globalThemes'
6
+ import palette from './palette'
7
7
  import themes from './themes'
8
8
 
9
9
  export const Color = {
@@ -12,7 +12,7 @@ export const Color = {
12
12
  gap: '68px'
13
13
  },
14
14
 
15
- documentThemes,
15
+ globalThemes,
16
16
  line: { extend: Line },
17
17
  palette,
18
18
  line2: { extend: Line },
@@ -6,7 +6,7 @@ const mapColors = (el, s) => {
6
6
  if (!el.context.SYSTEM) return
7
7
  const { COLOR } = el.context.SYSTEM
8
8
  const colorKeys = Object.keys(COLOR)
9
- return colorKeys.map(v => COLOR[v])
9
+ return colorKeys.map(v => ({ key: v, ...COLOR[v] }))
10
10
  }
11
11
 
12
12
  export default {
@@ -1,86 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { IconText, Link, Flex, SectionHeader, Grid } from '@symbo.ls/components'
4
-
5
- const style = {
6
- cursor: 'pointer',
7
-
8
- '> *': {
9
- transition: '350ms',
10
- transitionProperty: 'opacity, transform',
11
- opacity: 0.35
12
- },
13
-
14
- '&:hover > *': {
15
- opacity: 1,
16
- transform: 'scale(1.015)'
17
- }
18
- }
19
-
20
- export const ThemeTemplate = {
21
- extend: [Link, Flex],
22
-
23
- props: (el, s) => ({
24
- flow: 'column',
25
- href: `/theme/${s.key}`,
26
- padding: 'A Z1',
27
- fontWeight: '400',
28
- color: 'white',
29
-
30
- colors: {
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],
49
- props: {
50
- align: 'center flex-start',
51
- flex: 1,
52
- padding: 'Z1 A'
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
- })
80
- }
81
- },
82
- title: { text: (el, state) => state.key }
83
- }
3
+ import { ThemeTemplate, SectionHeader, Grid } from '@symbo.ls/components'
84
4
 
85
5
  const mapThemes = (el, s) => {
86
6
  if (!el.context.SYSTEM) return
@@ -105,16 +25,12 @@ export default {
105
25
  content: {
106
26
  extend: Grid,
107
27
  props: {
108
- columns: 'repeat(6, 1fr)',
109
- gap: 'A',
28
+ columns: 'repeat(5, 1fr)',
29
+ gap: 'C2',
110
30
  margin: '0 -Z'
111
31
  },
112
32
 
113
33
  childExtend: ThemeTemplate,
114
- $setCollection: (el, s) => {
115
- const c = mapThemes(el, s)
116
- console.log(c)
117
- return c
118
- }
34
+ $setCollection: (el, s) => mapThemes(el, s)
119
35
  }
120
36
  }
@@ -1,13 +1,14 @@
1
1
  'use strict'
2
2
 
3
- import { Flex, Link, SquareButton } from '@symbo.ls/components'
3
+ import { ClickableItem, Flex, Link, SquareButton } from '@symbo.ls/components'
4
4
  import { PageExtend,
5
5
  Color,
6
6
  ColorEditor,
7
7
  Shapes,
8
8
  Spaces,
9
9
  Icons,
10
- Typography
10
+ Typography,
11
+ Fonts
11
12
  } from '..'
12
13
 
13
14
  const NAV = [{
@@ -23,7 +24,8 @@ const NAV = [{
23
24
  }, {
24
25
  props: {
25
26
  icon: 'space outline',
26
- href: '/space'
27
+ href: '/space',
28
+ opacity: '.55'
27
29
  }
28
30
  }, {
29
31
  props: {
@@ -33,12 +35,21 @@ const NAV = [{
33
35
  }, {
34
36
  props: {
35
37
  icon: 'icons outline colored',
36
- href: '/icons'
38
+ href: '/icons',
39
+ $active: {
40
+ icon: 'icons colored'
41
+ }
42
+ }
43
+ }, {
44
+ props: {
45
+ icon: 'typeface colored',
46
+ href: '/fonts'
37
47
  }
38
48
  }, {
39
49
  props: {
40
50
  icon: 'device mobile half fill',
41
- href: '/responsive'
51
+ href: '/responsive',
52
+ opacity: '.55'
42
53
  }
43
54
  }, {
44
55
  props: {
@@ -59,6 +70,7 @@ export const DesignSystem = {
59
70
  maxWidth: '100%',
60
71
  width: '100%',
61
72
  flow: 'row',
73
+ align: 'flex-start flex-start',
62
74
  gap: 'B1',
63
75
  padding: 'D2 A B1'
64
76
  },
@@ -69,7 +81,7 @@ export const DesignSystem = {
69
81
  '/theme': ColorEditor,
70
82
  // '/theme': Theme,
71
83
  '/typography': Typography,
72
- // '/font': Font,
84
+ '/fonts': Fonts,
73
85
  '/space': Spaces,
74
86
  // '/sequence': Sequence,
75
87
  '/shape': Shapes,
@@ -81,14 +93,22 @@ export const DesignSystem = {
81
93
  sidebar: {
82
94
  tag: 'nav',
83
95
  extend: Flex,
84
- childExtend: [Link, SquareButton],
96
+ childExtend: {
97
+ extend: [ClickableItem, Link, SquareButton],
98
+ props: ({ props }) => ({
99
+ active: props.href === window.location.pathname,
100
+ theme: null
101
+ })
102
+ },
85
103
 
86
104
  props: {
87
105
  gap: 'B1',
88
106
  flow: 'column',
89
107
  background: 'transparent',
90
108
  color: 'gray7',
91
- fontSize: 'A2'
109
+ fontSize: 'A2',
110
+ position: 'sticky',
111
+ top: 'E'
92
112
  },
93
113
 
94
114
  ...NAV
@@ -39,14 +39,9 @@ export default {
39
39
  }
40
40
  }
41
41
  },
42
- comp: (el, s) => {
43
- console.warn(s)
44
- return {
45
- extend: [s.component],
46
- props: {
47
- }
48
- }
49
- },
42
+ comp: (el, s) => ({
43
+ extend: [s.component],
44
+ }),
50
45
 
51
46
  on: {
52
47
  initUpdate: (el, s) => {
@@ -1,7 +1,9 @@
1
1
  'use strict'
2
2
 
3
3
  import { Grid, FontObject, FontFamilyObject, Line } from '@symbo.ls/components'
4
- import { TypeSection } from './shared'
4
+ import { TypeSection } from '../Typography/shared'
5
+
6
+ import { state } from './state'
5
7
 
6
8
  const mapFonts = (el, s) => {
7
9
  if (!el.context.SYSTEM) return
@@ -16,7 +18,7 @@ const mapFonts = (el, s) => {
16
18
 
17
19
  return {
18
20
  title: v,
19
- href: `/typography/document-fonts/font-settings/${v}`,
21
+ href: `/fonts/font-settings/${v}`,
20
22
  labels: [
21
23
  { icon: 'variableFont', text: fontWeightCaption }
22
24
  ]
@@ -34,13 +36,13 @@ const mapFontFamilies = (el, s) => {
34
36
  if (v === 'default') return
35
37
  return {
36
38
  title: v,
37
- href: `/typography/font-family/${v}`,
39
+ href: `/fonts/font-family/${v}`,
38
40
  val
39
41
  }
40
42
  }).filter(v => v)
41
43
  }
42
44
 
43
- const Fonts = {
45
+ const FontFaces = {
44
46
  extend: TypeSection,
45
47
  header: {
46
48
  state: {
@@ -48,7 +50,7 @@ const Fonts = {
48
50
  p: 'Document @font-face, default and backup fonts',
49
51
  nav: [{
50
52
  icon: 'plus',
51
- href: '/typography/upload-font'
53
+ href: '/fonts/upload-font'
52
54
  }]
53
55
  }
54
56
  },
@@ -74,7 +76,7 @@ const FontFamilies = {
74
76
  p: 'Setup a set and fallback fonts as font families',
75
77
  nav: [{
76
78
  icon: 'plus',
77
- href: '/typography/add-font-family'
79
+ href: '/fonts/add-font-family'
78
80
  }]
79
81
  }
80
82
  },
@@ -91,8 +93,10 @@ const FontFamilies = {
91
93
  }
92
94
  }
93
95
 
94
- export default {
95
- Fonts,
96
+ export const Fonts = {
97
+ state,
98
+
99
+ FontFaces,
96
100
  line: { extend: Line },
97
101
  FontFamilies
98
102
  }
@@ -0,0 +1,5 @@
1
+ 'use strict'
2
+
3
+ export const state = {
4
+ sampleText: 'Today is a big day for our tribe. The year ends.'
5
+ }
@@ -1,12 +1,11 @@
1
1
  'use strict'
2
2
 
3
- import { SectionHeader } from '@symbo.ls/components'
3
+ import { SectionHeader } from '@symbo.ls/components' // eslint-disable-line no-unused-vars
4
4
 
5
5
  import state from './state'
6
6
 
7
- import documentFonts from './docFonts'
8
7
  import documentStyle from './docStyles'
9
- import typeScale from './typeScale'
8
+ import { TypeScale } from './typeScale'
10
9
 
11
10
  export const Typography = {
12
11
  define: { routes: param => param },
@@ -14,28 +13,15 @@ export const Typography = {
14
13
  state,
15
14
 
16
15
  routes: {
17
- '/': documentFonts,
18
- '/document-fonts': documentFonts,
19
- '/type-scale': typeScale,
16
+ '/': TypeScale,
20
17
  '/document-styles': documentStyle
21
18
  },
22
19
 
23
- header: {
24
- extend: SectionHeader
25
- },
20
+ // header: {
21
+ // extend: SectionHeader
22
+ // },
26
23
 
27
24
  page: {
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
- }
25
+ TypeScale
40
26
  }
41
27
  }
@@ -1,13 +1,15 @@
1
1
  'use strict'
2
2
 
3
3
  export default {
4
- base: 14,
5
- ratio: 1.125,
6
- scales: {},
7
- range: [-3, +10],
4
+ base: 16,
5
+ ratio: 1.2,
6
+ range: [-3, +8],
8
7
  h1Matches: +6,
8
+ scales: {},
9
9
  sequence: {},
10
- type: 'font-size',
10
+ vars: {},
11
+ // subSequence: true,
12
+ type: 'demo-font-size',
11
13
 
12
14
  title: 'Typography',
13
15
  p: 'A general configuration of type properties on the document.',
@@ -1,101 +1,90 @@
1
1
  'use strict'
2
2
 
3
3
  import {
4
- Flex, Block, Text, Grid,
5
- SequenceGraph,
6
- SliderToolWithCaption,
7
- StaticSpacing,
8
- PreviewSettings,
9
- ScalesSequence,
10
- CommonField
4
+ TypeScaleSequence,
5
+ SequenceSliders
11
6
  } from '@symbo.ls/components'
7
+ import { mapSequence, sortSequence } from '@symbo.ls/utils'
12
8
 
13
9
  import { TypeSection } from './shared'
14
10
 
15
- const ScalingTools = {
16
- extend: Flex,
11
+ export const TypeScale = {
12
+ extend: TypeSection,
17
13
 
18
- props: {
19
- flow: 'column',
20
- gap: 'A2'
14
+ header: {
15
+ state: {
16
+ title: 'TypeScale',
17
+ p: 'Generate text sequence by a base size and ratio'
18
+ }
21
19
  },
22
20
 
23
- fontSize: {
24
- extend: [SliderToolWithCaption],
25
- caption: { text: 'Base size' },
26
- element: {
27
- style: {
28
- maxWidth: `${232 / 16}em`
29
- }
21
+ sliders: { extend: SequenceSliders },
22
+
23
+ p: {
24
+ extend: 'Paragraph',
25
+ props: {
26
+ margin: '0',
27
+ padding: 'B2 0',
28
+ text: `Base size and ratio will sequentially generate set by multiplying each next unit by the ratio.`
30
29
  }
31
30
  },
32
31
 
33
32
  sequence: {
34
- extend: CommonField,
35
- caption: { text: 'Sequence ratio' },
36
- element: {
37
- extend: StaticSpacing,
38
- spacings: {
39
- childExtend: {
40
- on: {
41
- click: (ev, el, s) => s.update({ ratio: el.value.text })
42
- }
43
- }
44
- }
45
- }
33
+ extend: TypeScaleSequence,
34
+ $setCollection: ({ state }) => mapSequence(state, sortSequence)
46
35
  }
47
36
  }
48
37
 
49
- export default {
50
- extend: TypeSection,
38
+ // export default {
39
+ // extend: TypeSection,
51
40
 
52
- header: {
53
- heading: {
54
- p: { props: { text: 'Generate text sequence by a base size and ratio' } }
55
- },
56
- nav: {
57
- add: { props: { icon: 'plus' } }
58
- }
59
- },
41
+ // header: {
42
+ // heading: {
43
+ // p: { props: { text: 'Generate text sequence by a base size and ratio' } }
44
+ // },
45
+ // nav: {
46
+ // add: { props: { icon: 'plus' } }
47
+ // }
48
+ // },
60
49
 
61
- wrapper: {
62
- textTest: '',
63
- fonts: '',
64
-
65
- cnt: {
66
- extend: [Block, Grid],
67
-
68
- props: {
69
- gap: 'D',
70
- columns: '16em auto'
71
- },
72
-
73
- aside: ScalingTools,
74
-
75
- wrapper: {
76
- settings: {
77
- extend: PreviewSettings,
78
- props: { margin: '0 0 B' }
79
- },
80
-
81
- fonts: ScalesSequence
82
- },
83
-
84
- sequenceSet: {
85
- extend: CommonField,
86
- props: { margin: 'C2 0' },
87
- caption: {
88
- extend: [Block, Text],
89
- props: {
90
- text: 'Sizing generated by this setting',
91
- padding: '0 0 A 0'
92
- }
93
- },
94
- element: {
95
- extend: [SequenceGraph, Block, Text],
96
- style: { '> span': { display: 'none' } }
97
- }
98
- }
99
- }
100
- }
101
- }
50
+ // wrapper: {
51
+ // textTest: '',
52
+ // fonts: '',
53
+
54
+ // cnt: {
55
+ // extend: [Block, Grid],
56
+
57
+ // props: {
58
+ // gap: 'D',
59
+ // columns: '16em auto'
60
+ // },
61
+
62
+ // aside: ScalingTools,
63
+
64
+ // wrapper: {
65
+ // settings: {
66
+ // extend: PreviewSettings,
67
+ // props: { margin: '0 0 B' }
68
+ // },
69
+
70
+ // fonts: ScalesSequence
71
+ // },
72
+
73
+ // sequenceSet: {
74
+ // extend: CommonField,
75
+ // props: { margin: 'C2 0' },
76
+ // caption: {
77
+ // extend: [Block, Text],
78
+ // props: {
79
+ // text: 'Sizing generated by this setting',
80
+ // padding: '0 0 A 0'
81
+ // }
82
+ // },
83
+ // element: {
84
+ // extend: [SequenceGraph, Block, Text],
85
+ // style: { '> span': { display: 'none' } }
86
+ // }
87
+ // }
88
+ // }
89
+ // }
90
+ // }
@@ -3,6 +3,7 @@
3
3
  export * from './PageExtend'
4
4
  export * from './Components'
5
5
  export * from './Export'
6
+ export * from './Fonts'
6
7
  export * from './Icons'
7
8
  export * from './Library'
8
9
  export * from './Color'
@@ -1,80 +0,0 @@
1
- 'use strict'
2
-
3
- import { Notification, Flex, ClickableItem, SectionHeader, IconText, Link } from '@symbo.ls/components'
4
-
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
- }
54
-
55
- export default {
56
- header: {
57
- extend: SectionHeader,
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'
61
- }
62
- },
63
-
64
- modes: {
65
- extend: Flex,
66
- props: { gap: 'A' },
67
-
68
- childExtend: [ThemeItem, Link],
69
-
70
- $setCollection: () => [{
71
- title: 'Light',
72
- key: 'light',
73
- icon: 'sun'
74
- }, {
75
- title: 'Dark',
76
- key: 'dark',
77
- icon: 'moon'
78
- }]
79
- }
80
- }