@domql/event 0.0.1

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 ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@domql/event",
3
+ "version": "0.0.1",
4
+ "main": "index.js",
5
+ "license": "MIT",
6
+ "scripts": {
7
+ "patch": "npm version patch && npm publish"
8
+ }
9
+ }
package/src/can.js ADDED
@@ -0,0 +1,10 @@
1
+ 'use strict'
2
+
3
+ import { NODE_REGISTRY } from '@domql/node'
4
+ import { report } from '@domql/report'
5
+
6
+ export const render = (element) => {
7
+ const tag = element.tag || 'div'
8
+ const isValid = NODE_REGISTRY.body.indexOf(tag) > -1
9
+ return isValid || report('HTMLInvalidTag')
10
+ }
package/src/index.js ADDED
@@ -0,0 +1,11 @@
1
+ 'use strict'
2
+
3
+ import * as on from './on'
4
+ import * as can from './can'
5
+ import * as is from './is'
6
+
7
+ export {
8
+ on,
9
+ can,
10
+ is
11
+ }
package/src/is.js ADDED
@@ -0,0 +1,13 @@
1
+ 'use strict'
2
+
3
+ export const node = (node) => {
4
+ const { Node } = window
5
+ return (
6
+ typeof Node === 'function'
7
+ ? node instanceof Node
8
+ : node &&
9
+ typeof node === 'object' &&
10
+ typeof node.nodeType === 'number' &&
11
+ typeof node.tag === 'string'
12
+ )
13
+ }
package/src/on.js ADDED
@@ -0,0 +1,33 @@
1
+ 'use strict'
2
+
3
+ export const init = (param, element, state) => {
4
+ param(element, state)
5
+ }
6
+
7
+ export const render = (param, element, state) => {
8
+ param(element, state)
9
+ }
10
+
11
+ export const initUpdate = (param, element, state) => {
12
+ param(element, state)
13
+ }
14
+
15
+ export const attachNode = (param, element, state) => {
16
+ param(element, state)
17
+ }
18
+
19
+ export const stateCreated = (param, element, state) => {
20
+ param(element, state)
21
+ }
22
+
23
+ export const initStateUpdated = (param, element, state) => {
24
+ param(element, state)
25
+ }
26
+
27
+ export const stateUpdated = (param, element, state) => {
28
+ param(element, state)
29
+ }
30
+
31
+ export const update = (param, element, state) => {
32
+ param(element, state)
33
+ }
package/src/store.js ADDED
@@ -0,0 +1,6 @@
1
+ 'use strict'
2
+
3
+ export default {
4
+ click: [],
5
+ render: []
6
+ }
@@ -0,0 +1,14 @@
1
+ 'use strict'
2
+
3
+ export const getScrollPositions = () => {
4
+ if (window.pageYOffset !== undefined) {
5
+ return [window.pageXOffset, window.pageYOffset]
6
+ } else {
7
+ const d = document
8
+ const r = d.documentElement
9
+ const b = d.body
10
+ const sx = r.scrollLeft || b.scrollLeft || 0
11
+ const sy = r.scrollTop || b.scrollTop || 0
12
+ return [sx, sy]
13
+ }
14
+ }