@symbo.ls/create 2.10.20 → 2.10.28

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.
Files changed (2) hide show
  1. package/index.js +19 -22
  2. package/package.json +3 -2
package/index.js CHANGED
@@ -1,18 +1,22 @@
1
1
  'use strict'
2
2
 
3
3
  import DOM from 'domql'
4
- import { isString, overwriteDeep, deepDestringify } from '@domql/utils'
5
4
 
6
- import * as smbls from '@symbo.ls/uikit'
5
+ import * as utils from '@symbo.ls/utils'
6
+ import * as domqlUtils from '@domql/utils'
7
+
8
+ import * as uikit from '@symbo.ls/uikit'
7
9
  import { init, DYNAMIC_JSON } from '@symbo.ls/init' // eslint-disable-line no-unused-vars
8
- import { fetchRemote } from '@symbo.ls/fetch'
10
+ import { fetchProject } from '@symbo.ls/fetch'
9
11
 
10
12
  import { define } from './define'
11
13
 
12
14
  const { SYMBOLS_KEY } = process.env // eslint-disable-line no-unused-vars
13
15
 
14
16
  const defaultOptions = {
15
- endpoint: 'localhost:13335',
17
+ editor: {
18
+ endpoint: 'api.symbols.app'
19
+ },
16
20
  state: {},
17
21
  pages: {},
18
22
  system: {
@@ -23,21 +27,14 @@ const defaultOptions = {
23
27
  define
24
28
  }
25
29
 
26
- export const create = (App, options = defaultOptions) => {
27
- const appIsKey = isString(App)
30
+ export const create = async (App, options = defaultOptions) => {
31
+ const appIsKey = domqlUtils.isString(App)
28
32
  const key = options.key || SYMBOLS_KEY || (appIsKey && App)
29
33
 
30
34
  if (appIsKey) App = {}
31
- if (key) {
32
- if (options.remote) {
33
- const data = fetchRemote(key, { endpoint: options.endpoint })
34
- const evalData = deepDestringify(data)
35
- overwriteDeep(evalData, options)
36
- }
37
- }
35
+ if (key) await fetchProject(key, options)
38
36
 
39
- const components = { ...smbls, ...options.components }
40
- const designSystem = init(options.system)
37
+ const designSystem = init(options.system || {})
41
38
 
42
39
  DOM.define(options.define || define)
43
40
 
@@ -47,15 +44,15 @@ export const create = (App, options = defaultOptions) => {
47
44
  state: options.state
48
45
  }]
49
46
  }, null, 'app', {
50
- extend: [smbls.Box],
47
+ extend: [uikit.Box],
51
48
  context: {
52
49
  key,
53
- components,
54
- state: options.state,
55
- pages: options.pages,
56
- system: designSystem
57
- },
58
- components
50
+ components: { ...uikit, ...options.components },
51
+ state: options.state || {},
52
+ pages: options.pages || {},
53
+ system: designSystem || {},
54
+ utils: { ...utils, ...domqlUtils }
55
+ }
59
56
  // TODO: move define here,
60
57
  })
61
58
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@symbo.ls/create",
3
- "version": "2.10.20",
3
+ "version": "2.10.28",
4
4
  "license": "MIT",
5
- "gitHead": "2916a041146a954910251d5d73dd5e912858d562",
5
+ "gitHead": "6be33188b6d802fc29c3a3dc8873db0dabd16afe",
6
6
  "source": "index.js",
7
7
  "main": "index.js",
8
8
  "dependencies": {
@@ -10,6 +10,7 @@
10
10
  "@symbo.ls/fetch": "latest",
11
11
  "@symbo.ls/init": "latest",
12
12
  "@symbo.ls/uikit": "latest",
13
+ "@symbo.ls/utils": "latest",
13
14
  "domql": "latest"
14
15
  }
15
16
  }