@symbo.ls/preview 0.0.79 → 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.79",
5
+ "version": "0.0.80",
6
6
  "repository": "https://github.com/rackai/editor",
7
7
  "main": "src/index.js",
8
8
  "scripts": {
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
  }
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
  }