domql 1.5.69 → 1.5.70
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/package.json +1 -1
- package/packages/router/index.js +5 -3
- package/src/element/update.js +2 -1
- package/src/event/is.js +2 -2
- package/src/event/wrappers.js +3 -3
- package/src/index.js +2 -2
- package/src/utils/object.js +5 -5
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "DOM rendering Javascript framework at early stage.",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "symbo.ls",
|
|
6
|
-
"version": "1.5.
|
|
6
|
+
"version": "1.5.70",
|
|
7
7
|
"repository": "https://github.com/domql/domql",
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"registry": "https://registry.npmjs.org"
|
package/packages/router/index.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { global } from '@domql/globals'
|
|
4
|
+
|
|
5
|
+
export const splitRoute = (route = global.location.pathname) => route.slice(1).split('/')
|
|
4
6
|
|
|
5
7
|
export default (rootElement, path, state = {}, level = 0, pushState = true) => {
|
|
6
|
-
const route = path ||
|
|
8
|
+
const route = path || global.location.pathname
|
|
7
9
|
const routes = splitRoute(route)
|
|
8
10
|
|
|
9
11
|
const content = rootElement.routes[`/${routes[level]}`]
|
|
10
12
|
|
|
11
13
|
if (content) {
|
|
12
|
-
if (pushState)
|
|
14
|
+
if (pushState) global.history.pushState(state, null, route)
|
|
13
15
|
rootElement.set({ extend: content })
|
|
14
16
|
.node.scrollIntoView({ behavior: 'smooth' })
|
|
15
17
|
}
|
package/src/element/update.js
CHANGED
|
@@ -10,6 +10,7 @@ import { createNode } from './node'
|
|
|
10
10
|
import { updateProps } from './props'
|
|
11
11
|
import createState from './state'
|
|
12
12
|
import { diff } from '@domql/utils'
|
|
13
|
+
import { global } from '@domql/globals'
|
|
13
14
|
|
|
14
15
|
const snapshot = {
|
|
15
16
|
snapshotId: createSnapshotId
|
|
@@ -129,7 +130,7 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
|
|
|
129
130
|
calleeElement: element
|
|
130
131
|
})
|
|
131
132
|
if (element.props.lazyLoad || options.lazyLoad) {
|
|
132
|
-
|
|
133
|
+
global.requestAnimationFrame(() => childUpdateCall())
|
|
133
134
|
} else childUpdateCall()
|
|
134
135
|
}
|
|
135
136
|
}
|
package/src/event/is.js
CHANGED
package/src/event/wrappers.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { document,
|
|
3
|
+
import { document, global } from '@domql/globals'
|
|
4
4
|
|
|
5
5
|
export const getScrollPositions = () => {
|
|
6
|
-
if (
|
|
7
|
-
return [
|
|
6
|
+
if (global.pageYOffset !== undefined) {
|
|
7
|
+
return [global.pageXOffset, global.pageYOffset]
|
|
8
8
|
} else {
|
|
9
9
|
const d = document
|
|
10
10
|
const r = d.documentElement
|
package/src/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { global } from '@domql/globals'
|
|
4
4
|
import { create, parse, set, define, tree } from './element'
|
|
5
5
|
|
|
6
6
|
const ENV = process.env.NODE_ENV
|
|
7
|
-
if (ENV === 'test' || ENV === 'development')
|
|
7
|
+
if (ENV === 'test' || ENV === 'development') global.tree = tree
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
10
|
create,
|
package/src/utils/object.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { global } from '@domql/globals'
|
|
4
4
|
import nodes from '../element/nodes'
|
|
5
5
|
|
|
6
6
|
export const memoize = (fn) => {
|
|
@@ -48,16 +48,16 @@ export const isObjectLike = arg => {
|
|
|
48
48
|
|
|
49
49
|
export const isNode = obj => {
|
|
50
50
|
return (
|
|
51
|
-
typeof
|
|
52
|
-
? obj instanceof
|
|
51
|
+
typeof global.Node === 'object'
|
|
52
|
+
? obj instanceof global.Node
|
|
53
53
|
: obj && typeof obj === 'object' && typeof obj.nodeType === 'number' && typeof obj.nodeName === 'string'
|
|
54
54
|
)
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export const isHtmlElement = obj => {
|
|
58
58
|
return (
|
|
59
|
-
typeof
|
|
60
|
-
? obj instanceof
|
|
59
|
+
typeof global.HTMLElement === 'object'
|
|
60
|
+
? obj instanceof global.HTMLElement // DOM2
|
|
61
61
|
: obj && typeof obj === 'object' && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === 'string'
|
|
62
62
|
)
|
|
63
63
|
}
|