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 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.69",
6
+ "version": "1.5.70",
7
7
  "repository": "https://github.com/domql/domql",
8
8
  "publishConfig": {
9
9
  "registry": "https://registry.npmjs.org"
@@ -1,15 +1,17 @@
1
1
  'use strict'
2
2
 
3
- export const splitRoute = (route = window.location.pathname) => route.slice(1).split('/')
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 || window.location.pathname
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) window.history.pushState(state, null, route)
14
+ if (pushState) global.history.pushState(state, null, route)
13
15
  rootElement.set({ extend: content })
14
16
  .node.scrollIntoView({ behavior: 'smooth' })
15
17
  }
@@ -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
- window.requestAnimationFrame(() => childUpdateCall())
133
+ global.requestAnimationFrame(() => childUpdateCall())
133
134
  } else childUpdateCall()
134
135
  }
135
136
  }
package/src/event/is.js CHANGED
@@ -1,9 +1,9 @@
1
1
  'use strict'
2
2
 
3
- import { window } from '@domql/globals'
3
+ import { global } from '@domql/globals'
4
4
 
5
5
  export const node = (node) => {
6
- const { Node } = window
6
+ const { Node } = global
7
7
  return (
8
8
  typeof Node === 'function'
9
9
  ? node instanceof Node
@@ -1,10 +1,10 @@
1
1
  'use strict'
2
2
 
3
- import { document, window } from '@domql/globals'
3
+ import { document, global } from '@domql/globals'
4
4
 
5
5
  export const getScrollPositions = () => {
6
- if (window.pageYOffset !== undefined) {
7
- return [window.pageXOffset, window.pageYOffset]
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 { window } from '@domql/globals'
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') window.tree = tree
7
+ if (ENV === 'test' || ENV === 'development') global.tree = tree
8
8
 
9
9
  export default {
10
10
  create,
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { window } from '@domql/globals'
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 window.Node === 'object'
52
- ? obj instanceof window.Node
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 window.HTMLElement === 'object'
60
- ? obj instanceof window.HTMLElement // DOM2
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
  }