@symbo.ls/create 2.10.19 → 2.10.25
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/index.js +19 -22
- 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
|
|
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 {
|
|
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
|
-
|
|
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 = utils.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
|
|
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: [
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "2.10.25",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"gitHead": "
|
|
5
|
+
"gitHead": "891c18159d1045914b41f121474c6b707ac9db83",
|
|
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
|
}
|