@domql/element 2.5.145 → 2.5.147
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/create.js +2 -2
- package/dist/cjs/create.js +2 -2
- package/dist/cjs/methods/index.js +59 -36
- package/dist/cjs/methods/set.js +7 -3
- package/dist/cjs/update.js +1 -1
- package/dist/cjs/utils/onlyResolveExtends.js +1 -1
- package/methods/index.js +43 -21
- package/methods/set.js +12 -4
- package/package.json +6 -6
- package/update.js +2 -2
- package/utils/onlyResolveExtends.js +1 -1
package/create.js
CHANGED
|
@@ -80,7 +80,7 @@ const create = (element, parent, key, options = OPTIONS.create || {}, attachOpti
|
|
|
80
80
|
|
|
81
81
|
addCaching(element, parent)
|
|
82
82
|
|
|
83
|
-
addMethods(element, parent)
|
|
83
|
+
addMethods(element, parent, options)
|
|
84
84
|
|
|
85
85
|
createScope(element, parent)
|
|
86
86
|
|
|
@@ -342,7 +342,7 @@ const onlyResolveExtends = (element, parent, key, options) => {
|
|
|
342
342
|
if (!ref.__skipCreate) {
|
|
343
343
|
addCaching(element, parent)
|
|
344
344
|
|
|
345
|
-
addMethods(element, parent)
|
|
345
|
+
addMethods(element, parent, options)
|
|
346
346
|
|
|
347
347
|
createScope(element, parent)
|
|
348
348
|
|
package/dist/cjs/create.js
CHANGED
|
@@ -68,7 +68,7 @@ const create = (element, parent, key, options = import_options.default.create ||
|
|
|
68
68
|
}
|
|
69
69
|
switchDefaultOptions(element, parent, options);
|
|
70
70
|
addCaching(element, parent);
|
|
71
|
-
(0, import_set.addMethods)(element, parent);
|
|
71
|
+
(0, import_set.addMethods)(element, parent, options);
|
|
72
72
|
createScope(element, parent);
|
|
73
73
|
(0, import_state.createState)(element, parent);
|
|
74
74
|
if (element.scope === "state")
|
|
@@ -273,7 +273,7 @@ const onlyResolveExtends = (element, parent, key, options) => {
|
|
|
273
273
|
const { __ref: ref } = element;
|
|
274
274
|
if (!ref.__skipCreate) {
|
|
275
275
|
addCaching(element, parent);
|
|
276
|
-
(0, import_set.addMethods)(element, parent);
|
|
276
|
+
(0, import_set.addMethods)(element, parent, options);
|
|
277
277
|
createScope(element, parent);
|
|
278
278
|
(0, import_state.createState)(element, parent);
|
|
279
279
|
if (element.scope === "state")
|
|
@@ -20,6 +20,7 @@ var methods_exports = {};
|
|
|
20
20
|
__export(methods_exports, {
|
|
21
21
|
METHODS: () => METHODS,
|
|
22
22
|
defineSetter: () => defineSetter,
|
|
23
|
+
error: () => error,
|
|
23
24
|
get: () => get,
|
|
24
25
|
isMethod: () => isMethod,
|
|
25
26
|
keys: () => keys,
|
|
@@ -35,13 +36,16 @@ __export(methods_exports, {
|
|
|
35
36
|
setNodeStyles: () => setNodeStyles,
|
|
36
37
|
setProps: () => setProps,
|
|
37
38
|
spotByPath: () => spotByPath,
|
|
38
|
-
variables: () => variables
|
|
39
|
+
variables: () => variables,
|
|
40
|
+
verbose: () => verbose,
|
|
41
|
+
warn: () => warn
|
|
39
42
|
});
|
|
40
43
|
module.exports = __toCommonJS(methods_exports);
|
|
41
44
|
var import_utils = require("@domql/utils");
|
|
42
45
|
var import_tree = require("../tree");
|
|
43
46
|
var import_mixins = require("../mixins");
|
|
44
|
-
const
|
|
47
|
+
const ENV = "development";
|
|
48
|
+
function spotByPath(path) {
|
|
45
49
|
const element = this;
|
|
46
50
|
const arr = [].concat(path);
|
|
47
51
|
let active = import_tree.TREE[arr[0]];
|
|
@@ -56,8 +60,8 @@ const spotByPath = function(path) {
|
|
|
56
60
|
return;
|
|
57
61
|
}
|
|
58
62
|
return active;
|
|
59
|
-
}
|
|
60
|
-
|
|
63
|
+
}
|
|
64
|
+
function lookup(param) {
|
|
61
65
|
const el = this;
|
|
62
66
|
let { parent } = el;
|
|
63
67
|
if ((0, import_utils.isFunction)(param)) {
|
|
@@ -78,8 +82,8 @@ const lookup = function(param) {
|
|
|
78
82
|
return;
|
|
79
83
|
}
|
|
80
84
|
return parent;
|
|
81
|
-
}
|
|
82
|
-
|
|
85
|
+
}
|
|
86
|
+
function lookdown(param) {
|
|
83
87
|
var _a;
|
|
84
88
|
const el = this;
|
|
85
89
|
const { __ref: ref } = el;
|
|
@@ -100,8 +104,8 @@ const lookdown = function(param) {
|
|
|
100
104
|
return lookdown2;
|
|
101
105
|
}
|
|
102
106
|
return null;
|
|
103
|
-
}
|
|
104
|
-
|
|
107
|
+
}
|
|
108
|
+
function lookdownAll(param, results = []) {
|
|
105
109
|
var _a;
|
|
106
110
|
const el = this;
|
|
107
111
|
const { __ref: ref } = el;
|
|
@@ -119,8 +123,8 @@ const lookdownAll = function(param, results = []) {
|
|
|
119
123
|
(_a = childElem == null ? void 0 : childElem.lookdownAll) == null ? void 0 : _a.call(childElem, param, results);
|
|
120
124
|
}
|
|
121
125
|
return results.length ? results : null;
|
|
122
|
-
}
|
|
123
|
-
|
|
126
|
+
}
|
|
127
|
+
function setNodeStyles(params = {}) {
|
|
124
128
|
var _a;
|
|
125
129
|
const el = this;
|
|
126
130
|
if (!((_a = el.node) == null ? void 0 : _a.style))
|
|
@@ -134,8 +138,8 @@ const setNodeStyles = function(params = {}) {
|
|
|
134
138
|
el.node.style[param] = value;
|
|
135
139
|
}
|
|
136
140
|
return el;
|
|
137
|
-
}
|
|
138
|
-
|
|
141
|
+
}
|
|
142
|
+
function remove() {
|
|
139
143
|
const element = this;
|
|
140
144
|
if ((0, import_utils.isFunction)(element.node.remove))
|
|
141
145
|
element.node.remove();
|
|
@@ -146,20 +150,20 @@ const remove = function() {
|
|
|
146
150
|
delete element.parent[element.key];
|
|
147
151
|
if (element.parent.__ref)
|
|
148
152
|
element.parent.__ref.__children = (0, import_utils.removeValueFromArray)(element.parent.__ref.__children, element.key);
|
|
149
|
-
}
|
|
150
|
-
|
|
153
|
+
}
|
|
154
|
+
function get(param) {
|
|
151
155
|
const element = this;
|
|
152
156
|
return element[param];
|
|
153
|
-
}
|
|
154
|
-
|
|
157
|
+
}
|
|
158
|
+
function setProps(param, options) {
|
|
155
159
|
const element = this;
|
|
156
160
|
if (!param || !element.props)
|
|
157
161
|
return;
|
|
158
162
|
element.update({ props: param }, options);
|
|
159
163
|
return element;
|
|
160
|
-
}
|
|
164
|
+
}
|
|
161
165
|
const defineSetter = (element, key, get2, set) => Object.defineProperty(element, key, { get: get2, set });
|
|
162
|
-
|
|
166
|
+
function keys() {
|
|
163
167
|
const element = this;
|
|
164
168
|
const keys2 = [];
|
|
165
169
|
for (const param in element) {
|
|
@@ -169,12 +173,13 @@ const keys = function() {
|
|
|
169
173
|
keys2.push(param);
|
|
170
174
|
}
|
|
171
175
|
return keys2;
|
|
172
|
-
}
|
|
173
|
-
|
|
176
|
+
}
|
|
177
|
+
function parse(excl = []) {
|
|
174
178
|
const element = this;
|
|
175
179
|
const obj = {};
|
|
176
180
|
const keyList = keys.call(element);
|
|
177
181
|
keyList.forEach((v) => {
|
|
182
|
+
var _a;
|
|
178
183
|
if (excl.includes(v))
|
|
179
184
|
return;
|
|
180
185
|
const val = element[v];
|
|
@@ -190,12 +195,12 @@ const parse = function(excl = []) {
|
|
|
190
195
|
} else if (v === "props") {
|
|
191
196
|
const { __element, update, ...props } = element[v];
|
|
192
197
|
obj[v] = props;
|
|
193
|
-
} else if ((0, import_utils.isDefined)(val))
|
|
198
|
+
} else if ((0, import_utils.isDefined)(val) && !((_a = element.context) == null ? void 0 : _a.methods[v]))
|
|
194
199
|
obj[v] = val;
|
|
195
200
|
});
|
|
196
201
|
return obj;
|
|
197
|
-
}
|
|
198
|
-
|
|
202
|
+
}
|
|
203
|
+
function parseDeep(excl = []) {
|
|
199
204
|
const element = this;
|
|
200
205
|
const obj = parse.call(element, excl);
|
|
201
206
|
for (const v in obj) {
|
|
@@ -206,32 +211,47 @@ const parseDeep = function(excl = []) {
|
|
|
206
211
|
}
|
|
207
212
|
}
|
|
208
213
|
return obj;
|
|
209
|
-
}
|
|
210
|
-
|
|
214
|
+
}
|
|
215
|
+
function verbose(...args) {
|
|
211
216
|
const element = this;
|
|
212
|
-
const { __ref } = element;
|
|
217
|
+
const { __ref: ref } = element;
|
|
213
218
|
console.group(element.key);
|
|
214
219
|
if (args.length) {
|
|
215
220
|
args.forEach((v) => console.log(`%c${v}:
|
|
216
221
|
`, "font-weight: bold", element[v]));
|
|
217
222
|
} else {
|
|
218
|
-
console.log(
|
|
223
|
+
console.log(ref.path);
|
|
219
224
|
const keys2 = element.keys();
|
|
220
225
|
keys2.forEach((v) => console.log(`%c${v}:
|
|
221
226
|
`, "font-weight: bold", element[v]));
|
|
222
227
|
}
|
|
223
228
|
console.groupEnd(element.key);
|
|
224
229
|
return element;
|
|
225
|
-
}
|
|
226
|
-
|
|
230
|
+
}
|
|
231
|
+
function log(...params) {
|
|
232
|
+
if (ENV === "test" || ENV === "development") {
|
|
233
|
+
console.log(...params);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function warn(...params) {
|
|
237
|
+
if (ENV === "test" || ENV === "development") {
|
|
238
|
+
console.warn(...params);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
function error(...params) {
|
|
242
|
+
if (ENV === "test" || ENV === "development") {
|
|
243
|
+
console.error(...params);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
function nextElement() {
|
|
227
247
|
const element = this;
|
|
228
248
|
const { key, parent } = element;
|
|
229
249
|
const { __children } = parent.__ref;
|
|
230
250
|
const currentIndex = __children.indexOf(key);
|
|
231
251
|
const nextChild = __children[currentIndex + 1];
|
|
232
252
|
return parent[nextChild];
|
|
233
|
-
}
|
|
234
|
-
|
|
253
|
+
}
|
|
254
|
+
function previousElement(el) {
|
|
235
255
|
const element = el || this;
|
|
236
256
|
const { key, parent } = element;
|
|
237
257
|
const { __children } = parent.__ref;
|
|
@@ -239,8 +259,8 @@ const previousElement = function(el) {
|
|
|
239
259
|
return;
|
|
240
260
|
const currentIndex = __children.indexOf(key);
|
|
241
261
|
return parent[__children[currentIndex - 1]];
|
|
242
|
-
}
|
|
243
|
-
|
|
262
|
+
}
|
|
263
|
+
function variables(obj = {}) {
|
|
244
264
|
const element = this;
|
|
245
265
|
if (!element.data)
|
|
246
266
|
element.data = {};
|
|
@@ -274,7 +294,7 @@ const variables = function(obj = {}) {
|
|
|
274
294
|
}, timeout);
|
|
275
295
|
}
|
|
276
296
|
};
|
|
277
|
-
}
|
|
297
|
+
}
|
|
278
298
|
const METHODS = [
|
|
279
299
|
"set",
|
|
280
300
|
"reset",
|
|
@@ -294,10 +314,13 @@ const METHODS = [
|
|
|
294
314
|
"variables",
|
|
295
315
|
"if",
|
|
296
316
|
"log",
|
|
317
|
+
"verbose",
|
|
318
|
+
"warn",
|
|
319
|
+
"error",
|
|
297
320
|
"nextElement",
|
|
298
321
|
"previousElement"
|
|
299
322
|
];
|
|
300
|
-
|
|
323
|
+
function isMethod(param, element) {
|
|
301
324
|
var _a, _b;
|
|
302
325
|
return METHODS.includes(param) || ((_b = (_a = element == null ? void 0 : element.context) == null ? void 0 : _a.methods) == null ? void 0 : _b[param]);
|
|
303
|
-
}
|
|
326
|
+
}
|
package/dist/cjs/methods/set.js
CHANGED
|
@@ -36,7 +36,7 @@ var import_set = __toESM(require("../set"), 1);
|
|
|
36
36
|
var import_update = __toESM(require("../update"), 1);
|
|
37
37
|
var import__ = require("./");
|
|
38
38
|
var import_content = require("../mixins/content");
|
|
39
|
-
const addMethods = (element, parent, options) => {
|
|
39
|
+
const addMethods = (element, parent, options = {}) => {
|
|
40
40
|
const proto = {
|
|
41
41
|
set: import_set.default,
|
|
42
42
|
reset: import_set.reset,
|
|
@@ -58,8 +58,12 @@ const addMethods = (element, parent, options) => {
|
|
|
58
58
|
previousElement: import__.previousElement
|
|
59
59
|
};
|
|
60
60
|
if (element.context.methods)
|
|
61
|
-
(
|
|
62
|
-
if ((0, import_utils.isDevelopment)())
|
|
61
|
+
(options.strict ? import_utils.merge : import_utils.overwrite)(proto, element.context.methods);
|
|
62
|
+
if ((0, import_utils.isDevelopment)()) {
|
|
63
63
|
proto.log = import__.log;
|
|
64
|
+
proto.verbose = import__.verbose;
|
|
65
|
+
proto.warn = import__.warn;
|
|
66
|
+
proto.error = import__.error;
|
|
67
|
+
}
|
|
64
68
|
Object.setPrototypeOf(element, proto);
|
|
65
69
|
};
|
package/dist/cjs/update.js
CHANGED
|
@@ -93,7 +93,7 @@ const update = function(params = {}, opts) {
|
|
|
93
93
|
if (beforeUpdateReturns === false)
|
|
94
94
|
return element;
|
|
95
95
|
}
|
|
96
|
-
(0, import_utils.overwriteDeep)(element, params, import_utils2.METHODS_EXL);
|
|
96
|
+
(0, import_utils.overwriteDeep)(element, params, { exclude: import_utils2.METHODS_EXL });
|
|
97
97
|
(0, import_iterate.throughExecProps)(element);
|
|
98
98
|
(0, import_iterate.throughUpdatedExec)(element, { ignore: UPDATE_DEFAULT_OPTIONS });
|
|
99
99
|
(0, import_iterate.throughUpdatedDefine)(element);
|
|
@@ -55,7 +55,7 @@ const onlyResolveExtends = (element, parent, key, options) => {
|
|
|
55
55
|
if (!ref2.__children)
|
|
56
56
|
ref2.__children = [];
|
|
57
57
|
}
|
|
58
|
-
(0, import_set.addMethods)(element, parent);
|
|
58
|
+
(0, import_set.addMethods)(element, parent, options);
|
|
59
59
|
(0, import_state.createState)(element, parent);
|
|
60
60
|
const ref = __ref;
|
|
61
61
|
if ((0, import_utils.isFunction)(element.if)) {
|
package/methods/index.js
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
import { isDefined, isObject, isFunction, isObjectLike, isProduction, removeValueFromArray, deepClone } from '@domql/utils'
|
|
4
4
|
import { TREE } from '../tree'
|
|
5
5
|
import { parseFilters, registry } from '../mixins'
|
|
6
|
+
const ENV = process.env.NODE_ENV
|
|
6
7
|
|
|
7
8
|
// TODO: update these files
|
|
8
|
-
export
|
|
9
|
+
export function spotByPath (path) {
|
|
9
10
|
const element = this
|
|
10
11
|
const arr = [].concat(path)
|
|
11
12
|
let active = TREE[arr[0]]
|
|
@@ -23,7 +24,7 @@ export const spotByPath = function (path) {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
// TODO: update these files
|
|
26
|
-
export
|
|
27
|
+
export function lookup (param) {
|
|
27
28
|
const el = this
|
|
28
29
|
let { parent } = el
|
|
29
30
|
|
|
@@ -44,7 +45,7 @@ export const lookup = function (param) {
|
|
|
44
45
|
return parent
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
export
|
|
48
|
+
export function lookdown (param) {
|
|
48
49
|
const el = this
|
|
49
50
|
const { __ref: ref } = el
|
|
50
51
|
const children = ref.__children
|
|
@@ -67,7 +68,7 @@ export const lookdown = function (param) {
|
|
|
67
68
|
return null
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
export
|
|
71
|
+
export function lookdownAll (param, results = []) {
|
|
71
72
|
const el = this
|
|
72
73
|
const { __ref: ref } = el
|
|
73
74
|
const children = ref.__children
|
|
@@ -87,7 +88,7 @@ export const lookdownAll = function (param, results = []) {
|
|
|
87
88
|
return results.length ? results : null
|
|
88
89
|
}
|
|
89
90
|
|
|
90
|
-
export
|
|
91
|
+
export function setNodeStyles (params = {}) {
|
|
91
92
|
const el = this
|
|
92
93
|
if (!el.node?.style) return
|
|
93
94
|
|
|
@@ -101,7 +102,7 @@ export const setNodeStyles = function (params = {}) {
|
|
|
101
102
|
return el
|
|
102
103
|
}
|
|
103
104
|
|
|
104
|
-
export
|
|
105
|
+
export function remove () {
|
|
105
106
|
const element = this
|
|
106
107
|
if (isFunction(element.node.remove)) element.node.remove()
|
|
107
108
|
else if (!isProduction()) {
|
|
@@ -112,28 +113,28 @@ export const remove = function () {
|
|
|
112
113
|
if (element.parent.__ref) element.parent.__ref.__children = removeValueFromArray(element.parent.__ref.__children, element.key)
|
|
113
114
|
}
|
|
114
115
|
|
|
115
|
-
export
|
|
116
|
+
export function get (param) {
|
|
116
117
|
const element = this
|
|
117
118
|
return element[param]
|
|
118
119
|
}
|
|
119
120
|
|
|
120
|
-
export
|
|
121
|
+
export function setProps (param, options) {
|
|
121
122
|
const element = this
|
|
122
123
|
if (!param || !element.props) return
|
|
123
124
|
element.update({ props: param }, options)
|
|
124
125
|
return element
|
|
125
126
|
}
|
|
126
127
|
|
|
127
|
-
// export
|
|
128
|
+
// export function set () {
|
|
128
129
|
// }
|
|
129
130
|
|
|
130
|
-
// export
|
|
131
|
+
// export function update () {
|
|
131
132
|
// }
|
|
132
133
|
|
|
133
134
|
export const defineSetter = (element, key, get, set) =>
|
|
134
135
|
Object.defineProperty(element, key, { get, set })
|
|
135
136
|
|
|
136
|
-
export
|
|
137
|
+
export function keys () {
|
|
137
138
|
const element = this
|
|
138
139
|
const keys = []
|
|
139
140
|
for (const param in element) {
|
|
@@ -143,7 +144,7 @@ export const keys = function () {
|
|
|
143
144
|
return keys
|
|
144
145
|
}
|
|
145
146
|
|
|
146
|
-
export
|
|
147
|
+
export function parse (excl = []) {
|
|
147
148
|
const element = this
|
|
148
149
|
const obj = {}
|
|
149
150
|
const keyList = keys.call(element)
|
|
@@ -160,12 +161,12 @@ export const parse = function (excl = []) {
|
|
|
160
161
|
} else if (v === 'props') {
|
|
161
162
|
const { __element, update, ...props } = element[v]
|
|
162
163
|
obj[v] = props
|
|
163
|
-
} else if (isDefined(val)) obj[v] = val
|
|
164
|
+
} else if (isDefined(val) && !element.context?.methods[v]) obj[v] = val
|
|
164
165
|
})
|
|
165
166
|
return obj
|
|
166
167
|
}
|
|
167
168
|
|
|
168
|
-
export
|
|
169
|
+
export function parseDeep (excl = []) {
|
|
169
170
|
const element = this
|
|
170
171
|
const obj = parse.call(element, excl)
|
|
171
172
|
for (const v in obj) {
|
|
@@ -175,14 +176,14 @@ export const parseDeep = function (excl = []) {
|
|
|
175
176
|
return obj
|
|
176
177
|
}
|
|
177
178
|
|
|
178
|
-
export
|
|
179
|
+
export function verbose (...args) {
|
|
179
180
|
const element = this
|
|
180
|
-
const { __ref } = element
|
|
181
|
+
const { __ref: ref } = element
|
|
181
182
|
console.group(element.key)
|
|
182
183
|
if (args.length) {
|
|
183
184
|
args.forEach(v => console.log(`%c${v}:\n`, 'font-weight: bold', element[v]))
|
|
184
185
|
} else {
|
|
185
|
-
console.log(
|
|
186
|
+
console.log(ref.path)
|
|
186
187
|
const keys = element.keys()
|
|
187
188
|
keys.forEach(v => console.log(`%c${v}:\n`, 'font-weight: bold', element[v]))
|
|
188
189
|
}
|
|
@@ -190,7 +191,25 @@ export const log = function (...args) {
|
|
|
190
191
|
return element
|
|
191
192
|
}
|
|
192
193
|
|
|
193
|
-
export
|
|
194
|
+
export function log (...params) {
|
|
195
|
+
if (ENV === 'test' || ENV === 'development') {
|
|
196
|
+
console.log(...params)
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export function warn (...params) {
|
|
201
|
+
if (ENV === 'test' || ENV === 'development') {
|
|
202
|
+
console.warn(...params)
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export function error (...params) {
|
|
207
|
+
if (ENV === 'test' || ENV === 'development') {
|
|
208
|
+
console.error(...params)
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export function nextElement () {
|
|
194
213
|
const element = this
|
|
195
214
|
const { key, parent } = element
|
|
196
215
|
const { __children } = parent.__ref
|
|
@@ -201,7 +220,7 @@ export const nextElement = function () {
|
|
|
201
220
|
return parent[nextChild]
|
|
202
221
|
}
|
|
203
222
|
|
|
204
|
-
export
|
|
223
|
+
export function previousElement (el) {
|
|
205
224
|
const element = el || this
|
|
206
225
|
const { key, parent } = element
|
|
207
226
|
const { __children } = parent.__ref
|
|
@@ -212,7 +231,7 @@ export const previousElement = function (el) {
|
|
|
212
231
|
return parent[__children[currentIndex - 1]]
|
|
213
232
|
}
|
|
214
233
|
|
|
215
|
-
export
|
|
234
|
+
export function variables (obj = {}) {
|
|
216
235
|
const element = this
|
|
217
236
|
if (!element.data) element.data = {}
|
|
218
237
|
if (!element.data.varCaches) element.data.varCaches = {}
|
|
@@ -263,10 +282,13 @@ export const METHODS = [
|
|
|
263
282
|
'variables',
|
|
264
283
|
'if',
|
|
265
284
|
'log',
|
|
285
|
+
'verbose',
|
|
286
|
+
'warn',
|
|
287
|
+
'error',
|
|
266
288
|
'nextElement',
|
|
267
289
|
'previousElement'
|
|
268
290
|
]
|
|
269
291
|
|
|
270
|
-
export
|
|
292
|
+
export function isMethod (param, element) {
|
|
271
293
|
return METHODS.includes(param) || element?.context?.methods?.[param]
|
|
272
294
|
}
|
package/methods/set.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { isDevelopment, merge } from '@domql/utils'
|
|
3
|
+
import { isDevelopment, merge, overwrite } from '@domql/utils'
|
|
4
4
|
|
|
5
5
|
import set, { reset } from '../set'
|
|
6
6
|
import update from '../update'
|
|
@@ -14,6 +14,9 @@ import {
|
|
|
14
14
|
remove,
|
|
15
15
|
spotByPath,
|
|
16
16
|
log,
|
|
17
|
+
verbose,
|
|
18
|
+
warn,
|
|
19
|
+
error,
|
|
17
20
|
variables,
|
|
18
21
|
keys,
|
|
19
22
|
parse,
|
|
@@ -24,7 +27,7 @@ import {
|
|
|
24
27
|
|
|
25
28
|
import { removeContent, updateContent } from '../mixins/content'
|
|
26
29
|
|
|
27
|
-
export const addMethods = (element, parent, options) => {
|
|
30
|
+
export const addMethods = (element, parent, options = {}) => {
|
|
28
31
|
const proto = {
|
|
29
32
|
set,
|
|
30
33
|
reset,
|
|
@@ -45,7 +48,12 @@ export const addMethods = (element, parent, options) => {
|
|
|
45
48
|
nextElement,
|
|
46
49
|
previousElement
|
|
47
50
|
}
|
|
48
|
-
if (element.context.methods) merge(proto, element.context.methods)
|
|
49
|
-
if (isDevelopment())
|
|
51
|
+
if (element.context.methods) (options.strict ? merge : overwrite)(proto, element.context.methods)
|
|
52
|
+
if (isDevelopment()) {
|
|
53
|
+
proto.log = log
|
|
54
|
+
proto.verbose = verbose
|
|
55
|
+
proto.warn = warn
|
|
56
|
+
proto.error = error
|
|
57
|
+
}
|
|
50
58
|
Object.setPrototypeOf(element, proto)
|
|
51
59
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.147",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "index.js",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"prepublish": "rimraf -I dist && yarn build && yarn copy:package:cjs"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@domql/event": "^2.5.
|
|
30
|
-
"@domql/render": "^2.5.
|
|
31
|
-
"@domql/state": "^2.5.
|
|
32
|
-
"@domql/utils": "^2.5.
|
|
29
|
+
"@domql/event": "^2.5.147",
|
|
30
|
+
"@domql/render": "^2.5.147",
|
|
31
|
+
"@domql/state": "^2.5.147",
|
|
32
|
+
"@domql/utils": "^2.5.147"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "51d1a003e3d4eae96daa9eeed10e63bde2152f9d",
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/core": "^7.12.0"
|
|
37
37
|
}
|
package/update.js
CHANGED
|
@@ -80,7 +80,7 @@ const update = function (params = {}, opts) {
|
|
|
80
80
|
if (beforeUpdateReturns === false) return element
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
overwriteDeep(element, params, METHODS_EXL)
|
|
83
|
+
overwriteDeep(element, params, { exclude: METHODS_EXL })
|
|
84
84
|
throughExecProps(element)
|
|
85
85
|
throughUpdatedExec(element, { ignore: UPDATE_DEFAULT_OPTIONS })
|
|
86
86
|
throughUpdatedDefine(element)
|
|
@@ -312,7 +312,7 @@ const createStateUpdate = (element, parent, options) => {
|
|
|
312
312
|
export default update
|
|
313
313
|
|
|
314
314
|
// save updates history
|
|
315
|
-
// const overwriteChanges = overwriteDeep(element, params, METHODS_EXL)
|
|
315
|
+
// const overwriteChanges = overwriteDeep(element, params, { exclude: METHODS_EXL })
|
|
316
316
|
// // const overwriteChanges = overwriteDeep(element, params)
|
|
317
317
|
// const propsChanges = throughExecProps(element)
|
|
318
318
|
// const execChanges = throughUpdatedExec(element, { ignore: UPDATE_DEFAULT_OPTIONS })
|