@symbo.ls/preview 0.0.78 → 0.0.80

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.78",
5
+ "version": "0.0.80",
6
6
  "repository": "https://github.com/rackai/editor",
7
7
  "main": "src/index.js",
8
8
  "scripts": {
package/src/app.js CHANGED
@@ -3,8 +3,7 @@
3
3
  import './config'
4
4
  import style from './style'
5
5
 
6
- import { router } from '@domql/router'
7
- import { Flex, openModal } from '@symbo.ls/components'
6
+ import { Flex } from '@symbo.ls/components'
8
7
 
9
8
  import { state } from './state'
10
9
  import {
package/src/index.js CHANGED
@@ -18,7 +18,6 @@ import { Sync } from './sync' // eslint-disable-line
18
18
  smbls.init({ verbose: false, ...SYMBOLS_CONF })
19
19
 
20
20
  DOM.define({
21
- __filepath: param => param,
22
21
  $setCollection: smbls.Collection.define.$setCollection,
23
22
  $setStateCollection: smbls.Collection.define.$setStateCollection
24
23
  })
@@ -1,10 +1,10 @@
1
1
  'use strict'
2
2
 
3
3
  import { SEQUENCE, TYPOGRAPHY } from '@symbo.ls/scratch'
4
- import { LIBRARY, COMPONENTS } from '../../../.symbols'
4
+ import { LIBRARY, COMPONENTS } from '../../../.symbols' // eslint-disable-line
5
5
 
6
6
  const COMPONENT_ROUTES = {}
7
- LIBRARY.map(v => (COMPONENT_ROUTES[`/${v.key}`] = v))
7
+ // LIBRARY.map(v => (COMPONENT_ROUTES[`/${v.key}`] = v))
8
8
  COMPONENTS.map(v => (COMPONENT_ROUTES[`/${v.key}`] = v))
9
9
 
10
10
  // const SEQUENCE = [8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 32, 36, 42, 48, 56, 62, 68, 76, 84, 92, 100, 110]
@@ -39,8 +39,12 @@ export const Export = {
39
39
  const route = window.location.pathname
40
40
  const routes = route.slice(1).split('/')
41
41
  const componentKey = routes[1]
42
+ const { COMPONENTS } = state.__system
42
43
 
43
- const content = COMPONENT_ROUTES[`/${componentKey}`]
44
+ const content = COMPONENT_ROUTES[`/${componentKey}`] || COMPONENTS[componentKey]
45
+ console.warn('===content')
46
+ console.warn(content)
47
+ console.warn(componentKey, COMPONENTS)
44
48
 
45
49
  if (content) {
46
50
  state.update({
@@ -0,0 +1,38 @@
1
+ 'use strict'
2
+
3
+ import { ComponentTemplate } from '@symbo.ls/components'
4
+ import { Page, DisabledPage } from '../../components'
5
+
6
+ import { COMPONENTS } from '../../../.symbols' // eslint-disable-line
7
+
8
+ export const Library = {
9
+ extend: [Page, DisabledPage],
10
+
11
+ SectionHeader: {
12
+ title: 'My Symbols',
13
+ p: 'This is the first collection of your components'
14
+ },
15
+
16
+ Grid: {
17
+ props: {
18
+ flex: 1,
19
+ templateColumns: 'repeat(12, 1fr)',
20
+ autoFlow: 'dense',
21
+ autoColumns: 'auto',
22
+ autoRows: 'auto',
23
+ justifyItems: 'stretch',
24
+
25
+ margin: '- -Z2 B1',
26
+ gap: 'A'
27
+ },
28
+
29
+ childExtend: ComponentTemplate,
30
+ $setStateCollection: () => {
31
+ return new Array(15).fill(void 0).map(v => ({
32
+ settings: {
33
+ gridOptions: { colspan: 3, rowspan: 1 }
34
+ }
35
+ }))
36
+ }
37
+ }
38
+ }
@@ -1,12 +1,12 @@
1
1
  'use strict'
2
2
 
3
3
  import { ComponentTemplate } from '@symbo.ls/components'
4
- import { Page, DisabledPage } from '../../components'
4
+ import { Page } from '../../components'
5
5
 
6
6
  import { COMPONENTS } from '../../../.symbols' // eslint-disable-line
7
7
 
8
8
  export const Library = {
9
- extend: [Page, DisabledPage],
9
+ extend: [Page],
10
10
 
11
11
  SectionHeader: {
12
12
  title: 'My Symbols',
@@ -27,12 +27,9 @@ export const Library = {
27
27
  },
28
28
 
29
29
  childExtend: ComponentTemplate,
30
- $setStateCollection: () => {
31
- return new Array(15).fill(void 0).map(v => ({
32
- settings: {
33
- gridOptions: { colspan: 3, rowspan: 1 }
34
- }
35
- }))
30
+ $setStateCollection: ({ state }) => {
31
+ const { COMPONENTS } = state.__system
32
+ return COMPONENTS
36
33
  }
37
34
  }
38
35
  }
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import {
3
+ import {
4
4
  findHeadingLetter,
5
5
  getFontFamily
6
6
  } from '@symbo.ls/scratch'
@@ -28,7 +28,7 @@ const getTypeProp = (key, prop, library, defaultValue) => {
28
28
  const { TYPOGRAPHY } = library
29
29
  const { styles } = TYPOGRAPHY
30
30
  if (!styles[key]) styles[key] = {}
31
- return styles[key][prop] ||
31
+ return styles[key][prop] ||
32
32
  styles[prop] ||
33
33
  TYPOGRAPHY[prop] ||
34
34
  defaultValue ||
@@ -45,10 +45,8 @@ const getTypeStyle = (key, library) => ({
45
45
  letterWidth: getTypeProp(key, 'letterWidth', library)
46
46
  })
47
47
 
48
-
49
48
  const isHeading = v => v.length === 2 && v[0] === 'h'
50
- const isTag = v => HTML_TAGS.root.indexOf(v) > -1 ||
51
- HTML_TAGS.body.indexOf(v) > -1
49
+ const isTag = v => HTML_TAGS.root.indexOf(v) > -1 || HTML_TAGS.body.indexOf(v) > -1
52
50
  const isHelper = v => v.slice(0, 1) === '.'
53
51
 
54
52
  const getCollectionFromArray = (arr, s) => {
@@ -65,11 +63,11 @@ const getCollectionFromArray = (arr, s) => {
65
63
  },
66
64
  labels: Object.keys(result)
67
65
  .filter(key => key !== 'fontSize' && result[key] && result[key] !== '0')
68
- .map(key => ({
66
+ .map(key => ({
69
67
  icon: iconMap[key],
70
68
  text: result[key]
71
69
  })
72
- ),
70
+ ),
73
71
  sequenceValue: s.sequence[
74
72
  isHeading(v) ? findHeadingLetter(s.h1Matches, k) : result.fontSize
75
73
  ]
@@ -85,7 +83,7 @@ export const headingsCollection = (el, s) => {
85
83
 
86
84
  export const tagsCollection = (el, s) => {
87
85
  const { __system } = s
88
- const { FONT_FAMILY, TYPOGRAPHY } = __system
86
+ const { TYPOGRAPHY } = __system
89
87
  const { styles } = TYPOGRAPHY
90
88
  if (!styles.body) styles.body = {}
91
89
  el.removeContent()
@@ -100,17 +98,13 @@ export const tagsCollection = (el, s) => {
100
98
 
101
99
  export const helpersCollection = (el, s) => {
102
100
  const { __system } = s
103
- const { TYPOGRAPHY, FONT_FAMILY } = __system
104
- let { styles } = TYPOGRAPHY
105
- if (!styles) styles = TYPOGRAPHY.styles = {}
106
- el.removeContent()
107
-
108
- const { lineHeight, fontWeight } = TYPOGRAPHY
109
- const familyValue = getFontFamily('def', FONT_FAMILY)
110
- const font = familyValue[0]
101
+ const { TYPOGRAPHY } = __system
102
+ const { styles } = TYPOGRAPHY
111
103
 
112
104
  const HELPERS = Object.keys(styles)
113
105
  .filter(v => v.slice(0, 1) === '.')
114
106
 
107
+ el.removeContent()
108
+
115
109
  return getCollectionFromArray(HELPERS, s)
116
110
  }
package/src/state.js CHANGED
@@ -10,6 +10,7 @@ export const state = {
10
10
  }
11
11
 
12
12
  state.SYSTEM = USR_DATA[state.appKey]
13
+ state.SYSTEM.COMPONENTS = {}
13
14
 
14
15
  export const context = {
15
16
  LIBRARY,
package/src/sync.js CHANGED
@@ -1,26 +1,48 @@
1
1
  'use strict'
2
2
 
3
- // import { init } from '@symbo.ls/init'
4
- import { connect, send } from '@symbo.ls/socket/client'
3
+ import { init, connect, send } from 'smbls' // eslint-disable-line no-unused-vars
4
+ import { router } from '@domql/router'
5
5
 
6
6
  const onChange = (element, state) => {
7
7
  return (event, data) => {
8
- if (event !== 'live-change') {
9
- const obj = JSON.parse(data)
8
+ // if (event === 'change') {
9
+ // const obj = JSON.parse(data)
10
+ // state.update({ SYSTEM: obj })
11
+ // }
12
+ if (event === 'change') {
13
+ console.log(data)
14
+ // const obj = JSON.parse(data)
10
15
  state.update({ SYSTEM: data })
11
16
  }
17
+ if (event === 'route') {
18
+ console.log(data)
19
+ // const obj = JSON.parse(data)
20
+ router(element, data, {})
21
+ }
12
22
  }
13
23
  }
14
24
 
15
25
  export const Sync = {
16
26
  on: {
17
27
  init: (el, s) => {
18
- if (s.appKey) connect(s.appKey, onChange(el, s))
28
+ if (s.appKey) {
29
+ connect(s.appKey, {
30
+ source: 'symbols',
31
+ onChange: onChange(el, s)
32
+ })
33
+ }
19
34
  },
20
35
  stateUpdated: (el, s, changes) => {
21
36
  if (s.appKey && changes.SYSTEM) {
22
- send(changes.SYSTEM, s.SYSTEM)
23
- // init(changes.SYSTEM)
37
+ const { SYSTEM } = changes
38
+ send('liveChange', SYSTEM)
39
+
40
+ // if (SYSTEM.COLOR && SYSTEM.THEME) {
41
+ // init({
42
+ // color: SYSTEM.COLOR,
43
+ // theme: SYSTEM.THEME
44
+ // })
45
+ // }
24
46
  }
25
47
  }
26
48
  }