@domql/element 2.5.174 → 2.5.176
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/dist/cjs/methods/index.js +2 -3
- package/dist/cjs/utils/component.js +5 -8
- package/methods/index.js +3 -4
- package/package.json +2 -2
- package/utils/component.js +5 -10
|
@@ -143,7 +143,7 @@ function setNodeStyles(params = {}) {
|
|
|
143
143
|
}
|
|
144
144
|
function remove(opts) {
|
|
145
145
|
const element = this;
|
|
146
|
-
const beforeUpdateReturns = (0, import_event.
|
|
146
|
+
const beforeUpdateReturns = (0, import_event.triggerEventOn)("beforeRemove", element, opts);
|
|
147
147
|
if (beforeUpdateReturns === false)
|
|
148
148
|
return element;
|
|
149
149
|
if ((0, import_utils.isFunction)(element.node.remove))
|
|
@@ -155,7 +155,7 @@ function remove(opts) {
|
|
|
155
155
|
delete element.parent[element.key];
|
|
156
156
|
if (element.parent.__ref)
|
|
157
157
|
element.parent.__ref.__children = (0, import_utils.removeValueFromArray)(element.parent.__ref.__children, element.key);
|
|
158
|
-
(0, import_event.
|
|
158
|
+
(0, import_event.triggerEventOn)("remove", element, opts);
|
|
159
159
|
}
|
|
160
160
|
function get(param) {
|
|
161
161
|
const element = this;
|
|
@@ -256,7 +256,6 @@ function error(...params) {
|
|
|
256
256
|
if (ENV === "test" || ENV === "development") {
|
|
257
257
|
if ((_a = params[params.length - 1]) == null ? void 0 : _a.debugger)
|
|
258
258
|
debugger;
|
|
259
|
-
console.error(...params);
|
|
260
259
|
if ((_b = params[params.length - 1]) == null ? void 0 : _b.verbose)
|
|
261
260
|
verbose.call(this);
|
|
262
261
|
throw new Error(...params);
|
|
@@ -32,17 +32,14 @@ const createValidDomqlObjectFromSugar = (el, parent, key, options) => {
|
|
|
32
32
|
define: {}
|
|
33
33
|
};
|
|
34
34
|
for (const k in el) {
|
|
35
|
-
const
|
|
36
|
-
const isDefine = k.startsWith("is") || k.startsWith("has") || k.startsWith("use");
|
|
37
|
-
if (isDefine) {
|
|
38
|
-
newElem.define[k] = prop;
|
|
39
|
-
}
|
|
35
|
+
const value = el[k];
|
|
40
36
|
const isComponent = (0, import_utils.checkIfKeyIsComponent)(k);
|
|
41
37
|
const isRegistry = import_mixins.REGISTRY[k];
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
const allowedKeys = ["data", "state", "attr", "if"];
|
|
39
|
+
if (isComponent || isRegistry || allowedKeys.includes(k)) {
|
|
40
|
+
newElem[k] = value;
|
|
44
41
|
} else {
|
|
45
|
-
newElem.props[k] =
|
|
42
|
+
newElem.props[k] = value;
|
|
46
43
|
}
|
|
47
44
|
}
|
|
48
45
|
return newElem;
|
package/methods/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { triggerEventOn } from '@domql/event'
|
|
4
4
|
import { isDefined, isObject, isFunction, isObjectLike, isProduction, removeValueFromArray, deepClone } from '@domql/utils'
|
|
5
5
|
import { TREE } from '../tree'
|
|
6
6
|
import { parseFilters, REGISTRY } from '../mixins'
|
|
@@ -103,7 +103,7 @@ export function setNodeStyles (params = {}) {
|
|
|
103
103
|
|
|
104
104
|
export function remove (opts) {
|
|
105
105
|
const element = this
|
|
106
|
-
const beforeUpdateReturns =
|
|
106
|
+
const beforeUpdateReturns = triggerEventOn('beforeRemove', element, opts)
|
|
107
107
|
if (beforeUpdateReturns === false) return element
|
|
108
108
|
if (isFunction(element.node.remove)) element.node.remove()
|
|
109
109
|
else if (!isProduction()) {
|
|
@@ -112,7 +112,7 @@ export function remove (opts) {
|
|
|
112
112
|
}
|
|
113
113
|
delete element.parent[element.key]
|
|
114
114
|
if (element.parent.__ref) element.parent.__ref.__children = removeValueFromArray(element.parent.__ref.__children, element.key)
|
|
115
|
-
|
|
115
|
+
triggerEventOn('remove', element, opts)
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
export function get (param) {
|
|
@@ -219,7 +219,6 @@ export function warn (...params) {
|
|
|
219
219
|
export function error (...params) {
|
|
220
220
|
if (ENV === 'test' || ENV === 'development') {
|
|
221
221
|
if (params[params.length - 1]?.debugger) debugger // eslint-disable-line
|
|
222
|
-
console.error(...params)
|
|
223
222
|
if (params[params.length - 1]?.verbose) verbose.call(this)
|
|
224
223
|
throw new Error(...params)
|
|
225
224
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.176",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@domql/state": "^2.5.173",
|
|
32
32
|
"@domql/utils": "^2.5.170"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "8c1dcbe9e3f548f946f188b24545e7bb1c5317e2",
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/core": "^7.12.0"
|
|
37
37
|
}
|
package/utils/component.js
CHANGED
|
@@ -19,20 +19,15 @@ export const createValidDomqlObjectFromSugar = (el, parent, key, options) => {
|
|
|
19
19
|
define: {}
|
|
20
20
|
}
|
|
21
21
|
for (const k in el) {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const isDefine = k.startsWith('is') || k.startsWith('has') || k.startsWith('use')
|
|
25
|
-
if (isDefine) {
|
|
26
|
-
newElem.define[k] = prop
|
|
27
|
-
// } else if (!isMethod && checkIfKeyIsProperty(k)) {
|
|
28
|
-
}
|
|
22
|
+
const value = el[k]
|
|
29
23
|
|
|
30
24
|
const isComponent = checkIfKeyIsComponent(k)
|
|
31
25
|
const isRegistry = REGISTRY[k]
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
const allowedKeys = ['data', 'state', 'attr', 'if']
|
|
27
|
+
if (isComponent || isRegistry || allowedKeys.includes(k)) {
|
|
28
|
+
newElem[k] = value
|
|
34
29
|
} else {
|
|
35
|
-
newElem.props[k] =
|
|
30
|
+
newElem.props[k] = value
|
|
36
31
|
}
|
|
37
32
|
}
|
|
38
33
|
return newElem
|