@symbo.ls/create 2.10.25 → 2.10.31
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/define.js +1 -1
- package/index.js +34 -17
- package/package.json +2 -2
package/define.js
CHANGED
package/index.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import DOM from 'domql'
|
|
4
|
+
import { transformDOMQLEmotion } from 'domql/packages/emotion'
|
|
4
5
|
|
|
5
6
|
import * as utils from '@symbo.ls/utils'
|
|
6
7
|
import * as domqlUtils from '@domql/utils'
|
|
7
8
|
|
|
8
9
|
import * as uikit from '@symbo.ls/uikit'
|
|
9
|
-
import { init
|
|
10
|
+
import { init } from '@symbo.ls/init'
|
|
10
11
|
import { fetchProject } from '@symbo.ls/fetch'
|
|
11
12
|
|
|
12
|
-
import {
|
|
13
|
+
import { emotion as defaultEmotion, createEmotion } from '@symbo.ls/emotion'
|
|
14
|
+
import { defaultDefine } from './define'
|
|
13
15
|
|
|
14
|
-
const { SYMBOLS_KEY } = process.env
|
|
16
|
+
const { SYMBOLS_KEY } = process.env
|
|
15
17
|
|
|
16
18
|
const defaultOptions = {
|
|
17
19
|
editor: {
|
|
@@ -24,37 +26,52 @@ const defaultOptions = {
|
|
|
24
26
|
useVariable: true
|
|
25
27
|
},
|
|
26
28
|
components: {},
|
|
27
|
-
|
|
29
|
+
initOptions: {
|
|
30
|
+
emotion: defaultEmotion
|
|
31
|
+
},
|
|
32
|
+
define: defaultDefine
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
export const create = async (App, options = defaultOptions) => {
|
|
31
|
-
const appIsKey =
|
|
32
|
-
const key = options.key || SYMBOLS_KEY || (appIsKey
|
|
36
|
+
const appIsKey = domqlUtils.isString(App)
|
|
37
|
+
const key = options.key || SYMBOLS_KEY || (appIsKey ? App : '')
|
|
33
38
|
|
|
34
39
|
if (appIsKey) App = {}
|
|
35
40
|
if (key) await fetchProject(key, options)
|
|
36
41
|
|
|
37
|
-
const
|
|
42
|
+
const emotion = defaultEmotion || createEmotion()
|
|
43
|
+
const initOptions = options.initOptions || { emotion }
|
|
44
|
+
const emotionDefine = options.registry || transformDOMQLEmotion(initOptions.emotion, options)
|
|
38
45
|
|
|
39
|
-
|
|
46
|
+
const designSystem = init(options.system || {}, null, {
|
|
47
|
+
key,
|
|
48
|
+
verbose: options.verbose,
|
|
49
|
+
useReset: true,
|
|
50
|
+
useVariable: true,
|
|
51
|
+
...initOptions
|
|
52
|
+
})
|
|
40
53
|
|
|
41
|
-
|
|
42
|
-
extend: [App,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}]
|
|
46
|
-
}, null, 'app', {
|
|
47
|
-
extend: [uikit.Box],
|
|
54
|
+
const domqlElement = DOM.create({
|
|
55
|
+
extend: [App],
|
|
56
|
+
routes: options.pages,
|
|
57
|
+
state: options.state,
|
|
48
58
|
context: {
|
|
49
59
|
key,
|
|
50
60
|
components: { ...uikit, ...options.components },
|
|
51
61
|
state: options.state || {},
|
|
52
62
|
pages: options.pages || {},
|
|
53
63
|
system: designSystem || {},
|
|
54
|
-
utils: { ...utils, ...domqlUtils }
|
|
64
|
+
utils: { ...utils, ...domqlUtils },
|
|
65
|
+
define: defaultDefine,
|
|
66
|
+
registry: emotionDefine
|
|
55
67
|
}
|
|
56
|
-
|
|
68
|
+
}, (options.parent || document).body, key, {
|
|
69
|
+
extend: [uikit.Box],
|
|
70
|
+
verbose: options.verbose,
|
|
71
|
+
...options.domqlOptions
|
|
57
72
|
})
|
|
73
|
+
|
|
74
|
+
return domqlElement
|
|
58
75
|
}
|
|
59
76
|
|
|
60
77
|
export default create
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/create",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.31",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"gitHead": "
|
|
5
|
+
"gitHead": "828e14653b4f33040eaf9f42ba4adcc5111feb91",
|
|
6
6
|
"source": "index.js",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"dependencies": {
|