domql 1.4.14 → 1.4.17
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/README.md +3 -5
- package/package.json +2 -2
- package/src/element/create.js +3 -3
- package/src/element/index.js +1 -1
- package/src/element/{createNode.js → node.js} +0 -0
- package/src/element/{createProps.js → props.js} +2 -3
- package/src/element/{createState.js → state.js} +0 -0
- package/src/element/update.js +8 -8
package/README.md
CHANGED
|
@@ -7,14 +7,12 @@ DOM rendering Javascript framework.
|
|
|
7
7
|
- No transpilations, simple ES6 code
|
|
8
8
|
- One-time import and subtrees
|
|
9
9
|
|
|
10
|
-
You can start with [starter-kit](https://github.com/
|
|
10
|
+
You can start with [starter-kit](https://github.com/domql/starter-kit) as a boilerplate, or jump into the [playground](https://domql.com/playground/).
|
|
11
11
|
|
|
12
|
-
[](https://travis-ci.org/rackai/domql)
|
|
14
|
-
[](https://coveralls.io/github/rackai/domql?branch=main)
|
|
12
|
+
[](https://badge.fury.io/js/domql)
|
|
15
13
|
|
|
16
14
|
```javascript
|
|
17
|
-
import DOM from '
|
|
15
|
+
import DOM from 'domql'
|
|
18
16
|
|
|
19
17
|
DOM.create({ text: 'Rendered' })
|
|
20
18
|
```
|
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": "rackai",
|
|
6
|
-
"version": "1.4.
|
|
6
|
+
"version": "1.4.17",
|
|
7
7
|
"repository": "https://github.com/rackai/domql",
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"registry": "https://registry.npmjs.org"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@babel/eslint-parser": "^7.16.3",
|
|
31
31
|
"@babel/preset-env": "^7.16.4",
|
|
32
32
|
"@parcel/babel-preset-env": "^2.0.1",
|
|
33
|
-
"babel-jest": "^
|
|
33
|
+
"babel-jest": "^28.1.3",
|
|
34
34
|
"esbuild": "^0.14.47",
|
|
35
35
|
"eslint": "^8.4.0",
|
|
36
36
|
"eslint-config-standard": "^16.0.3",
|
package/src/element/create.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import root from './root'
|
|
4
|
-
import createNode from './
|
|
4
|
+
import createNode from './node'
|
|
5
5
|
import { appendNode, assignNode } from './assign'
|
|
6
6
|
import { applyPrototype } from './proto'
|
|
7
7
|
import nodes from './nodes'
|
|
8
8
|
import set from './set'
|
|
9
|
-
import createState from './
|
|
10
|
-
import createProps from './
|
|
9
|
+
import createState from './state'
|
|
10
|
+
import createProps from './props'
|
|
11
11
|
import update from './update'
|
|
12
12
|
import * as on from '../event/on'
|
|
13
13
|
import { assignClass } from './mixins/classList'
|
package/src/element/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import root from './root'
|
|
|
5
5
|
import tree from './tree'
|
|
6
6
|
import cache from './cache'
|
|
7
7
|
import create from './create'
|
|
8
|
-
import createNode from './
|
|
8
|
+
import createNode from './node'
|
|
9
9
|
import * as assign from './assign'
|
|
10
10
|
import define from './define'
|
|
11
11
|
import update from './update'
|
|
File without changes
|
|
@@ -14,6 +14,8 @@ const initProps = (element, parent) => {
|
|
|
14
14
|
return propValue
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
if (matchParent && props !== 'match') propsStack.push(matchParent)
|
|
18
|
+
|
|
17
19
|
if (isObject(props)) {
|
|
18
20
|
propsStack.push(props)
|
|
19
21
|
} else if (props === 'inherit') {
|
|
@@ -23,7 +25,6 @@ const initProps = (element, parent) => {
|
|
|
23
25
|
let matchParentValue
|
|
24
26
|
//console.log('hasArg', hasArg)
|
|
25
27
|
if (hasArg[1] && parent.props[hasArg[1]]) {
|
|
26
|
-
console.log('hasArg[1]', hasArg[1])
|
|
27
28
|
const secondArgasParentMatchProp = parent.props[hasArg[1]]
|
|
28
29
|
propsStack.push(
|
|
29
30
|
objectizeStringProperty(secondArgasParentMatchProp)
|
|
@@ -36,8 +37,6 @@ const initProps = (element, parent) => {
|
|
|
36
37
|
propsStack.push(matchParentValue)
|
|
37
38
|
} else if (props) propsStack.push(props)
|
|
38
39
|
|
|
39
|
-
if (matchParent && props !== 'match') propsStack.push(matchParent)
|
|
40
|
-
|
|
41
40
|
if (isArray(element.__proto)) {
|
|
42
41
|
element.__proto.map(proto => {
|
|
43
42
|
if (proto.props) propsStack.push(proto.props)
|
|
File without changes
|
package/src/element/update.js
CHANGED
|
@@ -8,8 +8,8 @@ import { throughUpdatedDefine, throughUpdatedExec } from './iterate'
|
|
|
8
8
|
import { merge } from '../utils/object'
|
|
9
9
|
import { appendNode } from './assign'
|
|
10
10
|
import { createNode } from '.'
|
|
11
|
-
import { updateProps } from './
|
|
12
|
-
import createState from './
|
|
11
|
+
import { updateProps } from './props'
|
|
12
|
+
import createState from './state'
|
|
13
13
|
|
|
14
14
|
const UPDATE_DEFAULT_OPTIONS = {
|
|
15
15
|
stackChanges: false,
|
|
@@ -39,17 +39,13 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
if (element.
|
|
43
|
-
preventUpdate = on.initUpdate(element.on.initUpdate, element, element.state)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (!element.__ifFalsy) updateProps(params.props, element, parent)
|
|
42
|
+
if (!element.__ifFalsy && !options.preventPropsUpdate) updateProps(params.props, element, parent)
|
|
47
43
|
|
|
48
44
|
const overwriteChanges = overwrite(element, params, UPDATE_DEFAULT_OPTIONS)
|
|
49
45
|
const execChanges = throughUpdatedExec(element, UPDATE_DEFAULT_OPTIONS)
|
|
50
46
|
const definedChanges = throughUpdatedDefine(element)
|
|
51
47
|
|
|
52
|
-
if (
|
|
48
|
+
if (options.stackChanges && element.__stackChanges) {
|
|
53
49
|
const stackChanges = merge(definedChanges, merge(execChanges, overwriteChanges))
|
|
54
50
|
element.__stackChanges.push(stackChanges)
|
|
55
51
|
}
|
|
@@ -60,6 +56,10 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
|
|
|
60
56
|
return
|
|
61
57
|
}
|
|
62
58
|
|
|
59
|
+
if (element.on && isFunction(element.on.initUpdate) && !options.ignoreInitUpdate) {
|
|
60
|
+
preventUpdate = on.initUpdate(element.on.initUpdate, element, element.state)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
63
|
for (const param in element) {
|
|
64
64
|
const prop = element[param]
|
|
65
65
|
|