@symbo.ls/preview 0.0.11 → 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.11",
5
+ "version": "0.0.12",
6
6
  "repository": "https://github.com/rackai/editor",
7
7
  "main": "src/index.js",
8
8
  "scripts": {
@@ -6,9 +6,6 @@ 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
- Object.keys(COLOR).map(v => {
10
- })
11
-
12
9
  return colorKeys.map(v => COLOR[v])
13
10
  }
14
11
 
@@ -14,6 +14,7 @@ export const Color = {
14
14
 
15
15
  documentThemes,
16
16
  line: { extend: Line },
17
- palette
18
- // themes
17
+ palette,
18
+ line2: { extend: Line },
19
+ themes
19
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.context.SYSTEM) return
118
- const { THEME } = el.context.SYSTEM
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
  }