@symbo.ls/preview 0.0.80 → 0.0.81

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.80",
5
+ "version": "0.0.81",
6
6
  "repository": "https://github.com/rackai/editor",
7
7
  "main": "src/index.js",
8
8
  "scripts": {
@@ -32,7 +32,7 @@ export const NavbarButton = {
32
32
  transform: 'translate3d(5%, -50%, 0)',
33
33
  opacity: '0',
34
34
  visibility: 'hidden',
35
- transition: 'B default-bezier',
35
+ transition: 'B defaultBezier',
36
36
  transitionProperty: 'opacity, transform',
37
37
  textAlign: 'start',
38
38
  zIndex: 9999,
@@ -35,7 +35,7 @@ export const TutorialBanner = {
35
35
  },
36
36
 
37
37
  ':before': {
38
- transition: 'B default-bezier',
38
+ transition: 'B defaultBezier',
39
39
  transitionProperty: 'opacity',
40
40
  backgroundImage: `url(${state.background})`,
41
41
  backgroundSize: 'cover',
@@ -43,7 +43,7 @@ export const TutorialBanner = {
43
43
  },
44
44
 
45
45
  ':after': {
46
- transition: 'B default-bezier',
46
+ transition: 'B defaultBezier',
47
47
  transitionProperty: 'opacity',
48
48
  background: 'shadow-overlay',
49
49
  opacity: '0.9'
@@ -1,6 +1,7 @@
1
1
  'use strict'
2
2
 
3
- import { PageTemplate, Overlay, Flex } from '@symbo.ls/components'
3
+ import { PageTemplate, Overlay, Flex, IconButton } from '@symbo.ls/components'
4
+ import { Link } from '@symbo.ls/components/src/Link'
4
5
 
5
6
  import MASK1 from '../assets/mask1.png'
6
7
  import MASK2 from '../assets/mask2.png' // eslint-disable-line
@@ -22,55 +23,107 @@ export const InitPage = {
22
23
  width: '100%',
23
24
  maxWidth: 'J',
24
25
  flow: 'column',
26
+ position: 'relative',
25
27
  align: 'flex-start',
26
28
 
27
29
  content: { width: '100%' }
30
+ },
31
+
32
+ back: {
33
+ extend: [Link, IconButton],
34
+ props: {
35
+ position: 'absolute',
36
+ fontSize: 'A1',
37
+ top: '0',
38
+ right: '102%',
39
+ icon: 'arrow angle left'
40
+ }
28
41
  }
29
42
  }
30
43
 
44
+ const ifWeHaveComponents = (state) => {
45
+ const keys = Object.keys(state.__system.COMPONENTS)
46
+ return !!keys.length
47
+ }
48
+
31
49
  export const DisabledPage = {
32
- props: {
33
- maxHeight: 'calc(100vh - 7em)',
34
- overflow: 'hidden'
50
+ props: ({ state }) => ({
51
+ active: ifWeHaveComponents(state),
52
+ maxHeight: 'none',
53
+ overflow: 'visible',
54
+
55
+ '!active': {
56
+ maxHeight: 'calc(100vh - 7em)',
57
+ overflow: 'hidden'
58
+ },
59
+
60
+ '.active': {
61
+ maxHeight: 'none',
62
+ overflow: 'visible'
63
+ }
64
+ }),
65
+
66
+ on: {
67
+ initUpdate: (element, state) => {
68
+ element.setProps({ active: ifWeHaveComponents(state) }, { preventUpdate: true, ignoreInitUpdate: true })
69
+ }
35
70
  },
36
71
 
37
72
  disablingOverlay: {
38
73
  extend: [Overlay, Flex],
39
74
 
40
- props: {
75
+ props: ({ state }) => ({
76
+ active: ifWeHaveComponents(state),
41
77
  overflow: 'hidden',
42
78
  background: 'shadow-overlay',
43
- animation: 'fadeInUp',
44
- animationDuration: 'G'
45
- },
79
+ '.active': {
80
+ animation: 'fadeOutDown',
81
+ animationDuration: 'G',
82
+ transition: 'G defaultBezier',
83
+ transitionProperty: 'opacity, transform, visibility',
84
+ opacity: '0',
85
+ visibility: 'hidden',
86
+ transform: 'translate3d(0, 12.5%, 1px)',
87
+ pointerEvents: 'none'
88
+ },
89
+ '!active': {
90
+ animation: 'fadeInUp',
91
+ animationDuration: 'G'
92
+ }
93
+ }),
46
94
 
47
- // Overlay: {
48
- // background: 'gradient-colorful',
49
- // inset: '0 0 0 0',
50
- // opacity: '.9',
51
- // style: {
52
- // WebkitMaskImage: 'url(' + MASK1 + ')',
53
- // WebkitMaskSize: '100% 100%'
54
- // }
55
- // },
95
+ Overlay: {
96
+ background: 'gradient-colorful',
97
+ inset: '0 0 0 0',
98
+ opacity: '.9',
99
+ style: {
100
+ WebkitMaskImage: 'url(' + MASK1 + ')',
101
+ WebkitMaskSize: '100% 100%'
102
+ }
103
+ },
56
104
 
57
105
  message: {
58
- props: {
106
+ props: ({ state }) => ({
59
107
  animation: 'fadeInUpShort',
60
108
  animationDuration: 'G',
61
109
  animationDelay: 'G',
62
110
  margin: 'auto auto 0',
63
111
  padding: 'C1 E C',
64
112
  width: '100%',
65
- maxWidth: 'K-default'
66
- },
113
+ maxWidth: 'K-default',
114
+ ArticleBig: {
115
+ p: {
116
+ text: 'Open up ' + state.appKey + ' in a new window to start working with components'
117
+ }
118
+ }
119
+ }),
67
120
 
68
121
  ArticleBig: {
69
122
  title: {
70
- text: 'Custom library will come up soon'
123
+ text: 'Connect to your website'
71
124
  },
72
125
  p: {
73
- text: 'Meanwhile, please check the components page',
126
+ color: 'white .8',
74
127
  margin: 'X 0 0',
75
128
  animation: 'fadeInUpShort',
76
129
  animationDuration: 'G',
@@ -26,7 +26,7 @@ const ShapeItem = {
26
26
  },
27
27
 
28
28
  _shape: {
29
- transition: 'A default-bezier',
29
+ transition: 'A defaultBezier',
30
30
  transitionProperty: 'background',
31
31
  width: 'C1',
32
32
  height: 'C1',
@@ -96,7 +96,7 @@ const sideBar = {
96
96
 
97
97
  info: { props: { icon: 'info' } },
98
98
  logout: {
99
- props: { icon: 'logout', href: '/logout' },
99
+ props: { icon: 'logout', href: '/logout' }
100
100
  }
101
101
  }
102
102
  }
@@ -105,7 +105,7 @@ export const Account = {
105
105
  sideBar,
106
106
  on: {
107
107
  render: element => {
108
-
108
+
109
109
  }
110
110
  }
111
111
  }
@@ -68,11 +68,11 @@ export default {
68
68
  QuickStartNumber: { text: '3' },
69
69
  Code: {
70
70
  note: { text: 'Create .symbolsrc.js file in your project and insert your Symbols key' },
71
- props: {
71
+ props: ({ state }) => ({
72
72
  code: {
73
- text: '{ "key": "key.symbo.ls" }'
73
+ text: `{ "key": "${state.appKey}" }`
74
74
  }
75
- }
75
+ })
76
76
  }
77
77
  },
78
78
 
@@ -41,13 +41,14 @@ export const Export = {
41
41
  const componentKey = routes[1]
42
42
  const { COMPONENTS } = state.__system
43
43
 
44
- const content = COMPONENT_ROUTES[`/${componentKey}`] || COMPONENTS[componentKey]
45
- console.warn('===content')
46
- console.warn(content)
47
- console.warn(componentKey, COMPONENTS)
44
+ const libComponent = COMPONENT_ROUTES[`/${componentKey}`]
45
+ const liveComponent = COMPONENTS[componentKey]
46
+
47
+ const content = libComponent || liveComponent
48
48
 
49
49
  if (content) {
50
50
  state.update({
51
+ live: !!liveComponent,
51
52
  ...content
52
53
  }, { preventUpdate: true })
53
54
  }
@@ -1,14 +1,24 @@
1
1
  'use strict'
2
2
 
3
- import { isString } from '@domql/utils'
4
- import { BREAKPOINTS } from '@symbo.ls/scratch'
5
- import { Scene } from '@symbo.ls/components'
3
+ import DOM from 'domql'
4
+ import { transformEmotionClass, transformEmotionStyle } from 'domql/packages/emotion'
5
+ import { createEmotion } from '@symbo.ls/create-emotion'
6
6
  import { updateReset } from '@symbo.ls/init'
7
+ import { isString } from '@domql/utils'
8
+
9
+ import { getActiveConfig, activateConfig } from '@symbo.ls/scratch'
10
+ import { init, Box, Scene } from '@symbo.ls/components'
11
+
12
+ import * as components from '../../components'
13
+
14
+ const emCache = {}
7
15
 
8
16
  export default {
9
17
  extend: Scene,
10
18
 
11
19
  props: (el, s) => {
20
+ const CONFIG = getActiveConfig()
21
+ const { BREAKPOINTS } = CONFIG
12
22
  const previewSize = BREAKPOINTS[s.previewSize]
13
23
  return {
14
24
  width: '100%',
@@ -40,27 +50,71 @@ export default {
40
50
  }
41
51
  },
42
52
 
43
- comp: (el, s) => ({
44
- extend: isString(s.component) ? document.eval(s.component) : s.component,
45
- props: { inheritSpacingRatio: true }
46
- }),
53
+ comp: (el, s) => {
54
+ if (s.live) {
55
+ const SYSTEM = s.__system
56
+ const styleNode = document.createElement('head')
57
+ const emotion = createEmotion('client', styleNode)
58
+ emCache['client'] = emotion
59
+
60
+ const emotionStyle = transformEmotionStyle(emotion, true)
61
+ const emotionClass = transformEmotionClass(emotion, true)
62
+
63
+ const newDom = DOM.create({
64
+ tag: 'shadow',
65
+ state: s.state
66
+ }, el.parent.node, 'comp', {
67
+ extend: [Box],
68
+ define: { style: emotionStyle, class: emotionClass },
69
+ components,
70
+ context: { SYSTEM }
71
+ })
72
+
73
+ newDom.node.appendChild(styleNode)
74
+
75
+ init(SYSTEM, null, { emotion, initDOMQLDefine: false, newConfig: 'client' })
76
+ activateConfig('client')
77
+
78
+ newDom.set({
79
+ tag: 'fragment',
80
+ [s.key]: {
81
+ extend: isString(s.component) ? document.eval(s.component) : s.component,
82
+ props: { inheritSpacingRatio: true }
83
+ },
84
+ on: {
85
+ render: (el) => {
86
+ // const appKey = el.__root.state.appKey && el.__root.state.appKey.split('.')[0]
87
+ }
88
+ }
89
+ })
90
+
91
+ activateConfig(0)
92
+ return newDom
93
+ }
94
+
95
+ return {
96
+ extend: {
97
+ extend: isString(s.component) ? document.eval(s.component) : s.component
98
+ },
99
+ props: { inheritSpacingRatio: true }
100
+ }
101
+ },
47
102
 
48
103
  on: {
49
104
  initUpdate: (el, s) => {
50
- el.comp.setProps({
51
- base: s.base,
52
- fontSize: s.base + 'px',
53
- spacingRatio: s.ratio,
54
- direction: s.direction
55
- }, { preventUpdate: true })
56
-
57
- // const componentNode = el.comp.node
58
- // const SVG = elementToSVG(componentNode)
59
- // const svgString = new window.XMLSerializer().serializeToString(SVG)
60
- // console.log(SVG)
61
- // console.log(svgString)
62
-
63
- updateReset()
105
+ if (s.live) {
106
+ activateConfig('client')
107
+ updateReset({ emotion: emCache['client'] })
108
+ } else {
109
+ el.comp.setProps({
110
+ base: s.base,
111
+ fontSize: s.base + 'px',
112
+ spacingRatio: s.ratio,
113
+ direction: s.direction
114
+ }, { preventUpdate: true })
115
+ updateReset()
116
+ }
117
+ activateConfig(0)
64
118
  }
65
119
  }
66
120
  }
@@ -4,18 +4,7 @@ import { Flex, CommonField, WiderButton, ClickableItem } from '@symbo.ls/compone
4
4
 
5
5
  import { InitPage } from '../../components'
6
6
 
7
- const header = {
8
- props: {
9
- margin: '- - D -'
10
- },
11
-
12
- Caption: { text: 'And finally,' },
13
- H1: {
14
- text: 'Your environment'
15
- }
16
- }
17
-
18
- const commonField = {
7
+ const ButtonOptions = {
19
8
  tag: 'section',
20
9
  extend: CommonField,
21
10
 
@@ -49,16 +38,17 @@ const commonField = {
49
38
  }
50
39
 
51
40
  const yourEnvironment = {
52
- extend: commonField,
41
+ extend: ButtonOptions,
53
42
  props: {
54
43
  margin: '- - C2 -',
55
44
  title: { text: 'Your environment' }
56
45
  },
57
46
 
58
47
  title: {},
59
- element: [
60
- { props: { icon: 'inputOutline' } },
61
- { props: { icon: 'accessibilityOutline' } },
48
+ element: { ...[
49
+ { props: { icon: 'js outline' } },
50
+ { props: { icon: 'ts outline' } },
51
+ { props: { icon: 'pdf' } },
62
52
  {
63
53
  props: {
64
54
  boxSizing: 'content-box',
@@ -70,24 +60,38 @@ const yourEnvironment = {
70
60
  },
71
61
  icon: null
72
62
  }
73
- ]
63
+ ] }
74
64
  }
75
65
 
76
66
  const yourFramework = {
77
- extend: commonField,
67
+ extend: ButtonOptions,
78
68
  props: {
79
69
  margin: '- - F -',
80
- title: { text: 'Your framework' },
81
- element: { childProps: { icon: 'info' } }
70
+ title: { text: 'Your framework' }
82
71
  },
83
72
  title: {},
84
- element: { ...[{}, {}, {}, {}, {}, {}] }
73
+ element: { ...[
74
+ { props: { icon: 'html' } },
75
+ { props: { icon: 'domql' } },
76
+ { props: { icon: 'react' } },
77
+ { props: { icon: 'vue' } },
78
+ { props: { icon: 'angular' } },
79
+ { props: { icon: 'svelte' } },
80
+ { props: { icon: 'webComponents' } }
81
+ ] }
85
82
  }
86
83
 
87
84
  export const ChooseEnvironment = {
88
85
  extend: InitPage,
89
86
 
90
- HeaderHeading: header,
87
+ back: { props: { href: '/init/font' } },
88
+
89
+ HeaderHeading: {
90
+ margin: '- - D -',
91
+
92
+ Caption: { text: 'And finally,' },
93
+ H1: { text: 'Your environment' }
94
+ },
91
95
 
92
96
  yourEnvironment,
93
97
  yourFramework,
@@ -70,7 +70,7 @@ const modes = {
70
70
  right: 'W',
71
71
  bottom: 'W',
72
72
  opacity: '0',
73
- transition: 'B default-bezier',
73
+ transition: 'B defaultBezier',
74
74
  transitionProperty: 'transform, opacity',
75
75
  transform: 'translate3d(0, 100%, 0)',
76
76
  columnGap: 'W'
@@ -113,6 +113,7 @@ export const CreateDocumentTheme = {
113
113
  props: {
114
114
  flow: 'column',
115
115
  align: 'flex-start',
116
+
116
117
  paragraphs: {
117
118
  gap: 'E',
118
119
  margin: '- - D1 -',
@@ -123,6 +124,8 @@ export const CreateDocumentTheme = {
123
124
  }
124
125
  },
125
126
 
127
+ back: { props: { href: '/init/font' } },
128
+
126
129
  HeaderHeading: {},
127
130
  paragraphs,
128
131
  modes,
@@ -56,6 +56,8 @@ const content = {
56
56
  export const CreatePallete = {
57
57
  extend: InitPage,
58
58
 
59
+ back: { props: { href: '/init/theme' } },
60
+
59
61
  HeaderHeading: {
60
62
  margin: '- - D -',
61
63
  Caption: { text: `Let's get started` },
@@ -5,6 +5,8 @@ import { InitPage } from '../../components'
5
5
  export const FontText = {
6
6
  extend: InitPage,
7
7
 
8
+ back: { props: { href: '/init/pallete' } },
9
+
8
10
  HeaderHeading: {
9
11
  props: { margin: '- - D2 -' },
10
12
  Caption: { text: `Let's make sure` },
@@ -1,12 +1,10 @@
1
1
  'use strict'
2
2
 
3
3
  import { ComponentTemplate } from '@symbo.ls/components'
4
- import { Page } from '../../components'
5
-
6
- import { COMPONENTS } from '../../../.symbols' // eslint-disable-line
4
+ import { DisabledPage, Page } from '../../components'
7
5
 
8
6
  export const Library = {
9
- extend: [Page],
7
+ extend: [DisabledPage, Page],
10
8
 
11
9
  SectionHeader: {
12
10
  title: 'My Symbols',
@@ -29,7 +27,7 @@ export const Library = {
29
27
  childExtend: ComponentTemplate,
30
28
  $setStateCollection: ({ state }) => {
31
29
  const { COMPONENTS } = state.__system
32
- return COMPONENTS
30
+ return Object.values(COMPONENTS)
33
31
  }
34
32
  }
35
33
  }
@@ -31,7 +31,7 @@ export const Tones = {
31
31
  text: null,
32
32
  props: ({ key, state }) => ({
33
33
  round: '0',
34
- transition: 'B default-bezier',
34
+ transition: 'B defaultBezier',
35
35
  transitionProperty: 'color, background',
36
36
  background: getThemeProperty('background', state.value, state.sceneTheme),
37
37
  opacity: '' + (100 / TONES_AMOUNT * parseInt(key)) / 100
package/src/sync.js CHANGED
@@ -35,7 +35,7 @@ export const Sync = {
35
35
  stateUpdated: (el, s, changes) => {
36
36
  if (s.appKey && changes.SYSTEM) {
37
37
  const { SYSTEM } = changes
38
- send('liveChange', SYSTEM)
38
+ send('change', SYSTEM)
39
39
 
40
40
  // if (SYSTEM.COLOR && SYSTEM.THEME) {
41
41
  // init({