@symbo.ls/create 2.11.208 → 2.11.210
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/dist/cjs/bundle/index.js +2725 -1435
- package/dist/cjs/index.js +9 -11
- package/dist/cjs/initEmotion.js +5 -5
- package/dist/cjs/options.js +13 -15
- package/dist/cjs/router.js +6 -4
- package/dist/cjs/syncExtend.js +1 -1
- package/package.json +2 -2
- package/src/index.js +8 -9
- package/src/initEmotion.js +7 -6
- package/src/options.js +13 -15
- package/src/router.js +4 -4
- package/src/syncExtend.js +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -51,7 +51,7 @@ const mergeWithLocalFile = (options, optionsExternalFile) => {
|
|
|
51
51
|
};
|
|
52
52
|
const create = async (App, options = import_options.default, optionsExternalFile) => {
|
|
53
53
|
const appIsKey = (0, import_utils.isString)(App);
|
|
54
|
-
options =
|
|
54
|
+
options = { ...import_options.default, ...mergeWithLocalFile(options, optionsExternalFile) };
|
|
55
55
|
const key = options.key || SYMBOLS_KEY || (appIsKey ? App : "");
|
|
56
56
|
if (appIsKey)
|
|
57
57
|
App = {};
|
|
@@ -64,17 +64,15 @@ const create = async (App, options = import_options.default, optionsExternalFile
|
|
|
64
64
|
document = window.document;
|
|
65
65
|
}
|
|
66
66
|
const doc = options.parent || options.document || document;
|
|
67
|
-
const [
|
|
68
|
-
|
|
67
|
+
const [scratcDesignhSystem, emotion, registry] = (0, import_initEmotion.initEmotion)(key, options);
|
|
68
|
+
const state = {};
|
|
69
69
|
if (options.state)
|
|
70
|
-
state
|
|
71
|
-
|
|
72
|
-
state
|
|
73
|
-
else
|
|
74
|
-
state = {};
|
|
70
|
+
(0, import_utils.deepMerge)(state, options.state);
|
|
71
|
+
if (App && App.state)
|
|
72
|
+
(0, import_utils.deepMerge)(state, App.state);
|
|
75
73
|
const pages = options.pages || {};
|
|
76
74
|
const components = options.components ? { ...uikit, ...options.components } : uikit;
|
|
77
|
-
const designSystem =
|
|
75
|
+
const designSystem = scratcDesignhSystem || {};
|
|
78
76
|
const snippets = { ...utils, ...utils.scratchUtils, ...options.snippets || {} };
|
|
79
77
|
const define = options.define || import_define.defaultDefine;
|
|
80
78
|
const routerOptions = (0, import_router.initRouter)(App, options);
|
|
@@ -132,7 +130,7 @@ const createSync = (App, options = import_options.default, optionsExternalFile)
|
|
|
132
130
|
parent = options.document;
|
|
133
131
|
else
|
|
134
132
|
parent = document.body;
|
|
135
|
-
const [
|
|
133
|
+
const [scratcDesignhSystem, emotion, registry] = (0, import_initEmotion.initEmotion)(key, options);
|
|
136
134
|
let state;
|
|
137
135
|
if (options.state)
|
|
138
136
|
state = options.state;
|
|
@@ -142,7 +140,7 @@ const createSync = (App, options = import_options.default, optionsExternalFile)
|
|
|
142
140
|
state = {};
|
|
143
141
|
const pages = options.pages || {};
|
|
144
142
|
const components = options.components ? { ...uikit, ...options.components } : uikit;
|
|
145
|
-
const designSystem =
|
|
143
|
+
const designSystem = scratcDesignhSystem || {};
|
|
146
144
|
const snippets = { ...utils, ...utils.scratchUtils, ...options.snippets || {} };
|
|
147
145
|
const define = options.define || import_define.defaultDefine;
|
|
148
146
|
const extend = (0, import_syncExtend.applySyncDebug)([App], options);
|
package/dist/cjs/initEmotion.js
CHANGED
|
@@ -35,14 +35,14 @@ var import_emotion = require("@domql/emotion");
|
|
|
35
35
|
var import_emotion2 = require("@symbo.ls/emotion");
|
|
36
36
|
var import_init = require("@symbo.ls/init");
|
|
37
37
|
var import_utils = require("@domql/utils");
|
|
38
|
-
var import_options =
|
|
38
|
+
var import_options = require("./options");
|
|
39
39
|
var import_default_config = __toESM(require("@symbo.ls/default-config"), 1);
|
|
40
|
-
const initEmotion = (key, options = import_options.
|
|
40
|
+
const initEmotion = (key, options = import_options.DESIGN_SYSTEM_OPTIONS) => {
|
|
41
41
|
const doc = options.parent || options.document || document;
|
|
42
42
|
const initOptions = options.initOptions || {};
|
|
43
|
-
const emotion = initOptions.emotion
|
|
43
|
+
const emotion = initOptions.emotion;
|
|
44
44
|
if (!initOptions.emotion)
|
|
45
|
-
initOptions.emotion = emotion;
|
|
45
|
+
initOptions.emotion = import_emotion2.emotion;
|
|
46
46
|
const registry = options.registry || (0, import_emotion.transformDOMQLEmotion)(initOptions.emotion, options);
|
|
47
47
|
const designSystem = options.designSystem || (options.defaultConfig ? (0, import_utils.deepClone)(import_default_config.default) : {});
|
|
48
48
|
const scratchSystem = (0, import_init.init)(designSystem, {
|
|
@@ -50,7 +50,7 @@ const initEmotion = (key, options = import_options.default) => {
|
|
|
50
50
|
emotion,
|
|
51
51
|
verbose: options.verbose,
|
|
52
52
|
document: doc,
|
|
53
|
-
...import_options.
|
|
53
|
+
...import_options.DESIGN_SYSTEM_OPTIONS,
|
|
54
54
|
...initOptions
|
|
55
55
|
});
|
|
56
56
|
return [scratchSystem, emotion, registry];
|
package/dist/cjs/options.js
CHANGED
|
@@ -18,28 +18,25 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var options_exports = {};
|
|
20
20
|
__export(options_exports, {
|
|
21
|
+
CREATE_OPTIONS: () => CREATE_OPTIONS,
|
|
22
|
+
DESIGN_SYSTEM_OPTIONS: () => DESIGN_SYSTEM_OPTIONS,
|
|
21
23
|
default: () => options_default
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(options_exports);
|
|
24
26
|
var import_define = require("./define");
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
const DESIGN_SYSTEM_OPTIONS = {
|
|
28
|
+
useReset: true,
|
|
29
|
+
useVariable: true,
|
|
30
|
+
useIconSprite: true,
|
|
31
|
+
useSvgSprite: true,
|
|
32
|
+
useDocumentTheme: true,
|
|
33
|
+
useFontImport: true
|
|
34
|
+
};
|
|
35
|
+
const CREATE_OPTIONS = {
|
|
36
|
+
defaultConfig: true,
|
|
28
37
|
state: {},
|
|
29
38
|
pages: {},
|
|
30
|
-
defaultConfig: true,
|
|
31
|
-
designSystem: {
|
|
32
|
-
useReset: true,
|
|
33
|
-
useVariable: true,
|
|
34
|
-
useIconSprite: true,
|
|
35
|
-
useSvgSprite: true,
|
|
36
|
-
useDocumentTheme: true,
|
|
37
|
-
useFontImport: true
|
|
38
|
-
},
|
|
39
39
|
components: {},
|
|
40
|
-
initOptions: {
|
|
41
|
-
emotion: import_emotion.emotion
|
|
42
|
-
},
|
|
43
40
|
router: {
|
|
44
41
|
initRouter: true,
|
|
45
42
|
popState: true,
|
|
@@ -47,3 +44,4 @@ var options_default = {
|
|
|
47
44
|
},
|
|
48
45
|
define: import_define.defaultDefine
|
|
49
46
|
};
|
|
47
|
+
var options_default = CREATE_OPTIONS;
|
package/dist/cjs/router.js
CHANGED
|
@@ -32,11 +32,13 @@ const DEFAULT_ROUTING_OPTIONS = {
|
|
|
32
32
|
popState: true
|
|
33
33
|
};
|
|
34
34
|
const initRouter = (element, options) => {
|
|
35
|
-
|
|
36
|
-
if (routerOptions === false)
|
|
35
|
+
if (options.router === false)
|
|
37
36
|
return;
|
|
38
|
-
if (
|
|
39
|
-
|
|
37
|
+
else if (options.router === true)
|
|
38
|
+
options.router = DEFAULT_ROUTING_OPTIONS;
|
|
39
|
+
else
|
|
40
|
+
(0, import_utils.merge)(options.router || {}, DEFAULT_ROUTING_OPTIONS);
|
|
41
|
+
const routerOptions = options.router;
|
|
40
42
|
const router = options.snippets && options.snippets.router ? options.snippets.router : import_router.router;
|
|
41
43
|
const onRouterRenderDefault = (el, s) => {
|
|
42
44
|
const { pathname, hash } = import_utils.window.location;
|
package/dist/cjs/syncExtend.js
CHANGED
|
@@ -29,9 +29,9 @@ const applySyncDebug = (extend, options) => {
|
|
|
29
29
|
if (!editor)
|
|
30
30
|
return extend;
|
|
31
31
|
const inspect = (0, import_utils.isUndefined)(editor.inspect) ? (0, import_utils.isDevelopment)() : editor.inspect;
|
|
32
|
-
const liveSync = (0, import_utils.isUndefined)(editor.liveSync) ? (0, import_utils.isDevelopment)() : editor.liveSync;
|
|
33
32
|
if (inspect)
|
|
34
33
|
extend.push(import_socket_ui.DevFocus);
|
|
34
|
+
const liveSync = (0, import_utils.isUndefined)(editor.liveSync) ? (0, import_utils.isDevelopment)() : editor.liveSync;
|
|
35
35
|
if (liveSync)
|
|
36
36
|
extend.push(import_socket_ui.Sync);
|
|
37
37
|
return extend;
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -24,7 +24,7 @@ const mergeWithLocalFile = (options, optionsExternalFile) => {
|
|
|
24
24
|
|
|
25
25
|
export const create = async (App, options = DEFAULT_CREATE_OPTIONS, optionsExternalFile) => {
|
|
26
26
|
const appIsKey = isString(App)
|
|
27
|
-
options =
|
|
27
|
+
options = { ...DEFAULT_CREATE_OPTIONS, ...mergeWithLocalFile(options, optionsExternalFile) }
|
|
28
28
|
|
|
29
29
|
const key = options.key || SYMBOLS_KEY || (appIsKey ? App : '')
|
|
30
30
|
|
|
@@ -37,16 +37,15 @@ export const create = async (App, options = DEFAULT_CREATE_OPTIONS, optionsExter
|
|
|
37
37
|
document = window.document // eslint-disable-line
|
|
38
38
|
}
|
|
39
39
|
const doc = options.parent || options.document || document
|
|
40
|
-
const [
|
|
40
|
+
const [scratcDesignhSystem, emotion, registry] = initEmotion(key, options)
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
if (options.state) state
|
|
44
|
-
|
|
45
|
-
else state = {}
|
|
42
|
+
const state = {}
|
|
43
|
+
if (options.state) deepMerge(state, options.state)
|
|
44
|
+
if (App && App.state) deepMerge(state, App.state)
|
|
46
45
|
|
|
47
46
|
const pages = options.pages || {}
|
|
48
47
|
const components = options.components ? { ...uikit, ...options.components } : uikit
|
|
49
|
-
const designSystem =
|
|
48
|
+
const designSystem = scratcDesignhSystem || {}
|
|
50
49
|
const snippets = { ...utils, ...utils.scratchUtils, ...(options.snippets || {}) }
|
|
51
50
|
const define = options.define || defaultDefine
|
|
52
51
|
|
|
@@ -107,7 +106,7 @@ export const createSync = (App, options = DEFAULT_CREATE_OPTIONS, optionsExterna
|
|
|
107
106
|
else if (options.document) parent = options.document
|
|
108
107
|
else parent = document.body
|
|
109
108
|
|
|
110
|
-
const [
|
|
109
|
+
const [scratcDesignhSystem, emotion, registry] = initEmotion(key, options)
|
|
111
110
|
|
|
112
111
|
let state
|
|
113
112
|
if (options.state) state = options.state
|
|
@@ -116,7 +115,7 @@ export const createSync = (App, options = DEFAULT_CREATE_OPTIONS, optionsExterna
|
|
|
116
115
|
|
|
117
116
|
const pages = options.pages || {}
|
|
118
117
|
const components = options.components ? { ...uikit, ...options.components } : uikit
|
|
119
|
-
const designSystem =
|
|
118
|
+
const designSystem = scratcDesignhSystem || {}
|
|
120
119
|
const snippets = { ...utils, ...utils.scratchUtils, ...(options.snippets || {}) }
|
|
121
120
|
const define = options.define || defaultDefine
|
|
122
121
|
|
package/src/initEmotion.js
CHANGED
|
@@ -5,16 +5,17 @@ import { emotion as defaultEmotion } from '@symbo.ls/emotion'
|
|
|
5
5
|
import { init } from '@symbo.ls/init'
|
|
6
6
|
import { deepClone } from '@domql/utils'
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import { DESIGN_SYSTEM_OPTIONS } from './options'
|
|
9
9
|
import DEFAULT_CONFIG from '@symbo.ls/default-config'
|
|
10
10
|
|
|
11
|
-
export const initEmotion = (key, options =
|
|
11
|
+
export const initEmotion = (key, options = DESIGN_SYSTEM_OPTIONS) => {
|
|
12
12
|
const doc = options.parent || options.document || document
|
|
13
13
|
const initOptions = options.initOptions || {}
|
|
14
|
-
const emotion = initOptions.emotion
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const emotion = initOptions.emotion
|
|
15
|
+
|
|
16
|
+
if (!initOptions.emotion) initOptions.emotion = defaultEmotion
|
|
17
17
|
|
|
18
|
+
const registry = options.registry || transformDOMQLEmotion(initOptions.emotion, options)
|
|
18
19
|
const designSystem = options.designSystem || (options.defaultConfig ? deepClone(DEFAULT_CONFIG) : {})
|
|
19
20
|
|
|
20
21
|
const scratchSystem = init(designSystem, {
|
|
@@ -22,7 +23,7 @@ export const initEmotion = (key, options = DEFAULT_CREATE_OPTIONS) => {
|
|
|
22
23
|
emotion,
|
|
23
24
|
verbose: options.verbose,
|
|
24
25
|
document: doc,
|
|
25
|
-
...
|
|
26
|
+
...DESIGN_SYSTEM_OPTIONS,
|
|
26
27
|
...initOptions
|
|
27
28
|
})
|
|
28
29
|
|
package/src/options.js
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import { defaultDefine } from './define'
|
|
4
|
-
import { emotion as defaultEmotion } from '@symbo.ls/emotion'
|
|
5
4
|
|
|
6
|
-
export
|
|
7
|
-
|
|
5
|
+
export const DESIGN_SYSTEM_OPTIONS = {
|
|
6
|
+
useReset: true,
|
|
7
|
+
useVariable: true,
|
|
8
|
+
useIconSprite: true,
|
|
9
|
+
useSvgSprite: true,
|
|
10
|
+
useDocumentTheme: true,
|
|
11
|
+
useFontImport: true
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const CREATE_OPTIONS = {
|
|
15
|
+
defaultConfig: true,
|
|
8
16
|
state: {},
|
|
9
17
|
pages: {},
|
|
10
|
-
defaultConfig: true,
|
|
11
|
-
designSystem: {
|
|
12
|
-
useReset: true,
|
|
13
|
-
useVariable: true,
|
|
14
|
-
useIconSprite: true,
|
|
15
|
-
useSvgSprite: true,
|
|
16
|
-
useDocumentTheme: true,
|
|
17
|
-
useFontImport: true
|
|
18
|
-
},
|
|
19
18
|
components: {},
|
|
20
|
-
initOptions: {
|
|
21
|
-
emotion: defaultEmotion
|
|
22
|
-
},
|
|
23
19
|
router: {
|
|
24
20
|
initRouter: true,
|
|
25
21
|
popState: true,
|
|
@@ -27,3 +23,5 @@ export default {
|
|
|
27
23
|
},
|
|
28
24
|
define: defaultDefine
|
|
29
25
|
}
|
|
26
|
+
|
|
27
|
+
export default CREATE_OPTIONS
|
package/src/router.js
CHANGED
|
@@ -11,11 +11,11 @@ const DEFAULT_ROUTING_OPTIONS = {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const initRouter = (element, options) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (routerOptions === true) routerOptions = DEFAULT_ROUTING_OPTIONS
|
|
14
|
+
if (options.router === false) return
|
|
15
|
+
else if (options.router === true) options.router = DEFAULT_ROUTING_OPTIONS
|
|
16
|
+
else merge(options.router || {}, DEFAULT_ROUTING_OPTIONS)
|
|
18
17
|
|
|
18
|
+
const routerOptions = options.router
|
|
19
19
|
const router = (options.snippets && options.snippets.router) ? options.snippets.router : defaultRouter
|
|
20
20
|
|
|
21
21
|
const onRouterRenderDefault = (el, s) => {
|
package/src/syncExtend.js
CHANGED
|
@@ -7,8 +7,8 @@ export const applySyncDebug = (extend, options) => {
|
|
|
7
7
|
const { editor } = options
|
|
8
8
|
if (!editor) return extend
|
|
9
9
|
const inspect = isUndefined(editor.inspect) ? isDevelopment() : editor.inspect
|
|
10
|
-
const liveSync = isUndefined(editor.liveSync) ? isDevelopment() : editor.liveSync
|
|
11
10
|
if (inspect) extend.push(DevFocus)
|
|
11
|
+
const liveSync = isUndefined(editor.liveSync) ? isDevelopment() : editor.liveSync
|
|
12
12
|
if (liveSync) extend.push(Sync)
|
|
13
13
|
return extend
|
|
14
14
|
}
|