@symbo.ls/preview 0.0.88 → 0.0.90

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.88",
5
+ "version": "0.0.90",
6
6
  "repository": "https://github.com/rackai/editor",
7
7
  "main": "src/index.js",
8
8
  "scripts": {
@@ -27,7 +27,7 @@
27
27
  "@domql/tags": "latest",
28
28
  "@symbo.ls/cli": "^0.6.23",
29
29
  "@symbo.ls/components": "latest",
30
- "@symbo.ls/config": "latest",
30
+ "@symbo.ls/config": "^1.0.60",
31
31
  "@symbo.ls/config-default": "^1.0.1",
32
32
  "@symbo.ls/icons": "latest",
33
33
  "@symbo.ls/init": "^1.1.3",
@@ -1,7 +1,8 @@
1
1
  'use strict'
2
2
 
3
3
  import { Flex } from '@symbo.ls/components'
4
- import { SpacingPropButton, SPACING_BUTTONS } from '../../components'
4
+ import { SpacingButton } from '..'
5
+ import { SPACING_BUTTONS } from './props'
5
6
 
6
7
  export const setTableButtons = ({ state }) =>
7
8
  Object.keys(SPACING_BUTTONS).filter(v => {
@@ -35,7 +36,6 @@ export default {
35
36
  ':hover': { opacity: '1' }
36
37
  },
37
38
 
38
- childExtend: SpacingPropButton,
39
-
39
+ childExtend: SpacingButton,
40
40
  $setStateCollection: setTableButtons
41
41
  }
@@ -11,9 +11,9 @@ import {
11
11
  diffPropPosition,
12
12
  diffPropValue,
13
13
  getStateTree,
14
- keysOf,
15
- SPACING_BUTTONS
14
+ keysOf
16
15
  } from '.'
16
+ import { SPACING_BUTTONS } from './props'
17
17
 
18
18
  const ButtonInDropdown = {
19
19
  extend: [ChoosableButton],
@@ -1,53 +1,10 @@
1
1
  'use strict'
2
2
 
3
- import { WiderButton, DropdownParent } from '@symbo.ls/components'
3
+ import { WiderButton, DropdownParent, Icon } from '@symbo.ls/components'
4
4
 
5
+ import { SPACING_BUTTONS } from './props'
5
6
  import dropdown from './dropdown'
6
7
 
7
- export const SPACING_BUTTONS = {
8
- margin: {
9
- maxValue: 3000,
10
- blockStart: {},
11
- inlineEnd: {},
12
- blockEnd: {},
13
- inlineStart: {}
14
- },
15
- height: {
16
- minWidth: {},
17
- maxWidth: {}
18
- },
19
- width: {
20
- minWidth: {},
21
- maxWidth: {}
22
- },
23
- borderWidth: {
24
- maxValue: 1280,
25
- blockStartWidth: {},
26
- inlineEndWidth: {},
27
- blockEndWidth: {},
28
- inlineStartWidth: {}
29
- },
30
- padding: {
31
- maxValue: 3000,
32
- blockStart: {},
33
- inlineEnd: {},
34
- blockEnd: {},
35
- inlineStart: {}
36
- },
37
- gap: {
38
- maxValue: 3000,
39
- Horizontal: {},
40
- Vertical: {}
41
- },
42
- borderRadius: {
43
- maxValue: 1280,
44
- endStart: {},
45
- startEnd: {},
46
- endEnd: {},
47
- startStart: {}
48
- }
49
- }
50
-
51
8
  export const ChoosableButton = {
52
9
  props: ({ key }) => ({
53
10
  padding: 'Z',
@@ -128,7 +85,7 @@ export const DotForRowButton = {
128
85
  }
129
86
  }
130
87
 
131
- export const SpacingPropButton = {
88
+ export const SpacingButton = {
132
89
  extend: [ChoosableButton, DropdownParent, WiderButton],
133
90
 
134
91
  props: (element) => {
@@ -192,6 +149,72 @@ export const SpacingPropButton = {
192
149
  dropdown
193
150
  }
194
151
 
152
+ const DotsInButton = SpacingButton.dots
153
+
154
+ export const SpacingRowButton = {
155
+ props: ({ state }) => {
156
+ const property = state
157
+ const row = property.parent
158
+ const table = row.parent
159
+
160
+ const propKey = property.value
161
+
162
+ const active = Object.keys(table.props).filter(prop => {
163
+ const hasProp = prop.toLowerCase().includes(propKey.toLowerCase())
164
+ const keyMathes = table.props[prop] === row.key
165
+ return hasProp && keyMathes
166
+ }).length
167
+
168
+ return {
169
+ active: !!active,
170
+ position: 'relative',
171
+ round: 'Z',
172
+ display: 'flex',
173
+
174
+ icon: {
175
+ name: propKey,
176
+ opacity: '0',
177
+ color: 'gray5',
178
+ margin: 'auto'
179
+ },
180
+
181
+ '.active': {
182
+ boxShadow: '0, 0, 0, 3px, gray1, inset'
183
+ }
184
+ }
185
+ },
186
+
187
+ icon: {
188
+ extend: Icon,
189
+ props: ({ state }) => {
190
+ const property = state
191
+ const row = property.parent
192
+ const table = row.parent
193
+
194
+ const propKey = property.value
195
+ const middleActive = table.props[propKey] === row.key
196
+
197
+ const active = Object.keys(table.props).filter(prop => {
198
+ const hasProp = prop.toLowerCase().includes(propKey.toLowerCase())
199
+ const keyMathes = table.props[prop] === row.key
200
+ return hasProp && keyMathes
201
+ }).length
202
+
203
+ return {
204
+ active,
205
+ middleActive,
206
+ '.active': { opacity: '1' },
207
+ '.middleActive': { color: 'blue' }
208
+ }
209
+ }
210
+ },
211
+
212
+ dots: {
213
+ childExtend: DotForRowButton,
214
+ $setStateCollection: DotsInButton.$setStateCollection
215
+ }
216
+ }
217
+
195
218
  export const getStateTree = element => {
196
219
  const table = element.lookup('Page').state
197
220
  const row = table.sequence[table.selectedKey]
@@ -0,0 +1,45 @@
1
+ 'use strict'
2
+
3
+ export const SPACING_BUTTONS = {
4
+ margin: {
5
+ maxValue: 3000,
6
+ blockStart: {},
7
+ inlineEnd: {},
8
+ blockEnd: {},
9
+ inlineStart: {}
10
+ },
11
+ height: {
12
+ minWidth: {},
13
+ maxWidth: {}
14
+ },
15
+ width: {
16
+ minWidth: {},
17
+ maxWidth: {}
18
+ },
19
+ borderWidth: {
20
+ maxValue: 1280,
21
+ blockStartWidth: {},
22
+ inlineEndWidth: {},
23
+ blockEndWidth: {},
24
+ inlineStartWidth: {}
25
+ },
26
+ padding: {
27
+ maxValue: 3000,
28
+ blockStart: {},
29
+ inlineEnd: {},
30
+ blockEnd: {},
31
+ inlineStart: {}
32
+ },
33
+ gap: {
34
+ maxValue: 3000,
35
+ Horizontal: {},
36
+ Vertical: {}
37
+ },
38
+ borderRadius: {
39
+ maxValue: 1280,
40
+ endStart: {},
41
+ startEnd: {},
42
+ endEnd: {},
43
+ startStart: {}
44
+ }
45
+ }
@@ -1,17 +1,14 @@
1
1
  'use strict'
2
2
 
3
3
  import {
4
- Icon,
5
4
  Grid,
6
5
  Pseudo,
7
6
  mapSequence,
8
7
  sortSequence
9
8
  } from '@symbo.ls/components'
10
9
 
11
- import buttons, { setRowButtons } from '../pages/Spaces/buttons'
12
- import { DotForRowButton, SpacingPropButton } from './SpacingPropButton'
13
-
14
- const DotsInButton = SpacingPropButton.dots
10
+ import { SpacingRowButton } from '.'
11
+ import actionButtons, { setRowButtons } from './SpacingButton/actionButtons'
15
12
 
16
13
  const Cell = {
17
14
  tag: 'div',
@@ -107,71 +104,7 @@ const Row = {
107
104
  px: {},
108
105
  buttons: {
109
106
  extend: Grid,
110
-
111
- childExtend: {
112
- props: ({ state }) => {
113
- const property = state
114
- const row = property.parent
115
- const table = row.parent
116
-
117
- const propKey = property.value
118
-
119
- const active = Object.keys(table.props).filter(prop => {
120
- const hasProp = prop.toLowerCase().includes(propKey.toLowerCase())
121
- const keyMathes = table.props[prop] === row.key
122
- return hasProp && keyMathes
123
- }).length
124
-
125
- return {
126
- active: !!active,
127
- position: 'relative',
128
- round: 'Z',
129
- display: 'flex',
130
-
131
- icon: {
132
- name: propKey,
133
- opacity: '0',
134
- color: 'gray5',
135
- margin: 'auto'
136
- },
137
-
138
- '.active': {
139
- boxShadow: '0, 0, 0, 3px, gray1, inset'
140
- }
141
- }
142
- },
143
-
144
- icon: {
145
- extend: Icon,
146
- props: ({ state }) => {
147
- const property = state
148
- const row = property.parent
149
- const table = row.parent
150
-
151
- const propKey = property.value
152
- const middleActive = table.props[propKey] === row.key
153
-
154
- const active = Object.keys(table.props).filter(prop => {
155
- const hasProp = prop.toLowerCase().includes(propKey.toLowerCase())
156
- const keyMathes = table.props[prop] === row.key
157
- return hasProp && keyMathes
158
- }).length
159
-
160
- return {
161
- active,
162
- middleActive,
163
- '.active': { opacity: '1' },
164
- '.middleActive': { color: 'blue' }
165
- }
166
- }
167
- },
168
-
169
- dots: {
170
- childExtend: DotForRowButton,
171
- $setStateCollection: DotsInButton.$setStateCollection
172
- }
173
- },
174
-
107
+ childExtend: SpacingRowButton,
175
108
  $setStateCollection: setRowButtons
176
109
  },
177
110
  graph: { line: {} },
@@ -273,5 +206,5 @@ export const SpacingTable = {
273
206
  $setStateCollection: ({ state }) => mapSequence(state, sortSequence)
274
207
  },
275
208
 
276
- actionButtons: buttons
209
+ actionButtons
277
210
  }
@@ -22,6 +22,34 @@ export const UploadImage = {
22
22
  element: {
23
23
  extend: [Upload, Flex, ClickableItem],
24
24
  icon: { style: { fontSize: '52px' } },
25
- p: { span: null }
25
+ p: { span: null },
26
+ input: {
27
+ on: {
28
+ change: async (ev, el, s) => {
29
+ const { context } = el
30
+ const { client } = context
31
+ s.update({ icon: { pending: true } })
32
+
33
+ try {
34
+ let id
35
+ await client.file(ev.target.files[0]).then(async d => { id = d.id })
36
+
37
+ await client.observe({
38
+ $id: id,
39
+ src: true
40
+ }, async (data) => {
41
+ s.update({ icon: { pending: false, data } })
42
+
43
+ await client.set({
44
+ $id: s.projectId,
45
+ file: data.id
46
+ })
47
+ })
48
+ } catch (e) {
49
+ console.log(e)
50
+ }
51
+ }
52
+ }
53
+ }
26
54
  }
27
55
  }
@@ -20,6 +20,6 @@ export * from './IconsGroup'
20
20
  export * from './FontText'
21
21
  export * from './DesignComponent'
22
22
  export * from './ColumnParagrphs'
23
- export * from './SpacingPropButton'
23
+ export * from './SpacingButton'
24
24
  export * from './UploadImage'
25
25
  export * from './SpacingTable'
@@ -46,6 +46,7 @@ const yourEnvironment = {
46
46
 
47
47
  title: {},
48
48
  element: { ...[
49
+ { props: { icon: 'html' } },
49
50
  { props: { icon: 'js outline' } },
50
51
  { props: { icon: 'ts outline' } },
51
52
  { props: { icon: 'pdf' } },
@@ -71,7 +72,6 @@ const yourFramework = {
71
72
  },
72
73
  title: {},
73
74
  element: { ...[
74
- { props: { icon: 'html' } },
75
75
  { props: { icon: 'domql' } },
76
76
  { props: { icon: 'react' } },
77
77
  { props: { icon: 'vue' } },
@@ -0,0 +1,109 @@
1
+ 'use strict'
2
+
3
+ import { CommonField, Input, Grid, SelectField } from '@symbo.ls/components'
4
+
5
+ export default {
6
+ extend: Grid,
7
+ props: {
8
+ columns: 'repeat(2, 270px)',
9
+ columnGap: 'C',
10
+ rowGap: 'C2'
11
+ },
12
+
13
+ childExtend: {
14
+ extend: CommonField,
15
+ props: {
16
+ position: 'relative',
17
+ align: 'stretch flex-start',
18
+ element: {
19
+ margin: '- -Z',
20
+ width: 'auto',
21
+ padding: 'Z1 A2'
22
+ }
23
+ }
24
+ },
25
+
26
+ name: {
27
+ props: {
28
+ title: { text: 'Name the project' },
29
+ element: { placeholder: 'You name it' }
30
+ },
31
+
32
+ title: {},
33
+ element: {
34
+ extend: Input,
35
+ attr: { value: ({ state }) => state.projectName }
36
+ }
37
+ },
38
+
39
+ k: {
40
+ props: {
41
+ title: { text: 'Key' }
42
+ },
43
+ title: {},
44
+ element: {
45
+ extend: Input,
46
+ attr: { value: ({ state }) => state.appKey && state.appKey.split('.')[0] },
47
+ props: { placeholder: 'a-zA-Z0-9' }
48
+ },
49
+ Span: {
50
+ position: 'absolute',
51
+ opacity: '.65',
52
+ text: '.symbo.ls',
53
+ right: 'Z2',
54
+ bottom: 'Z',
55
+ pointerEvents: 'none'
56
+ }
57
+ },
58
+
59
+ visibility: {
60
+ props: { title: { text: 'URL Access' } },
61
+ title: {},
62
+ element: {
63
+ extend: [SelectField],
64
+ props: {
65
+ style: { padding: '0' },
66
+ round: 'C1'
67
+ },
68
+ title: null,
69
+ buttons: {
70
+ props: {
71
+ position: 'absolute',
72
+ right: 'Z',
73
+ pointerEvents: 'none'
74
+ }
75
+ },
76
+
77
+ Select: {
78
+ props: {
79
+ outline: 'none',
80
+ border: 'none',
81
+ background: 'transparent',
82
+ color: 'currentColor',
83
+ padding: 'Z1 A2',
84
+ round: 'C1',
85
+ width: '100%',
86
+
87
+ style: {
88
+ cursor: 'default',
89
+ appearance: 'none'
90
+ },
91
+
92
+ name: 'user',
93
+ id: 'user'
94
+ },
95
+
96
+ childExtend: { tag: 'option', text: ({ state }) => state.text },
97
+ $setCollection: () => [
98
+ { text: 'Private' },
99
+ { text: 'Public' }
100
+ ],
101
+ on: {
102
+ change: (ev, { parent }) => {
103
+ parent.user.update({ key: ev.target.value })
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
109
+ }
@@ -0,0 +1,42 @@
1
+ 'use strict'
2
+
3
+ import { User } from '@symbo.ls/components'
4
+ import { UploadImage } from '../../../components'
5
+
6
+ export default {
7
+ extend: UploadImage,
8
+ props: {
9
+ title: { text: 'Project icon' },
10
+ element: {
11
+ flow: 'column',
12
+ position: 'relative',
13
+ width: 'fit-content',
14
+ padding: 'A',
15
+ gap: '0',
16
+
17
+ p: {
18
+ text: 'Drag and drop or click',
19
+ maxWidth: 'E',
20
+ textAlign: 'center'
21
+ }
22
+ }
23
+ },
24
+ title: {},
25
+ element: {
26
+ User: {
27
+ extend: User,
28
+ props: ({ state }) => ({
29
+ position: 'absolute',
30
+ fontSize: 'H',
31
+ top: '50%',
32
+ left: '50%',
33
+ transform: 'translate3d(-50%, -50%, 1px)',
34
+ src: state.icon && state.icon.src,
35
+ key: state.projectName,
36
+ transition: 'C defaultBezier opacity',
37
+ opacity: (state.icon && state.icon.src) ? '1' : '0',
38
+ pointerEvents: 'none'
39
+ })
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,37 @@
1
+ 'use strict'
2
+
3
+ import { InitPage } from '../../../components'
4
+
5
+ import icon from './icon'
6
+ import fields from './fields'
7
+
8
+ export const Personalize = {
9
+ extend: InitPage,
10
+
11
+ back: null,
12
+
13
+ HeaderHeading: {
14
+ props: { margin: '- - D2 -' },
15
+ Caption: { text: `Let's personalize your Symbols` },
16
+ H1: { text: ({ state }) => `Hi ${state.userName}` }
17
+ },
18
+
19
+ ColumnParagraphs: {
20
+ extend: true,
21
+ ...[
22
+ { props: { text: `In this example we'll initialize a Symbols Design System for you.` } },
23
+ { props: { text: `You can connect Symbols to your app and style it online.` } }
24
+ ]
25
+ },
26
+
27
+ Flex: {
28
+ props: { gap: 'D1' },
29
+
30
+ icon,
31
+ fields
32
+ },
33
+
34
+ ContinueButton: {
35
+ href: '/init/theme'
36
+ }
37
+ }
@@ -55,7 +55,6 @@ const BreakpointItem = {
55
55
  select: {
56
56
  extend: Select,
57
57
  props: ({ state }) => ({
58
- background: 'transparent',
59
58
  color: 'white'
60
59
  }),
61
60
 
@@ -1,9 +1,9 @@
1
1
  'use strict'
2
2
 
3
- import { Input, Img, Flex, ClickableItem, CommonField } from '@symbo.ls/components'
3
+ import { Input, Flex, CommonField } from '@symbo.ls/components'
4
4
 
5
5
  const sideBar = {
6
- tag: 'aside',
6
+ tag: 'aside'
7
7
  }
8
8
 
9
9
  export const State = {
@@ -26,7 +26,7 @@ export const State = {
26
26
  on: {
27
27
  input: (ev, el, s) => {
28
28
  const rootState = el.__root.state
29
- const obj = {
29
+ const obj = {
30
30
  STATE: { [el.parent.key]: el.node.value }
31
31
  }
32
32
  rootState.update({ SYSTEM: obj })
@@ -34,48 +34,48 @@ export const State = {
34
34
  }
35
35
  }
36
36
  },
37
-
37
+
38
38
  websiteTitle: {
39
39
  title: 'Title',
40
40
  element: {
41
41
  extend: Input
42
42
  }
43
43
  },
44
-
44
+
45
45
  websiteDesc: {
46
46
  title: 'Description',
47
47
  element: {
48
48
  extend: Input
49
49
  }
50
50
  },
51
-
51
+
52
52
  websiteTags: {
53
53
  title: 'Tags',
54
54
  element: {
55
55
  extend: Input
56
56
  }
57
57
  },
58
-
58
+
59
59
  headline: {
60
60
  title: 'Headline',
61
61
  element: {
62
62
  extend: Input
63
63
  }
64
64
  },
65
-
65
+
66
66
  paragraph: {
67
67
  title: 'Paragraph',
68
68
  element: {
69
69
  extend: Input
70
70
  }
71
71
  },
72
-
72
+
73
73
  bookNowUrl: {
74
74
  title: 'Book now URL:',
75
75
  element: {
76
76
  extend: Input
77
77
  }
78
- },
78
+ }
79
79
  },
80
80
 
81
81
  on: {
package/src/state.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import SYSTEM from './config'
4
4
  import { LIBRARY, COMPONENTS } from '@symbo.ls/preview/.symbols'
5
- import USR_DATA from '@symbo.ls/temp-db'
5
+ import USR_DATA from '@symbo.ls/temp-db' // eslint-disable-line
6
6
 
7
7
  export const state = {
8
8
  globalTheme: 'dark',
@@ -10,6 +10,7 @@ export const state = {
10
10
  }
11
11
 
12
12
  state.SYSTEM = USR_DATA[state.appKey]
13
+ // state.SYSTEM = {}
13
14
  state.SYSTEM.COMPONENTS = {}
14
15
 
15
16
  export const context = {
@@ -1,145 +0,0 @@
1
- 'use strict'
2
-
3
- import { CommonField, Input, Grid, Flex, ClickableItem } from '@symbo.ls/components'
4
-
5
- import { InitPage, UploadImage } from '../../components'
6
-
7
- const fields = {
8
- extend: Grid,
9
- props: {
10
- columns: 'repeat(2, 270px)',
11
- columnGap: 'C',
12
- rowGap: 'C2',
13
- childProps: {
14
- element: {
15
- round: 'Y2'
16
- // padding: '- A'
17
- // height: 'C',
18
-
19
- // style: { background: 'rgba(255, 255, 255, .1) !important' },
20
- // align: 'center space-between',
21
- }
22
- }
23
- },
24
-
25
- childExtend: {
26
- extend: CommonField,
27
- title: {},
28
- element: { extend: Flex }
29
- },
30
-
31
- ...[{
32
- props: {
33
- title: { text: 'Name the project' },
34
- element: { placeholder: 'You name it' }
35
- },
36
-
37
- title: {},
38
- element: { extend: Input, props: { } }
39
- }, {
40
- props: {
41
- title: { text: 'Key' },
42
- element: {
43
- extend: Input,
44
- props: {
45
- placeholder: 'a-zA-Z0-9'
46
- },
47
- Span: {
48
- position: 'absolute',
49
- text: '.symbo.ls',
50
- right: 'A',
51
- pointerEvents: 'none'
52
- }
53
- }
54
- },
55
- title: {},
56
- element: {
57
- input: { extend: Input },
58
- span: {}
59
- }
60
- }, {
61
- props: { title: { text: 'URL Access' } },
62
- title: {},
63
- element: {
64
- extend: [ClickableItem],
65
- Select: {
66
- props: {
67
- outline: 'none',
68
- pointerEvents: 'all',
69
- appearance: 'none',
70
- border: 'none',
71
- width: '100%',
72
- height: '100%',
73
- background: 'none',
74
- color: 'currentColor',
75
- fontSize: 'A',
76
- lineHeight: 1,
77
- padding: 'Z A',
78
-
79
- name: 'user',
80
- id: 'user'
81
- },
82
- childExtend: { tag: 'option', text: ({ state }) => state.text },
83
- $setCollection: () => [
84
- { text: 'Private' },
85
- { text: 'Public' }
86
- ],
87
- on: {
88
- change: (ev, { parent }) => {
89
- parent.user.update({ key: ev.target.value })
90
- }
91
- }
92
- }
93
- }
94
- }]
95
- }
96
-
97
- const uploadImage = {
98
- extend: UploadImage,
99
- props: {
100
- title: { text: 'Project icon' },
101
- element: {
102
- flow: 'column',
103
- width: 'fit-content',
104
- padding: 'A',
105
- gap: '0',
106
- p: {
107
- text: 'Drag and drop or click',
108
- maxWidth: 'E',
109
- textAlign: 'center'
110
- }
111
- }
112
- }
113
-
114
- }
115
-
116
- export const Personalize = {
117
- extend: InitPage,
118
-
119
- back: null,
120
-
121
- HeaderHeading: {
122
- props: { margin: '- - D2 -' },
123
- Caption: { text: `Let's personalize your Symbols` },
124
- H1: { text: 'Hi George' }
125
- },
126
-
127
- ColumnParagraphs: {
128
- extend: true,
129
- ...[
130
- { props: { text: `In this example we'll initialize a Symbols Design System for you.` } },
131
- { props: { text: `You can connect Symbols to your app and style it online.` } }
132
- ]
133
- },
134
-
135
- content: {
136
- extend: Flex,
137
- props: { gap: 'D1' },
138
- uploadImage,
139
- fields
140
- },
141
-
142
- ContinueButton: {
143
- href: '/init/theme'
144
- }
145
- }