@domql/element 3.6.3 → 3.6.6
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 +57 -1
- package/children.js +53 -17
- package/create.js +3 -0
- package/dist/cjs/children.js +33 -11
- package/dist/cjs/create.js +2 -0
- package/dist/cjs/methods/set.js +2 -0
- package/dist/cjs/mixins/registry.js +1 -0
- package/dist/cjs/update.js +5 -13
- package/dist/esm/children.js +35 -11
- package/dist/esm/create.js +2 -0
- package/dist/esm/methods/set.js +4 -0
- package/dist/esm/mixins/registry.js +1 -0
- package/dist/esm/update.js +5 -14
- package/dist/iife/index.js +3288 -1597
- package/methods/set.js +4 -0
- package/mixins/registry.js +1 -1
- package/package.json +5 -5
- package/update.js +7 -20
package/methods/set.js
CHANGED
|
@@ -9,7 +9,9 @@ import {
|
|
|
9
9
|
call,
|
|
10
10
|
error,
|
|
11
11
|
getContext,
|
|
12
|
+
getDB,
|
|
12
13
|
getPath,
|
|
14
|
+
getQuery,
|
|
13
15
|
getRef,
|
|
14
16
|
getRoot,
|
|
15
17
|
getRootContext,
|
|
@@ -47,7 +49,9 @@ export const addMethods = (element, parent, options = {}) => {
|
|
|
47
49
|
lookdown,
|
|
48
50
|
lookdownAll,
|
|
49
51
|
getRef,
|
|
52
|
+
getDB,
|
|
50
53
|
getPath,
|
|
54
|
+
getQuery,
|
|
51
55
|
getRootState,
|
|
52
56
|
getRoot,
|
|
53
57
|
getRootData,
|
package/mixins/registry.js
CHANGED
|
@@ -8,7 +8,6 @@ import scope from './scope.js'
|
|
|
8
8
|
import state from './state.js'
|
|
9
9
|
import style from './style.js'
|
|
10
10
|
import text from './text.js'
|
|
11
|
-
|
|
12
11
|
export const REGISTRY = {
|
|
13
12
|
attr,
|
|
14
13
|
style,
|
|
@@ -18,6 +17,7 @@ export const REGISTRY = {
|
|
|
18
17
|
classlist: classList,
|
|
19
18
|
state,
|
|
20
19
|
scope,
|
|
20
|
+
fetch: {},
|
|
21
21
|
deps: (param, el) => param || el.parent.deps,
|
|
22
22
|
|
|
23
23
|
extends: {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"build:iife": "cross-env NODE_ENV=$NODE_ENV esbuild index.js --bundle --target=es2020 --format=iife --global-name=DomqlElement --outfile=dist/iife/index.js --define:process.env.NODE_ENV=process.env.NODE_ENV"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@domql/report": "^3.6.
|
|
50
|
-
"@domql/state": "^3.6.
|
|
51
|
-
"@domql/utils": "^3.6.
|
|
52
|
-
"attrs-in-props": "^3.6.
|
|
49
|
+
"@domql/report": "^3.6.6",
|
|
50
|
+
"@domql/state": "^3.6.6",
|
|
51
|
+
"@domql/utils": "^3.6.6",
|
|
52
|
+
"attrs-in-props": "^3.6.6"
|
|
53
53
|
},
|
|
54
54
|
"gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
|
|
55
55
|
"devDependencies": {
|
package/update.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
window,
|
|
5
|
-
exec,
|
|
6
5
|
isArray,
|
|
7
6
|
isFunction,
|
|
8
7
|
isNumber,
|
|
@@ -286,6 +285,11 @@ export const update = function (params = {}, opts) {
|
|
|
286
285
|
if (!preventUpdateListener && !options.preventListeners) {
|
|
287
286
|
triggerEventOn('update', element, options)
|
|
288
287
|
}
|
|
288
|
+
|
|
289
|
+
// Trigger fetch on stateChange if configured (bound by define-level fetch handler)
|
|
290
|
+
if (!options.preventFetch && ref.__fetchOnStateChange) {
|
|
291
|
+
ref.__fetchOnStateChange()
|
|
292
|
+
}
|
|
289
293
|
}
|
|
290
294
|
|
|
291
295
|
const findSiblingAttachOptions = (element, parent) => {
|
|
@@ -402,8 +406,6 @@ const checkIfOnUpdate = (element, parent, options) => {
|
|
|
402
406
|
* @param {Object} options - Configuration options for state update inheritance.
|
|
403
407
|
* @param {boolean} [options.preventUpdateTriggerStateUpdate] - If true, prevent triggering state updates.
|
|
404
408
|
* @param {boolean} [options.isHoisted] - Whether the state is hoisted.
|
|
405
|
-
* @param {boolean} [options.execStateFunction] - Execute the state functions.
|
|
406
|
-
* @param {boolean} [options.stateFunctionOverwrite] - If true, overwrite (not merge) current state with what function returns.
|
|
407
409
|
* @param {boolean} [options.preventInheritedStateUpdate] - If true, prevent inheriting state updates.
|
|
408
410
|
* @param {boolean} [options.preventBeforeStateUpdateListener] - If true, prevent the 'beforeStateUpdate' event listener.
|
|
409
411
|
* @param {boolean} [options.preventStateUpdateListener] - If true, prevent the 'stateUpdate' event listener.
|
|
@@ -412,9 +414,8 @@ const checkIfOnUpdate = (element, parent, options) => {
|
|
|
412
414
|
const inheritStateUpdates = (element, options) => {
|
|
413
415
|
const { __ref: ref } = element
|
|
414
416
|
const stateKey = ref.__state
|
|
415
|
-
const { parent
|
|
416
|
-
const { preventUpdateTriggerStateUpdate
|
|
417
|
-
options
|
|
417
|
+
const { parent } = element
|
|
418
|
+
const { preventUpdateTriggerStateUpdate } = options
|
|
418
419
|
|
|
419
420
|
if (preventUpdateTriggerStateUpdate) return
|
|
420
421
|
|
|
@@ -424,20 +425,6 @@ const inheritStateUpdates = (element, options) => {
|
|
|
424
425
|
return
|
|
425
426
|
}
|
|
426
427
|
|
|
427
|
-
// If state is function, decide execution and apply setting a current state
|
|
428
|
-
const shouldForceFunctionState =
|
|
429
|
-
isFunction(stateKey) && !isHoisted && execStateFunction
|
|
430
|
-
if (shouldForceFunctionState) {
|
|
431
|
-
const execState = exec(stateKey, element)
|
|
432
|
-
state.set(execState, {
|
|
433
|
-
...options,
|
|
434
|
-
preventUpdate: true,
|
|
435
|
-
preventStateUpdateListener: false,
|
|
436
|
-
updatedByStateFunction: true
|
|
437
|
-
})
|
|
438
|
-
return
|
|
439
|
-
}
|
|
440
|
-
|
|
441
428
|
// If state is string, find its value in the state tree
|
|
442
429
|
const keyInParentState = findInheritedState(element, element.parent)
|
|
443
430
|
if (!keyInParentState || options.preventInheritedStateUpdate) return
|