@symbo.ls/create 2.10.259 → 2.10.264
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 +2 -1
- package/package.json +2 -2
- package/router.js +5 -5
package/index.js
CHANGED
|
@@ -41,7 +41,7 @@ export const create = async (App, options = DEFAULT_CREATE_OPTIONS, optionsExter
|
|
|
41
41
|
const snippets = { ...utils, ...utils.scratchUtils, ...(options.snippets || {}) }
|
|
42
42
|
const define = options.define || defaultDefine
|
|
43
43
|
|
|
44
|
-
const
|
|
44
|
+
const routerOptions = initRouter(App, options) // eslint-disable-line
|
|
45
45
|
const extend = applySyncDebug([App], options)
|
|
46
46
|
|
|
47
47
|
const domqlApp = DOM.create({
|
|
@@ -59,6 +59,7 @@ export const create = async (App, options = DEFAULT_CREATE_OPTIONS, optionsExter
|
|
|
59
59
|
define,
|
|
60
60
|
registry,
|
|
61
61
|
emotion,
|
|
62
|
+
routerOptions,
|
|
62
63
|
document: doc
|
|
63
64
|
}
|
|
64
65
|
}, doc.body, key, {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/create",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.264",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"gitHead": "
|
|
5
|
+
"gitHead": "8e22af4bcf2790f1926328880f1be5d88ace2ba9",
|
|
6
6
|
"source": "index.js",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"dependencies": {
|
package/router.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { router as defaultRouter } from '@domql/router'
|
|
4
4
|
import { window } from '@domql/globals'
|
|
5
5
|
import { Link, RouterLink } from '@symbo.ls/uikit'
|
|
6
|
-
import { deepMerge } from '@domql/utils'
|
|
6
|
+
import { deepMerge, merge } from '@domql/utils'
|
|
7
7
|
|
|
8
8
|
const DEFAULT_ROUTING_OPTIONS = {
|
|
9
9
|
initRouter: true,
|
|
@@ -12,12 +12,12 @@ const DEFAULT_ROUTING_OPTIONS = {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export const initRouter = (root, options) => {
|
|
15
|
-
let routerOptions = options.routerOptions || DEFAULT_ROUTING_OPTIONS
|
|
15
|
+
let routerOptions = merge(options.routerOptions || {}, DEFAULT_ROUTING_OPTIONS)
|
|
16
16
|
|
|
17
17
|
if (routerOptions === false) return
|
|
18
18
|
if (routerOptions === true) routerOptions = DEFAULT_ROUTING_OPTIONS
|
|
19
19
|
|
|
20
|
-
const router = options.snippets &&
|
|
20
|
+
const router = (options.snippets && options.snippets.router) ? options.snippets.router : defaultRouter
|
|
21
21
|
|
|
22
22
|
const onRender = (el, s) => {
|
|
23
23
|
const { pathname, hash } = window.location
|
|
@@ -37,13 +37,13 @@ export const initRouter = (root, options) => {
|
|
|
37
37
|
|
|
38
38
|
injectRouterInLinkComponent(routerOptions)
|
|
39
39
|
|
|
40
|
-
return
|
|
40
|
+
return routerOptions
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export const popStateRouter = (root, options) => {
|
|
44
44
|
const routerOptions = options.routerOptions || DEFAULT_ROUTING_OPTIONS
|
|
45
45
|
if (!routerOptions.popState) return
|
|
46
|
-
const router = options.snippets &&
|
|
46
|
+
const router = (options.snippets && options.snippets.router) ? options.snippets.router : defaultRouter
|
|
47
47
|
const { pathname, hash } = window.location
|
|
48
48
|
const url = pathname + hash
|
|
49
49
|
window.onpopstate = e => router(root, url, { pushState: false, level: 0 })
|